@chaibuilder/sdk 4.0.0-beta.2 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2SSKDMRQ-C4VFVd-q.cjs → 2SSKDMRQ-CopJgtZb.cjs} +1 -1
- package/dist/{2SSKDMRQ-DSnzF_1o.js → 2SSKDMRQ-Difo_1pg.js} +2 -2
- package/dist/{AP7HFJJL-Cxwj01Aq.js → AP7HFJJL-BPuPBqj4.js} +1 -1
- package/dist/{AP7HFJJL-B7YYCY9q.cjs → AP7HFJJL-DYxDgaOs.cjs} +1 -1
- package/dist/{IconPicker-RqVvq6G2.js → IconPicker-B2-oriq2.js} +8 -7
- package/dist/IconPicker-C0oycHbs.cjs +1 -0
- package/dist/{WDYDFRGG-b3T2SQbz.cjs → WDYDFRGG-DbejaRPK.cjs} +1 -1
- package/dist/{WDYDFRGG-C7aSUcjs.js → WDYDFRGG-KK8pkcW1.js} +2 -2
- package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
- package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/active-in-another-tab-Cu_ASKtx.cjs +1 -0
- package/dist/active-in-another-tab-DkR2HWI4.js +35 -0
- package/dist/add-new-language-page-BXuwluuU.cjs +1 -0
- package/dist/{add-new-language-page-D7NDABl1.js → add-new-language-page-CBY0RR6q.js} +54 -53
- package/dist/{add-new-page-BNfwKjRd.cjs → add-new-page-C_PzKby8.cjs} +1 -1
- package/dist/{add-new-page-B4hc0B-g.js → add-new-page-DJLJFLAd.js} +2 -2
- package/dist/{ai-panel-content-BnbURb7j.js → ai-panel-content--YM01Aly.js} +12 -11
- package/dist/ai-panel-content-rRmJdH7L.cjs +1 -0
- package/dist/{ai-panel-default-lang-oVk4TDeb.js → ai-panel-default-lang-BZl0tPYo.js} +40 -40
- package/dist/{ai-panel-default-lang-3tCHzab5.cjs → ai-panel-default-lang-D2zhXvKP.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DmQ3QMDD.js → ai-panel-other-lang-Bfjk2CYZ.js} +8 -8
- package/dist/{ai-panel-other-lang-BBHCCSen.cjs → ai-panel-other-lang-Y4bEKHoG.cjs} +1 -1
- package/dist/{ai-prompt-input-DaTyfib-.js → ai-prompt-input-DueQYNf-.js} +68 -67
- package/dist/ai-prompt-input-N9PcYCFa.cjs +1 -0
- package/dist/{ai-translation-prompt-DJPe2O-n.js → ai-translation-prompt-B36F3d7K.js} +2 -2
- package/dist/ai-translation-prompt-IAdWMNZb.cjs +1 -0
- package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
- package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
- package/dist/{code-display-BzBq5xSn.js → code-display-Ck81Id9K.js} +1 -1
- package/dist/code-display-DloSPyPr.cjs +1 -0
- package/dist/{code-editor-DWWnphW9.js → code-editor-Bb7JumZy.js} +11 -10
- package/dist/code-editor-DQB8lAOk.cjs +1 -0
- package/dist/{continue-editing-in-this-client-BllU94XG.js → continue-editing-in-this-client-Dm9cCj7K.js} +10 -9
- package/dist/continue-editing-in-this-client-DmGFLHXw.cjs +1 -0
- package/dist/core-Dr7QYemB.js +56 -0
- package/dist/core-Y0lXLwkq.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +41 -39
- package/dist/{css-import-modal-D72a-16X.js → css-import-modal-9P_0uNa4.js} +4 -3
- package/dist/css-import-modal-Rh1QAVxo.cjs +13 -0
- package/dist/{delete-design-token-D_TLlO3I.cjs → delete-design-token-BG8yHcS5.cjs} +1 -1
- package/dist/{delete-design-token-Cd1ZDtqT.js → delete-design-token-COvR4G1S.js} +1 -1
- package/dist/{delete-page-DC8pzvWW.js → delete-page-CNucxe4P.js} +11 -10
- package/dist/delete-page-DAvEjHwF.cjs +1 -0
- package/dist/design-token-usage-CXglXgcJ.cjs +1 -0
- package/dist/{design-token-usage-DE4XCDdn.js → design-token-usage-MNYsFlPG.js} +14 -13
- package/dist/digital-asset-manager-CB5MRBcW.cjs +1 -0
- package/dist/{digital-asset-manager-C_gL_0YY.js → digital-asset-manager-CqCWBO0s.js} +6 -5
- package/dist/{duplicate-page-BoVhko2q.js → duplicate-page-BknLfqr0.js} +19 -18
- package/dist/duplicate-page-DzZByALW.cjs +1 -0
- package/dist/{dynamic-page-selector-CSndg2-y.js → dynamic-page-selector-DoW7OyUB.js} +15 -14
- package/dist/dynamic-page-selector-WA007Sni.cjs +1 -0
- package/dist/get-chai-builder-tailwind-config-BFePCEIS.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-BXf_xLHk.js} +5 -5
- package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
- package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
- package/dist/{image-editor-oypq8asR.js → image-editor-CQnNtak2.js} +1 -1
- package/dist/{image-editor-DTspjj_c.cjs → image-editor-CqwaVxO2.cjs} +1 -1
- package/dist/index-C0-pgg_p.cjs +5 -0
- package/dist/index-C99FhuF1.cjs +160 -0
- package/dist/{index-BDnwJqMw.js → index-Dno42B0a.js} +716 -714
- package/dist/{index-S8ibZk9Q.js → index-rAcNbjk_.js} +3744 -3920
- package/dist/{json-diff-viewer-XX1pgabt.cjs → json-diff-viewer-CLuUHiPU.cjs} +3 -3
- package/dist/{json-diff-viewer-B5dr-Y_L.js → json-diff-viewer-CMvGUvJ2.js} +5 -4
- package/dist/{lang-panel-Cn83SRzd.js → lang-panel-CnwTb05j.js} +15 -14
- package/dist/lang-panel-fDCYm5Jm.cjs +1 -0
- package/dist/{manage-design-tokens-lP4HLS0P.js → manage-design-tokens-BsSZE9Vs.js} +12 -11
- package/dist/manage-design-tokens-BvH5KTJX.cjs +1 -0
- package/dist/mark-as-template-CpWEBJGd.cjs +1 -0
- package/dist/{mark-as-template-jncsjfHm.js → mark-as-template-DBLshWb5.js} +17 -16
- package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-6OBJ8LG8.js} +24 -23
- package/dist/nested-path-selector-content-C2sD9dkq.cjs +1 -0
- package/dist/no-language-page-content-BvPDdccK.cjs +1 -0
- package/dist/{no-language-page-content-D_zd9Rb0.js → no-language-page-content-CzENgtnu.js} +10 -9
- package/dist/{no-language-page-dialog-C5Ps6YYL.js → no-language-page-dialog-CbYI2cVg.js} +2 -2
- package/dist/{no-language-page-dialog-fXmbQO7L.cjs → no-language-page-dialog-CgW4yJBC.cjs} +1 -1
- package/dist/{page-creator-wCMtlE6Z.js → page-creator-Cc83uQqw.js} +113 -112
- package/dist/page-creator-g8GqgcKH.cjs +1 -0
- package/dist/{page-lock-BPCxfv9J.js → page-lock-BJUkyxdh.js} +2 -2
- package/dist/{page-lock-DweiYy1w.cjs → page-lock-CT7SmQqp.cjs} +1 -1
- package/dist/page-locked-dialog-Co5b9XIZ.cjs +1 -0
- package/dist/{page-locked-dialog-ByGl18_m.js → page-locked-dialog-DsEbWRed.js} +18 -15
- package/dist/{page-manager-new-BWFE-S-O.js → page-manager-new-5rFP5DyQ.js} +30 -29
- package/dist/page-manager-new-BOkJImo2.cjs +1 -0
- package/dist/page-manager-search-and-filter-Bfm0j1gg.cjs +1 -0
- package/dist/{page-manager-search-and-filter-kNJFWJ86.js → page-manager-search-and-filter-zq-LfhQ1.js} +13 -12
- package/dist/{page-revisions-content-Ulr8slUN.js → page-revisions-content-D38G2tJM.js} +34 -31
- package/dist/page-revisions-content-ag-MHBGr.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +22 -23
- package/dist/pages.js +12 -12
- package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
- package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
- package/dist/publish-pages-content-BiX-GMLw.cjs +1 -0
- package/dist/{publish-pages-content-BTPzt_m4.js → publish-pages-content-CS7f41Ac.js} +66 -65
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
- package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -2
- package/dist/render.js +87 -80
- package/dist/rte-widget-modal-BKNx2wln.cjs +1 -0
- package/dist/{rte-widget-modal-Rk_NW3KU.js → rte-widget-modal-D6Zik0Ta.js} +15 -14
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +168 -4
- package/dist/runtime.js +68 -38
- package/dist/{save-to-lib-BK3uTFss.js → save-to-lib-WwOzbgiF.js} +39 -38
- package/dist/save-to-lib-ffjCZYJ5.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CU3TwIMA.js → selected-block-display-B1SG_UXw.js} +37 -36
- package/dist/selected-block-display-BOgnQRLF.cjs +16 -0
- package/dist/{seo-panel-jbzxFioc.js → seo-panel-BkOgRoWd.js} +12 -11
- package/dist/seo-panel-FjS1UF_y.cjs +2 -0
- package/dist/{shared-json-ld-BL_dv3_q.js → shared-json-ld-uka9TOgA.js} +68 -67
- package/dist/shared-json-ld-yJkXjENy.cjs +1 -0
- package/dist/slug-input-Cyd6NR6J.cjs +1 -0
- package/dist/{slug-input-1qwKkXhA.js → slug-input-DHLmUNrH.js} +9 -8
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-DKvKi3mM.js → take-over-request-Ca0X-qyf.js} +17 -16
- package/dist/take-over-request-CmpJVe9T.cjs +1 -0
- package/dist/{theme-panel-footer-DbMDLYGI.js → theme-panel-footer-BUXIu252.js} +11 -10
- package/dist/theme-panel-footer-CKO9YYwZ.cjs +1 -0
- package/dist/{translation-warning-modal-9wTwIy_9.js → translation-warning-modal-DrpFeI83.js} +9 -8
- package/dist/translation-warning-modal-pSZVKcNW.cjs +1 -0
- package/dist/{unmark-as-template-Dulvf7Zw.js → unmark-as-template-BMqgelv-.js} +11 -10
- package/dist/unmark-as-template-DF1Ms4VN.cjs +1 -0
- package/dist/unpublish-page-BJ0Bsvt2.js +28 -0
- package/dist/unpublish-page-Bsq2yEqQ.cjs +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +5 -5
- package/dist/{web-preview-DXE4Jnf5.js → web-preview-D6h1L2nV.js} +2 -2
- package/dist/web-preview-kres0aG7.cjs +1 -0
- package/package.json +4 -2
- package/dist/IconPicker-C9-ieDWm.cjs +0 -1
- package/dist/active-in-another-tab-Clng6zpY.cjs +0 -1
- package/dist/active-in-another-tab-wb8qolB8.js +0 -34
- package/dist/add-new-language-page-C4BuMTaN.cjs +0 -1
- package/dist/ai-panel-content-DPy2jgKw.cjs +0 -1
- package/dist/ai-prompt-input-b5ty81RB.cjs +0 -1
- package/dist/ai-translation-prompt-c0Q3zkT2.cjs +0 -1
- package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
- package/dist/code-display-Q3_sK_Ta.cjs +0 -1
- package/dist/code-editor-BQZi6-FB.cjs +0 -1
- package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +0 -1
- package/dist/core-BoRDjj4h.cjs +0 -1
- package/dist/core-yvI6kCyw.js +0 -56
- package/dist/css-import-modal-BSMGKA2T.cjs +0 -13
- package/dist/delete-page-ByQwBupJ.cjs +0 -1
- package/dist/design-token-usage-BqZeR1sT.cjs +0 -1
- package/dist/digital-asset-manager-BYLKFEYi.cjs +0 -1
- package/dist/duplicate-page-vdvwLQLo.cjs +0 -1
- package/dist/dynamic-page-selector-DdnbCuQZ.cjs +0 -1
- package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
- package/dist/index-CbwxUFy_.cjs +0 -5
- package/dist/index-CnSjWE1P.cjs +0 -160
- package/dist/lang-panel-BPxex-M2.cjs +0 -1
- package/dist/manage-design-tokens-ConiyuPr.cjs +0 -1
- package/dist/mark-as-template-DYRxre1f.cjs +0 -1
- package/dist/nested-path-selector-content-BYtLi7mC.cjs +0 -1
- package/dist/no-language-page-content-DAbLq0gX.cjs +0 -1
- package/dist/page-creator-VWIB2VAs.cjs +0 -1
- package/dist/page-locked-dialog-BlbgvaG2.cjs +0 -1
- package/dist/page-manager-new-D0lGfNnS.cjs +0 -1
- package/dist/page-manager-search-and-filter-DpGMoOII.cjs +0 -1
- package/dist/page-revisions-content-DYxXZqmh.cjs +0 -1
- package/dist/publish-pages-content-D6g8GAsd.cjs +0 -1
- package/dist/rte-widget-modal-DrMzWWjw.cjs +0 -1
- package/dist/save-to-lib-DHHUO12i.cjs +0 -1
- package/dist/selected-block-display-DSFhddPj.cjs +0 -16
- package/dist/seo-panel-Dl0IDV09.cjs +0 -2
- package/dist/shared-json-ld-DPNkqDC1.cjs +0 -1
- package/dist/slug-input-YVLjtTI3.cjs +0 -1
- package/dist/take-over-request-DvMIg_cZ.cjs +0 -1
- package/dist/theme-panel-footer-BMOaPLWc.cjs +0 -1
- package/dist/translation-warning-modal-DjTwz75c.cjs +0 -1
- package/dist/unmark-as-template-CdqIJJER.cjs +0 -1
- package/dist/unpublish-page-BwSVBf0_.cjs +0 -1
- package/dist/unpublish-page-Degu5Cy9.js +0 -27
- package/dist/web-preview-YzKxyXft.cjs +0 -1
|
@@ -1,122 +1,123 @@
|
|
|
1
|
-
import { jsxs as n, jsx as t, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ar as X, as as Y, A as I, aA as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { B as L } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { d as K, e as Q, f as J, p as V, q as W } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-Dno42B0a.js";
|
|
5
|
+
import { LanguageSelector as ae } from "./page-manager-search-and-filter-zq-LfhQ1.js";
|
|
6
|
+
import { useQuery as ne } from "@tanstack/react-query";
|
|
7
|
+
import { find as B, filter as a, map as b, keys as re, get as F, includes as C, orderBy as N, isEmpty as oe, uniq as G, first as ce, concat as ie } from "lodash-es";
|
|
8
|
+
import { Lock as de, GlobeIcon as ue, File as me, Edit as he } from "lucide-react";
|
|
9
|
+
import { useState as D, useCallback as pe, useMemo as g, useEffect as j, startTransition as q } from "react";
|
|
9
10
|
const ge = () => {
|
|
10
11
|
const s = X(), d = Y();
|
|
11
|
-
return
|
|
12
|
+
return ne({
|
|
12
13
|
queryKey: [I.GET_CHANGES],
|
|
13
14
|
queryFn: async () => d(s, { action: I.GET_CHANGES })
|
|
14
15
|
});
|
|
15
|
-
},
|
|
16
|
-
const u =
|
|
16
|
+
}, fe = ({ page: s, selectedPages: d, handleCheckboxChange: k, getPageType: f, hasSlug: m, currentOwnerId: r }) => {
|
|
17
|
+
const u = O(), { data: i } = se(r), o = r === u ? null : i == null ? void 0 : i.name;
|
|
17
18
|
return /* @__PURE__ */ n("tr", { className: "group relative border-b last:border-b-0 hover:bg-gray-50", children: [
|
|
18
19
|
/* @__PURE__ */ n(
|
|
19
20
|
"td",
|
|
20
21
|
{
|
|
21
22
|
scope: "row",
|
|
22
|
-
className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${
|
|
23
|
+
className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o ? "opacity-50" : ""}`,
|
|
23
24
|
children: [
|
|
24
|
-
|
|
25
|
+
o ? /* @__PURE__ */ t(de, { className: "h-4 w-4 fill-red-200 text-red-500" }) : /* @__PURE__ */ t(
|
|
25
26
|
"input",
|
|
26
27
|
{
|
|
27
28
|
checked: C(d, s == null ? void 0 : s.id),
|
|
28
|
-
onClick: (
|
|
29
|
-
|
|
29
|
+
onClick: (x) => {
|
|
30
|
+
x.stopPropagation(), k(s == null ? void 0 : s.id);
|
|
30
31
|
},
|
|
31
32
|
type: "checkbox",
|
|
32
33
|
className: "cursor-pointer rounded focus:outline-none focus:ring-0"
|
|
33
34
|
}
|
|
34
35
|
),
|
|
35
36
|
" ",
|
|
36
|
-
|
|
37
|
+
m(s.pageType) ? /* @__PURE__ */ t(me, { className: "h-4 w-4" }) : /* @__PURE__ */ t(ue, { className: "h-4 w-4" }),
|
|
37
38
|
/* @__PURE__ */ t(U, { content: s.name, side: "top", showTooltip: s.name.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-medium text-black", children: s.name }) }),
|
|
38
39
|
s.slug && /* @__PURE__ */ t(U, { content: s.slug, side: "top", showTooltip: s.slug.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-mono text-xs text-muted-foreground", children: s.slug }) })
|
|
39
40
|
]
|
|
40
41
|
}
|
|
41
42
|
),
|
|
42
|
-
/* @__PURE__ */ t("td", { className: "px-2", children:
|
|
43
|
+
/* @__PURE__ */ t("td", { className: "px-2", children: f(s == null ? void 0 : s.pageType) }),
|
|
43
44
|
/* @__PURE__ */ t("td", { className: "px-4 text-right", children: ce(s.changes) || "" }),
|
|
44
|
-
/* @__PURE__ */ t(
|
|
45
|
+
/* @__PURE__ */ t($, { children: o && /* @__PURE__ */ n("button", { className: "absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
|
|
45
46
|
/* @__PURE__ */ t(he, { size: 12, className: "stroke-[3]" }),
|
|
46
47
|
" ",
|
|
47
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
48
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: o }),
|
|
48
49
|
" is editing this page"
|
|
49
50
|
] }) })
|
|
50
51
|
] }, s == null ? void 0 : s.id);
|
|
51
|
-
},
|
|
52
|
+
}, ve = ({
|
|
52
53
|
onClose: s = () => {
|
|
53
54
|
},
|
|
54
55
|
isPending: d,
|
|
55
56
|
publishPage: k
|
|
56
57
|
}) => {
|
|
57
|
-
const
|
|
58
|
+
const f = O(), { pageToUser: m } = Z(), [r, u] = D([]), i = ee(), [o, x] = D(i), { data: w, isFetching: v } = ge(), { data: h } = te(), T = pe((e) => {
|
|
58
59
|
var l;
|
|
59
|
-
return (l = B(
|
|
60
|
-
}, [
|
|
61
|
-
() => a(
|
|
62
|
-
[T,
|
|
63
|
-
), E = G(b(w, "lang")).filter(Boolean),
|
|
64
|
-
() => a(w, (e) => e.pageType === "theme" ? !1 :
|
|
65
|
-
[w,
|
|
66
|
-
), S =
|
|
67
|
-
() => a(
|
|
68
|
-
[
|
|
69
|
-
), P =
|
|
70
|
-
() => a(
|
|
71
|
-
[
|
|
60
|
+
return (l = B(h, { key: e })) == null ? void 0 : l.hasSlug;
|
|
61
|
+
}, [h]), y = g(
|
|
62
|
+
() => a(h, (e) => !T(e.key)).map((e) => e.key),
|
|
63
|
+
[T, h]
|
|
64
|
+
), E = G(b(w, "lang")).filter(Boolean), c = g(
|
|
65
|
+
() => a(w, (e) => e.pageType === "theme" ? !1 : o === i ? e.lang === o || e.lang === "" : e.lang === o),
|
|
66
|
+
[w, o, i]
|
|
67
|
+
), S = g(
|
|
68
|
+
() => a(c, (e) => !y.includes(e.pageType)),
|
|
69
|
+
[c, y]
|
|
70
|
+
), P = g(
|
|
71
|
+
() => a(c, (e) => y.includes(e.pageType)),
|
|
72
|
+
[c, y]
|
|
72
73
|
);
|
|
73
74
|
j(() => {
|
|
74
|
-
const e = b(a(
|
|
75
|
-
u(e);
|
|
76
|
-
}, [
|
|
77
|
-
const e = a(
|
|
78
|
-
u((l) => a(l, (
|
|
79
|
-
}, [
|
|
80
|
-
const A = r.length === (
|
|
81
|
-
u((l) => C(l, e) ? a(l, (
|
|
82
|
-
}, H = () => {
|
|
83
|
-
u(A ? [] : b(o, "id"));
|
|
75
|
+
const e = b(a(c, { online: !0 }), "id");
|
|
76
|
+
q(() => u(e));
|
|
77
|
+
}, [c]), j(() => {
|
|
78
|
+
const e = a(re(m), (l) => F(m, [l, "userId"]) !== f);
|
|
79
|
+
q(() => u((l) => a(l, (p) => !C(e, p))));
|
|
80
|
+
}, [m, f]);
|
|
81
|
+
const A = r.length === (c == null ? void 0 : c.length), H = (e) => {
|
|
82
|
+
u((l) => C(l, e) ? a(l, (p) => p !== e) : ie(l, e));
|
|
84
83
|
}, z = () => {
|
|
84
|
+
u(A ? [] : b(c, "id"));
|
|
85
|
+
}, M = () => {
|
|
85
86
|
k(
|
|
86
87
|
{ ids: G(r) },
|
|
87
88
|
{
|
|
88
89
|
onSuccess: () => {
|
|
89
|
-
s(), le("CENTER_CENTER"),
|
|
90
|
+
s(), le("CENTER_CENTER"), x(i);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
|
-
},
|
|
94
|
+
}, R = (e) => {
|
|
94
95
|
if (e === "theme") return "Theme";
|
|
95
|
-
const l = B(
|
|
96
|
+
const l = B(h, { key: e });
|
|
96
97
|
return l ? l == null ? void 0 : l.name : e;
|
|
97
|
-
},
|
|
98
|
+
}, _ = g(() => {
|
|
98
99
|
const e = [
|
|
99
100
|
{ label: "Updated", top: "pt-2" },
|
|
100
101
|
...N(a(S, { online: !0 }), "pageType"),
|
|
101
102
|
...N(a(P, { online: !0 }), "pageType")
|
|
102
|
-
].filter((
|
|
103
|
+
].filter((p) => p.pageType !== "theme"), l = [
|
|
103
104
|
{ label: "Offline", top: "pt-6" },
|
|
104
105
|
...N(a(S, { online: !1 }), "pageType"),
|
|
105
106
|
...N(a(P, { online: !1 }), "pageType")
|
|
106
107
|
];
|
|
107
108
|
return [...e, ...l];
|
|
108
109
|
}, [S, P]);
|
|
109
|
-
return /* @__PURE__ */ n(
|
|
110
|
-
/* @__PURE__ */ n(
|
|
111
|
-
/* @__PURE__ */ t(
|
|
112
|
-
/* @__PURE__ */ t(
|
|
110
|
+
return /* @__PURE__ */ n(K, { className: "flex max-h-[80%] max-w-4xl flex-col", children: [
|
|
111
|
+
/* @__PURE__ */ n(Q, { children: [
|
|
112
|
+
/* @__PURE__ */ t(J, { children: "Publish changes" }),
|
|
113
|
+
/* @__PURE__ */ t(V, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
|
|
113
114
|
] }),
|
|
114
115
|
E.length > 0 && /* @__PURE__ */ t("div", { className: "my-[2px] mt-0", children: /* @__PURE__ */ t(
|
|
115
|
-
|
|
116
|
+
ae,
|
|
116
117
|
{
|
|
117
118
|
languages: [i, ...E],
|
|
118
|
-
selectedLanguage:
|
|
119
|
-
setSelectedLanguage:
|
|
119
|
+
selectedLanguage: o,
|
|
120
|
+
setSelectedLanguage: x
|
|
120
121
|
}
|
|
121
122
|
) }),
|
|
122
123
|
/* @__PURE__ */ t("div", { className: "no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto", children: v ? /* @__PURE__ */ n("div", { className: "space-y-2 px-1", children: [
|
|
@@ -132,7 +133,7 @@ const ge = () => {
|
|
|
132
133
|
{
|
|
133
134
|
checked: A,
|
|
134
135
|
onClick: (e) => {
|
|
135
|
-
e.stopPropagation(),
|
|
136
|
+
e.stopPropagation(), z();
|
|
136
137
|
},
|
|
137
138
|
type: "checkbox",
|
|
138
139
|
className: "mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"
|
|
@@ -144,24 +145,24 @@ const ge = () => {
|
|
|
144
145
|
/* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-4 py-3 text-right", children: "Status" })
|
|
145
146
|
] }) }),
|
|
146
147
|
/* @__PURE__ */ t("tbody", { children: b(
|
|
147
|
-
|
|
148
|
+
_,
|
|
148
149
|
(e) => e.label ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ n("td", { colSpan: 3, className: `relative px-6 py-2 text-xs font-medium text-gray-800 ${e.top}`, children: [
|
|
149
150
|
/* @__PURE__ */ t("div", { className: "absolute inset-0 left-6 flex items-center", children: /* @__PURE__ */ t("div", { className: "order-gray-300 w-full" }) }),
|
|
150
151
|
/* @__PURE__ */ t("div", { className: "relative flex justify-start", children: /* @__PURE__ */ t("span", { className: "bg-gray-50 pr-2", children: e.label }) })
|
|
151
152
|
] }) }, "separator") : /* @__PURE__ */ t(
|
|
152
|
-
|
|
153
|
+
fe,
|
|
153
154
|
{
|
|
154
155
|
page: e,
|
|
155
156
|
selectedPages: r,
|
|
156
|
-
handleCheckboxChange:
|
|
157
|
-
getPageType:
|
|
157
|
+
handleCheckboxChange: H,
|
|
158
|
+
getPageType: R,
|
|
158
159
|
hasSlug: T,
|
|
159
|
-
currentOwnerId: F(
|
|
160
|
+
currentOwnerId: F(m, [(e == null ? void 0 : e.primaryPage) || (e == null ? void 0 : e.id), "userId"])
|
|
160
161
|
}
|
|
161
162
|
)
|
|
162
163
|
) })
|
|
163
164
|
] }) }),
|
|
164
|
-
/* @__PURE__ */ n(
|
|
165
|
+
/* @__PURE__ */ n(W, { className: "mt-10 flex items-center justify-center", children: [
|
|
165
166
|
r.length > 0 && /* @__PURE__ */ n("span", { className: "text-center text-sm text-muted-foreground", children: [
|
|
166
167
|
r.length,
|
|
167
168
|
" Page",
|
|
@@ -169,10 +170,10 @@ const ge = () => {
|
|
|
169
170
|
" Selected"
|
|
170
171
|
] }),
|
|
171
172
|
/* @__PURE__ */ t(L, { disabled: d, variant: "outline", onClick: s, children: "Cancel" }),
|
|
172
|
-
/* @__PURE__ */ t(L, { disabled: d || v ||
|
|
173
|
+
/* @__PURE__ */ t(L, { disabled: d || v || oe(r), onClick: M, children: d ? "Publishing..." : "Publish Selected" })
|
|
173
174
|
] })
|
|
174
175
|
] });
|
|
175
176
|
};
|
|
176
177
|
export {
|
|
177
|
-
|
|
178
|
+
ve as default
|
|
178
179
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("lodash-es"),n=require("react"),B=require("jotai"),P=require("jotai/utils"),s=require("react/jsx-runtime"),L=require("class-variance-authority"),D=require("clsx"),q=require("tailwind-merge"),H=require("@radix-ui/react-slot"),V=require("@radix-ui/react-icons"),U=require("react-i18next");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=$(n);function o(...e){return q.twMerge(D.clsx(e))}const d={},z=(e,t)=>{d[e]={id:e,component:t,type:"widget"}},G=(e,t)=>{d[e]={id:e,component:t,type:"field"}},W=(e,t)=>{d[e]={id:e,component:t,type:"template"}},J=e=>Object.values(d).filter(t=>t.type===e).reduce((t,r)=>(t[r.id]=r.component,t),{}),p={},K=(e,t)=>{i.has(p,e)&&console.warn(`Add block tab with id ${e} already registered`),i.set(p,e,{id:e,...t})},X=()=>n.useMemo(()=>i.values(p),[]),m={},M=(e,t)=>{if(m[e])throw new Error(`Flag ${e} already exists`);m[e]={key:e,value:!1,...t}},Y=e=>{Object.entries(e).forEach(([t,r])=>{if(m[t])throw new Error(`Flag ${t} already exists`);M(t,r)})},Q=()=>m,_=P.atomWithStorage("chai-feature-flags",[]),j=e=>{const[t]=B.useAtom(_);return t.includes(e)},Z=e=>{const[t,r]=B.useAtom(_);return()=>{t.includes(e)?r(t.filter(l=>l!==e)):r([...t,e])}},ee=({flagKey:e,children:t})=>j(e)?t:null;let y={};const te=(e,t)=>{y[e]={...t,id:e}},re=e=>y[e],se=()=>i.values(y),ae=L.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),S=u.forwardRef(({className:e,variant:t,...r},a)=>s.jsx("div",{ref:a,role:"alert",className:o(ae({variant:t}),e),...r}));S.displayName="Alert";const ne=u.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:o("mb-1 font-medium leading-none tracking-tight",e),...t}));ne.displayName="AlertTitle";const T=u.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:o("text-sm [&_p]:leading-relaxed",e),...t}));T.displayName="AlertDescription";const E=L.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),v=u.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...l},b)=>{const g=a?H.Slot:"button";return s.jsx(g,{className:o(E({variant:t,size:r,className:e})),ref:b,...l})});v.displayName="Button";const A=u.forwardRef(({className:e,type:t,...r},a)=>s.jsx("input",{type:t,className:o("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...r}));A.displayName="Input";const ie=({close:e,onSelect:t,mode:r="image"})=>{const[a,l]=n.useState(""),[b,g]=n.useState(!1),[k,x]=n.useState(!1),[w,f]=n.useState(null),O=async C=>{if(!C.trim()){x(!1),f("Please enter a URL");return}try{g(!0),f(null),x(!0),f(null)}catch{x(!1),f("Error validating URL")}finally{g(!1)}},{t:h}=U.useTranslation();return s.jsxs("div",{className:"flex w-96 flex-col gap-4 p-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:h(`${r.charAt(0).toUpperCase()+r.slice(1)} Manager`)}),w&&s.jsxs(S,{variant:"destructive",children:[s.jsx(V.ExclamationTriangleIcon,{className:"h-4 w-4"}),s.jsx(T,{children:w})]}),s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(A,{placeholder:h(`Enter ${r} URL`),value:a,onChange:C=>l(C.target.value),onKeyUp:()=>O(a)}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(v,{variant:"outline",onClick:e,children:h("Cancel")}),s.jsx(v,{onClick:()=>t({id:"dam-id",url:a,width:600,height:400,description:"This is image description"}),disabled:!k||b,children:h("Insert")})]})]})]})},I={component:ie},oe=e=>{I.component=e},le=()=>n.useMemo(()=>I.component,[]);let N=async e=>e;const ce=e=>{N=e},ue=async e=>await N(e);let F=null;const de=e=>{F=e},ge=()=>n.useMemo(()=>F,[]),fe=()=>{F=null},c={},he=(e,t)=>{i.has(c,e)&&console.warn(`Panel ${e} already registered. Overriding...`),i.set(c,e,{id:e,...t})},pe=e=>n.useMemo(()=>i.filter(i.values(c),t=>t.position===e),[e,c]),me=()=>s.jsx("div",{}),R={component:me},ve=e=>{R.component=e},be=()=>n.useMemo(()=>R.component,[]);exports.ADD_BLOCK_TABS=p;exports.Alert=S;exports.AlertDescription=T;exports.Button=v;exports.CHAI_BUILDER_PANELS=c;exports.IfChaiFeatureFlag=ee;exports.Input=A;exports.RJSF_EXTENSIONS=d;exports.buttonVariants=E;exports.cn=o;exports.getChaiLibrary=re;exports.getPreImportHTML=ue;exports.registerBlockSettingField=G;exports.registerBlockSettingTemplate=W;exports.registerBlockSettingWidget=z;exports.registerChaiAddBlockTab=K;exports.registerChaiFeatureFlag=M;exports.registerChaiFeatureFlags=Y;exports.registerChaiLibrary=te;exports.registerChaiMediaManager=oe;exports.registerChaiPreImportHTMLHook=ce;exports.registerChaiSaveToLibrary=de;exports.registerChaiSidebarPanel=he;exports.registerChaiTopBar=ve;exports.resetSaveToLibrary=fe;exports.useBlockSettingComponents=J;exports.useChaiAddBlockTabs=X;exports.useChaiFeatureFlag=j;exports.useChaiFeatureFlags=Q;exports.useChaiLibraries=se;exports.useChaiSidebarPanels=pe;exports.useMediaManagerComponent=le;exports.useSaveToLibraryComponent=ge;exports.useToggleChaiFeatureFlag=Z;exports.useTopBarComponent=be;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { has as E, set as N, values as w, filter as V } from "lodash-es";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { useMemo as i, useState as u } from "react";
|
|
4
|
+
import { useAtom as R } from "jotai";
|
|
5
|
+
import { atomWithStorage as U } from "jotai/utils";
|
|
6
|
+
import { jsx as s, jsxs as g } from "react/jsx-runtime";
|
|
7
|
+
import { cva as S } from "class-variance-authority";
|
|
8
|
+
import { clsx as j } from "clsx";
|
|
9
|
+
import { twMerge as H } from "tailwind-merge";
|
|
10
|
+
import { Slot as $ } from "@radix-ui/react-slot";
|
|
11
|
+
import { ExclamationTriangleIcon as z } from "@radix-ui/react-icons";
|
|
12
|
+
import { useTranslation as G } from "react-i18next";
|
|
13
|
+
function l(...e) {
|
|
14
|
+
return H(j(e));
|
|
15
|
+
}
|
|
16
|
+
const p = {}, de = (e, t) => {
|
|
17
|
+
p[e] = {
|
|
18
|
+
id: e,
|
|
19
|
+
component: t,
|
|
20
|
+
type: "widget"
|
|
21
|
+
};
|
|
22
|
+
}, ue = (e, t) => {
|
|
23
|
+
p[e] = {
|
|
24
|
+
id: e,
|
|
25
|
+
component: t,
|
|
26
|
+
type: "field"
|
|
27
|
+
};
|
|
28
|
+
}, ge = (e, t) => {
|
|
29
|
+
p[e] = {
|
|
30
|
+
id: e,
|
|
31
|
+
component: t,
|
|
32
|
+
type: "template"
|
|
33
|
+
};
|
|
34
|
+
}, fe = (e) => Object.values(p).filter((t) => t.type === e).reduce(
|
|
35
|
+
(t, r) => (t[r.id] = r.component, t),
|
|
36
|
+
{}
|
|
37
|
+
), y = {}, me = (e, t) => {
|
|
38
|
+
E(y, e) && console.warn(`Add block tab with id ${e} already registered`), N(y, e, { id: e, ...t });
|
|
39
|
+
}, pe = () => i(() => w(y), []), f = {}, W = (e, t) => {
|
|
40
|
+
if (f[e])
|
|
41
|
+
throw new Error(`Flag ${e} already exists`);
|
|
42
|
+
f[e] = { key: e, value: !1, ...t };
|
|
43
|
+
}, he = (e) => {
|
|
44
|
+
Object.entries(e).forEach(([t, r]) => {
|
|
45
|
+
if (f[t])
|
|
46
|
+
throw new Error(`Flag ${t} already exists`);
|
|
47
|
+
W(t, r);
|
|
48
|
+
});
|
|
49
|
+
}, ve = () => f, _ = U("chai-feature-flags", []), q = (e) => {
|
|
50
|
+
const [t] = R(_);
|
|
51
|
+
return t.includes(e);
|
|
52
|
+
}, be = (e) => {
|
|
53
|
+
const [t, r] = R(_);
|
|
54
|
+
return () => {
|
|
55
|
+
t.includes(e) ? r(t.filter((n) => n !== e)) : r([...t, e]);
|
|
56
|
+
};
|
|
57
|
+
}, xe = ({ flagKey: e, children: t }) => q(e) ? t : null;
|
|
58
|
+
let A = {};
|
|
59
|
+
const ye = (e, t) => {
|
|
60
|
+
A[e] = { ...t, id: e };
|
|
61
|
+
}, Ce = (e) => A[e], we = () => w(A), J = S(
|
|
62
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
63
|
+
{
|
|
64
|
+
variants: {
|
|
65
|
+
variant: {
|
|
66
|
+
default: "bg-background text-foreground",
|
|
67
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: "default"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
), B = o.forwardRef(({ className: e, variant: t, ...r }, a) => /* @__PURE__ */ s("div", { ref: a, role: "alert", className: l(J({ variant: t }), e), ...r }));
|
|
75
|
+
B.displayName = "Alert";
|
|
76
|
+
const K = o.forwardRef(
|
|
77
|
+
({ className: e, ...t }, r) => /* @__PURE__ */ s("h5", { ref: r, className: l("mb-1 font-medium leading-none tracking-tight", e), ...t })
|
|
78
|
+
);
|
|
79
|
+
K.displayName = "AlertTitle";
|
|
80
|
+
const L = o.forwardRef(
|
|
81
|
+
({ className: e, ...t }, r) => /* @__PURE__ */ s("div", { ref: r, className: l("text-sm [&_p]:leading-relaxed", e), ...t })
|
|
82
|
+
);
|
|
83
|
+
L.displayName = "AlertDescription";
|
|
84
|
+
const X = S(
|
|
85
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
86
|
+
{
|
|
87
|
+
variants: {
|
|
88
|
+
variant: {
|
|
89
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
90
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
91
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
92
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
93
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
94
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
95
|
+
},
|
|
96
|
+
size: {
|
|
97
|
+
default: "h-9 px-4 py-2",
|
|
98
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
99
|
+
lg: "h-10 rounded-md px-8",
|
|
100
|
+
icon: "h-9 w-9"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
defaultVariants: {
|
|
104
|
+
variant: "default",
|
|
105
|
+
size: "default"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
), C = o.forwardRef(
|
|
109
|
+
({ className: e, variant: t, size: r, asChild: a = !1, ...n }, h) => /* @__PURE__ */ s(
|
|
110
|
+
a ? $ : "button",
|
|
111
|
+
{
|
|
112
|
+
className: l(X({ variant: t, size: r, className: e })),
|
|
113
|
+
ref: h,
|
|
114
|
+
...n
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
C.displayName = "Button";
|
|
119
|
+
const I = o.forwardRef(
|
|
120
|
+
({ className: e, type: t, ...r }, a) => /* @__PURE__ */ s(
|
|
121
|
+
"input",
|
|
122
|
+
{
|
|
123
|
+
type: t,
|
|
124
|
+
className: l(
|
|
125
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
126
|
+
e
|
|
127
|
+
),
|
|
128
|
+
ref: a,
|
|
129
|
+
...r
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
I.displayName = "Input";
|
|
134
|
+
const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
|
|
135
|
+
const [a, n] = u(""), [h, v] = u(!1), [P, b] = u(!1), [F, c] = u(null), D = async (x) => {
|
|
136
|
+
if (!x.trim()) {
|
|
137
|
+
b(!1), c("Please enter a URL");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
v(!0), c(null), b(!0), c(null);
|
|
142
|
+
} catch {
|
|
143
|
+
b(!1), c("Error validating URL");
|
|
144
|
+
} finally {
|
|
145
|
+
v(!1);
|
|
146
|
+
}
|
|
147
|
+
}, { t: d } = G();
|
|
148
|
+
return /* @__PURE__ */ g("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
|
|
149
|
+
/* @__PURE__ */ s("h2", { className: "text-xl font-semibold", children: d(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
|
|
150
|
+
F && /* @__PURE__ */ g(B, { variant: "destructive", children: [
|
|
151
|
+
/* @__PURE__ */ s(z, { className: "h-4 w-4" }),
|
|
152
|
+
/* @__PURE__ */ s(L, { children: F })
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ g("div", { className: "flex flex-col gap-4", children: [
|
|
155
|
+
/* @__PURE__ */ s(
|
|
156
|
+
I,
|
|
157
|
+
{
|
|
158
|
+
placeholder: d(`Enter ${r} URL`),
|
|
159
|
+
value: a,
|
|
160
|
+
onChange: (x) => n(x.target.value),
|
|
161
|
+
onKeyUp: () => D(a)
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
/* @__PURE__ */ g("div", { className: "flex justify-end gap-2", children: [
|
|
165
|
+
/* @__PURE__ */ s(C, { variant: "outline", onClick: e, children: d("Cancel") }),
|
|
166
|
+
/* @__PURE__ */ s(
|
|
167
|
+
C,
|
|
168
|
+
{
|
|
169
|
+
onClick: () => t({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
|
|
170
|
+
disabled: !P || h,
|
|
171
|
+
children: d("Insert")
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] })
|
|
175
|
+
] })
|
|
176
|
+
] });
|
|
177
|
+
}, M = {
|
|
178
|
+
component: Y
|
|
179
|
+
}, Ae = (e) => {
|
|
180
|
+
M.component = e;
|
|
181
|
+
}, Te = () => i(() => M.component, []);
|
|
182
|
+
let k = async (e) => e;
|
|
183
|
+
const Fe = (e) => {
|
|
184
|
+
k = e;
|
|
185
|
+
}, Ee = async (e) => await k(e);
|
|
186
|
+
let T = null;
|
|
187
|
+
const Ne = (e) => {
|
|
188
|
+
T = e;
|
|
189
|
+
}, Re = () => i(() => T, []), Se = () => {
|
|
190
|
+
T = null;
|
|
191
|
+
}, m = {}, _e = (e, t) => {
|
|
192
|
+
E(m, e) && console.warn(`Panel ${e} already registered. Overriding...`), N(m, e, { id: e, ...t });
|
|
193
|
+
}, Be = (e) => i(
|
|
194
|
+
() => V(w(m), (t) => t.position === e),
|
|
195
|
+
[e, m]
|
|
196
|
+
), Q = () => /* @__PURE__ */ s("div", {}), O = {
|
|
197
|
+
component: Q
|
|
198
|
+
}, Le = (e) => {
|
|
199
|
+
O.component = e;
|
|
200
|
+
}, Ie = () => i(() => O.component, []);
|
|
201
|
+
export {
|
|
202
|
+
y as A,
|
|
203
|
+
C as B,
|
|
204
|
+
m as C,
|
|
205
|
+
B as D,
|
|
206
|
+
l as E,
|
|
207
|
+
L as F,
|
|
208
|
+
X as G,
|
|
209
|
+
xe as I,
|
|
210
|
+
p as R,
|
|
211
|
+
ue as a,
|
|
212
|
+
ge as b,
|
|
213
|
+
me as c,
|
|
214
|
+
pe as d,
|
|
215
|
+
W as e,
|
|
216
|
+
he as f,
|
|
217
|
+
ve as g,
|
|
218
|
+
q as h,
|
|
219
|
+
be as i,
|
|
220
|
+
ye as j,
|
|
221
|
+
Ce as k,
|
|
222
|
+
we as l,
|
|
223
|
+
Ae as m,
|
|
224
|
+
Te as n,
|
|
225
|
+
Ee as o,
|
|
226
|
+
Fe as p,
|
|
227
|
+
Ne as q,
|
|
228
|
+
de as r,
|
|
229
|
+
Re as s,
|
|
230
|
+
Se as t,
|
|
231
|
+
fe as u,
|
|
232
|
+
_e as v,
|
|
233
|
+
Be as w,
|
|
234
|
+
Le as x,
|
|
235
|
+
Ie as y,
|
|
236
|
+
I as z
|
|
237
|
+
};
|
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./plugin-BGlQf0iy.cjs"),d=require("./apply-binding-IsUf6UWJ.cjs"),m=require("react/jsx-runtime"),t=require("lodash-es"),g=require("react"),b=require("./core-Y0lXLwkq.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),j=require("@tailwindcss/aspect-ratio"),q=require("@tailwindcss/container-queries"),K=require("@tailwindcss/forms"),M=require("@tailwindcss/typography"),L=require("./get-chai-builder-theme-BApShjRz.cjs");async function O(e){const a={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},n=await e.dataProvider(a);return t.has(n,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,n.$metadata),e.children({...t.omit(n,"$metadata")})}const N=()=>m.jsx("div",{}),H=e=>{const{block:a,lang:n,fallbackLang:s,children:i,externalData:l,blocks:o,draft:r,pageProps:c,dataProviderMetadataCallback:f}=e,u=b.getRegisteredChaiBlock(a._type),p=t.get(u,"component",null),_=t.get(e.repeaterData,"index",-1),k=t.get(e.repeaterData,"dataKey",""),w=n===s?"":n??"",y=d.applyBindingToBlockProps(d.applyLanguage(a,w,u),l??{},{index:_,key:k}),h=d.getBlockTagAttributes(a,!1),I=D(o,a._id,d.getBlockRuntimeProps(a._type)),T=t.has(u,"dataProvider")&&t.isFunction(u.dataProvider),B={...y,...h,...I},P={blockProps:{},inBuilder:!1,lang:n||s||"en",draft:r??!1,pageData:l??{},...B},v=t.get(B,"_show",!0);if(t.isNull(p)||!v)return null;if(T){const S=t.get(u,"suspenseFallback",N);return m.jsx(g.Suspense,{fallback:g.createElement(S),children:m.jsx(O,{lang:n??"",pageProps:c,block:B,dataProvider:u.dataProvider,...f?{dataProviderMetadataCallback:f}:{},draft:r??!1,children:$=>g.createElement(p,{...P,...$,children:i({_id:a._id,_type:a._type,...t.isArray(y.repeaterItems)?{repeaterItems:d.applyLimit(y.repeaterItems,a),$repeaterItemsKey:y.$repeaterItemsKey,repeaterTotalItems:y.repeaterTotalItems??-1}:{}})})})})}return m.jsx(g.Suspense,{children:g.createElement(p,{...P,children:i({_id:a._id,_type:a._type,...t.isArray(y.repeaterItems)?{repeaterItems:d.applyLimit(y.repeaterItems,a),$repeaterItemsKey:y.$repeaterItemsKey,repeaterTotalItems:y.repeaterTotalItems??-1}:{}})})})},x=e=>{const{blocks:a,parent:n,repeaterData:s,type:i}=e;let l=t.uniqBy(t.filter(a,r=>t.has(r,"_id")&&(t.isEmpty(n)?!r._parent:r._parent===n)),"_id");const o=r=>t.filter(a,c=>c._parent===r).length>0;return(i==="Heading"||i==="Paragraph"||i==="Link"||i==="Span")&&(l=d.adjustSpacingInContentBlocks(l)),t.map(l,r=>r?g.createElement(H,{...e,key:r._id,block:r},({_id:c,_type:f,repeaterItems:u,$repeaterItemsKey:p})=>f==="Repeater"?t.isArray(u)&&u.map((_,k)=>g.createElement(x,{...e,parent:r._id,key:`${t.get(r,"_parent","root")}-${r._id}-${k}`,repeaterData:{index:k,dataKey:p}})):o(c)?g.createElement(x,{...e,parent:r._id,key:`${t.get(r,"_parent","root")}-${r._id}`,repeaterData:s,type:r._type}):null):null)},D=(e,a,n)=>t.isEmpty(n)?{}:Object.entries(n).reduce((s,[i,l])=>{const o=[];let r=t.find(e,{_id:a});for(;r;)o.push(r),r=t.find(e,{_id:r._parent});const c=t.find(o,{_type:l.block});return c&&(s[i]=t.get(c,t.get(l,"prop"),null)),s},{});function J(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const a=e.lang??"en",n=e.fallbackLang??a;return m.jsx(x,{...e,lang:a,fallbackLang:n})}async function V(e){const a=await e.dataProvider;return t.has(a,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,a.$metadata),e.children({...t.omit(a,"$metadata")})}const W=()=>m.jsx("div",{}),U=async e=>{const{block:a,lang:n,fallbackLang:s,children:i,externalData:l,blocks:o,draft:r,pageProps:c,dataProviderMetadataCallback:f,dataProviders:u}=e,p=b.getRegisteredChaiBlock(a._type),_=t.get(p,"component",null),k=t.get(e.repeaterData,"index",-1),w=t.get(e.repeaterData,"dataKey",""),y=n===s?"":n??"en",h=d.applyBindingToBlockProps(d.applyLanguage(a,y,p),l??{},{index:k,key:w}),I=d.getBlockTagAttributes(a,!1),T=D(o,a._id,d.getBlockRuntimeProps(a._type)),B=t.has(p,"dataProvider")&&t.isFunction(p.dataProvider),P={...h,...I,...T},v={blockProps:{},inBuilder:!1,lang:n||s||"en",draft:r??!1,pageData:l??{},...P},S=t.get(P,"_show",!0);if(t.isNull(_)||!S)return null;if(B){const $=t.get(u,a._id,Promise.resolve({})),R=t.get(p,"suspenseFallback",W);return m.jsx(g.Suspense,{fallback:g.createElement(R),children:m.jsx(V,{lang:n??"",pageProps:c,block:P,dataProvider:$,...f?{dataProviderMetadataCallback:f}:{},draft:r??!1,children:A=>g.createElement(_,{...v,...A,children:i({_id:a._id,_type:a._type,...t.isArray(h.repeaterItems)?{repeaterItems:d.applyLimit(h.repeaterItems,a),$repeaterItemsKey:h.$repeaterItemsKey,repeaterTotalItems:h.repeaterTotalItems??-1}:{}})})})})}return g.createElement(_,{...v,children:i({_id:a._id,_type:a._type,...t.isArray(h.repeaterItems)?{repeaterItems:d.applyLimit(h.repeaterItems,a),$repeaterItemsKey:h.$repeaterItemsKey,repeaterTotalItems:h.repeaterTotalItems??-1}:{}})})},C=async e=>{const{blocks:a,parent:n,repeaterData:s,type:i}=e;let l=t.uniqBy(t.filter(a,r=>t.has(r,"_id")&&(t.isEmpty(n)?!r._parent:r._parent===n)),"_id");const o=r=>t.filter(a,c=>c._parent===r).length>0;return(i==="Heading"||i==="Paragraph"||i==="Link")&&(l=d.adjustSpacingInContentBlocks(l)),t.map(l,r=>r?g.createElement(U,{...e,dataProviders:e.dataProviders,key:r._id,block:r},({_id:c,_type:f,repeaterItems:u,$repeaterItemsKey:p})=>f==="Repeater"?t.isArray(u)&&u.map((_,k)=>g.createElement(C,{...e,parent:r._id,key:`${t.get(r,"_parent","root")}-${r._id}-${k}`,repeaterData:{index:k,dataKey:p}})):o(c)?g.createElement(C,{...e,parent:r._id,key:`${t.get(r,"_parent","root")}-${r._id}`,repeaterData:s,type:r._type}):null):null)};async function G(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const a=e.lang??"en",n=e.fallbackLang??a;if(e.dataProviders)return m.jsx(C,{...e,lang:a,fallbackLang:n,dataProviders:e.dataProviders});const i=e.blocks.filter(l=>{const o=b.getRegisteredChaiBlock(l._type);return!!(t.has(o,"dataProvider")&&t.isFunction(o.dataProvider))}).reduce((l,o)=>{const r=b.getRegisteredChaiBlock(o._type);if(!r||!r.dataProvider)return l;const c={pageProps:e.pageProps,block:o,lang:e.lang,draft:e.draft,inBuilder:!1};return l[o._id]=r.dataProvider(c),l},{});return m.jsx(C,{...e,lang:a,fallbackLang:n,dataProviders:i})}function Q(e,a){const n=e.filter(s=>s._type==="GlobalBlock"||s._type==="PartialBlock");for(let s=0;s<n.length;s++){const i=n[s],l=t.get(i,"partialBlockId",t.get(i,"globalBlock",""));if(l==="")continue;let o=t.cloneDeep(t.get(a,l,[]));i._parent&&(o==null?void 0:o.length)>0&&(o=o.map(c=>(t.isEmpty(c._parent)&&(c._parent=i._parent),c)));const r=e.indexOf(i);e.splice(r,1,...o)}return e}const z=e=>{if(!e)return[];try{return JSON.parse(X(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function X(e){const a=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(a,n=>{const s=decodeURIComponent(n),i=s.indexOf("public");return i!==-1?s.substring(i+6):s})}async function Y(e,a=[],n=!1){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:a,theme:{extend:{...L.getChaiBuilderTheme(),keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}},plugins:[K,M,j,q,L.chaiBuilderPlugin],corePlugins:{preflight:n}}}).generateStylesFromContent(` ${n?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,e)}const Z=(e,a)=>{const n=JSON.stringify(e).replace(/#styles:([^"]*)/g,(s,i)=>`#styles:${i.replace(/,/g," ")}`.replace(/#styles:/g,""));return Y([n],[],a)},ee=async(e,a=!1)=>await Z(e,a);exports.getChaiThemeCssVariables=E.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=E.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=E.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=d.applyChaiDataBinding;exports.applyDesignTokens=d.applyDesignTokens;exports.convertHTMLToChaiBlocks=d.getBlocksFromHTML;exports.AsyncRenderChaiBlocks=G;exports.RenderChaiBlocks=J;exports.convertToBlocks=
|
|
3
|
+
@tailwind utilities;`,e)}const Z=(e,a)=>{const n=JSON.stringify(e).replace(/#styles:([^"]*)/g,(s,i)=>`#styles:${i.replace(/,/g," ")}`.replace(/#styles:/g,""));return Y([n],[],a)},ee=async(e,a=!1)=>await Z(e,a);exports.getChaiThemeCssVariables=E.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=E.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=E.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=d.applyChaiDataBinding;exports.applyDesignTokens=d.applyDesignTokens;exports.convertHTMLToChaiBlocks=d.getBlocksFromHTML;exports.AsyncRenderChaiBlocks=G;exports.RenderChaiBlocks=J;exports.convertToBlocks=z;exports.getMergedPartialBlocks=Q;exports.getStylesForBlocks=ee;
|
package/dist/render.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const applyChaiDataBinding: (block: Record<string, string>, pageE
|
|
|
4
4
|
|
|
5
5
|
export declare const applyDesignTokens: (blocks: ChaiBlock[], designTokens: DesignTokens) => ChaiBlock[];
|
|
6
6
|
|
|
7
|
-
export declare function AsyncRenderChaiBlocks(props: RenderChaiBlocksProps): Promise<JSX.Element>;
|
|
7
|
+
export declare function AsyncRenderChaiBlocks(props: RenderChaiBlocksProps): Promise<JSX.Element | null>;
|
|
8
8
|
|
|
9
9
|
declare type ChaiBlock<T = Record<string, any>> = {
|
|
10
10
|
_id: string;
|
|
@@ -96,7 +96,7 @@ declare type HexColor = string;
|
|
|
96
96
|
|
|
97
97
|
declare type HSLColor = string;
|
|
98
98
|
|
|
99
|
-
export declare function RenderChaiBlocks(props: RenderChaiBlocksProps_2): JSX.Element;
|
|
99
|
+
export declare function RenderChaiBlocks(props: RenderChaiBlocksProps_2): JSX.Element | null;
|
|
100
100
|
|
|
101
101
|
declare type RenderChaiBlocksProps = {
|
|
102
102
|
blocks: ChaiBlock[];
|