Skip to content

Commit 1acb416

Browse files
committed
Doc + Dep updates
1 parent 79d35c9 commit 1acb416

File tree

6 files changed

+77
-44
lines changed

6 files changed

+77
-44
lines changed

.github/workflows/deploy.yml

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ jobs:
4343
with:
4444
inlineScript: |
4545
az storage copy -s '${{ env.WEB_APP_NAME }}/bin/Release/net7.0/publish/wwwroot/*' --destination-account-name ${{ env.ACCOUNT_NAME }} --destination-container '$web' --recursive
46+
- name: logout
47+
run: |
48+
az logout
49+
if: always()
50+
purge-storage-cache:
51+
runs-on: ubuntu-latest
52+
needs: build-and-deploy
53+
steps:
54+
- name: Azure Login
55+
uses: azure/login@v1
56+
with:
57+
creds: ${{ secrets.AZURE_CREDENTIALS }}
4658
- name: Purge Storage Cache
4759
uses: azure/CLI@v1
4860
with:

Docs/LICENSE

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright © 2023 Stoic Dreams
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Docs/README.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# Stoic Dreams Blazor UI
2+
23
###### GitHub: [GitHub.com/StoicDreams/BlazorUI](https://github.com/StoicDreams/BlazorUI)
4+
35
###### Nuget: [NuGet.org/packages/StoicDreams.BlazorUI](https://nuget.org/packages/StoicDreams.BlazorUI)
6+
47
###### Demo & Docs: [blazorui.stoicdreams.com](https://blazorui.stoicdreams.com)
58

69
UI Framework and component library for Blazor based Websites and Maui projects.
710

8-
> ## **Notice:** This project is on hold indefinitely!
11+
> ## **Notice:** This project is on hold indefinitely
12+
>
913
> I do not expect much continuing work, if any, to be done on Blazor UI at this point, as we have switched our interests to Rust-language projects, including our new [WebUI](https://webui.stoicdreams.com) framework built in Rust that we are using to convert our Blazor-built websites to Rust-built websites.
1014
11-
> ## **Notice:** This project is very early in development!
15+
> ## **Notice:** This project is very early in development
16+
>
1217
> This project should technically have all the functionality to build a complete website, but at this stage there is a lot of experimental work being done and breaking changes could be introduced with each update.
1318
1419
If you do decide to use it please provide us feedback on our website at [www.stoicdreams.com](https://www.stoicdreams.com).
@@ -24,6 +29,7 @@ This Blazor UI framework is targeting a developer experience that will allow dev
2429
Where component frameworks such as MudBlazor typically give you a bunch of smaller components that need to be stitched together with countless options for doing so, Blazor UI's goal is to get rid of boilerplate coding such as index.html files, and package together these smaller components into larger components, including the `MUIApp` which replaces the normal `App` component that a developer would normally have to create and manage for each new app.
2530

2631
As an example here is the `Program.cs` contenxt taken from our Sample Website:
32+
2733
```csharp
2834
using Microsoft.AspNetCore.Components.Web;
2935
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
@@ -36,23 +42,23 @@ builder.RootComponents.Add<HeadOutlet>("head::after");
3642
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
3743
builder.Services.AddStoicDreamsBlazorUI(options =>
3844
{
39-
options.AppName = "Stoic Dreams Blazor UI Sample App";
40-
options.CssFiles.Add("css/app.css");
41-
options.CssFiles.Add("StoicDreams.SampleWebsite.styles.css");
42-
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "manifest")));
43-
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "512x512"), ("href", "icon-512.png")));
44-
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "192x192"), ("href", "icon-192.png")));
45-
options.BodyElements.Add(ElementDetail.Create("script", ("body", "navigator.serviceWorker.register('service-worker.js');"), ("type", "text/javascript")));
45+
options.AppName = "Stoic Dreams Blazor UI Sample App";
46+
options.CssFiles.Add("css/app.css");
47+
options.CssFiles.Add("StoicDreams.SampleWebsite.styles.css");
48+
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "manifest")));
49+
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "512x512"), ("href", "icon-512.png")));
50+
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "192x192"), ("href", "icon-192.png")));
51+
options.BodyElements.Add(ElementDetail.Create("script", ("body", "navigator.serviceWorker.register('service-worker.js');"), ("type", "text/javascript")));
4652
});
4753

4854
And while our DefaultLayout is being designed to provide a ton of flexability through simple config changes, we recognize some developers will want to do layouts that follow their own standards, so we allow a simple mechanism to set your own layout.
4955

5056
```csharp
5157
builder.Services.AddStoicDreamsBlazorUI(options =>
5258
{
53-
options.AppName = "Stoic Dreams Blazor UI Sample App";
54-
options.SetLayout<MainLayout>();
55-
...
59+
options.AppName = "Stoic Dreams Blazor UI Sample App";
60+
options.SetLayout<MainLayout>();
61+
...
5662
});
5763

5864
```
@@ -61,8 +67,8 @@ While this project will take some inspiration from and is expected to share some
6167

6268
We have developed and are evolving our own design patterns, and those will be reflected in this UI framework.
6369

64-
6570
## MudBlazor - [www.MudBlazor.com](https://www.mudblazor.com)
71+
6672
###### Library Docs - [MudBlazor.com/docs/overview](https://mudblazor.com/docs/overview)
6773

6874
Due to its sheer awesomeness we have decided to use MudBlazor as a base for our component library. We will do our best to update this project to keep it up to date with MudBlazor updates. And we'll do our best to make sure our integrations and components do not conflict with expected behavior from MudBlazor components.
@@ -79,13 +85,15 @@ See the [Blazor UI Sample Website](https://github.com/StoicDreams/BlazorUI/tree/
7985

8086
A Maui Blazor sample project will be added later after that framework and toolchain has become generally available for production use.
8187

82-
8388
## Author
8489

85-
**[Erik Gassler](https://www.erikgassler.com) - [Stoic Dreams](https://www.stoicdreams.com)** - Just a simpleton who likes making stuff with bits and bytes.
90+
**[Erik Gassler](https://www.erikgassler.com) - [Stoic Dreams](https://www.stoicdreams.com)** - Forging solutions for tomorrow's software development.
8691

8792
**Support** - Visit [Stoic Dreams' GitHub Sponsor page](https://github.com/sponsors/StoicDreams) if you would like to provide support to Stoic Dreams.
8893
Also make sure to share your support to the team at [MudBlazor](https://github.com/sponsors/MudBlazor) for the awesome work they're doing.
8994

90-
9195
**Software Development Standards** - Check out my [Simple-Holistic-Agile Software Engineering Standards](https://www.softwarestandards.dev) website to see my standards for developing software.
96+
97+
## License
98+
99+
[MIT](LICENSE)

StoicDreams.BlazorUI.BuildTests/StoicDreams.BlazorUI.BuildTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<ItemGroup>
1515
<PackageReference Include="bunit" Version="1.22.19" />
1616
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
17-
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.4.51" />
17+
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.5.14" />
1818
<PackageReference Include="xunit" Version="2.5.0" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

StoicDreams.BlazorUI/StoicDreams.BlazorUI.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Razor">
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
@@ -46,7 +46,7 @@
4646
</ItemGroup>
4747

4848
<ItemGroup>
49-
<PackageReference Include="StoicDreams.Core" Version="1.3.0" />
49+
<PackageReference Include="StoicDreams.Core" Version="1.3.1" />
5050
<PackageReference Include="BlazorTransitionableRoute" Version="4.0.0" />
5151
<PackageReference Include="Markdig" Version="0.31.0" />
5252
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.9" />
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
// Caution! Be sure you understand the caveats before publishing an application with
2-
// offline support. See https://aka.ms/blazor-offline-considerations
3-
4-
self.importScripts('./service-worker-assets.js');
5-
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
1+
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
62
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
73
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));
8-
4+
function get_uuid() {
5+
try {
6+
return crypto.randomUUID();
7+
} catch (ex) {
8+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9+
let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
10+
return v.toString(16);
11+
});
12+
}
13+
}
14+
const currentVersion = location.host.substring(0, 9) === 'localhost' ? `${get_uuid()}` : 'webui_0.6.38';
915
const cacheNamePrefix = 'offline-cache-';
10-
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
11-
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
12-
const offlineAssetsExclude = [ /^service-worker\.js$/ ];
16+
const cacheName = `${cacheNamePrefix}${currentVersion}`;
17+
const offlineAssetsInclude = [/\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/];
18+
const offlineAssetsExclude = [/^service-worker\.js$/];
1319

1420
async function onInstall(event) {
15-
console.info('Service worker: Install');
16-
17-
// Fetch and cache all matching items from the assets manifest
18-
const assetsRequests = self.assetsManifest.assets
19-
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
20-
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
21-
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
22-
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
21+
console.info(`Service worker: Install ${cacheName}`);
22+
self.skipWaiting();
2323
}
2424

2525
async function onActivate(event) {
26-
console.info('Service worker: Activate');
26+
console.info(`Service worker: Activate ${cacheName}`);
2727

2828
// Delete unused caches
2929
const cacheKeys = await caches.keys();
@@ -34,15 +34,19 @@ async function onActivate(event) {
3434

3535
async function onFetch(event) {
3636
let cachedResponse = null;
37-
if (event.request.method === 'GET') {
38-
// For all navigation requests, try to serve index.html from cache
39-
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
40-
const shouldServeIndexHtml = event.request.mode === 'navigate';
41-
42-
const request = shouldServeIndexHtml ? 'index.html' : event.request;
37+
if (allowCache(event.request)) {
4338
const cache = await caches.open(cacheName);
44-
cachedResponse = await cache.match(request);
39+
cachedResponse = await cache.match(event.request);
4540
}
4641

4742
return cachedResponse || fetch(event.request);
4843
}
44+
45+
function allowCache(request) {
46+
// Only allow caching for GET requests
47+
if (request.method !== 'GET') { return false; }
48+
// Exclude caching for navigation requests to ensure the latest site updates are loaded asap
49+
if (request.mode === 'navigate') { return false; }
50+
// All other GET requests allow navigation
51+
return true;
52+
}

0 commit comments

Comments
 (0)