Bolero brings Blazor to F# developers with an easy to use Model-View-Update architecture, HTML combinators, hot reloaded templates, type-safe endpoints, advanced routing and remoting capabilities, and more.
APACHE-2.0 License
Bot releases are visible (Hide)
#347 Add Blazor Interactive Render Modes.
IServiceCollection.AddBoleroComponents()
to be called instead of IServiceCollection.AddBoleroHost()
to use interactive render modes.
When that is used, boleroScript
will include blazor.web.js
instead of blazor.server.js
or blazor.webassembly.js
.
BoleroRenderModeAttribute
can be used to indicate the render mode of the component it is applied to.
Alternately, Bolero.Server.Html.attr.renderMode
can be used to indicate the render mode of the component it is applied to.
#279 Re-enable the generation of reference assemblies.
Published by github-actions[bot] 11 months ago
#336 Fix support for scoped CSS in HTML templates.
This fix disables an optimization that keeps part of the template content as plain HTML. A new static parameter optimizePlainHtml: bool
has been added to the type provider to enable this optimization, with the inconvenient of being incompatible with scoped CSS.
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 12 months ago
#308 Add router functions to decide what to do when the URL is invalid.
Router.withNotFound
takes an endpoint to redirect to, and applies to a Router<_, _, _>
(ie. an inferred router).
Router.withNotFoundMsg
takes an Elmish message to send, and applies to any IRouter<_, _>
(including manual routers).
These functions apply when the initial URL is invalid, or when the URL is programmatically changed to be invalid.
They do not apply when the user clicks a link to an invalid URL, in order to allow external links.
#309 Add support for query parameters in inferred routing with EndPointAttribute
.
?paramName={fieldName}
adds query parameter paramName
corresponding to the union field named fieldName
. This parameter is mandatory if fieldName
is a string, boolean or number, and optional if it is an option or voption of these types.
?{paramName}
is short for ?paramName={paramName}
.
#313 Improve C# compatibility of server-side APIs.
For the following extension methods:
IServiceCollection.AddBoleroHost
IServiceCollection.AddBoleroRouting
IEndpointRouteBuilder.MapFallbackToBolero
The following changes are applied:
?argument = optionValue
.Func
or Action
.#315 Support adding hash component to routing URLs:
Manually adding + "#foo"
to a routed URL will correctly scroll to the element named foo
in the target page.
Methods IRouter.Link
and IRouter.HRef
take a new optional argument hash: string
to link to the corresponding #hash
in the target page.
#316 Fix on.stopPropagation
and on.preventDefault
to take event names without the on
prefix, for consistency with on.event
.
#317 Fix .NET 8 compatibility of the MSBuild task for scoped CSS.
#317 Fix .NET 8 compatibility of the server-side rendering of nodes.
#323 Use WheelEventArgs
for wheel events and ErrorEventArgs
for on.error
.
Published by github-actions[bot] over 1 year ago
Published by github-actions[bot] over 1 year ago
Fix generated name of CssScopes.
Published by github-actions[bot] over 1 year ago
Published by github-actions[bot] over 1 year ago
#289 Add endpoint routing for remote services.
Add extension methods IServiceCollection.AddBoleroRemoting()
in Bolero.Server
, with the same overloads as the existing AddRemoting()
, to register remote services for endpoint routing.
Add extension method IEndpointRouteBuilder.MapBoleroRemoting(?buildEndpoint)
that sets up endpoint routing for all registered services.
The function buildEndpoint
configures the endpoint for a given method.
The returned IEndpointConventionBuilder
configures all the endpoints.
Add typed version of IEndpointRouteBuilder.MapBoleroRemoting<_>(?buildEndpoint)
to set up a specific remote service.
Make IServiceCollection.AddRemoting()
and IApplicationBuilder.UseRemoting()
obsolete, and add IServiceCollection.AddBoleroRemoting()
in Bolero.Client
as equivalent of AddRemoting()
.
#280 Add typed version of IServiceCollection.AddBoleroRemoting<_>()
in Bolero.Client
to configure the HttpClient and serialization of a given remote service separately.
#296 Add CSS isolation for Bolero components.
Files ending in .bolero.css
are treated as component-specific styles which can be applied to a component type with the following property:
override _.CssScope = CssScopes.MyApp
where CssScopes
is a compiler-generated module and MyApp
is the name of the style file without .bolero.css
extension.
The MSBuild item BoleroScopedCss
can be used to add component-specific CSS files.
Its metadata ScopeName
determines the name of the corresponding value in the CssScopes
module.
#290 Add support for HTML element references in HTML templates.
In a template, an attribute ref="MyRef"
will generate a method .MyRef()
taking an HtmlRef
as argument.
#269 Add a Zero method to the HTML builders to allow raising exceptions in the body.
Published by github-actions[bot] over 1 year ago
#281: Refine dependency on Microsoft.AspNetCore.Components.WebAssembly based on the framework to reduce compatibility issues.
Published by github-actions[bot] over 1 year ago
#261 Fix prerendering of components inside server-side Bolero.Html.
To instantiate a client-side component inside server-side Bolero.Html, the standard comp<T>
can now be used instead of the dedicated rootComp<T>
.
#275 Add new module Bolero.Server.Components.Rendering
with functions:
renderPlain : Node -> string
renders a node to raw HTML. Blazor components are ignored.
renderPage : Node -> HttpContext -> IHtmlHelper -> IBoleroHostConfig -> string
also renders a node to raw HTML. Blazor components are rendered according to the given host config.
#279 Bolero.Build: Disable the production of a reference assembly.
#285 Fix typed component builders so that nested components aren't forced to have the same type.
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Key
type; attr.key
now returns a simple Attr
.Published by github-actions[bot] over 2 years ago
Upgrade dependency to .NET 6.
#249 Replace the list-based functions for HTML and components with computation expressions:
div {
"Welcome to "
navLink NavLinkMatch.All {
attr.href "https://fsbolero.io"
on.click (fun _ -> printfn "Clicked!")
b { "Bolero" }
}
"!"
}
Union types Attr
and Node
replaced with delegate types, alongside modules for raw constructors.
Bolero.Html
element functions, Bolero.Html.concat
, Bolero.Html.attrs
replaced with computation expression builders.
Bolero.Html.comp
, ecomp
, lazyComp*
, navLink
functions no longer take attribute and child lists and return a computation expression builder instead.
Bolero.Html.virtualize.comp
replaced with a computation expression builder where let!
retrieves the current item:
virtualize.comp {
virtualize.placeholder (fun _ -> text "<placeholder>")
let! item = virtualize.items [1..100]
text $"Actual item {item}"
}
Bolero.Html.empty
value replaced with a function: empty()
.
Bolero.Html.attr.empty
value replaced with a function: attr.empty()
.
Bolero.Html.attr.classes
is obsolete. BREAKING CHANGE: classes are no longer combined across multiple calls to it or Bolero.Html.attr.class
.
#250 Configure Bolero and Bolero.Html for trimming.
Published by github-actions[bot] almost 3 years ago
Loosen Microsoft.* dependencies from ~> 5.0 to >= 5.0 to allow using 6.0+.
Update FSharp.Core to 6.0.
Remove references to Ply, use F# 6's own task
instead.
Run tests on .NET 6.
Move CI from AppVeyor to GitHub actions.
Published by Tarmil about 4 years ago
#56: Update to Elmish 3.0. Also update the Cmd
module to match Elmish 3's API, adding submodules Cmd.OfAuthorized
and Cmd.OfJS
.
#163 Rework the HTML element reference API and add Blazor component reference:
ElementRefBinder
renamed to HtmlRef
(old name still available but obsolete)attr.bindRef
renamed to attr.ref
(old name still available but obsolete)attr.ref
taking a function removedref.Ref
renamed to ref.Value
let theDiv = HtmlRef() // Used to be: let theDiv = ElementRefBinder()
div [
attr.ref theDiv // Used to be: attr.bindRef theDiv
on.click (fun _ -> doSomethingWith theDiv.Value) // Used to be: doSomethingWith theDiv.Ref
] []
Ref<'Component>
which provides the same capability for Blazor components, using the same attr.ref
:let theComp = Ref<MyComponent>()
comp<MyComponent> [
attr.ref theComp
on.click (fun _ -> doSomethingWith theComp.Value)
] []
#168: Move the module Bolero.Html
to a separate assembly and make all of its functions inline, in order to reduce the downloaded binary size.
#144: When a router is enabled and the user clicks a link that points to a URI not handled by the router, do navigate to this URI.
#166: Ensure that Elmish subscriptions and init commands are not run during server-side prerender.
#174: Change ShouldRender to invoke override instead of base implementation (thanks @dougquidd!)
#175: Do not render Ref until after Child Content (thanks @dougquidd!)
Published by Tarmil over 4 years ago
#135 Inferred router performs URL encoding/decoding on string
-typed parameters.
#151 Accept either a relative or absolute path in custom router's getRoute
.
#155 Add function fragment
to create a Bolero Node
from a Blazor RenderFragment
.
#159 Breaking change: Remove the module Bolero.Json
, and use System.Text.Json together with FSharp.SystemTextJson instead for remoting.
Remoting serialization can be customized by passing an additional argument configureSerialization: JsonSerializerOptions -> unit
to services.AddRemoting()
in both the server-side and client-side startup functions.
Published by Tarmil over 4 years ago
This release upgrades the minimal required version of .NET Core SDK to 3.1.300.
Update dependencies to Blazor 3.2.0.
Add Elmish commands for JavaScript interop:
Cmd.ofJS : IJSRuntime -> string -> obj[] -> ('res -> 'msg) -> (exn -> 'msg) -> Cmd<'msg>
Cmd.performJS : IJSRuntime -> string -> obj[] -> ('res -> 'msg) -> Cmd<'msg>
#127 Add lazyComp*By
family functions based on a key function (as opposed to lazyComp*With
's equality function):
lazyCompBy
: ('model -> 'key)
-> ('model -> Node)
-> 'model -> Node
when 'key : equality
lazyComp2By
: ('model -> 'key)
-> ('model -> Dispatch<'msg> -> Node)
-> 'model -> Dispatch<'msg> -> Node
when 'key : equality
lazyComp3By
: ('model1 * 'model2 -> 'key)
-> ('model1 -> 'model2 -> Dispatch<'msg> -> Node)
-> 'model1 -> 'model2 -> Dispatch<'msg> -> Node
when 'key : equality
#142 Add functions to create Blazor component attributes of certain types for which =>
is not sufficient:
EventCallback<'T>
:
attr.callback : string -> ('T -> unit) -> Attr
attr.async.callback : string -> ('T -> Async<unit>) -> Attr
attr.task.callback : string -> ('T -> Task) -> Attr
RenderFragment
:
attr.fragment : string -> Node -> Attr
RenderFragment<'T>
:
attr.fragmentWith : string -> ('T -> Node) -> Attr
#141 Add injectable Bolero.Server.RazorHost.IBoleroHostConfig
to provide configuration for the server-side Razor host. This is used within the Razor page by calling the extension methods on IHtmlHelper
:
member RenderComponentAsync<'T when 'T :> IComponent> : IBoleroHostConfig -> Task<IHtmlContent>
member RenderBoleroScript : IBoleroHostConfig -> IHtmlContent
and injected using the extension method on IServiceCollection
:
member AddBoleroHost : ?server: bool * ?prerendered: bool * ?devToggle: bool -> IServiceCollection
Published by Tarmil over 4 years ago
bind.*