@chaibuilder/sdk 3.2.8 → 3.2.9
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-cnBzYLxk.cjs → code-editor-CEsA4Nlq.cjs} +1 -1
- package/dist/{code-editor-vpbOSO05.js → code-editor-DPr4HDOV.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{design-token-usage-CCv4XltM.cjs → design-token-usage-DyQcFypc.cjs} +1 -1
- package/dist/{design-token-usage-BDArZ38H.js → design-token-usage-_FBnvL92.js} +1 -1
- package/dist/{index-DvdOXKUE.js → index-CIez6R-d.js} +541 -552
- package/dist/index-zLw6cVaV.cjs +160 -0
- package/dist/{manage-design-tokens-DUoMdCBl.js → manage-design-tokens-BHCCrWFS.js} +2 -2
- package/dist/{manage-design-tokens-DpC46NAy.cjs → manage-design-tokens-Cfjg_at9.cjs} +1 -1
- package/dist/{rte-widget-modal-CXbmmhcb.js → rte-widget-modal-CsBCpJSY.js} +1 -1
- package/dist/{rte-widget-modal-DDjf0xui.cjs → rte-widget-modal-Dif3ZoFQ.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/package.json +1 -1
- package/dist/index-CuANr9iH.cjs +0 -160
|
@@ -16,9 +16,9 @@ import React__default, { useEffect, useCallback, useState, useMemo, useRef, Comp
|
|
|
16
16
|
import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-DLaiD20q.js";
|
|
17
17
|
import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
|
|
18
18
|
import { isObject } from "@rjsf/utils";
|
|
19
|
-
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebouncedState } from "@react-hookz/web";
|
|
20
19
|
import { toast, Toaster } from "sonner";
|
|
21
20
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
21
|
+
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebouncedState } from "@react-hookz/web";
|
|
22
22
|
import Fuse from "fuse.js";
|
|
23
23
|
import UndoManager from "undo-manager";
|
|
24
24
|
import { ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, at as Input$1, aW as Skeleton, d as Alert, e as AlertDescription, v as Button, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, 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, au as Label, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, b1 as Textarea, z as CardFooter, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, b8 as cn$2, 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, a6 as DialogHeader, aX as Slider, aL as Separator, aY as Switch, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./tooltip-DUosa-uC.js";
|
|
@@ -708,22 +708,23 @@ class StructureRuleRegistry {
|
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
710
|
const defaultRuleRegistry = new StructureRuleRegistry(), useCheckStructure = (r = {}) => {
|
|
711
|
-
const n = useBuilderProp("flags.validateStructure", !0), o = useSetAtom$1(structureErrorsAtom), a = useSetAtom$1(structureValidationValidAtom), i = useSetAtom$1(hasStructureErrorsAtom), l = useSetAtom$1(hasStructureWarningsAtom)
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
711
|
+
const n = useBuilderProp("flags.validateStructure", !0), o = useSetAtom$1(structureErrorsAtom), a = useSetAtom$1(structureValidationValidAtom), i = useSetAtom$1(hasStructureErrorsAtom), l = useSetAtom$1(hasStructureWarningsAtom);
|
|
712
|
+
return useCallback(
|
|
713
|
+
(d) => {
|
|
714
|
+
const u = d;
|
|
715
|
+
if (!n || u.length === 0) return;
|
|
716
|
+
const p = convertToBlocksTree(u), h = [];
|
|
717
|
+
let f = defaultRuleRegistry.getRules();
|
|
718
|
+
r.enableAccessibilityRules && (defaultRuleRegistry.enableAccessibilityRules(), f = defaultRuleRegistry.getRules()), r.customRules && r.customRules.length > 0 && f.push(...r.customRules), f.forEach((x) => {
|
|
718
719
|
try {
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
} catch (
|
|
722
|
-
console.error(`Error running structure rule "${
|
|
720
|
+
const y = x.validate(u, p);
|
|
721
|
+
h.push(...y);
|
|
722
|
+
} catch (y) {
|
|
723
|
+
console.error(`Error running structure rule "${x.name}":`, y);
|
|
723
724
|
}
|
|
724
725
|
});
|
|
725
|
-
const
|
|
726
|
-
o(
|
|
726
|
+
const m = h.filter((x) => x.severity === "error").length > 0, g = h.filter((x) => x.severity === "warning").length > 0, b = !m;
|
|
727
|
+
o(h), a(b), i(m), l(g);
|
|
727
728
|
},
|
|
728
729
|
[
|
|
729
730
|
n,
|
|
@@ -734,18 +735,6 @@ const defaultRuleRegistry = new StructureRuleRegistry(), useCheckStructure = (r
|
|
|
734
735
|
l
|
|
735
736
|
]
|
|
736
737
|
);
|
|
737
|
-
return useDebouncedCallback(
|
|
738
|
-
c,
|
|
739
|
-
[
|
|
740
|
-
n,
|
|
741
|
-
r,
|
|
742
|
-
o,
|
|
743
|
-
a,
|
|
744
|
-
i,
|
|
745
|
-
l
|
|
746
|
-
],
|
|
747
|
-
1e3
|
|
748
|
-
);
|
|
749
738
|
}, useBlocksStoreManager = () => {
|
|
750
739
|
const [, r] = useBlocksStore(), { postMessage: n } = useBroadcastChannel(), o = useUpdateBlockAtom(), a = useCheckStructure(), i = useIncrementActionsCount();
|
|
751
740
|
return {
|
|
@@ -779,7 +768,7 @@ const defaultRuleRegistry = new StructureRuleRegistry(), useCheckStructure = (r
|
|
|
779
768
|
l.forEach((c) => {
|
|
780
769
|
const d = omit(c, "_id");
|
|
781
770
|
o({ id: c._id, props: d });
|
|
782
|
-
}), n({ type: "blocks-props-updated", blocks: l }),
|
|
771
|
+
}), n({ type: "blocks-props-updated", blocks: l }), i();
|
|
783
772
|
}
|
|
784
773
|
};
|
|
785
774
|
}, blockRepeaterDataAtom = atom({});
|
|
@@ -977,13 +966,13 @@ const checkMissingTranslations = (r, n) => n ? r.some((o) => {
|
|
|
977
966
|
return !d || d === u ? !1 : checkMissingTranslations(y.blocks || [], d);
|
|
978
967
|
};
|
|
979
968
|
return { savePage: useThrottledCallback(
|
|
980
|
-
async (y = !1,
|
|
981
|
-
if (!
|
|
969
|
+
async (y = !1, S = !1) => {
|
|
970
|
+
if (!S && (!c("save_page") || !p))
|
|
982
971
|
return;
|
|
983
|
-
const
|
|
984
|
-
return
|
|
972
|
+
const k = i();
|
|
973
|
+
return k != null && k.blocks && f(k.blocks), n("SAVING"), a("SAVING"), m(0), await o({
|
|
985
974
|
autoSave: y,
|
|
986
|
-
blocks:
|
|
975
|
+
blocks: k.blocks,
|
|
987
976
|
theme: l,
|
|
988
977
|
needTranslations: g(),
|
|
989
978
|
designTokens: h
|
|
@@ -1008,10 +997,10 @@ const checkMissingTranslations = (r, n) => n ? r.some((o) => {
|
|
|
1008
997
|
if (!y && (!c("save_page") || !p))
|
|
1009
998
|
return;
|
|
1010
999
|
n("SAVING"), a("SAVING");
|
|
1011
|
-
const
|
|
1000
|
+
const S = i();
|
|
1012
1001
|
return m(0), await o({
|
|
1013
1002
|
autoSave: !0,
|
|
1014
|
-
blocks:
|
|
1003
|
+
blocks: S.blocks,
|
|
1015
1004
|
theme: l,
|
|
1016
1005
|
needTranslations: g(),
|
|
1017
1006
|
designTokens: h
|
|
@@ -1071,13 +1060,13 @@ const undoRedoStateAtom = atom({
|
|
|
1071
1060
|
} = useBlocksStoreManager();
|
|
1072
1061
|
return {
|
|
1073
1062
|
moveBlocks: (g, b, x) => {
|
|
1074
|
-
const y = builderStore.get(presentBlocksAtom),
|
|
1075
|
-
const B = y.find((w) => w._id ===
|
|
1076
|
-
return { _id:
|
|
1077
|
-
}),
|
|
1078
|
-
|
|
1079
|
-
undo: () => each(
|
|
1080
|
-
i([
|
|
1063
|
+
const y = builderStore.get(presentBlocksAtom), S = map(g, (C) => {
|
|
1064
|
+
const B = y.find((w) => w._id === C)._parent || null, A = y.filter((w) => B ? w._parent === B : !w._parent).map((w) => w._id).indexOf(C);
|
|
1065
|
+
return { _id: C, oldParent: B, oldPosition: A };
|
|
1066
|
+
}), k = S.find(({ _id: C }) => C === g[0]);
|
|
1067
|
+
k && k.oldParent === b && k.oldPosition === x || (i(g, b, x), r({
|
|
1068
|
+
undo: () => each(S, ({ _id: C, oldParent: E, oldPosition: B }) => {
|
|
1069
|
+
i([C], E, B);
|
|
1081
1070
|
}),
|
|
1082
1071
|
redo: () => i(g, b, x)
|
|
1083
1072
|
}));
|
|
@@ -1089,28 +1078,28 @@ const undoRedoStateAtom = atom({
|
|
|
1089
1078
|
});
|
|
1090
1079
|
},
|
|
1091
1080
|
removeBlocks: (g) => {
|
|
1092
|
-
var
|
|
1093
|
-
const b = builderStore.get(presentBlocksAtom), x = (
|
|
1081
|
+
var k;
|
|
1082
|
+
const b = builderStore.get(presentBlocksAtom), x = (k = first$1(g)) == null ? void 0 : k._parent, S = b.filter((C) => x ? C._parent === x : !C._parent).indexOf(first$1(g));
|
|
1094
1083
|
a(map(g, "_id")), r({
|
|
1095
|
-
undo: () => o(g, x,
|
|
1084
|
+
undo: () => o(g, x, S),
|
|
1096
1085
|
redo: () => a(map(g, "_id"))
|
|
1097
1086
|
});
|
|
1098
1087
|
},
|
|
1099
1088
|
updateBlocks: (g, b, x) => {
|
|
1100
1089
|
const y = builderStore.get(presentBlocksAtom);
|
|
1101
|
-
let
|
|
1090
|
+
let S = [];
|
|
1102
1091
|
if (x)
|
|
1103
|
-
|
|
1092
|
+
S = map(g, (k) => ({ _id: k, ...x }));
|
|
1104
1093
|
else {
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
const E = y.find((I) => I._id ===
|
|
1108
|
-
return each(
|
|
1094
|
+
const k = keys$1(b);
|
|
1095
|
+
S = map(g, (C) => {
|
|
1096
|
+
const E = y.find((I) => I._id === C), B = { _id: C };
|
|
1097
|
+
return each(k, (I) => B[I] = E[I]), B;
|
|
1109
1098
|
});
|
|
1110
1099
|
}
|
|
1111
|
-
l(map(g, (
|
|
1112
|
-
undo: () => l(
|
|
1113
|
-
redo: () => l(map(g, (
|
|
1100
|
+
l(map(g, (k) => ({ _id: k, ...b }))), r({
|
|
1101
|
+
undo: () => l(S),
|
|
1102
|
+
redo: () => l(map(g, (k) => ({ _id: k, ...b })))
|
|
1114
1103
|
});
|
|
1115
1104
|
},
|
|
1116
1105
|
updateBlocksRuntime: (g, b) => {
|
|
@@ -1127,8 +1116,8 @@ const undoRedoStateAtom = atom({
|
|
|
1127
1116
|
const b = builderStore.get(presentBlocksAtom);
|
|
1128
1117
|
let x = [];
|
|
1129
1118
|
x = map(g, (y) => {
|
|
1130
|
-
const
|
|
1131
|
-
return each(
|
|
1119
|
+
const S = keys$1(y), k = b.find((E) => E._id === y._id), C = {};
|
|
1120
|
+
return each(S, (E) => C[E] = k[E]), C;
|
|
1132
1121
|
}), l(g), r({
|
|
1133
1122
|
undo: () => l(x),
|
|
1134
1123
|
redo: () => l(g)
|
|
@@ -2604,8 +2593,8 @@ const getBlockWithChildren = (r, n) => {
|
|
|
2604
2593
|
for (const x in b) {
|
|
2605
2594
|
const y = b[x];
|
|
2606
2595
|
if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
|
|
2607
|
-
const { baseClasses:
|
|
2608
|
-
b[x] = compact(flattenDeep([
|
|
2596
|
+
const { baseClasses: S, classes: k } = getSplitChaiClasses(y);
|
|
2597
|
+
b[x] = compact(flattenDeep([S, k])).join(" ");
|
|
2609
2598
|
} else
|
|
2610
2599
|
x !== "_id" && delete b[x];
|
|
2611
2600
|
}
|
|
@@ -2617,7 +2606,7 @@ const getBlockWithChildren = (r, n) => {
|
|
|
2617
2606
|
if (i) {
|
|
2618
2607
|
n(!0), a(null);
|
|
2619
2608
|
try {
|
|
2620
|
-
const y = u === p ? "" : u,
|
|
2609
|
+
const y = u === p ? "" : u, S = b.toLowerCase().includes("translate the content"), k = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(g, d)), u, S) : [f(g, d)], C = await i(m, addLangToPrompt(b, h, m), k, y), { blocks: E, error: B } = C;
|
|
2621
2610
|
if (B) {
|
|
2622
2611
|
a(B);
|
|
2623
2612
|
return;
|
|
@@ -2631,7 +2620,7 @@ const getBlockWithChildren = (r, n) => {
|
|
|
2631
2620
|
c(I);
|
|
2632
2621
|
} else
|
|
2633
2622
|
l(E);
|
|
2634
|
-
x && x(
|
|
2623
|
+
x && x(C);
|
|
2635
2624
|
} catch (y) {
|
|
2636
2625
|
a(y);
|
|
2637
2626
|
} finally {
|
|
@@ -3178,7 +3167,7 @@ const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), useCanvasIframe
|
|
|
3178
3167
|
const [r] = useBlocksStore();
|
|
3179
3168
|
return useCallback(
|
|
3180
3169
|
(n) => {
|
|
3181
|
-
const o = getBlocksFromHTML(n), a = mergeBlocksWithExisting(o, r);
|
|
3170
|
+
const o = syncBlocksWithDefaults(getBlocksFromHTML(n)), a = mergeBlocksWithExisting(o, r);
|
|
3182
3171
|
return handlei18N(a, r);
|
|
3183
3172
|
},
|
|
3184
3173
|
[r]
|
|
@@ -3534,23 +3523,23 @@ function calculateElementZone(r, n, o, a, i) {
|
|
|
3534
3523
|
}
|
|
3535
3524
|
}
|
|
3536
3525
|
function detectDropZone(r, n, o, a, i) {
|
|
3537
|
-
var
|
|
3526
|
+
var C, E, B, I;
|
|
3538
3527
|
const l = r.getAttribute("data-block-id"), c = r.getAttribute("data-block-type") || "Box";
|
|
3539
3528
|
if (!l)
|
|
3540
3529
|
return null;
|
|
3541
3530
|
let d = r.parentElement;
|
|
3542
3531
|
for (; d && !d.hasAttribute("data-block-id"); )
|
|
3543
3532
|
d = d.parentElement;
|
|
3544
|
-
const u = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), p = d ? getOrientation(d) : "vertical", h = getOrientation(r), f = isLeafBlock(c), m = !f && canAcceptChildBlock(c, a), g = ((
|
|
3533
|
+
const u = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), p = d ? getOrientation(d) : "vertical", h = getOrientation(r), f = isLeafBlock(c), m = !f && canAcceptChildBlock(c, a), g = ((C = i.defaultView) == null ? void 0 : C.scrollY) || 0, b = ((E = i.defaultView) == null ? void 0 : E.scrollX) || 0;
|
|
3545
3534
|
if (l === "canvas" && hasChildBlocks(r)) {
|
|
3546
3535
|
const A = getChildBlocks(r), w = A[A.length - 1];
|
|
3547
3536
|
if (w) {
|
|
3548
|
-
const
|
|
3537
|
+
const v = w.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = T.width - j - P, D = T.left + b + j;
|
|
3549
3538
|
return {
|
|
3550
3539
|
position: "after",
|
|
3551
3540
|
placeholderOrientation: "horizontal",
|
|
3552
3541
|
rect: {
|
|
3553
|
-
top:
|
|
3542
|
+
top: v.bottom + g,
|
|
3554
3543
|
left: D,
|
|
3555
3544
|
width: L,
|
|
3556
3545
|
height: 4
|
|
@@ -3566,7 +3555,7 @@ function detectDropZone(r, n, o, a, i) {
|
|
|
3566
3555
|
if (m && !f && hasChildBlocks(r)) {
|
|
3567
3556
|
const A = detectGapZone(r, n, o, h);
|
|
3568
3557
|
if (A) {
|
|
3569
|
-
const w = A.before.getBoundingClientRect(),
|
|
3558
|
+
const w = A.before.getBoundingClientRect(), v = A.after.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = getChildBlocks(r), D = getSiblingsInSameRow(L, A.before, h);
|
|
3570
3559
|
let $ = 0;
|
|
3571
3560
|
if (D.forEach((M) => {
|
|
3572
3561
|
const O = M.getBoundingClientRect();
|
|
@@ -3590,7 +3579,7 @@ function detectDropZone(r, n, o, a, i) {
|
|
|
3590
3579
|
// High confidence for gap zones
|
|
3591
3580
|
};
|
|
3592
3581
|
} else {
|
|
3593
|
-
const M = w.top + g, O = $ > 0 ? $ : Math.max(w.height,
|
|
3582
|
+
const M = w.top + g, O = $ > 0 ? $ : Math.max(w.height, v.height);
|
|
3594
3583
|
return {
|
|
3595
3584
|
position: "after",
|
|
3596
3585
|
placeholderOrientation: "vertical",
|
|
@@ -3612,7 +3601,7 @@ function detectDropZone(r, n, o, a, i) {
|
|
|
3612
3601
|
if (d && u) {
|
|
3613
3602
|
const A = detectParentEdgeProximity(d, n, o, p);
|
|
3614
3603
|
if (A) {
|
|
3615
|
-
const w = d.getBoundingClientRect(),
|
|
3604
|
+
const w = d.getBoundingClientRect(), v = window.getComputedStyle(d), T = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, j = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, L = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, D = ((I = i.defaultView) == null ? void 0 : I.scrollX) || 0, $ = p === "vertical" ? "horizontal" : "vertical", M = getMaxSiblingDimensions(d);
|
|
3616
3605
|
if (A === "start") {
|
|
3617
3606
|
const O = getChildBlocks(d)[0];
|
|
3618
3607
|
if (O) {
|
|
@@ -3705,20 +3694,20 @@ function detectDropZone(r, n, o, a, i) {
|
|
|
3705
3694
|
}
|
|
3706
3695
|
let y;
|
|
3707
3696
|
x.position === "inside" ? y = h === "vertical" ? "horizontal" : "vertical" : y = p === "vertical" ? "horizontal" : "vertical";
|
|
3708
|
-
const
|
|
3697
|
+
const S = calculatePlaceholderRect(
|
|
3709
3698
|
r,
|
|
3710
3699
|
d,
|
|
3711
3700
|
x.position,
|
|
3712
3701
|
y,
|
|
3713
3702
|
i
|
|
3714
|
-
),
|
|
3703
|
+
), k = x.position === "inside" ? l : u;
|
|
3715
3704
|
return {
|
|
3716
3705
|
position: x.position,
|
|
3717
3706
|
placeholderOrientation: y,
|
|
3718
|
-
rect:
|
|
3707
|
+
rect: S,
|
|
3719
3708
|
targetElement: r,
|
|
3720
3709
|
targetBlockId: l,
|
|
3721
|
-
targetParentId:
|
|
3710
|
+
targetParentId: k,
|
|
3722
3711
|
isEmpty: x.position === "inside" && !hasChildBlocks(r),
|
|
3723
3712
|
confidence: x.confidence
|
|
3724
3713
|
};
|
|
@@ -3767,14 +3756,14 @@ function getSiblingsInSameRow(r, n, o) {
|
|
|
3767
3756
|
}
|
|
3768
3757
|
function calculatePlaceholderRect(r, n, o, a, i) {
|
|
3769
3758
|
var j, P;
|
|
3770
|
-
const l = r.getBoundingClientRect(), c = window.getComputedStyle(r), d = ((j = i.defaultView) == null ? void 0 : j.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, h = parseFloat(c.marginBottom) || 0, f = parseFloat(c.marginLeft) || 0, m = parseFloat(c.marginRight) || 0, g = parseFloat(c.paddingTop) || 0, b = parseFloat(c.paddingBottom) || 0, x = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0,
|
|
3759
|
+
const l = r.getBoundingClientRect(), c = window.getComputedStyle(r), d = ((j = i.defaultView) == null ? void 0 : j.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, h = parseFloat(c.marginBottom) || 0, f = parseFloat(c.marginLeft) || 0, m = parseFloat(c.marginRight) || 0, g = parseFloat(c.paddingTop) || 0, b = parseFloat(c.paddingBottom) || 0, x = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, S = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, C = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, E = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, I = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, A = n ? getOrientation(n) : "vertical", w = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(w, r, A);
|
|
3771
3760
|
let T = 0, N = 0;
|
|
3772
|
-
if (
|
|
3761
|
+
if (v.forEach((L) => {
|
|
3773
3762
|
const D = L.getBoundingClientRect();
|
|
3774
3763
|
D.height > T && (T = D.height), D.width > N && (N = D.width);
|
|
3775
3764
|
}), o === "before")
|
|
3776
3765
|
if (a === "horizontal") {
|
|
3777
|
-
const L =
|
|
3766
|
+
const L = S ? S.width - k - C : l.width, D = S ? S.left + u + k : l.left + u;
|
|
3778
3767
|
return {
|
|
3779
3768
|
top: l.top + d - p - 2,
|
|
3780
3769
|
left: D,
|
|
@@ -3782,7 +3771,7 @@ function calculatePlaceholderRect(r, n, o, a, i) {
|
|
|
3782
3771
|
height: 4
|
|
3783
3772
|
};
|
|
3784
3773
|
} else {
|
|
3785
|
-
const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight :
|
|
3774
|
+
const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
|
|
3786
3775
|
return {
|
|
3787
3776
|
top: L,
|
|
3788
3777
|
left: l.left + u - f - 2,
|
|
@@ -3792,7 +3781,7 @@ function calculatePlaceholderRect(r, n, o, a, i) {
|
|
|
3792
3781
|
}
|
|
3793
3782
|
else if (o === "after")
|
|
3794
3783
|
if (a === "horizontal") {
|
|
3795
|
-
const L =
|
|
3784
|
+
const L = S ? S.width - k - C : l.width, D = S ? S.left + u + k : l.left + u;
|
|
3796
3785
|
return {
|
|
3797
3786
|
top: l.bottom + d + h - 2,
|
|
3798
3787
|
left: D,
|
|
@@ -3800,7 +3789,7 @@ function calculatePlaceholderRect(r, n, o, a, i) {
|
|
|
3800
3789
|
height: 4
|
|
3801
3790
|
};
|
|
3802
3791
|
} else {
|
|
3803
|
-
const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight :
|
|
3792
|
+
const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
|
|
3804
3793
|
return {
|
|
3805
3794
|
top: L,
|
|
3806
3795
|
left: l.right + u + m - 2,
|
|
@@ -3884,31 +3873,31 @@ const useBlockDrop = () => {
|
|
|
3884
3873
|
return;
|
|
3885
3874
|
}
|
|
3886
3875
|
n(null);
|
|
3887
|
-
const
|
|
3888
|
-
if (!
|
|
3876
|
+
const S = o.targetBlockId, k = o.targetParentId;
|
|
3877
|
+
if (!S)
|
|
3889
3878
|
return;
|
|
3890
|
-
const { parentId:
|
|
3879
|
+
const { parentId: C, index: E, replaceImageUrl: B } = calculateInsertionIndex(
|
|
3891
3880
|
i,
|
|
3892
|
-
k,
|
|
3893
3881
|
S,
|
|
3882
|
+
k,
|
|
3894
3883
|
o.position,
|
|
3895
3884
|
r
|
|
3896
3885
|
), I = r._id !== void 0;
|
|
3897
3886
|
if (B && isDraggingOnlyImageBlock(r)) {
|
|
3898
|
-
b([
|
|
3887
|
+
b([S], { image: get(r, "blocks.0.image") }), setTimeout(() => {
|
|
3899
3888
|
g(m + 1);
|
|
3900
3889
|
}, 50);
|
|
3901
3890
|
return;
|
|
3902
3891
|
}
|
|
3903
3892
|
if (I)
|
|
3904
|
-
d([r._id],
|
|
3893
|
+
d([r._id], C === null ? void 0 : C, E), h(), p([]), u([r._id]);
|
|
3905
3894
|
else {
|
|
3906
3895
|
const A = r._type || r.type, w = r != null && r.blocks ? isFunction$1(r == null ? void 0 : r.blocks) ? syncBlocksWithDefaults(r == null ? void 0 : r.blocks()) : r == null ? void 0 : r.blocks : null;
|
|
3907
3896
|
c(
|
|
3908
3897
|
A === "PartialBlock" ? {
|
|
3909
3898
|
blocks: [{ _type: A, _id: "partial-block", partialBlockId: r.partialBlockId }]
|
|
3910
3899
|
} : (w == null ? void 0 : w.length) > 0 ? { blocks: [...w] } : { type: A },
|
|
3911
|
-
|
|
3900
|
+
C,
|
|
3912
3901
|
E
|
|
3913
3902
|
);
|
|
3914
3903
|
}
|
|
@@ -4013,22 +4002,22 @@ const LEAF_BLOCK_TYPES = [
|
|
|
4013
4002
|
if (!(c != null && c.defaultView)) return;
|
|
4014
4003
|
const m = c.defaultView, g = m.innerHeight, b = m.scrollY, x = c.documentElement.scrollHeight;
|
|
4015
4004
|
u.current = f;
|
|
4016
|
-
const y = f,
|
|
4017
|
-
let
|
|
4018
|
-
if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && b > 0 ? (
|
|
4005
|
+
const y = f, S = g - f;
|
|
4006
|
+
let k = !1, C = null, E = 0;
|
|
4007
|
+
if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && b > 0 ? (k = !0, C = "up", E = y) : S < AUTO_SCROLL_CONFIG.EDGE_ZONE && b + g < x && (k = !0, C = "down", E = S), !k && d.current !== null) {
|
|
4019
4008
|
cancelAnimationFrame(d.current), d.current = null;
|
|
4020
4009
|
return;
|
|
4021
4010
|
}
|
|
4022
|
-
if (
|
|
4011
|
+
if (k && C) {
|
|
4023
4012
|
const B = 1 - E / AUTO_SCROLL_CONFIG.EDGE_ZONE, I = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, A = () => {
|
|
4024
4013
|
if (!isDragging || !m) {
|
|
4025
4014
|
d.current = null;
|
|
4026
4015
|
return;
|
|
4027
4016
|
}
|
|
4028
|
-
const w =
|
|
4017
|
+
const w = C === "up" ? -I : I;
|
|
4029
4018
|
m.scrollBy(0, w);
|
|
4030
|
-
const
|
|
4031
|
-
|
|
4019
|
+
const v = m.scrollY, T = v > 0, N = v + g < x, j = u.current, P = g - u.current;
|
|
4020
|
+
C === "up" && T && j < AUTO_SCROLL_CONFIG.EDGE_ZONE || C === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(A) : d.current = null;
|
|
4032
4021
|
};
|
|
4033
4022
|
d.current === null && (d.current = requestAnimationFrame(A));
|
|
4034
4023
|
}
|
|
@@ -4051,18 +4040,18 @@ const LEAF_BLOCK_TYPES = [
|
|
|
4051
4040
|
const y = r._id;
|
|
4052
4041
|
if (y && (b === y || isDescendantOf(b, y, l)))
|
|
4053
4042
|
return;
|
|
4054
|
-
const
|
|
4055
|
-
if (!
|
|
4043
|
+
const S = r._type || r.type;
|
|
4044
|
+
if (!S)
|
|
4056
4045
|
return;
|
|
4057
|
-
const
|
|
4058
|
-
p(
|
|
4059
|
-
const E = detectDropZone(g,
|
|
4046
|
+
const k = f.clientX, C = f.clientY;
|
|
4047
|
+
p(C);
|
|
4048
|
+
const E = detectDropZone(g, k, C, S, c);
|
|
4060
4049
|
if (!E)
|
|
4061
4050
|
return;
|
|
4062
4051
|
const B = g.getAttribute("data-block-type") || "Box";
|
|
4063
4052
|
let I = !1;
|
|
4064
4053
|
const A = LEAF_BLOCK_TYPES.includes(B);
|
|
4065
|
-
if (B === "Image" &&
|
|
4054
|
+
if (B === "Image" && S === "Image" && isDraggingOnlyImageBlock(r)) {
|
|
4066
4055
|
i(b), o({
|
|
4067
4056
|
isVisible: !0,
|
|
4068
4057
|
isValid: !0,
|
|
@@ -4081,14 +4070,14 @@ const LEAF_BLOCK_TYPES = [
|
|
|
4081
4070
|
if (E.position === "inside") {
|
|
4082
4071
|
if (A || y && !canDropWithoutCircularReference(y, b, l))
|
|
4083
4072
|
return;
|
|
4084
|
-
I = canAcceptChildBlock(B,
|
|
4073
|
+
I = canAcceptChildBlock(B, S);
|
|
4085
4074
|
} else {
|
|
4086
|
-
let
|
|
4087
|
-
for (;
|
|
4088
|
-
|
|
4089
|
-
if (
|
|
4075
|
+
let v = g.parentElement, T = "Box";
|
|
4076
|
+
for (; v && !v.hasAttribute("data-block-id"); )
|
|
4077
|
+
v = v.parentElement;
|
|
4078
|
+
if (v && (T = v.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, b, l))
|
|
4090
4079
|
return;
|
|
4091
|
-
I = canAcceptChildBlock(T,
|
|
4080
|
+
I = canAcceptChildBlock(T, S);
|
|
4092
4081
|
}
|
|
4093
4082
|
if (!I)
|
|
4094
4083
|
return;
|
|
@@ -4425,9 +4414,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4425
4414
|
}),
|
|
4426
4415
|
size({
|
|
4427
4416
|
boundary: h == null ? void 0 : h.body,
|
|
4428
|
-
apply({ availableWidth:
|
|
4417
|
+
apply({ availableWidth: C, availableHeight: E, elements: B }) {
|
|
4429
4418
|
Object.assign(B.floating.style, {
|
|
4430
|
-
maxWidth: `${Math.max(200,
|
|
4419
|
+
maxWidth: `${Math.max(200, C)}px`,
|
|
4431
4420
|
maxHeight: `${Math.max(100, E)}px`
|
|
4432
4421
|
});
|
|
4433
4422
|
}
|
|
@@ -4436,16 +4425,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4436
4425
|
elements: { reference: o }
|
|
4437
4426
|
});
|
|
4438
4427
|
useResizeObserver(o, () => x(), o !== null), useResizeObserver(h == null ? void 0 : h.body, () => x(), (h == null ? void 0 : h.body) !== null);
|
|
4439
|
-
const y = get(r, "_parent", null),
|
|
4428
|
+
const y = get(r, "_parent", null), S = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
|
|
4440
4429
|
useEffect(() => {
|
|
4441
|
-
let
|
|
4442
|
-
return o ? (
|
|
4443
|
-
|
|
4430
|
+
let C = null;
|
|
4431
|
+
return o ? (C = setTimeout(() => x(), 500), () => {
|
|
4432
|
+
C && clearTimeout(C);
|
|
4444
4433
|
}) : (x(), () => {
|
|
4445
|
-
|
|
4434
|
+
C && clearTimeout(C);
|
|
4446
4435
|
});
|
|
4447
4436
|
}, [o, r == null ? void 0 : r._id]);
|
|
4448
|
-
const [,
|
|
4437
|
+
const [, k] = useSidebarActivePanel();
|
|
4449
4438
|
return !n && (!o || !r || p) ? null : /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(
|
|
4450
4439
|
"div",
|
|
4451
4440
|
{
|
|
@@ -4453,13 +4442,13 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4453
4442
|
tabIndex: 0,
|
|
4454
4443
|
ref: b.setFloating,
|
|
4455
4444
|
style: g,
|
|
4456
|
-
onClick: (
|
|
4457
|
-
|
|
4445
|
+
onClick: (C) => {
|
|
4446
|
+
C.stopPropagation(), C.preventDefault();
|
|
4458
4447
|
},
|
|
4459
|
-
onMouseEnter: (
|
|
4460
|
-
|
|
4448
|
+
onMouseEnter: (C) => {
|
|
4449
|
+
C.stopPropagation(), c(null);
|
|
4461
4450
|
},
|
|
4462
|
-
onKeyDown: (
|
|
4451
|
+
onKeyDown: (C) => C.stopPropagation(),
|
|
4463
4452
|
className: `isolate z-[999] flex h-6 items-center justify-between bg-blue-500 py-2 text-xs text-white ${n ? "opacity-0" : ""}`,
|
|
4464
4453
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4465
4454
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -4474,14 +4463,14 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4474
4463
|
}
|
|
4475
4464
|
)
|
|
4476
4465
|
] }),
|
|
4477
|
-
/* @__PURE__ */ jsx("div", { className: `w-full ${f ? "cursor-grab active:cursor-grabbing" : ""}`, children: /* @__PURE__ */ jsx("div", { className: "mr-10 w-full items-center space-x-1 px-1 leading-tight", children:
|
|
4466
|
+
/* @__PURE__ */ jsx("div", { className: `w-full ${f ? "cursor-grab active:cursor-grabbing" : ""}`, children: /* @__PURE__ */ jsx("div", { className: "mr-10 w-full items-center space-x-1 px-1 leading-tight", children: S }) }),
|
|
4478
4467
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pl-1 pr-1.5", children: [
|
|
4479
4468
|
u(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
|
|
4480
4469
|
AiIcon,
|
|
4481
4470
|
{
|
|
4482
4471
|
className: "h-4 w-4 rounded hover:bg-white hover:text-blue-500",
|
|
4483
4472
|
onClick: () => {
|
|
4484
|
-
|
|
4473
|
+
k("chai-chat-panel"), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_AI_PANEL);
|
|
4485
4474
|
}
|
|
4486
4475
|
}
|
|
4487
4476
|
),
|
|
@@ -4886,7 +4875,7 @@ const ChaiFrame = React__default.forwardRef((r, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
4886
4875
|
}, useDirectBlockDrag = () => {
|
|
4887
4876
|
const [, r] = useSelectedBlockIds(), { onDragStart: n, onDragEnd: o } = useDragAndDrop(), [a] = useBlocksStore(), i = useRef(null), [l, c] = useAtom$1(lastClickTimeAtom), [d, u] = useAtom$1(clickCountAtom), p = useCallback(
|
|
4888
4877
|
(m) => {
|
|
4889
|
-
var
|
|
4878
|
+
var S;
|
|
4890
4879
|
if (m.button !== 0) return;
|
|
4891
4880
|
const g = Date.now(), b = g - l;
|
|
4892
4881
|
if (b < 400 && b > 0) {
|
|
@@ -4894,7 +4883,7 @@ const ChaiFrame = React__default.forwardRef((r, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
4894
4883
|
return;
|
|
4895
4884
|
}
|
|
4896
4885
|
c(g);
|
|
4897
|
-
const y = (
|
|
4886
|
+
const y = (S = m.target.closest("[data-block-id]")) == null ? void 0 : S.getAttribute("data-block-id");
|
|
4898
4887
|
y && (r([y]), i.current = y);
|
|
4899
4888
|
},
|
|
4900
4889
|
[r, l, c, d, u]
|
|
@@ -4945,12 +4934,12 @@ const RteDropdownMenu = ({
|
|
|
4945
4934
|
}) => {
|
|
4946
4935
|
const { document: l } = useFrame(), [c, d] = useState({ left: void 0, right: void 0, top: void 0, bottom: void 0 }), [u, p] = useState(!1), h = useRef(null);
|
|
4947
4936
|
if (useEffect(() => {
|
|
4948
|
-
var
|
|
4937
|
+
var S, k;
|
|
4949
4938
|
if (!u) {
|
|
4950
4939
|
d({ left: void 0, right: void 0, top: void 0, bottom: void 0 });
|
|
4951
4940
|
return;
|
|
4952
4941
|
}
|
|
4953
|
-
const f = (
|
|
4942
|
+
const f = (S = h.current) == null ? void 0 : S.getBoundingClientRect(), m = (k = i.current) == null ? void 0 : k.getBoundingClientRect();
|
|
4954
4943
|
let g = f == null ? void 0 : f.left, b = (f == null ? void 0 : f.bottom) + 4, x, y;
|
|
4955
4944
|
(m == null ? void 0 : m.left) + (m == null ? void 0 : m.width) + 50 >= l.body.offsetWidth && (g = void 0, x = l.body.offsetWidth - (f == null ? void 0 : f.right)), b + 202 >= l.body.clientHeight && (b = null, y = l.body.clientHeight - (f == null ? void 0 : f.bottom) + (m == null ? void 0 : m.height)), d({ left: g, top: b, right: x, bottom: y });
|
|
4956
4945
|
}, [u]), a === "canvas") {
|
|
@@ -5101,8 +5090,8 @@ const getActiveClasses$1 = (r, n, o) => {
|
|
|
5101
5090
|
)
|
|
5102
5091
|
] });
|
|
5103
5092
|
}, RteColorPicker = ({ editor: r, from: n, menuRef: o }) => {
|
|
5104
|
-
var
|
|
5105
|
-
const a = (
|
|
5093
|
+
var k, C;
|
|
5094
|
+
const a = (k = r == null ? void 0 : r.getAttributes("textStyle")) == null ? void 0 : k.color, i = (C = r == null ? void 0 : r.getAttributes("highlight")) == null ? void 0 : C.color, [l, c] = useState(a || "#000000F2"), [d, u] = useState(i || "#00000057"), [p, h] = useDebouncedState(l, 150), [f, m] = useDebouncedState(d, 150), g = (E, B) => {
|
|
5106
5095
|
B ? (c(E), h(E)) : (r == null || r.chain().setColor(E).run(), c(E));
|
|
5107
5096
|
}, b = (E, B) => {
|
|
5108
5097
|
B ? (u(E), m(E)) : (r == null || r.chain().setHighlight({ color: E }).run(), u(E));
|
|
@@ -8725,8 +8714,8 @@ class Fitter {
|
|
|
8725
8714
|
let b = p == d.childCount;
|
|
8726
8715
|
b || (g = -1), this.placed = addToFragment(this.placed, o, Fragment.from(h)), this.frontier[o].match = f, b && g < 0 && a && a.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
8727
8716
|
for (let x = 0, y = d; x < g; x++) {
|
|
8728
|
-
let
|
|
8729
|
-
this.frontier.push({ type:
|
|
8717
|
+
let S = y.lastChild;
|
|
8718
|
+
this.frontier.push({ type: S.type, match: S.contentMatchAt(S.childCount) }), y = S.content;
|
|
8730
8719
|
}
|
|
8731
8720
|
this.unplaced = b ? n == 0 ? Slice.empty : new Slice(dropFromFragment(c.content, n - 1, 1), n - 1, g < 0 ? c.openEnd : n - 1) : new Slice(dropFromFragment(c.content, n, p), c.openStart, c.openEnd);
|
|
8732
8721
|
}
|
|
@@ -9605,8 +9594,8 @@ function deleteBarrier(r, n, o, a) {
|
|
|
9605
9594
|
if (p && (c = (d = i.contentMatchAt(i.childCount)).findWrapping(l.type)) && d.matchType(c[0] || l.type).validEnd) {
|
|
9606
9595
|
if (o) {
|
|
9607
9596
|
let g = n.pos + l.nodeSize, b = Fragment.empty;
|
|
9608
|
-
for (let
|
|
9609
|
-
b = Fragment.from(c[
|
|
9597
|
+
for (let S = c.length - 1; S >= 0; S--)
|
|
9598
|
+
b = Fragment.from(c[S].create(null, b));
|
|
9610
9599
|
b = Fragment.from(i.copy(b));
|
|
9611
9600
|
let x = r.tr.step(new ReplaceAroundStep(n.pos - 1, g, n.pos, g, new Slice(b, 1, 0), c.length, !0)), y = x.doc.resolve(g + 2 * c.length);
|
|
9612
9601
|
y.nodeAfter && y.nodeAfter.type == i.type && canJoin(x.doc, y.pos) && x.join(y.pos), o(x.scrollIntoView());
|
|
@@ -9625,11 +9614,11 @@ function deleteBarrier(r, n, o, a) {
|
|
|
9625
9614
|
y++;
|
|
9626
9615
|
if (g.canReplace(g.childCount, g.childCount, x.content)) {
|
|
9627
9616
|
if (o) {
|
|
9628
|
-
let
|
|
9629
|
-
for (let
|
|
9630
|
-
|
|
9631
|
-
let
|
|
9632
|
-
o(
|
|
9617
|
+
let S = Fragment.empty;
|
|
9618
|
+
for (let C = b.length - 1; C >= 0; C--)
|
|
9619
|
+
S = Fragment.from(b[C].copy(S));
|
|
9620
|
+
let k = r.tr.step(new ReplaceAroundStep(n.pos - b.length, n.pos + l.nodeSize, n.pos + y, n.pos + l.nodeSize - y, new Slice(S, b.length, 0), 0, !0));
|
|
9621
|
+
o(k.scrollIntoView());
|
|
9633
9622
|
}
|
|
9634
9623
|
return !0;
|
|
9635
9624
|
}
|
|
@@ -9816,8 +9805,8 @@ class CommandManager {
|
|
|
9816
9805
|
createChain(n, o = !0) {
|
|
9817
9806
|
const { rawCommands: a, editor: i, state: l } = this, { view: c } = i, d = [], u = !!n, p = n || l.tr, h = () => (!u && o && !p.getMeta("preventDispatch") && !this.hasCustomState && c.dispatch(p), d.every((m) => m === !0)), f = {
|
|
9818
9807
|
...Object.fromEntries(Object.entries(a).map(([m, g]) => [m, (...x) => {
|
|
9819
|
-
const y = this.buildProps(p, o),
|
|
9820
|
-
return d.push(
|
|
9808
|
+
const y = this.buildProps(p, o), S = g(...x)(y);
|
|
9809
|
+
return d.push(S), f;
|
|
9821
9810
|
}])),
|
|
9822
9811
|
run: h
|
|
9823
9812
|
};
|
|
@@ -10258,8 +10247,8 @@ const isFragment = (r) => !("type" in r), insertContentAt = (r, n, o) => ({ tr:
|
|
|
10258
10247
|
x = n.map((y) => y.text || "").join("");
|
|
10259
10248
|
else if (n instanceof Fragment) {
|
|
10260
10249
|
let y = "";
|
|
10261
|
-
n.forEach((
|
|
10262
|
-
|
|
10250
|
+
n.forEach((S) => {
|
|
10251
|
+
S.text && (y += S.text);
|
|
10263
10252
|
}), x = y;
|
|
10264
10253
|
} else typeof n == "object" && n && n.text ? x = n.text : x = n;
|
|
10265
10254
|
a.insertText(x, h, f);
|
|
@@ -10440,11 +10429,11 @@ function isMarkActive(r, n, o = {}) {
|
|
|
10440
10429
|
r.doc.nodesBetween(g, b, (x, y) => {
|
|
10441
10430
|
if (!x.isText && !x.marks.length)
|
|
10442
10431
|
return;
|
|
10443
|
-
const
|
|
10444
|
-
c +=
|
|
10432
|
+
const S = Math.max(g, y), k = Math.min(b, y + x.nodeSize), C = k - S;
|
|
10433
|
+
c += C, d.push(...x.marks.map((E) => ({
|
|
10445
10434
|
mark: E,
|
|
10446
|
-
from:
|
|
10447
|
-
to:
|
|
10435
|
+
from: S,
|
|
10436
|
+
to: k
|
|
10448
10437
|
})));
|
|
10449
10438
|
});
|
|
10450
10439
|
}), c === 0)
|
|
@@ -10521,9 +10510,9 @@ const setMark = (r, n = {}) => ({ tr: o, state: a, dispatch: i }) => {
|
|
|
10521
10510
|
const h = p.$from.pos, f = p.$to.pos;
|
|
10522
10511
|
a.doc.nodesBetween(h, f, (m, g) => {
|
|
10523
10512
|
const b = Math.max(g, h), x = Math.min(g + m.nodeSize, f);
|
|
10524
|
-
m.marks.find((
|
|
10525
|
-
u ===
|
|
10526
|
-
...
|
|
10513
|
+
m.marks.find((S) => S.type === u) ? m.marks.forEach((S) => {
|
|
10514
|
+
u === S.type && o.addMark(b, x, u.create({
|
|
10515
|
+
...S.attrs,
|
|
10527
10516
|
...n
|
|
10528
10517
|
}));
|
|
10529
10518
|
}) : o.addMark(b, x, u.create(n));
|
|
@@ -10596,22 +10585,22 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
|
|
|
10596
10585
|
if (u.depth === 2 || u.node(-3).type !== d || u.index(-2) !== u.node(-2).childCount - 1)
|
|
10597
10586
|
return !1;
|
|
10598
10587
|
if (i) {
|
|
10599
|
-
let
|
|
10600
|
-
const
|
|
10601
|
-
for (let w = u.depth -
|
|
10602
|
-
|
|
10603
|
-
const
|
|
10588
|
+
let S = Fragment.empty;
|
|
10589
|
+
const k = u.index(-1) ? 1 : u.index(-2) ? 2 : 3;
|
|
10590
|
+
for (let w = u.depth - k; w >= u.depth - 3; w -= 1)
|
|
10591
|
+
S = Fragment.from(u.node(w).copy(S));
|
|
10592
|
+
const C = u.indexAfter(-1) < u.node(-2).childCount ? 1 : u.indexAfter(-2) < u.node(-3).childCount ? 2 : 3, E = {
|
|
10604
10593
|
...getSplittedAttributes(m, u.node().type.name, u.node().attrs),
|
|
10605
10594
|
...n
|
|
10606
10595
|
}, B = ((c = d.contentMatch.defaultType) === null || c === void 0 ? void 0 : c.createAndFill(E)) || void 0;
|
|
10607
|
-
|
|
10608
|
-
const I = u.before(u.depth - (
|
|
10609
|
-
o.replace(I, u.after(-
|
|
10596
|
+
S = S.append(Fragment.from(d.createAndFill(null, B) || void 0));
|
|
10597
|
+
const I = u.before(u.depth - (k - 1));
|
|
10598
|
+
o.replace(I, u.after(-C), new Slice(S, 4 - k, 0));
|
|
10610
10599
|
let A = -1;
|
|
10611
|
-
o.doc.nodesBetween(I, o.doc.content.size, (w,
|
|
10600
|
+
o.doc.nodesBetween(I, o.doc.content.size, (w, v) => {
|
|
10612
10601
|
if (A > -1)
|
|
10613
10602
|
return !1;
|
|
10614
|
-
w.isTextblock && w.content.size === 0 && (A =
|
|
10603
|
+
w.isTextblock && w.content.size === 0 && (A = v + 1);
|
|
10615
10604
|
}), A > -1 && o.setSelection(TextSelection.near(o.doc.resolve(A))), o.scrollIntoView();
|
|
10616
10605
|
}
|
|
10617
10606
|
return !0;
|
|
@@ -10631,10 +10620,10 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
|
|
|
10631
10620
|
if (!canSplit(o.doc, u.pos, 2))
|
|
10632
10621
|
return !1;
|
|
10633
10622
|
if (i) {
|
|
10634
|
-
const { selection:
|
|
10623
|
+
const { selection: S, storedMarks: k } = a, { splittableMarks: C } = l.extensionManager, E = k || S.$to.parentOffset && S.$from.marks();
|
|
10635
10624
|
if (o.split(u.pos, 2, y).scrollIntoView(), !E || !i)
|
|
10636
10625
|
return !0;
|
|
10637
|
-
const B = E.filter((I) =>
|
|
10626
|
+
const B = E.filter((I) => C.includes(I.type.name));
|
|
10638
10627
|
o.ensureMarks(B);
|
|
10639
10628
|
}
|
|
10640
10629
|
return !0;
|
|
@@ -10657,11 +10646,11 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
|
|
|
10657
10646
|
const i = r.doc.nodeAt(a);
|
|
10658
10647
|
return o.node.type === (i == null ? void 0 : i.type) && canJoin(r.doc, a) && r.join(a), !0;
|
|
10659
10648
|
}, toggleList = (r, n, o, a = {}) => ({ editor: i, tr: l, state: c, dispatch: d, chain: u, commands: p, can: h }) => {
|
|
10660
|
-
const { extensions: f, splittableMarks: m } = i.extensionManager, g = getNodeType(r, c.schema), b = getNodeType(n, c.schema), { selection: x, storedMarks: y } = c, { $from:
|
|
10661
|
-
if (!
|
|
10649
|
+
const { extensions: f, splittableMarks: m } = i.extensionManager, g = getNodeType(r, c.schema), b = getNodeType(n, c.schema), { selection: x, storedMarks: y } = c, { $from: S, $to: k } = x, C = S.blockRange(k), E = y || x.$to.parentOffset && x.$from.marks();
|
|
10650
|
+
if (!C)
|
|
10662
10651
|
return !1;
|
|
10663
10652
|
const B = findParentNode((I) => isList(I.type.name, f))(x);
|
|
10664
|
-
if (
|
|
10653
|
+
if (C.depth >= 1 && B && C.depth - B.depth <= 1) {
|
|
10665
10654
|
if (B.node.type === g)
|
|
10666
10655
|
return p.liftListItem(b);
|
|
10667
10656
|
if (isList(B.node.type.name, f) && g.validContent(B.node.content) && d)
|
|
@@ -10732,11 +10721,11 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
|
|
|
10732
10721
|
y < p && l && l === x.type && (g = Math.max(y, p), b = Math.min(y + x.nodeSize, h), f = y, m = x), y >= p && y <= h && (l && l === x.type && o.setNodeMarkup(y, void 0, {
|
|
10733
10722
|
...x.attrs,
|
|
10734
10723
|
...n
|
|
10735
|
-
}), c && x.marks.length && x.marks.forEach((
|
|
10736
|
-
if (c ===
|
|
10737
|
-
const
|
|
10738
|
-
o.addMark(
|
|
10739
|
-
...
|
|
10724
|
+
}), c && x.marks.length && x.marks.forEach((S) => {
|
|
10725
|
+
if (c === S.type) {
|
|
10726
|
+
const k = Math.max(y, p), C = Math.min(y + x.nodeSize, h);
|
|
10727
|
+
o.addMark(k, C, c.create({
|
|
10728
|
+
...S.attrs,
|
|
10740
10729
|
...n
|
|
10741
10730
|
}));
|
|
10742
10731
|
}
|
|
@@ -10893,8 +10882,8 @@ Extension.create({
|
|
|
10893
10882
|
() => c.undoInputRule(),
|
|
10894
10883
|
// maybe convert first text block node to default node
|
|
10895
10884
|
() => c.command(({ tr: d }) => {
|
|
10896
|
-
const { selection: u, doc: p } = d, { empty: h, $anchor: f } = u, { pos: m, parent: g } = f, b = f.parent.isTextblock && m > 0 ? d.doc.resolve(m - 1) : f, x = b.parent.type.spec.isolating, y = f.pos - f.parentOffset,
|
|
10897
|
-
return !h || !g.type.isTextblock || g.textContent.length || !
|
|
10885
|
+
const { selection: u, doc: p } = d, { empty: h, $anchor: f } = u, { pos: m, parent: g } = f, b = f.parent.isTextblock && m > 0 ? d.doc.resolve(m - 1) : f, x = b.parent.type.spec.isolating, y = f.pos - f.parentOffset, S = x && b.parent.childCount === 1 ? y === f.pos : Selection.atStart(p).from === m;
|
|
10886
|
+
return !h || !g.type.isTextblock || g.textContent.length || !S || S && f.parent.type.name === "paragraph" ? !1 : c.clearNodes();
|
|
10898
10887
|
}),
|
|
10899
10888
|
() => c.deleteSelection(),
|
|
10900
10889
|
() => c.joinBackward(),
|
|
@@ -11105,10 +11094,10 @@ const RichTextEditor = memo(
|
|
|
11105
11094
|
placeholder: "Enter text here",
|
|
11106
11095
|
onUpdate: ({ editor: p }) => a((p == null ? void 0 : p.getHTML()) || ""),
|
|
11107
11096
|
onBlur: ({ editor: p, event: h }) => {
|
|
11108
|
-
const f = h == null ? void 0 : h.relatedTarget, m = l.querySelector(".ProseMirror"), g = l.querySelector(".tippy-box"), b = l.querySelector("#chai-rich-text-menu-bar"), x = m == null ? void 0 : m.contains(f), y = g == null ? void 0 : g.contains(f),
|
|
11109
|
-
if (!x && !y && !
|
|
11110
|
-
const
|
|
11111
|
-
o(
|
|
11097
|
+
const f = h == null ? void 0 : h.relatedTarget, m = l.querySelector(".ProseMirror"), g = l.querySelector(".tippy-box"), b = l.querySelector("#chai-rich-text-menu-bar"), x = m == null ? void 0 : m.contains(f), y = g == null ? void 0 : g.contains(f), S = b == null ? void 0 : b.contains(f), k = window.document.getElementById("rte-widget-color-picker");
|
|
11098
|
+
if (!x && !y && !S && !k) {
|
|
11099
|
+
const C = (p == null ? void 0 : p.getHTML()) || "";
|
|
11100
|
+
o(C);
|
|
11112
11101
|
}
|
|
11113
11102
|
},
|
|
11114
11103
|
from: "canvas"
|
|
@@ -11208,16 +11197,16 @@ const RichTextEditor = memo(
|
|
|
11208
11197
|
}
|
|
11209
11198
|
), WithBlockTextEditor = memo(
|
|
11210
11199
|
({ block: r, children: n }) => {
|
|
11211
|
-
const o = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [u, p] = useState(null), h = useRef(null), { clearHighlight: f } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: g } = useLanguages(), [, b] = useSelectedBlockIds(), x = useRef(null), y = i, { blockContent:
|
|
11200
|
+
const o = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [u, p] = useState(null), h = useRef(null), { clearHighlight: f } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: g } = useLanguages(), [, b] = useSelectedBlockIds(), x = useRef(null), y = i, { blockContent: S, blockType: k } = useMemo(() => {
|
|
11212
11201
|
var N;
|
|
11213
11202
|
const A = r._type;
|
|
11214
11203
|
let w = r[o];
|
|
11215
|
-
const
|
|
11216
|
-
return g && ((N =
|
|
11217
|
-
}, [r, g]),
|
|
11204
|
+
const v = getRegisteredChaiBlock(r._type);
|
|
11205
|
+
return g && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(o)) && has(r, `${o}-${g}`) && (w = get(r, `${o}-${g}`)), { blockContent: w, blockType: A };
|
|
11206
|
+
}, [r, g]), C = useCallback(
|
|
11218
11207
|
(A) => {
|
|
11219
|
-
var
|
|
11220
|
-
const w = A || ((
|
|
11208
|
+
var v;
|
|
11209
|
+
const w = A || ((v = h.current) == null ? void 0 : v.innerText);
|
|
11221
11210
|
m([y], { [o]: w }), p(null), c(null), d(-1), b([]), y && setTimeout(() => b([y]), 100);
|
|
11222
11211
|
},
|
|
11223
11212
|
[y, m, c, b, g]
|
|
@@ -11229,7 +11218,7 @@ const RichTextEditor = memo(
|
|
|
11229
11218
|
1e3
|
|
11230
11219
|
), B = useCallback(
|
|
11231
11220
|
(A) => {
|
|
11232
|
-
A.preventDefault(), y && (x.current = y),
|
|
11221
|
+
A.preventDefault(), y && (x.current = y), C(), setTimeout(() => {
|
|
11233
11222
|
const w = x.current;
|
|
11234
11223
|
x.current = null, b([w]);
|
|
11235
11224
|
}, 100);
|
|
@@ -11239,29 +11228,29 @@ const RichTextEditor = memo(
|
|
|
11239
11228
|
useEffect(() => {
|
|
11240
11229
|
var T;
|
|
11241
11230
|
if (!y) return;
|
|
11242
|
-
const A = `[data-block-id="${y}"]`, w = l >= 0 ? `[data-block-index="${l}"]` : "",
|
|
11243
|
-
|
|
11244
|
-
}, [y,
|
|
11245
|
-
const I = useMemo(() => u ? (f(), ["RichText", "Paragraph"].includes(
|
|
11231
|
+
const A = `[data-block-id="${y}"]`, w = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${A}${w}`);
|
|
11232
|
+
v && ((T = v == null ? void 0 : v.classList) == null || T.add("sr-only"), p(v));
|
|
11233
|
+
}, [y, k, a, l]);
|
|
11234
|
+
const I = useMemo(() => u ? (f(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
|
|
11246
11235
|
RichTextEditor,
|
|
11247
11236
|
{
|
|
11248
|
-
blockContent:
|
|
11237
|
+
blockContent: S,
|
|
11249
11238
|
editingElement: u,
|
|
11250
11239
|
onChange: E,
|
|
11251
|
-
onClose:
|
|
11240
|
+
onClose: C,
|
|
11252
11241
|
onEscape: B
|
|
11253
11242
|
}
|
|
11254
11243
|
) : /* @__PURE__ */ jsx(
|
|
11255
11244
|
MemoizedEditor,
|
|
11256
11245
|
{
|
|
11257
11246
|
editorRef: h,
|
|
11258
|
-
blockContent:
|
|
11247
|
+
blockContent: S,
|
|
11259
11248
|
editingElement: u,
|
|
11260
|
-
onClose:
|
|
11249
|
+
onClose: C,
|
|
11261
11250
|
onChange: E,
|
|
11262
11251
|
onEscape: B
|
|
11263
11252
|
}
|
|
11264
|
-
)) : null, [u, y,
|
|
11253
|
+
)) : null, [u, y, k, S, C, g]);
|
|
11265
11254
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11266
11255
|
I,
|
|
11267
11256
|
n
|
|
@@ -11296,7 +11285,7 @@ const RichTextEditor = memo(
|
|
|
11296
11285
|
blockAtom: n,
|
|
11297
11286
|
children: o
|
|
11298
11287
|
}) => {
|
|
11299
|
-
const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: u } = useLanguages(), p = useBlockRuntimeProps(), h = usePageExternalData(), [f] = useAtom$1(dataBindingActiveAtom), m = get(c, "component", null), { index: g, key: b } = useContext(RepeaterContext), { mode: x } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom),
|
|
11288
|
+
const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: u } = useLanguages(), p = useBlockRuntimeProps(), h = usePageExternalData(), [f] = useAtom$1(dataBindingActiveAtom), m = get(c, "component", null), { index: g, key: b } = useContext(RepeaterContext), { mode: x } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom), S = useIsDragAndDropEnabled(), k = x === "edit", C = useDirectBlockDrag(), E = useMemo(
|
|
11300
11289
|
() => f ? applyBindingToBlockProps(applyLanguage(l, d, c), h, {
|
|
11301
11290
|
index: g,
|
|
11302
11291
|
key: b
|
|
@@ -11314,14 +11303,14 @@ const RichTextEditor = memo(
|
|
|
11314
11303
|
"data-block-type": l._type,
|
|
11315
11304
|
"data-block-index": g
|
|
11316
11305
|
};
|
|
11317
|
-
return
|
|
11306
|
+
return k && S ? {
|
|
11318
11307
|
...P,
|
|
11319
11308
|
draggable: !a,
|
|
11320
|
-
onMouseDown:
|
|
11321
|
-
onDragStart:
|
|
11322
|
-
onDragEnd:
|
|
11309
|
+
onMouseDown: C.onMouseDown,
|
|
11310
|
+
onDragStart: C.onDragStart,
|
|
11311
|
+
onDragEnd: C.onDragEnd
|
|
11323
11312
|
} : P;
|
|
11324
|
-
}, [l._id, l._type, g,
|
|
11313
|
+
}, [l._id, l._type, g, k, S, C, a]), w = useMemo(
|
|
11325
11314
|
() => ({
|
|
11326
11315
|
blockProps: A,
|
|
11327
11316
|
inBuilder: x === "edit",
|
|
@@ -11333,7 +11322,7 @@ const RichTextEditor = memo(
|
|
|
11333
11322
|
...r
|
|
11334
11323
|
}),
|
|
11335
11324
|
[x, A, d, u, E, B, I, r]
|
|
11336
|
-
),
|
|
11325
|
+
), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), T = useMemo(() => get(l, "_show", !0), [l]);
|
|
11337
11326
|
if (isNull(m) || !T) return null;
|
|
11338
11327
|
let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(m, {
|
|
11339
11328
|
...w,
|
|
@@ -11349,7 +11338,7 @@ const RichTextEditor = memo(
|
|
|
11349
11338
|
})
|
|
11350
11339
|
}) });
|
|
11351
11340
|
const j = a === l._id && (i === g || g < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: l, children: N }) : N;
|
|
11352
|
-
return
|
|
11341
|
+
return v ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: j }) : j;
|
|
11353
11342
|
}, PartialWrapper$1 = ({ children: r, partialBlockId: n }) => {
|
|
11354
11343
|
const o = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: i, fallbackLang: l } = useLanguages(), c = useCallback(
|
|
11355
11344
|
(d) => {
|
|
@@ -11453,14 +11442,14 @@ const RichTextEditor = memo(
|
|
|
11453
11442
|
}, StaticCanvas = () => {
|
|
11454
11443
|
const [r] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), o = useRef(null), a = useRef(null), [i, l] = useState({ width: 0, height: 0 }), c = useCanvasScale(i), [, d] = useCanvasIframe(), u = useBuilderProp("loading", !1), p = useBuilderProp("htmlDir", "ltr"), { onDragOver: h, onDrop: f, onDragEnd: m } = useDragAndDrop(), g = useDropIndicator(), b = useCallback(
|
|
11455
11444
|
(y) => {
|
|
11456
|
-
l((
|
|
11445
|
+
l((S) => ({ ...S, width: y }));
|
|
11457
11446
|
},
|
|
11458
11447
|
[l]
|
|
11459
11448
|
);
|
|
11460
11449
|
useEffect(() => {
|
|
11461
11450
|
if (!a.current) return;
|
|
11462
|
-
const { clientWidth: y, clientHeight:
|
|
11463
|
-
l({ width: y, height:
|
|
11451
|
+
const { clientWidth: y, clientHeight: S } = a.current;
|
|
11452
|
+
l({ width: y, height: S });
|
|
11464
11453
|
}, [a, r]);
|
|
11465
11454
|
const x = useMemo(() => {
|
|
11466
11455
|
let y = IframeInitialContent;
|
|
@@ -11519,7 +11508,7 @@ const RichTextEditor = memo(
|
|
|
11519
11508
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: r("Oops! Something went wrong.") }),
|
|
11520
11509
|
/* @__PURE__ */ jsx("p", { children: r("Please try again.") })
|
|
11521
11510
|
] }) });
|
|
11522
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
11511
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DPr4HDOV.js")), CanvasArea = () => {
|
|
11523
11512
|
const [r] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
11524
11513
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
|
|
11525
11514
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -11656,52 +11645,52 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
11656
11645
|
if (!r || startsWith(r, "data")) return "";
|
|
11657
11646
|
const n = ((i = r.split("/").pop()) == null ? void 0 : i.split("?")[0]) || "";
|
|
11658
11647
|
return [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".ico", ".avif"].some((l) => n.toLowerCase().endsWith(l)) ? n : "";
|
|
11659
|
-
}, ImagePickerField = ({ value: r, onChange: n, id: o, onBlur: a
|
|
11660
|
-
const { t:
|
|
11661
|
-
if (!r || !
|
|
11662
|
-
const
|
|
11663
|
-
return get(
|
|
11664
|
-
}, [r,
|
|
11665
|
-
const
|
|
11666
|
-
if (
|
|
11667
|
-
n(
|
|
11668
|
-
const
|
|
11669
|
-
if (
|
|
11670
|
-
const
|
|
11671
|
-
...
|
|
11672
|
-
...
|
|
11673
|
-
...
|
|
11648
|
+
}, ImagePickerField = ({ value: r, onChange: n, id: o, onBlur: a }) => {
|
|
11649
|
+
const { t: i } = useTranslation(), { selectedLang: l } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), u = usePageExternalData(), p = o.split(".").pop() || "", h = l ? `_${p}Id-${l}` : `_${p}Id`, f = isEmpty(l) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), m = get(c, h, f ? c == null ? void 0 : c.assetId : ""), g = useMemo(() => {
|
|
11650
|
+
if (!r || !c || !/\{\{.*?\}\}/.test(r)) return r;
|
|
11651
|
+
const C = { ...c, [p]: r }, E = applyBindingToBlockProps(C, u, { index: -1, key: "" });
|
|
11652
|
+
return get(E, p, r);
|
|
11653
|
+
}, [r, c, u, p]), b = !!m || g !== PLACEHOLDER_IMAGE, x = (k) => {
|
|
11654
|
+
const C = isArray(k) ? first$1(k) : k;
|
|
11655
|
+
if (C) {
|
|
11656
|
+
n(C == null ? void 0 : C.url);
|
|
11657
|
+
const E = C == null ? void 0 : C.width, B = C == null ? void 0 : C.height, I = h.includes("mobile");
|
|
11658
|
+
if (c != null && c._id) {
|
|
11659
|
+
const A = {
|
|
11660
|
+
...E && { [I ? "mobileWidth" : "width"]: E },
|
|
11661
|
+
...B && { [I ? "mobileHeight" : "height"]: B },
|
|
11662
|
+
...C.description && { alt: C.description }
|
|
11674
11663
|
};
|
|
11675
|
-
if (set(
|
|
11676
|
-
|
|
11664
|
+
if (set(A, h, C.id), isEmpty(A)) return;
|
|
11665
|
+
d([c._id], A);
|
|
11677
11666
|
}
|
|
11678
11667
|
}
|
|
11679
|
-
},
|
|
11680
|
-
if (n(
|
|
11681
|
-
const
|
|
11682
|
-
set(
|
|
11668
|
+
}, y = useCallback(() => {
|
|
11669
|
+
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
11670
|
+
const k = {}, C = h.includes("mobile");
|
|
11671
|
+
set(k, h, ""), set(k, C ? "mobileWidth" : "width", ""), set(k, C ? "mobileHeight" : "height", ""), d([c._id], k);
|
|
11683
11672
|
}
|
|
11684
|
-
}, [n,
|
|
11673
|
+
}, [n, c == null ? void 0 : c._id, d, h]), S = getFileName(g);
|
|
11685
11674
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
|
|
11686
|
-
|
|
11675
|
+
g ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
11687
11676
|
/* @__PURE__ */ jsx(
|
|
11688
11677
|
"img",
|
|
11689
11678
|
{
|
|
11690
|
-
src:
|
|
11691
|
-
className: "h-14 w-14 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (
|
|
11679
|
+
src: g,
|
|
11680
|
+
className: "h-14 w-14 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (m && m !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
|
|
11692
11681
|
alt: ""
|
|
11693
11682
|
}
|
|
11694
11683
|
),
|
|
11695
|
-
|
|
11684
|
+
b && /* @__PURE__ */ jsx(
|
|
11696
11685
|
"button",
|
|
11697
11686
|
{
|
|
11698
11687
|
type: "button",
|
|
11699
|
-
onClick:
|
|
11688
|
+
onClick: y,
|
|
11700
11689
|
className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
11701
11690
|
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" })
|
|
11702
11691
|
}
|
|
11703
11692
|
),
|
|
11704
|
-
|
|
11693
|
+
m && m !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, assetId: m, children: /* @__PURE__ */ jsx(
|
|
11705
11694
|
"button",
|
|
11706
11695
|
{
|
|
11707
11696
|
type: "button",
|
|
@@ -11709,11 +11698,11 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
11709
11698
|
children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-4 w-4 text-white" })
|
|
11710
11699
|
}
|
|
11711
11700
|
) })
|
|
11712
|
-
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
11701
|
+
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, mode: "image", assetId: m, children: /* @__PURE__ */ jsx("div", { className: "h-14 w-14 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
11713
11702
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
11714
11703
|
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11715
|
-
/* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children:
|
|
11716
|
-
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
11704
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children: S }),
|
|
11705
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 mb-1 w-full cursor-pointer rounded-md bg-secondary px-1 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: !isEmpty(g) && g !== PLACEHOLDER_IMAGE ? i("Replace image") : i("Choose image") }) }),
|
|
11717
11706
|
/* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-400", children: "OR" })
|
|
11718
11707
|
] }),
|
|
11719
11708
|
/* @__PURE__ */ jsx(
|
|
@@ -11725,10 +11714,10 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
11725
11714
|
spellCheck: "false",
|
|
11726
11715
|
type: "url",
|
|
11727
11716
|
className: "h-6 text-xs",
|
|
11728
|
-
placeholder:
|
|
11717
|
+
placeholder: i("Enter image URL"),
|
|
11729
11718
|
value: r === PLACEHOLDER_IMAGE ? "" : r,
|
|
11730
|
-
onBlur: ({ target: { value:
|
|
11731
|
-
onChange: (
|
|
11719
|
+
onBlur: ({ target: { value: k } }) => a(o, k),
|
|
11720
|
+
onChange: (k) => n(k.target.value)
|
|
11732
11721
|
}
|
|
11733
11722
|
)
|
|
11734
11723
|
] })
|
|
@@ -11844,11 +11833,11 @@ const DataBindingSelector = ({
|
|
|
11844
11833
|
n(`{{${f}}}`, {}, o);
|
|
11845
11834
|
return;
|
|
11846
11835
|
}
|
|
11847
|
-
const g = (
|
|
11836
|
+
const g = (S) => /[.,!?;:]/.test(S), b = (S, k, C) => {
|
|
11848
11837
|
let E = "", B = "";
|
|
11849
|
-
const I =
|
|
11850
|
-
return
|
|
11851
|
-
text: E +
|
|
11838
|
+
const I = k > 0 ? S[k - 1] : "", A = k < S.length ? S[k] : "";
|
|
11839
|
+
return k > 0 && (I === "." || !g(I) && I !== " ") && (E = " "), k < S.length && !g(A) && A !== " " && (B = " "), {
|
|
11840
|
+
text: E + C + B,
|
|
11852
11841
|
prefixLength: E.length,
|
|
11853
11842
|
suffixLength: B.length
|
|
11854
11843
|
};
|
|
@@ -11856,31 +11845,31 @@ const DataBindingSelector = ({
|
|
|
11856
11845
|
if (!x) return;
|
|
11857
11846
|
const y = document.getElementById(`chai-rte-${o}`) || document.getElementById(`chai-rte-modal-${o}`);
|
|
11858
11847
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
11859
|
-
const
|
|
11860
|
-
if (
|
|
11861
|
-
const
|
|
11862
|
-
|
|
11863
|
-
const { from:
|
|
11864
|
-
if (
|
|
11865
|
-
|
|
11848
|
+
const S = y.__chaiRTE;
|
|
11849
|
+
if (S) {
|
|
11850
|
+
const k = `{{${f}}}`;
|
|
11851
|
+
S.commands.focus();
|
|
11852
|
+
const { from: C, to: E } = S.state.selection;
|
|
11853
|
+
if (C !== E)
|
|
11854
|
+
S.chain().deleteSelection().insertContent(k).run();
|
|
11866
11855
|
else {
|
|
11867
|
-
const { state: I } =
|
|
11856
|
+
const { state: I } = S, A = I.selection.from, w = I.doc.textBetween(Math.max(0, A - 1), A), v = I.doc.textBetween(A, Math.min(A + 1, I.doc.content.size));
|
|
11868
11857
|
let T = "";
|
|
11869
11858
|
A > 0 && w !== " " && !g(w) && (T = " ");
|
|
11870
11859
|
let N = "";
|
|
11871
|
-
|
|
11860
|
+
v && v !== " " && !g(v) && (N = " "), S.chain().insertContent(T + k + N).run();
|
|
11872
11861
|
}
|
|
11873
|
-
setTimeout(() => n(
|
|
11862
|
+
setTimeout(() => n(S.getHTML(), {}, o), 100);
|
|
11874
11863
|
return;
|
|
11875
11864
|
}
|
|
11876
11865
|
} else {
|
|
11877
|
-
const
|
|
11878
|
-
if (E >
|
|
11879
|
-
const
|
|
11866
|
+
const S = x, k = S.selectionStart || 0, C = S.value || "", E = S.selectionEnd || k;
|
|
11867
|
+
if (E > k) {
|
|
11868
|
+
const v = `{{${f}}}`, { text: T } = b(C, k, v), N = C.slice(0, k) + T + C.slice(E);
|
|
11880
11869
|
n(N, {}, o);
|
|
11881
11870
|
return;
|
|
11882
11871
|
}
|
|
11883
|
-
const I = `{{${f}}}`, { text: A } = b(
|
|
11872
|
+
const I = `{{${f}}}`, { text: A } = b(C, k, I), w = C.slice(0, k) + A + C.slice(k);
|
|
11884
11873
|
n(w, {}, o);
|
|
11885
11874
|
}
|
|
11886
11875
|
},
|
|
@@ -11903,69 +11892,69 @@ const DataBindingSelector = ({
|
|
|
11903
11892
|
onChange: o
|
|
11904
11893
|
}) => {
|
|
11905
11894
|
var w;
|
|
11906
|
-
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (
|
|
11895
|
+
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, T) => []), [l, c] = useState(!1), [d, u] = useState(!1), [p, h] = useState("page"), [f, m] = useState(""), [g, b] = useState([]), [x, y] = useState(-1), S = useRef(null), k = (w = n == null ? void 0 : n.find((v) => v.key === p)) == null ? void 0 : w.name;
|
|
11907
11896
|
useEffect(() => {
|
|
11908
11897
|
if (m(""), b([]), y(-1), u(!1), !r || l || !startsWith(r, "pageType:")) return;
|
|
11909
|
-
const
|
|
11898
|
+
const v = split(r, ":"), T = get(v, 1, "page") || "page";
|
|
11910
11899
|
h(T), (async () => {
|
|
11911
|
-
const N = await i(T, [get(
|
|
11900
|
+
const N = await i(T, [get(v, 2, "page")]);
|
|
11912
11901
|
N && Array.isArray(N) && m(get(N, [0, "name"], ""));
|
|
11913
11902
|
})();
|
|
11914
11903
|
}, [r]);
|
|
11915
|
-
const
|
|
11916
|
-
async (
|
|
11917
|
-
if (isEmpty(
|
|
11904
|
+
const C = useDebouncedCallback(
|
|
11905
|
+
async (v) => {
|
|
11906
|
+
if (isEmpty(v))
|
|
11918
11907
|
b([]);
|
|
11919
11908
|
else {
|
|
11920
|
-
const T = await i(p,
|
|
11909
|
+
const T = await i(p, v);
|
|
11921
11910
|
b(T);
|
|
11922
11911
|
}
|
|
11923
11912
|
c(!1), y(-1);
|
|
11924
11913
|
},
|
|
11925
11914
|
[p],
|
|
11926
11915
|
300
|
|
11927
|
-
), E = (
|
|
11928
|
-
const T = ["pageType", p,
|
|
11929
|
-
T[1] && (o(T.join(":")), m(
|
|
11930
|
-
}, B = (
|
|
11931
|
-
switch (
|
|
11916
|
+
), E = (v) => {
|
|
11917
|
+
const T = ["pageType", p, v.id];
|
|
11918
|
+
T[1] && (o(T.join(":")), m(v.name), u(!1), b([]), y(-1));
|
|
11919
|
+
}, B = (v) => {
|
|
11920
|
+
switch (v.key) {
|
|
11932
11921
|
case "ArrowDown":
|
|
11933
|
-
|
|
11922
|
+
v.preventDefault(), y((T) => T < g.length - 1 ? T + 1 : T);
|
|
11934
11923
|
break;
|
|
11935
11924
|
case "ArrowUp":
|
|
11936
|
-
|
|
11925
|
+
v.preventDefault(), y((T) => T > 0 ? T - 1 : T);
|
|
11937
11926
|
break;
|
|
11938
11927
|
case "Enter":
|
|
11939
|
-
if (
|
|
11928
|
+
if (v.preventDefault(), g.length === 0) return;
|
|
11940
11929
|
x >= 0 && E(g[x]);
|
|
11941
11930
|
break;
|
|
11942
11931
|
case "Escape":
|
|
11943
|
-
|
|
11932
|
+
v.preventDefault(), I();
|
|
11944
11933
|
break;
|
|
11945
11934
|
}
|
|
11946
11935
|
};
|
|
11947
11936
|
useEffect(() => {
|
|
11948
|
-
if (x >= 0 &&
|
|
11949
|
-
const
|
|
11950
|
-
|
|
11937
|
+
if (x >= 0 && S.current) {
|
|
11938
|
+
const v = S.current.children[x];
|
|
11939
|
+
v == null || v.scrollIntoView({ block: "nearest" });
|
|
11951
11940
|
}
|
|
11952
11941
|
}, [x]);
|
|
11953
11942
|
const I = () => {
|
|
11954
11943
|
m(""), b([]), y(-1), u(!1), o("");
|
|
11955
|
-
}, A = (
|
|
11956
|
-
m(
|
|
11944
|
+
}, A = (v) => {
|
|
11945
|
+
m(v), u(!isEmpty(v)), c(!0), C(v);
|
|
11957
11946
|
};
|
|
11958
11947
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
11959
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: p, onChange: (
|
|
11948
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: p, onChange: (v) => h(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
|
|
11960
11949
|
p && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
11961
11950
|
/* @__PURE__ */ jsx(
|
|
11962
11951
|
"input",
|
|
11963
11952
|
{
|
|
11964
11953
|
type: "text",
|
|
11965
11954
|
value: f,
|
|
11966
|
-
onChange: (
|
|
11955
|
+
onChange: (v) => A(v.target.value),
|
|
11967
11956
|
onKeyDown: B,
|
|
11968
|
-
placeholder: a(`Search ${
|
|
11957
|
+
placeholder: a(`Search ${k ?? ""}`),
|
|
11969
11958
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
11970
11959
|
}
|
|
11971
11960
|
),
|
|
@@ -11979,22 +11968,22 @@ const DataBindingSelector = ({
|
|
|
11979
11968
|
' "',
|
|
11980
11969
|
f,
|
|
11981
11970
|
'"'
|
|
11982
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref:
|
|
11971
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: S, children: map(g == null ? void 0 : g.slice(0, 20), (v, T) => /* @__PURE__ */ jsxs(
|
|
11983
11972
|
"li",
|
|
11984
11973
|
{
|
|
11985
|
-
onClick: () => E(
|
|
11986
|
-
className: `cursor-pointer p-2 text-xs ${r != null && r.includes(
|
|
11974
|
+
onClick: () => E(v),
|
|
11975
|
+
className: `cursor-pointer p-2 text-xs ${r != null && r.includes(v.id) ? "bg-blue-200" : T === x ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
11987
11976
|
children: [
|
|
11988
|
-
|
|
11977
|
+
v.name,
|
|
11989
11978
|
" ",
|
|
11990
|
-
|
|
11979
|
+
v.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
11991
11980
|
"( ",
|
|
11992
|
-
|
|
11981
|
+
v.slug,
|
|
11993
11982
|
" )"
|
|
11994
11983
|
] })
|
|
11995
11984
|
]
|
|
11996
11985
|
},
|
|
11997
|
-
|
|
11986
|
+
v.id
|
|
11998
11987
|
)) }) })
|
|
11999
11988
|
] });
|
|
12000
11989
|
}, LinkField = ({ schema: r, formData: n, onChange: o, name: a }) => {
|
|
@@ -12088,7 +12077,7 @@ const DataBindingSelector = ({
|
|
|
12088
12077
|
]
|
|
12089
12078
|
}
|
|
12090
12079
|
) });
|
|
12091
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
12080
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-CsBCpJSY.js")), RichTextEditorFieldComp = ({ blockId: r, id: n, placeholder: o, value: a, onChange: i, onBlur: l }) => {
|
|
12092
12081
|
const c = useRef(null), [d, u] = useState(!1), p = useRTEditor({
|
|
12093
12082
|
blockId: r,
|
|
12094
12083
|
value: a,
|
|
@@ -12337,9 +12326,9 @@ const DataBindingSelector = ({
|
|
|
12337
12326
|
const { id: n, classNames: o, label: a, children: i, errors: l, help: c, hidden: d, required: u, schema: p, formData: h, onChange: f } = r, { selectedLang: m, fallbackLang: g, languages: b } = useLanguages(), x = useMemo(
|
|
12338
12327
|
() => isEmpty(b) ? "" : isEmpty(m) ? g : m,
|
|
12339
12328
|
[b, m, g]
|
|
12340
|
-
), y = useMemo(() => get(LANGUAGES, x, x), [x]),
|
|
12341
|
-
() => get(
|
|
12342
|
-
[
|
|
12329
|
+
), y = useMemo(() => get(LANGUAGES, x, x), [x]), S = usePageExternalData(), k = useSelectedBlock(), C = useRegisteredChaiBlocks(), E = useMemo(
|
|
12330
|
+
() => get(C, [k == null ? void 0 : k._type, "i18nProps"], []),
|
|
12331
|
+
[C, k == null ? void 0 : k._type]
|
|
12343
12332
|
), [B, I] = useState(null);
|
|
12344
12333
|
if (d)
|
|
12345
12334
|
return null;
|
|
@@ -12381,7 +12370,7 @@ const DataBindingSelector = ({
|
|
|
12381
12370
|
] })
|
|
12382
12371
|
] });
|
|
12383
12372
|
}
|
|
12384
|
-
const
|
|
12373
|
+
const v = n.replace("root.", ""), T = E.includes(v) && !isEmpty(m) && isEmpty(h);
|
|
12385
12374
|
return /* @__PURE__ */ jsxs("div", { className: o, children: [
|
|
12386
12375
|
p.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12387
12376
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -12399,7 +12388,7 @@ const DataBindingSelector = ({
|
|
|
12399
12388
|
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
12400
12389
|
] }) })
|
|
12401
12390
|
] }),
|
|
12402
|
-
!p.enum && !p.oneOf &&
|
|
12391
|
+
!p.enum && !p.oneOf && S && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
|
|
12403
12392
|
T ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
12404
12393
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
12405
12394
|
"svg",
|
|
@@ -12550,7 +12539,7 @@ function BlockSettings() {
|
|
|
12550
12539
|
I && (o([n._id], { [I]: get(B, I) }), b({ formData: B }, I, { [I]: get(c, I) }));
|
|
12551
12540
|
}, y = ({ formData: B }, I) => {
|
|
12552
12541
|
I && (o([h._id], { [I]: get(B, I) }), b({ formData: B }, I, { [I]: get(c, I) }));
|
|
12553
|
-
}, { schema:
|
|
12542
|
+
}, { schema: S, uiSchema: k } = useMemo(() => {
|
|
12554
12543
|
const B = n == null ? void 0 : n._type;
|
|
12555
12544
|
if (!B)
|
|
12556
12545
|
return { schema: {}, uiSchema: {} };
|
|
@@ -12564,7 +12553,7 @@ function BlockSettings() {
|
|
|
12564
12553
|
} catch {
|
|
12565
12554
|
return { schema: {}, uiSchema: {} };
|
|
12566
12555
|
}
|
|
12567
|
-
}, [n]), { wrapperSchema:
|
|
12556
|
+
}, [n]), { wrapperSchema: C, wrapperUiSchema: E } = useMemo(() => {
|
|
12568
12557
|
if (!h || !(h != null && h._type))
|
|
12569
12558
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
12570
12559
|
const B = h == null ? void 0 : h._type, { schema: I = {}, uiSchema: A = {} } = getBlockFormSchemas(B);
|
|
@@ -12596,19 +12585,19 @@ function BlockSettings() {
|
|
|
12596
12585
|
blockId: h == null ? void 0 : h._id,
|
|
12597
12586
|
onChange: y,
|
|
12598
12587
|
formData: m,
|
|
12599
|
-
schema:
|
|
12588
|
+
schema: C,
|
|
12600
12589
|
uiSchema: E
|
|
12601
12590
|
}
|
|
12602
12591
|
) })
|
|
12603
12592
|
] }),
|
|
12604
|
-
isEmpty(
|
|
12593
|
+
isEmpty(S) ? null : /* @__PURE__ */ jsx(
|
|
12605
12594
|
JSONForm,
|
|
12606
12595
|
{
|
|
12607
12596
|
blockId: n == null ? void 0 : n._id,
|
|
12608
12597
|
onChange: x,
|
|
12609
12598
|
formData: l,
|
|
12610
|
-
schema:
|
|
12611
|
-
uiSchema:
|
|
12599
|
+
schema: S,
|
|
12600
|
+
uiSchema: k
|
|
12612
12601
|
}
|
|
12613
12602
|
)
|
|
12614
12603
|
] });
|
|
@@ -12819,17 +12808,17 @@ const BlockStylingProps = () => {
|
|
|
12819
12808
|
},
|
|
12820
12809
|
a
|
|
12821
12810
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (r) => {
|
|
12822
|
-
const [n, o] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: h } = r, [f, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [g, b] = useState(!1), [x, y] = useState(""), [
|
|
12811
|
+
const [n, o] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: h } = r, [f, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [g, b] = useState(!1), [x, y] = useState(""), [S, k] = useState(!1), [C, E] = useState(!1);
|
|
12823
12812
|
useEffect(() => {
|
|
12824
|
-
const { value:
|
|
12813
|
+
const { value: v, unit: T } = getClassValueAndUnit(l);
|
|
12825
12814
|
if (T === "") {
|
|
12826
|
-
i(
|
|
12815
|
+
i(v), m(u != null && u.toLowerCase().includes("width") ? "%" : first$1(p));
|
|
12827
12816
|
return;
|
|
12828
12817
|
}
|
|
12829
|
-
m(T), i(T === "class" || isEmpty(
|
|
12818
|
+
m(T), i(T === "class" || isEmpty(v) ? "" : v);
|
|
12830
12819
|
}, [l, u, p]);
|
|
12831
|
-
const B = useThrottledCallback((
|
|
12832
|
-
(
|
|
12820
|
+
const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), I = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), A = useCallback(
|
|
12821
|
+
(v = !1) => {
|
|
12833
12822
|
const T = getUserInputValues(`${a}`, p);
|
|
12834
12823
|
if (get(T, "error", !1)) {
|
|
12835
12824
|
b(!0);
|
|
@@ -12843,23 +12832,23 @@ const BlockStylingProps = () => {
|
|
|
12843
12832
|
if (get(T, "value") === "")
|
|
12844
12833
|
return;
|
|
12845
12834
|
const P = `${get(T, "value", "").startsWith("-") ? "-" : ""}${d}[${get(T, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
12846
|
-
|
|
12835
|
+
v ? I(P) : B(P);
|
|
12847
12836
|
},
|
|
12848
12837
|
[B, I, a, f, d, p]
|
|
12849
12838
|
), w = useCallback(
|
|
12850
|
-
(
|
|
12839
|
+
(v) => {
|
|
12851
12840
|
const T = getUserInputValues(`${a}`, p);
|
|
12852
12841
|
if (get(T, "error", !1)) {
|
|
12853
12842
|
b(!0);
|
|
12854
12843
|
return;
|
|
12855
12844
|
}
|
|
12856
|
-
if (
|
|
12857
|
-
B(`${d}${
|
|
12845
|
+
if (v === "auto" || v === "none") {
|
|
12846
|
+
B(`${d}${v}`);
|
|
12858
12847
|
return;
|
|
12859
12848
|
}
|
|
12860
12849
|
if (get(T, "value") === "")
|
|
12861
12850
|
return;
|
|
12862
|
-
const N = get(T, "unit") !== "" ? get(T, "unit") :
|
|
12851
|
+
const N = get(T, "unit") !== "" ? get(T, "unit") : v, P = `${get(T, "value", "").startsWith("-") ? "-" : ""}${d}[${get(T, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
12863
12852
|
B(P);
|
|
12864
12853
|
},
|
|
12865
12854
|
[B, a, d, p]
|
|
@@ -12877,37 +12866,37 @@ const BlockStylingProps = () => {
|
|
|
12877
12866
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
|
|
12878
12867
|
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
12879
12868
|
] })
|
|
12880
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${
|
|
12869
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
|
|
12881
12870
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
12882
12871
|
["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsx(
|
|
12883
12872
|
"input",
|
|
12884
12873
|
{
|
|
12885
12874
|
readOnly: f === "class",
|
|
12886
|
-
onKeyPress: (
|
|
12887
|
-
|
|
12875
|
+
onKeyPress: (v) => {
|
|
12876
|
+
v.key === "Enter" && A();
|
|
12888
12877
|
},
|
|
12889
|
-
onKeyDown: (
|
|
12890
|
-
if (
|
|
12878
|
+
onKeyDown: (v) => {
|
|
12879
|
+
if (v.keyCode !== 38 && v.keyCode !== 40)
|
|
12891
12880
|
return;
|
|
12892
|
-
|
|
12893
|
-
const T = parseInt$1(
|
|
12881
|
+
v.preventDefault(), E(!0);
|
|
12882
|
+
const T = parseInt$1(v.target.value);
|
|
12894
12883
|
let N = isNaN$1(T) ? 0 : T;
|
|
12895
|
-
|
|
12884
|
+
v.keyCode === 38 && (N += 1), v.keyCode === 40 && (N -= 1);
|
|
12896
12885
|
const j = `${N}`, L = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${f === "-" ? "" : f}]`;
|
|
12897
12886
|
I(L);
|
|
12898
12887
|
},
|
|
12899
|
-
onKeyUp: (
|
|
12900
|
-
|
|
12888
|
+
onKeyUp: (v) => {
|
|
12889
|
+
C && (v.preventDefault(), E(!1));
|
|
12901
12890
|
},
|
|
12902
12891
|
onBlur: () => A(),
|
|
12903
|
-
onChange: (
|
|
12904
|
-
b(!1), i(
|
|
12892
|
+
onChange: (v) => {
|
|
12893
|
+
b(!1), i(v.target.value);
|
|
12905
12894
|
},
|
|
12906
|
-
onClick: (
|
|
12895
|
+
onClick: (v) => {
|
|
12907
12896
|
var T;
|
|
12908
|
-
(T =
|
|
12897
|
+
(T = v == null ? void 0 : v.target) == null || T.select(), o(!1);
|
|
12909
12898
|
},
|
|
12910
|
-
value:
|
|
12899
|
+
value: S ? x : a,
|
|
12911
12900
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
12912
12901
|
" ",
|
|
12913
12902
|
g ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -12932,28 +12921,28 @@ const BlockStylingProps = () => {
|
|
|
12932
12921
|
{
|
|
12933
12922
|
units: p,
|
|
12934
12923
|
current: f,
|
|
12935
|
-
onSelect: (
|
|
12936
|
-
o(!1), m(
|
|
12924
|
+
onSelect: (v) => {
|
|
12925
|
+
o(!1), m(v), w(v);
|
|
12937
12926
|
}
|
|
12938
12927
|
}
|
|
12939
12928
|
) })
|
|
12940
12929
|
] })
|
|
12941
12930
|
] }),
|
|
12942
|
-
["none", "auto"].indexOf(f) !== -1 ||
|
|
12931
|
+
["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsx(
|
|
12943
12932
|
DragStyleButton,
|
|
12944
12933
|
{
|
|
12945
|
-
onDragStart: () =>
|
|
12946
|
-
onDragEnd: (
|
|
12947
|
-
if (y(() => ""),
|
|
12934
|
+
onDragStart: () => k(!0),
|
|
12935
|
+
onDragEnd: (v) => {
|
|
12936
|
+
if (y(() => ""), k(!1), isEmpty(v))
|
|
12948
12937
|
return;
|
|
12949
|
-
const T = `${
|
|
12938
|
+
const T = `${v}`, j = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${f === "-" ? "" : f}]`;
|
|
12950
12939
|
B(j);
|
|
12951
12940
|
},
|
|
12952
|
-
onDrag: (
|
|
12953
|
-
if (isEmpty(
|
|
12941
|
+
onDrag: (v) => {
|
|
12942
|
+
if (isEmpty(v))
|
|
12954
12943
|
return;
|
|
12955
|
-
y(
|
|
12956
|
-
const T = `${
|
|
12944
|
+
y(v);
|
|
12945
|
+
const T = `${v}`, j = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${f === "-" ? "" : f}]`;
|
|
12957
12946
|
I(j);
|
|
12958
12947
|
},
|
|
12959
12948
|
currentValue: a,
|
|
@@ -13421,19 +13410,19 @@ const COLOR_PROP = {
|
|
|
13421
13410
|
(I, A = !0) => {
|
|
13422
13411
|
const w = { dark: u, mq: h, mod: p, cls: I, property: i, fullCls: "" };
|
|
13423
13412
|
(u || p !== "") && (w.mq = "xs");
|
|
13424
|
-
const
|
|
13425
|
-
m(b, [
|
|
13413
|
+
const v = generateFullClsName(w);
|
|
13414
|
+
m(b, [v], A);
|
|
13426
13415
|
},
|
|
13427
13416
|
[b, u, h, p, i, m]
|
|
13428
|
-
),
|
|
13417
|
+
), S = useCallback(() => {
|
|
13429
13418
|
g(b, [x], !0);
|
|
13430
|
-
}, [b, x, g]),
|
|
13419
|
+
}, [b, x, g]), k = useMemo(() => canChangeClass(f, h), [f, h]);
|
|
13431
13420
|
useEffect(() => {
|
|
13432
|
-
l(
|
|
13433
|
-
}, [
|
|
13434
|
-
const [, ,
|
|
13421
|
+
l(k, f);
|
|
13422
|
+
}, [k, l, f]);
|
|
13423
|
+
const [, , C] = useScreenSizeWidth(), E = useCallback(
|
|
13435
13424
|
(I) => {
|
|
13436
|
-
|
|
13425
|
+
C({
|
|
13437
13426
|
xs: 400,
|
|
13438
13427
|
sm: 640,
|
|
13439
13428
|
md: 800,
|
|
@@ -13442,9 +13431,9 @@ const COLOR_PROP = {
|
|
|
13442
13431
|
"2xl": 1920
|
|
13443
13432
|
}[I]);
|
|
13444
13433
|
},
|
|
13445
|
-
[
|
|
13434
|
+
[C]
|
|
13446
13435
|
), B = get(f, "dark", null) === u && get(f, "mod", null) === p && get(f, "mq", null) === h;
|
|
13447
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
13436
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: k, canReset: f && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
13448
13437
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${f && !B ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
13449
13438
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
13450
13439
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -13464,7 +13453,7 @@ const COLOR_PROP = {
|
|
|
13464
13453
|
o === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: i, onChange: y }),
|
|
13465
13454
|
o === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: i, onChange: y })
|
|
13466
13455
|
] }),
|
|
13467
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${x ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () =>
|
|
13456
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${x ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => S(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : k && f ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
13468
13457
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
13469
13458
|
"button",
|
|
13470
13459
|
{
|
|
@@ -13686,33 +13675,33 @@ const COLOR_PROP = {
|
|
|
13686
13675
|
buttonClass: a = "",
|
|
13687
13676
|
activeButtonClass: i = ""
|
|
13688
13677
|
}) => {
|
|
13689
|
-
const [l, , c] = useScreenSizeWidth(), [d, u] = useCanvasDisplayWidth(), [p, h] = useSelectedBreakpoints(), f = p, m = h, { t: g } = useTranslation(), b = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (
|
|
13690
|
-
f.includes(
|
|
13691
|
-
}, y = (
|
|
13692
|
-
n || c(
|
|
13693
|
-
},
|
|
13694
|
-
return b.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(b, (
|
|
13678
|
+
const [l, , c] = useScreenSizeWidth(), [d, u] = useCanvasDisplayWidth(), [p, h] = useSelectedBreakpoints(), f = p, m = h, { t: g } = useTranslation(), b = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (k) => {
|
|
13679
|
+
f.includes(k) ? f.length > 2 && m(f.filter((C) => C !== k)) : m((C) => [...C, k]);
|
|
13680
|
+
}, y = (k) => {
|
|
13681
|
+
n || c(k), u(k);
|
|
13682
|
+
}, S = getBreakpointValue(n ? d : l).toLowerCase();
|
|
13683
|
+
return b.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(b, (k) => /* @__PURE__ */ createElement(
|
|
13695
13684
|
BreakpointCard,
|
|
13696
13685
|
{
|
|
13697
13686
|
canvas: n,
|
|
13698
|
-
...
|
|
13687
|
+
...k,
|
|
13699
13688
|
onClick: y,
|
|
13700
|
-
key:
|
|
13701
|
-
currentBreakpoint:
|
|
13689
|
+
key: k.breakpoint,
|
|
13690
|
+
currentBreakpoint: S
|
|
13702
13691
|
}
|
|
13703
13692
|
)) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
|
|
13704
13693
|
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
|
|
13705
|
-
b.filter((
|
|
13706
|
-
(
|
|
13694
|
+
b.filter((k) => includes(f, toUpper(k.breakpoint))),
|
|
13695
|
+
(k) => /* @__PURE__ */ createElement(
|
|
13707
13696
|
BreakpointCard,
|
|
13708
13697
|
{
|
|
13709
13698
|
canvas: n,
|
|
13710
13699
|
openDelay: r,
|
|
13711
13700
|
tooltip: o,
|
|
13712
|
-
...
|
|
13701
|
+
...k,
|
|
13713
13702
|
onClick: y,
|
|
13714
|
-
key:
|
|
13715
|
-
currentBreakpoint:
|
|
13703
|
+
key: k.breakpoint,
|
|
13704
|
+
currentBreakpoint: S,
|
|
13716
13705
|
buttonClass: a,
|
|
13717
13706
|
activeButtonClass: i
|
|
13718
13707
|
}
|
|
@@ -13723,16 +13712,16 @@ const COLOR_PROP = {
|
|
|
13723
13712
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
|
|
13724
13713
|
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: g("Screen sizes") }),
|
|
13725
13714
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
13726
|
-
map(b, (
|
|
13715
|
+
map(b, (k) => /* @__PURE__ */ jsx(
|
|
13727
13716
|
DropdownMenuCheckboxItem,
|
|
13728
13717
|
{
|
|
13729
|
-
disabled:
|
|
13730
|
-
onCheckedChange: () => x(toUpper(
|
|
13731
|
-
checked: includes(f, toUpper(
|
|
13732
|
-
onSelect: (
|
|
13733
|
-
children: g(
|
|
13718
|
+
disabled: k.breakpoint === "xs",
|
|
13719
|
+
onCheckedChange: () => x(toUpper(k.breakpoint)),
|
|
13720
|
+
checked: includes(f, toUpper(k.breakpoint)),
|
|
13721
|
+
onSelect: (C) => C.preventDefault(),
|
|
13722
|
+
children: g(k.title)
|
|
13734
13723
|
},
|
|
13735
|
-
|
|
13724
|
+
k.breakpoint
|
|
13736
13725
|
))
|
|
13737
13726
|
] })
|
|
13738
13727
|
] })
|
|
@@ -13766,10 +13755,10 @@ function ManualClasses({
|
|
|
13766
13755
|
onRemove: a
|
|
13767
13756
|
}) {
|
|
13768
13757
|
var G;
|
|
13769
|
-
const i = useRef(null), [l, c] = useState(""), [d, u] = useState(!1), [p, h] = useState(-1), [, f] = useRightPanel(), m = useFuseSearch(), { t: g } = useTranslation(), [b] = useSelectedStylingBlocks(), x = useSelectedBlock(), y = useAddClassesToBlocks(),
|
|
13758
|
+
const i = useRef(null), [l, c] = useState(""), [d, u] = useState(!1), [p, h] = useState(-1), [, f] = useRightPanel(), m = useFuseSearch(), { t: g } = useTranslation(), [b] = useSelectedStylingBlocks(), x = useSelectedBlock(), y = useAddClassesToBlocks(), S = useRemoveClassesFromBlocks(), [k] = useSelectedBlockIds(), [C, E] = useState(""), B = useAtomValue$1(chaiDesignTokensAtom), I = (G = first$1(b)) == null ? void 0 : G.prop, { classes: A } = getSplitChaiClasses(get(x, I, "")), v = (r === "default" ? A : n ?? "").split(" ").filter((_) => !isEmpty(_)), T = useMemo(() => [...v].sort((_, F) => {
|
|
13770
13759
|
const z = _.startsWith(DESIGN_TOKEN_PREFIX), U = F.startsWith(DESIGN_TOKEN_PREFIX);
|
|
13771
13760
|
return z && !U ? -1 : !z && U ? 1 : 0;
|
|
13772
|
-
}), [
|
|
13761
|
+
}), [v]), N = useBuilderProp("flags.copyPaste", !0), j = (_) => {
|
|
13773
13762
|
if (_.startsWith(DESIGN_TOKEN_PREFIX)) {
|
|
13774
13763
|
const F = B[_];
|
|
13775
13764
|
return F ? F.name : _;
|
|
@@ -13779,8 +13768,8 @@ function ManualClasses({
|
|
|
13779
13768
|
const F = Object.entries(B).find(([z, U]) => U.name === _);
|
|
13780
13769
|
return F ? `${F[0]}` : _;
|
|
13781
13770
|
}, L = () => {
|
|
13782
|
-
const _ =
|
|
13783
|
-
r === "designToken" ? isFunction$1(o) && o(_) : y(
|
|
13771
|
+
const _ = C.trim().replace(/ +(?= )/g, "").split(" ").map(P);
|
|
13772
|
+
r === "designToken" ? isFunction$1(o) && o(_) : y(k, _, !0), E("");
|
|
13784
13773
|
}, [D, $] = useState([]), M = useBuilderProp("flags.designTokens", !1), O = ({ value: _ }) => {
|
|
13785
13774
|
const F = _.trim().toLowerCase(), z = F.match(/.+:/g);
|
|
13786
13775
|
let U = [], q = [];
|
|
@@ -13815,14 +13804,14 @@ function ManualClasses({
|
|
|
13815
13804
|
autoCapitalize: "off",
|
|
13816
13805
|
spellCheck: !1,
|
|
13817
13806
|
placeholder: g("Enter classes separated by space"),
|
|
13818
|
-
value:
|
|
13807
|
+
value: C,
|
|
13819
13808
|
onFocus: (_) => {
|
|
13820
13809
|
setTimeout(() => {
|
|
13821
13810
|
_.target && _.target.select();
|
|
13822
13811
|
}, 0);
|
|
13823
13812
|
},
|
|
13824
13813
|
onKeyDown: (_) => {
|
|
13825
|
-
if (_.key === "Enter" &&
|
|
13814
|
+
if (_.key === "Enter" && C.trim() !== "" && (_.preventDefault(), L()), _.key === "Tab" && D.length > 0) {
|
|
13826
13815
|
_.preventDefault();
|
|
13827
13816
|
const F = new KeyboardEvent("keydown", {
|
|
13828
13817
|
key: "ArrowDown",
|
|
@@ -13836,16 +13825,16 @@ function ManualClasses({
|
|
|
13836
13825
|
onChange: (_, { newValue: F }) => E(F),
|
|
13837
13826
|
className: `w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border ${r === "default" ? "py-1" : "py-1.5"}`
|
|
13838
13827
|
}),
|
|
13839
|
-
[
|
|
13828
|
+
[C, g, i, D.length]
|
|
13840
13829
|
), K = (_) => {
|
|
13841
13830
|
const F = l.trim().replace(/ +(?= )/g, "").split(" ").map(P);
|
|
13842
|
-
k
|
|
13831
|
+
S(k, [_]), y(k, F, !0), c(""), h(-1);
|
|
13843
13832
|
}, Z = () => {
|
|
13844
13833
|
if (navigator.clipboard === void 0) {
|
|
13845
13834
|
toast.error(g("Clipboard not supported"));
|
|
13846
13835
|
return;
|
|
13847
13836
|
}
|
|
13848
|
-
navigator.clipboard.writeText(
|
|
13837
|
+
navigator.clipboard.writeText(v.join(" ")), toast.success(g("Classes copied to clipboard")), u(!0), setTimeout(() => u(!1), 2e3);
|
|
13849
13838
|
};
|
|
13850
13839
|
return /* @__PURE__ */ jsxs(
|
|
13851
13840
|
"div",
|
|
@@ -13874,7 +13863,7 @@ function ManualClasses({
|
|
|
13874
13863
|
inputProps: W,
|
|
13875
13864
|
onSuggestionSelected: (_, { suggestionValue: F }) => {
|
|
13876
13865
|
const U = [P(F)];
|
|
13877
|
-
r === "designToken" ? isFunction$1(o) && o(U) : y(
|
|
13866
|
+
r === "designToken" ? isFunction$1(o) && o(U) : y(k, U, !0), E("");
|
|
13878
13867
|
},
|
|
13879
13868
|
containerProps: {
|
|
13880
13869
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
@@ -13892,7 +13881,7 @@ function ManualClasses({
|
|
|
13892
13881
|
variant: "outline",
|
|
13893
13882
|
className: `border-border ${r === "default" ? "h-6" : "mt-1 h-7"}`,
|
|
13894
13883
|
onClick: L,
|
|
13895
|
-
disabled:
|
|
13884
|
+
disabled: C.trim() === "",
|
|
13896
13885
|
size: "sm",
|
|
13897
13886
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
13898
13887
|
}
|
|
@@ -13923,7 +13912,7 @@ function ManualClasses({
|
|
|
13923
13912
|
"button",
|
|
13924
13913
|
{
|
|
13925
13914
|
onDoubleClick: () => {
|
|
13926
|
-
E(j(_)), r === "default" ? k
|
|
13915
|
+
E(j(_)), r === "default" ? S(k, [_]) : (isFunction$1(a) && a(_), E(_)), setTimeout(() => {
|
|
13927
13916
|
i.current && i.current.focus();
|
|
13928
13917
|
}, 10);
|
|
13929
13918
|
},
|
|
@@ -13934,7 +13923,7 @@ function ManualClasses({
|
|
|
13934
13923
|
Cross2Icon,
|
|
13935
13924
|
{
|
|
13936
13925
|
onClick: () => {
|
|
13937
|
-
r === "default" ? k
|
|
13926
|
+
r === "default" ? S(k, [_]) : isFunction$1(a) && a(_);
|
|
13938
13927
|
},
|
|
13939
13928
|
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"
|
|
13940
13929
|
}
|
|
@@ -14276,16 +14265,16 @@ const registerChaiLibrary = (r, n) => {
|
|
|
14276
14265
|
"div",
|
|
14277
14266
|
{
|
|
14278
14267
|
draggable: b,
|
|
14279
|
-
onDragStart: async (
|
|
14268
|
+
onDragStart: async (S) => {
|
|
14280
14269
|
try {
|
|
14281
14270
|
if (i) {
|
|
14282
|
-
i(
|
|
14271
|
+
i(S);
|
|
14283
14272
|
return;
|
|
14284
14273
|
}
|
|
14285
|
-
let
|
|
14274
|
+
let k = null;
|
|
14286
14275
|
if (u === "Image") {
|
|
14287
14276
|
if (!(r != null && r.image)) return;
|
|
14288
|
-
|
|
14277
|
+
k = {
|
|
14289
14278
|
type: "Image",
|
|
14290
14279
|
blocks: [
|
|
14291
14280
|
{
|
|
@@ -14298,35 +14287,35 @@ const registerChaiLibrary = (r, n) => {
|
|
|
14298
14287
|
]
|
|
14299
14288
|
};
|
|
14300
14289
|
} else if (n) {
|
|
14301
|
-
const
|
|
14290
|
+
const C = typeof n == "function" ? await n() : n, E = getBlocksFromHTML(C);
|
|
14302
14291
|
if (isEmpty(E)) return;
|
|
14303
|
-
|
|
14292
|
+
k = {
|
|
14304
14293
|
type: "Box",
|
|
14305
14294
|
blocks: E,
|
|
14306
14295
|
name: get(E, "0._type", "Block")
|
|
14307
14296
|
};
|
|
14308
14297
|
} else if (o) {
|
|
14309
|
-
const
|
|
14310
|
-
if (isEmpty(
|
|
14311
|
-
|
|
14298
|
+
const C = typeof o == "function" ? await o() : o;
|
|
14299
|
+
if (isEmpty(C)) return;
|
|
14300
|
+
k = {
|
|
14312
14301
|
type: "Box",
|
|
14313
|
-
blocks:
|
|
14314
|
-
name: get(
|
|
14302
|
+
blocks: C,
|
|
14303
|
+
name: get(C, "0._type", "Block")
|
|
14315
14304
|
};
|
|
14316
14305
|
} else if (r) {
|
|
14317
|
-
const
|
|
14318
|
-
|
|
14306
|
+
const C = typeof r == "function" ? await r() : r;
|
|
14307
|
+
k = typeof C == "object" ? omit(C, ["component", "icon"]) : C;
|
|
14319
14308
|
}
|
|
14320
|
-
if (!
|
|
14321
|
-
p(
|
|
14309
|
+
if (!k) return;
|
|
14310
|
+
p(S, k, !0), setTimeout(() => {
|
|
14322
14311
|
m([]), g();
|
|
14323
14312
|
}, 200);
|
|
14324
|
-
} catch (
|
|
14325
|
-
console.error("Error in ChaiDraggableBlock drag start:",
|
|
14313
|
+
} catch (k) {
|
|
14314
|
+
console.error("Error in ChaiDraggableBlock drag start:", k);
|
|
14326
14315
|
}
|
|
14327
14316
|
},
|
|
14328
|
-
onDragEnd: (
|
|
14329
|
-
l ? l(
|
|
14317
|
+
onDragEnd: (S) => {
|
|
14318
|
+
l ? l(S) : h();
|
|
14330
14319
|
},
|
|
14331
14320
|
className: `${b ? "cursor-grab active:cursor-grabbing" : ""} ${d}`.trim(),
|
|
14332
14321
|
children: a
|
|
@@ -14371,16 +14360,16 @@ const BlockCard = ({
|
|
|
14371
14360
|
return;
|
|
14372
14361
|
}
|
|
14373
14362
|
l(!0);
|
|
14374
|
-
let
|
|
14375
|
-
typeof
|
|
14363
|
+
let S = await c({ library: n, block: r });
|
|
14364
|
+
typeof S == "string" && (S = getBlocksFromHTML(S)), isEmpty(S) || u(syncBlocksWithDefaults(S), o, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK), setTimeout(() => l(!1), 1e3);
|
|
14376
14365
|
},
|
|
14377
14366
|
[d, u, r, c, n, o, a]
|
|
14378
14367
|
);
|
|
14379
14368
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
14380
14369
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(ChaiDraggableBlock, { draggable: g, onDragStart: async (y) => {
|
|
14381
14370
|
if (!g) return;
|
|
14382
|
-
let
|
|
14383
|
-
typeof
|
|
14371
|
+
let S = await c({ library: n, block: r });
|
|
14372
|
+
typeof S == "string" && (S = getBlocksFromHTML(S)), f(y, { type: "Box", blocks: S, name: p }, !0);
|
|
14384
14373
|
}, onDragEnd: m, children: /* @__PURE__ */ jsxs(
|
|
14385
14374
|
"div",
|
|
14386
14375
|
{
|
|
@@ -14424,26 +14413,26 @@ const BlockCard = ({
|
|
|
14424
14413
|
const N = b.current.search(h).map((j) => j.item);
|
|
14425
14414
|
g(N);
|
|
14426
14415
|
}, [h]);
|
|
14427
|
-
const x = h.trim() && !isEmpty(m) ? m : d, y = groupBy(x, "group"), [
|
|
14416
|
+
const x = h.trim() && !isEmpty(m) ? m : d, y = groupBy(x, "group"), [S, k] = useState(null);
|
|
14428
14417
|
useEffect(() => {
|
|
14429
14418
|
if (isEmpty(keys$1(y))) {
|
|
14430
|
-
|
|
14419
|
+
k(null);
|
|
14431
14420
|
return;
|
|
14432
14421
|
}
|
|
14433
|
-
if (!
|
|
14434
|
-
|
|
14422
|
+
if (!S || !y[S]) {
|
|
14423
|
+
k(first$1(keys$1(y)));
|
|
14435
14424
|
return;
|
|
14436
14425
|
}
|
|
14437
|
-
}, [y,
|
|
14438
|
-
const
|
|
14426
|
+
}, [y, S]);
|
|
14427
|
+
const C = get(y, S, []), E = useRef(null), { t: B } = useTranslation(), I = useRef(null);
|
|
14439
14428
|
useEffect(() => {
|
|
14440
14429
|
var j;
|
|
14441
14430
|
const N = (j = I.current) == null ? void 0 : j.querySelector("[data-radix-scroll-area-viewport]");
|
|
14442
14431
|
N && N.scrollTo({ top: 0, behavior: "smooth" });
|
|
14443
|
-
}, [c,
|
|
14432
|
+
}, [c, S]);
|
|
14444
14433
|
const A = (N) => {
|
|
14445
14434
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
14446
|
-
E.current &&
|
|
14435
|
+
E.current && k(N);
|
|
14447
14436
|
}, 400);
|
|
14448
14437
|
}, w = () => {
|
|
14449
14438
|
c != null && c.id && p(c.id);
|
|
@@ -14453,7 +14442,7 @@ const BlockCard = ({
|
|
|
14453
14442
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
14454
14443
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
14455
14444
|
] });
|
|
14456
|
-
const
|
|
14445
|
+
const v = filter(C, (N, j) => j % 2 === 0), T = filter(C, (N, j) => j % 2 === 1);
|
|
14457
14446
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
14458
14447
|
/* @__PURE__ */ jsx(SearchInput, { value: h, setValue: f }),
|
|
14459
14448
|
/* @__PURE__ */ jsx("div", { className: "relative flex h-full max-h-full flex-1 overflow-hidden bg-background", children: /* @__PURE__ */ jsxs("div", { className: `flex h-full flex-1 pt-2 ${o ? "flex-col" : ""}`, children: [
|
|
@@ -14476,7 +14465,7 @@ const BlockCard = ({
|
|
|
14476
14465
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
14477
14466
|
B("Retry")
|
|
14478
14467
|
] })
|
|
14479
|
-
] }) }) : o ? /* @__PURE__ */ jsxs(Select$1, { value:
|
|
14468
|
+
] }) }) : o ? /* @__PURE__ */ jsxs(Select$1, { value: S, onValueChange: k, children: [
|
|
14480
14469
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: B("Select a group") }) }),
|
|
14481
14470
|
/* @__PURE__ */ jsx(SelectContent, { children: map(y, (N, j) => /* @__PURE__ */ jsx(SelectItem, { value: j, children: capitalize(B(j.toLowerCase())) }, j)) })
|
|
14482
14471
|
] }) : map(y, (N, j) => /* @__PURE__ */ jsxs(
|
|
@@ -14485,10 +14474,10 @@ const BlockCard = ({
|
|
|
14485
14474
|
onMouseEnter: () => A(j),
|
|
14486
14475
|
onMouseLeave: () => clearTimeout(E.current),
|
|
14487
14476
|
role: "button",
|
|
14488
|
-
onClick: () =>
|
|
14477
|
+
onClick: () => k(j),
|
|
14489
14478
|
className: cn$2(
|
|
14490
14479
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
14491
|
-
j ===
|
|
14480
|
+
j === S ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
|
|
14492
14481
|
),
|
|
14493
14482
|
children: [
|
|
14494
14483
|
/* @__PURE__ */ jsx("span", { children: capitalize(B(j.toLowerCase())) }),
|
|
@@ -14510,8 +14499,8 @@ const BlockCard = ({
|
|
|
14510
14499
|
onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
|
|
14511
14500
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
14512
14501
|
children: [
|
|
14513
|
-
isEmpty(
|
|
14514
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
14502
|
+
isEmpty(C) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: `grid w-full gap-2 ${o ? "grid-cols-1 pb-20" : "grid-cols-2 px-2"}`, children: [
|
|
14503
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((N, j) => /* @__PURE__ */ jsx(
|
|
14515
14504
|
BlockCard,
|
|
14516
14505
|
{
|
|
14517
14506
|
parentId: r,
|
|
@@ -14571,19 +14560,19 @@ const BlockCard = ({
|
|
|
14571
14560
|
}), f(!0);
|
|
14572
14561
|
else if (!l && Object.keys(i || {}).length > 0) {
|
|
14573
14562
|
const g = Object.entries(i).map(([x, y]) => {
|
|
14574
|
-
const
|
|
14563
|
+
const S = y, k = S.type || "partial", C = formatReadableName(k);
|
|
14575
14564
|
return {
|
|
14576
14565
|
type: "PartialBlock",
|
|
14577
14566
|
// Set the type to PartialBlock
|
|
14578
|
-
label: formatReadableName(
|
|
14579
|
-
description:
|
|
14567
|
+
label: formatReadableName(S.name || x),
|
|
14568
|
+
description: S.description || "",
|
|
14580
14569
|
icon: FrameIcon,
|
|
14581
|
-
group:
|
|
14570
|
+
group: C,
|
|
14582
14571
|
// Use formatted type as group
|
|
14583
14572
|
category: "partial",
|
|
14584
14573
|
partialBlockId: x,
|
|
14585
14574
|
// Store the original ID as partialBlockId
|
|
14586
|
-
_name:
|
|
14575
|
+
_name: S.name
|
|
14587
14576
|
};
|
|
14588
14577
|
}), b = uniq(map(g, "group"));
|
|
14589
14578
|
p({
|
|
@@ -14642,7 +14631,7 @@ const BlockCard = ({
|
|
|
14642
14631
|
disableBlockGroupsSidebar: l
|
|
14643
14632
|
}) => {
|
|
14644
14633
|
var N;
|
|
14645
|
-
const { t: c } = useTranslation(), [d] = useBlocksStore(), [u, p] = useState(""), h = useRef(null), [f] = useAtom$1(addBlockTabAtom), m = (N = find(d, (j) => j._id === o)) == null ? void 0 : N._type, [g, b] = useState("all"), [x, y] = useState(null),
|
|
14634
|
+
const { t: c } = useTranslation(), [d] = useBlocksStore(), [u, p] = useState(""), h = useRef(null), [f] = useAtom$1(addBlockTabAtom), m = (N = find(d, (j) => j._id === o)) == null ? void 0 : N._type, [g, b] = useState("all"), [x, y] = useState(null), S = useRef(null), k = useBuilderProp("flags.dragAndDrop", !1);
|
|
14646
14635
|
useEffect(() => {
|
|
14647
14636
|
const j = setTimeout(() => {
|
|
14648
14637
|
var P;
|
|
@@ -14651,17 +14640,17 @@ const BlockCard = ({
|
|
|
14651
14640
|
return () => clearTimeout(j);
|
|
14652
14641
|
}, [f]), useEffect(() => {
|
|
14653
14642
|
u && (b("all"), y(null));
|
|
14654
|
-
}, [u]), useEffect(() => (
|
|
14643
|
+
}, [u]), useEffect(() => (S.current = debounce((j) => {
|
|
14655
14644
|
b(j);
|
|
14656
14645
|
}, 500), () => {
|
|
14657
|
-
|
|
14646
|
+
S.current && S.current.cancel();
|
|
14658
14647
|
}), []);
|
|
14659
|
-
const
|
|
14660
|
-
y(j),
|
|
14648
|
+
const C = useCallback((j) => {
|
|
14649
|
+
y(j), S.current && S.current(j);
|
|
14661
14650
|
}, []), E = useCallback(() => {
|
|
14662
|
-
y(null),
|
|
14651
|
+
y(null), S.current && S.current.cancel();
|
|
14663
14652
|
}, []), B = useCallback((j) => {
|
|
14664
|
-
|
|
14653
|
+
S.current && S.current.cancel(), b(j), y(null);
|
|
14665
14654
|
}, []), I = useMemo(
|
|
14666
14655
|
() => u ? values(n).filter(
|
|
14667
14656
|
(j) => {
|
|
@@ -14678,7 +14667,7 @@ const BlockCard = ({
|
|
|
14678
14667
|
), w = useMemo(
|
|
14679
14668
|
() => sortBy(A, (j) => CORE_GROUPS.indexOf(j) === -1 ? 99 : CORE_GROUPS.indexOf(j)),
|
|
14680
14669
|
[A]
|
|
14681
|
-
),
|
|
14670
|
+
), v = useMemo(() => g === "all" ? I : filter(values(I), { group: g }), [I, g]), T = useMemo(() => g === "all" ? w : [g], [w, g]);
|
|
14682
14671
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
|
|
14683
14672
|
/* @__PURE__ */ jsx(SearchInput, { value: u, setValue: p }),
|
|
14684
14673
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
|
|
@@ -14687,7 +14676,7 @@ const BlockCard = ({
|
|
|
14687
14676
|
"button",
|
|
14688
14677
|
{
|
|
14689
14678
|
onClick: () => B("all"),
|
|
14690
|
-
onMouseEnter: () =>
|
|
14679
|
+
onMouseEnter: () => C("all"),
|
|
14691
14680
|
onMouseLeave: E,
|
|
14692
14681
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${g === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
14693
14682
|
children: c("All")
|
|
@@ -14698,7 +14687,7 @@ const BlockCard = ({
|
|
|
14698
14687
|
"button",
|
|
14699
14688
|
{
|
|
14700
14689
|
onClick: () => B(j),
|
|
14701
|
-
onMouseEnter: () =>
|
|
14690
|
+
onMouseEnter: () => C(j),
|
|
14702
14691
|
onMouseLeave: E,
|
|
14703
14692
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${g === j || x === j ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
14704
14693
|
children: capitalize(c(j.toLowerCase()))
|
|
@@ -14718,7 +14707,7 @@ const BlockCard = ({
|
|
|
14718
14707
|
] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: T.map((j, P) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
14719
14708
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(j.toLowerCase())) }),
|
|
14720
14709
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
|
|
14721
|
-
g === "all" ? filter(values(
|
|
14710
|
+
g === "all" ? filter(values(v), { group: j }) : values(v),
|
|
14722
14711
|
{ hidden: !0 }
|
|
14723
14712
|
).map((L, D) => /* @__PURE__ */ jsx(
|
|
14724
14713
|
CoreBlock,
|
|
@@ -14726,7 +14715,7 @@ const BlockCard = ({
|
|
|
14726
14715
|
parentId: o,
|
|
14727
14716
|
position: a,
|
|
14728
14717
|
block: L,
|
|
14729
|
-
disabled: !
|
|
14718
|
+
disabled: !k && (!canAcceptChildBlock(m, L.type) || !canBeNestedInside(m, L.type))
|
|
14730
14719
|
},
|
|
14731
14720
|
L.type + "-" + P + "-" + D
|
|
14732
14721
|
)) })
|
|
@@ -14748,10 +14737,10 @@ const BlockCard = ({
|
|
|
14748
14737
|
}, [c, f, d]);
|
|
14749
14738
|
const g = useCallback(() => {
|
|
14750
14739
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
14751
|
-
}, []), b = useChaiAddBlockTabs(), x = p && m(PERMISSIONS.IMPORT_HTML),
|
|
14740
|
+
}, []), b = useChaiAddBlockTabs(), x = p && m(PERMISSIONS.IMPORT_HTML), S = useChaiLibraries().length > 0;
|
|
14752
14741
|
return useEffect(() => {
|
|
14753
|
-
c === "library" && !
|
|
14754
|
-
}, [c,
|
|
14742
|
+
c === "library" && !S && d("core");
|
|
14743
|
+
}, [c, S, d]), /* @__PURE__ */ jsxs("div", { className: cn$1("flex h-full w-full flex-col overflow-hidden", r), children: [
|
|
14755
14744
|
n ? /* @__PURE__ */ jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
14756
14745
|
/* @__PURE__ */ jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: l("Add block") }),
|
|
14757
14746
|
/* @__PURE__ */ jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: l(c === "html" ? "Enter or paste TailwindCSS HTML snippet" : "Click to add block to page") })
|
|
@@ -14759,25 +14748,25 @@ const BlockCard = ({
|
|
|
14759
14748
|
/* @__PURE__ */ jsxs(
|
|
14760
14749
|
Tabs,
|
|
14761
14750
|
{
|
|
14762
|
-
onValueChange: (
|
|
14763
|
-
u(""), d(
|
|
14751
|
+
onValueChange: (k) => {
|
|
14752
|
+
u(""), d(k);
|
|
14764
14753
|
},
|
|
14765
14754
|
value: c,
|
|
14766
14755
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
14767
14756
|
children: [
|
|
14768
14757
|
/* @__PURE__ */ jsxs(TabsList, { className: `flex items-center ${i ? "h-max w-max justify-start p-1" : "w-full"}`, children: [
|
|
14769
|
-
|
|
14758
|
+
S && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", className: i ? "h-5 px-2 text-xs" : "", children: l("Library") }),
|
|
14770
14759
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", className: i ? "h-5 px-2 text-xs" : "", children: l("Blocks") }),
|
|
14771
14760
|
f && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", className: i ? "h-5 px-2 text-xs" : "", children: l("Partials") }),
|
|
14772
14761
|
x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", className: i ? "h-5 px-2 text-xs" : "", children: l("Import") }) : null,
|
|
14773
|
-
map(b, (
|
|
14762
|
+
map(b, (k) => /* @__PURE__ */ jsx(
|
|
14774
14763
|
TabsTrigger,
|
|
14775
14764
|
{
|
|
14776
|
-
value:
|
|
14765
|
+
value: k.id,
|
|
14777
14766
|
className: i ? "h-5 px-2 text-xs" : "",
|
|
14778
|
-
children: React__default.createElement(
|
|
14767
|
+
children: React__default.createElement(k.tab)
|
|
14779
14768
|
},
|
|
14780
|
-
`tab-add-block-${
|
|
14769
|
+
`tab-add-block-${k.id}`
|
|
14781
14770
|
))
|
|
14782
14771
|
] }),
|
|
14783
14772
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(
|
|
@@ -14789,7 +14778,7 @@ const BlockCard = ({
|
|
|
14789
14778
|
disableBlockGroupsSidebar: i
|
|
14790
14779
|
}
|
|
14791
14780
|
) }) }) }),
|
|
14792
|
-
|
|
14781
|
+
S && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { fromSidebar: i, parentId: o, position: a }) }),
|
|
14793
14782
|
f && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(
|
|
14794
14783
|
PartialBlocks,
|
|
14795
14784
|
{
|
|
@@ -14800,7 +14789,7 @@ const BlockCard = ({
|
|
|
14800
14789
|
}
|
|
14801
14790
|
) }) }) }),
|
|
14802
14791
|
x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20 ", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: o, position: a, fromSidebar: i }) }) : null,
|
|
14803
|
-
map(b, (
|
|
14792
|
+
map(b, (k) => /* @__PURE__ */ jsx(TabsContent, { value: k.id, children: React__default.createElement(k.tabContent, { close: g, parentId: o, position: a }) }, `panel-add-block-${k.id}`))
|
|
14804
14793
|
]
|
|
14805
14794
|
}
|
|
14806
14795
|
)
|
|
@@ -15205,19 +15194,19 @@ const useStructureValidation = () => {
|
|
|
15205
15194
|
var H;
|
|
15206
15195
|
const { t: a } = useTranslation(), i = useUpdateBlocksProps(), [l] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
15207
15196
|
let d = null;
|
|
15208
|
-
const u = r.children.length > 0, { highlightBlock: p, clearHighlight: h } = useBlockHighlight(), f = useIsDragAndDropEnabled(), { id: m, data: g, isSelected: b, willReceiveDrop: x, isDragging: y, isEditing:
|
|
15197
|
+
const u = r.children.length > 0, { highlightBlock: p, clearHighlight: h } = useBlockHighlight(), f = useIsDragAndDropEnabled(), { id: m, data: g, isSelected: b, willReceiveDrop: x, isDragging: y, isEditing: S, handleClick: k } = r, C = useStructureValidation(), E = useMemo(() => C.getBlockErrors(m), [C, m]), B = get(g, "_show", !0), I = (R) => {
|
|
15209
15198
|
R.stopPropagation(), B && r.toggle();
|
|
15210
15199
|
}, A = (R) => {
|
|
15211
15200
|
R.isInternal && (d = R.isOpen, R.isOpen && R.close());
|
|
15212
15201
|
}, w = (R) => {
|
|
15213
15202
|
R.isInternal && d !== null && (d ? R.open() : R.close(), d = null);
|
|
15214
|
-
}, [
|
|
15203
|
+
}, [v, T] = useAtom$1(currentAddSelection), N = () => {
|
|
15215
15204
|
var R;
|
|
15216
15205
|
j(), r.parent.isSelected || T((R = r == null ? void 0 : r.parent) == null ? void 0 : R.id);
|
|
15217
15206
|
}, j = () => {
|
|
15218
15207
|
T(null);
|
|
15219
15208
|
}, P = (R) => {
|
|
15220
|
-
j(), R.stopPropagation(), !r.isOpen && B && r.toggle(),
|
|
15209
|
+
j(), R.stopPropagation(), !r.isOpen && B && r.toggle(), k(R);
|
|
15221
15210
|
};
|
|
15222
15211
|
useEffect(() => {
|
|
15223
15212
|
const R = setTimeout(() => {
|
|
@@ -15294,7 +15283,7 @@ const useStructureValidation = () => {
|
|
|
15294
15283
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
15295
15284
|
b ? "bg-primary/20" : "hover:bg-primary/10",
|
|
15296
15285
|
x && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
|
|
15297
|
-
(r == null ? void 0 : r.id) ===
|
|
15286
|
+
(r == null ? void 0 : r.id) === v ? "bg-primary/10" : "",
|
|
15298
15287
|
y && "opacity-20",
|
|
15299
15288
|
B ? "" : "line-through opacity-50",
|
|
15300
15289
|
M && b && "bg-primary/20 text-primary"
|
|
@@ -15320,7 +15309,7 @@ const useStructureValidation = () => {
|
|
|
15320
15309
|
),
|
|
15321
15310
|
children: [
|
|
15322
15311
|
E.length > 0 ? /* @__PURE__ */ jsx("div", { className: "text-red-500", children: /* @__PURE__ */ jsx(ExclamationTriangleIcon, { className: "h-3 w-3" }) }) : /* @__PURE__ */ jsx(TypeIcon, { type: g == null ? void 0 : g._type }),
|
|
15323
|
-
|
|
15312
|
+
S ? /* @__PURE__ */ jsx(Input, { node: r }) : /* @__PURE__ */ jsx(
|
|
15324
15313
|
"div",
|
|
15325
15314
|
{
|
|
15326
15315
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
@@ -15808,17 +15797,17 @@ const useStructureValidation = () => {
|
|
|
15808
15797
|
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((w) => {
|
|
15809
15798
|
d.push(w);
|
|
15810
15799
|
});
|
|
15811
|
-
const [g, b] = useTheme(), x = useThemeOptions(), { t: y } = useTranslation(),
|
|
15800
|
+
const [g, b] = useTheme(), x = useThemeOptions(), { t: y } = useTranslation(), S = React.useCallback(
|
|
15812
15801
|
(w) => {
|
|
15813
|
-
const
|
|
15814
|
-
setPreviousTheme(
|
|
15802
|
+
const v = { ...g };
|
|
15803
|
+
setPreviousTheme(v), b(w), m(), toast.success("Theme updated", {
|
|
15815
15804
|
action: {
|
|
15816
15805
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
15817
15806
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
15818
15807
|
" Undo"
|
|
15819
15808
|
] }),
|
|
15820
15809
|
onClick: () => {
|
|
15821
|
-
b(
|
|
15810
|
+
b(v), clearPreviousTheme(), toast.dismiss();
|
|
15822
15811
|
}
|
|
15823
15812
|
},
|
|
15824
15813
|
closeButton: !0,
|
|
@@ -15826,22 +15815,22 @@ const useStructureValidation = () => {
|
|
|
15826
15815
|
});
|
|
15827
15816
|
},
|
|
15828
15817
|
[g, b, m]
|
|
15829
|
-
),
|
|
15830
|
-
const w = d.find((
|
|
15818
|
+
), k = () => {
|
|
15819
|
+
const w = d.find((v) => Object.keys(v)[0] === a);
|
|
15831
15820
|
if (w) {
|
|
15832
|
-
const
|
|
15833
|
-
|
|
15821
|
+
const v = Object.values(w)[0];
|
|
15822
|
+
v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (S(v), i(""), m()) : console.error("Invalid preset structure:", v);
|
|
15834
15823
|
} else
|
|
15835
15824
|
console.error("Preset not found:", a);
|
|
15836
|
-
},
|
|
15837
|
-
|
|
15825
|
+
}, C = (w) => {
|
|
15826
|
+
S(w), i(""), m();
|
|
15838
15827
|
}, E = useDebouncedCallback(
|
|
15839
|
-
(w,
|
|
15828
|
+
(w, v) => {
|
|
15840
15829
|
b(() => ({
|
|
15841
15830
|
...g,
|
|
15842
15831
|
fontFamily: {
|
|
15843
15832
|
...g.fontFamily,
|
|
15844
|
-
[w.replace(/font-/g, "")]:
|
|
15833
|
+
[w.replace(/font-/g, "")]: v
|
|
15845
15834
|
}
|
|
15846
15835
|
})), m();
|
|
15847
15836
|
},
|
|
@@ -15856,10 +15845,10 @@ const useStructureValidation = () => {
|
|
|
15856
15845
|
},
|
|
15857
15846
|
[g, m]
|
|
15858
15847
|
), I = useDebouncedCallback(
|
|
15859
|
-
(w,
|
|
15848
|
+
(w, v) => {
|
|
15860
15849
|
b(() => {
|
|
15861
15850
|
const T = get(g, `colors.${w}`);
|
|
15862
|
-
return n ? set(T, 1,
|
|
15851
|
+
return n ? set(T, 1, v) : set(T, 0, v), m(), {
|
|
15863
15852
|
...g,
|
|
15864
15853
|
colors: {
|
|
15865
15854
|
...g.colors,
|
|
@@ -15870,18 +15859,18 @@ const useStructureValidation = () => {
|
|
|
15870
15859
|
},
|
|
15871
15860
|
[g, m],
|
|
15872
15861
|
200
|
|
15873
|
-
), A = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([
|
|
15874
|
-
const T = get(g, `colors.${
|
|
15875
|
-
return T ? /* @__PURE__ */ jsxs("div", { id: `theme-${
|
|
15862
|
+
), A = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([v]) => {
|
|
15863
|
+
const T = get(g, `colors.${v}.${n ? 1 : 0}`);
|
|
15864
|
+
return T ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
|
|
15876
15865
|
/* @__PURE__ */ jsx(
|
|
15877
15866
|
ColorPickerInput,
|
|
15878
15867
|
{
|
|
15879
15868
|
value: T,
|
|
15880
|
-
onChange: (N) => I(
|
|
15869
|
+
onChange: (N) => I(v, N)
|
|
15881
15870
|
}
|
|
15882
15871
|
),
|
|
15883
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
15884
|
-
] },
|
|
15872
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
|
|
15873
|
+
] }, v) : null;
|
|
15885
15874
|
}) });
|
|
15886
15875
|
return p("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
15887
15876
|
/* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", r), children: [
|
|
@@ -15897,11 +15886,11 @@ const useStructureValidation = () => {
|
|
|
15897
15886
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
|
|
15898
15887
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
|
|
15899
15888
|
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
|
|
15900
|
-
const
|
|
15901
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
15889
|
+
const v = Object.keys(w)[0], T = v.replaceAll("_", " ");
|
|
15890
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(T) }, v);
|
|
15902
15891
|
}) })
|
|
15903
15892
|
] }) }),
|
|
15904
|
-
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick:
|
|
15893
|
+
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
|
|
15905
15894
|
] })
|
|
15906
15895
|
] }),
|
|
15907
15896
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
@@ -15910,11 +15899,11 @@ const useStructureValidation = () => {
|
|
|
15910
15899
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
15911
15900
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
|
|
15912
15901
|
] }),
|
|
15913
|
-
(x == null ? void 0 : x.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(x.fontFamily).map(([w,
|
|
15902
|
+
(x == null ? void 0 : x.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(x.fontFamily).map(([w, v]) => /* @__PURE__ */ jsx(
|
|
15914
15903
|
FontSelector,
|
|
15915
15904
|
{
|
|
15916
15905
|
label: w,
|
|
15917
|
-
value: g.fontFamily[w.replace(/font-/g, "")] ||
|
|
15906
|
+
value: g.fontFamily[w.replace(/font-/g, "")] || v[Object.keys(v)[0]],
|
|
15918
15907
|
onChange: (T) => E(w, T)
|
|
15919
15908
|
},
|
|
15920
15909
|
w
|
|
@@ -15958,7 +15947,7 @@ const useStructureValidation = () => {
|
|
|
15958
15947
|
{
|
|
15959
15948
|
open: l,
|
|
15960
15949
|
onOpenChange: c,
|
|
15961
|
-
onImport:
|
|
15950
|
+
onImport: C
|
|
15962
15951
|
}
|
|
15963
15952
|
) })
|
|
15964
15953
|
] }),
|
|
@@ -16701,7 +16690,7 @@ const UndoRedo = () => {
|
|
|
16701
16690
|
useEffect(() => {
|
|
16702
16691
|
i(n);
|
|
16703
16692
|
}, [n]);
|
|
16704
|
-
const
|
|
16693
|
+
const S = () => {
|
|
16705
16694
|
if (l.startsWith("@")) {
|
|
16706
16695
|
m(y("Attribute keys cannot start with @"));
|
|
16707
16696
|
return;
|
|
@@ -16710,10 +16699,10 @@ const UndoRedo = () => {
|
|
|
16710
16699
|
const A = [...a, { key: l, value: d }];
|
|
16711
16700
|
o(A), i(a), c(""), u(""), m("");
|
|
16712
16701
|
}
|
|
16713
|
-
},
|
|
16714
|
-
const w = a.filter((
|
|
16702
|
+
}, k = (A) => {
|
|
16703
|
+
const w = a.filter((v, T) => T !== A);
|
|
16715
16704
|
o(w), i(w);
|
|
16716
|
-
},
|
|
16705
|
+
}, C = (A) => {
|
|
16717
16706
|
h(A), c(a[A].key), u(a[A].value);
|
|
16718
16707
|
}, E = () => {
|
|
16719
16708
|
if (l.startsWith("@")) {
|
|
@@ -16725,9 +16714,9 @@ const UndoRedo = () => {
|
|
|
16725
16714
|
A[p] = { key: l, value: d }, o(A), i(A), h(null), c(""), u(""), m("");
|
|
16726
16715
|
}
|
|
16727
16716
|
}, B = (A) => {
|
|
16728
|
-
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? E() :
|
|
16717
|
+
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? E() : S());
|
|
16729
16718
|
}, I = useCallback((A) => {
|
|
16730
|
-
const w = (N) => /[.,!?;:]/.test(N),
|
|
16719
|
+
const w = (N) => /[.,!?;:]/.test(N), v = (N, j, P) => {
|
|
16731
16720
|
let L = "", D = "";
|
|
16732
16721
|
const $ = j > 0 ? N[j - 1] : "", M = j < N.length ? N[j] : "";
|
|
16733
16722
|
return j > 0 && ($ === "." || !w($) && $ !== " ") && (L = " "), j < N.length && !w(M) && M !== " " && (D = " "), {
|
|
@@ -16739,11 +16728,11 @@ const UndoRedo = () => {
|
|
|
16739
16728
|
if (T) {
|
|
16740
16729
|
const N = T.selectionStart || 0, j = T.value || "", P = T.selectionEnd || N;
|
|
16741
16730
|
if (P > N) {
|
|
16742
|
-
const O = `{{${A}}}`, { text: H } =
|
|
16731
|
+
const O = `{{${A}}}`, { text: H } = v(j, N, O), R = j.slice(0, N) + H + j.slice(P);
|
|
16743
16732
|
u(R);
|
|
16744
16733
|
return;
|
|
16745
16734
|
}
|
|
16746
|
-
const D = `{{${A}}}`, { text: $ } =
|
|
16735
|
+
const D = `{{${A}}}`, { text: $ } = v(j, N, D), M = j.slice(0, N) + $ + j.slice(N);
|
|
16747
16736
|
u(M);
|
|
16748
16737
|
}
|
|
16749
16738
|
}, []);
|
|
@@ -16752,7 +16741,7 @@ const UndoRedo = () => {
|
|
|
16752
16741
|
"form",
|
|
16753
16742
|
{
|
|
16754
16743
|
onSubmit: (A) => {
|
|
16755
|
-
A.preventDefault(), p !== null ? E() :
|
|
16744
|
+
A.preventDefault(), p !== null ? E() : S();
|
|
16756
16745
|
},
|
|
16757
16746
|
className: "space-y-3",
|
|
16758
16747
|
children: [
|
|
@@ -16807,8 +16796,8 @@ const UndoRedo = () => {
|
|
|
16807
16796
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: A.value.toString() })
|
|
16808
16797
|
] }),
|
|
16809
16798
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
16810
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
16811
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
16799
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(w), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
16800
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
16812
16801
|
] })
|
|
16813
16802
|
] }, w)) })
|
|
16814
16803
|
] });
|
|
@@ -16952,7 +16941,7 @@ const PartialWrapper = ({ partialBlockId: r }) => {
|
|
|
16952
16941
|
component: DefaultTopBar
|
|
16953
16942
|
}, registerChaiTopBar = (r) => {
|
|
16954
16943
|
TOP_BAR.component = r;
|
|
16955
|
-
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), ManageDesignTokens = React__default.lazy(() => import("./manage-design-tokens-
|
|
16944
|
+
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), ManageDesignTokens = React__default.lazy(() => import("./manage-design-tokens-BHCCrWFS.js")), DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(StackIcon, { className: "h-5 w-5" }) }), AddBlocksButton = ({ isActive: r, show: n }) => useIsDragAndDropEnabled() && /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-5 w-5" }) }), AskAiButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(AiIcon, {}) });
|
|
16956
16945
|
registerChaiSidebarPanel("add-block", {
|
|
16957
16946
|
button: AddBlocksButton,
|
|
16958
16947
|
label: "Add Blocks",
|
|
@@ -16985,7 +16974,7 @@ const RootLayout = () => {
|
|
|
16985
16974
|
console.log("handleMenuItemClick", w, n), o(n === w ? null : w);
|
|
16986
16975
|
},
|
|
16987
16976
|
[n, o]
|
|
16988
|
-
), { t: x } = useTranslation(), y = useMemo(() => [...p, ...h], [p, h]),
|
|
16977
|
+
), { t: x } = useTranslation(), y = useMemo(() => [...p, ...h], [p, h]), S = useBuilderProp("htmlDir", "ltr"), k = find(y, { id: n }) ?? first$1(y), C = get(k, "width", DEFAULT_PANEL_WIDTH);
|
|
16989
16978
|
useEffect(() => {
|
|
16990
16979
|
if (n !== null) {
|
|
16991
16980
|
const w = find(y, { id: n });
|
|
@@ -16995,8 +16984,8 @@ const RootLayout = () => {
|
|
|
16995
16984
|
const E = useMemo(() => {
|
|
16996
16985
|
if (n === null) return 0;
|
|
16997
16986
|
const w = find(y, { id: n });
|
|
16998
|
-
return get(w, "view", "standard") === "standard" ?
|
|
16999
|
-
}, [n,
|
|
16987
|
+
return get(w, "view", "standard") === "standard" ? C : i;
|
|
16988
|
+
}, [n, C, i, y]), B = useCallback(() => {
|
|
17000
16989
|
o(a.current);
|
|
17001
16990
|
}, [o, n]), I = useCallback(() => {
|
|
17002
16991
|
o("outline");
|
|
@@ -17010,7 +16999,7 @@ const RootLayout = () => {
|
|
|
17010
16999
|
},
|
|
17011
17000
|
[b]
|
|
17012
17001
|
);
|
|
17013
|
-
return /* @__PURE__ */ jsx("div", { dir:
|
|
17002
|
+
return /* @__PURE__ */ jsx("div", { dir: S, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
|
|
17014
17003
|
/* @__PURE__ */ jsxs(
|
|
17015
17004
|
"div",
|
|
17016
17005
|
{
|
|
@@ -17020,7 +17009,7 @@ const RootLayout = () => {
|
|
|
17020
17009
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(r, {}) }) }),
|
|
17021
17010
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
17022
17011
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
17023
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: g.map((w,
|
|
17012
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: g.map((w, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
17024
17013
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
17025
17014
|
position: "top",
|
|
17026
17015
|
panelId: w.id,
|
|
@@ -17028,9 +17017,9 @@ const RootLayout = () => {
|
|
|
17028
17017
|
show: () => A(w.id)
|
|
17029
17018
|
}) }),
|
|
17030
17019
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
17031
|
-
] }, "button-top-" +
|
|
17020
|
+
] }, "button-top-" + v)) }),
|
|
17032
17021
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
17033
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: f == null ? void 0 : f.map((w,
|
|
17022
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: f == null ? void 0 : f.map((w, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
17034
17023
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
17035
17024
|
position: "bottom",
|
|
17036
17025
|
panelId: w.id,
|
|
@@ -17038,7 +17027,7 @@ const RootLayout = () => {
|
|
|
17038
17027
|
show: () => A(w.id)
|
|
17039
17028
|
}) }),
|
|
17040
17029
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
17041
|
-
] }, "button-bottom-" +
|
|
17030
|
+
] }, "button-bottom-" + v)) })
|
|
17042
17031
|
] }),
|
|
17043
17032
|
/* @__PURE__ */ jsx(
|
|
17044
17033
|
motion.div,
|
|
@@ -17048,15 +17037,15 @@ const RootLayout = () => {
|
|
|
17048
17037
|
initial: { width: E },
|
|
17049
17038
|
animate: { width: E },
|
|
17050
17039
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
17051
|
-
children: n !== null && get(
|
|
17040
|
+
children: n !== null && get(k, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
17052
17041
|
/* @__PURE__ */ jsx(
|
|
17053
17042
|
"div",
|
|
17054
17043
|
{
|
|
17055
|
-
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(
|
|
17056
|
-
children: /* @__PURE__ */ jsx("span", { children: x(get(
|
|
17044
|
+
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(k, "isInternal", !1) ? "" : "w-64"}`,
|
|
17045
|
+
children: /* @__PURE__ */ jsx("span", { children: x(get(k, "label", "")) })
|
|
17057
17046
|
}
|
|
17058
17047
|
),
|
|
17059
|
-
/* @__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(
|
|
17048
|
+
/* @__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(k, "panel", NoopComponent), {}) }) })
|
|
17060
17049
|
] })
|
|
17061
17050
|
}
|
|
17062
17051
|
),
|
|
@@ -17119,34 +17108,34 @@ const RootLayout = () => {
|
|
|
17119
17108
|
}
|
|
17120
17109
|
),
|
|
17121
17110
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
17122
|
-
n !== null && get(
|
|
17111
|
+
n !== null && get(k, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(
|
|
17123
17112
|
SheetContent,
|
|
17124
17113
|
{
|
|
17125
17114
|
side: "left",
|
|
17126
17115
|
className: "flex flex-col gap-0 p-0 sm:max-w-full",
|
|
17127
|
-
style: { width: `${
|
|
17116
|
+
style: { width: `${C}px` },
|
|
17128
17117
|
children: [
|
|
17129
17118
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
17130
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
17131
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
17119
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(k, "icon", null) }),
|
|
17120
|
+
/* @__PURE__ */ jsx("span", { children: x(get(k, "label", "")) })
|
|
17132
17121
|
] }) }),
|
|
17133
|
-
/* @__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(
|
|
17122
|
+
/* @__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(k, "panel", NoopComponent), {
|
|
17134
17123
|
close: I
|
|
17135
17124
|
}) }) })
|
|
17136
17125
|
]
|
|
17137
17126
|
}
|
|
17138
17127
|
) }),
|
|
17139
17128
|
" ",
|
|
17140
|
-
n !== null && get(
|
|
17129
|
+
n !== null && get(k, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${C}px` }, children: [
|
|
17141
17130
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
17142
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
17143
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
17131
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(k, "icon", null) }),
|
|
17132
|
+
/* @__PURE__ */ jsx("span", { children: x(get(k, "label", "")) })
|
|
17144
17133
|
] }) }),
|
|
17145
|
-
/* @__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(
|
|
17134
|
+
/* @__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(k, "panel", NoopComponent), {
|
|
17146
17135
|
close: I
|
|
17147
17136
|
}) }) })
|
|
17148
17137
|
] }) }),
|
|
17149
|
-
n !== null && get(
|
|
17138
|
+
n !== null && get(k, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
17150
17139
|
motion.div,
|
|
17151
17140
|
{
|
|
17152
17141
|
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
@@ -17165,12 +17154,12 @@ const RootLayout = () => {
|
|
|
17165
17154
|
children: [
|
|
17166
17155
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
17167
17156
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
17168
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
17169
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
17157
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(k, "icon", null) }),
|
|
17158
|
+
/* @__PURE__ */ jsx("span", { children: x(get(k, "label", "")) })
|
|
17170
17159
|
] }),
|
|
17171
17160
|
/* @__PURE__ */ jsx(Button, { onClick: () => B(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
17172
17161
|
] }),
|
|
17173
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
17162
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(k, "panel", NoopComponent), {
|
|
17174
17163
|
close: I
|
|
17175
17164
|
}) }) })
|
|
17176
17165
|
]
|
|
@@ -17231,8 +17220,8 @@ const RootLayout = () => {
|
|
|
17231
17220
|
const b = i.toLowerCase();
|
|
17232
17221
|
return Object.fromEntries(
|
|
17233
17222
|
Object.entries(a).filter(([x, y]) => {
|
|
17234
|
-
var
|
|
17235
|
-
return (x == null ? void 0 : x.toLowerCase().includes(b)) || ((
|
|
17223
|
+
var S;
|
|
17224
|
+
return (x == null ? void 0 : x.toLowerCase().includes(b)) || ((S = y == null ? void 0 : y.description) == null ? void 0 : S.toLowerCase().includes(b));
|
|
17236
17225
|
})
|
|
17237
17226
|
);
|
|
17238
17227
|
}, [a, i]), f = (b) => {
|
|
@@ -17242,7 +17231,7 @@ const RootLayout = () => {
|
|
|
17242
17231
|
});
|
|
17243
17232
|
}, m = (b) => {
|
|
17244
17233
|
if (!c) return;
|
|
17245
|
-
const x = b.clientX - u.x, y = b.clientY - u.y,
|
|
17234
|
+
const x = b.clientX - u.x, y = b.clientY - u.y, S = b.currentTarget, k = S.offsetWidth, C = S.offsetHeight, E = window.innerWidth - k, B = window.innerHeight - C, I = Math.max(0, Math.min(x, E)), A = Math.max(0, Math.min(y, B));
|
|
17246
17235
|
o(I, A);
|
|
17247
17236
|
}, g = () => {
|
|
17248
17237
|
d(!1);
|
|
@@ -17497,10 +17486,10 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
|
|
|
17497
17486
|
return x;
|
|
17498
17487
|
x.d.clear();
|
|
17499
17488
|
let y = !0;
|
|
17500
|
-
function
|
|
17489
|
+
function S() {
|
|
17501
17490
|
i.has(n) && (b(r, n), f(r), h(r));
|
|
17502
17491
|
}
|
|
17503
|
-
function
|
|
17492
|
+
function k(A) {
|
|
17504
17493
|
var w;
|
|
17505
17494
|
if (isSelfAtom(n, A)) {
|
|
17506
17495
|
const T = p(r, A);
|
|
@@ -17511,17 +17500,17 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
|
|
|
17511
17500
|
throw new Error("no atom init");
|
|
17512
17501
|
return returnAtomValue(T);
|
|
17513
17502
|
}
|
|
17514
|
-
const
|
|
17503
|
+
const v = m(r, A);
|
|
17515
17504
|
try {
|
|
17516
|
-
return returnAtomValue(
|
|
17505
|
+
return returnAtomValue(v);
|
|
17517
17506
|
} finally {
|
|
17518
|
-
x.d.set(A,
|
|
17507
|
+
x.d.set(A, v.n), isPendingPromise(x.v) && addPendingPromiseToDependency(n, x.v, v), (w = i.get(A)) == null || w.t.add(n), y || S();
|
|
17519
17508
|
}
|
|
17520
17509
|
}
|
|
17521
|
-
let
|
|
17510
|
+
let C, E;
|
|
17522
17511
|
const B = {
|
|
17523
17512
|
get signal() {
|
|
17524
|
-
return
|
|
17513
|
+
return C || (C = new AbortController()), C.signal;
|
|
17525
17514
|
},
|
|
17526
17515
|
get setSelf() {
|
|
17527
17516
|
return !E && isActuallyWritableAtom(n) && (E = (...A) => {
|
|
@@ -17535,8 +17524,8 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
|
|
|
17535
17524
|
}
|
|
17536
17525
|
}, I = x.n;
|
|
17537
17526
|
try {
|
|
17538
|
-
const A = u(r, n,
|
|
17539
|
-
return setAtomStateValueOrPromise(r, n, A), isPromiseLike$1(A) && (registerAbortHandler(A, () =>
|
|
17527
|
+
const A = u(r, n, k, B);
|
|
17528
|
+
return setAtomStateValueOrPromise(r, n, A), isPromiseLike$1(A) && (registerAbortHandler(A, () => C == null ? void 0 : C.abort()), A.then(S, S)), x;
|
|
17540
17529
|
} catch (A) {
|
|
17541
17530
|
return delete x.v, x.e = A, ++x.n, x;
|
|
17542
17531
|
} finally {
|
|
@@ -17554,18 +17543,18 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
|
|
|
17554
17543
|
}, writeAtomState = (r, n, ...o) => {
|
|
17555
17544
|
const a = getBuildingBlocks(r), i = a[3], l = a[6], c = a[8], d = a[11], u = a[12], p = a[13], h = a[14], f = a[15], m = a[17];
|
|
17556
17545
|
let g = !0;
|
|
17557
|
-
const b = (y) => returnAtomValue(h(r, y)), x = (y, ...
|
|
17558
|
-
var
|
|
17559
|
-
const
|
|
17546
|
+
const b = (y) => returnAtomValue(h(r, y)), x = (y, ...S) => {
|
|
17547
|
+
var k;
|
|
17548
|
+
const C = d(r, y);
|
|
17560
17549
|
try {
|
|
17561
17550
|
if (isSelfAtom(n, y)) {
|
|
17562
17551
|
if (!hasInitialValue(y))
|
|
17563
17552
|
throw new Error("atom not writable");
|
|
17564
|
-
const E =
|
|
17565
|
-
setAtomStateValueOrPromise(r, y, B), m(r, y), E !==
|
|
17553
|
+
const E = C.n, B = S[0];
|
|
17554
|
+
setAtomStateValueOrPromise(r, y, B), m(r, y), E !== C.n && (i.add(y), (k = l.c) == null || k.call(l, y), f(r, y));
|
|
17566
17555
|
return;
|
|
17567
17556
|
} else
|
|
17568
|
-
return writeAtomState(r, y, ...
|
|
17557
|
+
return writeAtomState(r, y, ...S);
|
|
17569
17558
|
} finally {
|
|
17570
17559
|
g || (p(r), u(r));
|
|
17571
17560
|
}
|
|
@@ -17606,19 +17595,19 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
|
|
|
17606
17595
|
}, i.set(n, b), (o = c.m) == null || o.call(c, n), isActuallyWritableAtom(n)) {
|
|
17607
17596
|
const x = () => {
|
|
17608
17597
|
let y = !0;
|
|
17609
|
-
const
|
|
17598
|
+
const S = (...k) => {
|
|
17610
17599
|
try {
|
|
17611
|
-
return m(r, n, ...
|
|
17600
|
+
return m(r, n, ...k);
|
|
17612
17601
|
} finally {
|
|
17613
17602
|
y || (h(r), p(r));
|
|
17614
17603
|
}
|
|
17615
17604
|
};
|
|
17616
17605
|
try {
|
|
17617
|
-
const
|
|
17618
|
-
|
|
17606
|
+
const k = d(r, n, S);
|
|
17607
|
+
k && (b.u = () => {
|
|
17619
17608
|
y = !0;
|
|
17620
17609
|
try {
|
|
17621
|
-
|
|
17610
|
+
k();
|
|
17622
17611
|
} finally {
|
|
17623
17612
|
y = !1;
|
|
17624
17613
|
}
|
|
@@ -17971,10 +17960,10 @@ function domToJsx(r, n = 0) {
|
|
|
17971
17960
|
} else if (m.name === "style" && m.value) {
|
|
17972
17961
|
const g = m.value.split(";").reduce(
|
|
17973
17962
|
(b, x) => {
|
|
17974
|
-
const [y,
|
|
17975
|
-
if (y &&
|
|
17976
|
-
const
|
|
17977
|
-
b[
|
|
17963
|
+
const [y, S] = x.split(":").map((k) => k.trim());
|
|
17964
|
+
if (y && S) {
|
|
17965
|
+
const k = y.replace(/-([a-z])/g, (C) => C[1].toUpperCase());
|
|
17966
|
+
b[k] = S.replace(/['"]/g, "");
|
|
17978
17967
|
}
|
|
17979
17968
|
return b;
|
|
17980
17969
|
},
|
|
@@ -18000,7 +17989,7 @@ function domToJsx(r, n = 0) {
|
|
|
18000
17989
|
(m, g) => {
|
|
18001
17990
|
const [b, x] = g.split(":").map((y) => y.trim());
|
|
18002
17991
|
if (b && x) {
|
|
18003
|
-
const y = b.replace(/-([a-z])/g, (
|
|
17992
|
+
const y = b.replace(/-([a-z])/g, (S) => S[1].toUpperCase());
|
|
18004
17993
|
m[y] = x.replace(/['"]/g, "");
|
|
18005
17994
|
}
|
|
18006
17995
|
return m;
|
|
@@ -18073,7 +18062,7 @@ ${i}${i}${l == null ? void 0 : l.trimEnd()}
|
|
|
18073
18062
|
${i})
|
|
18074
18063
|
}`, { jsx: l, html: formatHtml(c), componentName: a };
|
|
18075
18064
|
}, ExportCodeModalContent = ({ tab: r }) => {
|
|
18076
|
-
var
|
|
18065
|
+
var S;
|
|
18077
18066
|
const { t: n } = useTranslation(), [o, a] = useState({ html: "", jsx: "" }), i = useSelectedBlock(), l = useBlocksHtmlForAi(), [c, d] = useState(""), [u, p] = useState(!1), h = () => {
|
|
18078
18067
|
switch (r) {
|
|
18079
18068
|
case "js":
|
|
@@ -18098,52 +18087,52 @@ ${i})
|
|
|
18098
18087
|
}, m = useCallback(async () => {
|
|
18099
18088
|
try {
|
|
18100
18089
|
p(!1);
|
|
18101
|
-
let
|
|
18102
|
-
|
|
18103
|
-
const
|
|
18090
|
+
let k = l({ blockId: i == null ? void 0 : i._id, additionalCoreBlocks: ["Icon"] });
|
|
18091
|
+
k = k.replace(/\s*bid=["'][^"']*["']/g, "");
|
|
18092
|
+
const C = r === "ts", {
|
|
18104
18093
|
jsx: E,
|
|
18105
18094
|
html: B,
|
|
18106
18095
|
componentName: I
|
|
18107
18096
|
} = await getExportedCoded({
|
|
18108
18097
|
selectedBlock: i,
|
|
18109
|
-
html:
|
|
18110
|
-
isTypeScript:
|
|
18098
|
+
html: k,
|
|
18099
|
+
isTypeScript: C
|
|
18111
18100
|
});
|
|
18112
18101
|
a({ html: B, jsx: E }), d(I), p(!0);
|
|
18113
18102
|
} catch {
|
|
18114
|
-
const
|
|
18115
|
-
a({ html:
|
|
18103
|
+
const C = "<div>Export failed. Close the modal and try again.</div>";
|
|
18104
|
+
a({ html: C, jsx: C }), toast.error(n("Failed to generate export HTML"));
|
|
18116
18105
|
}
|
|
18117
18106
|
}, [n, r, i, l]);
|
|
18118
18107
|
useEffect(() => {
|
|
18119
18108
|
m();
|
|
18120
18109
|
}, [m, r]);
|
|
18121
18110
|
const g = useCallback(
|
|
18122
|
-
async (
|
|
18111
|
+
async (k) => {
|
|
18123
18112
|
try {
|
|
18124
|
-
navigator.clipboard.writeText(
|
|
18113
|
+
navigator.clipboard.writeText(k), toast.success(n("Export code copied!"));
|
|
18125
18114
|
} catch {
|
|
18126
18115
|
toast.error(n("Failed to copy export code"));
|
|
18127
18116
|
}
|
|
18128
18117
|
},
|
|
18129
18118
|
[n]
|
|
18130
|
-
), b = (
|
|
18131
|
-
const
|
|
18119
|
+
), b = (k) => {
|
|
18120
|
+
const C = new Blob([k], { type: "text/jsx" }), E = URL.createObjectURL(C), B = document.createElement("a");
|
|
18132
18121
|
B.href = E, B.download = h(), document.body.appendChild(B), B.click(), URL.revokeObjectURL(E), document.body.removeChild(B), toast.success(n("Export code downloaded successfully!"));
|
|
18133
18122
|
}, x = /* @__PURE__ */ jsxs("span", { children: [
|
|
18134
18123
|
"Download ",
|
|
18135
18124
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-light text-gray-300", children: h() })
|
|
18136
18125
|
] }), y = useMemo(() => {
|
|
18137
|
-
const
|
|
18126
|
+
const k = { extend: shadcnTheme() }, C = JSON.stringify(k, null, 2);
|
|
18138
18127
|
return `{
|
|
18139
18128
|
// Your tailwind config ...
|
|
18140
18129
|
|
|
18141
|
-
"theme": ${
|
|
18130
|
+
"theme": ${C == null ? void 0 : C.split(`
|
|
18142
18131
|
`).join(`
|
|
18143
18132
|
`)},
|
|
18144
18133
|
}`;
|
|
18145
18134
|
}, []);
|
|
18146
|
-
return ((
|
|
18135
|
+
return ((S = o == null ? void 0 : o.jsx) == null ? void 0 : S.length) > 0 && u ? /* @__PURE__ */ jsx(
|
|
18147
18136
|
CodeDisplay,
|
|
18148
18137
|
{
|
|
18149
18138
|
onCopy: g,
|