@chaibuilder/sdk 2.3.6 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +4 -4
- package/dist/core.d.ts +2 -0
- package/dist/core.js +474 -407
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +4 -3
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -10,8 +10,8 @@ import React__default, { useMemo, useCallback, useEffect, useState, useRef, Comp
|
|
|
10
10
|
import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
|
|
11
11
|
import { atomWithStorage, splitAtom, useAtomCallback } from "jotai/utils";
|
|
12
12
|
import { g as generateUUID, a as getBreakpointValue, c as cn$2 } from "./common-functions-BGzDsf1z.js";
|
|
13
|
-
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, 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, 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, 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, aY as Switch, r as Avatar, aL as Separator,
|
|
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, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
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, 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, aY as Switch, r as Avatar, aL as Separator, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-BKtuoy5e.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, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, 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";
|
|
@@ -343,16 +343,16 @@ function insertBlocksAtPosition(o, n, r, a) {
|
|
|
343
343
|
_type: "Text",
|
|
344
344
|
content: u.content
|
|
345
345
|
};
|
|
346
|
-
Object.keys(u).forEach((
|
|
347
|
-
|
|
348
|
-
}), l.unshift(m), i = i.map((
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
return Object.keys(
|
|
352
|
-
y.startsWith("content-") && (
|
|
353
|
-
}),
|
|
346
|
+
Object.keys(u).forEach((f) => {
|
|
347
|
+
f.startsWith("content-") && (m[f] = u[f]);
|
|
348
|
+
}), l.unshift(m), i = i.map((f) => {
|
|
349
|
+
if (f._id === r) {
|
|
350
|
+
const x = { ...f, content: "" };
|
|
351
|
+
return Object.keys(x).forEach((y) => {
|
|
352
|
+
y.startsWith("content-") && (x[y] = "");
|
|
353
|
+
}), x;
|
|
354
354
|
}
|
|
355
|
-
return
|
|
355
|
+
return f;
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -480,15 +480,15 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
|
|
|
480
480
|
if (g.length === 2) {
|
|
481
481
|
const h = g.find((m) => m._id !== d);
|
|
482
482
|
if (h && h._type === "Text") {
|
|
483
|
-
const m = r.find((
|
|
484
|
-
m && "content" in m && (r = r.map((
|
|
485
|
-
if (
|
|
486
|
-
const
|
|
483
|
+
const m = r.find((f) => f._id === u);
|
|
484
|
+
m && "content" in m && (r = r.map((f) => {
|
|
485
|
+
if (f._id === u) {
|
|
486
|
+
const x = { ...f, content: h.content };
|
|
487
487
|
return Object.keys(h).forEach((y) => {
|
|
488
|
-
y.startsWith("content-") && (
|
|
489
|
-
}),
|
|
488
|
+
y.startsWith("content-") && (x[y] = h[y]);
|
|
489
|
+
}), x;
|
|
490
490
|
}
|
|
491
|
-
return
|
|
491
|
+
return f;
|
|
492
492
|
}), a.push(h._id));
|
|
493
493
|
}
|
|
494
494
|
}
|
|
@@ -571,32 +571,32 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
|
|
|
571
571
|
status: "idle",
|
|
572
572
|
props: {},
|
|
573
573
|
error: void 0
|
|
574
|
-
}), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (
|
|
574
|
+
}), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (f) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), h = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
|
|
575
575
|
return useEffect(() => {
|
|
576
576
|
if (n === "mock") {
|
|
577
577
|
if (isFunction(a)) {
|
|
578
|
-
i((
|
|
579
|
-
const
|
|
580
|
-
if (!isObject(
|
|
578
|
+
i((x) => ({ ...x, status: "loading", props: {} }));
|
|
579
|
+
const f = a({ block: o });
|
|
580
|
+
if (!isObject(f))
|
|
581
581
|
throw new Error("mockDataProvider should return an object");
|
|
582
|
-
i((
|
|
582
|
+
i((x) => ({ ...x, status: "loaded", props: f }));
|
|
583
583
|
}
|
|
584
584
|
return;
|
|
585
585
|
}
|
|
586
|
-
n === "live" && (!g && !h || (i((
|
|
587
|
-
g ? (p((
|
|
588
|
-
...
|
|
586
|
+
n === "live" && (!g && !h || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
|
|
587
|
+
g ? (p((x) => ({
|
|
588
|
+
...x,
|
|
589
589
|
[o._id]: {
|
|
590
590
|
status: "loaded",
|
|
591
|
-
props: get(
|
|
591
|
+
props: get(f, "items", []),
|
|
592
592
|
repeaterItems: o.repeaterItems
|
|
593
593
|
}
|
|
594
|
-
})), i((
|
|
595
|
-
}).catch((
|
|
596
|
-
g ? (p((
|
|
597
|
-
...
|
|
598
|
-
[o._id]: { status: "error", error:
|
|
599
|
-
})), i((
|
|
594
|
+
})), i((x) => ({ ...x, status: "loaded", props: { totalItems: get(f, "totalItems") } })), c([o._id], { totalItems: get(f, "totalItems") })) : i((x) => ({ ...x, status: "loaded", props: isObject(f) ? f : {} }));
|
|
595
|
+
}).catch((f) => {
|
|
596
|
+
g ? (p((x) => ({
|
|
597
|
+
...x,
|
|
598
|
+
[o._id]: { status: "error", error: f, props: [] }
|
|
599
|
+
})), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
|
|
600
600
|
})));
|
|
601
601
|
}, [o == null ? void 0 : o._id, u, g, h, a, n]), {
|
|
602
602
|
$loading: get(l, "status") === "loading",
|
|
@@ -810,65 +810,65 @@ const undoRedoStateAtom = atom({
|
|
|
810
810
|
updateBlocksProps: c
|
|
811
811
|
} = useBlocksStoreManager();
|
|
812
812
|
return {
|
|
813
|
-
moveBlocks: (
|
|
814
|
-
const v = map(
|
|
813
|
+
moveBlocks: (x, y, b) => {
|
|
814
|
+
const v = map(x, (w) => {
|
|
815
815
|
const E = n.find((N) => N._id === w)._parent || null, A = n.filter((N) => E ? N._parent === E : !N._parent).map((N) => N._id).indexOf(w);
|
|
816
816
|
return { _id: w, oldParent: E, oldPosition: A };
|
|
817
|
-
}), B = v.find(({ _id: w }) => w ===
|
|
818
|
-
B && B.oldParent === y && B.oldPosition === b || (i(
|
|
817
|
+
}), B = v.find(({ _id: w }) => w === x[0]);
|
|
818
|
+
B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
|
|
819
819
|
undo: () => each(v, ({ _id: w, oldParent: _, oldPosition: E }) => {
|
|
820
820
|
i([w], _, E);
|
|
821
821
|
}),
|
|
822
|
-
redo: () => i(
|
|
822
|
+
redo: () => i(x, y, b)
|
|
823
823
|
}));
|
|
824
824
|
},
|
|
825
|
-
addBlocks: (
|
|
826
|
-
a(
|
|
827
|
-
undo: () => l(map(
|
|
828
|
-
redo: () => a(
|
|
825
|
+
addBlocks: (x, y, b) => {
|
|
826
|
+
a(x, y, b), o({
|
|
827
|
+
undo: () => l(map(x, "_id")),
|
|
828
|
+
redo: () => a(x, y, b)
|
|
829
829
|
});
|
|
830
830
|
},
|
|
831
|
-
removeBlocks: (
|
|
831
|
+
removeBlocks: (x) => {
|
|
832
832
|
var B;
|
|
833
|
-
const y = (B = first(
|
|
834
|
-
l(map(
|
|
835
|
-
undo: () => a(
|
|
836
|
-
redo: () => l(map(
|
|
833
|
+
const y = (B = first(x)) == null ? void 0 : B._parent, v = n.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
|
|
834
|
+
l(map(x, "_id")), o({
|
|
835
|
+
undo: () => a(x, y, v),
|
|
836
|
+
redo: () => l(map(x, "_id"))
|
|
837
837
|
});
|
|
838
838
|
},
|
|
839
|
-
updateBlocks: (
|
|
839
|
+
updateBlocks: (x, y, b) => {
|
|
840
840
|
let v = [];
|
|
841
841
|
if (b)
|
|
842
|
-
v = map(
|
|
842
|
+
v = map(x, (B) => ({ _id: B, ...b }));
|
|
843
843
|
else {
|
|
844
844
|
const B = keys(y);
|
|
845
|
-
v = map(
|
|
845
|
+
v = map(x, (w) => {
|
|
846
846
|
const _ = n.find((S) => S._id === w), E = { _id: w };
|
|
847
847
|
return each(B, (S) => E[S] = _[S]), E;
|
|
848
848
|
});
|
|
849
849
|
}
|
|
850
|
-
c(map(
|
|
850
|
+
c(map(x, (B) => ({ _id: B, ...y }))), o({
|
|
851
851
|
undo: () => c(v),
|
|
852
|
-
redo: () => c(map(
|
|
852
|
+
redo: () => c(map(x, (B) => ({ _id: B, ...y })))
|
|
853
853
|
});
|
|
854
854
|
},
|
|
855
|
-
updateBlocksRuntime: (
|
|
856
|
-
c(map(
|
|
855
|
+
updateBlocksRuntime: (x, y) => {
|
|
856
|
+
c(map(x, (b) => ({ _id: b, ...y })));
|
|
857
857
|
},
|
|
858
|
-
setNewBlocks: (
|
|
859
|
-
r(
|
|
858
|
+
setNewBlocks: (x) => {
|
|
859
|
+
r(x), o({
|
|
860
860
|
undo: () => r(n),
|
|
861
|
-
redo: () => r(
|
|
861
|
+
redo: () => r(x)
|
|
862
862
|
});
|
|
863
863
|
},
|
|
864
|
-
updateMultipleBlocksProps: (
|
|
864
|
+
updateMultipleBlocksProps: (x) => {
|
|
865
865
|
let y = [];
|
|
866
|
-
y = map(
|
|
866
|
+
y = map(x, (b) => {
|
|
867
867
|
const v = keys(b), B = n.find((_) => _._id === b._id), w = {};
|
|
868
868
|
return each(v, (_) => w[_] = B[_]), w;
|
|
869
|
-
}), c(
|
|
869
|
+
}), c(x), o({
|
|
870
870
|
undo: () => c(y),
|
|
871
|
-
redo: () => c(
|
|
871
|
+
redo: () => c(x)
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
874
|
};
|
|
@@ -876,12 +876,12 @@ const undoRedoStateAtom = atom({
|
|
|
876
876
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
877
877
|
(i, c, d) => {
|
|
878
878
|
var m;
|
|
879
|
-
for (let
|
|
880
|
-
const { _id:
|
|
881
|
-
i[
|
|
882
|
-
const y = filter(i, { _parent:
|
|
879
|
+
for (let f = 0; f < i.length; f++) {
|
|
880
|
+
const { _id: x } = i[f];
|
|
881
|
+
i[f]._id = generateUUID();
|
|
882
|
+
const y = filter(i, { _parent: x });
|
|
883
883
|
for (let b = 0; b < y.length; b++)
|
|
884
|
-
y[b]._parent = i[
|
|
884
|
+
y[b]._parent = i[f]._id;
|
|
885
885
|
}
|
|
886
886
|
const p = first(i);
|
|
887
887
|
let u, g;
|
|
@@ -2343,25 +2343,25 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2343
2343
|
return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
|
|
2344
2344
|
})
|
|
2345
2345
|
), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
|
|
2346
|
-
const [o, n] = useAtom$1(askAiProcessingAtom), [r, 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,
|
|
2347
|
-
const
|
|
2348
|
-
for (const y in
|
|
2349
|
-
const b =
|
|
2346
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, 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) => {
|
|
2347
|
+
const x = cloneDeep(f.find((y) => y._id === m));
|
|
2348
|
+
for (const y in x) {
|
|
2349
|
+
const b = x[y];
|
|
2350
2350
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2351
2351
|
const { baseClasses: v, classes: B } = getSplitChaiClasses(b);
|
|
2352
|
-
|
|
2352
|
+
x[y] = compact(flattenDeep([v, B])).join(" ");
|
|
2353
2353
|
} else
|
|
2354
|
-
y !== "_id" && delete
|
|
2354
|
+
y !== "_id" && delete x[y];
|
|
2355
2355
|
}
|
|
2356
|
-
return
|
|
2356
|
+
return x;
|
|
2357
2357
|
};
|
|
2358
2358
|
return {
|
|
2359
2359
|
askAi: useCallback(
|
|
2360
|
-
async (m,
|
|
2360
|
+
async (m, f, x, y) => {
|
|
2361
2361
|
if (l) {
|
|
2362
2362
|
n(!0), a(null);
|
|
2363
2363
|
try {
|
|
2364
|
-
const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(
|
|
2364
|
+
const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], B = await l(m, addLangToPrompt(x, g, m), v, b), { blocks: w, error: _ } = B;
|
|
2365
2365
|
if (_) {
|
|
2366
2366
|
a(_);
|
|
2367
2367
|
return;
|
|
@@ -2473,12 +2473,12 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2473
2473
|
if (!p)
|
|
2474
2474
|
return h;
|
|
2475
2475
|
let m = [];
|
|
2476
|
-
for (const
|
|
2477
|
-
if (
|
|
2478
|
-
let
|
|
2479
|
-
|
|
2476
|
+
for (const f of h)
|
|
2477
|
+
if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
|
|
2478
|
+
let x = l(f.partialBlockId);
|
|
2479
|
+
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];
|
|
2480
2480
|
} else
|
|
2481
|
-
m.push(
|
|
2481
|
+
m.push(f);
|
|
2482
2482
|
return m;
|
|
2483
2483
|
})
|
|
2484
2484
|
};
|
|
@@ -2661,13 +2661,13 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2661
2661
|
const d = o(c), p = a;
|
|
2662
2662
|
let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
|
|
2663
2663
|
return each(p, (h) => {
|
|
2664
|
-
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2665
|
-
u = u.replace(
|
|
2666
|
-
const
|
|
2667
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2664
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2665
|
+
u = u.replace(f, " ").replace(/\s+/g, " ").trim();
|
|
2666
|
+
const x = first(h.split(":"));
|
|
2667
|
+
includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(h.split(":").pop().trim());
|
|
2668
2668
|
}), each(p, (h) => {
|
|
2669
|
-
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2670
|
-
g = g.replace(
|
|
2669
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2670
|
+
g = g.replace(f, " ").replace(/\s+/g, " ").trim();
|
|
2671
2671
|
}), {
|
|
2672
2672
|
ids: [d._id],
|
|
2673
2673
|
props: {
|
|
@@ -2675,7 +2675,23 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2675
2675
|
}
|
|
2676
2676
|
};
|
|
2677
2677
|
});
|
|
2678
|
-
}),
|
|
2678
|
+
}), removeAllClassesForBlock = (o) => {
|
|
2679
|
+
const n = Object.keys(o).filter(
|
|
2680
|
+
(a) => typeof o[a] == "string" && o[a].startsWith(STYLES_KEY)
|
|
2681
|
+
), r = {};
|
|
2682
|
+
return n.forEach((a) => {
|
|
2683
|
+
r[a] = `${STYLES_KEY},`;
|
|
2684
|
+
}), {
|
|
2685
|
+
ids: [o._id],
|
|
2686
|
+
props: r
|
|
2687
|
+
};
|
|
2688
|
+
}, useRemoveAllClassesForBlock = () => {
|
|
2689
|
+
const { updateBlocks: o, updateBlocksRuntime: n } = useBlocksStoreUndoableActions();
|
|
2690
|
+
return useCallback((r, a = !1) => {
|
|
2691
|
+
const { ids: l, props: i } = removeAllClassesForBlock(r);
|
|
2692
|
+
a ? o(l, i) : n(l, i);
|
|
2693
|
+
}, [o, n]);
|
|
2694
|
+
}, useRemoveClassesFromBlocks = () => {
|
|
2679
2695
|
const { updateBlocks: o, updateBlocksRuntime: n } = useBlocksStoreUndoableActions(), r = useSetAtom$1(removeClassFromBlocksAtom);
|
|
2680
2696
|
return useCallback(
|
|
2681
2697
|
(a, l, i = !1) => {
|
|
@@ -2800,21 +2816,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
|
|
|
2800
2816
|
return "VERTICAL";
|
|
2801
2817
|
}
|
|
2802
2818
|
}, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
|
|
2803
|
-
const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (
|
|
2804
|
-
(
|
|
2805
|
-
isDisabledControl(g, h,
|
|
2819
|
+
const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (x) => c ? get(x, "_parent") === c : !get(x, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, h = u + 1 === (d == null ? void 0 : d.length), m = getParentBlockOrientation(c, i, a), f = useCallback(
|
|
2820
|
+
(x) => {
|
|
2821
|
+
isDisabledControl(g, h, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
|
|
2806
2822
|
},
|
|
2807
2823
|
[g, h, p, u, i, c, n]
|
|
2808
2824
|
);
|
|
2809
2825
|
return useHotkeys(
|
|
2810
2826
|
"shift+up, shift+down, shift+left, shift+right",
|
|
2811
|
-
({ key:
|
|
2827
|
+
({ key: x }) => {
|
|
2812
2828
|
var y;
|
|
2813
|
-
|
|
2829
|
+
f((y = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
|
|
2814
2830
|
},
|
|
2815
2831
|
{ document: a == null ? void 0 : a.contentDocument },
|
|
2816
|
-
[
|
|
2817
|
-
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock:
|
|
2832
|
+
[f]
|
|
2833
|
+
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: f, orientation: m };
|
|
2818
2834
|
}, BlockController = ({ block: o, updateFloatingBar: n }) => {
|
|
2819
2835
|
const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
|
|
2820
2836
|
o,
|
|
@@ -2960,7 +2976,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
2960
2976
|
elements: { reference: n }
|
|
2961
2977
|
});
|
|
2962
2978
|
useResizeObserver(n, () => m(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
|
|
2963
|
-
const
|
|
2979
|
+
const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
2964
2980
|
return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
2965
2981
|
"div",
|
|
2966
2982
|
{
|
|
@@ -2977,16 +2993,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
2977
2993
|
onKeyDown: (y) => y.stopPropagation(),
|
|
2978
2994
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
2979
2995
|
children: [
|
|
2980
|
-
|
|
2996
|
+
f && /* @__PURE__ */ jsx(
|
|
2981
2997
|
ArrowUpIcon,
|
|
2982
2998
|
{
|
|
2983
2999
|
className: "hover:scale-105",
|
|
2984
3000
|
onClick: () => {
|
|
2985
|
-
c([]), l([
|
|
3001
|
+
c([]), l([f]);
|
|
2986
3002
|
}
|
|
2987
3003
|
}
|
|
2988
3004
|
),
|
|
2989
|
-
/* @__PURE__ */ jsx(BlockActionLabel, { label:
|
|
3005
|
+
/* @__PURE__ */ jsx(BlockActionLabel, { label: x, block: o }),
|
|
2990
3006
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
|
|
2991
3007
|
/* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
|
|
2992
3008
|
canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
|
|
@@ -3144,8 +3160,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3144
3160
|
i
|
|
3145
3161
|
]), useHotkeys(
|
|
3146
3162
|
"del, backspace",
|
|
3147
|
-
(
|
|
3148
|
-
|
|
3163
|
+
(f) => {
|
|
3164
|
+
f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
|
|
3149
3165
|
},
|
|
3150
3166
|
m,
|
|
3151
3167
|
[n, l]
|
|
@@ -3438,8 +3454,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3438
3454
|
],
|
|
3439
3455
|
onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
|
|
3440
3456
|
onBlur: ({ editor: u, event: g }) => {
|
|
3441
|
-
const h = g.relatedTarget, m = i.querySelector(".ProseMirror"),
|
|
3442
|
-
if (!
|
|
3457
|
+
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);
|
|
3458
|
+
if (!x && !y) {
|
|
3443
3459
|
const b = (u == null ? void 0 : u.getHTML()) || "";
|
|
3444
3460
|
r(b);
|
|
3445
3461
|
}
|
|
@@ -3494,14 +3510,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3494
3510
|
useEffect(() => {
|
|
3495
3511
|
if (a.current) {
|
|
3496
3512
|
a.current.innerText = n, a.current.focus();
|
|
3497
|
-
const m = c.createRange(),
|
|
3498
|
-
m.selectNodeContents(a.current), m.collapse(!1),
|
|
3513
|
+
const m = c.createRange(), f = d.getSelection();
|
|
3514
|
+
m.selectNodeContents(a.current), m.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(m), a.current.focus();
|
|
3499
3515
|
} else
|
|
3500
3516
|
r();
|
|
3501
3517
|
}, [c, d]);
|
|
3502
3518
|
const p = useMemo(() => {
|
|
3503
|
-
var
|
|
3504
|
-
const m = ((
|
|
3519
|
+
var f;
|
|
3520
|
+
const m = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
|
|
3505
3521
|
return m === "button" ? "div" : m;
|
|
3506
3522
|
}, [o]), u = useCallback(
|
|
3507
3523
|
(m) => {
|
|
@@ -3517,12 +3533,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3517
3533
|
contentEditable: !0,
|
|
3518
3534
|
className: `${((m = o == null ? void 0 : o.className) == null ? void 0 : m.replace("sr-only", "")) || ""} outline outline-[2px] outline-green-500 shadow-none empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 empty:before:absolute empty:before:pointer-events-none empty:before:select-none empty:before:inset-0 empty:before:z-0 relative min-h-[1em]`,
|
|
3519
3535
|
style: cloneDeep(o == null ? void 0 : o.style) || {},
|
|
3520
|
-
onInput: (
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3536
|
+
onInput: (f) => {
|
|
3537
|
+
const x = f.target;
|
|
3538
|
+
x && (x.innerText.trim() === "" ? (x.setAttribute("data-placeholder", "Enter text here"), x.children.length > 0 && x.children[0].remove()) : f.target.removeAttribute("data-placeholder"), l(f.target.innerText));
|
|
3523
3539
|
},
|
|
3524
|
-
onClick: (
|
|
3525
|
-
|
|
3540
|
+
onClick: (f) => {
|
|
3541
|
+
f.stopPropagation(), f.preventDefault();
|
|
3526
3542
|
}
|
|
3527
3543
|
};
|
|
3528
3544
|
}, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
|
|
@@ -3535,33 +3551,33 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3535
3551
|
}
|
|
3536
3552
|
), WithBlockTextEditor = memo(
|
|
3537
3553
|
({ block: o, children: n }) => {
|
|
3538
|
-
const r = "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:
|
|
3554
|
+
const r = "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: v, blockType: B } = useMemo(() => {
|
|
3539
3555
|
var j;
|
|
3540
3556
|
const A = o._type;
|
|
3541
3557
|
let N = o[r];
|
|
3542
3558
|
const C = getRegisteredChaiBlock(o._type);
|
|
3543
|
-
return
|
|
3544
|
-
}, [o,
|
|
3559
|
+
return f && ((j = C == null ? void 0 : C.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${f}`) && (N = get(o, `${r}-${f}`)), { blockContent: N, blockType: A };
|
|
3560
|
+
}, [o, f]), w = useCallback(
|
|
3545
3561
|
(A) => {
|
|
3546
3562
|
var C;
|
|
3547
3563
|
const N = A || ((C = g.current) == null ? void 0 : C.innerText);
|
|
3548
|
-
m([b], { [r]: N }), u(null), c(null), d(-1),
|
|
3564
|
+
m([b], { [r]: N }), u(null), c(null), d(-1), x([]);
|
|
3549
3565
|
},
|
|
3550
|
-
[b, m, c,
|
|
3566
|
+
[b, m, c, x, f]
|
|
3551
3567
|
), _ = useDebouncedCallback(
|
|
3552
3568
|
(A) => {
|
|
3553
3569
|
m([b], { [r]: A });
|
|
3554
3570
|
},
|
|
3555
|
-
[b, o, m,
|
|
3571
|
+
[b, o, m, f],
|
|
3556
3572
|
1e3
|
|
3557
3573
|
), E = useCallback(
|
|
3558
3574
|
(A) => {
|
|
3559
3575
|
A.preventDefault(), b && (y.current = b), w(), setTimeout(() => {
|
|
3560
3576
|
const N = y.current;
|
|
3561
|
-
y.current = null,
|
|
3577
|
+
y.current = null, x([N]);
|
|
3562
3578
|
}, 100);
|
|
3563
3579
|
},
|
|
3564
|
-
[
|
|
3580
|
+
[x, b, f]
|
|
3565
3581
|
);
|
|
3566
3582
|
useEffect(() => {
|
|
3567
3583
|
var k;
|
|
@@ -3588,7 +3604,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3588
3604
|
onChange: _,
|
|
3589
3605
|
onEscape: E
|
|
3590
3606
|
}
|
|
3591
|
-
)) : null, [p, b, B, v, w,
|
|
3607
|
+
)) : null, [p, b, B, v, w, f]);
|
|
3592
3608
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3593
3609
|
S,
|
|
3594
3610
|
n
|
|
@@ -3623,18 +3639,18 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3623
3639
|
blockAtom: n,
|
|
3624
3640
|
children: r
|
|
3625
3641
|
}) => {
|
|
3626
|
-
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom),
|
|
3642
|
+
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: y } = useContext(RepeaterContext), b = useMemo(
|
|
3627
3643
|
() => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
|
|
3628
|
-
index:
|
|
3644
|
+
index: x,
|
|
3629
3645
|
key: y
|
|
3630
3646
|
}) : applyLanguage(i, d, c),
|
|
3631
|
-
[i, d, c, g, m,
|
|
3647
|
+
[i, d, c, g, m, x, y]
|
|
3632
3648
|
), v = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
|
|
3633
3649
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3634
3650
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3635
3651
|
), w = useMemo(
|
|
3636
3652
|
() => ({
|
|
3637
|
-
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index":
|
|
3653
|
+
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
|
|
3638
3654
|
inBuilder: !0,
|
|
3639
3655
|
lang: d || p,
|
|
3640
3656
|
...b,
|
|
@@ -3653,8 +3669,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3653
3669
|
o
|
|
3654
3670
|
]
|
|
3655
3671
|
), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3656
|
-
if (isNull(
|
|
3657
|
-
let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(
|
|
3672
|
+
if (isNull(f) || h.includes(i._id)) return null;
|
|
3673
|
+
let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
3658
3674
|
...w,
|
|
3659
3675
|
children: r({
|
|
3660
3676
|
_id: i._id,
|
|
@@ -3667,7 +3683,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3667
3683
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3668
3684
|
})
|
|
3669
3685
|
}) });
|
|
3670
|
-
const S = a === i._id && (l ===
|
|
3686
|
+
const S = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
|
|
3671
3687
|
return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: S }) : S;
|
|
3672
3688
|
}, PartialWrapper = ({ children: o, partialBlockId: n }) => {
|
|
3673
3689
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
@@ -3708,7 +3724,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3708
3724
|
);
|
|
3709
3725
|
return map(l, (c) => {
|
|
3710
3726
|
const d = a(c._id);
|
|
3711
|
-
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:
|
|
3727
|
+
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: r, 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: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
|
|
3712
3728
|
});
|
|
3713
3729
|
}, PageBlocksRenderer = () => {
|
|
3714
3730
|
const [o] = useBlocksStore();
|
|
@@ -3776,14 +3792,14 @@ const CanvasEventsWatcher = () => {
|
|
|
3776
3792
|
}, StaticCanvas = () => {
|
|
3777
3793
|
const [o] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), r = useRef(null), a = useRef(null), [l, i] = useState({ width: 0, height: 0 }), c = useCanvasScale(l), [, d] = useAtom$1(canvasIframeAtom), p = useBuilderProp("loading", !1), u = useBuilderProp("htmlDir", "ltr"), g = useCallback(
|
|
3778
3794
|
(m) => {
|
|
3779
|
-
i((
|
|
3795
|
+
i((f) => ({ ...f, width: m }));
|
|
3780
3796
|
},
|
|
3781
3797
|
[i]
|
|
3782
3798
|
);
|
|
3783
3799
|
useEffect(() => {
|
|
3784
3800
|
if (!a.current) return;
|
|
3785
|
-
const { clientWidth: m, clientHeight:
|
|
3786
|
-
i({ width: m, height:
|
|
3801
|
+
const { clientWidth: m, clientHeight: f } = a.current;
|
|
3802
|
+
i({ width: m, height: f });
|
|
3787
3803
|
}, [a, o]);
|
|
3788
3804
|
const h = useMemo(() => {
|
|
3789
3805
|
let m = IframeInitialContent;
|
|
@@ -3898,8 +3914,8 @@ const CanvasEventsWatcher = () => {
|
|
|
3898
3914
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
|
|
3899
3915
|
] });
|
|
3900
3916
|
}, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
|
|
3901
|
-
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (
|
|
3902
|
-
if (!
|
|
3917
|
+
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (f) => {
|
|
3918
|
+
if (!f.trim()) {
|
|
3903
3919
|
p(!1), g("Please enter a URL");
|
|
3904
3920
|
return;
|
|
3905
3921
|
}
|
|
@@ -3923,7 +3939,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3923
3939
|
{
|
|
3924
3940
|
placeholder: m(`Enter ${r} URL`),
|
|
3925
3941
|
value: a,
|
|
3926
|
-
onChange: (
|
|
3942
|
+
onChange: (f) => l(f.target.value),
|
|
3927
3943
|
onKeyUp: () => h(a)
|
|
3928
3944
|
}
|
|
3929
3945
|
),
|
|
@@ -3964,16 +3980,16 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
3964
3980
|
const h = isArray(g) ? first(g) : g;
|
|
3965
3981
|
if (h) {
|
|
3966
3982
|
n(h == null ? void 0 : h.url);
|
|
3967
|
-
const m = h == null ? void 0 : h.width,
|
|
3983
|
+
const m = h == null ? void 0 : h.width, f = h == null ? void 0 : h.height;
|
|
3968
3984
|
if (i != null && i._id) {
|
|
3969
|
-
const
|
|
3985
|
+
const x = {
|
|
3970
3986
|
...m && { width: m },
|
|
3971
|
-
...
|
|
3987
|
+
...f && { height: f },
|
|
3972
3988
|
...h.description && { alt: h.description },
|
|
3973
3989
|
...h.id && { assetId: h.id }
|
|
3974
3990
|
};
|
|
3975
|
-
if (isEmpty(
|
|
3976
|
-
c([i._id],
|
|
3991
|
+
if (isEmpty(x)) return;
|
|
3992
|
+
c([i._id], x);
|
|
3977
3993
|
}
|
|
3978
3994
|
}
|
|
3979
3995
|
}, p = useCallback(() => {
|
|
@@ -4017,14 +4033,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4017
4033
|
}, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
|
|
4018
4034
|
const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (h) => Array.isArray(h) ? "array" : typeof h == "object" && h !== null ? "object" : "value", p = React__default.useCallback(
|
|
4019
4035
|
(h) => {
|
|
4020
|
-
const m = (
|
|
4021
|
-
h.type === "object" ? (l((
|
|
4036
|
+
const m = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
|
|
4037
|
+
h.type === "object" ? (l((f) => [...f, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
|
|
4022
4038
|
},
|
|
4023
4039
|
[a, n, r]
|
|
4024
4040
|
), u = React__default.useCallback(() => {
|
|
4025
4041
|
if (a.length > 0) {
|
|
4026
4042
|
const h = a.slice(0, -1);
|
|
4027
|
-
l(h), c(h.reduce((m,
|
|
4043
|
+
l(h), c(h.reduce((m, f) => m[f], o));
|
|
4028
4044
|
}
|
|
4029
4045
|
}, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([h, m]) => ({ key: h, value: m, type: d(m) })).filter((h) => !startsWith(h.key, REPEATER_PREFIX) && h.key.includes("/") ? !1 : r === "value" ? h.type === "value" || h.type === "object" : r === "array" ? h.type === "array" || h.type === "object" : r === "object" ? h.type === "object" : !0) : [], [i, r]);
|
|
4030
4046
|
return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
|
|
@@ -4117,7 +4133,7 @@ const DataBindingSelector = ({
|
|
|
4117
4133
|
}) => {
|
|
4118
4134
|
const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
|
|
4119
4135
|
if (i.length === 1) return "";
|
|
4120
|
-
const g = i.find((
|
|
4136
|
+
const g = i.find((f) => f._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
|
|
4121
4137
|
return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
|
|
4122
4138
|
}, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
|
|
4123
4139
|
(g, h) => {
|
|
@@ -4125,7 +4141,7 @@ const DataBindingSelector = ({
|
|
|
4125
4141
|
n(`{{${g}}}`, {}, r);
|
|
4126
4142
|
return;
|
|
4127
4143
|
}
|
|
4128
|
-
const m = (b) => /[.,!?;:]/.test(b),
|
|
4144
|
+
const m = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
|
|
4129
4145
|
let w = "", _ = "";
|
|
4130
4146
|
const E = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
|
|
4131
4147
|
return v > 0 && (E === "." || !m(E) && E !== " ") && (w = " "), v < b.length && !m(S) && S !== " " && (_ = " "), {
|
|
@@ -4133,8 +4149,8 @@ const DataBindingSelector = ({
|
|
|
4133
4149
|
prefixLength: w.length,
|
|
4134
4150
|
suffixLength: _.length
|
|
4135
4151
|
};
|
|
4136
|
-
},
|
|
4137
|
-
if (!
|
|
4152
|
+
}, x = document.getElementById(r);
|
|
4153
|
+
if (!x) return;
|
|
4138
4154
|
const y = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
|
|
4139
4155
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4140
4156
|
const b = y.__chaiRTE;
|
|
@@ -4155,13 +4171,13 @@ const DataBindingSelector = ({
|
|
|
4155
4171
|
return;
|
|
4156
4172
|
}
|
|
4157
4173
|
} else {
|
|
4158
|
-
const b =
|
|
4174
|
+
const b = x, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
|
|
4159
4175
|
if (w > v) {
|
|
4160
|
-
const N = `{{${g}}}`, { text: C } =
|
|
4176
|
+
const N = `{{${g}}}`, { text: C } = f(B, v, N), k = B.slice(0, v) + C + B.slice(w);
|
|
4161
4177
|
n(k, {}, r);
|
|
4162
4178
|
return;
|
|
4163
4179
|
}
|
|
4164
|
-
const E = `{{${g}}}`, { text: S } =
|
|
4180
|
+
const E = `{{${g}}}`, { text: S } = f(B, v, E), A = B.slice(0, v) + S + B.slice(v);
|
|
4165
4181
|
n(A, {}, r);
|
|
4166
4182
|
}
|
|
4167
4183
|
},
|
|
@@ -4184,9 +4200,9 @@ const DataBindingSelector = ({
|
|
|
4184
4200
|
onChange: r
|
|
4185
4201
|
}) => {
|
|
4186
4202
|
var N;
|
|
4187
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [
|
|
4203
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
|
|
4188
4204
|
useEffect(() => {
|
|
4189
|
-
if (m(""),
|
|
4205
|
+
if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4190
4206
|
const C = split(o, ":"), k = get(C, 1, "page") || "page";
|
|
4191
4207
|
g(k), (async () => {
|
|
4192
4208
|
const j = await l(k, [get(C, 2, "page")]);
|
|
@@ -4196,10 +4212,10 @@ const DataBindingSelector = ({
|
|
|
4196
4212
|
const w = useDebouncedCallback(
|
|
4197
4213
|
async (C) => {
|
|
4198
4214
|
if (isEmpty(C))
|
|
4199
|
-
|
|
4215
|
+
x([]);
|
|
4200
4216
|
else {
|
|
4201
4217
|
const k = await l(u, C);
|
|
4202
|
-
|
|
4218
|
+
x(k);
|
|
4203
4219
|
}
|
|
4204
4220
|
c(!1), b(-1);
|
|
4205
4221
|
},
|
|
@@ -4207,18 +4223,18 @@ const DataBindingSelector = ({
|
|
|
4207
4223
|
300
|
|
4208
4224
|
), _ = (C) => {
|
|
4209
4225
|
const k = ["pageType", u, C.id];
|
|
4210
|
-
k[1] && (r(k.join(":")), m(C.name), p(!1),
|
|
4226
|
+
k[1] && (r(k.join(":")), m(C.name), p(!1), x([]), b(-1));
|
|
4211
4227
|
}, E = (C) => {
|
|
4212
4228
|
switch (C.key) {
|
|
4213
4229
|
case "ArrowDown":
|
|
4214
|
-
C.preventDefault(), b((k) => k <
|
|
4230
|
+
C.preventDefault(), b((k) => k < f.length - 1 ? k + 1 : k);
|
|
4215
4231
|
break;
|
|
4216
4232
|
case "ArrowUp":
|
|
4217
4233
|
C.preventDefault(), b((k) => k > 0 ? k - 1 : k);
|
|
4218
4234
|
break;
|
|
4219
4235
|
case "Enter":
|
|
4220
|
-
if (C.preventDefault(),
|
|
4221
|
-
y >= 0 && _(
|
|
4236
|
+
if (C.preventDefault(), f.length === 0) return;
|
|
4237
|
+
y >= 0 && _(f[y]);
|
|
4222
4238
|
break;
|
|
4223
4239
|
case "Escape":
|
|
4224
4240
|
C.preventDefault(), S();
|
|
@@ -4232,7 +4248,7 @@ const DataBindingSelector = ({
|
|
|
4232
4248
|
}
|
|
4233
4249
|
}, [y]);
|
|
4234
4250
|
const S = () => {
|
|
4235
|
-
m(""),
|
|
4251
|
+
m(""), x([]), b(-1), p(!1), r("");
|
|
4236
4252
|
}, A = (C) => {
|
|
4237
4253
|
m(C), p(!isEmpty(C)), c(!0), w(C);
|
|
4238
4254
|
};
|
|
@@ -4252,15 +4268,15 @@ const DataBindingSelector = ({
|
|
|
4252
4268
|
),
|
|
4253
4269
|
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
4254
4270
|
] }),
|
|
4255
|
-
(i || !isEmpty(
|
|
4271
|
+
(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: [
|
|
4256
4272
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
4257
4273
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
4258
|
-
] }) : d && isEmpty(
|
|
4274
|
+
] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
4259
4275
|
a("No results found for"),
|
|
4260
4276
|
' "',
|
|
4261
4277
|
h,
|
|
4262
4278
|
'"'
|
|
4263
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(
|
|
4279
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(f == null ? void 0 : f.slice(0, 20), (C, k) => /* @__PURE__ */ jsxs(
|
|
4264
4280
|
"li",
|
|
4265
4281
|
{
|
|
4266
4282
|
onClick: () => _(C),
|
|
@@ -4575,8 +4591,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4575
4591
|
if (!u) return;
|
|
4576
4592
|
const m = `{{${h}}}`;
|
|
4577
4593
|
u.commands.focus();
|
|
4578
|
-
const { from:
|
|
4579
|
-
if (
|
|
4594
|
+
const { from: f, to: x } = u.state.selection;
|
|
4595
|
+
if (f !== x)
|
|
4580
4596
|
u.chain().deleteSelection().insertContent(m).run();
|
|
4581
4597
|
else {
|
|
4582
4598
|
const { state: b } = u, v = b.selection.from, B = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
|
|
@@ -4622,13 +4638,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4622
4638
|
})
|
|
4623
4639
|
],
|
|
4624
4640
|
content: r || "",
|
|
4625
|
-
onUpdate: ({ editor:
|
|
4626
|
-
const
|
|
4627
|
-
a(
|
|
4641
|
+
onUpdate: ({ editor: f }) => {
|
|
4642
|
+
const x = f.getHTML();
|
|
4643
|
+
a(x), c || u(x);
|
|
4628
4644
|
},
|
|
4629
|
-
onBlur: ({ editor:
|
|
4630
|
-
const
|
|
4631
|
-
l(o,
|
|
4645
|
+
onBlur: ({ editor: f }) => {
|
|
4646
|
+
const x = f.getHTML();
|
|
4647
|
+
l(o, x);
|
|
4632
4648
|
},
|
|
4633
4649
|
editorProps: {
|
|
4634
4650
|
attributes: {
|
|
@@ -4641,8 +4657,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4641
4657
|
}, [g]), useEffect(() => {
|
|
4642
4658
|
u(r || "");
|
|
4643
4659
|
}, [r]);
|
|
4644
|
-
const h = (
|
|
4645
|
-
a(
|
|
4660
|
+
const h = (f) => {
|
|
4661
|
+
a(f);
|
|
4646
4662
|
}, m = () => {
|
|
4647
4663
|
d(!1), g && g.commands.setContent(p);
|
|
4648
4664
|
};
|
|
@@ -4675,24 +4691,24 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4675
4691
|
u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
|
|
4676
4692
|
}, [o, u]);
|
|
4677
4693
|
const h = () => {
|
|
4678
|
-
const
|
|
4679
|
-
if (
|
|
4680
|
-
const y = (
|
|
4694
|
+
const x = findIndex(u, { _id: g });
|
|
4695
|
+
if (x > -1) {
|
|
4696
|
+
const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
|
|
4681
4697
|
if (!b) return;
|
|
4682
4698
|
n({ ...o, currentSlide: b }), c([b]);
|
|
4683
4699
|
}
|
|
4684
4700
|
}, m = () => {
|
|
4685
|
-
const
|
|
4686
|
-
if (
|
|
4687
|
-
const y = (
|
|
4701
|
+
const x = findIndex(u, { _id: g });
|
|
4702
|
+
if (x > -1) {
|
|
4703
|
+
const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
|
|
4688
4704
|
if (!b) return;
|
|
4689
4705
|
n({ ...o, currentSlide: b }), c([b]);
|
|
4690
4706
|
}
|
|
4691
|
-
},
|
|
4692
|
-
const
|
|
4707
|
+
}, f = () => {
|
|
4708
|
+
const x = i(
|
|
4693
4709
|
{ styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
|
|
4694
4710
|
p == null ? void 0 : p._id
|
|
4695
|
-
), y =
|
|
4711
|
+
), y = x == null ? void 0 : x._id;
|
|
4696
4712
|
y && (n({ ...o, currentSlide: y }), c([y]));
|
|
4697
4713
|
};
|
|
4698
4714
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
@@ -4710,7 +4726,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4710
4726
|
/* @__PURE__ */ jsxs(
|
|
4711
4727
|
"button",
|
|
4712
4728
|
{
|
|
4713
|
-
onClick:
|
|
4729
|
+
onClick: f,
|
|
4714
4730
|
className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
|
|
4715
4731
|
children: [
|
|
4716
4732
|
/* @__PURE__ */ jsx(PlusCircle, { className: "h-3 w-3 stroke-[2]" }),
|
|
@@ -4771,8 +4787,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4771
4787
|
value: o == null ? void 0 : o.autoplayInterval,
|
|
4772
4788
|
className: "text-xs",
|
|
4773
4789
|
pattern: "[0-9]*",
|
|
4774
|
-
onChange: (
|
|
4775
|
-
let y =
|
|
4790
|
+
onChange: (x) => {
|
|
4791
|
+
let y = x.target.value;
|
|
4776
4792
|
y.length && (y = y.replace("-", "")), n({ ...o, autoplayInterval: y });
|
|
4777
4793
|
}
|
|
4778
4794
|
}
|
|
@@ -4881,9 +4897,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4881
4897
|
formData: g,
|
|
4882
4898
|
onChange: h
|
|
4883
4899
|
}) => {
|
|
4884
|
-
const { selectedLang: m, fallbackLang:
|
|
4885
|
-
() => isEmpty(
|
|
4886
|
-
[
|
|
4900
|
+
const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
|
|
4901
|
+
() => isEmpty(x) ? "" : isEmpty(m) ? f : m,
|
|
4902
|
+
[x, m, f]
|
|
4887
4903
|
), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
|
|
4888
4904
|
() => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
|
|
4889
4905
|
[w, B == null ? void 0 : B._type]
|
|
@@ -4920,14 +4936,20 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4920
4936
|
}
|
|
4921
4937
|
return /* @__PURE__ */ jsxs("div", { className: n, children: [
|
|
4922
4938
|
u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4923
|
-
/* @__PURE__ */ jsxs("
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
N && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4939
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4940
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
|
|
4941
|
+
r,
|
|
4927
4942
|
" ",
|
|
4928
|
-
|
|
4943
|
+
N && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4944
|
+
" ",
|
|
4945
|
+
b
|
|
4946
|
+
] }),
|
|
4947
|
+
p && u.type !== "object" ? " *" : null
|
|
4929
4948
|
] }),
|
|
4930
|
-
|
|
4949
|
+
u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4950
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-muted-foreground/70" }) }),
|
|
4951
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
|
|
4952
|
+
] }) })
|
|
4931
4953
|
] }),
|
|
4932
4954
|
!u.enum && !u.oneOf && v && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
4933
4955
|
DataBindingSelector,
|
|
@@ -5041,17 +5063,17 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5041
5063
|
}), a;
|
|
5042
5064
|
};
|
|
5043
5065
|
function BlockSettings() {
|
|
5044
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h),
|
|
5066
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: E }, S, A) => {
|
|
5045
5067
|
S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(E, S) }, A);
|
|
5046
|
-
},
|
|
5068
|
+
}, x = useCallback(
|
|
5047
5069
|
debounce(({ formData: E }, S, A) => {
|
|
5048
|
-
|
|
5070
|
+
f({ formData: E }, S, A), d(E);
|
|
5049
5071
|
}, 1500),
|
|
5050
5072
|
[n == null ? void 0 : n._id, o]
|
|
5051
5073
|
), y = ({ formData: E }, S) => {
|
|
5052
|
-
S && (r([n._id], { [S]: get(E, S) }),
|
|
5074
|
+
S && (r([n._id], { [S]: get(E, S) }), x({ formData: E }, S, { [S]: get(c, S) }));
|
|
5053
5075
|
}, b = ({ formData: E }, S) => {
|
|
5054
|
-
S && (r([g._id], { [S]: get(E, S) }),
|
|
5076
|
+
S && (r([g._id], { [S]: get(E, S) }), x({ formData: E }, S, { [S]: get(c, S) }));
|
|
5055
5077
|
}, { schema: v, uiSchema: B } = useMemo(() => {
|
|
5056
5078
|
const E = n == null ? void 0 : n._type;
|
|
5057
5079
|
if (!E)
|
|
@@ -5116,50 +5138,63 @@ function BlockSettings() {
|
|
|
5116
5138
|
] });
|
|
5117
5139
|
}
|
|
5118
5140
|
const BlockStylingProps = () => {
|
|
5119
|
-
|
|
5141
|
+
var f;
|
|
5142
|
+
const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), a = useRemoveClassesFromBlocks(), [l] = useSelectedBlockIds(), { t: i } = useTranslation();
|
|
5120
5143
|
if (!o) return null;
|
|
5121
|
-
const
|
|
5122
|
-
(
|
|
5123
|
-
), { reset:
|
|
5124
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
5144
|
+
const c = Object.keys(o).filter(
|
|
5145
|
+
(x) => typeof o[x] == "string" && o[x].startsWith("#styles:")
|
|
5146
|
+
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = n[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(n, (y) => y.prop === x);
|
|
5147
|
+
return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
5125
5148
|
/* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
|
|
5126
|
-
|
|
5149
|
+
i("Style element"),
|
|
5127
5150
|
":"
|
|
5128
5151
|
] }),
|
|
5129
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(
|
|
5152
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (x) => /* @__PURE__ */ jsxs(
|
|
5130
5153
|
Badge,
|
|
5131
5154
|
{
|
|
5132
5155
|
className: "flex cursor-pointer items-center gap-1 pr-1",
|
|
5133
|
-
variant:
|
|
5156
|
+
variant: m(x) ? "default" : "secondary",
|
|
5134
5157
|
onClick: () => {
|
|
5135
|
-
r([{ id: `${
|
|
5158
|
+
r([{ id: `${x}-${o._id}`, blockId: o._id, prop: x }]);
|
|
5136
5159
|
},
|
|
5137
5160
|
children: [
|
|
5138
|
-
startCase(
|
|
5161
|
+
startCase(x),
|
|
5139
5162
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5140
5163
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
5141
5164
|
"button",
|
|
5142
5165
|
{
|
|
5143
5166
|
type: "button",
|
|
5144
5167
|
className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
|
|
5145
|
-
onClick: (
|
|
5168
|
+
onClick: (y) => y.stopPropagation(),
|
|
5146
5169
|
children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
|
|
5147
5170
|
}
|
|
5148
5171
|
) }),
|
|
5149
|
-
/* @__PURE__ */
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5172
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
|
|
5173
|
+
/* @__PURE__ */ jsx(
|
|
5174
|
+
DropdownMenuItem,
|
|
5175
|
+
{
|
|
5176
|
+
className: "text-xs",
|
|
5177
|
+
onClick: () => {
|
|
5178
|
+
d(x);
|
|
5179
|
+
},
|
|
5180
|
+
children: i("Reset style")
|
|
5181
|
+
}
|
|
5182
|
+
),
|
|
5183
|
+
/* @__PURE__ */ jsx(
|
|
5184
|
+
DropdownMenuItem,
|
|
5185
|
+
{
|
|
5186
|
+
className: "text-xs",
|
|
5187
|
+
onClick: () => {
|
|
5188
|
+
a(l, h, !0);
|
|
5189
|
+
},
|
|
5190
|
+
children: i("Clear styles")
|
|
5191
|
+
}
|
|
5192
|
+
)
|
|
5193
|
+
] })
|
|
5159
5194
|
] })
|
|
5160
5195
|
]
|
|
5161
5196
|
},
|
|
5162
|
-
|
|
5197
|
+
x
|
|
5163
5198
|
)) }),
|
|
5164
5199
|
/* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
|
|
5165
5200
|
] }) });
|
|
@@ -5308,7 +5343,7 @@ const BlockStylingProps = () => {
|
|
|
5308
5343
|
},
|
|
5309
5344
|
a
|
|
5310
5345
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5311
|
-
const [n, r] = 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]), [
|
|
5346
|
+
const [n, r] = 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(""), [v, B] = useState(!1), [w, _] = useState(!1);
|
|
5312
5347
|
useEffect(() => {
|
|
5313
5348
|
const { value: C, unit: k } = getClassValueAndUnit(i);
|
|
5314
5349
|
if (k === "") {
|
|
@@ -5321,7 +5356,7 @@ const BlockStylingProps = () => {
|
|
|
5321
5356
|
(C = !1) => {
|
|
5322
5357
|
const k = getUserInputValues(`${a}`, u);
|
|
5323
5358
|
if (get(k, "error", !1)) {
|
|
5324
|
-
|
|
5359
|
+
x(!0);
|
|
5325
5360
|
return;
|
|
5326
5361
|
}
|
|
5327
5362
|
const j = get(k, "unit") !== "" ? get(k, "unit") : h;
|
|
@@ -5339,7 +5374,7 @@ const BlockStylingProps = () => {
|
|
|
5339
5374
|
(C) => {
|
|
5340
5375
|
const k = getUserInputValues(`${a}`, u);
|
|
5341
5376
|
if (get(k, "error", !1)) {
|
|
5342
|
-
|
|
5377
|
+
x(!0);
|
|
5343
5378
|
return;
|
|
5344
5379
|
}
|
|
5345
5380
|
if (C === "auto" || C === "none") {
|
|
@@ -5390,7 +5425,7 @@ const BlockStylingProps = () => {
|
|
|
5390
5425
|
},
|
|
5391
5426
|
onBlur: () => A(),
|
|
5392
5427
|
onChange: (C) => {
|
|
5393
|
-
|
|
5428
|
+
x(!1), l(C.target.value);
|
|
5394
5429
|
},
|
|
5395
5430
|
onClick: (C) => {
|
|
5396
5431
|
var k;
|
|
@@ -5399,7 +5434,7 @@ const BlockStylingProps = () => {
|
|
|
5399
5434
|
value: v ? y : a,
|
|
5400
5435
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5401
5436
|
" ",
|
|
5402
|
-
|
|
5437
|
+
f ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
5403
5438
|
)
|
|
5404
5439
|
}
|
|
5405
5440
|
),
|
|
@@ -5518,7 +5553,7 @@ const COLOR_PROP = {
|
|
|
5518
5553
|
return c([]);
|
|
5519
5554
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
5520
5555
|
}, [g]);
|
|
5521
|
-
const
|
|
5556
|
+
const f = useCallback(
|
|
5522
5557
|
// eslint-disable-next-line no-shadow
|
|
5523
5558
|
(y) => {
|
|
5524
5559
|
p({ color: g, shade: y });
|
|
@@ -5528,11 +5563,11 @@ const COLOR_PROP = {
|
|
|
5528
5563
|
useEffect(() => {
|
|
5529
5564
|
p({ color: "", shade: "" });
|
|
5530
5565
|
}, [r]);
|
|
5531
|
-
const { match:
|
|
5566
|
+
const { match: x } = useTailwindClassList();
|
|
5532
5567
|
return useEffect(() => {
|
|
5533
5568
|
const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
5534
|
-
|
|
5535
|
-
}, [
|
|
5569
|
+
x(o, b) && n(b, o);
|
|
5570
|
+
}, [x, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
5536
5571
|
/* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
|
|
5537
5572
|
DropDown,
|
|
5538
5573
|
{
|
|
@@ -5572,7 +5607,7 @@ const COLOR_PROP = {
|
|
|
5572
5607
|
]
|
|
5573
5608
|
}
|
|
5574
5609
|
) }),
|
|
5575
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange:
|
|
5610
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: f, options: i }) })
|
|
5576
5611
|
] });
|
|
5577
5612
|
}, EDITOR_ICONS = {
|
|
5578
5613
|
"not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
|
|
@@ -5906,17 +5941,17 @@ const COLOR_PROP = {
|
|
|
5906
5941
|
"2xl": "1536px"
|
|
5907
5942
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5908
5943
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5909
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(),
|
|
5944
|
+
}, 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(
|
|
5910
5945
|
(S, A = !0) => {
|
|
5911
5946
|
const N = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
|
|
5912
5947
|
(p || u !== "") && (N.mq = "xs");
|
|
5913
5948
|
const C = generateFullClsName(N);
|
|
5914
|
-
m(
|
|
5949
|
+
m(x, [C], A);
|
|
5915
5950
|
},
|
|
5916
|
-
[
|
|
5951
|
+
[x, p, g, u, l, m]
|
|
5917
5952
|
), v = useCallback(() => {
|
|
5918
|
-
x
|
|
5919
|
-
}, [
|
|
5953
|
+
f(x, [y], !0);
|
|
5954
|
+
}, [x, y, f]), B = useMemo(() => canChangeClass(h, g), [h, g]);
|
|
5920
5955
|
useEffect(() => {
|
|
5921
5956
|
i(B, h);
|
|
5922
5957
|
}, [B, i, h]);
|
|
@@ -6002,23 +6037,23 @@ const COLOR_PROP = {
|
|
|
6002
6037
|
children: [
|
|
6003
6038
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6004
6039
|
o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6005
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key:
|
|
6040
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6006
6041
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6007
6042
|
"button",
|
|
6008
6043
|
{
|
|
6009
6044
|
type: "button",
|
|
6010
|
-
onClick: () => u(
|
|
6011
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6045
|
+
onClick: () => u(f),
|
|
6046
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6012
6047
|
children: [
|
|
6013
6048
|
React__default.createElement("div", {
|
|
6014
|
-
className: h(
|
|
6049
|
+
className: h(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6015
6050
|
}),
|
|
6016
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6051
|
+
React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6017
6052
|
]
|
|
6018
6053
|
}
|
|
6019
6054
|
) }),
|
|
6020
6055
|
/* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
|
|
6021
|
-
] }) }, `option-${
|
|
6056
|
+
] }) }, `option-${x}`)) })
|
|
6022
6057
|
] }),
|
|
6023
6058
|
/* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
|
|
6024
6059
|
BlockStyle,
|
|
@@ -6173,9 +6208,9 @@ const COLOR_PROP = {
|
|
|
6173
6208
|
canvas: n = !1,
|
|
6174
6209
|
tooltip: r = !0
|
|
6175
6210
|
}) => {
|
|
6176
|
-
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS),
|
|
6211
|
+
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
|
|
6177
6212
|
u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
|
|
6178
|
-
},
|
|
6213
|
+
}, x = (b) => {
|
|
6179
6214
|
n || l(b), c(b);
|
|
6180
6215
|
}, y = getBreakpointValue(n ? i : a).toLowerCase();
|
|
6181
6216
|
return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
|
|
@@ -6183,7 +6218,7 @@ const COLOR_PROP = {
|
|
|
6183
6218
|
{
|
|
6184
6219
|
canvas: n,
|
|
6185
6220
|
...b,
|
|
6186
|
-
onClick:
|
|
6221
|
+
onClick: x,
|
|
6187
6222
|
key: b.breakpoint,
|
|
6188
6223
|
currentBreakpoint: y
|
|
6189
6224
|
}
|
|
@@ -6197,7 +6232,7 @@ const COLOR_PROP = {
|
|
|
6197
6232
|
openDelay: o,
|
|
6198
6233
|
tooltip: r,
|
|
6199
6234
|
...b,
|
|
6200
|
-
onClick:
|
|
6235
|
+
onClick: x,
|
|
6201
6236
|
key: b.breakpoint,
|
|
6202
6237
|
currentBreakpoint: y
|
|
6203
6238
|
}
|
|
@@ -6212,7 +6247,7 @@ const COLOR_PROP = {
|
|
|
6212
6247
|
DropdownMenuCheckboxItem,
|
|
6213
6248
|
{
|
|
6214
6249
|
disabled: b.breakpoint === "xs",
|
|
6215
|
-
onCheckedChange: () =>
|
|
6250
|
+
onCheckedChange: () => f(toUpper(b.breakpoint)),
|
|
6216
6251
|
checked: includes(u, toUpper(b.breakpoint)),
|
|
6217
6252
|
children: h(b.title)
|
|
6218
6253
|
},
|
|
@@ -6297,8 +6332,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6297
6332
|
(m = d.current) == null || m.focus();
|
|
6298
6333
|
}, []);
|
|
6299
6334
|
const h = (m) => {
|
|
6300
|
-
const { usage:
|
|
6301
|
-
!l &&
|
|
6335
|
+
const { usage: f } = m || {};
|
|
6336
|
+
!l && f && g(f), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
6302
6337
|
};
|
|
6303
6338
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
6304
6339
|
/* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
|
|
@@ -6354,9 +6389,9 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6354
6389
|
};
|
|
6355
6390
|
function ManualClasses() {
|
|
6356
6391
|
var I;
|
|
6357
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [
|
|
6358
|
-
const L =
|
|
6359
|
-
u(h, L, !0),
|
|
6392
|
+
const o = useRef(null), [n, r] = 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, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
|
|
6393
|
+
const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6394
|
+
u(h, L, !0), x("");
|
|
6360
6395
|
}, [w, _] = useState([]), E = ({ value: L }) => {
|
|
6361
6396
|
const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
|
|
6362
6397
|
let D = [];
|
|
@@ -6379,19 +6414,19 @@ function ManualClasses() {
|
|
|
6379
6414
|
autoCapitalize: "off",
|
|
6380
6415
|
spellCheck: !1,
|
|
6381
6416
|
placeholder: c("Enter classes separated by space"),
|
|
6382
|
-
value:
|
|
6417
|
+
value: f,
|
|
6383
6418
|
onFocus: (L) => {
|
|
6384
6419
|
setTimeout(() => {
|
|
6385
6420
|
L.target && L.target.select();
|
|
6386
6421
|
}, 0);
|
|
6387
6422
|
},
|
|
6388
6423
|
onKeyDown: (L) => {
|
|
6389
|
-
L.key === "Enter" &&
|
|
6424
|
+
L.key === "Enter" && f.trim() !== "" && B();
|
|
6390
6425
|
},
|
|
6391
|
-
onChange: (L, { newValue: R }) =>
|
|
6426
|
+
onChange: (L, { newValue: R }) => x(R),
|
|
6392
6427
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6393
6428
|
}),
|
|
6394
|
-
[
|
|
6429
|
+
[f, c, o]
|
|
6395
6430
|
), k = (L) => {
|
|
6396
6431
|
debugger;
|
|
6397
6432
|
const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
@@ -6446,7 +6481,7 @@ function ManualClasses() {
|
|
|
6446
6481
|
variant: "outline",
|
|
6447
6482
|
className: "h-6 border-border",
|
|
6448
6483
|
onClick: B,
|
|
6449
|
-
disabled:
|
|
6484
|
+
disabled: f.trim() === "",
|
|
6450
6485
|
size: "sm",
|
|
6451
6486
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
6452
6487
|
}
|
|
@@ -6473,28 +6508,49 @@ function ManualClasses() {
|
|
|
6473
6508
|
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"
|
|
6474
6509
|
},
|
|
6475
6510
|
L
|
|
6476
|
-
) : /* @__PURE__ */ jsxs(
|
|
6511
|
+
) : /* @__PURE__ */ jsx("div", { className: "group relative flex max-w-[260px] items-center", children: /* @__PURE__ */ jsxs(
|
|
6477
6512
|
"button",
|
|
6478
6513
|
{
|
|
6479
6514
|
onDoubleClick: () => {
|
|
6480
|
-
|
|
6515
|
+
x(L), g(h, [L]), setTimeout(() => {
|
|
6481
6516
|
o.current && o.current.focus();
|
|
6482
6517
|
}, 10);
|
|
6483
6518
|
},
|
|
6484
|
-
className: "
|
|
6519
|
+
className: "flex cursor-default items-center gap-x-1 truncate break-words border border-border bg-gray-200 p-px pl-5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 hover:pl-5 group-hover:pl-5 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
6485
6520
|
children: [
|
|
6486
6521
|
L,
|
|
6487
|
-
|
|
6522
|
+
/* @__PURE__ */ jsx(
|
|
6488
6523
|
Cross2Icon,
|
|
6489
6524
|
{
|
|
6490
6525
|
onClick: () => g(h, [L], !0),
|
|
6491
|
-
className: "
|
|
6526
|
+
className: "absolute left-0.5 mr-0.5 hidden group-hover:block h-4 w-4 bg-gray-500 font-bold group-hover:bg-gray-300 group-hover:text-red-500 "
|
|
6527
|
+
}
|
|
6528
|
+
),
|
|
6529
|
+
/* @__PURE__ */ jsxs(
|
|
6530
|
+
"svg",
|
|
6531
|
+
{
|
|
6532
|
+
className: "absolute left-0.5 mr-0.5 group-hover:hidden h-3.5 w-3.5 ",
|
|
6533
|
+
fill: "rgba(55, 65, 81, 0.4)",
|
|
6534
|
+
viewBox: "0 0 24 24",
|
|
6535
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6536
|
+
xmlSpace: "preserve",
|
|
6537
|
+
children: [
|
|
6538
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
|
|
6539
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
6540
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
|
|
6541
|
+
"path",
|
|
6542
|
+
{
|
|
6543
|
+
fillRule: "evenodd",
|
|
6544
|
+
clipRule: "evenodd",
|
|
6545
|
+
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"
|
|
6546
|
+
}
|
|
6547
|
+
) })
|
|
6548
|
+
]
|
|
6492
6549
|
}
|
|
6493
6550
|
)
|
|
6494
6551
|
]
|
|
6495
|
-
}
|
|
6496
|
-
|
|
6497
|
-
)
|
|
6552
|
+
}
|
|
6553
|
+
) }, L)
|
|
6498
6554
|
) })
|
|
6499
6555
|
] });
|
|
6500
6556
|
}
|
|
@@ -6610,9 +6666,9 @@ function BlockStyling() {
|
|
|
6610
6666
|
const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
|
|
6611
6667
|
let m = parseFloat(i.dragStartValue);
|
|
6612
6668
|
m = isNaN(m) ? 0 : m;
|
|
6613
|
-
let
|
|
6614
|
-
(startsWith(h, "scale") || h === "opacity") && (
|
|
6615
|
-
let y = (i.dragStartY - u.pageY) /
|
|
6669
|
+
let f = MAPPER[i.dragUnit];
|
|
6670
|
+
(startsWith(h, "scale") || h === "opacity") && (f = 10);
|
|
6671
|
+
let y = (i.dragStartY - u.pageY) / f + m;
|
|
6616
6672
|
g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
|
|
6617
6673
|
},
|
|
6618
6674
|
[i],
|
|
@@ -6661,7 +6717,7 @@ const CoreBlock = ({
|
|
|
6661
6717
|
} else
|
|
6662
6718
|
p(o, r || null, a);
|
|
6663
6719
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6664
|
-
},
|
|
6720
|
+
}, f = useFeature("dnd"), { t: x } = useTranslation();
|
|
6665
6721
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6666
6722
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6667
6723
|
"button",
|
|
@@ -6674,15 +6730,15 @@ const CoreBlock = ({
|
|
|
6674
6730
|
g([]), h();
|
|
6675
6731
|
}, 200);
|
|
6676
6732
|
},
|
|
6677
|
-
draggable:
|
|
6733
|
+
draggable: f ? "true" : "false",
|
|
6678
6734
|
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
|
|
6679
6735
|
children: [
|
|
6680
6736
|
createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
6681
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
6737
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(x(d || i)) })
|
|
6682
6738
|
]
|
|
6683
6739
|
}
|
|
6684
6740
|
) }),
|
|
6685
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children:
|
|
6741
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: x(d || i) }) })
|
|
6686
6742
|
] }) });
|
|
6687
6743
|
}, DefaultChaiBlocks = ({
|
|
6688
6744
|
parentId: o,
|
|
@@ -6870,7 +6926,7 @@ const CoreBlock = ({
|
|
|
6870
6926
|
}
|
|
6871
6927
|
}
|
|
6872
6928
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
6873
|
-
var h, m,
|
|
6929
|
+
var h, m, f, x, y, b, v, B;
|
|
6874
6930
|
if (r.type === "comment") return [];
|
|
6875
6931
|
let a = { _id: generateUUID() };
|
|
6876
6932
|
if (n && (a._parent = n.block._id), r.type === "text")
|
|
@@ -6912,8 +6968,8 @@ const CoreBlock = ({
|
|
|
6912
6968
|
...a,
|
|
6913
6969
|
href: ((h = l.find((_) => _.key === "href")) == null ? void 0 : h.value) || "",
|
|
6914
6970
|
hrefType: ((m = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
6915
|
-
autoplay: ((
|
|
6916
|
-
maxWidth: ((y = (
|
|
6971
|
+
autoplay: ((f = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
|
|
6972
|
+
maxWidth: ((y = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
|
|
6917
6973
|
backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
|
|
6918
6974
|
galleryName: ((v = l.find((_) => _.key === "data-gall")) == null ? void 0 : v.value) || ""
|
|
6919
6975
|
}, forEach(w, (_) => {
|
|
@@ -7054,7 +7110,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7054
7110
|
parentId: r = void 0,
|
|
7055
7111
|
position: a = -1
|
|
7056
7112
|
}) => {
|
|
7057
|
-
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""),
|
|
7113
|
+
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { 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 = (B) => {
|
|
7058
7114
|
const w = has(B, "styles_attrs.data-page-section");
|
|
7059
7115
|
return B._type === "Box" && w;
|
|
7060
7116
|
}, b = useCallback(
|
|
@@ -7075,7 +7131,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7075
7131
|
{
|
|
7076
7132
|
onClick: l ? () => {
|
|
7077
7133
|
} : b,
|
|
7078
|
-
draggable:
|
|
7134
|
+
draggable: f ? "true" : "false",
|
|
7079
7135
|
onDragStart: async (B) => {
|
|
7080
7136
|
const w = await c({ library: n, block: o });
|
|
7081
7137
|
let _ = r;
|
|
@@ -7088,7 +7144,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7088
7144
|
};
|
|
7089
7145
|
} else
|
|
7090
7146
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7091
|
-
|
|
7147
|
+
x(E), setTimeout(() => {
|
|
7092
7148
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7093
7149
|
}, 200);
|
|
7094
7150
|
}
|
|
@@ -7114,22 +7170,22 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7114
7170
|
] }) })
|
|
7115
7171
|
] });
|
|
7116
7172
|
}, UILibrarySection = ({ parentId: o, position: n }) => {
|
|
7117
|
-
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]),
|
|
7173
|
+
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
|
|
7118
7174
|
useEffect(() => {
|
|
7119
|
-
c && c.length > 0 && (
|
|
7175
|
+
c && c.length > 0 && (f.current = new Fuse(c, {
|
|
7120
7176
|
keys: ["name", "label", "description", "group"],
|
|
7121
7177
|
threshold: 0.4,
|
|
7122
7178
|
ignoreLocation: !0
|
|
7123
7179
|
}));
|
|
7124
7180
|
}, [c]), useEffect(() => {
|
|
7125
|
-
if (!u.trim() || !
|
|
7181
|
+
if (!u.trim() || !f.current) {
|
|
7126
7182
|
m([]);
|
|
7127
7183
|
return;
|
|
7128
7184
|
}
|
|
7129
|
-
const k =
|
|
7185
|
+
const k = f.current.search(u).map((j) => j.item);
|
|
7130
7186
|
m(k);
|
|
7131
7187
|
}, [u]);
|
|
7132
|
-
const
|
|
7188
|
+
const x = u.trim() && !isEmpty(h) ? h : c, y = groupBy(x, "group"), [b, v] = useState(null);
|
|
7133
7189
|
useEffect(() => {
|
|
7134
7190
|
if (isEmpty(keys(y))) {
|
|
7135
7191
|
v(null);
|
|
@@ -7269,25 +7325,25 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7269
7325
|
error: c
|
|
7270
7326
|
}), g(!0);
|
|
7271
7327
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7272
|
-
const m = Object.entries(a).map(([
|
|
7328
|
+
const m = Object.entries(a).map(([x, y]) => {
|
|
7273
7329
|
const b = y, v = b.type || "partial", B = formatReadableName(v);
|
|
7274
7330
|
return {
|
|
7275
7331
|
type: "PartialBlock",
|
|
7276
7332
|
// Set the type to PartialBlock
|
|
7277
|
-
label: formatReadableName(b.name ||
|
|
7333
|
+
label: formatReadableName(b.name || x),
|
|
7278
7334
|
description: b.description || "",
|
|
7279
7335
|
icon: Globe,
|
|
7280
7336
|
group: B,
|
|
7281
7337
|
// Use formatted type as group
|
|
7282
7338
|
category: "partial",
|
|
7283
|
-
partialBlockId:
|
|
7339
|
+
partialBlockId: x,
|
|
7284
7340
|
// Store the original ID as partialBlockId
|
|
7285
7341
|
_name: b.name
|
|
7286
7342
|
};
|
|
7287
|
-
}),
|
|
7343
|
+
}), f = uniq(map(m, "group"));
|
|
7288
7344
|
p({
|
|
7289
7345
|
blocks: m,
|
|
7290
|
-
groups:
|
|
7346
|
+
groups: f,
|
|
7291
7347
|
isLoading: !1,
|
|
7292
7348
|
error: null
|
|
7293
7349
|
}), g(!0);
|
|
@@ -7333,7 +7389,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7333
7389
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7334
7390
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7335
7391
|
var C;
|
|
7336
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m,
|
|
7392
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
|
|
7337
7393
|
useEffect(() => {
|
|
7338
7394
|
const k = setTimeout(() => {
|
|
7339
7395
|
var j;
|
|
@@ -7341,9 +7397,9 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7341
7397
|
}, 0);
|
|
7342
7398
|
return () => clearTimeout(k);
|
|
7343
7399
|
}, [g]), useEffect(() => {
|
|
7344
|
-
d && (
|
|
7400
|
+
d && (f("all"), y(null));
|
|
7345
7401
|
}, [d]), useEffect(() => (b.current = debounce((k) => {
|
|
7346
|
-
|
|
7402
|
+
f(k);
|
|
7347
7403
|
}, 500), () => {
|
|
7348
7404
|
b.current && b.current.cancel();
|
|
7349
7405
|
}), []);
|
|
@@ -7352,7 +7408,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7352
7408
|
}, []), B = useCallback(() => {
|
|
7353
7409
|
y(null), b.current && b.current.cancel();
|
|
7354
7410
|
}, []), w = useCallback((k) => {
|
|
7355
|
-
b.current && b.current.cancel(),
|
|
7411
|
+
b.current && b.current.cancel(), f(k), y(null);
|
|
7356
7412
|
}, []), _ = useMemo(
|
|
7357
7413
|
() => d ? values(n).filter(
|
|
7358
7414
|
(k) => {
|
|
@@ -7390,7 +7446,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7390
7446
|
onClick: () => w("all"),
|
|
7391
7447
|
onMouseEnter: () => v("all"),
|
|
7392
7448
|
onMouseLeave: B,
|
|
7393
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" ||
|
|
7449
|
+
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"}`,
|
|
7394
7450
|
children: i("All")
|
|
7395
7451
|
},
|
|
7396
7452
|
"sidebar-all"
|
|
@@ -7401,7 +7457,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7401
7457
|
onClick: () => w(k),
|
|
7402
7458
|
onMouseEnter: () => v(k),
|
|
7403
7459
|
onMouseLeave: B,
|
|
7404
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k ||
|
|
7460
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7405
7461
|
children: capitalize(i(k.toLowerCase()))
|
|
7406
7462
|
},
|
|
7407
7463
|
`sidebar-${k}`
|
|
@@ -7442,7 +7498,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7442
7498
|
}, [i, g, c]);
|
|
7443
7499
|
const m = useCallback(() => {
|
|
7444
7500
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7445
|
-
}, []),
|
|
7501
|
+
}, []), f = useChaiAddBlockTabs(), x = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
|
|
7446
7502
|
return useEffect(() => {
|
|
7447
7503
|
i === "library" && !b && c("core");
|
|
7448
7504
|
}, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
|
|
@@ -7463,14 +7519,14 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7463
7519
|
b && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
|
|
7464
7520
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7465
7521
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7466
|
-
|
|
7467
|
-
map(
|
|
7522
|
+
x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7523
|
+
map(f, (v) => /* @__PURE__ */ jsx(TabsTrigger, { value: v.id, children: React__default.createElement(v.tab) }, `tab-add-block-${v.id}`))
|
|
7468
7524
|
] }),
|
|
7469
7525
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7470
7526
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
7471
7527
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7472
|
-
|
|
7473
|
-
map(
|
|
7528
|
+
x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
7529
|
+
map(f, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: m, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
|
|
7474
7530
|
]
|
|
7475
7531
|
}
|
|
7476
7532
|
)
|
|
@@ -7773,11 +7829,14 @@ const Input = ({ node: o }) => {
|
|
|
7773
7829
|
}
|
|
7774
7830
|
}
|
|
7775
7831
|
);
|
|
7776
|
-
}, currentAddSelection = atom(null),
|
|
7832
|
+
}, currentAddSelection = atom(null), getBlockDisplayName = (o) => {
|
|
7833
|
+
var n;
|
|
7834
|
+
return o != null && o._name ? o._name : (o == null ? void 0 : o._type) === "Box" && (o != null && o.tag) && (o == null ? void 0 : o.tag) !== "div" ? startCase(o.tag) : ((n = o == null ? void 0 : o._type) == null ? void 0 : n.split("/").pop()) || "";
|
|
7835
|
+
}, Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7777
7836
|
var R;
|
|
7778
7837
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7779
7838
|
let p = null;
|
|
7780
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data:
|
|
7839
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
|
|
7781
7840
|
T.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7782
7841
|
}, _ = (T) => {
|
|
7783
7842
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
@@ -7825,7 +7884,7 @@ const Input = ({ node: o }) => {
|
|
|
7825
7884
|
),
|
|
7826
7885
|
/* @__PURE__ */ jsx("br", {})
|
|
7827
7886
|
] });
|
|
7828
|
-
const L = useMemo(() => has(
|
|
7887
|
+
const L = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
|
|
7829
7888
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
7830
7889
|
"div",
|
|
7831
7890
|
{
|
|
@@ -7864,12 +7923,12 @@ const Input = ({ node: o }) => {
|
|
|
7864
7923
|
{
|
|
7865
7924
|
className: cn(
|
|
7866
7925
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
7867
|
-
|
|
7868
|
-
y && canAcceptChildBlock(
|
|
7926
|
+
x ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
|
|
7927
|
+
y && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
|
|
7869
7928
|
(o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
|
|
7870
7929
|
b && "opacity-20",
|
|
7871
7930
|
l.includes(m) ? "opacity-50" : "",
|
|
7872
|
-
L &&
|
|
7931
|
+
L && x && "bg-primary/20 text-primary"
|
|
7873
7932
|
),
|
|
7874
7933
|
children: [
|
|
7875
7934
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -7877,7 +7936,7 @@ const Input = ({ node: o }) => {
|
|
|
7877
7936
|
"div",
|
|
7878
7937
|
{
|
|
7879
7938
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
7880
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${
|
|
7939
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
|
|
7881
7940
|
}
|
|
7882
7941
|
),
|
|
7883
7942
|
/* @__PURE__ */ jsxs(
|
|
@@ -7886,10 +7945,10 @@ const Input = ({ node: o }) => {
|
|
|
7886
7945
|
className: cn(
|
|
7887
7946
|
"leading-1 flex items-center",
|
|
7888
7947
|
L && "text-primary/60",
|
|
7889
|
-
L &&
|
|
7948
|
+
L && x && "text-primary/80"
|
|
7890
7949
|
),
|
|
7891
7950
|
children: [
|
|
7892
|
-
/* @__PURE__ */ jsx(TypeIcon, { type:
|
|
7951
|
+
/* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
|
|
7893
7952
|
v ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
|
|
7894
7953
|
"div",
|
|
7895
7954
|
{
|
|
@@ -7897,7 +7956,7 @@ const Input = ({ node: o }) => {
|
|
|
7897
7956
|
onDoubleClick: (T) => {
|
|
7898
7957
|
T.stopPropagation(), o.edit(), o.deselect();
|
|
7899
7958
|
},
|
|
7900
|
-
children: /* @__PURE__ */ jsx("span", { children: (
|
|
7959
|
+
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(f) })
|
|
7901
7960
|
}
|
|
7902
7961
|
)
|
|
7903
7962
|
]
|
|
@@ -7905,7 +7964,7 @@ const Input = ({ node: o }) => {
|
|
|
7905
7964
|
)
|
|
7906
7965
|
] }),
|
|
7907
7966
|
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
|
|
7908
|
-
canAddChildBlock(
|
|
7967
|
+
canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7909
7968
|
/* @__PURE__ */ jsx(
|
|
7910
7969
|
TooltipTrigger,
|
|
7911
7970
|
{
|
|
@@ -8205,7 +8264,7 @@ const Input = ({ node: o }) => {
|
|
|
8205
8264
|
B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
|
|
8206
8265
|
} else
|
|
8207
8266
|
console.error("Preset not found:", r);
|
|
8208
|
-
},
|
|
8267
|
+
}, f = useDebouncedCallback(
|
|
8209
8268
|
(v, B) => {
|
|
8210
8269
|
p(() => ({
|
|
8211
8270
|
...d,
|
|
@@ -8217,7 +8276,7 @@ const Input = ({ node: o }) => {
|
|
|
8217
8276
|
},
|
|
8218
8277
|
[d],
|
|
8219
8278
|
200
|
|
8220
|
-
),
|
|
8279
|
+
), x = useDebouncedCallback(
|
|
8221
8280
|
(v) => {
|
|
8222
8281
|
p(() => ({
|
|
8223
8282
|
...d,
|
|
@@ -8289,14 +8348,14 @@ const Input = ({ node: o }) => {
|
|
|
8289
8348
|
{
|
|
8290
8349
|
label: v,
|
|
8291
8350
|
value: d.fontFamily[v.replace(/font-/g, "")] || B[Object.keys(B)[0]],
|
|
8292
|
-
onChange: (w) =>
|
|
8351
|
+
onChange: (w) => f(v, w)
|
|
8293
8352
|
},
|
|
8294
8353
|
v
|
|
8295
8354
|
)) }),
|
|
8296
8355
|
(u == null ? void 0 : u.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
|
|
8297
8356
|
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: g("Border Radius") }),
|
|
8298
8357
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 py-2", children: [
|
|
8299
|
-
/* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange:
|
|
8358
|
+
/* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: x }),
|
|
8300
8359
|
/* @__PURE__ */ jsx("span", { className: "w-12 text-sm", children: d.borderRadius })
|
|
8301
8360
|
] })
|
|
8302
8361
|
] }),
|
|
@@ -8796,11 +8855,11 @@ function QuickPrompts({ onClick: o }) {
|
|
|
8796
8855
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
8797
8856
|
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), h = useRef(null), m = useRef(null);
|
|
8798
8857
|
useEffect(() => {
|
|
8799
|
-
var
|
|
8800
|
-
(
|
|
8858
|
+
var x;
|
|
8859
|
+
(x = h.current) == null || x.focus();
|
|
8801
8860
|
}, []);
|
|
8802
|
-
const
|
|
8803
|
-
const { usage: y } =
|
|
8861
|
+
const f = (x) => {
|
|
8862
|
+
const { usage: y } = x || {};
|
|
8804
8863
|
!l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
8805
8864
|
};
|
|
8806
8865
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
@@ -8821,12 +8880,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8821
8880
|
{
|
|
8822
8881
|
ref: h,
|
|
8823
8882
|
value: i,
|
|
8824
|
-
onChange: (
|
|
8883
|
+
onChange: (x) => c(x.target.value),
|
|
8825
8884
|
placeholder: n("Ask AI to edit content"),
|
|
8826
8885
|
className: "w-full",
|
|
8827
8886
|
rows: 3,
|
|
8828
|
-
onKeyDown: (
|
|
8829
|
-
|
|
8887
|
+
onKeyDown: (x) => {
|
|
8888
|
+
x.key === "Enter" && (x.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f));
|
|
8830
8889
|
}
|
|
8831
8890
|
}
|
|
8832
8891
|
),
|
|
@@ -8836,7 +8895,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8836
8895
|
{
|
|
8837
8896
|
disabled: i.trim().length < 5 || a,
|
|
8838
8897
|
onClick: () => {
|
|
8839
|
-
m.current && clearTimeout(m.current), g(void 0), r("content", o, i,
|
|
8898
|
+
m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f);
|
|
8840
8899
|
},
|
|
8841
8900
|
variant: "default",
|
|
8842
8901
|
className: "w-fit",
|
|
@@ -8868,8 +8927,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8868
8927
|
/* @__PURE__ */ jsx(
|
|
8869
8928
|
QuickPrompts,
|
|
8870
8929
|
{
|
|
8871
|
-
onClick: (
|
|
8872
|
-
m.current && clearTimeout(m.current), g(void 0), r("content", o,
|
|
8930
|
+
onClick: (x) => {
|
|
8931
|
+
m.current && clearTimeout(m.current), g(void 0), r("content", o, x, f);
|
|
8873
8932
|
}
|
|
8874
8933
|
}
|
|
8875
8934
|
)
|
|
@@ -8886,8 +8945,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8886
8945
|
const m = async () => {
|
|
8887
8946
|
try {
|
|
8888
8947
|
d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), h.current.click();
|
|
8889
|
-
} catch (
|
|
8890
|
-
u(
|
|
8948
|
+
} catch (f) {
|
|
8949
|
+
u(f);
|
|
8891
8950
|
} finally {
|
|
8892
8951
|
d(!1);
|
|
8893
8952
|
}
|
|
@@ -8895,8 +8954,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8895
8954
|
return /* @__PURE__ */ jsx(
|
|
8896
8955
|
Accordion,
|
|
8897
8956
|
{
|
|
8898
|
-
onValueChange: (
|
|
8899
|
-
g(
|
|
8957
|
+
onValueChange: (f) => {
|
|
8958
|
+
g(f !== "");
|
|
8900
8959
|
},
|
|
8901
8960
|
type: "single",
|
|
8902
8961
|
collapsible: !0,
|
|
@@ -8908,12 +8967,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8908
8967
|
{
|
|
8909
8968
|
ref: l,
|
|
8910
8969
|
value: r,
|
|
8911
|
-
onChange: (
|
|
8970
|
+
onChange: (f) => a(f.target.value),
|
|
8912
8971
|
placeholder: o("Tell about this page eg this page is about"),
|
|
8913
8972
|
className: "mt-1 w-full",
|
|
8914
8973
|
rows: 10,
|
|
8915
|
-
onKeyDown: (
|
|
8916
|
-
|
|
8974
|
+
onKeyDown: (f) => {
|
|
8975
|
+
f.key === "Enter" && (f.preventDefault(), m());
|
|
8917
8976
|
}
|
|
8918
8977
|
}
|
|
8919
8978
|
),
|
|
@@ -9034,7 +9093,7 @@ function AIChatPanel() {
|
|
|
9034
9093
|
}, 1500);
|
|
9035
9094
|
}, m = (b) => {
|
|
9036
9095
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
|
|
9037
|
-
},
|
|
9096
|
+
}, f = (b) => {
|
|
9038
9097
|
var B;
|
|
9039
9098
|
const v = (B = b.target.files) == null ? void 0 : B[0];
|
|
9040
9099
|
if (v) {
|
|
@@ -9044,7 +9103,7 @@ function AIChatPanel() {
|
|
|
9044
9103
|
d((E = _.target) == null ? void 0 : E.result);
|
|
9045
9104
|
}, w.readAsDataURL(v);
|
|
9046
9105
|
}
|
|
9047
|
-
},
|
|
9106
|
+
}, x = () => {
|
|
9048
9107
|
var b;
|
|
9049
9108
|
(b = p.current) == null || b.click();
|
|
9050
9109
|
}, y = () => {
|
|
@@ -9111,14 +9170,14 @@ function AIChatPanel() {
|
|
|
9111
9170
|
className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
|
|
9112
9171
|
}
|
|
9113
9172
|
),
|
|
9114
|
-
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange:
|
|
9173
|
+
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: f, accept: "image/*", className: "hidden" }),
|
|
9115
9174
|
/* @__PURE__ */ jsx(
|
|
9116
9175
|
Button,
|
|
9117
9176
|
{
|
|
9118
9177
|
size: "icon",
|
|
9119
9178
|
variant: "ghost",
|
|
9120
9179
|
className: "absolute bottom-2 right-2 h-6 w-6",
|
|
9121
|
-
onClick:
|
|
9180
|
+
onClick: x,
|
|
9122
9181
|
children: /* @__PURE__ */ jsx(Image$1, { className: "h-4 w-4 text-muted-foreground" })
|
|
9123
9182
|
}
|
|
9124
9183
|
)
|
|
@@ -9236,7 +9295,7 @@ const AiAssistant = () => {
|
|
|
9236
9295
|
preloadedAttributes: n = [],
|
|
9237
9296
|
onAttributesChange: r
|
|
9238
9297
|
}) {
|
|
9239
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""),
|
|
9298
|
+
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();
|
|
9240
9299
|
useEffect(() => {
|
|
9241
9300
|
l(n);
|
|
9242
9301
|
}, [n]);
|
|
@@ -9274,7 +9333,7 @@ const AiAssistant = () => {
|
|
|
9274
9333
|
prefixLength: L.length,
|
|
9275
9334
|
suffixLength: R.length
|
|
9276
9335
|
};
|
|
9277
|
-
}, C =
|
|
9336
|
+
}, C = x.current;
|
|
9278
9337
|
if (C) {
|
|
9279
9338
|
const k = C.selectionStart || 0, j = C.value || "", I = C.selectionEnd || k;
|
|
9280
9339
|
if (I > k) {
|
|
@@ -9305,7 +9364,7 @@ const AiAssistant = () => {
|
|
|
9305
9364
|
autoCorrect: "off",
|
|
9306
9365
|
spellCheck: "false",
|
|
9307
9366
|
id: "attrKey",
|
|
9308
|
-
ref:
|
|
9367
|
+
ref: f,
|
|
9309
9368
|
value: i,
|
|
9310
9369
|
onChange: (S) => c(S.target.value),
|
|
9311
9370
|
placeholder: "Enter Key",
|
|
@@ -9326,7 +9385,7 @@ const AiAssistant = () => {
|
|
|
9326
9385
|
spellCheck: "false",
|
|
9327
9386
|
id: "attrValue",
|
|
9328
9387
|
rows: 2,
|
|
9329
|
-
ref:
|
|
9388
|
+
ref: x,
|
|
9330
9389
|
value: d,
|
|
9331
9390
|
onChange: (S) => p(S.target.value),
|
|
9332
9391
|
onKeyDown: _,
|
|
@@ -9369,30 +9428,37 @@ const AiAssistant = () => {
|
|
|
9369
9428
|
);
|
|
9370
9429
|
return /* @__PURE__ */ jsx("div", { className: "flex-col gap-y-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AttrsEditor, { preloadedAttributes: n, onAttributesChange: c }) }) }) });
|
|
9371
9430
|
}), NoopComponent = () => null, ResetStylesButton = () => {
|
|
9372
|
-
const { resetAll: o } = useResetBlockStyles(), { t:
|
|
9373
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
9374
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9431
|
+
const { resetAll: o } = useResetBlockStyles(), n = useSelectedBlock(), [r] = useSelectedStylingBlocks(), a = useRemoveAllClassesForBlock(), { t: l } = useTranslation();
|
|
9432
|
+
return !n || isEmpty(r) ? null : /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
9433
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-sm p-0.5 hover:bg-gray-300", onClick: (i) => i.stopPropagation(), children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" }) }) }),
|
|
9434
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
|
|
9435
|
+
/* @__PURE__ */ jsxs(
|
|
9436
|
+
DropdownMenuItem,
|
|
9437
|
+
{
|
|
9438
|
+
className: "flex items-center gap-1 text-xs",
|
|
9439
|
+
onClick: () => {
|
|
9440
|
+
o();
|
|
9441
|
+
},
|
|
9442
|
+
children: [
|
|
9443
|
+
/* @__PURE__ */ jsx(ResetIcon, { className: "h-3 w-3" }),
|
|
9444
|
+
l("Reset styles")
|
|
9445
|
+
]
|
|
9446
|
+
}
|
|
9447
|
+
),
|
|
9448
|
+
/* @__PURE__ */ jsxs(
|
|
9449
|
+
DropdownMenuItem,
|
|
9450
|
+
{
|
|
9451
|
+
className: "text-xs",
|
|
9452
|
+
onClick: () => {
|
|
9453
|
+
n && a(n, !0);
|
|
9454
|
+
},
|
|
9455
|
+
children: [
|
|
9456
|
+
/* @__PURE__ */ jsx(Cross2Icon, { className: "h-3 w-3" }),
|
|
9457
|
+
l("Clear styles")
|
|
9458
|
+
]
|
|
9459
|
+
}
|
|
9460
|
+
)
|
|
9461
|
+
] })
|
|
9396
9462
|
] });
|
|
9397
9463
|
};
|
|
9398
9464
|
function BlockAttributesToggle() {
|
|
@@ -9512,28 +9578,28 @@ const RootLayout = () => {
|
|
|
9512
9578
|
r(n === S ? null : S);
|
|
9513
9579
|
},
|
|
9514
9580
|
[n]
|
|
9515
|
-
), { t:
|
|
9581
|
+
), { t: f } = useTranslation(), x = useMemo(
|
|
9516
9582
|
() => [...p, ...u, ...g],
|
|
9517
9583
|
[p, u, g]
|
|
9518
|
-
), y = useBuilderProp("htmlDir", "ltr"), b = find(
|
|
9584
|
+
), y = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: n }) ?? first(x), v = get(b, "width", DEFAULT_PANEL_WIDTH);
|
|
9519
9585
|
useEffect(() => {
|
|
9520
9586
|
if (n !== null) {
|
|
9521
|
-
const S = find(
|
|
9587
|
+
const S = find(x, { id: n });
|
|
9522
9588
|
S && get(S, "view", "standard") === "standard" && (a.current = n, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
|
|
9523
9589
|
}
|
|
9524
|
-
}, [n,
|
|
9590
|
+
}, [n, x]);
|
|
9525
9591
|
const B = useMemo(() => {
|
|
9526
9592
|
if (n === null) return 0;
|
|
9527
|
-
const S = find(
|
|
9593
|
+
const S = find(x, { id: n });
|
|
9528
9594
|
return get(S, "view", "standard") === "standard" ? v : l;
|
|
9529
|
-
}, [n, v, l,
|
|
9595
|
+
}, [n, v, l, x]), w = useCallback(() => {
|
|
9530
9596
|
r(a.current);
|
|
9531
9597
|
}, [r]), _ = useCallback(() => {
|
|
9532
9598
|
r("outline");
|
|
9533
9599
|
}, [r]);
|
|
9534
9600
|
useEffect(() => {
|
|
9535
|
-
find(
|
|
9536
|
-
}, [n,
|
|
9601
|
+
find(x, { id: n }) || r("outline");
|
|
9602
|
+
}, [n, x]);
|
|
9537
9603
|
const E = useCallback(
|
|
9538
9604
|
(S) => {
|
|
9539
9605
|
m(S);
|
|
@@ -9557,7 +9623,7 @@ const RootLayout = () => {
|
|
|
9557
9623
|
isActive: n === S.id,
|
|
9558
9624
|
show: () => E(S.id)
|
|
9559
9625
|
}) }),
|
|
9560
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9626
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9561
9627
|
] }, "button-top-" + A)) }),
|
|
9562
9628
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9563
9629
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
@@ -9567,7 +9633,7 @@ const RootLayout = () => {
|
|
|
9567
9633
|
isActive: n === S.id,
|
|
9568
9634
|
show: () => E(S.id)
|
|
9569
9635
|
}) }),
|
|
9570
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9636
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9571
9637
|
] }, "button-bottom-" + A)) })
|
|
9572
9638
|
] }),
|
|
9573
9639
|
/* @__PURE__ */ jsx(
|
|
@@ -9583,7 +9649,7 @@ const RootLayout = () => {
|
|
|
9583
9649
|
"div",
|
|
9584
9650
|
{
|
|
9585
9651
|
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(b, "isInternal", !1) ? "" : "w-64"}`,
|
|
9586
|
-
children: /* @__PURE__ */ jsx("span", { children:
|
|
9652
|
+
children: /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9587
9653
|
}
|
|
9588
9654
|
),
|
|
9589
9655
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {}) }) })
|
|
@@ -9606,11 +9672,11 @@ const RootLayout = () => {
|
|
|
9606
9672
|
/* @__PURE__ */ jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-2", children: c === "ai" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9607
9673
|
/* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
9608
9674
|
" ",
|
|
9609
|
-
|
|
9675
|
+
f("AI Assistant")
|
|
9610
9676
|
] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
9611
9677
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9612
9678
|
/* @__PURE__ */ jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
|
|
9613
|
-
|
|
9679
|
+
f("Theme Settings")
|
|
9614
9680
|
] }),
|
|
9615
9681
|
/* @__PURE__ */ jsx(
|
|
9616
9682
|
Button,
|
|
@@ -9641,7 +9707,7 @@ const RootLayout = () => {
|
|
|
9641
9707
|
children: [
|
|
9642
9708
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9643
9709
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9644
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9710
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9645
9711
|
] }) }),
|
|
9646
9712
|
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9647
9713
|
close: _
|
|
@@ -9653,7 +9719,7 @@ const RootLayout = () => {
|
|
|
9653
9719
|
n !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${v}px` }, children: [
|
|
9654
9720
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9655
9721
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9656
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9722
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9657
9723
|
] }) }),
|
|
9658
9724
|
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
|
|
9659
9725
|
close: _
|
|
@@ -9679,7 +9745,7 @@ const RootLayout = () => {
|
|
|
9679
9745
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9680
9746
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9681
9747
|
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9682
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9748
|
+
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9683
9749
|
] }),
|
|
9684
9750
|
/* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9685
9751
|
] }),
|
|
@@ -9723,36 +9789,36 @@ const RootLayout = () => {
|
|
|
9723
9789
|
}) => {
|
|
9724
9790
|
const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), g = useMemo(() => {
|
|
9725
9791
|
if (!l.trim()) return a;
|
|
9726
|
-
const
|
|
9792
|
+
const x = l.toLowerCase();
|
|
9727
9793
|
return Object.fromEntries(
|
|
9728
9794
|
Object.entries(a).filter(([y, b]) => {
|
|
9729
9795
|
var v;
|
|
9730
|
-
return (y == null ? void 0 : y.toLowerCase().includes(
|
|
9796
|
+
return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((v = b == null ? void 0 : b.description) == null ? void 0 : v.toLowerCase().includes(x));
|
|
9731
9797
|
})
|
|
9732
9798
|
);
|
|
9733
|
-
}, [a, l]), h = (
|
|
9799
|
+
}, [a, l]), h = (x) => {
|
|
9734
9800
|
d(!0), u({
|
|
9735
|
-
x:
|
|
9736
|
-
y:
|
|
9801
|
+
x: x.clientX - n.x,
|
|
9802
|
+
y: x.clientY - n.y
|
|
9737
9803
|
});
|
|
9738
|
-
}, m = (
|
|
9804
|
+
}, m = (x) => {
|
|
9739
9805
|
if (!c) return;
|
|
9740
|
-
const y =
|
|
9806
|
+
const y = x.clientX - p.x, b = x.clientY - p.y, v = x.currentTarget, B = v.offsetWidth, w = v.offsetHeight, _ = window.innerWidth - B, E = window.innerHeight - w, S = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, E));
|
|
9741
9807
|
r(S, A);
|
|
9742
|
-
},
|
|
9808
|
+
}, f = () => {
|
|
9743
9809
|
d(!1);
|
|
9744
9810
|
};
|
|
9745
9811
|
return useEffect(() => {
|
|
9746
|
-
const
|
|
9812
|
+
const x = () => {
|
|
9747
9813
|
c && d(!1);
|
|
9748
9814
|
};
|
|
9749
|
-
return window.addEventListener("mouseup",
|
|
9815
|
+
return window.addEventListener("mouseup", x), () => window.removeEventListener("mouseup", x);
|
|
9750
9816
|
}, [c]), !n || n.x < 0 || n.y < 0 ? null : /* @__PURE__ */ jsxs(
|
|
9751
9817
|
"div",
|
|
9752
9818
|
{
|
|
9753
9819
|
onMouseDown: h,
|
|
9754
9820
|
onMouseMove: m,
|
|
9755
|
-
onMouseUp:
|
|
9821
|
+
onMouseUp: f,
|
|
9756
9822
|
className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
|
|
9757
9823
|
style: {
|
|
9758
9824
|
left: n.x,
|
|
@@ -9794,13 +9860,13 @@ const RootLayout = () => {
|
|
|
9794
9860
|
placeholder: "Search features...",
|
|
9795
9861
|
className: "w-full pl-8",
|
|
9796
9862
|
value: l,
|
|
9797
|
-
onChange: (
|
|
9863
|
+
onChange: (x) => i(x.target.value),
|
|
9798
9864
|
autoFocus: !0
|
|
9799
9865
|
}
|
|
9800
9866
|
)
|
|
9801
9867
|
] })
|
|
9802
9868
|
] }),
|
|
9803
|
-
/* @__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(([
|
|
9869
|
+
/* @__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: [
|
|
9804
9870
|
'No features found matching "',
|
|
9805
9871
|
l,
|
|
9806
9872
|
'"'
|
|
@@ -9911,17 +9977,17 @@ const RootLayout = () => {
|
|
|
9911
9977
|
for (const i of n.p)
|
|
9912
9978
|
l.add(i);
|
|
9913
9979
|
return l;
|
|
9914
|
-
}, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...
|
|
9915
|
-
var
|
|
9916
|
-
return (
|
|
9917
|
-
}, g = (m,
|
|
9918
|
-
var
|
|
9919
|
-
return (
|
|
9980
|
+
}, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...f) => m.read(...f), p = (m, ...f) => m.write(...f), u = (m, f) => {
|
|
9981
|
+
var x;
|
|
9982
|
+
return (x = m.unstable_onInit) == null ? void 0 : x.call(m, f);
|
|
9983
|
+
}, g = (m, f) => {
|
|
9984
|
+
var x;
|
|
9985
|
+
return (x = m.onMount) == null ? void 0 : x.call(m, f);
|
|
9920
9986
|
}, ...h) => {
|
|
9921
9987
|
const m = h[0] || ((A) => {
|
|
9922
9988
|
let N = o.get(A);
|
|
9923
9989
|
return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
|
|
9924
|
-
}),
|
|
9990
|
+
}), f = h[1] || (() => {
|
|
9925
9991
|
let A, N;
|
|
9926
9992
|
const C = (k) => {
|
|
9927
9993
|
try {
|
|
@@ -9936,11 +10002,11 @@ const RootLayout = () => {
|
|
|
9936
10002
|
a.forEach((I) => {
|
|
9937
10003
|
var L;
|
|
9938
10004
|
return (L = n.get(I)) == null ? void 0 : L.l.forEach(j);
|
|
9939
|
-
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size &&
|
|
10005
|
+
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
|
|
9940
10006
|
} while (a.size || i.size || l.size);
|
|
9941
10007
|
if (A)
|
|
9942
10008
|
throw N;
|
|
9943
|
-
}),
|
|
10009
|
+
}), x = h[2] || (() => {
|
|
9944
10010
|
const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
|
|
9945
10011
|
for (; k.length; ) {
|
|
9946
10012
|
const j = k[k.length - 1], I = m(j);
|
|
@@ -9980,7 +10046,7 @@ const RootLayout = () => {
|
|
|
9980
10046
|
k.d.clear();
|
|
9981
10047
|
let j = !0;
|
|
9982
10048
|
const I = () => {
|
|
9983
|
-
n.has(A) && (B(A),
|
|
10049
|
+
n.has(A) && (B(A), x(), f());
|
|
9984
10050
|
}, L = (P) => {
|
|
9985
10051
|
var $;
|
|
9986
10052
|
if (isSelfAtom(A, P)) {
|
|
@@ -10010,7 +10076,7 @@ const RootLayout = () => {
|
|
|
10010
10076
|
try {
|
|
10011
10077
|
return v(A, ...P);
|
|
10012
10078
|
} finally {
|
|
10013
|
-
|
|
10079
|
+
x(), f();
|
|
10014
10080
|
}
|
|
10015
10081
|
}), T;
|
|
10016
10082
|
}
|
|
@@ -10050,7 +10116,7 @@ const RootLayout = () => {
|
|
|
10050
10116
|
} else
|
|
10051
10117
|
return v(I, ...L);
|
|
10052
10118
|
} finally {
|
|
10053
|
-
C || (
|
|
10119
|
+
C || (x(), f());
|
|
10054
10120
|
}
|
|
10055
10121
|
};
|
|
10056
10122
|
try {
|
|
@@ -10093,7 +10159,7 @@ const RootLayout = () => {
|
|
|
10093
10159
|
try {
|
|
10094
10160
|
return v(A, ...R);
|
|
10095
10161
|
} finally {
|
|
10096
|
-
I || (
|
|
10162
|
+
I || (x(), f());
|
|
10097
10163
|
}
|
|
10098
10164
|
};
|
|
10099
10165
|
try {
|
|
@@ -10146,8 +10212,8 @@ const RootLayout = () => {
|
|
|
10146
10212
|
g,
|
|
10147
10213
|
// building-block functions
|
|
10148
10214
|
m,
|
|
10149
|
-
x,
|
|
10150
10215
|
f,
|
|
10216
|
+
x,
|
|
10151
10217
|
y,
|
|
10152
10218
|
b,
|
|
10153
10219
|
v,
|
|
@@ -10160,13 +10226,13 @@ const RootLayout = () => {
|
|
|
10160
10226
|
try {
|
|
10161
10227
|
return v(A, ...N);
|
|
10162
10228
|
} finally {
|
|
10163
|
-
|
|
10229
|
+
x(), f();
|
|
10164
10230
|
}
|
|
10165
10231
|
},
|
|
10166
10232
|
sub: (A, N) => {
|
|
10167
10233
|
const k = w(A).l;
|
|
10168
|
-
return k.add(N),
|
|
10169
|
-
k.delete(N), _(A),
|
|
10234
|
+
return k.add(N), f(), () => {
|
|
10235
|
+
k.delete(N), _(A), f();
|
|
10170
10236
|
};
|
|
10171
10237
|
}
|
|
10172
10238
|
};
|
|
@@ -10361,6 +10427,7 @@ export {
|
|
|
10361
10427
|
usePasteBlocks,
|
|
10362
10428
|
usePermissions,
|
|
10363
10429
|
usePreviewMode,
|
|
10430
|
+
useRemoveAllClassesForBlock,
|
|
10364
10431
|
useRemoveBlocks,
|
|
10365
10432
|
useRemoveClassesFromBlocks,
|
|
10366
10433
|
useResetBlockStyles,
|