spoko-design-system 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,7 @@ Most of the components from this repository can be seen in my projects:
45
45
  - 🔎 [astro-pagefind](https://github.com/shishkin/astro-pagefind) - Astro integration for Pagefind static site search
46
46
  - 🗒 [astrojs/mdx](https://github.com/withastro/astro/tree/main/packages/integrations/mdx/) - markdown support
47
47
  - 📦 [astro-compress](https://github.com/astro-community/AstroCompress) - compression utilities to your Astro project
48
+ - 📲 [PWA](https://github.com/vite-pwa/astro) - Zero-config PWA Integration for Astro
48
49
  - 🖨 Static-site generation (SSG)
49
50
  - 🎡 [Swiper](https://github.com/nolimits4web/swiper) - modern mobile touch slider with hardware accelerated transitions and amazing native behavior
50
51
  - 🌠 [View Transitions API](https://docs.astro.build/en/guides/view-transitions/#full-site-view-transitions-spa-mode) - [View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) - makes it easy to change the DOM in a single step, while creating an animated transition between the two states. It's available in Chrome 111+ ([more details](https://developer.chrome.com/docs/web-platform/view-transitions?hl=en))
package/astro.config.mjs CHANGED
@@ -8,7 +8,7 @@ import astroI18next from "astro-i18next";
8
8
  import icon from "astro-icon";
9
9
  import sitemap from "@astrojs/sitemap";
10
10
  import pagefind from "astro-pagefind";
11
-
11
+ import AstroPWA from '@vite-pwa/astro';
12
12
  // https://astro.build/config
13
13
  export default defineConfig({
14
14
  site: "https://sds.spoko.space/",
@@ -24,6 +24,58 @@ export default defineConfig({
24
24
  vue(),
25
25
  mdx(),
26
26
  astroI18next(),
27
+
28
+ AstroPWA({
29
+ mode: 'development',
30
+ base: '/',
31
+ scope: '/',
32
+ includeAssets: ['favicon.svg', 'safari-pinned-tab.svg', 'brands/*.svg', 'fonts/*.woff2', 'fonts/*.svg', 'vw.svg', 'polo.blue.svg', 'spoko.space.svg'],
33
+ // add this to cache all the static assets in the public folder
34
+ // includeAssets: [
35
+ // "**/*",
36
+ // ],
37
+ registerType: 'autoUpdate',
38
+ manifest: {
39
+ name: 'Spoko Design System',
40
+ short_name: 'SDS',
41
+ description: 'SDS PWA app description',
42
+ categories: ['multimedia'],
43
+ screenshots: [{
44
+ "src": "pwa-512x512.png",
45
+ "sizes": "512x512",
46
+ "platform": "windows",
47
+ "label": "SDS"
48
+ }],
49
+ theme_color: '#001e50',
50
+ icons: [{
51
+ src: 'pwa-192x192.png',
52
+ sizes: '192x192',
53
+ type: 'image/png'
54
+ }, {
55
+ src: 'pwa-512x512.png',
56
+ sizes: '512x512',
57
+ type: 'image/png'
58
+ }, {
59
+ src: 'pwa-512x512.png',
60
+ sizes: '512x512',
61
+ type: 'image/png',
62
+ purpose: 'any maskable'
63
+ }]
64
+ },
65
+ workbox: {
66
+ navigateFallback: '/',
67
+ globPatterns: ['**/*.{css,js,html,svg,png,ico,txt}'],
68
+ // globPatterns: ["**/*"], // add this to cache all the imports
69
+ },
70
+ devOptions: {
71
+ enabled: true,
72
+ navigateFallbackAllowlist: [/^\//]
73
+ },
74
+ experimental: {
75
+ directoryAndTrailingSlashHandler: true
76
+ }
77
+ }),
78
+
27
79
  UnoCSS({
28
80
  injectReset: true
29
81
  }), icon(
package/dev-dist/sw.js ADDED
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Copyright 2018 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // If the loader is already loaded, just stop.
15
+ if (!self.define) {
16
+ let registry = {};
17
+
18
+ // Used for `eval` and `importScripts` where we can't get script URL by other means.
19
+ // In both cases, it's safe to use a global var because those functions are synchronous.
20
+ let nextDefineUri;
21
+
22
+ const singleRequire = (uri, parentUri) => {
23
+ uri = new URL(uri + ".js", parentUri).href;
24
+ return registry[uri] || (
25
+
26
+ new Promise(resolve => {
27
+ if ("document" in self) {
28
+ const script = document.createElement("script");
29
+ script.src = uri;
30
+ script.onload = resolve;
31
+ document.head.appendChild(script);
32
+ } else {
33
+ nextDefineUri = uri;
34
+ importScripts(uri);
35
+ resolve();
36
+ }
37
+ })
38
+
39
+ .then(() => {
40
+ let promise = registry[uri];
41
+ if (!promise) {
42
+ throw new Error(`Module ${uri} didn’t register its module`);
43
+ }
44
+ return promise;
45
+ })
46
+ );
47
+ };
48
+
49
+ self.define = (depsNames, factory) => {
50
+ const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
51
+ if (registry[uri]) {
52
+ // Module is already loading or loaded.
53
+ return;
54
+ }
55
+ let exports = {};
56
+ const require = depUri => singleRequire(depUri, uri);
57
+ const specialDeps = {
58
+ module: { uri },
59
+ exports,
60
+ require
61
+ };
62
+ registry[uri] = Promise.all(depsNames.map(
63
+ depName => specialDeps[depName] || require(depName)
64
+ )).then(deps => {
65
+ factory(...deps);
66
+ return exports;
67
+ });
68
+ };
69
+ }
70
+ define(['./workbox-c676b6d3'], (function (workbox) { 'use strict';
71
+
72
+ self.skipWaiting();
73
+ workbox.clientsClaim();
74
+
75
+ /**
76
+ * The precacheAndRoute() method efficiently caches and responds to
77
+ * requests for URLs in the manifest.
78
+ * See https://goo.gl/S9QRab
79
+ */
80
+ workbox.precacheAndRoute([{
81
+ "url": "/",
82
+ "revision": "0.9rameh2lp0g"
83
+ }], {
84
+ "directoryIndex": "index.html"
85
+ });
86
+ workbox.cleanupOutdatedCaches();
87
+ workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/"), {
88
+ allowlist: [/^\//]
89
+ }));
90
+
91
+ }));