Personal patched build of slaveOftime/Fun.Blazor
  • F# 97.5%
  • CSS 2%
  • Shell 0.4%
Find a file
Ivan The Geek a35676a764
All checks were successful
Publish dev package / publish (push) Successful in 1m45s
Merge chore/infra-cleanup: build-system alignment (3 tasks)
- ./build: NUGET_XMLDOC_MODE=none so first-time restores keep shipped XML
  (689c).
- IsPackable=false on Docs.Server/Docs.Wasm/Benchmark/CSharpComponents;
  removed 5 upstream GitHub Actions workflows (9400).
- Trimmed build.fsx to local-dev orchestration (dev/docs/bindings/
  benchmark + version-stamp); dropped the broken `test` + ./build-owned
  `packages` pipelines (697b).

No shipped library code changed. Closes Tasks 019e79ff-689c,
019e7aae-9400, 019e7aae-697b.
2026-05-31 23:20:51 -04:00
.claude chore: align repo with NEXUS agent-files and git hooks 2026-05-29 22:37:41 -04:00
.config chore: add ./build coverage (coverlet.console, report-only) + tool manifest 2026-05-31 10:00:42 -04:00
.forgejo/workflows test: add on-demand Playwright browser E2E for typed DOM events 2026-05-31 15:08:50 -04:00
.vscode Init HtmlTemplate project 2021-12-08 21:46:42 +08:00
Benchmark chore: mark non-shipped projects IsPackable=false; remove GH Actions 2026-05-31 23:15:05 -04:00
Bindings chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
data/html-spec feature: pin Blazor event registry + webref element-event specs 2026-05-31 01:23:18 -04:00
Docs Update bindings 2026-01-08 10:43:26 +08:00
e2e test: add on-demand Playwright browser E2E for typed DOM events 2026-05-31 15:08:50 -04:00
Fun.Blazor fix: drop NRE-as-control-flow on query-less routes (use ParseQuery) 2026-05-31 22:25:00 -04:00
Fun.Blazor.Cli chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.CustomElements chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.Docs.Server chore: mark non-shipped projects IsPackable=false; remove GH Actions 2026-05-31 23:15:05 -04:00
Fun.Blazor.Docs.Wasm chore: mark non-shipped projects IsPackable=false; remove GH Actions 2026-05-31 23:15:05 -04:00
Fun.Blazor.Elmish chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.Generator chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.HotReload chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.HtmlTemplate chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.Reactive chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.Server chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Blazor.Tests test: cover Fun.Htmx.NativeJs JS-snippet generators (was 0%) 2026-05-31 22:52:41 -04:00
Fun.Blazor.Wasm chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
Fun.Htmx chore: target net10.0 only across the library (drop net8.0 + net9.0) 2026-05-31 12:05:50 -04:00
scripts fix: preserve custom EventArgs under trimming; emit them at namespace level 2026-05-31 01:54:52 -04:00
.build-image chore: adopt NEXUS containerized ./build (pinned SDK + lockfiles) 2026-05-30 14:37:25 -04:00
.editorconfig Refactor 2022-03-18 10:01:24 +08:00
.gitignore test: add on-demand Playwright browser E2E for typed DOM events 2026-05-31 15:08:50 -04:00
AGENTS.md chore: run Forgejo CI as direct dotnet on the pinned-SDK runner 2026-05-30 17:41:25 -04:00
AGENTS.source.md docs: update Target-frameworks note to net10-only (regen source) 2026-05-31 12:07:11 -04:00
build chore: set NUGET_XMLDOC_MODE=none in ./build to keep shipped XML 2026-05-31 23:12:55 -04:00
build.fsx chore: trim build.fsx -- drop broken test + ./build-owned pack pipelines 2026-05-31 23:18:54 -04:00
CHANGELOG.md Fork: initial overlay baseline for IvanTheGeek distribution 2026-05-12 16:25:07 -04:00
CLAUDE.md chore: align repo with NEXUS agent-files and git hooks 2026-05-29 22:37:41 -04:00
crawler.fsx refactor: strip crawler.fsx to just the htmx pipeline 2026-05-30 20:49:02 -04:00
Directory.Build.props chore: adopt NEXUS containerized ./build (pinned SDK + lockfiles) 2026-05-30 14:37:25 -04:00
docs.fsx Update packages 2024-01-29 13:43:08 +08:00
Fun.Blazor.sln Update tests 2024-10-21 16:38:51 +08:00
global.json chore: adopt NEXUS containerized ./build (pinned SDK + lockfiles) 2026-05-30 14:37:25 -04:00
LICENSE Create LICENSE 2022-05-26 13:33:04 +08:00
nuget.config Overlay 4.1.10-IvanTheGeek.3: switch transitive Fun.Css to IvanTheGeek fork 2026-05-14 14:11:16 -04:00
README.md Overlay 4.1.10-IvanTheGeek.5: document open Fun.Css requirement 2026-05-14 18:36:48 -04:00
THIRD-PARTY-NOTICES.md feature: regenerate HTML element bindings from authoritative sources 2026-05-30 19:16:56 -04:00
WORK-PLAN.md WORK-PLAN: mark .4 publish + contribution plan updates complete 2026-05-14 16:44:28 -04:00

Fun.Blazor Nuget

Patched build of slaveOftime/Fun.Blazor distributed via Forgejo. Tracks upstream master with overlay-fork fixes pending upstream merge.

Upstream sources (click through to view on GitHub):

See CHANGELOG.md for the patches included on top of upstream.

image

This is a project to make F# developer to write blazor easier.

  1. Use F# ❤️😊 for blazor
  2. Computation expression (CE) style DSL for internal and third party blazor libraries
  3. Dependency injection (html.inject)
  4. Adaptive model (adaptiview/AdaptivieForm) (recommend), elmish model (html.elmish)
  5. Giraffe style routing (html.route/blazor official style)
  6. Type safe css style (Fun.Css)
  7. Convert html to CE style by Fun.Dev.Tools

Check the WASM Docs for more 🚀

Donation

If you find my projects helpful and would like to support my work, consider making a donation via PayPal. Your support is greatly appreciated!

Start to use

dotnet new install Fun.Blazor.Templates::4.1.1
dotnet new fun-blazor -o FunBlazorDemo1

The template is upgraded to dotnet 9, but you can downgrade it according to your needs.

Code samples

// Functional style
let count = cval 0
let counter (str: string) = section {
    h2 { "Counter: "; str }
    adapt {
        let! count, setCount = count.WithSetter()
        button {
            onclick (fun _ -> setCount (count + 1))
            "Increase "; count
        }
    }
}

// Class style
type CountPage() =
    inherit FunComponent()

    let mutable count = 0

    override _.Render() = main {
        h1 { "Counter Page" }
        p { "hi here" }
        button {
            onclick (fun _ -> count <- count + 1)
            "Increase "; count
        }
        counter "functional style"
    }

Inline styles: open Fun.Css required

When authoring inline styles via style { ... } or ruleset { ... }, add open Fun.Css alongside open Fun.Blazor. Many CSS CustomOperations — color, width, height, backgroundColor, fontSize, borderRadius, cursorPointer, and similar — live in an [<AutoOpen>] module CssBuilderGenerated inside Fun.Css.dll. F#'s computation-expression machinery only discovers those extensions when the Fun.Css namespace is in scope at the consumer site.

open Fun.Blazor
open Fun.Css

let view =
    div {
        style { color "red"; backgroundColor "ivory"; padding 8 }
        "Hello"
    }

Without open Fun.Css, F# emits errors like FS3095: '<op>' is not used correctly. This is a custom operation in this query or computation expression. or FS0039: The value or constructor '<op>' is not defined.

This is a consequence of the IvanTheGeek Fun.Css fork's generator-based packaging. Cross-assembly [<assembly: AutoOpen("Fun.Css")>] on Fun.Blazor was investigated and is non-functional for this purpose — F#'s CE CustomOperation resolution does not honor type extensions reached only via cross-assembly auto-open, so consumers must open Fun.Css explicitly.

Local development

You can run dotnet fsi build.fsx -- -h to check what is available to help you get started.

Benchmark

BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.4317/23H2/2023Update/SunValley3) 12th Gen Intel Core i7-12700H, 1 CPU, 20 logical and 14 physical cores .NET SDK 9.0.100 [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 DEBUG DefaultJob : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2

Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
RenderWithRazorCSharp 247.7 ns 3.80 ns 3.37 ns 1.00 0.02 0.0291 368 B 1.00
RenderWithFunBlazorInlineCE 374.1 ns 5.53 ns 4.91 ns 1.51 0.03 0.0439 552 B 1.50
RenderWithFunBlazorSSRTemplate 475.6 ns 5.78 ns 5.40 ns 1.92 0.03 0.0420 528 B 1.43
RenderWithBolero 497.9 ns 8.46 ns 10.07 ns 2.01 0.05 0.1192 1496 B 4.07
RenderWithFunBlazorArray 525.2 ns 10.44 ns 11.17 ns 2.12 0.05 0.1144 1440 B 3.91
RenderWithFunBlazorTemplate 785.9 ns 7.95 ns 7.44 ns 3.17 0.05 0.1240 1560 B 4.24