-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial structure * Component Render Strategies * Implement page state hierarchy * Extract RenderStrategies * Add PageStateContainer * Persist page state * Fix components notifying parent about descendancy multiple times * Implement state restore * Fallback to state initialization if PageState object is unavailable
- Loading branch information
1 parent
d8ef184
commit 4ca84ea
Showing
64 changed files
with
2,344 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.{cs,vb}] | ||
|
||
# IDE0130: Namespace does not match folder structure | ||
dotnet_diagnostic.IDE0130.severity = none |
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,45 @@ | ||
name: Publish Documentation | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "docs/**" | ||
- ".github/workflows/docs.yml" | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # To push a branch | ||
pages: write # To push to a GitHub Pages site | ||
id-token: write # To update the deployment status | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir mdbook | ||
curl -sSL $url | tar -xz --directory=./mdbook | ||
echo `pwd`/mdbook >> $GITHUB_PATH | ||
- name: Build Book | ||
run: | | ||
# This assumes your book is in the root of your repository. | ||
# Just add a `cd` here if you need to change to another directory. | ||
cd docs | ||
mdbook build | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v2 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
# Upload entire repository | ||
path: 'docs/book' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
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,39 @@ | ||
name: Release Blazor.State | ||
|
||
on: | ||
repository_dispatch: | ||
push: | ||
tags: | ||
- "State-v[0-9]+.[0-9]+.[0-9]+*" | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY}} | ||
|
||
jobs: | ||
|
||
Publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Verify commit | ||
run: | | ||
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | ||
git branch --remote --contains | grep origin/main | ||
- name: Set version | ||
run: echo "VERSION=${GITHUB_REF/refs\/tags\/State-v/}" >> $GITHUB_ENV | ||
|
||
- name: Build | ||
run: | | ||
dotnet build BitzArt.Blazor.State.sln --configuration Release /p:Version=${VERSION} | ||
dotnet pack BitzArt.Blazor.State.sln --configuration Release /p:Version=${VERSION} --no-build --output . | ||
- name: Push | ||
run: | | ||
dotnet nuget push BitzArt.Blazor.State.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_APIKEY} | ||
dotnet nuget push BitzArt.Blazor.RenderStrategies.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_APIKEY} |
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,25 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags-ignore: | ||
- '*' | ||
|
||
jobs: | ||
tests: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Test | ||
run: dotnet test --no-restore --verbosity normal |
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,92 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.10.35004.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{9CA44D4E-0295-4A3F-94DB-7428A05E795A}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{46952EDA-0C6C-4436-AB79-FFE35E13D112}" | ||
ProjectSection(SolutionItems) = preProject | ||
.github\workflows\docs.yml = .github\workflows\docs.yml | ||
.github\workflows\publish.yml = .github\workflows\publish.yml | ||
.github\workflows\tests.yml = .github\workflows\tests.yml | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{4CEA9216-5CE1-4CC7-87BF-046837CACC99}" | ||
ProjectSection(SolutionItems) = preProject | ||
docs\book.toml = docs\book.toml | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{56DAC196-1ECD-4485-A227-1A239FCC9866}" | ||
ProjectSection(SolutionItems) = preProject | ||
docs\src\01.introduction.md = docs\src\01.introduction.md | ||
docs\src\SUMMARY.md = docs\src\SUMMARY.md | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5A39EAA1-A9D6-402C-B1CD-1704F0DBD80B}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{750EFE03-9656-4B39-A67F-74D3A900CEE1}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{818B8950-B52B-49E9-B15B-196024C22A18}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Blazor.State", "src\BitzArt.Blazor.State\BitzArt.Blazor.State.csproj", "{AF79E00B-481B-4D0D-9E2F-09BD3B528735}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Blazor.State.Tests", "tests\BitzArt.Blazor.State.Tests\BitzArt.Blazor.State.Tests.csproj", "{97DF570A-9E40-440C-9360-BC3AA5E1A83E}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Blazor.State.SampleApp", "sample\BitzArt.Blazor.State.SampleApp\BitzArt.Blazor.State.SampleApp\BitzArt.Blazor.State.SampleApp.csproj", "{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Blazor.State.SampleApp.Client", "sample\BitzArt.Blazor.State.SampleApp\BitzArt.Blazor.State.SampleApp.Client\BitzArt.Blazor.State.SampleApp.Client.csproj", "{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BitzArt.Blazor.State.SampleApp", "BitzArt.Blazor.State.SampleApp", "{AF748271-0827-41E0-9ACC-F6B38227B85F}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{853EC833-DEF6-4DB4-BE27-DFD460523236}" | ||
ProjectSection(SolutionItems) = preProject | ||
.editorconfig = .editorconfig | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitzArt.Blazor.RenderStrategies", "src\BitzArt.Blazor.RenderStrategies\BitzArt.Blazor.RenderStrategies.csproj", "{201A4DFF-23FA-40C5-8920-9B9907D95E57}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{AF79E00B-481B-4D0D-9E2F-09BD3B528735}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{AF79E00B-481B-4D0D-9E2F-09BD3B528735}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{AF79E00B-481B-4D0D-9E2F-09BD3B528735}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{AF79E00B-481B-4D0D-9E2F-09BD3B528735}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{97DF570A-9E40-440C-9360-BC3AA5E1A83E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{97DF570A-9E40-440C-9360-BC3AA5E1A83E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{97DF570A-9E40-440C-9360-BC3AA5E1A83E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{97DF570A-9E40-440C-9360-BC3AA5E1A83E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{201A4DFF-23FA-40C5-8920-9B9907D95E57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{201A4DFF-23FA-40C5-8920-9B9907D95E57}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{201A4DFF-23FA-40C5-8920-9B9907D95E57}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{201A4DFF-23FA-40C5-8920-9B9907D95E57}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{46952EDA-0C6C-4436-AB79-FFE35E13D112} = {9CA44D4E-0295-4A3F-94DB-7428A05E795A} | ||
{56DAC196-1ECD-4485-A227-1A239FCC9866} = {4CEA9216-5CE1-4CC7-87BF-046837CACC99} | ||
{AF79E00B-481B-4D0D-9E2F-09BD3B528735} = {5A39EAA1-A9D6-402C-B1CD-1704F0DBD80B} | ||
{97DF570A-9E40-440C-9360-BC3AA5E1A83E} = {750EFE03-9656-4B39-A67F-74D3A900CEE1} | ||
{68862CF8-9CBD-4ACC-8EAF-D1EA32DB23FC} = {AF748271-0827-41E0-9ACC-F6B38227B85F} | ||
{5EC46C1C-E2E1-4A1E-8CF5-BCE56F491ECF} = {AF748271-0827-41E0-9ACC-F6B38227B85F} | ||
{AF748271-0827-41E0-9ACC-F6B38227B85F} = {818B8950-B52B-49E9-B15B-196024C22A18} | ||
{201A4DFF-23FA-40C5-8920-9B9907D95E57} = {5A39EAA1-A9D6-402C-B1CD-1704F0DBD80B} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {70901A76-781C-4DB7-A313-3E93BE0F665F} | ||
EndGlobalSection | ||
EndGlobal |
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,18 @@ | ||
![Tests](https://github.com/BitzArt/Blazor.State/actions/workflows/tests.yml/badge.svg) | ||
|
||
[![NuGet version](https://img.shields.io/nuget/v/BitzArt.Blazor.State.svg)](https://www.nuget.org/packages/BitzArt.Blazor.State/) | ||
[![NuGet downloads](https://img.shields.io/nuget/dt/BitzArt.Blazor.State.svg)](https://www.nuget.org/packages/BitzArt.Blazor.State/) | ||
|
||
## Overview | ||
|
||
![Prerelease](https://img.shields.io/badge/prerelease%2C_work_in_progress-ffa624?style=for-the-badge) | ||
|
||
**BitzArt.Blazor.State** allows persisting component state across rendering environments with Blazor. | ||
|
||
Refer to the [documentation](https://bitzart.github.io/Blazor.State) for more information. | ||
|
||
[![documentation](https://img.shields.io/badge/documentation-512BD4?style=for-the-badge)](https://bitzart.github.io/Blazor.State) | ||
|
||
## License | ||
|
||
[![License](https://img.shields.io/badge/mit-%230072C6?style=for-the-badge)](https://github.com/BitzArt/Blazor.State/blob/main/LICENSE) |
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,6 @@ | ||
[book] | ||
title = "BitzArt.Blazor.State" | ||
|
||
[output.html] | ||
git-repository-url = "https://github.com/BitzArt/Blazor.State" | ||
git-repository-icon = "fa-github" |
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,3 @@ | ||
## Introduction | ||
|
||
TODO |
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,5 @@ | ||
# Summary | ||
|
||
# Blazor.State | ||
|
||
- [Introduction](01.introduction.md) |
20 changes: 20 additions & 0 deletions
20
...pleApp/BitzArt.Blazor.State.SampleApp.Client/BitzArt.Blazor.State.SampleApp.Client.csproj
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,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile> | ||
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode> | ||
<RootNamespace>BitzArt.Blazor.State.SampleApp.Client</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0-preview.7.24406.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\BitzArt.Blazor.State\BitzArt.Blazor.State.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
15 changes: 15 additions & 0 deletions
15
...Art.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Components/Counter.razor
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,15 @@ | ||
@inherits PersistentComponentBase | ||
|
||
<div class="card"> | ||
|
||
<h4>@Name</h4> | ||
|
||
<p role="status">Current count: @Count</p> | ||
|
||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
|
||
<small style="margin-top:1rem;">@InfoText</small> | ||
|
||
<small style="margin-top:1rem;">@Description</small> | ||
|
||
</div> |
31 changes: 31 additions & 0 deletions
31
....Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Components/Counter.razor.cs
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,31 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace BitzArt.Blazor.State.SampleApp.Client.Components; | ||
|
||
public partial class Counter : PersistentComponentBase | ||
{ | ||
[Parameter, EditorRequired] | ||
public string Name { get; set; } = string.Empty; | ||
|
||
[Parameter, EditorRequired] | ||
public string? Description { get; set; } | ||
|
||
[ComponentState] | ||
public int Count { get; private set; } = 0; | ||
|
||
[ComponentState] | ||
public string InfoText { get; set; } = string.Empty; | ||
|
||
protected override async Task InitializeStateAsync() | ||
{ | ||
await Task.Delay(100); // simulate loading data | ||
|
||
InfoText = $"State initialized in render mode: {RendererInfo.Name}"; | ||
} | ||
|
||
private void IncrementCount(object? state) | ||
{ | ||
Count++; | ||
StateHasChanged(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Components/Counter.razor.css
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,12 @@ | ||
.card { | ||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); | ||
transition: 0.3s; | ||
padding: 1rem; | ||
border-radius: 0.5rem; | ||
margin-bottom: 2rem; | ||
width: 400px; | ||
} | ||
|
||
.card:hover { | ||
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); | ||
} |
13 changes: 13 additions & 0 deletions
13
...zArt.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Pages/CounterPage.razor
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,13 @@ | ||
@page "/counter" | ||
@rendermode InteractiveWebAssembly | ||
@inherits PersistentComponentBase | ||
|
||
<PageTitle>Counter</PageTitle> | ||
|
||
<Counter Name="Counter 1" | ||
Description="This counter is initialized while pre-rendering" | ||
StateId="Counter1"/> | ||
|
||
<Counter Name="Counter 2" | ||
Description="This counter is initialized while pre-rendering" | ||
StateId="Counter2" /> |
7 changes: 7 additions & 0 deletions
7
...t.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Pages/CounterPage.razor.cs
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,7 @@ | ||
using BitzArt.Blazor.State.SampleApp.Client.Components; | ||
|
||
namespace BitzArt.Blazor.State.SampleApp.Client.Pages; | ||
|
||
public partial class CounterPage : PersistentComponentBase | ||
{ | ||
} |
18 changes: 18 additions & 0 deletions
18
sample/BitzArt.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/Program.cs
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,18 @@ | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
|
||
namespace BitzArt.Blazor.State.SampleApp.Client; | ||
|
||
internal class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
|
||
builder.Services.AddBlazorState(builder => | ||
{ | ||
builder.AddAssemblyContaining<_Imports>(); | ||
}); | ||
|
||
await builder.Build().RunAsync(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
sample/BitzArt.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/_Imports.razor
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,12 @@ | ||
@using System.Net.Http | ||
@using System.Net.Http.Json | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using Microsoft.AspNetCore.Components.Routing | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using static Microsoft.AspNetCore.Components.Web.RenderMode | ||
@using Microsoft.AspNetCore.Components.Web.Virtualization | ||
@using Microsoft.JSInterop | ||
@using BitzArt.Blazor.State.SampleApp.Client | ||
@using BitzArt.Blazor.State.SampleApp.Client.Components | ||
@using BitzArt.Blazor.State.SampleApp.Client.Pages | ||
@using BitzArt.Blazor.State |
7 changes: 7 additions & 0 deletions
7
sample/BitzArt.Blazor.State.SampleApp/BitzArt.Blazor.State.SampleApp.Client/wwwroot/app.js
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,7 @@ | ||
function getInnerText(id) { | ||
let element = document.getElementById(id); | ||
if (element) { | ||
return element.innerText; | ||
} | ||
return null; | ||
} |
Oops, something went wrong.