@thebase/ui 1.1.7 → 1.2.1
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/CHANGELOG.md +70 -1
- package/README.md +22 -4
- package/bin/create-baseui-app.mjs +28 -2
- package/dist/baseui.apidoc.esm.js +64 -64
- package/dist/baseui.apidoc.min.js +64 -64
- package/dist/baseui.esm.js +42 -61
- package/dist/baseui.i18n.esm.js +2 -0
- package/dist/baseui.i18n.min.js +2 -0
- package/dist/baseui.icons.esm.js +1 -1
- package/dist/baseui.min.css +2 -2
- package/dist/baseui.min.js +61 -61
- package/dist/baseui.pwa.esm.js +71 -9
- package/dist/baseui.registry.json +13 -9
- package/dist/baseui.templates.xml +311 -311
- package/dist/baseui.vite.esm.js +116 -0
- package/dist/runtime/lazy/apidoc.logic.js +20 -0
- package/dist/runtime/milkdown/milkdown-editor.js +1 -1
- package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
- package/dist/themes/baseui-dark.css +80 -1
- package/dist/themes/baseui-dark.min.css +1 -0
- package/dist/themes/baseui-light.css +81 -1
- package/dist/themes/baseui-light.min.css +1 -0
- package/dist/types/i18n.d.ts +25 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/pwa.d.ts +1 -45
- package/dist/types/vite.d.ts +4 -0
- package/docs/analytics.md +3 -3
- package/docs/base-ui-skill.md +54 -0
- package/docs/blocks.md +1 -1
- package/docs/components/accordion.md +4 -4
- package/docs/components/apidoc.md +1 -1
- package/docs/components/block-viewer.md +1 -1
- package/docs/components/breadcrumb.md +1 -1
- package/docs/components/button.md +1 -1
- package/docs/components/code-editor.md +1 -1
- package/docs/components/data-table.md +2 -2
- package/docs/components/dialog.md +5 -5
- package/docs/components/form.md +29 -29
- package/docs/components/input.md +1 -1
- package/docs/components/markdown.md +1 -1
- package/docs/components/pwa.md +1 -1
- package/docs/components/shell.md +2 -2
- package/docs/components/sidebar.md +16 -16
- package/docs/components/text-editor.md +1 -1
- package/docs/components/theme-button.md +1 -1
- package/docs/components/toast.md +10 -10
- package/docs/components/typography.md +21 -2
- package/docs/i18n.md +119 -0
- package/docs/icons.md +1 -1
- package/docs/installation.md +3 -2
- package/docs/owl-components.md +1 -1
- package/docs/registry.md +1 -0
- package/docs/runtime-api.md +5 -3
- package/docs/theming.md +33 -3
- package/docs/usage-guide.md +23 -6
- package/package.json +13 -1
package/dist/baseui.pwa.esm.js
CHANGED
|
@@ -1,20 +1,80 @@
|
|
|
1
|
-
var d=["favicon.ico","favicon-16x16.png","favicon-32x32.png","apple-touch-icon.png","icon-192.png","icon-512.png"],
|
|
2
|
-
|
|
1
|
+
var d=["favicon.ico","favicon-16x16.png","favicon-32x32.png","apple-touch-icon.png","icon-192.png","icon-512.png"],h="/icons/";function v(e){return[{src:`${e}icon-192.png`,sizes:"192x192",type:"image/png",purpose:"any"},{src:`${e}icon-512.png`,sizes:"512x512",type:"image/png",purpose:"any"},{src:`${e}icon-512.png`,sizes:"512x512",type:"image/png",purpose:"maskable"}]}function g(e){let{name:n,shortName:r=n,description:a="",startUrl:o="/",scope:i="/",display:c="standalone",orientation:t="portrait-primary",backgroundColor:l="#ffffff",themeColor:s="#0f172a",lang:p="en",iconsBase:u=h,icons:f=v(u)}=e;return{name:n,short_name:r,description:a,start_url:o,scope:i,display:c,orientation:t,background_color:l,theme_color:s,lang:p,icons:f}}function w(e){return JSON.stringify({version:e})+`
|
|
2
|
+
`}function m({swUrl:e="/sw.js"}={}){return`/** Registers the offline service worker and reloads the page whenever a new app version is deployed. */
|
|
3
|
+
if ("serviceWorker" in navigator) {
|
|
4
|
+
navigator.serviceWorker.addEventListener("message", (event) => {
|
|
5
|
+
if (event.data === "version-changed") location.reload();
|
|
6
|
+
});
|
|
7
|
+
document.addEventListener("visibilitychange", () => {
|
|
8
|
+
if (!document.hidden) navigator.serviceWorker.controller?.postMessage("check-version");
|
|
9
|
+
});
|
|
10
|
+
window.addEventListener("load", () => {
|
|
11
|
+
navigator.serviceWorker.register(${JSON.stringify(e)}).catch((error) => {
|
|
12
|
+
console.error("Service worker registration failed", error);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
`}function k(e){let{cacheName:n,cdnVersion:r,iconsBase:a=h,manifestUrl:o="/manifest.webmanifest",appFiles:i=[],extraPrecacheUrls:c=[]}=e,t=r?`https://cdn.jsdelivr.net/npm/@thebase/ui@${r}/dist/`:null,l=["/",o,...d.map(s=>`${a}${s}`),...i,...c,...t?["baseui.min.css","baseui.esm.js","baseui.templates.xml"].map(s=>`${t}${s}`):[]];return`const CACHE_NAME = ${JSON.stringify(n)};
|
|
17
|
+
const BASEUI_CDN = ${JSON.stringify(t)};
|
|
18
|
+
|
|
19
|
+
const PRECACHE_URLS = ${JSON.stringify(l,null,2)};
|
|
20
|
+
|
|
21
|
+
/** Last-seen app version lives in its own cache so wiping the app caches never forgets it. */
|
|
22
|
+
const VERSION_CACHE = ${JSON.stringify(n+"-version")};
|
|
23
|
+
const VERSION_URL = new URL("version.json", self.registration.scope).href;
|
|
24
|
+
let pendingCheck = null;
|
|
25
|
+
|
|
26
|
+
/** Re-downloads every app-shell file fresh, so the next page load runs the new code offline too. */
|
|
27
|
+
async function precache() {
|
|
28
|
+
const cache = await caches.open(CACHE_NAME);
|
|
29
|
+
await Promise.all(PRECACHE_URLS.map((url) => cache.add(new Request(url, { cache: "reload" }))));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Asks the server for version.json; when it differs from the last one seen, throws away every
|
|
33
|
+
* cached file, caches the new ones and tells all open pages to reload. */
|
|
34
|
+
async function runVersionCheck() {
|
|
35
|
+
try {
|
|
36
|
+
const response = await fetch(VERSION_URL, { cache: "no-store" });
|
|
37
|
+
if (!response.ok) return;
|
|
38
|
+
const latest = (await response.json()).version;
|
|
39
|
+
const store = await caches.open(VERSION_CACHE);
|
|
40
|
+
const known = await store.match(VERSION_URL);
|
|
41
|
+
const previous = known ? await known.text() : null;
|
|
42
|
+
if (previous === latest) return;
|
|
43
|
+
await store.put(VERSION_URL, new Response(latest));
|
|
44
|
+
if (previous === null) return;
|
|
45
|
+
const names = await caches.keys();
|
|
46
|
+
await Promise.all(names.filter((name) => name !== VERSION_CACHE).map((name) => caches.delete(name)));
|
|
47
|
+
await precache();
|
|
48
|
+
const pages = await self.clients.matchAll({ type: "window" });
|
|
49
|
+
pages.forEach((page) => page.postMessage("version-changed"));
|
|
50
|
+
} catch {
|
|
51
|
+
// Offline or server hiccup: keep the current cached app and try again on the next check.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
3
54
|
|
|
4
|
-
|
|
55
|
+
/** Runs one version check at a time, so a burst of page loads shares a single request. */
|
|
56
|
+
function checkVersion() {
|
|
57
|
+
pendingCheck ??= runVersionCheck().finally(() => {
|
|
58
|
+
pendingCheck = null;
|
|
59
|
+
});
|
|
60
|
+
return pendingCheck;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
self.addEventListener("message", (event) => {
|
|
64
|
+
if (event.data === "check-version") event.waitUntil(checkVersion());
|
|
65
|
+
});
|
|
5
66
|
|
|
6
67
|
self.addEventListener("install", (event) => {
|
|
7
|
-
event.waitUntil(
|
|
8
|
-
caches.open(CACHE_NAME).then((cache) => cache.addAll(PRECACHE_URLS)).then(() => self.skipWaiting())
|
|
9
|
-
);
|
|
68
|
+
event.waitUntil(precache().then(() => self.skipWaiting()));
|
|
10
69
|
});
|
|
11
70
|
|
|
12
71
|
self.addEventListener("activate", (event) => {
|
|
13
72
|
event.waitUntil(
|
|
14
73
|
caches
|
|
15
74
|
.keys()
|
|
16
|
-
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
|
|
75
|
+
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME && key !== VERSION_CACHE).map((key) => caches.delete(key))))
|
|
17
76
|
.then(() => self.clients.claim())
|
|
77
|
+
.then(checkVersion)
|
|
18
78
|
);
|
|
19
79
|
});
|
|
20
80
|
|
|
@@ -30,11 +90,13 @@ async function fromCdnCache(request) {
|
|
|
30
90
|
self.addEventListener("fetch", (event) => {
|
|
31
91
|
const { request } = event;
|
|
32
92
|
if (request.method !== "GET") return;
|
|
33
|
-
if (request.url.startsWith(BASEUI_CDN)) {
|
|
93
|
+
if (BASEUI_CDN && request.url.startsWith(BASEUI_CDN)) {
|
|
34
94
|
event.respondWith(fromCdnCache(request));
|
|
35
95
|
return;
|
|
36
96
|
}
|
|
37
97
|
if (new URL(request.url).origin !== self.location.origin) return;
|
|
98
|
+
if (request.url === VERSION_URL) return;
|
|
99
|
+
if (request.mode === "navigate") event.waitUntil(checkVersion());
|
|
38
100
|
|
|
39
101
|
event.respondWith(
|
|
40
102
|
caches.open(CACHE_NAME).then(async (cache) => {
|
|
@@ -50,4 +112,4 @@ self.addEventListener("fetch", (event) => {
|
|
|
50
112
|
})
|
|
51
113
|
);
|
|
52
114
|
});
|
|
53
|
-
`}export{d as DEFAULT_ICON_FILES,
|
|
115
|
+
`}export{d as DEFAULT_ICON_FILES,g as buildManifest,k as buildServiceWorker,m as buildServiceWorkerRegister,w as buildVersionJson};
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"themes": [
|
|
46
46
|
"themes/baseui-light.css",
|
|
47
|
-
"themes/baseui-dark.css"
|
|
47
|
+
"themes/baseui-dark.css",
|
|
48
|
+
"themes/baseui-light.min.css",
|
|
49
|
+
"themes/baseui-dark.min.css"
|
|
48
50
|
],
|
|
49
51
|
"components": [
|
|
50
52
|
{
|
|
@@ -1686,17 +1688,19 @@
|
|
|
1686
1688
|
}
|
|
1687
1689
|
],
|
|
1688
1690
|
"integrity": {
|
|
1689
|
-
"baseui.min.css": "sha384-
|
|
1691
|
+
"baseui.min.css": "sha384-ZHn0002xs5Vgxz9uxfop7VtPOQAh6E5rIJO01L/a2zmeIBWoZyFt6cnVrx75Dvuv",
|
|
1690
1692
|
"bootstrap.bundle.min.js": "sha384-RMbllTJcplkCRnELNTOc5Kz/3AvFDE/rNlJqWqfgmRWruobClBdfwvl10akQZkR1",
|
|
1691
|
-
"baseui.min.js": "sha384
|
|
1692
|
-
"baseui.esm.js": "sha384-
|
|
1693
|
-
"baseui.icons.esm.js": "sha384-
|
|
1694
|
-
"baseui.templates.xml": "sha384
|
|
1695
|
-
"baseui.block-viewer.esm.js": "sha384-
|
|
1693
|
+
"baseui.min.js": "sha384-aD8d00QW67jb6lvNvF5zTVnL6PhUxwsFM6zCf1h8PAy9HoYQCyDTuRZYoh0WRw9E",
|
|
1694
|
+
"baseui.esm.js": "sha384-frdLhpMXVNCzoVdnDtpd/y9IzPJzmNgBdKKYDYQCtLm/an9wp+LjCVPvbSpKar4O",
|
|
1695
|
+
"baseui.icons.esm.js": "sha384-ZfEsbs5m2fWdNSu4Ql+ul4mOxhfl1HviBlbxZGZ/4ud905I8Csa6/ekJjNSVkjQ0",
|
|
1696
|
+
"baseui.templates.xml": "sha384-+f/GUQVnonSoB2Q38NEa6hialYS8zT1NAAeGBtV6Kvtio+W4hOlpzihhvaCwKipc",
|
|
1697
|
+
"baseui.block-viewer.esm.js": "sha384-vOMuFxKFmcXlJnc7tF4g9+ZcZJs3E8oLe2pgyOp5ZWqJ9zsmW7S8gcS5kFIWRnY4",
|
|
1696
1698
|
"baseui.analytics.esm.js": "sha384-M6TVmchmceTvpSzgI+DNA6zAn9xmz9a+YEexCLslSo/Ngxyp2kmzs9fm+PxWy+Da",
|
|
1697
1699
|
"baseui.analytics.min.js": "sha384-B0hBkVDbT7gmDmUMazlN4Nc1KnYGSpL+IcW2hd8840knx73HGImPgGs84MvS3hKE",
|
|
1698
1700
|
"icons/lucide.json": "sha384-mc5mzpmq9eOgZVa2IcjrL33Ty4nMXE8aoZMfy+lgkC/jMQ4aYnk2S58mFsSGFnW1",
|
|
1699
|
-
"themes/baseui-light.css": "sha384
|
|
1700
|
-
"themes/baseui-dark.css": "sha384-
|
|
1701
|
+
"themes/baseui-light.css": "sha384-XhA89k6XLY7cqj+vOmbLXJJb2lqPgmtbcG7l405Npi9jrGusMb0aRzlzudm4xQjd",
|
|
1702
|
+
"themes/baseui-dark.css": "sha384-NuFHViGPtr0BsRavJuNrDwEoHCjAAWeApoFkPqcmNNG5iepRq3axVMx5TGDFoZ+M",
|
|
1703
|
+
"themes/baseui-light.min.css": "sha384-GpQ0m8Gdag3mlVieaGQwxMvkhVjd06oZaVPb9ibl8BPDTv+WtyMw5FC45Cwatr+g",
|
|
1704
|
+
"themes/baseui-dark.min.css": "sha384-sVNXeOvnAz20W2H9c8C/U7Cuj9fT7uO9carZ4uxQ6WF/3/gXe8ihqip1mW7yRfnp"
|
|
1701
1705
|
}
|
|
1702
1706
|
}
|