@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.
Files changed (126) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/blocks/cta-01/cta.d.ts +66 -6
  3. package/dist/blocks/cta-01/cta.d.ts.map +1 -1
  4. package/dist/blocks/cta-01/cta.js +8 -3
  5. package/dist/blocks/cta-01/index.d.ts +1 -0
  6. package/dist/blocks/cta-01/index.d.ts.map +1 -1
  7. package/dist/blocks/feature-grid-01/feature-grid.d.ts +57 -6
  8. package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
  9. package/dist/blocks/feature-grid-01/feature-grid.js +12 -2
  10. package/dist/blocks/feature-grid-01/index.d.ts +1 -0
  11. package/dist/blocks/feature-grid-01/index.d.ts.map +1 -1
  12. package/dist/blocks/hero-01/hero.d.ts +30 -1
  13. package/dist/blocks/hero-01/hero.d.ts.map +1 -1
  14. package/dist/blocks/hero-01/hero.js +14 -2
  15. package/dist/blocks/index.d.ts +10 -0
  16. package/dist/blocks/index.d.ts.map +1 -1
  17. package/dist/blocks/index.js +9 -0
  18. package/dist/blocks/instrument-panel-01/index.d.ts +3 -0
  19. package/dist/blocks/instrument-panel-01/index.d.ts.map +1 -0
  20. package/dist/blocks/instrument-panel-01/index.js +1 -0
  21. package/dist/blocks/instrument-panel-01/instrument-panel.d.ts +114 -0
  22. package/dist/blocks/instrument-panel-01/instrument-panel.d.ts.map +1 -0
  23. package/dist/blocks/instrument-panel-01/instrument-panel.js +64 -0
  24. package/dist/blocks/logo-strip-01/index.d.ts +3 -0
  25. package/dist/blocks/logo-strip-01/index.d.ts.map +1 -0
  26. package/dist/blocks/logo-strip-01/index.js +1 -0
  27. package/dist/blocks/logo-strip-01/logo-strip.d.ts +84 -0
  28. package/dist/blocks/logo-strip-01/logo-strip.d.ts.map +1 -0
  29. package/dist/blocks/logo-strip-01/logo-strip.js +40 -0
  30. package/dist/blocks/note-grid-01/index.d.ts +3 -0
  31. package/dist/blocks/note-grid-01/index.d.ts.map +1 -0
  32. package/dist/blocks/note-grid-01/index.js +1 -0
  33. package/dist/blocks/note-grid-01/note-grid.d.ts +79 -0
  34. package/dist/blocks/note-grid-01/note-grid.d.ts.map +1 -0
  35. package/dist/blocks/note-grid-01/note-grid.js +37 -0
  36. package/dist/blocks/pricing-01/pricing.js +1 -1
  37. package/dist/blocks/process-rail-01/index.d.ts +3 -0
  38. package/dist/blocks/process-rail-01/index.d.ts.map +1 -0
  39. package/dist/blocks/process-rail-01/index.js +1 -0
  40. package/dist/blocks/process-rail-01/process-rail.d.ts +99 -0
  41. package/dist/blocks/process-rail-01/process-rail.d.ts.map +1 -0
  42. package/dist/blocks/process-rail-01/process-rail.js +58 -0
  43. package/dist/blocks/product-grid-01/index.d.ts +3 -0
  44. package/dist/blocks/product-grid-01/index.d.ts.map +1 -0
  45. package/dist/blocks/product-grid-01/index.js +1 -0
  46. package/dist/blocks/product-grid-01/product-grid.d.ts +114 -0
  47. package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -0
  48. package/dist/blocks/product-grid-01/product-grid.js +51 -0
  49. package/dist/blocks/site-footer/index.d.ts +3 -0
  50. package/dist/blocks/site-footer/index.d.ts.map +1 -0
  51. package/dist/blocks/site-footer/index.js +1 -0
  52. package/dist/blocks/site-footer/site-footer.d.ts +135 -0
  53. package/dist/blocks/site-footer/site-footer.d.ts.map +1 -0
  54. package/dist/blocks/site-footer/site-footer.js +41 -0
  55. package/dist/blocks/site-header/index.d.ts +3 -0
  56. package/dist/blocks/site-header/index.d.ts.map +1 -0
  57. package/dist/blocks/site-header/index.js +1 -0
  58. package/dist/blocks/site-header/site-header.d.ts +142 -0
  59. package/dist/blocks/site-header/site-header.d.ts.map +1 -0
  60. package/dist/blocks/site-header/site-header.js +46 -0
  61. package/dist/blocks/stack-grid-01/index.d.ts +3 -0
  62. package/dist/blocks/stack-grid-01/index.d.ts.map +1 -0
  63. package/dist/blocks/stack-grid-01/index.js +1 -0
  64. package/dist/blocks/stack-grid-01/stack-grid.d.ts +118 -0
  65. package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -0
  66. package/dist/blocks/stack-grid-01/stack-grid.js +49 -0
  67. package/dist/blocks/status-ledger-01/index.d.ts +3 -0
  68. package/dist/blocks/status-ledger-01/index.d.ts.map +1 -0
  69. package/dist/blocks/status-ledger-01/index.js +1 -0
  70. package/dist/blocks/status-ledger-01/status-ledger.d.ts +131 -0
  71. package/dist/blocks/status-ledger-01/status-ledger.d.ts.map +1 -0
  72. package/dist/blocks/status-ledger-01/status-ledger.js +80 -0
  73. package/dist/catalog.d.ts.map +1 -1
  74. package/dist/catalog.js +170 -0
  75. package/dist/components/index.d.ts +11 -0
  76. package/dist/components/index.d.ts.map +1 -1
  77. package/dist/components/index.js +6 -0
  78. package/dist/components/ui/card.d.ts +25 -0
  79. package/dist/components/ui/card.d.ts.map +1 -1
  80. package/dist/components/ui/card.js +25 -0
  81. package/dist/components/ui/cta-link.d.ts +45 -0
  82. package/dist/components/ui/cta-link.d.ts.map +1 -0
  83. package/dist/components/ui/cta-link.js +81 -0
  84. package/dist/components/ui/diagram.d.ts +154 -0
  85. package/dist/components/ui/diagram.d.ts.map +1 -0
  86. package/dist/components/ui/diagram.js +150 -0
  87. package/dist/components/ui/fact-list.d.ts +90 -0
  88. package/dist/components/ui/fact-list.d.ts.map +1 -0
  89. package/dist/components/ui/fact-list.js +38 -0
  90. package/dist/components/ui/product-mark.d.ts +115 -0
  91. package/dist/components/ui/product-mark.d.ts.map +1 -0
  92. package/dist/components/ui/product-mark.js +82 -0
  93. package/dist/components/ui/product-switcher.d.ts +108 -0
  94. package/dist/components/ui/product-switcher.d.ts.map +1 -0
  95. package/dist/components/ui/product-switcher.js +47 -0
  96. package/dist/components/ui/prose.d.ts +88 -0
  97. package/dist/components/ui/prose.d.ts.map +1 -0
  98. package/dist/components/ui/prose.js +53 -0
  99. package/dist/components/ui/section.d.ts +24 -1
  100. package/dist/components/ui/section.d.ts.map +1 -1
  101. package/dist/components/ui/section.js +11 -2
  102. package/dist/components/ui/slider.d.ts.map +1 -1
  103. package/dist/components/ui/slider.js +7 -1
  104. package/dist/index.d.ts +24 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +17 -0
  107. package/dist/pages/blog-post-page/index.d.ts +174 -0
  108. package/dist/pages/blog-post-page/index.d.ts.map +1 -0
  109. package/dist/pages/blog-post-page/index.js +49 -0
  110. package/dist/pages/index.d.ts +4 -0
  111. package/dist/pages/index.d.ts.map +1 -1
  112. package/dist/pages/index.js +2 -0
  113. package/dist/pages/not-found-page/index.d.ts +112 -0
  114. package/dist/pages/not-found-page/index.d.ts.map +1 -0
  115. package/dist/pages/not-found-page/index.js +46 -0
  116. package/dist/provider/provider.d.ts +5 -0
  117. package/dist/provider/provider.d.ts.map +1 -1
  118. package/dist/provider/provider.js +129 -38
  119. package/dist/provider/theme-script.d.ts +41 -3
  120. package/dist/provider/theme-script.d.ts.map +1 -1
  121. package/dist/provider/theme-script.js +68 -17
  122. package/dist/styles.css +493 -12
  123. package/dist/theming/index.d.ts +132 -2
  124. package/dist/theming/index.d.ts.map +1 -1
  125. package/dist/theming/index.js +127 -1
  126. 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. Precedence matches `PrismProvider`: stored value, then the
7
- * server-rendered attribute, then the defaults. It is safe to omit; a consumer
8
- * who renders the attributes on `<html>` needs no client runtime at all.
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;;;;;;;;GAQG;AACH,OAAO,EAAqC,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAA;AAEtF,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,+BAkBvB"}
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. Precedence matches `PrismProvider`: stored value, then the
8
- * server-rendered attribute, then the defaults. It is safe to omit; a consumer
9
- * who renders the attributes on `<html>` needs no client runtime at all.
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
- import { DEFAULT_STORAGE_KEY, MODES, PACKS } from '../theming';
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 root=document.documentElement;' +
15
- `var packs=${JSON.stringify(PACKS)};` +
16
- `var modes=${JSON.stringify(MODES)};` +
17
- 'var stored=null;' +
18
- `try{stored=JSON.parse(localStorage.getItem(${JSON.stringify(storageKey)})||"null");}catch(ignored){}` +
19
- 'var pack=stored&&packs.indexOf(stored.pack)>-1?stored.pack:(root.getAttribute("data-pack")||' +
20
- `${JSON.stringify(defaultPack)});` +
21
- 'var mode=stored&&modes.indexOf(stored.mode)>-1?stored.mode:(root.classList.contains("dark")?"dark":' +
22
- `${JSON.stringify(defaultMode)});` +
23
- `if(packs.indexOf(pack)<0){pack=${JSON.stringify(defaultPack)};}` +
24
- 'if(pack&&pack!=="default"){root.setAttribute("data-pack",pack);}else{root.removeAttribute("data-pack");}' +
25
- 'root.classList.toggle("dark",mode==="dark");' +
26
- '}catch(ignored){}})();';
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
  }