@chaibuilder/sdk 3.0.26 → 3.0.28
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/IconPicker-BWE43eMO.cjs +1 -0
- package/dist/IconPicker-CluS-5Mv.js +64 -0
- package/dist/{code-editor-CuilXtvr.cjs → code-editor-D9Lla5Lr.cjs} +1 -1
- package/dist/{code-editor-DcA8_k1c.js → code-editor-DmN41-qr.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +40 -39
- package/dist/index-BtVNiUIw.cjs +128 -0
- package/dist/{index-CqT7UFjI.js → index-Ct0lOt4c.js} +47 -25
- package/dist/{rte-widget-modal-CtBOYzKl.cjs → rte-widget-modal-DzEtNny0.cjs} +1 -1
- package/dist/{rte-widget-modal-BdsHiL3Q.js → rte-widget-modal-jYxk5Q4W.js} +1 -1
- package/package.json +2 -1
- package/dist/index-u0fTC0qG.cjs +0 -128
|
@@ -2799,6 +2799,24 @@ const useInlineEditing = () => {
|
|
|
2799
2799
|
setEditingBlockId: n,
|
|
2800
2800
|
setEditingItemIndex: a
|
|
2801
2801
|
};
|
|
2802
|
+
}, replaceBlock = (o, n, r) => {
|
|
2803
|
+
const a = find(o, { _id: n });
|
|
2804
|
+
if (!a) return o;
|
|
2805
|
+
const l = a._parent, i = r.map((d) => ({
|
|
2806
|
+
...d,
|
|
2807
|
+
_parent: l
|
|
2808
|
+
}));
|
|
2809
|
+
return [...filter(o, (d) => d._id !== n && d._parent !== n), ...i];
|
|
2810
|
+
}, useReplaceBlock = () => {
|
|
2811
|
+
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { setNewBlocks: r } = useBlocksStoreUndoableActions(), { hasPermission: a } = usePermissions();
|
|
2812
|
+
return useCallback(
|
|
2813
|
+
(l, i) => {
|
|
2814
|
+
if (!a(PERMISSIONS.EDIT_BLOCK)) return;
|
|
2815
|
+
const c = replaceBlock(o, l, i);
|
|
2816
|
+
r(c), i.length > 0 && setTimeout(() => n([i[0]._id]), 200);
|
|
2817
|
+
},
|
|
2818
|
+
[o, n, r, a]
|
|
2819
|
+
);
|
|
2802
2820
|
}, useSelectedLibrary = () => useAtom$1(selectedLibraryAtom), sidebarActivePanelAtom = atom("outline");
|
|
2803
2821
|
sidebarActivePanelAtom.debugLabel = "sidebarActivePanelAtom";
|
|
2804
2822
|
const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS = [
|
|
@@ -3048,7 +3066,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3048
3066
|
<head>
|
|
3049
3067
|
<meta charset="UTF-8">
|
|
3050
3068
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3051
|
-
<script src="https://cdn.tailwindcss.com/3.4.
|
|
3069
|
+
<script src="https://cdn.tailwindcss.com/3.4.17?plugins=forms@0.5.9,typography@0.5.15,aspect-ratio@0.4.2"><\/script>
|
|
3052
3070
|
<style>
|
|
3053
3071
|
html { height: 100%; overflow:auto; }
|
|
3054
3072
|
body { height: 100%; }
|
|
@@ -4327,7 +4345,7 @@ const CanvasEventsWatcher = () => {
|
|
|
4327
4345
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
4328
4346
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
4329
4347
|
] }) });
|
|
4330
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
4348
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DmN41-qr.js")), CanvasArea = () => {
|
|
4331
4349
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
4332
4350
|
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: [
|
|
4333
4351
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -4355,7 +4373,7 @@ const CanvasEventsWatcher = () => {
|
|
|
4355
4373
|
}, useBlockSettingComponents = (o) => Object.values(RJSF_EXTENSIONS).filter((n) => n.type === o).reduce(
|
|
4356
4374
|
(n, r) => (n[r.id] = r.component, n),
|
|
4357
4375
|
{}
|
|
4358
|
-
), sanitizeSvg = (o) => {
|
|
4376
|
+
), IconPicker = lazy(() => import("./IconPicker-CluS-5Mv.js").then((o) => ({ default: o.IconPicker }))), sanitizeSvg = (o) => {
|
|
4359
4377
|
try {
|
|
4360
4378
|
let n = o.replace(/<svg([^>]*)\sheight="[^"]*"([^>]*)>/gi, "<svg$1$2>").replace(/<svg([^>]*)\swidth="[^"]*"([^>]*)>/gi, "<svg$1$2>");
|
|
4361
4379
|
return n = n.replace(/>\s+</g, "><"), n = n.replace(/\n/g, "").replace(/\s{2,}/g, " "), n = n.replace(/\s+=/g, "=").replace(/=\s+/g, "="), n = n.replace(/<!--[\s\S]*?-->/g, ""), n.trim();
|
|
@@ -4390,7 +4408,10 @@ const CanvasEventsWatcher = () => {
|
|
|
4390
4408
|
}
|
|
4391
4409
|
)
|
|
4392
4410
|
] }),
|
|
4393
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4412
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: "Loading..." }), children: /* @__PURE__ */ jsx(IconPicker, { onSelectIcon: c }) }),
|
|
4413
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG_code") })
|
|
4414
|
+
] })
|
|
4394
4415
|
] });
|
|
4395
4416
|
}, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
|
|
4396
4417
|
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (f) => {
|
|
@@ -4894,7 +4915,7 @@ const DataBindingSelector = ({
|
|
|
4894
4915
|
]
|
|
4895
4916
|
}
|
|
4896
4917
|
) });
|
|
4897
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
4918
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-jYxk5Q4W.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
|
|
4898
4919
|
const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
|
|
4899
4920
|
blockId: o,
|
|
4900
4921
|
value: a,
|
|
@@ -10639,26 +10660,27 @@ export {
|
|
|
10639
10660
|
useRemoveAllClassesForBlock as ab,
|
|
10640
10661
|
useRemoveBlocks as ac,
|
|
10641
10662
|
useRemoveClassesFromBlocks as ad,
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10663
|
+
useReplaceBlock as ae,
|
|
10664
|
+
useResetBlockStyles as af,
|
|
10665
|
+
useRightPanel as ag,
|
|
10666
|
+
useSavePage as ah,
|
|
10667
|
+
useSelectedBlock as ai,
|
|
10668
|
+
useSelectedBlockAllClasses as aj,
|
|
10669
|
+
useSelectedBlockCurrentClasses as ak,
|
|
10670
|
+
useSelectedBlocksDisplayChild as al,
|
|
10671
|
+
useSelectedBreakpoints as am,
|
|
10672
|
+
useSelectedStylingBlocks as an,
|
|
10673
|
+
useStylingBreakpoint as ao,
|
|
10674
|
+
useStylingState as ap,
|
|
10675
|
+
useTheme as aq,
|
|
10676
|
+
useThemeOptions as ar,
|
|
10677
|
+
useUndoManager as as,
|
|
10678
|
+
useWrapperBlock as at,
|
|
10679
|
+
useBlocksStoreUndoableActions as au,
|
|
10680
|
+
useCanvasDisplayWidth as av,
|
|
10681
|
+
useScreenSizeWidth as aw,
|
|
10682
|
+
useSelectedLibrary as ax,
|
|
10683
|
+
useSidebarActivePanel as ay,
|
|
10662
10684
|
useUpdateBlocksProps as b,
|
|
10663
10685
|
useUpdateBlocksPropsRealtime as c,
|
|
10664
10686
|
usePageExternalData as d,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-BtVNiUIw.cjs"),n=require("./tooltip-CzZ7Fvt7.cjs");require("clsx");require("tailwind-merge");const S=({isOpen:m,onClose:l,editor:t,rteElement:f})=>{const r=u.usePageExternalData(),j=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:p,to:g}=t.state.selection;if(p!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,s=c.selection.from,x=c.doc.textBetween(Math.max(0,s-1),s),a=c.doc.textBetween(s,Math.min(s+1,c.doc.content.size));let d="";s>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";a&&a!==" "&&!/[.,!?;:]/.test(a)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(n.Dialog,{open:m,onOpenChange:o=>!o&&l(),children:e.jsxs(n.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(n.DialogHeader,{children:e.jsxs(n.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),Object.keys(r).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(u.NestedPathSelector,{data:r,onSelect:j})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(n.Button,{onClick:l,children:"Done"})})]})})};exports.default=S;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { d as N, N as D } from "./index-
|
|
2
|
+
import { d as N, N as D } from "./index-Ct0lOt4c.js";
|
|
3
3
|
import { a1 as v, a3 as S, a6 as j, a9 as w, v as y } from "./tooltip-Bz2MxMHf.js";
|
|
4
4
|
import "clsx";
|
|
5
5
|
import "tailwind-merge";
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "3.0.
|
|
8
|
+
"version": "3.0.28",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@chaibuilder/runtime": "2.2.0",
|
|
73
73
|
"@floating-ui/dom": "1.7.4",
|
|
74
74
|
"@floating-ui/react-dom": "2.1.6",
|
|
75
|
+
"@iconify-json/lucide": "^1.2.71",
|
|
75
76
|
"@mhsdesign/jit-browser-tailwindcss": "0.4.2",
|
|
76
77
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
77
78
|
"@radix-ui/react-alert-dialog": "^1.1.14",
|