@nanisoft/prism-ui 0.5.1 → 0.6.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/dist/.tsbuildinfo +1 -1
- package/dist/blocks/cta-01/cta.d.ts +66 -6
- package/dist/blocks/cta-01/cta.d.ts.map +1 -1
- package/dist/blocks/cta-01/cta.js +8 -3
- package/dist/blocks/cta-01/index.d.ts +1 -0
- package/dist/blocks/cta-01/index.d.ts.map +1 -1
- package/dist/blocks/feature-grid-01/feature-grid.d.ts +57 -6
- package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
- package/dist/blocks/feature-grid-01/feature-grid.js +12 -2
- package/dist/blocks/feature-grid-01/index.d.ts +1 -0
- package/dist/blocks/feature-grid-01/index.d.ts.map +1 -1
- package/dist/blocks/hero-01/hero.d.ts +30 -1
- package/dist/blocks/hero-01/hero.d.ts.map +1 -1
- package/dist/blocks/hero-01/hero.js +14 -2
- package/dist/blocks/index.d.ts +10 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +9 -0
- package/dist/blocks/instrument-panel-01/index.d.ts +3 -0
- package/dist/blocks/instrument-panel-01/index.d.ts.map +1 -0
- package/dist/blocks/instrument-panel-01/index.js +1 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.d.ts +114 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.d.ts.map +1 -0
- package/dist/blocks/instrument-panel-01/instrument-panel.js +64 -0
- package/dist/blocks/logo-strip-01/index.d.ts +3 -0
- package/dist/blocks/logo-strip-01/index.d.ts.map +1 -0
- package/dist/blocks/logo-strip-01/index.js +1 -0
- package/dist/blocks/logo-strip-01/logo-strip.d.ts +84 -0
- package/dist/blocks/logo-strip-01/logo-strip.d.ts.map +1 -0
- package/dist/blocks/logo-strip-01/logo-strip.js +40 -0
- package/dist/blocks/note-grid-01/index.d.ts +3 -0
- package/dist/blocks/note-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/note-grid-01/index.js +1 -0
- package/dist/blocks/note-grid-01/note-grid.d.ts +79 -0
- package/dist/blocks/note-grid-01/note-grid.d.ts.map +1 -0
- package/dist/blocks/note-grid-01/note-grid.js +37 -0
- package/dist/blocks/pricing-01/pricing.js +1 -1
- package/dist/blocks/process-rail-01/index.d.ts +3 -0
- package/dist/blocks/process-rail-01/index.d.ts.map +1 -0
- package/dist/blocks/process-rail-01/index.js +1 -0
- package/dist/blocks/process-rail-01/process-rail.d.ts +99 -0
- package/dist/blocks/process-rail-01/process-rail.d.ts.map +1 -0
- package/dist/blocks/process-rail-01/process-rail.js +58 -0
- package/dist/blocks/product-grid-01/index.d.ts +3 -0
- package/dist/blocks/product-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/product-grid-01/index.js +1 -0
- package/dist/blocks/product-grid-01/product-grid.d.ts +114 -0
- package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -0
- package/dist/blocks/product-grid-01/product-grid.js +51 -0
- package/dist/blocks/site-footer/index.d.ts +3 -0
- package/dist/blocks/site-footer/index.d.ts.map +1 -0
- package/dist/blocks/site-footer/index.js +1 -0
- package/dist/blocks/site-footer/site-footer.d.ts +135 -0
- package/dist/blocks/site-footer/site-footer.d.ts.map +1 -0
- package/dist/blocks/site-footer/site-footer.js +41 -0
- package/dist/blocks/site-header/index.d.ts +3 -0
- package/dist/blocks/site-header/index.d.ts.map +1 -0
- package/dist/blocks/site-header/index.js +1 -0
- package/dist/blocks/site-header/site-header.d.ts +142 -0
- package/dist/blocks/site-header/site-header.d.ts.map +1 -0
- package/dist/blocks/site-header/site-header.js +46 -0
- package/dist/blocks/stack-grid-01/index.d.ts +3 -0
- package/dist/blocks/stack-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/stack-grid-01/index.js +1 -0
- package/dist/blocks/stack-grid-01/stack-grid.d.ts +118 -0
- package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -0
- package/dist/blocks/stack-grid-01/stack-grid.js +49 -0
- package/dist/blocks/status-ledger-01/index.d.ts +3 -0
- package/dist/blocks/status-ledger-01/index.d.ts.map +1 -0
- package/dist/blocks/status-ledger-01/index.js +1 -0
- package/dist/blocks/status-ledger-01/status-ledger.d.ts +131 -0
- package/dist/blocks/status-ledger-01/status-ledger.d.ts.map +1 -0
- package/dist/blocks/status-ledger-01/status-ledger.js +80 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +170 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6 -0
- package/dist/components/ui/card.d.ts +25 -0
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +25 -0
- package/dist/components/ui/cta-link.d.ts +45 -0
- package/dist/components/ui/cta-link.d.ts.map +1 -0
- package/dist/components/ui/cta-link.js +81 -0
- package/dist/components/ui/diagram.d.ts +154 -0
- package/dist/components/ui/diagram.d.ts.map +1 -0
- package/dist/components/ui/diagram.js +150 -0
- package/dist/components/ui/fact-list.d.ts +90 -0
- package/dist/components/ui/fact-list.d.ts.map +1 -0
- package/dist/components/ui/fact-list.js +38 -0
- package/dist/components/ui/product-mark.d.ts +115 -0
- package/dist/components/ui/product-mark.d.ts.map +1 -0
- package/dist/components/ui/product-mark.js +82 -0
- package/dist/components/ui/product-switcher.d.ts +108 -0
- package/dist/components/ui/product-switcher.d.ts.map +1 -0
- package/dist/components/ui/product-switcher.js +47 -0
- package/dist/components/ui/prose.d.ts +88 -0
- package/dist/components/ui/prose.d.ts.map +1 -0
- package/dist/components/ui/prose.js +53 -0
- package/dist/components/ui/section.d.ts +24 -1
- package/dist/components/ui/section.d.ts.map +1 -1
- package/dist/components/ui/section.js +11 -2
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +7 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/pages/blog-post-page/index.d.ts +174 -0
- package/dist/pages/blog-post-page/index.d.ts.map +1 -0
- package/dist/pages/blog-post-page/index.js +49 -0
- package/dist/pages/index.d.ts +4 -0
- package/dist/pages/index.d.ts.map +1 -1
- package/dist/pages/index.js +2 -0
- package/dist/pages/not-found-page/index.d.ts +112 -0
- package/dist/pages/not-found-page/index.d.ts.map +1 -0
- package/dist/pages/not-found-page/index.js +46 -0
- package/dist/provider/provider.d.ts +5 -0
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.js +129 -38
- package/dist/provider/theme-script.d.ts +41 -3
- package/dist/provider/theme-script.d.ts.map +1 -1
- package/dist/provider/theme-script.js +68 -17
- package/dist/styles.css +493 -12
- package/dist/theming/index.d.ts +132 -2
- package/dist/theming/index.d.ts.map +1 -1
- package/dist/theming/index.js +127 -1
- package/package.json +14 -4
|
@@ -3,11 +3,49 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A Server Component that renders one blocking script. Placed in `<head>`, it
|
|
5
5
|
* applies the stored pack and mode before React hydrates, so the first paint is
|
|
6
|
-
* already correct.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* already correct. It is safe to omit; a consumer who renders the attributes on
|
|
7
|
+
* `<html>` needs no client runtime at all.
|
|
8
|
+
*
|
|
9
|
+
* It is the only writer of `THEME_ORIGIN_ATTRIBUTE`, and it writes that
|
|
10
|
+
* attribute on every path it reaches, so the origin of the active theme is
|
|
11
|
+
* always readable and never merely absent.
|
|
12
|
+
*
|
|
13
|
+
* The string below is a second implementation of `resolveTheme`, not a copy of
|
|
14
|
+
* it that has been kept in step. A function cannot be shared with a string that
|
|
15
|
+
* a minifier rewrites: a renamed identifier inside the script's own `try` throws
|
|
16
|
+
* there, the catch swallows it, and the theme silently stops applying on every
|
|
17
|
+
* page. So the string implements the rule and
|
|
18
|
+
* `scripts/check-theme-resolution.mjs` runs BOTH over one table of stored
|
|
19
|
+
* values, which is the only thing that can hold them together.
|
|
20
|
+
*
|
|
21
|
+
* Its price is a separate ceiling, `scripts/check-boot-budget.mjs`, because this
|
|
22
|
+
* string runs before paint on every page and adding it to a table of component
|
|
23
|
+
* bundle sizes would corrupt the unit that table exists to measure.
|
|
9
24
|
*/
|
|
10
25
|
import { type Mode, type PackId } from '../theming';
|
|
26
|
+
/**
|
|
27
|
+
* The first half of the storage-migration clause: read one key this line no
|
|
28
|
+
* longer writes.
|
|
29
|
+
*
|
|
30
|
+
* Exported because `check-boot-budget.mjs` prices the clause rather than
|
|
31
|
+
* guessing at it. The emitted string contains this fragment verbatim, so its
|
|
32
|
+
* byte count is the clause's cost and not an estimate of it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const THEME_MIGRATION_READ: string;
|
|
35
|
+
/**
|
|
36
|
+
* The second half: the clause retires itself.
|
|
37
|
+
*
|
|
38
|
+
* The recovery is the only write this string performs, and it writes the
|
|
39
|
+
* recovered pair into the key this line does write and removes the key it came
|
|
40
|
+
* from, in one guarded step. That is the clause's expiry by rule rather than by
|
|
41
|
+
* number: it fires only while a retired key still holds a mode, it fires at
|
|
42
|
+
* most once per reader because its own write is what makes the second load find
|
|
43
|
+
* nothing, and it is retired for good by deleting the last entry of
|
|
44
|
+
* `LEGACY_MODE_STORAGE_KEYS`. There is no date and no version constant in it,
|
|
45
|
+
* and the gate reports how many keys are still live so the number is visible
|
|
46
|
+
* rather than remembered.
|
|
47
|
+
*/
|
|
48
|
+
export declare const THEME_MIGRATION_RETIRE = "if(G===\"legacy\"){try{localStorage.setItem(K,JSON.stringify({pack:pack,mode:m}));localStorage.removeItem(LK);}catch(e){}}";
|
|
11
49
|
export type PrismThemeScriptProps = {
|
|
12
50
|
storageKey?: string;
|
|
13
51
|
defaultPack?: PackId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-script.d.ts","sourceRoot":"","sources":["../../src/provider/theme-script.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme-script.d.ts","sourceRoot":"","sources":["../../src/provider/theme-script.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAOL,KAAK,IAAI,EACT,KAAK,MAAM,EACZ,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAEvB,CAAA;AAEV;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,+HACyF,CAAA;AAE5H,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,IAAI,CAAA;CACnB,CAAA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,UAAgC,EAChC,WAAuB,EACvB,WAAqB,GACtB,EAAE,qBAAqB,+BA+BvB"}
|
|
@@ -4,25 +4,76 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* A Server Component that renders one blocking script. Placed in `<head>`, it
|
|
6
6
|
* applies the stored pack and mode before React hydrates, so the first paint is
|
|
7
|
-
* already correct.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* already correct. It is safe to omit; a consumer who renders the attributes on
|
|
8
|
+
* `<html>` needs no client runtime at all.
|
|
9
|
+
*
|
|
10
|
+
* It is the only writer of `THEME_ORIGIN_ATTRIBUTE`, and it writes that
|
|
11
|
+
* attribute on every path it reaches, so the origin of the active theme is
|
|
12
|
+
* always readable and never merely absent.
|
|
13
|
+
*
|
|
14
|
+
* The string below is a second implementation of `resolveTheme`, not a copy of
|
|
15
|
+
* it that has been kept in step. A function cannot be shared with a string that
|
|
16
|
+
* a minifier rewrites: a renamed identifier inside the script's own `try` throws
|
|
17
|
+
* there, the catch swallows it, and the theme silently stops applying on every
|
|
18
|
+
* page. So the string implements the rule and
|
|
19
|
+
* `scripts/check-theme-resolution.mjs` runs BOTH over one table of stored
|
|
20
|
+
* values, which is the only thing that can hold them together.
|
|
21
|
+
*
|
|
22
|
+
* Its price is a separate ceiling, `scripts/check-boot-budget.mjs`, because this
|
|
23
|
+
* string runs before paint on every page and adding it to a table of component
|
|
24
|
+
* bundle sizes would corrupt the unit that table exists to measure.
|
|
25
|
+
*/
|
|
26
|
+
import { DEFAULT_STORAGE_KEY, LEGACY_MODE_STORAGE_KEYS, MODES, PACKS, PACK_ATTRIBUTE, THEME_ORIGIN_ATTRIBUTE, } from '../theming';
|
|
27
|
+
/**
|
|
28
|
+
* The first half of the storage-migration clause: read one key this line no
|
|
29
|
+
* longer writes.
|
|
30
|
+
*
|
|
31
|
+
* Exported because `check-boot-budget.mjs` prices the clause rather than
|
|
32
|
+
* guessing at it. The emitted string contains this fragment verbatim, so its
|
|
33
|
+
* byte count is the clause's cost and not an estimate of it.
|
|
34
|
+
*/
|
|
35
|
+
export const THEME_MIGRATION_READ = LEGACY_MODE_STORAGE_KEYS.map((key) => `try{var g=localStorage.getItem(${JSON.stringify(key)});if(M.indexOf(g)>-1){L=g;LK=${JSON.stringify(key)};}}catch(e){}`).join('');
|
|
36
|
+
/**
|
|
37
|
+
* The second half: the clause retires itself.
|
|
38
|
+
*
|
|
39
|
+
* The recovery is the only write this string performs, and it writes the
|
|
40
|
+
* recovered pair into the key this line does write and removes the key it came
|
|
41
|
+
* from, in one guarded step. That is the clause's expiry by rule rather than by
|
|
42
|
+
* number: it fires only while a retired key still holds a mode, it fires at
|
|
43
|
+
* most once per reader because its own write is what makes the second load find
|
|
44
|
+
* nothing, and it is retired for good by deleting the last entry of
|
|
45
|
+
* `LEGACY_MODE_STORAGE_KEYS`. There is no date and no version constant in it,
|
|
46
|
+
* and the gate reports how many keys are still live so the number is visible
|
|
47
|
+
* rather than remembered.
|
|
10
48
|
*/
|
|
11
|
-
|
|
49
|
+
export const THEME_MIGRATION_RETIRE = 'if(G==="legacy"){try{localStorage.setItem(K,JSON.stringify({pack:pack,mode:m}));localStorage.removeItem(LK);}catch(e){}}';
|
|
12
50
|
export function PrismThemeScript({ storageKey = DEFAULT_STORAGE_KEY, defaultPack = 'default', defaultMode = 'light', }) {
|
|
13
51
|
const script = '(function(){try{' +
|
|
14
|
-
'var
|
|
15
|
-
`
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
`
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
'
|
|
52
|
+
'var r=document.documentElement,' +
|
|
53
|
+
`P=${JSON.stringify(PACKS)},` +
|
|
54
|
+
`M=${JSON.stringify(MODES)},` +
|
|
55
|
+
`K=${JSON.stringify(storageKey)},` +
|
|
56
|
+
`A=${JSON.stringify(PACK_ATTRIBUTE)},` +
|
|
57
|
+
`O=${JSON.stringify(THEME_ORIGIN_ATTRIBUTE)},` +
|
|
58
|
+
`DP=${JSON.stringify(defaultPack)},` +
|
|
59
|
+
`DM=${JSON.stringify(defaultMode)},` +
|
|
60
|
+
'L=null,LK=null,S=null,T=null;' +
|
|
61
|
+
'try{var t=localStorage.getItem(K);if(t){T=t;S=JSON.parse(t);}}catch(e){}' +
|
|
62
|
+
THEME_MIGRATION_READ +
|
|
63
|
+
'var a=r.getAttribute(A),' +
|
|
64
|
+
'DPK=P.indexOf(a)>-1?a:null,' +
|
|
65
|
+
'DK=r.classList.contains("dark")?"dark":null,' +
|
|
66
|
+
'U=S&&typeof S=="object"&&P.indexOf(S.pack)>-1&&M.indexOf(S.mode)>-1,' +
|
|
67
|
+
'pack,m,G;' +
|
|
68
|
+
'if(U){pack=S.pack;m=S.mode;G="stored";}' +
|
|
69
|
+
'else if(T){pack=DPK||DP;m=DK||DM;G="unparsed";}' +
|
|
70
|
+
'else if(L){pack=DP;m=L;G="legacy";}' +
|
|
71
|
+
'else if(DPK||DK){pack=DPK||DP;m=DK||DM;G="document";}' +
|
|
72
|
+
'else{pack=DP;m=DM;G="default";}' +
|
|
73
|
+
THEME_MIGRATION_RETIRE +
|
|
74
|
+
'if(pack!=="default"){r.setAttribute(A,pack);}else{r.removeAttribute(A);}' +
|
|
75
|
+
'r.classList.toggle("dark",m==="dark");' +
|
|
76
|
+
'r.setAttribute(O,G);' +
|
|
77
|
+
'}catch(e){}})();';
|
|
27
78
|
return _jsx("script", { dangerouslySetInnerHTML: { __html: script } });
|
|
28
79
|
}
|