@chaibuilder/sdk 2.4.5 → 2.5.0
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/core.cjs +3 -3
- package/dist/core.js +736 -712
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -7
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -11,7 +11,7 @@ import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultS
|
|
|
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
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, 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, a9 as DialogTitle, 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, aY as Switch, 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, r as Avatar, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-CyXEVUOu.js";
|
|
14
|
-
import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
|
|
14
|
+
import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
|
|
15
15
|
import clsx$1, { clsx } from "clsx";
|
|
16
16
|
import { twMerge } from "tailwind-merge";
|
|
17
17
|
import TreeModel from "tree-model";
|
|
@@ -37,7 +37,7 @@ import { useFeature } from "flagged";
|
|
|
37
37
|
import { parse, stringify } from "himalaya";
|
|
38
38
|
import { Tree } from "react-arborist";
|
|
39
39
|
import i18n from "i18next";
|
|
40
|
-
import { default as
|
|
40
|
+
import { default as ze } from "i18next";
|
|
41
41
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
42
42
|
import tailwindForms from "@tailwindcss/forms";
|
|
43
43
|
import tailwindTypography from "@tailwindcss/typography";
|
|
@@ -348,8 +348,8 @@ function insertBlocksAtPosition(o, r, n, a) {
|
|
|
348
348
|
}), l.unshift(m), i = i.map((f) => {
|
|
349
349
|
if (f._id === n) {
|
|
350
350
|
const x = { ...f, content: "" };
|
|
351
|
-
return Object.keys(x).forEach((
|
|
352
|
-
|
|
351
|
+
return Object.keys(x).forEach((y) => {
|
|
352
|
+
y.startsWith("content-") && (x[y] = "");
|
|
353
353
|
}), x;
|
|
354
354
|
}
|
|
355
355
|
return f;
|
|
@@ -484,8 +484,8 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
|
|
|
484
484
|
m && "content" in m && (n = n.map((f) => {
|
|
485
485
|
if (f._id === u) {
|
|
486
486
|
const x = { ...f, content: h.content };
|
|
487
|
-
return Object.keys(h).forEach((
|
|
488
|
-
|
|
487
|
+
return Object.keys(h).forEach((y) => {
|
|
488
|
+
y.startsWith("content-") && (x[y] = h[y]);
|
|
489
489
|
}), x;
|
|
490
490
|
}
|
|
491
491
|
return f;
|
|
@@ -839,50 +839,50 @@ const undoRedoStateAtom = atom({
|
|
|
839
839
|
updateBlocksProps: c
|
|
840
840
|
} = useBlocksStoreManager();
|
|
841
841
|
return {
|
|
842
|
-
moveBlocks: (x,
|
|
843
|
-
const A = map(x, (
|
|
844
|
-
const w = r.find((E) => E._id ===
|
|
845
|
-
return { _id:
|
|
846
|
-
}),
|
|
847
|
-
|
|
848
|
-
undo: () => each(A, ({ _id:
|
|
849
|
-
i([
|
|
842
|
+
moveBlocks: (x, y, b) => {
|
|
843
|
+
const A = map(x, (B) => {
|
|
844
|
+
const w = r.find((E) => E._id === B)._parent || null, S = r.filter((E) => w ? E._parent === w : !E._parent).map((E) => E._id).indexOf(B);
|
|
845
|
+
return { _id: B, oldParent: w, oldPosition: S };
|
|
846
|
+
}), _ = A.find(({ _id: B }) => B === x[0]);
|
|
847
|
+
_ && _.oldParent === y && _.oldPosition === b || (i(x, y, b), o({
|
|
848
|
+
undo: () => each(A, ({ _id: B, oldParent: N, oldPosition: w }) => {
|
|
849
|
+
i([B], N, w);
|
|
850
850
|
}),
|
|
851
|
-
redo: () => i(x,
|
|
851
|
+
redo: () => i(x, y, b)
|
|
852
852
|
}));
|
|
853
853
|
},
|
|
854
|
-
addBlocks: (x,
|
|
855
|
-
a(x,
|
|
854
|
+
addBlocks: (x, y, b) => {
|
|
855
|
+
a(x, y, b), o({
|
|
856
856
|
undo: () => l(map(x, "_id")),
|
|
857
|
-
redo: () => a(x,
|
|
857
|
+
redo: () => a(x, y, b)
|
|
858
858
|
});
|
|
859
859
|
},
|
|
860
860
|
removeBlocks: (x) => {
|
|
861
|
-
var
|
|
862
|
-
const
|
|
861
|
+
var _;
|
|
862
|
+
const y = (_ = first(x)) == null ? void 0 : _._parent, A = r.filter((B) => y ? B._parent === y : !B._parent).indexOf(first(x));
|
|
863
863
|
l(map(x, "_id")), o({
|
|
864
|
-
undo: () => a(x,
|
|
864
|
+
undo: () => a(x, y, A),
|
|
865
865
|
redo: () => l(map(x, "_id"))
|
|
866
866
|
});
|
|
867
867
|
},
|
|
868
|
-
updateBlocks: (x,
|
|
868
|
+
updateBlocks: (x, y, b) => {
|
|
869
869
|
let A = [];
|
|
870
870
|
if (b)
|
|
871
|
-
A = map(x, (
|
|
871
|
+
A = map(x, (_) => ({ _id: _, ...b }));
|
|
872
872
|
else {
|
|
873
|
-
const
|
|
874
|
-
A = map(x, (
|
|
875
|
-
const N = r.find((
|
|
876
|
-
return each(
|
|
873
|
+
const _ = keys(y);
|
|
874
|
+
A = map(x, (B) => {
|
|
875
|
+
const N = r.find((k) => k._id === B), w = { _id: B };
|
|
876
|
+
return each(_, (k) => w[k] = N[k]), w;
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
c(map(x, (
|
|
879
|
+
c(map(x, (_) => ({ _id: _, ...y }))), o({
|
|
880
880
|
undo: () => c(A),
|
|
881
|
-
redo: () => c(map(x, (
|
|
881
|
+
redo: () => c(map(x, (_) => ({ _id: _, ...y })))
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
|
-
updateBlocksRuntime: (x,
|
|
885
|
-
c(map(x, (b) => ({ _id: b, ...
|
|
884
|
+
updateBlocksRuntime: (x, y) => {
|
|
885
|
+
c(map(x, (b) => ({ _id: b, ...y })));
|
|
886
886
|
},
|
|
887
887
|
setNewBlocks: (x) => {
|
|
888
888
|
n(x), o({
|
|
@@ -891,12 +891,12 @@ const undoRedoStateAtom = atom({
|
|
|
891
891
|
});
|
|
892
892
|
},
|
|
893
893
|
updateMultipleBlocksProps: (x) => {
|
|
894
|
-
let
|
|
895
|
-
|
|
896
|
-
const A = keys(b),
|
|
897
|
-
return each(A, (N) =>
|
|
894
|
+
let y = [];
|
|
895
|
+
y = map(x, (b) => {
|
|
896
|
+
const A = keys(b), _ = r.find((N) => N._id === b._id), B = {};
|
|
897
|
+
return each(A, (N) => B[N] = _[N]), B;
|
|
898
898
|
}), c(x), o({
|
|
899
|
-
undo: () => c(
|
|
899
|
+
undo: () => c(y),
|
|
900
900
|
redo: () => c(x)
|
|
901
901
|
});
|
|
902
902
|
}
|
|
@@ -908,9 +908,9 @@ const undoRedoStateAtom = atom({
|
|
|
908
908
|
for (let f = 0; f < i.length; f++) {
|
|
909
909
|
const { _id: x } = i[f];
|
|
910
910
|
i[f]._id = generateUUID();
|
|
911
|
-
const
|
|
912
|
-
for (let b = 0; b <
|
|
913
|
-
|
|
911
|
+
const y = filter(i, { _parent: x });
|
|
912
|
+
for (let b = 0; b < y.length; b++)
|
|
913
|
+
y[b]._parent = i[f]._id;
|
|
914
914
|
}
|
|
915
915
|
const p = first(i);
|
|
916
916
|
let u, g;
|
|
@@ -921,8 +921,8 @@ const undoRedoStateAtom = atom({
|
|
|
921
921
|
return { addCoreBlock: useCallback(
|
|
922
922
|
(i, c, d) => {
|
|
923
923
|
if (has(i, "blocks")) {
|
|
924
|
-
const
|
|
925
|
-
return a(
|
|
924
|
+
const y = i.blocks;
|
|
925
|
+
return a(y, c, d);
|
|
926
926
|
}
|
|
927
927
|
const p = generateUUID(), u = getDefaultBlockProps(i.type), g = {
|
|
928
928
|
_type: i.type,
|
|
@@ -2361,42 +2361,42 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2361
2361
|
})
|
|
2362
2362
|
), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
|
|
2363
2363
|
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, f) => {
|
|
2364
|
-
const x = cloneDeep(f.find((
|
|
2365
|
-
for (const
|
|
2366
|
-
const b = x[
|
|
2364
|
+
const x = cloneDeep(f.find((y) => y._id === m));
|
|
2365
|
+
for (const y in x) {
|
|
2366
|
+
const b = x[y];
|
|
2367
2367
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2368
|
-
const { baseClasses: A, classes:
|
|
2369
|
-
x[
|
|
2368
|
+
const { baseClasses: A, classes: _ } = getSplitChaiClasses(b);
|
|
2369
|
+
x[y] = compact(flattenDeep([A, _])).join(" ");
|
|
2370
2370
|
} else
|
|
2371
|
-
|
|
2371
|
+
y !== "_id" && delete x[y];
|
|
2372
2372
|
}
|
|
2373
2373
|
return x;
|
|
2374
2374
|
};
|
|
2375
2375
|
return {
|
|
2376
2376
|
askAi: useCallback(
|
|
2377
|
-
async (m, f, x,
|
|
2377
|
+
async (m, f, x, y) => {
|
|
2378
2378
|
if (l) {
|
|
2379
2379
|
r(!0), a(null);
|
|
2380
2380
|
try {
|
|
2381
|
-
const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)],
|
|
2381
|
+
const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], _ = await l(m, addLangToPrompt(x, g, m), A, b), { blocks: B, error: N } = _;
|
|
2382
2382
|
if (N) {
|
|
2383
2383
|
a(N);
|
|
2384
2384
|
return;
|
|
2385
2385
|
}
|
|
2386
2386
|
if (m === "styles") {
|
|
2387
|
-
const w =
|
|
2388
|
-
for (const
|
|
2389
|
-
|
|
2390
|
-
return
|
|
2387
|
+
const w = B.map((k) => {
|
|
2388
|
+
for (const S in k)
|
|
2389
|
+
S !== "_id" && (k[S] = `${STYLES_KEY},${k[S]}`);
|
|
2390
|
+
return k;
|
|
2391
2391
|
});
|
|
2392
2392
|
c(w);
|
|
2393
2393
|
} else
|
|
2394
|
-
i(
|
|
2395
|
-
|
|
2394
|
+
i(B);
|
|
2395
|
+
y && y(_);
|
|
2396
2396
|
} catch (b) {
|
|
2397
2397
|
a(b);
|
|
2398
2398
|
} finally {
|
|
2399
|
-
r(!1),
|
|
2399
|
+
r(!1), y && y();
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
2402
|
},
|
|
@@ -2493,7 +2493,7 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2493
2493
|
for (const f of h)
|
|
2494
2494
|
if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
|
|
2495
2495
|
let x = l(f.partialBlockId);
|
|
2496
|
-
f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((
|
|
2496
|
+
f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((y) => (isEmpty(y._parent) && set(y, "_parent", f._parent), y))), m = [...m, ...x];
|
|
2497
2497
|
} else
|
|
2498
2498
|
m.push(f);
|
|
2499
2499
|
return m;
|
|
@@ -2842,8 +2842,8 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
|
|
|
2842
2842
|
return useHotkeys(
|
|
2843
2843
|
"shift+up, shift+down, shift+left, shift+right",
|
|
2844
2844
|
({ key: x }) => {
|
|
2845
|
-
var
|
|
2846
|
-
f((
|
|
2845
|
+
var y;
|
|
2846
|
+
f((y = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
|
|
2847
2847
|
},
|
|
2848
2848
|
{ document: a == null ? void 0 : a.contentDocument },
|
|
2849
2849
|
[f]
|
|
@@ -3004,9 +3004,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3004
3004
|
}),
|
|
3005
3005
|
size({
|
|
3006
3006
|
boundary: u == null ? void 0 : u.body,
|
|
3007
|
-
apply({ availableWidth:
|
|
3007
|
+
apply({ availableWidth: y, availableHeight: b, elements: A }) {
|
|
3008
3008
|
Object.assign(A.floating.style, {
|
|
3009
|
-
maxWidth: `${Math.max(200,
|
|
3009
|
+
maxWidth: `${Math.max(200, y)}px`,
|
|
3010
3010
|
maxHeight: `${Math.max(100, b)}px`
|
|
3011
3011
|
});
|
|
3012
3012
|
}
|
|
@@ -3018,8 +3018,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3018
3018
|
const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
3019
3019
|
return useEffect(() => {
|
|
3020
3020
|
if (r) {
|
|
3021
|
-
const
|
|
3022
|
-
return () => clearTimeout(
|
|
3021
|
+
const y = setTimeout(() => m(), 500);
|
|
3022
|
+
return () => clearTimeout(y);
|
|
3023
3023
|
} else
|
|
3024
3024
|
m();
|
|
3025
3025
|
}, [r]), !r || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
@@ -3029,13 +3029,13 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3029
3029
|
tabIndex: 0,
|
|
3030
3030
|
ref: h.setFloating,
|
|
3031
3031
|
style: g,
|
|
3032
|
-
onClick: (
|
|
3033
|
-
|
|
3032
|
+
onClick: (y) => {
|
|
3033
|
+
y.stopPropagation(), y.preventDefault();
|
|
3034
3034
|
},
|
|
3035
|
-
onMouseEnter: (
|
|
3036
|
-
|
|
3035
|
+
onMouseEnter: (y) => {
|
|
3036
|
+
y.stopPropagation(), i(null);
|
|
3037
3037
|
},
|
|
3038
|
-
onKeyDown: (
|
|
3038
|
+
onKeyDown: (y) => y.stopPropagation(),
|
|
3039
3039
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3040
3040
|
children: [
|
|
3041
3041
|
f && /* @__PURE__ */ jsx(
|
|
@@ -3499,8 +3499,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3499
3499
|
],
|
|
3500
3500
|
onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
|
|
3501
3501
|
onBlur: ({ editor: u, event: g }) => {
|
|
3502
|
-
const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h),
|
|
3503
|
-
if (!x && !
|
|
3502
|
+
const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h), y = f == null ? void 0 : f.contains(h);
|
|
3503
|
+
if (!x && !y) {
|
|
3504
3504
|
const b = (u == null ? void 0 : u.getHTML()) || "";
|
|
3505
3505
|
n(b);
|
|
3506
3506
|
}
|
|
@@ -3596,47 +3596,47 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3596
3596
|
}
|
|
3597
3597
|
), WithBlockTextEditor = memo(
|
|
3598
3598
|
({ block: o, children: r }) => {
|
|
3599
|
-
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(),
|
|
3599
|
+
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: A, blockType: _ } = useMemo(() => {
|
|
3600
3600
|
var j;
|
|
3601
|
-
const
|
|
3601
|
+
const S = o._type;
|
|
3602
3602
|
let E = o[n];
|
|
3603
3603
|
const v = getRegisteredChaiBlock(o._type);
|
|
3604
|
-
return f && ((j = v == null ? void 0 : v.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (E = get(o, `${n}-${f}`)), { blockContent: E, blockType:
|
|
3605
|
-
}, [o, f]),
|
|
3606
|
-
(
|
|
3604
|
+
return f && ((j = v == null ? void 0 : v.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (E = get(o, `${n}-${f}`)), { blockContent: E, blockType: S };
|
|
3605
|
+
}, [o, f]), B = useCallback(
|
|
3606
|
+
(S) => {
|
|
3607
3607
|
var v;
|
|
3608
|
-
const E =
|
|
3609
|
-
m([b], { [n]: E }), u(null), c(null), d(-1), x([]);
|
|
3608
|
+
const E = S || ((v = g.current) == null ? void 0 : v.innerText);
|
|
3609
|
+
m([b], { [n]: E }), u(null), c(null), d(-1), x(b ? [b] : []);
|
|
3610
3610
|
},
|
|
3611
3611
|
[b, m, c, x, f]
|
|
3612
3612
|
), N = useDebouncedCallback(
|
|
3613
|
-
(
|
|
3614
|
-
m([b], { [n]:
|
|
3613
|
+
(S) => {
|
|
3614
|
+
m([b], { [n]: S });
|
|
3615
3615
|
},
|
|
3616
3616
|
[b, o, m, f],
|
|
3617
3617
|
1e3
|
|
3618
3618
|
), w = useCallback(
|
|
3619
|
-
(
|
|
3620
|
-
|
|
3621
|
-
const E =
|
|
3622
|
-
|
|
3619
|
+
(S) => {
|
|
3620
|
+
S.preventDefault(), b && (y.current = b), B(), setTimeout(() => {
|
|
3621
|
+
const E = y.current;
|
|
3622
|
+
y.current = null, x([E]);
|
|
3623
3623
|
}, 100);
|
|
3624
3624
|
},
|
|
3625
3625
|
[x, b, f]
|
|
3626
3626
|
);
|
|
3627
3627
|
useEffect(() => {
|
|
3628
|
-
var
|
|
3628
|
+
var C;
|
|
3629
3629
|
if (!b) return;
|
|
3630
|
-
const
|
|
3631
|
-
v && ((
|
|
3632
|
-
}, [b,
|
|
3633
|
-
const
|
|
3630
|
+
const S = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", v = a.querySelector(`${S}${E}`);
|
|
3631
|
+
v && ((C = v == null ? void 0 : v.classList) == null || C.add("sr-only"), u(v));
|
|
3632
|
+
}, [b, _, a, i]);
|
|
3633
|
+
const k = useMemo(() => p ? (h(), _ === "RichText" ? /* @__PURE__ */ jsx(
|
|
3634
3634
|
RichTextEditor,
|
|
3635
3635
|
{
|
|
3636
3636
|
blockContent: A,
|
|
3637
3637
|
editingElement: p,
|
|
3638
3638
|
onChange: N,
|
|
3639
|
-
onClose:
|
|
3639
|
+
onClose: B,
|
|
3640
3640
|
onEscape: w
|
|
3641
3641
|
}
|
|
3642
3642
|
) : /* @__PURE__ */ jsx(
|
|
@@ -3645,13 +3645,13 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3645
3645
|
editorRef: g,
|
|
3646
3646
|
blockContent: A,
|
|
3647
3647
|
editingElement: p,
|
|
3648
|
-
onClose:
|
|
3648
|
+
onClose: B,
|
|
3649
3649
|
onChange: N,
|
|
3650
3650
|
onEscape: w
|
|
3651
3651
|
}
|
|
3652
|
-
)) : null, [p, b,
|
|
3652
|
+
)) : null, [p, b, _, A, B, f]);
|
|
3653
3653
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3654
|
-
|
|
3654
|
+
k,
|
|
3655
3655
|
r
|
|
3656
3656
|
] });
|
|
3657
3657
|
},
|
|
@@ -3684,23 +3684,23 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3684
3684
|
blockAtom: r,
|
|
3685
3685
|
children: n
|
|
3686
3686
|
}) => {
|
|
3687
|
-
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key:
|
|
3687
|
+
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: y } = useContext(RepeaterContext), b = useMemo(
|
|
3688
3688
|
() => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
|
|
3689
3689
|
index: x,
|
|
3690
|
-
key:
|
|
3690
|
+
key: y
|
|
3691
3691
|
}) : applyLanguage(i, d, c),
|
|
3692
|
-
[i, d, c, g, m, x,
|
|
3693
|
-
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]),
|
|
3692
|
+
[i, d, c, g, m, x, y]
|
|
3693
|
+
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), _ = useMemo(
|
|
3694
3694
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3695
3695
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3696
|
-
),
|
|
3696
|
+
), B = useMemo(
|
|
3697
3697
|
() => ({
|
|
3698
3698
|
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
|
|
3699
3699
|
inBuilder: !0,
|
|
3700
3700
|
lang: d || p,
|
|
3701
3701
|
...b,
|
|
3702
3702
|
...A,
|
|
3703
|
-
...
|
|
3703
|
+
..._,
|
|
3704
3704
|
...o
|
|
3705
3705
|
}),
|
|
3706
3706
|
[
|
|
@@ -3710,13 +3710,13 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3710
3710
|
p,
|
|
3711
3711
|
b,
|
|
3712
3712
|
A,
|
|
3713
|
-
|
|
3713
|
+
_,
|
|
3714
3714
|
o
|
|
3715
3715
|
]
|
|
3716
3716
|
), N = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3717
3717
|
if (isNull(f) || h.includes(i._id)) return null;
|
|
3718
3718
|
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
3719
|
-
...
|
|
3719
|
+
...B,
|
|
3720
3720
|
children: n({
|
|
3721
3721
|
_id: i._id,
|
|
3722
3722
|
_type: i._type,
|
|
@@ -3728,8 +3728,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3728
3728
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3729
3729
|
})
|
|
3730
3730
|
}) });
|
|
3731
|
-
const
|
|
3732
|
-
return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children:
|
|
3731
|
+
const k = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
|
|
3732
|
+
return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: k }) : k;
|
|
3733
3733
|
}, PartialWrapper = ({ children: o, partialBlockId: r }) => {
|
|
3734
3734
|
const n = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
3735
3735
|
(d) => {
|
|
@@ -3769,7 +3769,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3769
3769
|
);
|
|
3770
3770
|
return map(l, (c) => {
|
|
3771
3771
|
const d = a(c._id);
|
|
3772
|
-
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x,
|
|
3772
|
+
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) : null }) }, c._id) : null;
|
|
3773
3773
|
});
|
|
3774
3774
|
}, PageBlocksRenderer = () => {
|
|
3775
3775
|
const [o] = useBlocksStore();
|
|
@@ -4020,42 +4020,56 @@ const CanvasEventsWatcher = () => {
|
|
|
4020
4020
|
] });
|
|
4021
4021
|
};
|
|
4022
4022
|
MediaManagerModal.displayName = "MediaManagerModal";
|
|
4023
|
-
const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
4024
|
-
const { t: l } = useTranslation(), i =
|
|
4025
|
-
const
|
|
4026
|
-
if (
|
|
4027
|
-
r(
|
|
4028
|
-
const
|
|
4029
|
-
if (
|
|
4030
|
-
const
|
|
4031
|
-
...
|
|
4032
|
-
...
|
|
4033
|
-
...
|
|
4034
|
-
...h.id && { assetId: h.id }
|
|
4023
|
+
const PLACEHOLDER_IMAGE_URL = "https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/dam-assets/02817647-2581-4c50-a005-f72de13d3da7/banner-placeholder.png", ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
4024
|
+
const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = n.split(".").pop() || "", u = i ? `_${p}Id-${i}` : `${p}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), h = get(c, u, g ? c == null ? void 0 : c.assetId : ""), m = !!h, f = (y) => {
|
|
4025
|
+
const b = isArray(y) ? first(y) : y;
|
|
4026
|
+
if (b) {
|
|
4027
|
+
r(b == null ? void 0 : b.url);
|
|
4028
|
+
const A = b == null ? void 0 : b.width, _ = b == null ? void 0 : b.height;
|
|
4029
|
+
if (c != null && c._id) {
|
|
4030
|
+
const B = {
|
|
4031
|
+
...A && { width: A },
|
|
4032
|
+
..._ && { height: _ },
|
|
4033
|
+
...b.description && { alt: b.description }
|
|
4035
4034
|
};
|
|
4036
|
-
if (isEmpty(
|
|
4037
|
-
|
|
4035
|
+
if (set(B, u, b.id), isEmpty(B)) return;
|
|
4036
|
+
d([c._id], B);
|
|
4038
4037
|
}
|
|
4039
4038
|
}
|
|
4040
|
-
},
|
|
4041
|
-
r(
|
|
4042
|
-
}, [r,
|
|
4039
|
+
}, x = useCallback(() => {
|
|
4040
|
+
r(PLACEHOLDER_IMAGE_URL), c != null && c._id && d([c._id], { assetId: "" });
|
|
4041
|
+
}, [r, c == null ? void 0 : c._id, d]);
|
|
4043
4042
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
4044
|
-
o ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
4045
|
-
/* @__PURE__ */ jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }),
|
|
4043
|
+
o ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
4046
4044
|
/* @__PURE__ */ jsx(
|
|
4045
|
+
"img",
|
|
4046
|
+
{
|
|
4047
|
+
src: o,
|
|
4048
|
+
className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (h && h !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
|
|
4049
|
+
alt: ""
|
|
4050
|
+
}
|
|
4051
|
+
),
|
|
4052
|
+
m && /* @__PURE__ */ jsx(
|
|
4047
4053
|
"button",
|
|
4048
4054
|
{
|
|
4049
4055
|
type: "button",
|
|
4050
|
-
onClick:
|
|
4051
|
-
className: "absolute -right-2 -top-2 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4056
|
+
onClick: x,
|
|
4057
|
+
className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4052
4058
|
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
4053
4059
|
}
|
|
4054
|
-
)
|
|
4055
|
-
|
|
4060
|
+
),
|
|
4061
|
+
h && h !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, assetId: h, children: /* @__PURE__ */ jsx(
|
|
4062
|
+
"button",
|
|
4063
|
+
{
|
|
4064
|
+
type: "button",
|
|
4065
|
+
className: "absolute inset-0 z-10 flex cursor-pointer items-center justify-center bg-black/10 opacity-0 transition duration-200 group-hover:bg-black/30 group-hover:opacity-100",
|
|
4066
|
+
children: /* @__PURE__ */ jsx(Edit2Icon, { className: "h-4 w-4 text-white" })
|
|
4067
|
+
}
|
|
4068
|
+
) })
|
|
4069
|
+
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, mode: "image", assetId: h, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
4056
4070
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4057
4071
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4058
|
-
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
4072
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 cursor-pointer rounded-md bg-secondary px-2 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: o || !isEmpty(o) ? l("Replace image") : l("Choose image") }) }),
|
|
4059
4073
|
/* @__PURE__ */ jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-secondary-foreground", children: "OR" })
|
|
4060
4074
|
] }),
|
|
4061
4075
|
/* @__PURE__ */ jsx(
|
|
@@ -4069,8 +4083,8 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
|
4069
4083
|
className: "text-xs",
|
|
4070
4084
|
placeholder: l("Enter image URL"),
|
|
4071
4085
|
value: o,
|
|
4072
|
-
onBlur: ({ target: { value:
|
|
4073
|
-
onChange: (
|
|
4086
|
+
onBlur: ({ target: { value: y } }) => a(n, y),
|
|
4087
|
+
onChange: (y) => r(y.target.value)
|
|
4074
4088
|
}
|
|
4075
4089
|
)
|
|
4076
4090
|
] })
|
|
@@ -4186,44 +4200,44 @@ const DataBindingSelector = ({
|
|
|
4186
4200
|
r(`{{${g}}}`, {}, n);
|
|
4187
4201
|
return;
|
|
4188
4202
|
}
|
|
4189
|
-
const m = (b) => /[.,!?;:]/.test(b), f = (b, A,
|
|
4190
|
-
let
|
|
4191
|
-
const w = A > 0 ? b[A - 1] : "",
|
|
4192
|
-
return A > 0 && (w === "." || !m(w) && w !== " ") && (
|
|
4193
|
-
text:
|
|
4194
|
-
prefixLength:
|
|
4203
|
+
const m = (b) => /[.,!?;:]/.test(b), f = (b, A, _) => {
|
|
4204
|
+
let B = "", N = "";
|
|
4205
|
+
const w = A > 0 ? b[A - 1] : "", k = A < b.length ? b[A] : "";
|
|
4206
|
+
return A > 0 && (w === "." || !m(w) && w !== " ") && (B = " "), A < b.length && !m(k) && k !== " " && (N = " "), {
|
|
4207
|
+
text: B + _ + N,
|
|
4208
|
+
prefixLength: B.length,
|
|
4195
4209
|
suffixLength: N.length
|
|
4196
4210
|
};
|
|
4197
4211
|
}, x = document.getElementById(n);
|
|
4198
4212
|
if (!x) return;
|
|
4199
|
-
const
|
|
4200
|
-
if (
|
|
4201
|
-
const b =
|
|
4213
|
+
const y = document.getElementById(`chai-rte-${n}`) || document.getElementById(`chai-rte-modal-${n}`);
|
|
4214
|
+
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4215
|
+
const b = y.__chaiRTE;
|
|
4202
4216
|
if (b) {
|
|
4203
4217
|
const A = `{{${g}}}`;
|
|
4204
4218
|
b.commands.focus();
|
|
4205
|
-
const { from:
|
|
4206
|
-
if (
|
|
4219
|
+
const { from: _, to: B } = b.state.selection;
|
|
4220
|
+
if (_ !== B)
|
|
4207
4221
|
b.chain().deleteSelection().insertContent(A).run();
|
|
4208
4222
|
else {
|
|
4209
|
-
const { state: w } = b,
|
|
4223
|
+
const { state: w } = b, k = w.selection.from, S = w.doc.textBetween(Math.max(0, k - 1), k), E = w.doc.textBetween(k, Math.min(k + 1, w.doc.content.size));
|
|
4210
4224
|
let v = "";
|
|
4211
|
-
|
|
4212
|
-
let
|
|
4213
|
-
E && E !== " " && !m(E) && (
|
|
4225
|
+
k > 0 && S !== " " && !m(S) && (v = " ");
|
|
4226
|
+
let C = "";
|
|
4227
|
+
E && E !== " " && !m(E) && (C = " "), b.chain().insertContent(v + A + C).run();
|
|
4214
4228
|
}
|
|
4215
4229
|
setTimeout(() => r(b.getHTML(), {}, n), 100);
|
|
4216
4230
|
return;
|
|
4217
4231
|
}
|
|
4218
4232
|
} else {
|
|
4219
|
-
const b = x, A = b.selectionStart || 0,
|
|
4220
|
-
if (
|
|
4221
|
-
const E = `{{${g}}}`, { text: v } = f(
|
|
4222
|
-
r(
|
|
4233
|
+
const b = x, A = b.selectionStart || 0, _ = b.value || "", B = b.selectionEnd || A;
|
|
4234
|
+
if (B > A) {
|
|
4235
|
+
const E = `{{${g}}}`, { text: v } = f(_, A, E), C = _.slice(0, A) + v + _.slice(B);
|
|
4236
|
+
r(C, {}, n);
|
|
4223
4237
|
return;
|
|
4224
4238
|
}
|
|
4225
|
-
const w = `{{${g}}}`, { text:
|
|
4226
|
-
r(
|
|
4239
|
+
const w = `{{${g}}}`, { text: k } = f(_, A, w), S = _.slice(0, A) + k + _.slice(A);
|
|
4240
|
+
r(S, {}, n);
|
|
4227
4241
|
}
|
|
4228
4242
|
},
|
|
4229
4243
|
[n, r, a, c == null ? void 0 : c._id, d]
|
|
@@ -4245,57 +4259,57 @@ const DataBindingSelector = ({
|
|
|
4245
4259
|
onChange: n
|
|
4246
4260
|
}) => {
|
|
4247
4261
|
var E;
|
|
4248
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v,
|
|
4262
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), A = useRef(null), _ = (E = r == null ? void 0 : r.find((v) => v.key === u)) == null ? void 0 : E.name;
|
|
4249
4263
|
useEffect(() => {
|
|
4250
4264
|
if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4251
|
-
const v = split(o, ":"),
|
|
4252
|
-
g(
|
|
4253
|
-
const j = await l(
|
|
4265
|
+
const v = split(o, ":"), C = get(v, 1, "page") || "page";
|
|
4266
|
+
g(C), (async () => {
|
|
4267
|
+
const j = await l(C, [get(v, 2, "page")]);
|
|
4254
4268
|
j && Array.isArray(j) && m(get(j, [0, "name"], ""));
|
|
4255
4269
|
})();
|
|
4256
4270
|
}, [o]);
|
|
4257
|
-
const
|
|
4271
|
+
const B = useDebouncedCallback(
|
|
4258
4272
|
async (v) => {
|
|
4259
4273
|
if (isEmpty(v))
|
|
4260
4274
|
x([]);
|
|
4261
4275
|
else {
|
|
4262
|
-
const
|
|
4263
|
-
x(
|
|
4276
|
+
const C = await l(u, v);
|
|
4277
|
+
x(C);
|
|
4264
4278
|
}
|
|
4265
4279
|
c(!1), b(-1);
|
|
4266
4280
|
},
|
|
4267
4281
|
[u],
|
|
4268
4282
|
300
|
|
4269
4283
|
), N = (v) => {
|
|
4270
|
-
const
|
|
4271
|
-
|
|
4284
|
+
const C = ["pageType", u, v.id];
|
|
4285
|
+
C[1] && (n(C.join(":")), m(v.name), p(!1), x([]), b(-1));
|
|
4272
4286
|
}, w = (v) => {
|
|
4273
4287
|
switch (v.key) {
|
|
4274
4288
|
case "ArrowDown":
|
|
4275
|
-
v.preventDefault(), b((
|
|
4289
|
+
v.preventDefault(), b((C) => C < f.length - 1 ? C + 1 : C);
|
|
4276
4290
|
break;
|
|
4277
4291
|
case "ArrowUp":
|
|
4278
|
-
v.preventDefault(), b((
|
|
4292
|
+
v.preventDefault(), b((C) => C > 0 ? C - 1 : C);
|
|
4279
4293
|
break;
|
|
4280
4294
|
case "Enter":
|
|
4281
4295
|
if (v.preventDefault(), f.length === 0) return;
|
|
4282
|
-
|
|
4296
|
+
y >= 0 && N(f[y]);
|
|
4283
4297
|
break;
|
|
4284
4298
|
case "Escape":
|
|
4285
|
-
v.preventDefault(),
|
|
4299
|
+
v.preventDefault(), k();
|
|
4286
4300
|
break;
|
|
4287
4301
|
}
|
|
4288
4302
|
};
|
|
4289
4303
|
useEffect(() => {
|
|
4290
|
-
if (
|
|
4291
|
-
const v = A.current.children[
|
|
4304
|
+
if (y >= 0 && A.current) {
|
|
4305
|
+
const v = A.current.children[y];
|
|
4292
4306
|
v == null || v.scrollIntoView({ block: "nearest" });
|
|
4293
4307
|
}
|
|
4294
|
-
}, [
|
|
4295
|
-
const
|
|
4308
|
+
}, [y]);
|
|
4309
|
+
const k = () => {
|
|
4296
4310
|
m(""), x([]), b(-1), p(!1), n("");
|
|
4297
|
-
},
|
|
4298
|
-
m(v), p(!isEmpty(v)), c(!0),
|
|
4311
|
+
}, S = (v) => {
|
|
4312
|
+
m(v), p(!isEmpty(v)), c(!0), B(v);
|
|
4299
4313
|
};
|
|
4300
4314
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4301
4315
|
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (v) => g(v.target.value), children: map(r, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
|
|
@@ -4305,13 +4319,13 @@ const DataBindingSelector = ({
|
|
|
4305
4319
|
{
|
|
4306
4320
|
type: "text",
|
|
4307
4321
|
value: h,
|
|
4308
|
-
onChange: (v) =>
|
|
4322
|
+
onChange: (v) => S(v.target.value),
|
|
4309
4323
|
onKeyDown: w,
|
|
4310
|
-
placeholder: a(`Search ${
|
|
4324
|
+
placeholder: a(`Search ${_ ?? ""}`),
|
|
4311
4325
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4312
4326
|
}
|
|
4313
4327
|
),
|
|
4314
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick:
|
|
4328
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: k, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
4315
4329
|
] }),
|
|
4316
4330
|
(i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4317
4331
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4321,11 +4335,11 @@ const DataBindingSelector = ({
|
|
|
4321
4335
|
' "',
|
|
4322
4336
|
h,
|
|
4323
4337
|
'"'
|
|
4324
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(f == null ? void 0 : f.slice(0, 20), (v,
|
|
4338
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(f == null ? void 0 : f.slice(0, 20), (v, C) => /* @__PURE__ */ jsxs(
|
|
4325
4339
|
"li",
|
|
4326
4340
|
{
|
|
4327
4341
|
onClick: () => N(v),
|
|
4328
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" :
|
|
4342
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : C === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4329
4343
|
children: [
|
|
4330
4344
|
v.name,
|
|
4331
4345
|
" ",
|
|
@@ -4640,11 +4654,11 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4640
4654
|
if (f !== x)
|
|
4641
4655
|
u.chain().deleteSelection().insertContent(m).run();
|
|
4642
4656
|
else {
|
|
4643
|
-
const { state: b } = u, A = b.selection.from,
|
|
4657
|
+
const { state: b } = u, A = b.selection.from, _ = b.doc.textBetween(Math.max(0, A - 1), A), B = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
|
|
4644
4658
|
let N = "";
|
|
4645
|
-
A > 0 &&
|
|
4659
|
+
A > 0 && _ !== " " && !/[.,!?;:]/.test(_) && (N = " ");
|
|
4646
4660
|
let w = "";
|
|
4647
|
-
|
|
4661
|
+
B && B !== " " && !/[.,!?;:]/.test(B) && (w = " "), u.chain().insertContent(N + m + w).run();
|
|
4648
4662
|
}
|
|
4649
4663
|
};
|
|
4650
4664
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && r(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4738,14 +4752,14 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4738
4752
|
const h = () => {
|
|
4739
4753
|
const x = findIndex(u, { _id: g });
|
|
4740
4754
|
if (x > -1) {
|
|
4741
|
-
const
|
|
4755
|
+
const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
|
|
4742
4756
|
if (!b) return;
|
|
4743
4757
|
r({ ...o, currentSlide: b }), c([b]);
|
|
4744
4758
|
}
|
|
4745
4759
|
}, m = () => {
|
|
4746
4760
|
const x = findIndex(u, { _id: g });
|
|
4747
4761
|
if (x > -1) {
|
|
4748
|
-
const
|
|
4762
|
+
const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
|
|
4749
4763
|
if (!b) return;
|
|
4750
4764
|
r({ ...o, currentSlide: b }), c([b]);
|
|
4751
4765
|
}
|
|
@@ -4753,8 +4767,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4753
4767
|
const x = i(
|
|
4754
4768
|
{ styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
|
|
4755
4769
|
p == null ? void 0 : p._id
|
|
4756
|
-
),
|
|
4757
|
-
|
|
4770
|
+
), y = x == null ? void 0 : x._id;
|
|
4771
|
+
y && (r({ ...o, currentSlide: y }), c([y]));
|
|
4758
4772
|
};
|
|
4759
4773
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
4760
4774
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
|
|
@@ -4833,8 +4847,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4833
4847
|
className: "text-xs",
|
|
4834
4848
|
pattern: "[0-9]*",
|
|
4835
4849
|
onChange: (x) => {
|
|
4836
|
-
let
|
|
4837
|
-
|
|
4850
|
+
let y = x.target.value;
|
|
4851
|
+
y.length && (y = y.replace("-", "")), r({ ...o, autoplayInterval: y });
|
|
4838
4852
|
}
|
|
4839
4853
|
}
|
|
4840
4854
|
)
|
|
@@ -4935,44 +4949,53 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4935
4949
|
children: a,
|
|
4936
4950
|
errors: l,
|
|
4937
4951
|
help: i,
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
onChange: h
|
|
4952
|
+
hidden: c,
|
|
4953
|
+
required: d,
|
|
4954
|
+
schema: p,
|
|
4955
|
+
formData: u,
|
|
4956
|
+
onChange: g
|
|
4944
4957
|
}) => {
|
|
4945
|
-
const { selectedLang:
|
|
4946
|
-
() => isEmpty(
|
|
4947
|
-
[
|
|
4948
|
-
),
|
|
4949
|
-
() => get(_, [
|
|
4950
|
-
[_,
|
|
4951
|
-
), [
|
|
4952
|
-
if (
|
|
4958
|
+
const { selectedLang: h, fallbackLang: m, languages: f } = useLanguages(), x = useMemo(
|
|
4959
|
+
() => isEmpty(f) ? "" : isEmpty(h) ? m : h,
|
|
4960
|
+
[f, h, m]
|
|
4961
|
+
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), A = useSelectedBlock(), _ = useRegisteredChaiBlocks(), B = useMemo(
|
|
4962
|
+
() => get(_, [A == null ? void 0 : A._type, "i18nProps"], []),
|
|
4963
|
+
[_, A == null ? void 0 : A._type]
|
|
4964
|
+
), [N, w] = useState(null);
|
|
4965
|
+
if (c)
|
|
4953
4966
|
return null;
|
|
4954
|
-
if (
|
|
4955
|
-
const
|
|
4956
|
-
if (
|
|
4957
|
-
const
|
|
4967
|
+
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
|
|
4968
|
+
const S = B == null ? void 0 : B.includes(o.replace("root.", ""));
|
|
4969
|
+
if (p.type === "array") {
|
|
4970
|
+
const E = N === o;
|
|
4958
4971
|
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
4959
|
-
|
|
4972
|
+
p.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
|
|
4960
4973
|
"label",
|
|
4961
4974
|
{
|
|
4962
4975
|
htmlFor: o,
|
|
4963
|
-
onClick: () =>
|
|
4976
|
+
onClick: () => w(E ? null : o),
|
|
4964
4977
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4965
4978
|
children: [
|
|
4966
|
-
|
|
4979
|
+
E ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4967
4980
|
/* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
|
|
4968
4981
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: n }),
|
|
4969
4982
|
" ",
|
|
4970
|
-
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children:
|
|
4983
|
+
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: u == null ? void 0 : u.length }) }),
|
|
4984
|
+
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4985
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
4986
|
+
Info,
|
|
4987
|
+
{
|
|
4988
|
+
className: "h-3 w-3 text-muted-foreground/70",
|
|
4989
|
+
onClick: (v) => v.stopPropagation(),
|
|
4990
|
+
onMouseDown: (v) => v.stopPropagation()
|
|
4991
|
+
}
|
|
4992
|
+
) }),
|
|
4993
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
4994
|
+
] }) })
|
|
4971
4995
|
]
|
|
4972
4996
|
}
|
|
4973
|
-
),
|
|
4974
|
-
(
|
|
4975
|
-
c,
|
|
4997
|
+
) }),
|
|
4998
|
+
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${E ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
4976
4999
|
a,
|
|
4977
5000
|
l,
|
|
4978
5001
|
i
|
|
@@ -4980,35 +5003,34 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4980
5003
|
] });
|
|
4981
5004
|
}
|
|
4982
5005
|
return /* @__PURE__ */ jsxs("div", { className: r, children: [
|
|
4983
|
-
|
|
5006
|
+
p.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4984
5007
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4985
|
-
/* @__PURE__ */ jsxs("label", { htmlFor: o, className:
|
|
5008
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
4986
5009
|
n,
|
|
4987
5010
|
" ",
|
|
4988
|
-
|
|
5011
|
+
S && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4989
5012
|
" ",
|
|
4990
|
-
|
|
5013
|
+
y
|
|
4991
5014
|
] }),
|
|
4992
|
-
|
|
5015
|
+
d && p.type !== "object" ? " *" : null
|
|
4993
5016
|
] }),
|
|
4994
|
-
|
|
5017
|
+
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4995
5018
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-muted-foreground/70" }) }),
|
|
4996
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children:
|
|
5019
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
4997
5020
|
] }) })
|
|
4998
5021
|
] }),
|
|
4999
|
-
!
|
|
5022
|
+
!p.enum && !p.oneOf && b && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
5000
5023
|
DataBindingSelector,
|
|
5001
5024
|
{
|
|
5002
|
-
schema:
|
|
5003
|
-
onChange: (
|
|
5004
|
-
|
|
5025
|
+
schema: p,
|
|
5026
|
+
onChange: (E) => {
|
|
5027
|
+
g(E, u, o);
|
|
5005
5028
|
},
|
|
5006
5029
|
id: o,
|
|
5007
|
-
formData:
|
|
5030
|
+
formData: u
|
|
5008
5031
|
}
|
|
5009
5032
|
) })
|
|
5010
5033
|
] }),
|
|
5011
|
-
c,
|
|
5012
5034
|
a,
|
|
5013
5035
|
l,
|
|
5014
5036
|
i
|
|
@@ -5108,36 +5130,36 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5108
5130
|
}), a;
|
|
5109
5131
|
};
|
|
5110
5132
|
function BlockSettings() {
|
|
5111
|
-
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: w },
|
|
5112
|
-
|
|
5133
|
+
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: w }, k, S) => {
|
|
5134
|
+
k && (c == null ? void 0 : c._id) === r._id && a([r._id], { [k]: get(w, k) }, S);
|
|
5113
5135
|
}, x = useCallback(
|
|
5114
|
-
debounce(({ formData: w },
|
|
5115
|
-
f({ formData: w },
|
|
5136
|
+
debounce(({ formData: w }, k, S) => {
|
|
5137
|
+
f({ formData: w }, k, S), d(w);
|
|
5116
5138
|
}, 1500),
|
|
5117
5139
|
[r == null ? void 0 : r._id, o]
|
|
5118
|
-
),
|
|
5119
|
-
|
|
5120
|
-
}, b = ({ formData: w },
|
|
5121
|
-
|
|
5122
|
-
}, { schema: A, uiSchema:
|
|
5140
|
+
), y = ({ formData: w }, k) => {
|
|
5141
|
+
k && (n([r._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5142
|
+
}, b = ({ formData: w }, k) => {
|
|
5143
|
+
k && (n([g._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5144
|
+
}, { schema: A, uiSchema: _ } = useMemo(() => {
|
|
5123
5145
|
const w = r == null ? void 0 : r._type;
|
|
5124
5146
|
if (!w)
|
|
5125
5147
|
return { schema: {}, uiSchema: {} };
|
|
5126
5148
|
try {
|
|
5127
|
-
const { schema:
|
|
5149
|
+
const { schema: k, uiSchema: S } = getBlockFormSchemas(w);
|
|
5128
5150
|
if (w === "Repeater") {
|
|
5129
5151
|
const E = get(r, "repeaterItems", "");
|
|
5130
|
-
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(
|
|
5152
|
+
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(S, "filter", { "ui:widget": "collectionSelect" }), set(S, "sort", { "ui:widget": "collectionSelect" })) : (set(S, "filter", { "ui:widget": "hidden" }), set(S, "sort", { "ui:widget": "hidden" }));
|
|
5131
5153
|
}
|
|
5132
|
-
return { schema:
|
|
5154
|
+
return { schema: k, uiSchema: S };
|
|
5133
5155
|
} catch {
|
|
5134
5156
|
return { schema: {}, uiSchema: {} };
|
|
5135
5157
|
}
|
|
5136
|
-
}, [r]), { wrapperSchema:
|
|
5158
|
+
}, [r]), { wrapperSchema: B, wrapperUiSchema: N } = useMemo(() => {
|
|
5137
5159
|
if (!g || !(g != null && g._type))
|
|
5138
5160
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5139
|
-
const w = g == null ? void 0 : g._type, { schema:
|
|
5140
|
-
return { wrapperSchema:
|
|
5161
|
+
const w = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: S = {} } = getBlockFormSchemas(w);
|
|
5162
|
+
return { wrapperSchema: k, wrapperUiSchema: S };
|
|
5141
5163
|
}, [g]);
|
|
5142
5164
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5143
5165
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -5165,7 +5187,7 @@ function BlockSettings() {
|
|
|
5165
5187
|
blockId: g == null ? void 0 : g._id,
|
|
5166
5188
|
onChange: b,
|
|
5167
5189
|
formData: m,
|
|
5168
|
-
schema:
|
|
5190
|
+
schema: B,
|
|
5169
5191
|
uiSchema: N
|
|
5170
5192
|
}
|
|
5171
5193
|
) })
|
|
@@ -5174,10 +5196,10 @@ function BlockSettings() {
|
|
|
5174
5196
|
JSONForm,
|
|
5175
5197
|
{
|
|
5176
5198
|
blockId: r == null ? void 0 : r._id,
|
|
5177
|
-
onChange:
|
|
5199
|
+
onChange: y,
|
|
5178
5200
|
formData: i,
|
|
5179
5201
|
schema: A,
|
|
5180
|
-
uiSchema:
|
|
5202
|
+
uiSchema: _
|
|
5181
5203
|
}
|
|
5182
5204
|
)
|
|
5183
5205
|
] });
|
|
@@ -5188,7 +5210,7 @@ const BlockStylingProps = () => {
|
|
|
5188
5210
|
if (!o) return null;
|
|
5189
5211
|
const c = Object.keys(o).filter(
|
|
5190
5212
|
(x) => typeof o[x] == "string" && o[x].startsWith("#styles:")
|
|
5191
|
-
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = r[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(r, (
|
|
5213
|
+
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = r[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(r, (y) => y.prop === x);
|
|
5192
5214
|
return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
5193
5215
|
/* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
|
|
5194
5216
|
i("Style element"),
|
|
@@ -5210,7 +5232,7 @@ const BlockStylingProps = () => {
|
|
|
5210
5232
|
{
|
|
5211
5233
|
type: "button",
|
|
5212
5234
|
className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
|
|
5213
|
-
onClick: (
|
|
5235
|
+
onClick: (y) => y.stopPropagation(),
|
|
5214
5236
|
children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
|
|
5215
5237
|
}
|
|
5216
5238
|
) }),
|
|
@@ -5388,37 +5410,37 @@ const BlockStylingProps = () => {
|
|
|
5388
5410
|
},
|
|
5389
5411
|
a
|
|
5390
5412
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5391
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [
|
|
5413
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [A, _] = useState(!1), [B, N] = useState(!1);
|
|
5392
5414
|
useEffect(() => {
|
|
5393
|
-
const { value: v, unit:
|
|
5394
|
-
if (
|
|
5415
|
+
const { value: v, unit: C } = getClassValueAndUnit(i);
|
|
5416
|
+
if (C === "") {
|
|
5395
5417
|
l(v), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5396
5418
|
return;
|
|
5397
5419
|
}
|
|
5398
|
-
m(
|
|
5420
|
+
m(C), l(C === "class" || isEmpty(v) ? "" : v);
|
|
5399
5421
|
}, [i, p, u]);
|
|
5400
|
-
const w = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME),
|
|
5422
|
+
const w = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), k = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), S = useCallback(
|
|
5401
5423
|
(v = !1) => {
|
|
5402
|
-
const
|
|
5403
|
-
if (get(
|
|
5424
|
+
const C = getUserInputValues(`${a}`, u);
|
|
5425
|
+
if (get(C, "error", !1)) {
|
|
5404
5426
|
x(!0);
|
|
5405
5427
|
return;
|
|
5406
5428
|
}
|
|
5407
|
-
const j = get(
|
|
5429
|
+
const j = get(C, "unit") !== "" ? get(C, "unit") : h;
|
|
5408
5430
|
if (j === "auto" || j === "none") {
|
|
5409
5431
|
w(`${d}${j}`);
|
|
5410
5432
|
return;
|
|
5411
5433
|
}
|
|
5412
|
-
if (get(
|
|
5434
|
+
if (get(C, "value") === "")
|
|
5413
5435
|
return;
|
|
5414
|
-
const L = `${get(
|
|
5415
|
-
v ?
|
|
5436
|
+
const L = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5437
|
+
v ? k(L) : w(L);
|
|
5416
5438
|
},
|
|
5417
|
-
[w,
|
|
5439
|
+
[w, k, a, h, d, u]
|
|
5418
5440
|
), E = useCallback(
|
|
5419
5441
|
(v) => {
|
|
5420
|
-
const
|
|
5421
|
-
if (get(
|
|
5442
|
+
const C = getUserInputValues(`${a}`, u);
|
|
5443
|
+
if (get(C, "error", !1)) {
|
|
5422
5444
|
x(!0);
|
|
5423
5445
|
return;
|
|
5424
5446
|
}
|
|
@@ -5426,9 +5448,9 @@ const BlockStylingProps = () => {
|
|
|
5426
5448
|
w(`${d}${v}`);
|
|
5427
5449
|
return;
|
|
5428
5450
|
}
|
|
5429
|
-
if (get(
|
|
5451
|
+
if (get(C, "value") === "")
|
|
5430
5452
|
return;
|
|
5431
|
-
const j = get(
|
|
5453
|
+
const j = get(C, "unit") !== "" ? get(C, "unit") : v, L = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5432
5454
|
w(L);
|
|
5433
5455
|
},
|
|
5434
5456
|
[w, a, d, u]
|
|
@@ -5453,30 +5475,30 @@ const BlockStylingProps = () => {
|
|
|
5453
5475
|
{
|
|
5454
5476
|
readOnly: h === "class",
|
|
5455
5477
|
onKeyPress: (v) => {
|
|
5456
|
-
v.key === "Enter" &&
|
|
5478
|
+
v.key === "Enter" && S();
|
|
5457
5479
|
},
|
|
5458
5480
|
onKeyDown: (v) => {
|
|
5459
5481
|
if (v.keyCode !== 38 && v.keyCode !== 40)
|
|
5460
5482
|
return;
|
|
5461
5483
|
v.preventDefault(), N(!0);
|
|
5462
|
-
const
|
|
5463
|
-
let j = isNaN$1(
|
|
5484
|
+
const C = parseInt$1(v.target.value);
|
|
5485
|
+
let j = isNaN$1(C) ? 0 : C;
|
|
5464
5486
|
v.keyCode === 38 && (j += 1), v.keyCode === 40 && (j -= 1);
|
|
5465
|
-
const
|
|
5466
|
-
|
|
5487
|
+
const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5488
|
+
k(R);
|
|
5467
5489
|
},
|
|
5468
5490
|
onKeyUp: (v) => {
|
|
5469
|
-
|
|
5491
|
+
B && (v.preventDefault(), N(!1));
|
|
5470
5492
|
},
|
|
5471
|
-
onBlur: () =>
|
|
5493
|
+
onBlur: () => S(),
|
|
5472
5494
|
onChange: (v) => {
|
|
5473
5495
|
x(!1), l(v.target.value);
|
|
5474
5496
|
},
|
|
5475
5497
|
onClick: (v) => {
|
|
5476
|
-
var
|
|
5477
|
-
(
|
|
5498
|
+
var C;
|
|
5499
|
+
(C = v == null ? void 0 : v.target) == null || C.select(), n(!1);
|
|
5478
5500
|
},
|
|
5479
|
-
value: A ?
|
|
5501
|
+
value: A ? y : a,
|
|
5480
5502
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5481
5503
|
" ",
|
|
5482
5504
|
f ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -5511,19 +5533,19 @@ const BlockStylingProps = () => {
|
|
|
5511
5533
|
["none", "auto"].indexOf(h) !== -1 || A ? null : /* @__PURE__ */ jsx(
|
|
5512
5534
|
DragStyleButton,
|
|
5513
5535
|
{
|
|
5514
|
-
onDragStart: () =>
|
|
5536
|
+
onDragStart: () => _(!0),
|
|
5515
5537
|
onDragEnd: (v) => {
|
|
5516
|
-
if (b(() => ""),
|
|
5538
|
+
if (b(() => ""), _(!1), isEmpty(v))
|
|
5517
5539
|
return;
|
|
5518
|
-
const
|
|
5519
|
-
w(
|
|
5540
|
+
const C = `${v}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5541
|
+
w(I);
|
|
5520
5542
|
},
|
|
5521
5543
|
onDrag: (v) => {
|
|
5522
5544
|
if (isEmpty(v))
|
|
5523
5545
|
return;
|
|
5524
5546
|
b(v);
|
|
5525
|
-
const
|
|
5526
|
-
|
|
5547
|
+
const C = `${v}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5548
|
+
k(I);
|
|
5527
5549
|
},
|
|
5528
5550
|
currentValue: a,
|
|
5529
5551
|
unit: h,
|
|
@@ -5588,8 +5610,8 @@ const COLOR_PROP = {
|
|
|
5588
5610
|
}, ColorChoice = ({ property: o, onChange: r }) => {
|
|
5589
5611
|
const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
|
|
5590
5612
|
// eslint-disable-next-line no-shadow
|
|
5591
|
-
(
|
|
5592
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
5613
|
+
(y) => {
|
|
5614
|
+
["current", "inherit", "transparent", "black", "white"].includes(y) ? (c([]), p({ color: y })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: y, shade: b.shade ? b.shade : "500" })));
|
|
5593
5615
|
},
|
|
5594
5616
|
[c, p]
|
|
5595
5617
|
);
|
|
@@ -5600,8 +5622,8 @@ const COLOR_PROP = {
|
|
|
5600
5622
|
}, [g]);
|
|
5601
5623
|
const f = useCallback(
|
|
5602
5624
|
// eslint-disable-next-line no-shadow
|
|
5603
|
-
(
|
|
5604
|
-
p({ color: g, shade:
|
|
5625
|
+
(y) => {
|
|
5626
|
+
p({ color: g, shade: y });
|
|
5605
5627
|
},
|
|
5606
5628
|
[g]
|
|
5607
5629
|
);
|
|
@@ -5986,34 +6008,34 @@ const COLOR_PROP = {
|
|
|
5986
6008
|
"2xl": "1536px"
|
|
5987
6009
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5988
6010
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5989
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(),
|
|
5990
|
-
(
|
|
5991
|
-
const E = { dark: p, mq: g, mod: u, cls:
|
|
6011
|
+
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
|
|
6012
|
+
(k, S = !0) => {
|
|
6013
|
+
const E = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
|
|
5992
6014
|
(p || u !== "") && (E.mq = "xs");
|
|
5993
6015
|
const v = generateFullClsName(E);
|
|
5994
|
-
m(x, [v],
|
|
6016
|
+
m(x, [v], S);
|
|
5995
6017
|
},
|
|
5996
6018
|
[x, p, g, u, l, m]
|
|
5997
6019
|
), A = useCallback(() => {
|
|
5998
|
-
f(x, [
|
|
5999
|
-
}, [x,
|
|
6020
|
+
f(x, [y], !0);
|
|
6021
|
+
}, [x, y, f]), _ = useMemo(() => canChangeClass(h, g), [h, g]);
|
|
6000
6022
|
useEffect(() => {
|
|
6001
|
-
i(
|
|
6002
|
-
}, [
|
|
6003
|
-
const [, ,
|
|
6004
|
-
(
|
|
6005
|
-
|
|
6023
|
+
i(_, h);
|
|
6024
|
+
}, [_, i, h]);
|
|
6025
|
+
const [, , B] = useScreenSizeWidth(), N = useCallback(
|
|
6026
|
+
(k) => {
|
|
6027
|
+
B({
|
|
6006
6028
|
xs: 400,
|
|
6007
6029
|
sm: 640,
|
|
6008
6030
|
md: 800,
|
|
6009
6031
|
lg: 1024,
|
|
6010
6032
|
xl: 1420,
|
|
6011
6033
|
"2xl": 1920
|
|
6012
|
-
}[
|
|
6034
|
+
}[k]);
|
|
6013
6035
|
},
|
|
6014
|
-
[
|
|
6036
|
+
[B]
|
|
6015
6037
|
), w = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
|
|
6016
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6038
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: _, canReset: h && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6017
6039
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !w ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
6018
6040
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6019
6041
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6033,7 +6055,7 @@ const COLOR_PROP = {
|
|
|
6033
6055
|
n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6034
6056
|
n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6035
6057
|
] }),
|
|
6036
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6058
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : _ && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6037
6059
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6038
6060
|
"button",
|
|
6039
6061
|
{
|
|
@@ -6257,7 +6279,7 @@ const COLOR_PROP = {
|
|
|
6257
6279
|
u.includes(b) ? u.length > 2 && g(u.filter((A) => A !== b)) : g((A) => [...A, b]);
|
|
6258
6280
|
}, x = (b) => {
|
|
6259
6281
|
r || l(b), c(b);
|
|
6260
|
-
},
|
|
6282
|
+
}, y = getBreakpointValue(r ? i : a).toLowerCase();
|
|
6261
6283
|
return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
|
|
6262
6284
|
BreakpointCard,
|
|
6263
6285
|
{
|
|
@@ -6265,7 +6287,7 @@ const COLOR_PROP = {
|
|
|
6265
6287
|
...b,
|
|
6266
6288
|
onClick: x,
|
|
6267
6289
|
key: b.breakpoint,
|
|
6268
|
-
currentBreakpoint:
|
|
6290
|
+
currentBreakpoint: y
|
|
6269
6291
|
}
|
|
6270
6292
|
)) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
|
|
6271
6293
|
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
|
|
@@ -6279,7 +6301,7 @@ const COLOR_PROP = {
|
|
|
6279
6301
|
...b,
|
|
6280
6302
|
onClick: x,
|
|
6281
6303
|
key: b.breakpoint,
|
|
6282
|
-
currentBreakpoint:
|
|
6304
|
+
currentBreakpoint: y
|
|
6283
6305
|
}
|
|
6284
6306
|
)
|
|
6285
6307
|
) }),
|
|
@@ -6433,15 +6455,15 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6433
6455
|
] });
|
|
6434
6456
|
};
|
|
6435
6457
|
function ManualClasses() {
|
|
6436
|
-
var
|
|
6437
|
-
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""),
|
|
6458
|
+
var I;
|
|
6459
|
+
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), A = b.split(" ").filter((L) => !isEmpty(L)), _ = () => {
|
|
6438
6460
|
const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6439
6461
|
u(h, L, !0), x("");
|
|
6440
|
-
}, [
|
|
6441
|
-
const R = L.trim().toLowerCase(),
|
|
6462
|
+
}, [B, N] = useState([]), w = ({ value: L }) => {
|
|
6463
|
+
const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
|
|
6442
6464
|
let D = [];
|
|
6443
|
-
if (
|
|
6444
|
-
const [O] =
|
|
6465
|
+
if (T && T.length > 0) {
|
|
6466
|
+
const [O] = T, P = R.replace(O, "");
|
|
6445
6467
|
D = i.search(P).map((M) => ({
|
|
6446
6468
|
...M,
|
|
6447
6469
|
item: { ...M.item, name: O + M.item.name }
|
|
@@ -6449,9 +6471,9 @@ function ManualClasses() {
|
|
|
6449
6471
|
} else
|
|
6450
6472
|
D = i.search(R);
|
|
6451
6473
|
return N(map(D, "item"));
|
|
6452
|
-
},
|
|
6474
|
+
}, k = () => {
|
|
6453
6475
|
N([]);
|
|
6454
|
-
},
|
|
6476
|
+
}, S = (L) => L.name, E = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), v = useMemo(
|
|
6455
6477
|
() => ({
|
|
6456
6478
|
ref: o,
|
|
6457
6479
|
autoComplete: "off",
|
|
@@ -6466,13 +6488,13 @@ function ManualClasses() {
|
|
|
6466
6488
|
}, 0);
|
|
6467
6489
|
},
|
|
6468
6490
|
onKeyDown: (L) => {
|
|
6469
|
-
L.key === "Enter" && f.trim() !== "" &&
|
|
6491
|
+
L.key === "Enter" && f.trim() !== "" && _();
|
|
6470
6492
|
},
|
|
6471
6493
|
onChange: (L, { newValue: R }) => x(R),
|
|
6472
6494
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6473
6495
|
}),
|
|
6474
6496
|
[f, c, o]
|
|
6475
|
-
),
|
|
6497
|
+
), C = (L) => {
|
|
6476
6498
|
debugger;
|
|
6477
6499
|
const R = r.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6478
6500
|
g(h, [L]), u(h, R, !0), n(""), l(-1);
|
|
@@ -6504,10 +6526,10 @@ function ManualClasses() {
|
|
|
6504
6526
|
/* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
|
|
6505
6527
|
Autosuggest,
|
|
6506
6528
|
{
|
|
6507
|
-
suggestions:
|
|
6529
|
+
suggestions: B,
|
|
6508
6530
|
onSuggestionsFetchRequested: w,
|
|
6509
|
-
onSuggestionsClearRequested:
|
|
6510
|
-
getSuggestionValue:
|
|
6531
|
+
onSuggestionsClearRequested: k,
|
|
6532
|
+
getSuggestionValue: S,
|
|
6511
6533
|
renderSuggestion: E,
|
|
6512
6534
|
inputProps: v,
|
|
6513
6535
|
containerProps: {
|
|
@@ -6525,7 +6547,7 @@ function ManualClasses() {
|
|
|
6525
6547
|
{
|
|
6526
6548
|
variant: "outline",
|
|
6527
6549
|
className: "h-6 border-border",
|
|
6528
|
-
onClick:
|
|
6550
|
+
onClick: _,
|
|
6529
6551
|
disabled: f.trim() === "",
|
|
6530
6552
|
size: "sm",
|
|
6531
6553
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
@@ -6538,16 +6560,16 @@ function ManualClasses() {
|
|
|
6538
6560
|
{
|
|
6539
6561
|
ref: o,
|
|
6540
6562
|
value: r,
|
|
6541
|
-
onChange: (
|
|
6563
|
+
onChange: (T) => n(T.target.value),
|
|
6542
6564
|
onBlur: () => {
|
|
6543
|
-
|
|
6565
|
+
C(L);
|
|
6544
6566
|
},
|
|
6545
|
-
onKeyDown: (
|
|
6546
|
-
|
|
6567
|
+
onKeyDown: (T) => {
|
|
6568
|
+
T.key === "Enter" && C(L);
|
|
6547
6569
|
},
|
|
6548
|
-
onFocus: (
|
|
6570
|
+
onFocus: (T) => {
|
|
6549
6571
|
setTimeout(() => {
|
|
6550
|
-
|
|
6572
|
+
T.target.select();
|
|
6551
6573
|
}, 0);
|
|
6552
6574
|
},
|
|
6553
6575
|
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"
|
|
@@ -6561,38 +6583,40 @@ function ManualClasses() {
|
|
|
6561
6583
|
o.current && o.current.focus();
|
|
6562
6584
|
}, 10);
|
|
6563
6585
|
},
|
|
6564
|
-
className: "flex cursor-default items-center gap-x-1 truncate break-words
|
|
6586
|
+
className: "flex h-max cursor-default items-center gap-x-1 truncate break-words rounded bg-gray-200 py-px pl-0.5 pr-1 text-[11px] text-gray-600 dark:bg-gray-800 dark:text-gray-300",
|
|
6565
6587
|
children: [
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6588
|
+
/* @__PURE__ */ jsxs("div", { className: "z-10 flex h-full w-max items-center justify-center", children: [
|
|
6589
|
+
/* @__PURE__ */ jsx(
|
|
6590
|
+
Cross2Icon,
|
|
6591
|
+
{
|
|
6592
|
+
onClick: () => g(h, [L], !0),
|
|
6593
|
+
className: "hidden h-max w-3.5 cursor-pointer rounded bg-gray-100 p-0.5 text-red-500 hover:bg-gray-50 group-hover:block"
|
|
6594
|
+
}
|
|
6595
|
+
),
|
|
6596
|
+
/* @__PURE__ */ jsxs(
|
|
6597
|
+
"svg",
|
|
6598
|
+
{
|
|
6599
|
+
className: "h-3.5 w-3.5 group-hover:hidden",
|
|
6600
|
+
fill: "rgba(55, 65, 81, 0.4)",
|
|
6601
|
+
viewBox: "0 0 24 24",
|
|
6602
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6603
|
+
xmlSpace: "preserve",
|
|
6604
|
+
children: [
|
|
6605
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
|
|
6606
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
6607
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
|
|
6608
|
+
"path",
|
|
6609
|
+
{
|
|
6610
|
+
fillRule: "evenodd",
|
|
6611
|
+
clipRule: "evenodd",
|
|
6612
|
+
d: "M12 6.036c-2.667 0-4.333 1.325-5 3.976 1-1.325 2.167-1.822 3.5-1.491.761.189 1.305.738 1.906 1.345C13.387 10.855 14.522 12 17 12c2.667 0 4.333-1.325 5-3.976-1 1.325-2.166 1.822-3.5 1.491-.761-.189-1.305-.738-1.907-1.345-.98-.99-2.114-2.134-4.593-2.134zM7 12c-2.667 0-4.333 1.325-5 3.976 1-1.326 2.167-1.822 3.5-1.491.761.189 1.305.738 1.907 1.345.98.989 2.115 2.134 4.594 2.134 2.667 0 4.333-1.325 5-3.976-1 1.325-2.167 1.822-3.5 1.491-.761-.189-1.305-.738-1.906-1.345C10.613 13.145 9.478 12 7 12z"
|
|
6613
|
+
}
|
|
6614
|
+
) })
|
|
6615
|
+
]
|
|
6616
|
+
}
|
|
6617
|
+
)
|
|
6618
|
+
] }),
|
|
6619
|
+
/* @__PURE__ */ jsx("div", { children: L })
|
|
6596
6620
|
]
|
|
6597
6621
|
}
|
|
6598
6622
|
) }, L)
|
|
@@ -6713,8 +6737,8 @@ function BlockStyling() {
|
|
|
6713
6737
|
m = isNaN(m) ? 0 : m;
|
|
6714
6738
|
let f = MAPPER[i.dragUnit];
|
|
6715
6739
|
(startsWith(h, "scale") || h === "opacity") && (f = 10);
|
|
6716
|
-
let
|
|
6717
|
-
g &&
|
|
6740
|
+
let y = (i.dragStartY - u.pageY) / f + m;
|
|
6741
|
+
g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
|
|
6718
6742
|
},
|
|
6719
6743
|
[i],
|
|
6720
6744
|
50
|
|
@@ -6757,8 +6781,8 @@ const CoreBlock = ({
|
|
|
6757
6781
|
}) => {
|
|
6758
6782
|
const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
|
|
6759
6783
|
if (has(o, "blocks")) {
|
|
6760
|
-
const
|
|
6761
|
-
u(syncBlocksWithDefaults(
|
|
6784
|
+
const y = isFunction(o.blocks) ? o.blocks() : o.blocks;
|
|
6785
|
+
u(syncBlocksWithDefaults(y), n || null, a);
|
|
6762
6786
|
} else
|
|
6763
6787
|
p(o, n || null, a);
|
|
6764
6788
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
@@ -6770,8 +6794,8 @@ const CoreBlock = ({
|
|
|
6770
6794
|
disabled: r,
|
|
6771
6795
|
onClick: m,
|
|
6772
6796
|
type: "button",
|
|
6773
|
-
onDragStart: (
|
|
6774
|
-
|
|
6797
|
+
onDragStart: (y) => {
|
|
6798
|
+
y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
6775
6799
|
g([]), h();
|
|
6776
6800
|
}, 200);
|
|
6777
6801
|
},
|
|
@@ -6986,7 +7010,7 @@ const CoreBlock = ({
|
|
|
6986
7010
|
}
|
|
6987
7011
|
}
|
|
6988
7012
|
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
6989
|
-
var h, m, f, x,
|
|
7013
|
+
var h, m, f, x, y, b, A, _, B, N;
|
|
6990
7014
|
if (n.type === "comment") return [];
|
|
6991
7015
|
let a = { _id: generateUUID() };
|
|
6992
7016
|
if (r && (a._parent = r.block._id), n.type === "text")
|
|
@@ -7008,7 +7032,7 @@ const CoreBlock = ({
|
|
|
7008
7032
|
...getAttrs(n),
|
|
7009
7033
|
...getStyles(n)
|
|
7010
7034
|
}, n.attributes) {
|
|
7011
|
-
const w = n.attributes.find((
|
|
7035
|
+
const w = n.attributes.find((k) => includes(NAME_ATTRIBUTES, k.key));
|
|
7012
7036
|
w && (a._name = w.value);
|
|
7013
7037
|
}
|
|
7014
7038
|
if (i)
|
|
@@ -7026,29 +7050,29 @@ const CoreBlock = ({
|
|
|
7026
7050
|
];
|
|
7027
7051
|
a = {
|
|
7028
7052
|
...a,
|
|
7029
|
-
href: ((h = l.find((
|
|
7030
|
-
hrefType: ((m = l.find((
|
|
7031
|
-
autoplay: ((f = l.find((
|
|
7032
|
-
maxWidth: ((
|
|
7033
|
-
backdropColor: ((b = l.find((
|
|
7034
|
-
galleryName: ((A = l.find((
|
|
7035
|
-
}, forEach(w, (
|
|
7036
|
-
has(a, `styles_attrs.${
|
|
7053
|
+
href: ((h = l.find((k) => k.key === "href")) == null ? void 0 : h.value) || "",
|
|
7054
|
+
hrefType: ((m = l.find((k) => k.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
7055
|
+
autoplay: ((f = l.find((k) => k.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
|
|
7056
|
+
maxWidth: ((y = (x = l.find((k) => k.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
|
|
7057
|
+
backdropColor: ((b = l.find((k) => k.key === "data-overlay")) == null ? void 0 : b.value) || "",
|
|
7058
|
+
galleryName: ((A = l.find((k) => k.key === "data-gall")) == null ? void 0 : A.value) || ""
|
|
7059
|
+
}, forEach(w, (k) => {
|
|
7060
|
+
has(a, `styles_attrs.${k}`) && delete a.styles_attrs[k];
|
|
7037
7061
|
});
|
|
7038
7062
|
}
|
|
7039
7063
|
if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
|
|
7040
7064
|
delete a.styles_attrs;
|
|
7041
|
-
const w = filter(n.children || [], (
|
|
7065
|
+
const w = filter(n.children || [], (S) => (S == null ? void 0 : S.tagName) !== "span");
|
|
7042
7066
|
a.content = getTextContent(w);
|
|
7043
|
-
const
|
|
7067
|
+
const k = find(
|
|
7044
7068
|
n.children || [],
|
|
7045
|
-
(
|
|
7069
|
+
(S) => (S == null ? void 0 : S.tagName) === "span" && some(S.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg")
|
|
7046
7070
|
);
|
|
7047
|
-
if (
|
|
7048
|
-
const
|
|
7049
|
-
if (
|
|
7050
|
-
a.icon = stringify([
|
|
7051
|
-
const { height: E, width: v } = getSvgDimensions(
|
|
7071
|
+
if (k) {
|
|
7072
|
+
const S = find(k.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg");
|
|
7073
|
+
if (S) {
|
|
7074
|
+
a.icon = stringify([S]);
|
|
7075
|
+
const { height: E, width: v } = getSvgDimensions(S, "16px", "16px");
|
|
7052
7076
|
a.iconHeight = E, a.iconWidth = v;
|
|
7053
7077
|
}
|
|
7054
7078
|
}
|
|
@@ -7061,11 +7085,11 @@ const CoreBlock = ({
|
|
|
7061
7085
|
const w = stringify([n]);
|
|
7062
7086
|
return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
|
|
7063
7087
|
} else if (n.tagName === "svg") {
|
|
7064
|
-
const w = get(find(n.attributes, { key: "class" }), "value", ""), { height:
|
|
7065
|
-
if (
|
|
7066
|
-
a.styles = `${STYLES_KEY}, ${cn$2(`w-${
|
|
7088
|
+
const w = get(find(n.attributes, { key: "class" }), "value", ""), { height: k, width: S } = getHeightAndWidthFromClass(w);
|
|
7089
|
+
if (k && S)
|
|
7090
|
+
a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${k}`, w)}`.trim(), a.height = k == null ? void 0 : k.replace("px", ""), a.width = S == null ? void 0 : S.replace("px", "");
|
|
7067
7091
|
else {
|
|
7068
|
-
const E = (
|
|
7092
|
+
const E = (_ = find(n.attributes, { key: "height" })) == null ? void 0 : _.value, v = (B = find(n.attributes, { key: "width" })) == null ? void 0 : B.value;
|
|
7069
7093
|
E && v ? (a.styles = `${STYLES_KEY}, ${cn$2(`w-[${v}px] h-[${E}px]`, w)}`.trim(), a.height = E, a.width = v) : a.styles = `${STYLES_KEY}, ${cn$2("w-full h-full", w)}`.trim();
|
|
7070
7094
|
}
|
|
7071
7095
|
return n.attributes = filter(n.attributes, (E) => !includes(["style", "width", "height", "class"], E.key)), a.icon = stringify([n]), [a];
|
|
@@ -7185,18 +7209,18 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7185
7209
|
parentId: n = void 0,
|
|
7186
7210
|
position: a = -1
|
|
7187
7211
|
}) => {
|
|
7188
|
-
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom),
|
|
7189
|
-
const
|
|
7190
|
-
return
|
|
7212
|
+
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (_) => {
|
|
7213
|
+
const B = has(_, "styles_attrs.data-page-section");
|
|
7214
|
+
return _._type === "Box" && B;
|
|
7191
7215
|
}, b = useCallback(
|
|
7192
|
-
async (
|
|
7193
|
-
if (
|
|
7216
|
+
async (_) => {
|
|
7217
|
+
if (_.stopPropagation(), has(o, "component")) {
|
|
7194
7218
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7195
7219
|
return;
|
|
7196
7220
|
}
|
|
7197
7221
|
i(!0);
|
|
7198
|
-
let
|
|
7199
|
-
typeof
|
|
7222
|
+
let B = await c({ library: r, block: o });
|
|
7223
|
+
typeof B == "string" && (B = getBlocksFromHTML(B)), isEmpty(B) || p(syncBlocksWithDefaults(B), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7200
7224
|
},
|
|
7201
7225
|
[d, p, o, c, r, n, a]
|
|
7202
7226
|
);
|
|
@@ -7207,18 +7231,18 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7207
7231
|
onClick: l ? () => {
|
|
7208
7232
|
} : b,
|
|
7209
7233
|
draggable: f ? "true" : "false",
|
|
7210
|
-
onDragStart: async (
|
|
7211
|
-
const
|
|
7234
|
+
onDragStart: async (_) => {
|
|
7235
|
+
const B = await c({ library: r, block: o });
|
|
7212
7236
|
let N = n;
|
|
7213
|
-
if (
|
|
7214
|
-
const w = { blocks:
|
|
7215
|
-
if (
|
|
7216
|
-
const
|
|
7217
|
-
|
|
7218
|
-
|
|
7237
|
+
if (y(first(B)) && (N = null), !isEmpty(B)) {
|
|
7238
|
+
const w = { blocks: B, uiLibrary: !0, parent: N };
|
|
7239
|
+
if (_.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
7240
|
+
const k = new Image();
|
|
7241
|
+
k.src = o.preview, k.onload = () => {
|
|
7242
|
+
_.dataTransfer.setDragImage(k, 0, 0);
|
|
7219
7243
|
};
|
|
7220
7244
|
} else
|
|
7221
|
-
|
|
7245
|
+
_.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7222
7246
|
x(w), setTimeout(() => {
|
|
7223
7247
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7224
7248
|
}, 200);
|
|
@@ -7245,7 +7269,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7245
7269
|
] }) })
|
|
7246
7270
|
] });
|
|
7247
7271
|
}, UILibrarySection = ({ parentId: o, position: r }) => {
|
|
7248
|
-
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((
|
|
7272
|
+
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((C) => C.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
|
|
7249
7273
|
useEffect(() => {
|
|
7250
7274
|
c && c.length > 0 && (f.current = new Fuse(c, {
|
|
7251
7275
|
keys: ["name", "label", "description", "group"],
|
|
@@ -7257,27 +7281,27 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7257
7281
|
m([]);
|
|
7258
7282
|
return;
|
|
7259
7283
|
}
|
|
7260
|
-
const
|
|
7261
|
-
m(
|
|
7284
|
+
const C = f.current.search(u).map((j) => j.item);
|
|
7285
|
+
m(C);
|
|
7262
7286
|
}, [u]);
|
|
7263
|
-
const x = u.trim() && !isEmpty(h) ? h : c,
|
|
7287
|
+
const x = u.trim() && !isEmpty(h) ? h : c, y = groupBy(x, "group"), [b, A] = useState(null);
|
|
7264
7288
|
useEffect(() => {
|
|
7265
|
-
if (isEmpty(keys(
|
|
7289
|
+
if (isEmpty(keys(y))) {
|
|
7266
7290
|
A(null);
|
|
7267
7291
|
return;
|
|
7268
7292
|
}
|
|
7269
|
-
if (!b || !
|
|
7270
|
-
A(first(keys(
|
|
7293
|
+
if (!b || !y[b]) {
|
|
7294
|
+
A(first(keys(y)));
|
|
7271
7295
|
return;
|
|
7272
7296
|
}
|
|
7273
|
-
}, [
|
|
7274
|
-
const
|
|
7275
|
-
|
|
7276
|
-
|
|
7297
|
+
}, [y, b]);
|
|
7298
|
+
const _ = get(y, b, []), B = useRef(null), { t: N } = useTranslation(), w = (C) => {
|
|
7299
|
+
B.current && (clearTimeout(B.current), B.current = null), B.current = setTimeout(() => {
|
|
7300
|
+
B.current && A(C);
|
|
7277
7301
|
}, 400);
|
|
7278
|
-
},
|
|
7302
|
+
}, k = () => {
|
|
7279
7303
|
i != null && i.id && p(i.id);
|
|
7280
|
-
},
|
|
7304
|
+
}, S = () => {
|
|
7281
7305
|
g("");
|
|
7282
7306
|
};
|
|
7283
7307
|
if (d)
|
|
@@ -7285,7 +7309,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7285
7309
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7286
7310
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7287
7311
|
] });
|
|
7288
|
-
const E = filter(
|
|
7312
|
+
const E = filter(_, (C, j) => j % 2 === 0), v = filter(_, (C, j) => j % 2 === 1);
|
|
7289
7313
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7290
7314
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7291
7315
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7294,14 +7318,14 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7294
7318
|
{
|
|
7295
7319
|
placeholder: N("Search blocks..."),
|
|
7296
7320
|
value: u,
|
|
7297
|
-
onChange: (
|
|
7321
|
+
onChange: (C) => g(C.target.value),
|
|
7298
7322
|
className: "w-full pl-8 pr-8"
|
|
7299
7323
|
}
|
|
7300
7324
|
),
|
|
7301
7325
|
u && /* @__PURE__ */ jsx(
|
|
7302
7326
|
"button",
|
|
7303
7327
|
{
|
|
7304
|
-
onClick:
|
|
7328
|
+
onClick: S,
|
|
7305
7329
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7306
7330
|
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
7307
7331
|
}
|
|
@@ -7313,17 +7337,17 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7313
7337
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7314
7338
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: N("Groups") }),
|
|
7315
7339
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7316
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(
|
|
7340
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7317
7341
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: N("Failed to load the UI library. Try again") }),
|
|
7318
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
7342
|
+
/* @__PURE__ */ jsxs(Button, { onClick: k, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7319
7343
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
|
|
7320
7344
|
N("Retry")
|
|
7321
7345
|
] })
|
|
7322
|
-
] }) }) : map(
|
|
7346
|
+
] }) }) : map(y, (C, j) => /* @__PURE__ */ jsxs(
|
|
7323
7347
|
"div",
|
|
7324
7348
|
{
|
|
7325
7349
|
onMouseEnter: () => w(j),
|
|
7326
|
-
onMouseLeave: () => clearTimeout(
|
|
7350
|
+
onMouseLeave: () => clearTimeout(B.current),
|
|
7327
7351
|
role: "button",
|
|
7328
7352
|
onClick: () => A(j),
|
|
7329
7353
|
className: cn$2(
|
|
@@ -7342,26 +7366,26 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7342
7366
|
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
|
|
7343
7367
|
ScrollArea,
|
|
7344
7368
|
{
|
|
7345
|
-
onMouseEnter: () =>
|
|
7369
|
+
onMouseEnter: () => B.current ? clearTimeout(B.current) : null,
|
|
7346
7370
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7347
7371
|
children: [
|
|
7348
|
-
isEmpty(
|
|
7349
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((
|
|
7372
|
+
isEmpty(_) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7373
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((C, j) => /* @__PURE__ */ jsx(
|
|
7350
7374
|
BlockCard,
|
|
7351
7375
|
{
|
|
7352
7376
|
parentId: o,
|
|
7353
7377
|
position: r,
|
|
7354
|
-
block:
|
|
7378
|
+
block: C,
|
|
7355
7379
|
library: i
|
|
7356
7380
|
},
|
|
7357
7381
|
`block-${j}`
|
|
7358
7382
|
)) }),
|
|
7359
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((
|
|
7383
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((C, j) => /* @__PURE__ */ jsx(
|
|
7360
7384
|
BlockCard,
|
|
7361
7385
|
{
|
|
7362
7386
|
parentId: o,
|
|
7363
7387
|
position: r,
|
|
7364
|
-
block:
|
|
7388
|
+
block: C,
|
|
7365
7389
|
library: i
|
|
7366
7390
|
},
|
|
7367
7391
|
`block-second-${j}`
|
|
@@ -7400,15 +7424,15 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7400
7424
|
error: c
|
|
7401
7425
|
}), g(!0);
|
|
7402
7426
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7403
|
-
const m = Object.entries(a).map(([x,
|
|
7404
|
-
const b =
|
|
7427
|
+
const m = Object.entries(a).map(([x, y]) => {
|
|
7428
|
+
const b = y, A = b.type || "partial", _ = formatReadableName(A);
|
|
7405
7429
|
return {
|
|
7406
7430
|
type: "PartialBlock",
|
|
7407
7431
|
// Set the type to PartialBlock
|
|
7408
7432
|
label: formatReadableName(b.name || x),
|
|
7409
7433
|
description: b.description || "",
|
|
7410
7434
|
icon: Globe,
|
|
7411
|
-
group:
|
|
7435
|
+
group: _,
|
|
7412
7436
|
// Use formatted type as group
|
|
7413
7437
|
category: "partial",
|
|
7414
7438
|
partialBlockId: x,
|
|
@@ -7464,43 +7488,43 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7464
7488
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...r });
|
|
7465
7489
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: r, parentId: n, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7466
7490
|
var v;
|
|
7467
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (
|
|
7491
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (C) => C._id === n)) == null ? void 0 : v._type, [m, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
|
|
7468
7492
|
useEffect(() => {
|
|
7469
|
-
const
|
|
7493
|
+
const C = setTimeout(() => {
|
|
7470
7494
|
var j;
|
|
7471
7495
|
(j = u.current) == null || j.focus();
|
|
7472
7496
|
}, 0);
|
|
7473
|
-
return () => clearTimeout(
|
|
7497
|
+
return () => clearTimeout(C);
|
|
7474
7498
|
}, [g]), useEffect(() => {
|
|
7475
|
-
d && (f("all"),
|
|
7476
|
-
}, [d]), useEffect(() => (b.current = debounce((
|
|
7477
|
-
f(
|
|
7499
|
+
d && (f("all"), y(null));
|
|
7500
|
+
}, [d]), useEffect(() => (b.current = debounce((C) => {
|
|
7501
|
+
f(C);
|
|
7478
7502
|
}, 500), () => {
|
|
7479
7503
|
b.current && b.current.cancel();
|
|
7480
7504
|
}), []);
|
|
7481
|
-
const A = useCallback((
|
|
7482
|
-
|
|
7483
|
-
}, []),
|
|
7484
|
-
|
|
7485
|
-
}, []),
|
|
7486
|
-
b.current && b.current.cancel(), f(
|
|
7505
|
+
const A = useCallback((C) => {
|
|
7506
|
+
y(C), b.current && b.current(C);
|
|
7507
|
+
}, []), _ = useCallback(() => {
|
|
7508
|
+
y(null), b.current && b.current.cancel();
|
|
7509
|
+
}, []), B = useCallback((C) => {
|
|
7510
|
+
b.current && b.current.cancel(), f(C), y(null);
|
|
7487
7511
|
}, []), N = useMemo(
|
|
7488
7512
|
() => d ? values(r).filter(
|
|
7489
|
-
(
|
|
7490
|
-
var j,
|
|
7491
|
-
return (((j =
|
|
7513
|
+
(C) => {
|
|
7514
|
+
var j, I;
|
|
7515
|
+
return (((j = C.label) == null ? void 0 : j.toLowerCase()) + " " + ((I = C.type) == null ? void 0 : I.toLowerCase())).includes(d.toLowerCase());
|
|
7492
7516
|
}
|
|
7493
7517
|
) : r,
|
|
7494
7518
|
[r, d]
|
|
7495
7519
|
), w = useMemo(
|
|
7496
7520
|
() => d ? o.filter(
|
|
7497
|
-
(
|
|
7498
|
-
) : o.filter((
|
|
7521
|
+
(C) => reject(filter(values(N), { group: C }), { hidden: !0 }).length > 0
|
|
7522
|
+
) : o.filter((C) => reject(filter(values(r), { group: C }), { hidden: !0 }).length > 0),
|
|
7499
7523
|
[r, N, o, d]
|
|
7500
|
-
),
|
|
7501
|
-
() => sortBy(w, (
|
|
7524
|
+
), k = useMemo(
|
|
7525
|
+
() => sortBy(w, (C) => CORE_GROUPS.indexOf(C) === -1 ? 99 : CORE_GROUPS.indexOf(C)),
|
|
7502
7526
|
[w]
|
|
7503
|
-
),
|
|
7527
|
+
), S = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), E = useMemo(() => m === "all" ? k : [m], [k, m]);
|
|
7504
7528
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7505
7529
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7506
7530
|
Input$1,
|
|
@@ -7510,32 +7534,32 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7510
7534
|
placeholder: i("Search blocks..."),
|
|
7511
7535
|
value: d,
|
|
7512
7536
|
className: "-ml-2",
|
|
7513
|
-
onChange: (
|
|
7537
|
+
onChange: (C) => p(C.target.value)
|
|
7514
7538
|
}
|
|
7515
7539
|
) }),
|
|
7516
7540
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
|
|
7517
|
-
|
|
7541
|
+
k.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
7518
7542
|
/* @__PURE__ */ jsx(
|
|
7519
7543
|
"button",
|
|
7520
7544
|
{
|
|
7521
|
-
onClick: () =>
|
|
7545
|
+
onClick: () => B("all"),
|
|
7522
7546
|
onMouseEnter: () => A("all"),
|
|
7523
|
-
onMouseLeave:
|
|
7547
|
+
onMouseLeave: _,
|
|
7524
7548
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7525
7549
|
children: i("All")
|
|
7526
7550
|
},
|
|
7527
7551
|
"sidebar-all"
|
|
7528
7552
|
),
|
|
7529
|
-
|
|
7553
|
+
k.map((C) => /* @__PURE__ */ jsx(
|
|
7530
7554
|
"button",
|
|
7531
7555
|
{
|
|
7532
|
-
onClick: () =>
|
|
7533
|
-
onMouseEnter: () => A(
|
|
7534
|
-
onMouseLeave:
|
|
7535
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m ===
|
|
7536
|
-
children: capitalize(i(
|
|
7556
|
+
onClick: () => B(C),
|
|
7557
|
+
onMouseEnter: () => A(C),
|
|
7558
|
+
onMouseLeave: _,
|
|
7559
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === C || x === C ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7560
|
+
children: capitalize(i(C.toLowerCase()))
|
|
7537
7561
|
},
|
|
7538
|
-
`sidebar-${
|
|
7562
|
+
`sidebar-${C}`
|
|
7539
7563
|
))
|
|
7540
7564
|
] }) }) }),
|
|
7541
7565
|
/* @__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: w.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: [
|
|
@@ -7543,10 +7567,10 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7543
7567
|
' "',
|
|
7544
7568
|
d,
|
|
7545
7569
|
'"'
|
|
7546
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((
|
|
7547
|
-
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(
|
|
7570
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((C) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7571
|
+
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(C.toLowerCase())) }),
|
|
7548
7572
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7549
|
-
m === "all" ? filter(values(
|
|
7573
|
+
m === "all" ? filter(values(S), { group: C }) : values(S),
|
|
7550
7574
|
{ hidden: !0 }
|
|
7551
7575
|
).map((j) => /* @__PURE__ */ jsx(
|
|
7552
7576
|
CoreBlock,
|
|
@@ -7558,7 +7582,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7558
7582
|
},
|
|
7559
7583
|
j.type
|
|
7560
7584
|
)) })
|
|
7561
|
-
] },
|
|
7585
|
+
] }, C)) }) }) })
|
|
7562
7586
|
] })
|
|
7563
7587
|
] });
|
|
7564
7588
|
}, addBlockTabAtom = atomWithStorage("__add_block_tab", "library"), AddBlocksPanel = ({
|
|
@@ -7911,35 +7935,35 @@ const Input = ({ node: o }) => {
|
|
|
7911
7935
|
var R;
|
|
7912
7936
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7913
7937
|
let p = null;
|
|
7914
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop:
|
|
7915
|
-
|
|
7916
|
-
}, N = (
|
|
7917
|
-
|
|
7918
|
-
}, w = (
|
|
7919
|
-
|
|
7920
|
-
}, [
|
|
7921
|
-
var
|
|
7922
|
-
v(), o.parent.isSelected ||
|
|
7938
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: A, handleClick: _ } = o, B = (T) => {
|
|
7939
|
+
T.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7940
|
+
}, N = (T) => {
|
|
7941
|
+
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
7942
|
+
}, w = (T) => {
|
|
7943
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
7944
|
+
}, [k, S] = useAtom$1(currentAddSelection), E = () => {
|
|
7945
|
+
var T;
|
|
7946
|
+
v(), o.parent.isSelected || S((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
7923
7947
|
}, v = () => {
|
|
7924
|
-
|
|
7925
|
-
},
|
|
7926
|
-
v(),
|
|
7948
|
+
S(null);
|
|
7949
|
+
}, C = (T) => {
|
|
7950
|
+
v(), T.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), _(T);
|
|
7927
7951
|
};
|
|
7928
7952
|
useEffect(() => {
|
|
7929
|
-
const
|
|
7930
|
-
|
|
7953
|
+
const T = setTimeout(() => {
|
|
7954
|
+
y && !o.isOpen && !b && !l.includes(m) && o.toggle();
|
|
7931
7955
|
}, 500);
|
|
7932
|
-
return () => clearTimeout(
|
|
7933
|
-
}, [
|
|
7934
|
-
const j = (
|
|
7935
|
-
const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${
|
|
7956
|
+
return () => clearTimeout(T);
|
|
7957
|
+
}, [y, o, b]);
|
|
7958
|
+
const j = (T, D) => {
|
|
7959
|
+
const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${T}]`);
|
|
7936
7960
|
P && P.setAttribute("data-drop", D);
|
|
7937
7961
|
const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
|
|
7938
7962
|
$.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
|
|
7939
|
-
},
|
|
7963
|
+
}, I = (T) => {
|
|
7940
7964
|
v();
|
|
7941
7965
|
const D = get(o, "parent.id");
|
|
7942
|
-
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position:
|
|
7966
|
+
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
|
|
7943
7967
|
};
|
|
7944
7968
|
if (m === ROOT_TEMP_KEY)
|
|
7945
7969
|
return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
@@ -7948,7 +7972,7 @@ const Input = ({ node: o }) => {
|
|
|
7948
7972
|
"div",
|
|
7949
7973
|
{
|
|
7950
7974
|
role: "button",
|
|
7951
|
-
onClick: () =>
|
|
7975
|
+
onClick: () => I(-1),
|
|
7952
7976
|
className: "h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
7953
7977
|
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-primary px-3 py-1 text-[9px] leading-tight text-white hover:bg-primary", children: [
|
|
7954
7978
|
/* @__PURE__ */ jsx(PlusIcon, { className: "h-2 w-2 stroke-[3]" }),
|
|
@@ -7965,27 +7989,27 @@ const Input = ({ node: o }) => {
|
|
|
7965
7989
|
{
|
|
7966
7990
|
onMouseEnter: () => g(m),
|
|
7967
7991
|
onMouseLeave: () => h(),
|
|
7968
|
-
onClick:
|
|
7992
|
+
onClick: C,
|
|
7969
7993
|
style: r,
|
|
7970
7994
|
"data-node-id": m,
|
|
7971
7995
|
ref: l.includes(m) ? null : n,
|
|
7972
7996
|
onDragStart: () => N(o),
|
|
7973
7997
|
onDragEnd: () => w(o),
|
|
7974
|
-
onDragOver: (
|
|
7975
|
-
|
|
7998
|
+
onDragOver: (T) => {
|
|
7999
|
+
T.preventDefault(), j(m, "yes");
|
|
7976
8000
|
},
|
|
7977
|
-
onDragLeave: (
|
|
7978
|
-
|
|
8001
|
+
onDragLeave: (T) => {
|
|
8002
|
+
T.preventDefault(), j(m, "no");
|
|
7979
8003
|
},
|
|
7980
|
-
onDrop: (
|
|
7981
|
-
|
|
8004
|
+
onDrop: (T) => {
|
|
8005
|
+
T.preventDefault(), j(m, "no");
|
|
7982
8006
|
},
|
|
7983
8007
|
children: [
|
|
7984
8008
|
d(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(
|
|
7985
8009
|
"div",
|
|
7986
8010
|
{
|
|
7987
|
-
onClick: (
|
|
7988
|
-
|
|
8011
|
+
onClick: (T) => {
|
|
8012
|
+
T.stopPropagation(), I(o.childIndex);
|
|
7989
8013
|
},
|
|
7990
8014
|
onMouseEnter: E,
|
|
7991
8015
|
onMouseLeave: v,
|
|
@@ -7999,8 +8023,8 @@ const Input = ({ node: o }) => {
|
|
|
7999
8023
|
className: cn(
|
|
8000
8024
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
8001
8025
|
x ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
|
|
8002
|
-
|
|
8003
|
-
(o == null ? void 0 : o.id) ===
|
|
8026
|
+
y && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
|
|
8027
|
+
(o == null ? void 0 : o.id) === k ? "bg-primary/10" : "",
|
|
8004
8028
|
b && "opacity-20",
|
|
8005
8029
|
l.includes(m) ? "opacity-50" : "",
|
|
8006
8030
|
L && x && "bg-primary/20 text-primary"
|
|
@@ -8011,7 +8035,7 @@ const Input = ({ node: o }) => {
|
|
|
8011
8035
|
"div",
|
|
8012
8036
|
{
|
|
8013
8037
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
8014
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick:
|
|
8038
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
|
|
8015
8039
|
}
|
|
8016
8040
|
),
|
|
8017
8041
|
/* @__PURE__ */ jsxs(
|
|
@@ -8028,8 +8052,8 @@ const Input = ({ node: o }) => {
|
|
|
8028
8052
|
"div",
|
|
8029
8053
|
{
|
|
8030
8054
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
8031
|
-
onDoubleClick: (
|
|
8032
|
-
|
|
8055
|
+
onDoubleClick: (T) => {
|
|
8056
|
+
T.stopPropagation(), o.edit(), o.deselect();
|
|
8033
8057
|
},
|
|
8034
8058
|
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(f) })
|
|
8035
8059
|
}
|
|
@@ -8055,8 +8079,8 @@ const Input = ({ node: o }) => {
|
|
|
8055
8079
|
/* @__PURE__ */ jsx(
|
|
8056
8080
|
TooltipTrigger,
|
|
8057
8081
|
{
|
|
8058
|
-
onClick: (
|
|
8059
|
-
|
|
8082
|
+
onClick: (T) => {
|
|
8083
|
+
T.stopPropagation(), i(m), o.isOpen && o.toggle();
|
|
8060
8084
|
},
|
|
8061
8085
|
className: "cursor-pointer rounded bg-transparent",
|
|
8062
8086
|
asChild: !0,
|
|
@@ -8346,15 +8370,15 @@ const Input = ({ node: o }) => {
|
|
|
8346
8370
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8347
8371
|
const [r, n] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions(), [g, h] = useTheme(), m = useThemeOptions(), { t: f } = useTranslation(), x = React.useCallback(
|
|
8348
8372
|
(w) => {
|
|
8349
|
-
const
|
|
8350
|
-
setPreviousTheme(
|
|
8373
|
+
const k = { ...g };
|
|
8374
|
+
setPreviousTheme(k), h(w), toast.success("Theme updated", {
|
|
8351
8375
|
action: {
|
|
8352
8376
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8353
8377
|
/* @__PURE__ */ jsx(Undo$1, { className: "h-4 w-4" }),
|
|
8354
8378
|
" Undo"
|
|
8355
8379
|
] }),
|
|
8356
8380
|
onClick: () => {
|
|
8357
|
-
h(
|
|
8381
|
+
h(k), clearPreviousTheme(), toast.dismiss();
|
|
8358
8382
|
}
|
|
8359
8383
|
},
|
|
8360
8384
|
closeButton: !0,
|
|
@@ -8362,28 +8386,28 @@ const Input = ({ node: o }) => {
|
|
|
8362
8386
|
});
|
|
8363
8387
|
},
|
|
8364
8388
|
[g, h]
|
|
8365
|
-
),
|
|
8366
|
-
const w = d.find((
|
|
8389
|
+
), y = () => {
|
|
8390
|
+
const w = d.find((k) => Object.keys(k)[0] === a);
|
|
8367
8391
|
if (w) {
|
|
8368
|
-
const
|
|
8369
|
-
|
|
8392
|
+
const k = Object.values(w)[0];
|
|
8393
|
+
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (x(k), l("")) : console.error("Invalid preset structure:", k);
|
|
8370
8394
|
} else
|
|
8371
8395
|
console.error("Preset not found:", a);
|
|
8372
8396
|
}, b = (w) => {
|
|
8373
8397
|
x(w), l("");
|
|
8374
8398
|
}, A = useDebouncedCallback(
|
|
8375
|
-
(w,
|
|
8399
|
+
(w, k) => {
|
|
8376
8400
|
h(() => ({
|
|
8377
8401
|
...g,
|
|
8378
8402
|
fontFamily: {
|
|
8379
8403
|
...g.fontFamily,
|
|
8380
|
-
[w.replace(/font-/g, "")]:
|
|
8404
|
+
[w.replace(/font-/g, "")]: k
|
|
8381
8405
|
}
|
|
8382
8406
|
}));
|
|
8383
8407
|
},
|
|
8384
8408
|
[g],
|
|
8385
8409
|
200
|
|
8386
|
-
),
|
|
8410
|
+
), _ = React.useCallback(
|
|
8387
8411
|
(w) => {
|
|
8388
8412
|
h(() => ({
|
|
8389
8413
|
...g,
|
|
@@ -8391,33 +8415,33 @@ const Input = ({ node: o }) => {
|
|
|
8391
8415
|
}));
|
|
8392
8416
|
},
|
|
8393
8417
|
[g]
|
|
8394
|
-
),
|
|
8395
|
-
(w,
|
|
8418
|
+
), B = useDebouncedCallback(
|
|
8419
|
+
(w, k) => {
|
|
8396
8420
|
h(() => {
|
|
8397
|
-
const
|
|
8398
|
-
return r ? set(
|
|
8421
|
+
const S = get(g, `colors.${w}`);
|
|
8422
|
+
return r ? set(S, 1, k) : set(S, 0, k), {
|
|
8399
8423
|
...g,
|
|
8400
8424
|
colors: {
|
|
8401
8425
|
...g.colors,
|
|
8402
|
-
[w]:
|
|
8426
|
+
[w]: S
|
|
8403
8427
|
}
|
|
8404
8428
|
};
|
|
8405
8429
|
});
|
|
8406
8430
|
},
|
|
8407
8431
|
[g],
|
|
8408
8432
|
200
|
|
8409
|
-
), N = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([
|
|
8410
|
-
const
|
|
8411
|
-
return
|
|
8433
|
+
), N = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([k]) => {
|
|
8434
|
+
const S = get(g, `colors.${k}.${r ? 1 : 0}`);
|
|
8435
|
+
return S ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8412
8436
|
/* @__PURE__ */ jsx(
|
|
8413
8437
|
ColorPickerInput,
|
|
8414
8438
|
{
|
|
8415
|
-
value:
|
|
8416
|
-
onChange: (E) =>
|
|
8439
|
+
value: S,
|
|
8440
|
+
onChange: (E) => B(k, E)
|
|
8417
8441
|
}
|
|
8418
8442
|
),
|
|
8419
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
8420
|
-
] },
|
|
8443
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!k.toLowerCase().includes("foreground") && !k.toLowerCase().includes("border") && !k.toLowerCase().includes("input") && !k.toLowerCase().includes("ring") && !k.toLowerCase().includes("background") ? " Background" : "") })
|
|
8444
|
+
] }, k) : null;
|
|
8421
8445
|
}) });
|
|
8422
8446
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8423
8447
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -8433,11 +8457,11 @@ const Input = ({ node: o }) => {
|
|
|
8433
8457
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8434
8458
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8435
8459
|
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
|
|
8436
|
-
const
|
|
8437
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
8460
|
+
const k = Object.keys(w)[0], S = k.replaceAll("_", " ");
|
|
8461
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(S) }, k);
|
|
8438
8462
|
}) })
|
|
8439
8463
|
] }) }),
|
|
8440
|
-
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick:
|
|
8464
|
+
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: f("Apply") }) })
|
|
8441
8465
|
] })
|
|
8442
8466
|
] }),
|
|
8443
8467
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
@@ -8446,12 +8470,12 @@ const Input = ({ node: o }) => {
|
|
|
8446
8470
|
/* @__PURE__ */ jsx(Type, { className: "h-3 w-3 text-gray-600" }),
|
|
8447
8471
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8448
8472
|
] }),
|
|
8449
|
-
(m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([w,
|
|
8473
|
+
(m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([w, k]) => /* @__PURE__ */ jsx(
|
|
8450
8474
|
FontSelector,
|
|
8451
8475
|
{
|
|
8452
8476
|
label: w,
|
|
8453
|
-
value: g.fontFamily[w.replace(/font-/g, "")] ||
|
|
8454
|
-
onChange: (
|
|
8477
|
+
value: g.fontFamily[w.replace(/font-/g, "")] || k[Object.keys(k)[0]],
|
|
8478
|
+
onChange: (S) => A(w, S)
|
|
8455
8479
|
},
|
|
8456
8480
|
w
|
|
8457
8481
|
)) }),
|
|
@@ -8464,7 +8488,7 @@ const Input = ({ node: o }) => {
|
|
|
8464
8488
|
] }),
|
|
8465
8489
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
8466
8490
|
] }),
|
|
8467
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange:
|
|
8491
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: _ }) })
|
|
8468
8492
|
] }),
|
|
8469
8493
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8470
8494
|
(m == null ? void 0 : m.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
@@ -8993,8 +9017,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8993
9017
|
(x = h.current) == null || x.focus();
|
|
8994
9018
|
}, []);
|
|
8995
9019
|
const f = (x) => {
|
|
8996
|
-
const { usage:
|
|
8997
|
-
!l &&
|
|
9020
|
+
const { usage: y } = x || {};
|
|
9021
|
+
!l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
8998
9022
|
};
|
|
8999
9023
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
9000
9024
|
/* @__PURE__ */ jsxs(
|
|
@@ -9223,24 +9247,24 @@ function AIChatPanel() {
|
|
|
9223
9247
|
content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
|
|
9224
9248
|
timestamp: /* @__PURE__ */ new Date()
|
|
9225
9249
|
};
|
|
9226
|
-
r((
|
|
9250
|
+
r((_) => [..._, A]), i(!1), d(null);
|
|
9227
9251
|
}, 1500);
|
|
9228
9252
|
}, m = (b) => {
|
|
9229
9253
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
|
|
9230
9254
|
}, f = (b) => {
|
|
9231
|
-
var
|
|
9232
|
-
const A = (
|
|
9255
|
+
var _;
|
|
9256
|
+
const A = (_ = b.target.files) == null ? void 0 : _[0];
|
|
9233
9257
|
if (A) {
|
|
9234
|
-
const
|
|
9235
|
-
|
|
9258
|
+
const B = new FileReader();
|
|
9259
|
+
B.onload = (N) => {
|
|
9236
9260
|
var w;
|
|
9237
9261
|
d((w = N.target) == null ? void 0 : w.result);
|
|
9238
|
-
},
|
|
9262
|
+
}, B.readAsDataURL(A);
|
|
9239
9263
|
}
|
|
9240
9264
|
}, x = () => {
|
|
9241
9265
|
var b;
|
|
9242
9266
|
(b = p.current) == null || b.click();
|
|
9243
|
-
},
|
|
9267
|
+
}, y = () => {
|
|
9244
9268
|
d(null), p.current && (p.current.value = "");
|
|
9245
9269
|
};
|
|
9246
9270
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col rounded-lg bg-background shadow-sm", children: [
|
|
@@ -9286,7 +9310,7 @@ function AIChatPanel() {
|
|
|
9286
9310
|
size: "icon",
|
|
9287
9311
|
variant: "destructive",
|
|
9288
9312
|
className: "absolute right-0 top-0 h-5 w-5 rounded-full p-0",
|
|
9289
|
-
onClick:
|
|
9313
|
+
onClick: y,
|
|
9290
9314
|
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
9291
9315
|
}
|
|
9292
9316
|
)
|
|
@@ -9429,7 +9453,7 @@ const AiAssistant = () => {
|
|
|
9429
9453
|
preloadedAttributes: r = [],
|
|
9430
9454
|
onAttributesChange: n
|
|
9431
9455
|
}) {
|
|
9432
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null),
|
|
9456
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null), y = usePageExternalData();
|
|
9433
9457
|
useEffect(() => {
|
|
9434
9458
|
l(r);
|
|
9435
9459
|
}, [r]);
|
|
@@ -9439,43 +9463,43 @@ const AiAssistant = () => {
|
|
|
9439
9463
|
return;
|
|
9440
9464
|
}
|
|
9441
9465
|
if (i) {
|
|
9442
|
-
const
|
|
9443
|
-
n(
|
|
9466
|
+
const k = [...a, { key: i, value: d }];
|
|
9467
|
+
n(k), l(a), c(""), p(""), m("");
|
|
9444
9468
|
}
|
|
9445
|
-
}, A = (
|
|
9446
|
-
const
|
|
9447
|
-
n(
|
|
9448
|
-
},
|
|
9449
|
-
g(
|
|
9450
|
-
},
|
|
9469
|
+
}, A = (k) => {
|
|
9470
|
+
const S = a.filter((E, v) => v !== k);
|
|
9471
|
+
n(S), l(S);
|
|
9472
|
+
}, _ = (k) => {
|
|
9473
|
+
g(k), c(a[k].key), p(a[k].value);
|
|
9474
|
+
}, B = () => {
|
|
9451
9475
|
if (i.startsWith("@")) {
|
|
9452
9476
|
m("Attribute keys cannot start with '@'");
|
|
9453
9477
|
return;
|
|
9454
9478
|
}
|
|
9455
9479
|
if (u !== null && i) {
|
|
9456
|
-
const
|
|
9457
|
-
|
|
9480
|
+
const k = [...a];
|
|
9481
|
+
k[u] = { key: i, value: d }, n(k), l(k), g(null), c(""), p(""), m("");
|
|
9458
9482
|
}
|
|
9459
|
-
}, N = (
|
|
9460
|
-
|
|
9461
|
-
}, w = useCallback((
|
|
9462
|
-
const
|
|
9483
|
+
}, N = (k) => {
|
|
9484
|
+
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? B() : b());
|
|
9485
|
+
}, w = useCallback((k) => {
|
|
9486
|
+
const S = (C) => /[.,!?;:]/.test(C), E = (C, j, I) => {
|
|
9463
9487
|
let L = "", R = "";
|
|
9464
|
-
const
|
|
9465
|
-
return j > 0 && (
|
|
9466
|
-
text: L +
|
|
9488
|
+
const T = j > 0 ? C[j - 1] : "", D = j < C.length ? C[j] : "";
|
|
9489
|
+
return j > 0 && (T === "." || !S(T) && T !== " ") && (L = " "), j < C.length && !S(D) && D !== " " && (R = " "), {
|
|
9490
|
+
text: L + I + R,
|
|
9467
9491
|
prefixLength: L.length,
|
|
9468
9492
|
suffixLength: R.length
|
|
9469
9493
|
};
|
|
9470
9494
|
}, v = x.current;
|
|
9471
9495
|
if (v) {
|
|
9472
|
-
const
|
|
9473
|
-
if (
|
|
9474
|
-
const O = `{{${
|
|
9496
|
+
const C = v.selectionStart || 0, j = v.value || "", I = v.selectionEnd || C;
|
|
9497
|
+
if (I > C) {
|
|
9498
|
+
const O = `{{${k}}}`, { text: P } = E(j, C, O), $ = j.slice(0, C) + P + j.slice(I);
|
|
9475
9499
|
p($);
|
|
9476
9500
|
return;
|
|
9477
9501
|
}
|
|
9478
|
-
const R = `{{${
|
|
9502
|
+
const R = `{{${k}}}`, { text: T } = E(j, C, R), D = j.slice(0, C) + T + j.slice(C);
|
|
9479
9503
|
p(D);
|
|
9480
9504
|
}
|
|
9481
9505
|
}, []);
|
|
@@ -9483,8 +9507,8 @@ const AiAssistant = () => {
|
|
|
9483
9507
|
/* @__PURE__ */ jsxs(
|
|
9484
9508
|
"form",
|
|
9485
9509
|
{
|
|
9486
|
-
onSubmit: (
|
|
9487
|
-
|
|
9510
|
+
onSubmit: (k) => {
|
|
9511
|
+
k.preventDefault(), u !== null ? B() : b();
|
|
9488
9512
|
},
|
|
9489
9513
|
className: "space-y-3",
|
|
9490
9514
|
children: [
|
|
@@ -9500,7 +9524,7 @@ const AiAssistant = () => {
|
|
|
9500
9524
|
id: "attrKey",
|
|
9501
9525
|
ref: f,
|
|
9502
9526
|
value: i,
|
|
9503
|
-
onChange: (
|
|
9527
|
+
onChange: (k) => c(k.target.value),
|
|
9504
9528
|
placeholder: "Enter Key",
|
|
9505
9529
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
9506
9530
|
}
|
|
@@ -9509,7 +9533,7 @@ const AiAssistant = () => {
|
|
|
9509
9533
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9510
9534
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9511
9535
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9512
|
-
!isEmpty(
|
|
9536
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: w })
|
|
9513
9537
|
] }),
|
|
9514
9538
|
/* @__PURE__ */ jsx(
|
|
9515
9539
|
Textarea,
|
|
@@ -9521,7 +9545,7 @@ const AiAssistant = () => {
|
|
|
9521
9545
|
rows: 2,
|
|
9522
9546
|
ref: x,
|
|
9523
9547
|
value: d,
|
|
9524
|
-
onChange: (
|
|
9548
|
+
onChange: (k) => p(k.target.value),
|
|
9525
9549
|
onKeyDown: N,
|
|
9526
9550
|
placeholder: "Enter Value",
|
|
9527
9551
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
@@ -9534,16 +9558,16 @@ const AiAssistant = () => {
|
|
|
9534
9558
|
]
|
|
9535
9559
|
}
|
|
9536
9560
|
),
|
|
9537
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
9561
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k, S) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9538
9562
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9539
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
9540
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children:
|
|
9563
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: k.key }),
|
|
9564
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
|
|
9541
9565
|
] }),
|
|
9542
9566
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9543
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9544
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(
|
|
9567
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(S), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
9568
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(S), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
|
|
9545
9569
|
] })
|
|
9546
|
-
] },
|
|
9570
|
+
] }, S)) })
|
|
9547
9571
|
] });
|
|
9548
9572
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9549
9573
|
const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9705,28 +9729,28 @@ const RootLayout = () => {
|
|
|
9705
9729
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
9706
9730
|
n("outline");
|
|
9707
9731
|
});
|
|
9708
|
-
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((
|
|
9709
|
-
|
|
9732
|
+
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((k) => {
|
|
9733
|
+
k.preventDefault();
|
|
9710
9734
|
}, []), m = useCallback(
|
|
9711
|
-
(
|
|
9712
|
-
n(r ===
|
|
9735
|
+
(k) => {
|
|
9736
|
+
n(r === k ? null : k);
|
|
9713
9737
|
},
|
|
9714
9738
|
[r]
|
|
9715
9739
|
), { t: f } = useTranslation(), x = useMemo(
|
|
9716
9740
|
() => [...p, ...u, ...g],
|
|
9717
9741
|
[p, u, g]
|
|
9718
|
-
),
|
|
9742
|
+
), y = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: r }) ?? first(x), A = get(b, "width", DEFAULT_PANEL_WIDTH);
|
|
9719
9743
|
useEffect(() => {
|
|
9720
9744
|
if (r !== null) {
|
|
9721
|
-
const
|
|
9722
|
-
|
|
9745
|
+
const k = find(x, { id: r });
|
|
9746
|
+
k && get(k, "view", "standard") === "standard" && (a.current = r, i(get(k, "width", DEFAULT_PANEL_WIDTH)));
|
|
9723
9747
|
}
|
|
9724
9748
|
}, [r, x]);
|
|
9725
|
-
const
|
|
9749
|
+
const _ = useMemo(() => {
|
|
9726
9750
|
if (r === null) return 0;
|
|
9727
|
-
const
|
|
9728
|
-
return get(
|
|
9729
|
-
}, [r, A, l, x]),
|
|
9751
|
+
const k = find(x, { id: r });
|
|
9752
|
+
return get(k, "view", "standard") === "standard" ? A : l;
|
|
9753
|
+
}, [r, A, l, x]), B = useCallback(() => {
|
|
9730
9754
|
n(a.current);
|
|
9731
9755
|
}, [n]), N = useCallback(() => {
|
|
9732
9756
|
n("outline");
|
|
@@ -9735,12 +9759,12 @@ const RootLayout = () => {
|
|
|
9735
9759
|
find(x, { id: r }) || n("outline");
|
|
9736
9760
|
}, [r, x]);
|
|
9737
9761
|
const w = useCallback(
|
|
9738
|
-
(
|
|
9739
|
-
m(
|
|
9762
|
+
(k) => {
|
|
9763
|
+
m(k);
|
|
9740
9764
|
},
|
|
9741
9765
|
[m]
|
|
9742
9766
|
);
|
|
9743
|
-
return /* @__PURE__ */ jsx("div", { dir:
|
|
9767
|
+
return /* @__PURE__ */ jsx("div", { dir: y, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
|
|
9744
9768
|
/* @__PURE__ */ jsxs(
|
|
9745
9769
|
"div",
|
|
9746
9770
|
{
|
|
@@ -9750,33 +9774,33 @@ const RootLayout = () => {
|
|
|
9750
9774
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9751
9775
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9752
9776
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9753
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9754
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9777
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((k, S) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9778
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(k, "button", NoopComponent), {
|
|
9755
9779
|
position: "top",
|
|
9756
|
-
panelId:
|
|
9757
|
-
isActive: r ===
|
|
9758
|
-
show: () => w(
|
|
9780
|
+
panelId: k.id,
|
|
9781
|
+
isActive: r === k.id,
|
|
9782
|
+
show: () => w(k.id)
|
|
9759
9783
|
}) }),
|
|
9760
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9761
|
-
] }, "button-top-" +
|
|
9784
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
|
|
9785
|
+
] }, "button-top-" + S)) }),
|
|
9762
9786
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9763
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((
|
|
9764
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9787
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((k, S) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9788
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(k, "button", NoopComponent), {
|
|
9765
9789
|
position: "bottom",
|
|
9766
|
-
panelId:
|
|
9767
|
-
isActive: r ===
|
|
9768
|
-
show: () => w(
|
|
9790
|
+
panelId: k.id,
|
|
9791
|
+
isActive: r === k.id,
|
|
9792
|
+
show: () => w(k.id)
|
|
9769
9793
|
}) }),
|
|
9770
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9771
|
-
] }, "button-bottom-" +
|
|
9794
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
|
|
9795
|
+
] }, "button-bottom-" + S)) })
|
|
9772
9796
|
] }),
|
|
9773
9797
|
/* @__PURE__ */ jsx(
|
|
9774
9798
|
motion.div,
|
|
9775
9799
|
{
|
|
9776
9800
|
id: "left-panel",
|
|
9777
9801
|
className: "h-full max-h-full border-r border-border",
|
|
9778
|
-
initial: { width:
|
|
9779
|
-
animate: { width:
|
|
9802
|
+
initial: { width: _ },
|
|
9803
|
+
animate: { width: _ },
|
|
9780
9804
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9781
9805
|
children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9782
9806
|
/* @__PURE__ */ jsx(
|
|
@@ -9832,7 +9856,7 @@ const RootLayout = () => {
|
|
|
9832
9856
|
}
|
|
9833
9857
|
),
|
|
9834
9858
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9835
|
-
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () =>
|
|
9859
|
+
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(
|
|
9836
9860
|
SheetContent,
|
|
9837
9861
|
{
|
|
9838
9862
|
side: "left",
|
|
@@ -9850,7 +9874,7 @@ const RootLayout = () => {
|
|
|
9850
9874
|
}
|
|
9851
9875
|
) }),
|
|
9852
9876
|
" ",
|
|
9853
|
-
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () =>
|
|
9877
|
+
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${A}px` }, children: [
|
|
9854
9878
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9855
9879
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9856
9880
|
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
@@ -9881,7 +9905,7 @@ const RootLayout = () => {
|
|
|
9881
9905
|
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9882
9906
|
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9883
9907
|
] }),
|
|
9884
|
-
/* @__PURE__ */ jsx(Button, { onClick: () =>
|
|
9908
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => B(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9885
9909
|
] }),
|
|
9886
9910
|
/* @__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(b, "panel", NoopComponent), {
|
|
9887
9911
|
close: N
|
|
@@ -9925,9 +9949,9 @@ const RootLayout = () => {
|
|
|
9925
9949
|
if (!l.trim()) return a;
|
|
9926
9950
|
const x = l.toLowerCase();
|
|
9927
9951
|
return Object.fromEntries(
|
|
9928
|
-
Object.entries(a).filter(([
|
|
9952
|
+
Object.entries(a).filter(([y, b]) => {
|
|
9929
9953
|
var A;
|
|
9930
|
-
return (
|
|
9954
|
+
return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((A = b == null ? void 0 : b.description) == null ? void 0 : A.toLowerCase().includes(x));
|
|
9931
9955
|
})
|
|
9932
9956
|
);
|
|
9933
9957
|
}, [a, l]), h = (x) => {
|
|
@@ -9937,8 +9961,8 @@ const RootLayout = () => {
|
|
|
9937
9961
|
});
|
|
9938
9962
|
}, m = (x) => {
|
|
9939
9963
|
if (!c) return;
|
|
9940
|
-
const
|
|
9941
|
-
n(
|
|
9964
|
+
const y = x.clientX - p.x, b = x.clientY - p.y, A = x.currentTarget, _ = A.offsetWidth, B = A.offsetHeight, N = window.innerWidth - _, w = window.innerHeight - B, k = Math.max(0, Math.min(y, N)), S = Math.max(0, Math.min(b, w));
|
|
9965
|
+
n(k, S);
|
|
9942
9966
|
}, f = () => {
|
|
9943
9967
|
d(!1);
|
|
9944
9968
|
};
|
|
@@ -10000,7 +10024,7 @@ const RootLayout = () => {
|
|
|
10000
10024
|
)
|
|
10001
10025
|
] })
|
|
10002
10026
|
] }),
|
|
10003
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([x,
|
|
10027
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([x, y]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: x, options: y }, x)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
10004
10028
|
'No features found matching "',
|
|
10005
10029
|
l,
|
|
10006
10030
|
'"'
|
|
@@ -10118,72 +10142,72 @@ const RootLayout = () => {
|
|
|
10118
10142
|
var x;
|
|
10119
10143
|
return (x = m.onMount) == null ? void 0 : x.call(m, f);
|
|
10120
10144
|
}, ...h) => {
|
|
10121
|
-
const m = h[0] || ((
|
|
10122
|
-
let E = o.get(
|
|
10123
|
-
return E || (E = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(
|
|
10145
|
+
const m = h[0] || ((S) => {
|
|
10146
|
+
let E = o.get(S);
|
|
10147
|
+
return E || (E = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(S, E), u == null || u(S, k)), E;
|
|
10124
10148
|
}), f = h[1] || (() => {
|
|
10125
|
-
let
|
|
10126
|
-
const v = (
|
|
10149
|
+
let S, E;
|
|
10150
|
+
const v = (C) => {
|
|
10127
10151
|
try {
|
|
10128
|
-
|
|
10152
|
+
C();
|
|
10129
10153
|
} catch (j) {
|
|
10130
|
-
|
|
10154
|
+
S || (S = !0, E = j);
|
|
10131
10155
|
}
|
|
10132
10156
|
};
|
|
10133
10157
|
do {
|
|
10134
10158
|
c.f && v(c.f);
|
|
10135
|
-
const
|
|
10136
|
-
a.forEach((
|
|
10159
|
+
const C = /* @__PURE__ */ new Set(), j = C.add.bind(C);
|
|
10160
|
+
a.forEach((I) => {
|
|
10137
10161
|
var L;
|
|
10138
|
-
return (L = r.get(
|
|
10139
|
-
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(),
|
|
10162
|
+
return (L = r.get(I)) == null ? void 0 : L.l.forEach(j);
|
|
10163
|
+
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), C.forEach(v), a.size && x();
|
|
10140
10164
|
} while (a.size || i.size || l.size);
|
|
10141
|
-
if (
|
|
10165
|
+
if (S)
|
|
10142
10166
|
throw E;
|
|
10143
10167
|
}), x = h[2] || (() => {
|
|
10144
|
-
const
|
|
10145
|
-
for (;
|
|
10146
|
-
const j =
|
|
10168
|
+
const S = [], E = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), C = Array.from(a);
|
|
10169
|
+
for (; C.length; ) {
|
|
10170
|
+
const j = C[C.length - 1], I = m(j);
|
|
10147
10171
|
if (v.has(j)) {
|
|
10148
|
-
|
|
10172
|
+
C.pop();
|
|
10149
10173
|
continue;
|
|
10150
10174
|
}
|
|
10151
10175
|
if (E.has(j)) {
|
|
10152
|
-
n.get(j) ===
|
|
10176
|
+
n.get(j) === I.n && S.push([j, I]), v.add(j), C.pop();
|
|
10153
10177
|
continue;
|
|
10154
10178
|
}
|
|
10155
10179
|
E.add(j);
|
|
10156
|
-
for (const L of getMountedOrPendingDependents(j,
|
|
10157
|
-
E.has(L) ||
|
|
10180
|
+
for (const L of getMountedOrPendingDependents(j, I, r))
|
|
10181
|
+
E.has(L) || C.push(L);
|
|
10158
10182
|
}
|
|
10159
|
-
for (let j =
|
|
10160
|
-
const [
|
|
10183
|
+
for (let j = S.length - 1; j >= 0; --j) {
|
|
10184
|
+
const [I, L] = S[j];
|
|
10161
10185
|
let R = !1;
|
|
10162
|
-
for (const
|
|
10163
|
-
if (
|
|
10186
|
+
for (const T of L.d.keys())
|
|
10187
|
+
if (T !== I && a.has(T)) {
|
|
10164
10188
|
R = !0;
|
|
10165
10189
|
break;
|
|
10166
10190
|
}
|
|
10167
|
-
R && (
|
|
10191
|
+
R && (y(I), _(I)), n.delete(I);
|
|
10168
10192
|
}
|
|
10169
|
-
}),
|
|
10193
|
+
}), y = h[3] || ((S) => {
|
|
10170
10194
|
var E, v;
|
|
10171
|
-
const
|
|
10172
|
-
if (isAtomStateInitialized(
|
|
10195
|
+
const C = m(S);
|
|
10196
|
+
if (isAtomStateInitialized(C) && (r.has(S) && n.get(S) !== C.n || Array.from(C.d).every(
|
|
10173
10197
|
([P, $]) => (
|
|
10174
10198
|
// Recursively, read the atom state of the dependency, and
|
|
10175
10199
|
// check if the atom epoch number is unchanged
|
|
10176
|
-
|
|
10200
|
+
y(P).n === $
|
|
10177
10201
|
)
|
|
10178
10202
|
)))
|
|
10179
|
-
return
|
|
10180
|
-
|
|
10203
|
+
return C;
|
|
10204
|
+
C.d.clear();
|
|
10181
10205
|
let j = !0;
|
|
10182
|
-
const
|
|
10183
|
-
r.has(
|
|
10206
|
+
const I = () => {
|
|
10207
|
+
r.has(S) && (_(S), x(), f());
|
|
10184
10208
|
}, L = (P) => {
|
|
10185
10209
|
var $;
|
|
10186
|
-
if (isSelfAtom(
|
|
10210
|
+
if (isSelfAtom(S, P)) {
|
|
10187
10211
|
const H = m(P);
|
|
10188
10212
|
if (!isAtomStateInitialized(H))
|
|
10189
10213
|
if (hasInitialValue(P))
|
|
@@ -10192,144 +10216,144 @@ const RootLayout = () => {
|
|
|
10192
10216
|
throw new Error("no atom init");
|
|
10193
10217
|
return returnAtomValue(H);
|
|
10194
10218
|
}
|
|
10195
|
-
const M =
|
|
10219
|
+
const M = y(P);
|
|
10196
10220
|
try {
|
|
10197
10221
|
return returnAtomValue(M);
|
|
10198
10222
|
} finally {
|
|
10199
|
-
|
|
10223
|
+
C.d.set(P, M.n), isPendingPromise(C.v) && addPendingPromiseToDependency(S, C.v, M), ($ = r.get(P)) == null || $.t.add(S), j || I();
|
|
10200
10224
|
}
|
|
10201
10225
|
};
|
|
10202
|
-
let R,
|
|
10226
|
+
let R, T;
|
|
10203
10227
|
const D = {
|
|
10204
10228
|
get signal() {
|
|
10205
10229
|
return R || (R = new AbortController()), R.signal;
|
|
10206
10230
|
},
|
|
10207
10231
|
get setSelf() {
|
|
10208
|
-
return !
|
|
10232
|
+
return !T && isActuallyWritableAtom(S) && (T = (...P) => {
|
|
10209
10233
|
if (!j)
|
|
10210
10234
|
try {
|
|
10211
|
-
return A(
|
|
10235
|
+
return A(S, ...P);
|
|
10212
10236
|
} finally {
|
|
10213
10237
|
x(), f();
|
|
10214
10238
|
}
|
|
10215
|
-
}),
|
|
10239
|
+
}), T;
|
|
10216
10240
|
}
|
|
10217
|
-
}, O =
|
|
10241
|
+
}, O = C.n;
|
|
10218
10242
|
try {
|
|
10219
|
-
const P = d(
|
|
10220
|
-
return setAtomStateValueOrPromise(
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
)),
|
|
10243
|
+
const P = d(S, L, D);
|
|
10244
|
+
return setAtomStateValueOrPromise(S, P, m), isPromiseLike$1(P) && ((E = P.onCancel) == null || E.call(P, () => R == null ? void 0 : R.abort()), P.then(
|
|
10245
|
+
I,
|
|
10246
|
+
I
|
|
10247
|
+
)), C;
|
|
10224
10248
|
} catch (P) {
|
|
10225
|
-
return delete
|
|
10249
|
+
return delete C.v, C.e = P, ++C.n, C;
|
|
10226
10250
|
} finally {
|
|
10227
|
-
j = !1, O !==
|
|
10251
|
+
j = !1, O !== C.n && n.get(S) === O && (n.set(S, C.n), a.add(S), (v = c.c) == null || v.call(c, S));
|
|
10228
10252
|
}
|
|
10229
|
-
}), b = h[4] || ((
|
|
10230
|
-
const E = [
|
|
10253
|
+
}), b = h[4] || ((S) => {
|
|
10254
|
+
const E = [S];
|
|
10231
10255
|
for (; E.length; ) {
|
|
10232
|
-
const v = E.pop(),
|
|
10233
|
-
for (const j of getMountedOrPendingDependents(v,
|
|
10234
|
-
const
|
|
10235
|
-
n.set(j,
|
|
10256
|
+
const v = E.pop(), C = m(v);
|
|
10257
|
+
for (const j of getMountedOrPendingDependents(v, C, r)) {
|
|
10258
|
+
const I = m(j);
|
|
10259
|
+
n.set(j, I.n), E.push(j);
|
|
10236
10260
|
}
|
|
10237
10261
|
}
|
|
10238
|
-
}), A = h[5] || ((
|
|
10262
|
+
}), A = h[5] || ((S, ...E) => {
|
|
10239
10263
|
let v = !0;
|
|
10240
|
-
const
|
|
10264
|
+
const C = (I) => returnAtomValue(y(I)), j = (I, ...L) => {
|
|
10241
10265
|
var R;
|
|
10242
|
-
const
|
|
10266
|
+
const T = m(I);
|
|
10243
10267
|
try {
|
|
10244
|
-
if (isSelfAtom(
|
|
10245
|
-
if (!hasInitialValue(
|
|
10268
|
+
if (isSelfAtom(S, I)) {
|
|
10269
|
+
if (!hasInitialValue(I))
|
|
10246
10270
|
throw new Error("atom not writable");
|
|
10247
|
-
const D =
|
|
10248
|
-
setAtomStateValueOrPromise(
|
|
10271
|
+
const D = T.n, O = L[0];
|
|
10272
|
+
setAtomStateValueOrPromise(I, O, m), _(I), D !== T.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
|
|
10249
10273
|
return;
|
|
10250
10274
|
} else
|
|
10251
|
-
return A(
|
|
10275
|
+
return A(I, ...L);
|
|
10252
10276
|
} finally {
|
|
10253
10277
|
v || (x(), f());
|
|
10254
10278
|
}
|
|
10255
10279
|
};
|
|
10256
10280
|
try {
|
|
10257
|
-
return p(
|
|
10281
|
+
return p(S, C, j, ...E);
|
|
10258
10282
|
} finally {
|
|
10259
10283
|
v = !1;
|
|
10260
10284
|
}
|
|
10261
|
-
}),
|
|
10285
|
+
}), _ = h[6] || ((S) => {
|
|
10262
10286
|
var E;
|
|
10263
|
-
const v = m(
|
|
10264
|
-
if (
|
|
10265
|
-
for (const [j,
|
|
10266
|
-
if (!
|
|
10287
|
+
const v = m(S), C = r.get(S);
|
|
10288
|
+
if (C && !isPendingPromise(v.v)) {
|
|
10289
|
+
for (const [j, I] of v.d)
|
|
10290
|
+
if (!C.d.has(j)) {
|
|
10267
10291
|
const L = m(j);
|
|
10268
|
-
|
|
10292
|
+
B(j).t.add(S), C.d.add(j), I !== L.n && (a.add(j), (E = c.c) == null || E.call(c, j), b(j));
|
|
10269
10293
|
}
|
|
10270
|
-
for (const j of
|
|
10294
|
+
for (const j of C.d || [])
|
|
10271
10295
|
if (!v.d.has(j)) {
|
|
10272
|
-
|
|
10273
|
-
const
|
|
10274
|
-
|
|
10296
|
+
C.d.delete(j);
|
|
10297
|
+
const I = N(j);
|
|
10298
|
+
I == null || I.t.delete(S);
|
|
10275
10299
|
}
|
|
10276
10300
|
}
|
|
10277
|
-
}),
|
|
10301
|
+
}), B = h[7] || ((S) => {
|
|
10278
10302
|
var E;
|
|
10279
|
-
const v = m(
|
|
10280
|
-
let
|
|
10281
|
-
if (!
|
|
10282
|
-
|
|
10303
|
+
const v = m(S);
|
|
10304
|
+
let C = r.get(S);
|
|
10305
|
+
if (!C) {
|
|
10306
|
+
y(S);
|
|
10283
10307
|
for (const j of v.d.keys())
|
|
10284
|
-
|
|
10285
|
-
if (
|
|
10308
|
+
B(j).t.add(S);
|
|
10309
|
+
if (C = {
|
|
10286
10310
|
l: /* @__PURE__ */ new Set(),
|
|
10287
10311
|
d: new Set(v.d.keys()),
|
|
10288
10312
|
t: /* @__PURE__ */ new Set()
|
|
10289
|
-
}, r.set(
|
|
10313
|
+
}, r.set(S, C), (E = c.m) == null || E.call(c, S), isActuallyWritableAtom(S)) {
|
|
10290
10314
|
const j = () => {
|
|
10291
|
-
let
|
|
10315
|
+
let I = !0;
|
|
10292
10316
|
const L = (...R) => {
|
|
10293
10317
|
try {
|
|
10294
|
-
return A(
|
|
10318
|
+
return A(S, ...R);
|
|
10295
10319
|
} finally {
|
|
10296
|
-
|
|
10320
|
+
I || (x(), f());
|
|
10297
10321
|
}
|
|
10298
10322
|
};
|
|
10299
10323
|
try {
|
|
10300
|
-
const R = g(
|
|
10301
|
-
R && (
|
|
10302
|
-
|
|
10324
|
+
const R = g(S, L);
|
|
10325
|
+
R && (C.u = () => {
|
|
10326
|
+
I = !0;
|
|
10303
10327
|
try {
|
|
10304
10328
|
R();
|
|
10305
10329
|
} finally {
|
|
10306
|
-
|
|
10330
|
+
I = !1;
|
|
10307
10331
|
}
|
|
10308
10332
|
});
|
|
10309
10333
|
} finally {
|
|
10310
|
-
|
|
10334
|
+
I = !1;
|
|
10311
10335
|
}
|
|
10312
10336
|
};
|
|
10313
10337
|
l.add(j);
|
|
10314
10338
|
}
|
|
10315
10339
|
}
|
|
10316
|
-
return
|
|
10317
|
-
}), N = h[8] || ((
|
|
10340
|
+
return C;
|
|
10341
|
+
}), N = h[8] || ((S) => {
|
|
10318
10342
|
var E;
|
|
10319
|
-
const v = m(
|
|
10320
|
-
let
|
|
10321
|
-
if (
|
|
10322
|
-
var
|
|
10323
|
-
return (
|
|
10343
|
+
const v = m(S);
|
|
10344
|
+
let C = r.get(S);
|
|
10345
|
+
if (C && !C.l.size && !Array.from(C.t).some((j) => {
|
|
10346
|
+
var I;
|
|
10347
|
+
return (I = r.get(j)) == null ? void 0 : I.d.has(S);
|
|
10324
10348
|
})) {
|
|
10325
|
-
|
|
10349
|
+
C.u && i.add(C.u), C = void 0, r.delete(S), (E = c.u) == null || E.call(c, S);
|
|
10326
10350
|
for (const j of v.d.keys()) {
|
|
10327
|
-
const
|
|
10328
|
-
|
|
10351
|
+
const I = N(j);
|
|
10352
|
+
I == null || I.t.delete(S);
|
|
10329
10353
|
}
|
|
10330
10354
|
return;
|
|
10331
10355
|
}
|
|
10332
|
-
return
|
|
10356
|
+
return C;
|
|
10333
10357
|
}), w = [
|
|
10334
10358
|
// store state
|
|
10335
10359
|
o,
|
|
@@ -10348,29 +10372,29 @@ const RootLayout = () => {
|
|
|
10348
10372
|
m,
|
|
10349
10373
|
f,
|
|
10350
10374
|
x,
|
|
10351
|
-
|
|
10375
|
+
y,
|
|
10352
10376
|
b,
|
|
10353
10377
|
A,
|
|
10354
|
-
B,
|
|
10355
10378
|
_,
|
|
10379
|
+
B,
|
|
10356
10380
|
N
|
|
10357
|
-
],
|
|
10358
|
-
get: (
|
|
10359
|
-
set: (
|
|
10381
|
+
], k = {
|
|
10382
|
+
get: (S) => returnAtomValue(y(S)),
|
|
10383
|
+
set: (S, ...E) => {
|
|
10360
10384
|
try {
|
|
10361
|
-
return A(
|
|
10385
|
+
return A(S, ...E);
|
|
10362
10386
|
} finally {
|
|
10363
10387
|
x(), f();
|
|
10364
10388
|
}
|
|
10365
10389
|
},
|
|
10366
|
-
sub: (
|
|
10367
|
-
const
|
|
10368
|
-
return
|
|
10369
|
-
|
|
10390
|
+
sub: (S, E) => {
|
|
10391
|
+
const C = B(S).l;
|
|
10392
|
+
return C.add(E), f(), () => {
|
|
10393
|
+
C.delete(E), N(S), f();
|
|
10370
10394
|
};
|
|
10371
10395
|
}
|
|
10372
10396
|
};
|
|
10373
|
-
return Object.defineProperty(
|
|
10397
|
+
return Object.defineProperty(k, BUILDING_BLOCKS, { value: w }), k;
|
|
10374
10398
|
}, INTERNAL_buildStoreRev1 = buildStore, createStore = () => INTERNAL_buildStoreRev1();
|
|
10375
10399
|
let defaultStore;
|
|
10376
10400
|
const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore), StoreContext = createContext(
|
|
@@ -10517,7 +10541,7 @@ export {
|
|
|
10517
10541
|
getBlocksFromHTML as convertHTMLToChaiBlocks,
|
|
10518
10542
|
generateUUID as generateBlockId,
|
|
10519
10543
|
getBlocksFromHTML,
|
|
10520
|
-
|
|
10544
|
+
ze as i18n,
|
|
10521
10545
|
cn$2 as mergeClasses,
|
|
10522
10546
|
registerBlockSettingField,
|
|
10523
10547
|
registerBlockSettingTemplate,
|