@chaibuilder/sdk 3.1.30 → 3.1.32
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-DiMrcGU6.cjs → code-editor-DniWNMiF.cjs} +1 -1
- package/dist/{code-editor-C9OjZ4pO.js → code-editor-tNvYQ21U.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -2
- package/dist/core.js +1 -1
- package/dist/{index-BxU793-d.cjs → index-Cw-O8A8U.cjs} +6 -6
- package/dist/{index-DbG1Z1b3.js → index-x0hEzxrt.js} +709 -596
- package/dist/{rte-widget-modal-CMfi2JfL.cjs → rte-widget-modal-BjpCMgJv.cjs} +1 -1
- package/dist/{rte-widget-modal-BtmZDq6x.js → rte-widget-modal-vV5HE2hd.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Y = Object.defineProperty;
|
|
2
2
|
var X = (o, n, r) => n in o ? Y(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
-
var
|
|
3
|
+
var G = (o, n, r) => X(o, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { getRegisteredChaiBlock, getDefaultBlockProps, syncBlocksWithDefaults, useRegisteredFonts, useRegisteredChaiBlocks, getBlockFormSchemas } from "@chaibuilder/runtime";
|
|
6
6
|
import { has, get, filter, findIndex, find, flatten, map, includes, without, compact, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, forEach, range, flattenDeep, set, unset, chunk, cloneDeep, isNull, kebabCase, throttle, some, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy, round, reverse, camelCase } from "lodash-es";
|
|
@@ -22,7 +22,7 @@ import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebou
|
|
|
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, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, 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, a4 as DialogDescription, a5 as DialogFooter, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./tooltip-DUosa-uC.js";
|
|
25
|
-
import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, GearIcon, DragHandleDots2Icon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, ChevronRightIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, FontStyleIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, SquareIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, StackIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, ZoomInIcon, DotsHorizontalIcon, LightningBoltIcon, Pencil1Icon } from "@radix-ui/react-icons";
|
|
25
|
+
import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, GearIcon, DragHandleDots2Icon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, ChevronRightIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, FontStyleIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, SquareIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, StackIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, ZoomInIcon, DotsHorizontalIcon, LightningBoltIcon, GlobeIcon, Pencil1Icon } from "@radix-ui/react-icons";
|
|
26
26
|
import i18n, { t } from "i18next";
|
|
27
27
|
import ReactDOM, { createPortal } from "react-dom";
|
|
28
28
|
import { HexAlphaColorPicker } from "react-colorful";
|
|
@@ -95,7 +95,7 @@ import.meta.vitest && describe("canDropBlock Function", () => {
|
|
|
95
95
|
});
|
|
96
96
|
class PubSub {
|
|
97
97
|
constructor() {
|
|
98
|
-
|
|
98
|
+
G(this, "subscribers", /* @__PURE__ */ new Map());
|
|
99
99
|
}
|
|
100
100
|
subscribe(n, r) {
|
|
101
101
|
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
@@ -687,7 +687,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
687
687
|
];
|
|
688
688
|
class StructureRuleRegistry {
|
|
689
689
|
constructor() {
|
|
690
|
-
|
|
690
|
+
G(this, "rules", [...CORE_STRUCTURE_RULES]);
|
|
691
691
|
}
|
|
692
692
|
addRule(n) {
|
|
693
693
|
this.rules.push(n);
|
|
@@ -1059,13 +1059,13 @@ const undoRedoStateAtom = atom({
|
|
|
1059
1059
|
} = useBlocksStoreManager();
|
|
1060
1060
|
return {
|
|
1061
1061
|
moveBlocks: (x, b, y) => {
|
|
1062
|
-
const C = map(x, (
|
|
1063
|
-
const B = n.find((
|
|
1064
|
-
return { _id:
|
|
1065
|
-
}), k = C.find(({ _id:
|
|
1062
|
+
const C = map(x, (v) => {
|
|
1063
|
+
const B = n.find((j) => j._id === v)._parent || null, w = n.filter((j) => B ? j._parent === B : !j._parent).map((j) => j._id).indexOf(v);
|
|
1064
|
+
return { _id: v, oldParent: B, oldPosition: w };
|
|
1065
|
+
}), k = C.find(({ _id: v }) => v === x[0]);
|
|
1066
1066
|
k && k.oldParent === b && k.oldPosition === y || (l(x, b, y), o({
|
|
1067
|
-
undo: () => each(C, ({ _id:
|
|
1068
|
-
l([
|
|
1067
|
+
undo: () => each(C, ({ _id: v, oldParent: A, oldPosition: B }) => {
|
|
1068
|
+
l([v], A, B);
|
|
1069
1069
|
}),
|
|
1070
1070
|
redo: () => l(x, b, y)
|
|
1071
1071
|
}));
|
|
@@ -1078,7 +1078,7 @@ const undoRedoStateAtom = atom({
|
|
|
1078
1078
|
},
|
|
1079
1079
|
removeBlocks: (x) => {
|
|
1080
1080
|
var k;
|
|
1081
|
-
const b = (k = first(x)) == null ? void 0 : k._parent, C = n.filter((
|
|
1081
|
+
const b = (k = first(x)) == null ? void 0 : k._parent, C = n.filter((v) => b ? v._parent === b : !v._parent).indexOf(first(x));
|
|
1082
1082
|
i(map(x, "_id")), o({
|
|
1083
1083
|
undo: () => a(x, b, C),
|
|
1084
1084
|
redo: () => i(map(x, "_id"))
|
|
@@ -1090,8 +1090,8 @@ const undoRedoStateAtom = atom({
|
|
|
1090
1090
|
C = map(x, (k) => ({ _id: k, ...y }));
|
|
1091
1091
|
else {
|
|
1092
1092
|
const k = keys(b);
|
|
1093
|
-
C = map(x, (
|
|
1094
|
-
const A = n.find((_) => _._id ===
|
|
1093
|
+
C = map(x, (v) => {
|
|
1094
|
+
const A = n.find((_) => _._id === v), B = { _id: v };
|
|
1095
1095
|
return each(k, (_) => B[_] = A[_]), B;
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
@@ -1112,8 +1112,8 @@ const undoRedoStateAtom = atom({
|
|
|
1112
1112
|
updateMultipleBlocksProps: (x) => {
|
|
1113
1113
|
let b = [];
|
|
1114
1114
|
b = map(x, (y) => {
|
|
1115
|
-
const C = keys(y), k = n.find((A) => A._id === y._id),
|
|
1116
|
-
return each(C, (A) =>
|
|
1115
|
+
const C = keys(y), k = n.find((A) => A._id === y._id), v = {};
|
|
1116
|
+
return each(C, (A) => v[A] = k[A]), v;
|
|
1117
1117
|
}), c(x), o({
|
|
1118
1118
|
undo: () => c(b),
|
|
1119
1119
|
redo: () => c(x)
|
|
@@ -2602,21 +2602,21 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2602
2602
|
if (i) {
|
|
2603
2603
|
n(!0), a(null);
|
|
2604
2604
|
try {
|
|
2605
|
-
const y = p === u ? "" : p, C = x.toLowerCase().includes("translate the content"), k = f === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p, C) : [m(h, d)],
|
|
2605
|
+
const y = p === u ? "" : p, C = x.toLowerCase().includes("translate the content"), k = f === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p, C) : [m(h, d)], v = await i(f, addLangToPrompt(x, g, f), k, y), { blocks: A, error: B } = v;
|
|
2606
2606
|
if (B) {
|
|
2607
2607
|
a(B);
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
2610
|
if (f === "styles") {
|
|
2611
|
-
const _ = A.map((
|
|
2612
|
-
for (const
|
|
2613
|
-
|
|
2614
|
-
return
|
|
2611
|
+
const _ = A.map((w) => {
|
|
2612
|
+
for (const j in w)
|
|
2613
|
+
j !== "_id" && (w[j] = `${STYLES_KEY},${w[j]}`);
|
|
2614
|
+
return w;
|
|
2615
2615
|
});
|
|
2616
2616
|
c(_);
|
|
2617
2617
|
} else
|
|
2618
2618
|
l(A);
|
|
2619
|
-
b && b(
|
|
2619
|
+
b && b(v);
|
|
2620
2620
|
} catch (y) {
|
|
2621
2621
|
a(y);
|
|
2622
2622
|
} finally {
|
|
@@ -3527,29 +3527,29 @@ function calculateElementZone(o, n, r, a, i) {
|
|
|
3527
3527
|
}
|
|
3528
3528
|
}
|
|
3529
3529
|
function detectDropZone(o, n, r, a, i) {
|
|
3530
|
-
var
|
|
3530
|
+
var v, A, B, _;
|
|
3531
3531
|
const l = o.getAttribute("data-block-id"), c = o.getAttribute("data-block-type") || "Box";
|
|
3532
3532
|
if (!l)
|
|
3533
3533
|
return null;
|
|
3534
3534
|
let d = o.parentElement;
|
|
3535
3535
|
for (; d && !d.hasAttribute("data-block-id"); )
|
|
3536
3536
|
d = d.parentElement;
|
|
3537
|
-
const p = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), u = d ? getOrientation(d) : "vertical", g = getOrientation(o), m = isLeafBlock(c), f = !m && canAcceptChildBlock(c, a), h = ((
|
|
3537
|
+
const p = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), u = d ? getOrientation(d) : "vertical", g = getOrientation(o), m = isLeafBlock(c), f = !m && canAcceptChildBlock(c, a), h = ((v = i.defaultView) == null ? void 0 : v.scrollY) || 0, x = ((A = i.defaultView) == null ? void 0 : A.scrollX) || 0;
|
|
3538
3538
|
if (l === "canvas" && hasChildBlocks(o)) {
|
|
3539
|
-
const
|
|
3540
|
-
if (
|
|
3541
|
-
const S =
|
|
3539
|
+
const w = getChildBlocks(o), j = w[w.length - 1];
|
|
3540
|
+
if (j) {
|
|
3541
|
+
const S = j.getBoundingClientRect(), E = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = E.width - I - D, R = E.left + x + I;
|
|
3542
3542
|
return {
|
|
3543
3543
|
position: "after",
|
|
3544
3544
|
placeholderOrientation: "horizontal",
|
|
3545
3545
|
rect: {
|
|
3546
3546
|
top: S.bottom + h,
|
|
3547
|
-
left:
|
|
3547
|
+
left: R,
|
|
3548
3548
|
width: P,
|
|
3549
3549
|
height: 4
|
|
3550
3550
|
},
|
|
3551
|
-
targetElement:
|
|
3552
|
-
targetBlockId:
|
|
3551
|
+
targetElement: j,
|
|
3552
|
+
targetBlockId: j.getAttribute("data-block-id"),
|
|
3553
3553
|
targetParentId: "canvas",
|
|
3554
3554
|
isEmpty: !1,
|
|
3555
3555
|
confidence: 1
|
|
@@ -3557,44 +3557,44 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3557
3557
|
}
|
|
3558
3558
|
}
|
|
3559
3559
|
if (f && !m && hasChildBlocks(o)) {
|
|
3560
|
-
const
|
|
3561
|
-
if (
|
|
3562
|
-
const
|
|
3563
|
-
let
|
|
3564
|
-
if (
|
|
3565
|
-
const
|
|
3566
|
-
|
|
3560
|
+
const w = detectGapZone(o, n, r, g);
|
|
3561
|
+
if (w) {
|
|
3562
|
+
const j = w.before.getBoundingClientRect(), S = w.after.getBoundingClientRect(), E = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = getChildBlocks(o), R = getSiblingsInSameRow(P, w.before, g);
|
|
3563
|
+
let $ = 0;
|
|
3564
|
+
if (R.forEach((F) => {
|
|
3565
|
+
const O = F.getBoundingClientRect();
|
|
3566
|
+
O.height > $ && ($ = O.height);
|
|
3567
3567
|
}), g === "vertical") {
|
|
3568
|
-
const
|
|
3568
|
+
const F = E.width - I - D, O = E.left + x + I;
|
|
3569
3569
|
return {
|
|
3570
3570
|
position: "after",
|
|
3571
3571
|
placeholderOrientation: "horizontal",
|
|
3572
3572
|
rect: {
|
|
3573
|
-
top:
|
|
3574
|
-
left:
|
|
3575
|
-
width:
|
|
3573
|
+
top: j.bottom + h,
|
|
3574
|
+
left: O,
|
|
3575
|
+
width: F,
|
|
3576
3576
|
height: 4
|
|
3577
3577
|
},
|
|
3578
|
-
targetElement:
|
|
3579
|
-
targetBlockId:
|
|
3578
|
+
targetElement: w.before,
|
|
3579
|
+
targetBlockId: w.before.getAttribute("data-block-id"),
|
|
3580
3580
|
targetParentId: l,
|
|
3581
3581
|
isGapZone: !0,
|
|
3582
3582
|
confidence: 1
|
|
3583
3583
|
// High confidence for gap zones
|
|
3584
3584
|
};
|
|
3585
3585
|
} else {
|
|
3586
|
-
const
|
|
3586
|
+
const F = j.top + h, O = $ > 0 ? $ : Math.max(j.height, S.height);
|
|
3587
3587
|
return {
|
|
3588
3588
|
position: "after",
|
|
3589
3589
|
placeholderOrientation: "vertical",
|
|
3590
3590
|
rect: {
|
|
3591
|
-
top:
|
|
3592
|
-
left:
|
|
3591
|
+
top: F,
|
|
3592
|
+
left: j.right + x,
|
|
3593
3593
|
width: 4,
|
|
3594
|
-
height:
|
|
3594
|
+
height: O
|
|
3595
3595
|
},
|
|
3596
|
-
targetElement:
|
|
3597
|
-
targetBlockId:
|
|
3596
|
+
targetElement: w.before,
|
|
3597
|
+
targetBlockId: w.before.getAttribute("data-block-id"),
|
|
3598
3598
|
targetParentId: l,
|
|
3599
3599
|
isGapZone: !0,
|
|
3600
3600
|
confidence: 1
|
|
@@ -3603,80 +3603,80 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3603
3603
|
}
|
|
3604
3604
|
}
|
|
3605
3605
|
if (d && p) {
|
|
3606
|
-
const
|
|
3607
|
-
if (
|
|
3608
|
-
const
|
|
3609
|
-
if (
|
|
3610
|
-
const
|
|
3611
|
-
if (
|
|
3612
|
-
const
|
|
3606
|
+
const w = detectParentEdgeProximity(d, n, r, u);
|
|
3607
|
+
if (w) {
|
|
3608
|
+
const j = d.getBoundingClientRect(), S = window.getComputedStyle(d), E = parseFloat(S.paddingLeft) || 0, N = parseFloat(S.paddingRight) || 0, I = parseFloat(S.paddingTop) || 0, D = parseFloat(S.paddingBottom) || 0, P = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((_ = i.defaultView) == null ? void 0 : _.scrollX) || 0, $ = u === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
|
|
3609
|
+
if (w === "start") {
|
|
3610
|
+
const O = getChildBlocks(d)[0];
|
|
3611
|
+
if (O) {
|
|
3612
|
+
const L = O.getBoundingClientRect();
|
|
3613
3613
|
if (u === "vertical") {
|
|
3614
|
-
const T =
|
|
3614
|
+
const T = j.width - E - N, M = j.left + R + E;
|
|
3615
3615
|
return {
|
|
3616
3616
|
position: "before",
|
|
3617
|
-
placeholderOrientation:
|
|
3617
|
+
placeholderOrientation: $,
|
|
3618
3618
|
rect: {
|
|
3619
|
-
top:
|
|
3620
|
-
left:
|
|
3619
|
+
top: L.top + P - 2,
|
|
3620
|
+
left: M,
|
|
3621
3621
|
width: T,
|
|
3622
3622
|
height: 4
|
|
3623
3623
|
},
|
|
3624
|
-
targetElement:
|
|
3625
|
-
targetBlockId:
|
|
3624
|
+
targetElement: O,
|
|
3625
|
+
targetBlockId: O.getAttribute("data-block-id"),
|
|
3626
3626
|
targetParentId: p,
|
|
3627
3627
|
confidence: 0.9
|
|
3628
3628
|
};
|
|
3629
3629
|
} else {
|
|
3630
|
-
const T =
|
|
3630
|
+
const T = j.top + P + I, M = F.maxHeight > 0 ? F.maxHeight : j.height - I - D;
|
|
3631
3631
|
return {
|
|
3632
3632
|
position: "before",
|
|
3633
|
-
placeholderOrientation:
|
|
3633
|
+
placeholderOrientation: $,
|
|
3634
3634
|
rect: {
|
|
3635
3635
|
top: T,
|
|
3636
|
-
left:
|
|
3636
|
+
left: L.left + R - 2,
|
|
3637
3637
|
width: 4,
|
|
3638
|
-
height:
|
|
3638
|
+
height: M
|
|
3639
3639
|
},
|
|
3640
|
-
targetElement:
|
|
3641
|
-
targetBlockId:
|
|
3640
|
+
targetElement: O,
|
|
3641
|
+
targetBlockId: O.getAttribute("data-block-id"),
|
|
3642
3642
|
targetParentId: p,
|
|
3643
3643
|
confidence: 0.9
|
|
3644
3644
|
};
|
|
3645
3645
|
}
|
|
3646
3646
|
}
|
|
3647
3647
|
} else {
|
|
3648
|
-
const
|
|
3649
|
-
if (
|
|
3650
|
-
const T =
|
|
3648
|
+
const O = getChildBlocks(d), L = O[O.length - 1];
|
|
3649
|
+
if (L) {
|
|
3650
|
+
const T = L.getBoundingClientRect();
|
|
3651
3651
|
if (u === "vertical") {
|
|
3652
|
-
const
|
|
3652
|
+
const M = j.width - E - N, H = j.left + R + E;
|
|
3653
3653
|
return {
|
|
3654
3654
|
position: "after",
|
|
3655
|
-
placeholderOrientation:
|
|
3655
|
+
placeholderOrientation: $,
|
|
3656
3656
|
rect: {
|
|
3657
3657
|
top: T.bottom + P - 2,
|
|
3658
|
-
left:
|
|
3659
|
-
width:
|
|
3658
|
+
left: H,
|
|
3659
|
+
width: M,
|
|
3660
3660
|
height: 4
|
|
3661
3661
|
},
|
|
3662
|
-
targetElement:
|
|
3663
|
-
targetBlockId:
|
|
3662
|
+
targetElement: L,
|
|
3663
|
+
targetBlockId: L.getAttribute("data-block-id"),
|
|
3664
3664
|
targetParentId: p,
|
|
3665
3665
|
confidence: 0.9
|
|
3666
3666
|
};
|
|
3667
3667
|
} else {
|
|
3668
|
-
const
|
|
3668
|
+
const M = j.top + P + I, H = F.maxHeight > 0 ? F.maxHeight : j.height - I - D;
|
|
3669
3669
|
return {
|
|
3670
3670
|
position: "after",
|
|
3671
|
-
placeholderOrientation:
|
|
3671
|
+
placeholderOrientation: $,
|
|
3672
3672
|
rect: {
|
|
3673
|
-
top:
|
|
3674
|
-
left: T.right +
|
|
3673
|
+
top: M,
|
|
3674
|
+
left: T.right + R - 2,
|
|
3675
3675
|
width: 4,
|
|
3676
|
-
height:
|
|
3676
|
+
height: H
|
|
3677
3677
|
},
|
|
3678
|
-
targetElement:
|
|
3679
|
-
targetBlockId:
|
|
3678
|
+
targetElement: L,
|
|
3679
|
+
targetBlockId: L.getAttribute("data-block-id"),
|
|
3680
3680
|
targetParentId: p,
|
|
3681
3681
|
confidence: 0.9
|
|
3682
3682
|
};
|
|
@@ -3687,12 +3687,12 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3687
3687
|
}
|
|
3688
3688
|
let b = calculateElementZone(o, n, r, f, u);
|
|
3689
3689
|
if (m && b.position === "inside") {
|
|
3690
|
-
const
|
|
3690
|
+
const w = o.getBoundingClientRect();
|
|
3691
3691
|
u === "vertical" ? b = {
|
|
3692
|
-
position: (r -
|
|
3692
|
+
position: (r - w.top) / w.height < 0.5 ? "before" : "after",
|
|
3693
3693
|
confidence: b.confidence
|
|
3694
3694
|
} : b = {
|
|
3695
|
-
position: (n -
|
|
3695
|
+
position: (n - w.left) / w.width < 0.5 ? "before" : "after",
|
|
3696
3696
|
confidence: b.confidence
|
|
3697
3697
|
};
|
|
3698
3698
|
}
|
|
@@ -3759,46 +3759,46 @@ function getSiblingsInSameRow(o, n, r) {
|
|
|
3759
3759
|
});
|
|
3760
3760
|
}
|
|
3761
3761
|
function calculatePlaceholderRect(o, n, r, a, i) {
|
|
3762
|
-
var I,
|
|
3763
|
-
const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((
|
|
3764
|
-
let
|
|
3762
|
+
var I, D;
|
|
3763
|
+
const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((D = i.defaultView) == null ? void 0 : D.scrollX) || 0, u = parseFloat(c.marginTop) || 0, g = parseFloat(c.marginBottom) || 0, m = parseFloat(c.marginLeft) || 0, f = parseFloat(c.marginRight) || 0, h = parseFloat(c.paddingTop) || 0, x = parseFloat(c.paddingBottom) || 0, b = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, C = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, v = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, _ = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", j = n ? getChildBlocks(n) : [], S = getSiblingsInSameRow(j, o, w);
|
|
3764
|
+
let E = 0, N = 0;
|
|
3765
3765
|
if (S.forEach((P) => {
|
|
3766
|
-
const
|
|
3767
|
-
|
|
3766
|
+
const R = P.getBoundingClientRect();
|
|
3767
|
+
R.height > E && (E = R.height), R.width > N && (N = R.width);
|
|
3768
3768
|
}), r === "before")
|
|
3769
3769
|
if (a === "horizontal") {
|
|
3770
|
-
const P = C ? C.width - k -
|
|
3770
|
+
const P = C ? C.width - k - v : l.width, R = C ? C.left + p + k : l.left + p;
|
|
3771
3771
|
return {
|
|
3772
3772
|
top: l.top + d - u - 2,
|
|
3773
|
-
left:
|
|
3773
|
+
left: R,
|
|
3774
3774
|
width: P,
|
|
3775
3775
|
height: 4
|
|
3776
3776
|
};
|
|
3777
3777
|
} else {
|
|
3778
|
-
const P = l.top + d,
|
|
3778
|
+
const P = l.top + d, R = w === "horizontal" && E > 0 ? E : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
|
|
3779
3779
|
return {
|
|
3780
3780
|
top: P,
|
|
3781
3781
|
left: l.left + p - m - 2,
|
|
3782
3782
|
width: 4,
|
|
3783
|
-
height:
|
|
3783
|
+
height: R
|
|
3784
3784
|
};
|
|
3785
3785
|
}
|
|
3786
3786
|
else if (r === "after")
|
|
3787
3787
|
if (a === "horizontal") {
|
|
3788
|
-
const P = C ? C.width - k -
|
|
3788
|
+
const P = C ? C.width - k - v : l.width, R = C ? C.left + p + k : l.left + p;
|
|
3789
3789
|
return {
|
|
3790
3790
|
top: l.bottom + d + g - 2,
|
|
3791
|
-
left:
|
|
3791
|
+
left: R,
|
|
3792
3792
|
width: P,
|
|
3793
3793
|
height: 4
|
|
3794
3794
|
};
|
|
3795
3795
|
} else {
|
|
3796
|
-
const P = l.top + d,
|
|
3796
|
+
const P = l.top + d, R = w === "horizontal" && E > 0 ? E : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
|
|
3797
3797
|
return {
|
|
3798
3798
|
top: P,
|
|
3799
3799
|
left: l.right + p + f - 2,
|
|
3800
3800
|
width: 4,
|
|
3801
|
-
height:
|
|
3801
|
+
height: R
|
|
3802
3802
|
};
|
|
3803
3803
|
}
|
|
3804
3804
|
else
|
|
@@ -3873,23 +3873,23 @@ const LEAF_BLOCK_TYPES = [
|
|
|
3873
3873
|
const f = c.defaultView, h = f.innerHeight, x = f.scrollY, b = c.documentElement.scrollHeight;
|
|
3874
3874
|
p.current = m;
|
|
3875
3875
|
const y = m, C = h - m;
|
|
3876
|
-
let k = !1,
|
|
3877
|
-
if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && x > 0 ? (k = !0,
|
|
3876
|
+
let k = !1, v = null, A = 0;
|
|
3877
|
+
if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && x > 0 ? (k = !0, v = "up", A = y) : C < AUTO_SCROLL_CONFIG.EDGE_ZONE && x + h < b && (k = !0, v = "down", A = C), !k && d.current !== null) {
|
|
3878
3878
|
cancelAnimationFrame(d.current), d.current = null;
|
|
3879
3879
|
return;
|
|
3880
3880
|
}
|
|
3881
|
-
if (k &&
|
|
3882
|
-
const B = 1 - A / AUTO_SCROLL_CONFIG.EDGE_ZONE, _ = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B,
|
|
3881
|
+
if (k && v) {
|
|
3882
|
+
const B = 1 - A / AUTO_SCROLL_CONFIG.EDGE_ZONE, _ = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, w = () => {
|
|
3883
3883
|
if (!isDragging || !f) {
|
|
3884
3884
|
d.current = null;
|
|
3885
3885
|
return;
|
|
3886
3886
|
}
|
|
3887
|
-
const
|
|
3888
|
-
f.scrollBy(0,
|
|
3889
|
-
const S = f.scrollY,
|
|
3890
|
-
|
|
3887
|
+
const j = v === "up" ? -_ : _;
|
|
3888
|
+
f.scrollBy(0, j);
|
|
3889
|
+
const S = f.scrollY, E = S > 0, N = S + h < b, I = p.current, D = h - p.current;
|
|
3890
|
+
v === "up" && E && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || v === "down" && N && D < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
|
|
3891
3891
|
};
|
|
3892
|
-
d.current === null && (d.current = requestAnimationFrame(
|
|
3892
|
+
d.current === null && (d.current = requestAnimationFrame(w));
|
|
3893
3893
|
}
|
|
3894
3894
|
},
|
|
3895
3895
|
[c]
|
|
@@ -3913,30 +3913,30 @@ const LEAF_BLOCK_TYPES = [
|
|
|
3913
3913
|
const C = o._type || o.type;
|
|
3914
3914
|
if (!C)
|
|
3915
3915
|
return;
|
|
3916
|
-
const k = m.clientX,
|
|
3917
|
-
u(
|
|
3918
|
-
const A = detectDropZone(h, k,
|
|
3916
|
+
const k = m.clientX, v = m.clientY;
|
|
3917
|
+
u(v);
|
|
3918
|
+
const A = detectDropZone(h, k, v, C, c);
|
|
3919
3919
|
if (!A)
|
|
3920
3920
|
return;
|
|
3921
3921
|
const B = h.getAttribute("data-block-type") || "Box";
|
|
3922
3922
|
let _ = !1;
|
|
3923
|
-
const
|
|
3923
|
+
const w = LEAF_BLOCK_TYPES.includes(B);
|
|
3924
3924
|
if (A.position === "inside") {
|
|
3925
|
-
if (
|
|
3925
|
+
if (w || y && !canDropWithoutCircularReference(y, x, l))
|
|
3926
3926
|
return;
|
|
3927
3927
|
_ = canAcceptChildBlock(B, C);
|
|
3928
3928
|
} else {
|
|
3929
|
-
let S = h.parentElement,
|
|
3929
|
+
let S = h.parentElement, E = "Box";
|
|
3930
3930
|
for (; S && !S.hasAttribute("data-block-id"); )
|
|
3931
3931
|
S = S.parentElement;
|
|
3932
|
-
if (S && (
|
|
3932
|
+
if (S && (E = S.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
|
|
3933
3933
|
return;
|
|
3934
|
-
_ = canAcceptChildBlock(
|
|
3934
|
+
_ = canAcceptChildBlock(E, C);
|
|
3935
3935
|
}
|
|
3936
3936
|
if (!_)
|
|
3937
3937
|
return;
|
|
3938
3938
|
i(A.targetParentId);
|
|
3939
|
-
const
|
|
3939
|
+
const j = A.targetParentId || b;
|
|
3940
3940
|
r({
|
|
3941
3941
|
isVisible: !0,
|
|
3942
3942
|
isValid: !0,
|
|
@@ -3948,7 +3948,7 @@ const LEAF_BLOCK_TYPES = [
|
|
|
3948
3948
|
width: A.rect.width,
|
|
3949
3949
|
height: A.rect.height,
|
|
3950
3950
|
targetBlockId: A.targetBlockId,
|
|
3951
|
-
targetParentId:
|
|
3951
|
+
targetParentId: j
|
|
3952
3952
|
}), removeDropTargetAttributes$1(c), A.targetElement.setAttribute("data-drop-target", "true");
|
|
3953
3953
|
}, 300),
|
|
3954
3954
|
[c, o, r, a, i, l, u]
|
|
@@ -4085,14 +4085,14 @@ const useBlockDragStart = () => {
|
|
|
4085
4085
|
const y = r.targetBlockId, C = r.targetParentId;
|
|
4086
4086
|
if (!y)
|
|
4087
4087
|
return;
|
|
4088
|
-
const { parentId: k, index:
|
|
4088
|
+
const { parentId: k, index: v } = calculateInsertionIndex(
|
|
4089
4089
|
i,
|
|
4090
4090
|
y,
|
|
4091
4091
|
C,
|
|
4092
4092
|
r.position
|
|
4093
4093
|
);
|
|
4094
4094
|
if (o._id !== void 0)
|
|
4095
|
-
d([o._id], k === null ? void 0 : k,
|
|
4095
|
+
d([o._id], k === null ? void 0 : k, v), g(), u([]), p([o._id]);
|
|
4096
4096
|
else {
|
|
4097
4097
|
const B = o._type || o.type, _ = o != null && o.blocks ? isFunction(o == null ? void 0 : o.blocks) ? syncBlocksWithDefaults(o == null ? void 0 : o.blocks()) : o == null ? void 0 : o.blocks : null;
|
|
4098
4098
|
c(
|
|
@@ -4100,7 +4100,7 @@ const useBlockDragStart = () => {
|
|
|
4100
4100
|
blocks: [{ _type: B, _id: "partial-block", partialBlockId: o.partialBlockId }]
|
|
4101
4101
|
} : (_ == null ? void 0 : _.length) > 0 ? { blocks: [..._] } : { type: B },
|
|
4102
4102
|
k,
|
|
4103
|
-
|
|
4103
|
+
v
|
|
4104
4104
|
);
|
|
4105
4105
|
}
|
|
4106
4106
|
setTimeout(() => {
|
|
@@ -4387,9 +4387,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4387
4387
|
}),
|
|
4388
4388
|
size({
|
|
4389
4389
|
boundary: g == null ? void 0 : g.body,
|
|
4390
|
-
apply({ availableWidth:
|
|
4390
|
+
apply({ availableWidth: v, availableHeight: A, elements: B }) {
|
|
4391
4391
|
Object.assign(B.floating.style, {
|
|
4392
|
-
maxWidth: `${Math.max(200,
|
|
4392
|
+
maxWidth: `${Math.max(200, v)}px`,
|
|
4393
4393
|
maxHeight: `${Math.max(100, A)}px`
|
|
4394
4394
|
});
|
|
4395
4395
|
}
|
|
@@ -4400,11 +4400,11 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4400
4400
|
useResizeObserver(r, () => b(), r !== null), useResizeObserver(g == null ? void 0 : g.body, () => b(), (g == null ? void 0 : g.body) !== null);
|
|
4401
4401
|
const y = get(o, "_parent", null), C = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
4402
4402
|
useEffect(() => {
|
|
4403
|
-
let
|
|
4404
|
-
return r ? (
|
|
4405
|
-
|
|
4403
|
+
let v = null;
|
|
4404
|
+
return r ? (v = setTimeout(() => b(), 500), () => {
|
|
4405
|
+
v && clearTimeout(v);
|
|
4406
4406
|
}) : (b(), () => {
|
|
4407
|
-
|
|
4407
|
+
v && clearTimeout(v);
|
|
4408
4408
|
});
|
|
4409
4409
|
}, [r, o == null ? void 0 : o._id]);
|
|
4410
4410
|
const [, k] = useSidebarActivePanel();
|
|
@@ -4415,13 +4415,13 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
4415
4415
|
tabIndex: 0,
|
|
4416
4416
|
ref: x.setFloating,
|
|
4417
4417
|
style: h,
|
|
4418
|
-
onClick: (
|
|
4419
|
-
|
|
4418
|
+
onClick: (v) => {
|
|
4419
|
+
v.stopPropagation(), v.preventDefault();
|
|
4420
4420
|
},
|
|
4421
|
-
onMouseEnter: (
|
|
4422
|
-
|
|
4421
|
+
onMouseEnter: (v) => {
|
|
4422
|
+
v.stopPropagation(), c(null);
|
|
4423
4423
|
},
|
|
4424
|
-
onKeyDown: (
|
|
4424
|
+
onKeyDown: (v) => v.stopPropagation(),
|
|
4425
4425
|
className: `isolate z-[999] flex h-6 items-center justify-between bg-blue-500 py-2 text-xs text-white ${n ? "opacity-0" : ""}`,
|
|
4426
4426
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4427
4427
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -4613,17 +4613,17 @@ class Content extends Component {
|
|
|
4613
4613
|
class Frame extends Component {
|
|
4614
4614
|
constructor(r, a) {
|
|
4615
4615
|
super(r, a);
|
|
4616
|
-
|
|
4616
|
+
G(this, "setRef", (r) => {
|
|
4617
4617
|
this.nodeRef.current = r;
|
|
4618
4618
|
const { forwardedRef: a } = this.props;
|
|
4619
4619
|
typeof a == "function" ? a(r) : a && (a.current = r);
|
|
4620
4620
|
});
|
|
4621
|
-
|
|
4621
|
+
G(this, "handleLoad", () => {
|
|
4622
4622
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
4623
4623
|
});
|
|
4624
4624
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
4625
4625
|
// fallback to an interval to check if that's the case
|
|
4626
|
-
|
|
4626
|
+
G(this, "loadCheck", () => setInterval(() => {
|
|
4627
4627
|
this.handleLoad();
|
|
4628
4628
|
}, 500));
|
|
4629
4629
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -4660,7 +4660,7 @@ class Frame extends Component {
|
|
|
4660
4660
|
return delete r.head, delete r.initialContent, delete r.mountTarget, delete r.contentDidMount, delete r.contentDidUpdate, delete r.forwardedRef, /* @__PURE__ */ jsx("iframe", { ...r, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
|
-
|
|
4663
|
+
G(Frame, "defaultProps", {
|
|
4664
4664
|
style: {},
|
|
4665
4665
|
head: null,
|
|
4666
4666
|
children: void 0,
|
|
@@ -5063,8 +5063,8 @@ const getActiveClasses$1 = (o, n, r) => {
|
|
|
5063
5063
|
)
|
|
5064
5064
|
] });
|
|
5065
5065
|
}, RteColorPicker = ({ editor: o, from: n, menuRef: r }) => {
|
|
5066
|
-
var k,
|
|
5067
|
-
const a = (k = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : k.color, i = (
|
|
5066
|
+
var k, v;
|
|
5067
|
+
const a = (k = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : k.color, i = (v = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : v.color, [l, c] = useState(a || "#000000F2"), [d, p] = useState(i || "#00000057"), [u, g] = useDebouncedState(l, 150), [m, f] = useDebouncedState(d, 150), h = (A, B) => {
|
|
5068
5068
|
B ? (c(A), g(A)) : (o == null || o.chain().setColor(A).run(), c(A));
|
|
5069
5069
|
}, x = (A, B) => {
|
|
5070
5070
|
B ? (p(A), f(A)) : (o == null || o.chain().setHighlight({ color: A }).run(), p(A));
|
|
@@ -5426,8 +5426,8 @@ const RichTextEditor = memo(
|
|
|
5426
5426
|
onBlur: ({ editor: u, event: g }) => {
|
|
5427
5427
|
const m = g == null ? void 0 : g.relatedTarget, f = l.querySelector(".ProseMirror"), h = l.querySelector(".tippy-box"), x = l.querySelector("#chai-rich-text-menu-bar"), b = f == null ? void 0 : f.contains(m), y = h == null ? void 0 : h.contains(m), C = x == null ? void 0 : x.contains(m), k = window.document.getElementById("rte-widget-color-picker");
|
|
5428
5428
|
if (!b && !y && !C && !k) {
|
|
5429
|
-
const
|
|
5430
|
-
r(
|
|
5429
|
+
const v = (u == null ? void 0 : u.getHTML()) || "";
|
|
5430
|
+
r(v);
|
|
5431
5431
|
}
|
|
5432
5432
|
},
|
|
5433
5433
|
from: "canvas"
|
|
@@ -5529,37 +5529,37 @@ const RichTextEditor = memo(
|
|
|
5529
5529
|
({ block: o, children: n }) => {
|
|
5530
5530
|
const r = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), f = useUpdateBlocksProps(), { selectedLang: h } = useLanguages(), [, x] = useSelectedBlockIds(), b = useRef(null), y = i, { blockContent: C, blockType: k } = useMemo(() => {
|
|
5531
5531
|
var N;
|
|
5532
|
-
const
|
|
5533
|
-
let
|
|
5532
|
+
const w = o._type;
|
|
5533
|
+
let j = o[r];
|
|
5534
5534
|
const S = getRegisteredChaiBlock(o._type);
|
|
5535
|
-
return h && ((N = S == null ? void 0 : S.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (
|
|
5536
|
-
}, [o, h]),
|
|
5537
|
-
(
|
|
5535
|
+
return h && ((N = S == null ? void 0 : S.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (j = get(o, `${r}-${h}`)), { blockContent: j, blockType: w };
|
|
5536
|
+
}, [o, h]), v = useCallback(
|
|
5537
|
+
(w) => {
|
|
5538
5538
|
var S;
|
|
5539
|
-
const
|
|
5540
|
-
f([y], { [r]:
|
|
5539
|
+
const j = w || ((S = g.current) == null ? void 0 : S.innerText);
|
|
5540
|
+
f([y], { [r]: j }), u(null), c(null), d(-1), x([]), y && setTimeout(() => x([y]), 100);
|
|
5541
5541
|
},
|
|
5542
5542
|
[y, f, c, x, h]
|
|
5543
5543
|
), A = useDebouncedCallback(
|
|
5544
|
-
(
|
|
5545
|
-
f([y], { [r]:
|
|
5544
|
+
(w) => {
|
|
5545
|
+
f([y], { [r]: w });
|
|
5546
5546
|
},
|
|
5547
5547
|
[y, o, f, h],
|
|
5548
5548
|
1e3
|
|
5549
5549
|
), B = useCallback(
|
|
5550
|
-
(
|
|
5551
|
-
|
|
5552
|
-
const
|
|
5553
|
-
b.current = null, x([
|
|
5550
|
+
(w) => {
|
|
5551
|
+
w.preventDefault(), y && (b.current = y), v(), setTimeout(() => {
|
|
5552
|
+
const j = b.current;
|
|
5553
|
+
b.current = null, x([j]);
|
|
5554
5554
|
}, 100);
|
|
5555
5555
|
},
|
|
5556
5556
|
[x, y, h]
|
|
5557
5557
|
);
|
|
5558
5558
|
useEffect(() => {
|
|
5559
|
-
var
|
|
5559
|
+
var E;
|
|
5560
5560
|
if (!y) return;
|
|
5561
|
-
const
|
|
5562
|
-
S && ((
|
|
5561
|
+
const w = `[data-block-id="${y}"]`, j = l >= 0 ? `[data-block-index="${l}"]` : "", S = a.querySelector(`${w}${j}`);
|
|
5562
|
+
S && ((E = S == null ? void 0 : S.classList) == null || E.add("sr-only"), u(S));
|
|
5563
5563
|
}, [y, k, a, l]);
|
|
5564
5564
|
const _ = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
|
|
5565
5565
|
RichTextEditor,
|
|
@@ -5567,7 +5567,7 @@ const RichTextEditor = memo(
|
|
|
5567
5567
|
blockContent: C,
|
|
5568
5568
|
editingElement: p,
|
|
5569
5569
|
onChange: A,
|
|
5570
|
-
onClose:
|
|
5570
|
+
onClose: v,
|
|
5571
5571
|
onEscape: B
|
|
5572
5572
|
}
|
|
5573
5573
|
) : /* @__PURE__ */ jsx(
|
|
@@ -5576,11 +5576,11 @@ const RichTextEditor = memo(
|
|
|
5576
5576
|
editorRef: g,
|
|
5577
5577
|
blockContent: C,
|
|
5578
5578
|
editingElement: p,
|
|
5579
|
-
onClose:
|
|
5579
|
+
onClose: v,
|
|
5580
5580
|
onChange: A,
|
|
5581
5581
|
onEscape: B
|
|
5582
5582
|
}
|
|
5583
|
-
)) : null, [p, y, k, C,
|
|
5583
|
+
)) : null, [p, y, k, C, v, h]);
|
|
5584
5584
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5585
5585
|
_,
|
|
5586
5586
|
n
|
|
@@ -5615,7 +5615,7 @@ const RichTextEditor = memo(
|
|
|
5615
5615
|
blockAtom: n,
|
|
5616
5616
|
children: r
|
|
5617
5617
|
}) => {
|
|
5618
|
-
const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: h, key: x } = useContext(RepeaterContext), { mode: b } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom), C = useIsDragAndDropEnabled(), k = b === "edit",
|
|
5618
|
+
const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: h, key: x } = useContext(RepeaterContext), { mode: b } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom), C = useIsDragAndDropEnabled(), k = b === "edit", v = useDirectBlockDrag(), A = useMemo(
|
|
5619
5619
|
() => m ? applyBindingToBlockProps(applyLanguage(l, d, c), g, {
|
|
5620
5620
|
index: h,
|
|
5621
5621
|
key: x
|
|
@@ -5627,22 +5627,22 @@ const RichTextEditor = memo(
|
|
|
5627
5627
|
), _ = useMemo(
|
|
5628
5628
|
() => u(l._id, getBlockRuntimeProps(l._type)),
|
|
5629
5629
|
[l._id, l._type, u, getBlockRuntimeProps]
|
|
5630
|
-
),
|
|
5631
|
-
const
|
|
5630
|
+
), w = useMemo(() => {
|
|
5631
|
+
const D = {
|
|
5632
5632
|
"data-block-id": l._id,
|
|
5633
5633
|
"data-block-type": l._type,
|
|
5634
5634
|
"data-block-index": h
|
|
5635
5635
|
};
|
|
5636
5636
|
return k && C ? {
|
|
5637
|
-
...
|
|
5637
|
+
...D,
|
|
5638
5638
|
draggable: !0,
|
|
5639
|
-
onMouseDown:
|
|
5640
|
-
onDragStart:
|
|
5641
|
-
onDragEnd:
|
|
5642
|
-
} :
|
|
5643
|
-
}, [l._id, l._type, h, k, C,
|
|
5639
|
+
onMouseDown: v.onMouseDown,
|
|
5640
|
+
onDragStart: v.onDragStart,
|
|
5641
|
+
onDragEnd: v.onDragEnd
|
|
5642
|
+
} : D;
|
|
5643
|
+
}, [l._id, l._type, h, k, C, v]), j = useMemo(
|
|
5644
5644
|
() => ({
|
|
5645
|
-
blockProps:
|
|
5645
|
+
blockProps: w,
|
|
5646
5646
|
inBuilder: b === "edit",
|
|
5647
5647
|
lang: d || p,
|
|
5648
5648
|
...A,
|
|
@@ -5650,11 +5650,11 @@ const RichTextEditor = memo(
|
|
|
5650
5650
|
..._,
|
|
5651
5651
|
...o
|
|
5652
5652
|
}),
|
|
5653
|
-
[b,
|
|
5654
|
-
), S = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]),
|
|
5655
|
-
if (isNull(f) || !
|
|
5653
|
+
[b, w, d, p, A, B, _, o]
|
|
5654
|
+
), S = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), E = useMemo(() => get(l, "_show", !0), [l]);
|
|
5655
|
+
if (isNull(f) || !E) return null;
|
|
5656
5656
|
let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
5657
|
-
...
|
|
5657
|
+
...j,
|
|
5658
5658
|
children: r({
|
|
5659
5659
|
_id: l._id,
|
|
5660
5660
|
_type: l._type,
|
|
@@ -5837,7 +5837,7 @@ const RichTextEditor = memo(
|
|
|
5837
5837
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
5838
5838
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
5839
5839
|
] }) });
|
|
5840
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
5840
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-tNvYQ21U.js")), CanvasArea = () => {
|
|
5841
5841
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
5842
5842
|
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: [
|
|
5843
5843
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -5977,27 +5977,27 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
5977
5977
|
}, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
5978
5978
|
const { t: i } = useTranslation(), { selectedLang: l } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = usePageExternalData(), u = r.split(".").pop() || "", g = l ? `_${u}Id-${l}` : `_${u}Id`, m = isEmpty(l) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), f = get(c, g, m ? c == null ? void 0 : c.assetId : ""), h = useMemo(() => {
|
|
5979
5979
|
if (!o || !c || !/\{\{.*?\}\}/.test(o)) return o;
|
|
5980
|
-
const
|
|
5980
|
+
const v = { ...c, [u]: o }, A = applyBindingToBlockProps(v, p, { index: -1, key: "" });
|
|
5981
5981
|
return get(A, u, o);
|
|
5982
5982
|
}, [o, c, p, u]), x = !!f || h !== PLACEHOLDER_IMAGE, b = (k) => {
|
|
5983
|
-
const
|
|
5984
|
-
if (
|
|
5985
|
-
n(
|
|
5986
|
-
const A =
|
|
5983
|
+
const v = isArray(k) ? first(k) : k;
|
|
5984
|
+
if (v) {
|
|
5985
|
+
n(v == null ? void 0 : v.url);
|
|
5986
|
+
const A = v == null ? void 0 : v.width, B = v == null ? void 0 : v.height, _ = g.includes("mobile");
|
|
5987
5987
|
if (c != null && c._id) {
|
|
5988
|
-
const
|
|
5988
|
+
const w = {
|
|
5989
5989
|
...A && { [_ ? "mobileWidth" : "width"]: A },
|
|
5990
5990
|
...B && { [_ ? "mobileHeight" : "height"]: B },
|
|
5991
|
-
...
|
|
5991
|
+
...v.description && { alt: v.description }
|
|
5992
5992
|
};
|
|
5993
|
-
if (set(
|
|
5994
|
-
d([c._id],
|
|
5993
|
+
if (set(w, g, v.id), isEmpty(w)) return;
|
|
5994
|
+
d([c._id], w);
|
|
5995
5995
|
}
|
|
5996
5996
|
}
|
|
5997
5997
|
}, y = useCallback(() => {
|
|
5998
5998
|
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
5999
|
-
const k = {},
|
|
6000
|
-
set(k, g, ""), set(k,
|
|
5999
|
+
const k = {}, v = g.includes("mobile");
|
|
6000
|
+
set(k, g, ""), set(k, v ? "mobileWidth" : "width", ""), set(k, v ? "mobileHeight" : "height", ""), d([c._id], k);
|
|
6001
6001
|
}
|
|
6002
6002
|
}, [n, c == null ? void 0 : c._id, d, g]), C = getFileName(h);
|
|
6003
6003
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
|
|
@@ -6162,11 +6162,11 @@ const DataBindingSelector = ({
|
|
|
6162
6162
|
n(`{{${m}}}`, {}, r);
|
|
6163
6163
|
return;
|
|
6164
6164
|
}
|
|
6165
|
-
const h = (C) => /[.,!?;:]/.test(C), x = (C, k,
|
|
6165
|
+
const h = (C) => /[.,!?;:]/.test(C), x = (C, k, v) => {
|
|
6166
6166
|
let A = "", B = "";
|
|
6167
|
-
const _ = k > 0 ? C[k - 1] : "",
|
|
6168
|
-
return k > 0 && (_ === "." || !h(_) && _ !== " ") && (A = " "), k < C.length && !h(
|
|
6169
|
-
text: A +
|
|
6167
|
+
const _ = k > 0 ? C[k - 1] : "", w = k < C.length ? C[k] : "";
|
|
6168
|
+
return k > 0 && (_ === "." || !h(_) && _ !== " ") && (A = " "), k < C.length && !h(w) && w !== " " && (B = " "), {
|
|
6169
|
+
text: A + v + B,
|
|
6170
6170
|
prefixLength: A.length,
|
|
6171
6171
|
suffixLength: B.length
|
|
6172
6172
|
};
|
|
@@ -6178,28 +6178,28 @@ const DataBindingSelector = ({
|
|
|
6178
6178
|
if (C) {
|
|
6179
6179
|
const k = `{{${m}}}`;
|
|
6180
6180
|
C.commands.focus();
|
|
6181
|
-
const { from:
|
|
6182
|
-
if (
|
|
6181
|
+
const { from: v, to: A } = C.state.selection;
|
|
6182
|
+
if (v !== A)
|
|
6183
6183
|
C.chain().deleteSelection().insertContent(k).run();
|
|
6184
6184
|
else {
|
|
6185
|
-
const { state: _ } = C,
|
|
6186
|
-
let
|
|
6187
|
-
|
|
6185
|
+
const { state: _ } = C, w = _.selection.from, j = _.doc.textBetween(Math.max(0, w - 1), w), S = _.doc.textBetween(w, Math.min(w + 1, _.doc.content.size));
|
|
6186
|
+
let E = "";
|
|
6187
|
+
w > 0 && j !== " " && !h(j) && (E = " ");
|
|
6188
6188
|
let N = "";
|
|
6189
|
-
S && S !== " " && !h(S) && (N = " "), C.chain().insertContent(
|
|
6189
|
+
S && S !== " " && !h(S) && (N = " "), C.chain().insertContent(E + k + N).run();
|
|
6190
6190
|
}
|
|
6191
6191
|
setTimeout(() => n(C.getHTML(), {}, r), 100);
|
|
6192
6192
|
return;
|
|
6193
6193
|
}
|
|
6194
6194
|
} else {
|
|
6195
|
-
const C = b, k = C.selectionStart || 0,
|
|
6195
|
+
const C = b, k = C.selectionStart || 0, v = C.value || "", A = C.selectionEnd || k;
|
|
6196
6196
|
if (A > k) {
|
|
6197
|
-
const S = `{{${m}}}`, { text:
|
|
6197
|
+
const S = `{{${m}}}`, { text: E } = x(v, k, S), N = v.slice(0, k) + E + v.slice(A);
|
|
6198
6198
|
n(N, {}, r);
|
|
6199
6199
|
return;
|
|
6200
6200
|
}
|
|
6201
|
-
const _ = `{{${m}}}`, { text:
|
|
6202
|
-
n(
|
|
6201
|
+
const _ = `{{${m}}}`, { text: w } = x(v, k, _), j = v.slice(0, k) + w + v.slice(k);
|
|
6202
|
+
n(j, {}, r);
|
|
6203
6203
|
}
|
|
6204
6204
|
},
|
|
6205
6205
|
[r, n, a, d == null ? void 0 : d._id, p]
|
|
@@ -6220,38 +6220,38 @@ const DataBindingSelector = ({
|
|
|
6220
6220
|
pageTypes: n,
|
|
6221
6221
|
onChange: r
|
|
6222
6222
|
}) => {
|
|
6223
|
-
var
|
|
6224
|
-
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (S,
|
|
6223
|
+
var j;
|
|
6224
|
+
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (S, E) => []), [l, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, f] = useState(""), [h, x] = useState([]), [b, y] = useState(-1), C = useRef(null), k = (j = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : j.name;
|
|
6225
6225
|
useEffect(() => {
|
|
6226
6226
|
if (f(""), x([]), y(-1), p(!1), !o || l || !startsWith(o, "pageType:")) return;
|
|
6227
|
-
const S = split(o, ":"),
|
|
6228
|
-
g(
|
|
6229
|
-
const N = await i(
|
|
6227
|
+
const S = split(o, ":"), E = get(S, 1, "page") || "page";
|
|
6228
|
+
g(E), (async () => {
|
|
6229
|
+
const N = await i(E, [get(S, 2, "page")]);
|
|
6230
6230
|
N && Array.isArray(N) && f(get(N, [0, "name"], ""));
|
|
6231
6231
|
})();
|
|
6232
6232
|
}, [o]);
|
|
6233
|
-
const
|
|
6233
|
+
const v = useDebouncedCallback(
|
|
6234
6234
|
async (S) => {
|
|
6235
6235
|
if (isEmpty(S))
|
|
6236
6236
|
x([]);
|
|
6237
6237
|
else {
|
|
6238
|
-
const
|
|
6239
|
-
x(
|
|
6238
|
+
const E = await i(u, S);
|
|
6239
|
+
x(E);
|
|
6240
6240
|
}
|
|
6241
6241
|
c(!1), y(-1);
|
|
6242
6242
|
},
|
|
6243
6243
|
[u],
|
|
6244
6244
|
300
|
|
6245
6245
|
), A = (S) => {
|
|
6246
|
-
const
|
|
6247
|
-
|
|
6246
|
+
const E = ["pageType", u, S.id];
|
|
6247
|
+
E[1] && (r(E.join(":")), f(S.name), p(!1), x([]), y(-1));
|
|
6248
6248
|
}, B = (S) => {
|
|
6249
6249
|
switch (S.key) {
|
|
6250
6250
|
case "ArrowDown":
|
|
6251
|
-
S.preventDefault(), y((
|
|
6251
|
+
S.preventDefault(), y((E) => E < h.length - 1 ? E + 1 : E);
|
|
6252
6252
|
break;
|
|
6253
6253
|
case "ArrowUp":
|
|
6254
|
-
S.preventDefault(), y((
|
|
6254
|
+
S.preventDefault(), y((E) => E > 0 ? E - 1 : E);
|
|
6255
6255
|
break;
|
|
6256
6256
|
case "Enter":
|
|
6257
6257
|
if (S.preventDefault(), h.length === 0) return;
|
|
@@ -6270,8 +6270,8 @@ const DataBindingSelector = ({
|
|
|
6270
6270
|
}, [b]);
|
|
6271
6271
|
const _ = () => {
|
|
6272
6272
|
f(""), x([]), y(-1), p(!1), r("");
|
|
6273
|
-
},
|
|
6274
|
-
f(S), p(!isEmpty(S)), c(!0),
|
|
6273
|
+
}, w = (S) => {
|
|
6274
|
+
f(S), p(!isEmpty(S)), c(!0), v(S);
|
|
6275
6275
|
};
|
|
6276
6276
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6277
6277
|
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(n, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
|
|
@@ -6281,7 +6281,7 @@ const DataBindingSelector = ({
|
|
|
6281
6281
|
{
|
|
6282
6282
|
type: "text",
|
|
6283
6283
|
value: m,
|
|
6284
|
-
onChange: (S) =>
|
|
6284
|
+
onChange: (S) => w(S.target.value),
|
|
6285
6285
|
onKeyDown: B,
|
|
6286
6286
|
placeholder: a(`Search ${k ?? ""}`),
|
|
6287
6287
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
@@ -6297,11 +6297,11 @@ const DataBindingSelector = ({
|
|
|
6297
6297
|
' "',
|
|
6298
6298
|
m,
|
|
6299
6299
|
'"'
|
|
6300
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (S,
|
|
6300
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (S, E) => /* @__PURE__ */ jsxs(
|
|
6301
6301
|
"li",
|
|
6302
6302
|
{
|
|
6303
6303
|
onClick: () => A(S),
|
|
6304
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" :
|
|
6304
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : E === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
6305
6305
|
children: [
|
|
6306
6306
|
S.name,
|
|
6307
6307
|
" ",
|
|
@@ -6406,7 +6406,7 @@ const DataBindingSelector = ({
|
|
|
6406
6406
|
]
|
|
6407
6407
|
}
|
|
6408
6408
|
) });
|
|
6409
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
6409
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-vV5HE2hd.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
|
|
6410
6410
|
const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
|
|
6411
6411
|
blockId: o,
|
|
6412
6412
|
value: a,
|
|
@@ -6655,14 +6655,14 @@ const DataBindingSelector = ({
|
|
|
6655
6655
|
const { id: n, classNames: r, label: a, children: i, errors: l, help: c, hidden: d, required: p, schema: u, formData: g, onChange: m } = o, { selectedLang: f, fallbackLang: h, languages: x } = useLanguages(), b = useMemo(
|
|
6656
6656
|
() => isEmpty(x) ? "" : isEmpty(f) ? h : f,
|
|
6657
6657
|
[x, f, h]
|
|
6658
|
-
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), k = useSelectedBlock(),
|
|
6659
|
-
() => get(
|
|
6660
|
-
[
|
|
6658
|
+
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), k = useSelectedBlock(), v = useRegisteredChaiBlocks(), A = useMemo(
|
|
6659
|
+
() => get(v, [k == null ? void 0 : k._type, "i18nProps"], []),
|
|
6660
|
+
[v, k == null ? void 0 : k._type]
|
|
6661
6661
|
), [B, _] = useState(null);
|
|
6662
6662
|
if (d)
|
|
6663
6663
|
return null;
|
|
6664
6664
|
if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: i });
|
|
6665
|
-
const
|
|
6665
|
+
const j = A == null ? void 0 : A.includes(n.replace("root.", ""));
|
|
6666
6666
|
if (u.type === "array") {
|
|
6667
6667
|
const N = B === n;
|
|
6668
6668
|
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
@@ -6699,14 +6699,14 @@ const DataBindingSelector = ({
|
|
|
6699
6699
|
] })
|
|
6700
6700
|
] });
|
|
6701
6701
|
}
|
|
6702
|
-
const S = n.replace("root.", ""),
|
|
6702
|
+
const S = n.replace("root.", ""), E = A.includes(S) && !isEmpty(f) && isEmpty(g);
|
|
6703
6703
|
return /* @__PURE__ */ jsxs("div", { className: r, children: [
|
|
6704
6704
|
u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6705
6705
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6706
6706
|
/* @__PURE__ */ jsxs("label", { htmlFor: n, className: u.type === "object" ? "pb-2" : "", children: [
|
|
6707
6707
|
a,
|
|
6708
6708
|
" ",
|
|
6709
|
-
|
|
6709
|
+
j && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
6710
6710
|
" ",
|
|
6711
6711
|
y
|
|
6712
6712
|
] }),
|
|
@@ -6718,7 +6718,7 @@ const DataBindingSelector = ({
|
|
|
6718
6718
|
] }) })
|
|
6719
6719
|
] }),
|
|
6720
6720
|
!u.enum && !u.oneOf && C && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
|
|
6721
|
-
|
|
6721
|
+
E ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6722
6722
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6723
6723
|
"svg",
|
|
6724
6724
|
{
|
|
@@ -6857,11 +6857,11 @@ const DataBindingSelector = ({
|
|
|
6857
6857
|
}), a;
|
|
6858
6858
|
};
|
|
6859
6859
|
function BlockSettings() {
|
|
6860
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, o, i), [c, d] = useState(l), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), f = formDataWithSelectedLang(g, o, m), h = ({ formData: B }, _,
|
|
6861
|
-
_ && (c == null ? void 0 : c._id) === n._id && a([n._id], { [_]: get(B, _) },
|
|
6860
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, o, i), [c, d] = useState(l), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), f = formDataWithSelectedLang(g, o, m), h = ({ formData: B }, _, w) => {
|
|
6861
|
+
_ && (c == null ? void 0 : c._id) === n._id && a([n._id], { [_]: get(B, _) }, w);
|
|
6862
6862
|
}, x = useCallback(
|
|
6863
|
-
debounce(({ formData: B }, _,
|
|
6864
|
-
h({ formData: B }, _,
|
|
6863
|
+
debounce(({ formData: B }, _, w) => {
|
|
6864
|
+
h({ formData: B }, _, w), d(B);
|
|
6865
6865
|
}, 1500),
|
|
6866
6866
|
[n == null ? void 0 : n._id, o]
|
|
6867
6867
|
), b = ({ formData: B }, _) => {
|
|
@@ -6873,20 +6873,20 @@ function BlockSettings() {
|
|
|
6873
6873
|
if (!B)
|
|
6874
6874
|
return { schema: {}, uiSchema: {} };
|
|
6875
6875
|
try {
|
|
6876
|
-
const { schema: _, uiSchema:
|
|
6876
|
+
const { schema: _, uiSchema: w } = getBlockFormSchemas(B);
|
|
6877
6877
|
if (B === "Repeater") {
|
|
6878
|
-
const
|
|
6879
|
-
startsWith(
|
|
6878
|
+
const j = get(n, "repeaterItems", "");
|
|
6879
|
+
startsWith(j, `{{${COLLECTION_PREFIX}`) ? (set(w, "filter", { "ui:widget": "collectionSelect" }), set(w, "sort", { "ui:widget": "collectionSelect" })) : (set(w, "filter", { "ui:widget": "hidden" }), set(w, "sort", { "ui:widget": "hidden" }));
|
|
6880
6880
|
}
|
|
6881
|
-
return { schema: _, uiSchema:
|
|
6881
|
+
return { schema: _, uiSchema: w };
|
|
6882
6882
|
} catch {
|
|
6883
6883
|
return { schema: {}, uiSchema: {} };
|
|
6884
6884
|
}
|
|
6885
|
-
}, [n]), { wrapperSchema:
|
|
6885
|
+
}, [n]), { wrapperSchema: v, wrapperUiSchema: A } = useMemo(() => {
|
|
6886
6886
|
if (!g || !(g != null && g._type))
|
|
6887
6887
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
6888
|
-
const B = g == null ? void 0 : g._type, { schema: _ = {}, uiSchema:
|
|
6889
|
-
return { wrapperSchema: _, wrapperUiSchema:
|
|
6888
|
+
const B = g == null ? void 0 : g._type, { schema: _ = {}, uiSchema: w = {} } = getBlockFormSchemas(B);
|
|
6889
|
+
return { wrapperSchema: _, wrapperUiSchema: w };
|
|
6890
6890
|
}, [g]);
|
|
6891
6891
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
6892
6892
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -6914,7 +6914,7 @@ function BlockSettings() {
|
|
|
6914
6914
|
blockId: g == null ? void 0 : g._id,
|
|
6915
6915
|
onChange: y,
|
|
6916
6916
|
formData: f,
|
|
6917
|
-
schema:
|
|
6917
|
+
schema: v,
|
|
6918
6918
|
uiSchema: A
|
|
6919
6919
|
}
|
|
6920
6920
|
) })
|
|
@@ -7137,37 +7137,37 @@ const BlockStylingProps = () => {
|
|
|
7137
7137
|
},
|
|
7138
7138
|
a
|
|
7139
7139
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
7140
|
-
const [n, r] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, f] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [b, y] = useState(""), [C, k] = useState(!1), [
|
|
7140
|
+
const [n, r] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, f] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [b, y] = useState(""), [C, k] = useState(!1), [v, A] = useState(!1);
|
|
7141
7141
|
useEffect(() => {
|
|
7142
|
-
const { value: S, unit:
|
|
7143
|
-
if (
|
|
7142
|
+
const { value: S, unit: E } = getClassValueAndUnit(l);
|
|
7143
|
+
if (E === "") {
|
|
7144
7144
|
i(S), f(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
7145
7145
|
return;
|
|
7146
7146
|
}
|
|
7147
|
-
f(
|
|
7147
|
+
f(E), i(E === "class" || isEmpty(S) ? "" : S);
|
|
7148
7148
|
}, [l, p, u]);
|
|
7149
|
-
const B = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), _ = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME),
|
|
7149
|
+
const B = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), _ = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), w = useCallback(
|
|
7150
7150
|
(S = !1) => {
|
|
7151
|
-
const
|
|
7152
|
-
if (get(
|
|
7151
|
+
const E = getUserInputValues(`${a}`, u);
|
|
7152
|
+
if (get(E, "error", !1)) {
|
|
7153
7153
|
x(!0);
|
|
7154
7154
|
return;
|
|
7155
7155
|
}
|
|
7156
|
-
const N = get(
|
|
7156
|
+
const N = get(E, "unit") !== "" ? get(E, "unit") : m;
|
|
7157
7157
|
if (N === "auto" || N === "none") {
|
|
7158
7158
|
B(`${d}${N}`);
|
|
7159
7159
|
return;
|
|
7160
7160
|
}
|
|
7161
|
-
if (get(
|
|
7161
|
+
if (get(E, "value") === "")
|
|
7162
7162
|
return;
|
|
7163
|
-
const
|
|
7164
|
-
S ? _(
|
|
7163
|
+
const D = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7164
|
+
S ? _(D) : B(D);
|
|
7165
7165
|
},
|
|
7166
7166
|
[B, _, a, m, d, u]
|
|
7167
|
-
),
|
|
7167
|
+
), j = useCallback(
|
|
7168
7168
|
(S) => {
|
|
7169
|
-
const
|
|
7170
|
-
if (get(
|
|
7169
|
+
const E = getUserInputValues(`${a}`, u);
|
|
7170
|
+
if (get(E, "error", !1)) {
|
|
7171
7171
|
x(!0);
|
|
7172
7172
|
return;
|
|
7173
7173
|
}
|
|
@@ -7175,10 +7175,10 @@ const BlockStylingProps = () => {
|
|
|
7175
7175
|
B(`${d}${S}`);
|
|
7176
7176
|
return;
|
|
7177
7177
|
}
|
|
7178
|
-
if (get(
|
|
7178
|
+
if (get(E, "value") === "")
|
|
7179
7179
|
return;
|
|
7180
|
-
const N = get(
|
|
7181
|
-
B(
|
|
7180
|
+
const N = get(E, "unit") !== "" ? get(E, "unit") : S, D = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7181
|
+
B(D);
|
|
7182
7182
|
},
|
|
7183
7183
|
[B, a, d, u]
|
|
7184
7184
|
);
|
|
@@ -7202,28 +7202,28 @@ const BlockStylingProps = () => {
|
|
|
7202
7202
|
{
|
|
7203
7203
|
readOnly: m === "class",
|
|
7204
7204
|
onKeyPress: (S) => {
|
|
7205
|
-
S.key === "Enter" &&
|
|
7205
|
+
S.key === "Enter" && w();
|
|
7206
7206
|
},
|
|
7207
7207
|
onKeyDown: (S) => {
|
|
7208
7208
|
if (S.keyCode !== 38 && S.keyCode !== 40)
|
|
7209
7209
|
return;
|
|
7210
7210
|
S.preventDefault(), A(!0);
|
|
7211
|
-
const
|
|
7212
|
-
let N = isNaN$1(
|
|
7211
|
+
const E = parseInt$1(S.target.value);
|
|
7212
|
+
let N = isNaN$1(E) ? 0 : E;
|
|
7213
7213
|
S.keyCode === 38 && (N += 1), S.keyCode === 40 && (N -= 1);
|
|
7214
7214
|
const I = `${N}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7215
7215
|
_(P);
|
|
7216
7216
|
},
|
|
7217
7217
|
onKeyUp: (S) => {
|
|
7218
|
-
|
|
7218
|
+
v && (S.preventDefault(), A(!1));
|
|
7219
7219
|
},
|
|
7220
|
-
onBlur: () =>
|
|
7220
|
+
onBlur: () => w(),
|
|
7221
7221
|
onChange: (S) => {
|
|
7222
7222
|
x(!1), i(S.target.value);
|
|
7223
7223
|
},
|
|
7224
7224
|
onClick: (S) => {
|
|
7225
|
-
var
|
|
7226
|
-
(
|
|
7225
|
+
var E;
|
|
7226
|
+
(E = S == null ? void 0 : S.target) == null || E.select(), r(!1);
|
|
7227
7227
|
},
|
|
7228
7228
|
value: C ? b : a,
|
|
7229
7229
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -7251,7 +7251,7 @@ const BlockStylingProps = () => {
|
|
|
7251
7251
|
units: u,
|
|
7252
7252
|
current: m,
|
|
7253
7253
|
onSelect: (S) => {
|
|
7254
|
-
r(!1), f(S),
|
|
7254
|
+
r(!1), f(S), j(S);
|
|
7255
7255
|
}
|
|
7256
7256
|
}
|
|
7257
7257
|
) })
|
|
@@ -7264,14 +7264,14 @@ const BlockStylingProps = () => {
|
|
|
7264
7264
|
onDragEnd: (S) => {
|
|
7265
7265
|
if (y(() => ""), k(!1), isEmpty(S))
|
|
7266
7266
|
return;
|
|
7267
|
-
const
|
|
7267
|
+
const E = `${S}`, I = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7268
7268
|
B(I);
|
|
7269
7269
|
},
|
|
7270
7270
|
onDrag: (S) => {
|
|
7271
7271
|
if (isEmpty(S))
|
|
7272
7272
|
return;
|
|
7273
7273
|
y(S);
|
|
7274
|
-
const
|
|
7274
|
+
const E = `${S}`, I = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7275
7275
|
_(I);
|
|
7276
7276
|
},
|
|
7277
7277
|
currentValue: a,
|
|
@@ -7736,11 +7736,11 @@ const COLOR_PROP = {
|
|
|
7736
7736
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
7737
7737
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: i, onEmitChange: l = () => {
|
|
7738
7738
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(i), f = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), b = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
|
|
7739
|
-
(_,
|
|
7740
|
-
const
|
|
7741
|
-
(p || u !== "") && (
|
|
7742
|
-
const S = generateFullClsName(
|
|
7743
|
-
f(x, [S],
|
|
7739
|
+
(_, w = !0) => {
|
|
7740
|
+
const j = { dark: p, mq: g, mod: u, cls: _, property: i, fullCls: "" };
|
|
7741
|
+
(p || u !== "") && (j.mq = "xs");
|
|
7742
|
+
const S = generateFullClsName(j);
|
|
7743
|
+
f(x, [S], w);
|
|
7744
7744
|
},
|
|
7745
7745
|
[x, p, g, u, i, f]
|
|
7746
7746
|
), C = useCallback(() => {
|
|
@@ -7749,9 +7749,9 @@ const COLOR_PROP = {
|
|
|
7749
7749
|
useEffect(() => {
|
|
7750
7750
|
l(k, m);
|
|
7751
7751
|
}, [k, l, m]);
|
|
7752
|
-
const [, ,
|
|
7752
|
+
const [, , v] = useScreenSizeWidth(), A = useCallback(
|
|
7753
7753
|
(_) => {
|
|
7754
|
-
|
|
7754
|
+
v({
|
|
7755
7755
|
xs: 400,
|
|
7756
7756
|
sm: 640,
|
|
7757
7757
|
md: 800,
|
|
@@ -7760,7 +7760,7 @@ const COLOR_PROP = {
|
|
|
7760
7760
|
"2xl": 1920
|
|
7761
7761
|
}[_]);
|
|
7762
7762
|
},
|
|
7763
|
-
[
|
|
7763
|
+
[v]
|
|
7764
7764
|
), B = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
7765
7765
|
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: k, canReset: m && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
7766
7766
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !B ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
@@ -8005,7 +8005,7 @@ const COLOR_PROP = {
|
|
|
8005
8005
|
activeButtonClass: i = ""
|
|
8006
8006
|
}) => {
|
|
8007
8007
|
const [l, , c] = useScreenSizeWidth(), [d, p] = useCanvasDisplayWidth(), [u, g] = useSelectedBreakpoints(), m = u, f = g, { t: h } = useTranslation(), x = useBuilderProp("breakpoints", WEB_BREAKPOINTS), b = (k) => {
|
|
8008
|
-
m.includes(k) ? m.length > 2 && f(m.filter((
|
|
8008
|
+
m.includes(k) ? m.length > 2 && f(m.filter((v) => v !== k)) : f((v) => [...v, k]);
|
|
8009
8009
|
}, y = (k) => {
|
|
8010
8010
|
n || c(k), p(k);
|
|
8011
8011
|
}, C = getBreakpointValue(n ? d : l).toLowerCase();
|
|
@@ -8047,7 +8047,7 @@ const COLOR_PROP = {
|
|
|
8047
8047
|
disabled: k.breakpoint === "xs",
|
|
8048
8048
|
onCheckedChange: () => b(toUpper(k.breakpoint)),
|
|
8049
8049
|
checked: includes(m, toUpper(k.breakpoint)),
|
|
8050
|
-
onSelect: (
|
|
8050
|
+
onSelect: (v) => v.preventDefault(),
|
|
8051
8051
|
children: h(k.title)
|
|
8052
8052
|
},
|
|
8053
8053
|
k.breakpoint
|
|
@@ -8076,98 +8076,102 @@ function BreakpointSelector() {
|
|
|
8076
8076
|
] }) }) })
|
|
8077
8077
|
] });
|
|
8078
8078
|
}
|
|
8079
|
+
const DesignTokensIcon = ({ className: o = "" }) => /* @__PURE__ */ jsx(FontStyleIcon, { className: o });
|
|
8079
8080
|
function ManualClasses() {
|
|
8080
|
-
var
|
|
8081
|
-
const o = useRef(null), [n, r] = useState(""), [a, i] = useState(-1), l = useFuseSearch(), { t:
|
|
8082
|
-
const
|
|
8083
|
-
return
|
|
8084
|
-
}), [
|
|
8081
|
+
var O;
|
|
8082
|
+
const o = useRef(null), [n, r] = useState(""), [a, i] = useState(-1), [, l] = useRightPanel(), c = useFuseSearch(), { t: d } = useTranslation(), [p] = useSelectedStylingBlocks(), u = useSelectedBlock(), g = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), [h, x] = useState(""), b = useAtomValue$1(chaiDesignTokensAtom), y = (O = first(p)) == null ? void 0 : O.prop, { classes: C } = getSplitChaiClasses(get(u, y, "")), k = C.split(" ").filter((L) => !isEmpty(L)), v = useMemo(() => [...k].sort((L, T) => {
|
|
8083
|
+
const M = L.startsWith("dt-"), H = T.startsWith("dt-");
|
|
8084
|
+
return M && !H ? -1 : !M && H ? 1 : 0;
|
|
8085
|
+
}), [k]), A = useBuilderProp("flags.copyPaste", !0), B = (L) => {
|
|
8085
8086
|
if (L.startsWith("dt-")) {
|
|
8086
|
-
const
|
|
8087
|
-
return
|
|
8087
|
+
const T = L.substring(3), M = b[T];
|
|
8088
|
+
return M ? M.name : L;
|
|
8088
8089
|
}
|
|
8089
8090
|
return L;
|
|
8090
|
-
},
|
|
8091
|
-
const
|
|
8092
|
-
return
|
|
8093
|
-
},
|
|
8094
|
-
const L =
|
|
8095
|
-
|
|
8096
|
-
}, [
|
|
8097
|
-
const
|
|
8098
|
-
let
|
|
8099
|
-
if (
|
|
8100
|
-
name:
|
|
8101
|
-
id: `dt-${
|
|
8091
|
+
}, _ = (L) => {
|
|
8092
|
+
const T = Object.entries(b).find(([M, H]) => H.name === L);
|
|
8093
|
+
return T ? `dt-${T[0]}` : L;
|
|
8094
|
+
}, w = () => {
|
|
8095
|
+
const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(_);
|
|
8096
|
+
g(f, L, !0), x("");
|
|
8097
|
+
}, [j, S] = useState([]), E = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
|
|
8098
|
+
const T = L.trim().toLowerCase(), M = T.match(/.+:/g);
|
|
8099
|
+
let H = [], W = [];
|
|
8100
|
+
if (E && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
|
|
8101
|
+
name: U.name,
|
|
8102
|
+
id: `dt-${V}`,
|
|
8102
8103
|
isDesignToken: !0
|
|
8103
|
-
})) :
|
|
8104
|
-
name:
|
|
8105
|
-
id: `dt-${
|
|
8104
|
+
})) : W = Object.entries(b).filter(([V, U]) => U.name.toLowerCase().includes(T)).map(([V, U]) => ({
|
|
8105
|
+
name: U.name,
|
|
8106
|
+
id: `dt-${V}`,
|
|
8106
8107
|
isDesignToken: !0
|
|
8107
|
-
}))),
|
|
8108
|
-
const [
|
|
8109
|
-
|
|
8108
|
+
}))), M && M.length > 0) {
|
|
8109
|
+
const [V] = M, U = T.replace(V, "");
|
|
8110
|
+
H = c.search(U).map((K) => ({
|
|
8110
8111
|
...K,
|
|
8111
|
-
item: { ...K.item, name:
|
|
8112
|
+
item: { ...K.item, name: V + K.item.name }
|
|
8112
8113
|
}));
|
|
8113
8114
|
} else
|
|
8114
|
-
|
|
8115
|
-
const
|
|
8116
|
-
return
|
|
8117
|
-
},
|
|
8118
|
-
|
|
8119
|
-
},
|
|
8120
|
-
L.isDesignToken && /* @__PURE__ */ jsx(
|
|
8115
|
+
H = c.search(T);
|
|
8116
|
+
const z = [...W, ...map(H, "item")];
|
|
8117
|
+
return S(z);
|
|
8118
|
+
}, I = () => {
|
|
8119
|
+
S([]);
|
|
8120
|
+
}, D = (L) => L.name, P = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
|
|
8121
|
+
L.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
8121
8122
|
/* @__PURE__ */ jsx("span", { children: L.name })
|
|
8122
|
-
] }),
|
|
8123
|
+
] }), R = useMemo(
|
|
8123
8124
|
() => ({
|
|
8124
8125
|
ref: o,
|
|
8125
8126
|
autoComplete: "off",
|
|
8126
8127
|
autoCorrect: "off",
|
|
8127
8128
|
autoCapitalize: "off",
|
|
8128
8129
|
spellCheck: !1,
|
|
8129
|
-
placeholder:
|
|
8130
|
-
value:
|
|
8130
|
+
placeholder: d("Enter classes separated by space"),
|
|
8131
|
+
value: h,
|
|
8131
8132
|
onFocus: (L) => {
|
|
8132
8133
|
setTimeout(() => {
|
|
8133
8134
|
L.target && L.target.select();
|
|
8134
8135
|
}, 0);
|
|
8135
8136
|
},
|
|
8136
8137
|
onKeyDown: (L) => {
|
|
8137
|
-
L.key === "Enter" &&
|
|
8138
|
+
L.key === "Enter" && h.trim() !== "" && w();
|
|
8138
8139
|
},
|
|
8139
|
-
onChange: (L, { newValue:
|
|
8140
|
+
onChange: (L, { newValue: T }) => x(T),
|
|
8140
8141
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
8141
8142
|
}),
|
|
8142
|
-
[
|
|
8143
|
-
),
|
|
8144
|
-
const
|
|
8145
|
-
|
|
8146
|
-
},
|
|
8143
|
+
[h, d, o]
|
|
8144
|
+
), $ = (L) => {
|
|
8145
|
+
const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(_);
|
|
8146
|
+
m(f, [L]), g(f, T, !0), r(""), i(-1);
|
|
8147
|
+
}, F = () => {
|
|
8147
8148
|
if (navigator.clipboard === void 0) {
|
|
8148
|
-
toast.error(
|
|
8149
|
+
toast.error(d("Clipboard not supported"));
|
|
8149
8150
|
return;
|
|
8150
8151
|
}
|
|
8151
|
-
navigator.clipboard.writeText(
|
|
8152
|
+
navigator.clipboard.writeText(k.join(" ")), toast.success(d("Classes copied to clipboard"));
|
|
8152
8153
|
};
|
|
8153
8154
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
8154
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */
|
|
8155
|
-
/* @__PURE__ */
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8155
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-x-2 text-muted-foreground", children: [
|
|
8156
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-1", children: [
|
|
8157
|
+
/* @__PURE__ */ jsx("span", { children: d(E ? "Styles" : "Classes") }),
|
|
8158
|
+
A && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8159
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: F, className: "cursor-pointer" }) }),
|
|
8160
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: d("Copy classes to clipboard") }) })
|
|
8161
|
+
] })
|
|
8162
|
+
] }),
|
|
8163
|
+
E && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => l("design-tokens"), children: d("Design Tokens") })
|
|
8164
|
+
] }) }),
|
|
8161
8165
|
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
|
|
8162
8166
|
/* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
|
|
8163
8167
|
Autosuggest,
|
|
8164
8168
|
{
|
|
8165
|
-
suggestions:
|
|
8166
|
-
onSuggestionsFetchRequested:
|
|
8167
|
-
onSuggestionsClearRequested:
|
|
8168
|
-
getSuggestionValue:
|
|
8169
|
-
renderSuggestion:
|
|
8170
|
-
inputProps:
|
|
8169
|
+
suggestions: j,
|
|
8170
|
+
onSuggestionsFetchRequested: N,
|
|
8171
|
+
onSuggestionsClearRequested: I,
|
|
8172
|
+
getSuggestionValue: D,
|
|
8173
|
+
renderSuggestion: P,
|
|
8174
|
+
inputProps: R,
|
|
8171
8175
|
containerProps: {
|
|
8172
8176
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
8173
8177
|
},
|
|
@@ -8183,29 +8187,29 @@ function ManualClasses() {
|
|
|
8183
8187
|
{
|
|
8184
8188
|
variant: "outline",
|
|
8185
8189
|
className: "h-6 border-border",
|
|
8186
|
-
onClick:
|
|
8187
|
-
disabled:
|
|
8190
|
+
onClick: w,
|
|
8191
|
+
disabled: h.trim() === "",
|
|
8188
8192
|
size: "sm",
|
|
8189
8193
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
8190
8194
|
}
|
|
8191
8195
|
)
|
|
8192
8196
|
] }),
|
|
8193
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children:
|
|
8194
|
-
(L,
|
|
8197
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: v.map(
|
|
8198
|
+
(L, T) => a === T ? /* @__PURE__ */ jsx(
|
|
8195
8199
|
"input",
|
|
8196
8200
|
{
|
|
8197
8201
|
ref: o,
|
|
8198
8202
|
value: n,
|
|
8199
|
-
onChange: (
|
|
8203
|
+
onChange: (M) => r(M.target.value),
|
|
8200
8204
|
onBlur: () => {
|
|
8201
|
-
|
|
8205
|
+
$(L);
|
|
8202
8206
|
},
|
|
8203
|
-
onKeyDown: (
|
|
8204
|
-
|
|
8207
|
+
onKeyDown: (M) => {
|
|
8208
|
+
M.key === "Enter" && $(L);
|
|
8205
8209
|
},
|
|
8206
|
-
onFocus: (
|
|
8210
|
+
onFocus: (M) => {
|
|
8207
8211
|
setTimeout(() => {
|
|
8208
|
-
|
|
8212
|
+
M.target.select();
|
|
8209
8213
|
}, 0);
|
|
8210
8214
|
},
|
|
8211
8215
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
|
|
@@ -8215,7 +8219,7 @@ function ManualClasses() {
|
|
|
8215
8219
|
"button",
|
|
8216
8220
|
{
|
|
8217
8221
|
onDoubleClick: () => {
|
|
8218
|
-
|
|
8222
|
+
x(B(L)), m(f, [L]), setTimeout(() => {
|
|
8219
8223
|
o.current && o.current.focus();
|
|
8220
8224
|
}, 10);
|
|
8221
8225
|
},
|
|
@@ -8225,11 +8229,11 @@ function ManualClasses() {
|
|
|
8225
8229
|
/* @__PURE__ */ jsx(
|
|
8226
8230
|
Cross2Icon,
|
|
8227
8231
|
{
|
|
8228
|
-
onClick: () =>
|
|
8232
|
+
onClick: () => m(f, [L], !0),
|
|
8229
8233
|
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"
|
|
8230
8234
|
}
|
|
8231
8235
|
),
|
|
8232
|
-
L.startsWith("dt-") ? /* @__PURE__ */ jsx(
|
|
8236
|
+
L.startsWith("dt-") ? /* @__PURE__ */ jsx(DesignTokensIcon, { className: "text-[rgba(55, 65, 81, 0.4)] h-3.5 w-3.5 group-hover:hidden" }) : /* @__PURE__ */ jsxs(
|
|
8233
8237
|
"svg",
|
|
8234
8238
|
{
|
|
8235
8239
|
className: "h-3.5 w-3.5 group-hover:hidden",
|
|
@@ -8252,7 +8256,7 @@ function ManualClasses() {
|
|
|
8252
8256
|
}
|
|
8253
8257
|
)
|
|
8254
8258
|
] }),
|
|
8255
|
-
/* @__PURE__ */ jsx("div", { children:
|
|
8259
|
+
/* @__PURE__ */ jsx("div", { children: B(L) })
|
|
8256
8260
|
]
|
|
8257
8261
|
}
|
|
8258
8262
|
) }, L)
|
|
@@ -8586,7 +8590,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
8586
8590
|
]
|
|
8587
8591
|
};
|
|
8588
8592
|
} else if (n) {
|
|
8589
|
-
const
|
|
8593
|
+
const v = typeof n == "function" ? await n() : n, A = getBlocksFromHTML(v);
|
|
8590
8594
|
if (isEmpty(A)) return;
|
|
8591
8595
|
k = {
|
|
8592
8596
|
type: "Box",
|
|
@@ -8594,16 +8598,16 @@ const registerChaiLibrary = (o, n) => {
|
|
|
8594
8598
|
name: get(A, "0._type", "Block")
|
|
8595
8599
|
};
|
|
8596
8600
|
} else if (r) {
|
|
8597
|
-
const
|
|
8598
|
-
if (isEmpty(
|
|
8601
|
+
const v = typeof r == "function" ? await r() : r;
|
|
8602
|
+
if (isEmpty(v)) return;
|
|
8599
8603
|
k = {
|
|
8600
8604
|
type: "Box",
|
|
8601
|
-
blocks:
|
|
8602
|
-
name: get(
|
|
8605
|
+
blocks: v,
|
|
8606
|
+
name: get(v, "0._type", "Block")
|
|
8603
8607
|
};
|
|
8604
8608
|
} else if (o) {
|
|
8605
|
-
const
|
|
8606
|
-
k = typeof
|
|
8609
|
+
const v = typeof o == "function" ? await o() : o;
|
|
8610
|
+
k = typeof v == "object" ? omit(v, ["component", "icon"]) : v;
|
|
8607
8611
|
}
|
|
8608
8612
|
if (!k) return;
|
|
8609
8613
|
u(C, k, !0), setTimeout(() => {
|
|
@@ -8723,17 +8727,17 @@ const BlockCard = ({
|
|
|
8723
8727
|
return;
|
|
8724
8728
|
}
|
|
8725
8729
|
}, [y, C]);
|
|
8726
|
-
const
|
|
8730
|
+
const v = get(y, C, []), A = useRef(null), { t: B } = useTranslation(), _ = useRef(null);
|
|
8727
8731
|
useEffect(() => {
|
|
8728
8732
|
var I;
|
|
8729
8733
|
const N = (I = _.current) == null ? void 0 : I.querySelector("[data-radix-scroll-area-viewport]");
|
|
8730
8734
|
N && N.scrollTo({ top: 0, behavior: "smooth" });
|
|
8731
8735
|
}, [c, C]);
|
|
8732
|
-
const
|
|
8736
|
+
const w = (N) => {
|
|
8733
8737
|
A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
|
|
8734
8738
|
A.current && k(N);
|
|
8735
8739
|
}, 400);
|
|
8736
|
-
},
|
|
8740
|
+
}, j = () => {
|
|
8737
8741
|
c != null && c.id && u(c.id);
|
|
8738
8742
|
};
|
|
8739
8743
|
if (p)
|
|
@@ -8741,7 +8745,7 @@ const BlockCard = ({
|
|
|
8741
8745
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
8742
8746
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
8743
8747
|
] });
|
|
8744
|
-
const S = filter(
|
|
8748
|
+
const S = filter(v, (N, I) => I % 2 === 0), E = filter(v, (N, I) => I % 2 === 1);
|
|
8745
8749
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
8746
8750
|
/* @__PURE__ */ jsx(SearchInput, { value: g, setValue: m }),
|
|
8747
8751
|
/* @__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 ${r ? "flex-col" : ""}`, children: [
|
|
@@ -8760,7 +8764,7 @@ const BlockCard = ({
|
|
|
8760
8764
|
className: `no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto ${r ? "" : "pb-20"}`,
|
|
8761
8765
|
children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: g ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8762
8766
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: B("Failed to load the UI library. Try again") }),
|
|
8763
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
8767
|
+
/* @__PURE__ */ jsxs(Button, { onClick: j, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
8764
8768
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
8765
8769
|
B("Retry")
|
|
8766
8770
|
] })
|
|
@@ -8770,7 +8774,7 @@ const BlockCard = ({
|
|
|
8770
8774
|
] }) : map(y, (N, I) => /* @__PURE__ */ jsxs(
|
|
8771
8775
|
"div",
|
|
8772
8776
|
{
|
|
8773
|
-
onMouseEnter: () =>
|
|
8777
|
+
onMouseEnter: () => w(I),
|
|
8774
8778
|
onMouseLeave: () => clearTimeout(A.current),
|
|
8775
8779
|
role: "button",
|
|
8776
8780
|
onClick: () => k(I),
|
|
@@ -8798,7 +8802,7 @@ const BlockCard = ({
|
|
|
8798
8802
|
onMouseEnter: () => A.current ? clearTimeout(A.current) : null,
|
|
8799
8803
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
8800
8804
|
children: [
|
|
8801
|
-
isEmpty(
|
|
8805
|
+
isEmpty(v) && !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 ${r ? "grid-cols-1 pb-20" : "grid-cols-2 px-2"}`, children: [
|
|
8802
8806
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: S.map((N, I) => /* @__PURE__ */ jsx(
|
|
8803
8807
|
BlockCard,
|
|
8804
8808
|
{
|
|
@@ -8809,7 +8813,7 @@ const BlockCard = ({
|
|
|
8809
8813
|
},
|
|
8810
8814
|
`block-${I}`
|
|
8811
8815
|
)) }),
|
|
8812
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
8816
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((N, I) => /* @__PURE__ */ jsx(
|
|
8813
8817
|
BlockCard,
|
|
8814
8818
|
{
|
|
8815
8819
|
parentId: o,
|
|
@@ -8859,14 +8863,14 @@ const BlockCard = ({
|
|
|
8859
8863
|
}), m(!0);
|
|
8860
8864
|
else if (!l && Object.keys(i || {}).length > 0) {
|
|
8861
8865
|
const h = Object.entries(i).map(([b, y]) => {
|
|
8862
|
-
const C = y, k = C.type || "partial",
|
|
8866
|
+
const C = y, k = C.type || "partial", v = formatReadableName(k);
|
|
8863
8867
|
return {
|
|
8864
8868
|
type: "PartialBlock",
|
|
8865
8869
|
// Set the type to PartialBlock
|
|
8866
8870
|
label: formatReadableName(C.name || b),
|
|
8867
8871
|
description: C.description || "",
|
|
8868
8872
|
icon: FrameIcon,
|
|
8869
|
-
group:
|
|
8873
|
+
group: v,
|
|
8870
8874
|
// Use formatted type as group
|
|
8871
8875
|
category: "partial",
|
|
8872
8876
|
partialBlockId: b,
|
|
@@ -8933,8 +8937,8 @@ const BlockCard = ({
|
|
|
8933
8937
|
const { t: c } = useTranslation(), [d] = useBlocksStore(), [p, u] = useState(""), g = useRef(null), [m] = useAtom$1(addBlockTabAtom), f = (N = find(d, (I) => I._id === r)) == null ? void 0 : N._type, [h, x] = useState("all"), [b, y] = useState(null), C = useRef(null), k = useBuilderProp("flags.dragAndDrop", !1);
|
|
8934
8938
|
useEffect(() => {
|
|
8935
8939
|
const I = setTimeout(() => {
|
|
8936
|
-
var
|
|
8937
|
-
(
|
|
8940
|
+
var D;
|
|
8941
|
+
(D = g.current) == null || D.focus();
|
|
8938
8942
|
}, 0);
|
|
8939
8943
|
return () => clearTimeout(I);
|
|
8940
8944
|
}, [m]), useEffect(() => {
|
|
@@ -8944,7 +8948,7 @@ const BlockCard = ({
|
|
|
8944
8948
|
}, 500), () => {
|
|
8945
8949
|
C.current && C.current.cancel();
|
|
8946
8950
|
}), []);
|
|
8947
|
-
const
|
|
8951
|
+
const v = useCallback((I) => {
|
|
8948
8952
|
y(I), C.current && C.current(I);
|
|
8949
8953
|
}, []), A = useCallback(() => {
|
|
8950
8954
|
y(null), C.current && C.current.cancel();
|
|
@@ -8953,40 +8957,40 @@ const BlockCard = ({
|
|
|
8953
8957
|
}, []), _ = useMemo(
|
|
8954
8958
|
() => p ? values(n).filter(
|
|
8955
8959
|
(I) => {
|
|
8956
|
-
var
|
|
8957
|
-
return (((
|
|
8960
|
+
var D, P;
|
|
8961
|
+
return (((D = I.label) == null ? void 0 : D.toLowerCase()) + " " + ((P = I.type) == null ? void 0 : P.toLowerCase())).includes(p.toLowerCase());
|
|
8958
8962
|
}
|
|
8959
8963
|
) : n,
|
|
8960
8964
|
[n, p]
|
|
8961
|
-
),
|
|
8965
|
+
), w = useMemo(
|
|
8962
8966
|
() => p ? o.filter(
|
|
8963
8967
|
(I) => reject(filter(values(_), { group: I }), { hidden: !0 }).length > 0
|
|
8964
8968
|
) : o.filter((I) => reject(filter(values(n), { group: I }), { hidden: !0 }).length > 0),
|
|
8965
8969
|
[n, _, o, p]
|
|
8966
|
-
),
|
|
8967
|
-
() => sortBy(
|
|
8968
|
-
[
|
|
8969
|
-
), S = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]),
|
|
8970
|
+
), j = useMemo(
|
|
8971
|
+
() => sortBy(w, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
|
|
8972
|
+
[w]
|
|
8973
|
+
), S = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), E = useMemo(() => h === "all" ? j : [h], [j, h]);
|
|
8970
8974
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
|
|
8971
8975
|
/* @__PURE__ */ jsx(SearchInput, { value: p, setValue: u }),
|
|
8972
8976
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
|
|
8973
|
-
!l &&
|
|
8977
|
+
!l && j.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8974
8978
|
/* @__PURE__ */ jsx(
|
|
8975
8979
|
"button",
|
|
8976
8980
|
{
|
|
8977
8981
|
onClick: () => B("all"),
|
|
8978
|
-
onMouseEnter: () =>
|
|
8982
|
+
onMouseEnter: () => v("all"),
|
|
8979
8983
|
onMouseLeave: A,
|
|
8980
8984
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || b === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
8981
8985
|
children: c("All")
|
|
8982
8986
|
},
|
|
8983
8987
|
"sidebar-all"
|
|
8984
8988
|
),
|
|
8985
|
-
|
|
8989
|
+
j.map((I) => /* @__PURE__ */ jsx(
|
|
8986
8990
|
"button",
|
|
8987
8991
|
{
|
|
8988
8992
|
onClick: () => B(I),
|
|
8989
|
-
onMouseEnter: () =>
|
|
8993
|
+
onMouseEnter: () => v(I),
|
|
8990
8994
|
onMouseLeave: A,
|
|
8991
8995
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === I || b === I ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
8992
8996
|
children: capitalize(c(I.toLowerCase()))
|
|
@@ -8997,26 +9001,26 @@ const BlockCard = ({
|
|
|
8997
9001
|
/* @__PURE__ */ jsx(
|
|
8998
9002
|
"div",
|
|
8999
9003
|
{
|
|
9000
|
-
className: `h-full flex-1 overflow-hidden ${!l &&
|
|
9001
|
-
children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children:
|
|
9004
|
+
className: `h-full flex-1 overflow-hidden ${!l && j.length > 0 ? "w-3/4" : "w-full"}`,
|
|
9005
|
+
children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: w.length === 0 && p ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
9002
9006
|
c("No blocks found matching"),
|
|
9003
9007
|
' "',
|
|
9004
9008
|
p,
|
|
9005
9009
|
'"'
|
|
9006
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children:
|
|
9010
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: E.map((I) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9007
9011
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
|
|
9008
9012
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
|
|
9009
9013
|
h === "all" ? filter(values(S), { group: I }) : values(S),
|
|
9010
9014
|
{ hidden: !0 }
|
|
9011
|
-
).map((
|
|
9015
|
+
).map((D) => /* @__PURE__ */ jsx(
|
|
9012
9016
|
CoreBlock,
|
|
9013
9017
|
{
|
|
9014
9018
|
parentId: r,
|
|
9015
9019
|
position: a,
|
|
9016
|
-
block:
|
|
9017
|
-
disabled: !k && (!canAcceptChildBlock(f,
|
|
9020
|
+
block: D,
|
|
9021
|
+
disabled: !k && (!canAcceptChildBlock(f, D.type) || !canBeNestedInside(f, D.type))
|
|
9018
9022
|
},
|
|
9019
|
-
|
|
9023
|
+
D.type
|
|
9020
9024
|
)) })
|
|
9021
9025
|
] }, I)) }) })
|
|
9022
9026
|
}
|
|
@@ -9490,21 +9494,21 @@ const useStructureValidation = () => {
|
|
|
9490
9494
|
var n;
|
|
9491
9495
|
return o != null && o._name ? o._name : (o == null ? void 0 : o._type) === "Box" && (o != null && o.tag) && (o == null ? void 0 : o.tag) !== "div" ? startCase(o.tag) : ((n = o == null ? void 0 : o._type) == null ? void 0 : n.split("/").pop()) || "";
|
|
9492
9496
|
}, truncateText = (o, n) => o.length > n ? o.substring(0, n) + "..." : o, Node$1 = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
9493
|
-
var
|
|
9497
|
+
var L;
|
|
9494
9498
|
const { t: a } = useTranslation(), i = useUpdateBlocksProps(), [l] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
9495
9499
|
let d = null;
|
|
9496
|
-
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), m = useIsDragAndDropEnabled(), { id: f, data: h, isSelected: x, willReceiveDrop: b, isDragging: y, isEditing: C, handleClick: k } = o,
|
|
9500
|
+
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), m = useIsDragAndDropEnabled(), { id: f, data: h, isSelected: x, willReceiveDrop: b, isDragging: y, isEditing: C, handleClick: k } = o, v = useStructureValidation(), A = useMemo(() => v.getBlockErrors(f), [v, f]), B = get(h, "_show", !0), _ = (T) => {
|
|
9497
9501
|
T.stopPropagation(), B && o.toggle();
|
|
9498
|
-
},
|
|
9502
|
+
}, w = (T) => {
|
|
9499
9503
|
T.isInternal && (d = T.isOpen, T.isOpen && T.close());
|
|
9500
|
-
},
|
|
9504
|
+
}, j = (T) => {
|
|
9501
9505
|
T.isInternal && d !== null && (d ? T.open() : T.close(), d = null);
|
|
9502
|
-
}, [S,
|
|
9506
|
+
}, [S, E] = useAtom$1(currentAddSelection), N = () => {
|
|
9503
9507
|
var T;
|
|
9504
|
-
I(), o.parent.isSelected ||
|
|
9508
|
+
I(), o.parent.isSelected || E((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
9505
9509
|
}, I = () => {
|
|
9506
|
-
|
|
9507
|
-
},
|
|
9510
|
+
E(null);
|
|
9511
|
+
}, D = (T) => {
|
|
9508
9512
|
I(), T.stopPropagation(), !o.isOpen && B && o.toggle(), k(T);
|
|
9509
9513
|
};
|
|
9510
9514
|
useEffect(() => {
|
|
@@ -9513,15 +9517,15 @@ const useStructureValidation = () => {
|
|
|
9513
9517
|
}, 500);
|
|
9514
9518
|
return () => clearTimeout(T);
|
|
9515
9519
|
}, [b, o, y]);
|
|
9516
|
-
const P = (T,
|
|
9517
|
-
const
|
|
9518
|
-
W && W.setAttribute("data-drop",
|
|
9519
|
-
const
|
|
9520
|
-
|
|
9521
|
-
},
|
|
9520
|
+
const P = (T, M) => {
|
|
9521
|
+
const H = l.contentDocument || l.contentWindow.document, W = H.querySelector(`[data-block-id=${T}]`);
|
|
9522
|
+
W && W.setAttribute("data-drop", M);
|
|
9523
|
+
const z = W.getBoundingClientRect(), V = l.getBoundingClientRect();
|
|
9524
|
+
z.top >= V.top && z.left >= V.left && z.bottom <= V.bottom && z.right <= V.right || (H.documentElement.scrollTop = W.offsetTop - V.top);
|
|
9525
|
+
}, R = (T) => {
|
|
9522
9526
|
I();
|
|
9523
|
-
const
|
|
9524
|
-
|
|
9527
|
+
const M = get(o, "parent.id");
|
|
9528
|
+
M !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: M, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
|
|
9525
9529
|
};
|
|
9526
9530
|
if (f === ROOT_TEMP_KEY)
|
|
9527
9531
|
return /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 w-full cursor-pointer", children: [
|
|
@@ -9530,7 +9534,7 @@ const useStructureValidation = () => {
|
|
|
9530
9534
|
"div",
|
|
9531
9535
|
{
|
|
9532
9536
|
role: "button",
|
|
9533
|
-
onClick: () =>
|
|
9537
|
+
onClick: () => R(-1),
|
|
9534
9538
|
className: "h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
9535
9539
|
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-primary px-3 py-1 text-[9px] leading-tight text-white hover:bg-primary", children: [
|
|
9536
9540
|
/* @__PURE__ */ jsx(PlusIcon, { className: "w-2.4 h-2.5 stroke-[5] text-white" }),
|
|
@@ -9541,18 +9545,18 @@ const useStructureValidation = () => {
|
|
|
9541
9545
|
),
|
|
9542
9546
|
/* @__PURE__ */ jsx("br", {})
|
|
9543
9547
|
] });
|
|
9544
|
-
const { librarySite:
|
|
9548
|
+
const { librarySite: $ } = useBuilderProp("flags", { librarySite: !1 }), F = useMemo(() => $ && has(h, "_libBlockId") && !isEmpty(h._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [h, c, $]), O = useMemo(() => (h == null ? void 0 : h._type) === "PartialBlock" || (h == null ? void 0 : h._type) === "GlobalBlock", [h]);
|
|
9545
9549
|
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
9546
9550
|
"div",
|
|
9547
9551
|
{
|
|
9548
9552
|
onMouseEnter: () => u(f),
|
|
9549
9553
|
onMouseLeave: () => g(),
|
|
9550
|
-
onClick:
|
|
9554
|
+
onClick: D,
|
|
9551
9555
|
style: n,
|
|
9552
9556
|
"data-node-id": f,
|
|
9553
9557
|
ref: r,
|
|
9554
|
-
onDragStart: () =>
|
|
9555
|
-
onDragEnd: () =>
|
|
9558
|
+
onDragStart: () => w(o),
|
|
9559
|
+
onDragEnd: () => j(o),
|
|
9556
9560
|
onDragOver: (T) => {
|
|
9557
9561
|
T.preventDefault(), P(f, "yes");
|
|
9558
9562
|
},
|
|
@@ -9563,11 +9567,11 @@ const useStructureValidation = () => {
|
|
|
9563
9567
|
T.preventDefault(), P(f, "no");
|
|
9564
9568
|
},
|
|
9565
9569
|
children: [
|
|
9566
|
-
c(PERMISSIONS.ADD_BLOCK) && !m && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((
|
|
9570
|
+
c(PERMISSIONS.ADD_BLOCK) && !m && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
9567
9571
|
"div",
|
|
9568
9572
|
{
|
|
9569
9573
|
onClick: (T) => {
|
|
9570
|
-
T.stopPropagation(),
|
|
9574
|
+
T.stopPropagation(), R(o.childIndex);
|
|
9571
9575
|
},
|
|
9572
9576
|
onMouseEnter: N,
|
|
9573
9577
|
onMouseLeave: I,
|
|
@@ -9585,7 +9589,7 @@ const useStructureValidation = () => {
|
|
|
9585
9589
|
(o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
|
|
9586
9590
|
y && "opacity-20",
|
|
9587
9591
|
B ? "" : "line-through opacity-50",
|
|
9588
|
-
|
|
9592
|
+
F && x && "bg-primary/20 text-primary"
|
|
9589
9593
|
),
|
|
9590
9594
|
children: [
|
|
9591
9595
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -9601,10 +9605,10 @@ const useStructureValidation = () => {
|
|
|
9601
9605
|
{
|
|
9602
9606
|
className: cn(
|
|
9603
9607
|
"leading-1 flex items-center",
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
+
F && "text-orange-600/90",
|
|
9609
|
+
F && x && "text-orange-800",
|
|
9610
|
+
O && "text-purple-600/90",
|
|
9611
|
+
O && x && "text-purple-800"
|
|
9608
9612
|
),
|
|
9609
9613
|
children: [
|
|
9610
9614
|
A.length > 0 ? /* @__PURE__ */ jsx("div", { className: "text-red-500", children: /* @__PURE__ */ jsx(ExclamationTriangleIcon, { className: "h-3 w-3" }) }) : /* @__PURE__ */ jsx(TypeIcon, { type: h == null ? void 0 : h._type }),
|
|
@@ -10093,17 +10097,13 @@ const useStructureValidation = () => {
|
|
|
10093
10097
|
}
|
|
10094
10098
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
10095
10099
|
const [n, r] = useDarkMode(), [a, i] = React.useState(""), [l, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions(), g = useBuilderProp("flags.importTheme", !0), m = useBuilderProp("flags.darkMode", !0), f = useIncrementActionsCount();
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
const j = Object.keys(S)[0];
|
|
10100
|
-
E.includes(j) || d.push(S);
|
|
10101
|
-
});
|
|
10102
|
-
}
|
|
10100
|
+
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((j) => {
|
|
10101
|
+
d.push(j);
|
|
10102
|
+
});
|
|
10103
10103
|
const [h, x] = useTheme(), b = useThemeOptions(), { t: y } = useTranslation(), C = React.useCallback(
|
|
10104
|
-
(
|
|
10104
|
+
(j) => {
|
|
10105
10105
|
const S = { ...h };
|
|
10106
|
-
setPreviousTheme(S), x(
|
|
10106
|
+
setPreviousTheme(S), x(j), f(), toast.success("Theme updated", {
|
|
10107
10107
|
action: {
|
|
10108
10108
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
10109
10109
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
@@ -10119,56 +10119,56 @@ const useStructureValidation = () => {
|
|
|
10119
10119
|
},
|
|
10120
10120
|
[h, x, f]
|
|
10121
10121
|
), k = () => {
|
|
10122
|
-
const
|
|
10123
|
-
if (
|
|
10124
|
-
const S = Object.values(
|
|
10122
|
+
const j = d.find((S) => Object.keys(S)[0] === a);
|
|
10123
|
+
if (j) {
|
|
10124
|
+
const S = Object.values(j)[0];
|
|
10125
10125
|
S && typeof S == "object" && "fontFamily" in S && "borderRadius" in S && "colors" in S ? (C(S), i(""), f()) : console.error("Invalid preset structure:", S);
|
|
10126
10126
|
} else
|
|
10127
10127
|
console.error("Preset not found:", a);
|
|
10128
|
-
},
|
|
10129
|
-
C(
|
|
10128
|
+
}, v = (j) => {
|
|
10129
|
+
C(j), i(""), f();
|
|
10130
10130
|
}, A = useDebouncedCallback(
|
|
10131
|
-
(
|
|
10131
|
+
(j, S) => {
|
|
10132
10132
|
x(() => ({
|
|
10133
10133
|
...h,
|
|
10134
10134
|
fontFamily: {
|
|
10135
10135
|
...h.fontFamily,
|
|
10136
|
-
[
|
|
10136
|
+
[j.replace(/font-/g, "")]: S
|
|
10137
10137
|
}
|
|
10138
10138
|
})), f();
|
|
10139
10139
|
},
|
|
10140
10140
|
[h, f],
|
|
10141
10141
|
200
|
|
10142
10142
|
), B = React.useCallback(
|
|
10143
|
-
(
|
|
10143
|
+
(j) => {
|
|
10144
10144
|
x(() => ({
|
|
10145
10145
|
...h,
|
|
10146
|
-
borderRadius: `${
|
|
10146
|
+
borderRadius: `${j}px`
|
|
10147
10147
|
})), f();
|
|
10148
10148
|
},
|
|
10149
10149
|
[h, f]
|
|
10150
10150
|
), _ = useDebouncedCallback(
|
|
10151
|
-
(
|
|
10151
|
+
(j, S) => {
|
|
10152
10152
|
x(() => {
|
|
10153
|
-
const
|
|
10154
|
-
return n ? set(
|
|
10153
|
+
const E = get(h, `colors.${j}`);
|
|
10154
|
+
return n ? set(E, 1, S) : set(E, 0, S), f(), {
|
|
10155
10155
|
...h,
|
|
10156
10156
|
colors: {
|
|
10157
10157
|
...h.colors,
|
|
10158
|
-
[
|
|
10158
|
+
[j]: E
|
|
10159
10159
|
}
|
|
10160
10160
|
};
|
|
10161
10161
|
});
|
|
10162
10162
|
},
|
|
10163
10163
|
[h, f],
|
|
10164
10164
|
200
|
|
10165
|
-
),
|
|
10166
|
-
const
|
|
10167
|
-
return
|
|
10165
|
+
), w = (j) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(j.items).map(([S]) => {
|
|
10166
|
+
const E = get(h, `colors.${S}.${n ? 1 : 0}`);
|
|
10167
|
+
return E ? /* @__PURE__ */ jsxs("div", { id: `theme-${S}`, className: "mt-1 flex items-center gap-x-2", children: [
|
|
10168
10168
|
/* @__PURE__ */ jsx(
|
|
10169
10169
|
ColorPickerInput,
|
|
10170
10170
|
{
|
|
10171
|
-
value:
|
|
10171
|
+
value: E,
|
|
10172
10172
|
onChange: (N) => _(S, N)
|
|
10173
10173
|
}
|
|
10174
10174
|
),
|
|
@@ -10188,9 +10188,9 @@ const useStructureValidation = () => {
|
|
|
10188
10188
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
10189
10189
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
|
|
10190
10190
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
|
|
10191
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
10192
|
-
const S = Object.keys(
|
|
10193
|
-
return /* @__PURE__ */ jsx(SelectItem, { value: S, children: capitalize(
|
|
10191
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((j) => {
|
|
10192
|
+
const S = Object.keys(j)[0], E = S.replaceAll("_", " ");
|
|
10193
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: S, children: capitalize(E) }, S);
|
|
10194
10194
|
}) })
|
|
10195
10195
|
] }) }),
|
|
10196
10196
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
|
|
@@ -10202,14 +10202,14 @@ const useStructureValidation = () => {
|
|
|
10202
10202
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
10203
10203
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
|
|
10204
10204
|
] }),
|
|
10205
|
-
(b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([
|
|
10205
|
+
(b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([j, S]) => /* @__PURE__ */ jsx(
|
|
10206
10206
|
FontSelector,
|
|
10207
10207
|
{
|
|
10208
|
-
label:
|
|
10209
|
-
value: h.fontFamily[
|
|
10210
|
-
onChange: (
|
|
10208
|
+
label: j,
|
|
10209
|
+
value: h.fontFamily[j.replace(/font-/g, "")] || S[Object.keys(S)[0]],
|
|
10210
|
+
onChange: (E) => A(j, E)
|
|
10211
10211
|
},
|
|
10212
|
-
|
|
10212
|
+
j
|
|
10213
10213
|
)) }),
|
|
10214
10214
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
10215
10215
|
(b == null ? void 0 : b.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -10235,7 +10235,7 @@ const useStructureValidation = () => {
|
|
|
10235
10235
|
Switch,
|
|
10236
10236
|
{
|
|
10237
10237
|
checked: n,
|
|
10238
|
-
onCheckedChange: (
|
|
10238
|
+
onCheckedChange: (j) => r(j),
|
|
10239
10239
|
"aria-label": y("Toggle dark mode"),
|
|
10240
10240
|
className: "mx-1"
|
|
10241
10241
|
}
|
|
@@ -10243,14 +10243,14 @@ const useStructureValidation = () => {
|
|
|
10243
10243
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
10244
10244
|
] })
|
|
10245
10245
|
] }),
|
|
10246
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((
|
|
10246
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((j) => w(j)) })
|
|
10247
10247
|
] }),
|
|
10248
10248
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && g && /* @__PURE__ */ jsx(
|
|
10249
10249
|
LazyCssImportModal,
|
|
10250
10250
|
{
|
|
10251
10251
|
open: l,
|
|
10252
10252
|
onOpenChange: c,
|
|
10253
|
-
onImport:
|
|
10253
|
+
onImport: v
|
|
10254
10254
|
}
|
|
10255
10255
|
) })
|
|
10256
10256
|
] }),
|
|
@@ -10999,52 +10999,52 @@ const UndoRedo = () => {
|
|
|
10999
10999
|
return;
|
|
11000
11000
|
}
|
|
11001
11001
|
if (l) {
|
|
11002
|
-
const
|
|
11003
|
-
r(
|
|
11002
|
+
const w = [...a, { key: l, value: d }];
|
|
11003
|
+
r(w), i(a), c(""), p(""), f("");
|
|
11004
11004
|
}
|
|
11005
|
-
}, k = (
|
|
11006
|
-
const
|
|
11007
|
-
r(
|
|
11008
|
-
},
|
|
11009
|
-
g(
|
|
11005
|
+
}, k = (w) => {
|
|
11006
|
+
const j = a.filter((S, E) => E !== w);
|
|
11007
|
+
r(j), i(j);
|
|
11008
|
+
}, v = (w) => {
|
|
11009
|
+
g(w), c(a[w].key), p(a[w].value);
|
|
11010
11010
|
}, A = () => {
|
|
11011
11011
|
if (l.startsWith("@")) {
|
|
11012
11012
|
f(y("Attribute keys cannot start with @"));
|
|
11013
11013
|
return;
|
|
11014
11014
|
}
|
|
11015
11015
|
if (u !== null && l) {
|
|
11016
|
-
const
|
|
11017
|
-
|
|
11016
|
+
const w = [...a];
|
|
11017
|
+
w[u] = { key: l, value: d }, r(w), i(w), g(null), c(""), p(""), f("");
|
|
11018
11018
|
}
|
|
11019
|
-
}, B = (
|
|
11020
|
-
|
|
11021
|
-
}, _ = useCallback((
|
|
11022
|
-
const
|
|
11023
|
-
let P = "",
|
|
11024
|
-
const
|
|
11025
|
-
return I > 0 && (
|
|
11026
|
-
text: P +
|
|
11019
|
+
}, B = (w) => {
|
|
11020
|
+
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? A() : C());
|
|
11021
|
+
}, _ = useCallback((w) => {
|
|
11022
|
+
const j = (N) => /[.,!?;:]/.test(N), S = (N, I, D) => {
|
|
11023
|
+
let P = "", R = "";
|
|
11024
|
+
const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
|
|
11025
|
+
return I > 0 && ($ === "." || !j($) && $ !== " ") && (P = " "), I < N.length && !j(F) && F !== " " && (R = " "), {
|
|
11026
|
+
text: P + D + R,
|
|
11027
11027
|
prefixLength: P.length,
|
|
11028
|
-
suffixLength:
|
|
11028
|
+
suffixLength: R.length
|
|
11029
11029
|
};
|
|
11030
|
-
},
|
|
11031
|
-
if (
|
|
11032
|
-
const N =
|
|
11033
|
-
if (
|
|
11034
|
-
const
|
|
11030
|
+
}, E = x.current;
|
|
11031
|
+
if (E) {
|
|
11032
|
+
const N = E.selectionStart || 0, I = E.value || "", D = E.selectionEnd || N;
|
|
11033
|
+
if (D > N) {
|
|
11034
|
+
const O = `{{${w}}}`, { text: L } = S(I, N, O), T = I.slice(0, N) + L + I.slice(D);
|
|
11035
11035
|
p(T);
|
|
11036
11036
|
return;
|
|
11037
11037
|
}
|
|
11038
|
-
const
|
|
11039
|
-
p(
|
|
11038
|
+
const R = `{{${w}}}`, { text: $ } = S(I, N, R), F = I.slice(0, N) + $ + I.slice(N);
|
|
11039
|
+
p(F);
|
|
11040
11040
|
}
|
|
11041
11041
|
}, []);
|
|
11042
11042
|
return /* @__PURE__ */ jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
11043
11043
|
/* @__PURE__ */ jsxs(
|
|
11044
11044
|
"form",
|
|
11045
11045
|
{
|
|
11046
|
-
onSubmit: (
|
|
11047
|
-
|
|
11046
|
+
onSubmit: (w) => {
|
|
11047
|
+
w.preventDefault(), u !== null ? A() : C();
|
|
11048
11048
|
},
|
|
11049
11049
|
className: "space-y-3",
|
|
11050
11050
|
children: [
|
|
@@ -11060,7 +11060,7 @@ const UndoRedo = () => {
|
|
|
11060
11060
|
id: "attrKey",
|
|
11061
11061
|
ref: h,
|
|
11062
11062
|
value: l,
|
|
11063
|
-
onChange: (
|
|
11063
|
+
onChange: (w) => c(w.target.value),
|
|
11064
11064
|
placeholder: y("Enter key"),
|
|
11065
11065
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
11066
11066
|
}
|
|
@@ -11080,7 +11080,7 @@ const UndoRedo = () => {
|
|
|
11080
11080
|
id: "attrValue",
|
|
11081
11081
|
ref: x,
|
|
11082
11082
|
value: d,
|
|
11083
|
-
onChange: (
|
|
11083
|
+
onChange: (w) => p(w.target.value),
|
|
11084
11084
|
onKeyDown: B,
|
|
11085
11085
|
placeholder: y("Enter value"),
|
|
11086
11086
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
@@ -11093,16 +11093,16 @@ const UndoRedo = () => {
|
|
|
11093
11093
|
]
|
|
11094
11094
|
}
|
|
11095
11095
|
),
|
|
11096
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
11096
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w, j) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
11097
11097
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
11098
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
11099
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children:
|
|
11098
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
|
|
11099
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
|
|
11100
11100
|
] }),
|
|
11101
11101
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
11102
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
11103
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(
|
|
11102
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(j), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
11103
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(j), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
11104
11104
|
] })
|
|
11105
|
-
] },
|
|
11105
|
+
] }, j)) })
|
|
11106
11106
|
] });
|
|
11107
11107
|
}), BlockAttributesEditor = React.memo(() => {
|
|
11108
11108
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), i = useUpdateBlocksProps(), l = `${get(a, "0.prop")}_attrs`;
|
|
@@ -11242,47 +11242,153 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11242
11242
|
component: DefaultTopBar
|
|
11243
11243
|
}, registerChaiTopBar = (o) => {
|
|
11244
11244
|
TOP_BAR.component = o;
|
|
11245
|
-
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []),
|
|
11246
|
-
|
|
11247
|
-
|
|
11245
|
+
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), TokenUsageSection = ({ title: o, items: n, emptyLabel: r, onSelect: a, icon: i }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
11246
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: o }),
|
|
11247
|
+
n.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: n.map((l) => /* @__PURE__ */ jsx(
|
|
11248
|
+
"button",
|
|
11249
|
+
{
|
|
11250
|
+
type: "button",
|
|
11251
|
+
onClick: () => a(l.id),
|
|
11252
|
+
className: cn$2(
|
|
11253
|
+
"group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-2 text-left text-xs transition",
|
|
11254
|
+
"hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
|
|
11255
|
+
l.isSelected && "border-primary/40 bg-primary/10 text-primary"
|
|
11256
|
+
),
|
|
11257
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-2", children: [
|
|
11258
|
+
i && i,
|
|
11259
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-muted-foreground/50 group-hover:bg-primary/60" }),
|
|
11260
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: l.label })
|
|
11261
|
+
] })
|
|
11262
|
+
},
|
|
11263
|
+
l.id
|
|
11264
|
+
)) }) : /* @__PURE__ */ jsx("div", { className: "rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground", children: r })
|
|
11265
|
+
] }), STYLES_PREFIX = "#styles:", getBlockLabel = (o) => {
|
|
11266
|
+
const r = [
|
|
11267
|
+
typeof o._name == "string" ? o._name : void 0,
|
|
11268
|
+
typeof o._type == "string" ? o._type : void 0
|
|
11269
|
+
].filter(Boolean).find((a) => a.trim().length > 0);
|
|
11270
|
+
return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : o._id;
|
|
11271
|
+
}, collectTokenUsageOnPage = (o, n) => {
|
|
11272
|
+
const r = `dt-${n}`;
|
|
11273
|
+
return o.filter((a) => Object.values(a).some((i) => typeof i != "string" || !i.startsWith(STYLES_PREFIX) ? !1 : i.includes(r))).map((a) => ({
|
|
11274
|
+
id: a._id,
|
|
11275
|
+
label: getBlockLabel(a)
|
|
11276
|
+
}));
|
|
11277
|
+
}, TokenUsagePopover = ({ tokenId: o, tokenName: n }) => {
|
|
11278
|
+
const { t: r } = useTranslation(), [a] = useBlocksStore(), [i, l] = useSelectedBlockIds(), c = useBuilderProp("pageId"), d = useBuilderProp("siteWideUsage"), p = useMemo(() => collectTokenUsageOnPage(a, o), [a, o]), u = useMemo(
|
|
11279
|
+
() => p.map((b) => ({
|
|
11280
|
+
id: b.id,
|
|
11281
|
+
label: b.label,
|
|
11282
|
+
isSelected: i.includes(b.id)
|
|
11283
|
+
})),
|
|
11284
|
+
[p, i]
|
|
11285
|
+
), g = useMemo(() => Object.entries(d).reduce(
|
|
11286
|
+
(b, [y, C]) => (y === c || !(C != null && C.designTokens) || !Object.keys(C.designTokens).some((v) => typeof v != "string" ? !1 : v === o) || b.push({ id: y, name: C.name || y, isPartial: !!C.isPartial }), b),
|
|
11287
|
+
[]
|
|
11288
|
+
), [d, n, o, c]), m = useMemo(
|
|
11289
|
+
() => g.filter((b) => !b.isPartial).map((b) => ({
|
|
11290
|
+
id: b.id,
|
|
11291
|
+
label: b.name
|
|
11292
|
+
})),
|
|
11293
|
+
[g]
|
|
11294
|
+
), f = useMemo(
|
|
11295
|
+
() => g.filter((b) => b.isPartial).map((b) => ({
|
|
11296
|
+
id: b.id,
|
|
11297
|
+
label: b.name
|
|
11298
|
+
})),
|
|
11299
|
+
[g]
|
|
11300
|
+
), h = useCallback(
|
|
11301
|
+
(b) => {
|
|
11302
|
+
l([b]);
|
|
11303
|
+
},
|
|
11304
|
+
[l]
|
|
11305
|
+
), x = (b) => {
|
|
11306
|
+
if (!b) return;
|
|
11307
|
+
const y = new URL(window.location.href);
|
|
11308
|
+
y.searchParams.set("pageId", b), window.open(y.toString(), "_blank");
|
|
11309
|
+
};
|
|
11310
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
11311
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0", children: /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-3 w-3" }) }) }),
|
|
11312
|
+
/* @__PURE__ */ jsxs(PopoverContent, { side: "bottom", align: "end", className: "w-80 p-0", children: [
|
|
11313
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 px-4 py-3", children: [
|
|
11314
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold", children: n }),
|
|
11315
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: r("Usage summary for this design token across your site.") })
|
|
11316
|
+
] }),
|
|
11317
|
+
/* @__PURE__ */ jsxs("div", { className: "no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4", children: [
|
|
11318
|
+
/* @__PURE__ */ jsx(
|
|
11319
|
+
TokenUsageSection,
|
|
11320
|
+
{
|
|
11321
|
+
title: r("Blocks affected on this page"),
|
|
11322
|
+
items: u,
|
|
11323
|
+
emptyLabel: r("None"),
|
|
11324
|
+
onSelect: h,
|
|
11325
|
+
icon: /* @__PURE__ */ jsx(BoxIcon, { fontSize: 8 })
|
|
11326
|
+
}
|
|
11327
|
+
),
|
|
11328
|
+
/* @__PURE__ */ jsx(
|
|
11329
|
+
TokenUsageSection,
|
|
11330
|
+
{
|
|
11331
|
+
title: r("Blocks affected on other pages"),
|
|
11332
|
+
items: m,
|
|
11333
|
+
emptyLabel: r("None"),
|
|
11334
|
+
onSelect: x,
|
|
11335
|
+
icon: /* @__PURE__ */ jsx(FileIcon, { fontSize: 8 })
|
|
11336
|
+
}
|
|
11337
|
+
),
|
|
11338
|
+
/* @__PURE__ */ jsx(
|
|
11339
|
+
TokenUsageSection,
|
|
11340
|
+
{
|
|
11341
|
+
title: r("Blocks affected on partial blocks"),
|
|
11342
|
+
items: f,
|
|
11343
|
+
emptyLabel: r("None"),
|
|
11344
|
+
onSelect: x,
|
|
11345
|
+
icon: /* @__PURE__ */ jsx(GlobeIcon, { fontSize: 8 })
|
|
11346
|
+
}
|
|
11347
|
+
)
|
|
11348
|
+
] })
|
|
11349
|
+
] })
|
|
11350
|
+
] });
|
|
11351
|
+
}, ManageDesignTokens = ({}) => {
|
|
11352
|
+
const { t: o } = useTranslation(), [n, r] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, p] = useState(!1), [u, g] = useState(!1), [m, f] = useState(""), [h, x] = useState(""), [b, y] = useState(""), [C, k] = useState(""), [v, A] = useState(""), [B, _] = useState(""), w = useIncrementActionsCount(), j = (L) => {
|
|
11353
|
+
const T = L.trim();
|
|
11248
11354
|
return T.length === 0 || T.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(T);
|
|
11249
|
-
}, S = (
|
|
11250
|
-
const
|
|
11251
|
-
return
|
|
11252
|
-
([V,
|
|
11355
|
+
}, S = (L, T = !1, M) => {
|
|
11356
|
+
const H = L.trim();
|
|
11357
|
+
return H.length === 0 ? "" : H.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(H) ? Object.entries(n).find(
|
|
11358
|
+
([V, U]) => U.name === H && (!T || V !== M)
|
|
11253
11359
|
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
11254
|
-
},
|
|
11360
|
+
}, E = () => {
|
|
11255
11361
|
if (!m.trim() || !h.trim()) {
|
|
11256
11362
|
toast.error(o("Please fill in both token name and classes"));
|
|
11257
11363
|
return;
|
|
11258
11364
|
}
|
|
11259
|
-
if (!
|
|
11365
|
+
if (!j(m)) {
|
|
11260
11366
|
toast.error(o("Invalid design token name format"));
|
|
11261
11367
|
return;
|
|
11262
11368
|
}
|
|
11263
|
-
if (Object.values(n).find((
|
|
11369
|
+
if (Object.values(n).find((H) => H.name === m.trim())) {
|
|
11264
11370
|
toast.error(o("Token already exists"));
|
|
11265
11371
|
return;
|
|
11266
11372
|
}
|
|
11267
|
-
const T = `token_${nanoid(12)}`,
|
|
11373
|
+
const T = `token_${nanoid(12)}`, M = {
|
|
11268
11374
|
...n,
|
|
11269
11375
|
[T]: {
|
|
11270
11376
|
name: m.trim(),
|
|
11271
11377
|
value: h.trim()
|
|
11272
11378
|
}
|
|
11273
11379
|
};
|
|
11274
|
-
r(
|
|
11380
|
+
r(M), f(""), x(""), i(!1), p(!1), w(), toast.success(o("Token added successfully"));
|
|
11275
11381
|
}, N = () => {
|
|
11276
11382
|
if (!b.trim() || !C.trim()) {
|
|
11277
11383
|
toast.error(o("Please fill in both token name and classes"));
|
|
11278
11384
|
return;
|
|
11279
11385
|
}
|
|
11280
|
-
if (!
|
|
11386
|
+
if (!j(b)) {
|
|
11281
11387
|
toast.error(o("Invalid design token name format"));
|
|
11282
11388
|
return;
|
|
11283
11389
|
}
|
|
11284
11390
|
if (Object.entries(n).find(
|
|
11285
|
-
([
|
|
11391
|
+
([M, H]) => H.name === b.trim() && M !== l
|
|
11286
11392
|
)) {
|
|
11287
11393
|
toast.error(o("Token already exists"));
|
|
11288
11394
|
return;
|
|
@@ -11296,27 +11402,27 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11296
11402
|
value: C.trim()
|
|
11297
11403
|
}
|
|
11298
11404
|
};
|
|
11299
|
-
r(T), c(null), y(""), k(""), g(!1),
|
|
11300
|
-
}, I = (
|
|
11405
|
+
r(T), c(null), y(""), k(""), g(!1), w(), toast.success(o("Token updated successfully"));
|
|
11406
|
+
}, I = (L) => {
|
|
11301
11407
|
const T = { ...n };
|
|
11302
|
-
delete T[
|
|
11303
|
-
},
|
|
11304
|
-
const T = n[
|
|
11305
|
-
T && (c(
|
|
11408
|
+
delete T[L], r(T), w(), toast.success(o("Token deleted successfully"));
|
|
11409
|
+
}, D = (L) => {
|
|
11410
|
+
const T = n[L];
|
|
11411
|
+
T && (c(L), y(T.name), k(T.value), i(!1), g(!0));
|
|
11306
11412
|
}, P = () => {
|
|
11307
11413
|
i(!0), c(null), f(""), x(""), A(""), p(!0);
|
|
11308
|
-
},
|
|
11414
|
+
}, R = () => {
|
|
11309
11415
|
c(null), y(""), k(""), _(""), g(!1);
|
|
11310
|
-
},
|
|
11416
|
+
}, $ = () => {
|
|
11311
11417
|
i(!1), f(""), x(""), A(""), p(!1);
|
|
11312
|
-
},
|
|
11313
|
-
const T =
|
|
11418
|
+
}, F = (L) => {
|
|
11419
|
+
const T = L.replace(/\s+/g, "-");
|
|
11314
11420
|
f(T), A(S(T));
|
|
11315
|
-
},
|
|
11316
|
-
const T =
|
|
11421
|
+
}, O = (L) => {
|
|
11422
|
+
const T = L.replace(/\s+/g, "-");
|
|
11317
11423
|
y(T), _(S(T, !0, l || void 0));
|
|
11318
11424
|
};
|
|
11319
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-full
|
|
11425
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
11320
11426
|
/* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(
|
|
11321
11427
|
Button,
|
|
11322
11428
|
{
|
|
@@ -11334,19 +11440,20 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11334
11440
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full flex-1", children: /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(n).length === 0 ? /* @__PURE__ */ jsxs("div", { className: "py-6 text-center text-muted-foreground", children: [
|
|
11335
11441
|
/* @__PURE__ */ jsx("div", { className: "mb-1 text-2xl", children: "🎨" }),
|
|
11336
11442
|
/* @__PURE__ */ jsx("p", { className: "text-xs", children: o("No design tokens defined") })
|
|
11337
|
-
] }) : Object.entries(n).map(([
|
|
11443
|
+
] }) : Object.entries(n).map(([L, T]) => /* @__PURE__ */ jsxs(
|
|
11338
11444
|
"div",
|
|
11339
11445
|
{
|
|
11340
|
-
className: `group flex items-center justify-between hover:bg-muted/90 ${l ===
|
|
11446
|
+
className: `group flex items-center justify-between hover:bg-muted/90 ${l === L ? "bg-primary/10" : ""}`,
|
|
11341
11447
|
children: [
|
|
11342
11448
|
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("span", { className: "flex items-center break-all pl-1 text-xs font-semibold", children: T.name }) }),
|
|
11343
11449
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-center opacity-0 group-hover:opacity-100", children: [
|
|
11450
|
+
/* @__PURE__ */ jsx(TokenUsagePopover, { tokenId: L, tokenName: T.name }),
|
|
11344
11451
|
/* @__PURE__ */ jsx(
|
|
11345
11452
|
Button,
|
|
11346
11453
|
{
|
|
11347
11454
|
variant: "ghost",
|
|
11348
11455
|
size: "sm",
|
|
11349
|
-
onClick: () =>
|
|
11456
|
+
onClick: () => D(L),
|
|
11350
11457
|
disabled: a || l !== null,
|
|
11351
11458
|
className: "h-6 w-6 p-0",
|
|
11352
11459
|
children: /* @__PURE__ */ jsx(Pencil1Icon, { className: "h-3 w-3" })
|
|
@@ -11377,7 +11484,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11377
11484
|
/* @__PURE__ */ jsx(
|
|
11378
11485
|
AlertDialogAction,
|
|
11379
11486
|
{
|
|
11380
|
-
onClick: () => I(
|
|
11487
|
+
onClick: () => I(L),
|
|
11381
11488
|
className: "h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",
|
|
11382
11489
|
children: o("Delete")
|
|
11383
11490
|
}
|
|
@@ -11388,9 +11495,9 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11388
11495
|
] })
|
|
11389
11496
|
]
|
|
11390
11497
|
},
|
|
11391
|
-
|
|
11498
|
+
L
|
|
11392
11499
|
)) }) }) }),
|
|
11393
|
-
/* @__PURE__ */ jsx(Dialog, { open: d, onOpenChange:
|
|
11500
|
+
/* @__PURE__ */ jsx(Dialog, { open: d, onOpenChange: $, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
|
|
11394
11501
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
11395
11502
|
/* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: o("Add Design Token") }),
|
|
11396
11503
|
/* @__PURE__ */ jsx(DialogDescription, { className: "text-sm", children: o("Create a new reusable design token with Tailwind classes.") })
|
|
@@ -11404,11 +11511,11 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11404
11511
|
id: "new-selector",
|
|
11405
11512
|
placeholder: "Button-Primary",
|
|
11406
11513
|
value: m,
|
|
11407
|
-
onChange: (
|
|
11514
|
+
onChange: (L) => F(L.target.value),
|
|
11408
11515
|
className: "text-sm"
|
|
11409
11516
|
}
|
|
11410
11517
|
),
|
|
11411
|
-
|
|
11518
|
+
v ? /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: v }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: o("Button-Primary, Card-Header, Text-Large") })
|
|
11412
11519
|
] }),
|
|
11413
11520
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
11414
11521
|
/* @__PURE__ */ jsx(Label, { htmlFor: "new-classes", className: "text-sm", children: o("Tailwind Classes") }),
|
|
@@ -11418,18 +11525,18 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11418
11525
|
id: "new-classes",
|
|
11419
11526
|
placeholder: "bg-blue-500 text-white px-4 py-2",
|
|
11420
11527
|
value: h,
|
|
11421
|
-
onChange: (
|
|
11528
|
+
onChange: (L) => x(L.target.value),
|
|
11422
11529
|
className: "min-h-[80px] resize-none font-mono text-xs"
|
|
11423
11530
|
}
|
|
11424
11531
|
)
|
|
11425
11532
|
] })
|
|
11426
11533
|
] }),
|
|
11427
11534
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
11428
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick:
|
|
11429
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
11535
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: $, className: "h-8 text-sm", children: o("Cancel") }),
|
|
11536
|
+
/* @__PURE__ */ jsx(Button, { onClick: E, className: "h-8 text-sm", children: o("Add Token") })
|
|
11430
11537
|
] })
|
|
11431
11538
|
] }) }),
|
|
11432
|
-
/* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange:
|
|
11539
|
+
/* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange: R, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
|
|
11433
11540
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
11434
11541
|
/* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: o("Edit Design Token") }),
|
|
11435
11542
|
/* @__PURE__ */ jsx(DialogDescription, { className: "text-sm", children: o("Update the design token name and classes.") })
|
|
@@ -11442,7 +11549,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11442
11549
|
{
|
|
11443
11550
|
id: "edit-selector",
|
|
11444
11551
|
value: b,
|
|
11445
|
-
onChange: (
|
|
11552
|
+
onChange: (L) => O(L.target.value),
|
|
11446
11553
|
className: "text-sm"
|
|
11447
11554
|
}
|
|
11448
11555
|
),
|
|
@@ -11455,21 +11562,18 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11455
11562
|
{
|
|
11456
11563
|
id: "edit-classes",
|
|
11457
11564
|
value: C,
|
|
11458
|
-
onChange: (
|
|
11565
|
+
onChange: (L) => k(L.target.value),
|
|
11459
11566
|
className: "min-h-[80px] resize-none font-mono text-xs"
|
|
11460
11567
|
}
|
|
11461
11568
|
)
|
|
11462
11569
|
] })
|
|
11463
11570
|
] }),
|
|
11464
11571
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
11465
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick:
|
|
11572
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: R, className: "h-8 text-sm", children: o("Cancel") }),
|
|
11466
11573
|
/* @__PURE__ */ jsx(Button, { onClick: N, className: "h-8 text-sm", children: o("Update Token") })
|
|
11467
11574
|
] })
|
|
11468
11575
|
] }) })
|
|
11469
11576
|
] });
|
|
11470
|
-
}, PanelButton = ({ show: o, isActive: n }) => {
|
|
11471
|
-
const r = useBuilderProp("flags.designTokens", !1);
|
|
11472
|
-
return r ? /* @__PURE__ */ jsx(Button, { variant: n ? "default" : "ghost", size: "icon", onClick: o, disabled: !r, children: /* @__PURE__ */ jsx(FontStyleIcon, {}) }) : null;
|
|
11473
11577
|
}, DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(StackIcon, { className: "h-5 w-5" }) }), AddBlocksButton = ({ isActive: o, show: n }) => useIsDragAndDropEnabled() && /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-5 w-5" }) }), AskAiButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(AiIcon, {}) });
|
|
11474
11578
|
registerChaiSidebarPanel("add-block", {
|
|
11475
11579
|
button: AddBlocksButton,
|
|
@@ -11495,31 +11599,25 @@ registerChaiSidebarPanel("outline", {
|
|
|
11495
11599
|
width: DEFAULT_PANEL_WIDTH,
|
|
11496
11600
|
panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
|
|
11497
11601
|
});
|
|
11498
|
-
registerChaiSidebarPanel("desgin-tokens", {
|
|
11499
|
-
label: "Design Tokens",
|
|
11500
|
-
panel: ManageDesignTokens,
|
|
11501
|
-
position: "top",
|
|
11502
|
-
button: PanelButton
|
|
11503
|
-
});
|
|
11504
11602
|
const RootLayout = () => {
|
|
11505
|
-
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), g = reverse([...u ?? []]), m = useCallback((
|
|
11506
|
-
|
|
11603
|
+
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), g = reverse([...u ?? []]), m = useCallback((w) => {
|
|
11604
|
+
w.preventDefault();
|
|
11507
11605
|
}, []), f = useMemo(() => [p].flat(), [p]), h = useCallback(
|
|
11508
|
-
(
|
|
11509
|
-
console.log("handleMenuItemClick",
|
|
11606
|
+
(w) => {
|
|
11607
|
+
console.log("handleMenuItemClick", w, n), r(n === w ? null : w);
|
|
11510
11608
|
},
|
|
11511
11609
|
[n, r]
|
|
11512
11610
|
), { t: x } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b), k = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
11513
11611
|
useEffect(() => {
|
|
11514
11612
|
if (n !== null) {
|
|
11515
|
-
const
|
|
11516
|
-
|
|
11613
|
+
const w = find(b, { id: n });
|
|
11614
|
+
w && get(w, "view", "standard") === "standard" && (a.current = n, l(get(w, "width", DEFAULT_PANEL_WIDTH)));
|
|
11517
11615
|
}
|
|
11518
11616
|
}, [n, b]);
|
|
11519
|
-
const
|
|
11617
|
+
const v = useMemo(() => {
|
|
11520
11618
|
if (n === null) return 0;
|
|
11521
|
-
const
|
|
11522
|
-
return get(
|
|
11619
|
+
const w = find(b, { id: n });
|
|
11620
|
+
return get(w, "view", "standard") === "standard" ? k : i;
|
|
11523
11621
|
}, [n, k, i, b]), A = useCallback(() => {
|
|
11524
11622
|
r(a.current);
|
|
11525
11623
|
}, [r, n]), B = useCallback(() => {
|
|
@@ -11529,8 +11627,8 @@ const RootLayout = () => {
|
|
|
11529
11627
|
n !== null && !find(b, { id: n }) && r("outline");
|
|
11530
11628
|
}, [n, b]);
|
|
11531
11629
|
const _ = useCallback(
|
|
11532
|
-
(
|
|
11533
|
-
h(
|
|
11630
|
+
(w) => {
|
|
11631
|
+
h(w);
|
|
11534
11632
|
},
|
|
11535
11633
|
[h]
|
|
11536
11634
|
);
|
|
@@ -11544,33 +11642,33 @@ const RootLayout = () => {
|
|
|
11544
11642
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
11545
11643
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
11546
11644
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
11547
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((
|
|
11548
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
11645
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11646
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11549
11647
|
position: "top",
|
|
11550
|
-
panelId:
|
|
11551
|
-
isActive: n ===
|
|
11552
|
-
show: () => _(
|
|
11648
|
+
panelId: w.id,
|
|
11649
|
+
isActive: n === w.id,
|
|
11650
|
+
show: () => _(w.id)
|
|
11553
11651
|
}) }),
|
|
11554
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
11555
|
-
] }, "button-top-" +
|
|
11652
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11653
|
+
] }, "button-top-" + j)) }),
|
|
11556
11654
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
11557
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((
|
|
11558
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
11655
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11656
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11559
11657
|
position: "bottom",
|
|
11560
|
-
panelId:
|
|
11561
|
-
isActive: n ===
|
|
11562
|
-
show: () => _(
|
|
11658
|
+
panelId: w.id,
|
|
11659
|
+
isActive: n === w.id,
|
|
11660
|
+
show: () => _(w.id)
|
|
11563
11661
|
}) }),
|
|
11564
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
11565
|
-
] }, "button-bottom-" +
|
|
11662
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11663
|
+
] }, "button-bottom-" + j)) })
|
|
11566
11664
|
] }),
|
|
11567
11665
|
/* @__PURE__ */ jsx(
|
|
11568
11666
|
motion.div,
|
|
11569
11667
|
{
|
|
11570
11668
|
id: "left-panel",
|
|
11571
11669
|
className: "h-full max-h-full border-r border-border",
|
|
11572
|
-
initial: { width:
|
|
11573
|
-
animate: { width:
|
|
11670
|
+
initial: { width: v },
|
|
11671
|
+
animate: { width: v },
|
|
11574
11672
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
11575
11673
|
children: n !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
11576
11674
|
/* @__PURE__ */ jsx(
|
|
@@ -11601,7 +11699,22 @@ const RootLayout = () => {
|
|
|
11601
11699
|
/* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
11602
11700
|
" ",
|
|
11603
11701
|
x("AI Assistant")
|
|
11604
|
-
] }) }) : c === "
|
|
11702
|
+
] }) }) : c === "design-tokens" ? /* @__PURE__ */ jsxs("div", { className: "mb-1 flex w-full items-center justify-between gap-2", children: [
|
|
11703
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
11704
|
+
/* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
11705
|
+
x("Design Tokens")
|
|
11706
|
+
] }),
|
|
11707
|
+
/* @__PURE__ */ jsx(
|
|
11708
|
+
Button,
|
|
11709
|
+
{
|
|
11710
|
+
onClick: () => d("block"),
|
|
11711
|
+
variant: "ghost",
|
|
11712
|
+
size: "icon",
|
|
11713
|
+
className: "text-xs",
|
|
11714
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4 rtl:ml-2" })
|
|
11715
|
+
}
|
|
11716
|
+
)
|
|
11717
|
+
] }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
11605
11718
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
11606
11719
|
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
11607
11720
|
x("Theme Settings")
|
|
@@ -11617,7 +11730,7 @@ const RootLayout = () => {
|
|
|
11617
11730
|
}
|
|
11618
11731
|
)
|
|
11619
11732
|
] }) : null }) }) }),
|
|
11620
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: c === "ai" ? /* @__PURE__ */ jsx(AskAI, {}) : c === "theme" ? /* @__PURE__ */ jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
|
|
11733
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: c === "ai" ? /* @__PURE__ */ jsx(AskAI, {}) : c === "design-tokens" ? /* @__PURE__ */ jsx(ManageDesignTokens, {}) : c === "theme" ? /* @__PURE__ */ jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
|
|
11621
11734
|
] }) })
|
|
11622
11735
|
}
|
|
11623
11736
|
)
|
|
@@ -11749,8 +11862,8 @@ const RootLayout = () => {
|
|
|
11749
11862
|
});
|
|
11750
11863
|
}, f = (x) => {
|
|
11751
11864
|
if (!c) return;
|
|
11752
|
-
const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth,
|
|
11753
|
-
r(_,
|
|
11865
|
+
const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth, v = C.offsetHeight, A = window.innerWidth - k, B = window.innerHeight - v, _ = Math.max(0, Math.min(b, A)), w = Math.max(0, Math.min(y, B));
|
|
11866
|
+
r(_, w);
|
|
11754
11867
|
}, h = () => {
|
|
11755
11868
|
d(!1);
|
|
11756
11869
|
};
|
|
@@ -11992,10 +12105,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
11992
12105
|
var r;
|
|
11993
12106
|
const a = getBuildingBlocks(o), i = a[1], l = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], f = a[14], h = a[16], x = a[17], b = u(o, n);
|
|
11994
12107
|
if (isAtomStateInitialized(b) && (i.has(n) && l.get(n) !== b.n || Array.from(b.d).every(
|
|
11995
|
-
([
|
|
12108
|
+
([w, j]) => (
|
|
11996
12109
|
// Recursively, read the atom state of the dependency, and
|
|
11997
12110
|
// check if the atom epoch number is unchanged
|
|
11998
|
-
f(o,
|
|
12111
|
+
f(o, w).n === j
|
|
11999
12112
|
)
|
|
12000
12113
|
)))
|
|
12001
12114
|
return b;
|
|
@@ -12004,34 +12117,34 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12004
12117
|
function C() {
|
|
12005
12118
|
i.has(n) && (x(o, n), m(o), g(o));
|
|
12006
12119
|
}
|
|
12007
|
-
function k(
|
|
12008
|
-
var
|
|
12009
|
-
if (isSelfAtom(n,
|
|
12010
|
-
const
|
|
12011
|
-
if (!isAtomStateInitialized(
|
|
12012
|
-
if (hasInitialValue(
|
|
12013
|
-
setAtomStateValueOrPromise(o,
|
|
12120
|
+
function k(w) {
|
|
12121
|
+
var j;
|
|
12122
|
+
if (isSelfAtom(n, w)) {
|
|
12123
|
+
const E = u(o, w);
|
|
12124
|
+
if (!isAtomStateInitialized(E))
|
|
12125
|
+
if (hasInitialValue(w))
|
|
12126
|
+
setAtomStateValueOrPromise(o, w, w.init);
|
|
12014
12127
|
else
|
|
12015
12128
|
throw new Error("no atom init");
|
|
12016
|
-
return returnAtomValue(
|
|
12129
|
+
return returnAtomValue(E);
|
|
12017
12130
|
}
|
|
12018
|
-
const S = f(o,
|
|
12131
|
+
const S = f(o, w);
|
|
12019
12132
|
try {
|
|
12020
12133
|
return returnAtomValue(S);
|
|
12021
12134
|
} finally {
|
|
12022
|
-
b.d.set(
|
|
12135
|
+
b.d.set(w, S.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, S), (j = i.get(w)) == null || j.t.add(n), y || C();
|
|
12023
12136
|
}
|
|
12024
12137
|
}
|
|
12025
|
-
let
|
|
12138
|
+
let v, A;
|
|
12026
12139
|
const B = {
|
|
12027
12140
|
get signal() {
|
|
12028
|
-
return
|
|
12141
|
+
return v || (v = new AbortController()), v.signal;
|
|
12029
12142
|
},
|
|
12030
12143
|
get setSelf() {
|
|
12031
|
-
return !A && isActuallyWritableAtom(n) && (A = (...
|
|
12144
|
+
return !A && isActuallyWritableAtom(n) && (A = (...w) => {
|
|
12032
12145
|
if (!y)
|
|
12033
12146
|
try {
|
|
12034
|
-
return h(o, n, ...
|
|
12147
|
+
return h(o, n, ...w);
|
|
12035
12148
|
} finally {
|
|
12036
12149
|
m(o), g(o);
|
|
12037
12150
|
}
|
|
@@ -12039,10 +12152,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12039
12152
|
}
|
|
12040
12153
|
}, _ = b.n;
|
|
12041
12154
|
try {
|
|
12042
|
-
const
|
|
12043
|
-
return setAtomStateValueOrPromise(o, n,
|
|
12044
|
-
} catch (
|
|
12045
|
-
return delete b.v, b.e =
|
|
12155
|
+
const w = p(o, n, k, B);
|
|
12156
|
+
return setAtomStateValueOrPromise(o, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () => v == null ? void 0 : v.abort()), w.then(C, C)), b;
|
|
12157
|
+
} catch (w) {
|
|
12158
|
+
return delete b.v, b.e = w, ++b.n, b;
|
|
12046
12159
|
} finally {
|
|
12047
12160
|
y = !1, _ !== b.n && l.get(n) === _ && (l.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
12048
12161
|
}
|
|
@@ -12060,13 +12173,13 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12060
12173
|
let h = !0;
|
|
12061
12174
|
const x = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
|
|
12062
12175
|
var k;
|
|
12063
|
-
const
|
|
12176
|
+
const v = d(o, y);
|
|
12064
12177
|
try {
|
|
12065
12178
|
if (isSelfAtom(n, y)) {
|
|
12066
12179
|
if (!hasInitialValue(y))
|
|
12067
12180
|
throw new Error("atom not writable");
|
|
12068
|
-
const A =
|
|
12069
|
-
setAtomStateValueOrPromise(o, y, B), f(o, y), A !==
|
|
12181
|
+
const A = v.n, B = C[0];
|
|
12182
|
+
setAtomStateValueOrPromise(o, y, B), f(o, y), A !== v.n && (i.add(y), (k = l.c) == null || k.call(l, y), m(o, y));
|
|
12070
12183
|
return;
|
|
12071
12184
|
} else
|
|
12072
12185
|
return writeAtomState(o, y, ...C);
|
|
@@ -12477,7 +12590,7 @@ function domToJsx(o, n = 0) {
|
|
|
12477
12590
|
(x, b) => {
|
|
12478
12591
|
const [y, C] = b.split(":").map((k) => k.trim());
|
|
12479
12592
|
if (y && C) {
|
|
12480
|
-
const k = y.replace(/-([a-z])/g, (
|
|
12593
|
+
const k = y.replace(/-([a-z])/g, (v) => v[1].toUpperCase());
|
|
12481
12594
|
x[k] = C.replace(/['"]/g, "");
|
|
12482
12595
|
}
|
|
12483
12596
|
return x;
|
|
@@ -12604,19 +12717,19 @@ ${i})
|
|
|
12604
12717
|
u(!1);
|
|
12605
12718
|
let k = l({ blockId: i == null ? void 0 : i._id, additionalCoreBlocks: ["Icon"] });
|
|
12606
12719
|
k = k.replace(/\s*bid=["'][^"']*["']/g, "");
|
|
12607
|
-
const
|
|
12720
|
+
const v = o === "ts", {
|
|
12608
12721
|
jsx: A,
|
|
12609
12722
|
html: B,
|
|
12610
12723
|
componentName: _
|
|
12611
12724
|
} = await getExportedCoded({
|
|
12612
12725
|
selectedBlock: i,
|
|
12613
12726
|
html: k,
|
|
12614
|
-
isTypeScript:
|
|
12727
|
+
isTypeScript: v
|
|
12615
12728
|
});
|
|
12616
12729
|
a({ html: B, jsx: A }), d(_), u(!0);
|
|
12617
12730
|
} catch {
|
|
12618
|
-
const
|
|
12619
|
-
a({ html:
|
|
12731
|
+
const v = "<div>Export failed. Close the modal and try again.</div>";
|
|
12732
|
+
a({ html: v, jsx: v }), toast.error(n("Failed to generate export HTML"));
|
|
12620
12733
|
}
|
|
12621
12734
|
}, [n, o, i, l]);
|
|
12622
12735
|
useEffect(() => {
|
|
@@ -12632,17 +12745,17 @@ ${i})
|
|
|
12632
12745
|
},
|
|
12633
12746
|
[n]
|
|
12634
12747
|
), x = (k) => {
|
|
12635
|
-
const
|
|
12748
|
+
const v = new Blob([k], { type: "text/jsx" }), A = URL.createObjectURL(v), B = document.createElement("a");
|
|
12636
12749
|
B.href = A, B.download = g(), document.body.appendChild(B), B.click(), URL.revokeObjectURL(A), document.body.removeChild(B), toast.success(n("Export code downloaded successfully!"));
|
|
12637
12750
|
}, b = /* @__PURE__ */ jsxs("span", { children: [
|
|
12638
12751
|
"Download ",
|
|
12639
12752
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-light text-gray-300", children: g() })
|
|
12640
12753
|
] }), y = useMemo(() => {
|
|
12641
|
-
const k = { extend: shadcnTheme() },
|
|
12754
|
+
const k = { extend: shadcnTheme() }, v = JSON.stringify(k, null, 2);
|
|
12642
12755
|
return `{
|
|
12643
12756
|
// Your tailwind config ...
|
|
12644
12757
|
|
|
12645
|
-
"theme": ${
|
|
12758
|
+
"theme": ${v == null ? void 0 : v.split(`
|
|
12646
12759
|
`).join(`
|
|
12647
12760
|
`)},
|
|
12648
12761
|
}`;
|