@chaibuilder/sdk 3.1.32 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apply-binding-BwPhgnhk.js → apply-binding-CSWwWMjY.js} +106 -105
- package/dist/apply-binding-DLHh7HoS.cjs +1 -0
- package/dist/{code-editor-tNvYQ21U.js → code-editor-BZMSNYkF.js} +1 -1
- package/dist/{code-editor-DniWNMiF.cjs → code-editor-DRCY5ruT.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{index-x0hEzxrt.js → index-CAiYwkFz.js} +194 -189
- package/dist/{index-Cw-O8A8U.cjs → index-DIVARO6Y.cjs} +2 -2
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-BjpCMgJv.cjs → rte-widget-modal-C7aXKVn4.cjs} +1 -1
- package/dist/{rte-widget-modal-vV5HE2hd.js → rte-widget-modal-DwKI9icC.js} +1 -1
- package/package.json +1 -1
- package/dist/apply-binding-Dblf6wMG.cjs +0 -1
|
@@ -13,7 +13,7 @@ import { twMerge } from "tailwind-merge";
|
|
|
13
13
|
import TreeModel from "tree-model";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import React__default, { useEffect, useCallback, useState, useMemo, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
|
|
16
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-
|
|
16
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-CSWwWMjY.js";
|
|
17
17
|
import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
|
|
18
18
|
import { isObject } from "@rjsf/utils";
|
|
19
19
|
import { toast, Toaster } from "sonner";
|
|
@@ -1060,7 +1060,7 @@ const undoRedoStateAtom = atom({
|
|
|
1060
1060
|
return {
|
|
1061
1061
|
moveBlocks: (x, b, y) => {
|
|
1062
1062
|
const C = map(x, (v) => {
|
|
1063
|
-
const B = n.find((
|
|
1063
|
+
const B = n.find((E) => E._id === v)._parent || null, w = n.filter((E) => B ? E._parent === B : !E._parent).map((E) => E._id).indexOf(v);
|
|
1064
1064
|
return { _id: v, oldParent: B, oldPosition: w };
|
|
1065
1065
|
}), k = C.find(({ _id: v }) => v === x[0]);
|
|
1066
1066
|
k && k.oldParent === b && k.oldPosition === y || (l(x, b, y), o({
|
|
@@ -2609,8 +2609,8 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2609
2609
|
}
|
|
2610
2610
|
if (f === "styles") {
|
|
2611
2611
|
const _ = A.map((w) => {
|
|
2612
|
-
for (const
|
|
2613
|
-
|
|
2612
|
+
for (const E in w)
|
|
2613
|
+
E !== "_id" && (w[E] = `${STYLES_KEY},${w[E]}`);
|
|
2614
2614
|
return w;
|
|
2615
2615
|
});
|
|
2616
2616
|
c(_);
|
|
@@ -3536,9 +3536,9 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3536
3536
|
d = d.parentElement;
|
|
3537
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 w = getChildBlocks(o),
|
|
3540
|
-
if (
|
|
3541
|
-
const S =
|
|
3539
|
+
const w = getChildBlocks(o), E = w[w.length - 1];
|
|
3540
|
+
if (E) {
|
|
3541
|
+
const S = E.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = j.width - I - D, R = j.left + x + I;
|
|
3542
3542
|
return {
|
|
3543
3543
|
position: "after",
|
|
3544
3544
|
placeholderOrientation: "horizontal",
|
|
@@ -3548,8 +3548,8 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3548
3548
|
width: P,
|
|
3549
3549
|
height: 4
|
|
3550
3550
|
},
|
|
3551
|
-
targetElement:
|
|
3552
|
-
targetBlockId:
|
|
3551
|
+
targetElement: E,
|
|
3552
|
+
targetBlockId: E.getAttribute("data-block-id"),
|
|
3553
3553
|
targetParentId: "canvas",
|
|
3554
3554
|
isEmpty: !1,
|
|
3555
3555
|
confidence: 1
|
|
@@ -3559,18 +3559,18 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3559
3559
|
if (f && !m && hasChildBlocks(o)) {
|
|
3560
3560
|
const w = detectGapZone(o, n, r, g);
|
|
3561
3561
|
if (w) {
|
|
3562
|
-
const
|
|
3562
|
+
const E = w.before.getBoundingClientRect(), S = w.after.getBoundingClientRect(), j = 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
3563
|
let $ = 0;
|
|
3564
3564
|
if (R.forEach((F) => {
|
|
3565
3565
|
const O = F.getBoundingClientRect();
|
|
3566
3566
|
O.height > $ && ($ = O.height);
|
|
3567
3567
|
}), g === "vertical") {
|
|
3568
|
-
const F =
|
|
3568
|
+
const F = j.width - I - D, O = j.left + x + I;
|
|
3569
3569
|
return {
|
|
3570
3570
|
position: "after",
|
|
3571
3571
|
placeholderOrientation: "horizontal",
|
|
3572
3572
|
rect: {
|
|
3573
|
-
top:
|
|
3573
|
+
top: E.bottom + h,
|
|
3574
3574
|
left: O,
|
|
3575
3575
|
width: F,
|
|
3576
3576
|
height: 4
|
|
@@ -3583,13 +3583,13 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3583
3583
|
// High confidence for gap zones
|
|
3584
3584
|
};
|
|
3585
3585
|
} else {
|
|
3586
|
-
const F =
|
|
3586
|
+
const F = E.top + h, O = $ > 0 ? $ : Math.max(E.height, S.height);
|
|
3587
3587
|
return {
|
|
3588
3588
|
position: "after",
|
|
3589
3589
|
placeholderOrientation: "vertical",
|
|
3590
3590
|
rect: {
|
|
3591
3591
|
top: F,
|
|
3592
|
-
left:
|
|
3592
|
+
left: E.right + x,
|
|
3593
3593
|
width: 4,
|
|
3594
3594
|
height: O
|
|
3595
3595
|
},
|
|
@@ -3605,13 +3605,13 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3605
3605
|
if (d && p) {
|
|
3606
3606
|
const w = detectParentEdgeProximity(d, n, r, u);
|
|
3607
3607
|
if (w) {
|
|
3608
|
-
const
|
|
3608
|
+
const E = d.getBoundingClientRect(), S = window.getComputedStyle(d), j = 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
3609
|
if (w === "start") {
|
|
3610
3610
|
const O = getChildBlocks(d)[0];
|
|
3611
3611
|
if (O) {
|
|
3612
3612
|
const L = O.getBoundingClientRect();
|
|
3613
3613
|
if (u === "vertical") {
|
|
3614
|
-
const T =
|
|
3614
|
+
const T = E.width - j - N, M = E.left + R + j;
|
|
3615
3615
|
return {
|
|
3616
3616
|
position: "before",
|
|
3617
3617
|
placeholderOrientation: $,
|
|
@@ -3627,7 +3627,7 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3627
3627
|
confidence: 0.9
|
|
3628
3628
|
};
|
|
3629
3629
|
} else {
|
|
3630
|
-
const T =
|
|
3630
|
+
const T = E.top + P + I, M = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
|
|
3631
3631
|
return {
|
|
3632
3632
|
position: "before",
|
|
3633
3633
|
placeholderOrientation: $,
|
|
@@ -3649,7 +3649,7 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3649
3649
|
if (L) {
|
|
3650
3650
|
const T = L.getBoundingClientRect();
|
|
3651
3651
|
if (u === "vertical") {
|
|
3652
|
-
const M =
|
|
3652
|
+
const M = E.width - j - N, H = E.left + R + j;
|
|
3653
3653
|
return {
|
|
3654
3654
|
position: "after",
|
|
3655
3655
|
placeholderOrientation: $,
|
|
@@ -3665,7 +3665,7 @@ function detectDropZone(o, n, r, a, i) {
|
|
|
3665
3665
|
confidence: 0.9
|
|
3666
3666
|
};
|
|
3667
3667
|
} else {
|
|
3668
|
-
const M =
|
|
3668
|
+
const M = E.top + P + I, H = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
|
|
3669
3669
|
return {
|
|
3670
3670
|
position: "after",
|
|
3671
3671
|
placeholderOrientation: $,
|
|
@@ -3760,11 +3760,11 @@ function getSiblingsInSameRow(o, n, r) {
|
|
|
3760
3760
|
}
|
|
3761
3761
|
function calculatePlaceholderRect(o, n, r, a, i) {
|
|
3762
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",
|
|
3764
|
-
let
|
|
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", E = n ? getChildBlocks(n) : [], S = getSiblingsInSameRow(E, o, w);
|
|
3764
|
+
let j = 0, N = 0;
|
|
3765
3765
|
if (S.forEach((P) => {
|
|
3766
3766
|
const R = P.getBoundingClientRect();
|
|
3767
|
-
R.height >
|
|
3767
|
+
R.height > j && (j = R.height), R.width > N && (N = R.width);
|
|
3768
3768
|
}), r === "before")
|
|
3769
3769
|
if (a === "horizontal") {
|
|
3770
3770
|
const P = C ? C.width - k - v : l.width, R = C ? C.left + p + k : l.left + p;
|
|
@@ -3775,7 +3775,7 @@ function calculatePlaceholderRect(o, n, r, a, i) {
|
|
|
3775
3775
|
height: 4
|
|
3776
3776
|
};
|
|
3777
3777
|
} else {
|
|
3778
|
-
const P = l.top + d, R = w === "horizontal" &&
|
|
3778
|
+
const P = l.top + d, R = w === "horizontal" && j > 0 ? j : _.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,
|
|
@@ -3793,7 +3793,7 @@ function calculatePlaceholderRect(o, n, r, a, i) {
|
|
|
3793
3793
|
height: 4
|
|
3794
3794
|
};
|
|
3795
3795
|
} else {
|
|
3796
|
-
const P = l.top + d, R = w === "horizontal" &&
|
|
3796
|
+
const P = l.top + d, R = w === "horizontal" && j > 0 ? j : _.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,
|
|
@@ -3884,10 +3884,10 @@ const LEAF_BLOCK_TYPES = [
|
|
|
3884
3884
|
d.current = null;
|
|
3885
3885
|
return;
|
|
3886
3886
|
}
|
|
3887
|
-
const
|
|
3888
|
-
f.scrollBy(0,
|
|
3889
|
-
const S = f.scrollY,
|
|
3890
|
-
v === "up" &&
|
|
3887
|
+
const E = v === "up" ? -_ : _;
|
|
3888
|
+
f.scrollBy(0, E);
|
|
3889
|
+
const S = f.scrollY, j = S > 0, N = S + h < b, I = p.current, D = h - p.current;
|
|
3890
|
+
v === "up" && j && 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
3892
|
d.current === null && (d.current = requestAnimationFrame(w));
|
|
3893
3893
|
}
|
|
@@ -3926,17 +3926,17 @@ const LEAF_BLOCK_TYPES = [
|
|
|
3926
3926
|
return;
|
|
3927
3927
|
_ = canAcceptChildBlock(B, C);
|
|
3928
3928
|
} else {
|
|
3929
|
-
let S = h.parentElement,
|
|
3929
|
+
let S = h.parentElement, j = "Box";
|
|
3930
3930
|
for (; S && !S.hasAttribute("data-block-id"); )
|
|
3931
3931
|
S = S.parentElement;
|
|
3932
|
-
if (S && (
|
|
3932
|
+
if (S && (j = S.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
|
|
3933
3933
|
return;
|
|
3934
|
-
_ = canAcceptChildBlock(
|
|
3934
|
+
_ = canAcceptChildBlock(j, C);
|
|
3935
3935
|
}
|
|
3936
3936
|
if (!_)
|
|
3937
3937
|
return;
|
|
3938
3938
|
i(A.targetParentId);
|
|
3939
|
-
const
|
|
3939
|
+
const E = 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: E
|
|
3952
3952
|
}), removeDropTargetAttributes$1(c), A.targetElement.setAttribute("data-drop-target", "true");
|
|
3953
3953
|
}, 300),
|
|
3954
3954
|
[c, o, r, a, i, l, u]
|
|
@@ -5530,14 +5530,14 @@ const RichTextEditor = memo(
|
|
|
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
5532
|
const w = o._type;
|
|
5533
|
-
let
|
|
5533
|
+
let E = 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}`) && (
|
|
5535
|
+
return h && ((N = S == null ? void 0 : S.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (E = get(o, `${r}-${h}`)), { blockContent: E, blockType: w };
|
|
5536
5536
|
}, [o, h]), v = useCallback(
|
|
5537
5537
|
(w) => {
|
|
5538
5538
|
var S;
|
|
5539
|
-
const
|
|
5540
|
-
f([y], { [r]:
|
|
5539
|
+
const E = w || ((S = g.current) == null ? void 0 : S.innerText);
|
|
5540
|
+
f([y], { [r]: E }), 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(
|
|
@@ -5549,17 +5549,17 @@ const RichTextEditor = memo(
|
|
|
5549
5549
|
), B = useCallback(
|
|
5550
5550
|
(w) => {
|
|
5551
5551
|
w.preventDefault(), y && (b.current = y), v(), setTimeout(() => {
|
|
5552
|
-
const
|
|
5553
|
-
b.current = null, x([
|
|
5552
|
+
const E = b.current;
|
|
5553
|
+
b.current = null, x([E]);
|
|
5554
5554
|
}, 100);
|
|
5555
5555
|
},
|
|
5556
5556
|
[x, y, h]
|
|
5557
5557
|
);
|
|
5558
5558
|
useEffect(() => {
|
|
5559
|
-
var
|
|
5559
|
+
var j;
|
|
5560
5560
|
if (!y) return;
|
|
5561
|
-
const w = `[data-block-id="${y}"]`,
|
|
5562
|
-
S && ((
|
|
5561
|
+
const w = `[data-block-id="${y}"]`, E = l >= 0 ? `[data-block-index="${l}"]` : "", S = a.querySelector(`${w}${E}`);
|
|
5562
|
+
S && ((j = S == null ? void 0 : S.classList) == null || j.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,
|
|
@@ -5640,7 +5640,7 @@ const RichTextEditor = memo(
|
|
|
5640
5640
|
onDragStart: v.onDragStart,
|
|
5641
5641
|
onDragEnd: v.onDragEnd
|
|
5642
5642
|
} : D;
|
|
5643
|
-
}, [l._id, l._type, h, k, C, v]),
|
|
5643
|
+
}, [l._id, l._type, h, k, C, v]), E = useMemo(
|
|
5644
5644
|
() => ({
|
|
5645
5645
|
blockProps: w,
|
|
5646
5646
|
inBuilder: b === "edit",
|
|
@@ -5651,10 +5651,10 @@ const RichTextEditor = memo(
|
|
|
5651
5651
|
...o
|
|
5652
5652
|
}),
|
|
5653
5653
|
[b, w, d, p, A, B, _, o]
|
|
5654
|
-
), S = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]),
|
|
5655
|
-
if (isNull(f) || !
|
|
5654
|
+
), S = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), j = useMemo(() => get(l, "_show", !0), [l]);
|
|
5655
|
+
if (isNull(f) || !j) return null;
|
|
5656
5656
|
let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
5657
|
-
...
|
|
5657
|
+
...E,
|
|
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-BZMSNYkF.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, {}) }) }),
|
|
@@ -6182,11 +6182,11 @@ const DataBindingSelector = ({
|
|
|
6182
6182
|
if (v !== A)
|
|
6183
6183
|
C.chain().deleteSelection().insertContent(k).run();
|
|
6184
6184
|
else {
|
|
6185
|
-
const { state: _ } = C, w = _.selection.from,
|
|
6186
|
-
let
|
|
6187
|
-
w > 0 &&
|
|
6185
|
+
const { state: _ } = C, w = _.selection.from, E = _.doc.textBetween(Math.max(0, w - 1), w), S = _.doc.textBetween(w, Math.min(w + 1, _.doc.content.size));
|
|
6186
|
+
let j = "";
|
|
6187
|
+
w > 0 && E !== " " && !h(E) && (j = " ");
|
|
6188
6188
|
let N = "";
|
|
6189
|
-
S && S !== " " && !h(S) && (N = " "), C.chain().insertContent(
|
|
6189
|
+
S && S !== " " && !h(S) && (N = " "), C.chain().insertContent(j + k + N).run();
|
|
6190
6190
|
}
|
|
6191
6191
|
setTimeout(() => n(C.getHTML(), {}, r), 100);
|
|
6192
6192
|
return;
|
|
@@ -6194,12 +6194,12 @@ const DataBindingSelector = ({
|
|
|
6194
6194
|
} else {
|
|
6195
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: j } = x(v, k, S), N = v.slice(0, k) + j + v.slice(A);
|
|
6198
6198
|
n(N, {}, r);
|
|
6199
6199
|
return;
|
|
6200
6200
|
}
|
|
6201
|
-
const _ = `{{${m}}}`, { text: w } = x(v, k, _),
|
|
6202
|
-
n(
|
|
6201
|
+
const _ = `{{${m}}}`, { text: w } = x(v, k, _), E = v.slice(0, k) + w + v.slice(k);
|
|
6202
|
+
n(E, {}, r);
|
|
6203
6203
|
}
|
|
6204
6204
|
},
|
|
6205
6205
|
[r, n, a, d == null ? void 0 : d._id, p]
|
|
@@ -6220,13 +6220,13 @@ 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 E;
|
|
6224
|
+
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (S, j) => []), [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 = (E = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : E.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, ":"), j = get(S, 1, "page") || "page";
|
|
6228
|
+
g(j), (async () => {
|
|
6229
|
+
const N = await i(j, [get(S, 2, "page")]);
|
|
6230
6230
|
N && Array.isArray(N) && f(get(N, [0, "name"], ""));
|
|
6231
6231
|
})();
|
|
6232
6232
|
}, [o]);
|
|
@@ -6235,23 +6235,23 @@ const DataBindingSelector = ({
|
|
|
6235
6235
|
if (isEmpty(S))
|
|
6236
6236
|
x([]);
|
|
6237
6237
|
else {
|
|
6238
|
-
const
|
|
6239
|
-
x(
|
|
6238
|
+
const j = await i(u, S);
|
|
6239
|
+
x(j);
|
|
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 j = ["pageType", u, S.id];
|
|
6247
|
+
j[1] && (r(j.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((j) => j < h.length - 1 ? j + 1 : j);
|
|
6252
6252
|
break;
|
|
6253
6253
|
case "ArrowUp":
|
|
6254
|
-
S.preventDefault(), y((
|
|
6254
|
+
S.preventDefault(), y((j) => j > 0 ? j - 1 : j);
|
|
6255
6255
|
break;
|
|
6256
6256
|
case "Enter":
|
|
6257
6257
|
if (S.preventDefault(), h.length === 0) return;
|
|
@@ -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, j) => /* @__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" : j === 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-DwKI9icC.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,
|
|
@@ -6662,7 +6662,7 @@ const DataBindingSelector = ({
|
|
|
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 E = 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.", ""), j = 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
|
+
E && /* @__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
|
+
j ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6722
6722
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6723
6723
|
"svg",
|
|
6724
6724
|
{
|
|
@@ -6875,8 +6875,8 @@ function BlockSettings() {
|
|
|
6875
6875
|
try {
|
|
6876
6876
|
const { schema: _, uiSchema: w } = getBlockFormSchemas(B);
|
|
6877
6877
|
if (B === "Repeater") {
|
|
6878
|
-
const
|
|
6879
|
-
startsWith(
|
|
6878
|
+
const E = get(n, "repeaterItems", "");
|
|
6879
|
+
startsWith(E, `{{${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
6881
|
return { schema: _, uiSchema: w };
|
|
6882
6882
|
} catch {
|
|
@@ -7139,35 +7139,35 @@ const BlockStylingProps = () => {
|
|
|
7139
7139
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
7140
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: j } = getClassValueAndUnit(l);
|
|
7143
|
+
if (j === "") {
|
|
7144
7144
|
i(S), f(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
7145
7145
|
return;
|
|
7146
7146
|
}
|
|
7147
|
-
f(
|
|
7147
|
+
f(j), i(j === "class" || isEmpty(S) ? "" : S);
|
|
7148
7148
|
}, [l, p, u]);
|
|
7149
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 j = getUserInputValues(`${a}`, u);
|
|
7152
|
+
if (get(j, "error", !1)) {
|
|
7153
7153
|
x(!0);
|
|
7154
7154
|
return;
|
|
7155
7155
|
}
|
|
7156
|
-
const N = get(
|
|
7156
|
+
const N = get(j, "unit") !== "" ? get(j, "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(j, "value") === "")
|
|
7162
7162
|
return;
|
|
7163
|
-
const D = `${get(
|
|
7163
|
+
const D = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7164
7164
|
S ? _(D) : B(D);
|
|
7165
7165
|
},
|
|
7166
7166
|
[B, _, a, m, d, u]
|
|
7167
|
-
),
|
|
7167
|
+
), E = useCallback(
|
|
7168
7168
|
(S) => {
|
|
7169
|
-
const
|
|
7170
|
-
if (get(
|
|
7169
|
+
const j = getUserInputValues(`${a}`, u);
|
|
7170
|
+
if (get(j, "error", !1)) {
|
|
7171
7171
|
x(!0);
|
|
7172
7172
|
return;
|
|
7173
7173
|
}
|
|
@@ -7175,9 +7175,9 @@ const BlockStylingProps = () => {
|
|
|
7175
7175
|
B(`${d}${S}`);
|
|
7176
7176
|
return;
|
|
7177
7177
|
}
|
|
7178
|
-
if (get(
|
|
7178
|
+
if (get(j, "value") === "")
|
|
7179
7179
|
return;
|
|
7180
|
-
const N = get(
|
|
7180
|
+
const N = get(j, "unit") !== "" ? get(j, "unit") : S, D = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7181
7181
|
B(D);
|
|
7182
7182
|
},
|
|
7183
7183
|
[B, a, d, u]
|
|
@@ -7208,8 +7208,8 @@ const BlockStylingProps = () => {
|
|
|
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 j = parseInt$1(S.target.value);
|
|
7212
|
+
let N = isNaN$1(j) ? 0 : j;
|
|
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);
|
|
@@ -7222,8 +7222,8 @@ const BlockStylingProps = () => {
|
|
|
7222
7222
|
x(!1), i(S.target.value);
|
|
7223
7223
|
},
|
|
7224
7224
|
onClick: (S) => {
|
|
7225
|
-
var
|
|
7226
|
-
(
|
|
7225
|
+
var j;
|
|
7226
|
+
(j = S == null ? void 0 : S.target) == null || j.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), E(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 j = `${S}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.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 j = `${S}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7275
7275
|
_(I);
|
|
7276
7276
|
},
|
|
7277
7277
|
currentValue: a,
|
|
@@ -7737,9 +7737,9 @@ const COLOR_PROP = {
|
|
|
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
7739
|
(_, w = !0) => {
|
|
7740
|
-
const
|
|
7741
|
-
(p || u !== "") && (
|
|
7742
|
-
const S = generateFullClsName(
|
|
7740
|
+
const E = { dark: p, mq: g, mod: u, cls: _, property: i, fullCls: "" };
|
|
7741
|
+
(p || u !== "") && (E.mq = "xs");
|
|
7742
|
+
const S = generateFullClsName(E);
|
|
7743
7743
|
f(x, [S], w);
|
|
7744
7744
|
},
|
|
7745
7745
|
[x, p, g, u, i, f]
|
|
@@ -8080,30 +8080,30 @@ const DesignTokensIcon = ({ className: o = "" }) => /* @__PURE__ */ jsx(FontStyl
|
|
|
8080
8080
|
function ManualClasses() {
|
|
8081
8081
|
var O;
|
|
8082
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(
|
|
8083
|
+
const M = L.startsWith(DESIGN_TOKEN_PREFIX), H = T.startsWith(DESIGN_TOKEN_PREFIX);
|
|
8084
8084
|
return M && !H ? -1 : !M && H ? 1 : 0;
|
|
8085
8085
|
}), [k]), A = useBuilderProp("flags.copyPaste", !0), B = (L) => {
|
|
8086
|
-
if (L.startsWith(
|
|
8087
|
-
const T =
|
|
8088
|
-
return
|
|
8086
|
+
if (L.startsWith(DESIGN_TOKEN_PREFIX)) {
|
|
8087
|
+
const T = b[L];
|
|
8088
|
+
return T ? T.name : L;
|
|
8089
8089
|
}
|
|
8090
8090
|
return L;
|
|
8091
8091
|
}, _ = (L) => {
|
|
8092
8092
|
const T = Object.entries(b).find(([M, H]) => H.name === L);
|
|
8093
|
-
return T ?
|
|
8093
|
+
return T ? `${T[0]}` : L;
|
|
8094
8094
|
}, w = () => {
|
|
8095
8095
|
const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(_);
|
|
8096
8096
|
g(f, L, !0), x("");
|
|
8097
|
-
}, [
|
|
8097
|
+
}, [E, S] = useState([]), j = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
|
|
8098
8098
|
const T = L.trim().toLowerCase(), M = T.match(/.+:/g);
|
|
8099
8099
|
let H = [], W = [];
|
|
8100
|
-
if (
|
|
8100
|
+
if (j && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
|
|
8101
8101
|
name: U.name,
|
|
8102
|
-
id:
|
|
8102
|
+
id: `${V}`,
|
|
8103
8103
|
isDesignToken: !0
|
|
8104
8104
|
})) : W = Object.entries(b).filter(([V, U]) => U.name.toLowerCase().includes(T)).map(([V, U]) => ({
|
|
8105
8105
|
name: U.name,
|
|
8106
|
-
id:
|
|
8106
|
+
id: `${V}`,
|
|
8107
8107
|
isDesignToken: !0
|
|
8108
8108
|
}))), M && M.length > 0) {
|
|
8109
8109
|
const [V] = M, U = T.replace(V, "");
|
|
@@ -8135,12 +8135,12 @@ function ManualClasses() {
|
|
|
8135
8135
|
}, 0);
|
|
8136
8136
|
},
|
|
8137
8137
|
onKeyDown: (L) => {
|
|
8138
|
-
L.key === "Enter" && h.trim() !== "" && w();
|
|
8138
|
+
L.key === "Enter" && h.trim() !== "" && E.length === 0 && w();
|
|
8139
8139
|
},
|
|
8140
8140
|
onChange: (L, { newValue: T }) => x(T),
|
|
8141
8141
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
8142
8142
|
}),
|
|
8143
|
-
[h, d, o]
|
|
8143
|
+
[h, d, o, E.length]
|
|
8144
8144
|
), $ = (L) => {
|
|
8145
8145
|
const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(_);
|
|
8146
8146
|
m(f, [L]), g(f, T, !0), r(""), i(-1);
|
|
@@ -8154,24 +8154,29 @@ function ManualClasses() {
|
|
|
8154
8154
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
8155
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
8156
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-1", children: [
|
|
8157
|
-
/* @__PURE__ */ jsx("span", { children: d(
|
|
8157
|
+
/* @__PURE__ */ jsx("span", { children: d(j ? "Styles" : "Classes") }),
|
|
8158
8158
|
A && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8159
8159
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: F, className: "cursor-pointer" }) }),
|
|
8160
8160
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: d("Copy classes to clipboard") }) })
|
|
8161
8161
|
] })
|
|
8162
8162
|
] }),
|
|
8163
|
-
|
|
8163
|
+
j && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => l("design-tokens"), children: d("Design Tokens") })
|
|
8164
8164
|
] }) }),
|
|
8165
8165
|
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
|
|
8166
8166
|
/* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
|
|
8167
8167
|
Autosuggest,
|
|
8168
8168
|
{
|
|
8169
|
-
suggestions:
|
|
8169
|
+
suggestions: E,
|
|
8170
8170
|
onSuggestionsFetchRequested: N,
|
|
8171
8171
|
onSuggestionsClearRequested: I,
|
|
8172
8172
|
getSuggestionValue: D,
|
|
8173
8173
|
renderSuggestion: P,
|
|
8174
8174
|
inputProps: R,
|
|
8175
|
+
highlightFirstSuggestion: !0,
|
|
8176
|
+
onSuggestionSelected: (L, { suggestionValue: T }) => {
|
|
8177
|
+
const M = _(T);
|
|
8178
|
+
g(f, [M], !0), x("");
|
|
8179
|
+
},
|
|
8175
8180
|
containerProps: {
|
|
8176
8181
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
8177
8182
|
},
|
|
@@ -8233,7 +8238,7 @@ function ManualClasses() {
|
|
|
8233
8238
|
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"
|
|
8234
8239
|
}
|
|
8235
8240
|
),
|
|
8236
|
-
L.startsWith(
|
|
8241
|
+
L.startsWith(DESIGN_TOKEN_PREFIX) ? /* @__PURE__ */ jsx(DesignTokensIcon, { className: "text-[rgba(55, 65, 81, 0.4)] h-3.5 w-3.5 group-hover:hidden" }) : /* @__PURE__ */ jsxs(
|
|
8237
8242
|
"svg",
|
|
8238
8243
|
{
|
|
8239
8244
|
className: "h-3.5 w-3.5 group-hover:hidden",
|
|
@@ -8737,7 +8742,7 @@ const BlockCard = ({
|
|
|
8737
8742
|
A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
|
|
8738
8743
|
A.current && k(N);
|
|
8739
8744
|
}, 400);
|
|
8740
|
-
},
|
|
8745
|
+
}, E = () => {
|
|
8741
8746
|
c != null && c.id && u(c.id);
|
|
8742
8747
|
};
|
|
8743
8748
|
if (p)
|
|
@@ -8745,7 +8750,7 @@ const BlockCard = ({
|
|
|
8745
8750
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
8746
8751
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
8747
8752
|
] });
|
|
8748
|
-
const S = filter(v, (N, I) => I % 2 === 0),
|
|
8753
|
+
const S = filter(v, (N, I) => I % 2 === 0), j = filter(v, (N, I) => I % 2 === 1);
|
|
8749
8754
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
8750
8755
|
/* @__PURE__ */ jsx(SearchInput, { value: g, setValue: m }),
|
|
8751
8756
|
/* @__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: [
|
|
@@ -8764,7 +8769,7 @@ const BlockCard = ({
|
|
|
8764
8769
|
className: `no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto ${r ? "" : "pb-20"}`,
|
|
8765
8770
|
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: [
|
|
8766
8771
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: B("Failed to load the UI library. Try again") }),
|
|
8767
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
8772
|
+
/* @__PURE__ */ jsxs(Button, { onClick: E, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
8768
8773
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
8769
8774
|
B("Retry")
|
|
8770
8775
|
] })
|
|
@@ -8813,7 +8818,7 @@ const BlockCard = ({
|
|
|
8813
8818
|
},
|
|
8814
8819
|
`block-${I}`
|
|
8815
8820
|
)) }),
|
|
8816
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
8821
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: j.map((N, I) => /* @__PURE__ */ jsx(
|
|
8817
8822
|
BlockCard,
|
|
8818
8823
|
{
|
|
8819
8824
|
parentId: o,
|
|
@@ -8967,14 +8972,14 @@ const BlockCard = ({
|
|
|
8967
8972
|
(I) => reject(filter(values(_), { group: I }), { hidden: !0 }).length > 0
|
|
8968
8973
|
) : o.filter((I) => reject(filter(values(n), { group: I }), { hidden: !0 }).length > 0),
|
|
8969
8974
|
[n, _, o, p]
|
|
8970
|
-
),
|
|
8975
|
+
), E = useMemo(
|
|
8971
8976
|
() => sortBy(w, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
|
|
8972
8977
|
[w]
|
|
8973
|
-
), S = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]),
|
|
8978
|
+
), S = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), j = useMemo(() => h === "all" ? E : [h], [E, h]);
|
|
8974
8979
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
|
|
8975
8980
|
/* @__PURE__ */ jsx(SearchInput, { value: p, setValue: u }),
|
|
8976
8981
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
|
|
8977
|
-
!l &&
|
|
8982
|
+
!l && E.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: [
|
|
8978
8983
|
/* @__PURE__ */ jsx(
|
|
8979
8984
|
"button",
|
|
8980
8985
|
{
|
|
@@ -8986,7 +8991,7 @@ const BlockCard = ({
|
|
|
8986
8991
|
},
|
|
8987
8992
|
"sidebar-all"
|
|
8988
8993
|
),
|
|
8989
|
-
|
|
8994
|
+
E.map((I) => /* @__PURE__ */ jsx(
|
|
8990
8995
|
"button",
|
|
8991
8996
|
{
|
|
8992
8997
|
onClick: () => B(I),
|
|
@@ -9001,13 +9006,13 @@ const BlockCard = ({
|
|
|
9001
9006
|
/* @__PURE__ */ jsx(
|
|
9002
9007
|
"div",
|
|
9003
9008
|
{
|
|
9004
|
-
className: `h-full flex-1 overflow-hidden ${!l &&
|
|
9009
|
+
className: `h-full flex-1 overflow-hidden ${!l && E.length > 0 ? "w-3/4" : "w-full"}`,
|
|
9005
9010
|
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: [
|
|
9006
9011
|
c("No blocks found matching"),
|
|
9007
9012
|
' "',
|
|
9008
9013
|
p,
|
|
9009
9014
|
'"'
|
|
9010
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children:
|
|
9015
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: j.map((I) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9011
9016
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
|
|
9012
9017
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
|
|
9013
9018
|
h === "all" ? filter(values(S), { group: I }) : values(S),
|
|
@@ -9501,13 +9506,13 @@ const useStructureValidation = () => {
|
|
|
9501
9506
|
T.stopPropagation(), B && o.toggle();
|
|
9502
9507
|
}, w = (T) => {
|
|
9503
9508
|
T.isInternal && (d = T.isOpen, T.isOpen && T.close());
|
|
9504
|
-
},
|
|
9509
|
+
}, E = (T) => {
|
|
9505
9510
|
T.isInternal && d !== null && (d ? T.open() : T.close(), d = null);
|
|
9506
|
-
}, [S,
|
|
9511
|
+
}, [S, j] = useAtom$1(currentAddSelection), N = () => {
|
|
9507
9512
|
var T;
|
|
9508
|
-
I(), o.parent.isSelected ||
|
|
9513
|
+
I(), o.parent.isSelected || j((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
9509
9514
|
}, I = () => {
|
|
9510
|
-
|
|
9515
|
+
j(null);
|
|
9511
9516
|
}, D = (T) => {
|
|
9512
9517
|
I(), T.stopPropagation(), !o.isOpen && B && o.toggle(), k(T);
|
|
9513
9518
|
};
|
|
@@ -9556,7 +9561,7 @@ const useStructureValidation = () => {
|
|
|
9556
9561
|
"data-node-id": f,
|
|
9557
9562
|
ref: r,
|
|
9558
9563
|
onDragStart: () => w(o),
|
|
9559
|
-
onDragEnd: () =>
|
|
9564
|
+
onDragEnd: () => E(o),
|
|
9560
9565
|
onDragOver: (T) => {
|
|
9561
9566
|
T.preventDefault(), P(f, "yes");
|
|
9562
9567
|
},
|
|
@@ -10097,13 +10102,13 @@ const useStructureValidation = () => {
|
|
|
10097
10102
|
}
|
|
10098
10103
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
10099
10104
|
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();
|
|
10100
|
-
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((
|
|
10101
|
-
d.push(
|
|
10105
|
+
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((E) => {
|
|
10106
|
+
d.push(E);
|
|
10102
10107
|
});
|
|
10103
10108
|
const [h, x] = useTheme(), b = useThemeOptions(), { t: y } = useTranslation(), C = React.useCallback(
|
|
10104
|
-
(
|
|
10109
|
+
(E) => {
|
|
10105
10110
|
const S = { ...h };
|
|
10106
|
-
setPreviousTheme(S), x(
|
|
10111
|
+
setPreviousTheme(S), x(E), f(), toast.success("Theme updated", {
|
|
10107
10112
|
action: {
|
|
10108
10113
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
10109
10114
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
@@ -10119,56 +10124,56 @@ const useStructureValidation = () => {
|
|
|
10119
10124
|
},
|
|
10120
10125
|
[h, x, f]
|
|
10121
10126
|
), k = () => {
|
|
10122
|
-
const
|
|
10123
|
-
if (
|
|
10124
|
-
const S = Object.values(
|
|
10127
|
+
const E = d.find((S) => Object.keys(S)[0] === a);
|
|
10128
|
+
if (E) {
|
|
10129
|
+
const S = Object.values(E)[0];
|
|
10125
10130
|
S && typeof S == "object" && "fontFamily" in S && "borderRadius" in S && "colors" in S ? (C(S), i(""), f()) : console.error("Invalid preset structure:", S);
|
|
10126
10131
|
} else
|
|
10127
10132
|
console.error("Preset not found:", a);
|
|
10128
|
-
}, v = (
|
|
10129
|
-
C(
|
|
10133
|
+
}, v = (E) => {
|
|
10134
|
+
C(E), i(""), f();
|
|
10130
10135
|
}, A = useDebouncedCallback(
|
|
10131
|
-
(
|
|
10136
|
+
(E, S) => {
|
|
10132
10137
|
x(() => ({
|
|
10133
10138
|
...h,
|
|
10134
10139
|
fontFamily: {
|
|
10135
10140
|
...h.fontFamily,
|
|
10136
|
-
[
|
|
10141
|
+
[E.replace(/font-/g, "")]: S
|
|
10137
10142
|
}
|
|
10138
10143
|
})), f();
|
|
10139
10144
|
},
|
|
10140
10145
|
[h, f],
|
|
10141
10146
|
200
|
|
10142
10147
|
), B = React.useCallback(
|
|
10143
|
-
(
|
|
10148
|
+
(E) => {
|
|
10144
10149
|
x(() => ({
|
|
10145
10150
|
...h,
|
|
10146
|
-
borderRadius: `${
|
|
10151
|
+
borderRadius: `${E}px`
|
|
10147
10152
|
})), f();
|
|
10148
10153
|
},
|
|
10149
10154
|
[h, f]
|
|
10150
10155
|
), _ = useDebouncedCallback(
|
|
10151
|
-
(
|
|
10156
|
+
(E, S) => {
|
|
10152
10157
|
x(() => {
|
|
10153
|
-
const
|
|
10154
|
-
return n ? set(
|
|
10158
|
+
const j = get(h, `colors.${E}`);
|
|
10159
|
+
return n ? set(j, 1, S) : set(j, 0, S), f(), {
|
|
10155
10160
|
...h,
|
|
10156
10161
|
colors: {
|
|
10157
10162
|
...h.colors,
|
|
10158
|
-
[
|
|
10163
|
+
[E]: j
|
|
10159
10164
|
}
|
|
10160
10165
|
};
|
|
10161
10166
|
});
|
|
10162
10167
|
},
|
|
10163
10168
|
[h, f],
|
|
10164
10169
|
200
|
|
10165
|
-
), w = (
|
|
10166
|
-
const
|
|
10167
|
-
return
|
|
10170
|
+
), w = (E) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(E.items).map(([S]) => {
|
|
10171
|
+
const j = get(h, `colors.${S}.${n ? 1 : 0}`);
|
|
10172
|
+
return j ? /* @__PURE__ */ jsxs("div", { id: `theme-${S}`, className: "mt-1 flex items-center gap-x-2", children: [
|
|
10168
10173
|
/* @__PURE__ */ jsx(
|
|
10169
10174
|
ColorPickerInput,
|
|
10170
10175
|
{
|
|
10171
|
-
value:
|
|
10176
|
+
value: j,
|
|
10172
10177
|
onChange: (N) => _(S, N)
|
|
10173
10178
|
}
|
|
10174
10179
|
),
|
|
@@ -10188,9 +10193,9 @@ const useStructureValidation = () => {
|
|
|
10188
10193
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
10189
10194
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
|
|
10190
10195
|
/* @__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(
|
|
10196
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((E) => {
|
|
10197
|
+
const S = Object.keys(E)[0], j = S.replaceAll("_", " ");
|
|
10198
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: S, children: capitalize(j) }, S);
|
|
10194
10199
|
}) })
|
|
10195
10200
|
] }) }),
|
|
10196
10201
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
|
|
@@ -10202,14 +10207,14 @@ const useStructureValidation = () => {
|
|
|
10202
10207
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
10203
10208
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
|
|
10204
10209
|
] }),
|
|
10205
|
-
(b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([
|
|
10210
|
+
(b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([E, S]) => /* @__PURE__ */ jsx(
|
|
10206
10211
|
FontSelector,
|
|
10207
10212
|
{
|
|
10208
|
-
label:
|
|
10209
|
-
value: h.fontFamily[
|
|
10210
|
-
onChange: (
|
|
10213
|
+
label: E,
|
|
10214
|
+
value: h.fontFamily[E.replace(/font-/g, "")] || S[Object.keys(S)[0]],
|
|
10215
|
+
onChange: (j) => A(E, j)
|
|
10211
10216
|
},
|
|
10212
|
-
|
|
10217
|
+
E
|
|
10213
10218
|
)) }),
|
|
10214
10219
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
10215
10220
|
(b == null ? void 0 : b.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -10235,7 +10240,7 @@ const useStructureValidation = () => {
|
|
|
10235
10240
|
Switch,
|
|
10236
10241
|
{
|
|
10237
10242
|
checked: n,
|
|
10238
|
-
onCheckedChange: (
|
|
10243
|
+
onCheckedChange: (E) => r(E),
|
|
10239
10244
|
"aria-label": y("Toggle dark mode"),
|
|
10240
10245
|
className: "mx-1"
|
|
10241
10246
|
}
|
|
@@ -10243,7 +10248,7 @@ const useStructureValidation = () => {
|
|
|
10243
10248
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
10244
10249
|
] })
|
|
10245
10250
|
] }),
|
|
10246
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((
|
|
10251
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((E) => w(E)) })
|
|
10247
10252
|
] }),
|
|
10248
10253
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && g && /* @__PURE__ */ jsx(
|
|
10249
10254
|
LazyCssImportModal,
|
|
@@ -11003,8 +11008,8 @@ const UndoRedo = () => {
|
|
|
11003
11008
|
r(w), i(a), c(""), p(""), f("");
|
|
11004
11009
|
}
|
|
11005
11010
|
}, k = (w) => {
|
|
11006
|
-
const
|
|
11007
|
-
r(
|
|
11011
|
+
const E = a.filter((S, j) => j !== w);
|
|
11012
|
+
r(E), i(E);
|
|
11008
11013
|
}, v = (w) => {
|
|
11009
11014
|
g(w), c(a[w].key), p(a[w].value);
|
|
11010
11015
|
}, A = () => {
|
|
@@ -11019,17 +11024,17 @@ const UndoRedo = () => {
|
|
|
11019
11024
|
}, B = (w) => {
|
|
11020
11025
|
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? A() : C());
|
|
11021
11026
|
}, _ = useCallback((w) => {
|
|
11022
|
-
const
|
|
11027
|
+
const E = (N) => /[.,!?;:]/.test(N), S = (N, I, D) => {
|
|
11023
11028
|
let P = "", R = "";
|
|
11024
11029
|
const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
|
|
11025
|
-
return I > 0 && ($ === "." || !
|
|
11030
|
+
return I > 0 && ($ === "." || !E($) && $ !== " ") && (P = " "), I < N.length && !E(F) && F !== " " && (R = " "), {
|
|
11026
11031
|
text: P + D + R,
|
|
11027
11032
|
prefixLength: P.length,
|
|
11028
11033
|
suffixLength: R.length
|
|
11029
11034
|
};
|
|
11030
|
-
},
|
|
11031
|
-
if (
|
|
11032
|
-
const N =
|
|
11035
|
+
}, j = x.current;
|
|
11036
|
+
if (j) {
|
|
11037
|
+
const N = j.selectionStart || 0, I = j.value || "", D = j.selectionEnd || N;
|
|
11033
11038
|
if (D > N) {
|
|
11034
11039
|
const O = `{{${w}}}`, { text: L } = S(I, N, O), T = I.slice(0, N) + L + I.slice(D);
|
|
11035
11040
|
p(T);
|
|
@@ -11093,16 +11098,16 @@ const UndoRedo = () => {
|
|
|
11093
11098
|
]
|
|
11094
11099
|
}
|
|
11095
11100
|
),
|
|
11096
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w,
|
|
11101
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w, E) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
11097
11102
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
11098
11103
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
|
|
11099
11104
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
|
|
11100
11105
|
] }),
|
|
11101
11106
|
/* @__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: () => v(
|
|
11103
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(
|
|
11107
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(E), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
11108
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(E), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
11104
11109
|
] })
|
|
11105
|
-
] },
|
|
11110
|
+
] }, E)) })
|
|
11106
11111
|
] });
|
|
11107
11112
|
}), BlockAttributesEditor = React.memo(() => {
|
|
11108
11113
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), i = useUpdateBlocksProps(), l = `${get(a, "0.prop")}_attrs`;
|
|
@@ -11269,7 +11274,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11269
11274
|
].filter(Boolean).find((a) => a.trim().length > 0);
|
|
11270
11275
|
return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : o._id;
|
|
11271
11276
|
}, collectTokenUsageOnPage = (o, n) => {
|
|
11272
|
-
const r =
|
|
11277
|
+
const r = `${DESIGN_TOKEN_PREFIX}${n}`;
|
|
11273
11278
|
return o.filter((a) => Object.values(a).some((i) => typeof i != "string" || !i.startsWith(STYLES_PREFIX) ? !1 : i.includes(r))).map((a) => ({
|
|
11274
11279
|
id: a._id,
|
|
11275
11280
|
label: getBlockLabel(a)
|
|
@@ -11282,10 +11287,10 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11282
11287
|
isSelected: i.includes(b.id)
|
|
11283
11288
|
})),
|
|
11284
11289
|
[p, i]
|
|
11285
|
-
), g = useMemo(() => Object.entries(d).reduce(
|
|
11290
|
+
), g = useMemo(() => d ? Object.entries(d).reduce(
|
|
11286
11291
|
(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
11292
|
[]
|
|
11288
|
-
), [d, n, o, c]), m = useMemo(
|
|
11293
|
+
) : [], [d, n, o, c]), m = useMemo(
|
|
11289
11294
|
() => g.filter((b) => !b.isPartial).map((b) => ({
|
|
11290
11295
|
id: b.id,
|
|
11291
11296
|
label: b.name
|
|
@@ -11349,7 +11354,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11349
11354
|
] })
|
|
11350
11355
|
] });
|
|
11351
11356
|
}, 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(),
|
|
11357
|
+
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(), E = (L) => {
|
|
11353
11358
|
const T = L.trim();
|
|
11354
11359
|
return T.length === 0 || T.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(T);
|
|
11355
11360
|
}, S = (L, T = !1, M) => {
|
|
@@ -11357,12 +11362,12 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11357
11362
|
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
11363
|
([V, U]) => U.name === H && (!T || V !== M)
|
|
11359
11364
|
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
11360
|
-
},
|
|
11365
|
+
}, j = () => {
|
|
11361
11366
|
if (!m.trim() || !h.trim()) {
|
|
11362
11367
|
toast.error(o("Please fill in both token name and classes"));
|
|
11363
11368
|
return;
|
|
11364
11369
|
}
|
|
11365
|
-
if (!
|
|
11370
|
+
if (!E(m)) {
|
|
11366
11371
|
toast.error(o("Invalid design token name format"));
|
|
11367
11372
|
return;
|
|
11368
11373
|
}
|
|
@@ -11370,7 +11375,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11370
11375
|
toast.error(o("Token already exists"));
|
|
11371
11376
|
return;
|
|
11372
11377
|
}
|
|
11373
|
-
const T =
|
|
11378
|
+
const T = `${DESIGN_TOKEN_PREFIX}${nanoid(12)}`, M = {
|
|
11374
11379
|
...n,
|
|
11375
11380
|
[T]: {
|
|
11376
11381
|
name: m.trim(),
|
|
@@ -11383,7 +11388,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11383
11388
|
toast.error(o("Please fill in both token name and classes"));
|
|
11384
11389
|
return;
|
|
11385
11390
|
}
|
|
11386
|
-
if (!
|
|
11391
|
+
if (!E(b)) {
|
|
11387
11392
|
toast.error(o("Invalid design token name format"));
|
|
11388
11393
|
return;
|
|
11389
11394
|
}
|
|
@@ -11533,7 +11538,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11533
11538
|
] }),
|
|
11534
11539
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
11535
11540
|
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: $, className: "h-8 text-sm", children: o("Cancel") }),
|
|
11536
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
11541
|
+
/* @__PURE__ */ jsx(Button, { onClick: j, className: "h-8 text-sm", children: o("Add Token") })
|
|
11537
11542
|
] })
|
|
11538
11543
|
] }) }),
|
|
11539
11544
|
/* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange: R, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
|
|
@@ -11642,7 +11647,7 @@ const RootLayout = () => {
|
|
|
11642
11647
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
11643
11648
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
11644
11649
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
11645
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w,
|
|
11650
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11646
11651
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11647
11652
|
position: "top",
|
|
11648
11653
|
panelId: w.id,
|
|
@@ -11650,9 +11655,9 @@ const RootLayout = () => {
|
|
|
11650
11655
|
show: () => _(w.id)
|
|
11651
11656
|
}) }),
|
|
11652
11657
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11653
|
-
] }, "button-top-" +
|
|
11658
|
+
] }, "button-top-" + E)) }),
|
|
11654
11659
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
11655
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w,
|
|
11660
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11656
11661
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11657
11662
|
position: "bottom",
|
|
11658
11663
|
panelId: w.id,
|
|
@@ -11660,7 +11665,7 @@ const RootLayout = () => {
|
|
|
11660
11665
|
show: () => _(w.id)
|
|
11661
11666
|
}) }),
|
|
11662
11667
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11663
|
-
] }, "button-bottom-" +
|
|
11668
|
+
] }, "button-bottom-" + E)) })
|
|
11664
11669
|
] }),
|
|
11665
11670
|
/* @__PURE__ */ jsx(
|
|
11666
11671
|
motion.div,
|
|
@@ -12105,10 +12110,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12105
12110
|
var r;
|
|
12106
12111
|
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);
|
|
12107
12112
|
if (isAtomStateInitialized(b) && (i.has(n) && l.get(n) !== b.n || Array.from(b.d).every(
|
|
12108
|
-
([w,
|
|
12113
|
+
([w, E]) => (
|
|
12109
12114
|
// Recursively, read the atom state of the dependency, and
|
|
12110
12115
|
// check if the atom epoch number is unchanged
|
|
12111
|
-
f(o, w).n ===
|
|
12116
|
+
f(o, w).n === E
|
|
12112
12117
|
)
|
|
12113
12118
|
)))
|
|
12114
12119
|
return b;
|
|
@@ -12118,21 +12123,21 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12118
12123
|
i.has(n) && (x(o, n), m(o), g(o));
|
|
12119
12124
|
}
|
|
12120
12125
|
function k(w) {
|
|
12121
|
-
var
|
|
12126
|
+
var E;
|
|
12122
12127
|
if (isSelfAtom(n, w)) {
|
|
12123
|
-
const
|
|
12124
|
-
if (!isAtomStateInitialized(
|
|
12128
|
+
const j = u(o, w);
|
|
12129
|
+
if (!isAtomStateInitialized(j))
|
|
12125
12130
|
if (hasInitialValue(w))
|
|
12126
12131
|
setAtomStateValueOrPromise(o, w, w.init);
|
|
12127
12132
|
else
|
|
12128
12133
|
throw new Error("no atom init");
|
|
12129
|
-
return returnAtomValue(
|
|
12134
|
+
return returnAtomValue(j);
|
|
12130
12135
|
}
|
|
12131
12136
|
const S = f(o, w);
|
|
12132
12137
|
try {
|
|
12133
12138
|
return returnAtomValue(S);
|
|
12134
12139
|
} finally {
|
|
12135
|
-
b.d.set(w, S.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, S), (
|
|
12140
|
+
b.d.set(w, S.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, S), (E = i.get(w)) == null || E.t.add(n), y || C();
|
|
12136
12141
|
}
|
|
12137
12142
|
}
|
|
12138
12143
|
let v, A;
|