Repository: fable-elmish/elmish Branch: v5.x Commit: 2f2312b78240 Files: 50 Total size: 133.1 KB Directory structure: gitextract_g05siaj6/ ├── .gitattributes ├── .github/ │ ├── CONTRIBUTING.md │ ├── ISSUE_TEMPLATE.md │ └── workflows/ │ ├── ci.yml │ └── publish.yml ├── .gitignore ├── .nacara/ │ └── _partials/ │ └── footer.js ├── .npmrc ├── .vscode/ │ ├── settings.json │ └── tasks.json ├── Elmish.slnx ├── LICENSE.md ├── README.md ├── RELEASE_NOTES.md ├── appveyor.yml ├── babel.config.json ├── build.fsx ├── docs/ │ ├── _partials/ │ │ └── footer.jsx │ ├── docs/ │ │ ├── basics.fsx │ │ ├── menu.json │ │ ├── parent-child.fsx │ │ ├── subscription.fsx │ │ └── subscriptionv3.fsx │ ├── index.md │ ├── release_notes.md │ ├── scss/ │ │ └── fable-font.scss │ ├── static/ │ │ └── img/ │ │ ├── commands.wsd │ │ ├── flow.wsd │ │ └── parent-child.wsd │ └── style.scss ├── global.json ├── nacara.config.json ├── netstandard/ │ └── Elmish.fsproj ├── package.json ├── src/ │ ├── Fable.Elmish.fsproj │ ├── cmd.fs │ ├── cmd.obsolete.fs │ ├── prelude.fs │ ├── program.fs │ ├── ring.fs │ └── sub.fs ├── tests/ │ ├── Attributes.fs │ ├── CmdTests.fs │ ├── Elmish.Tests.fsproj │ ├── ProgramTest.fs │ ├── RingTest.fs │ └── SubTests.fs └── websharper/ ├── WebSharper.Elmish.fsproj ├── prelude.fs └── wsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ * text=auto ================================================ FILE: .github/CONTRIBUTING.md ================================================ ### Contributor guidelines First of all - thanks for taking the time to contribute! With that in mind, elmish is a young project and as such while we welcome the contributions from non-member there are certain things we'd like to get more right than fast. To make everyone's experience as enjoyable as possible please keep the following things in mind: * Unless it's a trivial fix, consider opening an issue first to discuss it with the team. * If you are just looking for something to take on, check the [help wanted](/elmish/elmish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) labeled items ### Opening an Issue * Before you do, please check if there's a known work around, existing issue or already a work in progress to address it. * If you just don't know how to do something consider asking in the gitter, there are always helpful people around. * Provide as much info as possible - follow the template if it makes sense, attach screenshots or logs if applicable. ### Pull requests To make it easier to review the changes and get you code into the repo keep the commit history clean: * [rebase your pulls](https://coderwall.com/p/tnoiug/rebase-by-default-when-doing-git-pull) on the latest from repo * only push the commits relevant to the PR * consider [squashing](https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history) multiple commits to keep the history clean (you *can* force push to your fork!) If adding a feature, also consider adding a sample (or link to one). ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ ### Description Please provide a succinct description of your issue. ### Repro code Please provide the F# code to reproduce the problem. Ideally, it should be possibe to easily turn this code into a unit test. ### Expected and actual results Please provide the expected and actual results. ### Related information * elmish version: * fable-compiler version: * fable-core version: * Operating system: ================================================ FILE: .github/workflows/ci.yml ================================================ name: .NET on: push: branches: [ v4.x ] pull_request: branches: [ v4.x ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: global-json-file: global.json - name: Build run: ./build.fsx ================================================ FILE: .github/workflows/publish.yml ================================================ name: Publish on: push: branches: - v4.x workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: global-json-file: global.json - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '16' - name: Install and use custom npm version run: npm i -g npm@7 - name: Install NPM dependencies run: npm install - name: Build site run: ./build.fsx -t GenerateDocs - name: Deploy site uses: peaceiris/actions-gh-pages@v4 with: personal_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs_deploy ================================================ FILE: .gitignore ================================================ # OSX # .DS_Store # node.js # **/node_modules/ **/npm/ npm-debug.log # F# .fake/ packages/ build/ obj bin out # git *.orig .vs *.log docs/output docs/temp Directory.Build.props temp paket-files .ionide docs_deploy/ ================================================ FILE: .nacara/_partials/footer.js ================================================ import React from 'react'; const SitemapSection = ({ title, children }) => /*#__PURE__*/React.createElement("div", { className: "sitemap-section" }, /*#__PURE__*/React.createElement("div", { className: "sitemap-section-title" }, title), /*#__PURE__*/React.createElement("ul", { className: "sitemap-section-list" }, children)); const SitemapSectionItem = ({ text, icon, url }) => /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", { href: url, className: "icon-text sitemap-section-list-item" }, /*#__PURE__*/React.createElement("span", { className: "icon" }, /*#__PURE__*/React.createElement("i", { className: icon })), /*#__PURE__*/React.createElement("span", { className: "sitemap-section-list-item-text" }, text))); const CopyrightScript = () => /*#__PURE__*/React.createElement("script", { dangerouslySetInnerHTML: { __html: ` const year = new Date().getFullYear(); document.getElementById('copyright-end-year').innerHTML = year; ` } }); export default /*#__PURE__*/React.createElement("div", { className: "is-size-5" }, /*#__PURE__*/React.createElement("div", { className: "sitemap" }, /*#__PURE__*/React.createElement(SitemapSection, { title: "Project ressources" }, /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Repository", icon: "fas fa-file-code", url: "https://github.com/elmish/elmish" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Release notes", icon: "fas fa-list", url: "/elmish/release_notes.html" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "License", icon: "fas fa-id-card", url: "https://github.com/elmish/elmish/blob/v4.x/LICENSE.md" })), /*#__PURE__*/React.createElement(SitemapSection, { title: "Elmish modules" }, /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish", icon: "fa fa-book", url: "https://elmish.github.io/elmish/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish.Browser", icon: "fa fa-book", url: "https://elmish.github.io/browser/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish.UrlParser", icon: "fa fa-book", url: "https://elmish.github.io/urlParser/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish.Debugger", icon: "fa fa-book", url: "https://elmish.github.io/debugger/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish.React", icon: "fa fa-book", url: "https://elmish.github.io/react/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable.Elmish.HMR", icon: "fa fa-book", url: "https://elmish.github.io/hmr/" })), /*#__PURE__*/React.createElement(SitemapSection, { title: "Other Links" }, /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable", icon: "faf faf-fable", url: "https://fable.io" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "Fable Gitter", icon: "fab fa-gitter", url: "https://gitter.im/fable-compiler/Fable" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "F# Slack", icon: "fab fa-slack", url: "https://fsharp.org/guides/slack/" }), /*#__PURE__*/React.createElement(SitemapSectionItem, { text: "F# Software Foundation", icon: "faf faf-fsharp-org", url: "https://fsharp.org/" }))), /*#__PURE__*/React.createElement("p", { className: "has-text-centered" }, "Built with ", /*#__PURE__*/React.createElement("a", { className: "is-underlined", href: "https://mangelmaxime.github.io/Nacara/" }, "Nacara")), /*#__PURE__*/React.createElement("p", { className: "has-text-centered mt-2" }, "Copyright \xA9 2021-", /*#__PURE__*/React.createElement("span", { id: "copyright-end-year" }), " Elmish contributors."), /*#__PURE__*/React.createElement(CopyrightScript, null)); ================================================ FILE: .npmrc ================================================ engine-strict=true ================================================ FILE: .vscode/settings.json ================================================ { "plantuml.exportOutDir": "docs/files/img", "plantuml.diagramsRoot": "docs/content", "plantuml.exportSubFolder": false } ================================================ FILE: .vscode/tasks.json ================================================ { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "build", "command": "dotnet", "type": "shell", "args": [ "build", "netstandard", // Ask dotnet build to generate full paths for file names. "/property:GenerateFullPaths=true", // Do not generate summary otherwise it leads to duplicate errors in Problems panel "/consoleloggerparameters:NoSummary" ], "group": "build", "presentation": { "reveal": "silent" }, "problemMatcher": "$msCompile" } ] } ================================================ FILE: Elmish.slnx ================================================ ================================================ FILE: LICENSE.md ================================================ Copyright 2016-2020 elmish contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ Elmish: Elm-like abstractions for F# applications. ======= [![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/fable-compiler/Fable) [![Windows Build status](https://ci.appveyor.com/api/projects/status/c8k7a67evgci6ama/branch/v4.x?svg=true)](https://ci.appveyor.com/project/et1975/elmish/branch/v4.x) [![NuGet version](https://badge.fury.io/nu/Fable.Elmish.svg)](https://badge.fury.io/nu/Fable.Elmish) Elmish implements core abstractions that can be used to build applications following the “model view update” style of architecture, as made famous by Elm. The library however does not model any "view" and is intended for use in conjuction with a DOM/renderer, like React/ReactNative or VirtualDOM. Those familiar with Redux may find Elmish a more natural fit when targeting React or ReactNative as it allows one to stay completely in idiomatic F#. Elmish abstractions have been carefully designed to resemble Elm's "look and feel" and anyone familiar with post-Signal Elm terminology will find themselves right at home. See the [docs site](https://elmish.github.io/elmish/) for more information. Using Elmish ------ v2.0 and above releases use `dotnet` SDK and can be installed with `dotnet nuget` or `paket`: For use in a Fable project: `paket add nuget Fable.Elmish -i` For use in a WebSharper project: `paket add nuget WebSharper.Elmish -i` If targeting CLR, please use Elmish package: `paket add nuget Elmish -i` For v1.x release information please see the [v1.x branch](https://github.com/elmish/elmish/tree/v1.x) For v2.x release information please see the [v2.x branch](https://github.com/elmish/elmish/tree/v2.x) For v3.x release information please see the [v3.x branch](https://github.com/elmish/elmish/tree/v3.x) For v4.x release information please see the [v3.x branch](https://github.com/elmish/elmish/tree/v4.x) Building Elmish ------ Elmish depends on [dotnet SDK 8](https://www.microsoft.com/net/download/core): * `dotnet fsi build.fsx` or `./build.fsx` on a *nix system. Contributing ------ Please have a look at the [guidelines](https://github.com/elmish/elmish/blob/master/.github/CONTRIBUTING.md). ================================================ FILE: RELEASE_NOTES.md ================================================ ## 5.0.2 * Fix: OfTask.attempt signature ## 5.0.1 * Fix: Conditions around ValueTask for target platforms ## 5.0.0 * Implement native support for Task and ValueTask by (@xperiandri) (#303) ## 4.3.0 * CE Cmds handle more exceptions (#300) ## 4.2.0 * reintroduce try/catch in the dispatch loop ## 4.1.0 * Reverse order of subs and cmds evaluation [#66](https://github.com/elmish/browser/issues/66) ## 4.0.2 * Loosen the tasks contraint when we don't care about the result (#277). ## 4.0.1 * Elmish targeting .NET runtime was imposing v6 FSharp.Core despite 4.7 being the reference (#267), thanks @JordanMarr. ## 4.0.0 * Breaking: `withSubscription` replaces existing subscription, use `mapSubscription` to add/accumulate the subscribers * Obsolete all `Cmd.xxx.result` functions * Breaking: subs receive current model, automatically started/stopped as needed (#248), thanks Kasey Speakman! ## 4.0.0-beta-6 * WebSharper support by @granicz (Adam Granicz) ## 4.0.0-beta-5 * Breaking: subs receive current model, automatically started/stopped as needed (#248), thanks Kasey Speakman! ## 4.0.0-beta-4 * Move to .NET 6 SDK * Breaking: dropping .NET 4.6.1 as the target ## 4.0.0-beta-3 * Breaking: `withSubscription` replaces existing subscription, use `mapSubscription` to add/accumulate the subscribers ## 4.0.0-beta-2 * Obsolete all `Cmd.xxx.result` functions ## 4.0.0-beta-1 * Move to .NET 5 SDK * Deferring `Cmd` and `Sub` changes to v5 * For end-user compatibility with v3 keep `Program.runWith` signature and introduce `Program.runWithDispatch` to allow for multi-threaded sync function. ## 4.0.0-alpha-2 * Changing `Cmd` and `Sub` aliases to DUs * Changing `ofSub` to take the error mapper * Dropping netstandard1.6 from Elmish (for CLR) targets ## 4.0.0-alpha-1 * Adding termination * Moving `syncDispatch` into `runWith` args ## 3.1.0 * Changing Cmd.OfAsync/OfAsyncImmediate `result` implementation to allow exceptions to escape into the dispatch loop. ## 3.0.6 * Changing Cmd.OfAsync implementations to start via 0-interval StartImmediate to mimic .NET behavior ## 3.0.5 * Changing Cmd.OfAsync implementations to start on thread pool to restore v2.x experience * Adding Cmd.OfAsyncImmediate implementations * Adding Cmd.OfAsyncWith for custom async start implementations ## 3.0.4 * Access to `Program`'s error handler ## 3.0.3 * Reordering: call `trace` with updated state ## 3.0.1 * Bugfix for ring resizing ## 3.0.0 * Releasing stable 3.0 ## 3.0.0-beta-8 * Making `Program` type opaque and reorganizing `Cmd` functions ## 3.0.0-beta-5 * Fable 3 conversion courtesy of Alfonso ## 3.0.0-beta-4 * Ditching PowerPack in favour of Fable.Promise ## 3.0.0-beta-2 * Ditching MailboxProcessor ## 2.0.3 * Adding `Cmd.ofTask` for netstandard ## 2.0.1 * Adding `Cmd.exec` ## 2.0.0 * Stable release ## 2.0.0-beta-4 * re-releasing v1.x for Fable2 ## 1.0.3 * re-releasing with azure-functions compatible FSharp.Core dependency ## 1.0.2 * backporting CLR (platform) support ## 1.0.1 * handle exceptions raising from initial subscription ## 1.0.0 * dotnet 2.0 SDK build ## 0.9.2 * `withErrorHandler` modifier * cumulative `withSubscription` ## 0.9.1 * packaging fix: Console.WriteLine replaced with console, as commited * Fable 1.1.3 dependency ## 0.9.0 * Releasing using fable 1.x "stable" * Console tracing from @forki ## 0.9.0-beta-9 * Paket! ## 0.9.0-beta-7 * standalone package repo ## 0.9.0-beta-5 * BREAKING: Moved browser-specific stuff (navigation, urlparser) to elmish-browser ## 0.8.2 * Stricter signatures ## 0.8.1 * Browser navigation: working around IE11/Edge lack of `popstate` event ## 0.8.0 * Expanding `Program` to accommodate plugabble error reporting ## 0.7.2 * Fable dev tools bump ## 0.7.1 * Stable release ## 0.7.1-alpha.3 * Update dependencies ## 0.7.1-alpha.2 * Rearranging `Program` API to prepare for debugger ## 0.7.0-alpha.4 * Update README ## 0.7.0-alpha.3 * Update libraries ## 0.7.0-alpha.2 * Move Promise extensions to `Elmish.Cmd` module ## 0.7.0-alpha.1 * Migrate to Fable 0.7 ================================================ FILE: appveyor.yml ================================================ image: Visual Studio 2022 install: - ps: Install-Product node 17 x64 build_script: - cmd: dotnet fsi build.fsx cache: - "%LOCALAPPDATA%\\Yarn" ================================================ FILE: babel.config.json ================================================ { "presets": [ "@babel/preset-react" ] } ================================================ FILE: build.fsx ================================================ #!/usr/bin/env -S dotnet fsi #r "nuget: Fake.Core.Target, 5.23.1" #r "nuget: Fake.IO.FileSystem, 5.23.1" #r "nuget: Fake.DotNet.Cli, 5.23.1" #r "nuget: Fake.Core.Target, 5.23.1" #r "nuget: Fake.Core.ReleaseNotes, 5.23.1" #r "nuget: Fake.Tools.Git, 5.23.1" #r "nuget: MSBuild.StructuredLogger, 2.2.441" open Fake.Core open Fake.Core.TargetOperators open Fake.DotNet open Fake.Tools open Fake.IO open Fake.IO.FileSystemOperators open Fake.IO.Globbing.Operators open System open System.IO // Filesets let projects = !! "src/**.fsproj" ++ "netstandard/**.fsproj" ++ "websharper/**.fsproj" System.Environment.GetCommandLineArgs() |> Array.skip 2 // fsi.exe; build.fsx |> Array.toList |> Context.FakeExecutionContext.Create false __SOURCE_FILE__ |> Context.RuntimeContext.Fake |> Context.setExecutionContext Target.create "Clean" (fun _ -> Shell.cleanDir "src/obj" Shell.cleanDir "src/bin" Shell.cleanDir "netstandard/obj" Shell.cleanDir "netstandard/bin" Shell.cleanDir "websharper/obj" Shell.cleanDir "websharper/bin" ) Target.create "Restore" (fun _ -> projects |> Seq.iter (Path.GetDirectoryName >> DotNet.restore id) ) Target.create "Build" (fun _ -> projects |> Seq.iter (Path.GetDirectoryName >> DotNet.build id) ) Target.create "Test" (fun _ -> DotNet.test (fun a -> a.WithCommon id) "tests" ) let release = ReleaseNotes.load "RELEASE_NOTES.md" Target.create "Meta" (fun _ -> [ "" "" "" "" "" "" "true" "$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb" "https://github.com/elmish/elmish" "Apache-2.0" "https://raw.githubusercontent.com/elmish/elmish/master/docs/files/img/logo.png" "logo.png" "https://github.com/elmish/elmish.git" sprintf "%s" (List.head release.Notes) "MVU;fsharp" "Eugene Tolmachev" sprintf "%s" (string release.SemVer) "" ""] |> File.write false "Directory.Build.props" ) // -------------------------------------------------------------------------------------- // Build a NuGet package Target.create "Package" (fun _ -> projects |> Seq.iter (Path.GetDirectoryName >> DotNet.pack id) ) Target.create "PublishNuget" (fun _ -> let exec dir = DotNet.exec (DotNet.Options.withWorkingDirectory dir) let args = sprintf "push Fable.Elmish.%s.nupkg -s nuget.org -k %s" (string release.SemVer) (Environment.environVar "nugetkey") let result = exec "src/bin/Release" "nuget" args if (not result.OK) then failwithf "%A" result.Errors let args = sprintf "push WebSharper.Elmish.%s.nupkg -s nuget.org -k %s" (string release.SemVer) (Environment.environVar "nugetkey") let result = exec "websharper/bin/Release" "nuget" args if (not result.OK) then failwithf "%A" result.Errors let args = sprintf "push Elmish.%s.nupkg -s nuget.org -k %s" (string release.SemVer) (Environment.environVar "nugetkey") let result = exec "netstandard/bin/Release" "nuget" args if (not result.OK) then failwithf "%A" result.Errors ) // -------------------------------------------------------------------------------------- // Generate the documentation Target.create "GenerateDocs" (fun _ -> let res = Shell.Exec("npm", "run docs:build") if res <> 0 then failwithf "Failed to generate docs" ) Target.create "WatchDocs" (fun _ -> let res = Shell.Exec("npm", "run docs:watch") if res <> 0 then failwithf "Failed to watch docs: %d" res ) // -------------------------------------------------------------------------------------- // Release Scripts Target.create "ReleaseDocs" (fun _ -> let res = Shell.Exec("npm", "run docs:publish") if res <> 0 then failwithf "Failed to publish docs: %d" res ) Target.create "Publish" ignore // Build order "Clean" ==> "Meta" ==> "Restore" ==> "Build" ==> "Test" ==> "Package" ==> "PublishNuget" ==> "Publish" // start build Target.runOrDefault "Test" ================================================ FILE: docs/_partials/footer.jsx ================================================ import React from 'react'; const SitemapSection = ({ title, children }) => (
{title}
) const SitemapSectionItem = ({ text, icon, url }) => (
  • {text}
  • ) const CopyrightScript = () => (