@burojs/ui-shadcn 0.3.0 → 0.4.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 (63) hide show
  1. package/README.md +4 -2
  2. package/dist/index.cjs +15044 -16998
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +3488 -3105
  5. package/dist/index.d.ts +3488 -3105
  6. package/dist/index.js +14965 -16860
  7. package/dist/index.js.map +1 -1
  8. package/dist/layout/theme-storage-key.cjs +5 -10
  9. package/dist/layout/theme-storage-key.cjs.map +1 -1
  10. package/dist/layout/theme-storage-key.d.cts +2 -23
  11. package/dist/layout/theme-storage-key.d.ts +2 -23
  12. package/dist/layout/theme-storage-key.js +5 -2
  13. package/dist/layout/theme-storage-key.js.map +1 -1
  14. package/dist/markdown/index.cjs +424 -511
  15. package/dist/markdown/index.cjs.map +1 -1
  16. package/dist/markdown/index.d.cts +1072 -34
  17. package/dist/markdown/index.d.ts +1072 -34
  18. package/dist/markdown/index.js +411 -459
  19. package/dist/markdown/index.js.map +1 -1
  20. package/dist/rich-text-IDFvyvRE.js +454 -0
  21. package/dist/rich-text-IDFvyvRE.js.map +1 -0
  22. package/dist/rich-text-lndbYqzR.cjs +457 -0
  23. package/dist/rich-text-lndbYqzR.cjs.map +1 -0
  24. package/dist/styles.css +14 -8
  25. package/dist/theme/theme-css.cjs +95 -96
  26. package/dist/theme/theme-css.cjs.map +1 -1
  27. package/dist/theme/theme-css.d.cts +10 -8
  28. package/dist/theme/theme-css.d.ts +10 -8
  29. package/dist/theme/theme-css.js +94 -94
  30. package/dist/theme/theme-css.js.map +1 -1
  31. package/dist/theme/theme-storage.cjs +34 -39
  32. package/dist/theme/theme-storage.cjs.map +1 -1
  33. package/dist/theme/theme-storage.d.cts +3 -1
  34. package/dist/theme/theme-storage.d.ts +3 -1
  35. package/dist/theme/theme-storage.js +33 -37
  36. package/dist/theme/theme-storage.js.map +1 -1
  37. package/dist/theme-storage-key-pYlp4aDS.d.cts +31 -0
  38. package/dist/theme-storage-key-pYlp4aDS.d.ts +31 -0
  39. package/dist/use-theme-BwPWinB2.cjs +246 -0
  40. package/dist/use-theme-BwPWinB2.cjs.map +1 -0
  41. package/dist/use-theme-IHmtrhEt.js +170 -0
  42. package/dist/use-theme-IHmtrhEt.js.map +1 -0
  43. package/package.json +10 -11
  44. package/dist/chunk-ABUQPOOE.js +0 -11
  45. package/dist/chunk-ABUQPOOE.js.map +0 -1
  46. package/dist/chunk-DBGGWBFG.cjs +0 -199
  47. package/dist/chunk-DBGGWBFG.cjs.map +0 -1
  48. package/dist/chunk-FMX4GLCQ.js +0 -6
  49. package/dist/chunk-FMX4GLCQ.js.map +0 -1
  50. package/dist/chunk-UC57Z243.js +0 -143
  51. package/dist/chunk-UC57Z243.js.map +0 -1
  52. package/dist/chunk-UPGPO75B.js +0 -164
  53. package/dist/chunk-UPGPO75B.js.map +0 -1
  54. package/dist/chunk-VXJAXJ3U.cjs +0 -8
  55. package/dist/chunk-VXJAXJ3U.cjs.map +0 -1
  56. package/dist/chunk-W7AEYE7A.cjs +0 -13
  57. package/dist/chunk-W7AEYE7A.cjs.map +0 -1
  58. package/dist/chunk-YF5IW525.cjs +0 -155
  59. package/dist/chunk-YF5IW525.cjs.map +0 -1
  60. package/dist/rich-text-6V7WZ3WV.cjs +0 -518
  61. package/dist/rich-text-6V7WZ3WV.cjs.map +0 -1
  62. package/dist/rich-text-N2FZEJJV.js +0 -491
  63. package/dist/rich-text-N2FZEJJV.js.map +0 -1
@@ -1,51 +1,46 @@
1
- 'use strict';
2
-
3
- // src/theme/theme-storage.ts
4
- var THEME_CSS_STORAGE_KEY = "buro-theme-css";
5
- var THEME_CSS_STYLE_ELEMENT_ID = "buro-theme-css";
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/theme/theme-storage.ts
3
+ const THEME_CSS_STORAGE_KEY = "buro-theme-css";
4
+ const THEME_CSS_STYLE_ELEMENT_ID = "buro-theme-css";
6
5
  function readThemeCss() {
7
- if (typeof window === "undefined") return null;
8
- try {
9
- const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);
10
- return css && css.length > 0 ? css : null;
11
- } catch {
12
- return null;
13
- }
6
+ if (typeof window === "undefined") return null;
7
+ try {
8
+ const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);
9
+ return css && css.length > 0 ? css : null;
10
+ } catch {
11
+ return null;
12
+ }
14
13
  }
15
14
  function writeThemeCss(css) {
16
- if (typeof window === "undefined") return;
17
- try {
18
- if (css === null || css.length === 0) {
19
- window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);
20
- } else {
21
- window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);
22
- }
23
- } catch {
24
- }
15
+ if (typeof window === "undefined") return;
16
+ try {
17
+ if (css === null || css.length === 0) window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);
18
+ else window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);
19
+ } catch {}
25
20
  }
26
21
  function applyThemeCss(css) {
27
- if (typeof document === "undefined") return;
28
- const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);
29
- if (css === null || css.length === 0) {
30
- existing?.remove();
31
- return;
32
- }
33
- if (existing instanceof HTMLStyleElement) {
34
- existing.textContent = css;
35
- document.head.appendChild(existing);
36
- return;
37
- }
38
- existing?.remove();
39
- const style = document.createElement("style");
40
- style.id = THEME_CSS_STYLE_ELEMENT_ID;
41
- style.textContent = css;
42
- document.head.appendChild(style);
22
+ if (typeof document === "undefined") return;
23
+ const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);
24
+ if (css === null || css.length === 0) {
25
+ existing?.remove();
26
+ return;
27
+ }
28
+ if (existing instanceof HTMLStyleElement) {
29
+ existing.textContent = css;
30
+ document.head.appendChild(existing);
31
+ return;
32
+ }
33
+ existing?.remove();
34
+ const style = document.createElement("style");
35
+ style.id = THEME_CSS_STYLE_ELEMENT_ID;
36
+ style.textContent = css;
37
+ document.head.appendChild(style);
43
38
  }
44
-
39
+ //#endregion
45
40
  exports.THEME_CSS_STORAGE_KEY = THEME_CSS_STORAGE_KEY;
46
41
  exports.THEME_CSS_STYLE_ELEMENT_ID = THEME_CSS_STYLE_ELEMENT_ID;
47
42
  exports.applyThemeCss = applyThemeCss;
48
43
  exports.readThemeCss = readThemeCss;
49
44
  exports.writeThemeCss = writeThemeCss;
50
- //# sourceMappingURL=theme-storage.cjs.map
45
+
51
46
  //# sourceMappingURL=theme-storage.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/theme-storage.ts"],"names":[],"mappings":";;;AAuCO,IAAM,qBAAA,GAAwB;AAK9B,IAAM,0BAAA,GAA6B;AAQnC,SAAS,YAAA,GAA8B;AAC5C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,IAAA;AAC1C,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,qBAAqB,CAAA;AAC7D,IAAA,OAAO,GAAA,IAAO,GAAA,CAAI,MAAA,GAAS,CAAA,GAAI,GAAA,GAAM,IAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAWO,SAAS,cAAc,GAAA,EAA0B;AACtD,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,IAAI;AACF,IAAA,IAAI,GAAA,KAAQ,IAAA,IAAQ,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AACpC,MAAA,MAAA,CAAO,YAAA,CAAa,WAAW,qBAAqB,CAAA;AAAA,IACtD,CAAA,MAAO;AACL,MAAA,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,qBAAA,EAAuB,GAAG,CAAA;AAAA,IACxD;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAGR;AACF;AAcO,SAAS,cAAc,GAAA,EAA0B;AACtD,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,cAAA,CAAe,0BAA0B,CAAA;AAEnE,EAAA,IAAI,GAAA,KAAQ,IAAA,IAAQ,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AACpC,IAAA,QAAA,EAAU,MAAA,EAAO;AACjB,IAAA;AAAA,EACF;AAEA,EAAA,IAAI,oBAAoB,gBAAA,EAAkB;AACxC,IAAA,QAAA,CAAS,WAAA,GAAc,GAAA;AACvB,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,QAAQ,CAAA;AAClC,IAAA;AAAA,EACF;AACA,EAAA,QAAA,EAAU,MAAA,EAAO;AAEjB,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA;AAC5C,EAAA,KAAA,CAAM,EAAA,GAAK,0BAAA;AACX,EAAA,KAAA,CAAM,WAAA,GAAc,GAAA;AACpB,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,KAAK,CAAA;AACjC","file":"theme-storage.cjs","sourcesContent":["/**\n * Persists and applies the active PALETTE theme's CSS — separate concern\n * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),\n * which holds light/dark/system. That key answers \"which class goes on\n * `<html>`\"; this one answers \"what custom-property values does `:root`/\n * `.dark` carry\". A theme picker calling `writeThemeCss` must never touch\n * `THEME_STORAGE_KEY`, and the light/dark toggle must never touch this one —\n * each write path only ever calls its own key's functions, so there is no\n * shared code path where a bug could cross-contaminate them.\n *\n * The stored value is the theme's CSS **in full** (already reduced to just\n * `:root`/`.dark` by `stripThemeCss`), not a theme id. That is what makes a\n * pasted (tweakcn) theme and a built-in theme indistinguishable to this\n * module and to the bootstrap script: neither has to know the built-in\n * theme catalogue, ship it in the bundle, or fetch it over the network\n * before paint. The cost is that this module does NOT validate — a caller\n * that wants the \".dark block present\" guarantee must run `validateThemeCss`\n * itself before calling `writeThemeCss` (the theme picker does this; see its\n * task). `applyThemeCss` and the bootstrap script just inject whatever\n * string is there. That is deliberate, not an oversight: CSS parsing is\n * forgiving by construction — unknown/malformed declarations are dropped\n * rule-by-rule by the browser's own parser, not fatal — so blindly injecting\n * a corrupt or half-written string degrades to \"some rules don't apply\", not\n * a crash or a blank page. Re-validating on every read would also block\n * first paint on running `parseTopLevelBlocks` over an arbitrarily large\n * string, which is exactly the cost the bootstrap script exists to avoid.\n *\n * Deliberately its own module, no React import, same reasoning as\n * `theme-storage-key.ts`: the ONE consumer that needs `THEME_CSS_STORAGE_KEY`\n * and `applyThemeCss` outside a hook is the bootstrap `<script>` in the\n * playground's root `app/layout.tsx`, a Server Component that cannot import\n * anything carrying `'use client'`. This file has no hooks, so it can be\n * imported there directly via the `@burojs/ui-shadcn/theme-storage` subpath.\n */\n\n/**\n * The localStorage key for the active theme's CSS text. Kept apart from\n * `THEME_STORAGE_KEY` on purpose — see the module doc comment above.\n */\nexport const THEME_CSS_STORAGE_KEY = 'buro-theme-css';\n\n/** The id of the `<style>` element the bootstrap script and `applyThemeCss`\n * both create/update. Exported so a test can assert on it without\n * retyping the literal. */\nexport const THEME_CSS_STYLE_ELEMENT_ID = 'buro-theme-css';\n\n/**\n * Reads the persisted theme CSS, or `null` if nothing is stored, storage is\n * unavailable (SSR, or a browser with it disabled — e.g. some private-mode\n * configurations throw on access rather than just being empty), or the\n * stored value is an empty string (treated the same as absent).\n */\nexport function readThemeCss(): string | null {\n if (typeof window === 'undefined') return null;\n try {\n const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);\n return css && css.length > 0 ? css : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Persists (or, given `null`, clears) the theme CSS. Does not validate —\n * callers that need the \".dark present\" guarantee run `validateThemeCss`\n * first (see module doc comment). Swallows storage errors (quota exceeded\n * from an oversized paste, storage disabled, etc.): the in-memory\n * application via `applyThemeCss` already happened by the time a caller\n * persists, so a failed write loses the choice on next reload but does not\n * throw or break the current page.\n */\nexport function writeThemeCss(css: string | null): void {\n if (typeof window === 'undefined') return;\n try {\n if (css === null || css.length === 0) {\n window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);\n } else {\n window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);\n }\n } catch {\n // Quota exceeded, storage disabled, or a similar DOMException — nothing\n // persisted. The caller's in-memory `applyThemeCss` call still stands.\n }\n}\n\n/**\n * Creates, updates, or removes the `<style id=\"buro-theme-css\">`\n * element that carries the active theme's `:root`/`.dark` custom\n * properties. Given `null` (or an empty string), removes the element\n * entirely rather than leaving an empty tag behind.\n *\n * Order matters: this function always places the element at the END of\n * `<head>`, including when updating a style created by a prepaint bootstrap.\n * That lets an app call it after its own stylesheet has loaded so the theme's\n * equal-specificity `:root`/`.dark` rules win the cascade without creating a\n * duplicate element.\n */\nexport function applyThemeCss(css: string | null): void {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);\n\n if (css === null || css.length === 0) {\n existing?.remove();\n return;\n }\n\n if (existing instanceof HTMLStyleElement) {\n existing.textContent = css;\n document.head.appendChild(existing);\n return;\n }\n existing?.remove(); // defensive: same id but somehow not a <style>\n\n const style = document.createElement('style');\n style.id = THEME_CSS_STYLE_ELEMENT_ID;\n style.textContent = css;\n document.head.appendChild(style);\n}\n"]}
1
+ {"version":3,"file":"theme-storage.cjs","names":[],"sources":["../../src/theme/theme-storage.ts"],"sourcesContent":["/**\n * Persists and applies the active PALETTE theme's CSS — separate concern\n * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),\n * which holds light/dark/system. That key answers \"which class goes on\n * `<html>`\"; this one answers \"what custom-property values does `:root`/\n * `.dark` carry\". A theme picker calling `writeThemeCss` must never touch\n * `THEME_STORAGE_KEY`, and the light/dark toggle must never touch this one —\n * each write path only ever calls its own key's functions, so there is no\n * shared code path where a bug could cross-contaminate them.\n *\n * The stored value is the theme's CSS **in full** (already reduced to just\n * `:root`/`.dark` by `stripThemeCss`), not a theme id. That is what makes a\n * pasted (tweakcn) theme and a built-in theme indistinguishable to this\n * module and to the bootstrap script: neither has to know the built-in\n * theme catalogue, ship it in the bundle, or fetch it over the network\n * before paint. The cost is that this module does NOT validate — a caller\n * that wants the \".dark block present\" guarantee must run `validateThemeCss`\n * itself before calling `writeThemeCss` (the theme picker does this; see its\n * task). `applyThemeCss` and the bootstrap script just inject whatever\n * string is there. That is deliberate, not an oversight: CSS parsing is\n * forgiving by construction — unknown/malformed declarations are dropped\n * rule-by-rule by the browser's own parser, not fatal — so blindly injecting\n * a corrupt or half-written string degrades to \"some rules don't apply\", not\n * a crash or a blank page. Re-validating on every read would also block\n * first paint on running `parseTopLevelBlocks` over an arbitrarily large\n * string, which is exactly the cost the bootstrap script exists to avoid.\n *\n * Deliberately its own module, no React import, same reasoning as\n * `theme-storage-key.ts`: the ONE consumer that needs `THEME_CSS_STORAGE_KEY`\n * and `applyThemeCss` outside a hook is the bootstrap `<script>` in the\n * playground's root `app/layout.tsx`, a Server Component that cannot import\n * anything carrying `'use client'`. This file has no hooks, so it can be\n * imported there directly via the `@burojs/ui-shadcn/theme-storage` subpath.\n */\n\n/**\n * The localStorage key for the active theme's CSS text. Kept apart from\n * `THEME_STORAGE_KEY` on purpose — see the module doc comment above.\n */\nexport const THEME_CSS_STORAGE_KEY = 'buro-theme-css';\n\n/** The id of the `<style>` element the bootstrap script and `applyThemeCss`\n * both create/update. Exported so a test can assert on it without\n * retyping the literal. */\nexport const THEME_CSS_STYLE_ELEMENT_ID = 'buro-theme-css';\n\n/**\n * Reads the persisted theme CSS, or `null` if nothing is stored, storage is\n * unavailable (SSR, or a browser with it disabled — e.g. some private-mode\n * configurations throw on access rather than just being empty), or the\n * stored value is an empty string (treated the same as absent).\n */\nexport function readThemeCss(): string | null {\n if (typeof window === 'undefined') return null;\n try {\n const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);\n return css && css.length > 0 ? css : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Persists (or, given `null`, clears) the theme CSS. Does not validate —\n * callers that need the \".dark present\" guarantee run `validateThemeCss`\n * first (see module doc comment). Swallows storage errors (quota exceeded\n * from an oversized paste, storage disabled, etc.): the in-memory\n * application via `applyThemeCss` already happened by the time a caller\n * persists, so a failed write loses the choice on next reload but does not\n * throw or break the current page.\n */\nexport function writeThemeCss(css: string | null): void {\n if (typeof window === 'undefined') return;\n try {\n if (css === null || css.length === 0) {\n window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);\n } else {\n window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);\n }\n } catch {\n // Quota exceeded, storage disabled, or a similar DOMException — nothing\n // persisted. The caller's in-memory `applyThemeCss` call still stands.\n }\n}\n\n/**\n * Creates, updates, or removes the `<style id=\"buro-theme-css\">`\n * element that carries the active theme's `:root`/`.dark` custom\n * properties. Given `null` (or an empty string), removes the element\n * entirely rather than leaving an empty tag behind.\n *\n * Order matters: this function always places the element at the END of\n * `<head>`, including when updating a style created by a prepaint bootstrap.\n * That lets an app call it after its own stylesheet has loaded so the theme's\n * equal-specificity `:root`/`.dark` rules win the cascade without creating a\n * duplicate element.\n */\nexport function applyThemeCss(css: string | null): void {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);\n\n if (css === null || css.length === 0) {\n existing?.remove();\n return;\n }\n\n if (existing instanceof HTMLStyleElement) {\n existing.textContent = css;\n document.head.appendChild(existing);\n return;\n }\n existing?.remove(); // defensive: same id but somehow not a <style>\n\n const style = document.createElement('style');\n style.id = THEME_CSS_STYLE_ELEMENT_ID;\n style.textContent = css;\n document.head.appendChild(style);\n}\n"],"mappings":";;AAuCA,MAAa,wBAAwB;AAKrC,MAAa,6BAA6B;AAQ1C,SAAgB,eAA8B;CAC5C,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,IAAI;EACF,MAAM,MAAM,OAAO,aAAa,QAAQ,qBAAqB;EAC7D,OAAO,OAAO,IAAI,SAAS,IAAI,MAAM;CACvC,QAAQ;EACN,OAAO;CACT;AACF;AAWA,SAAgB,cAAc,KAA0B;CACtD,IAAI,OAAO,WAAW,aAAa;CACnC,IAAI;EACF,IAAI,QAAQ,QAAQ,IAAI,WAAW,GACjC,OAAO,aAAa,WAAW,qBAAqB;OAEpD,OAAO,aAAa,QAAQ,uBAAuB,GAAG;CAE1D,QAAQ,CAGR;AACF;AAcA,SAAgB,cAAc,KAA0B;CACtD,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,WAAW,SAAS,eAAe,0BAA0B;CAEnE,IAAI,QAAQ,QAAQ,IAAI,WAAW,GAAG;EACpC,UAAU,OAAO;EACjB;CACF;CAEA,IAAI,oBAAoB,kBAAkB;EACxC,SAAS,cAAc;EACvB,SAAS,KAAK,YAAY,QAAQ;EAClC;CACF;CACA,UAAU,OAAO;CAEjB,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,KAAK;CACX,MAAM,cAAc;CACpB,SAAS,KAAK,YAAY,KAAK;AACjC"}
@@ -1,3 +1,4 @@
1
+ //#region src/theme/theme-storage.d.ts
1
2
  /**
2
3
  * Persists and applies the active PALETTE theme's CSS — separate concern
3
4
  * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),
@@ -71,5 +72,6 @@ declare function writeThemeCss(css: string | null): void;
71
72
  * duplicate element.
72
73
  */
73
74
  declare function applyThemeCss(css: string | null): void;
74
-
75
+ //#endregion
75
76
  export { THEME_CSS_STORAGE_KEY, THEME_CSS_STYLE_ELEMENT_ID, applyThemeCss, readThemeCss, writeThemeCss };
77
+ //# sourceMappingURL=theme-storage.d.cts.map
@@ -1,3 +1,4 @@
1
+ //#region src/theme/theme-storage.d.ts
1
2
  /**
2
3
  * Persists and applies the active PALETTE theme's CSS — separate concern
3
4
  * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),
@@ -71,5 +72,6 @@ declare function writeThemeCss(css: string | null): void;
71
72
  * duplicate element.
72
73
  */
73
74
  declare function applyThemeCss(css: string | null): void;
74
-
75
+ //#endregion
75
76
  export { THEME_CSS_STORAGE_KEY, THEME_CSS_STYLE_ELEMENT_ID, applyThemeCss, readThemeCss, writeThemeCss };
77
+ //# sourceMappingURL=theme-storage.d.ts.map
@@ -1,45 +1,41 @@
1
- // src/theme/theme-storage.ts
2
- var THEME_CSS_STORAGE_KEY = "buro-theme-css";
3
- var THEME_CSS_STYLE_ELEMENT_ID = "buro-theme-css";
1
+ //#region src/theme/theme-storage.ts
2
+ const THEME_CSS_STORAGE_KEY = "buro-theme-css";
3
+ const THEME_CSS_STYLE_ELEMENT_ID = "buro-theme-css";
4
4
  function readThemeCss() {
5
- if (typeof window === "undefined") return null;
6
- try {
7
- const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);
8
- return css && css.length > 0 ? css : null;
9
- } catch {
10
- return null;
11
- }
5
+ if (typeof window === "undefined") return null;
6
+ try {
7
+ const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);
8
+ return css && css.length > 0 ? css : null;
9
+ } catch {
10
+ return null;
11
+ }
12
12
  }
13
13
  function writeThemeCss(css) {
14
- if (typeof window === "undefined") return;
15
- try {
16
- if (css === null || css.length === 0) {
17
- window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);
18
- } else {
19
- window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);
20
- }
21
- } catch {
22
- }
14
+ if (typeof window === "undefined") return;
15
+ try {
16
+ if (css === null || css.length === 0) window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);
17
+ else window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);
18
+ } catch {}
23
19
  }
24
20
  function applyThemeCss(css) {
25
- if (typeof document === "undefined") return;
26
- const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);
27
- if (css === null || css.length === 0) {
28
- existing?.remove();
29
- return;
30
- }
31
- if (existing instanceof HTMLStyleElement) {
32
- existing.textContent = css;
33
- document.head.appendChild(existing);
34
- return;
35
- }
36
- existing?.remove();
37
- const style = document.createElement("style");
38
- style.id = THEME_CSS_STYLE_ELEMENT_ID;
39
- style.textContent = css;
40
- document.head.appendChild(style);
21
+ if (typeof document === "undefined") return;
22
+ const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);
23
+ if (css === null || css.length === 0) {
24
+ existing?.remove();
25
+ return;
26
+ }
27
+ if (existing instanceof HTMLStyleElement) {
28
+ existing.textContent = css;
29
+ document.head.appendChild(existing);
30
+ return;
31
+ }
32
+ existing?.remove();
33
+ const style = document.createElement("style");
34
+ style.id = THEME_CSS_STYLE_ELEMENT_ID;
35
+ style.textContent = css;
36
+ document.head.appendChild(style);
41
37
  }
42
-
38
+ //#endregion
43
39
  export { THEME_CSS_STORAGE_KEY, THEME_CSS_STYLE_ELEMENT_ID, applyThemeCss, readThemeCss, writeThemeCss };
44
- //# sourceMappingURL=theme-storage.js.map
40
+
45
41
  //# sourceMappingURL=theme-storage.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/theme-storage.ts"],"names":[],"mappings":";AAuCO,IAAM,qBAAA,GAAwB;AAK9B,IAAM,0BAAA,GAA6B;AAQnC,SAAS,YAAA,GAA8B;AAC5C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,IAAA;AAC1C,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,qBAAqB,CAAA;AAC7D,IAAA,OAAO,GAAA,IAAO,GAAA,CAAI,MAAA,GAAS,CAAA,GAAI,GAAA,GAAM,IAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAWO,SAAS,cAAc,GAAA,EAA0B;AACtD,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,IAAI;AACF,IAAA,IAAI,GAAA,KAAQ,IAAA,IAAQ,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AACpC,MAAA,MAAA,CAAO,YAAA,CAAa,WAAW,qBAAqB,CAAA;AAAA,IACtD,CAAA,MAAO;AACL,MAAA,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,qBAAA,EAAuB,GAAG,CAAA;AAAA,IACxD;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAGR;AACF;AAcO,SAAS,cAAc,GAAA,EAA0B;AACtD,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,cAAA,CAAe,0BAA0B,CAAA;AAEnE,EAAA,IAAI,GAAA,KAAQ,IAAA,IAAQ,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AACpC,IAAA,QAAA,EAAU,MAAA,EAAO;AACjB,IAAA;AAAA,EACF;AAEA,EAAA,IAAI,oBAAoB,gBAAA,EAAkB;AACxC,IAAA,QAAA,CAAS,WAAA,GAAc,GAAA;AACvB,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,QAAQ,CAAA;AAClC,IAAA;AAAA,EACF;AACA,EAAA,QAAA,EAAU,MAAA,EAAO;AAEjB,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA;AAC5C,EAAA,KAAA,CAAM,EAAA,GAAK,0BAAA;AACX,EAAA,KAAA,CAAM,WAAA,GAAc,GAAA;AACpB,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,KAAK,CAAA;AACjC","file":"theme-storage.js","sourcesContent":["/**\n * Persists and applies the active PALETTE theme's CSS — separate concern\n * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),\n * which holds light/dark/system. That key answers \"which class goes on\n * `<html>`\"; this one answers \"what custom-property values does `:root`/\n * `.dark` carry\". A theme picker calling `writeThemeCss` must never touch\n * `THEME_STORAGE_KEY`, and the light/dark toggle must never touch this one —\n * each write path only ever calls its own key's functions, so there is no\n * shared code path where a bug could cross-contaminate them.\n *\n * The stored value is the theme's CSS **in full** (already reduced to just\n * `:root`/`.dark` by `stripThemeCss`), not a theme id. That is what makes a\n * pasted (tweakcn) theme and a built-in theme indistinguishable to this\n * module and to the bootstrap script: neither has to know the built-in\n * theme catalogue, ship it in the bundle, or fetch it over the network\n * before paint. The cost is that this module does NOT validate — a caller\n * that wants the \".dark block present\" guarantee must run `validateThemeCss`\n * itself before calling `writeThemeCss` (the theme picker does this; see its\n * task). `applyThemeCss` and the bootstrap script just inject whatever\n * string is there. That is deliberate, not an oversight: CSS parsing is\n * forgiving by construction — unknown/malformed declarations are dropped\n * rule-by-rule by the browser's own parser, not fatal — so blindly injecting\n * a corrupt or half-written string degrades to \"some rules don't apply\", not\n * a crash or a blank page. Re-validating on every read would also block\n * first paint on running `parseTopLevelBlocks` over an arbitrarily large\n * string, which is exactly the cost the bootstrap script exists to avoid.\n *\n * Deliberately its own module, no React import, same reasoning as\n * `theme-storage-key.ts`: the ONE consumer that needs `THEME_CSS_STORAGE_KEY`\n * and `applyThemeCss` outside a hook is the bootstrap `<script>` in the\n * playground's root `app/layout.tsx`, a Server Component that cannot import\n * anything carrying `'use client'`. This file has no hooks, so it can be\n * imported there directly via the `@burojs/ui-shadcn/theme-storage` subpath.\n */\n\n/**\n * The localStorage key for the active theme's CSS text. Kept apart from\n * `THEME_STORAGE_KEY` on purpose — see the module doc comment above.\n */\nexport const THEME_CSS_STORAGE_KEY = 'buro-theme-css';\n\n/** The id of the `<style>` element the bootstrap script and `applyThemeCss`\n * both create/update. Exported so a test can assert on it without\n * retyping the literal. */\nexport const THEME_CSS_STYLE_ELEMENT_ID = 'buro-theme-css';\n\n/**\n * Reads the persisted theme CSS, or `null` if nothing is stored, storage is\n * unavailable (SSR, or a browser with it disabled — e.g. some private-mode\n * configurations throw on access rather than just being empty), or the\n * stored value is an empty string (treated the same as absent).\n */\nexport function readThemeCss(): string | null {\n if (typeof window === 'undefined') return null;\n try {\n const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);\n return css && css.length > 0 ? css : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Persists (or, given `null`, clears) the theme CSS. Does not validate —\n * callers that need the \".dark present\" guarantee run `validateThemeCss`\n * first (see module doc comment). Swallows storage errors (quota exceeded\n * from an oversized paste, storage disabled, etc.): the in-memory\n * application via `applyThemeCss` already happened by the time a caller\n * persists, so a failed write loses the choice on next reload but does not\n * throw or break the current page.\n */\nexport function writeThemeCss(css: string | null): void {\n if (typeof window === 'undefined') return;\n try {\n if (css === null || css.length === 0) {\n window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);\n } else {\n window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);\n }\n } catch {\n // Quota exceeded, storage disabled, or a similar DOMException — nothing\n // persisted. The caller's in-memory `applyThemeCss` call still stands.\n }\n}\n\n/**\n * Creates, updates, or removes the `<style id=\"buro-theme-css\">`\n * element that carries the active theme's `:root`/`.dark` custom\n * properties. Given `null` (or an empty string), removes the element\n * entirely rather than leaving an empty tag behind.\n *\n * Order matters: this function always places the element at the END of\n * `<head>`, including when updating a style created by a prepaint bootstrap.\n * That lets an app call it after its own stylesheet has loaded so the theme's\n * equal-specificity `:root`/`.dark` rules win the cascade without creating a\n * duplicate element.\n */\nexport function applyThemeCss(css: string | null): void {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);\n\n if (css === null || css.length === 0) {\n existing?.remove();\n return;\n }\n\n if (existing instanceof HTMLStyleElement) {\n existing.textContent = css;\n document.head.appendChild(existing);\n return;\n }\n existing?.remove(); // defensive: same id but somehow not a <style>\n\n const style = document.createElement('style');\n style.id = THEME_CSS_STYLE_ELEMENT_ID;\n style.textContent = css;\n document.head.appendChild(style);\n}\n"]}
1
+ {"version":3,"file":"theme-storage.js","names":[],"sources":["../../src/theme/theme-storage.ts"],"sourcesContent":["/**\n * Persists and applies the active PALETTE theme's CSS — separate concern\n * from `THEME_STORAGE_KEY` (`packages/ui-shadcn/src/layout/theme-storage-key.ts`),\n * which holds light/dark/system. That key answers \"which class goes on\n * `<html>`\"; this one answers \"what custom-property values does `:root`/\n * `.dark` carry\". A theme picker calling `writeThemeCss` must never touch\n * `THEME_STORAGE_KEY`, and the light/dark toggle must never touch this one —\n * each write path only ever calls its own key's functions, so there is no\n * shared code path where a bug could cross-contaminate them.\n *\n * The stored value is the theme's CSS **in full** (already reduced to just\n * `:root`/`.dark` by `stripThemeCss`), not a theme id. That is what makes a\n * pasted (tweakcn) theme and a built-in theme indistinguishable to this\n * module and to the bootstrap script: neither has to know the built-in\n * theme catalogue, ship it in the bundle, or fetch it over the network\n * before paint. The cost is that this module does NOT validate — a caller\n * that wants the \".dark block present\" guarantee must run `validateThemeCss`\n * itself before calling `writeThemeCss` (the theme picker does this; see its\n * task). `applyThemeCss` and the bootstrap script just inject whatever\n * string is there. That is deliberate, not an oversight: CSS parsing is\n * forgiving by construction — unknown/malformed declarations are dropped\n * rule-by-rule by the browser's own parser, not fatal — so blindly injecting\n * a corrupt or half-written string degrades to \"some rules don't apply\", not\n * a crash or a blank page. Re-validating on every read would also block\n * first paint on running `parseTopLevelBlocks` over an arbitrarily large\n * string, which is exactly the cost the bootstrap script exists to avoid.\n *\n * Deliberately its own module, no React import, same reasoning as\n * `theme-storage-key.ts`: the ONE consumer that needs `THEME_CSS_STORAGE_KEY`\n * and `applyThemeCss` outside a hook is the bootstrap `<script>` in the\n * playground's root `app/layout.tsx`, a Server Component that cannot import\n * anything carrying `'use client'`. This file has no hooks, so it can be\n * imported there directly via the `@burojs/ui-shadcn/theme-storage` subpath.\n */\n\n/**\n * The localStorage key for the active theme's CSS text. Kept apart from\n * `THEME_STORAGE_KEY` on purpose — see the module doc comment above.\n */\nexport const THEME_CSS_STORAGE_KEY = 'buro-theme-css';\n\n/** The id of the `<style>` element the bootstrap script and `applyThemeCss`\n * both create/update. Exported so a test can assert on it without\n * retyping the literal. */\nexport const THEME_CSS_STYLE_ELEMENT_ID = 'buro-theme-css';\n\n/**\n * Reads the persisted theme CSS, or `null` if nothing is stored, storage is\n * unavailable (SSR, or a browser with it disabled — e.g. some private-mode\n * configurations throw on access rather than just being empty), or the\n * stored value is an empty string (treated the same as absent).\n */\nexport function readThemeCss(): string | null {\n if (typeof window === 'undefined') return null;\n try {\n const css = window.localStorage.getItem(THEME_CSS_STORAGE_KEY);\n return css && css.length > 0 ? css : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Persists (or, given `null`, clears) the theme CSS. Does not validate —\n * callers that need the \".dark present\" guarantee run `validateThemeCss`\n * first (see module doc comment). Swallows storage errors (quota exceeded\n * from an oversized paste, storage disabled, etc.): the in-memory\n * application via `applyThemeCss` already happened by the time a caller\n * persists, so a failed write loses the choice on next reload but does not\n * throw or break the current page.\n */\nexport function writeThemeCss(css: string | null): void {\n if (typeof window === 'undefined') return;\n try {\n if (css === null || css.length === 0) {\n window.localStorage.removeItem(THEME_CSS_STORAGE_KEY);\n } else {\n window.localStorage.setItem(THEME_CSS_STORAGE_KEY, css);\n }\n } catch {\n // Quota exceeded, storage disabled, or a similar DOMException — nothing\n // persisted. The caller's in-memory `applyThemeCss` call still stands.\n }\n}\n\n/**\n * Creates, updates, or removes the `<style id=\"buro-theme-css\">`\n * element that carries the active theme's `:root`/`.dark` custom\n * properties. Given `null` (or an empty string), removes the element\n * entirely rather than leaving an empty tag behind.\n *\n * Order matters: this function always places the element at the END of\n * `<head>`, including when updating a style created by a prepaint bootstrap.\n * That lets an app call it after its own stylesheet has loaded so the theme's\n * equal-specificity `:root`/`.dark` rules win the cascade without creating a\n * duplicate element.\n */\nexport function applyThemeCss(css: string | null): void {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById(THEME_CSS_STYLE_ELEMENT_ID);\n\n if (css === null || css.length === 0) {\n existing?.remove();\n return;\n }\n\n if (existing instanceof HTMLStyleElement) {\n existing.textContent = css;\n document.head.appendChild(existing);\n return;\n }\n existing?.remove(); // defensive: same id but somehow not a <style>\n\n const style = document.createElement('style');\n style.id = THEME_CSS_STYLE_ELEMENT_ID;\n style.textContent = css;\n document.head.appendChild(style);\n}\n"],"mappings":";AAuCA,MAAa,wBAAwB;AAKrC,MAAa,6BAA6B;AAQ1C,SAAgB,eAA8B;CAC5C,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,IAAI;EACF,MAAM,MAAM,OAAO,aAAa,QAAQ,qBAAqB;EAC7D,OAAO,OAAO,IAAI,SAAS,IAAI,MAAM;CACvC,QAAQ;EACN,OAAO;CACT;AACF;AAWA,SAAgB,cAAc,KAA0B;CACtD,IAAI,OAAO,WAAW,aAAa;CACnC,IAAI;EACF,IAAI,QAAQ,QAAQ,IAAI,WAAW,GACjC,OAAO,aAAa,WAAW,qBAAqB;OAEpD,OAAO,aAAa,QAAQ,uBAAuB,GAAG;CAE1D,QAAQ,CAGR;AACF;AAcA,SAAgB,cAAc,KAA0B;CACtD,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,WAAW,SAAS,eAAe,0BAA0B;CAEnE,IAAI,QAAQ,QAAQ,IAAI,WAAW,GAAG;EACpC,UAAU,OAAO;EACjB;CACF;CAEA,IAAI,oBAAoB,kBAAkB;EACxC,SAAS,cAAc;EACvB,SAAS,KAAK,YAAY,QAAQ;EAClC;CACF;CACA,UAAU,OAAO;CAEjB,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,KAAK;CACX,MAAM,cAAc;CACpB,SAAS,KAAK,YAAY,KAAK;AACjC"}
@@ -0,0 +1,31 @@
1
+ //#region src/layout/theme-storage-key.d.ts
2
+ /**
3
+ * The ONE localStorage key every theme-aware place in the app must agree on.
4
+ * Exported so nothing re-types the string — two files agreeing on a literal
5
+ * is how they drift.
6
+ *
7
+ * Deliberately its own module: no `'use client'`, no React import, nothing
8
+ * that would pull in `use-theme.ts`'s hook (or the rest of the kit's client
9
+ * component tree). That matters because the consumer that needs this
10
+ * constant outside a hook is a pre-paint bootstrap `<script>` in a Next root
11
+ * `app/layout.tsx` — a Server Component, which cannot itself carry
12
+ * `'use client'`. `examples/next/app/layout.tsx` is that consumer, and after
13
+ * SP9 deleted `apps/playground` it is the only one; a plain-HTML host has the
14
+ * same need but no module graph to satisfy it from, which is why
15
+ * `examples/marketplace-ops/index.html` spells the key as a literal and pins
16
+ * it against this constant in a test instead.
17
+ * Importing from the package's main entry (`@burojs/ui-shadcn`)
18
+ * there fails Next's server/client boundary check, because that entry
19
+ * bundles the whole kit — including many components that call hooks —
20
+ * into one file without a top-level `'use client'` directive (the bundler
21
+ * drops it when merging multiple client modules together — true of tsdown,
22
+ * as it was of tsup). Importing this file
23
+ * directly via the `@burojs/ui-shadcn/theme-storage-key` subpath sidesteps
24
+ * that: it has no hooks, so a Server Component can import the real string
25
+ * value at build/SSR time. `use-theme.ts` re-exports the same constant for
26
+ * everyone else, so there is exactly one literal in the whole codebase.
27
+ */
28
+ declare const THEME_STORAGE_KEY = "buro-theme";
29
+ //#endregion
30
+ export { THEME_STORAGE_KEY as t };
31
+ //# sourceMappingURL=theme-storage-key-pYlp4aDS.d.cts.map
@@ -0,0 +1,31 @@
1
+ //#region src/layout/theme-storage-key.d.ts
2
+ /**
3
+ * The ONE localStorage key every theme-aware place in the app must agree on.
4
+ * Exported so nothing re-types the string — two files agreeing on a literal
5
+ * is how they drift.
6
+ *
7
+ * Deliberately its own module: no `'use client'`, no React import, nothing
8
+ * that would pull in `use-theme.ts`'s hook (or the rest of the kit's client
9
+ * component tree). That matters because the consumer that needs this
10
+ * constant outside a hook is a pre-paint bootstrap `<script>` in a Next root
11
+ * `app/layout.tsx` — a Server Component, which cannot itself carry
12
+ * `'use client'`. `examples/next/app/layout.tsx` is that consumer, and after
13
+ * SP9 deleted `apps/playground` it is the only one; a plain-HTML host has the
14
+ * same need but no module graph to satisfy it from, which is why
15
+ * `examples/marketplace-ops/index.html` spells the key as a literal and pins
16
+ * it against this constant in a test instead.
17
+ * Importing from the package's main entry (`@burojs/ui-shadcn`)
18
+ * there fails Next's server/client boundary check, because that entry
19
+ * bundles the whole kit — including many components that call hooks —
20
+ * into one file without a top-level `'use client'` directive (the bundler
21
+ * drops it when merging multiple client modules together — true of tsdown,
22
+ * as it was of tsup). Importing this file
23
+ * directly via the `@burojs/ui-shadcn/theme-storage-key` subpath sidesteps
24
+ * that: it has no hooks, so a Server Component can import the real string
25
+ * value at build/SSR time. `use-theme.ts` re-exports the same constant for
26
+ * everyone else, so there is exactly one literal in the whole codebase.
27
+ */
28
+ declare const THEME_STORAGE_KEY = "buro-theme";
29
+ //#endregion
30
+ export { THEME_STORAGE_KEY as t };
31
+ //# sourceMappingURL=theme-storage-key-pYlp4aDS.d.ts.map
@@ -0,0 +1,246 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ const require_layout_theme_storage_key = require("./layout/theme-storage-key.cjs");
24
+ let react = require("react");
25
+ let clsx = require("clsx");
26
+ let tailwind_merge = require("tailwind-merge");
27
+ let github_slugger = require("github-slugger");
28
+ github_slugger = __toESM(github_slugger, 1);
29
+ //#region src/lib/cn.ts
30
+ function cn(...inputs) {
31
+ return (0, tailwind_merge.twMerge)((0, clsx.clsx)(inputs));
32
+ }
33
+ //#endregion
34
+ //#region src/markdown/anchors.ts
35
+ const DOC_ID_PREFIX = "user-content-";
36
+ function docSlug(text) {
37
+ return new github_slugger.default().slug(text);
38
+ }
39
+ function readDocHash() {
40
+ if (typeof window === "undefined") return "";
41
+ const raw = window.location.hash.replace(/^#/, "");
42
+ if (raw === "") return "";
43
+ try {
44
+ return decodeURIComponent(raw);
45
+ } catch {
46
+ return raw;
47
+ }
48
+ }
49
+ function findDocAnchor(hash, root = document) {
50
+ let id = hash.replace(/^#/, "");
51
+ if (id === "") return null;
52
+ try {
53
+ id = decodeURIComponent(id);
54
+ } catch {}
55
+ const doc = root.ownerDocument ?? root;
56
+ const pick = (candidate) => {
57
+ const el = doc.getElementById(candidate);
58
+ if (!el) return null;
59
+ return root === doc || root.contains(el) ? el : null;
60
+ };
61
+ return pick("user-content-" + id) ?? pick(id);
62
+ }
63
+ function placeInScroller(target) {
64
+ let container = target.parentElement;
65
+ while (container) {
66
+ const style = getComputedStyle(container);
67
+ if (/(auto|scroll)/.test(style.overflowY) && container.scrollHeight > container.clientHeight + 1) break;
68
+ container = container.parentElement;
69
+ }
70
+ if (!container) {
71
+ target.scrollIntoView({
72
+ block: "start",
73
+ behavior: "auto"
74
+ });
75
+ return;
76
+ }
77
+ const margin = Number.parseFloat(getComputedStyle(target).scrollMarginTop) || 0;
78
+ const delta = target.getBoundingClientRect().top - container.getBoundingClientRect().top - margin;
79
+ container.scrollTop += delta;
80
+ }
81
+ function scrollToDocAnchor(hash, root = document.body, settleMs = 1500) {
82
+ let stopped = false;
83
+ const go = () => {
84
+ if (stopped) return;
85
+ const target = findDocAnchor(hash, root);
86
+ if (target) placeInScroller(target);
87
+ };
88
+ const raf1 = requestAnimationFrame(() => requestAnimationFrame(go));
89
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => requestAnimationFrame(go));
90
+ observer?.observe(root);
91
+ const timer = setTimeout(() => {
92
+ stopped = true;
93
+ observer?.disconnect();
94
+ }, settleMs);
95
+ return () => {
96
+ stopped = true;
97
+ cancelAnimationFrame(raf1);
98
+ observer?.disconnect();
99
+ clearTimeout(timer);
100
+ };
101
+ }
102
+ function docShareUrl(slug, href = window.location.href) {
103
+ const url = new URL(href);
104
+ const safe = /[#?%\s]/.test(slug) ? encodeURIComponent(slug) : slug;
105
+ return `${url.origin}${url.pathname}${url.search}#${safe}`;
106
+ }
107
+ //#endregion
108
+ //#region src/layout/use-theme.ts
109
+ function systemPrefersDark() {
110
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
111
+ }
112
+ function readChoice() {
113
+ if (typeof window === "undefined") return "system";
114
+ try {
115
+ const saved = window.localStorage.getItem(require_layout_theme_storage_key.THEME_STORAGE_KEY);
116
+ if (saved === "light" || saved === "dark") return saved;
117
+ } catch {}
118
+ return "system";
119
+ }
120
+ function resolveTheme(choice) {
121
+ if (choice === "light" || choice === "dark") return choice;
122
+ return systemPrefersDark() ? "dark" : "light";
123
+ }
124
+ function applyDomClass(resolved) {
125
+ if (typeof document === "undefined") return;
126
+ document.documentElement.classList.toggle("dark", resolved === "dark");
127
+ }
128
+ function persistChoice(choice) {
129
+ if (typeof window === "undefined") return;
130
+ try {
131
+ if (choice === "system") window.localStorage.removeItem(require_layout_theme_storage_key.THEME_STORAGE_KEY);
132
+ else window.localStorage.setItem(require_layout_theme_storage_key.THEME_STORAGE_KEY, choice);
133
+ } catch {}
134
+ }
135
+ function useTheme() {
136
+ const [state, setState] = (0, react.useState)({
137
+ choice: "system",
138
+ resolved: "light"
139
+ });
140
+ (0, react.useEffect)(() => {
141
+ const choice = readChoice();
142
+ setState({
143
+ choice,
144
+ resolved: resolveTheme(choice)
145
+ });
146
+ const root = document.documentElement;
147
+ const observer = new MutationObserver(() => {
148
+ const resolved = root.classList.contains("dark") ? "dark" : "light";
149
+ setState((prev) => prev.resolved === resolved ? prev : {
150
+ ...prev,
151
+ resolved
152
+ });
153
+ });
154
+ observer.observe(root, {
155
+ attributes: true,
156
+ attributeFilter: ["class"]
157
+ });
158
+ const mql = typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
159
+ const onSystemChange = (event) => {
160
+ const choice = readChoice();
161
+ if (choice !== "system") return;
162
+ const resolved = event.matches ? "dark" : "light";
163
+ applyDomClass(resolved);
164
+ setState((prev) => prev.choice === choice && prev.resolved === resolved ? prev : {
165
+ choice,
166
+ resolved
167
+ });
168
+ };
169
+ mql?.addEventListener("change", onSystemChange);
170
+ return () => {
171
+ observer.disconnect();
172
+ mql?.removeEventListener("change", onSystemChange);
173
+ };
174
+ }, []);
175
+ const setTheme = (0, react.useCallback)((next) => {
176
+ const resolved = resolveTheme(next);
177
+ applyDomClass(resolved);
178
+ persistChoice(next);
179
+ setState({
180
+ choice: next,
181
+ resolved
182
+ });
183
+ }, []);
184
+ return {
185
+ choice: state.choice,
186
+ resolved: state.resolved,
187
+ setTheme
188
+ };
189
+ }
190
+ //#endregion
191
+ Object.defineProperty(exports, "DOC_ID_PREFIX", {
192
+ enumerable: true,
193
+ get: function() {
194
+ return DOC_ID_PREFIX;
195
+ }
196
+ });
197
+ Object.defineProperty(exports, "__toESM", {
198
+ enumerable: true,
199
+ get: function() {
200
+ return __toESM;
201
+ }
202
+ });
203
+ Object.defineProperty(exports, "cn", {
204
+ enumerable: true,
205
+ get: function() {
206
+ return cn;
207
+ }
208
+ });
209
+ Object.defineProperty(exports, "docShareUrl", {
210
+ enumerable: true,
211
+ get: function() {
212
+ return docShareUrl;
213
+ }
214
+ });
215
+ Object.defineProperty(exports, "docSlug", {
216
+ enumerable: true,
217
+ get: function() {
218
+ return docSlug;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, "findDocAnchor", {
222
+ enumerable: true,
223
+ get: function() {
224
+ return findDocAnchor;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, "readDocHash", {
228
+ enumerable: true,
229
+ get: function() {
230
+ return readDocHash;
231
+ }
232
+ });
233
+ Object.defineProperty(exports, "scrollToDocAnchor", {
234
+ enumerable: true,
235
+ get: function() {
236
+ return scrollToDocAnchor;
237
+ }
238
+ });
239
+ Object.defineProperty(exports, "useTheme", {
240
+ enumerable: true,
241
+ get: function() {
242
+ return useTheme;
243
+ }
244
+ });
245
+
246
+ //# sourceMappingURL=use-theme-BwPWinB2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-theme-BwPWinB2.cjs","names":["twMerge","GithubSlugger","THEME_STORAGE_KEY","useState","useCallback"],"sources":["../src/lib/cn.ts","../src/markdown/anchors.ts","../src/layout/use-theme.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import GithubSlugger from 'github-slugger';\n\n/**\n * Anchor identity for documentation, in ONE place.\n *\n * Three things have to agree on what `#kak-ustroen-gtin` means: `rehype-slug`,\n * which stamps ids onto headings; the FAQ accordion, which is built from\n * headings but never goes through rehype; and whatever scrolls to a hash. When\n * they disagree the link simply does nothing — no error, no console warning,\n * the page just sits there — so the algorithm lives here and everyone imports it.\n *\n * `github-slugger` is not an extra dependency: `rehype-slug` uses it internally,\n * which is exactly why it is the right choice — matching its output by\n * reimplementing it would be a slow-motion bug in a language with case rules,\n * combining marks and a Cyrillic alphabet.\n */\n\n/** Prefix `rehype-sanitize` renames every id to. See `defaultSchema.clobberPrefix`. */\nexport const DOC_ID_PREFIX = 'user-content-';\n\n/**\n * Slug for a heading's text — the value that appears in a shareable `#hash`.\n *\n * A fresh slugger per call ON PURPOSE. `GithubSlugger` is stateful: it\n * remembers what it has emitted and disambiguates repeats as `foo-1`, `foo-2`.\n * That is right when walking one document top to bottom, and wrong here, where\n * the same heading must produce the same hash every time it is asked about.\n */\nexport function docSlug(text: string): string {\n return new GithubSlugger().slug(text);\n}\n\n/**\n * The current fragment, DECODED, without its `#`.\n *\n * `window.location.hash` hands back a percent-encoded string —\n * `#%D0%BF%D0%BE%D1%87%D0%B5%D0%BC%D1%83…` for `#почему…` — so every\n * comparison against a slug fails, silently, for exactly the alphabet this\n * project writes its documentation in. It works perfectly in English, which is\n * the worst possible way for it to be wrong.\n */\nexport function readDocHash(): string {\n if (typeof window === 'undefined') return '';\n const raw = window.location.hash.replace(/^#/, '');\n if (raw === '') return '';\n try {\n return decodeURIComponent(raw);\n } catch {\n // A malformed escape sequence is not worth throwing over.\n return raw;\n }\n}\n\n/**\n * Find the element a hash points at.\n *\n * Tries the prefixed id first, because a heading inside sanitized Markdown is\n * the common case, then the bare one for anchors we render ourselves (the FAQ\n * accordion, which is built from React and never passes through the sanitizer).\n */\nexport function findDocAnchor(hash: string, root: Document | Element = document): Element | null {\n let id = hash.replace(/^#/, '');\n if (id === '') return null;\n try {\n id = decodeURIComponent(id);\n } catch {\n /* keep the raw form */\n }\n\n /*\n `getElementById`, NOT `querySelector('#'+id)`.\n\n A fragment is user input — it arrives from the address bar — and `#a.b:c`\n is a perfectly ordinary thing to paste and an invalid CSS selector, so\n `querySelector` throws a `SyntaxError` on it. `CSS.escape` would fix that\n where it exists, and it does not exist in jsdom, so the crash would have\n been invisible to the unit suite and live only in production. Looking an id\n up by id involves no selector parsing at all.\n */\n const doc = root.ownerDocument ?? (root as Document);\n const pick = (candidate: string): Element | null => {\n const el = doc.getElementById(candidate);\n if (!el) return null;\n // Scoped lookups must not reach outside their root — the handbook searches\n // within the open article so a stale heading elsewhere cannot win.\n return root === doc || root.contains(el) ? el : null;\n };\n return pick(DOC_ID_PREFIX + id) ?? pick(id);\n}\n\n/**\n * Bring an element to the top of ITS OWN scroll container, and nothing else.\n *\n * `scrollIntoView` cannot be used here. It scrolls EVERY scrollable ancestor,\n * the document included — and the document does scroll in this shell, because\n * `SidebarInset` is `min-h-svh` and the app's own sidebar can exceed a short\n * viewport. Clicking an anchor therefore dragged the whole page up: the app\n * header and the handbook's own search box went off the top of the screen, and\n * the layout read as broken. Caught in a screenshot, not by any assertion.\n *\n * Walking to the nearest scrollable ancestor and moving only that keeps the\n * effect where the reader expects it — inside the column they are reading.\n * `scroll-margin-top` is honoured by hand, since we are no longer going through\n * the API that would apply it.\n */\nfunction placeInScroller(target: Element): void {\n let container = target.parentElement;\n while (container) {\n const style = getComputedStyle(container);\n if (\n /(auto|scroll)/.test(style.overflowY) &&\n container.scrollHeight > container.clientHeight + 1\n ) {\n break;\n }\n container = container.parentElement;\n }\n if (!container) {\n // Nothing between here and the document scrolls; the browser's own\n // behaviour is then exactly right.\n target.scrollIntoView({ block: 'start', behavior: 'auto' });\n return;\n }\n const margin = Number.parseFloat(getComputedStyle(target).scrollMarginTop) || 0;\n const delta = target.getBoundingClientRect().top - container.getBoundingClientRect().top - margin;\n container.scrollTop += delta;\n}\n\n/**\n * Scroll to an anchor and KEEP it in view while the article settles.\n *\n * One `scrollIntoView` is not enough here. An article's height is not final\n * when its markup lands: a mermaid diagram renders asynchronously and a lazily\n * loaded image has no height until it arrives, and either one appearing ABOVE\n * the target pushes it back down — the reader watches the page scroll to the\n * right place and then drift away from it. Measured: the target ended 731px\n * down a 709px pane, i.e. just off the bottom.\n *\n * So the scroll is repeated whenever the container resizes, for a short window\n * and no longer. The window is a deliberate ceiling rather than a guess at how\n * long rendering takes: after it, the reader owns the scroll position, and\n * yanking it back because a late image loaded would be worse than being a few\n * pixels off.\n */\nexport function scrollToDocAnchor(\n hash: string,\n root: Element = document.body,\n settleMs = 1500,\n): () => void {\n let stopped = false;\n const go = () => {\n if (stopped) return;\n const target = findDocAnchor(hash, root);\n if (target) placeInScroller(target);\n };\n // Two frames: markdown → hast → DOM, then layout.\n const raf1 = requestAnimationFrame(() => requestAnimationFrame(go));\n\n const observer =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(() => requestAnimationFrame(go));\n observer?.observe(root);\n const timer = setTimeout(() => {\n stopped = true;\n observer?.disconnect();\n }, settleMs);\n\n return () => {\n stopped = true;\n cancelAnimationFrame(raf1);\n observer?.disconnect();\n clearTimeout(timer);\n };\n}\n\n/**\n * A shareable url for an anchor on the current page — READABLE.\n *\n * `new URL(…).toString()` percent-encodes the fragment, so a Russian heading\n * becomes forty characters of `%D0%BF%D0%BE…`. That is correct and unusable:\n * the entire point of this link is being pasted into a message where a person\n * reads it, and a wall of escapes tells them nothing about where it goes.\n * Browsers accept a literal fragment and encode it themselves on navigation.\n *\n * The slug is still escaped if it contains anything that would change how the\n * url PARSES — `#`, `?`, whitespace, or a stray `%`. `github-slugger` does not\n * emit those, but this is the one place where being wrong produces a link that\n * silently points somewhere else.\n */\nexport function docShareUrl(slug: string, href: string = window.location.href): string {\n const url = new URL(href);\n const safe = /[#?%\\s]/.test(slug) ? encodeURIComponent(slug) : slug;\n return `${url.origin}${url.pathname}${url.search}#${safe}`;\n}\n","'use client';\nimport { useCallback, useEffect, useState } from 'react';\nimport { THEME_STORAGE_KEY } from './theme-storage-key.js';\n\n/**\n * Re-exported here so most consumers only need one import path. A pre-paint\n * bootstrap is the one exception — `examples/next/app/layout.tsx` imports the\n * constant from the separate, hook-free `@burojs/ui-shadcn/theme-storage-key`\n * subpath instead; see `./theme-storage-key.js` for why a Server Component\n * cannot import it from here.\n */\nexport { THEME_STORAGE_KEY };\n\n/** What the user picked. `'system'` means \"no explicit choice\" — nothing is\n * persisted for it; its absence from storage IS the `system` state. */\nexport type ThemeChoice = 'light' | 'dark' | 'system';\n\n/** What is actually painted. Never `'system'` — every reader (Toaster,\n * CodeMirror, Mermaid) only ever needs to know light or dark. */\nexport type ResolvedTheme = 'light' | 'dark';\n\nexport interface UseThemeResult {\n /** The persisted preference, including `'system'`. Only the theme\n * submenu (the one place with a three-way control) needs this. */\n choice: ThemeChoice;\n /** The resolved light/dark value, kept in sync with the `dark` class on\n * `<html>`. This is what every read-only consumer wants. */\n resolved: ResolvedTheme;\n /** Set a new choice: applies the `dark` class immediately and persists\n * (or, for `'system'`, clears) the preference. */\n setTheme: (next: ThemeChoice) => void;\n}\n\nfunction systemPrefersDark(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n );\n}\n\nfunction readChoice(): ThemeChoice {\n if (typeof window === 'undefined') return 'system';\n try {\n const saved = window.localStorage.getItem(THEME_STORAGE_KEY);\n if (saved === 'light' || saved === 'dark') return saved;\n } catch {\n // localStorage may be disabled — fall through to system\n }\n return 'system';\n}\n\nfunction resolveTheme(choice: ThemeChoice): ResolvedTheme {\n if (choice === 'light' || choice === 'dark') return choice;\n return systemPrefersDark() ? 'dark' : 'light';\n}\n\nfunction applyDomClass(resolved: ResolvedTheme): void {\n if (typeof document === 'undefined') return;\n document.documentElement.classList.toggle('dark', resolved === 'dark');\n}\n\nfunction persistChoice(choice: ThemeChoice): void {\n if (typeof window === 'undefined') return;\n try {\n if (choice === 'system') window.localStorage.removeItem(THEME_STORAGE_KEY);\n else window.localStorage.setItem(THEME_STORAGE_KEY, choice);\n } catch {\n // localStorage may be disabled — the class flip already applied.\n }\n}\n\ninterface ThemeState {\n choice: ThemeChoice;\n resolved: ResolvedTheme;\n}\n\n/**\n * Single source of truth for light/dark/system, replacing seven places that\n * each used to know about the theme independently (a bootstrap script, a\n * command-palette action, a submenu, an unused kit component, and three\n * MutationObserver-based readers).\n *\n * Read-only consumers (Toaster, CodeMirror, Mermaid) only need `resolved`\n * and don't call the public `setTheme` — they stay in sync via the\n * `<html class=\"dark\">` MutationObserver below, which fires regardless of\n * WHICH writer flipped it. That is deliberate: it's the same mechanism these\n * three already used individually before this hook existed, now shared\n * instead of duplicated, and it means a future writer doesn't need to know\n * about every reader. Every mounted instance — including these \"read-only\"\n * ones — still runs its OWN `onSystemChange` listener below and applies the\n * class itself on an OS change; see that listener for why re-reading storage\n * there (rather than trusting this instance's local `choice`) is required\n * for that to be safe with several instances mounted at once.\n *\n * `choice` (the three-way value, including `'system'`) is NOT synchronized\n * the same way — the `dark` class alone can't tell \"explicitly dark\" apart\n * from \"system, and the system happens to be dark\". The only consumer that\n * needs `choice` is the theme submenu, and Radix unmounts a closed dropdown's\n * content, so it re-reads storage fresh every time it opens; no live\n * cross-component sync of `choice` is needed in practice.\n *\n * NOT used by the bootstrap `<script>` in `app/layout.tsx` — see the comment\n * there for why a hook cannot do that job.\n */\nexport function useTheme(): UseThemeResult {\n // Safe default for the very first client render, corrected synchronously\n // by the effect below on mount — mirrors the pattern the three readers\n // used before migrating here (start light/false, fix it post-mount) so no\n // component newly grows a hydration-mismatch warning.\n const [state, setState] = useState<ThemeState>({ choice: 'system', resolved: 'light' });\n\n useEffect(() => {\n const choice = readChoice();\n setState({ choice, resolved: resolveTheme(choice) });\n\n const root = document.documentElement;\n const observer = new MutationObserver(() => {\n const resolved: ResolvedTheme = root.classList.contains('dark') ? 'dark' : 'light';\n setState((prev) => (prev.resolved === resolved ? prev : { ...prev, resolved }));\n });\n observer.observe(root, { attributes: true, attributeFilter: ['class'] });\n\n const mql =\n typeof window.matchMedia === 'function'\n ? window.matchMedia('(prefers-color-scheme: dark)')\n : undefined;\n const onSystemChange = (event: { matches: boolean }) => {\n // Re-read the stored choice instead of trusting this instance's own\n // `prev.choice`: `choice` is captured once at mount and never\n // resynchronised, but several `useTheme()` instances mount at once\n // (Toaster, CodeMirror, Mermaid, the admin layout, the theme submenu\n // while open). If a later explicit pick only updates the instance that\n // made it, every OTHER instance still believes `system` applies and\n // would repaint the whole app back to the OS value on the next\n // preference flip — silently overriding storage, which is why this\n // must not trust local state. Storage is already the single source of\n // truth (`setTheme('system')` clears the key), so a fresh read here is\n // correct in both directions: an explicit pick is respected, and\n // `system` is honoured even once the one instance that set it has\n // unmounted. Every other live instance's listener fires on the same OS\n // change and independently reaches the same conclusion, so several\n // instances may call `applyDomClass` with the same value for one\n // event — redundant, but harmless, and not worth coordinating.\n const choice = readChoice();\n if (choice !== 'system') return;\n const resolved: ResolvedTheme = event.matches ? 'dark' : 'light';\n applyDomClass(resolved);\n setState((prev) =>\n prev.choice === choice && prev.resolved === resolved ? prev : { choice, resolved },\n );\n };\n mql?.addEventListener('change', onSystemChange);\n\n return () => {\n observer.disconnect();\n mql?.removeEventListener('change', onSystemChange);\n };\n }, []);\n\n const setTheme = useCallback((next: ThemeChoice) => {\n const resolved = resolveTheme(next);\n applyDomClass(resolved);\n persistChoice(next);\n setState({ choice: next, resolved });\n }, []);\n\n return { choice: state.choice, resolved: state.resolved, setTheme };\n}\n"],"mappings":"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"}