Skip to content

Commit

Permalink
Doc + Dep updates
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgassler committed Oct 10, 2023
1 parent 79d35c9 commit 1acb416
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 44 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ jobs:
with:
inlineScript: |
az storage copy -s '${{ env.WEB_APP_NAME }}/bin/Release/net7.0/publish/wwwroot/*' --destination-account-name ${{ env.ACCOUNT_NAME }} --destination-container '$web' --recursive
- name: logout
run: |
az logout
if: always()
purge-storage-cache:
runs-on: ubuntu-latest
needs: build-and-deploy
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Purge Storage Cache
uses: azure/CLI@v1
with:
Expand Down
9 changes: 9 additions & 0 deletions Docs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright © 2023 Stoic Dreams

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.
40 changes: 24 additions & 16 deletions Docs/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Stoic Dreams Blazor UI

###### GitHub: [GitHub.com/StoicDreams/BlazorUI](https://github.com/StoicDreams/BlazorUI)

###### Nuget: [NuGet.org/packages/StoicDreams.BlazorUI](https://nuget.org/packages/StoicDreams.BlazorUI)

###### Demo & Docs: [blazorui.stoicdreams.com](https://blazorui.stoicdreams.com)

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

> ## **Notice:** This project is on hold indefinitely!
> ## **Notice:** This project is on hold indefinitely
>
> 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.
> ## **Notice:** This project is very early in development!
> ## **Notice:** This project is very early in development
>
> 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.
If you do decide to use it please provide us feedback on our website at [www.stoicdreams.com](https://www.stoicdreams.com).
Expand All @@ -24,6 +29,7 @@ This Blazor UI framework is targeting a developer experience that will allow dev
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.

As an example here is the `Program.cs` contenxt taken from our Sample Website:

```csharp
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
Expand All @@ -36,23 +42,23 @@ builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddStoicDreamsBlazorUI(options =>
{
options.AppName = "Stoic Dreams Blazor UI Sample App";
options.CssFiles.Add("css/app.css");
options.CssFiles.Add("StoicDreams.SampleWebsite.styles.css");
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "manifest")));
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "512x512"), ("href", "icon-512.png")));
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "192x192"), ("href", "icon-192.png")));
options.BodyElements.Add(ElementDetail.Create("script", ("body", "navigator.serviceWorker.register('service-worker.js');"), ("type", "text/javascript")));
options.AppName = "Stoic Dreams Blazor UI Sample App";
options.CssFiles.Add("css/app.css");
options.CssFiles.Add("StoicDreams.SampleWebsite.styles.css");
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "manifest")));
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "512x512"), ("href", "icon-512.png")));
options.HeadElements.Add(ElementDetail.Create("link", ("rel", "apple-touch-icon"), ("sizes", "192x192"), ("href", "icon-192.png")));
options.BodyElements.Add(ElementDetail.Create("script", ("body", "navigator.serviceWorker.register('service-worker.js');"), ("type", "text/javascript")));
});

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.

```csharp
builder.Services.AddStoicDreamsBlazorUI(options =>
{
options.AppName = "Stoic Dreams Blazor UI Sample App";
options.SetLayout<MainLayout>();
...
options.AppName = "Stoic Dreams Blazor UI Sample App";
options.SetLayout<MainLayout>();
...
});

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

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


## MudBlazor - [www.MudBlazor.com](https://www.mudblazor.com)

###### Library Docs - [MudBlazor.com/docs/overview](https://mudblazor.com/docs/overview)

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.
Expand All @@ -79,13 +85,15 @@ See the [Blazor UI Sample Website](https://github.com/StoicDreams/BlazorUI/tree/

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


## Author

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

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


**Software Development Standards** - Check out my [Simple-Holistic-Agile Software Engineering Standards](https://www.softwarestandards.dev) website to see my standards for developing software.

## License

[MIT](LICENSE)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="bunit" Version="1.22.19" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.4.51" />
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.5.14" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
4 changes: 2 additions & 2 deletions StoicDreams.BlazorUI/StoicDreams.BlazorUI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Expand Down Expand Up @@ -46,7 +46,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="StoicDreams.Core" Version="1.3.0" />
<PackageReference Include="StoicDreams.Core" Version="1.3.1" />
<PackageReference Include="BlazorTransitionableRoute" Version="4.0.0" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.9" />
Expand Down
54 changes: 29 additions & 25 deletions StoicDreams.SampleWebsite/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// Caution! Be sure you understand the caveats before publishing an application with
// offline support. See https://aka.ms/blazor-offline-considerations

self.importScripts('./service-worker-assets.js');
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));

function get_uuid() {
try {
return crypto.randomUUID();
} catch (ex) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
}
const currentVersion = location.host.substring(0, 9) === 'localhost' ? `${get_uuid()}` : 'webui_0.6.38';
const cacheNamePrefix = 'offline-cache-';
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
const offlineAssetsExclude = [ /^service-worker\.js$/ ];
const cacheName = `${cacheNamePrefix}${currentVersion}`;
const offlineAssetsInclude = [/\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/];
const offlineAssetsExclude = [/^service-worker\.js$/];

async function onInstall(event) {
console.info('Service worker: Install');

// Fetch and cache all matching items from the assets manifest
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
console.info(`Service worker: Install ${cacheName}`);
self.skipWaiting();
}

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

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

async function onFetch(event) {
let cachedResponse = null;
if (event.request.method === 'GET') {
// For all navigation requests, try to serve index.html from cache
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
const shouldServeIndexHtml = event.request.mode === 'navigate';

const request = shouldServeIndexHtml ? 'index.html' : event.request;
if (allowCache(event.request)) {
const cache = await caches.open(cacheName);
cachedResponse = await cache.match(request);
cachedResponse = await cache.match(event.request);
}

return cachedResponse || fetch(event.request);
}

function allowCache(request) {
// Only allow caching for GET requests
if (request.method !== 'GET') { return false; }
// Exclude caching for navigation requests to ensure the latest site updates are loaded asap
if (request.mode === 'navigate') { return false; }
// All other GET requests allow navigation
return true;
}

0 comments on commit 1acb416

Please sign in to comment.