{"id":24236901,"url":"https://github.com/maxumka/blazorish","last_synced_at":"2025-09-23T07:31:24.582Z","repository":{"id":144106992,"uuid":"455109423","full_name":"Maxumka/Blazorish","owner":"Maxumka","description":"Naive implementation MVU in blazor inspired by elmish with hello world examples","archived":false,"fork":false,"pushed_at":"2022-11-13T12:39:01.000Z","size":418,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-13T09:38:28.885Z","etag":null,"topics":["blazor","blazor-webassembly","csharp-library","elm-architecture","mvu"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maxumka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-03T09:52:13.000Z","updated_at":"2024-10-01T22:16:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b598dc4b-9b39-408a-9351-1ce237a663bf","html_url":"https://github.com/Maxumka/Blazorish","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FBlazorish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FBlazorish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FBlazorish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FBlazorish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maxumka","download_url":"https://codeload.github.com/Maxumka/Blazorish/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233946091,"owners_count":18755296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor","blazor-webassembly","csharp-library","elm-architecture","mvu"],"created_at":"2025-01-14T19:49:59.066Z","updated_at":"2025-09-23T07:31:19.216Z","avatar_url":"https://github.com/Maxumka.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blazorish\nNaive implementation MVU in Blazor inspired by elmish (without razor syntax). \u003cbr /\u003e\nI want to write applications in C# and Blazor based on model-view-update. If you too, try this. \n# Warning\nIts not production ready, its not ready for anything. I just making this in free time. \u003cbr /\u003e \nJust for fun.\n# Commands \nThe following commands are currently ready:\n* None\n* OfMsg\n* OfFuncEither\n* OfFuncPerform\n* OfTaskEither\n* OfTaskPerform\n# Usage\nJust create class and inherintce BlazorishSimpleComponent, in generic parameters add your model and msg.\nWrite your model, like this\n```csharp\npublic record Model(int Count);\n```\nAnd add your messages \n```csharp\n\npublic abstract record Msg\n{\n    public sealed record Increment : Msg;\n    public sealed record Decrement : Msg;\n    public sealed record Reset : Msg;\n}\n```\nAfter that implement abstract methods: Update, Init and View. \n```csharp\nprotected override Model Init() =\u003e new(0);\n\nprotected override Model Update(Model model, Msg msg) =\u003e msg switch\n{\n    Msg.Increment =\u003e model with {Count = model.Count + 1},\n    Msg.Decrement =\u003e model with {Count = model.Count - 1},\n    _ =\u003e model with {Count = 0}\n};\n\nprotected override Tag View(Model model) =\u003e\n    div(\n        children(\n            h1(\n                content(\"Counter\")\n            ),\n            p(\n                content($\"Current count: {model.Count}\")\n            ),\n            btn(\n                content(\"Increment\"),\n                classes(\"btn btn-primary\"),\n                onclick(_ =\u003e Dispatch(new Msg.Increment()))\n            ),\n            btn(\n                content(\"Decrement\"),\n                classes(\"btn btn-primary\"),\n                onclick(_ =\u003e Dispatch(new Msg.Decrement()))\n            ),\n            btn(\n                content(\"Reset\"),\n                classes(\"btn btn-primary\"),\n                onclick(_ =\u003e Dispatch(new Msg.Reset()))\n            )\n        )\n    );\n```\nAlso add route attribute to your component\n```csharp\n[Route(\"/counter\")]\npublic class CounterComponent : BlazorishSimpleComponent\u003cCounterComponent.Model, CounterComponent.Msg\u003e\n```\nOptional, add static using if you don't want write static class for dsl\n```csharp\nglobal using static Blazorish.Html.Tag;\nglobal using static Blazorish.Html.Attr;\n```\nCongratulations! You create blazor component with MVU architecture.\n\nBlazorish.Samples project has examples based on defaut blazor WASM template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxumka%2Fblazorish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxumka%2Fblazorish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxumka%2Fblazorish/lists"}