-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from fsbolero/interactive-render-mode
Enable interactive render modes
- Loading branch information
Showing
8 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Bolero | ||
#if NET8_0_OR_GREATER | ||
|
||
open System.Runtime.InteropServices | ||
open Microsoft.AspNetCore.Components | ||
open Microsoft.AspNetCore.Components.Web | ||
|
||
type BoleroRenderMode = | ||
/// <summary> | ||
/// Render the component and run its interactivity on the server side. | ||
/// </summary> | ||
| Server = 1 | ||
/// <summary> | ||
/// Render the component and run its interactivity on the client side. | ||
/// </summary> | ||
| WebAssembly = 2 | ||
/// <summary> | ||
/// Automatically decide where to render the component and run its interactivity. | ||
/// </summary> | ||
| Auto = 3 | ||
|
||
/// <summary> | ||
/// Define how a component is rendered in interactive render mode. | ||
/// </summary> | ||
type BoleroRenderModeAttribute | ||
/// <summary> | ||
/// Define how a component is rendered in interactive render mode. | ||
/// </summary> | ||
/// <param name="mode">The render mode.</param> | ||
/// <param name="prerender">Whether to prerender the component in the HTML response.</param> | ||
(mode, [<Optional; DefaultParameterValue true>] prerender: bool) = | ||
inherit RenderModeAttribute() | ||
|
||
/// <inheritdoc /> | ||
override val Mode : IComponentRenderMode = | ||
match mode with | ||
| BoleroRenderMode.Server -> InteractiveServerRenderMode(prerender) | ||
| BoleroRenderMode.WebAssembly -> InteractiveWebAssemblyRenderMode(prerender) | ||
| BoleroRenderMode.Auto -> InteractiveAutoRenderMode(prerender) | ||
| _ -> failwith $"Invalid InteractiveRenderMode: {mode}" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters