@chaibuilder/sdk 3.0.3 → 3.0.5
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/{apply-binding-CxkQxWx3.cjs → apply-binding-HQ9gBNJP.cjs} +1 -1
- package/dist/{apply-binding-OTp8TO_7.js → apply-binding-tfi-KyyV.js} +133 -130
- package/dist/{code-editor-BL_76o6w.cjs → code-editor-CF1tV_Nj.cjs} +1 -1
- package/dist/{code-editor-tDa4T69w.js → code-editor-CbG2Orke.js} +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.d.ts +0 -2
- package/dist/core.js +370 -326
- package/dist/{css-import-modal-CgSqJi_w.js → css-import-modal-CgQoE9jh.js} +1 -1
- package/dist/{css-import-modal-BRFVZ9j3.cjs → css-import-modal-bSqqsAxl.cjs} +1 -1
- package/dist/render.cjs +2 -2
- package/dist/render.js +63 -63
- package/dist/toggle-ByUaDO5Y.cjs +1 -0
- package/dist/{toggle-C6VUu_7m.js → toggle-Cud7csHn.js} +101 -93
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -1
- package/dist/ui.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +30 -30
- package/package.json +1 -1
- package/dist/toggle-C5f1IJ1G.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var U = (o, n, r) => n in o ? V(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
+
var $ = (o, n, r) => U(o, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
6
|
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, sortBy, round } from "lodash-es";
|
|
7
|
-
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, 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, ReloadIcon, MagicWandIcon, MagnifyingGlassIcon, CaretRightIcon,
|
|
7
|
+
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, 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, ReloadIcon, MagicWandIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, ChatBubbleIcon, FaceIcon, ShuffleIcon, ImageIcon, PaperPlaneIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } 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";
|
|
11
11
|
import { atomWithStorage, splitAtom, useAtomCallback } from "jotai/utils";
|
|
12
12
|
import { g as generateUUID, a as getBreakpointValue, c as cn$2 } from "./common-functions-BGzDsf1z.js";
|
|
13
|
-
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator,
|
|
13
|
+
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, B as Badge, b6 as TooltipProvider, aY as Switch, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, r as Avatar, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-Cud7csHn.js";
|
|
14
14
|
import clsx$1, { clsx } from "clsx";
|
|
15
15
|
import { twMerge } from "tailwind-merge";
|
|
16
16
|
import TreeModel from "tree-model";
|
|
17
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY, h as getSplitChaiClasses, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, f as getBlocksFromHTML, i as ROOT_TEMP_KEY } from "./apply-binding-
|
|
17
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, h as getSplitChaiClasses, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, f as getBlocksFromHTML, i as ROOT_TEMP_KEY } from "./apply-binding-tfi-KyyV.js";
|
|
18
18
|
import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
|
|
19
19
|
import { isObject } from "@rjsf/utils";
|
|
20
20
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
@@ -35,7 +35,7 @@ import Autosuggest from "react-autosuggest";
|
|
|
35
35
|
import { useFeature } from "flagged";
|
|
36
36
|
import { Tree } from "react-arborist";
|
|
37
37
|
import i18n from "i18next";
|
|
38
|
-
import { default as
|
|
38
|
+
import { default as Ve } from "i18next";
|
|
39
39
|
import "himalaya";
|
|
40
40
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
41
41
|
import tailwindForms from "@tailwindcss/forms";
|
|
@@ -280,7 +280,7 @@ import.meta.vitest && describe("canDropBlock Function", () => {
|
|
|
280
280
|
});
|
|
281
281
|
class PubSub {
|
|
282
282
|
constructor() {
|
|
283
|
-
|
|
283
|
+
$(this, "subscribers", /* @__PURE__ */ new Map());
|
|
284
284
|
}
|
|
285
285
|
subscribe(n, r) {
|
|
286
286
|
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
@@ -839,12 +839,12 @@ const undoRedoStateAtom = atom({
|
|
|
839
839
|
return {
|
|
840
840
|
moveBlocks: (x, y, b) => {
|
|
841
841
|
const C = map(x, (j) => {
|
|
842
|
-
const
|
|
843
|
-
return { _id: j, oldParent:
|
|
842
|
+
const A = n.find((E) => E._id === j)._parent || null, w = n.filter((E) => A ? E._parent === A : !E._parent).map((E) => E._id).indexOf(j);
|
|
843
|
+
return { _id: j, oldParent: A, oldPosition: w };
|
|
844
844
|
}), B = C.find(({ _id: j }) => j === x[0]);
|
|
845
845
|
B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
|
|
846
|
-
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition:
|
|
847
|
-
i([j], _,
|
|
846
|
+
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition: A }) => {
|
|
847
|
+
i([j], _, A);
|
|
848
848
|
}),
|
|
849
849
|
redo: () => i(x, y, b)
|
|
850
850
|
}));
|
|
@@ -870,8 +870,8 @@ const undoRedoStateAtom = atom({
|
|
|
870
870
|
else {
|
|
871
871
|
const B = keys(y);
|
|
872
872
|
C = map(x, (j) => {
|
|
873
|
-
const _ = n.find((k) => k._id === j),
|
|
874
|
-
return each(B, (k) =>
|
|
873
|
+
const _ = n.find((k) => k._id === j), A = { _id: j };
|
|
874
|
+
return each(B, (k) => A[k] = _[k]), A;
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
c(map(x, (B) => ({ _id: B, ...y }))), o({
|
|
@@ -2381,16 +2381,16 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2381
2381
|
try {
|
|
2382
2382
|
const b = p === u ? "" : p;
|
|
2383
2383
|
console.log("prompt", x);
|
|
2384
|
-
const C = x.toLowerCase().includes("translate the content"), B = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, C) : [m(f, d)], j = await l(h, addLangToPrompt(x, g, h), B, b), { blocks: _, error:
|
|
2385
|
-
if (
|
|
2386
|
-
a(
|
|
2384
|
+
const C = x.toLowerCase().includes("translate the content"), B = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, C) : [m(f, d)], j = await l(h, addLangToPrompt(x, g, h), B, b), { blocks: _, error: A } = j;
|
|
2385
|
+
if (A) {
|
|
2386
|
+
a(A);
|
|
2387
2387
|
return;
|
|
2388
2388
|
}
|
|
2389
2389
|
if (h === "styles") {
|
|
2390
|
-
const k = _.map((
|
|
2391
|
-
for (const E in
|
|
2392
|
-
E !== "_id" && (
|
|
2393
|
-
return
|
|
2390
|
+
const k = _.map((w) => {
|
|
2391
|
+
for (const E in w)
|
|
2392
|
+
E !== "_id" && (w[E] = `${STYLES_KEY},${w[E]}`);
|
|
2393
|
+
return w;
|
|
2394
2394
|
});
|
|
2395
2395
|
c(k);
|
|
2396
2396
|
} else
|
|
@@ -2548,14 +2548,6 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2548
2548
|
},
|
|
2549
2549
|
[o, n]
|
|
2550
2550
|
);
|
|
2551
|
-
}, hiddenBlockIdsAtom = atom([]), useHiddenBlockIds = () => {
|
|
2552
|
-
const [o, n] = useAtom$1(hiddenBlockIdsAtom), r = useCallback(
|
|
2553
|
-
(a) => {
|
|
2554
|
-
n((l) => includes(l, a) ? without(l, a) : [...l, a]);
|
|
2555
|
-
},
|
|
2556
|
-
[n]
|
|
2557
|
-
);
|
|
2558
|
-
return [o, n, r];
|
|
2559
2551
|
}, highlightBlockIdAtom = atom(""), useHighlightBlockId = () => useAtom$1(highlightBlockIdAtom), libraryBlocksAtom = atom(
|
|
2560
2552
|
{}
|
|
2561
2553
|
), useLibraryBlocks = (o) => {
|
|
@@ -3131,17 +3123,17 @@ class Content extends Component {
|
|
|
3131
3123
|
class Frame extends Component {
|
|
3132
3124
|
constructor(r, a) {
|
|
3133
3125
|
super(r, a);
|
|
3134
|
-
|
|
3126
|
+
$(this, "setRef", (r) => {
|
|
3135
3127
|
this.nodeRef.current = r;
|
|
3136
3128
|
const { forwardedRef: a } = this.props;
|
|
3137
3129
|
typeof a == "function" ? a(r) : a && (a.current = r);
|
|
3138
3130
|
});
|
|
3139
|
-
|
|
3131
|
+
$(this, "handleLoad", () => {
|
|
3140
3132
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
3141
3133
|
});
|
|
3142
3134
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
3143
3135
|
// fallback to an interval to check if that's the case
|
|
3144
|
-
|
|
3136
|
+
$(this, "loadCheck", () => setInterval(() => {
|
|
3145
3137
|
this.handleLoad();
|
|
3146
3138
|
}, 500));
|
|
3147
3139
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -3178,7 +3170,7 @@ class Frame extends Component {
|
|
|
3178
3170
|
return delete r.head, delete r.initialContent, delete r.mountTarget, delete r.contentDidMount, delete r.contentDidUpdate, delete r.forwardedRef, /* @__PURE__ */ jsx("iframe", { ...r, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
|
|
3179
3171
|
}
|
|
3180
3172
|
}
|
|
3181
|
-
|
|
3173
|
+
$(Frame, "defaultProps", {
|
|
3182
3174
|
style: {},
|
|
3183
3175
|
head: null,
|
|
3184
3176
|
children: void 0,
|
|
@@ -3610,26 +3602,26 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3610
3602
|
({ block: o, children: n }) => {
|
|
3611
3603
|
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: C, blockType: B } = useMemo(() => {
|
|
3612
3604
|
var I;
|
|
3613
|
-
const
|
|
3605
|
+
const w = o._type;
|
|
3614
3606
|
let E = o[r];
|
|
3615
3607
|
const S = getRegisteredChaiBlock(o._type);
|
|
3616
|
-
return f && ((I = S == null ? void 0 : S.i18nProps) == null ? void 0 : I.includes(r)) && has(o, `${r}-${f}`) && (E = get(o, `${r}-${f}`)), { blockContent: E, blockType:
|
|
3608
|
+
return f && ((I = S == null ? void 0 : S.i18nProps) == null ? void 0 : I.includes(r)) && has(o, `${r}-${f}`) && (E = get(o, `${r}-${f}`)), { blockContent: E, blockType: w };
|
|
3617
3609
|
}, [o, f]), j = useCallback(
|
|
3618
|
-
(
|
|
3610
|
+
(w) => {
|
|
3619
3611
|
var S;
|
|
3620
|
-
const E =
|
|
3612
|
+
const E = w || ((S = g.current) == null ? void 0 : S.innerText);
|
|
3621
3613
|
h([b], { [r]: E }), u(null), c(null), d(-1), x(b ? [b] : []);
|
|
3622
3614
|
},
|
|
3623
3615
|
[b, h, c, x, f]
|
|
3624
3616
|
), _ = useDebouncedCallback(
|
|
3625
|
-
(
|
|
3626
|
-
h([b], { [r]:
|
|
3617
|
+
(w) => {
|
|
3618
|
+
h([b], { [r]: w });
|
|
3627
3619
|
},
|
|
3628
3620
|
[b, o, h, f],
|
|
3629
3621
|
1e3
|
|
3630
|
-
),
|
|
3631
|
-
(
|
|
3632
|
-
|
|
3622
|
+
), A = useCallback(
|
|
3623
|
+
(w) => {
|
|
3624
|
+
w.preventDefault(), b && (y.current = b), j(), setTimeout(() => {
|
|
3633
3625
|
const E = y.current;
|
|
3634
3626
|
y.current = null, x([E]);
|
|
3635
3627
|
}, 100);
|
|
@@ -3639,7 +3631,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3639
3631
|
useEffect(() => {
|
|
3640
3632
|
var v;
|
|
3641
3633
|
if (!b) return;
|
|
3642
|
-
const
|
|
3634
|
+
const w = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${w}${E}`);
|
|
3643
3635
|
S && ((v = S == null ? void 0 : S.classList) == null || v.add("sr-only"), u(S));
|
|
3644
3636
|
}, [b, B, a, i]);
|
|
3645
3637
|
const k = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
@@ -3649,7 +3641,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3649
3641
|
editingElement: p,
|
|
3650
3642
|
onChange: _,
|
|
3651
3643
|
onClose: j,
|
|
3652
|
-
onEscape:
|
|
3644
|
+
onEscape: A
|
|
3653
3645
|
}
|
|
3654
3646
|
) : /* @__PURE__ */ jsx(
|
|
3655
3647
|
MemoizedEditor,
|
|
@@ -3659,7 +3651,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3659
3651
|
editingElement: p,
|
|
3660
3652
|
onClose: j,
|
|
3661
3653
|
onChange: _,
|
|
3662
|
-
onEscape:
|
|
3654
|
+
onEscape: A
|
|
3663
3655
|
}
|
|
3664
3656
|
)) : null, [p, b, B, C, j, f]);
|
|
3665
3657
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -3696,23 +3688,23 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3696
3688
|
blockAtom: n,
|
|
3697
3689
|
children: r
|
|
3698
3690
|
}) => {
|
|
3699
|
-
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] =
|
|
3700
|
-
() =>
|
|
3701
|
-
index:
|
|
3702
|
-
key:
|
|
3691
|
+
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), h = get(c, "component", null), { index: f, key: x } = useContext(RepeaterContext), y = useMemo(
|
|
3692
|
+
() => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
|
|
3693
|
+
index: f,
|
|
3694
|
+
key: x
|
|
3703
3695
|
}) : applyLanguage(i, d, c),
|
|
3704
|
-
[i, d, c, g,
|
|
3705
|
-
),
|
|
3696
|
+
[i, d, c, g, m, f, x]
|
|
3697
|
+
), b = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), C = useMemo(
|
|
3706
3698
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3707
3699
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3708
|
-
),
|
|
3700
|
+
), B = useMemo(
|
|
3709
3701
|
() => ({
|
|
3710
|
-
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index":
|
|
3702
|
+
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
|
|
3711
3703
|
inBuilder: !0,
|
|
3712
3704
|
lang: d || p,
|
|
3705
|
+
...y,
|
|
3713
3706
|
...b,
|
|
3714
3707
|
...C,
|
|
3715
|
-
...B,
|
|
3716
3708
|
...o
|
|
3717
3709
|
}),
|
|
3718
3710
|
[
|
|
@@ -3720,29 +3712,29 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3720
3712
|
i._type,
|
|
3721
3713
|
d,
|
|
3722
3714
|
p,
|
|
3715
|
+
y,
|
|
3723
3716
|
b,
|
|
3724
3717
|
C,
|
|
3725
|
-
B,
|
|
3726
3718
|
o
|
|
3727
3719
|
]
|
|
3728
|
-
),
|
|
3729
|
-
if (isNull(
|
|
3730
|
-
let
|
|
3731
|
-
...
|
|
3720
|
+
), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), _ = useMemo(() => get(i, "_show", !0), [i]);
|
|
3721
|
+
if (isNull(h) || !_) return null;
|
|
3722
|
+
let A = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
|
|
3723
|
+
...B,
|
|
3732
3724
|
children: r({
|
|
3733
3725
|
_id: i._id,
|
|
3734
3726
|
_type: i._type,
|
|
3735
|
-
...isArray(
|
|
3736
|
-
repeaterItems: applyLimit(
|
|
3737
|
-
$repeaterItemsKey:
|
|
3727
|
+
...isArray(y.repeaterItems) ? {
|
|
3728
|
+
repeaterItems: applyLimit(y.repeaterItems, i),
|
|
3729
|
+
$repeaterItemsKey: y.$repeaterItemsKey
|
|
3738
3730
|
} : {},
|
|
3739
3731
|
...i.partialBlockId ? { partialBlockId: i.partialBlockId } : "",
|
|
3740
3732
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3741
3733
|
})
|
|
3742
3734
|
}) });
|
|
3743
|
-
const k = a === i._id && (l ===
|
|
3744
|
-
return
|
|
3745
|
-
}, PartialWrapper = ({ children: o, partialBlockId: n }) => {
|
|
3735
|
+
const k = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: A }) : A;
|
|
3736
|
+
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: k }) : k;
|
|
3737
|
+
}, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
|
|
3746
3738
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
3747
3739
|
(d) => {
|
|
3748
3740
|
if (d.stopPropagation(), a !== "SAVED") {
|
|
@@ -3766,7 +3758,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3766
3758
|
] });
|
|
3767
3759
|
}, PartialBlocksRenderer = ({ partialBlockId: o }) => {
|
|
3768
3760
|
const { getPartailBlocks: n } = usePartialBlocksStore(), r = useMemo(() => n(o), [n, o]), a = useMemo(() => splitAtom(atom(r)), [r]);
|
|
3769
|
-
return isEmpty(r) ? null : /* @__PURE__ */ jsx(PartialWrapper, { partialBlockId: o, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: r }) });
|
|
3761
|
+
return isEmpty(r) ? null : /* @__PURE__ */ jsx(PartialWrapper$1, { partialBlockId: o, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: r }) });
|
|
3770
3762
|
}, BlocksRenderer = ({
|
|
3771
3763
|
blocks: o,
|
|
3772
3764
|
parent: n = null,
|
|
@@ -3906,7 +3898,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3906
3898
|
}, FallbackError = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3907
3899
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3908
3900
|
/* @__PURE__ */ jsx("p", { children: "Please try again." })
|
|
3909
|
-
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
3901
|
+
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-CbG2Orke.js")), CanvasArea = () => {
|
|
3910
3902
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3911
3903
|
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: [
|
|
3912
3904
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -4217,8 +4209,8 @@ const DataBindingSelector = ({
|
|
|
4217
4209
|
}
|
|
4218
4210
|
const h = (b) => /[.,!?;:]/.test(b), f = (b, C, B) => {
|
|
4219
4211
|
let j = "", _ = "";
|
|
4220
|
-
const
|
|
4221
|
-
return C > 0 && (
|
|
4212
|
+
const A = C > 0 ? b[C - 1] : "", k = C < b.length ? b[C] : "";
|
|
4213
|
+
return C > 0 && (A === "." || !h(A) && A !== " ") && (j = " "), C < b.length && !h(k) && k !== " " && (_ = " "), {
|
|
4222
4214
|
text: j + B + _,
|
|
4223
4215
|
prefixLength: j.length,
|
|
4224
4216
|
suffixLength: _.length
|
|
@@ -4235,9 +4227,9 @@ const DataBindingSelector = ({
|
|
|
4235
4227
|
if (B !== j)
|
|
4236
4228
|
b.chain().deleteSelection().insertContent(C).run();
|
|
4237
4229
|
else {
|
|
4238
|
-
const { state:
|
|
4230
|
+
const { state: A } = b, k = A.selection.from, w = A.doc.textBetween(Math.max(0, k - 1), k), E = A.doc.textBetween(k, Math.min(k + 1, A.doc.content.size));
|
|
4239
4231
|
let S = "";
|
|
4240
|
-
k > 0 &&
|
|
4232
|
+
k > 0 && w !== " " && !h(w) && (S = " ");
|
|
4241
4233
|
let v = "";
|
|
4242
4234
|
E && E !== " " && !h(E) && (v = " "), b.chain().insertContent(S + C + v).run();
|
|
4243
4235
|
}
|
|
@@ -4251,8 +4243,8 @@ const DataBindingSelector = ({
|
|
|
4251
4243
|
n(v, {}, r);
|
|
4252
4244
|
return;
|
|
4253
4245
|
}
|
|
4254
|
-
const
|
|
4255
|
-
n(
|
|
4246
|
+
const A = `{{${g}}}`, { text: k } = f(B, C, A), w = B.slice(0, C) + k + B.slice(C);
|
|
4247
|
+
n(w, {}, r);
|
|
4256
4248
|
}
|
|
4257
4249
|
},
|
|
4258
4250
|
[r, n, a, c == null ? void 0 : c._id, d]
|
|
@@ -4298,7 +4290,7 @@ const DataBindingSelector = ({
|
|
|
4298
4290
|
), _ = (S) => {
|
|
4299
4291
|
const v = ["pageType", u, S.id];
|
|
4300
4292
|
v[1] && (r(v.join(":")), h(S.name), p(!1), x([]), b(-1));
|
|
4301
|
-
},
|
|
4293
|
+
}, A = (S) => {
|
|
4302
4294
|
switch (S.key) {
|
|
4303
4295
|
case "ArrowDown":
|
|
4304
4296
|
S.preventDefault(), b((v) => v < f.length - 1 ? v + 1 : v);
|
|
@@ -4323,7 +4315,7 @@ const DataBindingSelector = ({
|
|
|
4323
4315
|
}, [y]);
|
|
4324
4316
|
const k = () => {
|
|
4325
4317
|
h(""), x([]), b(-1), p(!1), r("");
|
|
4326
|
-
},
|
|
4318
|
+
}, w = (S) => {
|
|
4327
4319
|
h(S), p(!isEmpty(S)), c(!0), j(S);
|
|
4328
4320
|
};
|
|
4329
4321
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4334,8 +4326,8 @@ const DataBindingSelector = ({
|
|
|
4334
4326
|
{
|
|
4335
4327
|
type: "text",
|
|
4336
4328
|
value: m,
|
|
4337
|
-
onChange: (S) =>
|
|
4338
|
-
onKeyDown:
|
|
4329
|
+
onChange: (S) => w(S.target.value),
|
|
4330
|
+
onKeyDown: A,
|
|
4339
4331
|
placeholder: a(`Search ${B ?? ""}`),
|
|
4340
4332
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4341
4333
|
}
|
|
@@ -4672,8 +4664,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4672
4664
|
const { state: b } = u, C = b.selection.from, B = b.doc.textBetween(Math.max(0, C - 1), C), j = b.doc.textBetween(C, Math.min(C + 1, b.doc.content.size));
|
|
4673
4665
|
let _ = "";
|
|
4674
4666
|
C > 0 && B !== " " && !/[.,!?;:]/.test(B) && (_ = " ");
|
|
4675
|
-
let
|
|
4676
|
-
j && j !== " " && !/[.,!?;:]/.test(j) && (
|
|
4667
|
+
let A = "";
|
|
4668
|
+
j && j !== " " && !/[.,!?;:]/.test(j) && (A = " "), u.chain().insertContent(_ + h + A).run();
|
|
4677
4669
|
}
|
|
4678
4670
|
};
|
|
4679
4671
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4976,11 +4968,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4976
4968
|
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), C = useSelectedBlock(), B = useRegisteredChaiBlocks(), j = useMemo(
|
|
4977
4969
|
() => get(B, [C == null ? void 0 : C._type, "i18nProps"], []),
|
|
4978
4970
|
[B, C == null ? void 0 : C._type]
|
|
4979
|
-
), [_,
|
|
4971
|
+
), [_, A] = useState(null);
|
|
4980
4972
|
if (c)
|
|
4981
4973
|
return null;
|
|
4982
4974
|
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: n, children: a });
|
|
4983
|
-
const
|
|
4975
|
+
const w = j == null ? void 0 : j.includes(o.replace("root.", ""));
|
|
4984
4976
|
if (p.type === "array") {
|
|
4985
4977
|
const E = _ === o;
|
|
4986
4978
|
return /* @__PURE__ */ jsxs("div", { className: `${n} relative`, children: [
|
|
@@ -4988,7 +4980,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4988
4980
|
"label",
|
|
4989
4981
|
{
|
|
4990
4982
|
htmlFor: o,
|
|
4991
|
-
onClick: () =>
|
|
4983
|
+
onClick: () => A(E ? null : o),
|
|
4992
4984
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4993
4985
|
children: [
|
|
4994
4986
|
E ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
@@ -5023,7 +5015,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5023
5015
|
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
5024
5016
|
r,
|
|
5025
5017
|
" ",
|
|
5026
|
-
|
|
5018
|
+
w && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5027
5019
|
" ",
|
|
5028
5020
|
y
|
|
5029
5021
|
] }),
|
|
@@ -5138,50 +5130,101 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5138
5130
|
},
|
|
5139
5131
|
i
|
|
5140
5132
|
);
|
|
5141
|
-
}),
|
|
5133
|
+
}), CommonSettings = ({ block: o, updateBlockProps: n, updateBlockPropsRealtime: r }) => {
|
|
5134
|
+
const [a, l] = useState(o._name), [i, c] = useState(o._show ?? !0);
|
|
5135
|
+
useEffect(() => {
|
|
5136
|
+
o && (l(o._name), c(o._show ?? !0));
|
|
5137
|
+
}, [o]);
|
|
5138
|
+
const d = useCallback(
|
|
5139
|
+
debounce((g) => {
|
|
5140
|
+
n([o._id], { _name: g });
|
|
5141
|
+
}, 500),
|
|
5142
|
+
[o._id, n]
|
|
5143
|
+
);
|
|
5144
|
+
return /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
5145
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 items-center", children: [
|
|
5146
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-gray-500", children: "Name" }),
|
|
5147
|
+
/* @__PURE__ */ jsx(
|
|
5148
|
+
"input",
|
|
5149
|
+
{
|
|
5150
|
+
type: "text",
|
|
5151
|
+
className: "col-span-2 rounded-md border border-gray-300 px-2 py-1 text-xs",
|
|
5152
|
+
value: a,
|
|
5153
|
+
onChange: (g) => {
|
|
5154
|
+
const m = g.target.value;
|
|
5155
|
+
l(m), r([o._id], { _name: m }), d(m);
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5158
|
+
)
|
|
5159
|
+
] }),
|
|
5160
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 items-center", children: [
|
|
5161
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-gray-500", children: "Show" }),
|
|
5162
|
+
/* @__PURE__ */ jsx(
|
|
5163
|
+
Switch,
|
|
5164
|
+
{
|
|
5165
|
+
className: "!col-span-2 !h-4 !w-7",
|
|
5166
|
+
thumbClassName: "!h-3 !w-3",
|
|
5167
|
+
checked: i,
|
|
5168
|
+
onCheckedChange: (g) => {
|
|
5169
|
+
c(g), n([o._id], { _show: g });
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
)
|
|
5173
|
+
] })
|
|
5174
|
+
] }) });
|
|
5175
|
+
}, formDataWithSelectedLang = (o, n, r) => {
|
|
5142
5176
|
const a = cloneDeep(o);
|
|
5143
5177
|
return forEach(keys(o), (l) => {
|
|
5144
5178
|
includes(get(r, "i18nProps", []), l) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
|
|
5145
5179
|
}), a;
|
|
5146
5180
|
};
|
|
5147
5181
|
function BlockSettings() {
|
|
5148
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData:
|
|
5149
|
-
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(
|
|
5182
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData: A }, k, w) => {
|
|
5183
|
+
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(A, k) }, w);
|
|
5150
5184
|
}, x = useCallback(
|
|
5151
|
-
debounce(({ formData:
|
|
5152
|
-
f({ formData:
|
|
5185
|
+
debounce(({ formData: A }, k, w) => {
|
|
5186
|
+
f({ formData: A }, k, w), d(A);
|
|
5153
5187
|
}, 1500),
|
|
5154
5188
|
[n == null ? void 0 : n._id, o]
|
|
5155
|
-
), y = ({ formData:
|
|
5156
|
-
k && (r([n._id], { [k]: get(
|
|
5157
|
-
}, b = ({ formData:
|
|
5158
|
-
k && (r([g._id], { [k]: get(
|
|
5189
|
+
), y = ({ formData: A }, k) => {
|
|
5190
|
+
k && (r([n._id], { [k]: get(A, k) }), x({ formData: A }, k, { [k]: get(c, k) }));
|
|
5191
|
+
}, b = ({ formData: A }, k) => {
|
|
5192
|
+
k && (r([g._id], { [k]: get(A, k) }), x({ formData: A }, k, { [k]: get(c, k) }));
|
|
5159
5193
|
}, { schema: C, uiSchema: B } = useMemo(() => {
|
|
5160
|
-
const
|
|
5161
|
-
if (!
|
|
5194
|
+
const A = n == null ? void 0 : n._type;
|
|
5195
|
+
if (!A)
|
|
5162
5196
|
return { schema: {}, uiSchema: {} };
|
|
5163
5197
|
try {
|
|
5164
|
-
const { schema: k, uiSchema:
|
|
5165
|
-
if (
|
|
5198
|
+
const { schema: k, uiSchema: w } = getBlockFormSchemas(A);
|
|
5199
|
+
if (A === "Repeater") {
|
|
5166
5200
|
const E = get(n, "repeaterItems", "");
|
|
5167
|
-
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(
|
|
5201
|
+
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(w, "filter", { "ui:widget": "collectionSelect" }), set(w, "sort", { "ui:widget": "collectionSelect" })) : (set(w, "filter", { "ui:widget": "hidden" }), set(w, "sort", { "ui:widget": "hidden" }));
|
|
5168
5202
|
}
|
|
5169
|
-
return { schema: k, uiSchema:
|
|
5203
|
+
return { schema: k, uiSchema: w };
|
|
5170
5204
|
} catch {
|
|
5171
5205
|
return { schema: {}, uiSchema: {} };
|
|
5172
5206
|
}
|
|
5173
5207
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: _ } = useMemo(() => {
|
|
5174
5208
|
if (!g || !(g != null && g._type))
|
|
5175
5209
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5176
|
-
const
|
|
5177
|
-
return { wrapperSchema: k, wrapperUiSchema:
|
|
5210
|
+
const A = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: w = {} } = getBlockFormSchemas(A);
|
|
5211
|
+
return { wrapperSchema: k, wrapperUiSchema: w };
|
|
5178
5212
|
}, [g]);
|
|
5179
5213
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5214
|
+
/* @__PURE__ */ jsx(
|
|
5215
|
+
CommonSettings,
|
|
5216
|
+
{
|
|
5217
|
+
block: n,
|
|
5218
|
+
updateBlockProps: a,
|
|
5219
|
+
updateBlockPropsRealtime: r
|
|
5220
|
+
}
|
|
5221
|
+
),
|
|
5222
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
5180
5223
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5181
5224
|
/* @__PURE__ */ jsxs(
|
|
5182
5225
|
"div",
|
|
5183
5226
|
{
|
|
5184
|
-
onClick: () => u((
|
|
5227
|
+
onClick: () => u((A) => !A),
|
|
5185
5228
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5186
5229
|
children: [
|
|
5187
5230
|
p ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 text-slate-400" }),
|
|
@@ -5434,7 +5477,7 @@ const BlockStylingProps = () => {
|
|
|
5434
5477
|
}
|
|
5435
5478
|
h(v), l(v === "class" || isEmpty(S) ? "" : S);
|
|
5436
5479
|
}, [i, p, u]);
|
|
5437
|
-
const
|
|
5480
|
+
const A = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), k = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), w = useCallback(
|
|
5438
5481
|
(S = !1) => {
|
|
5439
5482
|
const v = getUserInputValues(`${a}`, u);
|
|
5440
5483
|
if (get(v, "error", !1)) {
|
|
@@ -5443,15 +5486,15 @@ const BlockStylingProps = () => {
|
|
|
5443
5486
|
}
|
|
5444
5487
|
const I = get(v, "unit") !== "" ? get(v, "unit") : m;
|
|
5445
5488
|
if (I === "auto" || I === "none") {
|
|
5446
|
-
|
|
5489
|
+
A(`${d}${I}`);
|
|
5447
5490
|
return;
|
|
5448
5491
|
}
|
|
5449
5492
|
if (get(v, "value") === "")
|
|
5450
5493
|
return;
|
|
5451
5494
|
const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5452
|
-
S ? k(T) :
|
|
5495
|
+
S ? k(T) : A(T);
|
|
5453
5496
|
},
|
|
5454
|
-
[
|
|
5497
|
+
[A, k, a, m, d, u]
|
|
5455
5498
|
), E = useCallback(
|
|
5456
5499
|
(S) => {
|
|
5457
5500
|
const v = getUserInputValues(`${a}`, u);
|
|
@@ -5460,15 +5503,15 @@ const BlockStylingProps = () => {
|
|
|
5460
5503
|
return;
|
|
5461
5504
|
}
|
|
5462
5505
|
if (S === "auto" || S === "none") {
|
|
5463
|
-
|
|
5506
|
+
A(`${d}${S}`);
|
|
5464
5507
|
return;
|
|
5465
5508
|
}
|
|
5466
5509
|
if (get(v, "value") === "")
|
|
5467
5510
|
return;
|
|
5468
5511
|
const I = get(v, "unit") !== "" ? get(v, "unit") : S, T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5469
|
-
|
|
5512
|
+
A(T);
|
|
5470
5513
|
},
|
|
5471
|
-
[
|
|
5514
|
+
[A, a, d, u]
|
|
5472
5515
|
);
|
|
5473
5516
|
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5474
5517
|
/* @__PURE__ */ jsx(
|
|
@@ -5490,7 +5533,7 @@ const BlockStylingProps = () => {
|
|
|
5490
5533
|
{
|
|
5491
5534
|
readOnly: m === "class",
|
|
5492
5535
|
onKeyPress: (S) => {
|
|
5493
|
-
S.key === "Enter" &&
|
|
5536
|
+
S.key === "Enter" && w();
|
|
5494
5537
|
},
|
|
5495
5538
|
onKeyDown: (S) => {
|
|
5496
5539
|
if (S.keyCode !== 38 && S.keyCode !== 40)
|
|
@@ -5505,7 +5548,7 @@ const BlockStylingProps = () => {
|
|
|
5505
5548
|
onKeyUp: (S) => {
|
|
5506
5549
|
j && (S.preventDefault(), _(!1));
|
|
5507
5550
|
},
|
|
5508
|
-
onBlur: () =>
|
|
5551
|
+
onBlur: () => w(),
|
|
5509
5552
|
onChange: (S) => {
|
|
5510
5553
|
x(!1), l(S.target.value);
|
|
5511
5554
|
},
|
|
@@ -5553,7 +5596,7 @@ const BlockStylingProps = () => {
|
|
|
5553
5596
|
if (b(() => ""), B(!1), isEmpty(S))
|
|
5554
5597
|
return;
|
|
5555
5598
|
const v = `${S}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5556
|
-
|
|
5599
|
+
A(L);
|
|
5557
5600
|
},
|
|
5558
5601
|
onDrag: (S) => {
|
|
5559
5602
|
if (isEmpty(S))
|
|
@@ -6024,11 +6067,11 @@ const COLOR_PROP = {
|
|
|
6024
6067
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6025
6068
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6026
6069
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
|
|
6027
|
-
(k,
|
|
6070
|
+
(k, w = !0) => {
|
|
6028
6071
|
const E = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
|
|
6029
6072
|
(p || u !== "") && (E.mq = "xs");
|
|
6030
6073
|
const S = generateFullClsName(E);
|
|
6031
|
-
h(x, [S],
|
|
6074
|
+
h(x, [S], w);
|
|
6032
6075
|
},
|
|
6033
6076
|
[x, p, g, u, l, h]
|
|
6034
6077
|
), C = useCallback(() => {
|
|
@@ -6049,9 +6092,9 @@ const COLOR_PROP = {
|
|
|
6049
6092
|
}[k]);
|
|
6050
6093
|
},
|
|
6051
6094
|
[j]
|
|
6052
|
-
),
|
|
6053
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m &&
|
|
6054
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !
|
|
6095
|
+
), A = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
6096
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && A, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6097
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6055
6098
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6056
6099
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
6057
6100
|
r === "arbitrary" ? /* @__PURE__ */ jsx(
|
|
@@ -6070,7 +6113,7 @@ const COLOR_PROP = {
|
|
|
6070
6113
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6071
6114
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6072
6115
|
] }),
|
|
6073
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children:
|
|
6116
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: A ? /* @__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" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6074
6117
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6075
6118
|
"button",
|
|
6076
6119
|
{
|
|
@@ -6474,21 +6517,21 @@ function ManualClasses() {
|
|
|
6474
6517
|
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), C = b.split(" ").filter((T) => !isEmpty(T)), B = () => {
|
|
6475
6518
|
const T = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6476
6519
|
u(m, T, !0), x("");
|
|
6477
|
-
}, [j, _] = useState([]),
|
|
6478
|
-
const P = T.trim().toLowerCase(),
|
|
6479
|
-
let
|
|
6480
|
-
if (
|
|
6481
|
-
const [
|
|
6482
|
-
|
|
6483
|
-
...
|
|
6484
|
-
item: { ...
|
|
6520
|
+
}, [j, _] = useState([]), A = ({ value: T }) => {
|
|
6521
|
+
const P = T.trim().toLowerCase(), R = P.match(/.+:/g);
|
|
6522
|
+
let N = [];
|
|
6523
|
+
if (R && R.length > 0) {
|
|
6524
|
+
const [D] = R, F = P.replace(D, "");
|
|
6525
|
+
N = i.search(F).map((M) => ({
|
|
6526
|
+
...M,
|
|
6527
|
+
item: { ...M.item, name: D + M.item.name }
|
|
6485
6528
|
}));
|
|
6486
6529
|
} else
|
|
6487
|
-
|
|
6488
|
-
return _(map(
|
|
6530
|
+
N = i.search(P);
|
|
6531
|
+
return _(map(N, "item"));
|
|
6489
6532
|
}, k = () => {
|
|
6490
6533
|
_([]);
|
|
6491
|
-
},
|
|
6534
|
+
}, w = (T) => T.name, E = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), S = useMemo(
|
|
6492
6535
|
() => ({
|
|
6493
6536
|
ref: o,
|
|
6494
6537
|
autoComplete: "off",
|
|
@@ -6542,9 +6585,9 @@ function ManualClasses() {
|
|
|
6542
6585
|
Autosuggest,
|
|
6543
6586
|
{
|
|
6544
6587
|
suggestions: j,
|
|
6545
|
-
onSuggestionsFetchRequested:
|
|
6588
|
+
onSuggestionsFetchRequested: A,
|
|
6546
6589
|
onSuggestionsClearRequested: k,
|
|
6547
|
-
getSuggestionValue:
|
|
6590
|
+
getSuggestionValue: w,
|
|
6548
6591
|
renderSuggestion: E,
|
|
6549
6592
|
inputProps: S,
|
|
6550
6593
|
containerProps: {
|
|
@@ -6575,16 +6618,16 @@ function ManualClasses() {
|
|
|
6575
6618
|
{
|
|
6576
6619
|
ref: o,
|
|
6577
6620
|
value: n,
|
|
6578
|
-
onChange: (
|
|
6621
|
+
onChange: (R) => r(R.target.value),
|
|
6579
6622
|
onBlur: () => {
|
|
6580
6623
|
v(T);
|
|
6581
6624
|
},
|
|
6582
|
-
onKeyDown: (
|
|
6583
|
-
|
|
6625
|
+
onKeyDown: (R) => {
|
|
6626
|
+
R.key === "Enter" && v(T);
|
|
6584
6627
|
},
|
|
6585
|
-
onFocus: (
|
|
6628
|
+
onFocus: (R) => {
|
|
6586
6629
|
setTimeout(() => {
|
|
6587
|
-
|
|
6630
|
+
R.target.select();
|
|
6588
6631
|
}, 0);
|
|
6589
6632
|
},
|
|
6590
6633
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
|
|
@@ -6950,15 +6993,15 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6950
6993
|
const j = await c({ library: n, block: o });
|
|
6951
6994
|
let _ = r;
|
|
6952
6995
|
if (y(first(j)) && (_ = null), !isEmpty(j)) {
|
|
6953
|
-
const
|
|
6954
|
-
if (B.dataTransfer.setData("text/plain", JSON.stringify(
|
|
6996
|
+
const A = { blocks: j, uiLibrary: !0, parent: _ };
|
|
6997
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(A)), o.preview) {
|
|
6955
6998
|
const k = new Image();
|
|
6956
6999
|
k.src = o.preview, k.onload = () => {
|
|
6957
7000
|
B.dataTransfer.setDragImage(k, 0, 0);
|
|
6958
7001
|
};
|
|
6959
7002
|
} else
|
|
6960
7003
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6961
|
-
x(
|
|
7004
|
+
x(A), setTimeout(() => {
|
|
6962
7005
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6963
7006
|
}, 200);
|
|
6964
7007
|
}
|
|
@@ -7010,13 +7053,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7010
7053
|
return;
|
|
7011
7054
|
}
|
|
7012
7055
|
}, [y, b]);
|
|
7013
|
-
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(),
|
|
7056
|
+
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(), A = (v) => {
|
|
7014
7057
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7015
7058
|
j.current && C(v);
|
|
7016
7059
|
}, 400);
|
|
7017
7060
|
}, k = () => {
|
|
7018
7061
|
i != null && i.id && p(i.id);
|
|
7019
|
-
},
|
|
7062
|
+
}, w = () => {
|
|
7020
7063
|
g("");
|
|
7021
7064
|
};
|
|
7022
7065
|
if (d)
|
|
@@ -7040,7 +7083,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7040
7083
|
u && /* @__PURE__ */ jsx(
|
|
7041
7084
|
"button",
|
|
7042
7085
|
{
|
|
7043
|
-
onClick:
|
|
7086
|
+
onClick: w,
|
|
7044
7087
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7045
7088
|
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
7046
7089
|
}
|
|
@@ -7061,7 +7104,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7061
7104
|
] }) }) : map(y, (v, I) => /* @__PURE__ */ jsxs(
|
|
7062
7105
|
"div",
|
|
7063
7106
|
{
|
|
7064
|
-
onMouseEnter: () =>
|
|
7107
|
+
onMouseEnter: () => A(I),
|
|
7065
7108
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7066
7109
|
role: "button",
|
|
7067
7110
|
onClick: () => C(I),
|
|
@@ -7146,7 +7189,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7146
7189
|
// Set the type to PartialBlock
|
|
7147
7190
|
label: formatReadableName(b.name || x),
|
|
7148
7191
|
description: b.description || "",
|
|
7149
|
-
icon:
|
|
7192
|
+
icon: FrameIcon,
|
|
7150
7193
|
group: B,
|
|
7151
7194
|
// Use formatted type as group
|
|
7152
7195
|
category: "partial",
|
|
@@ -7231,15 +7274,15 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7231
7274
|
}
|
|
7232
7275
|
) : n,
|
|
7233
7276
|
[n, d]
|
|
7234
|
-
),
|
|
7277
|
+
), A = useMemo(
|
|
7235
7278
|
() => d ? o.filter(
|
|
7236
7279
|
(v) => reject(filter(values(_), { group: v }), { hidden: !0 }).length > 0
|
|
7237
7280
|
) : o.filter((v) => reject(filter(values(n), { group: v }), { hidden: !0 }).length > 0),
|
|
7238
7281
|
[n, _, o, d]
|
|
7239
7282
|
), k = useMemo(
|
|
7240
|
-
() => sortBy(
|
|
7241
|
-
[
|
|
7242
|
-
),
|
|
7283
|
+
() => sortBy(A, (v) => CORE_GROUPS.indexOf(v) === -1 ? 99 : CORE_GROUPS.indexOf(v)),
|
|
7284
|
+
[A]
|
|
7285
|
+
), w = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), E = useMemo(() => h === "all" ? k : [h], [k, h]);
|
|
7243
7286
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7244
7287
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7245
7288
|
Input$1,
|
|
@@ -7277,7 +7320,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7277
7320
|
`sidebar-${v}`
|
|
7278
7321
|
))
|
|
7279
7322
|
] }) }) }),
|
|
7280
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children:
|
|
7323
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: A.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
7281
7324
|
i("No blocks found matching"),
|
|
7282
7325
|
' "',
|
|
7283
7326
|
d,
|
|
@@ -7285,7 +7328,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7285
7328
|
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((v) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7286
7329
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(v.toLowerCase())) }),
|
|
7287
7330
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7288
|
-
h === "all" ? filter(values(
|
|
7331
|
+
h === "all" ? filter(values(w), { group: v }) : values(w),
|
|
7289
7332
|
{ hidden: !0 }
|
|
7290
7333
|
).map((I) => /* @__PURE__ */ jsx(
|
|
7291
7334
|
CoreBlock,
|
|
@@ -7646,44 +7689,44 @@ const Input = ({ node: o }) => {
|
|
|
7646
7689
|
}, currentAddSelection = atom(null), getBlockDisplayName = (o) => {
|
|
7647
7690
|
var n;
|
|
7648
7691
|
return o != null && o._name ? o._name : (o == null ? void 0 : o._type) === "Box" && (o != null && o.tag) && (o == null ? void 0 : o.tag) !== "div" ? startCase(o.tag) : ((n = o == null ? void 0 : o._type) == null ? void 0 : n.split("/").pop()) || "";
|
|
7649
|
-
}, Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7650
|
-
var
|
|
7651
|
-
const { t: a } = useTranslation(),
|
|
7652
|
-
let
|
|
7653
|
-
const
|
|
7654
|
-
N.stopPropagation(),
|
|
7692
|
+
}, truncateText = (o, n) => o.length > n ? o.substring(0, n) + "..." : o, Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7693
|
+
var R;
|
|
7694
|
+
const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
7695
|
+
let d = null;
|
|
7696
|
+
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: f, willReceiveDrop: x, isDragging: y, isEditing: b, handleClick: C } = o, B = get(h, "_show", !0), j = (N) => {
|
|
7697
|
+
N.stopPropagation(), B && o.toggle();
|
|
7655
7698
|
}, _ = (N) => {
|
|
7656
|
-
N.isInternal && (
|
|
7657
|
-
},
|
|
7658
|
-
N.isInternal &&
|
|
7659
|
-
}, [k,
|
|
7699
|
+
N.isInternal && (d = N.isOpen, N.isOpen && N.close());
|
|
7700
|
+
}, A = (N) => {
|
|
7701
|
+
N.isInternal && d !== null && (d ? N.open() : N.close(), d = null);
|
|
7702
|
+
}, [k, w] = useAtom$1(currentAddSelection), E = () => {
|
|
7660
7703
|
var N;
|
|
7661
|
-
S(), o.parent.isSelected ||
|
|
7704
|
+
S(), o.parent.isSelected || w((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
|
|
7662
7705
|
}, S = () => {
|
|
7663
|
-
|
|
7706
|
+
w(null);
|
|
7664
7707
|
}, v = (N) => {
|
|
7665
|
-
S(), N.stopPropagation(), !o.isOpen &&
|
|
7708
|
+
S(), N.stopPropagation(), !o.isOpen && B && o.toggle(), C(N);
|
|
7666
7709
|
};
|
|
7667
7710
|
useEffect(() => {
|
|
7668
7711
|
const N = setTimeout(() => {
|
|
7669
|
-
|
|
7712
|
+
x && !o.isOpen && !y && B && o.toggle();
|
|
7670
7713
|
}, 500);
|
|
7671
7714
|
return () => clearTimeout(N);
|
|
7672
|
-
}, [
|
|
7673
|
-
const I = (N,
|
|
7674
|
-
const
|
|
7675
|
-
|
|
7676
|
-
const
|
|
7677
|
-
|
|
7715
|
+
}, [x, o, y]);
|
|
7716
|
+
const I = (N, D) => {
|
|
7717
|
+
const F = i.contentDocument || i.contentWindow.document, O = F.querySelector(`[data-block-id=${N}]`);
|
|
7718
|
+
O && O.setAttribute("data-drop", D);
|
|
7719
|
+
const M = O.getBoundingClientRect(), H = i.getBoundingClientRect();
|
|
7720
|
+
M.top >= H.top && M.left >= H.left && M.bottom <= H.bottom && M.right <= H.right || (F.documentElement.scrollTop = O.offsetTop - H.top);
|
|
7678
7721
|
}, L = (N) => {
|
|
7679
7722
|
S();
|
|
7680
|
-
const
|
|
7681
|
-
|
|
7723
|
+
const D = get(o, "parent.id");
|
|
7724
|
+
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: N }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: N });
|
|
7682
7725
|
};
|
|
7683
|
-
if (
|
|
7726
|
+
if (m === ROOT_TEMP_KEY)
|
|
7684
7727
|
return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
7685
7728
|
/* @__PURE__ */ jsx("br", {}),
|
|
7686
|
-
|
|
7729
|
+
c(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
|
|
7687
7730
|
"div",
|
|
7688
7731
|
{
|
|
7689
7732
|
role: "button",
|
|
@@ -7698,29 +7741,29 @@ const Input = ({ node: o }) => {
|
|
|
7698
7741
|
),
|
|
7699
7742
|
/* @__PURE__ */ jsx("br", {})
|
|
7700
7743
|
] });
|
|
7701
|
-
const T = useMemo(() => has(
|
|
7744
|
+
const T = useMemo(() => has(h, "_libBlockId") && !isEmpty(h._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [h, c]), P = useMemo(() => (h == null ? void 0 : h._type) === "PartialBlock" || (h == null ? void 0 : h._type) === "GlobalBlock", [h]);
|
|
7702
7745
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
7703
7746
|
"div",
|
|
7704
7747
|
{
|
|
7705
|
-
onMouseEnter: () =>
|
|
7706
|
-
onMouseLeave: () =>
|
|
7748
|
+
onMouseEnter: () => u(m),
|
|
7749
|
+
onMouseLeave: () => g(),
|
|
7707
7750
|
onClick: v,
|
|
7708
7751
|
style: n,
|
|
7709
|
-
"data-node-id":
|
|
7710
|
-
ref:
|
|
7752
|
+
"data-node-id": m,
|
|
7753
|
+
ref: r,
|
|
7711
7754
|
onDragStart: () => _(o),
|
|
7712
|
-
onDragEnd: () =>
|
|
7755
|
+
onDragEnd: () => A(o),
|
|
7713
7756
|
onDragOver: (N) => {
|
|
7714
|
-
N.preventDefault(), I(
|
|
7757
|
+
N.preventDefault(), I(m, "yes");
|
|
7715
7758
|
},
|
|
7716
7759
|
onDragLeave: (N) => {
|
|
7717
|
-
N.preventDefault(), I(
|
|
7760
|
+
N.preventDefault(), I(m, "no");
|
|
7718
7761
|
},
|
|
7719
7762
|
onDrop: (N) => {
|
|
7720
|
-
N.preventDefault(), I(
|
|
7763
|
+
N.preventDefault(), I(m, "no");
|
|
7721
7764
|
},
|
|
7722
7765
|
children: [
|
|
7723
|
-
|
|
7766
|
+
c(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
7724
7767
|
"div",
|
|
7725
7768
|
{
|
|
7726
7769
|
onClick: (N) => {
|
|
@@ -7728,21 +7771,21 @@ const Input = ({ node: o }) => {
|
|
|
7728
7771
|
},
|
|
7729
7772
|
onMouseEnter: E,
|
|
7730
7773
|
onMouseLeave: S,
|
|
7731
|
-
className: "absolute -top-0.5 h-
|
|
7732
|
-
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-
|
|
7774
|
+
className: "absolute -top-0.5 h-0.5 w-[90%] rounded bg-primary/80 opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7775
|
+
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-primary/80 p-1 outline outline-2 outline-white hover:bg-primary/80", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-2 w-2 stroke-[2] text-white" }) })
|
|
7733
7776
|
}
|
|
7734
7777
|
) }),
|
|
7735
7778
|
/* @__PURE__ */ jsxs(
|
|
7736
7779
|
"div",
|
|
7737
7780
|
{
|
|
7738
7781
|
className: cn(
|
|
7739
|
-
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
7740
|
-
|
|
7741
|
-
|
|
7782
|
+
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
7783
|
+
f ? "bg-primary/20" : "hover:bg-primary/10",
|
|
7784
|
+
x && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
7742
7785
|
(o == null ? void 0 : o.id) === k ? "bg-primary/10" : "",
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
T &&
|
|
7786
|
+
y && "opacity-20",
|
|
7787
|
+
B ? "" : "line-through opacity-50",
|
|
7788
|
+
T && f && "bg-primary/20 text-primary"
|
|
7746
7789
|
),
|
|
7747
7790
|
children: [
|
|
7748
7791
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -7750,7 +7793,7 @@ const Input = ({ node: o }) => {
|
|
|
7750
7793
|
"div",
|
|
7751
7794
|
{
|
|
7752
7795
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
7753
|
-
children:
|
|
7796
|
+
children: p && /* @__PURE__ */ jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) })
|
|
7754
7797
|
}
|
|
7755
7798
|
),
|
|
7756
7799
|
/* @__PURE__ */ jsxs(
|
|
@@ -7758,53 +7801,55 @@ const Input = ({ node: o }) => {
|
|
|
7758
7801
|
{
|
|
7759
7802
|
className: cn(
|
|
7760
7803
|
"leading-1 flex items-center",
|
|
7761
|
-
T && "text-
|
|
7762
|
-
T &&
|
|
7804
|
+
T && "text-orange-600/90",
|
|
7805
|
+
T && f && "text-orange-800",
|
|
7806
|
+
P && "text-purple-600/90",
|
|
7807
|
+
P && f && "text-purple-800"
|
|
7763
7808
|
),
|
|
7764
7809
|
children: [
|
|
7765
|
-
/* @__PURE__ */ jsx(TypeIcon, { type:
|
|
7766
|
-
|
|
7810
|
+
/* @__PURE__ */ jsx(TypeIcon, { type: h == null ? void 0 : h._type }),
|
|
7811
|
+
b ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
|
|
7767
7812
|
"div",
|
|
7768
7813
|
{
|
|
7769
7814
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
7770
7815
|
onDoubleClick: (N) => {
|
|
7771
7816
|
N.stopPropagation(), o.edit(), o.deselect();
|
|
7772
7817
|
},
|
|
7773
|
-
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(
|
|
7818
|
+
children: /* @__PURE__ */ jsx("span", { title: getBlockDisplayName(h).length > 17 ? getBlockDisplayName(h) : "", children: truncateText(getBlockDisplayName(h), 17) })
|
|
7774
7819
|
}
|
|
7775
7820
|
)
|
|
7776
7821
|
]
|
|
7777
7822
|
}
|
|
7778
7823
|
)
|
|
7779
7824
|
] }),
|
|
7780
|
-
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-
|
|
7781
|
-
canAddChildBlock(
|
|
7825
|
+
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-px group-hover:visible", children: [
|
|
7826
|
+
canAddChildBlock(h == null ? void 0 : h._type) && B && c(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7782
7827
|
/* @__PURE__ */ jsx(
|
|
7783
7828
|
TooltipTrigger,
|
|
7784
7829
|
{
|
|
7785
|
-
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id:
|
|
7786
|
-
className: "cursor-pointer rounded bg-transparent",
|
|
7830
|
+
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
|
|
7831
|
+
className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10",
|
|
7787
7832
|
asChild: !0,
|
|
7788
|
-
children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-
|
|
7833
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" })
|
|
7789
7834
|
}
|
|
7790
7835
|
),
|
|
7791
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Add block") })
|
|
7836
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Add block inside") })
|
|
7792
7837
|
] }) : null,
|
|
7793
7838
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7794
7839
|
/* @__PURE__ */ jsx(
|
|
7795
7840
|
TooltipTrigger,
|
|
7796
7841
|
{
|
|
7797
7842
|
onClick: (N) => {
|
|
7798
|
-
N.stopPropagation(),
|
|
7843
|
+
N.stopPropagation(), l([m], { _show: !B }), o.isOpen && o.toggle();
|
|
7799
7844
|
},
|
|
7800
|
-
className: "cursor-pointer rounded bg-transparent",
|
|
7845
|
+
className: "cursor-pointer rounded bg-transparent p-0.5 hover:bg-primary/10",
|
|
7801
7846
|
asChild: !0,
|
|
7802
|
-
children: /* @__PURE__ */ jsx(
|
|
7847
|
+
children: B ? /* @__PURE__ */ jsx(EyeClosedIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-4 w-4" })
|
|
7803
7848
|
}
|
|
7804
7849
|
),
|
|
7805
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Hide block") })
|
|
7850
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(B ? "Hide the block from page" : "Show the block on page") })
|
|
7806
7851
|
] }),
|
|
7807
|
-
/* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id:
|
|
7852
|
+
/* @__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" }) }) })
|
|
7808
7853
|
] })
|
|
7809
7854
|
]
|
|
7810
7855
|
}
|
|
@@ -7851,7 +7896,7 @@ const Input = ({ node: o }) => {
|
|
|
7851
7896
|
return canAcceptChildBlock(a, l);
|
|
7852
7897
|
};
|
|
7853
7898
|
}, ListTree = () => {
|
|
7854
|
-
const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(),
|
|
7899
|
+
const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom$1(treeRefAtom), { t } = useTranslation(), [parentContext, setParentContext] = useState(null), clearSelection = () => {
|
|
7855
7900
|
setIds([]), setStyleBlocks([]);
|
|
7856
7901
|
}, filteredTreeData = useMemo(() => {
|
|
7857
7902
|
const o = (r, a) => r.filter((l) => !a.includes(l._id)).map((l) => ({
|
|
@@ -7929,6 +7974,7 @@ const Input = ({ node: o }) => {
|
|
|
7929
7974
|
disabled: !hasPermission(PERMISSIONS.ADD_BLOCK),
|
|
7930
7975
|
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK),
|
|
7931
7976
|
variant: "default",
|
|
7977
|
+
className: "bg-primary/80",
|
|
7932
7978
|
size: "sm",
|
|
7933
7979
|
children: [
|
|
7934
7980
|
"+ ",
|
|
@@ -7946,32 +7992,19 @@ const Input = ({ node: o }) => {
|
|
|
7946
7992
|
treeRef.current.isEditing || handleKeyDown(o);
|
|
7947
7993
|
},
|
|
7948
7994
|
children: [
|
|
7949
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-end gap-x-
|
|
7950
|
-
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7951
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
7952
|
-
Button,
|
|
7953
|
-
{
|
|
7954
|
-
onClick: () => setHiddenBlocks([]),
|
|
7955
|
-
variant: "outline",
|
|
7956
|
-
className: "h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
7957
|
-
size: "sm",
|
|
7958
|
-
children: /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-4 w-4" })
|
|
7959
|
-
}
|
|
7960
|
-
) }),
|
|
7961
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Show hidden blocks") })
|
|
7962
|
-
] }),
|
|
7995
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-end gap-x-1 pb-2 text-sm text-muted-foreground", children: [
|
|
7963
7996
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7964
7997
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
7965
7998
|
var o;
|
|
7966
7999
|
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
|
|
7967
|
-
}, variant: "
|
|
8000
|
+
}, variant: "ghost", size: "sm", children: /* @__PURE__ */ jsx(DoubleArrowDownIcon, { className: "h-2 w-2" }) }) }),
|
|
7968
8001
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
|
|
7969
8002
|
] }),
|
|
7970
8003
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7971
8004
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
7972
8005
|
var o;
|
|
7973
8006
|
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
|
|
7974
|
-
}, variant: "
|
|
8007
|
+
}, variant: "ghost", size: "sm", children: /* @__PURE__ */ jsx(DoubleArrowUpIcon, { className: "h-2 w-2" }) }) }),
|
|
7975
8008
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
|
|
7976
8009
|
] })
|
|
7977
8010
|
] }),
|
|
@@ -7999,7 +8032,7 @@ const Input = ({ node: o }) => {
|
|
|
7999
8032
|
onSelect,
|
|
8000
8033
|
childrenAccessor: (o) => o.children,
|
|
8001
8034
|
width: "100%",
|
|
8002
|
-
rowHeight:
|
|
8035
|
+
rowHeight: 25,
|
|
8003
8036
|
renderDragPreview: DefaultDragPreview,
|
|
8004
8037
|
indent: 10,
|
|
8005
8038
|
onContextMenu,
|
|
@@ -8210,7 +8243,7 @@ const Input = ({ node: o }) => {
|
|
|
8210
8243
|
"popover-foreground": ["#3d3436", "#f2e9e4"]
|
|
8211
8244
|
}
|
|
8212
8245
|
}, LazyCssImportModal = lazy(
|
|
8213
|
-
() => import("./css-import-modal-
|
|
8246
|
+
() => import("./css-import-modal-CgQoE9jh.js").then((o) => ({ default: o.CssImportModal }))
|
|
8214
8247
|
), PREV_THEME_KEY = "chai-builder-previous-theme", DEFAULT_THEME_PRESET = [
|
|
8215
8248
|
{ shadcn_default: defaultShadcnPreset },
|
|
8216
8249
|
{ twitter_theme: twitter },
|
|
@@ -8234,16 +8267,16 @@ const Input = ({ node: o }) => {
|
|
|
8234
8267
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8235
8268
|
const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8236
8269
|
if (d) {
|
|
8237
|
-
const
|
|
8270
|
+
const A = d.map((k) => Object.keys(k)[0]);
|
|
8238
8271
|
DEFAULT_THEME_PRESET.forEach((k) => {
|
|
8239
|
-
const
|
|
8240
|
-
|
|
8272
|
+
const w = Object.keys(k)[0];
|
|
8273
|
+
A.includes(w) || d.push(k);
|
|
8241
8274
|
});
|
|
8242
8275
|
}
|
|
8243
8276
|
const [g, m] = useTheme(), h = useThemeOptions(), { t: f } = useTranslation(), x = React.useCallback(
|
|
8244
|
-
(
|
|
8277
|
+
(A) => {
|
|
8245
8278
|
const k = { ...g };
|
|
8246
|
-
setPreviousTheme(k), m(
|
|
8279
|
+
setPreviousTheme(k), m(A), toast.success("Theme updated", {
|
|
8247
8280
|
action: {
|
|
8248
8281
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8249
8282
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
@@ -8259,56 +8292,56 @@ const Input = ({ node: o }) => {
|
|
|
8259
8292
|
},
|
|
8260
8293
|
[g, m]
|
|
8261
8294
|
), y = () => {
|
|
8262
|
-
const
|
|
8263
|
-
if (
|
|
8264
|
-
const k = Object.values(
|
|
8295
|
+
const A = d.find((k) => Object.keys(k)[0] === a);
|
|
8296
|
+
if (A) {
|
|
8297
|
+
const k = Object.values(A)[0];
|
|
8265
8298
|
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (x(k), l("")) : console.error("Invalid preset structure:", k);
|
|
8266
8299
|
} else
|
|
8267
8300
|
console.error("Preset not found:", a);
|
|
8268
|
-
}, b = (
|
|
8269
|
-
x(
|
|
8301
|
+
}, b = (A) => {
|
|
8302
|
+
x(A), l("");
|
|
8270
8303
|
}, C = useDebouncedCallback(
|
|
8271
|
-
(
|
|
8304
|
+
(A, k) => {
|
|
8272
8305
|
m(() => ({
|
|
8273
8306
|
...g,
|
|
8274
8307
|
fontFamily: {
|
|
8275
8308
|
...g.fontFamily,
|
|
8276
|
-
[
|
|
8309
|
+
[A.replace(/font-/g, "")]: k
|
|
8277
8310
|
}
|
|
8278
8311
|
}));
|
|
8279
8312
|
},
|
|
8280
8313
|
[g],
|
|
8281
8314
|
200
|
|
8282
8315
|
), B = React.useCallback(
|
|
8283
|
-
(
|
|
8316
|
+
(A) => {
|
|
8284
8317
|
m(() => ({
|
|
8285
8318
|
...g,
|
|
8286
|
-
borderRadius: `${
|
|
8319
|
+
borderRadius: `${A}px`
|
|
8287
8320
|
}));
|
|
8288
8321
|
},
|
|
8289
8322
|
[g]
|
|
8290
8323
|
), j = useDebouncedCallback(
|
|
8291
|
-
(
|
|
8324
|
+
(A, k) => {
|
|
8292
8325
|
m(() => {
|
|
8293
|
-
const
|
|
8294
|
-
return n ? set(
|
|
8326
|
+
const w = get(g, `colors.${A}`);
|
|
8327
|
+
return n ? set(w, 1, k) : set(w, 0, k), {
|
|
8295
8328
|
...g,
|
|
8296
8329
|
colors: {
|
|
8297
8330
|
...g.colors,
|
|
8298
|
-
[
|
|
8331
|
+
[A]: w
|
|
8299
8332
|
}
|
|
8300
8333
|
};
|
|
8301
8334
|
});
|
|
8302
8335
|
},
|
|
8303
8336
|
[g],
|
|
8304
8337
|
200
|
|
8305
|
-
), _ = (
|
|
8306
|
-
const
|
|
8307
|
-
return
|
|
8338
|
+
), _ = (A) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(A.items).map(([k]) => {
|
|
8339
|
+
const w = get(g, `colors.${k}.${n ? 1 : 0}`);
|
|
8340
|
+
return w ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8308
8341
|
/* @__PURE__ */ jsx(
|
|
8309
8342
|
ColorPickerInput,
|
|
8310
8343
|
{
|
|
8311
|
-
value:
|
|
8344
|
+
value: w,
|
|
8312
8345
|
onChange: (E) => j(k, E)
|
|
8313
8346
|
}
|
|
8314
8347
|
),
|
|
@@ -8328,9 +8361,9 @@ const Input = ({ node: o }) => {
|
|
|
8328
8361
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8329
8362
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8330
8363
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8331
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
8332
|
-
const k = Object.keys(
|
|
8333
|
-
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(
|
|
8364
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((A) => {
|
|
8365
|
+
const k = Object.keys(A)[0], w = k.replaceAll("_", " ");
|
|
8366
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(w) }, k);
|
|
8334
8367
|
}) })
|
|
8335
8368
|
] }) }),
|
|
8336
8369
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: f("Apply") }) })
|
|
@@ -8342,14 +8375,14 @@ const Input = ({ node: o }) => {
|
|
|
8342
8375
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8343
8376
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8344
8377
|
] }),
|
|
8345
|
-
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([
|
|
8378
|
+
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([A, k]) => /* @__PURE__ */ jsx(
|
|
8346
8379
|
FontSelector,
|
|
8347
8380
|
{
|
|
8348
|
-
label:
|
|
8349
|
-
value: g.fontFamily[
|
|
8350
|
-
onChange: (
|
|
8381
|
+
label: A,
|
|
8382
|
+
value: g.fontFamily[A.replace(/font-/g, "")] || k[Object.keys(k)[0]],
|
|
8383
|
+
onChange: (w) => C(A, w)
|
|
8351
8384
|
},
|
|
8352
|
-
|
|
8385
|
+
A
|
|
8353
8386
|
)) }),
|
|
8354
8387
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8355
8388
|
(h == null ? void 0 : h.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -8375,7 +8408,7 @@ const Input = ({ node: o }) => {
|
|
|
8375
8408
|
Switch,
|
|
8376
8409
|
{
|
|
8377
8410
|
checked: n,
|
|
8378
|
-
onCheckedChange: (
|
|
8411
|
+
onCheckedChange: (A) => r(A),
|
|
8379
8412
|
"aria-label": "Toggle dark mode",
|
|
8380
8413
|
className: "mx-1"
|
|
8381
8414
|
}
|
|
@@ -8383,7 +8416,7 @@ const Input = ({ node: o }) => {
|
|
|
8383
8416
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
8384
8417
|
] }) })
|
|
8385
8418
|
] }),
|
|
8386
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((
|
|
8419
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((A) => _(A)) })
|
|
8387
8420
|
] }),
|
|
8388
8421
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8389
8422
|
LazyCssImportModal,
|
|
@@ -9023,8 +9056,8 @@ function AIChatPanel() {
|
|
|
9023
9056
|
if (C) {
|
|
9024
9057
|
const j = new FileReader();
|
|
9025
9058
|
j.onload = (_) => {
|
|
9026
|
-
var
|
|
9027
|
-
d((
|
|
9059
|
+
var A;
|
|
9060
|
+
d((A = _.target) == null ? void 0 : A.result);
|
|
9028
9061
|
}, j.readAsDataURL(C);
|
|
9029
9062
|
}
|
|
9030
9063
|
}, x = () => {
|
|
@@ -9233,8 +9266,8 @@ const AiAssistant = () => {
|
|
|
9233
9266
|
r(k), l(a), c(""), p(""), h("");
|
|
9234
9267
|
}
|
|
9235
9268
|
}, C = (k) => {
|
|
9236
|
-
const
|
|
9237
|
-
r(
|
|
9269
|
+
const w = a.filter((E, S) => S !== k);
|
|
9270
|
+
r(w), l(w);
|
|
9238
9271
|
}, B = (k) => {
|
|
9239
9272
|
g(k), c(a[k].key), p(a[k].value);
|
|
9240
9273
|
}, j = () => {
|
|
@@ -9248,11 +9281,11 @@ const AiAssistant = () => {
|
|
|
9248
9281
|
}
|
|
9249
9282
|
}, _ = (k) => {
|
|
9250
9283
|
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? j() : b());
|
|
9251
|
-
},
|
|
9252
|
-
const
|
|
9284
|
+
}, A = useCallback((k) => {
|
|
9285
|
+
const w = (v) => /[.,!?;:]/.test(v), E = (v, I, L) => {
|
|
9253
9286
|
let T = "", P = "";
|
|
9254
|
-
const
|
|
9255
|
-
return I > 0 && (
|
|
9287
|
+
const R = I > 0 ? v[I - 1] : "", N = I < v.length ? v[I] : "";
|
|
9288
|
+
return I > 0 && (R === "." || !w(R) && R !== " ") && (T = " "), I < v.length && !w(N) && N !== " " && (P = " "), {
|
|
9256
9289
|
text: T + L + P,
|
|
9257
9290
|
prefixLength: T.length,
|
|
9258
9291
|
suffixLength: P.length
|
|
@@ -9261,12 +9294,12 @@ const AiAssistant = () => {
|
|
|
9261
9294
|
if (S) {
|
|
9262
9295
|
const v = S.selectionStart || 0, I = S.value || "", L = S.selectionEnd || v;
|
|
9263
9296
|
if (L > v) {
|
|
9264
|
-
const
|
|
9265
|
-
p(
|
|
9297
|
+
const D = `{{${k}}}`, { text: F } = E(I, v, D), O = I.slice(0, v) + F + I.slice(L);
|
|
9298
|
+
p(O);
|
|
9266
9299
|
return;
|
|
9267
9300
|
}
|
|
9268
|
-
const P = `{{${k}}}`, { text:
|
|
9269
|
-
p(
|
|
9301
|
+
const P = `{{${k}}}`, { text: R } = E(I, v, P), N = I.slice(0, v) + R + I.slice(v);
|
|
9302
|
+
p(N);
|
|
9270
9303
|
}
|
|
9271
9304
|
}, []);
|
|
9272
9305
|
return /* @__PURE__ */ jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
@@ -9299,7 +9332,7 @@ const AiAssistant = () => {
|
|
|
9299
9332
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9300
9333
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9301
9334
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9302
|
-
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect:
|
|
9335
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: A })
|
|
9303
9336
|
] }),
|
|
9304
9337
|
/* @__PURE__ */ jsx(
|
|
9305
9338
|
Textarea,
|
|
@@ -9324,16 +9357,16 @@ const AiAssistant = () => {
|
|
|
9324
9357
|
]
|
|
9325
9358
|
}
|
|
9326
9359
|
),
|
|
9327
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k,
|
|
9360
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k, w) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9328
9361
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9329
9362
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: k.key }),
|
|
9330
9363
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
|
|
9331
9364
|
] }),
|
|
9332
9365
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9333
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(
|
|
9334
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(
|
|
9366
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(w), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9367
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(w), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9335
9368
|
] })
|
|
9336
|
-
] },
|
|
9369
|
+
] }, w)) })
|
|
9337
9370
|
] });
|
|
9338
9371
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9339
9372
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9402,11 +9435,23 @@ function BlockAttributesToggle() {
|
|
|
9402
9435
|
n && /* @__PURE__ */ jsx(BlockAttributesEditor, {})
|
|
9403
9436
|
] });
|
|
9404
9437
|
}
|
|
9405
|
-
const
|
|
9438
|
+
const PartialWrapper = ({ partialBlockId: o }) => {
|
|
9439
|
+
const n = useBuilderProp("gotoPage", noop), { saveState: r } = useSavePage(), { selectedLang: a, fallbackLang: l } = useLanguages(), i = useCallback(
|
|
9440
|
+
(c) => {
|
|
9441
|
+
if (c.stopPropagation(), r !== "SAVED") {
|
|
9442
|
+
toast.error("You have unsaved changes. Please save the page first.");
|
|
9443
|
+
return;
|
|
9444
|
+
}
|
|
9445
|
+
n({ pageId: o, lang: a || l });
|
|
9446
|
+
},
|
|
9447
|
+
[r, n, o, a, l]
|
|
9448
|
+
);
|
|
9449
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "hidden", children: /* @__PURE__ */ jsx("div", { onDoubleClick: i, className: "h-full w-full items-center justify-center", children: /* @__PURE__ */ jsx("p", { className: "rounded-md bg-white px-2 py-1 text-xs", children: "Partial block. Double click to edit." }) }) }) });
|
|
9450
|
+
}, SettingsPanel = () => {
|
|
9406
9451
|
const o = useSelectedBlock(), { t: n } = useTranslation(), r = useBuilderProp("onError", noop), { hasPermission: a } = usePermissions();
|
|
9407
9452
|
let l = !a(PERMISSIONS.EDIT_BLOCK);
|
|
9408
9453
|
const i = !a(PERMISSIONS.EDIT_STYLES);
|
|
9409
|
-
return isNull(o) ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl p-4 text-muted-foreground", children: [
|
|
9454
|
+
return o && o._type === "PartialBlock" ? /* @__PURE__ */ jsx(PartialWrapper, { partialBlockId: o.partialBlockId }) : isNull(o) ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl p-4 text-muted-foreground", children: [
|
|
9410
9455
|
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "mx-auto text-3xl" }),
|
|
9411
9456
|
/* @__PURE__ */ jsx("h1", { children: n("Please select a block to edit settings or styles") })
|
|
9412
9457
|
] }) }) : l && i ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl p-4 text-muted-foreground", children: [
|
|
@@ -9491,11 +9536,11 @@ function useSidebarDefaultPanels() {
|
|
|
9491
9536
|
}, [o, n, r]);
|
|
9492
9537
|
}
|
|
9493
9538
|
const RootLayout = () => {
|
|
9494
|
-
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((
|
|
9495
|
-
|
|
9539
|
+
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((w) => {
|
|
9540
|
+
w.preventDefault();
|
|
9496
9541
|
}, []), f = useCallback(
|
|
9497
|
-
(
|
|
9498
|
-
console.log("handleMenuItemClick",
|
|
9542
|
+
(w) => {
|
|
9543
|
+
console.log("handleMenuItemClick", w, n), r(n === w ? null : w);
|
|
9499
9544
|
},
|
|
9500
9545
|
[n, r]
|
|
9501
9546
|
), { t: x } = useTranslation(), y = useMemo(
|
|
@@ -9504,25 +9549,25 @@ const RootLayout = () => {
|
|
|
9504
9549
|
), b = useBuilderProp("htmlDir", "ltr"), C = find(y, { id: n }) ?? first(y), B = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
9505
9550
|
useEffect(() => {
|
|
9506
9551
|
if (n !== null) {
|
|
9507
|
-
const
|
|
9508
|
-
|
|
9552
|
+
const w = find(y, { id: n });
|
|
9553
|
+
w && get(w, "view", "standard") === "standard" && (a.current = n, i(get(w, "width", DEFAULT_PANEL_WIDTH)));
|
|
9509
9554
|
}
|
|
9510
9555
|
}, [n, y]);
|
|
9511
9556
|
const j = useMemo(() => {
|
|
9512
9557
|
if (n === null) return 0;
|
|
9513
|
-
const
|
|
9514
|
-
return get(
|
|
9558
|
+
const w = find(y, { id: n });
|
|
9559
|
+
return get(w, "view", "standard") === "standard" ? B : l;
|
|
9515
9560
|
}, [n, B, l, y]), _ = useCallback(() => {
|
|
9516
9561
|
r(a.current);
|
|
9517
|
-
}, [r, n]),
|
|
9562
|
+
}, [r, n]), A = useCallback(() => {
|
|
9518
9563
|
r("outline");
|
|
9519
9564
|
}, [r]);
|
|
9520
9565
|
useEffect(() => {
|
|
9521
9566
|
n !== null && !find(y, { id: n }) && r("outline");
|
|
9522
9567
|
}, [n, y]);
|
|
9523
9568
|
const k = useCallback(
|
|
9524
|
-
(
|
|
9525
|
-
f(
|
|
9569
|
+
(w) => {
|
|
9570
|
+
f(w);
|
|
9526
9571
|
},
|
|
9527
9572
|
[f]
|
|
9528
9573
|
);
|
|
@@ -9536,24 +9581,24 @@ const RootLayout = () => {
|
|
|
9536
9581
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9537
9582
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9538
9583
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9539
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9540
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9584
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9585
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
9541
9586
|
position: "top",
|
|
9542
|
-
panelId:
|
|
9543
|
-
isActive: n ===
|
|
9544
|
-
show: () => k(
|
|
9587
|
+
panelId: w.id,
|
|
9588
|
+
isActive: n === w.id,
|
|
9589
|
+
show: () => k(w.id)
|
|
9545
9590
|
}) }),
|
|
9546
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9591
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
9547
9592
|
] }, "button-top-" + E)) }),
|
|
9548
9593
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9549
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((
|
|
9550
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9594
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9595
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
9551
9596
|
position: "bottom",
|
|
9552
|
-
panelId:
|
|
9553
|
-
isActive: n ===
|
|
9554
|
-
show: () => k(
|
|
9597
|
+
panelId: w.id,
|
|
9598
|
+
isActive: n === w.id,
|
|
9599
|
+
show: () => k(w.id)
|
|
9555
9600
|
}) }),
|
|
9556
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9601
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
9557
9602
|
] }, "button-bottom-" + E)) })
|
|
9558
9603
|
] }),
|
|
9559
9604
|
/* @__PURE__ */ jsx(
|
|
@@ -9630,7 +9675,7 @@ const RootLayout = () => {
|
|
|
9630
9675
|
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9631
9676
|
] }) }),
|
|
9632
9677
|
/* @__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), {
|
|
9633
|
-
close:
|
|
9678
|
+
close: A
|
|
9634
9679
|
}) }) })
|
|
9635
9680
|
]
|
|
9636
9681
|
}
|
|
@@ -9642,7 +9687,7 @@ const RootLayout = () => {
|
|
|
9642
9687
|
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9643
9688
|
] }) }),
|
|
9644
9689
|
/* @__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), {
|
|
9645
|
-
close:
|
|
9690
|
+
close: A
|
|
9646
9691
|
}) }) })
|
|
9647
9692
|
] }) }),
|
|
9648
9693
|
n !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
@@ -9670,7 +9715,7 @@ const RootLayout = () => {
|
|
|
9670
9715
|
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
9671
9716
|
] }),
|
|
9672
9717
|
/* @__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), {
|
|
9673
|
-
close:
|
|
9718
|
+
close: A
|
|
9674
9719
|
}) }) })
|
|
9675
9720
|
]
|
|
9676
9721
|
}
|
|
@@ -9723,8 +9768,8 @@ const RootLayout = () => {
|
|
|
9723
9768
|
});
|
|
9724
9769
|
}, h = (x) => {
|
|
9725
9770
|
if (!c) return;
|
|
9726
|
-
const y = x.clientX - p.x, b = x.clientY - p.y, C = x.currentTarget, B = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - B,
|
|
9727
|
-
r(k,
|
|
9771
|
+
const y = x.clientX - p.x, b = x.clientY - p.y, C = x.currentTarget, B = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - B, A = window.innerHeight - j, k = Math.max(0, Math.min(y, _)), w = Math.max(0, Math.min(b, A));
|
|
9772
|
+
r(k, w);
|
|
9728
9773
|
}, f = () => {
|
|
9729
9774
|
d(!1);
|
|
9730
9775
|
};
|
|
@@ -9966,10 +10011,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9966
10011
|
var r;
|
|
9967
10012
|
const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14], f = a[16], x = a[17], y = u(o, n);
|
|
9968
10013
|
if (isAtomStateInitialized(y) && (l.has(n) && i.get(n) !== y.n || Array.from(y.d).every(
|
|
9969
|
-
([
|
|
10014
|
+
([w, E]) => (
|
|
9970
10015
|
// Recursively, read the atom state of the dependency, and
|
|
9971
10016
|
// check if the atom epoch number is unchanged
|
|
9972
|
-
h(o,
|
|
10017
|
+
h(o, w).n === E
|
|
9973
10018
|
)
|
|
9974
10019
|
)))
|
|
9975
10020
|
return y;
|
|
@@ -9978,34 +10023,34 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9978
10023
|
function C() {
|
|
9979
10024
|
l.has(n) && (x(o, n), m(o), g(o));
|
|
9980
10025
|
}
|
|
9981
|
-
function B(
|
|
10026
|
+
function B(w) {
|
|
9982
10027
|
var E;
|
|
9983
|
-
if (isSelfAtom(n,
|
|
9984
|
-
const v = u(o,
|
|
10028
|
+
if (isSelfAtom(n, w)) {
|
|
10029
|
+
const v = u(o, w);
|
|
9985
10030
|
if (!isAtomStateInitialized(v))
|
|
9986
|
-
if (hasInitialValue(
|
|
9987
|
-
setAtomStateValueOrPromise(o,
|
|
10031
|
+
if (hasInitialValue(w))
|
|
10032
|
+
setAtomStateValueOrPromise(o, w, w.init);
|
|
9988
10033
|
else
|
|
9989
10034
|
throw new Error("no atom init");
|
|
9990
10035
|
return returnAtomValue(v);
|
|
9991
10036
|
}
|
|
9992
|
-
const S = h(o,
|
|
10037
|
+
const S = h(o, w);
|
|
9993
10038
|
try {
|
|
9994
10039
|
return returnAtomValue(S);
|
|
9995
10040
|
} finally {
|
|
9996
|
-
y.d.set(
|
|
10041
|
+
y.d.set(w, S.n), isPendingPromise(y.v) && addPendingPromiseToDependency(n, y.v, S), (E = l.get(w)) == null || E.t.add(n), b || C();
|
|
9997
10042
|
}
|
|
9998
10043
|
}
|
|
9999
10044
|
let j, _;
|
|
10000
|
-
const
|
|
10045
|
+
const A = {
|
|
10001
10046
|
get signal() {
|
|
10002
10047
|
return j || (j = new AbortController()), j.signal;
|
|
10003
10048
|
},
|
|
10004
10049
|
get setSelf() {
|
|
10005
|
-
return !_ && isActuallyWritableAtom(n) && (_ = (...
|
|
10050
|
+
return !_ && isActuallyWritableAtom(n) && (_ = (...w) => {
|
|
10006
10051
|
if (!b)
|
|
10007
10052
|
try {
|
|
10008
|
-
return f(o, n, ...
|
|
10053
|
+
return f(o, n, ...w);
|
|
10009
10054
|
} finally {
|
|
10010
10055
|
m(o), g(o);
|
|
10011
10056
|
}
|
|
@@ -10013,10 +10058,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10013
10058
|
}
|
|
10014
10059
|
}, k = y.n;
|
|
10015
10060
|
try {
|
|
10016
|
-
const
|
|
10017
|
-
return setAtomStateValueOrPromise(o, n,
|
|
10018
|
-
} catch (
|
|
10019
|
-
return delete y.v, y.e =
|
|
10061
|
+
const w = p(o, n, B, A);
|
|
10062
|
+
return setAtomStateValueOrPromise(o, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () => j == null ? void 0 : j.abort()), w.then(C, C)), y;
|
|
10063
|
+
} catch (w) {
|
|
10064
|
+
return delete y.v, y.e = w, ++y.n, y;
|
|
10020
10065
|
} finally {
|
|
10021
10066
|
b = !1, k !== y.n && i.get(n) === k && (i.set(n, y.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
10022
10067
|
}
|
|
@@ -10039,8 +10084,8 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10039
10084
|
if (isSelfAtom(n, b)) {
|
|
10040
10085
|
if (!hasInitialValue(b))
|
|
10041
10086
|
throw new Error("atom not writable");
|
|
10042
|
-
const _ = j.n,
|
|
10043
|
-
setAtomStateValueOrPromise(o, b,
|
|
10087
|
+
const _ = j.n, A = C[0];
|
|
10088
|
+
setAtomStateValueOrPromise(o, b, A), h(o, b), _ !== j.n && (l.add(b), (B = i.c) == null || B.call(i, b), m(o, b));
|
|
10044
10089
|
return;
|
|
10045
10090
|
} else
|
|
10046
10091
|
return writeAtomState(o, b, ...C);
|
|
@@ -10379,7 +10424,7 @@ export {
|
|
|
10379
10424
|
getBlocksFromHTML as convertHTMLToChaiBlocks,
|
|
10380
10425
|
generateUUID as generateBlockId,
|
|
10381
10426
|
getBlocksFromHTML,
|
|
10382
|
-
|
|
10427
|
+
Ve as i18n,
|
|
10383
10428
|
cn$2 as mergeClasses,
|
|
10384
10429
|
registerBlockSettingField,
|
|
10385
10430
|
registerBlockSettingTemplate,
|
|
@@ -10412,7 +10457,6 @@ export {
|
|
|
10412
10457
|
useCutBlockIds,
|
|
10413
10458
|
useDarkMode,
|
|
10414
10459
|
useDuplicateBlocks,
|
|
10415
|
-
useHiddenBlockIds,
|
|
10416
10460
|
useHighlightBlockId,
|
|
10417
10461
|
useInlineEditing,
|
|
10418
10462
|
useIsPageLoaded,
|