@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -20
- package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
- package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
- package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
- package/dist/AP7HFJJL-CymCmW14.js +9214 -0
- package/dist/IconPicker-B1rWC-Ex.js +59 -0
- package/dist/IconPicker-DREyo007.cjs +1 -0
- package/dist/WDYDFRGG-BUVnbAci.js +33 -0
- package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/actions-registery-CZ1w0NKa.js +15545 -0
- package/dist/actions-registery-YnFmU21O.cjs +418 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.ts +3202 -0
- package/dist/actions.js +216 -0
- package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
- package/dist/active-in-another-tab-CyjngVA6.js +34 -0
- package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
- package/dist/add-new-language-page-WmlCnytQ.js +401 -0
- package/dist/add-new-page-VW2wAYZp.js +31 -0
- package/dist/add-new-page-soZ8GAkN.cjs +1 -0
- package/dist/ai-panel-content-7zCil042.cjs +1 -0
- package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
- package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
- package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
- package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
- package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
- package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
- package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
- package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
- package/dist/apply-binding-6iwlED02.js +833 -0
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/code-display-BnqzqzoP.cjs +1 -0
- package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
- package/dist/code-editor-DRIAnNbb.js +50 -0
- package/dist/code-editor-o3___nu2.cjs +1 -0
- package/dist/common-functions-B3a4xKt_.cjs +1 -0
- package/dist/common-functions-D2lMFR6K.js +13 -0
- package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
- package/dist/core-BoRDjj4h.cjs +1 -0
- package/dist/core-yvI6kCyw.js +56 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +51 -383
- package/dist/core.js +39 -106
- package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
- package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
- package/dist/delete-design-token-BRZZiWtQ.js +40 -0
- package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
- package/dist/delete-page-BzyX9TN-.js +70 -0
- package/dist/delete-page-DxX7PFIE.cjs +1 -0
- package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
- package/dist/design-token-usage-xQs6SlaJ.js +113 -0
- package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
- package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
- package/dist/duplicate-page-BR7Dlo9d.js +133 -0
- package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
- package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
- package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
- package/dist/fonts-B-Xt29pe.cjs +1 -0
- package/dist/fonts-DRly3Wzd.js +78 -0
- package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
- package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
- package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
- package/dist/get-seo-defaults-9zHebckY.js +65 -0
- package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
- package/dist/image-compression-DZ9WMmyn.cjs +1 -0
- package/dist/image-compression-DsZ1oqpb.js +37 -0
- package/dist/image-editor-DV8kUKhl.js +108 -0
- package/dist/image-editor-G-K28aTS.cjs +1 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-Ct7ElCGK.js +19069 -0
- package/dist/index-DF5DEvqb.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-WQwzsC7A.cjs +5 -0
- package/dist/index-ZuacEL1j.js +4732 -0
- package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
- package/dist/json-diff-viewer-krslPepD.js +258 -0
- package/dist/lang-panel-BwIewMyw.js +215 -0
- package/dist/lang-panel-DT96k1xg.cjs +1 -0
- package/dist/manage-design-tokens-Caz_20VK.js +240 -0
- package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
- package/dist/mark-as-template-D295ZQtU.js +156 -0
- package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
- package/dist/no-language-page-content-BvqRBP6y.js +42 -0
- package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
- package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
- package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
- package/dist/page-creator-C4gc5NSC.cjs +1 -0
- package/dist/page-creator-DiOITEMw.js +795 -0
- package/dist/page-lock-BdYmCks0.cjs +1 -0
- package/dist/page-lock-Bfbs6RgL.js +30 -0
- package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
- package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
- package/dist/page-manager-new-CHDueBDk.cjs +1 -0
- package/dist/page-manager-new-CzX22g2n.js +394 -0
- package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
- package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
- package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +491 -0
- package/dist/pages.js +27 -0
- package/dist/plugin-3ZKK6RXm.js +245 -0
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-D9aixMN5.js +178 -0
- package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
- package/dist/register-partial-type-BjtdfKHE.js +36 -0
- package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +26 -13
- package/dist/render.js +130 -124
- package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
- package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +306 -7
- package/dist/runtime.js +44 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
- package/dist/save-to-lib-eiOc_SSN.js +422 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-BgRY82CT.cjs +16 -0
- package/dist/selected-block-display-CBFePS19.js +319 -0
- package/dist/seo-panel-C1-iMOR1.js +798 -0
- package/dist/seo-panel-DfAb8U7W.cjs +2 -0
- package/dist/shared-json-ld-B4PxAM_0.js +565 -0
- package/dist/shared-json-ld-DzG398hr.cjs +1 -0
- package/dist/slug-input-AwNJs9im.js +86 -0
- package/dist/slug-input-C_ijLQ_X.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -0
- package/dist/supabase-actions.d.ts +284 -0
- package/dist/supabase-actions.js +524 -0
- package/dist/take-over-request-BNxcjY2j.cjs +1 -0
- package/dist/take-over-request-C4FeDtN_.js +63 -0
- package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
- package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
- package/dist/translation-warning-modal-B64YqlbI.js +26 -0
- package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
- package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
- package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
- package/dist/unpublish-page-D4VwOlxc.js +27 -0
- package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/{tailwind.cjs → utils.cjs} +1 -1
- package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
- package/dist/utils.js +7 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +0 -6
- package/dist/web-blocks.js +248 -241
- package/dist/web-preview-Cio70gk5.cjs +1 -0
- package/dist/web-preview-Djy6WIyj.js +73 -0
- package/package.json +175 -105
- package/dist/IconPicker-CGWn9C4u.cjs +0 -1
- package/dist/IconPicker-QvxJ-4Ez.js +0 -64
- package/dist/apply-binding-DCno1xQL.js +0 -711
- package/dist/apply-binding-DvHNFLQD.cjs +0 -1
- package/dist/code-display-BZ1x7SqI.cjs +0 -1
- package/dist/code-editor-B28LoECM.cjs +0 -1
- package/dist/code-editor-CfG2FhJ-.js +0 -58
- package/dist/common-functions-BGzDsf1z.js +0 -14
- package/dist/common-functions-BZmyleS1.cjs +0 -1
- package/dist/css-import-modal-CENUYvcl.cjs +0 -13
- package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
- package/dist/index-CaGNHF7f.js +0 -12209
- package/dist/index-Gn6pJt2v.cjs +0 -166
- package/dist/mockServiceWorker.js +0 -307
- package/dist/plugin-B5627hMN.js +0 -195
- package/dist/plugin-UxTRfDum.cjs +0 -22
- package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
- package/dist/rte-widget-modal-Dte0od04.js +0 -41
- package/dist/tailwind.js +0 -7
- package/dist/tooltip-A4qGk781.cjs +0 -1
- package/dist/tooltip-tLiIOgjq.js +0 -1067
- package/dist/ui.cjs +0 -1
- package/dist/ui.d.ts +0 -415
- package/dist/ui.js +0 -129
- package/dist/vite.svg +0 -1
package/dist/core.js
CHANGED
|
@@ -1,109 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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-Ct7ElCGK.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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
F as
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
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-Ct7ElCGK.js";
|
|
5
3
|
import * as b from "culori";
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { a as L } from "./fonts-DRly3Wzd.js";
|
|
5
|
+
import * as x from "react";
|
|
6
|
+
import { useTranslation as P } from "react-i18next";
|
|
7
|
+
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
8
|
try {
|
|
9
9
|
const r = b.parse(o);
|
|
10
10
|
if (!r) throw new Error("Invalid color input");
|
|
11
11
|
switch (e) {
|
|
12
12
|
case "hsl": {
|
|
13
13
|
const t = b.converter("hsl")(r);
|
|
14
|
-
return s === "4" ?
|
|
14
|
+
return s === "4" ? H(t) : `${d(t.h)} ${d(t.s * 100)}% ${d(t.l * 100)}%`;
|
|
15
15
|
}
|
|
16
16
|
case "rgb":
|
|
17
17
|
return b.formatRgb(r);
|
|
@@ -40,13 +40,13 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
40
40
|
const s = w(o);
|
|
41
41
|
if (!s.isValid)
|
|
42
42
|
return console.warn("CSS validation failed:", s.error), $();
|
|
43
|
-
const r = v(o, ":root"), t = v(o, ".dark"), l =
|
|
43
|
+
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
44
|
e.fontFamily = {
|
|
45
45
|
heading: n,
|
|
46
46
|
body: n
|
|
47
47
|
};
|
|
48
|
-
const
|
|
49
|
-
e.borderRadius =
|
|
48
|
+
const m = f(r, "--radius") || f(r, "--border-radius") || "0.5rem";
|
|
49
|
+
e.borderRadius = q(m), [
|
|
50
50
|
"background",
|
|
51
51
|
"foreground",
|
|
52
52
|
"primary",
|
|
@@ -67,7 +67,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
67
67
|
"popover",
|
|
68
68
|
"popover-foreground"
|
|
69
69
|
].forEach((a) => {
|
|
70
|
-
const p =
|
|
70
|
+
const p = f(r, `--${a}`), g = f(t, `--${a}`);
|
|
71
71
|
if (p || g) {
|
|
72
72
|
const c = p ? k(p) : "#000000", C = g ? k(g) : c;
|
|
73
73
|
e.colors[a] = [c, C];
|
|
@@ -81,7 +81,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
81
81
|
var r, t;
|
|
82
82
|
const s = new RegExp(`${F(e)}\\s*{([^}]+)}`);
|
|
83
83
|
return ((t = (r = o.match(s)) == null ? void 0 : r[1]) == null ? void 0 : t.trim()) || null;
|
|
84
|
-
},
|
|
84
|
+
}, f = (o, e) => {
|
|
85
85
|
var t;
|
|
86
86
|
if (!o) return null;
|
|
87
87
|
const s = new RegExp(`${F(e)}\\s*:\\s*([^;]+)`), r = o.match(s);
|
|
@@ -102,8 +102,8 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
102
102
|
return S(e) || "#000000";
|
|
103
103
|
const s = e.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);
|
|
104
104
|
if (s) {
|
|
105
|
-
const [r, t, l
|
|
106
|
-
return S(
|
|
105
|
+
const [, r, t, l] = s, n = `hsl(${r} ${t}% ${l}%)`;
|
|
106
|
+
return S(n) || "#000000";
|
|
107
107
|
}
|
|
108
108
|
if (/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(e)) {
|
|
109
109
|
const r = e.split(/[\s,]+/).filter(Boolean);
|
|
@@ -117,7 +117,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
117
117
|
return console.warn("Failed to process color:", o, e), "#000000";
|
|
118
118
|
}
|
|
119
119
|
}, B = (o) => {
|
|
120
|
-
const e =
|
|
120
|
+
const e = L();
|
|
121
121
|
if (!o)
|
|
122
122
|
return "ui-sans-serif, system-ui, sans-serif";
|
|
123
123
|
try {
|
|
@@ -126,9 +126,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
126
126
|
} catch (s) {
|
|
127
127
|
return console.warn("Error processing font family:", o, s), "ui-sans-serif, system-ui, sans-serif";
|
|
128
128
|
}
|
|
129
|
-
},
|
|
130
|
-
if (!o)
|
|
131
|
-
return "8px";
|
|
129
|
+
}, q = (o) => {
|
|
132
130
|
try {
|
|
133
131
|
const e = o.trim();
|
|
134
132
|
if (e.endsWith("px"))
|
|
@@ -175,7 +173,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
175
173
|
popover: ["#ffffff", "#0f172a"],
|
|
176
174
|
"popover-foreground": ["#000000", "#f8fafc"]
|
|
177
175
|
}
|
|
178
|
-
}), F = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
176
|
+
}), F = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), W = (o) => ["background", "foreground", "primary", "primary-foreground"].every(
|
|
179
177
|
(r) => o.colors[r] && Array.isArray(o.colors[r]) && o.colors[r].length >= 2
|
|
180
178
|
) && !!o.fontFamily.heading && !!o.fontFamily.body && !!o.borderRadius, w = (o) => {
|
|
181
179
|
if (!o || typeof o != "string")
|
|
@@ -203,7 +201,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
203
201
|
} catch (s) {
|
|
204
202
|
return console.error("CSS validation error:", s), { isValid: !1, error: "Failed to parse CSS. Please check your syntax." };
|
|
205
203
|
}
|
|
206
|
-
},
|
|
204
|
+
}, _ = `:root {
|
|
207
205
|
--background: 0 0% 100%;
|
|
208
206
|
--foreground: oklch(0.52 0.13 144.17);
|
|
209
207
|
--primary: #3e2723;
|
|
@@ -216,7 +214,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
216
214
|
--primary: rgb(46, 125, 50);
|
|
217
215
|
--primary-foreground: #ffffff;
|
|
218
216
|
}`, Z = ({ open: o, onOpenChange: e, onImport: s }) => {
|
|
219
|
-
const [r, t] = x.useState(""), [l, n] = x.useState(null), [
|
|
217
|
+
const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } = P(), p = async () => {
|
|
220
218
|
h(!0), n(null);
|
|
221
219
|
try {
|
|
222
220
|
const c = w(r);
|
|
@@ -227,9 +225,11 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
227
225
|
return;
|
|
228
226
|
}
|
|
229
227
|
const C = z(r);
|
|
230
|
-
if (!
|
|
228
|
+
if (!W(C)) {
|
|
231
229
|
n(
|
|
232
|
-
a(
|
|
230
|
+
a(
|
|
231
|
+
"The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors."
|
|
232
|
+
)
|
|
233
233
|
), setTimeout(() => {
|
|
234
234
|
n(null);
|
|
235
235
|
}, 5e3), h(!1);
|
|
@@ -246,14 +246,14 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
246
246
|
}, g = () => {
|
|
247
247
|
t(""), n(null), e(!1);
|
|
248
248
|
};
|
|
249
|
-
return /* @__PURE__ */ i(
|
|
250
|
-
/* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ i(T, { open: o, onOpenChange: e, children: /* @__PURE__ */ u(V, { className: "flex max-h-[80vh] max-w-2xl flex-col", children: [
|
|
250
|
+
/* @__PURE__ */ u(N, { children: [
|
|
251
251
|
/* @__PURE__ */ i(R, { children: a("Import CSS Theme") }),
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ u(E, { className: "space-y-2", children: [
|
|
253
253
|
/* @__PURE__ */ i("p", { children: a(
|
|
254
254
|
"Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties."
|
|
255
255
|
) }),
|
|
256
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ u("div", { className: "flex items-center", children: [
|
|
257
257
|
/* @__PURE__ */ i("p", { className: "font-bold", children: "Get theme resources:" }),
|
|
258
258
|
/* @__PURE__ */ i(y, { variant: "link", size: "sm", onClick: () => window.open("https://tweakcn.com/", "_blank"), children: "TweakCN" }),
|
|
259
259
|
/* @__PURE__ */ i(
|
|
@@ -277,26 +277,26 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
277
277
|
] })
|
|
278
278
|
] })
|
|
279
279
|
] }),
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */ i(
|
|
280
|
+
/* @__PURE__ */ u("div", { className: "flex-1 space-y-4 overflow-hidden", children: [
|
|
281
|
+
/* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
282
|
+
/* @__PURE__ */ i(D, { htmlFor: "css-input", children: a("CSS Variables") }),
|
|
283
283
|
/* @__PURE__ */ i(
|
|
284
|
-
|
|
284
|
+
I,
|
|
285
285
|
{
|
|
286
286
|
id: "css-input",
|
|
287
|
-
placeholder:
|
|
287
|
+
placeholder: _,
|
|
288
288
|
value: r,
|
|
289
289
|
onChange: (c) => t(c.target.value),
|
|
290
290
|
className: "min-h-[300px] resize-none font-mono text-sm",
|
|
291
|
-
disabled:
|
|
291
|
+
disabled: m
|
|
292
292
|
}
|
|
293
293
|
)
|
|
294
294
|
] }),
|
|
295
295
|
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
296
|
] }),
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */ i(y, { variant: "outline", onClick: g, disabled:
|
|
299
|
-
/* @__PURE__ */ i(y, { onClick: p, disabled: !r.trim() ||
|
|
297
|
+
/* @__PURE__ */ u(A, { className: "gap-2", children: [
|
|
298
|
+
/* @__PURE__ */ i(y, { variant: "outline", onClick: g, disabled: m, children: a("Cancel") }),
|
|
299
|
+
/* @__PURE__ */ i(y, { onClick: p, disabled: !r.trim() || m, children: a(m ? "Importing..." : "Import Theme") })
|
|
300
300
|
] })
|
|
301
301
|
] }) });
|
|
302
302
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("./index-DF5DEvqb.cjs"),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=D(l);o.fontFamily={heading:a,body:a};const m=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=P(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"}},D=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"}},P=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,"\\$&"),q=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(!q(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;
|
|
@@ -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-Ct7ElCGK.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-DF5DEvqb.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,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-Ct7ElCGK.js";
|
|
3
|
+
import { c as R, o as W, m as q, g as F, l as H, L as M } from "./index-ZuacEL1j.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 t=require("react/jsx-runtime"),s=require("./index-DF5DEvqb.cjs"),o=require("./index-WQwzsC7A.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 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("./index-DF5DEvqb.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-Ct7ElCGK.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
|
+
};
|