@chaibuilder/sdk 3.0.19 → 3.0.20
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--_5n1fHM.js → code-editor-D2wFgjMt.js} +1 -1
- package/dist/{code-editor-CBlDQDOU.cjs → code-editor-DJwScFxt.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-D82Oycgh.js → index-DVZxqBpz.js} +15 -17
- package/dist/index-JBLy9hg-.cjs +128 -0
- package/dist/{rte-widget-modal-DZeFdaqT.cjs → rte-widget-modal-CnY4bSfN.cjs} +1 -1
- package/dist/{rte-widget-modal-ZDCgSYTI.js → rte-widget-modal-gfRmNGNM.js} +1 -1
- package/package.json +1 -1
- package/dist/index-yyKDajjI.cjs +0 -128
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-JBLy9hg-.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const i=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-CzZ7Fvt7.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]=i.useState(!1),[a,p]=i.useState(""),[t,d]=c.useCodeEditor(),[u]=c.useSelectedBlockIds(),b=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=i.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);i.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-JBLy9hg-.cjs"),s=require("./common-functions-BZmyleS1.cjs"),a=require("./apply-binding-BIYK6lOq.cjs"),i=require("react-i18next"),r=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.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.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.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasDisplayWidth=e.useCanvasDisplayWidth;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.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.useRemoveAllClassesForBlock=e.useRemoveAllClassesForBlock;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;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.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:()=>i.useTranslation});exports.i18n=r;
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as e, A as i, f as o, k as r, B as l, e as t, C as u, i as d, D as c, l as g, I as C, L as k, g as n, T as B, U as h, h as S, x as p, P as m, m as P, n as F, o as T, r as A, y, z as I, q as M, s as b, p as v, t as L, v as f, w as R, J as D, K as E, M as H, O as U, Q as x, at as O, R as W, S as w, V as z, au as j, W as q, E as Z, F as G, u as J, X as K, Y as N, Z as Q, _ as V, $ as X, a0 as Y, a1 as _, a2 as $, a3 as aa, a4 as sa, a5 as ea, H as ia, a6 as oa, a7 as ra, a8 as la, a9 as ta, aa as ua, ab as da, ac as ca, ad as ga, ae as Ca, af as ka, ag as na, av as Ba, ah as ha, ai as Sa, aj as pa, a as ma, ak as Pa, al as Fa, aw as Ta, am as Aa, ax as ya, an as Ia, ao as Ma, ap as ba, aq as va, G as La, ar as fa, b as Ra, c as Da, as as Ea } from "./index-
|
|
1
|
+
import { j as e, A as i, f as o, k as r, B as l, e as t, C as u, i as d, D as c, l as g, I as C, L as k, g as n, T as B, U as h, h as S, x as p, P as m, m as P, n as F, o as T, r as A, y, z as I, q as M, s as b, p as v, t as L, v as f, w as R, J as D, K as E, M as H, O as U, Q as x, at as O, R as W, S as w, V as z, au as j, W as q, E as Z, F as G, u as J, X as K, Y as N, Z as Q, _ as V, $ as X, a0 as Y, a1 as _, a2 as $, a3 as aa, a4 as sa, a5 as ea, H as ia, a6 as oa, a7 as ra, a8 as la, a9 as ta, aa as ua, ab as da, ac as ca, ad as ga, ae as Ca, af as ka, ag as na, av as Ba, ah as ha, ai as Sa, aj as pa, a as ma, ak as Pa, al as Fa, aw as Ta, am as Aa, ax as ya, an as Ia, ao as Ma, ap as ba, aq as va, G as La, ar as fa, b as Ra, c as Da, as as Ea } from "./index-DVZxqBpz.js";
|
|
2
2
|
import { g as Ua, c as xa } from "./common-functions-BGzDsf1z.js";
|
|
3
3
|
import { h as Wa, h as wa } from "./apply-binding-YbVf4970.js";
|
|
4
4
|
import { useTranslation as ja } from "react-i18next";
|
|
@@ -2380,9 +2380,7 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2380
2380
|
if (l) {
|
|
2381
2381
|
n(!0), a(null);
|
|
2382
2382
|
try {
|
|
2383
|
-
const y = p === u ? "" : p;
|
|
2384
|
-
console.log("prompt", x);
|
|
2385
|
-
const S = x.toLowerCase().includes("translate the content"), C = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, S) : [m(f, d)], B = await l(h, addLangToPrompt(x, g, h), C, y), { blocks: _, error: w } = B;
|
|
2383
|
+
const y = p === u ? "" : p, S = x.toLowerCase().includes("translate the content"), C = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, S) : [m(f, d)], B = await l(h, addLangToPrompt(x, g, h), C, y), { blocks: _, error: w } = B;
|
|
2386
2384
|
if (w) {
|
|
2387
2385
|
a(w);
|
|
2388
2386
|
return;
|
|
@@ -4329,7 +4327,7 @@ const CanvasEventsWatcher = () => {
|
|
|
4329
4327
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
4330
4328
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
4331
4329
|
] }) });
|
|
4332
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor
|
|
4330
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-D2wFgjMt.js")), CanvasArea = () => {
|
|
4333
4331
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
4334
4332
|
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: [
|
|
4335
4333
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -4485,11 +4483,11 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4485
4483
|
}
|
|
4486
4484
|
}, y = useCallback(() => {
|
|
4487
4485
|
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
4488
|
-
const C = {
|
|
4489
|
-
set(C, B ? "mobileWidth" : "width", ""), set(C, B ? "mobileHeight" : "height", ""), d([c._id], C);
|
|
4486
|
+
const C = {}, B = g.includes("mobile");
|
|
4487
|
+
set(C, g, ""), set(C, B ? "mobileWidth" : "width", ""), set(C, B ? "mobileHeight" : "height", ""), d([c._id], C);
|
|
4490
4488
|
}
|
|
4491
4489
|
}, [n, c == null ? void 0 : c._id, d, g]), S = getFileName(f);
|
|
4492
|
-
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-
|
|
4490
|
+
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
|
|
4493
4491
|
f ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
4494
4492
|
/* @__PURE__ */ jsx(
|
|
4495
4493
|
"img",
|
|
@@ -4519,8 +4517,9 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4519
4517
|
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, mode: "image", assetId: h, children: /* @__PURE__ */ jsx("div", { className: "h-14 w-14 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
4520
4518
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4521
4519
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4522
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
4523
|
-
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 w-
|
|
4520
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children: S }),
|
|
4521
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 mb-1 w-full cursor-pointer rounded-md bg-secondary px-1 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: !isEmpty(f) && f !== PLACEHOLDER_IMAGE ? l("Replace image") : l("Choose image") }) }),
|
|
4522
|
+
/* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-400", children: "OR" })
|
|
4524
4523
|
] }),
|
|
4525
4524
|
/* @__PURE__ */ jsx(
|
|
4526
4525
|
"input",
|
|
@@ -4530,9 +4529,9 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4530
4529
|
autoCorrect: "off",
|
|
4531
4530
|
spellCheck: "false",
|
|
4532
4531
|
type: "url",
|
|
4533
|
-
className: "
|
|
4532
|
+
className: "h-6 text-xs",
|
|
4534
4533
|
placeholder: l("Enter image URL"),
|
|
4535
|
-
value: o,
|
|
4534
|
+
value: o === PLACEHOLDER_IMAGE ? "" : o,
|
|
4536
4535
|
onBlur: ({ target: { value: C } }) => a(r, C),
|
|
4537
4536
|
onChange: (C) => n(C.target.value)
|
|
4538
4537
|
}
|
|
@@ -4894,7 +4893,7 @@ const DataBindingSelector = ({
|
|
|
4894
4893
|
]
|
|
4895
4894
|
}
|
|
4896
4895
|
) });
|
|
4897
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
4896
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-gfRmNGNM.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
|
|
4898
4897
|
const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
|
|
4899
4898
|
blockId: o,
|
|
4900
4899
|
value: a,
|
|
@@ -9087,12 +9086,11 @@ function QuickPrompts({ onClick: o }) {
|
|
|
9087
9086
|
}
|
|
9088
9087
|
]];
|
|
9089
9088
|
return a && a !== l && c.splice(0, 0, {
|
|
9090
|
-
name: r("Translate to
|
|
9089
|
+
name: r("Translate to {{lang}}", { lang: get(LANGUAGES, a, a) }),
|
|
9091
9090
|
icon: ChatBubbleIcon,
|
|
9092
|
-
prompt: r(
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
)
|
|
9091
|
+
prompt: r("Translate the content to {{lang}}. Maintain same tone, style and length.", {
|
|
9092
|
+
lang: get(LANGUAGES, a, a)
|
|
9093
|
+
})
|
|
9096
9094
|
}), /* @__PURE__ */ jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: c.map(
|
|
9097
9095
|
({ name: d, icon: p, subMenus: u, prompt: g }) => u ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
9098
9096
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|