@chaibuilder/sdk 3.2.0 → 3.2.1
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-BZMSNYkF.js → code-editor-BNuPxnsb.js} +1 -1
- package/dist/{code-editor-DRCY5ruT.cjs → code-editor-DKqeEOn5.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-CAiYwkFz.js → index-CXFBOH6M.js} +440 -443
- package/dist/{index-DIVARO6Y.cjs → index-CjZEAWCM.cjs} +5 -5
- package/dist/{rte-widget-modal-C7aXKVn4.cjs → rte-widget-modal-BTpBxi3g.cjs} +1 -1
- package/dist/{rte-widget-modal-DwKI9icC.js → rte-widget-modal-DuUAGYPy.js} +1 -1
- package/package.json +1 -1
|
@@ -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, (S) => {
|
|
1063
|
+
const B = n.find((j) => j._id === S)._parent || null, w = n.filter((j) => B ? j._parent === B : !j._parent).map((j) => j._id).indexOf(S);
|
|
1064
|
+
return { _id: S, oldParent: B, oldPosition: w };
|
|
1065
|
+
}), k = C.find(({ _id: S }) => S === 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: S, oldParent: A, oldPosition: B }) => {
|
|
1068
|
+
l([S], 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((S) => b ? S._parent === b : !S._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,9 +1090,9 @@ 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((
|
|
1095
|
-
return each(k, (
|
|
1093
|
+
C = map(x, (S) => {
|
|
1094
|
+
const A = n.find((E) => E._id === S), B = { _id: S };
|
|
1095
|
+
return each(k, (E) => B[E] = A[E]), B;
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
1098
1098
|
c(map(x, (k) => ({ _id: k, ...b }))), o({
|
|
@@ -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), S = {};
|
|
1116
|
+
return each(C, (A) => S[A] = k[A]), S;
|
|
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)], S = await i(f, addLangToPrompt(x, g, f), k, y), { blocks: A, error: B } = S;
|
|
2606
2606
|
if (B) {
|
|
2607
2607
|
a(B);
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
2610
|
if (f === "styles") {
|
|
2611
|
-
const
|
|
2612
|
-
for (const
|
|
2613
|
-
|
|
2611
|
+
const E = A.map((w) => {
|
|
2612
|
+
for (const j in w)
|
|
2613
|
+
j !== "_id" && (w[j] = `${STYLES_KEY},${w[j]}`);
|
|
2614
2614
|
return w;
|
|
2615
2615
|
});
|
|
2616
|
-
c(
|
|
2616
|
+
c(E);
|
|
2617
2617
|
} else
|
|
2618
2618
|
l(A);
|
|
2619
|
-
b && b(
|
|
2619
|
+
b && b(S);
|
|
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 S, A, B, E;
|
|
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 = ((S = i.defaultView) == null ? void 0 : S.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
|
|
3539
|
+
const w = getChildBlocks(o), j = w[w.length - 1];
|
|
3540
|
+
if (j) {
|
|
3541
|
+
const v = j.getBoundingClientRect(), _ = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = _.width - I - D, R = _.left + x + I;
|
|
3542
3542
|
return {
|
|
3543
3543
|
position: "after",
|
|
3544
3544
|
placeholderOrientation: "horizontal",
|
|
3545
3545
|
rect: {
|
|
3546
|
-
top:
|
|
3546
|
+
top: v.bottom + h,
|
|
3547
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
|
|
@@ -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 j = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), _ = 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 = _.width - I - D, O = _.left + x + I;
|
|
3569
3569
|
return {
|
|
3570
3570
|
position: "after",
|
|
3571
3571
|
placeholderOrientation: "horizontal",
|
|
3572
3572
|
rect: {
|
|
3573
|
-
top:
|
|
3573
|
+
top: j.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 = j.top + h, O = $ > 0 ? $ : Math.max(j.height, v.height);
|
|
3587
3587
|
return {
|
|
3588
3588
|
position: "after",
|
|
3589
3589
|
placeholderOrientation: "vertical",
|
|
3590
3590
|
rect: {
|
|
3591
3591
|
top: F,
|
|
3592
|
-
left:
|
|
3592
|
+
left: j.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 j = d.getBoundingClientRect(), v = window.getComputedStyle(d), _ = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, D = parseFloat(v.paddingBottom) || 0, P = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((E = i.defaultView) == null ? void 0 : E.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 = j.width - _ - N, M = j.left + R + _;
|
|
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 = j.top + P + I, M = F.maxHeight > 0 ? F.maxHeight : j.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 = j.width - _ - N, H = j.left + R + _;
|
|
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 = j.top + P + I, H = F.maxHeight > 0 ? F.maxHeight : j.height - I - D;
|
|
3669
3669
|
return {
|
|
3670
3670
|
position: "after",
|
|
3671
3671
|
placeholderOrientation: $,
|
|
@@ -3760,14 +3760,14 @@ 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,
|
|
3764
|
-
let
|
|
3765
|
-
if (
|
|
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, S = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, E = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", j = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(j, o, w);
|
|
3764
|
+
let _ = 0, N = 0;
|
|
3765
|
+
if (v.forEach((P) => {
|
|
3766
3766
|
const R = P.getBoundingClientRect();
|
|
3767
|
-
R.height >
|
|
3767
|
+
R.height > _ && (_ = 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 - S : l.width, R = C ? C.left + p + k : l.left + p;
|
|
3771
3771
|
return {
|
|
3772
3772
|
top: l.top + d - u - 2,
|
|
3773
3773
|
left: R,
|
|
@@ -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" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
|
|
3779
3779
|
return {
|
|
3780
3780
|
top: P,
|
|
3781
3781
|
left: l.left + p - m - 2,
|
|
@@ -3785,7 +3785,7 @@ function calculatePlaceholderRect(o, n, r, a, i) {
|
|
|
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 - S : l.width, R = C ? C.left + p + k : l.left + p;
|
|
3789
3789
|
return {
|
|
3790
3790
|
top: l.bottom + d + g - 2,
|
|
3791
3791
|
left: R,
|
|
@@ -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" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
|
|
3797
3797
|
return {
|
|
3798
3798
|
top: P,
|
|
3799
3799
|
left: l.right + p + f - 2,
|
|
@@ -3873,21 +3873,21 @@ 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, S = null, A = 0;
|
|
3877
|
+
if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && x > 0 ? (k = !0, S = "up", A = y) : C < AUTO_SCROLL_CONFIG.EDGE_ZONE && x + h < b && (k = !0, S = "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,
|
|
3881
|
+
if (k && S) {
|
|
3882
|
+
const B = 1 - A / AUTO_SCROLL_CONFIG.EDGE_ZONE, E = 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
|
|
3890
|
-
|
|
3887
|
+
const j = S === "up" ? -E : E;
|
|
3888
|
+
f.scrollBy(0, j);
|
|
3889
|
+
const v = f.scrollY, _ = v > 0, N = v + h < b, I = p.current, D = h - p.current;
|
|
3890
|
+
S === "up" && _ && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || S === "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
|
}
|
|
@@ -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, S = m.clientY;
|
|
3917
|
+
u(S);
|
|
3918
|
+
const A = detectDropZone(h, k, S, C, c);
|
|
3919
3919
|
if (!A)
|
|
3920
3920
|
return;
|
|
3921
3921
|
const B = h.getAttribute("data-block-type") || "Box";
|
|
3922
|
-
let
|
|
3922
|
+
let E = !1;
|
|
3923
3923
|
const w = LEAF_BLOCK_TYPES.includes(B);
|
|
3924
3924
|
if (A.position === "inside") {
|
|
3925
3925
|
if (w || y && !canDropWithoutCircularReference(y, x, l))
|
|
3926
3926
|
return;
|
|
3927
|
-
|
|
3927
|
+
E = canAcceptChildBlock(B, C);
|
|
3928
3928
|
} else {
|
|
3929
|
-
let
|
|
3930
|
-
for (;
|
|
3931
|
-
|
|
3932
|
-
if (
|
|
3929
|
+
let v = h.parentElement, _ = "Box";
|
|
3930
|
+
for (; v && !v.hasAttribute("data-block-id"); )
|
|
3931
|
+
v = v.parentElement;
|
|
3932
|
+
if (v && (_ = v.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
|
|
3933
3933
|
return;
|
|
3934
|
-
|
|
3934
|
+
E = canAcceptChildBlock(_, C);
|
|
3935
3935
|
}
|
|
3936
|
-
if (!
|
|
3936
|
+
if (!E)
|
|
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,22 +4085,22 @@ 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: S } = 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, S), g(), u([]), p([o._id]);
|
|
4096
4096
|
else {
|
|
4097
|
-
const B = o._type || o.type,
|
|
4097
|
+
const B = o._type || o.type, E = 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(
|
|
4099
4099
|
B === "PartialBlock" ? {
|
|
4100
4100
|
blocks: [{ _type: B, _id: "partial-block", partialBlockId: o.partialBlockId }]
|
|
4101
|
-
} : (
|
|
4101
|
+
} : (E == null ? void 0 : E.length) > 0 ? { blocks: [...E] } : { type: B },
|
|
4102
4102
|
k,
|
|
4103
|
-
|
|
4103
|
+
S
|
|
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: S, availableHeight: A, elements: B }) {
|
|
4391
4391
|
Object.assign(B.floating.style, {
|
|
4392
|
-
maxWidth: `${Math.max(200,
|
|
4392
|
+
maxWidth: `${Math.max(200, S)}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 S = null;
|
|
4404
|
+
return r ? (S = setTimeout(() => b(), 500), () => {
|
|
4405
|
+
S && clearTimeout(S);
|
|
4406
4406
|
}) : (b(), () => {
|
|
4407
|
-
|
|
4407
|
+
S && clearTimeout(S);
|
|
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: (S) => {
|
|
4419
|
+
S.stopPropagation(), S.preventDefault();
|
|
4420
4420
|
},
|
|
4421
|
-
onMouseEnter: (
|
|
4422
|
-
|
|
4421
|
+
onMouseEnter: (S) => {
|
|
4422
|
+
S.stopPropagation(), c(null);
|
|
4423
4423
|
},
|
|
4424
|
-
onKeyDown: (
|
|
4424
|
+
onKeyDown: (S) => S.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: [
|
|
@@ -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, S;
|
|
5067
|
+
const a = (k = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : k.color, i = (S = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : S.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 S = (u == null ? void 0 : u.getHTML()) || "";
|
|
5430
|
+
r(S);
|
|
5431
5431
|
}
|
|
5432
5432
|
},
|
|
5433
5433
|
from: "canvas"
|
|
@@ -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
|
|
5534
|
-
const
|
|
5535
|
-
return h && ((N =
|
|
5536
|
-
}, [o, h]),
|
|
5533
|
+
let j = o[r];
|
|
5534
|
+
const v = getRegisteredChaiBlock(o._type);
|
|
5535
|
+
return h && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (j = get(o, `${r}-${h}`)), { blockContent: j, blockType: w };
|
|
5536
|
+
}, [o, h]), S = useCallback(
|
|
5537
5537
|
(w) => {
|
|
5538
|
-
var
|
|
5539
|
-
const
|
|
5540
|
-
f([y], { [r]:
|
|
5538
|
+
var v;
|
|
5539
|
+
const j = w || ((v = g.current) == null ? void 0 : v.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(
|
|
@@ -5548,26 +5548,26 @@ const RichTextEditor = memo(
|
|
|
5548
5548
|
1e3
|
|
5549
5549
|
), B = useCallback(
|
|
5550
5550
|
(w) => {
|
|
5551
|
-
w.preventDefault(), y && (b.current = y),
|
|
5552
|
-
const
|
|
5553
|
-
b.current = null, x([
|
|
5551
|
+
w.preventDefault(), y && (b.current = y), S(), 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 _;
|
|
5560
5560
|
if (!y) return;
|
|
5561
|
-
const w = `[data-block-id="${y}"]`,
|
|
5562
|
-
|
|
5561
|
+
const w = `[data-block-id="${y}"]`, j = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${w}${j}`);
|
|
5562
|
+
v && ((_ = v == null ? void 0 : v.classList) == null || _.add("sr-only"), u(v));
|
|
5563
5563
|
}, [y, k, a, l]);
|
|
5564
|
-
const
|
|
5564
|
+
const E = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
|
|
5565
5565
|
RichTextEditor,
|
|
5566
5566
|
{
|
|
5567
5567
|
blockContent: C,
|
|
5568
5568
|
editingElement: p,
|
|
5569
5569
|
onChange: A,
|
|
5570
|
-
onClose:
|
|
5570
|
+
onClose: S,
|
|
5571
5571
|
onEscape: B
|
|
5572
5572
|
}
|
|
5573
5573
|
) : /* @__PURE__ */ jsx(
|
|
@@ -5576,13 +5576,13 @@ const RichTextEditor = memo(
|
|
|
5576
5576
|
editorRef: g,
|
|
5577
5577
|
blockContent: C,
|
|
5578
5578
|
editingElement: p,
|
|
5579
|
-
onClose:
|
|
5579
|
+
onClose: S,
|
|
5580
5580
|
onChange: A,
|
|
5581
5581
|
onEscape: B
|
|
5582
5582
|
}
|
|
5583
|
-
)) : null, [p, y, k, C,
|
|
5583
|
+
)) : null, [p, y, k, C, S, h]);
|
|
5584
5584
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5585
|
-
|
|
5585
|
+
E,
|
|
5586
5586
|
n
|
|
5587
5587
|
] });
|
|
5588
5588
|
},
|
|
@@ -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", S = useDirectBlockDrag(), A = useMemo(
|
|
5619
5619
|
() => m ? applyBindingToBlockProps(applyLanguage(l, d, c), g, {
|
|
5620
5620
|
index: h,
|
|
5621
5621
|
key: x
|
|
@@ -5624,7 +5624,7 @@ const RichTextEditor = memo(
|
|
|
5624
5624
|
), B = useMemo(
|
|
5625
5625
|
() => getBlockTagAttributes(l, !0, y),
|
|
5626
5626
|
[l, getBlockTagAttributes, y]
|
|
5627
|
-
),
|
|
5627
|
+
), E = useMemo(
|
|
5628
5628
|
() => u(l._id, getBlockRuntimeProps(l._type)),
|
|
5629
5629
|
[l._id, l._type, u, getBlockRuntimeProps]
|
|
5630
5630
|
), w = useMemo(() => {
|
|
@@ -5636,25 +5636,25 @@ const RichTextEditor = memo(
|
|
|
5636
5636
|
return k && C ? {
|
|
5637
5637
|
...D,
|
|
5638
5638
|
draggable: !0,
|
|
5639
|
-
onMouseDown:
|
|
5640
|
-
onDragStart:
|
|
5641
|
-
onDragEnd:
|
|
5639
|
+
onMouseDown: S.onMouseDown,
|
|
5640
|
+
onDragStart: S.onDragStart,
|
|
5641
|
+
onDragEnd: S.onDragEnd
|
|
5642
5642
|
} : D;
|
|
5643
|
-
}, [l._id, l._type, h, k, C,
|
|
5643
|
+
}, [l._id, l._type, h, k, C, S]), j = useMemo(
|
|
5644
5644
|
() => ({
|
|
5645
5645
|
blockProps: w,
|
|
5646
5646
|
inBuilder: b === "edit",
|
|
5647
5647
|
lang: d || p,
|
|
5648
5648
|
...A,
|
|
5649
5649
|
...B,
|
|
5650
|
-
...
|
|
5650
|
+
...E,
|
|
5651
5651
|
...o
|
|
5652
5652
|
}),
|
|
5653
|
-
[b, w, d, p, A, B,
|
|
5654
|
-
),
|
|
5655
|
-
if (isNull(f) || !
|
|
5653
|
+
[b, w, d, p, A, B, E, o]
|
|
5654
|
+
), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), _ = useMemo(() => get(l, "_show", !0), [l]);
|
|
5655
|
+
if (isNull(f) || !_) 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,
|
|
@@ -5667,7 +5667,7 @@ const RichTextEditor = memo(
|
|
|
5667
5667
|
})
|
|
5668
5668
|
}) });
|
|
5669
5669
|
const I = a === l._id && (i === h || h < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: l, children: N }) : N;
|
|
5670
|
-
return
|
|
5670
|
+
return v ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: I }) : I;
|
|
5671
5671
|
}, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
|
|
5672
5672
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: i, fallbackLang: l } = useLanguages(), c = useCallback(
|
|
5673
5673
|
(d) => {
|
|
@@ -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-BNuPxnsb.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 S = { ...c, [u]: o }, A = applyBindingToBlockProps(S, 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 S = isArray(k) ? first(k) : k;
|
|
5984
|
+
if (S) {
|
|
5985
|
+
n(S == null ? void 0 : S.url);
|
|
5986
|
+
const A = S == null ? void 0 : S.width, B = S == null ? void 0 : S.height, E = g.includes("mobile");
|
|
5987
5987
|
if (c != null && c._id) {
|
|
5988
5988
|
const w = {
|
|
5989
|
-
...A && { [
|
|
5990
|
-
...B && { [
|
|
5991
|
-
...
|
|
5989
|
+
...A && { [E ? "mobileWidth" : "width"]: A },
|
|
5990
|
+
...B && { [E ? "mobileHeight" : "height"]: B },
|
|
5991
|
+
...S.description && { alt: S.description }
|
|
5992
5992
|
};
|
|
5993
|
-
if (set(w, g,
|
|
5993
|
+
if (set(w, g, S.id), isEmpty(w)) return;
|
|
5994
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 = {}, S = g.includes("mobile");
|
|
6000
|
+
set(k, g, ""), set(k, S ? "mobileWidth" : "width", ""), set(k, S ? "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, S) => {
|
|
6166
6166
|
let A = "", B = "";
|
|
6167
|
-
const
|
|
6168
|
-
return k > 0 && (
|
|
6169
|
-
text: A +
|
|
6167
|
+
const E = k > 0 ? C[k - 1] : "", w = k < C.length ? C[k] : "";
|
|
6168
|
+
return k > 0 && (E === "." || !h(E) && E !== " ") && (A = " "), k < C.length && !h(w) && w !== " " && (B = " "), {
|
|
6169
|
+
text: A + S + 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: S, to: A } = C.state.selection;
|
|
6182
|
+
if (S !== A)
|
|
6183
6183
|
C.chain().deleteSelection().insertContent(k).run();
|
|
6184
6184
|
else {
|
|
6185
|
-
const { state:
|
|
6186
|
-
let
|
|
6187
|
-
w > 0 &&
|
|
6185
|
+
const { state: E } = C, w = E.selection.from, j = E.doc.textBetween(Math.max(0, w - 1), w), v = E.doc.textBetween(w, Math.min(w + 1, E.doc.content.size));
|
|
6186
|
+
let _ = "";
|
|
6187
|
+
w > 0 && j !== " " && !h(j) && (_ = " ");
|
|
6188
6188
|
let N = "";
|
|
6189
|
-
|
|
6189
|
+
v && v !== " " && !h(v) && (N = " "), C.chain().insertContent(_ + 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, S = C.value || "", A = C.selectionEnd || k;
|
|
6196
6196
|
if (A > k) {
|
|
6197
|
-
const
|
|
6197
|
+
const v = `{{${m}}}`, { text: _ } = x(S, k, v), N = S.slice(0, k) + _ + S.slice(A);
|
|
6198
6198
|
n(N, {}, r);
|
|
6199
6199
|
return;
|
|
6200
6200
|
}
|
|
6201
|
-
const
|
|
6202
|
-
n(
|
|
6201
|
+
const E = `{{${m}}}`, { text: w } = x(S, k, E), j = S.slice(0, k) + w + S.slice(k);
|
|
6202
|
+
n(j, {}, r);
|
|
6203
6203
|
}
|
|
6204
6204
|
},
|
|
6205
6205
|
[r, n, a, d == null ? void 0 : d._id, p]
|
|
@@ -6220,74 +6220,74 @@ const DataBindingSelector = ({
|
|
|
6220
6220
|
pageTypes: n,
|
|
6221
6221
|
onChange: r
|
|
6222
6222
|
}) => {
|
|
6223
|
-
var
|
|
6224
|
-
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (
|
|
6223
|
+
var j;
|
|
6224
|
+
const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, _) => []), [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((v) => v.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
|
|
6228
|
-
g(
|
|
6229
|
-
const N = await i(
|
|
6227
|
+
const v = split(o, ":"), _ = get(v, 1, "page") || "page";
|
|
6228
|
+
g(_), (async () => {
|
|
6229
|
+
const N = await i(_, [get(v, 2, "page")]);
|
|
6230
6230
|
N && Array.isArray(N) && f(get(N, [0, "name"], ""));
|
|
6231
6231
|
})();
|
|
6232
6232
|
}, [o]);
|
|
6233
|
-
const
|
|
6234
|
-
async (
|
|
6235
|
-
if (isEmpty(
|
|
6233
|
+
const S = useDebouncedCallback(
|
|
6234
|
+
async (v) => {
|
|
6235
|
+
if (isEmpty(v))
|
|
6236
6236
|
x([]);
|
|
6237
6237
|
else {
|
|
6238
|
-
const
|
|
6239
|
-
x(
|
|
6238
|
+
const _ = await i(u, v);
|
|
6239
|
+
x(_);
|
|
6240
6240
|
}
|
|
6241
6241
|
c(!1), y(-1);
|
|
6242
6242
|
},
|
|
6243
6243
|
[u],
|
|
6244
6244
|
300
|
|
6245
|
-
), A = (
|
|
6246
|
-
const
|
|
6247
|
-
|
|
6248
|
-
}, B = (
|
|
6249
|
-
switch (
|
|
6245
|
+
), A = (v) => {
|
|
6246
|
+
const _ = ["pageType", u, v.id];
|
|
6247
|
+
_[1] && (r(_.join(":")), f(v.name), p(!1), x([]), y(-1));
|
|
6248
|
+
}, B = (v) => {
|
|
6249
|
+
switch (v.key) {
|
|
6250
6250
|
case "ArrowDown":
|
|
6251
|
-
|
|
6251
|
+
v.preventDefault(), y((_) => _ < h.length - 1 ? _ + 1 : _);
|
|
6252
6252
|
break;
|
|
6253
6253
|
case "ArrowUp":
|
|
6254
|
-
|
|
6254
|
+
v.preventDefault(), y((_) => _ > 0 ? _ - 1 : _);
|
|
6255
6255
|
break;
|
|
6256
6256
|
case "Enter":
|
|
6257
|
-
if (
|
|
6257
|
+
if (v.preventDefault(), h.length === 0) return;
|
|
6258
6258
|
b >= 0 && A(h[b]);
|
|
6259
6259
|
break;
|
|
6260
6260
|
case "Escape":
|
|
6261
|
-
|
|
6261
|
+
v.preventDefault(), E();
|
|
6262
6262
|
break;
|
|
6263
6263
|
}
|
|
6264
6264
|
};
|
|
6265
6265
|
useEffect(() => {
|
|
6266
6266
|
if (b >= 0 && C.current) {
|
|
6267
|
-
const
|
|
6268
|
-
|
|
6267
|
+
const v = C.current.children[b];
|
|
6268
|
+
v == null || v.scrollIntoView({ block: "nearest" });
|
|
6269
6269
|
}
|
|
6270
6270
|
}, [b]);
|
|
6271
|
-
const
|
|
6271
|
+
const E = () => {
|
|
6272
6272
|
f(""), x([]), y(-1), p(!1), r("");
|
|
6273
|
-
}, w = (
|
|
6274
|
-
f(
|
|
6273
|
+
}, w = (v) => {
|
|
6274
|
+
f(v), p(!isEmpty(v)), c(!0), S(v);
|
|
6275
6275
|
};
|
|
6276
6276
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6277
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (
|
|
6277
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (v) => g(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
|
|
6278
6278
|
u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
6279
6279
|
/* @__PURE__ */ jsx(
|
|
6280
6280
|
"input",
|
|
6281
6281
|
{
|
|
6282
6282
|
type: "text",
|
|
6283
6283
|
value: m,
|
|
6284
|
-
onChange: (
|
|
6284
|
+
onChange: (v) => w(v.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"
|
|
6288
6288
|
}
|
|
6289
6289
|
),
|
|
6290
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick:
|
|
6290
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: E, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
|
|
6291
6291
|
] }),
|
|
6292
6292
|
(l || !isEmpty(h) || d && isEmpty(h)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: l ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
6293
6293
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -6297,22 +6297,22 @@ 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), (
|
|
6300
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (v, _) => /* @__PURE__ */ jsxs(
|
|
6301
6301
|
"li",
|
|
6302
6302
|
{
|
|
6303
|
-
onClick: () => A(
|
|
6304
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
6303
|
+
onClick: () => A(v),
|
|
6304
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : _ === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
6305
6305
|
children: [
|
|
6306
|
-
|
|
6306
|
+
v.name,
|
|
6307
6307
|
" ",
|
|
6308
|
-
|
|
6308
|
+
v.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
6309
6309
|
"( ",
|
|
6310
|
-
|
|
6310
|
+
v.slug,
|
|
6311
6311
|
" )"
|
|
6312
6312
|
] })
|
|
6313
6313
|
]
|
|
6314
6314
|
},
|
|
6315
|
-
|
|
6315
|
+
v.id
|
|
6316
6316
|
)) }) })
|
|
6317
6317
|
] });
|
|
6318
6318
|
}, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
|
|
@@ -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-DuUAGYPy.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
|
-
[
|
|
6661
|
-
), [B,
|
|
6658
|
+
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), k = useSelectedBlock(), S = useRegisteredChaiBlocks(), A = useMemo(
|
|
6659
|
+
() => get(S, [k == null ? void 0 : k._type, "i18nProps"], []),
|
|
6660
|
+
[S, k == null ? void 0 : k._type]
|
|
6661
|
+
), [B, E] = 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: [
|
|
@@ -6670,7 +6670,7 @@ const DataBindingSelector = ({
|
|
|
6670
6670
|
"label",
|
|
6671
6671
|
{
|
|
6672
6672
|
htmlFor: n,
|
|
6673
|
-
onClick: () =>
|
|
6673
|
+
onClick: () => E(N ? null : n),
|
|
6674
6674
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
6675
6675
|
children: [
|
|
6676
6676
|
N ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
@@ -6699,14 +6699,14 @@ const DataBindingSelector = ({
|
|
|
6699
6699
|
] })
|
|
6700
6700
|
] });
|
|
6701
6701
|
}
|
|
6702
|
-
const
|
|
6702
|
+
const v = n.replace("root.", ""), _ = A.includes(v) && !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
|
+
_ ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6722
6722
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6723
6723
|
"svg",
|
|
6724
6724
|
{
|
|
@@ -6857,36 +6857,36 @@ 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
|
-
|
|
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 }, E, w) => {
|
|
6861
|
+
E && (c == null ? void 0 : c._id) === n._id && a([n._id], { [E]: get(B, E) }, w);
|
|
6862
6862
|
}, x = useCallback(
|
|
6863
|
-
debounce(({ formData: B },
|
|
6864
|
-
h({ formData: B },
|
|
6863
|
+
debounce(({ formData: B }, E, w) => {
|
|
6864
|
+
h({ formData: B }, E, w), d(B);
|
|
6865
6865
|
}, 1500),
|
|
6866
6866
|
[n == null ? void 0 : n._id, o]
|
|
6867
|
-
), b = ({ formData: B },
|
|
6868
|
-
|
|
6869
|
-
}, y = ({ formData: B },
|
|
6870
|
-
|
|
6867
|
+
), b = ({ formData: B }, E) => {
|
|
6868
|
+
E && (r([n._id], { [E]: get(B, E) }), x({ formData: B }, E, { [E]: get(c, E) }));
|
|
6869
|
+
}, y = ({ formData: B }, E) => {
|
|
6870
|
+
E && (r([g._id], { [E]: get(B, E) }), x({ formData: B }, E, { [E]: get(c, E) }));
|
|
6871
6871
|
}, { schema: C, uiSchema: k } = useMemo(() => {
|
|
6872
6872
|
const B = n == null ? void 0 : n._type;
|
|
6873
6873
|
if (!B)
|
|
6874
6874
|
return { schema: {}, uiSchema: {} };
|
|
6875
6875
|
try {
|
|
6876
|
-
const { schema:
|
|
6876
|
+
const { schema: E, 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:
|
|
6881
|
+
return { schema: E, uiSchema: w };
|
|
6882
6882
|
} catch {
|
|
6883
6883
|
return { schema: {}, uiSchema: {} };
|
|
6884
6884
|
}
|
|
6885
|
-
}, [n]), { wrapperSchema:
|
|
6885
|
+
}, [n]), { wrapperSchema: S, 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:
|
|
6889
|
-
return { wrapperSchema:
|
|
6888
|
+
const B = g == null ? void 0 : g._type, { schema: E = {}, uiSchema: w = {} } = getBlockFormSchemas(B);
|
|
6889
|
+
return { wrapperSchema: E, 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: S,
|
|
6918
6918
|
uiSchema: A
|
|
6919
6919
|
}
|
|
6920
6920
|
) })
|
|
@@ -7137,47 +7137,47 @@ 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), [S, A] = useState(!1);
|
|
7141
7141
|
useEffect(() => {
|
|
7142
|
-
const { value:
|
|
7143
|
-
if (
|
|
7144
|
-
i(
|
|
7142
|
+
const { value: v, unit: _ } = getClassValueAndUnit(l);
|
|
7143
|
+
if (_ === "") {
|
|
7144
|
+
i(v), f(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
7145
7145
|
return;
|
|
7146
7146
|
}
|
|
7147
|
-
f(
|
|
7147
|
+
f(_), i(_ === "class" || isEmpty(v) ? "" : v);
|
|
7148
7148
|
}, [l, p, u]);
|
|
7149
|
-
const B = useThrottledCallback((
|
|
7150
|
-
(
|
|
7151
|
-
const
|
|
7152
|
-
if (get(
|
|
7149
|
+
const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), E = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), w = useCallback(
|
|
7150
|
+
(v = !1) => {
|
|
7151
|
+
const _ = getUserInputValues(`${a}`, u);
|
|
7152
|
+
if (get(_, "error", !1)) {
|
|
7153
7153
|
x(!0);
|
|
7154
7154
|
return;
|
|
7155
7155
|
}
|
|
7156
|
-
const N = get(
|
|
7156
|
+
const N = get(_, "unit") !== "" ? get(_, "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(_, "value") === "")
|
|
7162
7162
|
return;
|
|
7163
|
-
const D = `${get(
|
|
7164
|
-
|
|
7163
|
+
const D = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7164
|
+
v ? E(D) : B(D);
|
|
7165
7165
|
},
|
|
7166
|
-
[B,
|
|
7167
|
-
),
|
|
7168
|
-
(
|
|
7169
|
-
const
|
|
7170
|
-
if (get(
|
|
7166
|
+
[B, E, a, m, d, u]
|
|
7167
|
+
), j = useCallback(
|
|
7168
|
+
(v) => {
|
|
7169
|
+
const _ = getUserInputValues(`${a}`, u);
|
|
7170
|
+
if (get(_, "error", !1)) {
|
|
7171
7171
|
x(!0);
|
|
7172
7172
|
return;
|
|
7173
7173
|
}
|
|
7174
|
-
if (
|
|
7175
|
-
B(`${d}${
|
|
7174
|
+
if (v === "auto" || v === "none") {
|
|
7175
|
+
B(`${d}${v}`);
|
|
7176
7176
|
return;
|
|
7177
7177
|
}
|
|
7178
|
-
if (get(
|
|
7178
|
+
if (get(_, "value") === "")
|
|
7179
7179
|
return;
|
|
7180
|
-
const N = get(
|
|
7180
|
+
const N = get(_, "unit") !== "" ? get(_, "unit") : v, D = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
7181
7181
|
B(D);
|
|
7182
7182
|
},
|
|
7183
7183
|
[B, a, d, u]
|
|
@@ -7201,29 +7201,29 @@ const BlockStylingProps = () => {
|
|
|
7201
7201
|
"input",
|
|
7202
7202
|
{
|
|
7203
7203
|
readOnly: m === "class",
|
|
7204
|
-
onKeyPress: (
|
|
7205
|
-
|
|
7204
|
+
onKeyPress: (v) => {
|
|
7205
|
+
v.key === "Enter" && w();
|
|
7206
7206
|
},
|
|
7207
|
-
onKeyDown: (
|
|
7208
|
-
if (
|
|
7207
|
+
onKeyDown: (v) => {
|
|
7208
|
+
if (v.keyCode !== 38 && v.keyCode !== 40)
|
|
7209
7209
|
return;
|
|
7210
|
-
|
|
7211
|
-
const
|
|
7212
|
-
let N = isNaN$1(
|
|
7213
|
-
|
|
7210
|
+
v.preventDefault(), A(!0);
|
|
7211
|
+
const _ = parseInt$1(v.target.value);
|
|
7212
|
+
let N = isNaN$1(_) ? 0 : _;
|
|
7213
|
+
v.keyCode === 38 && (N += 1), v.keyCode === 40 && (N -= 1);
|
|
7214
7214
|
const I = `${N}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7215
|
-
|
|
7215
|
+
E(P);
|
|
7216
7216
|
},
|
|
7217
|
-
onKeyUp: (
|
|
7218
|
-
|
|
7217
|
+
onKeyUp: (v) => {
|
|
7218
|
+
S && (v.preventDefault(), A(!1));
|
|
7219
7219
|
},
|
|
7220
7220
|
onBlur: () => w(),
|
|
7221
|
-
onChange: (
|
|
7222
|
-
x(!1), i(
|
|
7221
|
+
onChange: (v) => {
|
|
7222
|
+
x(!1), i(v.target.value);
|
|
7223
7223
|
},
|
|
7224
|
-
onClick: (
|
|
7225
|
-
var
|
|
7226
|
-
(
|
|
7224
|
+
onClick: (v) => {
|
|
7225
|
+
var _;
|
|
7226
|
+
(_ = v == null ? void 0 : v.target) == null || _.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(
|
|
@@ -7250,8 +7250,8 @@ const BlockStylingProps = () => {
|
|
|
7250
7250
|
{
|
|
7251
7251
|
units: u,
|
|
7252
7252
|
current: m,
|
|
7253
|
-
onSelect: (
|
|
7254
|
-
r(!1), f(
|
|
7253
|
+
onSelect: (v) => {
|
|
7254
|
+
r(!1), f(v), j(v);
|
|
7255
7255
|
}
|
|
7256
7256
|
}
|
|
7257
7257
|
) })
|
|
@@ -7261,18 +7261,18 @@ const BlockStylingProps = () => {
|
|
|
7261
7261
|
DragStyleButton,
|
|
7262
7262
|
{
|
|
7263
7263
|
onDragStart: () => k(!0),
|
|
7264
|
-
onDragEnd: (
|
|
7265
|
-
if (y(() => ""), k(!1), isEmpty(
|
|
7264
|
+
onDragEnd: (v) => {
|
|
7265
|
+
if (y(() => ""), k(!1), isEmpty(v))
|
|
7266
7266
|
return;
|
|
7267
|
-
const
|
|
7267
|
+
const _ = `${v}`, I = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7268
7268
|
B(I);
|
|
7269
7269
|
},
|
|
7270
|
-
onDrag: (
|
|
7271
|
-
if (isEmpty(
|
|
7270
|
+
onDrag: (v) => {
|
|
7271
|
+
if (isEmpty(v))
|
|
7272
7272
|
return;
|
|
7273
|
-
y(
|
|
7274
|
-
const
|
|
7275
|
-
|
|
7273
|
+
y(v);
|
|
7274
|
+
const _ = `${v}`, I = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
7275
|
+
E(I);
|
|
7276
7276
|
},
|
|
7277
7277
|
currentValue: a,
|
|
7278
7278
|
unit: m,
|
|
@@ -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
|
|
7743
|
-
f(x, [
|
|
7739
|
+
(E, w = !0) => {
|
|
7740
|
+
const j = { dark: p, mq: g, mod: u, cls: E, property: i, fullCls: "" };
|
|
7741
|
+
(p || u !== "") && (j.mq = "xs");
|
|
7742
|
+
const v = generateFullClsName(j);
|
|
7743
|
+
f(x, [v], w);
|
|
7744
7744
|
},
|
|
7745
7745
|
[x, p, g, u, i, f]
|
|
7746
7746
|
), C = useCallback(() => {
|
|
@@ -7749,18 +7749,18 @@ const COLOR_PROP = {
|
|
|
7749
7749
|
useEffect(() => {
|
|
7750
7750
|
l(k, m);
|
|
7751
7751
|
}, [k, l, m]);
|
|
7752
|
-
const [, ,
|
|
7753
|
-
(
|
|
7754
|
-
|
|
7752
|
+
const [, , S] = useScreenSizeWidth(), A = useCallback(
|
|
7753
|
+
(E) => {
|
|
7754
|
+
S({
|
|
7755
7755
|
xs: 400,
|
|
7756
7756
|
sm: 640,
|
|
7757
7757
|
md: 800,
|
|
7758
7758
|
lg: 1024,
|
|
7759
7759
|
xl: 1420,
|
|
7760
7760
|
"2xl": 1920
|
|
7761
|
-
}[
|
|
7761
|
+
}[E]);
|
|
7762
7762
|
},
|
|
7763
|
-
[
|
|
7763
|
+
[S]
|
|
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((S) => S !== k)) : f((S) => [...S, 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: (S) => S.preventDefault(),
|
|
8051
8051
|
children: h(k.title)
|
|
8052
8052
|
},
|
|
8053
8053
|
k.breakpoint
|
|
@@ -8079,7 +8079,7 @@ function BreakpointSelector() {
|
|
|
8079
8079
|
const DesignTokensIcon = ({ className: o = "" }) => /* @__PURE__ */ jsx(FontStyleIcon, { className: o });
|
|
8080
8080
|
function ManualClasses() {
|
|
8081
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)),
|
|
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)), S = useMemo(() => [...k].sort((L, T) => {
|
|
8083
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) => {
|
|
@@ -8088,16 +8088,16 @@ function ManualClasses() {
|
|
|
8088
8088
|
return T ? T.name : L;
|
|
8089
8089
|
}
|
|
8090
8090
|
return L;
|
|
8091
|
-
},
|
|
8091
|
+
}, E = (L) => {
|
|
8092
8092
|
const T = Object.entries(b).find(([M, H]) => H.name === L);
|
|
8093
8093
|
return T ? `${T[0]}` : L;
|
|
8094
8094
|
}, w = () => {
|
|
8095
|
-
const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(
|
|
8095
|
+
const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(E);
|
|
8096
8096
|
g(f, L, !0), x("");
|
|
8097
|
-
}, [
|
|
8097
|
+
}, [j, v] = useState([]), _ = 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 (_ && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
|
|
8101
8101
|
name: U.name,
|
|
8102
8102
|
id: `${V}`,
|
|
8103
8103
|
isDesignToken: !0
|
|
@@ -8114,9 +8114,9 @@ function ManualClasses() {
|
|
|
8114
8114
|
} else
|
|
8115
8115
|
H = c.search(T);
|
|
8116
8116
|
const z = [...W, ...map(H, "item")];
|
|
8117
|
-
return
|
|
8117
|
+
return v(z);
|
|
8118
8118
|
}, I = () => {
|
|
8119
|
-
|
|
8119
|
+
v([]);
|
|
8120
8120
|
}, D = (L) => L.name, P = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
|
|
8121
8121
|
L.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
8122
8122
|
/* @__PURE__ */ jsx("span", { children: L.name })
|
|
@@ -8135,14 +8135,14 @@ function ManualClasses() {
|
|
|
8135
8135
|
}, 0);
|
|
8136
8136
|
},
|
|
8137
8137
|
onKeyDown: (L) => {
|
|
8138
|
-
L.key === "Enter" && h.trim() !== "" &&
|
|
8138
|
+
L.key === "Enter" && h.trim() !== "" && j.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, j.length]
|
|
8144
8144
|
), $ = (L) => {
|
|
8145
|
-
const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(
|
|
8145
|
+
const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(E);
|
|
8146
8146
|
m(f, [L]), g(f, T, !0), r(""), i(-1);
|
|
8147
8147
|
}, F = () => {
|
|
8148
8148
|
if (navigator.clipboard === void 0) {
|
|
@@ -8154,19 +8154,19 @@ 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(_ ? "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
|
+
_ && /* @__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: j,
|
|
8170
8170
|
onSuggestionsFetchRequested: N,
|
|
8171
8171
|
onSuggestionsClearRequested: I,
|
|
8172
8172
|
getSuggestionValue: D,
|
|
@@ -8174,7 +8174,7 @@ function ManualClasses() {
|
|
|
8174
8174
|
inputProps: R,
|
|
8175
8175
|
highlightFirstSuggestion: !0,
|
|
8176
8176
|
onSuggestionSelected: (L, { suggestionValue: T }) => {
|
|
8177
|
-
const M =
|
|
8177
|
+
const M = E(T);
|
|
8178
8178
|
g(f, [M], !0), x("");
|
|
8179
8179
|
},
|
|
8180
8180
|
containerProps: {
|
|
@@ -8199,7 +8199,7 @@ function ManualClasses() {
|
|
|
8199
8199
|
}
|
|
8200
8200
|
)
|
|
8201
8201
|
] }),
|
|
8202
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children:
|
|
8202
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: S.map(
|
|
8203
8203
|
(L, T) => a === T ? /* @__PURE__ */ jsx(
|
|
8204
8204
|
"input",
|
|
8205
8205
|
{
|
|
@@ -8595,7 +8595,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
8595
8595
|
]
|
|
8596
8596
|
};
|
|
8597
8597
|
} else if (n) {
|
|
8598
|
-
const
|
|
8598
|
+
const S = typeof n == "function" ? await n() : n, A = getBlocksFromHTML(S);
|
|
8599
8599
|
if (isEmpty(A)) return;
|
|
8600
8600
|
k = {
|
|
8601
8601
|
type: "Box",
|
|
@@ -8603,16 +8603,16 @@ const registerChaiLibrary = (o, n) => {
|
|
|
8603
8603
|
name: get(A, "0._type", "Block")
|
|
8604
8604
|
};
|
|
8605
8605
|
} else if (r) {
|
|
8606
|
-
const
|
|
8607
|
-
if (isEmpty(
|
|
8606
|
+
const S = typeof r == "function" ? await r() : r;
|
|
8607
|
+
if (isEmpty(S)) return;
|
|
8608
8608
|
k = {
|
|
8609
8609
|
type: "Box",
|
|
8610
|
-
blocks:
|
|
8611
|
-
name: get(
|
|
8610
|
+
blocks: S,
|
|
8611
|
+
name: get(S, "0._type", "Block")
|
|
8612
8612
|
};
|
|
8613
8613
|
} else if (o) {
|
|
8614
|
-
const
|
|
8615
|
-
k = typeof
|
|
8614
|
+
const S = typeof o == "function" ? await o() : o;
|
|
8615
|
+
k = typeof S == "object" ? omit(S, ["component", "icon"]) : S;
|
|
8616
8616
|
}
|
|
8617
8617
|
if (!k) return;
|
|
8618
8618
|
u(C, k, !0), setTimeout(() => {
|
|
@@ -8732,17 +8732,17 @@ const BlockCard = ({
|
|
|
8732
8732
|
return;
|
|
8733
8733
|
}
|
|
8734
8734
|
}, [y, C]);
|
|
8735
|
-
const
|
|
8735
|
+
const S = get(y, C, []), A = useRef(null), { t: B } = useTranslation(), E = useRef(null);
|
|
8736
8736
|
useEffect(() => {
|
|
8737
8737
|
var I;
|
|
8738
|
-
const N = (I =
|
|
8738
|
+
const N = (I = E.current) == null ? void 0 : I.querySelector("[data-radix-scroll-area-viewport]");
|
|
8739
8739
|
N && N.scrollTo({ top: 0, behavior: "smooth" });
|
|
8740
8740
|
}, [c, C]);
|
|
8741
8741
|
const w = (N) => {
|
|
8742
8742
|
A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
|
|
8743
8743
|
A.current && k(N);
|
|
8744
8744
|
}, 400);
|
|
8745
|
-
},
|
|
8745
|
+
}, j = () => {
|
|
8746
8746
|
c != null && c.id && u(c.id);
|
|
8747
8747
|
};
|
|
8748
8748
|
if (p)
|
|
@@ -8750,7 +8750,7 @@ const BlockCard = ({
|
|
|
8750
8750
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
8751
8751
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
8752
8752
|
] });
|
|
8753
|
-
const
|
|
8753
|
+
const v = filter(S, (N, I) => I % 2 === 0), _ = filter(S, (N, I) => I % 2 === 1);
|
|
8754
8754
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
8755
8755
|
/* @__PURE__ */ jsx(SearchInput, { value: g, setValue: m }),
|
|
8756
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: [
|
|
@@ -8769,7 +8769,7 @@ const BlockCard = ({
|
|
|
8769
8769
|
className: `no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto ${r ? "" : "pb-20"}`,
|
|
8770
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: [
|
|
8771
8771
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: B("Failed to load the UI library. Try again") }),
|
|
8772
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
8772
|
+
/* @__PURE__ */ jsxs(Button, { onClick: j, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
8773
8773
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
8774
8774
|
B("Retry")
|
|
8775
8775
|
] })
|
|
@@ -8803,12 +8803,12 @@ const BlockCard = ({
|
|
|
8803
8803
|
/* @__PURE__ */ jsx("div", { className: `flex h-full max-h-full w-full flex-col border-border ${r ? "" : "border-l"}`, children: /* @__PURE__ */ jsxs(
|
|
8804
8804
|
ScrollArea,
|
|
8805
8805
|
{
|
|
8806
|
-
ref:
|
|
8806
|
+
ref: E,
|
|
8807
8807
|
onMouseEnter: () => A.current ? clearTimeout(A.current) : null,
|
|
8808
8808
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
8809
8809
|
children: [
|
|
8810
|
-
isEmpty(
|
|
8811
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
8810
|
+
isEmpty(S) && !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: [
|
|
8811
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((N, I) => /* @__PURE__ */ jsx(
|
|
8812
8812
|
BlockCard,
|
|
8813
8813
|
{
|
|
8814
8814
|
parentId: o,
|
|
@@ -8818,7 +8818,7 @@ const BlockCard = ({
|
|
|
8818
8818
|
},
|
|
8819
8819
|
`block-${I}`
|
|
8820
8820
|
)) }),
|
|
8821
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
8821
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: _.map((N, I) => /* @__PURE__ */ jsx(
|
|
8822
8822
|
BlockCard,
|
|
8823
8823
|
{
|
|
8824
8824
|
parentId: o,
|
|
@@ -8868,14 +8868,14 @@ const BlockCard = ({
|
|
|
8868
8868
|
}), m(!0);
|
|
8869
8869
|
else if (!l && Object.keys(i || {}).length > 0) {
|
|
8870
8870
|
const h = Object.entries(i).map(([b, y]) => {
|
|
8871
|
-
const C = y, k = C.type || "partial",
|
|
8871
|
+
const C = y, k = C.type || "partial", S = formatReadableName(k);
|
|
8872
8872
|
return {
|
|
8873
8873
|
type: "PartialBlock",
|
|
8874
8874
|
// Set the type to PartialBlock
|
|
8875
8875
|
label: formatReadableName(C.name || b),
|
|
8876
8876
|
description: C.description || "",
|
|
8877
8877
|
icon: FrameIcon,
|
|
8878
|
-
group:
|
|
8878
|
+
group: S,
|
|
8879
8879
|
// Use formatted type as group
|
|
8880
8880
|
category: "partial",
|
|
8881
8881
|
partialBlockId: b,
|
|
@@ -8953,13 +8953,13 @@ const BlockCard = ({
|
|
|
8953
8953
|
}, 500), () => {
|
|
8954
8954
|
C.current && C.current.cancel();
|
|
8955
8955
|
}), []);
|
|
8956
|
-
const
|
|
8956
|
+
const S = useCallback((I) => {
|
|
8957
8957
|
y(I), C.current && C.current(I);
|
|
8958
8958
|
}, []), A = useCallback(() => {
|
|
8959
8959
|
y(null), C.current && C.current.cancel();
|
|
8960
8960
|
}, []), B = useCallback((I) => {
|
|
8961
8961
|
C.current && C.current.cancel(), x(I), y(null);
|
|
8962
|
-
}, []),
|
|
8962
|
+
}, []), E = useMemo(
|
|
8963
8963
|
() => p ? values(n).filter(
|
|
8964
8964
|
(I) => {
|
|
8965
8965
|
var D, P;
|
|
@@ -8969,33 +8969,33 @@ const BlockCard = ({
|
|
|
8969
8969
|
[n, p]
|
|
8970
8970
|
), w = useMemo(
|
|
8971
8971
|
() => p ? o.filter(
|
|
8972
|
-
(I) => reject(filter(values(
|
|
8972
|
+
(I) => reject(filter(values(E), { group: I }), { hidden: !0 }).length > 0
|
|
8973
8973
|
) : o.filter((I) => reject(filter(values(n), { group: I }), { hidden: !0 }).length > 0),
|
|
8974
|
-
[n,
|
|
8975
|
-
),
|
|
8974
|
+
[n, E, o, p]
|
|
8975
|
+
), j = useMemo(
|
|
8976
8976
|
() => sortBy(w, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
|
|
8977
8977
|
[w]
|
|
8978
|
-
),
|
|
8978
|
+
), v = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), _ = useMemo(() => h === "all" ? j : [h], [j, h]);
|
|
8979
8979
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
|
|
8980
8980
|
/* @__PURE__ */ jsx(SearchInput, { value: p, setValue: u }),
|
|
8981
8981
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
|
|
8982
|
-
!l &&
|
|
8982
|
+
!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: [
|
|
8983
8983
|
/* @__PURE__ */ jsx(
|
|
8984
8984
|
"button",
|
|
8985
8985
|
{
|
|
8986
8986
|
onClick: () => B("all"),
|
|
8987
|
-
onMouseEnter: () =>
|
|
8987
|
+
onMouseEnter: () => S("all"),
|
|
8988
8988
|
onMouseLeave: A,
|
|
8989
8989
|
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"}`,
|
|
8990
8990
|
children: c("All")
|
|
8991
8991
|
},
|
|
8992
8992
|
"sidebar-all"
|
|
8993
8993
|
),
|
|
8994
|
-
|
|
8994
|
+
j.map((I) => /* @__PURE__ */ jsx(
|
|
8995
8995
|
"button",
|
|
8996
8996
|
{
|
|
8997
8997
|
onClick: () => B(I),
|
|
8998
|
-
onMouseEnter: () =>
|
|
8998
|
+
onMouseEnter: () => S(I),
|
|
8999
8999
|
onMouseLeave: A,
|
|
9000
9000
|
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"}`,
|
|
9001
9001
|
children: capitalize(c(I.toLowerCase()))
|
|
@@ -9006,16 +9006,16 @@ const BlockCard = ({
|
|
|
9006
9006
|
/* @__PURE__ */ jsx(
|
|
9007
9007
|
"div",
|
|
9008
9008
|
{
|
|
9009
|
-
className: `h-full flex-1 overflow-hidden ${!l &&
|
|
9009
|
+
className: `h-full flex-1 overflow-hidden ${!l && j.length > 0 ? "w-3/4" : "w-full"}`,
|
|
9010
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: [
|
|
9011
9011
|
c("No blocks found matching"),
|
|
9012
9012
|
' "',
|
|
9013
9013
|
p,
|
|
9014
9014
|
'"'
|
|
9015
|
-
] }) }) : /* @__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: _.map((I) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9016
9016
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
|
|
9017
9017
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
|
|
9018
|
-
h === "all" ? filter(values(
|
|
9018
|
+
h === "all" ? filter(values(v), { group: I }) : values(v),
|
|
9019
9019
|
{ hidden: !0 }
|
|
9020
9020
|
).map((D) => /* @__PURE__ */ jsx(
|
|
9021
9021
|
CoreBlock,
|
|
@@ -9502,17 +9502,17 @@ const useStructureValidation = () => {
|
|
|
9502
9502
|
var L;
|
|
9503
9503
|
const { t: a } = useTranslation(), i = useUpdateBlocksProps(), [l] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
9504
9504
|
let d = null;
|
|
9505
|
-
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,
|
|
9505
|
+
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, S = useStructureValidation(), A = useMemo(() => S.getBlockErrors(f), [S, f]), B = get(h, "_show", !0), E = (T) => {
|
|
9506
9506
|
T.stopPropagation(), B && o.toggle();
|
|
9507
9507
|
}, w = (T) => {
|
|
9508
9508
|
T.isInternal && (d = T.isOpen, T.isOpen && T.close());
|
|
9509
|
-
},
|
|
9509
|
+
}, j = (T) => {
|
|
9510
9510
|
T.isInternal && d !== null && (d ? T.open() : T.close(), d = null);
|
|
9511
|
-
}, [
|
|
9511
|
+
}, [v, _] = useAtom$1(currentAddSelection), N = () => {
|
|
9512
9512
|
var T;
|
|
9513
|
-
I(), o.parent.isSelected ||
|
|
9513
|
+
I(), o.parent.isSelected || _((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
9514
9514
|
}, I = () => {
|
|
9515
|
-
|
|
9515
|
+
_(null);
|
|
9516
9516
|
}, D = (T) => {
|
|
9517
9517
|
I(), T.stopPropagation(), !o.isOpen && B && o.toggle(), k(T);
|
|
9518
9518
|
};
|
|
@@ -9561,7 +9561,7 @@ const useStructureValidation = () => {
|
|
|
9561
9561
|
"data-node-id": f,
|
|
9562
9562
|
ref: r,
|
|
9563
9563
|
onDragStart: () => w(o),
|
|
9564
|
-
onDragEnd: () =>
|
|
9564
|
+
onDragEnd: () => j(o),
|
|
9565
9565
|
onDragOver: (T) => {
|
|
9566
9566
|
T.preventDefault(), P(f, "yes");
|
|
9567
9567
|
},
|
|
@@ -9591,7 +9591,7 @@ const useStructureValidation = () => {
|
|
|
9591
9591
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
9592
9592
|
x ? "bg-primary/20" : "hover:bg-primary/10",
|
|
9593
9593
|
b && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
9594
|
-
(o == null ? void 0 : o.id) ===
|
|
9594
|
+
(o == null ? void 0 : o.id) === v ? "bg-primary/10" : "",
|
|
9595
9595
|
y && "opacity-20",
|
|
9596
9596
|
B ? "" : "line-through opacity-50",
|
|
9597
9597
|
F && x && "bg-primary/20 text-primary"
|
|
@@ -9602,7 +9602,7 @@ const useStructureValidation = () => {
|
|
|
9602
9602
|
"div",
|
|
9603
9603
|
{
|
|
9604
9604
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
9605
|
-
children: p && /* @__PURE__ */ jsx("button", { onClick:
|
|
9605
|
+
children: p && /* @__PURE__ */ jsx("button", { onClick: E, type: "button", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) })
|
|
9606
9606
|
}
|
|
9607
9607
|
),
|
|
9608
9608
|
/* @__PURE__ */ jsxs(
|
|
@@ -10102,20 +10102,20 @@ const useStructureValidation = () => {
|
|
|
10102
10102
|
}
|
|
10103
10103
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
10104
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();
|
|
10105
|
-
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((
|
|
10106
|
-
d.push(
|
|
10105
|
+
(!d || d.length === 0) && DEFAULT_THEME_PRESET.map((j) => {
|
|
10106
|
+
d.push(j);
|
|
10107
10107
|
});
|
|
10108
10108
|
const [h, x] = useTheme(), b = useThemeOptions(), { t: y } = useTranslation(), C = React.useCallback(
|
|
10109
|
-
(
|
|
10110
|
-
const
|
|
10111
|
-
setPreviousTheme(
|
|
10109
|
+
(j) => {
|
|
10110
|
+
const v = { ...h };
|
|
10111
|
+
setPreviousTheme(v), x(j), f(), toast.success("Theme updated", {
|
|
10112
10112
|
action: {
|
|
10113
10113
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
10114
10114
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
10115
10115
|
" Undo"
|
|
10116
10116
|
] }),
|
|
10117
10117
|
onClick: () => {
|
|
10118
|
-
x(
|
|
10118
|
+
x(v), clearPreviousTheme(), toast.dismiss();
|
|
10119
10119
|
}
|
|
10120
10120
|
},
|
|
10121
10121
|
closeButton: !0,
|
|
@@ -10124,61 +10124,61 @@ const useStructureValidation = () => {
|
|
|
10124
10124
|
},
|
|
10125
10125
|
[h, x, f]
|
|
10126
10126
|
), k = () => {
|
|
10127
|
-
const
|
|
10128
|
-
if (
|
|
10129
|
-
const
|
|
10130
|
-
|
|
10127
|
+
const j = d.find((v) => Object.keys(v)[0] === a);
|
|
10128
|
+
if (j) {
|
|
10129
|
+
const v = Object.values(j)[0];
|
|
10130
|
+
v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (C(v), i(""), f()) : console.error("Invalid preset structure:", v);
|
|
10131
10131
|
} else
|
|
10132
10132
|
console.error("Preset not found:", a);
|
|
10133
|
-
},
|
|
10134
|
-
C(
|
|
10133
|
+
}, S = (j) => {
|
|
10134
|
+
C(j), i(""), f();
|
|
10135
10135
|
}, A = useDebouncedCallback(
|
|
10136
|
-
(
|
|
10136
|
+
(j, v) => {
|
|
10137
10137
|
x(() => ({
|
|
10138
10138
|
...h,
|
|
10139
10139
|
fontFamily: {
|
|
10140
10140
|
...h.fontFamily,
|
|
10141
|
-
[
|
|
10141
|
+
[j.replace(/font-/g, "")]: v
|
|
10142
10142
|
}
|
|
10143
10143
|
})), f();
|
|
10144
10144
|
},
|
|
10145
10145
|
[h, f],
|
|
10146
10146
|
200
|
|
10147
10147
|
), B = React.useCallback(
|
|
10148
|
-
(
|
|
10148
|
+
(j) => {
|
|
10149
10149
|
x(() => ({
|
|
10150
10150
|
...h,
|
|
10151
|
-
borderRadius: `${
|
|
10151
|
+
borderRadius: `${j}px`
|
|
10152
10152
|
})), f();
|
|
10153
10153
|
},
|
|
10154
10154
|
[h, f]
|
|
10155
|
-
),
|
|
10156
|
-
(
|
|
10155
|
+
), E = useDebouncedCallback(
|
|
10156
|
+
(j, v) => {
|
|
10157
10157
|
x(() => {
|
|
10158
|
-
const
|
|
10159
|
-
return n ? set(
|
|
10158
|
+
const _ = get(h, `colors.${j}`);
|
|
10159
|
+
return n ? set(_, 1, v) : set(_, 0, v), f(), {
|
|
10160
10160
|
...h,
|
|
10161
10161
|
colors: {
|
|
10162
10162
|
...h.colors,
|
|
10163
|
-
[
|
|
10163
|
+
[j]: _
|
|
10164
10164
|
}
|
|
10165
10165
|
};
|
|
10166
10166
|
});
|
|
10167
10167
|
},
|
|
10168
10168
|
[h, f],
|
|
10169
10169
|
200
|
|
10170
|
-
), w = (
|
|
10171
|
-
const
|
|
10172
|
-
return
|
|
10170
|
+
), w = (j) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(j.items).map(([v]) => {
|
|
10171
|
+
const _ = get(h, `colors.${v}.${n ? 1 : 0}`);
|
|
10172
|
+
return _ ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
|
|
10173
10173
|
/* @__PURE__ */ jsx(
|
|
10174
10174
|
ColorPickerInput,
|
|
10175
10175
|
{
|
|
10176
|
-
value:
|
|
10177
|
-
onChange: (N) =>
|
|
10176
|
+
value: _,
|
|
10177
|
+
onChange: (N) => E(v, N)
|
|
10178
10178
|
}
|
|
10179
10179
|
),
|
|
10180
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
10181
|
-
] },
|
|
10180
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
|
|
10181
|
+
] }, v) : null;
|
|
10182
10182
|
}) });
|
|
10183
10183
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
10184
10184
|
/* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -10193,9 +10193,9 @@ const useStructureValidation = () => {
|
|
|
10193
10193
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
10194
10194
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
|
|
10195
10195
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
|
|
10196
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
10197
|
-
const
|
|
10198
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
10196
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((j) => {
|
|
10197
|
+
const v = Object.keys(j)[0], _ = v.replaceAll("_", " ");
|
|
10198
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(_) }, v);
|
|
10199
10199
|
}) })
|
|
10200
10200
|
] }) }),
|
|
10201
10201
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
|
|
@@ -10207,14 +10207,14 @@ const useStructureValidation = () => {
|
|
|
10207
10207
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
10208
10208
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
|
|
10209
10209
|
] }),
|
|
10210
|
-
(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(([j, v]) => /* @__PURE__ */ jsx(
|
|
10211
10211
|
FontSelector,
|
|
10212
10212
|
{
|
|
10213
|
-
label:
|
|
10214
|
-
value: h.fontFamily[
|
|
10215
|
-
onChange: (
|
|
10213
|
+
label: j,
|
|
10214
|
+
value: h.fontFamily[j.replace(/font-/g, "")] || v[Object.keys(v)[0]],
|
|
10215
|
+
onChange: (_) => A(j, _)
|
|
10216
10216
|
},
|
|
10217
|
-
|
|
10217
|
+
j
|
|
10218
10218
|
)) }),
|
|
10219
10219
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
10220
10220
|
(b == null ? void 0 : b.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -10240,7 +10240,7 @@ const useStructureValidation = () => {
|
|
|
10240
10240
|
Switch,
|
|
10241
10241
|
{
|
|
10242
10242
|
checked: n,
|
|
10243
|
-
onCheckedChange: (
|
|
10243
|
+
onCheckedChange: (j) => r(j),
|
|
10244
10244
|
"aria-label": y("Toggle dark mode"),
|
|
10245
10245
|
className: "mx-1"
|
|
10246
10246
|
}
|
|
@@ -10248,14 +10248,14 @@ const useStructureValidation = () => {
|
|
|
10248
10248
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
10249
10249
|
] })
|
|
10250
10250
|
] }),
|
|
10251
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((
|
|
10251
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((j) => w(j)) })
|
|
10252
10252
|
] }),
|
|
10253
10253
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && g && /* @__PURE__ */ jsx(
|
|
10254
10254
|
LazyCssImportModal,
|
|
10255
10255
|
{
|
|
10256
10256
|
open: l,
|
|
10257
10257
|
onOpenChange: c,
|
|
10258
|
-
onImport:
|
|
10258
|
+
onImport: S
|
|
10259
10259
|
}
|
|
10260
10260
|
) })
|
|
10261
10261
|
] }),
|
|
@@ -11008,9 +11008,9 @@ const UndoRedo = () => {
|
|
|
11008
11008
|
r(w), i(a), c(""), p(""), f("");
|
|
11009
11009
|
}
|
|
11010
11010
|
}, k = (w) => {
|
|
11011
|
-
const
|
|
11012
|
-
r(
|
|
11013
|
-
},
|
|
11011
|
+
const j = a.filter((v, _) => _ !== w);
|
|
11012
|
+
r(j), i(j);
|
|
11013
|
+
}, S = (w) => {
|
|
11014
11014
|
g(w), c(a[w].key), p(a[w].value);
|
|
11015
11015
|
}, A = () => {
|
|
11016
11016
|
if (l.startsWith("@")) {
|
|
@@ -11023,24 +11023,24 @@ const UndoRedo = () => {
|
|
|
11023
11023
|
}
|
|
11024
11024
|
}, B = (w) => {
|
|
11025
11025
|
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? A() : C());
|
|
11026
|
-
},
|
|
11027
|
-
const
|
|
11026
|
+
}, E = useCallback((w) => {
|
|
11027
|
+
const j = (N) => /[.,!?;:]/.test(N), v = (N, I, D) => {
|
|
11028
11028
|
let P = "", R = "";
|
|
11029
11029
|
const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
|
|
11030
|
-
return I > 0 && ($ === "." || !
|
|
11030
|
+
return I > 0 && ($ === "." || !j($) && $ !== " ") && (P = " "), I < N.length && !j(F) && F !== " " && (R = " "), {
|
|
11031
11031
|
text: P + D + R,
|
|
11032
11032
|
prefixLength: P.length,
|
|
11033
11033
|
suffixLength: R.length
|
|
11034
11034
|
};
|
|
11035
|
-
},
|
|
11036
|
-
if (
|
|
11037
|
-
const N =
|
|
11035
|
+
}, _ = x.current;
|
|
11036
|
+
if (_) {
|
|
11037
|
+
const N = _.selectionStart || 0, I = _.value || "", D = _.selectionEnd || N;
|
|
11038
11038
|
if (D > N) {
|
|
11039
|
-
const O = `{{${w}}}`, { text: L } =
|
|
11039
|
+
const O = `{{${w}}}`, { text: L } = v(I, N, O), T = I.slice(0, N) + L + I.slice(D);
|
|
11040
11040
|
p(T);
|
|
11041
11041
|
return;
|
|
11042
11042
|
}
|
|
11043
|
-
const R = `{{${w}}}`, { text: $ } =
|
|
11043
|
+
const R = `{{${w}}}`, { text: $ } = v(I, N, R), F = I.slice(0, N) + $ + I.slice(N);
|
|
11044
11044
|
p(F);
|
|
11045
11045
|
}
|
|
11046
11046
|
}, []);
|
|
@@ -11074,7 +11074,7 @@ const UndoRedo = () => {
|
|
|
11074
11074
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
11075
11075
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11076
11076
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: y("Value") }),
|
|
11077
|
-
!isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect:
|
|
11077
|
+
!isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect: E })
|
|
11078
11078
|
] }),
|
|
11079
11079
|
/* @__PURE__ */ jsx(
|
|
11080
11080
|
Textarea,
|
|
@@ -11098,16 +11098,16 @@ const UndoRedo = () => {
|
|
|
11098
11098
|
]
|
|
11099
11099
|
}
|
|
11100
11100
|
),
|
|
11101
|
-
/* @__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, j) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
11102
11102
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
11103
11103
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
|
|
11104
11104
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
|
|
11105
11105
|
] }),
|
|
11106
11106
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
11107
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
11108
|
-
/* @__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: () => S(j), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
11108
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(j), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
11109
11109
|
] })
|
|
11110
|
-
] },
|
|
11110
|
+
] }, j)) })
|
|
11111
11111
|
] });
|
|
11112
11112
|
}), BlockAttributesEditor = React.memo(() => {
|
|
11113
11113
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), i = useUpdateBlocksProps(), l = `${get(a, "0.prop")}_attrs`;
|
|
@@ -11255,18 +11255,17 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11255
11255
|
type: "button",
|
|
11256
11256
|
onClick: () => a(l.id),
|
|
11257
11257
|
className: cn$2(
|
|
11258
|
-
"group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-
|
|
11258
|
+
"group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition",
|
|
11259
11259
|
"hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
|
|
11260
11260
|
l.isSelected && "border-primary/40 bg-primary/10 text-primary"
|
|
11261
11261
|
),
|
|
11262
11262
|
children: /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-2", children: [
|
|
11263
11263
|
i && i,
|
|
11264
|
-
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-muted-foreground/50 group-hover:bg-primary/60" }),
|
|
11265
11264
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: l.label })
|
|
11266
11265
|
] })
|
|
11267
11266
|
},
|
|
11268
11267
|
l.id
|
|
11269
|
-
)) }) : /* @__PURE__ */ jsx("div", { className: "rounded border border-dashed border-muted px-3 py-
|
|
11268
|
+
)) }) : /* @__PURE__ */ jsx("div", { className: "rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground", children: r })
|
|
11270
11269
|
] }), STYLES_PREFIX = "#styles:", getBlockLabel = (o) => {
|
|
11271
11270
|
const r = [
|
|
11272
11271
|
typeof o._name == "string" ? o._name : void 0,
|
|
@@ -11274,43 +11273,41 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11274
11273
|
].filter(Boolean).find((a) => a.trim().length > 0);
|
|
11275
11274
|
return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : o._id;
|
|
11276
11275
|
}, collectTokenUsageOnPage = (o, n) => {
|
|
11277
|
-
const r = `${
|
|
11276
|
+
const r = `${n}`;
|
|
11278
11277
|
return o.filter((a) => Object.values(a).some((i) => typeof i != "string" || !i.startsWith(STYLES_PREFIX) ? !1 : i.includes(r))).map((a) => ({
|
|
11279
11278
|
id: a._id,
|
|
11280
11279
|
label: getBlockLabel(a)
|
|
11281
11280
|
}));
|
|
11282
11281
|
}, TokenUsagePopover = ({ tokenId: o, tokenName: n }) => {
|
|
11283
11282
|
const { t: r } = useTranslation(), [a] = useBlocksStore(), [i, l] = useSelectedBlockIds(), c = useBuilderProp("pageId"), d = useBuilderProp("siteWideUsage"), p = useMemo(() => collectTokenUsageOnPage(a, o), [a, o]), u = useMemo(
|
|
11284
|
-
() => p.map((
|
|
11285
|
-
id:
|
|
11286
|
-
label:
|
|
11287
|
-
isSelected: i.includes(
|
|
11283
|
+
() => p.map((S) => ({
|
|
11284
|
+
id: S.id,
|
|
11285
|
+
label: S.label,
|
|
11286
|
+
isSelected: i.includes(S.id)
|
|
11288
11287
|
})),
|
|
11289
11288
|
[p, i]
|
|
11290
11289
|
), g = useMemo(() => d ? Object.entries(d).reduce(
|
|
11291
|
-
(
|
|
11290
|
+
(S, [A, B]) => (A === c || !(B != null && B.designTokens) || !Object.keys(B.designTokens).some((w) => typeof w != "string" ? !1 : w === o) || S.push({ id: A, name: B.name || A, isPartial: !!B.isPartial }), S),
|
|
11292
11291
|
[]
|
|
11293
11292
|
) : [], [d, n, o, c]), m = useMemo(
|
|
11294
|
-
() => g.filter((
|
|
11295
|
-
id:
|
|
11296
|
-
label:
|
|
11293
|
+
() => g.filter((S) => !S.isPartial).map((S) => ({
|
|
11294
|
+
id: S.id,
|
|
11295
|
+
label: S.name
|
|
11297
11296
|
})),
|
|
11298
11297
|
[g]
|
|
11299
11298
|
), f = useMemo(
|
|
11300
|
-
() => g.filter((
|
|
11301
|
-
id:
|
|
11302
|
-
label:
|
|
11299
|
+
() => g.filter((S) => S.isPartial).map((S) => ({
|
|
11300
|
+
id: S.id,
|
|
11301
|
+
label: S.name
|
|
11303
11302
|
})),
|
|
11304
11303
|
[g]
|
|
11305
11304
|
), h = useCallback(
|
|
11306
|
-
(
|
|
11307
|
-
l([
|
|
11305
|
+
(S) => {
|
|
11306
|
+
l([S]);
|
|
11308
11307
|
},
|
|
11309
11308
|
[l]
|
|
11310
|
-
), x = (b) => {
|
|
11311
|
-
|
|
11312
|
-
const y = new URL(window.location.href);
|
|
11313
|
-
y.searchParams.set("pageId", b), window.open(y.toString(), "_blank");
|
|
11309
|
+
), x = useBuilderProp("gotoPage", noop), { selectedLang: b, fallbackLang: y } = useLanguages(), { savePageAsync: C } = useSavePage(), k = async (S) => {
|
|
11310
|
+
S && (await C(!0), x({ pageId: S, lang: b || y }));
|
|
11314
11311
|
};
|
|
11315
11312
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
11316
11313
|
/* @__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" }) }) }),
|
|
@@ -11327,7 +11324,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11327
11324
|
items: u,
|
|
11328
11325
|
emptyLabel: r("None"),
|
|
11329
11326
|
onSelect: h,
|
|
11330
|
-
icon: /* @__PURE__ */ jsx(
|
|
11327
|
+
icon: /* @__PURE__ */ jsx(ArrowRightIcon, { fontSize: 4 })
|
|
11331
11328
|
}
|
|
11332
11329
|
),
|
|
11333
11330
|
/* @__PURE__ */ jsx(
|
|
@@ -11336,7 +11333,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11336
11333
|
title: r("Blocks affected on other pages"),
|
|
11337
11334
|
items: m,
|
|
11338
11335
|
emptyLabel: r("None"),
|
|
11339
|
-
onSelect:
|
|
11336
|
+
onSelect: k,
|
|
11340
11337
|
icon: /* @__PURE__ */ jsx(FileIcon, { fontSize: 8 })
|
|
11341
11338
|
}
|
|
11342
11339
|
),
|
|
@@ -11346,7 +11343,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11346
11343
|
title: r("Blocks affected on partial blocks"),
|
|
11347
11344
|
items: f,
|
|
11348
11345
|
emptyLabel: r("None"),
|
|
11349
|
-
onSelect:
|
|
11346
|
+
onSelect: k,
|
|
11350
11347
|
icon: /* @__PURE__ */ jsx(GlobeIcon, { fontSize: 8 })
|
|
11351
11348
|
}
|
|
11352
11349
|
)
|
|
@@ -11354,20 +11351,20 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11354
11351
|
] })
|
|
11355
11352
|
] });
|
|
11356
11353
|
}, ManageDesignTokens = ({}) => {
|
|
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(""), [
|
|
11354
|
+
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(""), [S, A] = useState(""), [B, E] = useState(""), w = useIncrementActionsCount(), j = (L) => {
|
|
11358
11355
|
const T = L.trim();
|
|
11359
11356
|
return T.length === 0 || T.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(T);
|
|
11360
|
-
},
|
|
11357
|
+
}, v = (L, T = !1, M) => {
|
|
11361
11358
|
const H = L.trim();
|
|
11362
11359
|
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(
|
|
11363
11360
|
([V, U]) => U.name === H && (!T || V !== M)
|
|
11364
11361
|
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
11365
|
-
},
|
|
11362
|
+
}, _ = () => {
|
|
11366
11363
|
if (!m.trim() || !h.trim()) {
|
|
11367
11364
|
toast.error(o("Please fill in both token name and classes"));
|
|
11368
11365
|
return;
|
|
11369
11366
|
}
|
|
11370
|
-
if (!
|
|
11367
|
+
if (!j(m)) {
|
|
11371
11368
|
toast.error(o("Invalid design token name format"));
|
|
11372
11369
|
return;
|
|
11373
11370
|
}
|
|
@@ -11388,7 +11385,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11388
11385
|
toast.error(o("Please fill in both token name and classes"));
|
|
11389
11386
|
return;
|
|
11390
11387
|
}
|
|
11391
|
-
if (!
|
|
11388
|
+
if (!j(b)) {
|
|
11392
11389
|
toast.error(o("Invalid design token name format"));
|
|
11393
11390
|
return;
|
|
11394
11391
|
}
|
|
@@ -11417,15 +11414,15 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11417
11414
|
}, P = () => {
|
|
11418
11415
|
i(!0), c(null), f(""), x(""), A(""), p(!0);
|
|
11419
11416
|
}, R = () => {
|
|
11420
|
-
c(null), y(""), k(""),
|
|
11417
|
+
c(null), y(""), k(""), E(""), g(!1);
|
|
11421
11418
|
}, $ = () => {
|
|
11422
11419
|
i(!1), f(""), x(""), A(""), p(!1);
|
|
11423
11420
|
}, F = (L) => {
|
|
11424
11421
|
const T = L.replace(/\s+/g, "-");
|
|
11425
|
-
f(T), A(
|
|
11422
|
+
f(T), A(v(T));
|
|
11426
11423
|
}, O = (L) => {
|
|
11427
11424
|
const T = L.replace(/\s+/g, "-");
|
|
11428
|
-
y(T),
|
|
11425
|
+
y(T), E(v(T, !0, l || void 0));
|
|
11429
11426
|
};
|
|
11430
11427
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
11431
11428
|
/* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(
|
|
@@ -11520,7 +11517,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11520
11517
|
className: "text-sm"
|
|
11521
11518
|
}
|
|
11522
11519
|
),
|
|
11523
|
-
|
|
11520
|
+
S ? /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: S }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: o("Button-Primary, Card-Header, Text-Large") })
|
|
11524
11521
|
] }),
|
|
11525
11522
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
11526
11523
|
/* @__PURE__ */ jsx(Label, { htmlFor: "new-classes", className: "text-sm", children: o("Tailwind Classes") }),
|
|
@@ -11538,7 +11535,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
11538
11535
|
] }),
|
|
11539
11536
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
11540
11537
|
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: $, className: "h-8 text-sm", children: o("Cancel") }),
|
|
11541
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
11538
|
+
/* @__PURE__ */ jsx(Button, { onClick: _, className: "h-8 text-sm", children: o("Add Token") })
|
|
11542
11539
|
] })
|
|
11543
11540
|
] }) }),
|
|
11544
11541
|
/* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange: R, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
|
|
@@ -11619,7 +11616,7 @@ const RootLayout = () => {
|
|
|
11619
11616
|
w && get(w, "view", "standard") === "standard" && (a.current = n, l(get(w, "width", DEFAULT_PANEL_WIDTH)));
|
|
11620
11617
|
}
|
|
11621
11618
|
}, [n, b]);
|
|
11622
|
-
const
|
|
11619
|
+
const S = useMemo(() => {
|
|
11623
11620
|
if (n === null) return 0;
|
|
11624
11621
|
const w = find(b, { id: n });
|
|
11625
11622
|
return get(w, "view", "standard") === "standard" ? k : i;
|
|
@@ -11631,7 +11628,7 @@ const RootLayout = () => {
|
|
|
11631
11628
|
useEffect(() => {
|
|
11632
11629
|
n !== null && !find(b, { id: n }) && r("outline");
|
|
11633
11630
|
}, [n, b]);
|
|
11634
|
-
const
|
|
11631
|
+
const E = useCallback(
|
|
11635
11632
|
(w) => {
|
|
11636
11633
|
h(w);
|
|
11637
11634
|
},
|
|
@@ -11647,33 +11644,33 @@ const RootLayout = () => {
|
|
|
11647
11644
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
11648
11645
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
11649
11646
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
11650
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w,
|
|
11647
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11651
11648
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11652
11649
|
position: "top",
|
|
11653
11650
|
panelId: w.id,
|
|
11654
11651
|
isActive: n === w.id,
|
|
11655
|
-
show: () =>
|
|
11652
|
+
show: () => E(w.id)
|
|
11656
11653
|
}) }),
|
|
11657
11654
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11658
|
-
] }, "button-top-" +
|
|
11655
|
+
] }, "button-top-" + j)) }),
|
|
11659
11656
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
11660
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w,
|
|
11657
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11661
11658
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
|
|
11662
11659
|
position: "bottom",
|
|
11663
11660
|
panelId: w.id,
|
|
11664
11661
|
isActive: n === w.id,
|
|
11665
|
-
show: () =>
|
|
11662
|
+
show: () => E(w.id)
|
|
11666
11663
|
}) }),
|
|
11667
11664
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
|
|
11668
|
-
] }, "button-bottom-" +
|
|
11665
|
+
] }, "button-bottom-" + j)) })
|
|
11669
11666
|
] }),
|
|
11670
11667
|
/* @__PURE__ */ jsx(
|
|
11671
11668
|
motion.div,
|
|
11672
11669
|
{
|
|
11673
11670
|
id: "left-panel",
|
|
11674
11671
|
className: "h-full max-h-full border-r border-border",
|
|
11675
|
-
initial: { width:
|
|
11676
|
-
animate: { width:
|
|
11672
|
+
initial: { width: S },
|
|
11673
|
+
animate: { width: S },
|
|
11677
11674
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
11678
11675
|
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: [
|
|
11679
11676
|
/* @__PURE__ */ jsx(
|
|
@@ -11867,8 +11864,8 @@ const RootLayout = () => {
|
|
|
11867
11864
|
});
|
|
11868
11865
|
}, f = (x) => {
|
|
11869
11866
|
if (!c) return;
|
|
11870
|
-
const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth,
|
|
11871
|
-
r(
|
|
11867
|
+
const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth, S = C.offsetHeight, A = window.innerWidth - k, B = window.innerHeight - S, E = Math.max(0, Math.min(b, A)), w = Math.max(0, Math.min(y, B));
|
|
11868
|
+
r(E, w);
|
|
11872
11869
|
}, h = () => {
|
|
11873
11870
|
d(!1);
|
|
11874
11871
|
};
|
|
@@ -12110,10 +12107,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12110
12107
|
var r;
|
|
12111
12108
|
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);
|
|
12112
12109
|
if (isAtomStateInitialized(b) && (i.has(n) && l.get(n) !== b.n || Array.from(b.d).every(
|
|
12113
|
-
([w,
|
|
12110
|
+
([w, j]) => (
|
|
12114
12111
|
// Recursively, read the atom state of the dependency, and
|
|
12115
12112
|
// check if the atom epoch number is unchanged
|
|
12116
|
-
f(o, w).n ===
|
|
12113
|
+
f(o, w).n === j
|
|
12117
12114
|
)
|
|
12118
12115
|
)))
|
|
12119
12116
|
return b;
|
|
@@ -12123,27 +12120,27 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12123
12120
|
i.has(n) && (x(o, n), m(o), g(o));
|
|
12124
12121
|
}
|
|
12125
12122
|
function k(w) {
|
|
12126
|
-
var
|
|
12123
|
+
var j;
|
|
12127
12124
|
if (isSelfAtom(n, w)) {
|
|
12128
|
-
const
|
|
12129
|
-
if (!isAtomStateInitialized(
|
|
12125
|
+
const _ = u(o, w);
|
|
12126
|
+
if (!isAtomStateInitialized(_))
|
|
12130
12127
|
if (hasInitialValue(w))
|
|
12131
12128
|
setAtomStateValueOrPromise(o, w, w.init);
|
|
12132
12129
|
else
|
|
12133
12130
|
throw new Error("no atom init");
|
|
12134
|
-
return returnAtomValue(
|
|
12131
|
+
return returnAtomValue(_);
|
|
12135
12132
|
}
|
|
12136
|
-
const
|
|
12133
|
+
const v = f(o, w);
|
|
12137
12134
|
try {
|
|
12138
|
-
return returnAtomValue(
|
|
12135
|
+
return returnAtomValue(v);
|
|
12139
12136
|
} finally {
|
|
12140
|
-
b.d.set(w,
|
|
12137
|
+
b.d.set(w, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (j = i.get(w)) == null || j.t.add(n), y || C();
|
|
12141
12138
|
}
|
|
12142
12139
|
}
|
|
12143
|
-
let
|
|
12140
|
+
let S, A;
|
|
12144
12141
|
const B = {
|
|
12145
12142
|
get signal() {
|
|
12146
|
-
return
|
|
12143
|
+
return S || (S = new AbortController()), S.signal;
|
|
12147
12144
|
},
|
|
12148
12145
|
get setSelf() {
|
|
12149
12146
|
return !A && isActuallyWritableAtom(n) && (A = (...w) => {
|
|
@@ -12155,14 +12152,14 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12155
12152
|
}
|
|
12156
12153
|
}), A;
|
|
12157
12154
|
}
|
|
12158
|
-
},
|
|
12155
|
+
}, E = b.n;
|
|
12159
12156
|
try {
|
|
12160
12157
|
const w = p(o, n, k, B);
|
|
12161
|
-
return setAtomStateValueOrPromise(o, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () =>
|
|
12158
|
+
return setAtomStateValueOrPromise(o, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () => S == null ? void 0 : S.abort()), w.then(C, C)), b;
|
|
12162
12159
|
} catch (w) {
|
|
12163
12160
|
return delete b.v, b.e = w, ++b.n, b;
|
|
12164
12161
|
} finally {
|
|
12165
|
-
y = !1,
|
|
12162
|
+
y = !1, E !== b.n && l.get(n) === E && (l.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
12166
12163
|
}
|
|
12167
12164
|
}, invalidateDependents = (o, n) => {
|
|
12168
12165
|
const r = getBuildingBlocks(o), a = r[1], i = r[2], l = r[11], c = [n];
|
|
@@ -12178,13 +12175,13 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
12178
12175
|
let h = !0;
|
|
12179
12176
|
const x = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
|
|
12180
12177
|
var k;
|
|
12181
|
-
const
|
|
12178
|
+
const S = d(o, y);
|
|
12182
12179
|
try {
|
|
12183
12180
|
if (isSelfAtom(n, y)) {
|
|
12184
12181
|
if (!hasInitialValue(y))
|
|
12185
12182
|
throw new Error("atom not writable");
|
|
12186
|
-
const A =
|
|
12187
|
-
setAtomStateValueOrPromise(o, y, B), f(o, y), A !==
|
|
12183
|
+
const A = S.n, B = C[0];
|
|
12184
|
+
setAtomStateValueOrPromise(o, y, B), f(o, y), A !== S.n && (i.add(y), (k = l.c) == null || k.call(l, y), m(o, y));
|
|
12188
12185
|
return;
|
|
12189
12186
|
} else
|
|
12190
12187
|
return writeAtomState(o, y, ...C);
|
|
@@ -12595,7 +12592,7 @@ function domToJsx(o, n = 0) {
|
|
|
12595
12592
|
(x, b) => {
|
|
12596
12593
|
const [y, C] = b.split(":").map((k) => k.trim());
|
|
12597
12594
|
if (y && C) {
|
|
12598
|
-
const k = y.replace(/-([a-z])/g, (
|
|
12595
|
+
const k = y.replace(/-([a-z])/g, (S) => S[1].toUpperCase());
|
|
12599
12596
|
x[k] = C.replace(/['"]/g, "");
|
|
12600
12597
|
}
|
|
12601
12598
|
return x;
|
|
@@ -12722,19 +12719,19 @@ ${i})
|
|
|
12722
12719
|
u(!1);
|
|
12723
12720
|
let k = l({ blockId: i == null ? void 0 : i._id, additionalCoreBlocks: ["Icon"] });
|
|
12724
12721
|
k = k.replace(/\s*bid=["'][^"']*["']/g, "");
|
|
12725
|
-
const
|
|
12722
|
+
const S = o === "ts", {
|
|
12726
12723
|
jsx: A,
|
|
12727
12724
|
html: B,
|
|
12728
|
-
componentName:
|
|
12725
|
+
componentName: E
|
|
12729
12726
|
} = await getExportedCoded({
|
|
12730
12727
|
selectedBlock: i,
|
|
12731
12728
|
html: k,
|
|
12732
|
-
isTypeScript:
|
|
12729
|
+
isTypeScript: S
|
|
12733
12730
|
});
|
|
12734
|
-
a({ html: B, jsx: A }), d(
|
|
12731
|
+
a({ html: B, jsx: A }), d(E), u(!0);
|
|
12735
12732
|
} catch {
|
|
12736
|
-
const
|
|
12737
|
-
a({ html:
|
|
12733
|
+
const S = "<div>Export failed. Close the modal and try again.</div>";
|
|
12734
|
+
a({ html: S, jsx: S }), toast.error(n("Failed to generate export HTML"));
|
|
12738
12735
|
}
|
|
12739
12736
|
}, [n, o, i, l]);
|
|
12740
12737
|
useEffect(() => {
|
|
@@ -12750,17 +12747,17 @@ ${i})
|
|
|
12750
12747
|
},
|
|
12751
12748
|
[n]
|
|
12752
12749
|
), x = (k) => {
|
|
12753
|
-
const
|
|
12750
|
+
const S = new Blob([k], { type: "text/jsx" }), A = URL.createObjectURL(S), B = document.createElement("a");
|
|
12754
12751
|
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!"));
|
|
12755
12752
|
}, b = /* @__PURE__ */ jsxs("span", { children: [
|
|
12756
12753
|
"Download ",
|
|
12757
12754
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-light text-gray-300", children: g() })
|
|
12758
12755
|
] }), y = useMemo(() => {
|
|
12759
|
-
const k = { extend: shadcnTheme() },
|
|
12756
|
+
const k = { extend: shadcnTheme() }, S = JSON.stringify(k, null, 2);
|
|
12760
12757
|
return `{
|
|
12761
12758
|
// Your tailwind config ...
|
|
12762
12759
|
|
|
12763
|
-
"theme": ${
|
|
12760
|
+
"theme": ${S == null ? void 0 : S.split(`
|
|
12764
12761
|
`).join(`
|
|
12765
12762
|
`)},
|
|
12766
12763
|
}`;
|