@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.2

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 (184) hide show
  1. package/README.md +27 -20
  2. package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
  3. package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
  4. package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
  5. package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
  6. package/dist/IconPicker-C9-ieDWm.cjs +1 -0
  7. package/dist/IconPicker-RqVvq6G2.js +59 -0
  8. package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
  9. package/dist/WDYDFRGG-b3T2SQbz.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-Clng6zpY.cjs +1 -0
  18. package/dist/active-in-another-tab-wb8qolB8.js +34 -0
  19. package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
  20. package/dist/add-new-language-page-D7NDABl1.js +401 -0
  21. package/dist/add-new-page-B4hc0B-g.js +31 -0
  22. package/dist/add-new-page-BNfwKjRd.cjs +1 -0
  23. package/dist/ai-panel-content-BnbURb7j.js +61 -0
  24. package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
  25. package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
  26. package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
  27. package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
  28. package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
  29. package/dist/ai-prompt-input-DaTyfib-.js +655 -0
  30. package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
  31. package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
  32. package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
  33. package/dist/apply-binding-6iwlED02.js +833 -0
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/{code-display-337R7Dev.js → code-display-BzBq5xSn.js} +1 -1
  36. package/dist/code-display-Q3_sK_Ta.cjs +1 -0
  37. package/dist/code-editor-BQZi6-FB.cjs +1 -0
  38. package/dist/code-editor-DWWnphW9.js +50 -0
  39. package/dist/common-functions-B3a4xKt_.cjs +1 -0
  40. package/dist/common-functions-D2lMFR6K.js +13 -0
  41. package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
  42. package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +1 -0
  43. package/dist/core-BoRDjj4h.cjs +1 -0
  44. package/dist/core-yvI6kCyw.js +56 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +51 -383
  47. package/dist/core.js +39 -106
  48. package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
  49. package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-D72a-16X.js} +39 -38
  50. package/dist/delete-design-token-Cd1ZDtqT.js +40 -0
  51. package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
  52. package/dist/delete-page-ByQwBupJ.cjs +1 -0
  53. package/dist/delete-page-DC8pzvWW.js +70 -0
  54. package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
  55. package/dist/design-token-usage-DE4XCDdn.js +113 -0
  56. package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
  57. package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
  58. package/dist/duplicate-page-BoVhko2q.js +133 -0
  59. package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
  60. package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
  61. package/dist/dynamic-page-selector-DdnbCuQZ.cjs +1 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  66. package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
  67. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-DTspjj_c.cjs +1 -0
  73. package/dist/image-editor-oypq8asR.js +108 -0
  74. package/dist/index-B-rSiAp_.cjs +1 -0
  75. package/dist/index-BDnwJqMw.js +4732 -0
  76. package/dist/index-CbwxUFy_.cjs +5 -0
  77. package/dist/index-CnSjWE1P.cjs +160 -0
  78. package/dist/index-Dxfyt4d4.js +39 -0
  79. package/dist/index-S8ibZk9Q.js +19069 -0
  80. package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
  81. package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
  82. package/dist/lang-panel-BPxex-M2.cjs +1 -0
  83. package/dist/lang-panel-Cn83SRzd.js +215 -0
  84. package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
  85. package/dist/manage-design-tokens-lP4HLS0P.js +240 -0
  86. package/dist/mark-as-template-DYRxre1f.cjs +1 -0
  87. package/dist/mark-as-template-jncsjfHm.js +156 -0
  88. package/dist/models-5gOsRC56.cjs +1 -0
  89. package/dist/models-D95ZYr_x.js +70 -0
  90. package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
  91. package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
  92. package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
  93. package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
  94. package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
  95. package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
  96. package/dist/page-creator-VWIB2VAs.cjs +1 -0
  97. package/dist/page-creator-wCMtlE6Z.js +795 -0
  98. package/dist/page-lock-BPCxfv9J.js +30 -0
  99. package/dist/page-lock-DweiYy1w.cjs +1 -0
  100. package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
  101. package/dist/page-locked-dialog-ByGl18_m.js +133 -0
  102. package/dist/page-manager-new-BWFE-S-O.js +394 -0
  103. package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
  104. package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
  105. package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
  106. package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
  107. package/dist/page-revisions-content-Ulr8slUN.js +445 -0
  108. package/dist/pages.cjs +1 -0
  109. package/dist/pages.d.ts +492 -0
  110. package/dist/pages.js +27 -0
  111. package/dist/plugin-3ZKK6RXm.js +245 -0
  112. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  113. package/dist/publish-pages-content-BTPzt_m4.js +178 -0
  114. package/dist/publish-pages-content-D6g8GAsd.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +26 -13
  119. package/dist/render.js +130 -124
  120. package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
  121. package/dist/rte-widget-modal-Rk_NW3KU.js +38 -0
  122. package/dist/runtime.cjs +1 -1
  123. package/dist/runtime.d.ts +306 -7
  124. package/dist/runtime.js +44 -1
  125. package/dist/save-to-lib-BK3uTFss.js +422 -0
  126. package/dist/save-to-lib-DHHUO12i.cjs +1 -0
  127. package/dist/sdk.css +1 -1
  128. package/dist/selected-block-display-CU3TwIMA.js +319 -0
  129. package/dist/selected-block-display-DSFhddPj.cjs +16 -0
  130. package/dist/seo-panel-Dl0IDV09.cjs +2 -0
  131. package/dist/seo-panel-jbzxFioc.js +798 -0
  132. package/dist/shared-json-ld-BL_dv3_q.js +565 -0
  133. package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
  134. package/dist/slug-input-1qwKkXhA.js +86 -0
  135. package/dist/slug-input-YVLjtTI3.cjs +1 -0
  136. package/dist/supabase-actions.cjs +1 -0
  137. package/dist/supabase-actions.d.ts +284 -0
  138. package/dist/supabase-actions.js +524 -0
  139. package/dist/take-over-request-DKvKi3mM.js +63 -0
  140. package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
  141. package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
  142. package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
  143. package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
  144. package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
  145. package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
  146. package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
  147. package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
  148. package/dist/unpublish-page-Degu5Cy9.js +27 -0
  149. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  150. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  151. package/dist/{tailwind.cjs → utils.cjs} +1 -1
  152. package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
  153. package/dist/utils.js +7 -0
  154. package/dist/web-blocks.cjs +1 -1
  155. package/dist/web-blocks.d.ts +0 -6
  156. package/dist/web-blocks.js +258 -251
  157. package/dist/web-preview-DXE4Jnf5.js +73 -0
  158. package/dist/web-preview-YzKxyXft.cjs +1 -0
  159. package/package.json +175 -105
  160. package/dist/IconPicker-CGWn9C4u.cjs +0 -1
  161. package/dist/IconPicker-QvxJ-4Ez.js +0 -64
  162. package/dist/apply-binding-DCno1xQL.js +0 -711
  163. package/dist/apply-binding-DvHNFLQD.cjs +0 -1
  164. package/dist/code-display-BZ1x7SqI.cjs +0 -1
  165. package/dist/code-editor-B28LoECM.cjs +0 -1
  166. package/dist/code-editor-CfG2FhJ-.js +0 -58
  167. package/dist/common-functions-BGzDsf1z.js +0 -14
  168. package/dist/common-functions-BZmyleS1.cjs +0 -1
  169. package/dist/css-import-modal-CENUYvcl.cjs +0 -13
  170. package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
  171. package/dist/index-CaGNHF7f.js +0 -12209
  172. package/dist/index-Gn6pJt2v.cjs +0 -166
  173. package/dist/mockServiceWorker.js +0 -307
  174. package/dist/plugin-B5627hMN.js +0 -195
  175. package/dist/plugin-UxTRfDum.cjs +0 -22
  176. package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
  177. package/dist/rte-widget-modal-Dte0od04.js +0 -41
  178. package/dist/tailwind.js +0 -7
  179. package/dist/tooltip-A4qGk781.cjs +0 -1
  180. package/dist/tooltip-tLiIOgjq.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
package/dist/core.js CHANGED
@@ -1,109 +1,42 @@
1
- import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as C, m as B, E as k, I as g, L as n, g as h, T as p, U as S, h as m, z as P, P as F, n as A, o as T, p as b, q as M, r as y, F as I, G as v, t as L, v as f, s as H, w as R, x as D, y as E, O as U, Q as x, R as W, S as O, V as w, W as z, aC as j, X as q, Y as G, Z as V, aE as Z, aD as J, _ as K, H as N, J as Q, u as X, $ as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as oa, a6 as ia, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, M as da, ac as Ca, ad as Ba, ae as ka, af as ga, ag as na, ah as ha, ai as pa, aj as Sa, ak as ma, al as Pa, am as Fa, an as Aa, ao as Ta, aF as ba, ap as Ma, aq as ya, ar as Ia, a as va, as as La, at as fa, aG as Ha, au as Ra, aH as Da, av as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, K as wa, aA as za, b as ja, c as qa, aB as Ga } from "./index-CaGNHF7f.js";
2
- import { g as Za, c as Ja } from "./common-functions-BGzDsf1z.js";
3
- import { h as Na, h as Qa } from "./apply-binding-DCno1xQL.js";
4
- import { useTranslation as Ya } from "react-i18next";
5
- import { default as $a } from "i18next";
1
+ import { b6 as s, aW as i, b2 as r, b7 as o, aX as t, aY as l, aZ as C, aT as h, b4 as g, b8 as b, b9 as d, ba as n, a_ as c, a$ as k, b3 as B, b0 as S, b1 as m, b5 as p, an as M, bb as T, bd as P, be as f, bf as u, bc as A, aO as L, aR as E, bg as I, aS as x, aP as H, aU as U, bh as D } from "./index-S8ibZk9Q.js";
2
+ import { g as y, c as O } from "./common-functions-D2lMFR6K.js";
3
+ import { g as F, g as W } from "./apply-binding-6iwlED02.js";
4
+ import { default as z } from "i18next";
6
5
  export {
7
- e as ChaiAddBlocksDialog,
8
- o as ChaiAddBlocksPanel,
9
- i as ChaiAskAiUserPrompt,
10
- l as ChaiBlockAttributesEditor,
11
- r as ChaiBlockPropsEditor,
12
- t as ChaiBlockStyleEditor,
13
- u as ChaiBuilderCanvas,
14
- c as ChaiBuilderEditor,
15
- d as ChaiDarkModeSwitcher,
16
- C as ChaiDefaultBlocks,
17
- B as ChaiDraggableBlock,
18
- k as ChaiExportCodeModal,
19
- g as ChaiImportHTML,
20
- n as ChaiOutline,
21
- h as ChaiScreenSizes,
22
- p as ChaiThemeConfigPanel,
23
- S as ChaiUILibrariesPanel,
24
- m as ChaiUndoRedo,
25
- P as IfChaiFeatureFlag,
26
- F as PERMISSIONS,
27
- Na as convertHTMLToChaiBlocks,
28
- Za as generateBlockId,
29
- Qa as getBlocksFromHTML,
30
- A as getClassValueAndUnit,
31
- $a as i18n,
32
- Ja as mergeClasses,
33
- T as registerBlockSettingField,
34
- b as registerBlockSettingTemplate,
35
- M as registerBlockSettingWidget,
36
- y as registerChaiAddBlockTab,
37
- I as registerChaiFeatureFlag,
38
- v as registerChaiFeatureFlags,
6
+ s as ChaiAddBlocksDialog,
7
+ i as ChaiAddBlocksPanel,
8
+ r as ChaiAskAiUserPrompt,
9
+ o as ChaiBlockAttributesEditor,
10
+ t as ChaiBlockPropsEditor,
11
+ l as ChaiBlockStyleEditor,
12
+ C as ChaiBuilderCanvas,
13
+ h as ChaiBuilderEditor,
14
+ g as ChaiDarkModeSwitcher,
15
+ b as ChaiDefaultBlocks,
16
+ d as ChaiDraggableBlock,
17
+ n as ChaiExportCodeModal,
18
+ c as ChaiImportHTML,
19
+ k as ChaiOutline,
20
+ B as ChaiScreenSizes,
21
+ S as ChaiThemeConfigPanel,
22
+ m as ChaiUILibrariesPanel,
23
+ p as ChaiUndoRedo,
24
+ M as PERMISSIONS,
25
+ F as convertHTMLToChaiBlocks,
26
+ y as generateBlockId,
27
+ W as getBlocksFromHTML,
28
+ T as getClassValueAndUnit,
29
+ z as i18n,
30
+ O as mergeClasses,
31
+ P as registerBlockSettingField,
32
+ f as registerBlockSettingTemplate,
33
+ u as registerBlockSettingWidget,
34
+ A as registerChaiAddBlockTab,
39
35
  L as registerChaiLibrary,
40
- f as registerChaiMediaManager,
41
- H as registerChaiPreImportHTMLHook,
42
- R as registerChaiSaveToLibrary,
43
- D as registerChaiSidebarPanel,
44
- E as registerChaiTopBar,
45
- U as useAddBlock,
46
- x as useAddClassesToBlocks,
47
- W as useAskAi,
48
- O as useBlockHighlight,
49
- w as useBlocksHtmlForAi,
50
- z as useBlocksStore,
51
- j as useBlocksStoreUndoableActions,
52
- q as useBrandingOptions,
53
- G as useBuilderProp,
54
- V as useBuilderReset,
55
- Z as useCanvasDisplayWidth,
56
- J as useCanvasWidth,
57
- K as useCanvasZoom,
58
- N as useChaiFeatureFlag,
59
- Q as useChaiFeatureFlags,
60
- X as useCodeEditor,
61
- Y as useCopyBlockIds,
62
- _ as useCopyToClipboard,
63
- $ as useCurrentPage,
64
- aa as useCutBlockIds,
65
- sa as useDarkMode,
66
- ea as useDuplicateBlocks,
67
- oa as useHighlightBlockId,
68
- ia as useHtmlToBlocks,
69
- la as useI18nBlocks,
70
- ra as useInlineEditing,
71
- ta as useIsPageLoaded,
72
- ua as useLanguages,
73
- ca as useLibraryBlocks,
74
- da as useMediaManagerComponent,
75
- Ca as usePartailBlocksStore,
76
- Ba as usePartialBlocksList,
77
- ka as usePasteBlocks,
78
- ga as usePermissions,
79
- na as usePreviewMode,
80
- ha as usePubSub,
81
- pa as useRemoveAllClassesForBlock,
82
- Sa as useRemoveBlocks,
83
- ma as useRemoveClassesFromBlocks,
84
- Pa as useReplaceBlock,
85
- Fa as useResetBlockStyles,
86
- Aa as useRightPanel,
87
- Ta as useSavePage,
88
- ba as useScreenSizeWidth,
89
- Ma as useSelectedBlock,
90
- ya as useSelectedBlockAllClasses,
91
- Ia as useSelectedBlockCurrentClasses,
92
- va as useSelectedBlockIds,
93
- La as useSelectedBlocksDisplayChild,
94
- fa as useSelectedBreakpoints,
95
- Ha as useSelectedLibrary,
96
- Ra as useSelectedStylingBlocks,
97
- Da as useSidebarActivePanel,
98
- Ea as useStreamMultipleBlocksProps,
99
- Ua as useStylingBreakpoint,
100
- xa as useStylingState,
101
- Wa as useTheme,
102
- Oa as useThemeOptions,
103
- wa as useToggleChaiFeatureFlag,
104
- Ya as useTranslation,
105
- za as useUndoManager,
106
- ja as useUpdateBlocksProps,
107
- qa as useUpdateBlocksPropsRealtime,
108
- Ga as useWrapperBlock
36
+ E as registerChaiMediaManager,
37
+ I as registerChaiPreImportHTMLHook,
38
+ x as registerChaiSaveToLibrary,
39
+ H as registerChaiSidebarPanel,
40
+ U as registerChaiTopBar,
41
+ D as useMediaManagerComponent
109
42
  };
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("./index-CnSjWE1P.cjs");require("lodash-es");const w=require("culori"),T=require("./fonts-B-Xt29pe.cjs"),V=require("react"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=$(w),S=$(V),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),l=u(r,"--font-sans")||u(r,"--font-family")||u(r,"--font-heading")||u(r,"--font-body"),a=q(l);o.fontFamily={heading:a,body:a};const m=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=D(m),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=u(r,`--${i}`),g=u(s,`--${i}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[i]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},u=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[,r,s,l]=t,a=`hsl(${r} ${s}% ${l}%)`;return b(a)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const l=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(l)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},q=e=>{const o=T.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(l=>l.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},D=e=>{try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
2
+ --background: 0 0% 100%;
3
+ --foreground: oklch(0.52 0.13 144.17);
4
+ --primary: #3e2723;
5
+ --primary-foreground: #ffffff;
6
+ }
7
+
8
+ .dark {
9
+ --background: 222.2 84% 4.9%;
10
+ --foreground: hsl(37.50 36.36% 95.69%);
11
+ --primary: rgb(46, 125, 50);
12
+ --primary-foreground: #ffffff;
13
+ }`,B=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=S.useState(""),[l,a]=S.useState(null),[m,h]=S.useState(!1),{t:i}=N.useTranslation(),p=async()=>{h(!0),a(null);try{const d=F(r);if(!d.isValid){a(d.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),h(!1);return}const x=I(r);if(!P(x)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),h(!1);return}t(x),s(""),a(null),o(!1)}catch(d){console.error("Error importing CSS:",d),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{h(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(c.Dialog,{open:e,onOpenChange:o,children:n.jsxs(c.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(c.DialogHeader,{children:[n.jsx(c.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(c.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(c.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(c.Textarea,{id:"css-input",placeholder:M,value:r,onChange:d=>s(d.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:m})]}),l&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:l})})]}),n.jsxs(c.DialogFooter,{className:"gap-2",children:[n.jsx(c.Button,{variant:"outline",onClick:g,disabled:m,children:i("Cancel")}),n.jsx(c.Button,{onClick:p,disabled:!r.trim()||m,children:i(m?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=B;
@@ -1,17 +1,18 @@
1
- import { jsx as i, jsxs as m } from "react/jsx-runtime";
2
- import * as x from "react";
3
- import { a1 as V, a3 as T, a6 as N, a9 as R, a4 as E, v as y, au as I, b1 as D, a5 as A } from "./tooltip-tLiIOgjq.js";
4
- import { getAllRegisteredFonts as P } from "@chaibuilder/runtime";
1
+ import { jsx as i, jsxs as u } from "react/jsx-runtime";
2
+ import { D as T, d as V, e as N, f as R, p as E, B as y, L as D, T as I, q as A } from "./index-S8ibZk9Q.js";
3
+ import "lodash-es";
5
4
  import * as b from "culori";
6
- import { useTranslation as H } from "react-i18next";
7
- const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o.h)} ${d(o.s * 100)}% ${d(o.l * 100)}%)`, M = (o, e = "hsl", s = "4") => {
5
+ import { a as L } from "./fonts-DRly3Wzd.js";
6
+ import * as x from "react";
7
+ import { useTranslation as P } from "react-i18next";
8
+ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", H = (o) => `hsl(${d(o.h)} ${d(o.s * 100)}% ${d(o.l * 100)}%)`, M = (o, e = "hsl", s = "4") => {
8
9
  try {
9
10
  const r = b.parse(o);
10
11
  if (!r) throw new Error("Invalid color input");
11
12
  switch (e) {
12
13
  case "hsl": {
13
14
  const t = b.converter("hsl")(r);
14
- return s === "4" ? L(t) : `${d(t.h)} ${d(t.s * 100)}% ${d(t.l * 100)}%`;
15
+ return s === "4" ? H(t) : `${d(t.h)} ${d(t.s * 100)}% ${d(t.l * 100)}%`;
15
16
  }
16
17
  case "rgb":
17
18
  return b.formatRgb(r);
@@ -40,13 +41,13 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
40
41
  const s = w(o);
41
42
  if (!s.isValid)
42
43
  return console.warn("CSS validation failed:", s.error), $();
43
- const r = v(o, ":root"), t = v(o, ".dark"), l = u(r, "--font-sans") || u(r, "--font-family") || u(r, "--font-heading") || u(r, "--font-body"), n = B(l);
44
+ const r = v(o, ":root"), t = v(o, ".dark"), l = f(r, "--font-sans") || f(r, "--font-family") || f(r, "--font-heading") || f(r, "--font-body"), n = B(l);
44
45
  e.fontFamily = {
45
46
  heading: n,
46
47
  body: n
47
48
  };
48
- const f = u(r, "--radius") || u(r, "--border-radius") || "0.5rem";
49
- e.borderRadius = _(f), [
49
+ const m = f(r, "--radius") || f(r, "--border-radius") || "0.5rem";
50
+ e.borderRadius = q(m), [
50
51
  "background",
51
52
  "foreground",
52
53
  "primary",
@@ -67,7 +68,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
67
68
  "popover",
68
69
  "popover-foreground"
69
70
  ].forEach((a) => {
70
- const p = u(r, `--${a}`), g = u(t, `--${a}`);
71
+ const p = f(r, `--${a}`), g = f(t, `--${a}`);
71
72
  if (p || g) {
72
73
  const c = p ? k(p) : "#000000", C = g ? k(g) : c;
73
74
  e.colors[a] = [c, C];
@@ -81,7 +82,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
81
82
  var r, t;
82
83
  const s = new RegExp(`${F(e)}\\s*{([^}]+)}`);
83
84
  return ((t = (r = o.match(s)) == null ? void 0 : r[1]) == null ? void 0 : t.trim()) || null;
84
- }, u = (o, e) => {
85
+ }, f = (o, e) => {
85
86
  var t;
86
87
  if (!o) return null;
87
88
  const s = new RegExp(`${F(e)}\\s*:\\s*([^;]+)`), r = o.match(s);
@@ -102,8 +103,8 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
102
103
  return S(e) || "#000000";
103
104
  const s = e.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);
104
105
  if (s) {
105
- const [r, t, l, n] = s, f = `hsl(${t} ${l}% ${n}%)`;
106
- return S(f) || "#000000";
106
+ const [, r, t, l] = s, n = `hsl(${r} ${t}% ${l}%)`;
107
+ return S(n) || "#000000";
107
108
  }
108
109
  if (/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(e)) {
109
110
  const r = e.split(/[\s,]+/).filter(Boolean);
@@ -117,7 +118,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
117
118
  return console.warn("Failed to process color:", o, e), "#000000";
118
119
  }
119
120
  }, B = (o) => {
120
- const e = P();
121
+ const e = L();
121
122
  if (!o)
122
123
  return "ui-sans-serif, system-ui, sans-serif";
123
124
  try {
@@ -126,9 +127,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
126
127
  } catch (s) {
127
128
  return console.warn("Error processing font family:", o, s), "ui-sans-serif, system-ui, sans-serif";
128
129
  }
129
- }, _ = (o) => {
130
- if (!o)
131
- return "8px";
130
+ }, q = (o) => {
132
131
  try {
133
132
  const e = o.trim();
134
133
  if (e.endsWith("px"))
@@ -175,7 +174,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
175
174
  popover: ["#ffffff", "#0f172a"],
176
175
  "popover-foreground": ["#000000", "#f8fafc"]
177
176
  }
178
- }), F = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), q = (o) => ["background", "foreground", "primary", "primary-foreground"].every(
177
+ }), F = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), W = (o) => ["background", "foreground", "primary", "primary-foreground"].every(
179
178
  (r) => o.colors[r] && Array.isArray(o.colors[r]) && o.colors[r].length >= 2
180
179
  ) && !!o.fontFamily.heading && !!o.fontFamily.body && !!o.borderRadius, w = (o) => {
181
180
  if (!o || typeof o != "string")
@@ -203,7 +202,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
203
202
  } catch (s) {
204
203
  return console.error("CSS validation error:", s), { isValid: !1, error: "Failed to parse CSS. Please check your syntax." };
205
204
  }
206
- }, W = `:root {
205
+ }, _ = `:root {
207
206
  --background: 0 0% 100%;
208
207
  --foreground: oklch(0.52 0.13 144.17);
209
208
  --primary: #3e2723;
@@ -215,8 +214,8 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
215
214
  --foreground: hsl(37.50 36.36% 95.69%);
216
215
  --primary: rgb(46, 125, 50);
217
216
  --primary-foreground: #ffffff;
218
- }`, Z = ({ open: o, onOpenChange: e, onImport: s }) => {
219
- const [r, t] = x.useState(""), [l, n] = x.useState(null), [f, h] = x.useState(!1), { t: a } = H(), p = async () => {
217
+ }`, J = ({ open: o, onOpenChange: e, onImport: s }) => {
218
+ const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } = P(), p = async () => {
220
219
  h(!0), n(null);
221
220
  try {
222
221
  const c = w(r);
@@ -227,9 +226,11 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
227
226
  return;
228
227
  }
229
228
  const C = z(r);
230
- if (!q(C)) {
229
+ if (!W(C)) {
231
230
  n(
232
- a("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")
231
+ a(
232
+ "The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors."
233
+ )
233
234
  ), setTimeout(() => {
234
235
  n(null);
235
236
  }, 5e3), h(!1);
@@ -246,14 +247,14 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
246
247
  }, g = () => {
247
248
  t(""), n(null), e(!1);
248
249
  };
249
- return /* @__PURE__ */ i(V, { open: o, onOpenChange: e, children: /* @__PURE__ */ m(T, { className: "flex max-h-[80vh] max-w-2xl flex-col", children: [
250
- /* @__PURE__ */ m(N, { children: [
250
+ return /* @__PURE__ */ i(T, { open: o, onOpenChange: e, children: /* @__PURE__ */ u(V, { className: "flex max-h-[80vh] max-w-2xl flex-col", children: [
251
+ /* @__PURE__ */ u(N, { children: [
251
252
  /* @__PURE__ */ i(R, { children: a("Import CSS Theme") }),
252
- /* @__PURE__ */ m(E, { className: "space-y-2", children: [
253
+ /* @__PURE__ */ u(E, { className: "space-y-2", children: [
253
254
  /* @__PURE__ */ i("p", { children: a(
254
255
  "Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties."
255
256
  ) }),
256
- /* @__PURE__ */ m("div", { className: "flex items-center", children: [
257
+ /* @__PURE__ */ u("div", { className: "flex items-center", children: [
257
258
  /* @__PURE__ */ i("p", { className: "font-bold", children: "Get theme resources:" }),
258
259
  /* @__PURE__ */ i(y, { variant: "link", size: "sm", onClick: () => window.open("https://tweakcn.com/", "_blank"), children: "TweakCN" }),
259
260
  /* @__PURE__ */ i(
@@ -277,29 +278,29 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
277
278
  ] })
278
279
  ] })
279
280
  ] }),
280
- /* @__PURE__ */ m("div", { className: "flex-1 space-y-4 overflow-hidden", children: [
281
- /* @__PURE__ */ m("div", { className: "space-y-2", children: [
282
- /* @__PURE__ */ i(I, { htmlFor: "css-input", children: a("CSS Variables") }),
281
+ /* @__PURE__ */ u("div", { className: "flex-1 space-y-4 overflow-hidden", children: [
282
+ /* @__PURE__ */ u("div", { className: "space-y-2", children: [
283
+ /* @__PURE__ */ i(D, { htmlFor: "css-input", children: a("CSS Variables") }),
283
284
  /* @__PURE__ */ i(
284
- D,
285
+ I,
285
286
  {
286
287
  id: "css-input",
287
- placeholder: W,
288
+ placeholder: _,
288
289
  value: r,
289
290
  onChange: (c) => t(c.target.value),
290
291
  className: "min-h-[300px] resize-none font-mono text-sm",
291
- disabled: f
292
+ disabled: m
292
293
  }
293
294
  )
294
295
  ] }),
295
296
  l && /* @__PURE__ */ i("div", { className: "rounded-md border border-red-200 bg-red-50 p-3", children: /* @__PURE__ */ i("p", { className: "text-sm text-red-600", children: l }) })
296
297
  ] }),
297
- /* @__PURE__ */ m(A, { className: "gap-2", children: [
298
- /* @__PURE__ */ i(y, { variant: "outline", onClick: g, disabled: f, children: a("Cancel") }),
299
- /* @__PURE__ */ i(y, { onClick: p, disabled: !r.trim() || f, children: a(f ? "Importing..." : "Import Theme") })
298
+ /* @__PURE__ */ u(A, { className: "gap-2", children: [
299
+ /* @__PURE__ */ i(y, { variant: "outline", onClick: g, disabled: m, children: a("Cancel") }),
300
+ /* @__PURE__ */ i(y, { onClick: p, disabled: !r.trim() || m, children: a(m ? "Importing..." : "Import Theme") })
300
301
  ] })
301
302
  ] }) });
302
303
  };
303
304
  export {
304
- Z as CssImportModal
305
+ J as CssImportModal
305
306
  };
@@ -0,0 +1,40 @@
1
+ import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
+ import { G as i, H as n, J as c, K as d, M as m, O as h, Q as g, R as u, U as x } from "./index-S8ibZk9Q.js";
3
+ import { useTranslation as D } from "react-i18next";
4
+ const N = ({ tokenName: l, tokenValue: s, onDelete: a, children: o }) => {
5
+ const { t: r } = D();
6
+ return /* @__PURE__ */ e(i, { children: [
7
+ /* @__PURE__ */ t(n, { asChild: !0, children: o }),
8
+ /* @__PURE__ */ e(c, { className: "max-w-md", children: [
9
+ /* @__PURE__ */ e(d, { children: [
10
+ /* @__PURE__ */ e(m, { className: "text-base", children: [
11
+ r("Delete"),
12
+ ' "',
13
+ l,
14
+ '"?'
15
+ ] }),
16
+ /* @__PURE__ */ t(h, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "space-y-3 pt-1 text-sm", children: [
17
+ /* @__PURE__ */ t("p", { className: "text-muted-foreground", children: r("This action cannot be undone. This will permanently remove the design token from your project.") }),
18
+ /* @__PURE__ */ e("div", { className: "rounded-md border bg-muted/50 p-3", children: [
19
+ /* @__PURE__ */ t("p", { className: "mb-1 text-xs font-medium text-foreground", children: r("Token classes") }),
20
+ /* @__PURE__ */ t("p", { className: "font-mono text-xs text-muted-foreground", children: s })
21
+ ] })
22
+ ] }) })
23
+ ] }),
24
+ /* @__PURE__ */ e(g, { children: [
25
+ /* @__PURE__ */ t(u, { className: "h-7 text-xs", children: r("Cancel") }),
26
+ /* @__PURE__ */ t(
27
+ x,
28
+ {
29
+ onClick: a,
30
+ className: "h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",
31
+ children: r("Delete")
32
+ }
33
+ )
34
+ ] })
35
+ ] })
36
+ ] });
37
+ };
38
+ export {
39
+ N as default
40
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("./index-CnSjWE1P.cjs"),o=require("./index-CbwxUFy_.cjs"),L=require("lodash-es"),D=require("react"),N=require("react-i18next"),f=(e,r)=>{const n=r.filter(u=>u.parent===e);if(n.length===0)return 0;let a=n.length;return n.forEach(u=>{a+=f(u.id,r)}),a};function A({page:e,onClose:r}){const{t:n}=N.useTranslation(),[,a]=o.useSearchParams(),{mutate:u,isPending:x}=o.useDeletePage(),{data:P}=o.usePageTypes(),{data:h=[]}=o.useWebsitePages(),{setSelectedLang:v,fallbackLang:S}=s.useLanguages(),[,w]=s.useSidebarActivePanel(),l=!(e!=null&&e.primaryPage),{data:i=[]}=o.useLanguagePages(l?e==null?void 0:e.id:void 0),j=D.useMemo(()=>!l||!i?0:i.filter(d=>d.id!==(e==null?void 0:e.id)).length,[l,i,e==null?void 0:e.id]),m=D.useMemo(()=>{if(!(e!=null&&e.id)||!h.length)return 0;let d=f(e.id,h);return l&&i&&i.length>0&&i.forEach(y=>{y.id!==e.id&&(d+=f(y.id,h))}),d},[e==null?void 0:e.id,h,l,i]),C=()=>{x||u(e,{onSuccess:()=>{e!=null&&e.primaryPage?(window.history.replaceState({},"",`/?page=${e.primaryPage}`),a(new URLSearchParams({page:e.primaryPage}))):(window.history.replaceState({},"","/"),a(new URLSearchParams)),window.dispatchEvent(new PopStateEvent("popstate")),v(S),w("outline"),r()}})},c=P==null?void 0:P.find(d=>d.key===(e==null?void 0:e.pageType));return t.jsx(s.Dialog,{open:!!e,onOpenChange:r,children:t.jsxs(s.DialogContent,{children:[t.jsxs(s.DialogHeader,{children:[t.jsx(s.DialogTitle,{children:n("Confirm Deletion")}),t.jsxs(s.DialogDescription,{className:"py-4 text-slate-500",children:[t.jsxs("div",{children:[n("Are you sure you want to remove")," ",t.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",c!=null&&c.hasSlug?(c==null?void 0:c.name)+"?":n("page?")]}),l&&(j>0||m>0)&&t.jsxs("div",{className:"mt-3 rounded-md bg-red-50 p-3 text-sm",children:[t.jsxs("div",{className:"font-semibold text-red-800",children:[n("Warning: Deleting this primary page will also delete"),":"]}),t.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-red-700",children:[m>0&&t.jsxs("li",{children:[t.jsx("span",{className:"font-medium",children:m})," ",n(m===1?"nested child page":"nested child pages")]}),j>0&&t.jsx("li",{children:n("All associated language pages")})]})]}),e.lang&&t.jsxs("div",{className:"py-2 text-sm",children:[n("Language"),":"," ",t.jsx("span",{className:"font-medium text-gray-500",children:L.get(o.LANGUAGES,e.lang,e.lang)})]})]})]}),t.jsxs(s.DialogFooter,{children:[t.jsx(s.Button,{variant:"outline",onClick:r,children:n("Cancel")}),t.jsx(s.Button,{variant:"destructive",disabled:x,onClick:C,children:n(x?"Deleting...":"Delete")})]})]})})}exports.default=A;
@@ -0,0 +1,70 @@
1
+ import { jsx as i, jsxs as n } from "react/jsx-runtime";
2
+ import { n as N, o as A, D as E, d as b, e as k, f as U, p as B, q as G, B as v } from "./index-S8ibZk9Q.js";
3
+ import { c as R, o as W, m as q, g as F, l as H, L as M } from "./index-BDnwJqMw.js";
4
+ import { get as Q } from "lodash-es";
5
+ import { useMemo as w } from "react";
6
+ import { useTranslation as $ } from "react-i18next";
7
+ const P = (e, r) => {
8
+ const t = r.filter((c) => c.parent === e);
9
+ if (t.length === 0) return 0;
10
+ let d = t.length;
11
+ return t.forEach((c) => {
12
+ d += P(c.id, r);
13
+ }), d;
14
+ };
15
+ function X({ page: e, onClose: r }) {
16
+ const { t } = $(), [, d] = R(), { mutate: c, isPending: h } = W(), { data: f } = q(), { data: m = [] } = F(), { setSelectedLang: S, fallbackLang: x } = N(), [, L] = A(), l = !(e != null && e.primaryPage), { data: s = [] } = H(l ? e == null ? void 0 : e.id : void 0), D = w(() => !l || !s ? 0 : s.filter((o) => o.id !== (e == null ? void 0 : e.id)).length, [l, s, e == null ? void 0 : e.id]), u = w(() => {
17
+ if (!(e != null && e.id) || !m.length) return 0;
18
+ let o = P(e.id, m);
19
+ return l && s && s.length > 0 && s.forEach((y) => {
20
+ y.id !== e.id && (o += P(y.id, m));
21
+ }), o;
22
+ }, [e == null ? void 0 : e.id, m, l, s]), C = () => {
23
+ h || c(e, {
24
+ onSuccess: () => {
25
+ e != null && e.primaryPage ? (window.history.replaceState({}, "", `/?page=${e.primaryPage}`), d(new URLSearchParams({ page: e.primaryPage }))) : (window.history.replaceState({}, "", "/"), d(new URLSearchParams())), window.dispatchEvent(new PopStateEvent("popstate")), S(x), L("outline"), r();
26
+ }
27
+ });
28
+ }, a = f == null ? void 0 : f.find((o) => o.key === (e == null ? void 0 : e.pageType));
29
+ return /* @__PURE__ */ i(E, { open: !!e, onOpenChange: r, children: /* @__PURE__ */ n(b, { children: [
30
+ /* @__PURE__ */ n(k, { children: [
31
+ /* @__PURE__ */ i(U, { children: t("Confirm Deletion") }),
32
+ /* @__PURE__ */ n(B, { className: "py-4 text-slate-500", children: [
33
+ /* @__PURE__ */ n("div", { children: [
34
+ t("Are you sure you want to remove"),
35
+ " ",
36
+ /* @__PURE__ */ i("b", { children: (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.slug) }),
37
+ " ",
38
+ a != null && a.hasSlug ? (a == null ? void 0 : a.name) + "?" : t("page?")
39
+ ] }),
40
+ l && (D > 0 || u > 0) && /* @__PURE__ */ n("div", { className: "mt-3 rounded-md bg-red-50 p-3 text-sm", children: [
41
+ /* @__PURE__ */ n("div", { className: "font-semibold text-red-800", children: [
42
+ t("Warning: Deleting this primary page will also delete"),
43
+ ":"
44
+ ] }),
45
+ /* @__PURE__ */ n("ul", { className: "mt-2 list-inside list-disc space-y-1 text-red-700", children: [
46
+ u > 0 && /* @__PURE__ */ n("li", { children: [
47
+ /* @__PURE__ */ i("span", { className: "font-medium", children: u }),
48
+ " ",
49
+ t(u === 1 ? "nested child page" : "nested child pages")
50
+ ] }),
51
+ D > 0 && /* @__PURE__ */ i("li", { children: t("All associated language pages") })
52
+ ] })
53
+ ] }),
54
+ e.lang && /* @__PURE__ */ n("div", { className: "py-2 text-sm", children: [
55
+ t("Language"),
56
+ ":",
57
+ " ",
58
+ /* @__PURE__ */ i("span", { className: "font-medium text-gray-500", children: Q(M, e.lang, e.lang) })
59
+ ] })
60
+ ] })
61
+ ] }),
62
+ /* @__PURE__ */ n(G, { children: [
63
+ /* @__PURE__ */ i(v, { variant: "outline", onClick: r, children: t("Cancel") }),
64
+ /* @__PURE__ */ i(v, { variant: "destructive", disabled: h, onClick: C, children: t(h ? "Deleting..." : "Delete") })
65
+ ] })
66
+ ] }) });
67
+ }
68
+ export {
69
+ X as default
70
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("./index-CnSjWE1P.cjs"),p=require("@radix-ui/react-icons"),L=require("lodash-es"),d=require("react"),w=require("react-i18next"),x=({title:n,items:l,emptyLabel:o,onSelect:t,icon:i})=>s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:n}),l.length>0?s.jsx("div",{className:"space-y-1",children:l.map(a=>s.jsx("button",{type:"button",onClick:()=>t(a.id),className:r.cn("group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition","hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",a.isSelected&&"border-primary/40 bg-primary/10 text-primary"),children:s.jsxs("span",{className:"flex items-center space-x-2",children:[i&&i,s.jsx("span",{className:"truncate",children:a.label})]})},a.id))}):s.jsx("div",{className:"rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground",children:o})]}),M="#styles:",_=n=>{const o=[typeof n._name=="string"?n._name:void 0,typeof n._type=="string"?n._type:void 0].filter(Boolean).find(t=>t.trim().length>0);return o?o.length>40?`${o.slice(0,37)}...`:o:n._id},q=(n,l)=>{const o=`${l}`;return n.filter(t=>Object.values(t).some(i=>typeof i!="string"||!i.startsWith(M)?!1:i.includes(o))).map(t=>({id:t._id,label:_(t)}))},C=({tokenId:n,tokenName:l,children:o})=>{const{t}=w.useTranslation(),[i]=r.useBlocksStore(),[a,b]=r.useSelectedBlockIds(),g=r.useBuilderProp("pageId"),m=r.useBuilderProp("siteWideUsage"),h=d.useMemo(()=>q(i,n),[i,n]),P=d.useMemo(()=>h.map(e=>({id:e.id,label:e.label,isSelected:a.includes(e.id)})),[h,a]),u=d.useMemo(()=>m?Object.entries(m).reduce((e,[f,c])=>(f===g||!(c!=null&&c.designTokens)||!Object.keys(c.designTokens).some(j=>typeof j!="string"?!1:j===n)||e.push({id:f,name:c.name||f,isPartial:!!c.isPartial}),e),[]):[],[m,l,n,g]),S=d.useMemo(()=>u.filter(e=>!e.isPartial).map(e=>({id:e.id,label:e.name})),[u]),k=d.useMemo(()=>u.filter(e=>e.isPartial).map(e=>({id:e.id,label:e.name})),[u]),v=d.useCallback(e=>{b([e])},[b]),B=r.useBuilderProp("gotoPage",L.noop),{selectedLang:N,fallbackLang:T}=r.useLanguages(),{savePageAsync:I}=r.useSavePage(),y=async e=>{e&&(await I(!0),B({pageId:e,lang:N||T}))};return s.jsxs(r.Popover,{children:[s.jsx(r.PopoverTrigger,{asChild:!0,children:o}),s.jsxs(r.PopoverContent,{side:"bottom",align:"end",className:"w-80 p-0",children:[s.jsxs("div",{className:"space-y-1 px-4 py-3",children:[s.jsx("p",{className:"text-xs font-semibold",children:l}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("Usage summary for this design token across your site.")})]}),s.jsxs("div",{className:"no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4",children:[s.jsx(x,{title:t("Blocks affected on this page"),items:P,emptyLabel:t("None"),onSelect:v,icon:s.jsx(p.ArrowRightIcon,{fontSize:4})}),s.jsx(x,{title:t("Blocks affected on other pages"),items:S,emptyLabel:t("None"),onSelect:y,icon:s.jsx(p.FileIcon,{fontSize:8})}),s.jsx(x,{title:t("Blocks affected on partial blocks"),items:k,emptyLabel:t("None"),onSelect:y,icon:s.jsx(p.GlobeIcon,{fontSize:8})})]})]})]})};exports.default=C;
@@ -0,0 +1,113 @@
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
+ import { ag as _, ah as j, a as C, ai as p, n as I, V as O, a9 as z, aa as W, P as A } from "./index-S8ibZk9Q.js";
3
+ import { ArrowRightIcon as E, FileIcon as F, GlobeIcon as M } from "@radix-ui/react-icons";
4
+ import { noop as R } from "lodash-es";
5
+ import { useMemo as d, useCallback as $ } from "react";
6
+ import { useTranslation as D } from "react-i18next";
7
+ const b = ({ title: s, items: a, emptyLabel: r, onSelect: t, icon: o }) => /* @__PURE__ */ c("div", { className: "space-y-2", children: [
8
+ /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: s }),
9
+ a.length > 0 ? /* @__PURE__ */ n("div", { className: "space-y-1", children: a.map((i) => /* @__PURE__ */ n(
10
+ "button",
11
+ {
12
+ type: "button",
13
+ onClick: () => t(i.id),
14
+ className: _(
15
+ "group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition",
16
+ "hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
17
+ i.isSelected && "border-primary/40 bg-primary/10 text-primary"
18
+ ),
19
+ children: /* @__PURE__ */ c("span", { className: "flex items-center space-x-2", children: [
20
+ o && o,
21
+ /* @__PURE__ */ n("span", { className: "truncate", children: i.label })
22
+ ] })
23
+ },
24
+ i.id
25
+ )) }) : /* @__PURE__ */ n("div", { className: "rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground", children: r })
26
+ ] }), G = "#styles:", V = (s) => {
27
+ const r = [
28
+ typeof s._name == "string" ? s._name : void 0,
29
+ typeof s._type == "string" ? s._type : void 0
30
+ ].filter(Boolean).find((t) => t.trim().length > 0);
31
+ return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : s._id;
32
+ }, X = (s, a) => {
33
+ const r = `${a}`;
34
+ return s.filter((t) => Object.values(t).some((o) => typeof o != "string" || !o.startsWith(G) ? !1 : o.includes(r))).map((t) => ({
35
+ id: t._id,
36
+ label: V(t)
37
+ }));
38
+ }, K = ({ tokenId: s, tokenName: a, children: r }) => {
39
+ const { t } = D(), [o] = j(), [i, g] = C(), h = p("pageId"), u = p("siteWideUsage"), y = d(() => X(o, s), [o, s]), k = d(
40
+ () => y.map((e) => ({
41
+ id: e.id,
42
+ label: e.label,
43
+ isSelected: i.includes(e.id)
44
+ })),
45
+ [y, i]
46
+ ), m = d(() => u ? Object.entries(u).reduce(
47
+ (e, [f, l]) => (f === h || !(l != null && l.designTokens) || !Object.keys(l.designTokens).some((P) => typeof P != "string" ? !1 : P === s) || e.push({ id: f, name: l.name || f, isPartial: !!l.isPartial }), e),
48
+ []
49
+ ) : [], [u, a, s, h]), v = d(
50
+ () => m.filter((e) => !e.isPartial).map((e) => ({
51
+ id: e.id,
52
+ label: e.name
53
+ })),
54
+ [m]
55
+ ), S = d(
56
+ () => m.filter((e) => e.isPartial).map((e) => ({
57
+ id: e.id,
58
+ label: e.name
59
+ })),
60
+ [m]
61
+ ), N = $(
62
+ (e) => {
63
+ g([e]);
64
+ },
65
+ [g]
66
+ ), B = p("gotoPage", R), { selectedLang: T, fallbackLang: L } = I(), { savePageAsync: w } = O(), x = async (e) => {
67
+ e && (await w(!0), B({ pageId: e, lang: T || L }));
68
+ };
69
+ return /* @__PURE__ */ c(z, { children: [
70
+ /* @__PURE__ */ n(W, { asChild: !0, children: r }),
71
+ /* @__PURE__ */ c(A, { side: "bottom", align: "end", className: "w-80 p-0", children: [
72
+ /* @__PURE__ */ c("div", { className: "space-y-1 px-4 py-3", children: [
73
+ /* @__PURE__ */ n("p", { className: "text-xs font-semibold", children: a }),
74
+ /* @__PURE__ */ n("p", { className: "text-[11px] text-muted-foreground", children: t("Usage summary for this design token across your site.") })
75
+ ] }),
76
+ /* @__PURE__ */ c("div", { className: "no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4", children: [
77
+ /* @__PURE__ */ n(
78
+ b,
79
+ {
80
+ title: t("Blocks affected on this page"),
81
+ items: k,
82
+ emptyLabel: t("None"),
83
+ onSelect: N,
84
+ icon: /* @__PURE__ */ n(E, { fontSize: 4 })
85
+ }
86
+ ),
87
+ /* @__PURE__ */ n(
88
+ b,
89
+ {
90
+ title: t("Blocks affected on other pages"),
91
+ items: v,
92
+ emptyLabel: t("None"),
93
+ onSelect: x,
94
+ icon: /* @__PURE__ */ n(F, { fontSize: 8 })
95
+ }
96
+ ),
97
+ /* @__PURE__ */ n(
98
+ b,
99
+ {
100
+ title: t("Blocks affected on partial blocks"),
101
+ items: S,
102
+ emptyLabel: t("None"),
103
+ onSelect: x,
104
+ icon: /* @__PURE__ */ n(M, { fontSize: 8 })
105
+ }
106
+ )
107
+ ] })
108
+ ] })
109
+ ] });
110
+ };
111
+ export {
112
+ K as default
113
+ };