@chaibuilder/sdk 3.2.2 → 3.2.3
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/{code-editor-B4F8QB5S.cjs → code-editor-CUimilR9.cjs} +1 -1
- package/dist/{code-editor-zas3OmxC.js → code-editor-aEl9qnMt.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +4 -0
- package/dist/core.js +1 -1
- package/dist/{index-CPvjpLmN.js → index-Cb4I9wM_.js} +36 -33
- package/dist/index-ClDik0i4.cjs +154 -0
- package/dist/{rte-widget-modal-2S4dpCHF.js → rte-widget-modal-BC3QU74X.js} +1 -1
- package/dist/{rte-widget-modal-DcTD9G1X.cjs → rte-widget-modal-Cr2Sx0uo.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/index-IErL-ZZD.cjs +0 -154
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-ClDik0i4.cjs");require("clsx");require("lodash-es");require("nanoid");require("tailwind-merge");require("tree-model");const c=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-Ba1-8jmj.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=c.useState(!1),[a,p]=c.useState(""),[t,d]=i.useCodeEditor(),[u]=i.useSelectedBlockIds(),b=i.useUpdateBlocksProps(),f=i.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=c.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ClDik0i4.cjs"),s=require("./common-functions-B3a4xKt_.cjs"),a=require("./apply-binding-DOJpwjiG.cjs"),l=require("react-i18next"),i=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;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.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAskAi=e.useAskAi;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksHtmlForAi=e.useBlocksHtmlForAi;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasDisplayWidth=e.useCanvasDisplayWidth;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlocks;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useHtmlToBlocks=e.useHtmlToBlocks;exports.useI18nBlocks=e.useI18nBlocks;exports.useInlineEditing=e.useInlineEditing;exports.useIsPageLoaded=e.useIsPageLoaded;exports.useLanguages=e.useLanguages;exports.useLibraryBlocks=e.useLibraryBlocks;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.usePartailBlocksStore=e.usePartialBlocksStore;exports.usePartialBlocksList=e.usePartialBlocksList;exports.usePasteBlocks=e.usePasteBlocks;exports.usePermissions=e.usePermissions;exports.usePreviewMode=e.usePreviewMode;exports.usePubSub=e.usePubSub;exports.useRemoveAllClassesForBlock=e.useRemoveAllClassesForBlock;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useReplaceBlock=e.useReplaceBlock;exports.useResetBlockStyles=e.useResetBlockStyles;exports.useRightPanel=e.useRightPanel;exports.useSavePage=e.useSavePage;exports.useScreenSizeWidth=e.useScreenSizeWidth;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedLibrary=e.useSelectedLibrary;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSidebarActivePanel=e.useSidebarActivePanel;exports.useStreamMultipleBlocksProps=e.useStreamMultipleBlocksProps;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTheme=e.useTheme;exports.useThemeOptions=e.useThemeOptions;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useWrapperBlock=e.useWrapperBlock;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;exports.convertHTMLToChaiBlocks=a.getBlocksFromHTML;exports.getBlocksFromHTML=a.getBlocksFromHTML;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=i;
|
package/dist/core.d.ts
CHANGED
|
@@ -279,6 +279,10 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
279
279
|
structureRules?: StructureRule[];
|
|
280
280
|
designTokens?: DesignTokens;
|
|
281
281
|
siteWideUsage?: SiteWideUsage;
|
|
282
|
+
/**
|
|
283
|
+
* Screen to small message component
|
|
284
|
+
*/
|
|
285
|
+
smallScreenComponent?: ReactComponentType;
|
|
282
286
|
}
|
|
283
287
|
|
|
284
288
|
declare type ChaiBuilderThemeOptions = {
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as C, m as B, E as k, I as g, L as n, g as h, T as p, U as S, h as m, z as P, P as F, n as A, o as T, p as b, q as M, r as y, F as I, G as v, t as L, v as f, s as H, w as R, x as D, y as E, O as U, Q as x, R as W, S as O, V as w, W as z, aC as j, X as q, Y as G, Z as V, aE as Z, aD as J, _ as K, H as N, J as Q, u as X, $ as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as oa, a6 as ia, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, M as da, ac as Ca, ad as Ba, ae as ka, af as ga, ag as na, ah as ha, ai as pa, aj as Sa, ak as ma, al as Pa, am as Fa, an as Aa, ao as Ta, aF as ba, ap as Ma, aq as ya, ar as Ia, a as va, as as La, at as fa, aG as Ha, au as Ra, aH as Da, av as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, K as wa, aA as za, b as ja, c as qa, aB as Ga } from "./index-
|
|
1
|
+
import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as C, m as B, E as k, I as g, L as n, g as h, T as p, U as S, h as m, z as P, P as F, n as A, o as T, p as b, q as M, r as y, F as I, G as v, t as L, v as f, s as H, w as R, x as D, y as E, O as U, Q as x, R as W, S as O, V as w, W as z, aC as j, X as q, Y as G, Z as V, aE as Z, aD as J, _ as K, H as N, J as Q, u as X, $ as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as oa, a6 as ia, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, M as da, ac as Ca, ad as Ba, ae as ka, af as ga, ag as na, ah as ha, ai as pa, aj as Sa, ak as ma, al as Pa, am as Fa, an as Aa, ao as Ta, aF as ba, ap as Ma, aq as ya, ar as Ia, a as va, as as La, at as fa, aG as Ha, au as Ra, aH as Da, av as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, K as wa, aA as za, b as ja, c as qa, aB as Ga } from "./index-Cb4I9wM_.js";
|
|
2
2
|
import { g as Za, c as Ja } from "./common-functions-D2lMFR6K.js";
|
|
3
3
|
import { h as Na, h as Qa } from "./apply-binding-B11pPFEE.js";
|
|
4
4
|
import { useTranslation as Ya } from "react-i18next";
|
|
@@ -5635,12 +5635,12 @@ const RichTextEditor = memo(
|
|
|
5635
5635
|
};
|
|
5636
5636
|
return k && C ? {
|
|
5637
5637
|
...P,
|
|
5638
|
-
draggable: !
|
|
5638
|
+
draggable: !a,
|
|
5639
5639
|
onMouseDown: S.onMouseDown,
|
|
5640
5640
|
onDragStart: S.onDragStart,
|
|
5641
5641
|
onDragEnd: S.onDragEnd
|
|
5642
5642
|
} : P;
|
|
5643
|
-
}, [l._id, l._type, h, k, C, S]), j = useMemo(
|
|
5643
|
+
}, [l._id, l._type, h, k, C, S, a]), j = useMemo(
|
|
5644
5644
|
() => ({
|
|
5645
5645
|
blockProps: w,
|
|
5646
5646
|
inBuilder: b === "edit",
|
|
@@ -5837,7 +5837,7 @@ const RichTextEditor = memo(
|
|
|
5837
5837
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
5838
5838
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
5839
5839
|
] }) });
|
|
5840
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
5840
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-aEl9qnMt.js")), CanvasArea = () => {
|
|
5841
5841
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
5842
5842
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
|
|
5843
5843
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -6406,7 +6406,7 @@ const DataBindingSelector = ({
|
|
|
6406
6406
|
]
|
|
6407
6407
|
}
|
|
6408
6408
|
) });
|
|
6409
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
6409
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-BC3QU74X.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
|
|
6410
6410
|
const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
|
|
6411
6411
|
blockId: o,
|
|
6412
6412
|
value: a,
|
|
@@ -8587,7 +8587,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
8587
8587
|
blocks: [
|
|
8588
8588
|
{
|
|
8589
8589
|
_type: "Image",
|
|
8590
|
-
styles: "#styles:,w-full",
|
|
8590
|
+
styles: "#styles:,w-full h-full object-cover",
|
|
8591
8591
|
image: o == null ? void 0 : o.image,
|
|
8592
8592
|
alt: (o == null ? void 0 : o.alt) || "",
|
|
8593
8593
|
_name: (o == null ? void 0 : o.name) || "Image"
|
|
@@ -11963,36 +11963,39 @@ const RootLayout = () => {
|
|
|
11963
11963
|
const i = first(o);
|
|
11964
11964
|
isString(i) && (a = [i, ...getParentNodeIds(n, i)]), r(a);
|
|
11965
11965
|
}, [o, n, r]);
|
|
11966
|
-
}, ScreenTooSmall = () =>
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
alt: "Chai Builder",
|
|
11972
|
-
className: "mx-auto h-20 w-20 rounded-full shadow-lg transition-transform duration-300 hover:scale-105"
|
|
11973
|
-
}
|
|
11974
|
-
),
|
|
11975
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
11976
|
-
/* @__PURE__ */ jsx("h2", { className: "text-5xl font-bold tracking-tight text-gray-900", children: "Screen too small" }),
|
|
11977
|
-
/* @__PURE__ */ jsxs("p", { className: "mx-auto max-w-sm text-sm leading-7 text-gray-600", children: [
|
|
11978
|
-
"Please view this page on greater than ",
|
|
11979
|
-
/* @__PURE__ */ jsx("strong", { className: "font-medium", children: "1280px" }),
|
|
11980
|
-
" screen width for the best experience."
|
|
11981
|
-
] })
|
|
11982
|
-
] }),
|
|
11983
|
-
/* @__PURE__ */ jsx("div", { className: "pt-4", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center rounded-full bg-gray-100 px-4 py-2 text-sm text-gray-700", children: [
|
|
11984
|
-
/* @__PURE__ */ jsx("svg", { className: "mr-2 h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
|
|
11985
|
-
"path",
|
|
11966
|
+
}, ScreenTooSmall = () => {
|
|
11967
|
+
const o = useBuilderProp("smallScreenComponent", null);
|
|
11968
|
+
return /* @__PURE__ */ jsx("section", { className: "fixed inset-0 z-[99999] flex h-screen w-screen items-center justify-center bg-white xl:hidden", children: o ? React__default.createElement(o) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-[linear-gradient(to_right,#f3f4f6_1px,transparent_1px),linear-gradient(to_bottom,#f3f4f6_1px,transparent_1px)] bg-[size:10px_10px] py-12 sm:py-16 lg:py-20", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-md space-y-6 text-center", children: [
|
|
11969
|
+
/* @__PURE__ */ jsx(
|
|
11970
|
+
"img",
|
|
11986
11971
|
{
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
11972
|
+
src: "https://ucarecdn.com/fbfc3b05-cb73-4e99-92a2-3a367b7c36cd/",
|
|
11973
|
+
alt: "Chai Builder",
|
|
11974
|
+
className: "mx-auto h-20 w-20 rounded-full shadow-lg transition-transform duration-300 hover:scale-105"
|
|
11991
11975
|
}
|
|
11992
|
-
)
|
|
11993
|
-
"
|
|
11994
|
-
|
|
11995
|
-
|
|
11976
|
+
),
|
|
11977
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
11978
|
+
/* @__PURE__ */ jsx("h2", { className: "text-5xl font-bold tracking-tight text-gray-900", children: "Screen too small" }),
|
|
11979
|
+
/* @__PURE__ */ jsxs("p", { className: "mx-auto max-w-sm text-sm leading-7 text-gray-600", children: [
|
|
11980
|
+
"Please view this page on greater than ",
|
|
11981
|
+
/* @__PURE__ */ jsx("strong", { className: "font-medium", children: "1280px" }),
|
|
11982
|
+
" screen width for the best experience."
|
|
11983
|
+
] })
|
|
11984
|
+
] }),
|
|
11985
|
+
/* @__PURE__ */ jsx("div", { className: "pt-4", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center rounded-full bg-gray-100 px-4 py-2 text-sm text-gray-700", children: [
|
|
11986
|
+
/* @__PURE__ */ jsx("svg", { className: "mr-2 h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
|
|
11987
|
+
"path",
|
|
11988
|
+
{
|
|
11989
|
+
strokeLinecap: "round",
|
|
11990
|
+
strokeLinejoin: "round",
|
|
11991
|
+
strokeWidth: "2",
|
|
11992
|
+
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
11993
|
+
}
|
|
11994
|
+
) }),
|
|
11995
|
+
"Minimum width: 1280px"
|
|
11996
|
+
] }) })
|
|
11997
|
+
] }) }) }) });
|
|
11998
|
+
};
|
|
11996
11999
|
function isSelfAtom(o, n) {
|
|
11997
12000
|
return o.unstable_is ? o.unstable_is(n) : n === o;
|
|
11998
12001
|
}
|