@chaibuilder/sdk 3.2.8 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -20
- package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
- package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
- package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
- package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
- package/dist/IconPicker-C9-ieDWm.cjs +1 -0
- package/dist/IconPicker-RqVvq6G2.js +59 -0
- package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
- package/dist/WDYDFRGG-b3T2SQbz.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-Clng6zpY.cjs +1 -0
- package/dist/active-in-another-tab-wb8qolB8.js +34 -0
- package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
- package/dist/add-new-language-page-D7NDABl1.js +401 -0
- package/dist/add-new-page-B4hc0B-g.js +31 -0
- package/dist/add-new-page-BNfwKjRd.cjs +1 -0
- package/dist/ai-panel-content-BnbURb7j.js +61 -0
- package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
- package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
- package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
- package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
- package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
- package/dist/ai-prompt-input-DaTyfib-.js +655 -0
- package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
- package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
- package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
- package/dist/{apply-binding-DLaiD20q.js → apply-binding-6iwlED02.js} +156 -166
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/{code-display-DuH-UOhl.js → code-display-BzBq5xSn.js} +1 -1
- package/dist/code-display-Q3_sK_Ta.cjs +1 -0
- package/dist/code-editor-BQZi6-FB.cjs +1 -0
- package/dist/code-editor-DWWnphW9.js +50 -0
- package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
- package/dist/continue-editing-in-this-client-D9HyD4GP.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 +2 -393
- package/dist/core.js +37 -105
- package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
- package/dist/{css-import-modal-CFB2YjDT.js → css-import-modal-D72a-16X.js} +39 -38
- package/dist/{delete-design-token-BjMakV-b.js → delete-design-token-Cd1ZDtqT.js} +3 -3
- package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
- package/dist/delete-page-ByQwBupJ.cjs +1 -0
- package/dist/delete-page-DC8pzvWW.js +70 -0
- package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
- package/dist/design-token-usage-DE4XCDdn.js +113 -0
- package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
- package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
- package/dist/duplicate-page-BoVhko2q.js +133 -0
- package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
- package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
- package/dist/dynamic-page-selector-DdnbCuQZ.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-BYtp20KD.js +24 -0
- 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-DTspjj_c.cjs +1 -0
- package/dist/image-editor-oypq8asR.js +108 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-BDnwJqMw.js +4732 -0
- package/dist/index-CbwxUFy_.cjs +5 -0
- package/dist/index-CnSjWE1P.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-S8ibZk9Q.js +19069 -0
- package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
- package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
- package/dist/lang-panel-BPxex-M2.cjs +1 -0
- package/dist/lang-panel-Cn83SRzd.js +215 -0
- package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
- package/dist/{manage-design-tokens-DUoMdCBl.js → manage-design-tokens-lP4HLS0P.js} +31 -32
- package/dist/mark-as-template-DYRxre1f.cjs +1 -0
- package/dist/mark-as-template-jncsjfHm.js +156 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
- package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
- package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
- package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
- package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
- package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
- package/dist/page-creator-VWIB2VAs.cjs +1 -0
- package/dist/page-creator-wCMtlE6Z.js +795 -0
- package/dist/page-lock-BPCxfv9J.js +30 -0
- package/dist/page-lock-DweiYy1w.cjs +1 -0
- package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
- package/dist/page-locked-dialog-ByGl18_m.js +133 -0
- package/dist/page-manager-new-BWFE-S-O.js +394 -0
- package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
- package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
- package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
- package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
- package/dist/page-revisions-content-Ulr8slUN.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +492 -0
- package/dist/pages.js +27 -0
- package/dist/{plugin-BOcGV_IY.js → plugin-3ZKK6RXm.js} +30 -44
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-BTPzt_m4.js +178 -0
- package/dist/publish-pages-content-D6g8GAsd.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 +12 -9
- package/dist/render.js +97 -99
- package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
- package/dist/rte-widget-modal-Rk_NW3KU.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-BK3uTFss.js +422 -0
- package/dist/save-to-lib-DHHUO12i.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-CU3TwIMA.js +319 -0
- package/dist/selected-block-display-DSFhddPj.cjs +16 -0
- package/dist/seo-panel-Dl0IDV09.cjs +2 -0
- package/dist/seo-panel-jbzxFioc.js +798 -0
- package/dist/shared-json-ld-BL_dv3_q.js +565 -0
- package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
- package/dist/slug-input-1qwKkXhA.js +86 -0
- package/dist/slug-input-YVLjtTI3.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-DKvKi3mM.js +63 -0
- package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
- package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
- package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
- package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
- package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
- package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
- package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
- package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
- package/dist/unpublish-page-Degu5Cy9.js +27 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/utils.cjs +1 -0
- package/dist/{tailwind.d.ts → utils.d.ts} +4 -7
- 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 +48 -47
- package/dist/web-preview-DXE4Jnf5.js +73 -0
- package/dist/web-preview-YzKxyXft.cjs +1 -0
- package/package.json +159 -89
- package/dist/IconPicker-6JSublJp.js +0 -64
- package/dist/IconPicker-DpQQDK_Q.cjs +0 -1
- package/dist/apply-binding-Bn1KC8uC.cjs +0 -1
- package/dist/code-display-Dw1tAwiJ.cjs +0 -1
- package/dist/code-editor-cnBzYLxk.cjs +0 -1
- package/dist/code-editor-vpbOSO05.js +0 -59
- package/dist/css-import-modal-bGWZSlqv.cjs +0 -13
- package/dist/delete-design-token-Bzxspf8D.cjs +0 -1
- package/dist/design-token-usage-BDArZ38H.js +0 -120
- package/dist/design-token-usage-CCv4XltM.cjs +0 -1
- package/dist/get-chai-builder-theme-B1tr_NJB.cjs +0 -1
- package/dist/get-chai-builder-theme-BarMkcGH.js +0 -12
- package/dist/index-CuANr9iH.cjs +0 -160
- package/dist/index-DvdOXKUE.js +0 -18338
- package/dist/manage-design-tokens-DpC46NAy.cjs +0 -1
- package/dist/mockServiceWorker.js +0 -349
- package/dist/plugin-CSgw-f78.cjs +0 -22
- package/dist/rte-widget-modal-CXbmmhcb.js +0 -41
- package/dist/rte-widget-modal-DDjf0xui.cjs +0 -1
- package/dist/tailwind.cjs +0 -1
- package/dist/tailwind.js +0 -8
- package/dist/tooltip-Ba1-8jmj.cjs +0 -1
- package/dist/tooltip-DUosa-uC.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
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { D as
|
|
4
|
-
import {
|
|
5
|
-
import { ArrowLeftIcon as te, MagnifyingGlassIcon as L, PlusIcon as M, TokensIcon as ne, EyeOpenIcon as se, Pencil1Icon as re, TrashIcon as ae } from "@radix-ui/react-icons";
|
|
2
|
+
import { a3 as _, a4 as H, I as z, B as u, a5 as K, L as X, a6 as q, a7 as J, a8 as Y } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { D as ee } from "./apply-binding-6iwlED02.js";
|
|
4
|
+
import { MagnifyingGlassIcon as L, PlusIcon as O, TokensIcon as te, ArrowLeftIcon as ne, EyeOpenIcon as se, Pencil1Icon as re, TrashIcon as ae } from "@radix-ui/react-icons";
|
|
6
5
|
import { useAtom as oe } from "jotai";
|
|
7
6
|
import { nanoid as ie } from "nanoid";
|
|
8
|
-
import {
|
|
7
|
+
import { useState as g, useRef as le, useMemo as ce, useEffect as de, useCallback as me, Suspense as R, lazy as M } from "react";
|
|
9
8
|
import { useTranslation as ue } from "react-i18next";
|
|
10
9
|
import { toast as N } from "sonner";
|
|
11
10
|
import { twMerge as he } from "tailwind-merge";
|
|
12
|
-
const
|
|
11
|
+
const S = (n) => {
|
|
13
12
|
const s = n.trim();
|
|
14
13
|
return s.length === 0 || s.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(s);
|
|
15
14
|
}, fe = (n, s, o, d = !1, i) => {
|
|
@@ -17,13 +16,13 @@ const R = (n) => {
|
|
|
17
16
|
return m.length === 0 ? "" : m.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m) ? Object.entries(s).find(
|
|
18
17
|
([l, v]) => v.name === m && (!d || l !== i)
|
|
19
18
|
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
20
|
-
}, xe = (n) => n.replace(/\s+/g, "-"), ge =
|
|
19
|
+
}, xe = (n) => n.replace(/\s+/g, "-"), ge = M(() => import("./delete-design-token-Cd1ZDtqT.js")), pe = M(() => import("./design-token-usage-DE4XCDdn.js")), ve = ({ tokenId: n, token: s, isDisabled: o, onEdit: d, onDelete: i }) => /* @__PURE__ */ a("div", { className: "group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 hover:bg-muted/90", children: [
|
|
21
20
|
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
22
21
|
/* @__PURE__ */ e("div", { className: "text-xs font-semibold", children: s.name }),
|
|
23
22
|
/* @__PURE__ */ e("div", { className: "w-full max-w-52 truncate text-[10px] font-light", children: s.value })
|
|
24
23
|
] }),
|
|
25
24
|
/* @__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: [
|
|
26
|
-
/* @__PURE__ */ e(
|
|
25
|
+
/* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(pe, { tokenId: n, tokenName: s.name, children: /* @__PURE__ */ e(
|
|
27
26
|
u,
|
|
28
27
|
{
|
|
29
28
|
variant: "ghost",
|
|
@@ -43,7 +42,7 @@ const R = (n) => {
|
|
|
43
42
|
children: /* @__PURE__ */ e(re, { className: "h-3 w-3" })
|
|
44
43
|
}
|
|
45
44
|
),
|
|
46
|
-
/* @__PURE__ */ e(
|
|
45
|
+
/* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(ge, { tokenName: s.name, tokenValue: s.value, onDelete: () => i(n), children: /* @__PURE__ */ e(
|
|
47
46
|
u,
|
|
48
47
|
{
|
|
49
48
|
variant: "ghost",
|
|
@@ -54,8 +53,8 @@ const R = (n) => {
|
|
|
54
53
|
}
|
|
55
54
|
) }) })
|
|
56
55
|
] })
|
|
57
|
-
] }),
|
|
58
|
-
const { t: n } = ue(), [s, o] = oe(_), d = H(), [i, m] = g("view"), [p, k] = g(null), [l, v] = g(""), [h, b] = g(""), [T, y] = g(""), [w, P] = g(""), [
|
|
56
|
+
] }), ze = ({}) => {
|
|
57
|
+
const { t: n } = ue(), [s, o] = oe(_), d = H(), [i, m] = g("view"), [p, k] = g(null), [l, v] = g(""), [h, b] = g(""), [T, y] = g(""), [w, P] = g(""), [B, C] = g(!1), f = le(null), D = ce(() => Object.entries(s).filter(
|
|
59
58
|
([, t]) => t.name.toLowerCase().includes(w.toLowerCase()) || t.value.toLowerCase().includes(w.toLowerCase())
|
|
60
59
|
), [s, w]);
|
|
61
60
|
de(() => () => {
|
|
@@ -63,7 +62,7 @@ const R = (n) => {
|
|
|
63
62
|
}, []);
|
|
64
63
|
const j = me(
|
|
65
64
|
(t, r) => {
|
|
66
|
-
!p || i !== "edit" || !t.trim() || !r.trim() || !
|
|
65
|
+
!p || i !== "edit" || !t.trim() || !r.trim() || !S(t) || Object.entries(s).find(
|
|
67
66
|
([x, U]) => U.name === t.trim() && x !== p
|
|
68
67
|
) || (C(!0), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
69
68
|
const x = {
|
|
@@ -77,12 +76,12 @@ const R = (n) => {
|
|
|
77
76
|
}, 250));
|
|
78
77
|
},
|
|
79
78
|
[p, i, s, o, d]
|
|
80
|
-
),
|
|
79
|
+
), F = () => {
|
|
81
80
|
if (!l.trim() || !h.trim()) {
|
|
82
81
|
N.error(n("Please fill in both token name and classes"));
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
|
-
if (!
|
|
84
|
+
if (!S(l)) {
|
|
86
85
|
N.error(n("Invalid design token name format"));
|
|
87
86
|
return;
|
|
88
87
|
}
|
|
@@ -90,7 +89,7 @@ const R = (n) => {
|
|
|
90
89
|
N.error(n("Token already exists"));
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
|
-
const r = `${
|
|
92
|
+
const r = `${ee}${ie(12)}`, c = {
|
|
94
93
|
...s,
|
|
95
94
|
[r]: {
|
|
96
95
|
name: l.trim(),
|
|
@@ -104,7 +103,7 @@ const R = (n) => {
|
|
|
104
103
|
}, W = (t) => {
|
|
105
104
|
const r = s[t];
|
|
106
105
|
r && (k(t), v(r.name), b(r.value), y(""), m("edit"));
|
|
107
|
-
},
|
|
106
|
+
}, I = () => {
|
|
108
107
|
k(null), v(""), b(""), y(""), m("add");
|
|
109
108
|
}, A = () => {
|
|
110
109
|
f.current && clearTimeout(f.current), k(null), v(""), b(""), y(""), C(!1), m("view");
|
|
@@ -113,14 +112,14 @@ const R = (n) => {
|
|
|
113
112
|
v(r);
|
|
114
113
|
const c = fe(r, s, n, i === "edit", p || void 0);
|
|
115
114
|
y(c), i === "edit" && !c && j(r, h);
|
|
116
|
-
},
|
|
115
|
+
}, E = (t) => {
|
|
117
116
|
b(t), i === "edit" && !T && l.trim() && j(l, t);
|
|
118
117
|
}, $ = (t) => {
|
|
119
|
-
const r =
|
|
120
|
-
|
|
118
|
+
const r = J(Y(he(h, t)));
|
|
119
|
+
E(r);
|
|
121
120
|
}, G = (t) => {
|
|
122
121
|
const r = h.split(" ").filter((c) => c !== t).join(" ");
|
|
123
|
-
|
|
122
|
+
E(r);
|
|
124
123
|
};
|
|
125
124
|
return /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i === "view" ? /* @__PURE__ */ a(Q, { children: [
|
|
126
125
|
Object.entries(s).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
@@ -140,23 +139,23 @@ const R = (n) => {
|
|
|
140
139
|
u,
|
|
141
140
|
{
|
|
142
141
|
variant: "outline",
|
|
143
|
-
onClick:
|
|
142
|
+
onClick: I,
|
|
144
143
|
size: "sm",
|
|
145
144
|
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
146
145
|
children: [
|
|
147
|
-
/* @__PURE__ */ e(
|
|
146
|
+
/* @__PURE__ */ e(O, { className: "h-3 w-3" }),
|
|
148
147
|
n("Add")
|
|
149
148
|
]
|
|
150
149
|
}
|
|
151
150
|
)
|
|
152
151
|
] }),
|
|
153
|
-
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(
|
|
152
|
+
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(K, { className: "h-full flex-1", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
154
153
|
Object.entries(s).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: [
|
|
155
|
-
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(
|
|
154
|
+
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(te, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
156
155
|
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
|
|
157
156
|
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
|
|
158
|
-
/* @__PURE__ */ a(u, { variant: "default", onClick:
|
|
159
|
-
/* @__PURE__ */ e(
|
|
157
|
+
/* @__PURE__ */ a(u, { variant: "default", onClick: I, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
158
|
+
/* @__PURE__ */ e(O, { className: "mr-1 h-3 w-3" }),
|
|
160
159
|
n("Add first design token")
|
|
161
160
|
] })
|
|
162
161
|
] }) : D.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: [
|
|
@@ -187,18 +186,18 @@ const R = (n) => {
|
|
|
187
186
|
size: "sm",
|
|
188
187
|
onClick: A,
|
|
189
188
|
className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
|
|
190
|
-
children: /* @__PURE__ */ e(
|
|
189
|
+
children: /* @__PURE__ */ e(ne, { className: "h-3 w-3" })
|
|
191
190
|
}
|
|
192
191
|
),
|
|
193
192
|
/* @__PURE__ */ a("div", { className: "flex-1", children: [
|
|
194
193
|
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: r }),
|
|
195
194
|
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: c })
|
|
196
195
|
] }),
|
|
197
|
-
t &&
|
|
196
|
+
t && B && /* @__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" }) })
|
|
198
197
|
] }),
|
|
199
198
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
|
|
200
199
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
201
|
-
/* @__PURE__ */ e(
|
|
200
|
+
/* @__PURE__ */ e(X, { htmlFor: "token-name", className: "text-xs font-medium", children: n("Token Name") }),
|
|
202
201
|
/* @__PURE__ */ e(
|
|
203
202
|
z,
|
|
204
203
|
{
|
|
@@ -212,7 +211,7 @@ const R = (n) => {
|
|
|
212
211
|
T ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: T }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: n("Button-Primary, Card-Header, Text-Large etc.") })
|
|
213
212
|
] }),
|
|
214
213
|
/* @__PURE__ */ e(
|
|
215
|
-
|
|
214
|
+
q,
|
|
216
215
|
{
|
|
217
216
|
from: "designToken",
|
|
218
217
|
classFromProps: h,
|
|
@@ -225,7 +224,7 @@ const R = (n) => {
|
|
|
225
224
|
/* @__PURE__ */ e(
|
|
226
225
|
u,
|
|
227
226
|
{
|
|
228
|
-
onClick:
|
|
227
|
+
onClick: F,
|
|
229
228
|
disabled: !l.trim() || !h.trim() || !!T,
|
|
230
229
|
className: "h-7 text-xs",
|
|
231
230
|
children: n("Add Token")
|
|
@@ -237,5 +236,5 @@ const R = (n) => {
|
|
|
237
236
|
})() });
|
|
238
237
|
};
|
|
239
238
|
export {
|
|
240
|
-
|
|
239
|
+
ze as default
|
|
241
240
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CnSjWE1P.cjs"),b=require("./index-CbwxUFy_.cjs"),y=require("lodash-es"),d=require("lucide-react"),l=require("react"),M=require("react-i18next"),w=require("sonner"),q=1*1024*1024,A=({page:r,onClose:m})=>{const{t:s}=M.useTranslation(),[g,u]=l.useState(!1),[f,k]=l.useState(""),[c,j]=l.useState(""),[N,p]=l.useState(!1),i=l.useRef(null),I=b.useMarkAsTemplate(),{data:x}=b.usePageTypes(),h=x==null?void 0:x.find(t=>t.key===r.pageType),T=(h==null?void 0:h.name)||y.startCase(r.pageType),C=l.useCallback(t=>{var v;const o=(v=t.target.files)==null?void 0:v[0];if(o){if(o.size>q){w.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(o.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{p(!0);const n=new FileReader;n.onloadend=()=>{j(n.result),p(!1)},n.readAsDataURL(o)}catch(n){console.error("Error reading file:",n),p(!1),w.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),D=()=>{j(""),i.current&&(i.current.value="")},F=()=>{var t;(t=i.current)==null||t.click()},S=()=>{u(!0),I.mutate({page:r,name:r.name,description:f.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{u(!1),m()},onError:()=>{u(!1)}})};return e.jsx(a.Dialog,{open:!0,onOpenChange:m,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:s("Mark as template")}),e.jsxs(a.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(d.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:y.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.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:T})]})]}),e.jsxs("div",{children:[e.jsx(a.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(a.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:f,onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.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(a.Input,{type:"file",id:"previewImage",ref:i,onChange:C,accept:"image/*",className:"hidden"}),e.jsx(a.Button,{type:"button",variant:"outline",onClick:F,disabled:N,className:"w-full",children:N?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(d.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(a.Button,{type:"button",variant:"outline",size:"icon",onClick:D,children:e.jsx(d.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(a.DialogFooter,{className:g?"pointer-events-none opacity-75":"",children:[e.jsx(a.Button,{variant:"outline",onClick:t=>{t.stopPropagation(),m()},children:s("Cancel")}),e.jsx(a.Button,{variant:"default",disabled:g,onClick:S,children:s("Mark as template")})]})]})})};exports.default=A;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { D as L, d as P, e as z, f as B, p as E, L as w, T as S, I as U, B as c, q as R } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { q as j, m as O } from "./index-BDnwJqMw.js";
|
|
4
|
+
import { startCase as y } from "lodash-es";
|
|
5
|
+
import { Tag as q, File as X, ImageIcon as _, X as $ } from "lucide-react";
|
|
6
|
+
import { useState as d, useRef as H, useCallback as K } from "react";
|
|
7
|
+
import { useTranslation as Z } from "react-i18next";
|
|
8
|
+
import { toast as k } from "sonner";
|
|
9
|
+
const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
10
|
+
const { t: a } = Z(), [g, p] = d(!1), [x, I] = d(""), [l, N] = d(""), [v, u] = d(!1), i = H(null), T = j(), { data: h } = O(), f = h == null ? void 0 : h.find((s) => s.key === n.pageType), C = (f == null ? void 0 : f.name) || y(n.pageType), D = K(
|
|
11
|
+
(s) => {
|
|
12
|
+
var b;
|
|
13
|
+
const o = (b = s.target.files) == null ? void 0 : b[0];
|
|
14
|
+
if (o) {
|
|
15
|
+
if (o.size > G) {
|
|
16
|
+
k.error(a("File too large"), {
|
|
17
|
+
description: `${a("Maximum file size is 1MB. Selected file is")} ${(o.size / 1024).toFixed(2)}KB.`
|
|
18
|
+
}), i.current && (i.current.value = "");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
u(!0);
|
|
23
|
+
const r = new FileReader();
|
|
24
|
+
r.onloadend = () => {
|
|
25
|
+
N(r.result), u(!1);
|
|
26
|
+
}, r.readAsDataURL(o);
|
|
27
|
+
} catch (r) {
|
|
28
|
+
console.error("Error reading file:", r), u(!1), k.error(a("Failed to process image"), {
|
|
29
|
+
description: r instanceof Error ? r.message : a("Unknown error")
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[a]
|
|
35
|
+
), F = () => {
|
|
36
|
+
N(""), i.current && (i.current.value = "");
|
|
37
|
+
}, M = () => {
|
|
38
|
+
var s;
|
|
39
|
+
(s = i.current) == null || s.click();
|
|
40
|
+
}, A = () => {
|
|
41
|
+
p(!0), T.mutate(
|
|
42
|
+
{
|
|
43
|
+
page: n,
|
|
44
|
+
name: n.name,
|
|
45
|
+
description: x.trim() || void 0,
|
|
46
|
+
pageType: n.pageType,
|
|
47
|
+
...l ? { previewImage: l } : {}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
onSuccess: () => {
|
|
51
|
+
p(!1), m();
|
|
52
|
+
},
|
|
53
|
+
onError: () => {
|
|
54
|
+
p(!1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ e(L, { open: !0, onOpenChange: m, children: /* @__PURE__ */ t(P, { children: [
|
|
60
|
+
/* @__PURE__ */ t(z, { children: [
|
|
61
|
+
/* @__PURE__ */ e(B, { children: a("Mark as template") }),
|
|
62
|
+
/* @__PURE__ */ t(E, { className: "space-y-1 py-4 text-xs text-slate-500", children: [
|
|
63
|
+
a("Are you sure you want to mark this page as a template?"),
|
|
64
|
+
/* @__PURE__ */ e("br", {}),
|
|
65
|
+
a("Templates can be used to create new pages with the same content.")
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ t("div", { className: "mb-4 space-y-4 text-xs", children: [
|
|
69
|
+
/* @__PURE__ */ t("div", { className: "space-y-3 rounded border bg-slate-50 p-4", children: [
|
|
70
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
71
|
+
/* @__PURE__ */ e(q, { className: "h-4 w-4 text-slate-500" }),
|
|
72
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
73
|
+
a("Page Name"),
|
|
74
|
+
":"
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: y(n.name) })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
79
|
+
/* @__PURE__ */ e(X, { className: "h-4 w-4 text-slate-500" }),
|
|
80
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-500", children: [
|
|
81
|
+
a("Type"),
|
|
82
|
+
":"
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: C })
|
|
85
|
+
] })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t("div", { children: [
|
|
88
|
+
/* @__PURE__ */ e(w, { htmlFor: "description", className: "text-xs font-medium", children: a("Description (Optional)") }),
|
|
89
|
+
/* @__PURE__ */ e(
|
|
90
|
+
S,
|
|
91
|
+
{
|
|
92
|
+
id: "description",
|
|
93
|
+
placeholder: a("Describe this template's purpose"),
|
|
94
|
+
className: "mt-1 h-24 resize-none text-xs",
|
|
95
|
+
value: x,
|
|
96
|
+
onChange: (s) => I(s.target.value)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
101
|
+
/* @__PURE__ */ e(w, { htmlFor: "previewImage", className: "text-xs font-medium", children: a("Preview Image (Optional)") }),
|
|
102
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
103
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
104
|
+
/* @__PURE__ */ e(
|
|
105
|
+
U,
|
|
106
|
+
{
|
|
107
|
+
type: "file",
|
|
108
|
+
id: "previewImage",
|
|
109
|
+
ref: i,
|
|
110
|
+
onChange: D,
|
|
111
|
+
accept: "image/*",
|
|
112
|
+
className: "hidden"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ e(
|
|
116
|
+
c,
|
|
117
|
+
{
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "outline",
|
|
120
|
+
onClick: M,
|
|
121
|
+
disabled: v,
|
|
122
|
+
className: "w-full",
|
|
123
|
+
children: v ? /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
124
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
125
|
+
a("Uploading...")
|
|
126
|
+
] }) : /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
127
|
+
/* @__PURE__ */ e(_, { className: "h-4 w-4" }),
|
|
128
|
+
a("Select image")
|
|
129
|
+
] })
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
l && /* @__PURE__ */ e(c, { type: "button", variant: "outline", size: "icon", onClick: F, children: /* @__PURE__ */ e($, { className: "h-4 w-4" }) })
|
|
133
|
+
] }),
|
|
134
|
+
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" }) }),
|
|
135
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("max 1mb") })
|
|
136
|
+
] })
|
|
137
|
+
] })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ t(R, { className: g ? "pointer-events-none opacity-75" : "", children: [
|
|
140
|
+
/* @__PURE__ */ e(
|
|
141
|
+
c,
|
|
142
|
+
{
|
|
143
|
+
variant: "outline",
|
|
144
|
+
onClick: (s) => {
|
|
145
|
+
s.stopPropagation(), m();
|
|
146
|
+
},
|
|
147
|
+
children: a("Cancel")
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ e(c, { variant: "default", disabled: g, onClick: A, children: a("Mark as template") })
|
|
151
|
+
] })
|
|
152
|
+
] }) });
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
se as default
|
|
156
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=[{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"0.5x Credits",multiplier:.5},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"1.25x Credits",multiplier:1.25},{id:"google/gemini-3-flash",name:"Gemini 3 Flash",provider:"google",description:"1x Credits",multiplier:1},{id:"google/gemini-3-pro",name:"Gemini 3 Pro",provider:"google",description:"2.5x Credits",multiplier:2.5},{id:"openai/gpt-5",name:"GPT-5",provider:"openai",description:"2x Credits",multiplier:2},{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",provider:"anthropic",description:"1x Credits",multiplier:1},{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"openai/gpt-4.1",name:"GPT-4.1",provider:"openai",description:"2x Credits",multiplier:2}],o=e=>i.find(r=>r.id===e),t=()=>i[0];exports.AI_MODELS=i;exports.getDefaultModel=t;exports.getModelById=o;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const i = [
|
|
2
|
+
{
|
|
3
|
+
id: "google/gemini-2.5-flash",
|
|
4
|
+
name: "Gemini 2.5 Flash",
|
|
5
|
+
provider: "google",
|
|
6
|
+
description: "0.5x Credits",
|
|
7
|
+
multiplier: 0.5
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "google/gemini-2.5-pro",
|
|
11
|
+
name: "Gemini 2.5 Pro",
|
|
12
|
+
provider: "google",
|
|
13
|
+
description: "1.25x Credits",
|
|
14
|
+
multiplier: 1.25
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "google/gemini-3-flash",
|
|
18
|
+
name: "Gemini 3 Flash",
|
|
19
|
+
provider: "google",
|
|
20
|
+
description: "1x Credits",
|
|
21
|
+
multiplier: 1
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "google/gemini-3-pro",
|
|
25
|
+
name: "Gemini 3 Pro",
|
|
26
|
+
provider: "google",
|
|
27
|
+
description: "2.5x Credits",
|
|
28
|
+
multiplier: 2.5
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "openai/gpt-5",
|
|
32
|
+
name: "GPT-5",
|
|
33
|
+
provider: "openai",
|
|
34
|
+
description: "2x Credits",
|
|
35
|
+
multiplier: 2
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "anthropic/claude-haiku-4.5",
|
|
39
|
+
name: "Claude Haiku 4.5",
|
|
40
|
+
provider: "anthropic",
|
|
41
|
+
description: "1x Credits",
|
|
42
|
+
multiplier: 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "anthropic/claude-sonnet-4",
|
|
46
|
+
name: "Claude Sonnet 4",
|
|
47
|
+
provider: "anthropic",
|
|
48
|
+
description: "3x Credits",
|
|
49
|
+
multiplier: 3
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "anthropic/claude-sonnet-4.5",
|
|
53
|
+
name: "Claude Sonnet 4.5",
|
|
54
|
+
provider: "anthropic",
|
|
55
|
+
description: "3x Credits",
|
|
56
|
+
multiplier: 3
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "openai/gpt-4.1",
|
|
60
|
+
name: "GPT-4.1",
|
|
61
|
+
provider: "openai",
|
|
62
|
+
description: "2x Credits",
|
|
63
|
+
multiplier: 2
|
|
64
|
+
}
|
|
65
|
+
], o = (e) => i.find((r) => r.id === e), n = () => i[0];
|
|
66
|
+
export {
|
|
67
|
+
i as A,
|
|
68
|
+
o as a,
|
|
69
|
+
n as g
|
|
70
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as c, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as p, ChevronRight as g } from "lucide-react";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { P as k, C as N, i as x, j as P, k as S, l as w, m as d, B } from "./index-S8ibZk9Q.js";
|
|
5
|
+
function E({
|
|
6
|
+
data: o,
|
|
7
|
+
onSelect: u,
|
|
8
|
+
dataType: t = "value",
|
|
9
|
+
open: f,
|
|
10
|
+
setOpen: m
|
|
11
|
+
}) {
|
|
12
|
+
const [s, i] = l.useState([]), [y, h] = l.useState(o);
|
|
13
|
+
l.useEffect(() => {
|
|
14
|
+
f || i([]), h(o);
|
|
15
|
+
}, [o, f]);
|
|
16
|
+
const b = (e) => Array.isArray(e) ? "array" : typeof e == "object" && e !== null ? "object" : "value", j = l.useCallback(
|
|
17
|
+
(e) => {
|
|
18
|
+
const r = (a) => t === "value" ? a === "value" || a === "object" : t === "array" ? a === "array" : a === t;
|
|
19
|
+
e.type === "object" ? (i((a) => [...a, e.key]), h(e.value)) : r(e.type) && (u([...s, e.key].join(".")), m(!1));
|
|
20
|
+
},
|
|
21
|
+
[t, u, s, m]
|
|
22
|
+
), C = l.useCallback(() => {
|
|
23
|
+
if (s.length > 0) {
|
|
24
|
+
const e = s.slice(0, -1);
|
|
25
|
+
i(e), h(e.reduce((r, a) => r[a], o));
|
|
26
|
+
}
|
|
27
|
+
}, [s, o]), v = l.useMemo(() => Object.entries(y).map(([e, r]) => ({
|
|
28
|
+
key: e,
|
|
29
|
+
value: r,
|
|
30
|
+
type: b(r)
|
|
31
|
+
})).filter((e) => t === "value" ? e.type === "value" || e.type === "object" : t === "array" ? e.type === "array" || e.type === "object" : t === "object" ? e.type === "object" : !0), [y, t]);
|
|
32
|
+
return /* @__PURE__ */ c(k, { className: "z-[9999] w-[200px] p-0", children: /* @__PURE__ */ n(N, { children: [
|
|
33
|
+
/* @__PURE__ */ c(x, { className: "border-none", placeholder: "Search..." }),
|
|
34
|
+
/* @__PURE__ */ n(
|
|
35
|
+
P,
|
|
36
|
+
{
|
|
37
|
+
onWheel: (e) => {
|
|
38
|
+
try {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const r = e.currentTarget;
|
|
41
|
+
r.scrollTop += e.deltaY;
|
|
42
|
+
} catch {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ c(S, { children: "No option found." }),
|
|
48
|
+
/* @__PURE__ */ n(w, { children: [
|
|
49
|
+
s.length > 0 && /* @__PURE__ */ n(d, { onSelect: C, className: "flex items-center text-sm", children: [
|
|
50
|
+
/* @__PURE__ */ c(p, { className: "mr-2 h-4 w-4" }),
|
|
51
|
+
"Back"
|
|
52
|
+
] }),
|
|
53
|
+
v.map((e) => /* @__PURE__ */ n(
|
|
54
|
+
d,
|
|
55
|
+
{
|
|
56
|
+
onSelect: () => j(e),
|
|
57
|
+
className: "flex items-center justify-between",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ c("span", { children: e.key }),
|
|
60
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
61
|
+
t === "object" && e.type === "object" && /* @__PURE__ */ c(
|
|
62
|
+
B,
|
|
63
|
+
{
|
|
64
|
+
size: "sm",
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
|
|
67
|
+
onClick: (r) => {
|
|
68
|
+
r.stopPropagation(), u([...s, e.key].join(".")), m(!1);
|
|
69
|
+
},
|
|
70
|
+
children: "Select"
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
(e.type === "object" || e.type === "array") && /* @__PURE__ */ c("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ c(g, { className: "h-4 w-4 opacity-50" }) })
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
e.key
|
|
78
|
+
))
|
|
79
|
+
] })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }) });
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
E as default
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),v=require("react"),s=require("./index-CnSjWE1P.cjs");function p(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=p(v);function C({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=a=>r==="value"?a==="value"||a==="object":r==="array"?a==="array":a===r;e.type==="object"?(f(a=>[...a,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,a)=>n[a],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(s.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(s.Command,{children:[t.jsx(s.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(s.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(s.CommandEmpty,{children:"No option found."}),t.jsxs(s.CommandGroup,{children:[u.length>0&&t.jsxs(s.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(s.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(s.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=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CnSjWE1P.cjs"),n=require("./index-CbwxUFy_.cjs"),m=require("lodash-es"),w=require("lucide-react"),x=require("react-i18next"),P=()=>{const{t}=x.useTranslation(),[l,i]=n.useSearchParams(),c=l.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=a.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),i(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=m.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(w.LockIcon,{className:"h-6 w-6 text-yellow-500"}),t("Page missing for"),' "',s,'" ',t("language"),"."]})}),e.jsx(a.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[t("Page is not available in the"),' "',s,'" ',t("language. Either create the page in the"),' "',s,'"',t("language or switch to the base language.")]})}),e.jsx(a.CardFooter,{children:e.jsx(a.Button,{onClick:d,className:"w-full",variant:"destructive",children:t("Switch to default language")})})]})})};exports.default=P;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { n as h, W as u, X as w, Y as p, Z as f, _ as P, B as C } from "./index-S8ibZk9Q.js";
|
|
3
|
+
import { c as S, d as L, L as x, B as N } from "./index-BDnwJqMw.js";
|
|
4
|
+
import { get as v } from "lodash-es";
|
|
5
|
+
import { LockIcon as B } from "lucide-react";
|
|
6
|
+
import { useTranslation as E } from "react-i18next";
|
|
7
|
+
const A = () => {
|
|
8
|
+
const { t: a } = E(), [c, l] = S(), r = c.get("lang"), i = L(r), { setSelectedLang: g } = h(), d = () => {
|
|
9
|
+
const n = new URLSearchParams(window.location.search);
|
|
10
|
+
n.delete("lang");
|
|
11
|
+
const o = n.toString(), m = `${window.location.pathname}${o ? `?${o}` : ""}`;
|
|
12
|
+
window.history.pushState({}, "", m), l(n), g(""), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
13
|
+
};
|
|
14
|
+
if (i) return null;
|
|
15
|
+
const t = v(x, r);
|
|
16
|
+
return /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s(u, { className: "mx-auto w-full max-w-md", children: [
|
|
17
|
+
/* @__PURE__ */ e(w, { className: "space-y-1", children: /* @__PURE__ */ s(p, { className: "flex items-center gap-2 text-2xl", children: [
|
|
18
|
+
/* @__PURE__ */ e(B, { className: "h-6 w-6 text-yellow-500" }),
|
|
19
|
+
a("Page missing for"),
|
|
20
|
+
' "',
|
|
21
|
+
t,
|
|
22
|
+
'" ',
|
|
23
|
+
a("language"),
|
|
24
|
+
"."
|
|
25
|
+
] }) }),
|
|
26
|
+
/* @__PURE__ */ e(f, { className: "grid gap-4", children: /* @__PURE__ */ s("div", { children: [
|
|
27
|
+
a("Page is not available in the"),
|
|
28
|
+
' "',
|
|
29
|
+
t,
|
|
30
|
+
'" ',
|
|
31
|
+
a("language. Either create the page in the"),
|
|
32
|
+
' "',
|
|
33
|
+
t,
|
|
34
|
+
'"',
|
|
35
|
+
a("language or switch to the base language.")
|
|
36
|
+
] }) }),
|
|
37
|
+
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(C, { onClick: d, className: "w-full", variant: "destructive", children: a("Switch to default language") }) })
|
|
38
|
+
] }) });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
A as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as g, d as n } from "./index-BDnwJqMw.js";
|
|
3
|
+
import { Suspense as s, lazy as t } from "react";
|
|
4
|
+
const o = t(() => import("./no-language-page-content-D_zd9Rb0.js")), l = () => {
|
|
5
|
+
const [e] = g(), r = e.get("lang");
|
|
6
|
+
return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
l as default
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CbwxUFy_.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-DAbLq0gX.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
|