@chaibuilder/sdk 3.1.7 → 3.1.8
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-DEY4IkBJ.cjs → code-editor-C5J-eWjr.cjs} +1 -1
- package/dist/{code-editor-D1w8nUwt.js → code-editor-CihZ_PJK.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1 -1
- package/dist/{css-import-modal-P7f5SEKA.cjs → css-import-modal-BLAkS06W.cjs} +2 -2
- package/dist/{css-import-modal-DK2j6oGY.js → css-import-modal-DgLi5BIu.js} +25 -25
- package/dist/{index-CONV5Fbc.cjs → index-ArvL08VQ.cjs} +6 -6
- package/dist/{index-Cj8rTugy.js → index-C7JEjy8N.js} +237 -227
- package/dist/{rte-widget-modal-D_Yor38o.cjs → rte-widget-modal-CH1Bo9Mz.cjs} +1 -1
- package/dist/{rte-widget-modal-CsOaIXCW.js → rte-widget-modal-DpWQvFjm.js} +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ var $ = (o, n, r) => W(o, typeof n != "symbol" ? n + "" : n, r);
|
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, syncBlocksWithDefaults, useRegisteredFonts, getBlockFormSchemas } from "@chaibuilder/runtime";
|
|
6
6
|
import { get, find, filter, flatten, has, map, includes, without, compact, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, kebabCase, round, reverse, findIndex, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy } from "lodash-es";
|
|
7
|
-
import { SquareIcon, ZoomInIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, DotsHorizontalIcon, LightningBoltIcon, StackIcon, DragHandleDots2Icon } from "@radix-ui/react-icons";
|
|
7
|
+
import { SquareIcon, ZoomInIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, GearIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, DotsHorizontalIcon, LightningBoltIcon, StackIcon, DragHandleDots2Icon } from "@radix-ui/react-icons";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
|
|
10
10
|
import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
|
|
@@ -728,12 +728,12 @@ const undoRedoStateAtom = atom({
|
|
|
728
728
|
} = useBlocksStoreManager();
|
|
729
729
|
return {
|
|
730
730
|
moveBlocks: (x, b, y) => {
|
|
731
|
-
const
|
|
731
|
+
const C = map(x, (w) => {
|
|
732
732
|
const B = n.find((A) => A._id === w)._parent || null, k = n.filter((A) => B ? A._parent === B : !A._parent).map((A) => A._id).indexOf(w);
|
|
733
733
|
return { _id: w, oldParent: B, oldPosition: k };
|
|
734
|
-
}),
|
|
735
|
-
|
|
736
|
-
undo: () => each(
|
|
734
|
+
}), S = C.find(({ _id: w }) => w === x[0]);
|
|
735
|
+
S && S.oldParent === b && S.oldPosition === y || (i(x, b, y), o({
|
|
736
|
+
undo: () => each(C, ({ _id: w, oldParent: _, oldPosition: B }) => {
|
|
737
737
|
i([w], _, B);
|
|
738
738
|
}),
|
|
739
739
|
redo: () => i(x, b, y)
|
|
@@ -746,27 +746,27 @@ const undoRedoStateAtom = atom({
|
|
|
746
746
|
});
|
|
747
747
|
},
|
|
748
748
|
removeBlocks: (x) => {
|
|
749
|
-
var
|
|
750
|
-
const b = (
|
|
749
|
+
var S;
|
|
750
|
+
const b = (S = first(x)) == null ? void 0 : S._parent, C = n.filter((w) => b ? w._parent === b : !w._parent).indexOf(first(x));
|
|
751
751
|
l(map(x, "_id")), o({
|
|
752
|
-
undo: () => a(x, b,
|
|
752
|
+
undo: () => a(x, b, C),
|
|
753
753
|
redo: () => l(map(x, "_id"))
|
|
754
754
|
});
|
|
755
755
|
},
|
|
756
756
|
updateBlocks: (x, b, y) => {
|
|
757
|
-
let
|
|
757
|
+
let C = [];
|
|
758
758
|
if (y)
|
|
759
|
-
|
|
759
|
+
C = map(x, (S) => ({ _id: S, ...y }));
|
|
760
760
|
else {
|
|
761
|
-
const
|
|
762
|
-
|
|
761
|
+
const S = keys(b);
|
|
762
|
+
C = map(x, (w) => {
|
|
763
763
|
const _ = n.find((I) => I._id === w), B = { _id: w };
|
|
764
|
-
return each(
|
|
764
|
+
return each(S, (I) => B[I] = _[I]), B;
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
|
-
c(map(x, (
|
|
768
|
-
undo: () => c(
|
|
769
|
-
redo: () => c(map(x, (
|
|
767
|
+
c(map(x, (S) => ({ _id: S, ...b }))), o({
|
|
768
|
+
undo: () => c(C),
|
|
769
|
+
redo: () => c(map(x, (S) => ({ _id: S, ...b })))
|
|
770
770
|
});
|
|
771
771
|
},
|
|
772
772
|
updateBlocksRuntime: (x, b) => {
|
|
@@ -781,8 +781,8 @@ const undoRedoStateAtom = atom({
|
|
|
781
781
|
updateMultipleBlocksProps: (x) => {
|
|
782
782
|
let b = [];
|
|
783
783
|
b = map(x, (y) => {
|
|
784
|
-
const
|
|
785
|
-
return each(
|
|
784
|
+
const C = keys(y), S = n.find((_) => _._id === y._id), w = {};
|
|
785
|
+
return each(C, (_) => w[_] = S[_]), w;
|
|
786
786
|
}), c(x), o({
|
|
787
787
|
undo: () => c(b),
|
|
788
788
|
redo: () => c(x)
|
|
@@ -2285,8 +2285,8 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2285
2285
|
for (const b in x) {
|
|
2286
2286
|
const y = x[b];
|
|
2287
2287
|
if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
|
|
2288
|
-
const { baseClasses:
|
|
2289
|
-
x[b] = compact(flattenDeep([
|
|
2288
|
+
const { baseClasses: C, classes: S } = getSplitChaiClasses(y);
|
|
2289
|
+
x[b] = compact(flattenDeep([C, S])).join(" ");
|
|
2290
2290
|
} else
|
|
2291
2291
|
b !== "_id" && delete x[b];
|
|
2292
2292
|
}
|
|
@@ -2298,7 +2298,7 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2298
2298
|
if (l) {
|
|
2299
2299
|
n(!0), a(null);
|
|
2300
2300
|
try {
|
|
2301
|
-
const y = p === d ? "" : p,
|
|
2301
|
+
const y = p === d ? "" : p, C = x.toLowerCase().includes("translate the content"), S = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, u)), p, C) : [m(f, u)], w = await l(h, addLangToPrompt(x, g, h), S, y), { blocks: _, error: B } = w;
|
|
2302
2302
|
if (B) {
|
|
2303
2303
|
a(B);
|
|
2304
2304
|
return;
|
|
@@ -2971,6 +2971,7 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), ScalePerc
|
|
|
2971
2971
|
OPEN_ADD_BLOCK: "OPEN_ADD_BLOCK",
|
|
2972
2972
|
CLOSE_ADD_BLOCK: "CLOSE_ADD_BLOCK",
|
|
2973
2973
|
SHOW_BLOCK_SETTINGS: "SHOW_BLOCK_SETTINGS",
|
|
2974
|
+
GOTO_BLOCK_SETTINGS: "GOTO_BLOCK_SETTINGS",
|
|
2974
2975
|
//CANVAS Events
|
|
2975
2976
|
CLEAR_CANVAS_SELECTION: "CLEAR_CANVAS_SELECTION",
|
|
2976
2977
|
CANVAS_BLOCK_SELECTED: "CANVAS_BLOCK_SELECTED",
|
|
@@ -3061,7 +3062,9 @@ const FrameContext = React__default.createContext({ document: doc, window: win }
|
|
|
3061
3062
|
}, AiIcon = ({
|
|
3062
3063
|
className: o = "h-full w-full",
|
|
3063
3064
|
onClick: n = noop$1
|
|
3064
|
-
}) => /* @__PURE__ */ jsx("svg", { className: o, viewBox: "0 0 256 256", fill: "currentColor", onClick: n, children: /* @__PURE__ */ jsx("path", { d: "m198.39 128.986-52.16-19.216-19.216-52.16a16 16 0 0 0-30.028 0L77.77 109.77l-52.16 19.216a16 16 0 0 0 0 30.028l52.16 19.216 19.216 52.16a16 16 0 0 0 30.028 0l19.216-52.16 52.16-19.216a16 16 0 0 0 0-30.028m-57.69 34.23a15.97 15.97 0 0 0-9.483 9.483l-19.22 52.152-19.214-52.15a15.97 15.97 0 0 0-9.482-9.484l-52.152-19.22 52.15-19.214a15.97 15.97 0 0 0 9.484-9.482l19.22-52.152 19.214 52.15a15.97 15.97 0 0 0 9.482 9.484l52.152 19.22ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8" }) })
|
|
3065
|
+
}) => /* @__PURE__ */ jsx("svg", { className: o, viewBox: "0 0 256 256", fill: "currentColor", onClick: n, children: /* @__PURE__ */ jsx("path", { d: "m198.39 128.986-52.16-19.216-19.216-52.16a16 16 0 0 0-30.028 0L77.77 109.77l-52.16 19.216a16 16 0 0 0 0 30.028l52.16 19.216 19.216 52.16a16 16 0 0 0 30.028 0l19.216-52.16 52.16-19.216a16 16 0 0 0 0-30.028m-57.69 34.23a15.97 15.97 0 0 0-9.483 9.483l-19.22 52.152-19.214-52.15a15.97 15.97 0 0 0-9.482-9.484l-52.152-19.22 52.15-19.214a15.97 15.97 0 0 0 9.484-9.482l19.22-52.152 19.214 52.15a15.97 15.97 0 0 0 9.482 9.484l52.152 19.22ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8" }) }), GotoSettingsIcon = ({ blockId: o, className: n }) => /* @__PURE__ */ jsx(GearIcon, { className: n, onClick: () => {
|
|
3066
|
+
o && pubsub.publish(CHAI_BUILDER_EVENTS.GOTO_BLOCK_SETTINGS, o);
|
|
3067
|
+
} });
|
|
3065
3068
|
function getTargetedBlock(o) {
|
|
3066
3069
|
if (o.getAttribute("data-block-id") === "canvas")
|
|
3067
3070
|
return null;
|
|
@@ -3180,7 +3183,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3180
3183
|
i([null]);
|
|
3181
3184
|
}, [r, n]), /* @__PURE__ */ jsx(BlockFloatingSelector, { block: o, selectedBlockElement: a[0] });
|
|
3182
3185
|
}, BlockFloatingSelector = ({ block: o, selectedBlockElement: n }) => {
|
|
3183
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: u } = usePermissions(), { editingBlockId: p } = useInlineEditing(), { document: d } = useFrame(), { floatingStyles:
|
|
3186
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: u } = usePermissions(), { editingBlockId: p } = useInlineEditing(), { document: d } = useFrame(), g = useBuilderProp("flags.gotoSettings", !1), { floatingStyles: m, refs: h, update: f } = useFloating({
|
|
3184
3187
|
placement: "top-start",
|
|
3185
3188
|
middleware: [
|
|
3186
3189
|
shift({
|
|
@@ -3197,9 +3200,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3197
3200
|
}),
|
|
3198
3201
|
size({
|
|
3199
3202
|
boundary: d == null ? void 0 : d.body,
|
|
3200
|
-
apply({ availableWidth:
|
|
3201
|
-
Object.assign(
|
|
3202
|
-
maxWidth: `${Math.max(200,
|
|
3203
|
+
apply({ availableWidth: C, availableHeight: S, elements: w }) {
|
|
3204
|
+
Object.assign(w.floating.style, {
|
|
3205
|
+
maxWidth: `${Math.max(200, C)}px`,
|
|
3203
3206
|
maxHeight: `${Math.max(100, S)}px`
|
|
3204
3207
|
});
|
|
3205
3208
|
}
|
|
@@ -3207,48 +3210,55 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3207
3210
|
],
|
|
3208
3211
|
elements: { reference: n }
|
|
3209
3212
|
});
|
|
3210
|
-
useResizeObserver(n, () =>
|
|
3211
|
-
const
|
|
3213
|
+
useResizeObserver(n, () => f(), n !== null), useResizeObserver(d == null ? void 0 : d.body, () => f(), (d == null ? void 0 : d.body) !== null);
|
|
3214
|
+
const x = get(o, "_parent", null), b = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
3212
3215
|
useEffect(() => {
|
|
3213
3216
|
if (n) {
|
|
3214
|
-
const
|
|
3215
|
-
return () => clearTimeout(
|
|
3217
|
+
const C = setTimeout(() => f(), 500);
|
|
3218
|
+
return () => clearTimeout(C);
|
|
3216
3219
|
} else
|
|
3217
|
-
|
|
3220
|
+
f();
|
|
3218
3221
|
}, [n]);
|
|
3219
|
-
const [,
|
|
3222
|
+
const [, y] = useSidebarActivePanel();
|
|
3220
3223
|
return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
3221
3224
|
"div",
|
|
3222
3225
|
{
|
|
3223
3226
|
role: "button",
|
|
3224
3227
|
tabIndex: 0,
|
|
3225
|
-
ref:
|
|
3226
|
-
style:
|
|
3227
|
-
onClick: (
|
|
3228
|
-
|
|
3228
|
+
ref: h.setFloating,
|
|
3229
|
+
style: m,
|
|
3230
|
+
onClick: (C) => {
|
|
3231
|
+
C.stopPropagation(), C.preventDefault();
|
|
3229
3232
|
},
|
|
3230
|
-
onMouseEnter: (
|
|
3231
|
-
|
|
3233
|
+
onMouseEnter: (C) => {
|
|
3234
|
+
C.stopPropagation(), i(null);
|
|
3232
3235
|
},
|
|
3233
|
-
onKeyDown: (
|
|
3236
|
+
onKeyDown: (C) => C.stopPropagation(),
|
|
3234
3237
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3235
3238
|
children: [
|
|
3236
|
-
|
|
3239
|
+
x && /* @__PURE__ */ jsx(
|
|
3237
3240
|
ArrowUpIcon,
|
|
3238
3241
|
{
|
|
3239
3242
|
className: "rounded p-0.5 hover:bg-white/20",
|
|
3240
3243
|
onClick: () => {
|
|
3241
|
-
c([]), l([
|
|
3244
|
+
c([]), l([x]);
|
|
3242
3245
|
}
|
|
3243
3246
|
}
|
|
3244
3247
|
),
|
|
3245
|
-
/* @__PURE__ */ jsx(BlockActionLabel, { label:
|
|
3248
|
+
/* @__PURE__ */ jsx(BlockActionLabel, { label: b, block: o }),
|
|
3246
3249
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pl-1 pr-1.5", children: [
|
|
3247
3250
|
u(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
|
|
3248
3251
|
AiIcon,
|
|
3249
3252
|
{
|
|
3250
3253
|
className: "h-4 w-4 rounded hover:bg-white hover:text-blue-500",
|
|
3251
|
-
onClick: () =>
|
|
3254
|
+
onClick: () => y("chai-chat-panel")
|
|
3255
|
+
}
|
|
3256
|
+
),
|
|
3257
|
+
g && /* @__PURE__ */ jsx(
|
|
3258
|
+
GotoSettingsIcon,
|
|
3259
|
+
{
|
|
3260
|
+
blockId: o == null ? void 0 : o._id,
|
|
3261
|
+
className: "h-4 w-4 rounded p-px hover:bg-white hover:text-blue-500"
|
|
3252
3262
|
}
|
|
3253
3263
|
),
|
|
3254
3264
|
/* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4 rounded p-px hover:bg-white hover:text-blue-500" }) }),
|
|
@@ -3266,7 +3276,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3266
3276
|
onClick: () => r([o == null ? void 0 : o._id])
|
|
3267
3277
|
}
|
|
3268
3278
|
) : null,
|
|
3269
|
-
u(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar:
|
|
3279
|
+
u(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: f })
|
|
3270
3280
|
] })
|
|
3271
3281
|
]
|
|
3272
3282
|
}
|
|
@@ -3693,12 +3703,12 @@ const RteDropdownMenu = ({
|
|
|
3693
3703
|
}) => {
|
|
3694
3704
|
const { document: i } = useFrame(), [c, u] = useState({ left: void 0, right: void 0, top: void 0, bottom: void 0 }), [p, d] = useState(!1), g = useRef(null);
|
|
3695
3705
|
if (useEffect(() => {
|
|
3696
|
-
var
|
|
3706
|
+
var C, S;
|
|
3697
3707
|
if (!p) {
|
|
3698
3708
|
u({ left: void 0, right: void 0, top: void 0, bottom: void 0 });
|
|
3699
3709
|
return;
|
|
3700
3710
|
}
|
|
3701
|
-
const m = (
|
|
3711
|
+
const m = (C = g.current) == null ? void 0 : C.getBoundingClientRect(), h = (S = l.current) == null ? void 0 : S.getBoundingClientRect();
|
|
3702
3712
|
let f = m == null ? void 0 : m.left, x = (m == null ? void 0 : m.bottom) + 4, b, y;
|
|
3703
3713
|
(h == null ? void 0 : h.left) + (h == null ? void 0 : h.width) + 50 >= i.body.offsetWidth && (f = void 0, b = i.body.offsetWidth - (m == null ? void 0 : m.right)), x + 202 >= i.body.clientHeight && (x = null, y = i.body.clientHeight - (m == null ? void 0 : m.bottom) + (h == null ? void 0 : h.height)), u({ left: f, top: x, right: b, bottom: y });
|
|
3704
3714
|
}, [p]), a === "canvas") {
|
|
@@ -3848,8 +3858,8 @@ const getActiveClasses$1 = (o, n, r) => {
|
|
|
3848
3858
|
)
|
|
3849
3859
|
] });
|
|
3850
3860
|
}, RteColorPicker = ({ editor: o, from: n, menuRef: r }) => {
|
|
3851
|
-
var
|
|
3852
|
-
const a = (
|
|
3861
|
+
var S, w;
|
|
3862
|
+
const a = (S = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : S.color, l = (w = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : w.color, [i, c] = useState(a || "#000000F2"), [u, p] = useState(l || "#00000057"), [d, g] = useDebouncedState(i, 150), [m, h] = useDebouncedState(u, 150), f = (_, B) => {
|
|
3853
3863
|
B ? (c(_), g(_)) : (o == null || o.chain().setColor(_).run(), c(_));
|
|
3854
3864
|
}, x = (_, B) => {
|
|
3855
3865
|
B ? (p(_), h(_)) : (o == null || o.chain().setHighlight({ color: _ }).run(), p(_));
|
|
@@ -4160,8 +4170,8 @@ const RichTextEditor = memo(
|
|
|
4160
4170
|
placeholder: "Enter text here",
|
|
4161
4171
|
onUpdate: ({ editor: d }) => a((d == null ? void 0 : d.getHTML()) || ""),
|
|
4162
4172
|
onBlur: ({ editor: d, event: g }) => {
|
|
4163
|
-
const m = g == null ? void 0 : g.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(m), y = f == null ? void 0 : f.contains(m),
|
|
4164
|
-
if (!b && !y && !
|
|
4173
|
+
const m = g == null ? void 0 : g.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(m), y = f == null ? void 0 : f.contains(m), C = x == null ? void 0 : x.contains(m), S = window.document.getElementById("rte-widget-color-picker");
|
|
4174
|
+
if (!b && !y && !C && !S) {
|
|
4165
4175
|
const w = (d == null ? void 0 : d.getHTML()) || "";
|
|
4166
4176
|
r(w);
|
|
4167
4177
|
}
|
|
@@ -4254,7 +4264,7 @@ const RichTextEditor = memo(
|
|
|
4254
4264
|
}
|
|
4255
4265
|
), WithBlockTextEditor = memo(
|
|
4256
4266
|
({ block: o, children: n }) => {
|
|
4257
|
-
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: u } = useInlineEditing(), [p, d] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), b = useRef(null), y = l, { blockContent:
|
|
4267
|
+
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: u } = useInlineEditing(), [p, d] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), b = useRef(null), y = l, { blockContent: C, blockType: S } = useMemo(() => {
|
|
4258
4268
|
var j;
|
|
4259
4269
|
const k = o._type;
|
|
4260
4270
|
let A = o[r];
|
|
@@ -4287,11 +4297,11 @@ const RichTextEditor = memo(
|
|
|
4287
4297
|
if (!y) return;
|
|
4288
4298
|
const k = `[data-block-id="${y}"]`, A = i >= 0 ? `[data-block-index="${i}"]` : "", v = a.querySelector(`${k}${A}`);
|
|
4289
4299
|
v && ((E = v == null ? void 0 : v.classList) == null || E.add("sr-only"), d(v));
|
|
4290
|
-
}, [y,
|
|
4291
|
-
const I = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(
|
|
4300
|
+
}, [y, S, a, i]);
|
|
4301
|
+
const I = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(S) ? /* @__PURE__ */ jsx(
|
|
4292
4302
|
RichTextEditor,
|
|
4293
4303
|
{
|
|
4294
|
-
blockContent:
|
|
4304
|
+
blockContent: C,
|
|
4295
4305
|
editingElement: p,
|
|
4296
4306
|
onChange: _,
|
|
4297
4307
|
onClose: w,
|
|
@@ -4301,13 +4311,13 @@ const RichTextEditor = memo(
|
|
|
4301
4311
|
MemoizedEditor,
|
|
4302
4312
|
{
|
|
4303
4313
|
editorRef: g,
|
|
4304
|
-
blockContent:
|
|
4314
|
+
blockContent: C,
|
|
4305
4315
|
editingElement: p,
|
|
4306
4316
|
onClose: w,
|
|
4307
4317
|
onChange: _,
|
|
4308
4318
|
onEscape: B
|
|
4309
4319
|
}
|
|
4310
|
-
)) : null, [p, y,
|
|
4320
|
+
)) : null, [p, y, S, C, w, f]);
|
|
4311
4321
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4312
4322
|
I,
|
|
4313
4323
|
n
|
|
@@ -4351,7 +4361,7 @@ const RichTextEditor = memo(
|
|
|
4351
4361
|
key: x
|
|
4352
4362
|
}) : applyLanguage(i, u, c),
|
|
4353
4363
|
[i, u, c, g, m, f, x]
|
|
4354
|
-
),
|
|
4364
|
+
), C = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), S = useMemo(
|
|
4355
4365
|
() => d(i._id, getBlockRuntimeProps(i._type)),
|
|
4356
4366
|
[i._id, i._type, d, getBlockRuntimeProps]
|
|
4357
4367
|
), w = useMemo(
|
|
@@ -4360,8 +4370,8 @@ const RichTextEditor = memo(
|
|
|
4360
4370
|
inBuilder: b === "edit",
|
|
4361
4371
|
lang: u || p,
|
|
4362
4372
|
...y,
|
|
4363
|
-
...S,
|
|
4364
4373
|
...C,
|
|
4374
|
+
...S,
|
|
4365
4375
|
...o
|
|
4366
4376
|
}),
|
|
4367
4377
|
[
|
|
@@ -4371,8 +4381,8 @@ const RichTextEditor = memo(
|
|
|
4371
4381
|
u,
|
|
4372
4382
|
p,
|
|
4373
4383
|
y,
|
|
4374
|
-
S,
|
|
4375
4384
|
C,
|
|
4385
|
+
S,
|
|
4376
4386
|
o
|
|
4377
4387
|
]
|
|
4378
4388
|
), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), B = useMemo(() => get(i, "_show", !0), [i]);
|
|
@@ -4552,7 +4562,7 @@ const RichTextEditor = memo(
|
|
|
4552
4562
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
4553
4563
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
4554
4564
|
] }) });
|
|
4555
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
4565
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-CihZ_PJK.js")), CanvasArea = () => {
|
|
4556
4566
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
4557
4567
|
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: [
|
|
4558
4568
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -4695,8 +4705,8 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4695
4705
|
if (!o || !c || !/\{\{.*?\}\}/.test(o)) return o;
|
|
4696
4706
|
const w = { ...c, [d]: o }, _ = applyBindingToBlockProps(w, p, { index: -1, key: "" });
|
|
4697
4707
|
return get(_, d, o);
|
|
4698
|
-
}, [o, c, p, d]), x = !!h || f !== PLACEHOLDER_IMAGE, b = (
|
|
4699
|
-
const w = isArray(
|
|
4708
|
+
}, [o, c, p, d]), x = !!h || f !== PLACEHOLDER_IMAGE, b = (S) => {
|
|
4709
|
+
const w = isArray(S) ? first(S) : S;
|
|
4700
4710
|
if (w) {
|
|
4701
4711
|
n(w == null ? void 0 : w.url);
|
|
4702
4712
|
const _ = w == null ? void 0 : w.width, B = w == null ? void 0 : w.height, I = g.includes("mobile");
|
|
@@ -4712,10 +4722,10 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4712
4722
|
}
|
|
4713
4723
|
}, y = useCallback(() => {
|
|
4714
4724
|
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
4715
|
-
const
|
|
4716
|
-
set(
|
|
4725
|
+
const S = {}, w = g.includes("mobile");
|
|
4726
|
+
set(S, g, ""), set(S, w ? "mobileWidth" : "width", ""), set(S, w ? "mobileHeight" : "height", ""), u([c._id], S);
|
|
4717
4727
|
}
|
|
4718
|
-
}, [n, c == null ? void 0 : c._id, u, g]),
|
|
4728
|
+
}, [n, c == null ? void 0 : c._id, u, g]), C = getFileName(f);
|
|
4719
4729
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
|
|
4720
4730
|
f ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
4721
4731
|
/* @__PURE__ */ jsx(
|
|
@@ -4746,7 +4756,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4746
4756
|
] }) : /* @__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]" }) }),
|
|
4747
4757
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4748
4758
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4749
|
-
/* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children:
|
|
4759
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children: C }),
|
|
4750
4760
|
/* @__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") }) }),
|
|
4751
4761
|
/* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-400", children: "OR" })
|
|
4752
4762
|
] }),
|
|
@@ -4761,8 +4771,8 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4761
4771
|
className: "h-6 text-xs",
|
|
4762
4772
|
placeholder: l("Enter image URL"),
|
|
4763
4773
|
value: o === PLACEHOLDER_IMAGE ? "" : o,
|
|
4764
|
-
onBlur: ({ target: { value:
|
|
4765
|
-
onChange: (
|
|
4774
|
+
onBlur: ({ target: { value: S } }) => a(r, S),
|
|
4775
|
+
onChange: (S) => n(S.target.value)
|
|
4766
4776
|
}
|
|
4767
4777
|
)
|
|
4768
4778
|
] })
|
|
@@ -4878,10 +4888,10 @@ const DataBindingSelector = ({
|
|
|
4878
4888
|
n(`{{${m}}}`, {}, r);
|
|
4879
4889
|
return;
|
|
4880
4890
|
}
|
|
4881
|
-
const f = (
|
|
4891
|
+
const f = (C) => /[.,!?;:]/.test(C), x = (C, S, w) => {
|
|
4882
4892
|
let _ = "", B = "";
|
|
4883
|
-
const I =
|
|
4884
|
-
return
|
|
4893
|
+
const I = S > 0 ? C[S - 1] : "", k = S < C.length ? C[S] : "";
|
|
4894
|
+
return S > 0 && (I === "." || !f(I) && I !== " ") && (_ = " "), S < C.length && !f(k) && k !== " " && (B = " "), {
|
|
4885
4895
|
text: _ + w + B,
|
|
4886
4896
|
prefixLength: _.length,
|
|
4887
4897
|
suffixLength: B.length
|
|
@@ -4890,31 +4900,31 @@ const DataBindingSelector = ({
|
|
|
4890
4900
|
if (!b) return;
|
|
4891
4901
|
const y = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
|
|
4892
4902
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4893
|
-
const
|
|
4894
|
-
if (
|
|
4895
|
-
const
|
|
4896
|
-
|
|
4897
|
-
const { from: w, to: _ } =
|
|
4903
|
+
const C = y.__chaiRTE;
|
|
4904
|
+
if (C) {
|
|
4905
|
+
const S = `{{${m}}}`;
|
|
4906
|
+
C.commands.focus();
|
|
4907
|
+
const { from: w, to: _ } = C.state.selection;
|
|
4898
4908
|
if (w !== _)
|
|
4899
|
-
|
|
4909
|
+
C.chain().deleteSelection().insertContent(S).run();
|
|
4900
4910
|
else {
|
|
4901
|
-
const { state: I } =
|
|
4911
|
+
const { state: I } = C, k = I.selection.from, A = I.doc.textBetween(Math.max(0, k - 1), k), v = I.doc.textBetween(k, Math.min(k + 1, I.doc.content.size));
|
|
4902
4912
|
let E = "";
|
|
4903
4913
|
k > 0 && A !== " " && !f(A) && (E = " ");
|
|
4904
4914
|
let j = "";
|
|
4905
|
-
v && v !== " " && !f(v) && (j = " "),
|
|
4915
|
+
v && v !== " " && !f(v) && (j = " "), C.chain().insertContent(E + S + j).run();
|
|
4906
4916
|
}
|
|
4907
|
-
setTimeout(() => n(
|
|
4917
|
+
setTimeout(() => n(C.getHTML(), {}, r), 100);
|
|
4908
4918
|
return;
|
|
4909
4919
|
}
|
|
4910
4920
|
} else {
|
|
4911
|
-
const
|
|
4912
|
-
if (_ >
|
|
4913
|
-
const v = `{{${m}}}`, { text: E } = x(w,
|
|
4921
|
+
const C = b, S = C.selectionStart || 0, w = C.value || "", _ = C.selectionEnd || S;
|
|
4922
|
+
if (_ > S) {
|
|
4923
|
+
const v = `{{${m}}}`, { text: E } = x(w, S, v), j = w.slice(0, S) + E + w.slice(_);
|
|
4914
4924
|
n(j, {}, r);
|
|
4915
4925
|
return;
|
|
4916
4926
|
}
|
|
4917
|
-
const I = `{{${m}}}`, { text: k } = x(w,
|
|
4927
|
+
const I = `{{${m}}}`, { text: k } = x(w, S, I), A = w.slice(0, S) + k + w.slice(S);
|
|
4918
4928
|
n(A, {}, r);
|
|
4919
4929
|
}
|
|
4920
4930
|
},
|
|
@@ -4937,7 +4947,7 @@ const DataBindingSelector = ({
|
|
|
4937
4947
|
onChange: r
|
|
4938
4948
|
}) => {
|
|
4939
4949
|
var A;
|
|
4940
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, E) => []), [i, c] = useState(!1), [u, p] = useState(!1), [d, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [b, y] = useState(-1),
|
|
4950
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, E) => []), [i, c] = useState(!1), [u, p] = useState(!1), [d, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [b, y] = useState(-1), C = useRef(null), S = (A = n == null ? void 0 : n.find((v) => v.key === d)) == null ? void 0 : A.name;
|
|
4941
4951
|
useEffect(() => {
|
|
4942
4952
|
if (h(""), x([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4943
4953
|
const v = split(o, ":"), E = get(v, 1, "page") || "page";
|
|
@@ -4979,8 +4989,8 @@ const DataBindingSelector = ({
|
|
|
4979
4989
|
}
|
|
4980
4990
|
};
|
|
4981
4991
|
useEffect(() => {
|
|
4982
|
-
if (b >= 0 &&
|
|
4983
|
-
const v =
|
|
4992
|
+
if (b >= 0 && C.current) {
|
|
4993
|
+
const v = C.current.children[b];
|
|
4984
4994
|
v == null || v.scrollIntoView({ block: "nearest" });
|
|
4985
4995
|
}
|
|
4986
4996
|
}, [b]);
|
|
@@ -4999,7 +5009,7 @@ const DataBindingSelector = ({
|
|
|
4999
5009
|
value: m,
|
|
5000
5010
|
onChange: (v) => k(v.target.value),
|
|
5001
5011
|
onKeyDown: B,
|
|
5002
|
-
placeholder: a(`Search ${
|
|
5012
|
+
placeholder: a(`Search ${S ?? ""}`),
|
|
5003
5013
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
5004
5014
|
}
|
|
5005
5015
|
),
|
|
@@ -5013,7 +5023,7 @@ const DataBindingSelector = ({
|
|
|
5013
5023
|
' "',
|
|
5014
5024
|
m,
|
|
5015
5025
|
'"'
|
|
5016
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref:
|
|
5026
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(f == null ? void 0 : f.slice(0, 20), (v, E) => /* @__PURE__ */ jsxs(
|
|
5017
5027
|
"li",
|
|
5018
5028
|
{
|
|
5019
5029
|
onClick: () => _(v),
|
|
@@ -5122,7 +5132,7 @@ const DataBindingSelector = ({
|
|
|
5122
5132
|
]
|
|
5123
5133
|
}
|
|
5124
5134
|
) });
|
|
5125
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
5135
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DpWQvFjm.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
|
|
5126
5136
|
const c = useRef(null), [u, p] = useState(!1), d = useRTEditor({
|
|
5127
5137
|
blockId: o,
|
|
5128
5138
|
value: a,
|
|
@@ -5371,9 +5381,9 @@ const DataBindingSelector = ({
|
|
|
5371
5381
|
const { id: n, classNames: r, label: a, children: l, errors: i, help: c, hidden: u, required: p, schema: d, formData: g, onChange: m } = o, { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), b = useMemo(
|
|
5372
5382
|
() => isEmpty(x) ? "" : isEmpty(h) ? f : h,
|
|
5373
5383
|
[x, h, f]
|
|
5374
|
-
), y = useMemo(() => get(LANGUAGES, b, b), [b]),
|
|
5375
|
-
() => get(w, [
|
|
5376
|
-
[w,
|
|
5384
|
+
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), S = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
|
|
5385
|
+
() => get(w, [S == null ? void 0 : S._type, "i18nProps"], []),
|
|
5386
|
+
[w, S == null ? void 0 : S._type]
|
|
5377
5387
|
), [B, I] = useState(null);
|
|
5378
5388
|
if (u)
|
|
5379
5389
|
return null;
|
|
@@ -5433,7 +5443,7 @@ const DataBindingSelector = ({
|
|
|
5433
5443
|
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: d.description })
|
|
5434
5444
|
] }) })
|
|
5435
5445
|
] }),
|
|
5436
|
-
!d.enum && !d.oneOf &&
|
|
5446
|
+
!d.enum && !d.oneOf && C && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
|
|
5437
5447
|
E ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
5438
5448
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
5439
5449
|
"svg",
|
|
@@ -5584,7 +5594,7 @@ function BlockSettings() {
|
|
|
5584
5594
|
I && (r([n._id], { [I]: get(B, I) }), x({ formData: B }, I, { [I]: get(c, I) }));
|
|
5585
5595
|
}, y = ({ formData: B }, I) => {
|
|
5586
5596
|
I && (r([g._id], { [I]: get(B, I) }), x({ formData: B }, I, { [I]: get(c, I) }));
|
|
5587
|
-
}, { schema:
|
|
5597
|
+
}, { schema: C, uiSchema: S } = useMemo(() => {
|
|
5588
5598
|
const B = n == null ? void 0 : n._type;
|
|
5589
5599
|
if (!B)
|
|
5590
5600
|
return { schema: {}, uiSchema: {} };
|
|
@@ -5635,14 +5645,14 @@ function BlockSettings() {
|
|
|
5635
5645
|
}
|
|
5636
5646
|
) })
|
|
5637
5647
|
] }),
|
|
5638
|
-
isEmpty(
|
|
5648
|
+
isEmpty(C) ? null : /* @__PURE__ */ jsx(
|
|
5639
5649
|
JSONForm,
|
|
5640
5650
|
{
|
|
5641
5651
|
blockId: n == null ? void 0 : n._id,
|
|
5642
5652
|
onChange: b,
|
|
5643
5653
|
formData: i,
|
|
5644
|
-
schema:
|
|
5645
|
-
uiSchema:
|
|
5654
|
+
schema: C,
|
|
5655
|
+
uiSchema: S
|
|
5646
5656
|
}
|
|
5647
5657
|
)
|
|
5648
5658
|
] });
|
|
@@ -5853,7 +5863,7 @@ const BlockStylingProps = () => {
|
|
|
5853
5863
|
},
|
|
5854
5864
|
a
|
|
5855
5865
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5856
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: u, cssProperty: p, units: d, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : d[0]), [f, x] = useState(!1), [b, y] = useState(""), [
|
|
5866
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: u, cssProperty: p, units: d, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : d[0]), [f, x] = useState(!1), [b, y] = useState(""), [C, S] = useState(!1), [w, _] = useState(!1);
|
|
5857
5867
|
useEffect(() => {
|
|
5858
5868
|
const { value: v, unit: E } = getClassValueAndUnit(i);
|
|
5859
5869
|
if (E === "") {
|
|
@@ -5911,7 +5921,7 @@ const BlockStylingProps = () => {
|
|
|
5911
5921
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
|
|
5912
5922
|
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
5913
5923
|
] })
|
|
5914
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${
|
|
5924
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${C ? "z-auto" : ""}`, children: [
|
|
5915
5925
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
5916
5926
|
["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
|
|
5917
5927
|
"input",
|
|
@@ -5941,7 +5951,7 @@ const BlockStylingProps = () => {
|
|
|
5941
5951
|
var E;
|
|
5942
5952
|
(E = v == null ? void 0 : v.target) == null || E.select(), r(!1);
|
|
5943
5953
|
},
|
|
5944
|
-
value:
|
|
5954
|
+
value: C ? b : a,
|
|
5945
5955
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5946
5956
|
" ",
|
|
5947
5957
|
f ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -5973,12 +5983,12 @@ const BlockStylingProps = () => {
|
|
|
5973
5983
|
) })
|
|
5974
5984
|
] })
|
|
5975
5985
|
] }),
|
|
5976
|
-
["none", "auto"].indexOf(m) !== -1 ||
|
|
5986
|
+
["none", "auto"].indexOf(m) !== -1 || C ? null : /* @__PURE__ */ jsx(
|
|
5977
5987
|
DragStyleButton,
|
|
5978
5988
|
{
|
|
5979
|
-
onDragStart: () =>
|
|
5989
|
+
onDragStart: () => S(!0),
|
|
5980
5990
|
onDragEnd: (v) => {
|
|
5981
|
-
if (y(() => ""),
|
|
5991
|
+
if (y(() => ""), S(!1), isEmpty(v))
|
|
5982
5992
|
return;
|
|
5983
5993
|
const E = `${v}`, N = `${E.startsWith("-") ? "-" : ""}${u}[${E.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5984
5994
|
B(N);
|
|
@@ -6459,12 +6469,12 @@ const COLOR_PROP = {
|
|
|
6459
6469
|
h(x, [v], k);
|
|
6460
6470
|
},
|
|
6461
6471
|
[x, p, g, d, l, h]
|
|
6462
|
-
),
|
|
6472
|
+
), C = useCallback(() => {
|
|
6463
6473
|
f(x, [b], !0);
|
|
6464
|
-
}, [x, b, f]),
|
|
6474
|
+
}, [x, b, f]), S = useMemo(() => canChangeClass(m, g), [m, g]);
|
|
6465
6475
|
useEffect(() => {
|
|
6466
|
-
i(
|
|
6467
|
-
}, [
|
|
6476
|
+
i(S, m);
|
|
6477
|
+
}, [S, i, m]);
|
|
6468
6478
|
const [, , w] = useScreenSizeWidth(), _ = useCallback(
|
|
6469
6479
|
(I) => {
|
|
6470
6480
|
w({
|
|
@@ -6478,7 +6488,7 @@ const COLOR_PROP = {
|
|
|
6478
6488
|
},
|
|
6479
6489
|
[w]
|
|
6480
6490
|
), B = get(m, "dark", null) === p && get(m, "mod", null) === d && get(m, "mq", null) === g;
|
|
6481
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6491
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: S, canReset: m && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6482
6492
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !B ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6483
6493
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6484
6494
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6498,7 +6508,7 @@ const COLOR_PROP = {
|
|
|
6498
6508
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: y }),
|
|
6499
6509
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: y })
|
|
6500
6510
|
] }),
|
|
6501
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () =>
|
|
6511
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => C(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6502
6512
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6503
6513
|
"button",
|
|
6504
6514
|
{
|
|
@@ -6717,7 +6727,7 @@ const COLOR_PROP = {
|
|
|
6717
6727
|
tooltip: r = !0
|
|
6718
6728
|
}) => {
|
|
6719
6729
|
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [u, p] = useSelectedBreakpoints(), d = u, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (y) => {
|
|
6720
|
-
d.includes(y) ? d.length > 2 && g(d.filter((
|
|
6730
|
+
d.includes(y) ? d.length > 2 && g(d.filter((C) => C !== y)) : g((C) => [...C, y]);
|
|
6721
6731
|
}, x = (y) => {
|
|
6722
6732
|
n || l(y), c(y);
|
|
6723
6733
|
}, b = getBreakpointValue(n ? i : a).toLowerCase();
|
|
@@ -6757,7 +6767,7 @@ const COLOR_PROP = {
|
|
|
6757
6767
|
disabled: y.breakpoint === "xs",
|
|
6758
6768
|
onCheckedChange: () => f(toUpper(y.breakpoint)),
|
|
6759
6769
|
checked: includes(d, toUpper(y.breakpoint)),
|
|
6760
|
-
onSelect: (
|
|
6770
|
+
onSelect: (C) => C.preventDefault(),
|
|
6761
6771
|
children: m(y.title)
|
|
6762
6772
|
},
|
|
6763
6773
|
y.breakpoint
|
|
@@ -6785,7 +6795,7 @@ function BreakpointSelector() {
|
|
|
6785
6795
|
}
|
|
6786
6796
|
function ManualClasses() {
|
|
6787
6797
|
var N;
|
|
6788
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [u] = useSelectedStylingBlocks(), p = useSelectedBlock(), d = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), [h, f] = useState(""), x = (N = first(u)) == null ? void 0 : N.prop, { classes: b } = getSplitChaiClasses(get(p, x, "")), y = b.split(" ").filter((T) => !isEmpty(T)),
|
|
6798
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [u] = useSelectedStylingBlocks(), p = useSelectedBlock(), d = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), [h, f] = useState(""), x = (N = first(u)) == null ? void 0 : N.prop, { classes: b } = getSplitChaiClasses(get(p, x, "")), y = b.split(" ").filter((T) => !isEmpty(T)), C = useBuilderProp("flags.copyPaste", !0), S = () => {
|
|
6789
6799
|
const T = h.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6790
6800
|
d(m, T, !0), f("");
|
|
6791
6801
|
}, [w, _] = useState([]), B = ({ value: T }) => {
|
|
@@ -6817,7 +6827,7 @@ function ManualClasses() {
|
|
|
6817
6827
|
}, 0);
|
|
6818
6828
|
},
|
|
6819
6829
|
onKeyDown: (T) => {
|
|
6820
|
-
T.key === "Enter" && h.trim() !== "" &&
|
|
6830
|
+
T.key === "Enter" && h.trim() !== "" && S();
|
|
6821
6831
|
},
|
|
6822
6832
|
onChange: (T, { newValue: P }) => f(P),
|
|
6823
6833
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -6837,7 +6847,7 @@ function ManualClasses() {
|
|
|
6837
6847
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
6838
6848
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
6839
6849
|
/* @__PURE__ */ jsx("span", { children: c("Classes") }),
|
|
6840
|
-
|
|
6850
|
+
C && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6841
6851
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: j, className: "cursor-pointer" }) }),
|
|
6842
6852
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
|
|
6843
6853
|
] })
|
|
@@ -6867,7 +6877,7 @@ function ManualClasses() {
|
|
|
6867
6877
|
{
|
|
6868
6878
|
variant: "outline",
|
|
6869
6879
|
className: "h-6 border-border",
|
|
6870
|
-
onClick:
|
|
6880
|
+
onClick: S,
|
|
6871
6881
|
disabled: h.trim() === "",
|
|
6872
6882
|
size: "sm",
|
|
6873
6883
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
@@ -7240,12 +7250,12 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7240
7250
|
parentId: r = void 0,
|
|
7241
7251
|
position: a = -1
|
|
7242
7252
|
}) => {
|
|
7243
|
-
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: u, addPredefinedBlock: p } = useAddBlock(), [, d] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), b = (
|
|
7244
|
-
const w = has(
|
|
7245
|
-
return
|
|
7253
|
+
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: u, addPredefinedBlock: p } = useAddBlock(), [, d] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), b = (S) => {
|
|
7254
|
+
const w = has(S, "styles_attrs.data-page-section");
|
|
7255
|
+
return S._type === "Box" && w;
|
|
7246
7256
|
}, y = useCallback(
|
|
7247
|
-
async (
|
|
7248
|
-
if (
|
|
7257
|
+
async (S) => {
|
|
7258
|
+
if (S.stopPropagation(), has(o, "component")) {
|
|
7249
7259
|
u(o, r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7250
7260
|
return;
|
|
7251
7261
|
}
|
|
@@ -7262,18 +7272,18 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7262
7272
|
onClick: l ? () => {
|
|
7263
7273
|
} : y,
|
|
7264
7274
|
draggable: f ? "true" : "false",
|
|
7265
|
-
onDragStart: async (
|
|
7275
|
+
onDragStart: async (S) => {
|
|
7266
7276
|
const w = await c({ library: n, block: o });
|
|
7267
7277
|
let _ = r;
|
|
7268
7278
|
if (b(first(w)) && (_ = null), !isEmpty(w)) {
|
|
7269
7279
|
const B = { blocks: w, uiLibrary: !0, parent: _ };
|
|
7270
|
-
if (
|
|
7280
|
+
if (S.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
7271
7281
|
const I = new Image();
|
|
7272
7282
|
I.src = o.preview, I.onload = () => {
|
|
7273
|
-
|
|
7283
|
+
S.dataTransfer.setDragImage(I, 0, 0);
|
|
7274
7284
|
};
|
|
7275
7285
|
} else
|
|
7276
|
-
|
|
7286
|
+
S.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7277
7287
|
x(B), setTimeout(() => {
|
|
7278
7288
|
d([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7279
7289
|
}, 200);
|
|
@@ -7312,20 +7322,20 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7312
7322
|
const E = f.current.search(d).map((j) => j.item);
|
|
7313
7323
|
h(E);
|
|
7314
7324
|
}, [d]);
|
|
7315
|
-
const x = d.trim() && !isEmpty(m) ? m : c, b = groupBy(x, "group"), [y,
|
|
7325
|
+
const x = d.trim() && !isEmpty(m) ? m : c, b = groupBy(x, "group"), [y, C] = useState(null);
|
|
7316
7326
|
useEffect(() => {
|
|
7317
7327
|
if (isEmpty(keys(b))) {
|
|
7318
|
-
|
|
7328
|
+
C(null);
|
|
7319
7329
|
return;
|
|
7320
7330
|
}
|
|
7321
7331
|
if (!y || !b[y]) {
|
|
7322
|
-
|
|
7332
|
+
C(first(keys(b)));
|
|
7323
7333
|
return;
|
|
7324
7334
|
}
|
|
7325
7335
|
}, [b, y]);
|
|
7326
|
-
const
|
|
7336
|
+
const S = get(b, y, []), w = useRef(null), { t: _ } = useTranslation(), B = (E) => {
|
|
7327
7337
|
w.current && (clearTimeout(w.current), w.current = null), w.current = setTimeout(() => {
|
|
7328
|
-
w.current &&
|
|
7338
|
+
w.current && C(E);
|
|
7329
7339
|
}, 400);
|
|
7330
7340
|
}, I = () => {
|
|
7331
7341
|
i != null && i.id && p(i.id);
|
|
@@ -7337,7 +7347,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7337
7347
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7338
7348
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7339
7349
|
] });
|
|
7340
|
-
const A = filter(
|
|
7350
|
+
const A = filter(S, (E, j) => j % 2 === 0), v = filter(S, (E, j) => j % 2 === 1);
|
|
7341
7351
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7342
7352
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7343
7353
|
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7377,7 +7387,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7377
7387
|
onMouseEnter: () => B(j),
|
|
7378
7388
|
onMouseLeave: () => clearTimeout(w.current),
|
|
7379
7389
|
role: "button",
|
|
7380
|
-
onClick: () =>
|
|
7390
|
+
onClick: () => C(j),
|
|
7381
7391
|
className: cn$1(
|
|
7382
7392
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7383
7393
|
j === y ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
|
|
@@ -7397,7 +7407,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7397
7407
|
onMouseEnter: () => w.current ? clearTimeout(w.current) : null,
|
|
7398
7408
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7399
7409
|
children: [
|
|
7400
|
-
isEmpty(
|
|
7410
|
+
isEmpty(S) && !isEmpty(b) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7401
7411
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: A.map((E, j) => /* @__PURE__ */ jsx(
|
|
7402
7412
|
BlockCard,
|
|
7403
7413
|
{
|
|
@@ -7453,14 +7463,14 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7453
7463
|
}), g(!0);
|
|
7454
7464
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7455
7465
|
const h = Object.entries(a).map(([x, b]) => {
|
|
7456
|
-
const y = b,
|
|
7466
|
+
const y = b, C = y.type || "partial", S = formatReadableName(C);
|
|
7457
7467
|
return {
|
|
7458
7468
|
type: "PartialBlock",
|
|
7459
7469
|
// Set the type to PartialBlock
|
|
7460
7470
|
label: formatReadableName(y.name || x),
|
|
7461
7471
|
description: y.description || "",
|
|
7462
7472
|
icon: FrameIcon,
|
|
7463
|
-
group:
|
|
7473
|
+
group: S,
|
|
7464
7474
|
// Use formatted type as group
|
|
7465
7475
|
category: "partial",
|
|
7466
7476
|
partialBlockId: x,
|
|
@@ -7516,7 +7526,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7516
7526
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7517
7527
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4", disableBlockGroupsSidebar: i }) => {
|
|
7518
7528
|
var E;
|
|
7519
|
-
const { t: c } = useTranslation(), [u] = useBlocksStore(), [p, d] = useState(""), g = useRef(null), [m] = useAtom$1(addBlockTabAtom), h = (E = find(u, (j) => j._id === r)) == null ? void 0 : E._type, [f, x] = useState("all"), [b, y] = useState(null),
|
|
7529
|
+
const { t: c } = useTranslation(), [u] = useBlocksStore(), [p, d] = useState(""), g = useRef(null), [m] = useAtom$1(addBlockTabAtom), h = (E = find(u, (j) => j._id === r)) == null ? void 0 : E._type, [f, x] = useState("all"), [b, y] = useState(null), C = useRef(null);
|
|
7520
7530
|
useEffect(() => {
|
|
7521
7531
|
const j = setTimeout(() => {
|
|
7522
7532
|
var N;
|
|
@@ -7525,17 +7535,17 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7525
7535
|
return () => clearTimeout(j);
|
|
7526
7536
|
}, [m]), useEffect(() => {
|
|
7527
7537
|
p && (x("all"), y(null));
|
|
7528
|
-
}, [p]), useEffect(() => (
|
|
7538
|
+
}, [p]), useEffect(() => (C.current = debounce((j) => {
|
|
7529
7539
|
x(j);
|
|
7530
7540
|
}, 500), () => {
|
|
7531
|
-
|
|
7541
|
+
C.current && C.current.cancel();
|
|
7532
7542
|
}), []);
|
|
7533
|
-
const
|
|
7534
|
-
y(j),
|
|
7543
|
+
const S = useCallback((j) => {
|
|
7544
|
+
y(j), C.current && C.current(j);
|
|
7535
7545
|
}, []), w = useCallback(() => {
|
|
7536
|
-
y(null),
|
|
7546
|
+
y(null), C.current && C.current.cancel();
|
|
7537
7547
|
}, []), _ = useCallback((j) => {
|
|
7538
|
-
|
|
7548
|
+
C.current && C.current.cancel(), x(j), y(null);
|
|
7539
7549
|
}, []), B = useMemo(
|
|
7540
7550
|
() => p ? values(n).filter(
|
|
7541
7551
|
(j) => {
|
|
@@ -7554,7 +7564,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7554
7564
|
[I]
|
|
7555
7565
|
), A = useMemo(() => f === "all" ? B : filter(values(B), { group: f }), [B, f]), v = useMemo(() => f === "all" ? k : [f], [k, f]);
|
|
7556
7566
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7557
|
-
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80
|
|
7567
|
+
/* @__PURE__ */ jsx("div", { className: `${i ? "px-2" : "px-4"} sticky top-0 py-2 z-10 bg-background/80 backdrop-blur-sm`, children: /* @__PURE__ */ jsx(
|
|
7558
7568
|
Input$1,
|
|
7559
7569
|
{
|
|
7560
7570
|
ref: g,
|
|
@@ -7571,7 +7581,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7571
7581
|
"button",
|
|
7572
7582
|
{
|
|
7573
7583
|
onClick: () => _("all"),
|
|
7574
|
-
onMouseEnter: () =>
|
|
7584
|
+
onMouseEnter: () => S("all"),
|
|
7575
7585
|
onMouseLeave: w,
|
|
7576
7586
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${f === "all" || b === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7577
7587
|
children: c("All")
|
|
@@ -7582,7 +7592,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7582
7592
|
"button",
|
|
7583
7593
|
{
|
|
7584
7594
|
onClick: () => _(j),
|
|
7585
|
-
onMouseEnter: () =>
|
|
7595
|
+
onMouseEnter: () => S(j),
|
|
7586
7596
|
onMouseLeave: w,
|
|
7587
7597
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${f === j || b === j ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7588
7598
|
children: capitalize(c(j.toLowerCase()))
|
|
@@ -7599,7 +7609,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7599
7609
|
' "',
|
|
7600
7610
|
p,
|
|
7601
7611
|
'"'
|
|
7602
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "
|
|
7612
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: `${i ? "p-0" : "p-4"} space-y-6`, children: v.map((j) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7603
7613
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(j.toLowerCase())) }),
|
|
7604
7614
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7605
7615
|
f === "all" ? filter(values(A), { group: j }) : values(A),
|
|
@@ -7642,8 +7652,8 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7642
7652
|
/* @__PURE__ */ jsxs(
|
|
7643
7653
|
Tabs,
|
|
7644
7654
|
{
|
|
7645
|
-
onValueChange: (
|
|
7646
|
-
u(""), c(
|
|
7655
|
+
onValueChange: (C) => {
|
|
7656
|
+
u(""), c(C);
|
|
7647
7657
|
},
|
|
7648
7658
|
value: i,
|
|
7649
7659
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
@@ -7653,13 +7663,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7653
7663
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7654
7664
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7655
7665
|
x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7656
|
-
map(f, (
|
|
7666
|
+
map(f, (C) => /* @__PURE__ */ jsx(TabsTrigger, { value: C.id, children: React__default.createElement(C.tab) }, `tab-add-block-${C.id}`))
|
|
7657
7667
|
] }),
|
|
7658
7668
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7659
7669
|
y && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
7660
7670
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7661
7671
|
x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
7662
|
-
map(f, (
|
|
7672
|
+
map(f, (C) => /* @__PURE__ */ jsx(TabsContent, { value: C.id, children: React__default.createElement(C.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${C.id}`))
|
|
7663
7673
|
]
|
|
7664
7674
|
}
|
|
7665
7675
|
)
|
|
@@ -8033,8 +8043,8 @@ const Input = ({ node: o }) => {
|
|
|
8033
8043
|
var D;
|
|
8034
8044
|
const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
8035
8045
|
let u = null;
|
|
8036
|
-
const p = o.children.length > 0, { highlightBlock: d, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: f, willReceiveDrop: x, isDragging: b, isEditing: y, handleClick:
|
|
8037
|
-
L.stopPropagation(),
|
|
8046
|
+
const p = o.children.length > 0, { highlightBlock: d, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: f, willReceiveDrop: x, isDragging: b, isEditing: y, handleClick: C } = o, S = get(h, "_show", !0), w = (L) => {
|
|
8047
|
+
L.stopPropagation(), S && o.toggle();
|
|
8038
8048
|
}, _ = (L) => {
|
|
8039
8049
|
L.isInternal && (u = L.isOpen, L.isOpen && L.close());
|
|
8040
8050
|
}, B = (L) => {
|
|
@@ -8045,11 +8055,11 @@ const Input = ({ node: o }) => {
|
|
|
8045
8055
|
}, v = () => {
|
|
8046
8056
|
k(null);
|
|
8047
8057
|
}, E = (L) => {
|
|
8048
|
-
v(), L.stopPropagation(), !o.isOpen &&
|
|
8058
|
+
v(), L.stopPropagation(), !o.isOpen && S && o.toggle(), C(L);
|
|
8049
8059
|
};
|
|
8050
8060
|
useEffect(() => {
|
|
8051
8061
|
const L = setTimeout(() => {
|
|
8052
|
-
x && !o.isOpen && !b &&
|
|
8062
|
+
x && !o.isOpen && !b && S && o.toggle();
|
|
8053
8063
|
}, 500);
|
|
8054
8064
|
return () => clearTimeout(L);
|
|
8055
8065
|
}, [x, o, b]);
|
|
@@ -8124,7 +8134,7 @@ const Input = ({ node: o }) => {
|
|
|
8124
8134
|
x && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
8125
8135
|
(o == null ? void 0 : o.id) === I ? "bg-primary/10" : "",
|
|
8126
8136
|
b && "opacity-20",
|
|
8127
|
-
|
|
8137
|
+
S ? "" : "line-through opacity-50",
|
|
8128
8138
|
P && f && "bg-primary/20 text-primary"
|
|
8129
8139
|
),
|
|
8130
8140
|
children: [
|
|
@@ -8163,7 +8173,7 @@ const Input = ({ node: o }) => {
|
|
|
8163
8173
|
)
|
|
8164
8174
|
] }),
|
|
8165
8175
|
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-px group-hover:visible", children: [
|
|
8166
|
-
canAddChildBlock(h == null ? void 0 : h._type) &&
|
|
8176
|
+
canAddChildBlock(h == null ? void 0 : h._type) && S && c(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8167
8177
|
/* @__PURE__ */ jsx(
|
|
8168
8178
|
TooltipTrigger,
|
|
8169
8179
|
{
|
|
@@ -8180,14 +8190,14 @@ const Input = ({ node: o }) => {
|
|
|
8180
8190
|
TooltipTrigger,
|
|
8181
8191
|
{
|
|
8182
8192
|
onClick: (L) => {
|
|
8183
|
-
L.stopPropagation(), l([m], { _show: !
|
|
8193
|
+
L.stopPropagation(), l([m], { _show: !S }), o.isOpen && o.toggle();
|
|
8184
8194
|
},
|
|
8185
8195
|
className: "cursor-pointer rounded bg-transparent p-0.5 hover:bg-primary/10",
|
|
8186
8196
|
asChild: !0,
|
|
8187
|
-
children:
|
|
8197
|
+
children: S ? /* @__PURE__ */ jsx(EyeClosedIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-4 w-4" })
|
|
8188
8198
|
}
|
|
8189
8199
|
),
|
|
8190
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(
|
|
8200
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(S ? "Hide the block from page" : "Show the block on page") })
|
|
8191
8201
|
] }),
|
|
8192
8202
|
/* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" }) }) })
|
|
8193
8203
|
] })
|
|
@@ -8610,7 +8620,7 @@ const Input = ({ node: o }) => {
|
|
|
8610
8620
|
"popover-foreground": ["#3d3436", "#f2e9e4"]
|
|
8611
8621
|
}
|
|
8612
8622
|
}, LazyCssImportModal = lazy(
|
|
8613
|
-
() => import("./css-import-modal-
|
|
8623
|
+
() => import("./css-import-modal-DgLi5BIu.js").then((o) => ({ default: o.CssImportModal }))
|
|
8614
8624
|
), PREV_THEME_KEY = "chai-builder-previous-theme", DEFAULT_THEME_PRESET = [
|
|
8615
8625
|
{ shadcn_default: defaultShadcnPreset },
|
|
8616
8626
|
{ twitter_theme: twitter },
|
|
@@ -8658,14 +8668,14 @@ const Input = ({ node: o }) => {
|
|
|
8658
8668
|
});
|
|
8659
8669
|
},
|
|
8660
8670
|
[h, f]
|
|
8661
|
-
),
|
|
8671
|
+
), C = () => {
|
|
8662
8672
|
const k = u.find((A) => Object.keys(A)[0] === a);
|
|
8663
8673
|
if (k) {
|
|
8664
8674
|
const A = Object.values(k)[0];
|
|
8665
8675
|
A && typeof A == "object" && "fontFamily" in A && "borderRadius" in A && "colors" in A ? (y(A), l("")) : console.error("Invalid preset structure:", A);
|
|
8666
8676
|
} else
|
|
8667
8677
|
console.error("Preset not found:", a);
|
|
8668
|
-
},
|
|
8678
|
+
}, S = (k) => {
|
|
8669
8679
|
y(k), l("");
|
|
8670
8680
|
}, w = useDebouncedCallback(
|
|
8671
8681
|
(k, A) => {
|
|
@@ -8727,20 +8737,20 @@ const Input = ({ node: o }) => {
|
|
|
8727
8737
|
] }),
|
|
8728
8738
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8729
8739
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8730
|
-
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8740
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: b("Select preset") }) }),
|
|
8731
8741
|
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(u) && u.map((k) => {
|
|
8732
8742
|
const A = Object.keys(k)[0], v = A.replaceAll("_", " ");
|
|
8733
8743
|
return /* @__PURE__ */ jsx(SelectItem, { value: A, children: capitalize(v) }, A);
|
|
8734
8744
|
}) })
|
|
8735
8745
|
] }) }),
|
|
8736
|
-
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick:
|
|
8746
|
+
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: C, children: b("Apply") }) })
|
|
8737
8747
|
] })
|
|
8738
8748
|
] }),
|
|
8739
8749
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8740
8750
|
/* @__PURE__ */ jsxs("div", { className: cn$1("my-2 space-y-3", o), children: [
|
|
8741
8751
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8742
8752
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8743
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8753
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: b("Typography") })
|
|
8744
8754
|
] }),
|
|
8745
8755
|
(x == null ? void 0 : x.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(x.fontFamily).map(([k, A]) => /* @__PURE__ */ jsx(
|
|
8746
8756
|
FontSelector,
|
|
@@ -8756,7 +8766,7 @@ const Input = ({ node: o }) => {
|
|
|
8756
8766
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8757
8767
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8758
8768
|
/* @__PURE__ */ jsx(CornerTopRightIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8759
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Border Radius" })
|
|
8769
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: b("Border Radius") })
|
|
8760
8770
|
] }),
|
|
8761
8771
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: h.borderRadius })
|
|
8762
8772
|
] }),
|
|
@@ -8767,7 +8777,7 @@ const Input = ({ node: o }) => {
|
|
|
8767
8777
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8768
8778
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8769
8779
|
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8770
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Colors" })
|
|
8780
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: b("Colors") })
|
|
8771
8781
|
] }),
|
|
8772
8782
|
m && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8773
8783
|
/* @__PURE__ */ jsx(SunIcon, { className: "h-4 w-4" }),
|
|
@@ -8785,12 +8795,12 @@ const Input = ({ node: o }) => {
|
|
|
8785
8795
|
] }),
|
|
8786
8796
|
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: x.colors.map((k) => I(k)) })
|
|
8787
8797
|
] }),
|
|
8788
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && g && /* @__PURE__ */ jsx(
|
|
8798
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: b("Loading...") }), children: i && g && /* @__PURE__ */ jsx(
|
|
8789
8799
|
LazyCssImportModal,
|
|
8790
8800
|
{
|
|
8791
8801
|
open: i,
|
|
8792
8802
|
onOpenChange: c,
|
|
8793
|
-
onImport:
|
|
8803
|
+
onImport: S
|
|
8794
8804
|
}
|
|
8795
8805
|
) })
|
|
8796
8806
|
] }),
|
|
@@ -8800,7 +8810,7 @@ const Input = ({ node: o }) => {
|
|
|
8800
8810
|
/* @__PURE__ */ jsx("br", {})
|
|
8801
8811
|
] }),
|
|
8802
8812
|
p && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(p) })
|
|
8803
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: "You don't have permission to edit the theme. Please contact your administrator to get access." }) }) }) });
|
|
8813
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: b("You don't have permission to edit the theme. Please contact your administrator to get access.") }) }) }) });
|
|
8804
8814
|
}), Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Style", SVG_code = "Enter SVG code here", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", URL$1 = "URL", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", Classes = "Classes", All = "All", Undo = "Undo", Redo = "Redo", Duplicate = "Duplicate", Close = "Close", Selected = "Selected", Select = "Select", Attributes = "Attributes", apply = "apply", presets = "presets", Orientation = "Orientation", Color = "Color", Upload = "Upload", Apply = "Apply", Back = "Back", Insert = "Insert", Rename = "Rename", Partials = "Partials", Happy = "Happy", Sad = "Sad", Retry = "Retry", canvas_empty = "Canvas is empty", Presets = "Presets", No = "No", Saving = "Saving", theme_config = { heading_font: "Heading Font", body_font: "Body Font", rounded_corner: "Rounded Corners", primary: "Primary", secondary: "Secondary", background: "Background", text_color: "Text Color", background_dark_mode: "Background (Dark Mode)", text_color_dark_mode: "Text Color (Dark Mode)" }, web_blocks = { box: "box", tag: "Tag", div: "div", level: "Level", header: "header", footer: "footer", section: "section", article: "article", aside: "aside", main: "main", nav: "navigation", figure: "figure", details: "details", summary: "summary", dialog: "dialog", strike: "strike", caption: "caption", legend: "legend", figcaption: "figure caption", mark: "mark", background_image: "Background Image", label: "Label", default: "default", icon_size: "Icon Size", icon_position: "Icon Position", start: "Start", end: "End", button: "Button", custom_html: "Custom HTML", html_code: "HTML Code", default_snippet: "The HTML snippet goes here...", placeholder: "Enter custom HTML code here", custom_script: "Custom Script", dark_mode: "Dark Mode", divider: "Divider", empty_box: "Empty Box", heading: "Heading", image: "Image", alt: "Alt", width: "Width", height: "Height", video: "Video", span: "Span", content: "Content", icon: "Icon", richtext: "Rich Text", list: "List", list_type: "List Type", listitem: "List Item", link: "Link", list_item: "List Item", none: "None", disc: "Disc", number: "Number", paragraph: "Paragraph", lightbox_link: "Lightbox Link", href: "Link", type: "Type", iframe: "iframe", inline: "inline", ajax: "ajax", autoplay: "Video autoplay", max_width: "Max Width", backdrop_color: "Background Color", gallery_name: "Gallery Name", slot: "Slot", empty_slot: "Empty Slot", text: "Text", video_url: "Video URL", controls: "Show Controls", loop: "Loop", muted: "Muted", checkbox: "Checkbox", required: "Required", checked: "Checked", submit_button: "Submit Button", form: "Form", submit_url: "Submit URL", error_message: "Error Message", success_message: "Success Message", input: "Input", value: "Value", show_label: "Show Label", field_name: "Field Name", radio: "Radio", multiple: "Multiple", options: "Options", select: "Select", multiple_choice: "Multiple Choice", textarea: "Textarea", rows: "Rows" }, lngEn = {
|
|
8805
8815
|
"Add block": "Add Block",
|
|
8806
8816
|
"Add Block": "Add Block",
|
|
@@ -9479,7 +9489,7 @@ const UndoRedo = () => {
|
|
|
9479
9489
|
useEffect(() => {
|
|
9480
9490
|
l(n);
|
|
9481
9491
|
}, [n]);
|
|
9482
|
-
const
|
|
9492
|
+
const C = () => {
|
|
9483
9493
|
if (i.startsWith("@")) {
|
|
9484
9494
|
h("Attribute keys cannot start with '@'");
|
|
9485
9495
|
return;
|
|
@@ -9488,7 +9498,7 @@ const UndoRedo = () => {
|
|
|
9488
9498
|
const k = [...a, { key: i, value: u }];
|
|
9489
9499
|
r(k), l(a), c(""), p(""), h("");
|
|
9490
9500
|
}
|
|
9491
|
-
},
|
|
9501
|
+
}, S = (k) => {
|
|
9492
9502
|
const A = a.filter((v, E) => E !== k);
|
|
9493
9503
|
r(A), l(A);
|
|
9494
9504
|
}, w = (k) => {
|
|
@@ -9503,7 +9513,7 @@ const UndoRedo = () => {
|
|
|
9503
9513
|
k[d] = { key: i, value: u }, r(k), l(k), g(null), c(""), p(""), h("");
|
|
9504
9514
|
}
|
|
9505
9515
|
}, B = (k) => {
|
|
9506
|
-
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), d !== null ? _() :
|
|
9516
|
+
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), d !== null ? _() : C());
|
|
9507
9517
|
}, I = useCallback((k) => {
|
|
9508
9518
|
const A = (j) => /[.,!?;:]/.test(j), v = (j, N, T) => {
|
|
9509
9519
|
let P = "", R = "";
|
|
@@ -9530,7 +9540,7 @@ const UndoRedo = () => {
|
|
|
9530
9540
|
"form",
|
|
9531
9541
|
{
|
|
9532
9542
|
onSubmit: (k) => {
|
|
9533
|
-
k.preventDefault(), d !== null ? _() :
|
|
9543
|
+
k.preventDefault(), d !== null ? _() : C();
|
|
9534
9544
|
},
|
|
9535
9545
|
className: "space-y-3",
|
|
9536
9546
|
children: [
|
|
@@ -9587,7 +9597,7 @@ const UndoRedo = () => {
|
|
|
9587
9597
|
] }),
|
|
9588
9598
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9589
9599
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => w(A), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9590
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9600
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(A), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9591
9601
|
] })
|
|
9592
9602
|
] }, A)) })
|
|
9593
9603
|
] });
|
|
@@ -9757,7 +9767,7 @@ const RootLayout = () => {
|
|
|
9757
9767
|
console.log("handleMenuItemClick", k, n), r(n === k ? null : k);
|
|
9758
9768
|
},
|
|
9759
9769
|
[n, r]
|
|
9760
|
-
), { t: x } = useTranslation(), b = useMemo(() => [...p, ...d], [p, d]), y = useBuilderProp("htmlDir", "ltr"),
|
|
9770
|
+
), { t: x } = useTranslation(), b = useMemo(() => [...p, ...d], [p, d]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b), S = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
9761
9771
|
useEffect(() => {
|
|
9762
9772
|
if (n !== null) {
|
|
9763
9773
|
const k = find(b, { id: n });
|
|
@@ -9767,8 +9777,8 @@ const RootLayout = () => {
|
|
|
9767
9777
|
const w = useMemo(() => {
|
|
9768
9778
|
if (n === null) return 0;
|
|
9769
9779
|
const k = find(b, { id: n });
|
|
9770
|
-
return get(k, "view", "standard") === "standard" ?
|
|
9771
|
-
}, [n,
|
|
9780
|
+
return get(k, "view", "standard") === "standard" ? S : l;
|
|
9781
|
+
}, [n, S, l, b]), _ = useCallback(() => {
|
|
9772
9782
|
r(a.current);
|
|
9773
9783
|
}, [r, n]), B = useCallback(() => {
|
|
9774
9784
|
r("outline");
|
|
@@ -9820,15 +9830,15 @@ const RootLayout = () => {
|
|
|
9820
9830
|
initial: { width: w },
|
|
9821
9831
|
animate: { width: w },
|
|
9822
9832
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9823
|
-
children: n !== null && get(
|
|
9833
|
+
children: n !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9824
9834
|
/* @__PURE__ */ jsx(
|
|
9825
9835
|
"div",
|
|
9826
9836
|
{
|
|
9827
|
-
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(
|
|
9828
|
-
children: /* @__PURE__ */ jsx("span", { children: x(get(
|
|
9837
|
+
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(C, "isInternal", !1) ? "" : "w-64"}`,
|
|
9838
|
+
children: /* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9829
9839
|
}
|
|
9830
9840
|
),
|
|
9831
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9841
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
|
|
9832
9842
|
] })
|
|
9833
9843
|
}
|
|
9834
9844
|
),
|
|
@@ -9874,34 +9884,34 @@ const RootLayout = () => {
|
|
|
9874
9884
|
}
|
|
9875
9885
|
),
|
|
9876
9886
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9877
|
-
n !== null && get(
|
|
9887
|
+
n !== null && get(C, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
|
|
9878
9888
|
SheetContent,
|
|
9879
9889
|
{
|
|
9880
9890
|
side: "left",
|
|
9881
9891
|
className: "flex flex-col gap-0 p-0 sm:max-w-full",
|
|
9882
|
-
style: { width: `${
|
|
9892
|
+
style: { width: `${S}px` },
|
|
9883
9893
|
children: [
|
|
9884
9894
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9885
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9886
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9895
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9896
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9887
9897
|
] }) }),
|
|
9888
|
-
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9898
|
+
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9889
9899
|
close: B
|
|
9890
9900
|
}) }) })
|
|
9891
9901
|
]
|
|
9892
9902
|
}
|
|
9893
9903
|
) }),
|
|
9894
9904
|
" ",
|
|
9895
|
-
n !== null && get(
|
|
9905
|
+
n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${S}px` }, children: [
|
|
9896
9906
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9897
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9898
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9907
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9908
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9899
9909
|
] }) }),
|
|
9900
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9910
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9901
9911
|
close: B
|
|
9902
9912
|
}) }) })
|
|
9903
9913
|
] }) }),
|
|
9904
|
-
n !== null && get(
|
|
9914
|
+
n !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9905
9915
|
motion.div,
|
|
9906
9916
|
{
|
|
9907
9917
|
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
@@ -9920,12 +9930,12 @@ const RootLayout = () => {
|
|
|
9920
9930
|
children: [
|
|
9921
9931
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9922
9932
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9923
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
9924
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9933
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
|
|
9934
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9925
9935
|
] }),
|
|
9926
9936
|
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
9927
9937
|
] }),
|
|
9928
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9938
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9929
9939
|
close: B
|
|
9930
9940
|
}) }) })
|
|
9931
9941
|
]
|
|
@@ -9986,8 +9996,8 @@ const RootLayout = () => {
|
|
|
9986
9996
|
const x = l.toLowerCase();
|
|
9987
9997
|
return Object.fromEntries(
|
|
9988
9998
|
Object.entries(a).filter(([b, y]) => {
|
|
9989
|
-
var
|
|
9990
|
-
return (b == null ? void 0 : b.toLowerCase().includes(x)) || ((
|
|
9999
|
+
var C;
|
|
10000
|
+
return (b == null ? void 0 : b.toLowerCase().includes(x)) || ((C = y == null ? void 0 : y.description) == null ? void 0 : C.toLowerCase().includes(x));
|
|
9991
10001
|
})
|
|
9992
10002
|
);
|
|
9993
10003
|
}, [a, l]), m = (x) => {
|
|
@@ -9997,7 +10007,7 @@ const RootLayout = () => {
|
|
|
9997
10007
|
});
|
|
9998
10008
|
}, h = (x) => {
|
|
9999
10009
|
if (!c) return;
|
|
10000
|
-
const b = x.clientX - p.x, y = x.clientY - p.y,
|
|
10010
|
+
const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, S = C.offsetWidth, w = C.offsetHeight, _ = window.innerWidth - S, B = window.innerHeight - w, I = Math.max(0, Math.min(b, _)), k = Math.max(0, Math.min(y, B));
|
|
10001
10011
|
r(I, k);
|
|
10002
10012
|
}, f = () => {
|
|
10003
10013
|
u(!1);
|
|
@@ -10249,10 +10259,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10249
10259
|
return b;
|
|
10250
10260
|
b.d.clear();
|
|
10251
10261
|
let y = !0;
|
|
10252
|
-
function
|
|
10262
|
+
function C() {
|
|
10253
10263
|
l.has(n) && (x(o, n), m(o), g(o));
|
|
10254
10264
|
}
|
|
10255
|
-
function
|
|
10265
|
+
function S(k) {
|
|
10256
10266
|
var A;
|
|
10257
10267
|
if (isSelfAtom(n, k)) {
|
|
10258
10268
|
const E = d(o, k);
|
|
@@ -10267,7 +10277,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10267
10277
|
try {
|
|
10268
10278
|
return returnAtomValue(v);
|
|
10269
10279
|
} finally {
|
|
10270
|
-
b.d.set(k, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (A = l.get(k)) == null || A.t.add(n), y ||
|
|
10280
|
+
b.d.set(k, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (A = l.get(k)) == null || A.t.add(n), y || C();
|
|
10271
10281
|
}
|
|
10272
10282
|
}
|
|
10273
10283
|
let w, _;
|
|
@@ -10287,8 +10297,8 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10287
10297
|
}
|
|
10288
10298
|
}, I = b.n;
|
|
10289
10299
|
try {
|
|
10290
|
-
const k = p(o, n,
|
|
10291
|
-
return setAtomStateValueOrPromise(o, n, k), isPromiseLike$1(k) && (registerAbortHandler(k, () => w == null ? void 0 : w.abort()), k.then(
|
|
10300
|
+
const k = p(o, n, S, B);
|
|
10301
|
+
return setAtomStateValueOrPromise(o, n, k), isPromiseLike$1(k) && (registerAbortHandler(k, () => w == null ? void 0 : w.abort()), k.then(C, C)), b;
|
|
10292
10302
|
} catch (k) {
|
|
10293
10303
|
return delete b.v, b.e = k, ++b.n, b;
|
|
10294
10304
|
} finally {
|
|
@@ -10306,18 +10316,18 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10306
10316
|
}, writeAtomState = (o, n, ...r) => {
|
|
10307
10317
|
const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], u = a[11], p = a[12], d = a[13], g = a[14], m = a[15], h = a[17];
|
|
10308
10318
|
let f = !0;
|
|
10309
|
-
const x = (y) => returnAtomValue(g(o, y)), b = (y, ...
|
|
10310
|
-
var
|
|
10319
|
+
const x = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
|
|
10320
|
+
var S;
|
|
10311
10321
|
const w = u(o, y);
|
|
10312
10322
|
try {
|
|
10313
10323
|
if (isSelfAtom(n, y)) {
|
|
10314
10324
|
if (!hasInitialValue(y))
|
|
10315
10325
|
throw new Error("atom not writable");
|
|
10316
|
-
const _ = w.n, B =
|
|
10317
|
-
setAtomStateValueOrPromise(o, y, B), h(o, y), _ !== w.n && (l.add(y), (
|
|
10326
|
+
const _ = w.n, B = C[0];
|
|
10327
|
+
setAtomStateValueOrPromise(o, y, B), h(o, y), _ !== w.n && (l.add(y), (S = i.c) == null || S.call(i, y), m(o, y));
|
|
10318
10328
|
return;
|
|
10319
10329
|
} else
|
|
10320
|
-
return writeAtomState(o, y, ...
|
|
10330
|
+
return writeAtomState(o, y, ...C);
|
|
10321
10331
|
} finally {
|
|
10322
10332
|
f || (d(o), p(o));
|
|
10323
10333
|
}
|
|
@@ -10358,19 +10368,19 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10358
10368
|
}, l.set(n, x), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
|
|
10359
10369
|
const b = () => {
|
|
10360
10370
|
let y = !0;
|
|
10361
|
-
const
|
|
10371
|
+
const C = (...S) => {
|
|
10362
10372
|
try {
|
|
10363
|
-
return h(o, n, ...
|
|
10373
|
+
return h(o, n, ...S);
|
|
10364
10374
|
} finally {
|
|
10365
10375
|
y || (g(o), d(o));
|
|
10366
10376
|
}
|
|
10367
10377
|
};
|
|
10368
10378
|
try {
|
|
10369
|
-
const
|
|
10370
|
-
|
|
10379
|
+
const S = u(o, n, C);
|
|
10380
|
+
S && (x.u = () => {
|
|
10371
10381
|
y = !0;
|
|
10372
10382
|
try {
|
|
10373
|
-
|
|
10383
|
+
S();
|
|
10374
10384
|
} finally {
|
|
10375
10385
|
y = !1;
|
|
10376
10386
|
}
|
|
@@ -10613,10 +10623,10 @@ function domToJsx(o, n = 0) {
|
|
|
10613
10623
|
} else if (h.name === "style" && h.value) {
|
|
10614
10624
|
const f = h.value.split(";").reduce(
|
|
10615
10625
|
(x, b) => {
|
|
10616
|
-
const [y,
|
|
10617
|
-
if (y &&
|
|
10618
|
-
const
|
|
10619
|
-
x[
|
|
10626
|
+
const [y, C] = b.split(":").map((S) => S.trim());
|
|
10627
|
+
if (y && C) {
|
|
10628
|
+
const S = y.replace(/-([a-z])/g, (w) => w[1].toUpperCase());
|
|
10629
|
+
x[S] = C.replace(/['"]/g, "");
|
|
10620
10630
|
}
|
|
10621
10631
|
return x;
|
|
10622
10632
|
},
|
|
@@ -10644,7 +10654,7 @@ function domToJsx(o, n = 0) {
|
|
|
10644
10654
|
(h, f) => {
|
|
10645
10655
|
const [x, b] = f.split(":").map((y) => y.trim());
|
|
10646
10656
|
if (x && b) {
|
|
10647
|
-
const y = x.replace(/-([a-z])/g, (
|
|
10657
|
+
const y = x.replace(/-([a-z])/g, (C) => C[1].toUpperCase());
|
|
10648
10658
|
h[y] = b.replace(/['"]/g, "");
|
|
10649
10659
|
}
|
|
10650
10660
|
return h;
|
|
@@ -10713,7 +10723,7 @@ ${l}${l}${i == null ? void 0 : i.trimEnd()}
|
|
|
10713
10723
|
${l})
|
|
10714
10724
|
}`, { jsx: i, html: formatHtml(c), componentName: a };
|
|
10715
10725
|
}, ExportCodeModalContent = ({ tab: o }) => {
|
|
10716
|
-
var
|
|
10726
|
+
var C;
|
|
10717
10727
|
const { t: n } = useTranslation(), [r, a] = useState({ html: "", jsx: "" }), l = useSelectedBlock(), i = useBlocksHtmlForAi(), [c, u] = useState(""), [p, d] = useState(!1), g = () => {
|
|
10718
10728
|
switch (o) {
|
|
10719
10729
|
case "js":
|
|
@@ -10738,13 +10748,13 @@ ${l})
|
|
|
10738
10748
|
}, h = useCallback(async () => {
|
|
10739
10749
|
try {
|
|
10740
10750
|
d(!1), await new Promise((k) => setTimeout(k, 1e3));
|
|
10741
|
-
const
|
|
10751
|
+
const S = i({ EXTRA_CORE_BLOCKS: ["Icon"] }), w = o === "ts", {
|
|
10742
10752
|
jsx: _,
|
|
10743
10753
|
html: B,
|
|
10744
10754
|
componentName: I
|
|
10745
10755
|
} = await getExportedCoded({
|
|
10746
10756
|
selectedBlock: l,
|
|
10747
|
-
html:
|
|
10757
|
+
html: S,
|
|
10748
10758
|
isTypeScript: w
|
|
10749
10759
|
});
|
|
10750
10760
|
a({ html: B, jsx: _ }), u(I), d(!0);
|
|
@@ -10757,22 +10767,22 @@ ${l})
|
|
|
10757
10767
|
h();
|
|
10758
10768
|
}, [h, o]);
|
|
10759
10769
|
const f = useCallback(
|
|
10760
|
-
async (
|
|
10770
|
+
async (S) => {
|
|
10761
10771
|
try {
|
|
10762
|
-
navigator.clipboard.writeText(
|
|
10772
|
+
navigator.clipboard.writeText(S), toast.success(n("Export code copied!"));
|
|
10763
10773
|
} catch {
|
|
10764
10774
|
toast.error(n("Failed to copy export code"));
|
|
10765
10775
|
}
|
|
10766
10776
|
},
|
|
10767
10777
|
[n]
|
|
10768
|
-
), x = (
|
|
10769
|
-
const w = new Blob([
|
|
10778
|
+
), x = (S) => {
|
|
10779
|
+
const w = new Blob([S], { type: "text/jsx" }), _ = URL.createObjectURL(w), B = document.createElement("a");
|
|
10770
10780
|
B.href = _, B.download = g(), document.body.appendChild(B), B.click(), URL.revokeObjectURL(_), document.body.removeChild(B), toast.success(n("Export code downloaded successfully!"));
|
|
10771
10781
|
}, b = /* @__PURE__ */ jsxs("span", { children: [
|
|
10772
10782
|
"Download ",
|
|
10773
10783
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-light text-gray-300", children: g() })
|
|
10774
10784
|
] }), y = useMemo(() => {
|
|
10775
|
-
const
|
|
10785
|
+
const S = { extend: shadcnTheme() }, w = JSON.stringify(S, null, 2);
|
|
10776
10786
|
return `{
|
|
10777
10787
|
// Your tailwind config ...
|
|
10778
10788
|
|
|
@@ -10781,7 +10791,7 @@ ${l})
|
|
|
10781
10791
|
`)},
|
|
10782
10792
|
}`;
|
|
10783
10793
|
}, []);
|
|
10784
|
-
return ((
|
|
10794
|
+
return ((C = r == null ? void 0 : r.jsx) == null ? void 0 : C.length) > 0 && p ? /* @__PURE__ */ jsx(
|
|
10785
10795
|
CodeDisplay,
|
|
10786
10796
|
{
|
|
10787
10797
|
onCopy: f,
|