@chaibuilder/sdk 4.0.0-beta.32 → 4.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2SSKDMRQ-pPung-JB.js → 2SSKDMRQ-BXAXoR9y.js} +5 -5
- package/dist/{2SSKDMRQ-DfXKDvXk.cjs → 2SSKDMRQ-BqOsh3tf.cjs} +1 -1
- package/dist/{AP7HFJJL-CEJuc_Ox.js → AP7HFJJL-B78LfetW.js} +1 -1
- package/dist/{AP7HFJJL-PvPBwV6T.cjs → AP7HFJJL-Cv6sqAAd.cjs} +1 -1
- package/dist/{IconPicker-D_GRfhwS.js → IconPicker-BlO5Pnyu.js} +1 -1
- package/dist/{IconPicker-BJHUCDn4.cjs → IconPicker-D4yq_b-k.cjs} +1 -1
- package/dist/{WDYDFRGG-B3FrCE_j.js → WDYDFRGG-BE7jgVqa.js} +4 -4
- package/dist/{WDYDFRGG-BPHlcLi5.cjs → WDYDFRGG-Dz9d3cVW.cjs} +1 -1
- package/dist/{actions-registery-Bj-j1k5i.js → actions-registery-D3-4Yha7.js} +1108 -1061
- package/dist/{actions-registery-Cy1lqUVI.cjs → actions-registery-vPaY-3dZ.cjs} +25 -25
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-C_Ma7oFU.js → active-in-another-tab-CA47uafJ.js} +2 -2
- package/dist/{active-in-another-tab-WVYf-z5w.cjs → active-in-another-tab-CNn_R-55.cjs} +1 -1
- package/dist/{add-new-language-page-DtsBO739.js → add-new-language-page-B-kPbhFd.js} +3 -3
- package/dist/{add-new-language-page-CxW2Vuyr.cjs → add-new-language-page-QAZbAFQe.cjs} +1 -1
- package/dist/{add-new-page-BfKt72NF.cjs → add-new-page-D4nbAHOp.cjs} +1 -1
- package/dist/add-new-page-Y0d9tHh0.js +31 -0
- package/dist/{ai-panel-content-Dfo4jOVB.cjs → ai-panel-content-DXbebC-m.cjs} +1 -1
- package/dist/{ai-panel-content-dktE9CIO.js → ai-panel-content-WMOeK5pF.js} +5 -5
- package/dist/{ai-panel-default-lang-BbUTXMbm.js → ai-panel-default-lang-CM_psX_h.js} +7 -7
- package/dist/{ai-panel-default-lang-GQCtwlPs.cjs → ai-panel-default-lang-hmfyAYPM.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DIDS-mTi.js → ai-panel-other-lang-BKANRJAb.js} +13 -13
- package/dist/{ai-panel-other-lang-nCUxwpLX.cjs → ai-panel-other-lang-D4GL1b-W.cjs} +1 -1
- package/dist/{ai-prompt-input-Dws5BHhQ.cjs → ai-prompt-input-Dwd0-pcD.cjs} +1 -1
- package/dist/{ai-prompt-input-B2q30bhR.js → ai-prompt-input-mxXtWptn.js} +13 -13
- package/dist/{ai-translation-prompt-CJVcuWrs.cjs → ai-translation-prompt-7M2aEZ1w.cjs} +1 -1
- package/dist/{ai-translation-prompt-D87qk3C1.js → ai-translation-prompt-C_Pb7BE4.js} +1 -1
- package/dist/{apply-binding-chfbBKi2.js → apply-binding-BYCW1k2l.js} +1 -1
- package/dist/{apply-binding-9XSrYzAE.cjs → apply-binding-xiigK7eK.cjs} +1 -1
- package/dist/{change-password-modal-CVUa60pC.cjs → change-password-modal-BYZoefwT.cjs} +1 -1
- package/dist/{change-password-modal-PahNYs8x.js → change-password-modal-Dqf_mleR.js} +5 -5
- package/dist/{code-editor-CWOmKcUc.js → code-editor-1fSEocLK.js} +1 -1
- package/dist/{code-editor-Cim6jQVF.cjs → code-editor-uN7W7KMD.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BYFOU3hH.js → continue-editing-in-this-client-DD7bBhjD.js} +2 -2
- package/dist/{continue-editing-in-this-client-CW0f2LRk.cjs → continue-editing-in-this-client-DDM65ror.cjs} +1 -1
- package/dist/{core-BWQrViOY.cjs → core-czmLeR0h.cjs} +1 -1
- package/dist/{core-QlWEXm1d.js → core-nSRy3D7z.js} +16 -15
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -2
- package/dist/core.js +19 -19
- package/dist/{css-import-modal-CXulmaB4.cjs → css-import-modal-BU7bJAaT.cjs} +1 -1
- package/dist/{css-import-modal-6bMTRlCg.js → css-import-modal-pBNRVmGj.js} +1 -1
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/{plugin-BSjgGgwo.js → default-theme-options-saBIkWGT.js} +114 -114
- package/dist/{delete-page-CdByrw3j.cjs → delete-page-8oEYsHPE.cjs} +1 -1
- package/dist/delete-page-B53nkF74.js +71 -0
- package/dist/{design-token-usage-D-hrcKz1.cjs → design-token-usage-Cm9m4AMz.cjs} +1 -1
- package/dist/{design-token-usage-lf7N_uOk.js → design-token-usage-DzWav2ip.js} +14 -14
- package/dist/{digital-asset-manager-PcYficIX.js → digital-asset-manager-1yLYGPuf.js} +3 -3
- package/dist/{digital-asset-manager-CxxhsToc.cjs → digital-asset-manager-BaTvMY8Q.cjs} +1 -1
- package/dist/{duplicate-page-D2f3HvWX.cjs → duplicate-page-C2DZI4U0.cjs} +1 -1
- package/dist/{duplicate-page-DfEA148D.js → duplicate-page-DCRVR-kF.js} +6 -6
- package/dist/{dynamic-page-selector-Dz7D1Wdr.cjs → dynamic-page-selector-CZJQnc-Q.cjs} +1 -1
- package/dist/{dynamic-page-selector-DB__KD2y.js → dynamic-page-selector-DCGWkLVV.js} +12 -12
- package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
- package/dist/{image-editor-CilPMtAC.js → image-editor-C0EYZJY_.js} +1 -1
- package/dist/{image-editor-BdW476J8.cjs → image-editor-DkgZrSGr.cjs} +1 -1
- package/dist/{index-IQefjAA0.js → index-BDrc0HJQ.js} +1604 -1566
- package/dist/index-BuXfCtgR.cjs +5 -0
- package/dist/{index-DsQXiNA_.js → index-C7bidKtE.js} +2786 -2752
- package/dist/index-DKjYF53r.cjs +160 -0
- package/dist/{json-diff-viewer-BPqY25PU.cjs → json-diff-viewer-88jEhq8D.cjs} +1 -1
- package/dist/{json-diff-viewer-Ci2IbgDn.js → json-diff-viewer-wmzIZcuQ.js} +34 -34
- package/dist/{lang-panel-DlAQr-y9.js → lang-panel--kWBnU_W.js} +7 -7
- package/dist/{lang-panel-jebYHYGD.cjs → lang-panel-I_ABfjOZ.cjs} +1 -1
- package/dist/manage-design-tokens-CslCEOXU.cjs +1 -0
- package/dist/manage-design-tokens-JdVKj09s.js +445 -0
- package/dist/manage-design-tokens-modal-DA15ou0u.cjs +1 -0
- package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-xKxC72Bc.js} +9 -9
- package/dist/{mark-as-template-DOZL3umP.js → mark-as-template-AbZrkEYl.js} +7 -7
- package/dist/{mark-as-template-DS-tMllK.cjs → mark-as-template-ClQjC2p2.cjs} +1 -1
- package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-B04k-PPB.js} +1 -1
- package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-dFwZaM1r.cjs} +1 -1
- package/dist/{no-language-page-content-C8W0M_Fj.js → no-language-page-content-CbUqxuC4.js} +2 -2
- package/dist/{no-language-page-content-DWtEo657.cjs → no-language-page-content-pzkWJAg6.cjs} +1 -1
- package/dist/{no-language-page-dialog-cpCZ9vES.js → no-language-page-dialog-AavD_Mmc.js} +2 -2
- package/dist/{no-language-page-dialog-FVXkSnfT.cjs → no-language-page-dialog-DhlOVXUm.cjs} +1 -1
- package/dist/{page-creator-CFtxeW_t.js → page-creator-2OZveMsR.js} +95 -95
- package/dist/{page-creator-o6yRzsVf.cjs → page-creator-DMjnStPf.cjs} +1 -1
- package/dist/{page-lock-Cthbk6Pg.js → page-lock-5MwwTWe8.js} +2 -2
- package/dist/{page-lock-BS_ErOIW.cjs → page-lock-B3CpoFTs.cjs} +1 -1
- package/dist/{page-locked-dialog-D5hmaWqw.js → page-locked-dialog-BhNZC9wZ.js} +13 -13
- package/dist/{page-locked-dialog-BWXifuQ8.cjs → page-locked-dialog-ZOvjnxRI.cjs} +1 -1
- package/dist/page-manager-new-BcI-1Dms.cjs +1 -0
- package/dist/{page-manager-new-Dl5YwsMm.js → page-manager-new-l68-Lc9h.js} +85 -88
- package/dist/{page-manager-search-and-filter-jDoLrCB7.cjs → page-manager-search-and-filter-BOpne6v-.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-iFsFJhn4.js → page-manager-search-and-filter-DJn98D02.js} +9 -9
- package/dist/{page-revisions-content-CeBepZEw.cjs → page-revisions-content-B00tDCzu.cjs} +1 -1
- package/dist/{page-revisions-content-C1IGUurW.js → page-revisions-content-Bqp-9bae.js} +23 -23
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +14 -2
- package/dist/pages.js +12 -12
- package/dist/{publish-pages-content-BpEoA1T6.js → publish-pages-content-CtZLSG6O.js} +68 -75
- package/dist/publish-pages-content-DfYG0biw.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +5 -5
- package/dist/{rte-widget-modal-c3T09VeO.js → rte-widget-modal-DGEWoQ1b.js} +1 -1
- package/dist/{rte-widget-modal-CC1KcrAT.cjs → rte-widget-modal-DX66uSPv.cjs} +1 -1
- package/dist/runtime.cjs +6 -6
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +36 -35
- package/dist/{save-to-lib-BERYhyxq.js → save-to-lib-CCxX5ZmQ.js} +25 -25
- package/dist/{save-to-lib-Bk59qO1r.cjs → save-to-lib-DmAjdhzU.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-vFSCOnw8.cjs → selected-block-display-Csce27bR.cjs} +1 -1
- package/dist/{selected-block-display-C6NxfC0N.js → selected-block-display-Cv6jBhJD.js} +20 -20
- package/dist/{seo-panel-0vlr_dBq.cjs → seo-panel-BZYXeYzE.cjs} +1 -1
- package/dist/{seo-panel-COrEJZLA.js → seo-panel-Ctstjs-d.js} +25 -25
- package/dist/{shared-json-ld-C46hURIr.cjs → shared-json-ld-BDWtjHgw.cjs} +1 -1
- package/dist/{shared-json-ld-DnTuCBc3.js → shared-json-ld-BNHGmUBd.js} +45 -45
- package/dist/{slug-input-CAqkFZBq.js → slug-input-Bui1Qmvh.js} +1 -1
- package/dist/{slug-input-Curnt2n3.cjs → slug-input-IAl_jfHr.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +223 -155
- package/dist/{take-over-request-6fliSr8w.cjs → take-over-request-Bl6jS1cK.cjs} +1 -1
- package/dist/{take-over-request-DvmM5qTu.js → take-over-request-Ceuqyk5K.js} +13 -13
- package/dist/{translation-warning-modal-B876S5yp.cjs → translation-warning-modal-CCmmwz1C.cjs} +1 -1
- package/dist/{translation-warning-modal-kRcfrPgo.js → translation-warning-modal-DA5dt2FA.js} +9 -9
- package/dist/types.d.ts +14 -2
- package/dist/{unmark-as-template-Dn3klZKq.js → unmark-as-template-CKVMibvu.js} +13 -13
- package/dist/{unmark-as-template-q1GblG-u.cjs → unmark-as-template-OEUqo0uc.cjs} +1 -1
- package/dist/unpublish-page-A5qn6E6g.js +28 -0
- package/dist/{unpublish-page-DMbcHmUV.cjs → unpublish-page-C81bYHLI.cjs} +1 -1
- package/dist/{unpublished-partials-modal-Ts5ZhAK9.js → unpublished-partials-modal-FqzTp5el.js} +3 -3
- package/dist/{unpublished-partials-modal-CEFXp1D1.cjs → unpublished-partials-modal-af5uDL7Y.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/dist/{web-preview-B2YGL26D.js → web-preview-vge6uUSa.js} +1 -1
- package/dist/{web-preview-C6SLwtqv.cjs → web-preview-xtKkQOXy.cjs} +1 -1
- package/package.json +1 -1
- package/dist/add-new-page-DG38rI6S.js +0 -31
- package/dist/delete-page-BDViv7Xm.js +0 -71
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/index-Bzyv7mAh.cjs +0 -5
- package/dist/index-mPCp0j2h.cjs +0 -160
- package/dist/manage-design-tokens-BknGNAKE.cjs +0 -1
- package/dist/manage-design-tokens-Co5677WS.js +0 -428
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +0 -1
- package/dist/page-manager-new-DpSqBzeh.cjs +0 -1
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/publish-pages-content-PNsiaGI-.cjs +0 -1
- package/dist/theme-panel-footer-3ixmq107.cjs +0 -1
- package/dist/theme-panel-footer-BlsXRcEY.js +0 -26
- package/dist/unpublish-page-BbFZw0so.js +0 -28
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as A, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Y as he, Z as fe, _ as pe, $ as K, a0 as ge, a1 as xe, a2 as ve, a3 as ke, a4 as Ne, a5 as be, a6 as Te, p as ye, a7 as Ce, a8 as we, a9 as Ae } from "./index-C7bidKtE.js";
|
|
3
|
+
import { z as X, B as v } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
|
+
import { D as De } from "./STRINGS-BExFecZW.js";
|
|
5
|
+
import { MagnifyingGlassIcon as Y, PlusIcon as q, TokensIcon as je, ArrowLeftIcon as Oe, EyeOpenIcon as J, Pencil1Icon as Se } from "@radix-ui/react-icons";
|
|
6
|
+
import { useAtom as Ee } from "jotai";
|
|
7
|
+
import { nanoid as Ie } from "nanoid";
|
|
8
|
+
import { useState as x, useRef as U, useCallback as F, useMemo as Pe, useEffect as ee, Suspense as ze, lazy as Re } from "react";
|
|
9
|
+
import { useTranslation as Le } from "react-i18next";
|
|
10
|
+
import { toast as p } from "sonner";
|
|
11
|
+
import { twMerge as Me } from "tailwind-merge";
|
|
12
|
+
const W = (o) => {
|
|
13
|
+
const m = o.trim();
|
|
14
|
+
return m.length === 0 || m.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m);
|
|
15
|
+
}, $e = (o, m, n, i = !1, u) => {
|
|
16
|
+
const h = o.trim();
|
|
17
|
+
return h.length === 0 ? "" : h.length > 25 ? n("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h) ? Object.entries(m).find(
|
|
18
|
+
([k, C]) => C.name === h && (!i || k !== u)
|
|
19
|
+
) ? n("Token name already exists") : "" : n("Only alphanumeric characters and hyphens allowed");
|
|
20
|
+
}, Be = (o) => o.replace(/\s+/g, "-"), Fe = Re(() => import("./design-token-usage-DzWav2ip.js")), te = ({
|
|
21
|
+
tokenId: o,
|
|
22
|
+
token: m,
|
|
23
|
+
isDisabled: n,
|
|
24
|
+
isSelected: i,
|
|
25
|
+
isArchived: u = !1,
|
|
26
|
+
onSelect: h,
|
|
27
|
+
onEdit: y,
|
|
28
|
+
onUnarchive: N
|
|
29
|
+
}) => /* @__PURE__ */ a(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
onClick: () => h(o),
|
|
33
|
+
className: `group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${u ? "border-muted bg-muted/30 opacity-60" : i ? "border-primary bg-primary/10" : "hover:bg-muted/90"}`,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
36
|
+
/* @__PURE__ */ e("div", { className: `text-xs font-semibold ${u ? "text-muted-foreground" : ""}`, children: m.name }),
|
|
37
|
+
/* @__PURE__ */ e("div", { className: `w-full max-w-52 truncate text-[10px] font-light ${u ? "text-muted-foreground" : ""}`, children: m.value })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ a("div", { className: "absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100", children: [
|
|
40
|
+
!u && /* @__PURE__ */ a(A, { children: [
|
|
41
|
+
/* @__PURE__ */ e(ze, { fallback: null, children: /* @__PURE__ */ e(Fe, { tokenId: o, tokenName: m.name, children: /* @__PURE__ */ e(
|
|
42
|
+
v,
|
|
43
|
+
{
|
|
44
|
+
variant: "ghost",
|
|
45
|
+
size: "sm",
|
|
46
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
47
|
+
children: /* @__PURE__ */ e(J, { className: "h-3 w-3" })
|
|
48
|
+
}
|
|
49
|
+
) }) }),
|
|
50
|
+
/* @__PURE__ */ e(
|
|
51
|
+
v,
|
|
52
|
+
{
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
size: "sm",
|
|
55
|
+
onClick: (k) => {
|
|
56
|
+
k.stopPropagation(), y(o);
|
|
57
|
+
},
|
|
58
|
+
disabled: n,
|
|
59
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
60
|
+
children: /* @__PURE__ */ e(Se, { className: "h-3 w-3" })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
u && /* @__PURE__ */ e(
|
|
65
|
+
v,
|
|
66
|
+
{
|
|
67
|
+
variant: "ghost",
|
|
68
|
+
size: "sm",
|
|
69
|
+
onClick: (k) => {
|
|
70
|
+
k.stopPropagation(), N == null || N(o);
|
|
71
|
+
},
|
|
72
|
+
disabled: n,
|
|
73
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
74
|
+
children: /* @__PURE__ */ e(J, { className: "h-3 w-3" })
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
), tt = ({ onActiveTokenChange: o, onDirtyStateChange: m }) => {
|
|
81
|
+
const { t: n } = Le(), [i, u] = Ee(he), h = fe(), { saveDesignTokens: y, debouncedSaveDesignTokens: N } = pe(), k = K("pageId", ""), C = K("siteWideUsage", {}), [f, z] = x("view"), [g, R] = x(null), [b, Z] = x(null), [l, D] = x(""), [c, j] = x(""), [O, S] = x(""), [E, ne] = x(""), [se, L] = x(!1), M = U(null), [I, $] = x({
|
|
82
|
+
isOpen: !1,
|
|
83
|
+
tokenId: null,
|
|
84
|
+
tokenName: "",
|
|
85
|
+
pageCount: 0,
|
|
86
|
+
partialCount: 0
|
|
87
|
+
}), P = U(null), re = F(
|
|
88
|
+
(t) => {
|
|
89
|
+
if (!C) return { pageCount: 0, partialCount: 0 };
|
|
90
|
+
let s = 0, r = 0;
|
|
91
|
+
return Object.entries(C).forEach(([d, T]) => {
|
|
92
|
+
if (d === k || !(T != null && T.designTokens)) return;
|
|
93
|
+
Object.keys(T.designTokens).some((ue) => ue === t) && (T.isPartial ? r++ : s++);
|
|
94
|
+
}), { pageCount: s, partialCount: r };
|
|
95
|
+
},
|
|
96
|
+
[C, k]
|
|
97
|
+
), B = Pe(() => Object.entries(i).filter(
|
|
98
|
+
([, t]) => t.name.toLowerCase().includes(E.toLowerCase()) || t.value.toLowerCase().includes(E.toLowerCase())
|
|
99
|
+
), [i, E]);
|
|
100
|
+
ee(() => {
|
|
101
|
+
if (!m)
|
|
102
|
+
return;
|
|
103
|
+
const t = f === "add" && (l && l.trim().length > 0 || c && c.trim().length > 0);
|
|
104
|
+
m(t);
|
|
105
|
+
}, [f, l, c, m]), ee(() => {
|
|
106
|
+
if (o)
|
|
107
|
+
if (f === "edit" || f === "add")
|
|
108
|
+
o(l && c ? {
|
|
109
|
+
name: l,
|
|
110
|
+
value: c,
|
|
111
|
+
id: g || void 0
|
|
112
|
+
} : null);
|
|
113
|
+
else if (f === "view" && b && i[b]) {
|
|
114
|
+
const t = i[b];
|
|
115
|
+
o({
|
|
116
|
+
name: t.name,
|
|
117
|
+
value: t.value,
|
|
118
|
+
id: b
|
|
119
|
+
});
|
|
120
|
+
} else
|
|
121
|
+
o(null);
|
|
122
|
+
}, [f, l, c, g, b, i, o]);
|
|
123
|
+
const ae = () => {
|
|
124
|
+
if (!l.trim() || !c.trim()) {
|
|
125
|
+
p.error(n("Please fill in both token name and classes"));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!W(l)) {
|
|
129
|
+
p.error(n("Invalid design token name format"));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (Object.entries(i).find(
|
|
133
|
+
([s, r]) => r.name === l.trim() && s !== g
|
|
134
|
+
)) {
|
|
135
|
+
p.error(n("Token already exists"));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
g && ie(l, c);
|
|
139
|
+
}, w = F(() => {
|
|
140
|
+
R(null), D(""), j(""), S(""), L(!1), z("view");
|
|
141
|
+
}, []), ie = F(
|
|
142
|
+
(t, s) => {
|
|
143
|
+
!g || f !== "edit" || !t.trim() || !s.trim() || !W(t) || Object.entries(i).find(
|
|
144
|
+
([d, T]) => T.name === t.trim() && d !== g
|
|
145
|
+
) || (L(!0), M.current && clearTimeout(M.current), M.current = setTimeout(() => {
|
|
146
|
+
const d = {
|
|
147
|
+
...i,
|
|
148
|
+
[g]: {
|
|
149
|
+
name: t.trim(),
|
|
150
|
+
value: s.trim()
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
u(d), h(), N(), L(!1), p.success(n("Token updated successfully")), w();
|
|
154
|
+
}, 10));
|
|
155
|
+
},
|
|
156
|
+
[
|
|
157
|
+
g,
|
|
158
|
+
f,
|
|
159
|
+
i,
|
|
160
|
+
u,
|
|
161
|
+
h,
|
|
162
|
+
N,
|
|
163
|
+
n,
|
|
164
|
+
w
|
|
165
|
+
]
|
|
166
|
+
), oe = () => {
|
|
167
|
+
if (!l.trim() || !c.trim()) {
|
|
168
|
+
p.error(n("Please fill in both token name and classes"));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!W(l)) {
|
|
172
|
+
p.error(n("Invalid design token name format"));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (Object.values(i).find((d) => d.name === l.trim())) {
|
|
176
|
+
p.error(n("Token already exists"));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const s = `${De}${Ie(12)}`, r = {
|
|
180
|
+
...i,
|
|
181
|
+
[s]: {
|
|
182
|
+
name: l.trim(),
|
|
183
|
+
value: c.trim()
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
u(r), h(), y(), p.success(n("Token added successfully")), w();
|
|
187
|
+
}, G = (t) => {
|
|
188
|
+
const s = i[t];
|
|
189
|
+
if (!s) return;
|
|
190
|
+
const { pageCount: r, partialCount: d } = re(t);
|
|
191
|
+
$({
|
|
192
|
+
isOpen: !0,
|
|
193
|
+
tokenId: t,
|
|
194
|
+
tokenName: s.name,
|
|
195
|
+
pageCount: r,
|
|
196
|
+
partialCount: d
|
|
197
|
+
}), P.current = t;
|
|
198
|
+
}, le = () => {
|
|
199
|
+
const t = P.current;
|
|
200
|
+
if (!t) return;
|
|
201
|
+
const s = {
|
|
202
|
+
...i,
|
|
203
|
+
[t]: {
|
|
204
|
+
...i[t],
|
|
205
|
+
archived: !0
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
u(s), h(), y(), p.success(n("Token archived successfully")), $({
|
|
209
|
+
isOpen: !1,
|
|
210
|
+
tokenId: null,
|
|
211
|
+
tokenName: "",
|
|
212
|
+
pageCount: 0,
|
|
213
|
+
partialCount: 0
|
|
214
|
+
}), P.current = null;
|
|
215
|
+
}, V = (t) => {
|
|
216
|
+
const s = {
|
|
217
|
+
...i,
|
|
218
|
+
[t]: {
|
|
219
|
+
name: i[t].name,
|
|
220
|
+
value: i[t].value
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
u(s), h(), p.success(n("Token unarchived successfully"));
|
|
224
|
+
}, _ = (t) => {
|
|
225
|
+
const s = i[t];
|
|
226
|
+
s && (R(t), D(s.name), j(s.value), S(""), z("edit"));
|
|
227
|
+
}, Q = () => {
|
|
228
|
+
R(null), D(""), j(""), S(""), z("add");
|
|
229
|
+
}, ce = (t) => {
|
|
230
|
+
const s = Be(t);
|
|
231
|
+
D(s);
|
|
232
|
+
const r = $e(s, i, n, f === "edit", g || void 0);
|
|
233
|
+
S(r);
|
|
234
|
+
}, H = (t) => {
|
|
235
|
+
j(t);
|
|
236
|
+
}, de = (t) => {
|
|
237
|
+
const s = we(Ae(Me(c, t)));
|
|
238
|
+
H(s);
|
|
239
|
+
}, me = (t) => {
|
|
240
|
+
const s = c.split(" ").filter((r) => r !== t).join(" ");
|
|
241
|
+
H(s);
|
|
242
|
+
};
|
|
243
|
+
return /* @__PURE__ */ a(A, { children: [
|
|
244
|
+
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: f === "view" ? (() => {
|
|
245
|
+
const t = B.filter(([, r]) => !r.archived), s = B.filter(([, r]) => r.archived);
|
|
246
|
+
return /* @__PURE__ */ a(A, { children: [
|
|
247
|
+
Object.entries(i).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
248
|
+
/* @__PURE__ */ a("div", { className: "relative flex-1", children: [
|
|
249
|
+
/* @__PURE__ */ e(Y, { className: "absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" }),
|
|
250
|
+
/* @__PURE__ */ e(
|
|
251
|
+
X,
|
|
252
|
+
{
|
|
253
|
+
placeholder: n("Search tokens"),
|
|
254
|
+
value: E,
|
|
255
|
+
onChange: (r) => ne(r.target.value),
|
|
256
|
+
className: "h-6 pl-7 text-xs"
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ a(
|
|
261
|
+
v,
|
|
262
|
+
{
|
|
263
|
+
variant: "outline",
|
|
264
|
+
onClick: Q,
|
|
265
|
+
size: "sm",
|
|
266
|
+
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ e(q, { className: "h-3 w-3" }),
|
|
269
|
+
n("Add")
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(Te, { className: "flex h-full flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
275
|
+
Object.entries(i).length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
276
|
+
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(je, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
277
|
+
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
|
|
278
|
+
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
|
|
279
|
+
/* @__PURE__ */ a(v, { variant: "default", onClick: Q, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
280
|
+
/* @__PURE__ */ e(q, { className: "mr-1 h-3 w-3" }),
|
|
281
|
+
n("Add first design token")
|
|
282
|
+
] })
|
|
283
|
+
] }) : B.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
284
|
+
/* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(Y, { className: "h-10 w-10 text-muted-foreground" }) }),
|
|
285
|
+
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No tokens found") }),
|
|
286
|
+
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("No design tokens match your search") })
|
|
287
|
+
] }) : /* @__PURE__ */ a(A, { children: [
|
|
288
|
+
t.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-1", children: t.map(([r, d]) => /* @__PURE__ */ e(
|
|
289
|
+
te,
|
|
290
|
+
{
|
|
291
|
+
token: d,
|
|
292
|
+
tokenId: r,
|
|
293
|
+
isSelected: b === r,
|
|
294
|
+
isArchived: !1,
|
|
295
|
+
onSelect: Z,
|
|
296
|
+
onEdit: _,
|
|
297
|
+
onArchive: G,
|
|
298
|
+
onUnarchive: V,
|
|
299
|
+
isDisabled: !1
|
|
300
|
+
},
|
|
301
|
+
r
|
|
302
|
+
)) }),
|
|
303
|
+
s.length > 0 && /* @__PURE__ */ a("div", { className: "mt-4 space-y-1", children: [
|
|
304
|
+
/* @__PURE__ */ e("div", { className: "px-2 py-1 text-[10px] font-semibold text-muted-foreground", children: n("Archived") }),
|
|
305
|
+
s.map(([r, d]) => /* @__PURE__ */ e(
|
|
306
|
+
te,
|
|
307
|
+
{
|
|
308
|
+
token: d,
|
|
309
|
+
tokenId: r,
|
|
310
|
+
isSelected: b === r,
|
|
311
|
+
isArchived: !0,
|
|
312
|
+
onSelect: Z,
|
|
313
|
+
onEdit: _,
|
|
314
|
+
onArchive: G,
|
|
315
|
+
onUnarchive: V,
|
|
316
|
+
isDisabled: !1
|
|
317
|
+
},
|
|
318
|
+
r
|
|
319
|
+
))
|
|
320
|
+
] })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ e("div", { className: "h-44" })
|
|
323
|
+
] }) }) })
|
|
324
|
+
] });
|
|
325
|
+
})() : (() => {
|
|
326
|
+
const t = f === "edit", s = n(t ? "Edit Design Token" : "Add Design Token"), r = n(t ? "Update design token" : "Create a reusable design token");
|
|
327
|
+
return /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
|
|
328
|
+
/* @__PURE__ */ a("div", { className: "mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5", children: [
|
|
329
|
+
/* @__PURE__ */ e(
|
|
330
|
+
v,
|
|
331
|
+
{
|
|
332
|
+
variant: "ghost",
|
|
333
|
+
size: "sm",
|
|
334
|
+
onClick: w,
|
|
335
|
+
className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
|
|
336
|
+
children: /* @__PURE__ */ e(Oe, { className: "h-3 w-3" })
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
/* @__PURE__ */ a("div", { className: "flex-1", children: [
|
|
340
|
+
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: s }),
|
|
341
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: r })
|
|
342
|
+
] }),
|
|
343
|
+
t && se && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary" }) })
|
|
344
|
+
] }),
|
|
345
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
|
|
346
|
+
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
347
|
+
/* @__PURE__ */ e(ye, { htmlFor: "token-name", className: "text-xs font-medium", children: n("Token Name") }),
|
|
348
|
+
/* @__PURE__ */ e(
|
|
349
|
+
X,
|
|
350
|
+
{
|
|
351
|
+
id: "token-name",
|
|
352
|
+
placeholder: "Button-Primary",
|
|
353
|
+
value: l,
|
|
354
|
+
onChange: (d) => ce(d.target.value),
|
|
355
|
+
className: "h-7 text-xs"
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
O ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: O }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: n("Button-Primary, Card-Header, Text-Large etc.") })
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ e(
|
|
361
|
+
Ce,
|
|
362
|
+
{
|
|
363
|
+
from: "designToken",
|
|
364
|
+
classFromProps: c,
|
|
365
|
+
onAddNew: de,
|
|
366
|
+
onRemove: me
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ a("div", { className: "mt-3 flex items-center justify-end gap-2 pt-3", children: [
|
|
370
|
+
/* @__PURE__ */ e(v, { variant: "outline", onClick: w, className: "h-7 text-xs", children: n("Cancel") }),
|
|
371
|
+
t ? /* @__PURE__ */ e(
|
|
372
|
+
v,
|
|
373
|
+
{
|
|
374
|
+
onClick: ae,
|
|
375
|
+
disabled: !l.trim() || !c.trim() || !!O,
|
|
376
|
+
className: "h-7 text-xs",
|
|
377
|
+
children: n("Save Token")
|
|
378
|
+
}
|
|
379
|
+
) : /* @__PURE__ */ e(
|
|
380
|
+
v,
|
|
381
|
+
{
|
|
382
|
+
onClick: oe,
|
|
383
|
+
disabled: !l.trim() || !c.trim() || !!O,
|
|
384
|
+
className: "h-7 text-xs",
|
|
385
|
+
children: n("Add Token")
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
] })
|
|
389
|
+
] })
|
|
390
|
+
] });
|
|
391
|
+
})() }),
|
|
392
|
+
/* @__PURE__ */ e(
|
|
393
|
+
ge,
|
|
394
|
+
{
|
|
395
|
+
open: I.isOpen,
|
|
396
|
+
onOpenChange: (t) => {
|
|
397
|
+
t || ($({
|
|
398
|
+
isOpen: !1,
|
|
399
|
+
tokenId: null,
|
|
400
|
+
tokenName: "",
|
|
401
|
+
pageCount: 0,
|
|
402
|
+
partialCount: 0
|
|
403
|
+
}), P.current = null);
|
|
404
|
+
},
|
|
405
|
+
children: /* @__PURE__ */ a(xe, { children: [
|
|
406
|
+
/* @__PURE__ */ e(ve, { children: n("Archive Design Token") }),
|
|
407
|
+
/* @__PURE__ */ a(ke, { className: "space-y-3", children: [
|
|
408
|
+
/* @__PURE__ */ a("p", { children: [
|
|
409
|
+
n("This token is used on"),
|
|
410
|
+
" ",
|
|
411
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: I.pageCount }),
|
|
412
|
+
" ",
|
|
413
|
+
n("pages"),
|
|
414
|
+
I.partialCount > 0 && /* @__PURE__ */ a(A, { children: [
|
|
415
|
+
" ",
|
|
416
|
+
n("and"),
|
|
417
|
+
" ",
|
|
418
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: I.partialCount }),
|
|
419
|
+
" ",
|
|
420
|
+
n("partials")
|
|
421
|
+
] }),
|
|
422
|
+
"."
|
|
423
|
+
] }),
|
|
424
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: n("Archiving this token will remove the styling for those blocks.") }),
|
|
425
|
+
/* @__PURE__ */ e("p", { children: n("Do you wish to continue?") })
|
|
426
|
+
] }),
|
|
427
|
+
/* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
428
|
+
/* @__PURE__ */ e(Ne, { children: n("Cancel") }),
|
|
429
|
+
/* @__PURE__ */ e(
|
|
430
|
+
be,
|
|
431
|
+
{
|
|
432
|
+
onClick: le,
|
|
433
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
434
|
+
children: n("Archive")
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
] })
|
|
438
|
+
] })
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
] });
|
|
442
|
+
};
|
|
443
|
+
export {
|
|
444
|
+
tt as default
|
|
445
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DKjYF53r.cjs"),y=require("@radix-ui/react-icons"),c=require("react"),j=require("react-i18next"),g=require("./default-theme-options-DN-3gIjM.cjs"),o=require("lodash-es"),b=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),w=require("@tailwindcss/forms"),C=require("@tailwindcss/typography"),D=require("./fonts-D5fTqvSS.cjs"),F=require("./manage-design-tokens-CslCEOXU.cjs"),N=()=>{const[s]=t.useTheme(),r=t.useThemeOptions(),[l]=t.useDarkMode(),{document:n,window:d}=t.useFrame(),i=D.useRegisteredFonts();c.useEffect(()=>{l?n==null||n.documentElement.classList.add("dark"):n==null||n.documentElement.classList.remove("dark")},[l,n]),c.useEffect(()=>{!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...g.getChaiThemeOptions(r)}},plugins:[C,w,b,v,g.plugin(function({addBase:a,theme:m}){a({"h1,h2,h3,h4,h5,h6":{fontFamily:m("fontFamily.heading")},body:{fontFamily:m("fontFamily.body"),color:m("colors.foreground"),backgroundColor:m("colors.background")}})})]})},[s,r,d]);const u=c.useMemo(()=>{const a=o.get(s,"fontFamily.heading"),m=o.get(s,"fontFamily.body");return i.filter(f=>f.family===a||f.family===m)},[s,i]),p=c.useMemo(()=>g.getThemeFontsUrls(o.filter(u,a=>o.has(a,"url"))),[u]),h=c.useMemo(()=>g.getThemeCustomFontFace(o.filter(u,a=>o.has(a,"src"))),[u]);return e.jsxs(e.Fragment,{children:[e.jsx(t.CssThemeVariables,{theme:s}),p.map((a,m)=>e.jsx("link",{rel:"stylesheet",href:a},`preview-font-${m}`)),e.jsx("style",{id:"chai-custom-fonts",dangerouslySetInnerHTML:{__html:h}})]})},T=({content:s,classes:r="",className:l="w-full rounded border-0",style:n={minHeight:80},title:d="Preview"})=>{const i=c.useMemo(()=>t.IframeInitialContent.replace('dir="__HTML_DIR__"','dir="ltr"'),[]);return e.jsxs(t.ChaiFrame,{className:l,style:n,title:d,initialContent:i,children:[e.jsx(N,{}),e.jsx("div",{className:"h-full p-4",children:e.jsx("div",{className:r||void 0,dangerouslySetInnerHTML:{__html:s}})})]})},x=["xs","sm","md","lg","xl","2xl"],k=s=>{if(s=s.trim().replace(/ +(?= )/g,""),o.isEmpty(s))return"";const r=o.map(s.split(" "),t.constructClassObject),l=[];for(const n of r){const d=n.mq;if(!l.includes(n.fullCls))for(let i=x.indexOf(d)+1;i<x.length;i++){const u=o.find(r,{property:n.property,mq:x[i]});if(u&&u.cls!==n.cls)break;o.find(r,{cls:n.cls,mq:x[i]})&&l.push(`${x[i]}:${n.cls}`)}}return o.filter(o.map(r,n=>l.includes(n.fullCls)?null:n.fullCls),n=>n!==null).join(" ")},q=({activeToken:s})=>{const{t:r}=j.useTranslation(),l=s!=null&&s.value?k(s.value):"",n=s&&s.name&&s.value;return e.jsx(t.ScrollArea,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-4",children:e.jsxs("div",{className:"space-y-2 rounded-lg border bg-card p-4",children:[n&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.name}),s.id&&e.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground",children:s.id})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[10px] font-medium text-muted-foreground",children:r("Preview:")}),e.jsx(T,{content:r("Sample text with token styles applied"),classes:l,style:{minHeight:80},title:r("Token Preview")})]})]})})})},A=({open:s,onOpenChange:r})=>{const{t:l}=j.useTranslation(),[n,d]=c.useState(null),[i,u]=c.useState(!1),[p,h]=c.useState(!1),a=c.useCallback(f=>{if(!f&&i){h(!0);return}r(f)},[i,r]),m=c.useCallback(()=>{h(!1),u(!1),r(!1)},[r]);return e.jsxs(e.Fragment,{children:[e.jsx(t.Dialog,{open:s,onOpenChange:a,children:e.jsxs(t.DialogContent,{className:"flex h-[540px] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(t.DialogHeader,{className:"border-b border-border px-6 py-4",children:e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(y.TokensIcon,{className:"h-5 w-5 text-primary"}),l("Design Token Management")]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex w-1/2 flex-col border-r border-border p-4",children:e.jsx(F.default,{onActiveTokenChange:d,onDirtyStateChange:u})}),e.jsxs("div",{className:"flex w-1/2 flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold",children:l("Live Preview")})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{activeToken:n})})]})]})]})}),e.jsx(t.AlertDialog,{open:p,onOpenChange:h,children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:l("Unsaved Changes")}),e.jsx(t.AlertDialogDescription,{children:l("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{children:l("Continue Editing")}),e.jsx(t.AlertDialogAction,{onClick:m,children:l("Discard Changes")})]})]})})]})};exports.default=A;
|
package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-xKxC72Bc.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e, Fragment as y } from "react/jsx-runtime";
|
|
2
|
-
import { al as k, am as A,
|
|
2
|
+
import { al as k, am as A, an as T, ao as M, ap as H, aq as _, ar as j, as as I, a6 as P, D as S, e as L, f as E, g as O, a0 as U, a1 as q, at as R, a2 as $, a3 as V, au as Y, a4 as z, a5 as B } from "./index-C7bidKtE.js";
|
|
3
3
|
import { TokensIcon as Q } from "@radix-ui/react-icons";
|
|
4
|
-
import { useMemo as u, useEffect as b, useState as g, useCallback as
|
|
4
|
+
import { useMemo as u, useEffect as b, useState as g, useCallback as w } from "react";
|
|
5
5
|
import { useTranslation as F } from "react-i18next";
|
|
6
|
-
import { p as W, g as G, a as J, b as K } from "./
|
|
7
|
-
import { get as
|
|
6
|
+
import { p as W, g as G, a as J, b as K } from "./default-theme-options-saBIkWGT.js";
|
|
7
|
+
import { get as v, filter as x, has as C, isEmpty as X, map as D, find as N } from "lodash-es";
|
|
8
8
|
import Z from "@tailwindcss/aspect-ratio";
|
|
9
9
|
import ee from "@tailwindcss/container-queries";
|
|
10
10
|
import se from "@tailwindcss/forms";
|
|
11
11
|
import ne from "@tailwindcss/typography";
|
|
12
12
|
import { u as ae } from "./fonts-B3UYxuJI.js";
|
|
13
|
-
import re from "./manage-design-tokens-
|
|
13
|
+
import re from "./manage-design-tokens-JdVKj09s.js";
|
|
14
14
|
const te = () => {
|
|
15
15
|
const [s] = T(), a = M(), [r] = H(), { document: n, window: i } = _(), t = ae();
|
|
16
16
|
b(() => {
|
|
@@ -51,7 +51,7 @@ const te = () => {
|
|
|
51
51
|
});
|
|
52
52
|
}, [s, a, i]);
|
|
53
53
|
const c = u(() => {
|
|
54
|
-
const o =
|
|
54
|
+
const o = v(s, "fontFamily.heading"), d = v(s, "fontFamily.body");
|
|
55
55
|
return t.filter((h) => h.family === o || h.family === d);
|
|
56
56
|
}, [s, t]), p = u(
|
|
57
57
|
() => J(x(c, (o) => C(o, "url"))),
|
|
@@ -118,7 +118,7 @@ const te = () => {
|
|
|
118
118
|
] })
|
|
119
119
|
] }) }) });
|
|
120
120
|
}, Ce = ({ open: s, onOpenChange: a }) => {
|
|
121
|
-
const { t: r } = F(), [n, i] = g(null), [t, c] = g(!1), [p, m] = g(!1), o =
|
|
121
|
+
const { t: r } = F(), [n, i] = g(null), [t, c] = g(!1), [p, m] = g(!1), o = w(
|
|
122
122
|
(h) => {
|
|
123
123
|
if (!h && t) {
|
|
124
124
|
m(!0);
|
|
@@ -127,11 +127,11 @@ const te = () => {
|
|
|
127
127
|
a(h);
|
|
128
128
|
},
|
|
129
129
|
[t, a]
|
|
130
|
-
), d =
|
|
130
|
+
), d = w(() => {
|
|
131
131
|
m(!1), c(!1), a(!1);
|
|
132
132
|
}, [a]);
|
|
133
133
|
return /* @__PURE__ */ l(y, { children: [
|
|
134
|
-
/* @__PURE__ */ e(S, { open: s, onOpenChange: o, children: /* @__PURE__ */ l(L, { className: "flex h-[
|
|
134
|
+
/* @__PURE__ */ e(S, { open: s, onOpenChange: o, children: /* @__PURE__ */ l(L, { className: "flex h-[540px] max-w-6xl flex-col gap-0 p-0", children: [
|
|
135
135
|
/* @__PURE__ */ e(E, { className: "border-b border-border px-6 py-4", children: /* @__PURE__ */ l(O, { className: "flex items-center gap-2", children: [
|
|
136
136
|
/* @__PURE__ */ e(Q, { className: "h-5 w-5 text-primary" }),
|
|
137
137
|
r("Design Token Management")
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { z, B as c } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as P, e as B, f as E, g as L,
|
|
4
|
-
import {
|
|
3
|
+
import { D as P, e as B, f as E, g as L, o as S, p as w, T as U, q as R } from "./index-C7bidKtE.js";
|
|
4
|
+
import { n as j, k as O } from "./index-BDrc0HJQ.js";
|
|
5
5
|
import { startCase as y } from "lodash-es";
|
|
6
|
-
import { Tag as
|
|
6
|
+
import { Tag as X, File as _, ImageIcon as $, X as q } from "lucide-react";
|
|
7
7
|
import { useState as m, useRef as H, useCallback as K } from "react";
|
|
8
8
|
import { useTranslation as Z } from "react-i18next";
|
|
9
9
|
import { toast as k } from "sonner";
|
|
@@ -69,7 +69,7 @@ const G = 1 * 1024 * 1024, re = ({ page: n, onClose: d }) => {
|
|
|
69
69
|
/* @__PURE__ */ t("div", { className: "mb-4 space-y-4 text-xs", children: [
|
|
70
70
|
/* @__PURE__ */ t("div", { className: "space-y-3 rounded border bg-slate-50 p-4", children: [
|
|
71
71
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
72
|
-
/* @__PURE__ */ e(
|
|
72
|
+
/* @__PURE__ */ e(X, { className: "h-4 w-4 text-slate-500" }),
|
|
73
73
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
74
74
|
a("Page Name"),
|
|
75
75
|
":"
|
|
@@ -77,7 +77,7 @@ const G = 1 * 1024 * 1024, re = ({ page: n, onClose: d }) => {
|
|
|
77
77
|
/* @__PURE__ */ e("span", { className: "font-semibold", children: y(n.name) })
|
|
78
78
|
] }),
|
|
79
79
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
80
|
-
/* @__PURE__ */ e(
|
|
80
|
+
/* @__PURE__ */ e(_, { className: "h-4 w-4 text-slate-500" }),
|
|
81
81
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
82
82
|
a("Type"),
|
|
83
83
|
":"
|
|
@@ -125,12 +125,12 @@ const G = 1 * 1024 * 1024, re = ({ page: n, onClose: d }) => {
|
|
|
125
125
|
/* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
126
126
|
a("Uploading...")
|
|
127
127
|
] }) : /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
128
|
-
/* @__PURE__ */ e(
|
|
128
|
+
/* @__PURE__ */ e($, { className: "h-4 w-4" }),
|
|
129
129
|
a("Select image")
|
|
130
130
|
] })
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
|
-
l && /* @__PURE__ */ e(c, { type: "button", variant: "outline", size: "icon", onClick: F, children: /* @__PURE__ */ e(
|
|
133
|
+
l && /* @__PURE__ */ e(c, { type: "button", variant: "outline", size: "icon", onClick: F, children: /* @__PURE__ */ e(q, { className: "h-4 w-4" }) })
|
|
134
134
|
] }),
|
|
135
135
|
l && /* @__PURE__ */ e("div", { className: "aspect-video overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: l, alt: a("Preview"), className: "h-full max-h-[200px] w-full object-contain" }) }),
|
|
136
136
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("max 1mb") })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-DKjYF53r.cjs"),y=require("./index-BuXfCtgR.cjs"),w=require("lodash-es"),m=require("lucide-react"),l=require("react"),M=require("react-i18next"),k=require("sonner"),B=1*1024*1024,A=({page:r,onClose:u})=>{const{t:s}=M.useTranslation(),[f,p]=l.useState(!1),[j,T]=l.useState(""),[c,N]=l.useState(""),[v,x]=l.useState(!1),i=l.useRef(null),C=y.useMarkAsTemplate(),{data:h}=y.usePageTypes(),g=h==null?void 0:h.find(a=>a.key===r.pageType),I=(g==null?void 0:g.name)||w.startCase(r.pageType),D=l.useCallback(a=>{var b;const d=(b=a.target.files)==null?void 0:b[0];if(d){if(d.size>B){k.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(d.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{x(!0);const n=new FileReader;n.onloadend=()=>{N(n.result),x(!1)},n.readAsDataURL(d)}catch(n){console.error("Error reading file:",n),x(!1),k.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),F=()=>{N(""),i.current&&(i.current.value="")},S=()=>{var a;(a=i.current)==null||a.click()},q=()=>{p(!0),C.mutate({page:r,name:r.name,description:j.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{p(!1),u()},onError:()=>{p(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:u,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:s("Mark as template")}),e.jsxs(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:w.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:I})]})]}),e.jsxs("div",{children:[e.jsx(t.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(t.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:j,onChange:a=>T(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o.Input,{type:"file",id:"previewImage",ref:i,onChange:D,accept:"image/*",className:"hidden"}),e.jsx(o.Button,{type:"button",variant:"outline",onClick:S,disabled:v,className:"w-full",children:v?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(m.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(o.Button,{type:"button",variant:"outline",size:"icon",onClick:F,children:e.jsx(m.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(t.DialogFooter,{className:f?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:a=>{a.stopPropagation(),u()},children:s("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:f,onClick:q,children:s("Mark as template")})]})]})})};exports.default=A;
|
package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-B04k-PPB.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as n } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronLeft as v, ChevronRight as g } from "lucide-react";
|
|
3
3
|
import * as l from "react";
|
|
4
4
|
import { B as k } from "./register-chai-top-bar-D6GjnauV.js";
|
|
5
|
-
import { P as N, C as x,
|
|
5
|
+
import { P as N, C as x, i as P, j as S, k as w, l as B, m as d } from "./index-C7bidKtE.js";
|
|
6
6
|
function I({
|
|
7
7
|
data: o,
|
|
8
8
|
onSelect: m,
|
package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-dFwZaM1r.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),p=require("react"),v=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),p=require("react"),v=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DKjYF53r.cjs");function C(c){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(l,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return l.default=c,Object.freeze(l)}const o=C(p);function N({data:c,onSelect:l,dataType:r="value",open:i,setOpen:m}){const[u,f]=o.useState([]),[h,j]=o.useState(c);o.useEffect(()=>{i||f([]),j(c)},[c,i]);const b=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",y=o.useCallback(e=>{const n=s=>r==="value"?s==="value"||s==="object":r==="array"?s==="array":s===r;e.type==="object"?(f(s=>[...s,e.key]),j(e.value)):n(e.type)&&(l([...u,e.key].join(".")),m(!1))},[r,l,u,m]),x=o.useCallback(()=>{if(u.length>0){const e=u.slice(0,-1);f(e),j(e.reduce((n,s)=>n[s],c))}},[u,c]),g=o.useMemo(()=>Object.entries(h).map(([e,n])=>({key:e,value:n,type:b(n)})).filter(e=>r==="value"?e.type==="value"||e.type==="object":r==="array"?e.type==="array"||e.type==="object":r==="object"?e.type==="object":!0),[h,r]);return t.jsx(a.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(a.Command,{children:[t.jsx(a.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(a.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(a.CommandEmpty,{children:"No option found."}),t.jsxs(a.CommandGroup,{children:[u.length>0&&t.jsxs(a.CommandItem,{onSelect:x,className:"flex items-center text-sm",children:[t.jsx(d.ChevronLeft,{className:"mr-2 h-4 w-4"}),"Back"]}),g.map(e=>t.jsxs(a.CommandItem,{onSelect:()=>y(e),className:"flex items-center justify-between",children:[t.jsx("span",{children:e.key}),t.jsxs("div",{className:"flex items-center gap-2",children:[r==="object"&&e.type==="object"&&t.jsx(v.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:n=>{n.stopPropagation(),l([...u,e.key].join(".")),m(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&t.jsx("div",{className:"cursor-pointer rounded p-1 hover:bg-muted",children:t.jsx(d.ChevronRight,{className:"h-4 w-4 opacity-50"})})]})]},e.key))]})]})]})})}exports.default=N;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { B as h } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as u,
|
|
4
|
-
import { c as S, d as L, L as x, B as N } from "./index-
|
|
3
|
+
import { d as u, F as w, G as p, H as f, I as P, J as C } from "./index-C7bidKtE.js";
|
|
4
|
+
import { c as S, d as L, L as x, B as N } from "./index-BDrc0HJQ.js";
|
|
5
5
|
import { get as v } from "lodash-es";
|
|
6
6
|
import { LockIcon as B } from "lucide-react";
|
|
7
7
|
import { useTranslation as E } from "react-i18next";
|
package/dist/{no-language-page-content-DWtEo657.cjs → no-language-page-content-pzkWJAg6.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-DKjYF53r.cjs"),n=require("./index-BuXfCtgR.cjs"),w=require("lodash-es"),x=require("lucide-react"),p=require("react-i18next"),P=()=>{const{t:a}=p.useTranslation(),[i,l]=n.useSearchParams(),c=i.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=t.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),l(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(m.Button,{onClick:d,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { c as g, d as n } from "./index-
|
|
2
|
+
import { c as g, d as n } from "./index-BDrc0HJQ.js";
|
|
3
3
|
import { Suspense as s, lazy as t } from "react";
|
|
4
|
-
const o = t(() => import("./no-language-page-content-
|
|
4
|
+
const o = t(() => import("./no-language-page-content-CbUqxuC4.js")), l = () => {
|
|
5
5
|
const [e] = g(), r = e.get("lang");
|
|
6
6
|
return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
|
|
7
7
|
};
|