@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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 +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as s, jsxs as t, Fragment as L } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useMutation as U } from "@tanstack/react-query";
|
|
6
|
-
import { Loader2 as W } from "lucide-react";
|
|
7
|
-
import { useState as c, useCallback as S, useEffect as G } from "react";
|
|
8
|
-
import { useTranslation as _ } from "react-i18next";
|
|
2
|
+
import { Loader2 as T } from "lucide-react";
|
|
3
|
+
import { useState as c, useCallback as A, useEffect as O } from "react";
|
|
4
|
+
import { useTranslation as q } from "react-i18next";
|
|
9
5
|
import { z as m } from "zod";
|
|
6
|
+
import { z as h, B as E } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
7
|
+
import { D as z, e as B, f as H, g as I, o as M, p as f, q as R } from "./index-DPV6NiJ-.js";
|
|
8
|
+
import { ai as U, aj as W, ag as S, al as G } from "./index-DqzFD1CG.js";
|
|
9
|
+
import { useMutation as _ } from "@tanstack/react-query";
|
|
10
10
|
const K = () => {
|
|
11
|
-
const a =
|
|
12
|
-
return
|
|
13
|
-
mutationKey: [
|
|
11
|
+
const a = U(), o = W();
|
|
12
|
+
return _({
|
|
13
|
+
mutationKey: [S.CHANGE_PASSWORD],
|
|
14
14
|
mutationFn: async (e) => {
|
|
15
15
|
const n = await o(a, {
|
|
16
|
-
action:
|
|
16
|
+
action: S.CHANGE_PASSWORD,
|
|
17
17
|
data: e
|
|
18
18
|
});
|
|
19
19
|
return n == null ? void 0 : n.data;
|
|
@@ -30,15 +30,15 @@ const K = () => {
|
|
|
30
30
|
message: a("New password must be different from current password"),
|
|
31
31
|
path: ["newPassword"]
|
|
32
32
|
}), os = ({ open: a, onOpenChange: o }) => {
|
|
33
|
-
const { t: e } =
|
|
34
|
-
C(""), N(""),
|
|
35
|
-
}, [g]), l =
|
|
33
|
+
const { t: e } = q(), n = G("currentUser", null), { mutate: j, isPending: w, isSuccess: u, reset: g } = K(), [P, C] = c(""), [x, N] = c(""), [v, D] = c(""), [b, d] = c(null), y = A(() => {
|
|
34
|
+
C(""), N(""), D(""), d(null), g();
|
|
35
|
+
}, [g]), l = A(
|
|
36
36
|
(r) => {
|
|
37
|
-
o(r), r ||
|
|
37
|
+
o(r), r || y();
|
|
38
38
|
},
|
|
39
|
-
[o,
|
|
39
|
+
[o, y]
|
|
40
40
|
);
|
|
41
|
-
|
|
41
|
+
O(() => {
|
|
42
42
|
if (u) {
|
|
43
43
|
const r = setTimeout(() => {
|
|
44
44
|
l(!1);
|
|
@@ -46,8 +46,8 @@ const K = () => {
|
|
|
46
46
|
return () => clearTimeout(r);
|
|
47
47
|
}
|
|
48
48
|
}, [u, l]);
|
|
49
|
-
const
|
|
50
|
-
var
|
|
49
|
+
const k = () => {
|
|
50
|
+
var F;
|
|
51
51
|
d(null);
|
|
52
52
|
const r = {
|
|
53
53
|
oldPassword: P.trim(),
|
|
@@ -55,14 +55,14 @@ const K = () => {
|
|
|
55
55
|
confirmPassword: v.trim()
|
|
56
56
|
}, i = V(e).safeParse(r);
|
|
57
57
|
if (!i.success) {
|
|
58
|
-
d(((
|
|
58
|
+
d(((F = i.error.issues[0]) == null ? void 0 : F.message) || e("Validation failed"));
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
if (!(n != null && n.email)) {
|
|
62
62
|
d(e("User email not found"));
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
j(
|
|
66
66
|
{
|
|
67
67
|
email: n.email,
|
|
68
68
|
oldPassword: i.data.oldPassword,
|
|
@@ -76,13 +76,13 @@ const K = () => {
|
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
};
|
|
79
|
-
return /* @__PURE__ */ s(
|
|
79
|
+
return /* @__PURE__ */ s(z, { open: a, onOpenChange: l, children: /* @__PURE__ */ s(B, { className: "sm:max-w-[425px]", children: w ? /* @__PURE__ */ s("div", { className: "flex h-[340px] items-center justify-center", children: /* @__PURE__ */ s(T, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) : u ? /* @__PURE__ */ t("div", { className: "flex h-[340px] flex-col items-center justify-center gap-2", children: [
|
|
80
80
|
/* @__PURE__ */ s("div", { className: "rounded-full bg-green-100 p-3", children: /* @__PURE__ */ s("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }),
|
|
81
81
|
/* @__PURE__ */ s("p", { className: "text-lg font-medium", children: e("Password updated successfully") })
|
|
82
82
|
] }) : /* @__PURE__ */ t(L, { children: [
|
|
83
|
-
/* @__PURE__ */ t(
|
|
84
|
-
/* @__PURE__ */ s(
|
|
85
|
-
/* @__PURE__ */ s(
|
|
83
|
+
/* @__PURE__ */ t(H, { children: [
|
|
84
|
+
/* @__PURE__ */ s(I, { children: e("Change Password") }),
|
|
85
|
+
/* @__PURE__ */ s(M, { children: e("Enter your current password and a new password.") })
|
|
86
86
|
] }),
|
|
87
87
|
/* @__PURE__ */ t("div", { className: "grid gap-4 py-4", children: [
|
|
88
88
|
/* @__PURE__ */ t("div", { className: "grid gap-2", children: [
|
|
@@ -119,16 +119,16 @@ const K = () => {
|
|
|
119
119
|
id: "confirm-password",
|
|
120
120
|
type: "password",
|
|
121
121
|
value: v,
|
|
122
|
-
onChange: (r) =>
|
|
122
|
+
onChange: (r) => D(r.target.value),
|
|
123
123
|
placeholder: e("Confirm new password")
|
|
124
124
|
}
|
|
125
125
|
)
|
|
126
126
|
] }),
|
|
127
|
-
|
|
127
|
+
b && /* @__PURE__ */ s("p", { className: "text-sm text-destructive", children: b })
|
|
128
128
|
] }),
|
|
129
|
-
/* @__PURE__ */ t(
|
|
130
|
-
/* @__PURE__ */ s(
|
|
131
|
-
/* @__PURE__ */ s(
|
|
129
|
+
/* @__PURE__ */ t(R, { children: [
|
|
130
|
+
/* @__PURE__ */ s(E, { variant: "outline", onClick: () => l(!1), disabled: w, children: e("Cancel") }),
|
|
131
|
+
/* @__PURE__ */ s(E, { onClick: k, disabled: w, children: e("Change Password") })
|
|
132
132
|
] })
|
|
133
133
|
] }) }) });
|
|
134
134
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { B as l } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
2
|
import m from "@monaco-editor/react";
|
|
4
3
|
import { CheckIcon as h, CopyIcon as C, DownloadIcon as y } from "@radix-ui/react-icons";
|
|
5
|
-
import { useState as
|
|
4
|
+
import { useState as l } from "react";
|
|
5
|
+
import { B as s } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
6
6
|
function N({
|
|
7
7
|
code: r,
|
|
8
8
|
onCopy: d,
|
|
@@ -10,7 +10,7 @@ function N({
|
|
|
10
10
|
onDownload: c,
|
|
11
11
|
downloadText: p = "Download"
|
|
12
12
|
}) {
|
|
13
|
-
const [n, i] =
|
|
13
|
+
const [n, i] = l(!1), [t, f] = l(r);
|
|
14
14
|
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-4", children: [
|
|
15
15
|
/* @__PURE__ */ e("div", { className: "h-[500px] max-h-full overflow-hidden rounded-md border py-2", children: /* @__PURE__ */ e(
|
|
16
16
|
m,
|
|
@@ -40,7 +40,7 @@ function N({
|
|
|
40
40
|
}
|
|
41
41
|
) }),
|
|
42
42
|
/* @__PURE__ */ o("div", { className: "flex justify-end gap-2", children: [
|
|
43
|
-
/* @__PURE__ */ o(
|
|
43
|
+
/* @__PURE__ */ o(s, { type: "button", variant: "outline", onClick: () => {
|
|
44
44
|
d(t), i(!0), setTimeout(() => {
|
|
45
45
|
i(!1);
|
|
46
46
|
}, 2e3);
|
|
@@ -49,7 +49,7 @@ function N({
|
|
|
49
49
|
" ",
|
|
50
50
|
n ? "Copied" : "Copy"
|
|
51
51
|
] }),
|
|
52
|
-
/* @__PURE__ */ o(
|
|
52
|
+
/* @__PURE__ */ o(s, { type: "button", onClick: () => {
|
|
53
53
|
c(t);
|
|
54
54
|
}, children: [
|
|
55
55
|
/* @__PURE__ */ e(y, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@monaco-editor/react"),o=require("@radix-ui/react-icons"),i=require("react"),r=require("./register-chai-top-bar-CCssW5dL.cjs");function C({code:l,onCopy:d,language:s="javascript",onDownload:c,downloadText:u="Download"}){const[n,a]=i.useState(!1),[t,p]=i.useState(l),f=()=>{d(t),a(!0),setTimeout(()=>{a(!1)},2e3)},h=()=>{c(t)};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:e.jsx(m,{height:"100%",defaultLanguage:s,language:s,value:t,onChange:x=>p(x||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(r.Button,{type:"button",variant:"outline",onClick:f,children:[n?e.jsx(o.CheckIcon,{className:"text-green-500"}):e.jsx(o.CopyIcon,{})," ",n?"Copied":"Copy"]}),e.jsxs(r.Button,{type:"button",onClick:h,children:[e.jsx(o.DownloadIcon,{})," ",u]})]})]})}exports.default=C;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { useThrottledCallback as k } from "@react-hookz/web";
|
|
3
|
+
import { get as v } from "lodash-es";
|
|
4
|
+
import { useState as p, useMemo as T, useCallback as E, useEffect as L } from "react";
|
|
5
|
+
import { useTranslation as N } from "react-i18next";
|
|
6
|
+
import { u as y, a as w, b as D, c as H, d as M, L as P, D as B, e as I, f as S, g as j, T as R } from "./index-DPV6NiJ-.js";
|
|
7
7
|
const x = (a) => {
|
|
8
8
|
const s = document.createElement("div");
|
|
9
9
|
return s.innerHTML = a, s.innerHTML;
|
|
10
10
|
};
|
|
11
11
|
function J() {
|
|
12
|
-
const { t: a } =
|
|
12
|
+
const { t: a } = N(), [s, f] = p(!1), [n, h] = p(""), [e, i] = y(), [d] = w(), g = D(), C = H(), { selectedLang: r } = M(), m = T(() => v(P, r, r), [r]), b = k(
|
|
13
13
|
(o) => {
|
|
14
14
|
if (!e) return;
|
|
15
15
|
const l = x(o);
|
|
@@ -17,18 +17,18 @@ function J() {
|
|
|
17
17
|
},
|
|
18
18
|
[],
|
|
19
19
|
300
|
|
20
|
-
), u =
|
|
20
|
+
), u = E(() => {
|
|
21
21
|
if (s && e) {
|
|
22
22
|
const o = x(n);
|
|
23
23
|
g([e.blockId], { [e.blockProp]: o });
|
|
24
24
|
}
|
|
25
25
|
}, [s, n, e]);
|
|
26
|
-
return
|
|
26
|
+
return L(() => {
|
|
27
27
|
e && !d.includes(e.blockId) && (u(), i(null));
|
|
28
|
-
}, [d, e]), /* @__PURE__ */ t(
|
|
28
|
+
}, [d, e]), /* @__PURE__ */ t(B, { open: !0, onOpenChange: () => {
|
|
29
29
|
u(), i(null);
|
|
30
|
-
}, children: /* @__PURE__ */ c(
|
|
31
|
-
/* @__PURE__ */ t(
|
|
30
|
+
}, children: /* @__PURE__ */ c(I, { className: "flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black", children: [
|
|
31
|
+
/* @__PURE__ */ t(S, { className: "shrink-0 pb-3", children: /* @__PURE__ */ t(j, { className: "flex items-center justify-between text-black", children: /* @__PURE__ */ c("div", { className: "space-x-3 text-sm font-semibold", children: [
|
|
32
32
|
/* @__PURE__ */ t("span", { children: a("HTML Code Editor") }),
|
|
33
33
|
m && /* @__PURE__ */ c("span", { className: "text-xs text-gray-400", children: [
|
|
34
34
|
"(",
|
|
@@ -38,7 +38,7 @@ function J() {
|
|
|
38
38
|
/* @__PURE__ */ t("span", { className: "text-xs text-gray-400", children: a("Scripts will be only executed in preview and live mode.") })
|
|
39
39
|
] }) }) }),
|
|
40
40
|
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ t(
|
|
41
|
-
|
|
41
|
+
R,
|
|
42
42
|
{
|
|
43
43
|
className: "h-full w-full resize-none font-mono md:text-xs",
|
|
44
44
|
value: e ? n || e.initialCode : "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),j=require("@react-hookz/web"),v=require("lodash-es"),l=require("react"),T=require("react-i18next"),t=require("./index-D-r_K4yA.cjs"),h=c=>{const o=document.createElement("div");return o.innerHTML=c,o.innerHTML};function y(){const{t:c}=T.useTranslation(),[o,p]=l.useState(!1),[r,f]=l.useState(""),[e,d]=t.useCodeEditor(),[u]=t.useSelectedBlockIds(),g=t.useUpdateBlocksProps(),b=t.useUpdateBlocksPropsRealtime(),{selectedLang:i}=t.useLanguages(),x=l.useMemo(()=>v.get(t.LANGUAGES,i,i),[i]),C=j.useThrottledCallback(n=>{if(!e)return;const a=h(n);b([e.blockId],{[e.blockProp]:a})},[],300),m=l.useCallback(()=>{if(o&&e){const n=h(r);g([e.blockId],{[e.blockProp]:n})}},[o,r,e]);l.useEffect(()=>{e&&!u.includes(e.blockId)&&(m(),d(null))},[u,e]);const k=()=>{m(),d(null)};return s.jsx(t.Dialog,{open:!0,onOpenChange:k,children:s.jsxs(t.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[s.jsx(t.DialogHeader,{className:"shrink-0 pb-3",children:s.jsx(t.DialogTitle,{className:"flex items-center justify-between text-black",children:s.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[s.jsx("span",{children:c("HTML Code Editor")}),x&&s.jsxs("span",{className:"text-xs text-gray-400",children:["(",x,")"]}),s.jsx("span",{className:"text-xs text-gray-400",children:c("Scripts will be only executed in preview and live mode.")})]})})}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(t.Textarea,{className:"h-full w-full resize-none font-mono md:text-xs",value:e?r||e.initialCode:"",onChange:n=>{const a=n.target.value;p(!0),f(a),C(a)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=y;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D-r_K4yA.cjs"),r=require("./common-functions-B3a4xKt_.cjs"),i=require("./apply-binding-Cjh1kqMO.cjs"),t=require("react-i18next"),a=require("./register-chai-top-bar-CCssW5dL.cjs"),o=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.PERMISSIONS=e.PERMISSIONS;exports.defaultChaiLibrary=e.defaultChaiLibrary;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.useAddBlock=e.useAddBlock;exports.useBlocksHtmlForAi=e.useBlocksHtmlForAi;exports.useHtmlToBlocks=e.useHtmlToBlocks;exports.useI18nBlocks=e.useI18nBlocks;exports.useLanguages=e.useLanguages;exports.useReplaceBlock=e.useReplaceBlock;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useStreamMultipleBlocksProps=e.useStreamMultipleBlocksProps;exports.generateBlockId=r.generateUUID;exports.mergeClasses=r.cn;exports.convertHTMLToChaiBlocks=i.getBlocksFromHTML;exports.getBlocksFromHTML=i.getBlocksFromHTML;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>t.useTranslation});exports.ADD_BLOCK_TABS=a.ADD_BLOCK_TABS;exports.CHAI_BUILDER_PANELS=a.CHAI_BUILDER_PANELS;exports.IfChaiFeatureFlag=a.IfChaiFeatureFlag;exports.RJSF_EXTENSIONS=a.RJSF_EXTENSIONS;exports.getChaiLibrary=a.getChaiLibrary;exports.getPreImportHTML=a.getPreImportHTML;exports.registerChaiAddBlockTab=a.registerChaiAddBlockTab;exports.registerChaiBlockSettingField=a.registerChaiBlockSettingField;exports.registerChaiBlockSettingTemplate=a.registerChaiBlockSettingTemplate;exports.registerChaiBlockSettingWidget=a.registerChaiBlockSettingWidget;exports.registerChaiFeatureFlag=a.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=a.registerChaiFeatureFlags;exports.registerChaiLibrary=a.registerChaiLibrary;exports.registerChaiMediaManager=a.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=a.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=a.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=a.registerChaiSidebarPanel;exports.registerChaiTopBar=a.registerChaiTopBar;exports.resetSaveToLibrary=a.resetSaveToLibrary;exports.useChaiAddBlockTabs=a.useChaiAddBlockTabs;exports.useChaiBlockSettingComponents=a.useChaiBlockSettingComponents;exports.useChaiFeatureFlag=a.useChaiFeatureFlag;exports.useChaiFeatureFlags=a.useChaiFeatureFlags;exports.useChaiLibraries=a.useChaiLibraries;exports.useChaiSidebarPanels=a.useChaiSidebarPanels;exports.useMediaManagerComponent=a.useMediaManagerComponent;exports.useSaveToLibraryComponent=a.useSaveToLibraryComponent;exports.useToggleChaiFeatureFlag=a.useToggleChaiFeatureFlag;exports.useTopBarComponent=a.useTopBarComponent;exports.i18n=o;
|
package/dist/core.d.ts
CHANGED
|
@@ -248,7 +248,6 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
248
248
|
* temporary props. Not to be used in production
|
|
249
249
|
*/
|
|
250
250
|
flags?: {
|
|
251
|
-
librarySite?: boolean;
|
|
252
251
|
copyPaste?: boolean;
|
|
253
252
|
exportCode?: boolean;
|
|
254
253
|
darkMode?: boolean;
|
|
@@ -258,11 +257,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
258
257
|
gotoSettings?: boolean;
|
|
259
258
|
dragAndDrop?: boolean;
|
|
260
259
|
validateStructure?: boolean;
|
|
261
|
-
designTokens?: boolean;
|
|
262
260
|
ai?: boolean;
|
|
263
|
-
revisions?: boolean;
|
|
264
|
-
sharedJsonLD?: boolean;
|
|
265
|
-
resetSeoToDefault?: boolean;
|
|
266
261
|
};
|
|
267
262
|
structureRules?: StructureRule[];
|
|
268
263
|
designTokens?: ChaiDesignTokens;
|
package/dist/core.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as
|
|
3
|
-
import { g as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { default as
|
|
1
|
+
import { aM as s, aD as r, aL as i, aN as o, aE as t, aF as l, aG as C, aB as g, aj as h, aO as u, aP as n, aQ as d, aH as B, aI as c, ak as k, aJ as S, aK as p, al as m, an as T, aS as L, aR as F, U as b, X as A, aT as I, s as M, d as P, V as f, ar as E, r as H, t as x } from "./index-DPV6NiJ-.js";
|
|
2
|
+
import { g as D, c as v } from "./common-functions-D2lMFR6K.js";
|
|
3
|
+
import { g as U, g as N } from "./apply-binding-v_W4uR3U.js";
|
|
4
|
+
import { useTranslation as _ } from "react-i18next";
|
|
5
|
+
import { A as w, C as J, I as K, R as V, k as X, o as q, c as z, a as G, b as Q, r as W, e as Y, f as Z, j as $, m as aa, p as ea, q as sa, v as ra, x as ia, t as oa, d as ta, u as la, h as Ca, g as ga, l as ha, w as ua, n as na, s as da, i as Ba, y as ca } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
6
|
+
import { default as Sa } from "i18next";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
w as ADD_BLOCK_TABS,
|
|
9
|
+
J as CHAI_BUILDER_PANELS,
|
|
10
10
|
s as ChaiAddBlocksDialog,
|
|
11
11
|
r as ChaiAddBlocksPanel,
|
|
12
12
|
i as ChaiAskAiUserPrompt,
|
|
@@ -17,57 +17,57 @@ export {
|
|
|
17
17
|
g as ChaiBuilderEditor,
|
|
18
18
|
h as ChaiDarkModeSwitcher,
|
|
19
19
|
u as ChaiDefaultBlocks,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
n as ChaiDraggableBlock,
|
|
21
|
+
d as ChaiExportCodeModal,
|
|
22
|
+
B as ChaiImportHTML,
|
|
23
|
+
c as ChaiOutline,
|
|
24
|
+
k as ChaiScreenSizes,
|
|
25
|
+
S as ChaiThemeConfigPanel,
|
|
26
|
+
p as ChaiUILibrariesPanel,
|
|
27
|
+
m as ChaiUndoRedo,
|
|
28
28
|
K as IfChaiFeatureFlag,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
T as PERMISSIONS,
|
|
30
|
+
V as RJSF_EXTENSIONS,
|
|
31
|
+
U as convertHTMLToChaiBlocks,
|
|
32
|
+
L as defaultChaiLibrary,
|
|
33
|
+
D as generateBlockId,
|
|
34
|
+
N as getBlocksFromHTML,
|
|
35
|
+
X as getChaiLibrary,
|
|
36
|
+
F as getClassValueAndUnit,
|
|
37
37
|
q as getPreImportHTML,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
Sa as i18n,
|
|
39
|
+
v as mergeClasses,
|
|
40
40
|
z as registerChaiAddBlockTab,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
G as registerChaiBlockSettingField,
|
|
42
|
+
Q as registerChaiBlockSettingTemplate,
|
|
43
43
|
W as registerChaiBlockSettingWidget,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
Y as registerChaiFeatureFlag,
|
|
45
|
+
Z as registerChaiFeatureFlags,
|
|
46
|
+
$ as registerChaiLibrary,
|
|
47
|
+
aa as registerChaiMediaManager,
|
|
48
|
+
ea as registerChaiPreImportHTMLHook,
|
|
49
|
+
sa as registerChaiSaveToLibrary,
|
|
50
|
+
ra as registerChaiSidebarPanel,
|
|
51
|
+
ia as registerChaiTopBar,
|
|
52
|
+
oa as resetSaveToLibrary,
|
|
53
|
+
b as useAddBlock,
|
|
54
54
|
A as useBlocksHtmlForAi,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
ta as useChaiAddBlockTabs,
|
|
56
|
+
la as useChaiBlockSettingComponents,
|
|
57
|
+
Ca as useChaiFeatureFlag,
|
|
58
|
+
ga as useChaiFeatureFlags,
|
|
59
|
+
ha as useChaiLibraries,
|
|
60
|
+
ua as useChaiSidebarPanels,
|
|
61
61
|
I as useHtmlToBlocks,
|
|
62
62
|
M as useI18nBlocks,
|
|
63
63
|
P as useLanguages,
|
|
64
|
-
|
|
64
|
+
na as useMediaManagerComponent,
|
|
65
65
|
f as useReplaceBlock,
|
|
66
66
|
E as useSavePage,
|
|
67
|
-
|
|
67
|
+
da as useSaveToLibraryComponent,
|
|
68
68
|
H as useSelectedBlock,
|
|
69
69
|
x as useStreamMultipleBlocksProps,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
Ba as useToggleChaiFeatureFlag,
|
|
71
|
+
ca as useTopBarComponent,
|
|
72
|
+
_ as useTranslation
|
|
73
73
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as x from "react";
|
|
3
|
+
import { useTranslation as T } from "react-i18next";
|
|
4
|
+
import { B as y } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
5
|
+
import { D as V, e as N, f as R, g as E, o as D, p as I, T as A, q as P } from "./index-DPV6NiJ-.js";
|
|
4
6
|
import "lodash-es";
|
|
5
7
|
import * as b from "culori";
|
|
6
|
-
import { a as
|
|
7
|
-
import * as x from "react";
|
|
8
|
-
import { useTranslation as H } from "react-i18next";
|
|
8
|
+
import { a as H } from "./fonts-B3UYxuJI.js";
|
|
9
9
|
const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o.h)} ${d(o.s * 100)}% ${d(o.l * 100)}%)`, M = (o, e = "hsl", s = "4") => {
|
|
10
10
|
try {
|
|
11
11
|
const r = b.parse(o);
|
|
@@ -119,7 +119,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
119
119
|
return console.warn("Failed to process color:", o, e), "#000000";
|
|
120
120
|
}
|
|
121
121
|
}, B = (o) => {
|
|
122
|
-
const e =
|
|
122
|
+
const e = H();
|
|
123
123
|
if (!o)
|
|
124
124
|
return "ui-sans-serif, system-ui, sans-serif";
|
|
125
125
|
try {
|
|
@@ -216,7 +216,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
216
216
|
--primary: rgb(46, 125, 50);
|
|
217
217
|
--primary-foreground: #ffffff;
|
|
218
218
|
}`, Q = ({ open: o, onOpenChange: e, onImport: s }) => {
|
|
219
|
-
const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } =
|
|
219
|
+
const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } = T(), p = async () => {
|
|
220
220
|
h(!0), n(null);
|
|
221
221
|
try {
|
|
222
222
|
const c = w(r);
|
|
@@ -248,10 +248,10 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
248
248
|
}, g = () => {
|
|
249
249
|
t(""), n(null), e(!1);
|
|
250
250
|
};
|
|
251
|
-
return /* @__PURE__ */ i(
|
|
252
|
-
/* @__PURE__ */ u(
|
|
253
|
-
/* @__PURE__ */ i(
|
|
254
|
-
/* @__PURE__ */ u(
|
|
251
|
+
return /* @__PURE__ */ i(V, { open: o, onOpenChange: e, children: /* @__PURE__ */ u(N, { className: "flex max-h-[80vh] max-w-2xl flex-col", children: [
|
|
252
|
+
/* @__PURE__ */ u(R, { children: [
|
|
253
|
+
/* @__PURE__ */ i(E, { children: a("Import CSS Theme") }),
|
|
254
|
+
/* @__PURE__ */ u(D, { className: "space-y-2", children: [
|
|
255
255
|
/* @__PURE__ */ i("p", { children: a(
|
|
256
256
|
"Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties."
|
|
257
257
|
) }),
|
|
@@ -281,9 +281,9 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
281
281
|
] }),
|
|
282
282
|
/* @__PURE__ */ u("div", { className: "flex-1 space-y-4 overflow-hidden", children: [
|
|
283
283
|
/* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
284
|
-
/* @__PURE__ */ i(
|
|
284
|
+
/* @__PURE__ */ i(I, { htmlFor: "css-input", children: a("CSS Variables") }),
|
|
285
285
|
/* @__PURE__ */ i(
|
|
286
|
-
|
|
286
|
+
A,
|
|
287
287
|
{
|
|
288
288
|
id: "css-input",
|
|
289
289
|
placeholder: _,
|
|
@@ -296,7 +296,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", L = (o) => `hsl(${d(o
|
|
|
296
296
|
] }),
|
|
297
297
|
l && /* @__PURE__ */ i("div", { className: "rounded-md border border-red-200 bg-red-50 p-3", children: /* @__PURE__ */ i("p", { className: "text-sm text-red-600", children: l }) })
|
|
298
298
|
] }),
|
|
299
|
-
/* @__PURE__ */ u(
|
|
299
|
+
/* @__PURE__ */ u(P, { className: "gap-2", children: [
|
|
300
300
|
/* @__PURE__ */ i(y, { variant: "outline", onClick: g, disabled: m, children: a("Cancel") }),
|
|
301
301
|
/* @__PURE__ */ i(y, { onClick: p, disabled: !r.trim() || m, children: a(m ? "Importing..." : "Import Theme") })
|
|
302
302
|
] })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("./register-chai-top-bar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),T=require("react"),V=require("react-i18next"),y=require("./register-chai-top-bar-CCssW5dL.cjs"),f=require("./index-D-r_K4yA.cjs");require("lodash-es");const N=require("culori"),R=require("./fonts-D5fTqvSS.cjs");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const C=j(T),b=j(N),d=e=>e?e%1===0?e:e.toFixed(4):"0",q=e=>`hsl(${d(e.h)} ${d(e.s*100)}% ${d(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=b.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=b.converter("hsl")(r);return t==="4"?q(s):`${d(s.h)} ${d(s.s*100)}% ${d(s.l*100)}%`}case"rgb":return b.formatRgb(r);case"oklch":{const s=b.converter("oklch")(r);return`oklch(${d(s.l)} ${d(s.c)} ${d(s.h)})`}case"hex":return b.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},x=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=w(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),$();const r=v(e,":root"),s=v(e,".dark"),c=u(r,"--font-sans")||u(r,"--font-family")||u(r,"--font-heading")||u(r,"--font-body"),a=D(c);o.fontFamily={heading:a,body:a};const h=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=P(h),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=u(r,`--${i}`),g=u(s,`--${i}`);if(p||g){const l=p?k(p):"#000000",S=g?k(g):l;o.colors[i]=[l,S]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),$()}return o},v=(e,o)=>{var r,s;const t=new RegExp(`${F(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},u=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${F(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},k=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return x(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return x(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[,r,s,c]=t,a=`hsl(${r} ${s}% ${c}%)`;return x(a)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const c=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return x(c)||"#000000"}}return x(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=R.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(c=>c.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},$=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),F=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,w=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
|
|
2
2
|
--background: 0 0% 100%;
|
|
3
3
|
--foreground: oklch(0.52 0.13 144.17);
|
|
4
4
|
--primary: #3e2723;
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
--foreground: hsl(37.50 36.36% 95.69%);
|
|
11
11
|
--primary: rgb(46, 125, 50);
|
|
12
12
|
--primary-foreground: #ffffff;
|
|
13
|
-
}`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=C.useState(""),[c,a]=C.useState(null),[h,m]=C.useState(!1),{t:i}=
|
|
13
|
+
}`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=C.useState(""),[c,a]=C.useState(null),[h,m]=C.useState(!1),{t:i}=V.useTranslation(),p=async()=>{m(!0),a(null);try{const l=w(r);if(!l.isValid){a(l.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),m(!1);return}const S=I(r);if(!B(S)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),m(!1);return}t(S),s(""),a(null),o(!1)}catch(l){console.error("Error importing CSS:",l),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{m(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(f.Dialog,{open:e,onOpenChange:o,children:n.jsxs(f.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(f.DialogHeader,{children:[n.jsx(f.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(f.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(f.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(f.Textarea,{id:"css-input",placeholder:M,value:r,onChange:l=>s(l.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:h})]}),c&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:c})})]}),n.jsxs(f.DialogFooter,{className:"gap-2",children:[n.jsx(y.Button,{variant:"outline",onClick:g,disabled:h,children:i("Cancel")}),n.jsx(y.Button,{onClick:p,disabled:!r.trim()||h,children:i(h?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=_;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as s, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { d as k, n as U, D as W, e as g, f as B, g as q, o as G, q as R } from "./index-OuHV9Ann.js";
|
|
4
|
-
import { c as j, o as F, k as H, e as M, j as Q, q as T, L as $ } from "./index-LBTm1Jmk.js";
|
|
5
|
-
import { isEmpty as z, get as I } from "lodash-es";
|
|
2
|
+
import { isEmpty as U, get as k } from "lodash-es";
|
|
6
3
|
import { useMemo as f } from "react";
|
|
7
|
-
import { useTranslation as
|
|
4
|
+
import { useTranslation as W } from "react-i18next";
|
|
5
|
+
import { B as L } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
6
|
+
import { d as g, n as B, D as G, e as R, f as q, g as F, o as H, q as M } from "./index-DPV6NiJ-.js";
|
|
7
|
+
import { u as Q, l as T, h as $, b as j, g as z, m as I, L as J } from "./index-DqzFD1CG.js";
|
|
8
8
|
const x = (e, l) => {
|
|
9
9
|
const i = l.filter((m) => m.parent === e);
|
|
10
10
|
if (i.length === 0) return 0;
|
|
@@ -14,7 +14,7 @@ const x = (e, l) => {
|
|
|
14
14
|
}), c;
|
|
15
15
|
};
|
|
16
16
|
function p({ page: e, onClose: l }) {
|
|
17
|
-
const { t: i } =
|
|
17
|
+
const { t: i } = W(), [, c] = Q(), { mutate: m, isPending: P } = T(), { data: y } = $(), { data: u = [] } = j(), { setSelectedLang: b, fallbackLang: C } = g(), [, A] = B(), a = !(e != null && e.primaryPage), { data: r = [] } = z(a ? e == null ? void 0 : e.id : void 0), { data: D } = I(), v = f(() => U(e == null ? void 0 : e.slug), [e == null ? void 0 : e.slug]), N = f(() => {
|
|
18
18
|
if (!v || !(e != null && e.id) || !D) return [];
|
|
19
19
|
const n = [];
|
|
20
20
|
return Object.entries(D).forEach(([o, w]) => {
|
|
@@ -29,14 +29,14 @@ function p({ page: e, onClose: l }) {
|
|
|
29
29
|
}, [e.id, u, a, r]), E = () => {
|
|
30
30
|
P || m(e, {
|
|
31
31
|
onSuccess: () => {
|
|
32
|
-
e != null && e.primaryPage ? (window.history.replaceState({}, "", `/?page=${e.primaryPage}`), c(new URLSearchParams({ page: e.primaryPage }))) : (window.history.replaceState({}, "", "/"), c(new URLSearchParams())), window.dispatchEvent(new PopStateEvent("popstate")), C
|
|
32
|
+
e != null && e.primaryPage ? (window.history.replaceState({}, "", `/?page=${e.primaryPage}`), c(new URLSearchParams({ page: e.primaryPage }))) : (window.history.replaceState({}, "", "/"), c(new URLSearchParams())), window.dispatchEvent(new PopStateEvent("popstate")), b(C), A("outline"), l();
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}, d = y == null ? void 0 : y.find((n) => n.key === (e == null ? void 0 : e.pageType));
|
|
36
|
-
return /* @__PURE__ */ s(
|
|
37
|
-
/* @__PURE__ */ t(
|
|
38
|
-
/* @__PURE__ */ s(
|
|
39
|
-
/* @__PURE__ */ t(
|
|
36
|
+
return /* @__PURE__ */ s(G, { open: !!e, onOpenChange: l, children: /* @__PURE__ */ t(R, { children: [
|
|
37
|
+
/* @__PURE__ */ t(q, { children: [
|
|
38
|
+
/* @__PURE__ */ s(F, { children: i("Confirm Deletion") }),
|
|
39
|
+
/* @__PURE__ */ t(H, { className: "py-4 text-slate-500", children: [
|
|
40
40
|
/* @__PURE__ */ t("div", { children: [
|
|
41
41
|
i("Are you sure you want to remove"),
|
|
42
42
|
" ",
|
|
@@ -69,11 +69,11 @@ function p({ page: e, onClose: l }) {
|
|
|
69
69
|
i("Language"),
|
|
70
70
|
":",
|
|
71
71
|
" ",
|
|
72
|
-
/* @__PURE__ */ s("span", { className: "font-medium text-gray-500", children:
|
|
72
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-gray-500", children: k(J, e.lang, e.lang) })
|
|
73
73
|
] })
|
|
74
74
|
] })
|
|
75
75
|
] }),
|
|
76
|
-
/* @__PURE__ */ t(
|
|
76
|
+
/* @__PURE__ */ t(M, { children: [
|
|
77
77
|
/* @__PURE__ */ s(L, { variant: "outline", onClick: l, children: i("Cancel") }),
|
|
78
78
|
/* @__PURE__ */ s(L, { variant: "destructive", disabled: P, onClick: E, children: i(P ? "Deleting..." : "Delete") })
|
|
79
79
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("lodash-es"),f=require("react"),g=require("react-i18next"),C=require("./register-chai-top-bar-CCssW5dL.cjs"),n=require("./index-D-r_K4yA.cjs"),l=require("./index-BYrRPW_c.cjs"),S=(e,d)=>{const t=d.filter(m=>m.parent===e);if(t.length===0)return 0;let u=t.length;return t.forEach(m=>{u+=S(m.id,d)}),u};function U({page:e,onClose:d}){const{t}=g.useTranslation(),[,u]=l.useSearchParams(),{mutate:m,isPending:P}=l.useDeletePage(),{data:j}=l.usePageTypes(),{data:h=[]}=l.useWebsitePrimaryPages(),{setSelectedLang:E,fallbackLang:L}=n.useLanguages(),[,q]=n.useSidebarActivePanel(),c=!(e!=null&&e.primaryPage),{data:r=[]}=l.useLanguagePages(c?e==null?void 0:e.id:void 0),{data:y}=l.useSiteWideUsage(),v=f.useMemo(()=>b.isEmpty(e==null?void 0:e.slug),[e==null?void 0:e.slug]),w=f.useMemo(()=>{if(!v||!(e!=null&&e.id)||!y)return[];const i=[];return Object.entries(y).forEach(([o,D])=>{D.partialBlocks.includes(e.id)&&!D.isPartial&&i.push({id:o,name:D.name})}),i},[v,e.id,y]),N=f.useMemo(()=>!c||!r?0:r.filter(i=>i.id!==e.id).length,[c,r,e.id]),x=f.useMemo(()=>{if(!(e!=null&&e.id)||!h.length)return 0;let i=S(e.id,h);return c&&r&&r.length>0&&r.forEach(o=>{o.id!==e.id&&(i+=S(o.id,h))}),i},[e.id,h,c,r]),A=()=>{P||m(e,{onSuccess:()=>{e!=null&&e.primaryPage?(window.history.replaceState({},"",`/?page=${e.primaryPage}`),u(new URLSearchParams({page:e.primaryPage}))):(window.history.replaceState({},"","/"),u(new URLSearchParams)),window.dispatchEvent(new PopStateEvent("popstate")),E(L),q("outline"),d()}})},a=j==null?void 0:j.find(i=>i.key===(e==null?void 0:e.pageType));return s.jsx(n.Dialog,{open:!!e,onOpenChange:d,children:s.jsxs(n.DialogContent,{children:[s.jsxs(n.DialogHeader,{children:[s.jsx(n.DialogTitle,{children:t("Confirm Deletion")}),s.jsxs(n.DialogDescription,{className:"py-4 text-slate-500",children:[s.jsxs("div",{children:[t("Are you sure you want to remove")," ",s.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",a!=null&&a.hasSlug?(a==null?void 0:a.name)+"?":t("page?")]}),c&&(N>0||x>0)&&s.jsxs("div",{className:"mt-3 rounded-md bg-red-50 p-3 text-sm",children:[s.jsxs("div",{className:"font-semibold text-red-800",children:[t("Warning: Deleting this primary page will also delete"),":"]}),s.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-red-700",children:[x>0&&s.jsxs("li",{children:[s.jsx("span",{className:"font-medium",children:x})," ",t(x===1?"nested child page":"nested child pages")]}),N>0&&s.jsx("li",{children:t("All associated language pages")})]})]}),v&&w.length>0&&s.jsxs("div",{className:"mt-3 rounded-md bg-red-50 p-3 text-sm",children:[s.jsxs("div",{className:"font-semibold text-red-800",children:[t("Warning: This partial is currently used in the following pages"),":"]}),s.jsx("ul",{className:"mt-2 list-inside list-disc space-y-1 text-red-700",children:w.map(({id:i,name:o})=>s.jsx("li",{children:s.jsx("span",{className:"font-medium",children:o})},i))})]}),e.lang&&s.jsxs("div",{className:"py-2 text-sm",children:[t("Language"),":"," ",s.jsx("span",{className:"font-medium text-gray-500",children:b.get(l.LANGUAGES,e.lang,e.lang)})]})]})]}),s.jsxs(n.DialogFooter,{children:[s.jsx(C.Button,{variant:"outline",onClick:d,children:t("Cancel")}),s.jsx(C.Button,{variant:"destructive",disabled:P,onClick:A,children:t(P?"Deleting...":"Delete")})]})]})})}exports.default=U;
|