@chaibuilder/sdk 2.4.4 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{code-editor-CJfScsxg.js → code-editor-0HrsuGAE.js} +1 -1
- package/dist/{code-editor-Dy-oKXKY.cjs → code-editor-67qfXwGU.cjs} +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +773 -731
- package/dist/{CssImportModal-DXUM3oRB.js → css-import-modal-CcUf6F6T.js} +1 -1
- package/dist/{CssImportModal-CUuK4FZH.cjs → css-import-modal-CdOK43Be.cjs} +1 -1
- package/dist/{toggle-D0REpYUl.cjs → toggle-BgZfmuec.cjs} +1 -1
- package/dist/{toggle-BKtuoy5e.js → toggle-CyXEVUOu.js} +241 -244
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/package.json +5 -5
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, 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,
|
|
14
|
-
import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon,
|
|
13
|
+
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, a9 as DialogTitle, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, r as Avatar, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-CyXEVUOu.js";
|
|
14
|
+
import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
|
|
15
15
|
import clsx$1, { clsx } from "clsx";
|
|
16
16
|
import { twMerge } from "tailwind-merge";
|
|
17
17
|
import TreeModel from "tree-model";
|
|
@@ -37,7 +37,7 @@ import { useFeature } from "flagged";
|
|
|
37
37
|
import { parse, stringify } from "himalaya";
|
|
38
38
|
import { Tree } from "react-arborist";
|
|
39
39
|
import i18n from "i18next";
|
|
40
|
-
import { default as
|
|
40
|
+
import { default as ze } from "i18next";
|
|
41
41
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
42
42
|
import tailwindForms from "@tailwindcss/forms";
|
|
43
43
|
import tailwindTypography from "@tailwindcss/typography";
|
|
@@ -343,16 +343,16 @@ function insertBlocksAtPosition(o, r, n, 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
|
-
k.startsWith("content-") && (
|
|
353
|
-
}),
|
|
346
|
+
Object.keys(u).forEach((x) => {
|
|
347
|
+
x.startsWith("content-") && (m[x] = u[x]);
|
|
348
|
+
}), l.unshift(m), i = i.map((x) => {
|
|
349
|
+
if (x._id === n) {
|
|
350
|
+
const f = { ...x, content: "" };
|
|
351
|
+
return Object.keys(f).forEach((k) => {
|
|
352
|
+
k.startsWith("content-") && (f[k] = "");
|
|
353
|
+
}), f;
|
|
354
354
|
}
|
|
355
|
-
return
|
|
355
|
+
return x;
|
|
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 = n.find((
|
|
484
|
-
m && "content" in m && (n = n.map((
|
|
485
|
-
if (
|
|
486
|
-
const
|
|
483
|
+
const m = n.find((x) => x._id === u);
|
|
484
|
+
m && "content" in m && (n = n.map((x) => {
|
|
485
|
+
if (x._id === u) {
|
|
486
|
+
const f = { ...x, content: h.content };
|
|
487
487
|
return Object.keys(h).forEach((k) => {
|
|
488
|
-
k.startsWith("content-") && (
|
|
489
|
-
}),
|
|
488
|
+
k.startsWith("content-") && (f[k] = h[k]);
|
|
489
|
+
}), f;
|
|
490
490
|
}
|
|
491
|
-
return
|
|
491
|
+
return x;
|
|
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 (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, n ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), h = (o == null ? void 0 : o._type) !== "Repeater" && r === "live";
|
|
575
575
|
return useEffect(() => {
|
|
576
576
|
if (r === "mock") {
|
|
577
577
|
if (isFunction(a)) {
|
|
578
|
-
i((
|
|
579
|
-
const
|
|
580
|
-
if (!isObject(
|
|
578
|
+
i((f) => ({ ...f, status: "loading", props: {} }));
|
|
579
|
+
const x = a({ block: o });
|
|
580
|
+
if (!isObject(x))
|
|
581
581
|
throw new Error("mockDataProvider should return an object");
|
|
582
|
-
i((
|
|
582
|
+
i((f) => ({ ...f, status: "loaded", props: x }));
|
|
583
583
|
}
|
|
584
584
|
return;
|
|
585
585
|
}
|
|
586
|
-
r === "live" && (!g && !h || (i((
|
|
587
|
-
g ? (p((
|
|
588
|
-
...
|
|
586
|
+
r === "live" && (!g && !h || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
|
|
587
|
+
g ? (p((f) => ({
|
|
588
|
+
...f,
|
|
589
589
|
[o._id]: {
|
|
590
590
|
status: "loaded",
|
|
591
|
-
props: get(
|
|
591
|
+
props: get(x, "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((f) => ({ ...f, status: "loaded", props: { totalItems: get(x, "totalItems") } })), c([o._id], { totalItems: get(x, "totalItems") })) : i((f) => ({ ...f, status: "loaded", props: isObject(x) ? x : {} }));
|
|
595
|
+
}).catch((x) => {
|
|
596
|
+
g ? (p((f) => ({
|
|
597
|
+
...f,
|
|
598
|
+
[o._id]: { status: "error", error: x, props: [] }
|
|
599
|
+
})), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
|
|
600
600
|
})));
|
|
601
601
|
}, [o == null ? void 0 : o._id, u, g, h, a, r]), {
|
|
602
602
|
$loading: get(l, "status") === "loading",
|
|
@@ -761,10 +761,10 @@ const checkMissingTranslations = (o, r) => r ? o.some((n) => {
|
|
|
761
761
|
if (!c("save_page"))
|
|
762
762
|
return;
|
|
763
763
|
r("SAVING"), a("SAVING");
|
|
764
|
-
const
|
|
764
|
+
const x = l();
|
|
765
765
|
return await n({
|
|
766
766
|
autoSave: m,
|
|
767
|
-
blocks:
|
|
767
|
+
blocks: x.blocks,
|
|
768
768
|
theme: i,
|
|
769
769
|
needTranslations: u()
|
|
770
770
|
}), setTimeout(() => {
|
|
@@ -839,65 +839,65 @@ const undoRedoStateAtom = atom({
|
|
|
839
839
|
updateBlocksProps: c
|
|
840
840
|
} = useBlocksStoreManager();
|
|
841
841
|
return {
|
|
842
|
-
moveBlocks: (
|
|
843
|
-
const A = map(
|
|
844
|
-
const w = r.find((
|
|
842
|
+
moveBlocks: (f, k, b) => {
|
|
843
|
+
const A = map(f, (_) => {
|
|
844
|
+
const w = r.find((B) => B._id === _)._parent || null, S = r.filter((B) => w ? B._parent === w : !B._parent).map((B) => B._id).indexOf(_);
|
|
845
845
|
return { _id: _, oldParent: w, oldPosition: S };
|
|
846
|
-
}),
|
|
847
|
-
|
|
846
|
+
}), E = A.find(({ _id: _ }) => _ === f[0]);
|
|
847
|
+
E && E.oldParent === k && E.oldPosition === b || (i(f, k, b), o({
|
|
848
848
|
undo: () => each(A, ({ _id: _, oldParent: N, oldPosition: w }) => {
|
|
849
849
|
i([_], N, w);
|
|
850
850
|
}),
|
|
851
|
-
redo: () => i(
|
|
851
|
+
redo: () => i(f, k, b)
|
|
852
852
|
}));
|
|
853
853
|
},
|
|
854
|
-
addBlocks: (
|
|
855
|
-
a(
|
|
856
|
-
undo: () => l(map(
|
|
857
|
-
redo: () => a(
|
|
854
|
+
addBlocks: (f, k, b) => {
|
|
855
|
+
a(f, k, b), o({
|
|
856
|
+
undo: () => l(map(f, "_id")),
|
|
857
|
+
redo: () => a(f, k, b)
|
|
858
858
|
});
|
|
859
859
|
},
|
|
860
|
-
removeBlocks: (
|
|
861
|
-
var
|
|
862
|
-
const k = (
|
|
863
|
-
l(map(
|
|
864
|
-
undo: () => a(
|
|
865
|
-
redo: () => l(map(
|
|
860
|
+
removeBlocks: (f) => {
|
|
861
|
+
var E;
|
|
862
|
+
const k = (E = first(f)) == null ? void 0 : E._parent, A = r.filter((_) => k ? _._parent === k : !_._parent).indexOf(first(f));
|
|
863
|
+
l(map(f, "_id")), o({
|
|
864
|
+
undo: () => a(f, k, A),
|
|
865
|
+
redo: () => l(map(f, "_id"))
|
|
866
866
|
});
|
|
867
867
|
},
|
|
868
|
-
updateBlocks: (
|
|
868
|
+
updateBlocks: (f, k, b) => {
|
|
869
869
|
let A = [];
|
|
870
870
|
if (b)
|
|
871
|
-
A = map(
|
|
871
|
+
A = map(f, (E) => ({ _id: E, ...b }));
|
|
872
872
|
else {
|
|
873
|
-
const
|
|
874
|
-
A = map(
|
|
873
|
+
const E = keys(k);
|
|
874
|
+
A = map(f, (_) => {
|
|
875
875
|
const N = r.find((y) => y._id === _), w = { _id: _ };
|
|
876
|
-
return each(
|
|
876
|
+
return each(E, (y) => w[y] = N[y]), w;
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
c(map(
|
|
879
|
+
c(map(f, (E) => ({ _id: E, ...k }))), o({
|
|
880
880
|
undo: () => c(A),
|
|
881
|
-
redo: () => c(map(
|
|
881
|
+
redo: () => c(map(f, (E) => ({ _id: E, ...k })))
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
|
-
updateBlocksRuntime: (
|
|
885
|
-
c(map(
|
|
884
|
+
updateBlocksRuntime: (f, k) => {
|
|
885
|
+
c(map(f, (b) => ({ _id: b, ...k })));
|
|
886
886
|
},
|
|
887
|
-
setNewBlocks: (
|
|
888
|
-
n(
|
|
887
|
+
setNewBlocks: (f) => {
|
|
888
|
+
n(f), o({
|
|
889
889
|
undo: () => n(r),
|
|
890
|
-
redo: () => n(
|
|
890
|
+
redo: () => n(f)
|
|
891
891
|
});
|
|
892
892
|
},
|
|
893
|
-
updateMultipleBlocksProps: (
|
|
893
|
+
updateMultipleBlocksProps: (f) => {
|
|
894
894
|
let k = [];
|
|
895
|
-
k = map(
|
|
896
|
-
const A = keys(b),
|
|
897
|
-
return each(A, (N) => _[N] =
|
|
898
|
-
}), c(
|
|
895
|
+
k = map(f, (b) => {
|
|
896
|
+
const A = keys(b), E = r.find((N) => N._id === b._id), _ = {};
|
|
897
|
+
return each(A, (N) => _[N] = E[N]), _;
|
|
898
|
+
}), c(f), o({
|
|
899
899
|
undo: () => c(k),
|
|
900
|
-
redo: () => c(
|
|
900
|
+
redo: () => c(f)
|
|
901
901
|
});
|
|
902
902
|
}
|
|
903
903
|
};
|
|
@@ -905,12 +905,12 @@ const undoRedoStateAtom = atom({
|
|
|
905
905
|
const [o] = useBlocksStore(), [, r] = useSelectedBlockIds(), { addBlocks: n } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
906
906
|
(i, c, d) => {
|
|
907
907
|
var m;
|
|
908
|
-
for (let
|
|
909
|
-
const { _id:
|
|
910
|
-
i[
|
|
911
|
-
const k = filter(i, { _parent:
|
|
908
|
+
for (let x = 0; x < i.length; x++) {
|
|
909
|
+
const { _id: f } = i[x];
|
|
910
|
+
i[x]._id = generateUUID();
|
|
911
|
+
const k = filter(i, { _parent: f });
|
|
912
912
|
for (let b = 0; b < k.length; b++)
|
|
913
|
-
k[b]._parent = i[
|
|
913
|
+
k[b]._parent = i[x]._id;
|
|
914
914
|
}
|
|
915
915
|
const p = first(i);
|
|
916
916
|
let u, g;
|
|
@@ -2360,25 +2360,25 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2360
2360
|
return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
|
|
2361
2361
|
})
|
|
2362
2362
|
), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
|
|
2363
|
-
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m,
|
|
2364
|
-
const
|
|
2365
|
-
for (const k in
|
|
2366
|
-
const b =
|
|
2363
|
+
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, x) => {
|
|
2364
|
+
const f = cloneDeep(x.find((k) => k._id === m));
|
|
2365
|
+
for (const k in f) {
|
|
2366
|
+
const b = f[k];
|
|
2367
2367
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2368
|
-
const { baseClasses: A, classes:
|
|
2369
|
-
|
|
2368
|
+
const { baseClasses: A, classes: E } = getSplitChaiClasses(b);
|
|
2369
|
+
f[k] = compact(flattenDeep([A, E])).join(" ");
|
|
2370
2370
|
} else
|
|
2371
|
-
k !== "_id" && delete
|
|
2371
|
+
k !== "_id" && delete f[k];
|
|
2372
2372
|
}
|
|
2373
|
-
return
|
|
2373
|
+
return f;
|
|
2374
2374
|
};
|
|
2375
2375
|
return {
|
|
2376
2376
|
askAi: useCallback(
|
|
2377
|
-
async (m,
|
|
2377
|
+
async (m, x, f, k) => {
|
|
2378
2378
|
if (l) {
|
|
2379
2379
|
r(!0), a(null);
|
|
2380
2380
|
try {
|
|
2381
|
-
const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(
|
|
2381
|
+
const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p) : [h(x, d)], E = await l(m, addLangToPrompt(f, g, m), A, b), { blocks: _, error: N } = E;
|
|
2382
2382
|
if (N) {
|
|
2383
2383
|
a(N);
|
|
2384
2384
|
return;
|
|
@@ -2392,7 +2392,7 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2392
2392
|
c(w);
|
|
2393
2393
|
} else
|
|
2394
2394
|
i(_);
|
|
2395
|
-
k && k(
|
|
2395
|
+
k && k(E);
|
|
2396
2396
|
} catch (b) {
|
|
2397
2397
|
a(b);
|
|
2398
2398
|
} finally {
|
|
@@ -2490,12 +2490,12 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2490
2490
|
if (!p)
|
|
2491
2491
|
return h;
|
|
2492
2492
|
let m = [];
|
|
2493
|
-
for (const
|
|
2494
|
-
if (
|
|
2495
|
-
let
|
|
2496
|
-
|
|
2493
|
+
for (const x of h)
|
|
2494
|
+
if (x._type === "PartialBlock" || x._type === "GlobalBlock") {
|
|
2495
|
+
let f = l(x.partialBlockId);
|
|
2496
|
+
x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((k) => (isEmpty(k._parent) && set(k, "_parent", x._parent), k))), m = [...m, ...f];
|
|
2497
2497
|
} else
|
|
2498
|
-
m.push(
|
|
2498
|
+
m.push(x);
|
|
2499
2499
|
return m;
|
|
2500
2500
|
})
|
|
2501
2501
|
};
|
|
@@ -2678,13 +2678,13 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2678
2678
|
const d = o(c), p = a;
|
|
2679
2679
|
let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
|
|
2680
2680
|
return each(p, (h) => {
|
|
2681
|
-
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2682
|
-
u = u.replace(
|
|
2683
|
-
const
|
|
2684
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2681
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2682
|
+
u = u.replace(x, " ").replace(/\s+/g, " ").trim();
|
|
2683
|
+
const f = first(h.split(":"));
|
|
2684
|
+
includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(h.split(":").pop().trim());
|
|
2685
2685
|
}), each(p, (h) => {
|
|
2686
|
-
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2687
|
-
g = g.replace(
|
|
2686
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2687
|
+
g = g.replace(x, " ").replace(/\s+/g, " ").trim();
|
|
2688
2688
|
}), {
|
|
2689
2689
|
ids: [d._id],
|
|
2690
2690
|
props: {
|
|
@@ -2833,21 +2833,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
|
|
|
2833
2833
|
return "VERTICAL";
|
|
2834
2834
|
}
|
|
2835
2835
|
}, isDisabledControl = (o, r, n) => !!(o && (n === "UP" || n === "LEFT") || r && (n === "DOWN" || n === "RIGHT")), useBlockController = (o, r) => {
|
|
2836
|
-
const [n] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(n, (
|
|
2837
|
-
(
|
|
2838
|
-
isDisabledControl(g, h,
|
|
2836
|
+
const [n] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(n, (f) => c ? get(f, "_parent") === c : !get(f, "_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), x = useCallback(
|
|
2837
|
+
(f) => {
|
|
2838
|
+
isDisabledControl(g, h, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), r());
|
|
2839
2839
|
},
|
|
2840
2840
|
[g, h, p, u, i, c, r]
|
|
2841
2841
|
);
|
|
2842
2842
|
return useHotkeys(
|
|
2843
2843
|
"shift+up, shift+down, shift+left, shift+right",
|
|
2844
|
-
({ key:
|
|
2844
|
+
({ key: f }) => {
|
|
2845
2845
|
var k;
|
|
2846
|
-
|
|
2846
|
+
x((k = f == null ? void 0 : f.replace("Arrow", "")) == null ? void 0 : k.toUpperCase());
|
|
2847
2847
|
},
|
|
2848
2848
|
{ document: a == null ? void 0 : a.contentDocument },
|
|
2849
|
-
[
|
|
2850
|
-
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock:
|
|
2849
|
+
[x]
|
|
2850
|
+
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: x, orientation: m };
|
|
2851
2851
|
}, BlockController = ({ block: o, updateFloatingBar: r }) => {
|
|
2852
2852
|
const { isOnlyChild: n, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
|
|
2853
2853
|
o,
|
|
@@ -3015,7 +3015,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3015
3015
|
elements: { reference: r }
|
|
3016
3016
|
});
|
|
3017
3017
|
useResizeObserver(r, () => m(), r !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
|
|
3018
|
-
const
|
|
3018
|
+
const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
3019
3019
|
return useEffect(() => {
|
|
3020
3020
|
if (r) {
|
|
3021
3021
|
const k = setTimeout(() => m(), 500);
|
|
@@ -3038,16 +3038,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3038
3038
|
onKeyDown: (k) => k.stopPropagation(),
|
|
3039
3039
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3040
3040
|
children: [
|
|
3041
|
-
|
|
3041
|
+
x && /* @__PURE__ */ jsx(
|
|
3042
3042
|
ArrowUpIcon,
|
|
3043
3043
|
{
|
|
3044
3044
|
className: "hover:scale-105",
|
|
3045
3045
|
onClick: () => {
|
|
3046
|
-
c([]), l([
|
|
3046
|
+
c([]), l([x]);
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
3049
|
),
|
|
3050
|
-
/* @__PURE__ */ jsx(BlockActionLabel, { label:
|
|
3050
|
+
/* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
|
|
3051
3051
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
|
|
3052
3052
|
/* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
|
|
3053
3053
|
canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
|
|
@@ -3205,8 +3205,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3205
3205
|
i
|
|
3206
3206
|
]), useHotkeys(
|
|
3207
3207
|
"del, backspace",
|
|
3208
|
-
(
|
|
3209
|
-
|
|
3208
|
+
(x) => {
|
|
3209
|
+
x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(r);
|
|
3210
3210
|
},
|
|
3211
3211
|
m,
|
|
3212
3212
|
[r, l]
|
|
@@ -3499,8 +3499,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3499
3499
|
],
|
|
3500
3500
|
onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
|
|
3501
3501
|
onBlur: ({ editor: u, event: g }) => {
|
|
3502
|
-
const h = g.relatedTarget, m = i.querySelector(".ProseMirror"),
|
|
3503
|
-
if (!
|
|
3502
|
+
const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = m == null ? void 0 : m.contains(h), k = x == null ? void 0 : x.contains(h);
|
|
3503
|
+
if (!f && !k) {
|
|
3504
3504
|
const b = (u == null ? void 0 : u.getHTML()) || "";
|
|
3505
3505
|
n(b);
|
|
3506
3506
|
}
|
|
@@ -3555,14 +3555,14 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3555
3555
|
useEffect(() => {
|
|
3556
3556
|
if (a.current) {
|
|
3557
3557
|
a.current.innerText = r, a.current.focus();
|
|
3558
|
-
const m = c.createRange(),
|
|
3559
|
-
m.selectNodeContents(a.current), m.collapse(!1),
|
|
3558
|
+
const m = c.createRange(), x = d.getSelection();
|
|
3559
|
+
m.selectNodeContents(a.current), m.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(m), a.current.focus();
|
|
3560
3560
|
} else
|
|
3561
3561
|
n();
|
|
3562
3562
|
}, [c, d]);
|
|
3563
3563
|
const p = useMemo(() => {
|
|
3564
|
-
var
|
|
3565
|
-
const m = ((
|
|
3564
|
+
var x;
|
|
3565
|
+
const m = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
|
|
3566
3566
|
return m === "button" ? "div" : m;
|
|
3567
3567
|
}, [o]), u = useCallback(
|
|
3568
3568
|
(m) => {
|
|
@@ -3578,12 +3578,12 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3578
3578
|
contentEditable: !0,
|
|
3579
3579
|
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]`,
|
|
3580
3580
|
style: cloneDeep(o == null ? void 0 : o.style) || {},
|
|
3581
|
-
onInput: (
|
|
3582
|
-
const
|
|
3583
|
-
|
|
3581
|
+
onInput: (x) => {
|
|
3582
|
+
const f = x.target;
|
|
3583
|
+
f && (f.innerText.trim() === "" ? (f.setAttribute("data-placeholder", "Enter text here"), f.children.length > 0 && f.children[0].remove()) : x.target.removeAttribute("data-placeholder"), l(x.target.innerText));
|
|
3584
3584
|
},
|
|
3585
|
-
onClick: (
|
|
3586
|
-
|
|
3585
|
+
onClick: (x) => {
|
|
3586
|
+
x.stopPropagation(), x.preventDefault();
|
|
3587
3587
|
}
|
|
3588
3588
|
};
|
|
3589
3589
|
}, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
|
|
@@ -3596,41 +3596,41 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3596
3596
|
}
|
|
3597
3597
|
), WithBlockTextEditor = memo(
|
|
3598
3598
|
({ block: o, children: r }) => {
|
|
3599
|
-
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang:
|
|
3599
|
+
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), k = useRef(null), b = l, { blockContent: A, blockType: E } = useMemo(() => {
|
|
3600
3600
|
var j;
|
|
3601
3601
|
const S = o._type;
|
|
3602
|
-
let
|
|
3602
|
+
let B = o[n];
|
|
3603
3603
|
const v = getRegisteredChaiBlock(o._type);
|
|
3604
|
-
return
|
|
3605
|
-
}, [o,
|
|
3604
|
+
return x && ((j = v == null ? void 0 : v.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${x}`) && (B = get(o, `${n}-${x}`)), { blockContent: B, blockType: S };
|
|
3605
|
+
}, [o, x]), _ = useCallback(
|
|
3606
3606
|
(S) => {
|
|
3607
3607
|
var v;
|
|
3608
|
-
const
|
|
3609
|
-
m([b], { [n]:
|
|
3608
|
+
const B = S || ((v = g.current) == null ? void 0 : v.innerText);
|
|
3609
|
+
m([b], { [n]: B }), u(null), c(null), d(-1), f(b ? [b] : []);
|
|
3610
3610
|
},
|
|
3611
|
-
[b, m, c,
|
|
3611
|
+
[b, m, c, f, x]
|
|
3612
3612
|
), N = useDebouncedCallback(
|
|
3613
3613
|
(S) => {
|
|
3614
3614
|
m([b], { [n]: S });
|
|
3615
3615
|
},
|
|
3616
|
-
[b, o, m,
|
|
3616
|
+
[b, o, m, x],
|
|
3617
3617
|
1e3
|
|
3618
3618
|
), w = useCallback(
|
|
3619
3619
|
(S) => {
|
|
3620
3620
|
S.preventDefault(), b && (k.current = b), _(), setTimeout(() => {
|
|
3621
|
-
const
|
|
3622
|
-
k.current = null,
|
|
3621
|
+
const B = k.current;
|
|
3622
|
+
k.current = null, f([B]);
|
|
3623
3623
|
}, 100);
|
|
3624
3624
|
},
|
|
3625
|
-
[
|
|
3625
|
+
[f, b, x]
|
|
3626
3626
|
);
|
|
3627
3627
|
useEffect(() => {
|
|
3628
3628
|
var C;
|
|
3629
3629
|
if (!b) return;
|
|
3630
|
-
const S = `[data-block-id="${b}"]`,
|
|
3630
|
+
const S = `[data-block-id="${b}"]`, B = i >= 0 ? `[data-block-index="${i}"]` : "", v = a.querySelector(`${S}${B}`);
|
|
3631
3631
|
v && ((C = v == null ? void 0 : v.classList) == null || C.add("sr-only"), u(v));
|
|
3632
|
-
}, [b,
|
|
3633
|
-
const y = useMemo(() => p ? (h(),
|
|
3632
|
+
}, [b, E, a, i]);
|
|
3633
|
+
const y = useMemo(() => p ? (h(), E === "RichText" ? /* @__PURE__ */ jsx(
|
|
3634
3634
|
RichTextEditor,
|
|
3635
3635
|
{
|
|
3636
3636
|
blockContent: A,
|
|
@@ -3649,7 +3649,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3649
3649
|
onChange: N,
|
|
3650
3650
|
onEscape: w
|
|
3651
3651
|
}
|
|
3652
|
-
)) : null, [p, b,
|
|
3652
|
+
)) : null, [p, b, E, A, _, x]);
|
|
3653
3653
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3654
3654
|
y,
|
|
3655
3655
|
r
|
|
@@ -3684,23 +3684,23 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3684
3684
|
blockAtom: r,
|
|
3685
3685
|
children: n
|
|
3686
3686
|
}) => {
|
|
3687
|
-
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom),
|
|
3687
|
+
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), x = get(c, "component", null), { index: f, key: k } = useContext(RepeaterContext), b = useMemo(
|
|
3688
3688
|
() => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
|
|
3689
|
-
index:
|
|
3689
|
+
index: f,
|
|
3690
3690
|
key: k
|
|
3691
3691
|
}) : applyLanguage(i, d, c),
|
|
3692
|
-
[i, d, c, g, m,
|
|
3693
|
-
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]),
|
|
3692
|
+
[i, d, c, g, m, f, k]
|
|
3693
|
+
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), E = useMemo(
|
|
3694
3694
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3695
3695
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3696
3696
|
), _ = useMemo(
|
|
3697
3697
|
() => ({
|
|
3698
|
-
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index":
|
|
3698
|
+
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
|
|
3699
3699
|
inBuilder: !0,
|
|
3700
3700
|
lang: d || p,
|
|
3701
3701
|
...b,
|
|
3702
3702
|
...A,
|
|
3703
|
-
...
|
|
3703
|
+
...E,
|
|
3704
3704
|
...o
|
|
3705
3705
|
}),
|
|
3706
3706
|
[
|
|
@@ -3710,12 +3710,12 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3710
3710
|
p,
|
|
3711
3711
|
b,
|
|
3712
3712
|
A,
|
|
3713
|
-
|
|
3713
|
+
E,
|
|
3714
3714
|
o
|
|
3715
3715
|
]
|
|
3716
3716
|
), N = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3717
|
-
if (isNull(
|
|
3718
|
-
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(
|
|
3717
|
+
if (isNull(x) || h.includes(i._id)) return null;
|
|
3718
|
+
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(x, {
|
|
3719
3719
|
..._,
|
|
3720
3720
|
children: n({
|
|
3721
3721
|
_id: i._id,
|
|
@@ -3728,7 +3728,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3728
3728
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3729
3729
|
})
|
|
3730
3730
|
}) });
|
|
3731
|
-
const y = a === i._id && (l ===
|
|
3731
|
+
const y = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
|
|
3732
3732
|
return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: y }) : y;
|
|
3733
3733
|
}, PartialWrapper = ({ children: o, partialBlockId: r }) => {
|
|
3734
3734
|
const n = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
@@ -3769,7 +3769,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3769
3769
|
);
|
|
3770
3770
|
return map(l, (c) => {
|
|
3771
3771
|
const d = a(c._id);
|
|
3772
|
-
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey:
|
|
3772
|
+
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: x }) => g === "Repeater" ? isArray(m) && m.map((f, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) : null }) }, c._id) : null;
|
|
3773
3773
|
});
|
|
3774
3774
|
}, PageBlocksRenderer = () => {
|
|
3775
3775
|
const [o] = useBlocksStore();
|
|
@@ -3837,14 +3837,14 @@ const CanvasEventsWatcher = () => {
|
|
|
3837
3837
|
}, StaticCanvas = () => {
|
|
3838
3838
|
const [o] = useCanvasDisplayWidth(), [, r] = useHighlightBlockId(), n = 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(
|
|
3839
3839
|
(m) => {
|
|
3840
|
-
i((
|
|
3840
|
+
i((x) => ({ ...x, width: m }));
|
|
3841
3841
|
},
|
|
3842
3842
|
[i]
|
|
3843
3843
|
);
|
|
3844
3844
|
useEffect(() => {
|
|
3845
3845
|
if (!a.current) return;
|
|
3846
|
-
const { clientWidth: m, clientHeight:
|
|
3847
|
-
i({ width: m, height:
|
|
3846
|
+
const { clientWidth: m, clientHeight: x } = a.current;
|
|
3847
|
+
i({ width: m, height: x });
|
|
3848
3848
|
}, [a, o]);
|
|
3849
3849
|
const h = useMemo(() => {
|
|
3850
3850
|
let m = IframeInitialContent;
|
|
@@ -3894,7 +3894,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3894
3894
|
}, FallbackError = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3895
3895
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3896
3896
|
/* @__PURE__ */ jsx("p", { children: "Please try again." })
|
|
3897
|
-
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
3897
|
+
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-0HrsuGAE.js")), CanvasArea = () => {
|
|
3898
3898
|
const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
|
|
3899
3899
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3900
3900
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -3959,8 +3959,8 @@ const CanvasEventsWatcher = () => {
|
|
|
3959
3959
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
|
|
3960
3960
|
] });
|
|
3961
3961
|
}, DefaultMediaManager = ({ close: o, onSelect: r, mode: n = "image" }) => {
|
|
3962
|
-
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (
|
|
3963
|
-
if (!
|
|
3962
|
+
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (x) => {
|
|
3963
|
+
if (!x.trim()) {
|
|
3964
3964
|
p(!1), g("Please enter a URL");
|
|
3965
3965
|
return;
|
|
3966
3966
|
}
|
|
@@ -3984,7 +3984,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3984
3984
|
{
|
|
3985
3985
|
placeholder: m(`Enter ${n} URL`),
|
|
3986
3986
|
value: a,
|
|
3987
|
-
onChange: (
|
|
3987
|
+
onChange: (x) => l(x.target.value),
|
|
3988
3988
|
onKeyUp: () => h(a)
|
|
3989
3989
|
}
|
|
3990
3990
|
),
|
|
@@ -4020,42 +4020,58 @@ const CanvasEventsWatcher = () => {
|
|
|
4020
4020
|
] });
|
|
4021
4021
|
};
|
|
4022
4022
|
MediaManagerModal.displayName = "MediaManagerModal";
|
|
4023
|
-
const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4023
|
+
const PLACEHOLDER_IMAGE_URL = "https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/dam-assets/02817647-2581-4c50-a005-f72de13d3da7/banner-placeholder.png?cid=20250730t1809109830000?v=2025-07-30T18:09:11.041925+00:00", ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
4024
|
+
var h;
|
|
4025
|
+
const { t: l } = useTranslation(), i = useSelectedBlock(), c = useUpdateBlocksProps(), d = !((h = o == null ? void 0 : o.startsWith) != null && h.call(o, "https://fldwljgzcktqnysdkxnn")), p = (m) => {
|
|
4026
|
+
const x = isArray(m) ? first(m) : m;
|
|
4027
|
+
if (x) {
|
|
4028
|
+
r(x == null ? void 0 : x.url);
|
|
4029
|
+
const f = x == null ? void 0 : x.width, k = x == null ? void 0 : x.height;
|
|
4029
4030
|
if (i != null && i._id) {
|
|
4030
|
-
const
|
|
4031
|
-
...
|
|
4032
|
-
...
|
|
4033
|
-
...
|
|
4034
|
-
...
|
|
4031
|
+
const b = {
|
|
4032
|
+
...f && { width: f },
|
|
4033
|
+
...k && { height: k },
|
|
4034
|
+
...x.description && { alt: x.description },
|
|
4035
|
+
...x.id && { assetId: x.id }
|
|
4035
4036
|
};
|
|
4036
|
-
if (isEmpty(
|
|
4037
|
-
c([i._id],
|
|
4037
|
+
if (isEmpty(b)) return;
|
|
4038
|
+
c([i._id], b);
|
|
4038
4039
|
}
|
|
4039
4040
|
}
|
|
4040
|
-
},
|
|
4041
|
-
r(
|
|
4042
|
-
}, [r, i == null ? void 0 : i._id, c]),
|
|
4041
|
+
}, u = useCallback(() => {
|
|
4042
|
+
r(PLACEHOLDER_IMAGE_URL), i != null && i._id && c([i._id], { assetId: "" });
|
|
4043
|
+
}, [r, i == null ? void 0 : i._id, c]), g = get(i, "assetId", "");
|
|
4043
4044
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
4044
|
-
o ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
4045
|
-
/* @__PURE__ */ jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }),
|
|
4045
|
+
o ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
4046
4046
|
/* @__PURE__ */ jsx(
|
|
4047
|
+
"img",
|
|
4048
|
+
{
|
|
4049
|
+
src: o,
|
|
4050
|
+
className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (g && g !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
|
|
4051
|
+
alt: ""
|
|
4052
|
+
}
|
|
4053
|
+
),
|
|
4054
|
+
d && /* @__PURE__ */ jsx(
|
|
4047
4055
|
"button",
|
|
4048
4056
|
{
|
|
4049
4057
|
type: "button",
|
|
4050
|
-
onClick:
|
|
4051
|
-
className: "absolute -right-2 -top-2 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4058
|
+
onClick: u,
|
|
4059
|
+
className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4052
4060
|
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
4053
4061
|
}
|
|
4054
|
-
)
|
|
4055
|
-
|
|
4062
|
+
),
|
|
4063
|
+
g && g !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: p, assetId: g, children: /* @__PURE__ */ jsx(
|
|
4064
|
+
"button",
|
|
4065
|
+
{
|
|
4066
|
+
type: "button",
|
|
4067
|
+
className: "absolute inset-0 z-10 flex cursor-pointer items-center justify-center bg-black/10 opacity-0 transition duration-200 group-hover:bg-black/30 group-hover:opacity-100",
|
|
4068
|
+
children: /* @__PURE__ */ jsx(Edit2Icon, { className: "h-4 w-4 text-white" })
|
|
4069
|
+
}
|
|
4070
|
+
) })
|
|
4071
|
+
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: p, mode: "image", assetId: g, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
4056
4072
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4057
4073
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4058
|
-
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
4074
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: p, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 cursor-pointer rounded-md bg-secondary px-2 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: o || !isEmpty(o) ? l("Replace image") : l("Choose image") }) }),
|
|
4059
4075
|
/* @__PURE__ */ jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-secondary-foreground", children: "OR" })
|
|
4060
4076
|
] }),
|
|
4061
4077
|
/* @__PURE__ */ jsx(
|
|
@@ -4069,8 +4085,8 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
|
4069
4085
|
className: "text-xs",
|
|
4070
4086
|
placeholder: l("Enter image URL"),
|
|
4071
4087
|
value: o,
|
|
4072
|
-
onBlur: ({ target: { value:
|
|
4073
|
-
onChange: (
|
|
4088
|
+
onBlur: ({ target: { value: m } }) => a(n, m),
|
|
4089
|
+
onChange: (m) => r(m.target.value)
|
|
4074
4090
|
}
|
|
4075
4091
|
)
|
|
4076
4092
|
] })
|
|
@@ -4078,14 +4094,14 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
|
4078
4094
|
}, PathDropdown = ({ data: o, onSelect: r, dataType: n }) => {
|
|
4079
4095
|
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(
|
|
4080
4096
|
(h) => {
|
|
4081
|
-
const m = (
|
|
4082
|
-
h.type === "object" ? (l((
|
|
4097
|
+
const m = (x) => n === "value" ? x === "value" || x === "object" : n === "array" ? x === "array" : x === n;
|
|
4098
|
+
h.type === "object" ? (l((x) => [...x, h.key]), c(h.value)) : m(h.type) && r([...a, h.key].join("."), n);
|
|
4083
4099
|
},
|
|
4084
4100
|
[a, r, n]
|
|
4085
4101
|
), u = React__default.useCallback(() => {
|
|
4086
4102
|
if (a.length > 0) {
|
|
4087
4103
|
const h = a.slice(0, -1);
|
|
4088
|
-
l(h), c(h.reduce((m,
|
|
4104
|
+
l(h), c(h.reduce((m, x) => m[x], o));
|
|
4089
4105
|
}
|
|
4090
4106
|
}, [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 : n === "value" ? h.type === "value" || h.type === "object" : n === "array" ? h.type === "array" || h.type === "object" : n === "object" ? h.type === "object" : !0) : [], [i, n]);
|
|
4091
4107
|
return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
|
|
@@ -4178,7 +4194,7 @@ const DataBindingSelector = ({
|
|
|
4178
4194
|
}) => {
|
|
4179
4195
|
const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
|
|
4180
4196
|
if (i.length === 1) return "";
|
|
4181
|
-
const g = i.find((
|
|
4197
|
+
const g = i.find((x) => x._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
|
|
4182
4198
|
return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
|
|
4183
4199
|
}, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
|
|
4184
4200
|
(g, h) => {
|
|
@@ -4186,43 +4202,43 @@ const DataBindingSelector = ({
|
|
|
4186
4202
|
r(`{{${g}}}`, {}, n);
|
|
4187
4203
|
return;
|
|
4188
4204
|
}
|
|
4189
|
-
const m = (b) => /[.,!?;:]/.test(b),
|
|
4205
|
+
const m = (b) => /[.,!?;:]/.test(b), x = (b, A, E) => {
|
|
4190
4206
|
let _ = "", N = "";
|
|
4191
4207
|
const w = A > 0 ? b[A - 1] : "", y = A < b.length ? b[A] : "";
|
|
4192
4208
|
return A > 0 && (w === "." || !m(w) && w !== " ") && (_ = " "), A < b.length && !m(y) && y !== " " && (N = " "), {
|
|
4193
|
-
text: _ +
|
|
4209
|
+
text: _ + E + N,
|
|
4194
4210
|
prefixLength: _.length,
|
|
4195
4211
|
suffixLength: N.length
|
|
4196
4212
|
};
|
|
4197
|
-
},
|
|
4198
|
-
if (!
|
|
4213
|
+
}, f = document.getElementById(n);
|
|
4214
|
+
if (!f) return;
|
|
4199
4215
|
const k = document.getElementById(`chai-rte-${n}`) || document.getElementById(`chai-rte-modal-${n}`);
|
|
4200
4216
|
if (k && (k.querySelector(".ProseMirror") || k.__chaiRTE)) {
|
|
4201
4217
|
const b = k.__chaiRTE;
|
|
4202
4218
|
if (b) {
|
|
4203
4219
|
const A = `{{${g}}}`;
|
|
4204
4220
|
b.commands.focus();
|
|
4205
|
-
const { from:
|
|
4206
|
-
if (
|
|
4221
|
+
const { from: E, to: _ } = b.state.selection;
|
|
4222
|
+
if (E !== _)
|
|
4207
4223
|
b.chain().deleteSelection().insertContent(A).run();
|
|
4208
4224
|
else {
|
|
4209
|
-
const { state: w } = b, y = w.selection.from, S = w.doc.textBetween(Math.max(0, y - 1), y),
|
|
4225
|
+
const { state: w } = b, y = w.selection.from, S = w.doc.textBetween(Math.max(0, y - 1), y), B = w.doc.textBetween(y, Math.min(y + 1, w.doc.content.size));
|
|
4210
4226
|
let v = "";
|
|
4211
4227
|
y > 0 && S !== " " && !m(S) && (v = " ");
|
|
4212
4228
|
let C = "";
|
|
4213
|
-
|
|
4229
|
+
B && B !== " " && !m(B) && (C = " "), b.chain().insertContent(v + A + C).run();
|
|
4214
4230
|
}
|
|
4215
4231
|
setTimeout(() => r(b.getHTML(), {}, n), 100);
|
|
4216
4232
|
return;
|
|
4217
4233
|
}
|
|
4218
4234
|
} else {
|
|
4219
|
-
const b =
|
|
4235
|
+
const b = f, A = b.selectionStart || 0, E = b.value || "", _ = b.selectionEnd || A;
|
|
4220
4236
|
if (_ > A) {
|
|
4221
|
-
const
|
|
4237
|
+
const B = `{{${g}}}`, { text: v } = x(E, A, B), C = E.slice(0, A) + v + E.slice(_);
|
|
4222
4238
|
r(C, {}, n);
|
|
4223
4239
|
return;
|
|
4224
4240
|
}
|
|
4225
|
-
const w = `{{${g}}}`, { text: y } =
|
|
4241
|
+
const w = `{{${g}}}`, { text: y } = x(E, A, w), S = E.slice(0, A) + y + E.slice(A);
|
|
4226
4242
|
r(S, {}, n);
|
|
4227
4243
|
}
|
|
4228
4244
|
},
|
|
@@ -4244,10 +4260,10 @@ const DataBindingSelector = ({
|
|
|
4244
4260
|
pageTypes: r,
|
|
4245
4261
|
onChange: n
|
|
4246
4262
|
}) => {
|
|
4247
|
-
var
|
|
4248
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [
|
|
4263
|
+
var B;
|
|
4264
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [x, f] = useState([]), [k, b] = useState(-1), A = useRef(null), E = (B = r == null ? void 0 : r.find((v) => v.key === u)) == null ? void 0 : B.name;
|
|
4249
4265
|
useEffect(() => {
|
|
4250
|
-
if (m(""),
|
|
4266
|
+
if (m(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4251
4267
|
const v = split(o, ":"), C = get(v, 1, "page") || "page";
|
|
4252
4268
|
g(C), (async () => {
|
|
4253
4269
|
const j = await l(C, [get(v, 2, "page")]);
|
|
@@ -4257,10 +4273,10 @@ const DataBindingSelector = ({
|
|
|
4257
4273
|
const _ = useDebouncedCallback(
|
|
4258
4274
|
async (v) => {
|
|
4259
4275
|
if (isEmpty(v))
|
|
4260
|
-
|
|
4276
|
+
f([]);
|
|
4261
4277
|
else {
|
|
4262
4278
|
const C = await l(u, v);
|
|
4263
|
-
|
|
4279
|
+
f(C);
|
|
4264
4280
|
}
|
|
4265
4281
|
c(!1), b(-1);
|
|
4266
4282
|
},
|
|
@@ -4268,18 +4284,18 @@ const DataBindingSelector = ({
|
|
|
4268
4284
|
300
|
|
4269
4285
|
), N = (v) => {
|
|
4270
4286
|
const C = ["pageType", u, v.id];
|
|
4271
|
-
C[1] && (n(C.join(":")), m(v.name), p(!1),
|
|
4287
|
+
C[1] && (n(C.join(":")), m(v.name), p(!1), f([]), b(-1));
|
|
4272
4288
|
}, w = (v) => {
|
|
4273
4289
|
switch (v.key) {
|
|
4274
4290
|
case "ArrowDown":
|
|
4275
|
-
v.preventDefault(), b((C) => C <
|
|
4291
|
+
v.preventDefault(), b((C) => C < x.length - 1 ? C + 1 : C);
|
|
4276
4292
|
break;
|
|
4277
4293
|
case "ArrowUp":
|
|
4278
4294
|
v.preventDefault(), b((C) => C > 0 ? C - 1 : C);
|
|
4279
4295
|
break;
|
|
4280
4296
|
case "Enter":
|
|
4281
|
-
if (v.preventDefault(),
|
|
4282
|
-
k >= 0 && N(
|
|
4297
|
+
if (v.preventDefault(), x.length === 0) return;
|
|
4298
|
+
k >= 0 && N(x[k]);
|
|
4283
4299
|
break;
|
|
4284
4300
|
case "Escape":
|
|
4285
4301
|
v.preventDefault(), y();
|
|
@@ -4293,7 +4309,7 @@ const DataBindingSelector = ({
|
|
|
4293
4309
|
}
|
|
4294
4310
|
}, [k]);
|
|
4295
4311
|
const y = () => {
|
|
4296
|
-
m(""),
|
|
4312
|
+
m(""), f([]), b(-1), p(!1), n("");
|
|
4297
4313
|
}, S = (v) => {
|
|
4298
4314
|
m(v), p(!isEmpty(v)), c(!0), _(v);
|
|
4299
4315
|
};
|
|
@@ -4307,21 +4323,21 @@ const DataBindingSelector = ({
|
|
|
4307
4323
|
value: h,
|
|
4308
4324
|
onChange: (v) => S(v.target.value),
|
|
4309
4325
|
onKeyDown: w,
|
|
4310
|
-
placeholder: a(`Search ${
|
|
4326
|
+
placeholder: a(`Search ${E ?? ""}`),
|
|
4311
4327
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4312
4328
|
}
|
|
4313
4329
|
),
|
|
4314
4330
|
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: y, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
4315
4331
|
] }),
|
|
4316
|
-
(i || !isEmpty(
|
|
4332
|
+
(i || !isEmpty(x) || d && isEmpty(x)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4317
4333
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
4318
4334
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
4319
|
-
] }) : d && isEmpty(
|
|
4335
|
+
] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
4320
4336
|
a("No results found for"),
|
|
4321
4337
|
' "',
|
|
4322
4338
|
h,
|
|
4323
4339
|
'"'
|
|
4324
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(
|
|
4340
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(x == null ? void 0 : x.slice(0, 20), (v, C) => /* @__PURE__ */ jsxs(
|
|
4325
4341
|
"li",
|
|
4326
4342
|
{
|
|
4327
4343
|
onClick: () => N(v),
|
|
@@ -4636,13 +4652,13 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4636
4652
|
if (!u) return;
|
|
4637
4653
|
const m = `{{${h}}}`;
|
|
4638
4654
|
u.commands.focus();
|
|
4639
|
-
const { from:
|
|
4640
|
-
if (
|
|
4655
|
+
const { from: x, to: f } = u.state.selection;
|
|
4656
|
+
if (x !== f)
|
|
4641
4657
|
u.chain().deleteSelection().insertContent(m).run();
|
|
4642
4658
|
else {
|
|
4643
|
-
const { state: b } = u, A = b.selection.from,
|
|
4659
|
+
const { state: b } = u, A = b.selection.from, E = b.doc.textBetween(Math.max(0, A - 1), A), _ = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
|
|
4644
4660
|
let N = "";
|
|
4645
|
-
A > 0 &&
|
|
4661
|
+
A > 0 && E !== " " && !/[.,!?;:]/.test(E) && (N = " ");
|
|
4646
4662
|
let w = "";
|
|
4647
4663
|
_ && _ !== " " && !/[.,!?;:]/.test(_) && (w = " "), u.chain().insertContent(N + m + w).run();
|
|
4648
4664
|
}
|
|
@@ -4683,13 +4699,13 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4683
4699
|
})
|
|
4684
4700
|
],
|
|
4685
4701
|
content: n || "",
|
|
4686
|
-
onUpdate: ({ editor:
|
|
4687
|
-
const
|
|
4688
|
-
a(
|
|
4702
|
+
onUpdate: ({ editor: x }) => {
|
|
4703
|
+
const f = x.getHTML();
|
|
4704
|
+
a(f), c || u(f);
|
|
4689
4705
|
},
|
|
4690
|
-
onBlur: ({ editor:
|
|
4691
|
-
const
|
|
4692
|
-
l(o,
|
|
4706
|
+
onBlur: ({ editor: x }) => {
|
|
4707
|
+
const f = x.getHTML();
|
|
4708
|
+
l(o, f);
|
|
4693
4709
|
},
|
|
4694
4710
|
editorProps: {
|
|
4695
4711
|
attributes: {
|
|
@@ -4702,8 +4718,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4702
4718
|
}, [g]), useEffect(() => {
|
|
4703
4719
|
u(n || "");
|
|
4704
4720
|
}, [n]);
|
|
4705
|
-
const h = (
|
|
4706
|
-
a(
|
|
4721
|
+
const h = (x) => {
|
|
4722
|
+
a(x);
|
|
4707
4723
|
}, m = () => {
|
|
4708
4724
|
d(!1), g && g.commands.setContent(p);
|
|
4709
4725
|
};
|
|
@@ -4736,24 +4752,24 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4736
4752
|
u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && r({ ...o, currentSlide: get(u, "0._id") });
|
|
4737
4753
|
}, [o, u]);
|
|
4738
4754
|
const h = () => {
|
|
4739
|
-
const
|
|
4740
|
-
if (
|
|
4741
|
-
const k = (
|
|
4755
|
+
const f = findIndex(u, { _id: g });
|
|
4756
|
+
if (f > -1) {
|
|
4757
|
+
const k = (f + 1) % u.length, b = get(u, [k, "_id"]);
|
|
4742
4758
|
if (!b) return;
|
|
4743
4759
|
r({ ...o, currentSlide: b }), c([b]);
|
|
4744
4760
|
}
|
|
4745
4761
|
}, m = () => {
|
|
4746
|
-
const
|
|
4747
|
-
if (
|
|
4748
|
-
const k = (
|
|
4762
|
+
const f = findIndex(u, { _id: g });
|
|
4763
|
+
if (f > -1) {
|
|
4764
|
+
const k = (f - 1 + u.length) % u.length, b = get(u, [k, "_id"]);
|
|
4749
4765
|
if (!b) return;
|
|
4750
4766
|
r({ ...o, currentSlide: b }), c([b]);
|
|
4751
4767
|
}
|
|
4752
|
-
},
|
|
4753
|
-
const
|
|
4768
|
+
}, x = () => {
|
|
4769
|
+
const f = i(
|
|
4754
4770
|
{ styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
|
|
4755
4771
|
p == null ? void 0 : p._id
|
|
4756
|
-
), k =
|
|
4772
|
+
), k = f == null ? void 0 : f._id;
|
|
4757
4773
|
k && (r({ ...o, currentSlide: k }), c([k]));
|
|
4758
4774
|
};
|
|
4759
4775
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
@@ -4771,7 +4787,7 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4771
4787
|
/* @__PURE__ */ jsxs(
|
|
4772
4788
|
"button",
|
|
4773
4789
|
{
|
|
4774
|
-
onClick:
|
|
4790
|
+
onClick: x,
|
|
4775
4791
|
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",
|
|
4776
4792
|
children: [
|
|
4777
4793
|
/* @__PURE__ */ jsx(PlusCircle, { className: "h-3 w-3 stroke-[2]" }),
|
|
@@ -4832,8 +4848,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4832
4848
|
value: o == null ? void 0 : o.autoplayInterval,
|
|
4833
4849
|
className: "text-xs",
|
|
4834
4850
|
pattern: "[0-9]*",
|
|
4835
|
-
onChange: (
|
|
4836
|
-
let k =
|
|
4851
|
+
onChange: (f) => {
|
|
4852
|
+
let k = f.target.value;
|
|
4837
4853
|
k.length && (k = k.replace("-", "")), r({ ...o, autoplayInterval: k });
|
|
4838
4854
|
}
|
|
4839
4855
|
}
|
|
@@ -4935,44 +4951,53 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4935
4951
|
children: a,
|
|
4936
4952
|
errors: l,
|
|
4937
4953
|
help: i,
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
onChange: h
|
|
4954
|
+
hidden: c,
|
|
4955
|
+
required: d,
|
|
4956
|
+
schema: p,
|
|
4957
|
+
formData: u,
|
|
4958
|
+
onChange: g
|
|
4944
4959
|
}) => {
|
|
4945
|
-
const { selectedLang:
|
|
4946
|
-
() => isEmpty(x) ? "" : isEmpty(
|
|
4947
|
-
[x,
|
|
4948
|
-
),
|
|
4949
|
-
() => get(
|
|
4950
|
-
[
|
|
4951
|
-
), [
|
|
4952
|
-
if (
|
|
4960
|
+
const { selectedLang: h, fallbackLang: m, languages: x } = useLanguages(), f = useMemo(
|
|
4961
|
+
() => isEmpty(x) ? "" : isEmpty(h) ? m : h,
|
|
4962
|
+
[x, h, m]
|
|
4963
|
+
), k = useMemo(() => get(LANGUAGES, f, f), [f]), b = usePageExternalData(), A = useSelectedBlock(), E = useRegisteredChaiBlocks(), _ = useMemo(
|
|
4964
|
+
() => get(E, [A == null ? void 0 : A._type, "i18nProps"], []),
|
|
4965
|
+
[E, A == null ? void 0 : A._type]
|
|
4966
|
+
), [N, w] = useState(null);
|
|
4967
|
+
if (c)
|
|
4953
4968
|
return null;
|
|
4954
|
-
if (
|
|
4955
|
-
const
|
|
4956
|
-
if (
|
|
4957
|
-
const
|
|
4969
|
+
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
|
|
4970
|
+
const S = _ == null ? void 0 : _.includes(o.replace("root.", ""));
|
|
4971
|
+
if (p.type === "array") {
|
|
4972
|
+
const B = N === o;
|
|
4958
4973
|
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
4959
|
-
|
|
4974
|
+
p.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
|
|
4960
4975
|
"label",
|
|
4961
4976
|
{
|
|
4962
4977
|
htmlFor: o,
|
|
4963
|
-
onClick: () =>
|
|
4978
|
+
onClick: () => w(B ? null : o),
|
|
4964
4979
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4965
4980
|
children: [
|
|
4966
|
-
|
|
4981
|
+
B ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4967
4982
|
/* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
|
|
4968
4983
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: n }),
|
|
4969
4984
|
" ",
|
|
4970
|
-
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children:
|
|
4985
|
+
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: u == null ? void 0 : u.length }) }),
|
|
4986
|
+
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4987
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
4988
|
+
Info,
|
|
4989
|
+
{
|
|
4990
|
+
className: "h-3 w-3 text-muted-foreground/70",
|
|
4991
|
+
onClick: (v) => v.stopPropagation(),
|
|
4992
|
+
onMouseDown: (v) => v.stopPropagation()
|
|
4993
|
+
}
|
|
4994
|
+
) }),
|
|
4995
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
4996
|
+
] }) })
|
|
4971
4997
|
]
|
|
4972
4998
|
}
|
|
4973
|
-
),
|
|
4974
|
-
(
|
|
4975
|
-
c,
|
|
4999
|
+
) }),
|
|
5000
|
+
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${B ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
4976
5001
|
a,
|
|
4977
5002
|
l,
|
|
4978
5003
|
i
|
|
@@ -4980,35 +5005,34 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4980
5005
|
] });
|
|
4981
5006
|
}
|
|
4982
5007
|
return /* @__PURE__ */ jsxs("div", { className: r, children: [
|
|
4983
|
-
|
|
5008
|
+
p.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4984
5009
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4985
|
-
/* @__PURE__ */ jsxs("label", { htmlFor: o, className:
|
|
5010
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
4986
5011
|
n,
|
|
4987
5012
|
" ",
|
|
4988
|
-
|
|
5013
|
+
S && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4989
5014
|
" ",
|
|
4990
|
-
|
|
5015
|
+
k
|
|
4991
5016
|
] }),
|
|
4992
|
-
|
|
5017
|
+
d && p.type !== "object" ? " *" : null
|
|
4993
5018
|
] }),
|
|
4994
|
-
|
|
5019
|
+
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4995
5020
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-muted-foreground/70" }) }),
|
|
4996
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children:
|
|
5021
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
4997
5022
|
] }) })
|
|
4998
5023
|
] }),
|
|
4999
|
-
!
|
|
5024
|
+
!p.enum && !p.oneOf && b && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
5000
5025
|
DataBindingSelector,
|
|
5001
5026
|
{
|
|
5002
|
-
schema:
|
|
5003
|
-
onChange: (
|
|
5004
|
-
|
|
5027
|
+
schema: p,
|
|
5028
|
+
onChange: (B) => {
|
|
5029
|
+
g(B, u, o);
|
|
5005
5030
|
},
|
|
5006
5031
|
id: o,
|
|
5007
|
-
formData:
|
|
5032
|
+
formData: u
|
|
5008
5033
|
}
|
|
5009
5034
|
) })
|
|
5010
5035
|
] }),
|
|
5011
|
-
c,
|
|
5012
5036
|
a,
|
|
5013
5037
|
l,
|
|
5014
5038
|
i
|
|
@@ -5108,26 +5132,26 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5108
5132
|
}), a;
|
|
5109
5133
|
};
|
|
5110
5134
|
function BlockSettings() {
|
|
5111
|
-
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h),
|
|
5135
|
+
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), x = ({ formData: w }, y, S) => {
|
|
5112
5136
|
y && (c == null ? void 0 : c._id) === r._id && a([r._id], { [y]: get(w, y) }, S);
|
|
5113
|
-
},
|
|
5137
|
+
}, f = useCallback(
|
|
5114
5138
|
debounce(({ formData: w }, y, S) => {
|
|
5115
|
-
|
|
5139
|
+
x({ formData: w }, y, S), d(w);
|
|
5116
5140
|
}, 1500),
|
|
5117
5141
|
[r == null ? void 0 : r._id, o]
|
|
5118
5142
|
), k = ({ formData: w }, y) => {
|
|
5119
|
-
y && (n([r._id], { [y]: get(w, y) }),
|
|
5143
|
+
y && (n([r._id], { [y]: get(w, y) }), f({ formData: w }, y, { [y]: get(c, y) }));
|
|
5120
5144
|
}, b = ({ formData: w }, y) => {
|
|
5121
|
-
y && (n([g._id], { [y]: get(w, y) }),
|
|
5122
|
-
}, { schema: A, uiSchema:
|
|
5145
|
+
y && (n([g._id], { [y]: get(w, y) }), f({ formData: w }, y, { [y]: get(c, y) }));
|
|
5146
|
+
}, { schema: A, uiSchema: E } = useMemo(() => {
|
|
5123
5147
|
const w = r == null ? void 0 : r._type;
|
|
5124
5148
|
if (!w)
|
|
5125
5149
|
return { schema: {}, uiSchema: {} };
|
|
5126
5150
|
try {
|
|
5127
5151
|
const { schema: y, uiSchema: S } = getBlockFormSchemas(w);
|
|
5128
5152
|
if (w === "Repeater") {
|
|
5129
|
-
const
|
|
5130
|
-
startsWith(
|
|
5153
|
+
const B = get(r, "repeaterItems", "");
|
|
5154
|
+
startsWith(B, `{{${COLLECTION_PREFIX}`) ? (set(S, "filter", { "ui:widget": "collectionSelect" }), set(S, "sort", { "ui:widget": "collectionSelect" })) : (set(S, "filter", { "ui:widget": "hidden" }), set(S, "sort", { "ui:widget": "hidden" }));
|
|
5131
5155
|
}
|
|
5132
5156
|
return { schema: y, uiSchema: S };
|
|
5133
5157
|
} catch {
|
|
@@ -5177,33 +5201,33 @@ function BlockSettings() {
|
|
|
5177
5201
|
onChange: k,
|
|
5178
5202
|
formData: i,
|
|
5179
5203
|
schema: A,
|
|
5180
|
-
uiSchema:
|
|
5204
|
+
uiSchema: E
|
|
5181
5205
|
}
|
|
5182
5206
|
)
|
|
5183
5207
|
] });
|
|
5184
5208
|
}
|
|
5185
5209
|
const BlockStylingProps = () => {
|
|
5186
|
-
var
|
|
5210
|
+
var x;
|
|
5187
5211
|
const o = useSelectedBlock(), [r, n] = useSelectedStylingBlocks(), a = useRemoveClassesFromBlocks(), [l] = useSelectedBlockIds(), { t: i } = useTranslation();
|
|
5188
5212
|
if (!o) return null;
|
|
5189
5213
|
const c = Object.keys(o).filter(
|
|
5190
|
-
(
|
|
5191
|
-
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (
|
|
5214
|
+
(f) => typeof o[f] == "string" && o[f].startsWith("#styles:")
|
|
5215
|
+
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (x = r[0]) == null ? void 0 : x.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((f) => !isEmpty(f)) : [], m = (f) => find(r, (k) => k.prop === f);
|
|
5192
5216
|
return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
5193
5217
|
/* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
|
|
5194
5218
|
i("Style element"),
|
|
5195
5219
|
":"
|
|
5196
5220
|
] }),
|
|
5197
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (
|
|
5221
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (f) => /* @__PURE__ */ jsxs(
|
|
5198
5222
|
Badge,
|
|
5199
5223
|
{
|
|
5200
5224
|
className: "flex cursor-pointer items-center gap-1 pr-1",
|
|
5201
|
-
variant: m(
|
|
5225
|
+
variant: m(f) ? "default" : "secondary",
|
|
5202
5226
|
onClick: () => {
|
|
5203
|
-
n([{ id: `${
|
|
5227
|
+
n([{ id: `${f}-${o._id}`, blockId: o._id, prop: f }]);
|
|
5204
5228
|
},
|
|
5205
5229
|
children: [
|
|
5206
|
-
startCase(
|
|
5230
|
+
startCase(f),
|
|
5207
5231
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5208
5232
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
5209
5233
|
"button",
|
|
@@ -5220,7 +5244,7 @@ const BlockStylingProps = () => {
|
|
|
5220
5244
|
{
|
|
5221
5245
|
className: "text-xs",
|
|
5222
5246
|
onClick: () => {
|
|
5223
|
-
d(
|
|
5247
|
+
d(f);
|
|
5224
5248
|
},
|
|
5225
5249
|
children: i("Reset style")
|
|
5226
5250
|
}
|
|
@@ -5239,7 +5263,7 @@ const BlockStylingProps = () => {
|
|
|
5239
5263
|
] })
|
|
5240
5264
|
]
|
|
5241
5265
|
},
|
|
5242
|
-
|
|
5266
|
+
f
|
|
5243
5267
|
)) }),
|
|
5244
5268
|
/* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
|
|
5245
5269
|
] }) });
|
|
@@ -5388,7 +5412,7 @@ const BlockStylingProps = () => {
|
|
|
5388
5412
|
},
|
|
5389
5413
|
a
|
|
5390
5414
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5391
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [
|
|
5415
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [k, b] = useState(""), [A, E] = useState(!1), [_, N] = useState(!1);
|
|
5392
5416
|
useEffect(() => {
|
|
5393
5417
|
const { value: v, unit: C } = getClassValueAndUnit(i);
|
|
5394
5418
|
if (C === "") {
|
|
@@ -5401,7 +5425,7 @@ const BlockStylingProps = () => {
|
|
|
5401
5425
|
(v = !1) => {
|
|
5402
5426
|
const C = getUserInputValues(`${a}`, u);
|
|
5403
5427
|
if (get(C, "error", !1)) {
|
|
5404
|
-
|
|
5428
|
+
f(!0);
|
|
5405
5429
|
return;
|
|
5406
5430
|
}
|
|
5407
5431
|
const j = get(C, "unit") !== "" ? get(C, "unit") : h;
|
|
@@ -5415,11 +5439,11 @@ const BlockStylingProps = () => {
|
|
|
5415
5439
|
v ? y(L) : w(L);
|
|
5416
5440
|
},
|
|
5417
5441
|
[w, y, a, h, d, u]
|
|
5418
|
-
),
|
|
5442
|
+
), B = useCallback(
|
|
5419
5443
|
(v) => {
|
|
5420
5444
|
const C = getUserInputValues(`${a}`, u);
|
|
5421
5445
|
if (get(C, "error", !1)) {
|
|
5422
|
-
|
|
5446
|
+
f(!0);
|
|
5423
5447
|
return;
|
|
5424
5448
|
}
|
|
5425
5449
|
if (v === "auto" || v === "none") {
|
|
@@ -5462,7 +5486,7 @@ const BlockStylingProps = () => {
|
|
|
5462
5486
|
const C = parseInt$1(v.target.value);
|
|
5463
5487
|
let j = isNaN$1(C) ? 0 : C;
|
|
5464
5488
|
v.keyCode === 38 && (j += 1), v.keyCode === 40 && (j -= 1);
|
|
5465
|
-
const
|
|
5489
|
+
const T = `${j}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5466
5490
|
y(R);
|
|
5467
5491
|
},
|
|
5468
5492
|
onKeyUp: (v) => {
|
|
@@ -5470,7 +5494,7 @@ const BlockStylingProps = () => {
|
|
|
5470
5494
|
},
|
|
5471
5495
|
onBlur: () => S(),
|
|
5472
5496
|
onChange: (v) => {
|
|
5473
|
-
|
|
5497
|
+
f(!1), l(v.target.value);
|
|
5474
5498
|
},
|
|
5475
5499
|
onClick: (v) => {
|
|
5476
5500
|
var C;
|
|
@@ -5479,7 +5503,7 @@ const BlockStylingProps = () => {
|
|
|
5479
5503
|
value: A ? k : a,
|
|
5480
5504
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5481
5505
|
" ",
|
|
5482
|
-
|
|
5506
|
+
x ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
5483
5507
|
)
|
|
5484
5508
|
}
|
|
5485
5509
|
),
|
|
@@ -5502,7 +5526,7 @@ const BlockStylingProps = () => {
|
|
|
5502
5526
|
units: u,
|
|
5503
5527
|
current: h,
|
|
5504
5528
|
onSelect: (v) => {
|
|
5505
|
-
n(!1), m(v),
|
|
5529
|
+
n(!1), m(v), B(v);
|
|
5506
5530
|
}
|
|
5507
5531
|
}
|
|
5508
5532
|
) })
|
|
@@ -5511,19 +5535,19 @@ const BlockStylingProps = () => {
|
|
|
5511
5535
|
["none", "auto"].indexOf(h) !== -1 || A ? null : /* @__PURE__ */ jsx(
|
|
5512
5536
|
DragStyleButton,
|
|
5513
5537
|
{
|
|
5514
|
-
onDragStart: () =>
|
|
5538
|
+
onDragStart: () => E(!0),
|
|
5515
5539
|
onDragEnd: (v) => {
|
|
5516
|
-
if (b(() => ""),
|
|
5540
|
+
if (b(() => ""), E(!1), isEmpty(v))
|
|
5517
5541
|
return;
|
|
5518
|
-
const C = `${v}`,
|
|
5519
|
-
w(
|
|
5542
|
+
const C = `${v}`, T = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5543
|
+
w(T);
|
|
5520
5544
|
},
|
|
5521
5545
|
onDrag: (v) => {
|
|
5522
5546
|
if (isEmpty(v))
|
|
5523
5547
|
return;
|
|
5524
5548
|
b(v);
|
|
5525
|
-
const C = `${v}`,
|
|
5526
|
-
y(
|
|
5549
|
+
const C = `${v}`, T = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5550
|
+
y(T);
|
|
5527
5551
|
},
|
|
5528
5552
|
currentValue: a,
|
|
5529
5553
|
unit: h,
|
|
@@ -5598,7 +5622,7 @@ const COLOR_PROP = {
|
|
|
5598
5622
|
return c([]);
|
|
5599
5623
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
5600
5624
|
}, [g]);
|
|
5601
|
-
const
|
|
5625
|
+
const x = useCallback(
|
|
5602
5626
|
// eslint-disable-next-line no-shadow
|
|
5603
5627
|
(k) => {
|
|
5604
5628
|
p({ color: g, shade: k });
|
|
@@ -5608,11 +5632,11 @@ const COLOR_PROP = {
|
|
|
5608
5632
|
useEffect(() => {
|
|
5609
5633
|
p({ color: "", shade: "" });
|
|
5610
5634
|
}, [n]);
|
|
5611
|
-
const { match:
|
|
5635
|
+
const { match: f } = useTailwindClassList();
|
|
5612
5636
|
return useEffect(() => {
|
|
5613
5637
|
const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
5614
|
-
|
|
5615
|
-
}, [
|
|
5638
|
+
f(o, b) && r(b, o);
|
|
5639
|
+
}, [f, d, r, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
5616
5640
|
/* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
|
|
5617
5641
|
DropDown,
|
|
5618
5642
|
{
|
|
@@ -5652,7 +5676,7 @@ const COLOR_PROP = {
|
|
|
5652
5676
|
]
|
|
5653
5677
|
}
|
|
5654
5678
|
) }),
|
|
5655
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange:
|
|
5679
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: x, options: i }) })
|
|
5656
5680
|
] });
|
|
5657
5681
|
}, EDITOR_ICONS = {
|
|
5658
5682
|
"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" }) }),
|
|
@@ -5986,20 +6010,20 @@ const COLOR_PROP = {
|
|
|
5986
6010
|
"2xl": "1536px"
|
|
5987
6011
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5988
6012
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5989
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(),
|
|
6013
|
+
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), k = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
|
|
5990
6014
|
(y, S = !0) => {
|
|
5991
|
-
const
|
|
5992
|
-
(p || u !== "") && (
|
|
5993
|
-
const v = generateFullClsName(
|
|
5994
|
-
m(
|
|
6015
|
+
const B = { dark: p, mq: g, mod: u, cls: y, property: l, fullCls: "" };
|
|
6016
|
+
(p || u !== "") && (B.mq = "xs");
|
|
6017
|
+
const v = generateFullClsName(B);
|
|
6018
|
+
m(f, [v], S);
|
|
5995
6019
|
},
|
|
5996
|
-
[
|
|
6020
|
+
[f, p, g, u, l, m]
|
|
5997
6021
|
), A = useCallback(() => {
|
|
5998
|
-
f
|
|
5999
|
-
}, [
|
|
6022
|
+
x(f, [k], !0);
|
|
6023
|
+
}, [f, k, x]), E = useMemo(() => canChangeClass(h, g), [h, g]);
|
|
6000
6024
|
useEffect(() => {
|
|
6001
|
-
i(
|
|
6002
|
-
}, [
|
|
6025
|
+
i(E, h);
|
|
6026
|
+
}, [E, i, h]);
|
|
6003
6027
|
const [, , _] = useScreenSizeWidth(), N = useCallback(
|
|
6004
6028
|
(y) => {
|
|
6005
6029
|
_({
|
|
@@ -6013,7 +6037,7 @@ const COLOR_PROP = {
|
|
|
6013
6037
|
},
|
|
6014
6038
|
[_]
|
|
6015
6039
|
), w = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
|
|
6016
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6040
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: E, canReset: h && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6017
6041
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !w ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
6018
6042
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6019
6043
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6033,7 +6057,7 @@ const COLOR_PROP = {
|
|
|
6033
6057
|
n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6034
6058
|
n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6035
6059
|
] }),
|
|
6036
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${k ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) :
|
|
6060
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${k ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : E && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6037
6061
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6038
6062
|
"button",
|
|
6039
6063
|
{
|
|
@@ -6082,23 +6106,23 @@ const COLOR_PROP = {
|
|
|
6082
6106
|
children: [
|
|
6083
6107
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6084
6108
|
o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6085
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: r.map(({ label: m, key:
|
|
6109
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: r.map(({ label: m, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6086
6110
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6087
6111
|
"button",
|
|
6088
6112
|
{
|
|
6089
6113
|
type: "button",
|
|
6090
|
-
onClick: () => u(
|
|
6091
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6114
|
+
onClick: () => u(x),
|
|
6115
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6092
6116
|
children: [
|
|
6093
6117
|
React__default.createElement("div", {
|
|
6094
|
-
className: h(
|
|
6118
|
+
className: h(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6095
6119
|
}),
|
|
6096
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6120
|
+
React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6097
6121
|
]
|
|
6098
6122
|
}
|
|
6099
6123
|
) }),
|
|
6100
6124
|
/* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
|
|
6101
|
-
] }) }, `option-${
|
|
6125
|
+
] }) }, `option-${f}`)) })
|
|
6102
6126
|
] }),
|
|
6103
6127
|
/* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
|
|
6104
6128
|
BlockStyle,
|
|
@@ -6253,9 +6277,9 @@ const COLOR_PROP = {
|
|
|
6253
6277
|
canvas: r = !1,
|
|
6254
6278
|
tooltip: n = !0
|
|
6255
6279
|
}) => {
|
|
6256
|
-
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS),
|
|
6280
|
+
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
|
|
6257
6281
|
u.includes(b) ? u.length > 2 && g(u.filter((A) => A !== b)) : g((A) => [...A, b]);
|
|
6258
|
-
},
|
|
6282
|
+
}, f = (b) => {
|
|
6259
6283
|
r || l(b), c(b);
|
|
6260
6284
|
}, k = getBreakpointValue(r ? i : a).toLowerCase();
|
|
6261
6285
|
return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
|
|
@@ -6263,7 +6287,7 @@ const COLOR_PROP = {
|
|
|
6263
6287
|
{
|
|
6264
6288
|
canvas: r,
|
|
6265
6289
|
...b,
|
|
6266
|
-
onClick:
|
|
6290
|
+
onClick: f,
|
|
6267
6291
|
key: b.breakpoint,
|
|
6268
6292
|
currentBreakpoint: k
|
|
6269
6293
|
}
|
|
@@ -6277,7 +6301,7 @@ const COLOR_PROP = {
|
|
|
6277
6301
|
openDelay: o,
|
|
6278
6302
|
tooltip: n,
|
|
6279
6303
|
...b,
|
|
6280
|
-
onClick:
|
|
6304
|
+
onClick: f,
|
|
6281
6305
|
key: b.breakpoint,
|
|
6282
6306
|
currentBreakpoint: k
|
|
6283
6307
|
}
|
|
@@ -6292,7 +6316,7 @@ const COLOR_PROP = {
|
|
|
6292
6316
|
DropdownMenuCheckboxItem,
|
|
6293
6317
|
{
|
|
6294
6318
|
disabled: b.breakpoint === "xs",
|
|
6295
|
-
onCheckedChange: () =>
|
|
6319
|
+
onCheckedChange: () => x(toUpper(b.breakpoint)),
|
|
6296
6320
|
checked: includes(u, toUpper(b.breakpoint)),
|
|
6297
6321
|
children: h(b.title)
|
|
6298
6322
|
},
|
|
@@ -6377,8 +6401,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6377
6401
|
(m = d.current) == null || m.focus();
|
|
6378
6402
|
}, []);
|
|
6379
6403
|
const h = (m) => {
|
|
6380
|
-
const { usage:
|
|
6381
|
-
!l &&
|
|
6404
|
+
const { usage: x } = m || {};
|
|
6405
|
+
!l && x && g(x), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
6382
6406
|
};
|
|
6383
6407
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
6384
6408
|
/* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: r("Ask AI") }),
|
|
@@ -6433,15 +6457,15 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6433
6457
|
] });
|
|
6434
6458
|
};
|
|
6435
6459
|
function ManualClasses() {
|
|
6436
|
-
var
|
|
6437
|
-
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [
|
|
6438
|
-
const L =
|
|
6439
|
-
u(h, L, !0),
|
|
6460
|
+
var T;
|
|
6461
|
+
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), k = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), A = b.split(" ").filter((L) => !isEmpty(L)), E = () => {
|
|
6462
|
+
const L = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6463
|
+
u(h, L, !0), f("");
|
|
6440
6464
|
}, [_, N] = useState([]), w = ({ value: L }) => {
|
|
6441
|
-
const R = L.trim().toLowerCase(),
|
|
6465
|
+
const R = L.trim().toLowerCase(), I = R.match(/.+:/g);
|
|
6442
6466
|
let D = [];
|
|
6443
|
-
if (
|
|
6444
|
-
const [O] =
|
|
6467
|
+
if (I && I.length > 0) {
|
|
6468
|
+
const [O] = I, P = R.replace(O, "");
|
|
6445
6469
|
D = i.search(P).map((M) => ({
|
|
6446
6470
|
...M,
|
|
6447
6471
|
item: { ...M.item, name: O + M.item.name }
|
|
@@ -6451,7 +6475,7 @@ function ManualClasses() {
|
|
|
6451
6475
|
return N(map(D, "item"));
|
|
6452
6476
|
}, y = () => {
|
|
6453
6477
|
N([]);
|
|
6454
|
-
}, S = (L) => L.name,
|
|
6478
|
+
}, S = (L) => L.name, B = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), v = useMemo(
|
|
6455
6479
|
() => ({
|
|
6456
6480
|
ref: o,
|
|
6457
6481
|
autoComplete: "off",
|
|
@@ -6459,19 +6483,19 @@ function ManualClasses() {
|
|
|
6459
6483
|
autoCapitalize: "off",
|
|
6460
6484
|
spellCheck: !1,
|
|
6461
6485
|
placeholder: c("Enter classes separated by space"),
|
|
6462
|
-
value:
|
|
6486
|
+
value: x,
|
|
6463
6487
|
onFocus: (L) => {
|
|
6464
6488
|
setTimeout(() => {
|
|
6465
6489
|
L.target && L.target.select();
|
|
6466
6490
|
}, 0);
|
|
6467
6491
|
},
|
|
6468
6492
|
onKeyDown: (L) => {
|
|
6469
|
-
L.key === "Enter" &&
|
|
6493
|
+
L.key === "Enter" && x.trim() !== "" && E();
|
|
6470
6494
|
},
|
|
6471
|
-
onChange: (L, { newValue: R }) =>
|
|
6495
|
+
onChange: (L, { newValue: R }) => f(R),
|
|
6472
6496
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6473
6497
|
}),
|
|
6474
|
-
[
|
|
6498
|
+
[x, c, o]
|
|
6475
6499
|
), C = (L) => {
|
|
6476
6500
|
debugger;
|
|
6477
6501
|
const R = r.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
@@ -6508,7 +6532,7 @@ function ManualClasses() {
|
|
|
6508
6532
|
onSuggestionsFetchRequested: w,
|
|
6509
6533
|
onSuggestionsClearRequested: y,
|
|
6510
6534
|
getSuggestionValue: S,
|
|
6511
|
-
renderSuggestion:
|
|
6535
|
+
renderSuggestion: B,
|
|
6512
6536
|
inputProps: v,
|
|
6513
6537
|
containerProps: {
|
|
6514
6538
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
@@ -6525,8 +6549,8 @@ function ManualClasses() {
|
|
|
6525
6549
|
{
|
|
6526
6550
|
variant: "outline",
|
|
6527
6551
|
className: "h-6 border-border",
|
|
6528
|
-
onClick:
|
|
6529
|
-
disabled:
|
|
6552
|
+
onClick: E,
|
|
6553
|
+
disabled: x.trim() === "",
|
|
6530
6554
|
size: "sm",
|
|
6531
6555
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
6532
6556
|
}
|
|
@@ -6538,16 +6562,16 @@ function ManualClasses() {
|
|
|
6538
6562
|
{
|
|
6539
6563
|
ref: o,
|
|
6540
6564
|
value: r,
|
|
6541
|
-
onChange: (
|
|
6565
|
+
onChange: (I) => n(I.target.value),
|
|
6542
6566
|
onBlur: () => {
|
|
6543
6567
|
C(L);
|
|
6544
6568
|
},
|
|
6545
|
-
onKeyDown: (
|
|
6546
|
-
|
|
6569
|
+
onKeyDown: (I) => {
|
|
6570
|
+
I.key === "Enter" && C(L);
|
|
6547
6571
|
},
|
|
6548
|
-
onFocus: (
|
|
6572
|
+
onFocus: (I) => {
|
|
6549
6573
|
setTimeout(() => {
|
|
6550
|
-
|
|
6574
|
+
I.target.select();
|
|
6551
6575
|
}, 0);
|
|
6552
6576
|
},
|
|
6553
6577
|
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"
|
|
@@ -6557,42 +6581,44 @@ function ManualClasses() {
|
|
|
6557
6581
|
"button",
|
|
6558
6582
|
{
|
|
6559
6583
|
onDoubleClick: () => {
|
|
6560
|
-
|
|
6584
|
+
f(L), g(h, [L]), setTimeout(() => {
|
|
6561
6585
|
o.current && o.current.focus();
|
|
6562
6586
|
}, 10);
|
|
6563
6587
|
},
|
|
6564
|
-
className: "flex cursor-default items-center gap-x-1 truncate break-words
|
|
6588
|
+
className: "flex h-max cursor-default items-center gap-x-1 truncate break-words rounded bg-gray-200 py-px pl-0.5 pr-1 text-[11px] text-gray-600 dark:bg-gray-800 dark:text-gray-300",
|
|
6565
6589
|
children: [
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6590
|
+
/* @__PURE__ */ jsxs("div", { className: "z-10 flex h-full w-max items-center justify-center", children: [
|
|
6591
|
+
/* @__PURE__ */ jsx(
|
|
6592
|
+
Cross2Icon,
|
|
6593
|
+
{
|
|
6594
|
+
onClick: () => g(h, [L], !0),
|
|
6595
|
+
className: "hidden h-max w-3.5 cursor-pointer rounded bg-gray-100 p-0.5 text-red-500 hover:bg-gray-50 group-hover:block"
|
|
6596
|
+
}
|
|
6597
|
+
),
|
|
6598
|
+
/* @__PURE__ */ jsxs(
|
|
6599
|
+
"svg",
|
|
6600
|
+
{
|
|
6601
|
+
className: "h-3.5 w-3.5 group-hover:hidden",
|
|
6602
|
+
fill: "rgba(55, 65, 81, 0.4)",
|
|
6603
|
+
viewBox: "0 0 24 24",
|
|
6604
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6605
|
+
xmlSpace: "preserve",
|
|
6606
|
+
children: [
|
|
6607
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
|
|
6608
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
6609
|
+
/* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
|
|
6610
|
+
"path",
|
|
6611
|
+
{
|
|
6612
|
+
fillRule: "evenodd",
|
|
6613
|
+
clipRule: "evenodd",
|
|
6614
|
+
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"
|
|
6615
|
+
}
|
|
6616
|
+
) })
|
|
6617
|
+
]
|
|
6618
|
+
}
|
|
6619
|
+
)
|
|
6620
|
+
] }),
|
|
6621
|
+
/* @__PURE__ */ jsx("div", { children: L })
|
|
6596
6622
|
]
|
|
6597
6623
|
}
|
|
6598
6624
|
) }, L)
|
|
@@ -6711,9 +6737,9 @@ function BlockStyling() {
|
|
|
6711
6737
|
const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
|
|
6712
6738
|
let m = parseFloat(i.dragStartValue);
|
|
6713
6739
|
m = isNaN(m) ? 0 : m;
|
|
6714
|
-
let
|
|
6715
|
-
(startsWith(h, "scale") || h === "opacity") && (
|
|
6716
|
-
let k = (i.dragStartY - u.pageY) /
|
|
6740
|
+
let x = MAPPER[i.dragUnit];
|
|
6741
|
+
(startsWith(h, "scale") || h === "opacity") && (x = 10);
|
|
6742
|
+
let k = (i.dragStartY - u.pageY) / x + m;
|
|
6717
6743
|
g && k < 0 && (k = 0), h === "opacity" && k > 1 && (k = 1), i.onDrag(`${k}`), l(`${k}`);
|
|
6718
6744
|
},
|
|
6719
6745
|
[i],
|
|
@@ -6762,7 +6788,7 @@ const CoreBlock = ({
|
|
|
6762
6788
|
} else
|
|
6763
6789
|
p(o, n || null, a);
|
|
6764
6790
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6765
|
-
},
|
|
6791
|
+
}, x = useFeature("dnd"), { t: f } = useTranslation();
|
|
6766
6792
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6767
6793
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6768
6794
|
"button",
|
|
@@ -6775,15 +6801,15 @@ const CoreBlock = ({
|
|
|
6775
6801
|
g([]), h();
|
|
6776
6802
|
}, 200);
|
|
6777
6803
|
},
|
|
6778
|
-
draggable:
|
|
6804
|
+
draggable: x ? "true" : "false",
|
|
6779
6805
|
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",
|
|
6780
6806
|
children: [
|
|
6781
6807
|
createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
6782
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
6808
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(f(d || i)) })
|
|
6783
6809
|
]
|
|
6784
6810
|
}
|
|
6785
6811
|
) }),
|
|
6786
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children:
|
|
6812
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: f(d || i) }) })
|
|
6787
6813
|
] }) });
|
|
6788
6814
|
}, DefaultChaiBlocks = ({
|
|
6789
6815
|
parentId: o,
|
|
@@ -6986,7 +7012,7 @@ const CoreBlock = ({
|
|
|
6986
7012
|
}
|
|
6987
7013
|
}
|
|
6988
7014
|
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
6989
|
-
var h, m,
|
|
7015
|
+
var h, m, x, f, k, b, A, E, _, N;
|
|
6990
7016
|
if (n.type === "comment") return [];
|
|
6991
7017
|
let a = { _id: generateUUID() };
|
|
6992
7018
|
if (r && (a._parent = r.block._id), n.type === "text")
|
|
@@ -7028,8 +7054,8 @@ const CoreBlock = ({
|
|
|
7028
7054
|
...a,
|
|
7029
7055
|
href: ((h = l.find((y) => y.key === "href")) == null ? void 0 : h.value) || "",
|
|
7030
7056
|
hrefType: ((m = l.find((y) => y.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
7031
|
-
autoplay: ((
|
|
7032
|
-
maxWidth: ((k = (
|
|
7057
|
+
autoplay: ((x = l.find((y) => y.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
|
|
7058
|
+
maxWidth: ((k = (f = l.find((y) => y.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : k.replace("px", "")) || "",
|
|
7033
7059
|
backdropColor: ((b = l.find((y) => y.key === "data-overlay")) == null ? void 0 : b.value) || "",
|
|
7034
7060
|
galleryName: ((A = l.find((y) => y.key === "data-gall")) == null ? void 0 : A.value) || ""
|
|
7035
7061
|
}, forEach(w, (y) => {
|
|
@@ -7042,14 +7068,14 @@ const CoreBlock = ({
|
|
|
7042
7068
|
a.content = getTextContent(w);
|
|
7043
7069
|
const y = find(
|
|
7044
7070
|
n.children || [],
|
|
7045
|
-
(S) => (S == null ? void 0 : S.tagName) === "span" && some(S.children || [], (
|
|
7071
|
+
(S) => (S == null ? void 0 : S.tagName) === "span" && some(S.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg")
|
|
7046
7072
|
);
|
|
7047
7073
|
if (y) {
|
|
7048
|
-
const S = find(y.children || [], (
|
|
7074
|
+
const S = find(y.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg");
|
|
7049
7075
|
if (S) {
|
|
7050
7076
|
a.icon = stringify([S]);
|
|
7051
|
-
const { height:
|
|
7052
|
-
a.iconHeight =
|
|
7077
|
+
const { height: B, width: v } = getSvgDimensions(S, "16px", "16px");
|
|
7078
|
+
a.iconHeight = B, a.iconWidth = v;
|
|
7053
7079
|
}
|
|
7054
7080
|
}
|
|
7055
7081
|
return [a];
|
|
@@ -7065,10 +7091,10 @@ const CoreBlock = ({
|
|
|
7065
7091
|
if (y && S)
|
|
7066
7092
|
a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${y}`, w)}`.trim(), a.height = y == null ? void 0 : y.replace("px", ""), a.width = S == null ? void 0 : S.replace("px", "");
|
|
7067
7093
|
else {
|
|
7068
|
-
const
|
|
7069
|
-
|
|
7094
|
+
const B = (E = find(n.attributes, { key: "height" })) == null ? void 0 : E.value, v = (_ = find(n.attributes, { key: "width" })) == null ? void 0 : _.value;
|
|
7095
|
+
B && v ? (a.styles = `${STYLES_KEY}, ${cn$2(`w-[${v}px] h-[${B}px]`, w)}`.trim(), a.height = B, a.width = v) : a.styles = `${STYLES_KEY}, ${cn$2("w-full h-full", w)}`.trim();
|
|
7070
7096
|
}
|
|
7071
|
-
return n.attributes = filter(n.attributes, (
|
|
7097
|
+
return n.attributes = filter(n.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([n]), [a];
|
|
7072
7098
|
} else if (n.tagName == "option" && r && ((N = r.block) == null ? void 0 : N._type) === "Select")
|
|
7073
7099
|
return r.block.options.push({
|
|
7074
7100
|
label: getTextContent(n.children),
|
|
@@ -7185,12 +7211,12 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7185
7211
|
parentId: n = void 0,
|
|
7186
7212
|
position: a = -1
|
|
7187
7213
|
}) => {
|
|
7188
|
-
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""),
|
|
7189
|
-
const _ = has(
|
|
7190
|
-
return
|
|
7214
|
+
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), k = (E) => {
|
|
7215
|
+
const _ = has(E, "styles_attrs.data-page-section");
|
|
7216
|
+
return E._type === "Box" && _;
|
|
7191
7217
|
}, b = useCallback(
|
|
7192
|
-
async (
|
|
7193
|
-
if (
|
|
7218
|
+
async (E) => {
|
|
7219
|
+
if (E.stopPropagation(), has(o, "component")) {
|
|
7194
7220
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7195
7221
|
return;
|
|
7196
7222
|
}
|
|
@@ -7206,20 +7232,20 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7206
7232
|
{
|
|
7207
7233
|
onClick: l ? () => {
|
|
7208
7234
|
} : b,
|
|
7209
|
-
draggable:
|
|
7210
|
-
onDragStart: async (
|
|
7235
|
+
draggable: x ? "true" : "false",
|
|
7236
|
+
onDragStart: async (E) => {
|
|
7211
7237
|
const _ = await c({ library: r, block: o });
|
|
7212
7238
|
let N = n;
|
|
7213
7239
|
if (k(first(_)) && (N = null), !isEmpty(_)) {
|
|
7214
7240
|
const w = { blocks: _, uiLibrary: !0, parent: N };
|
|
7215
|
-
if (
|
|
7241
|
+
if (E.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
7216
7242
|
const y = new Image();
|
|
7217
7243
|
y.src = o.preview, y.onload = () => {
|
|
7218
|
-
|
|
7244
|
+
E.dataTransfer.setDragImage(y, 0, 0);
|
|
7219
7245
|
};
|
|
7220
7246
|
} else
|
|
7221
|
-
|
|
7222
|
-
|
|
7247
|
+
E.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7248
|
+
f(w), setTimeout(() => {
|
|
7223
7249
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7224
7250
|
}, 200);
|
|
7225
7251
|
}
|
|
@@ -7245,22 +7271,22 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7245
7271
|
] }) })
|
|
7246
7272
|
] });
|
|
7247
7273
|
}, UILibrarySection = ({ parentId: o, position: r }) => {
|
|
7248
|
-
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((C) => C.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]),
|
|
7274
|
+
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((C) => C.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), x = useRef(null);
|
|
7249
7275
|
useEffect(() => {
|
|
7250
|
-
c && c.length > 0 && (
|
|
7276
|
+
c && c.length > 0 && (x.current = new Fuse(c, {
|
|
7251
7277
|
keys: ["name", "label", "description", "group"],
|
|
7252
7278
|
threshold: 0.4,
|
|
7253
7279
|
ignoreLocation: !0
|
|
7254
7280
|
}));
|
|
7255
7281
|
}, [c]), useEffect(() => {
|
|
7256
|
-
if (!u.trim() || !
|
|
7282
|
+
if (!u.trim() || !x.current) {
|
|
7257
7283
|
m([]);
|
|
7258
7284
|
return;
|
|
7259
7285
|
}
|
|
7260
|
-
const C =
|
|
7286
|
+
const C = x.current.search(u).map((j) => j.item);
|
|
7261
7287
|
m(C);
|
|
7262
7288
|
}, [u]);
|
|
7263
|
-
const
|
|
7289
|
+
const f = u.trim() && !isEmpty(h) ? h : c, k = groupBy(f, "group"), [b, A] = useState(null);
|
|
7264
7290
|
useEffect(() => {
|
|
7265
7291
|
if (isEmpty(keys(k))) {
|
|
7266
7292
|
A(null);
|
|
@@ -7271,7 +7297,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7271
7297
|
return;
|
|
7272
7298
|
}
|
|
7273
7299
|
}, [k, b]);
|
|
7274
|
-
const
|
|
7300
|
+
const E = get(k, b, []), _ = useRef(null), { t: N } = useTranslation(), w = (C) => {
|
|
7275
7301
|
_.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
|
|
7276
7302
|
_.current && A(C);
|
|
7277
7303
|
}, 400);
|
|
@@ -7285,7 +7311,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7285
7311
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7286
7312
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7287
7313
|
] });
|
|
7288
|
-
const
|
|
7314
|
+
const B = filter(E, (C, j) => j % 2 === 0), v = filter(E, (C, j) => j % 2 === 1);
|
|
7289
7315
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7290
7316
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7291
7317
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7345,8 +7371,8 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7345
7371
|
onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
|
|
7346
7372
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7347
7373
|
children: [
|
|
7348
|
-
isEmpty(
|
|
7349
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7374
|
+
isEmpty(E) && !isEmpty(k) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7375
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: B.map((C, j) => /* @__PURE__ */ jsx(
|
|
7350
7376
|
BlockCard,
|
|
7351
7377
|
{
|
|
7352
7378
|
parentId: o,
|
|
@@ -7400,25 +7426,25 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7400
7426
|
error: c
|
|
7401
7427
|
}), g(!0);
|
|
7402
7428
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7403
|
-
const m = Object.entries(a).map(([
|
|
7404
|
-
const b = k, A = b.type || "partial",
|
|
7429
|
+
const m = Object.entries(a).map(([f, k]) => {
|
|
7430
|
+
const b = k, A = b.type || "partial", E = formatReadableName(A);
|
|
7405
7431
|
return {
|
|
7406
7432
|
type: "PartialBlock",
|
|
7407
7433
|
// Set the type to PartialBlock
|
|
7408
|
-
label: formatReadableName(b.name ||
|
|
7434
|
+
label: formatReadableName(b.name || f),
|
|
7409
7435
|
description: b.description || "",
|
|
7410
7436
|
icon: Globe,
|
|
7411
|
-
group:
|
|
7437
|
+
group: E,
|
|
7412
7438
|
// Use formatted type as group
|
|
7413
7439
|
category: "partial",
|
|
7414
|
-
partialBlockId:
|
|
7440
|
+
partialBlockId: f,
|
|
7415
7441
|
// Store the original ID as partialBlockId
|
|
7416
7442
|
_name: b.name
|
|
7417
7443
|
};
|
|
7418
|
-
}),
|
|
7444
|
+
}), x = uniq(map(m, "group"));
|
|
7419
7445
|
p({
|
|
7420
7446
|
blocks: m,
|
|
7421
|
-
groups:
|
|
7447
|
+
groups: x,
|
|
7422
7448
|
isLoading: !1,
|
|
7423
7449
|
error: null
|
|
7424
7450
|
}), g(!0);
|
|
@@ -7464,7 +7490,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7464
7490
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...r });
|
|
7465
7491
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: r, parentId: n, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7466
7492
|
var v;
|
|
7467
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (C) => C._id === n)) == null ? void 0 : v._type, [m,
|
|
7493
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (C) => C._id === n)) == null ? void 0 : v._type, [m, x] = useState("all"), [f, k] = useState(null), b = useRef(null);
|
|
7468
7494
|
useEffect(() => {
|
|
7469
7495
|
const C = setTimeout(() => {
|
|
7470
7496
|
var j;
|
|
@@ -7472,23 +7498,23 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7472
7498
|
}, 0);
|
|
7473
7499
|
return () => clearTimeout(C);
|
|
7474
7500
|
}, [g]), useEffect(() => {
|
|
7475
|
-
d && (
|
|
7501
|
+
d && (x("all"), k(null));
|
|
7476
7502
|
}, [d]), useEffect(() => (b.current = debounce((C) => {
|
|
7477
|
-
|
|
7503
|
+
x(C);
|
|
7478
7504
|
}, 500), () => {
|
|
7479
7505
|
b.current && b.current.cancel();
|
|
7480
7506
|
}), []);
|
|
7481
7507
|
const A = useCallback((C) => {
|
|
7482
7508
|
k(C), b.current && b.current(C);
|
|
7483
|
-
}, []),
|
|
7509
|
+
}, []), E = useCallback(() => {
|
|
7484
7510
|
k(null), b.current && b.current.cancel();
|
|
7485
7511
|
}, []), _ = useCallback((C) => {
|
|
7486
|
-
b.current && b.current.cancel(),
|
|
7512
|
+
b.current && b.current.cancel(), x(C), k(null);
|
|
7487
7513
|
}, []), N = useMemo(
|
|
7488
7514
|
() => d ? values(r).filter(
|
|
7489
7515
|
(C) => {
|
|
7490
|
-
var j,
|
|
7491
|
-
return (((j = C.label) == null ? void 0 : j.toLowerCase()) + " " + ((
|
|
7516
|
+
var j, T;
|
|
7517
|
+
return (((j = C.label) == null ? void 0 : j.toLowerCase()) + " " + ((T = C.type) == null ? void 0 : T.toLowerCase())).includes(d.toLowerCase());
|
|
7492
7518
|
}
|
|
7493
7519
|
) : r,
|
|
7494
7520
|
[r, d]
|
|
@@ -7500,7 +7526,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7500
7526
|
), y = useMemo(
|
|
7501
7527
|
() => sortBy(w, (C) => CORE_GROUPS.indexOf(C) === -1 ? 99 : CORE_GROUPS.indexOf(C)),
|
|
7502
7528
|
[w]
|
|
7503
|
-
), S = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]),
|
|
7529
|
+
), S = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), B = useMemo(() => m === "all" ? y : [m], [y, m]);
|
|
7504
7530
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7505
7531
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7506
7532
|
Input$1,
|
|
@@ -7520,8 +7546,8 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7520
7546
|
{
|
|
7521
7547
|
onClick: () => _("all"),
|
|
7522
7548
|
onMouseEnter: () => A("all"),
|
|
7523
|
-
onMouseLeave:
|
|
7524
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" ||
|
|
7549
|
+
onMouseLeave: E,
|
|
7550
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7525
7551
|
children: i("All")
|
|
7526
7552
|
},
|
|
7527
7553
|
"sidebar-all"
|
|
@@ -7531,8 +7557,8 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7531
7557
|
{
|
|
7532
7558
|
onClick: () => _(C),
|
|
7533
7559
|
onMouseEnter: () => A(C),
|
|
7534
|
-
onMouseLeave:
|
|
7535
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === C ||
|
|
7560
|
+
onMouseLeave: E,
|
|
7561
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === C || f === C ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7536
7562
|
children: capitalize(i(C.toLowerCase()))
|
|
7537
7563
|
},
|
|
7538
7564
|
`sidebar-${C}`
|
|
@@ -7543,7 +7569,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7543
7569
|
' "',
|
|
7544
7570
|
d,
|
|
7545
7571
|
'"'
|
|
7546
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children:
|
|
7572
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: B.map((C) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7547
7573
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(C.toLowerCase())) }),
|
|
7548
7574
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7549
7575
|
m === "all" ? filter(values(S), { group: C }) : values(S),
|
|
@@ -7573,7 +7599,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7573
7599
|
}, [i, g, c]);
|
|
7574
7600
|
const m = useCallback(() => {
|
|
7575
7601
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7576
|
-
}, []),
|
|
7602
|
+
}, []), x = useChaiAddBlockTabs(), f = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
|
|
7577
7603
|
return useEffect(() => {
|
|
7578
7604
|
i === "library" && !b && c("core");
|
|
7579
7605
|
}, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
|
|
@@ -7594,14 +7620,14 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7594
7620
|
b && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
|
|
7595
7621
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7596
7622
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7597
|
-
|
|
7598
|
-
map(
|
|
7623
|
+
f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7624
|
+
map(x, (A) => /* @__PURE__ */ jsx(TabsTrigger, { value: A.id, children: React__default.createElement(A.tab) }, `tab-add-block-${A.id}`))
|
|
7599
7625
|
] }),
|
|
7600
7626
|
/* @__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: n, position: a }) }) }) }),
|
|
7601
7627
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: n, position: a }) }),
|
|
7602
7628
|
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: n, position: a }) }) }) }),
|
|
7603
|
-
|
|
7604
|
-
map(
|
|
7629
|
+
f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: n, position: a }) }) : null,
|
|
7630
|
+
map(x, (A) => /* @__PURE__ */ jsx(TabsContent, { value: A.id, children: React__default.createElement(A.tabContent, { close: m, parentId: n, position: a }) }, `panel-add-block-${A.id}`))
|
|
7605
7631
|
]
|
|
7606
7632
|
}
|
|
7607
7633
|
)
|
|
@@ -7911,35 +7937,35 @@ const Input = ({ node: o }) => {
|
|
|
7911
7937
|
var R;
|
|
7912
7938
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7913
7939
|
let p = null;
|
|
7914
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data:
|
|
7915
|
-
|
|
7916
|
-
}, N = (
|
|
7917
|
-
|
|
7918
|
-
}, w = (
|
|
7919
|
-
|
|
7920
|
-
}, [y, S] = useAtom$1(currentAddSelection),
|
|
7921
|
-
var
|
|
7922
|
-
v(), o.parent.isSelected || S((
|
|
7940
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: x, isSelected: f, willReceiveDrop: k, isDragging: b, isEditing: A, handleClick: E } = o, _ = (I) => {
|
|
7941
|
+
I.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7942
|
+
}, N = (I) => {
|
|
7943
|
+
I.isInternal && (p = I.isOpen, I.isOpen && I.close());
|
|
7944
|
+
}, w = (I) => {
|
|
7945
|
+
I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
|
|
7946
|
+
}, [y, S] = useAtom$1(currentAddSelection), B = () => {
|
|
7947
|
+
var I;
|
|
7948
|
+
v(), o.parent.isSelected || S((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id);
|
|
7923
7949
|
}, v = () => {
|
|
7924
7950
|
S(null);
|
|
7925
|
-
}, C = (
|
|
7926
|
-
v(),
|
|
7951
|
+
}, C = (I) => {
|
|
7952
|
+
v(), I.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), E(I);
|
|
7927
7953
|
};
|
|
7928
7954
|
useEffect(() => {
|
|
7929
|
-
const
|
|
7955
|
+
const I = setTimeout(() => {
|
|
7930
7956
|
k && !o.isOpen && !b && !l.includes(m) && o.toggle();
|
|
7931
7957
|
}, 500);
|
|
7932
|
-
return () => clearTimeout(
|
|
7958
|
+
return () => clearTimeout(I);
|
|
7933
7959
|
}, [k, o, b]);
|
|
7934
|
-
const j = (
|
|
7935
|
-
const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${
|
|
7960
|
+
const j = (I, D) => {
|
|
7961
|
+
const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${I}]`);
|
|
7936
7962
|
P && P.setAttribute("data-drop", D);
|
|
7937
7963
|
const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
|
|
7938
7964
|
$.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
|
|
7939
|
-
},
|
|
7965
|
+
}, T = (I) => {
|
|
7940
7966
|
v();
|
|
7941
7967
|
const D = get(o, "parent.id");
|
|
7942
|
-
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position:
|
|
7968
|
+
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: I }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: I });
|
|
7943
7969
|
};
|
|
7944
7970
|
if (m === ROOT_TEMP_KEY)
|
|
7945
7971
|
return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
@@ -7948,7 +7974,7 @@ const Input = ({ node: o }) => {
|
|
|
7948
7974
|
"div",
|
|
7949
7975
|
{
|
|
7950
7976
|
role: "button",
|
|
7951
|
-
onClick: () =>
|
|
7977
|
+
onClick: () => T(-1),
|
|
7952
7978
|
className: "h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
7953
7979
|
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-primary px-3 py-1 text-[9px] leading-tight text-white hover:bg-primary", children: [
|
|
7954
7980
|
/* @__PURE__ */ jsx(PlusIcon, { className: "h-2 w-2 stroke-[3]" }),
|
|
@@ -7959,7 +7985,7 @@ const Input = ({ node: o }) => {
|
|
|
7959
7985
|
),
|
|
7960
7986
|
/* @__PURE__ */ jsx("br", {})
|
|
7961
7987
|
] });
|
|
7962
|
-
const L = useMemo(() => has(
|
|
7988
|
+
const L = useMemo(() => has(x, "_libBlockId") && !isEmpty(x._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [x, d]);
|
|
7963
7989
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
7964
7990
|
"div",
|
|
7965
7991
|
{
|
|
@@ -7971,23 +7997,23 @@ const Input = ({ node: o }) => {
|
|
|
7971
7997
|
ref: l.includes(m) ? null : n,
|
|
7972
7998
|
onDragStart: () => N(o),
|
|
7973
7999
|
onDragEnd: () => w(o),
|
|
7974
|
-
onDragOver: (
|
|
7975
|
-
|
|
8000
|
+
onDragOver: (I) => {
|
|
8001
|
+
I.preventDefault(), j(m, "yes");
|
|
7976
8002
|
},
|
|
7977
|
-
onDragLeave: (
|
|
7978
|
-
|
|
8003
|
+
onDragLeave: (I) => {
|
|
8004
|
+
I.preventDefault(), j(m, "no");
|
|
7979
8005
|
},
|
|
7980
|
-
onDrop: (
|
|
7981
|
-
|
|
8006
|
+
onDrop: (I) => {
|
|
8007
|
+
I.preventDefault(), j(m, "no");
|
|
7982
8008
|
},
|
|
7983
8009
|
children: [
|
|
7984
8010
|
d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
7985
8011
|
"div",
|
|
7986
8012
|
{
|
|
7987
|
-
onClick: (
|
|
7988
|
-
|
|
8013
|
+
onClick: (I) => {
|
|
8014
|
+
I.stopPropagation(), T(o.childIndex);
|
|
7989
8015
|
},
|
|
7990
|
-
onMouseEnter:
|
|
8016
|
+
onMouseEnter: B,
|
|
7991
8017
|
onMouseLeave: v,
|
|
7992
8018
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-primary opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7993
8019
|
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[4] text-white" }) })
|
|
@@ -7998,12 +8024,12 @@ const Input = ({ node: o }) => {
|
|
|
7998
8024
|
{
|
|
7999
8025
|
className: cn(
|
|
8000
8026
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
8001
|
-
|
|
8002
|
-
k && canAcceptChildBlock(
|
|
8027
|
+
f ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
|
|
8028
|
+
k && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
|
|
8003
8029
|
(o == null ? void 0 : o.id) === y ? "bg-primary/10" : "",
|
|
8004
8030
|
b && "opacity-20",
|
|
8005
8031
|
l.includes(m) ? "opacity-50" : "",
|
|
8006
|
-
L &&
|
|
8032
|
+
L && f && "bg-primary/20 text-primary"
|
|
8007
8033
|
),
|
|
8008
8034
|
children: [
|
|
8009
8035
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -8011,7 +8037,7 @@ const Input = ({ node: o }) => {
|
|
|
8011
8037
|
"div",
|
|
8012
8038
|
{
|
|
8013
8039
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
8014
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${
|
|
8040
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${f ? "text-white" : "text-slate-400"}` }) })
|
|
8015
8041
|
}
|
|
8016
8042
|
),
|
|
8017
8043
|
/* @__PURE__ */ jsxs(
|
|
@@ -8020,18 +8046,18 @@ const Input = ({ node: o }) => {
|
|
|
8020
8046
|
className: cn(
|
|
8021
8047
|
"leading-1 flex items-center",
|
|
8022
8048
|
L && "text-primary/60",
|
|
8023
|
-
L &&
|
|
8049
|
+
L && f && "text-primary/80"
|
|
8024
8050
|
),
|
|
8025
8051
|
children: [
|
|
8026
|
-
/* @__PURE__ */ jsx(TypeIcon, { type:
|
|
8052
|
+
/* @__PURE__ */ jsx(TypeIcon, { type: x == null ? void 0 : x._type }),
|
|
8027
8053
|
A ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
|
|
8028
8054
|
"div",
|
|
8029
8055
|
{
|
|
8030
8056
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
8031
|
-
onDoubleClick: (
|
|
8032
|
-
|
|
8057
|
+
onDoubleClick: (I) => {
|
|
8058
|
+
I.stopPropagation(), o.edit(), o.deselect();
|
|
8033
8059
|
},
|
|
8034
|
-
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(
|
|
8060
|
+
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(x) })
|
|
8035
8061
|
}
|
|
8036
8062
|
)
|
|
8037
8063
|
]
|
|
@@ -8039,7 +8065,7 @@ const Input = ({ node: o }) => {
|
|
|
8039
8065
|
)
|
|
8040
8066
|
] }),
|
|
8041
8067
|
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
|
|
8042
|
-
canAddChildBlock(
|
|
8068
|
+
canAddChildBlock(x == null ? void 0 : x._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8043
8069
|
/* @__PURE__ */ jsx(
|
|
8044
8070
|
TooltipTrigger,
|
|
8045
8071
|
{
|
|
@@ -8055,8 +8081,8 @@ const Input = ({ node: o }) => {
|
|
|
8055
8081
|
/* @__PURE__ */ jsx(
|
|
8056
8082
|
TooltipTrigger,
|
|
8057
8083
|
{
|
|
8058
|
-
onClick: (
|
|
8059
|
-
|
|
8084
|
+
onClick: (I) => {
|
|
8085
|
+
I.stopPropagation(), i(m), o.isOpen && o.toggle();
|
|
8060
8086
|
},
|
|
8061
8087
|
className: "cursor-pointer rounded bg-transparent",
|
|
8062
8088
|
asChild: !0,
|
|
@@ -8276,17 +8302,18 @@ const Input = ({ node: o }) => {
|
|
|
8276
8302
|
/* @__PURE__ */ jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
|
|
8277
8303
|
] });
|
|
8278
8304
|
}, BorderRadiusInput = ({ value: o, onChange: r, disabled: n }) => {
|
|
8279
|
-
const a =
|
|
8305
|
+
const [a, l] = useState(o), i = useThrottledCallback(r, [o], 200, !0);
|
|
8280
8306
|
return /* @__PURE__ */ jsx(
|
|
8281
|
-
|
|
8307
|
+
Slider,
|
|
8282
8308
|
{
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
max: "30",
|
|
8309
|
+
min: 0,
|
|
8310
|
+
step: 1,
|
|
8311
|
+
max: 50,
|
|
8287
8312
|
disabled: n,
|
|
8288
|
-
|
|
8289
|
-
|
|
8313
|
+
value: [Number(a.replace("px", ""))],
|
|
8314
|
+
onValueChange: (c) => {
|
|
8315
|
+
l(c[0].toString() + "px"), i(c[0].toString());
|
|
8316
|
+
},
|
|
8290
8317
|
className: "flex-1 cursor-pointer"
|
|
8291
8318
|
}
|
|
8292
8319
|
);
|
|
@@ -8317,20 +8344,17 @@ const Input = ({ node: o }) => {
|
|
|
8317
8344
|
onChange: n
|
|
8318
8345
|
}) => {
|
|
8319
8346
|
const a = useRegisteredFonts();
|
|
8320
|
-
return
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
children: a.map((l) => /* @__PURE__ */ jsx("option", { value: l.family, children: l.family }, l.family))
|
|
8329
|
-
}
|
|
8330
|
-
)
|
|
8347
|
+
return useEffect(() => {
|
|
8348
|
+
a.some((l) => l.family === r) || n(a[0].family);
|
|
8349
|
+
}, [r, n]), /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
8350
|
+
/* @__PURE__ */ jsx(Label, { className: "mb-1 block text-xs text-gray-600", children: startCase(o) }),
|
|
8351
|
+
/* @__PURE__ */ jsxs(Select$1, { value: r, onValueChange: n, children: [
|
|
8352
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-full text-xs text-black", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select font" }) }),
|
|
8353
|
+
/* @__PURE__ */ jsx(SelectContent, { children: a.map((l) => /* @__PURE__ */ jsx(SelectItem, { value: l.family, children: l.family }, l.family)) })
|
|
8354
|
+
] })
|
|
8331
8355
|
] });
|
|
8332
8356
|
}, LazyCssImportModal = lazy(
|
|
8333
|
-
() => import("./
|
|
8357
|
+
() => import("./css-import-modal-CcUf6F6T.js").then((o) => ({ default: o.CssImportModal }))
|
|
8334
8358
|
), PREV_THEME_KEY = "chai-builder-previous-theme", setPreviousTheme = (o) => {
|
|
8335
8359
|
if (!(typeof window > "u"))
|
|
8336
8360
|
try {
|
|
@@ -8346,148 +8370,166 @@ const Input = ({ node: o }) => {
|
|
|
8346
8370
|
console.warn("Failed to clear previous theme from localStorage:", o);
|
|
8347
8371
|
}
|
|
8348
8372
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8349
|
-
const [r] = useDarkMode(), [
|
|
8373
|
+
const [r, n] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions(), [g, h] = useTheme(), m = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
|
|
8350
8374
|
(w) => {
|
|
8351
|
-
const y = { ...
|
|
8352
|
-
setPreviousTheme(y),
|
|
8375
|
+
const y = { ...g };
|
|
8376
|
+
setPreviousTheme(y), h(w), toast.success("Theme updated", {
|
|
8353
8377
|
action: {
|
|
8354
8378
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8355
8379
|
/* @__PURE__ */ jsx(Undo$1, { className: "h-4 w-4" }),
|
|
8356
8380
|
" Undo"
|
|
8357
8381
|
] }),
|
|
8358
8382
|
onClick: () => {
|
|
8359
|
-
|
|
8383
|
+
h(y), clearPreviousTheme(), toast.dismiss();
|
|
8360
8384
|
}
|
|
8361
8385
|
},
|
|
8362
8386
|
closeButton: !0,
|
|
8363
8387
|
duration: 15e3
|
|
8364
8388
|
});
|
|
8365
8389
|
},
|
|
8366
|
-
[
|
|
8367
|
-
),
|
|
8368
|
-
|
|
8369
|
-
}, k = () => {
|
|
8370
|
-
const w = c.find((y) => Object.keys(y)[0] === n);
|
|
8390
|
+
[g, h]
|
|
8391
|
+
), k = () => {
|
|
8392
|
+
const w = d.find((y) => Object.keys(y)[0] === a);
|
|
8371
8393
|
if (w) {
|
|
8372
8394
|
const y = Object.values(w)[0];
|
|
8373
|
-
y && typeof y == "object" && "fontFamily" in y && "borderRadius" in y && "colors" in y ? f(y) : console.error("Invalid preset structure:", y);
|
|
8395
|
+
y && typeof y == "object" && "fontFamily" in y && "borderRadius" in y && "colors" in y ? (f(y), l("")) : console.error("Invalid preset structure:", y);
|
|
8374
8396
|
} else
|
|
8375
|
-
console.error("Preset not found:",
|
|
8397
|
+
console.error("Preset not found:", a);
|
|
8376
8398
|
}, b = (w) => {
|
|
8377
|
-
f(w),
|
|
8399
|
+
f(w), l("");
|
|
8378
8400
|
}, A = useDebouncedCallback(
|
|
8379
8401
|
(w, y) => {
|
|
8380
|
-
|
|
8381
|
-
...
|
|
8402
|
+
h(() => ({
|
|
8403
|
+
...g,
|
|
8382
8404
|
fontFamily: {
|
|
8383
|
-
...
|
|
8405
|
+
...g.fontFamily,
|
|
8384
8406
|
[w.replace(/font-/g, "")]: y
|
|
8385
8407
|
}
|
|
8386
8408
|
}));
|
|
8387
8409
|
},
|
|
8388
|
-
[
|
|
8410
|
+
[g],
|
|
8389
8411
|
200
|
|
8390
|
-
),
|
|
8412
|
+
), E = React.useCallback(
|
|
8391
8413
|
(w) => {
|
|
8392
|
-
|
|
8393
|
-
...
|
|
8414
|
+
h(() => ({
|
|
8415
|
+
...g,
|
|
8394
8416
|
borderRadius: `${w}px`
|
|
8395
8417
|
}));
|
|
8396
8418
|
},
|
|
8397
|
-
[
|
|
8398
|
-
200
|
|
8419
|
+
[g]
|
|
8399
8420
|
), _ = useDebouncedCallback(
|
|
8400
8421
|
(w, y) => {
|
|
8401
|
-
|
|
8402
|
-
const S = get(
|
|
8422
|
+
h(() => {
|
|
8423
|
+
const S = get(g, `colors.${w}`);
|
|
8403
8424
|
return r ? set(S, 1, y) : set(S, 0, y), {
|
|
8404
|
-
...
|
|
8425
|
+
...g,
|
|
8405
8426
|
colors: {
|
|
8406
|
-
...
|
|
8427
|
+
...g.colors,
|
|
8407
8428
|
[w]: S
|
|
8408
8429
|
}
|
|
8409
8430
|
};
|
|
8410
8431
|
});
|
|
8411
8432
|
},
|
|
8412
|
-
[
|
|
8433
|
+
[g],
|
|
8413
8434
|
200
|
|
8414
8435
|
), N = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([y]) => {
|
|
8415
|
-
const S = get(
|
|
8436
|
+
const S = get(g, `colors.${y}.${r ? 1 : 0}`);
|
|
8416
8437
|
return S ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8417
8438
|
/* @__PURE__ */ jsx(
|
|
8418
8439
|
ColorPickerInput,
|
|
8419
8440
|
{
|
|
8420
8441
|
value: S,
|
|
8421
|
-
onChange: (
|
|
8442
|
+
onChange: (B) => _(y, B)
|
|
8422
8443
|
}
|
|
8423
8444
|
),
|
|
8424
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: y.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((
|
|
8445
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: y.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((B) => B.charAt(0).toUpperCase() + B.slice(1)).join(" ") + (!y.toLowerCase().includes("foreground") && !y.toLowerCase().includes("border") && !y.toLowerCase().includes("input") && !y.toLowerCase().includes("ring") && !y.toLowerCase().includes("background") ? " Background" : "") })
|
|
8425
8446
|
] }, y) : null;
|
|
8426
8447
|
}) });
|
|
8427
|
-
return
|
|
8448
|
+
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8428
8449
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
8429
|
-
|
|
8450
|
+
d.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mx-0 my-2 flex flex-col gap-1 py-2", children: [
|
|
8430
8451
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
8431
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm", children:
|
|
8432
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs(Button, { className: "px-1", variant: "link", size: "sm", onClick: () =>
|
|
8452
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: x("Presets") }),
|
|
8453
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs(Button, { className: "px-1", variant: "link", size: "sm", onClick: () => c(!0), children: [
|
|
8433
8454
|
/* @__PURE__ */ jsx(ImportIcon, { className: "h-4 w-4" }),
|
|
8434
|
-
|
|
8455
|
+
x("Import theme")
|
|
8435
8456
|
] }) })
|
|
8436
8457
|
] }),
|
|
8437
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8438
|
-
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(
|
|
8439
|
-
"
|
|
8440
|
-
{
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
Array.isArray(c) && c.map((w) => /* @__PURE__ */ jsx("option", { value: Object.keys(w)[0], children: capitalize(Object.keys(w)[0].replaceAll("_", " ")) }, Object.keys(w)[0]))
|
|
8447
|
-
]
|
|
8448
|
-
}
|
|
8449
|
-
) }),
|
|
8450
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsx(
|
|
8451
|
-
Button,
|
|
8452
|
-
{
|
|
8453
|
-
className: "w-full text-sm",
|
|
8454
|
-
disabled: n === "",
|
|
8455
|
-
variant: "default",
|
|
8456
|
-
onClick: k,
|
|
8457
|
-
children: m("Apply")
|
|
8458
|
-
}
|
|
8459
|
-
) })
|
|
8458
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8459
|
+
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8460
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8461
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
|
|
8462
|
+
const y = Object.keys(w)[0], S = y.replaceAll("_", " ");
|
|
8463
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: y, children: capitalize(S) }, y);
|
|
8464
|
+
}) })
|
|
8465
|
+
] }) }),
|
|
8466
|
+
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: x("Apply") }) })
|
|
8460
8467
|
] })
|
|
8461
8468
|
] }),
|
|
8462
|
-
/* @__PURE__ */
|
|
8463
|
-
|
|
8469
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
8470
|
+
/* @__PURE__ */ jsxs("div", { className: cn$2("my-2 space-y-3", o), children: [
|
|
8471
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8472
|
+
/* @__PURE__ */ jsx(Type, { className: "h-3 w-3 text-gray-600" }),
|
|
8473
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8474
|
+
] }),
|
|
8475
|
+
(m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([w, y]) => /* @__PURE__ */ jsx(
|
|
8464
8476
|
FontSelector,
|
|
8465
8477
|
{
|
|
8466
8478
|
label: w,
|
|
8467
|
-
value:
|
|
8479
|
+
value: g.fontFamily[w.replace(/font-/g, "")] || y[Object.keys(y)[0]],
|
|
8468
8480
|
onChange: (S) => A(w, S)
|
|
8469
8481
|
},
|
|
8470
8482
|
w
|
|
8471
8483
|
)) }),
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center
|
|
8475
|
-
/* @__PURE__ */
|
|
8476
|
-
|
|
8477
|
-
|
|
8484
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
8485
|
+
(m == null ? void 0 : m.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
8486
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8487
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8488
|
+
/* @__PURE__ */ jsx(CornerUpRight, { className: "h-3 w-3 text-gray-600" }),
|
|
8489
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Border Radius" })
|
|
8490
|
+
] }),
|
|
8491
|
+
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
8492
|
+
] }),
|
|
8493
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: E }) })
|
|
8478
8494
|
] }),
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
/* @__PURE__ */
|
|
8482
|
-
|
|
8495
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
8496
|
+
(m == null ? void 0 : m.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
8497
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8498
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8499
|
+
/* @__PURE__ */ jsx(Palette, { className: "h-3 w-3 text-gray-600" }),
|
|
8500
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Colors" })
|
|
8501
|
+
] }),
|
|
8502
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8503
|
+
/* @__PURE__ */ jsx(Sun, { className: "h-4 w-4" }),
|
|
8504
|
+
/* @__PURE__ */ jsx(
|
|
8505
|
+
Switch,
|
|
8506
|
+
{
|
|
8507
|
+
checked: r,
|
|
8508
|
+
onCheckedChange: (w) => n(w),
|
|
8509
|
+
"aria-label": "Toggle dark mode",
|
|
8510
|
+
className: "mx-1"
|
|
8511
|
+
}
|
|
8512
|
+
),
|
|
8513
|
+
/* @__PURE__ */ jsx(Moon, { className: "h-4 w-4" })
|
|
8514
|
+
] }) })
|
|
8515
|
+
] }),
|
|
8516
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: m.colors.map((w) => N(w)) })
|
|
8517
|
+
] }),
|
|
8518
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8519
|
+
LazyCssImportModal,
|
|
8520
|
+
{
|
|
8521
|
+
open: i,
|
|
8522
|
+
onOpenChange: c,
|
|
8523
|
+
onImport: b
|
|
8524
|
+
}
|
|
8525
|
+
) })
|
|
8483
8526
|
] }),
|
|
8484
8527
|
/* @__PURE__ */ jsx("br", {}),
|
|
8485
8528
|
/* @__PURE__ */ jsx("br", {}),
|
|
8486
8529
|
/* @__PURE__ */ jsx("br", {}),
|
|
8487
8530
|
/* @__PURE__ */ jsx("br", {})
|
|
8488
8531
|
] }),
|
|
8489
|
-
|
|
8490
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: l && /* @__PURE__ */ jsx(LazyCssImportModal, { open: l, onOpenChange: i, onImport: b }) })
|
|
8532
|
+
p && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(p) })
|
|
8491
8533
|
] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: "You don't have permission to edit the theme. Please contact your administrator to get access." }) }) }) });
|
|
8492
8534
|
}), Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = { heading_font: "Heading Font", body_font: "Body Font", rounded_corner: "Rounded Corners", primary: "Primary", secondary: "Secondary", background: "Background", text_color: "Text Color", background_dark_mode: "Background (Dark Mode)", text_color_dark_mode: "Text Color (Dark Mode)" }, web_blocks = { box: "box", tag: "Tag", div: "div", level: "Level", header: "header", footer: "footer", section: "section", article: "article", aside: "aside", main: "main", nav: "navigation", figure: "figure", details: "details", summary: "summary", dialog: "dialog", strike: "strike", caption: "caption", legend: "legend", figcaption: "figure caption", mark: "mark", background_image: "Background Image", label: "Label", default: "default", icon_size: "Icon Size", icon_position: "Icon Position", start: "Start", end: "End", button: "Button", custom_html: "Custom HTML", html_code: "HTML Code", default_snippet: "The HTML snippet goes here...", placeholder: "Enter custom HTML code here", custom_script: "Custom Script", dark_mode: "Dark Mode", divider: "Divider", empty_box: "Empty Box", heading: "Heading", image: "Image", alt: "Alt", width: "Width", height: "Height", video: "Video", span: "Span", content: "Content", icon: "Icon", richtext: "Rich Text", list: "List", list_type: "List Type", listitem: "List Item", link: "Link", list_item: "List Item", none: "None", disc: "Disc", number: "Number", paragraph: "Paragraph", lightbox_link: "Lightbox Link", href: "Link", type: "Type", iframe: "iframe", inline: "inline", ajax: "ajax", autoplay: "Video autoplay", max_width: "Max Width", backdrop_color: "Background Color", gallery_name: "Gallery Name", slot: "Slot", empty_slot: "Empty Slot", text: "Text", video_url: "Video URL", controls: "Show Controls", loop: "Loop", muted: "Muted", checkbox: "Checkbox", required: "Required", checked: "Checked", submit_button: "Submit Button", form: "Form", submit_url: "Submit URL", error_message: "Error Message", success_message: "Success Message", input: "Input", value: "Value", show_label: "Show Label", field_name: "Field Name", radio: "Radio", multiple: "Multiple", options: "Options", select: "Select", multiple_choice: "Multiple Choice", textarea: "Textarea", rows: "Rows" }, Undo = "Undo", Redo = "Redo", Duplicate = "Duplicate", Close = "Close", Selected = "Selected", Select = "Select", Attributes = "Attributes", apply = "apply", presets = "presets", Orientation = "Orientation", Color = "Color", Upload = "Upload", lngEn = {
|
|
8493
8535
|
"Add block": "Add Block",
|
|
@@ -8973,11 +9015,11 @@ function QuickPrompts({ onClick: o }) {
|
|
|
8973
9015
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
8974
9016
|
const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), h = useRef(null), m = useRef(null);
|
|
8975
9017
|
useEffect(() => {
|
|
8976
|
-
var
|
|
8977
|
-
(
|
|
9018
|
+
var f;
|
|
9019
|
+
(f = h.current) == null || f.focus();
|
|
8978
9020
|
}, []);
|
|
8979
|
-
const
|
|
8980
|
-
const { usage: k } =
|
|
9021
|
+
const x = (f) => {
|
|
9022
|
+
const { usage: k } = f || {};
|
|
8981
9023
|
!l && k && g(k), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
8982
9024
|
};
|
|
8983
9025
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
@@ -8998,12 +9040,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8998
9040
|
{
|
|
8999
9041
|
ref: h,
|
|
9000
9042
|
value: i,
|
|
9001
|
-
onChange: (
|
|
9043
|
+
onChange: (f) => c(f.target.value),
|
|
9002
9044
|
placeholder: r("Ask AI to edit content"),
|
|
9003
9045
|
className: "w-full",
|
|
9004
9046
|
rows: 3,
|
|
9005
|
-
onKeyDown: (
|
|
9006
|
-
|
|
9047
|
+
onKeyDown: (f) => {
|
|
9048
|
+
f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), n("content", o, i, x));
|
|
9007
9049
|
}
|
|
9008
9050
|
}
|
|
9009
9051
|
),
|
|
@@ -9013,7 +9055,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
9013
9055
|
{
|
|
9014
9056
|
disabled: i.trim().length < 5 || a,
|
|
9015
9057
|
onClick: () => {
|
|
9016
|
-
m.current && clearTimeout(m.current), g(void 0), n("content", o, i,
|
|
9058
|
+
m.current && clearTimeout(m.current), g(void 0), n("content", o, i, x);
|
|
9017
9059
|
},
|
|
9018
9060
|
variant: "default",
|
|
9019
9061
|
className: "w-fit",
|
|
@@ -9045,8 +9087,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
9045
9087
|
/* @__PURE__ */ jsx(
|
|
9046
9088
|
QuickPrompts,
|
|
9047
9089
|
{
|
|
9048
|
-
onClick: (
|
|
9049
|
-
m.current && clearTimeout(m.current), g(void 0), n("content", o,
|
|
9090
|
+
onClick: (f) => {
|
|
9091
|
+
m.current && clearTimeout(m.current), g(void 0), n("content", o, f, x);
|
|
9050
9092
|
}
|
|
9051
9093
|
}
|
|
9052
9094
|
)
|
|
@@ -9063,8 +9105,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
9063
9105
|
const m = async () => {
|
|
9064
9106
|
try {
|
|
9065
9107
|
d(!0), u(null), await i(n), toast.success(o("Updated AI Context")), h.current.click();
|
|
9066
|
-
} catch (
|
|
9067
|
-
u(
|
|
9108
|
+
} catch (x) {
|
|
9109
|
+
u(x);
|
|
9068
9110
|
} finally {
|
|
9069
9111
|
d(!1);
|
|
9070
9112
|
}
|
|
@@ -9072,8 +9114,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
9072
9114
|
return /* @__PURE__ */ jsx(
|
|
9073
9115
|
Accordion,
|
|
9074
9116
|
{
|
|
9075
|
-
onValueChange: (
|
|
9076
|
-
g(
|
|
9117
|
+
onValueChange: (x) => {
|
|
9118
|
+
g(x !== "");
|
|
9077
9119
|
},
|
|
9078
9120
|
type: "single",
|
|
9079
9121
|
collapsible: !0,
|
|
@@ -9085,12 +9127,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
9085
9127
|
{
|
|
9086
9128
|
ref: l,
|
|
9087
9129
|
value: n,
|
|
9088
|
-
onChange: (
|
|
9130
|
+
onChange: (x) => a(x.target.value),
|
|
9089
9131
|
placeholder: o("Tell about this page eg this page is about"),
|
|
9090
9132
|
className: "mt-1 w-full",
|
|
9091
9133
|
rows: 10,
|
|
9092
|
-
onKeyDown: (
|
|
9093
|
-
|
|
9134
|
+
onKeyDown: (x) => {
|
|
9135
|
+
x.key === "Enter" && (x.preventDefault(), m());
|
|
9094
9136
|
}
|
|
9095
9137
|
}
|
|
9096
9138
|
),
|
|
@@ -9207,13 +9249,13 @@ function AIChatPanel() {
|
|
|
9207
9249
|
content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
|
|
9208
9250
|
timestamp: /* @__PURE__ */ new Date()
|
|
9209
9251
|
};
|
|
9210
|
-
r((
|
|
9252
|
+
r((E) => [...E, A]), i(!1), d(null);
|
|
9211
9253
|
}, 1500);
|
|
9212
9254
|
}, m = (b) => {
|
|
9213
9255
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
|
|
9214
|
-
},
|
|
9215
|
-
var
|
|
9216
|
-
const A = (
|
|
9256
|
+
}, x = (b) => {
|
|
9257
|
+
var E;
|
|
9258
|
+
const A = (E = b.target.files) == null ? void 0 : E[0];
|
|
9217
9259
|
if (A) {
|
|
9218
9260
|
const _ = new FileReader();
|
|
9219
9261
|
_.onload = (N) => {
|
|
@@ -9221,7 +9263,7 @@ function AIChatPanel() {
|
|
|
9221
9263
|
d((w = N.target) == null ? void 0 : w.result);
|
|
9222
9264
|
}, _.readAsDataURL(A);
|
|
9223
9265
|
}
|
|
9224
|
-
},
|
|
9266
|
+
}, f = () => {
|
|
9225
9267
|
var b;
|
|
9226
9268
|
(b = p.current) == null || b.click();
|
|
9227
9269
|
}, k = () => {
|
|
@@ -9288,14 +9330,14 @@ function AIChatPanel() {
|
|
|
9288
9330
|
className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
|
|
9289
9331
|
}
|
|
9290
9332
|
),
|
|
9291
|
-
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange:
|
|
9333
|
+
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: x, accept: "image/*", className: "hidden" }),
|
|
9292
9334
|
/* @__PURE__ */ jsx(
|
|
9293
9335
|
Button,
|
|
9294
9336
|
{
|
|
9295
9337
|
size: "icon",
|
|
9296
9338
|
variant: "ghost",
|
|
9297
9339
|
className: "absolute bottom-2 right-2 h-6 w-6",
|
|
9298
|
-
onClick:
|
|
9340
|
+
onClick: f,
|
|
9299
9341
|
children: /* @__PURE__ */ jsx(Image$1, { className: "h-4 w-4 text-muted-foreground" })
|
|
9300
9342
|
}
|
|
9301
9343
|
)
|
|
@@ -9413,7 +9455,7 @@ const AiAssistant = () => {
|
|
|
9413
9455
|
preloadedAttributes: r = [],
|
|
9414
9456
|
onAttributesChange: n
|
|
9415
9457
|
}) {
|
|
9416
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""),
|
|
9458
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), x = useRef(null), f = useRef(null), k = usePageExternalData();
|
|
9417
9459
|
useEffect(() => {
|
|
9418
9460
|
l(r);
|
|
9419
9461
|
}, [r]);
|
|
@@ -9427,9 +9469,9 @@ const AiAssistant = () => {
|
|
|
9427
9469
|
n(y), l(a), c(""), p(""), m("");
|
|
9428
9470
|
}
|
|
9429
9471
|
}, A = (y) => {
|
|
9430
|
-
const S = a.filter((
|
|
9472
|
+
const S = a.filter((B, v) => v !== y);
|
|
9431
9473
|
n(S), l(S);
|
|
9432
|
-
},
|
|
9474
|
+
}, E = (y) => {
|
|
9433
9475
|
g(y), c(a[y].key), p(a[y].value);
|
|
9434
9476
|
}, _ = () => {
|
|
9435
9477
|
if (i.startsWith("@")) {
|
|
@@ -9443,23 +9485,23 @@ const AiAssistant = () => {
|
|
|
9443
9485
|
}, N = (y) => {
|
|
9444
9486
|
y.key === "Enter" && !y.shiftKey && (y.preventDefault(), u !== null ? _() : b());
|
|
9445
9487
|
}, w = useCallback((y) => {
|
|
9446
|
-
const S = (C) => /[.,!?;:]/.test(C),
|
|
9488
|
+
const S = (C) => /[.,!?;:]/.test(C), B = (C, j, T) => {
|
|
9447
9489
|
let L = "", R = "";
|
|
9448
|
-
const
|
|
9449
|
-
return j > 0 && (
|
|
9450
|
-
text: L +
|
|
9490
|
+
const I = j > 0 ? C[j - 1] : "", D = j < C.length ? C[j] : "";
|
|
9491
|
+
return j > 0 && (I === "." || !S(I) && I !== " ") && (L = " "), j < C.length && !S(D) && D !== " " && (R = " "), {
|
|
9492
|
+
text: L + T + R,
|
|
9451
9493
|
prefixLength: L.length,
|
|
9452
9494
|
suffixLength: R.length
|
|
9453
9495
|
};
|
|
9454
|
-
}, v =
|
|
9496
|
+
}, v = f.current;
|
|
9455
9497
|
if (v) {
|
|
9456
|
-
const C = v.selectionStart || 0, j = v.value || "",
|
|
9457
|
-
if (
|
|
9458
|
-
const O = `{{${y}}}`, { text: P } =
|
|
9498
|
+
const C = v.selectionStart || 0, j = v.value || "", T = v.selectionEnd || C;
|
|
9499
|
+
if (T > C) {
|
|
9500
|
+
const O = `{{${y}}}`, { text: P } = B(j, C, O), $ = j.slice(0, C) + P + j.slice(T);
|
|
9459
9501
|
p($);
|
|
9460
9502
|
return;
|
|
9461
9503
|
}
|
|
9462
|
-
const R = `{{${y}}}`, { text:
|
|
9504
|
+
const R = `{{${y}}}`, { text: I } = B(j, C, R), D = j.slice(0, C) + I + j.slice(C);
|
|
9463
9505
|
p(D);
|
|
9464
9506
|
}
|
|
9465
9507
|
}, []);
|
|
@@ -9482,7 +9524,7 @@ const AiAssistant = () => {
|
|
|
9482
9524
|
autoCorrect: "off",
|
|
9483
9525
|
spellCheck: "false",
|
|
9484
9526
|
id: "attrKey",
|
|
9485
|
-
ref:
|
|
9527
|
+
ref: x,
|
|
9486
9528
|
value: i,
|
|
9487
9529
|
onChange: (y) => c(y.target.value),
|
|
9488
9530
|
placeholder: "Enter Key",
|
|
@@ -9503,7 +9545,7 @@ const AiAssistant = () => {
|
|
|
9503
9545
|
spellCheck: "false",
|
|
9504
9546
|
id: "attrValue",
|
|
9505
9547
|
rows: 2,
|
|
9506
|
-
ref:
|
|
9548
|
+
ref: f,
|
|
9507
9549
|
value: d,
|
|
9508
9550
|
onChange: (y) => p(y.target.value),
|
|
9509
9551
|
onKeyDown: N,
|
|
@@ -9524,7 +9566,7 @@ const AiAssistant = () => {
|
|
|
9524
9566
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: y.value.toString() })
|
|
9525
9567
|
] }),
|
|
9526
9568
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9527
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9569
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => E(S), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
9528
9570
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(S), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
|
|
9529
9571
|
] })
|
|
9530
9572
|
] }, S)) })
|
|
@@ -9696,28 +9738,28 @@ const RootLayout = () => {
|
|
|
9696
9738
|
n(r === y ? null : y);
|
|
9697
9739
|
},
|
|
9698
9740
|
[r]
|
|
9699
|
-
), { t:
|
|
9741
|
+
), { t: x } = useTranslation(), f = useMemo(
|
|
9700
9742
|
() => [...p, ...u, ...g],
|
|
9701
9743
|
[p, u, g]
|
|
9702
|
-
), k = useBuilderProp("htmlDir", "ltr"), b = find(
|
|
9744
|
+
), k = useBuilderProp("htmlDir", "ltr"), b = find(f, { id: r }) ?? first(f), A = get(b, "width", DEFAULT_PANEL_WIDTH);
|
|
9703
9745
|
useEffect(() => {
|
|
9704
9746
|
if (r !== null) {
|
|
9705
|
-
const y = find(
|
|
9747
|
+
const y = find(f, { id: r });
|
|
9706
9748
|
y && get(y, "view", "standard") === "standard" && (a.current = r, i(get(y, "width", DEFAULT_PANEL_WIDTH)));
|
|
9707
9749
|
}
|
|
9708
|
-
}, [r,
|
|
9709
|
-
const
|
|
9750
|
+
}, [r, f]);
|
|
9751
|
+
const E = useMemo(() => {
|
|
9710
9752
|
if (r === null) return 0;
|
|
9711
|
-
const y = find(
|
|
9753
|
+
const y = find(f, { id: r });
|
|
9712
9754
|
return get(y, "view", "standard") === "standard" ? A : l;
|
|
9713
|
-
}, [r, A, l,
|
|
9755
|
+
}, [r, A, l, f]), _ = useCallback(() => {
|
|
9714
9756
|
n(a.current);
|
|
9715
9757
|
}, [n]), N = useCallback(() => {
|
|
9716
9758
|
n("outline");
|
|
9717
9759
|
}, [n]);
|
|
9718
9760
|
useEffect(() => {
|
|
9719
|
-
find(
|
|
9720
|
-
}, [r,
|
|
9761
|
+
find(f, { id: r }) || n("outline");
|
|
9762
|
+
}, [r, f]);
|
|
9721
9763
|
const w = useCallback(
|
|
9722
9764
|
(y) => {
|
|
9723
9765
|
m(y);
|
|
@@ -9741,7 +9783,7 @@ const RootLayout = () => {
|
|
|
9741
9783
|
isActive: r === y.id,
|
|
9742
9784
|
show: () => w(y.id)
|
|
9743
9785
|
}) }),
|
|
9744
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9786
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(y.label) }) })
|
|
9745
9787
|
] }, "button-top-" + S)) }),
|
|
9746
9788
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9747
9789
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((y, S) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
@@ -9751,7 +9793,7 @@ const RootLayout = () => {
|
|
|
9751
9793
|
isActive: r === y.id,
|
|
9752
9794
|
show: () => w(y.id)
|
|
9753
9795
|
}) }),
|
|
9754
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9796
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(y.label) }) })
|
|
9755
9797
|
] }, "button-bottom-" + S)) })
|
|
9756
9798
|
] }),
|
|
9757
9799
|
/* @__PURE__ */ jsx(
|
|
@@ -9759,15 +9801,15 @@ const RootLayout = () => {
|
|
|
9759
9801
|
{
|
|
9760
9802
|
id: "left-panel",
|
|
9761
9803
|
className: "h-full max-h-full border-r border-border",
|
|
9762
|
-
initial: { width:
|
|
9763
|
-
animate: { width:
|
|
9804
|
+
initial: { width: E },
|
|
9805
|
+
animate: { width: E },
|
|
9764
9806
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9765
9807
|
children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9766
9808
|
/* @__PURE__ */ jsx(
|
|
9767
9809
|
"div",
|
|
9768
9810
|
{
|
|
9769
9811
|
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(b, "isInternal", !1) ? "" : "w-64"}`,
|
|
9770
|
-
children: /* @__PURE__ */ jsx("span", { children:
|
|
9812
|
+
children: /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
|
|
9771
9813
|
}
|
|
9772
9814
|
),
|
|
9773
9815
|
/* @__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), {}) }) })
|
|
@@ -9790,11 +9832,11 @@ const RootLayout = () => {
|
|
|
9790
9832
|
/* @__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: [
|
|
9791
9833
|
/* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
9792
9834
|
" ",
|
|
9793
|
-
|
|
9835
|
+
x("AI Assistant")
|
|
9794
9836
|
] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
9795
9837
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9796
|
-
/* @__PURE__ */ jsx(
|
|
9797
|
-
|
|
9838
|
+
/* @__PURE__ */ jsx(Palette, { className: "w-4 h-4 text-gray-600" }),
|
|
9839
|
+
x("Theme Settings")
|
|
9798
9840
|
] }),
|
|
9799
9841
|
/* @__PURE__ */ jsx(
|
|
9800
9842
|
Button,
|
|
@@ -9825,7 +9867,7 @@ const RootLayout = () => {
|
|
|
9825
9867
|
children: [
|
|
9826
9868
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9827
9869
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9828
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9870
|
+
/* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
|
|
9829
9871
|
] }) }),
|
|
9830
9872
|
/* @__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), {
|
|
9831
9873
|
close: N
|
|
@@ -9837,7 +9879,7 @@ const RootLayout = () => {
|
|
|
9837
9879
|
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${A}px` }, children: [
|
|
9838
9880
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9839
9881
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9840
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9882
|
+
/* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
|
|
9841
9883
|
] }) }),
|
|
9842
9884
|
/* @__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), {
|
|
9843
9885
|
close: N
|
|
@@ -9863,7 +9905,7 @@ const RootLayout = () => {
|
|
|
9863
9905
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9864
9906
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9865
9907
|
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9866
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9908
|
+
/* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
|
|
9867
9909
|
] }),
|
|
9868
9910
|
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9869
9911
|
] }),
|
|
@@ -9907,36 +9949,36 @@ const RootLayout = () => {
|
|
|
9907
9949
|
}) => {
|
|
9908
9950
|
const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), g = useMemo(() => {
|
|
9909
9951
|
if (!l.trim()) return a;
|
|
9910
|
-
const
|
|
9952
|
+
const f = l.toLowerCase();
|
|
9911
9953
|
return Object.fromEntries(
|
|
9912
9954
|
Object.entries(a).filter(([k, b]) => {
|
|
9913
9955
|
var A;
|
|
9914
|
-
return (k == null ? void 0 : k.toLowerCase().includes(
|
|
9956
|
+
return (k == null ? void 0 : k.toLowerCase().includes(f)) || ((A = b == null ? void 0 : b.description) == null ? void 0 : A.toLowerCase().includes(f));
|
|
9915
9957
|
})
|
|
9916
9958
|
);
|
|
9917
|
-
}, [a, l]), h = (
|
|
9959
|
+
}, [a, l]), h = (f) => {
|
|
9918
9960
|
d(!0), u({
|
|
9919
|
-
x:
|
|
9920
|
-
y:
|
|
9961
|
+
x: f.clientX - r.x,
|
|
9962
|
+
y: f.clientY - r.y
|
|
9921
9963
|
});
|
|
9922
|
-
}, m = (
|
|
9964
|
+
}, m = (f) => {
|
|
9923
9965
|
if (!c) return;
|
|
9924
|
-
const k =
|
|
9966
|
+
const k = f.clientX - p.x, b = f.clientY - p.y, A = f.currentTarget, E = A.offsetWidth, _ = A.offsetHeight, N = window.innerWidth - E, w = window.innerHeight - _, y = Math.max(0, Math.min(k, N)), S = Math.max(0, Math.min(b, w));
|
|
9925
9967
|
n(y, S);
|
|
9926
|
-
},
|
|
9968
|
+
}, x = () => {
|
|
9927
9969
|
d(!1);
|
|
9928
9970
|
};
|
|
9929
9971
|
return useEffect(() => {
|
|
9930
|
-
const
|
|
9972
|
+
const f = () => {
|
|
9931
9973
|
c && d(!1);
|
|
9932
9974
|
};
|
|
9933
|
-
return window.addEventListener("mouseup",
|
|
9975
|
+
return window.addEventListener("mouseup", f), () => window.removeEventListener("mouseup", f);
|
|
9934
9976
|
}, [c]), !r || r.x < 0 || r.y < 0 ? null : /* @__PURE__ */ jsxs(
|
|
9935
9977
|
"div",
|
|
9936
9978
|
{
|
|
9937
9979
|
onMouseDown: h,
|
|
9938
9980
|
onMouseMove: m,
|
|
9939
|
-
onMouseUp:
|
|
9981
|
+
onMouseUp: x,
|
|
9940
9982
|
className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
|
|
9941
9983
|
style: {
|
|
9942
9984
|
left: r.x,
|
|
@@ -9978,13 +10020,13 @@ const RootLayout = () => {
|
|
|
9978
10020
|
placeholder: "Search features...",
|
|
9979
10021
|
className: "w-full pl-8",
|
|
9980
10022
|
value: l,
|
|
9981
|
-
onChange: (
|
|
10023
|
+
onChange: (f) => i(f.target.value),
|
|
9982
10024
|
autoFocus: !0
|
|
9983
10025
|
}
|
|
9984
10026
|
)
|
|
9985
10027
|
] })
|
|
9986
10028
|
] }),
|
|
9987
|
-
/* @__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(([
|
|
10029
|
+
/* @__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(([f, k]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: f, options: k }, f)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
9988
10030
|
'No features found matching "',
|
|
9989
10031
|
l,
|
|
9990
10032
|
'"'
|
|
@@ -10095,63 +10137,63 @@ const RootLayout = () => {
|
|
|
10095
10137
|
for (const i of r.p)
|
|
10096
10138
|
l.add(i);
|
|
10097
10139
|
return l;
|
|
10098
|
-
}, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...
|
|
10099
|
-
var
|
|
10100
|
-
return (
|
|
10101
|
-
}, g = (m,
|
|
10102
|
-
var
|
|
10103
|
-
return (
|
|
10140
|
+
}, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...x) => m.read(...x), p = (m, ...x) => m.write(...x), u = (m, x) => {
|
|
10141
|
+
var f;
|
|
10142
|
+
return (f = m.unstable_onInit) == null ? void 0 : f.call(m, x);
|
|
10143
|
+
}, g = (m, x) => {
|
|
10144
|
+
var f;
|
|
10145
|
+
return (f = m.onMount) == null ? void 0 : f.call(m, x);
|
|
10104
10146
|
}, ...h) => {
|
|
10105
10147
|
const m = h[0] || ((S) => {
|
|
10106
|
-
let
|
|
10107
|
-
return
|
|
10108
|
-
}),
|
|
10109
|
-
let S,
|
|
10148
|
+
let B = o.get(S);
|
|
10149
|
+
return B || (B = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(S, B), u == null || u(S, y)), B;
|
|
10150
|
+
}), x = h[1] || (() => {
|
|
10151
|
+
let S, B;
|
|
10110
10152
|
const v = (C) => {
|
|
10111
10153
|
try {
|
|
10112
10154
|
C();
|
|
10113
10155
|
} catch (j) {
|
|
10114
|
-
S || (S = !0,
|
|
10156
|
+
S || (S = !0, B = j);
|
|
10115
10157
|
}
|
|
10116
10158
|
};
|
|
10117
10159
|
do {
|
|
10118
10160
|
c.f && v(c.f);
|
|
10119
10161
|
const C = /* @__PURE__ */ new Set(), j = C.add.bind(C);
|
|
10120
|
-
a.forEach((
|
|
10162
|
+
a.forEach((T) => {
|
|
10121
10163
|
var L;
|
|
10122
|
-
return (L = r.get(
|
|
10123
|
-
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), C.forEach(v), a.size &&
|
|
10164
|
+
return (L = r.get(T)) == null ? void 0 : L.l.forEach(j);
|
|
10165
|
+
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), C.forEach(v), a.size && f();
|
|
10124
10166
|
} while (a.size || i.size || l.size);
|
|
10125
10167
|
if (S)
|
|
10126
|
-
throw
|
|
10127
|
-
}),
|
|
10128
|
-
const S = [],
|
|
10168
|
+
throw B;
|
|
10169
|
+
}), f = h[2] || (() => {
|
|
10170
|
+
const S = [], B = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), C = Array.from(a);
|
|
10129
10171
|
for (; C.length; ) {
|
|
10130
|
-
const j = C[C.length - 1],
|
|
10172
|
+
const j = C[C.length - 1], T = m(j);
|
|
10131
10173
|
if (v.has(j)) {
|
|
10132
10174
|
C.pop();
|
|
10133
10175
|
continue;
|
|
10134
10176
|
}
|
|
10135
|
-
if (
|
|
10136
|
-
n.get(j) ===
|
|
10177
|
+
if (B.has(j)) {
|
|
10178
|
+
n.get(j) === T.n && S.push([j, T]), v.add(j), C.pop();
|
|
10137
10179
|
continue;
|
|
10138
10180
|
}
|
|
10139
|
-
|
|
10140
|
-
for (const L of getMountedOrPendingDependents(j,
|
|
10141
|
-
|
|
10181
|
+
B.add(j);
|
|
10182
|
+
for (const L of getMountedOrPendingDependents(j, T, r))
|
|
10183
|
+
B.has(L) || C.push(L);
|
|
10142
10184
|
}
|
|
10143
10185
|
for (let j = S.length - 1; j >= 0; --j) {
|
|
10144
|
-
const [
|
|
10186
|
+
const [T, L] = S[j];
|
|
10145
10187
|
let R = !1;
|
|
10146
|
-
for (const
|
|
10147
|
-
if (
|
|
10188
|
+
for (const I of L.d.keys())
|
|
10189
|
+
if (I !== T && a.has(I)) {
|
|
10148
10190
|
R = !0;
|
|
10149
10191
|
break;
|
|
10150
10192
|
}
|
|
10151
|
-
R && (k(
|
|
10193
|
+
R && (k(T), E(T)), n.delete(T);
|
|
10152
10194
|
}
|
|
10153
10195
|
}), k = h[3] || ((S) => {
|
|
10154
|
-
var
|
|
10196
|
+
var B, v;
|
|
10155
10197
|
const C = m(S);
|
|
10156
10198
|
if (isAtomStateInitialized(C) && (r.has(S) && n.get(S) !== C.n || Array.from(C.d).every(
|
|
10157
10199
|
([P, $]) => (
|
|
@@ -10163,8 +10205,8 @@ const RootLayout = () => {
|
|
|
10163
10205
|
return C;
|
|
10164
10206
|
C.d.clear();
|
|
10165
10207
|
let j = !0;
|
|
10166
|
-
const
|
|
10167
|
-
r.has(S) && (
|
|
10208
|
+
const T = () => {
|
|
10209
|
+
r.has(S) && (E(S), f(), x());
|
|
10168
10210
|
}, L = (P) => {
|
|
10169
10211
|
var $;
|
|
10170
10212
|
if (isSelfAtom(S, P)) {
|
|
@@ -10180,30 +10222,30 @@ const RootLayout = () => {
|
|
|
10180
10222
|
try {
|
|
10181
10223
|
return returnAtomValue(M);
|
|
10182
10224
|
} finally {
|
|
10183
|
-
C.d.set(P, M.n), isPendingPromise(C.v) && addPendingPromiseToDependency(S, C.v, M), ($ = r.get(P)) == null || $.t.add(S), j ||
|
|
10225
|
+
C.d.set(P, M.n), isPendingPromise(C.v) && addPendingPromiseToDependency(S, C.v, M), ($ = r.get(P)) == null || $.t.add(S), j || T();
|
|
10184
10226
|
}
|
|
10185
10227
|
};
|
|
10186
|
-
let R,
|
|
10228
|
+
let R, I;
|
|
10187
10229
|
const D = {
|
|
10188
10230
|
get signal() {
|
|
10189
10231
|
return R || (R = new AbortController()), R.signal;
|
|
10190
10232
|
},
|
|
10191
10233
|
get setSelf() {
|
|
10192
|
-
return !
|
|
10234
|
+
return !I && isActuallyWritableAtom(S) && (I = (...P) => {
|
|
10193
10235
|
if (!j)
|
|
10194
10236
|
try {
|
|
10195
10237
|
return A(S, ...P);
|
|
10196
10238
|
} finally {
|
|
10197
|
-
|
|
10239
|
+
f(), x();
|
|
10198
10240
|
}
|
|
10199
|
-
}),
|
|
10241
|
+
}), I;
|
|
10200
10242
|
}
|
|
10201
10243
|
}, O = C.n;
|
|
10202
10244
|
try {
|
|
10203
10245
|
const P = d(S, L, D);
|
|
10204
|
-
return setAtomStateValueOrPromise(S, P, m), isPromiseLike$1(P) && ((
|
|
10205
|
-
|
|
10206
|
-
|
|
10246
|
+
return setAtomStateValueOrPromise(S, P, m), isPromiseLike$1(P) && ((B = P.onCancel) == null || B.call(P, () => R == null ? void 0 : R.abort()), P.then(
|
|
10247
|
+
T,
|
|
10248
|
+
T
|
|
10207
10249
|
)), C;
|
|
10208
10250
|
} catch (P) {
|
|
10209
10251
|
return delete C.v, C.e = P, ++C.n, C;
|
|
@@ -10211,55 +10253,55 @@ const RootLayout = () => {
|
|
|
10211
10253
|
j = !1, O !== C.n && n.get(S) === O && (n.set(S, C.n), a.add(S), (v = c.c) == null || v.call(c, S));
|
|
10212
10254
|
}
|
|
10213
10255
|
}), b = h[4] || ((S) => {
|
|
10214
|
-
const
|
|
10215
|
-
for (;
|
|
10216
|
-
const v =
|
|
10256
|
+
const B = [S];
|
|
10257
|
+
for (; B.length; ) {
|
|
10258
|
+
const v = B.pop(), C = m(v);
|
|
10217
10259
|
for (const j of getMountedOrPendingDependents(v, C, r)) {
|
|
10218
|
-
const
|
|
10219
|
-
n.set(j,
|
|
10260
|
+
const T = m(j);
|
|
10261
|
+
n.set(j, T.n), B.push(j);
|
|
10220
10262
|
}
|
|
10221
10263
|
}
|
|
10222
|
-
}), A = h[5] || ((S, ...
|
|
10264
|
+
}), A = h[5] || ((S, ...B) => {
|
|
10223
10265
|
let v = !0;
|
|
10224
|
-
const C = (
|
|
10266
|
+
const C = (T) => returnAtomValue(k(T)), j = (T, ...L) => {
|
|
10225
10267
|
var R;
|
|
10226
|
-
const
|
|
10268
|
+
const I = m(T);
|
|
10227
10269
|
try {
|
|
10228
|
-
if (isSelfAtom(S,
|
|
10229
|
-
if (!hasInitialValue(
|
|
10270
|
+
if (isSelfAtom(S, T)) {
|
|
10271
|
+
if (!hasInitialValue(T))
|
|
10230
10272
|
throw new Error("atom not writable");
|
|
10231
|
-
const D =
|
|
10232
|
-
setAtomStateValueOrPromise(
|
|
10273
|
+
const D = I.n, O = L[0];
|
|
10274
|
+
setAtomStateValueOrPromise(T, O, m), E(T), D !== I.n && (a.add(T), (R = c.c) == null || R.call(c, T), b(T));
|
|
10233
10275
|
return;
|
|
10234
10276
|
} else
|
|
10235
|
-
return A(
|
|
10277
|
+
return A(T, ...L);
|
|
10236
10278
|
} finally {
|
|
10237
|
-
v || (
|
|
10279
|
+
v || (f(), x());
|
|
10238
10280
|
}
|
|
10239
10281
|
};
|
|
10240
10282
|
try {
|
|
10241
|
-
return p(S, C, j, ...
|
|
10283
|
+
return p(S, C, j, ...B);
|
|
10242
10284
|
} finally {
|
|
10243
10285
|
v = !1;
|
|
10244
10286
|
}
|
|
10245
|
-
}),
|
|
10246
|
-
var
|
|
10287
|
+
}), E = h[6] || ((S) => {
|
|
10288
|
+
var B;
|
|
10247
10289
|
const v = m(S), C = r.get(S);
|
|
10248
10290
|
if (C && !isPendingPromise(v.v)) {
|
|
10249
|
-
for (const [j,
|
|
10291
|
+
for (const [j, T] of v.d)
|
|
10250
10292
|
if (!C.d.has(j)) {
|
|
10251
10293
|
const L = m(j);
|
|
10252
|
-
_(j).t.add(S), C.d.add(j),
|
|
10294
|
+
_(j).t.add(S), C.d.add(j), T !== L.n && (a.add(j), (B = c.c) == null || B.call(c, j), b(j));
|
|
10253
10295
|
}
|
|
10254
10296
|
for (const j of C.d || [])
|
|
10255
10297
|
if (!v.d.has(j)) {
|
|
10256
10298
|
C.d.delete(j);
|
|
10257
|
-
const
|
|
10258
|
-
|
|
10299
|
+
const T = N(j);
|
|
10300
|
+
T == null || T.t.delete(S);
|
|
10259
10301
|
}
|
|
10260
10302
|
}
|
|
10261
10303
|
}), _ = h[7] || ((S) => {
|
|
10262
|
-
var
|
|
10304
|
+
var B;
|
|
10263
10305
|
const v = m(S);
|
|
10264
10306
|
let C = r.get(S);
|
|
10265
10307
|
if (!C) {
|
|
@@ -10270,28 +10312,28 @@ const RootLayout = () => {
|
|
|
10270
10312
|
l: /* @__PURE__ */ new Set(),
|
|
10271
10313
|
d: new Set(v.d.keys()),
|
|
10272
10314
|
t: /* @__PURE__ */ new Set()
|
|
10273
|
-
}, r.set(S, C), (
|
|
10315
|
+
}, r.set(S, C), (B = c.m) == null || B.call(c, S), isActuallyWritableAtom(S)) {
|
|
10274
10316
|
const j = () => {
|
|
10275
|
-
let
|
|
10317
|
+
let T = !0;
|
|
10276
10318
|
const L = (...R) => {
|
|
10277
10319
|
try {
|
|
10278
10320
|
return A(S, ...R);
|
|
10279
10321
|
} finally {
|
|
10280
|
-
|
|
10322
|
+
T || (f(), x());
|
|
10281
10323
|
}
|
|
10282
10324
|
};
|
|
10283
10325
|
try {
|
|
10284
10326
|
const R = g(S, L);
|
|
10285
10327
|
R && (C.u = () => {
|
|
10286
|
-
|
|
10328
|
+
T = !0;
|
|
10287
10329
|
try {
|
|
10288
10330
|
R();
|
|
10289
10331
|
} finally {
|
|
10290
|
-
|
|
10332
|
+
T = !1;
|
|
10291
10333
|
}
|
|
10292
10334
|
});
|
|
10293
10335
|
} finally {
|
|
10294
|
-
|
|
10336
|
+
T = !1;
|
|
10295
10337
|
}
|
|
10296
10338
|
};
|
|
10297
10339
|
l.add(j);
|
|
@@ -10299,17 +10341,17 @@ const RootLayout = () => {
|
|
|
10299
10341
|
}
|
|
10300
10342
|
return C;
|
|
10301
10343
|
}), N = h[8] || ((S) => {
|
|
10302
|
-
var
|
|
10344
|
+
var B;
|
|
10303
10345
|
const v = m(S);
|
|
10304
10346
|
let C = r.get(S);
|
|
10305
10347
|
if (C && !C.l.size && !Array.from(C.t).some((j) => {
|
|
10306
|
-
var
|
|
10307
|
-
return (
|
|
10348
|
+
var T;
|
|
10349
|
+
return (T = r.get(j)) == null ? void 0 : T.d.has(S);
|
|
10308
10350
|
})) {
|
|
10309
|
-
C.u && i.add(C.u), C = void 0, r.delete(S), (
|
|
10351
|
+
C.u && i.add(C.u), C = void 0, r.delete(S), (B = c.u) == null || B.call(c, S);
|
|
10310
10352
|
for (const j of v.d.keys()) {
|
|
10311
|
-
const
|
|
10312
|
-
|
|
10353
|
+
const T = N(j);
|
|
10354
|
+
T == null || T.t.delete(S);
|
|
10313
10355
|
}
|
|
10314
10356
|
return;
|
|
10315
10357
|
}
|
|
@@ -10330,27 +10372,27 @@ const RootLayout = () => {
|
|
|
10330
10372
|
g,
|
|
10331
10373
|
// building-block functions
|
|
10332
10374
|
m,
|
|
10333
|
-
f,
|
|
10334
10375
|
x,
|
|
10376
|
+
f,
|
|
10335
10377
|
k,
|
|
10336
10378
|
b,
|
|
10337
10379
|
A,
|
|
10338
|
-
|
|
10380
|
+
E,
|
|
10339
10381
|
_,
|
|
10340
10382
|
N
|
|
10341
10383
|
], y = {
|
|
10342
10384
|
get: (S) => returnAtomValue(k(S)),
|
|
10343
|
-
set: (S, ...
|
|
10385
|
+
set: (S, ...B) => {
|
|
10344
10386
|
try {
|
|
10345
|
-
return A(S, ...
|
|
10387
|
+
return A(S, ...B);
|
|
10346
10388
|
} finally {
|
|
10347
|
-
|
|
10389
|
+
f(), x();
|
|
10348
10390
|
}
|
|
10349
10391
|
},
|
|
10350
|
-
sub: (S,
|
|
10392
|
+
sub: (S, B) => {
|
|
10351
10393
|
const C = _(S).l;
|
|
10352
|
-
return C.add(
|
|
10353
|
-
C.delete(
|
|
10394
|
+
return C.add(B), x(), () => {
|
|
10395
|
+
C.delete(B), N(S), x();
|
|
10354
10396
|
};
|
|
10355
10397
|
}
|
|
10356
10398
|
};
|
|
@@ -10501,7 +10543,7 @@ export {
|
|
|
10501
10543
|
getBlocksFromHTML as convertHTMLToChaiBlocks,
|
|
10502
10544
|
generateUUID as generateBlockId,
|
|
10503
10545
|
getBlocksFromHTML,
|
|
10504
|
-
|
|
10546
|
+
ze as i18n,
|
|
10505
10547
|
cn$2 as mergeClasses,
|
|
10506
10548
|
registerBlockSettingField,
|
|
10507
10549
|
registerBlockSettingTemplate,
|