@chaibuilder/sdk 4.0.0-beta.3 → 4.0.0-beta.6
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-BnsZi3K3.cjs → 2SSKDMRQ-BIryEtW-.cjs} +1 -1
- package/dist/{2SSKDMRQ-CnSDkQcy.js → 2SSKDMRQ-trME0kvt.js} +2 -2
- package/dist/{AP7HFJJL-B31839PG.cjs → AP7HFJJL-5ZR38Hyh.cjs} +1 -1
- package/dist/{AP7HFJJL-CymCmW14.js → AP7HFJJL-CAGB9iMp.js} +1 -1
- package/dist/IconPicker-CQ-BgNNU.cjs +1 -0
- package/dist/{IconPicker-B1rWC-Ex.js → IconPicker-Mu75ni5T.js} +8 -7
- package/dist/{WDYDFRGG-BUVnbAci.js → WDYDFRGG-Cd4hRWj-.js} +2 -2
- package/dist/{WDYDFRGG-BxhOCHc3.cjs → WDYDFRGG-n8sBZVFG.cjs} +1 -1
- 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-CZLV-uAW.cjs +1 -0
- package/dist/active-in-another-tab-Cb6tnX9u.js +35 -0
- package/dist/{add-new-language-page-WmlCnytQ.js → add-new-language-page-BKcBaqZu.js} +54 -53
- package/dist/add-new-language-page-C3UzNV7W.cjs +1 -0
- package/dist/{add-new-page-soZ8GAkN.cjs → add-new-page-mULv9r3z.cjs} +1 -1
- package/dist/{add-new-page-VW2wAYZp.js → add-new-page-pH3PwqJe.js} +2 -2
- package/dist/ai-panel-content-BPgRdgye.cjs +1 -0
- package/dist/{ai-panel-content-D_o7Q_A-.js → ai-panel-content-CNxN84pv.js} +12 -11
- package/dist/{ai-panel-default-lang-DnElspF0.js → ai-panel-default-lang-CYcHjk8U.js} +40 -40
- package/dist/{ai-panel-default-lang-COYaxNwn.cjs → ai-panel-default-lang-DhTPtPgD.cjs} +2 -2
- package/dist/{ai-panel-other-lang-CkynNlAU.cjs → ai-panel-other-lang-CGNU3-FI.cjs} +1 -1
- package/dist/{ai-panel-other-lang-Dp0E9_Hx.js → ai-panel-other-lang-D8Ofvj8F.js} +8 -8
- package/dist/ai-prompt-input-CUutJjlf.cjs +1 -0
- package/dist/{ai-prompt-input-Bhc0ds7X.js → ai-prompt-input-Ceuy5bs3.js} +68 -67
- package/dist/{ai-translation-prompt-CZ55HQmo.js → ai-translation-prompt-BiepZRcN.js} +2 -2
- package/dist/ai-translation-prompt-CoCPLEed.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-DhD_RBcg.js → code-display-Ck81Id9K.js} +1 -1
- package/dist/code-display-DloSPyPr.cjs +1 -0
- package/dist/code-editor-C1ewJzDJ.cjs +1 -0
- package/dist/{code-editor-DRIAnNbb.js → code-editor-Z14ByBIv.js} +11 -10
- package/dist/{continue-editing-in-this-client-CS2aQ7yY.js → continue-editing-in-this-client-Byi6ER3L.js} +10 -9
- package/dist/continue-editing-in-this-client-k9Ab5E63.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 +32 -31
- package/dist/css-import-modal--bSJR-_y.cjs +13 -0
- package/dist/{css-import-modal-Byg6wV0O.js → css-import-modal-De7Kvg5C.js} +4 -3
- package/dist/{delete-design-token-BRZZiWtQ.js → delete-design-token-B97CnFDU.js} +1 -1
- package/dist/{delete-design-token-DkVs1oBf.cjs → delete-design-token-C6s-ESB_.cjs} +1 -1
- package/dist/delete-page-Djn97HiP.cjs +1 -0
- package/dist/{delete-page-BzyX9TN-.js → delete-page-Dnf97ZHP.js} +11 -10
- package/dist/{design-token-usage-xQs6SlaJ.js → design-token-usage-B-SykAjD.js} +14 -13
- package/dist/design-token-usage-OTd93kS8.cjs +1 -0
- package/dist/digital-asset-manager-DHYRXaaq.cjs +1 -0
- package/dist/{digital-asset-manager-DbtwzxRz.js → digital-asset-manager-b8gDuLnI.js} +6 -5
- package/dist/{duplicate-page-BR7Dlo9d.js → duplicate-page-Bdtpl7_R.js} +19 -18
- package/dist/duplicate-page-C4Ovp8Ff.cjs +1 -0
- package/dist/dynamic-page-selector-B8DdnfrF.cjs +1 -0
- package/dist/{dynamic-page-selector-Cb5r_W8s.js → dynamic-page-selector-BVnIM1Rq.js} +15 -14
- package/dist/get-chai-builder-tailwind-config-DNp8Vhme.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-k8l5sdcw.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-G-K28aTS.cjs → image-editor-C2zOHeKv.cjs} +1 -1
- package/dist/{image-editor-DV8kUKhl.js → image-editor-cckqPmk5.js} +1 -1
- package/dist/index-B0e71wJ1.cjs +160 -0
- package/dist/{index-ZuacEL1j.js → index-Bn0fFN58.js} +665 -663
- package/dist/{index-Ct7ElCGK.js → index-CAhEmHYP.js} +3744 -3920
- package/dist/index-DKuwxj1x.cjs +5 -0
- package/dist/{json-diff-viewer-D7z4zNvv.cjs → json-diff-viewer-D9DVIBz4.cjs} +3 -3
- package/dist/{json-diff-viewer-krslPepD.js → json-diff-viewer-DNizzMnu.js} +5 -4
- package/dist/lang-panel-C1dbn163.cjs +1 -0
- package/dist/{lang-panel-BwIewMyw.js → lang-panel-DL_BtSRD.js} +15 -14
- package/dist/manage-design-tokens-CXjYkarE.cjs +1 -0
- package/dist/{manage-design-tokens-Caz_20VK.js → manage-design-tokens-xxMO_RYg.js} +12 -11
- package/dist/{mark-as-template-D295ZQtU.js → mark-as-template-Ba2bmVd9.js} +17 -16
- package/dist/mark-as-template-DF1KIMr0.cjs +1 -0
- package/dist/{nested-path-selector-content-CKYYK-C5.js → nested-path-selector-content-Br1IWhK5.js} +24 -23
- package/dist/nested-path-selector-content-Cuk7NB-u.cjs +1 -0
- package/dist/{no-language-page-content-BvqRBP6y.js → no-language-page-content-9B2Fm-on.js} +10 -9
- package/dist/no-language-page-content-CxTp-LIM.cjs +1 -0
- package/dist/{no-language-page-dialog-PjNqTUpl.js → no-language-page-dialog-CPlKMyb8.js} +2 -2
- package/dist/{no-language-page-dialog-BcEoqyQB.cjs → no-language-page-dialog-DynACvgV.cjs} +1 -1
- package/dist/{page-creator-DiOITEMw.js → page-creator-BtyJz2sx.js} +115 -114
- package/dist/page-creator-Cbfv9N0P.cjs +1 -0
- package/dist/{page-lock-Bfbs6RgL.js → page-lock-CzsxrmN5.js} +2 -2
- package/dist/{page-lock-BdYmCks0.cjs → page-lock-fRos9wRU.cjs} +1 -1
- package/dist/{page-locked-dialog-B6MKTRfY.js → page-locked-dialog-D2q9qkPk.js} +18 -15
- package/dist/page-locked-dialog-D57d2gvn.cjs +1 -0
- package/dist/{page-manager-new-CzX22g2n.js → page-manager-new-D6DVIx2S.js} +30 -29
- package/dist/page-manager-new-aE198gKS.cjs +1 -0
- package/dist/{page-manager-search-and-filter-CM0UMb6U.js → page-manager-search-and-filter-CuZkQaZg.js} +13 -12
- package/dist/page-manager-search-and-filter-DGQEgKzy.cjs +1 -0
- package/dist/{page-revisions-content-NH9JK4Ey.js → page-revisions-content-5rbicFbD.js} +34 -31
- package/dist/page-revisions-content-CefqOvKX.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +4 -4
- package/dist/pages.js +1 -1
- 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-DBb8M3TG.cjs +1 -0
- package/dist/{publish-pages-content-D9aixMN5.js → publish-pages-content-WeGk-YLC.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-DBoPRXq-.cjs +1 -0
- package/dist/{rte-widget-modal-DOJEXLIf.js → rte-widget-modal-J-_AytmK.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-0ysmXVbI.cjs +1 -0
- package/dist/{save-to-lib-eiOc_SSN.js → save-to-lib-CQQxoovF.js} +39 -38
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-BWupQFoQ.cjs +16 -0
- package/dist/{selected-block-display-CBFePS19.js → selected-block-display-CgoXS8Hr.js} +37 -36
- package/dist/{seo-panel-C1-iMOR1.js → seo-panel-B798Myp_.js} +12 -11
- package/dist/seo-panel-BkFbXIL0.cjs +2 -0
- package/dist/{shared-json-ld-B4PxAM_0.js → shared-json-ld-Clg_UEhd.js} +68 -67
- package/dist/shared-json-ld-Cn3MCW6I.cjs +1 -0
- package/dist/slug-input-BHyD8cxk.cjs +1 -0
- package/dist/{slug-input-AwNJs9im.js → slug-input-hX5VaZpj.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-Dzczo20q.cjs +1 -0
- package/dist/{take-over-request-C4FeDtN_.js → take-over-request-s1L5Yofb.js} +17 -16
- package/dist/theme-panel-footer-NTNCL0SW.cjs +1 -0
- package/dist/{theme-panel-footer-uBQqSJXm.js → theme-panel-footer-sK6bYhEb.js} +11 -10
- package/dist/translation-warning-modal-BfM4HGck.cjs +1 -0
- package/dist/{translation-warning-modal-B64YqlbI.js → translation-warning-modal-Jadkcver.js} +9 -8
- package/dist/unmark-as-template-CqkHI3gR.cjs +1 -0
- package/dist/{unmark-as-template-CZ9sQp_P.js → unmark-as-template-D5b775eR.js} +11 -10
- package/dist/unpublish-page-BT5bCfs6.cjs +1 -0
- package/dist/unpublish-page-DLLLgY43.js +28 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +5 -5
- package/dist/{web-preview-Djy6WIyj.js → web-preview-C_yFwxEe.js} +2 -2
- package/dist/web-preview-DU1MgppY.cjs +1 -0
- package/package.json +4 -2
- package/dist/IconPicker-DREyo007.cjs +0 -1
- package/dist/active-in-another-tab-B47YjQGN.cjs +0 -1
- package/dist/active-in-another-tab-CyjngVA6.js +0 -34
- package/dist/add-new-language-page-88xzrUy8.cjs +0 -1
- package/dist/ai-panel-content-7zCil042.cjs +0 -1
- package/dist/ai-prompt-input-CThbVp0_.cjs +0 -1
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +0 -1
- package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
- package/dist/code-display-BnqzqzoP.cjs +0 -1
- package/dist/code-editor-o3___nu2.cjs +0 -1
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +0 -1
- package/dist/core-BoRDjj4h.cjs +0 -1
- package/dist/core-yvI6kCyw.js +0 -56
- package/dist/css-import-modal-CyqkXWCO.cjs +0 -13
- package/dist/delete-page-DxX7PFIE.cjs +0 -1
- package/dist/design-token-usage-CAHzEGgJ.cjs +0 -1
- package/dist/digital-asset-manager--uO8Agia.cjs +0 -1
- package/dist/duplicate-page-CaNAbXwV.cjs +0 -1
- package/dist/dynamic-page-selector-Cxk_gjni.cjs +0 -1
- package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
- package/dist/index-DF5DEvqb.cjs +0 -160
- package/dist/index-WQwzsC7A.cjs +0 -5
- package/dist/lang-panel-DT96k1xg.cjs +0 -1
- package/dist/manage-design-tokens-CrmLe7UT.cjs +0 -1
- package/dist/mark-as-template-W3LmpiqN.cjs +0 -1
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +0 -1
- package/dist/no-language-page-content-DkfeMl90.cjs +0 -1
- package/dist/page-creator-C4gc5NSC.cjs +0 -1
- package/dist/page-locked-dialog-B1FAtK92.cjs +0 -1
- package/dist/page-manager-new-CHDueBDk.cjs +0 -1
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +0 -1
- package/dist/page-revisions-content-ChY-4f2V.cjs +0 -1
- package/dist/publish-pages-content-x-JuSFJ9.cjs +0 -1
- package/dist/rte-widget-modal-BaHIuEjF.cjs +0 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +0 -1
- package/dist/selected-block-display-BgRY82CT.cjs +0 -16
- package/dist/seo-panel-DfAb8U7W.cjs +0 -2
- package/dist/shared-json-ld-DzG398hr.cjs +0 -1
- package/dist/slug-input-C_ijLQ_X.cjs +0 -1
- package/dist/take-over-request-BNxcjY2j.cjs +0 -1
- package/dist/theme-panel-footer-Cq9pljro.cjs +0 -1
- package/dist/translation-warning-modal-BZAcwM2_.cjs +0 -1
- package/dist/unmark-as-template-EVvk0vmp.cjs +0 -1
- package/dist/unpublish-page-D4VwOlxc.js +0 -27
- package/dist/unpublish-page-bdSmwAVQ.cjs +0 -1
- package/dist/web-preview-Cio70gk5.cjs +0 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { B as D } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { g as N, D as S, d as j, e as v, f as w, N as B } from "./index-CAhEmHYP.js";
|
|
4
|
+
const M = ({
|
|
4
5
|
isOpen: f,
|
|
5
|
-
onClose:
|
|
6
|
+
onClose: r,
|
|
6
7
|
editor: t,
|
|
7
8
|
rteElement: x
|
|
8
9
|
}) => {
|
|
9
|
-
const a =
|
|
10
|
+
const a = N(), u = (c) => {
|
|
10
11
|
if (!t) return;
|
|
11
|
-
const
|
|
12
|
+
const i = `{{${c}}}`;
|
|
12
13
|
t.commands.focus();
|
|
13
14
|
const { from: p, to: g } = t.state.selection;
|
|
14
15
|
if (p !== g)
|
|
15
|
-
t.chain().deleteSelection().insertContent(
|
|
16
|
+
t.chain().deleteSelection().insertContent(i).run();
|
|
16
17
|
else {
|
|
17
18
|
const { state: s } = t, n = s.selection.from, d = s.doc.textBetween(Math.max(0, n - 1), n), o = s.doc.textBetween(n, Math.min(n + 1, s.doc.content.size));
|
|
18
|
-
let h = "";
|
|
19
|
-
n > 0 && d !== " " && !/[.,!?;:]/.test(d) && (h = " ");
|
|
20
19
|
let m = "";
|
|
21
|
-
|
|
20
|
+
n > 0 && d !== " " && !/[.,!?;:]/.test(d) && (m = " ");
|
|
21
|
+
let h = "";
|
|
22
|
+
o && o !== " " && !/[.,!?;:]/.test(o) && (h = " "), t.chain().insertContent(m + i + h).run();
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
|
-
return /* @__PURE__ */ e(
|
|
25
|
-
/* @__PURE__ */ e(
|
|
25
|
+
return /* @__PURE__ */ e(S, { open: f, onOpenChange: (c) => !c && r(), children: /* @__PURE__ */ l(j, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
26
|
+
/* @__PURE__ */ e(v, { children: /* @__PURE__ */ l(w, { className: "flex items-center justify-between pr-8", children: [
|
|
26
27
|
/* @__PURE__ */ e("span", { children: "Rich Text Editor" }),
|
|
27
28
|
a && Object.keys(a).length > 0 && /* @__PURE__ */ l("div", { className: "flex items-center", children: [
|
|
28
29
|
/* @__PURE__ */ e("span", { className: "mr-2 text-sm text-muted-foreground", children: "Add field:" }),
|
|
29
|
-
/* @__PURE__ */ e("div", { className: "rte-path-selector", children: /* @__PURE__ */ e(
|
|
30
|
+
/* @__PURE__ */ e("div", { className: "rte-path-selector", children: /* @__PURE__ */ e(B, { data: a, onSelect: u }) })
|
|
30
31
|
] })
|
|
31
32
|
] }) }),
|
|
32
33
|
x,
|
|
33
|
-
/* @__PURE__ */ e("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ e(
|
|
34
|
+
/* @__PURE__ */ e("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ e(D, { onClick: r, children: "Done" }) })
|
|
34
35
|
] }) });
|
|
35
36
|
};
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
+
M as default
|
|
38
39
|
};
|
package/dist/runtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-B-rSiAp_.cjs"),e=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./register-partial-type-ig9fUWIJ.cjs"),i=require("./fonts-B-Xt29pe.cjs"),r=require("./core-Y0lXLwkq.cjs"),o=r.setChaiServerBlockDataProvider;exports.StylesProp=a.StylesProp;exports.builderProp=a.builderProp;exports.defaultChaiStyles=a.defaultChaiStyles;exports.registerChaiBlockSchema=a.registerChaiBlockSchema;exports.runtimeProp=a.runtimeProp;exports.stylesProp=a.stylesProp;exports.ADD_BLOCK_TABS=e.ADD_BLOCK_TABS;exports.CHAI_BUILDER_PANELS=e.CHAI_BUILDER_PANELS;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.RJSF_EXTENSIONS=e.RJSF_EXTENSIONS;exports.getChaiLibrary=e.getChaiLibrary;exports.getPreImportHTML=e.getPreImportHTML;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiFeatureFlag=e.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=e.registerChaiFeatureFlags;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.resetSaveToLibrary=e.resetSaveToLibrary;exports.useBlockSettingComponents=e.useBlockSettingComponents;exports.useChaiAddBlockTabs=e.useChaiAddBlockTabs;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useChaiLibraries=e.useChaiLibraries;exports.useChaiSidebarPanels=e.useChaiSidebarPanels;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.useSaveToLibraryComponent=e.useSaveToLibraryComponent;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useTopBarComponent=e.useTopBarComponent;Object.defineProperty(exports,"CHAI_GLOBAL_DATA_PROVIDER",{enumerable:!0,get:()=>t.CHAI_GLOBAL_DATA_PROVIDER});exports.COLLECTIONS=t.COLLECTIONS;exports.PAGE_TYPES=t.PAGE_TYPES;exports.getChaiCollection=t.getChaiCollection;exports.getChaiCollections=t.getChaiCollections;exports.getChaiGlobalData=t.getChaiGlobalData;exports.getChaiPageType=t.getChaiPageType;exports.getChaiPageTypes=t.getChaiPageTypes;exports.registerChaiCollection=t.registerChaiCollection;exports.registerChaiGlobalDataProvider=t.registerChaiGlobalDataProvider;exports.registerChaiPageType=t.registerChaiPageType;exports.registerChaiPartialType=t.registerChaiPartialType;exports.getAllRegisteredFonts=i.getAllRegisteredFonts;exports.getRegisteredFont=i.getRegisteredFont;exports.registerChaiFont=i.registerChaiFont;exports.useRegisteredFonts=i.useRegisteredFonts;exports.closestBlockProp=r.closestBlockProp;exports.getAIBlockProps=r.getAIBlockProps;exports.getBlockFormSchemas=r.getBlockFormSchemas;exports.getDefaultBlockProps=r.getDefaultBlockProps;exports.getI18nBlockProps=r.getI18nBlockProps;exports.getRegisteredChaiBlock=r.getRegisteredChaiBlock;exports.registerChaiBlock=r.registerChaiBlock;exports.registerChaiServerBlock=r.registerChaiServerBlock;exports.setChaiBlockComponent=r.setChaiBlockComponent;exports.setChaiServerBlockDataProvider=r.setChaiServerBlockDataProvider;exports.syncBlocksWithDefaults=r.syncBlocksWithDefaults;exports.useRegisteredChaiBlock=r.useRegisteredChaiBlock;exports.useRegisteredChaiBlocks=r.useRegisteredChaiBlocks;exports.setChaiBlockDataProvider=o;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
1
2
|
import { default as default_2 } from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
2
4
|
import { RJSFSchema } from '@rjsf/utils';
|
|
3
5
|
import { UiSchema } from '@rjsf/utils';
|
|
4
6
|
|
|
7
|
+
export declare const ADD_BLOCK_TABS: Record<string, AddBlockTab>;
|
|
8
|
+
|
|
9
|
+
export declare type AddBlockTab = {
|
|
10
|
+
id: string;
|
|
11
|
+
tab: React.ComponentType;
|
|
12
|
+
tabContent: React.ComponentType;
|
|
13
|
+
};
|
|
14
|
+
|
|
5
15
|
export declare const builderProp: (options: ChaiBlockPropSchema) => ChaiBlockPropSchema;
|
|
6
16
|
|
|
17
|
+
export declare const CHAI_BUILDER_PANELS: Record<string, ChaiSidebarPanel>;
|
|
18
|
+
|
|
7
19
|
export declare let CHAI_GLOBAL_DATA_PROVIDER: (args: {
|
|
8
20
|
lang: string;
|
|
9
21
|
draft: boolean;
|
|
10
22
|
inBuilder: boolean;
|
|
11
23
|
}) => Promise<any>;
|
|
12
24
|
|
|
25
|
+
declare type ChaiAsset = {
|
|
26
|
+
url: string;
|
|
27
|
+
id?: string;
|
|
28
|
+
thumbnailUrl?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
13
34
|
export declare type ChaiAsyncProp<T> = T | undefined;
|
|
14
35
|
|
|
15
36
|
export declare type ChaiBlock<BlockProps = Record<string, any>> = {
|
|
@@ -19,6 +40,23 @@ export declare type ChaiBlock<BlockProps = Record<string, any>> = {
|
|
|
19
40
|
_parent?: string | null;
|
|
20
41
|
} & BlockProps;
|
|
21
42
|
|
|
43
|
+
declare type ChaiBlock_2<T = Record<string, any>> = {
|
|
44
|
+
_id: string;
|
|
45
|
+
_name?: string;
|
|
46
|
+
_parent?: string | null | undefined;
|
|
47
|
+
_libBlock?: string;
|
|
48
|
+
_type: string;
|
|
49
|
+
partialBlockId?: string;
|
|
50
|
+
} & T;
|
|
51
|
+
|
|
52
|
+
declare type ChaiBlock_3<T = Record<string, any>> = {
|
|
53
|
+
_id: string;
|
|
54
|
+
_name?: string;
|
|
55
|
+
_parent?: string | null | undefined;
|
|
56
|
+
_type: string;
|
|
57
|
+
_libBlock?: string;
|
|
58
|
+
} & T;
|
|
59
|
+
|
|
22
60
|
export declare type ChaiBlockComponentProps<BlockProps, PageData = Record<string, unknown>> = ChaiBlock<BlockProps> & {
|
|
23
61
|
$loading?: boolean;
|
|
24
62
|
blockProps: Record<string, string>;
|
|
@@ -131,6 +169,12 @@ declare type ChaiDynamicPage = {
|
|
|
131
169
|
primaryPage?: string;
|
|
132
170
|
};
|
|
133
171
|
|
|
172
|
+
declare type ChaiFlagOptions = {
|
|
173
|
+
key: string;
|
|
174
|
+
value?: any;
|
|
175
|
+
description?: string;
|
|
176
|
+
};
|
|
177
|
+
|
|
134
178
|
export declare type ChaiFont = ChaiFontViaUrl | ChaiFontViaSrc;
|
|
135
179
|
|
|
136
180
|
export declare type ChaiFontViaSrc = {
|
|
@@ -152,6 +196,33 @@ export declare type ChaiFontViaUrl = {
|
|
|
152
196
|
fallback: string;
|
|
153
197
|
};
|
|
154
198
|
|
|
199
|
+
declare type ChaiLibrary<T = Record<string, any>> = {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string;
|
|
202
|
+
blocks?: ChaiLibraryBlock[];
|
|
203
|
+
description?: string;
|
|
204
|
+
} & T;
|
|
205
|
+
|
|
206
|
+
declare type ChaiLibraryBlock<T = Record<string, any>> = {
|
|
207
|
+
id: string;
|
|
208
|
+
group: string;
|
|
209
|
+
name: string;
|
|
210
|
+
preview?: string;
|
|
211
|
+
tags?: string[];
|
|
212
|
+
description?: string;
|
|
213
|
+
} & T;
|
|
214
|
+
|
|
215
|
+
declare type ChaiLibraryConfig<T> = {
|
|
216
|
+
id: string;
|
|
217
|
+
name: string;
|
|
218
|
+
description: string;
|
|
219
|
+
getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock<T>[]>;
|
|
220
|
+
getBlock: ({ library, block, }: {
|
|
221
|
+
library: ChaiLibrary;
|
|
222
|
+
block: ChaiLibraryBlock<T>;
|
|
223
|
+
}) => Promise<HTMLString | ChaiBlock_2[]>;
|
|
224
|
+
};
|
|
225
|
+
|
|
155
226
|
export declare interface ChaiPageProps {
|
|
156
227
|
slug: string;
|
|
157
228
|
searchParams?: Record<string, string>;
|
|
@@ -173,6 +244,23 @@ export declare interface ChaiServerBlockDefinition<T = Record<string, any>, K =
|
|
|
173
244
|
suspenseFallback?: default_2.ComponentType<any>;
|
|
174
245
|
}
|
|
175
246
|
|
|
247
|
+
export declare interface ChaiSidebarPanel {
|
|
248
|
+
id: string;
|
|
249
|
+
position: "top" | "bottom";
|
|
250
|
+
view?: "standard" | "modal" | "overlay" | "drawer";
|
|
251
|
+
button: React.ComponentType<{
|
|
252
|
+
isActive: boolean;
|
|
253
|
+
show: () => void;
|
|
254
|
+
panelId: string;
|
|
255
|
+
position: "top" | "bottom";
|
|
256
|
+
}>;
|
|
257
|
+
label: string;
|
|
258
|
+
panel?: ComponentType;
|
|
259
|
+
width?: number;
|
|
260
|
+
isInternal?: boolean;
|
|
261
|
+
icon?: React.ReactNode;
|
|
262
|
+
}
|
|
263
|
+
|
|
176
264
|
export declare type ChaiStyles = {
|
|
177
265
|
[key: string]: string;
|
|
178
266
|
};
|
|
@@ -213,7 +301,7 @@ export declare const COLLECTIONS: Record<string, CollectionConfig<any>>;
|
|
|
213
301
|
|
|
214
302
|
export declare const defaultChaiStyles: (classes: string) => string;
|
|
215
303
|
|
|
216
|
-
export declare const getAIBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) =>
|
|
304
|
+
export declare const getAIBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>> | never[];
|
|
217
305
|
|
|
218
306
|
export declare const getAllRegisteredFonts: () => ChaiFont[];
|
|
219
307
|
|
|
@@ -232,17 +320,35 @@ export declare const getChaiGlobalData: (args: {
|
|
|
232
320
|
inBuilder: boolean;
|
|
233
321
|
}) => Promise<any>;
|
|
234
322
|
|
|
323
|
+
export declare const getChaiLibrary: (id: string) => ChaiLibraryConfig<any>;
|
|
324
|
+
|
|
235
325
|
export declare const getChaiPageType: (key: keyof typeof PAGE_TYPES) => ChaiBuilderPageType;
|
|
236
326
|
|
|
237
327
|
export declare const getChaiPageTypes: () => ChaiBuilderPageType[];
|
|
238
328
|
|
|
239
329
|
export declare const getDefaultBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => Record<string, any>;
|
|
240
330
|
|
|
241
|
-
export declare const getI18nBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) =>
|
|
331
|
+
export declare const getI18nBlockProps: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>> | never[];
|
|
332
|
+
|
|
333
|
+
export declare const getPreImportHTML: (code: string) => Promise<string>;
|
|
242
334
|
|
|
243
335
|
export declare const getRegisteredChaiBlock: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition | null;
|
|
244
336
|
|
|
245
|
-
export declare const getRegisteredFont: (family: string) => ChaiFont;
|
|
337
|
+
export declare const getRegisteredFont: (family: string) => ChaiFont | undefined;
|
|
338
|
+
|
|
339
|
+
declare type HTMLString = string;
|
|
340
|
+
|
|
341
|
+
export declare const IfChaiFeatureFlag: ({ flagKey, children }: {
|
|
342
|
+
flagKey: string;
|
|
343
|
+
children: React.ReactNode;
|
|
344
|
+
}) => ReactNode;
|
|
345
|
+
|
|
346
|
+
export declare type MediaManagerProps = {
|
|
347
|
+
assetId?: string;
|
|
348
|
+
close: () => void;
|
|
349
|
+
onSelect: (assets: ChaiAsset | ChaiAsset[]) => void;
|
|
350
|
+
mode?: "image" | "video" | "audio";
|
|
351
|
+
};
|
|
246
352
|
|
|
247
353
|
export declare const PAGE_TYPES: Record<string, ChaiBuilderPageType>;
|
|
248
354
|
|
|
@@ -252,12 +358,24 @@ declare type PageTypeSearchResult = {
|
|
|
252
358
|
slug?: string;
|
|
253
359
|
};
|
|
254
360
|
|
|
361
|
+
export declare const registerBlockSettingField: (id: string, component: React.ComponentType<any>) => void;
|
|
362
|
+
|
|
363
|
+
export declare const registerBlockSettingTemplate: (id: string, component: React.ComponentType<any>) => void;
|
|
364
|
+
|
|
365
|
+
export declare const registerBlockSettingWidget: (id: string, component: React.ComponentType<any>) => void;
|
|
366
|
+
|
|
367
|
+
export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
|
|
368
|
+
|
|
255
369
|
export declare const registerChaiBlock: <T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>>(component: default_2.ComponentType<ChaiBlockComponentProps<T>>, options: ChaiBlockDefinitionOptions<T, K>) => void;
|
|
256
370
|
|
|
257
371
|
export declare const registerChaiBlockSchema: (blockSchema: ChaiBlockSchema) => ChaiBlockSchemas;
|
|
258
372
|
|
|
259
373
|
export declare function registerChaiCollection<T = Record<any, any>>(id: string, collection: Omit<CollectionConfig<T>, "id">): void;
|
|
260
374
|
|
|
375
|
+
export declare const registerChaiFeatureFlag: (key: string, flagOptions: Omit<ChaiFlagOptions, "key">) => void;
|
|
376
|
+
|
|
377
|
+
export declare const registerChaiFeatureFlags: (flags: Record<string, Omit<ChaiFlagOptions, "key">>) => void;
|
|
378
|
+
|
|
261
379
|
export declare const registerChaiFont: (family: string, font: Omit<ChaiFont, "family">) => void;
|
|
262
380
|
|
|
263
381
|
export declare const registerChaiGlobalDataProvider: <T>(globalDataProvider: (args: {
|
|
@@ -266,16 +384,42 @@ export declare const registerChaiGlobalDataProvider: <T>(globalDataProvider: (ar
|
|
|
266
384
|
inBuilder: boolean;
|
|
267
385
|
}) => Promise<T>) => void;
|
|
268
386
|
|
|
387
|
+
export declare const registerChaiLibrary: <T extends Record<string, any> = Record<string, any>>(id: string, library: Omit<ChaiLibraryConfig<T>, "id">) => void;
|
|
388
|
+
|
|
389
|
+
export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
|
|
390
|
+
|
|
269
391
|
export declare const registerChaiPageType: (key: string, pageTypeOptions: Omit<ChaiBuilderPageType, "key" | "hasSlug">) => void;
|
|
270
392
|
|
|
271
393
|
export declare const registerChaiPartialType: (key: string, pageTypeOptions: Omit<ChaiBuilderPageType, "key">) => void;
|
|
272
394
|
|
|
395
|
+
export declare const registerChaiPreImportHTMLHook: (fn: (code: string) => Promise<string>) => void;
|
|
396
|
+
|
|
397
|
+
export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
|
|
398
|
+
|
|
273
399
|
export declare const registerChaiServerBlock: <T extends Record<string, any> = Record<string, any>, K extends Record<string, any> = Record<string, any>>(component: default_2.ComponentType<ChaiBlockComponentProps<T>>, options: Pick<ChaiBlockDefinition<T, K>, "type" | "dataProvider" | "i18nProps" | "aiProps">) => void;
|
|
274
400
|
|
|
401
|
+
export declare const registerChaiSidebarPanel: (panelId: string, panelOptions: Omit<ChaiSidebarPanel, "id">) => void;
|
|
402
|
+
|
|
403
|
+
export declare const registerChaiTopBar: (component: React.ComponentType) => void;
|
|
404
|
+
|
|
275
405
|
declare const REGISTERED_CHAI_BLOCKS: Record<string, ChaiBlockDefinition | ChaiServerBlockDefinition>;
|
|
276
406
|
|
|
407
|
+
export declare const resetSaveToLibrary: () => void;
|
|
408
|
+
|
|
409
|
+
export declare const RJSF_EXTENSIONS: Record<string, {
|
|
410
|
+
id: string;
|
|
411
|
+
component: React.ComponentType<any>;
|
|
412
|
+
type: string;
|
|
413
|
+
}>;
|
|
414
|
+
|
|
277
415
|
export declare const runtimeProp: (options: ChaiBlockPropSchema) => ChaiBlockPropSchema;
|
|
278
416
|
|
|
417
|
+
export declare type SaveToLibraryProps = {
|
|
418
|
+
blockId: string;
|
|
419
|
+
blocks: ChaiBlock_3[];
|
|
420
|
+
close: () => void;
|
|
421
|
+
};
|
|
422
|
+
|
|
279
423
|
export declare const setChaiBlockComponent: <T extends Record<string, any> = Record<string, any>>(type: keyof typeof REGISTERED_CHAI_BLOCKS, component: default_2.ComponentType<ChaiBlockComponentProps<T>>) => void;
|
|
280
424
|
|
|
281
425
|
export declare const setChaiBlockDataProvider: <K extends Record<string, any> = Record<string, any>>(type: string, dataProvider: (args: {
|
|
@@ -300,10 +444,30 @@ export declare const stylesProp: (defaultClasses?: string) => ChaiBlockPropSchem
|
|
|
300
444
|
|
|
301
445
|
export declare const syncBlocksWithDefaults: (blocks: ChaiBlock[]) => ChaiBlock[];
|
|
302
446
|
|
|
303
|
-
export declare const
|
|
447
|
+
export declare const useBlockSettingComponents: (type: "widget" | "field" | "template") => Record<string, React.ComponentType<any>>;
|
|
448
|
+
|
|
449
|
+
export declare const useChaiAddBlockTabs: () => AddBlockTab[];
|
|
450
|
+
|
|
451
|
+
export declare const useChaiFeatureFlag: (flagKey: string) => boolean;
|
|
452
|
+
|
|
453
|
+
export declare const useChaiFeatureFlags: () => Record<string, ChaiFlagOptions>;
|
|
454
|
+
|
|
455
|
+
export declare const useChaiLibraries: () => ChaiLibraryConfig<any>[];
|
|
456
|
+
|
|
457
|
+
export declare const useChaiSidebarPanels: (position: "top" | "bottom") => ChaiSidebarPanel[];
|
|
458
|
+
|
|
459
|
+
export declare const useMediaManagerComponent: () => ComponentType<MediaManagerProps>;
|
|
460
|
+
|
|
461
|
+
export declare const useRegisteredChaiBlock: (type: keyof typeof REGISTERED_CHAI_BLOCKS) => ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>> | null;
|
|
304
462
|
|
|
305
463
|
export declare const useRegisteredChaiBlocks: () => Record<string, ChaiBlockDefinition<Record<string, any>, Record<string, any>> | ChaiServerBlockDefinition<Record<string, any>, Record<string, any>>>;
|
|
306
464
|
|
|
307
465
|
export declare const useRegisteredFonts: () => ChaiFont[];
|
|
308
466
|
|
|
467
|
+
export declare const useSaveToLibraryComponent: () => ComponentType<SaveToLibraryProps> | null;
|
|
468
|
+
|
|
469
|
+
export declare const useToggleChaiFeatureFlag: (flagKey: string) => () => void;
|
|
470
|
+
|
|
471
|
+
export declare const useTopBarComponent: () => ComponentType< {}>;
|
|
472
|
+
|
|
309
473
|
export { }
|
package/dist/runtime.js
CHANGED
|
@@ -1,44 +1,74 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { S as i, b as o, d as g, r as l, a as C, s as h } from "./index-Dxfyt4d4.js";
|
|
2
|
+
import { A as n, C as p, I as u, R as B, k as d, o as P, a as k, b as S, r as m, c as T, e as F, f as b, j as L, m as y, p as A, q as f, v as I, x as D, t as R, u as v, d as _, h as E, g as x, l as M, w as O, n as H, s as G, i as N, y as j } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { b as q, C as w, P as J, a as K, g as U, d as V, f as X, e as Y, r as z, c as Q, h as Z, i as $ } from "./register-partial-type-BjtdfKHE.js";
|
|
4
|
+
import { a as ae, g as se, r as re, u as te } from "./fonts-DRly3Wzd.js";
|
|
5
|
+
import { s as e } from "./core-Dr7QYemB.js";
|
|
6
|
+
import { c as oe, g as ge, a as le, b as Ce, d as he, e as ce, r as ne, f as pe, h as ue, i as Be, u as de, j as Pe } from "./core-Dr7QYemB.js";
|
|
6
7
|
const s = e;
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
9
|
+
n as ADD_BLOCK_TABS,
|
|
10
|
+
p as CHAI_BUILDER_PANELS,
|
|
11
|
+
q as CHAI_GLOBAL_DATA_PROVIDER,
|
|
12
|
+
w as COLLECTIONS,
|
|
13
|
+
u as IfChaiFeatureFlag,
|
|
14
|
+
J as PAGE_TYPES,
|
|
15
|
+
B as RJSF_EXTENSIONS,
|
|
16
|
+
i as StylesProp,
|
|
17
|
+
o as builderProp,
|
|
18
|
+
oe as closestBlockProp,
|
|
19
|
+
g as defaultChaiStyles,
|
|
20
|
+
ge as getAIBlockProps,
|
|
21
|
+
ae as getAllRegisteredFonts,
|
|
22
|
+
le as getBlockFormSchemas,
|
|
23
|
+
K as getChaiCollection,
|
|
24
|
+
U as getChaiCollections,
|
|
25
|
+
V as getChaiGlobalData,
|
|
26
|
+
d as getChaiLibrary,
|
|
27
|
+
X as getChaiPageType,
|
|
28
|
+
Y as getChaiPageTypes,
|
|
29
|
+
Ce as getDefaultBlockProps,
|
|
30
|
+
he as getI18nBlockProps,
|
|
31
|
+
P as getPreImportHTML,
|
|
32
|
+
ce as getRegisteredChaiBlock,
|
|
33
|
+
se as getRegisteredFont,
|
|
34
|
+
k as registerBlockSettingField,
|
|
35
|
+
S as registerBlockSettingTemplate,
|
|
36
|
+
m as registerBlockSettingWidget,
|
|
37
|
+
T as registerChaiAddBlockTab,
|
|
38
|
+
ne as registerChaiBlock,
|
|
39
|
+
l as registerChaiBlockSchema,
|
|
40
|
+
z as registerChaiCollection,
|
|
41
|
+
F as registerChaiFeatureFlag,
|
|
42
|
+
b as registerChaiFeatureFlags,
|
|
43
|
+
re as registerChaiFont,
|
|
44
|
+
Q as registerChaiGlobalDataProvider,
|
|
45
|
+
L as registerChaiLibrary,
|
|
46
|
+
y as registerChaiMediaManager,
|
|
47
|
+
Z as registerChaiPageType,
|
|
48
|
+
$ as registerChaiPartialType,
|
|
49
|
+
A as registerChaiPreImportHTMLHook,
|
|
50
|
+
f as registerChaiSaveToLibrary,
|
|
51
|
+
pe as registerChaiServerBlock,
|
|
52
|
+
I as registerChaiSidebarPanel,
|
|
53
|
+
D as registerChaiTopBar,
|
|
54
|
+
R as resetSaveToLibrary,
|
|
35
55
|
C as runtimeProp,
|
|
36
|
-
|
|
56
|
+
ue as setChaiBlockComponent,
|
|
37
57
|
s as setChaiBlockDataProvider,
|
|
38
58
|
e as setChaiServerBlockDataProvider,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
h as stylesProp,
|
|
60
|
+
Be as syncBlocksWithDefaults,
|
|
61
|
+
v as useBlockSettingComponents,
|
|
62
|
+
_ as useChaiAddBlockTabs,
|
|
63
|
+
E as useChaiFeatureFlag,
|
|
64
|
+
x as useChaiFeatureFlags,
|
|
65
|
+
M as useChaiLibraries,
|
|
66
|
+
O as useChaiSidebarPanels,
|
|
67
|
+
H as useMediaManagerComponent,
|
|
68
|
+
de as useRegisteredChaiBlock,
|
|
69
|
+
Pe as useRegisteredChaiBlocks,
|
|
70
|
+
te as useRegisteredFonts,
|
|
71
|
+
G as useSaveToLibraryComponent,
|
|
72
|
+
N as useToggleChaiFeatureFlag,
|
|
73
|
+
j as useTopBarComponent
|
|
44
74
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./register-chai-top-bar-BqwKw4uy.cjs"),b=require("./index-B0e71wJ1.cjs"),x=require("./index-DKuwxj1x.cjs"),C=require("@tanstack/react-query"),j=require("sonner"),E=require("lucide-react"),i=require("react"),X=require("./image-compression-DZ9WMmyn.cjs"),R=require("lodash-es"),J=s=>{const r=x.useApiUrl(),l=x.useFetch();return C.useMutation({mutationFn:async t=>l(r,{action:x.ACTIONS.UPSERT_LIBRARY_ITEM,data:t}),onSuccess:t=>{s?s(t):j.toast.success("Block saved successfully")},onError:t=>{console.error("Error saving block:",t),j.toast.error("Failed to save block",{description:t instanceof Error?t.message:"Unknown error"})}})},Z=s=>{const r=x.useApiUrl(),l=x.useFetch();return C.useQuery({staleTime:"static",queryKey:[x.ACTIONS.GET_LIBRARY_ITEM,s],enabled:!!s,queryFn:async()=>{if(!s)return null;try{return await l(r,{action:x.ACTIONS.GET_LIBRARY_ITEM,data:{id:s}})}catch(t){throw console.error(t),new Error("The block could not be found on the server. It may have been deleted.")}},retry:!1})},ee=s=>{const r=x.useApiUrl(),l=x.useFetch();return C.useMutation({mutationFn:async t=>l(r,{action:x.ACTIONS.DELETE_LIBRARY_ITEM,data:{id:t}}),onSuccess:()=>{s?s():j.toast.success("Block deleted successfully")},onError:t=>{console.error("Error deleting block:",t),j.toast.error("Failed to delete block",{description:t instanceof Error?t.message:"Unknown error"})}})},te=({blockId:s,libBlockId:r,isOpen:l,onClose:t,blockName:m,trigger:f})=>{const[d,o]=i.useState(!1),c=b.useUpdateBlocksPropsRealtime(),y=ee(()=>{c([s],{_libBlockId:void 0}),j.toast.success("Block deleted successfully"),o(!1),t()}),p=()=>{o(!0),y.mutate(r)},g=e.jsxs(u.Button,{type:"button",variant:"destructive",size:"sm",onClick:h=>h.preventDefault(),disabled:d,children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]});return e.jsxs(b.Popover,{open:l,onOpenChange:h=>!h&&t(),children:[e.jsx(b.PopoverTrigger,{asChild:!0,children:f||g}),e.jsx(b.PopoverContent,{className:"z-[9999] w-72 p-4",sideOffset:5,align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Delete Block"}),e.jsxs("p",{className:"text-sm",children:["Are you sure you want to delete the block",e.jsxs("span",{className:"font-medium",children:[' "',m,'"']}),"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This block will be permanently removed from the library. This action cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u.Button,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:d,children:"Cancel"}),e.jsx(u.Button,{type:"button",variant:"destructive",size:"sm",onClick:p,disabled:d,children:d?"Deleting...":"Delete"})]})]})})]})},se=({blockId:s,libBlockId:r,blockName:l,size:t="sm",className:m="",close:f})=>{const[d,o]=i.useState(!1);return e.jsx(te,{blockId:s,libBlockId:r,isOpen:d,onClose:()=>{o(!1),f()},blockName:l,trigger:e.jsxs(u.Button,{type:"button",variant:"destructive",size:t,className:m,onClick:()=>o(!0),children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]})})},re=()=>{const s=x.useApiUrl(),r=x.useFetch(),l=C.useQueryClient(),{data:t=[],isLoading:m,error:f}=C.useQuery({queryKey:["library-groups"],staleTime:"static",placeholderData:[],queryFn:async()=>{try{return await r(s,{action:"GET_LIBRARY_GROUPS"})||[]}catch(c){return console.error("Error fetching library groups:",c),[]}}}),{mutateAsync:d,isPending:o}=C.useMutation({mutationFn:async c=>{if(!c.trim())throw new Error("Group name is required");return r(s,{action:"CREATE_BLOCK_GROUP",data:{name:c}})},onSuccess:()=>{l.invalidateQueries({queryKey:["library-groups"]}),j.toast.success("Group created successfully")},onError:c=>{console.error("Error creating group:",c),j.toast.error("Failed to create group",{description:c instanceof Error?c.message:"Unknown error"})}});return{groups:t,isLoading:m,error:f,createGroup:d,isCreating:o}},ne=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),[m,f]=i.useState(""),d=i.useRef(null),{groups:o}=re(),[c,y]=i.useState([{id:"hero",name:"Hero"},{id:"feature",name:"Feature"},{id:"footer",name:"Footer"},{id:"content",name:"Content"},{id:"testimonial",name:"Testimonial"},{id:"pricing",name:"Pricing"},{id:"login",name:"Login"},{id:"logos",name:"Logos"},{id:"about",name:"About"},{id:"banner",name:"Banner"},{id:"blog",name:"Blog"},{id:"careers",name:"Careers"},{id:"casestudy",name:"Casestudy"},{id:"changelog",name:"Changelog"},{id:"compare",name:"Compare"},{id:"contact",name:"Contact"},{id:"cta",name:"Cta"},{id:"faq",name:"Faq"},{id:"gallery",name:"Gallery"},{id:"integration",name:"Integration"},{id:"list",name:"List"},{id:"navbar",name:"Navbar"},{id:"product",name:"Product"},{id:"signup",name:"Signup"},{id:"stats",name:"Stats"},{id:"team",name:"Team"},{id:"timeline",name:"Timeline"}]),p=i.useMemo(()=>[...o,...c.filter(n=>!o.some(B=>B.id===n.id))],[o,c]),g=()=>{const n=m.trim();if(!n)return;const B={id:n,name:n};y(w=>[...w,B]),r(B.id),f(""),t(!1)};i.useEffect(()=>{l&&d.current&&d.current.focus()},[l]);const h=n=>{n.key==="Enter"&&(n.preventDefault(),g())};return i.useEffect(()=>{s&&!p.some(n=>n.id===s)&&r("")},[s,p,r]),l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u.Input,{ref:d,placeholder:"Enter new group name",value:m,onChange:n=>f(n.target.value),onKeyDown:h}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(u.Button,{size:"sm",onClick:g,children:"Create"})]})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:s,onChange:n=>r(n.target.value),children:[e.jsx("option",{value:"",children:"Select a group"}),o.length>0&&e.jsx("optgroup",{label:"Library Groups",children:o.map(n=>e.jsx("option",{value:n.id,children:n.name},`lib-${n.id}`))}),c.length>0&&e.jsx("optgroup",{label:"Predefined Groups",children:c.filter(n=>!o.some(B=>B.id===n.id)).map(n=>e.jsx("option",{value:n.id,children:n.name},`local-${n.id}`))})]}),e.jsx(u.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>t(!0),children:e.jsx(E.Plus,{className:"h-4 w-4"})})]})},ae=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),m=i.useRef(null),f=i.useCallback(async c=>{var p;const y=(p=c.target.files)==null?void 0:p[0];if(y)try{t(!0);let g=y;y.type.startsWith("image/")&&(g=await X.compressImageIfNeeded(y));const h=new FileReader;h.onloadend=()=>{r(h.result),t(!1)},h.readAsDataURL(g)}catch(g){console.error("Error reading file:",g),t(!1),j.toast.error("Failed to process image",{description:g instanceof Error?g.message:"Unknown error"})}},[r]),d=()=>{r(""),m.current&&(m.current.value="")},o=()=>{var c;(c=m.current)==null||c.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u.Input,{type:"file",ref:m,onChange:f,accept:"image/*",className:"hidden"}),e.jsx(u.Button,{type:"button",variant:"outline",onClick:o,disabled:l,className:"w-full",children:l?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(E.ImageIcon,{className:"h-4 w-4"}),"Select image"]})}),s&&e.jsx(u.Button,{type:"button",variant:"outline",size:"icon",onClick:d,children:e.jsx(E.X,{className:"h-4 w-4"})})]}),s&&e.jsx("div",{className:"aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border",children:e.jsx("img",{src:s,alt:"Preview",className:"h-full w-full object-contain"})})]})},oe=s=>{const{blocks:r,close:l,blockId:t}=s,{getPartailBlocks:m}=b.usePartialBlocksStore(),f=r.find(a=>a._id===t),d=f==null?void 0:f._libBlockId,o=!!d,c=i.useMemo(()=>r.some(a=>a._type==="PartialBlock"||a._type==="GlobalBlock"),[r]),y=i.useMemo(()=>{let a=[];for(const v of r)if(v._type==="PartialBlock"||v._type==="GlobalBlock"){let k=m(v.partialBlockId);v._parent&&(k==null?void 0:k.length)>0&&(k=k.map(T=>(R.isEmpty(T._parent)&&R.set(T,"_parent",v._parent),T))),a=[...a,...k]}else a.push(v);return a},[r,m]),[p,g]=i.useState(""),[h,n]=i.useState(""),[B,w]=i.useState(""),[S,_]=i.useState(""),[N,A]=i.useState({}),[q,M]=i.useState(!1),[O,F]=i.useState(o),[z,K]=i.useState(!1),{hasPermission:Y}=b.usePermissions(),Q=Y(x.PAGES_PERMISSIONS.DELETE_LIBRARY_BLOCK),D=b.useUpdateBlocksPropsRealtime(),V=()=>{D([t],{_libBlockId:void 0}),j.toast.success("Block delinked from library"),l()},{data:I,isLoading:P,isError:G}=Z(d);i.useEffect(()=>{G&&o&&(K(!0),F(!1))},[G,o]),i.useEffect(()=>{I&&!P&&(g(I.name||""),n(I.group||""),w(I.description||""),_(I.preview||""),F(!1))},[I,P]),i.useEffect(()=>{const a=p.trim().length>=2,v=h.trim()!=="";M(a&&v)},[p,h]);const W=()=>{const a={};return p.trim()?p.length<2&&(a.name="Name must be at least 2 characters"):a.name="Name is required",h||(a.group="Group is required"),A(a),Object.keys(a).length===0},{resetLibrary:$}=b.useLibraryBlocks({id:""}),U=J(a=>{o||D([t],{_libBlockId:a.id}),j.toast.success(`Block ${o?"updated":"saved"} successfully`),$(a.library),l()}),H=async a=>{if(a.preventDefault(),!W())return;const v=y.map(k=>(R.has(k,"_libBlockId")&&delete k._libBlockId,k));U.mutate({name:p.trim(),group:h,blocks:v,description:B.trim(),...S&&S.startsWith("data:")?{previewImage:S}:{},...o?{id:d}:{}})},L=U.isPending;return O||P?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):z?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"font-medium text-destructive",children:"Block Not Found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This block could not be found on the server. It may have been deleted."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(u.Button,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),e.jsx(u.Button,{onClick:V,variant:"destructive",children:"Delink Block"})]})]}):e.jsxs("div",{children:[c&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive",children:[e.jsx(E.AlertCircle,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Partial Blocks Detected"}),e.jsx("p",{className:"mt-1 text-xs",children:"This block contains one or more Partial Blocks. Partial blocks will be merged into the library block"})]})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b.Label,{htmlFor:"name",className:N.name?"text-destructive":"",children:"Name"}),e.jsx(u.Input,{id:"name",placeholder:"Enter block name",value:p,onChange:a=>g(a.target.value),className:N.name?"border-destructive":""}),N.name&&e.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b.Label,{htmlFor:"group",className:N.group?"text-destructive":"",children:"Group"}),e.jsx(ne,{value:h,onChange:n}),N.group&&e.jsx("p",{className:"text-xs text-destructive",children:N.group})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(u.Input,{id:"description",placeholder:"Enter a brief description",className:"resize-none",value:B,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b.Label,{htmlFor:"previewImage",children:"Preview Image (optional)"}),e.jsx(ae,{value:S,onChange:_})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o&&Q&&e.jsx(se,{blockId:t,libBlockId:d,blockName:p,className:"mr-auto",close:l}),e.jsx(u.Button,{type:"button",variant:"outline",onClick:l,disabled:L,children:"Cancel"}),e.jsx(u.Button,{type:"submit",disabled:L||!q,children:L?"Saving...":o?"Update Block":"Save Block"})]})]})]})};exports.default=oe;
|