@chaibuilder/sdk 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply-binding-C4AQBX3p.cjs +1 -0
- package/dist/apply-binding-CSYk-NOA.js +641 -0
- package/dist/core.cjs +3 -3
- package/dist/core.js +797 -697
- package/dist/render.cjs +2 -2
- package/dist/render.js +70 -69
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +75 -63
- package/package.json +2 -3
- package/dist/apply-binding-HQ9gBNJP.cjs +0 -1
- package/dist/apply-binding-tfi-KyyV.js +0 -573
package/dist/core.js
CHANGED
|
@@ -14,7 +14,7 @@ import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as Dropd
|
|
|
14
14
|
import clsx$1, { clsx } from "clsx";
|
|
15
15
|
import { twMerge } from "tailwind-merge";
|
|
16
16
|
import TreeModel from "tree-model";
|
|
17
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY,
|
|
17
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, i as getSplitChaiClasses, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, h as getBlocksFromHTML, j as ROOT_TEMP_KEY } from "./apply-binding-CSYk-NOA.js";
|
|
18
18
|
import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
|
|
19
19
|
import { isObject } from "@rjsf/utils";
|
|
20
20
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
@@ -838,13 +838,13 @@ const undoRedoStateAtom = atom({
|
|
|
838
838
|
} = useBlocksStoreManager();
|
|
839
839
|
return {
|
|
840
840
|
moveBlocks: (f, y, b) => {
|
|
841
|
-
const
|
|
842
|
-
const
|
|
843
|
-
return { _id: j, oldParent:
|
|
844
|
-
}), B =
|
|
841
|
+
const k = map(f, (j) => {
|
|
842
|
+
const C = n.find((I) => I._id === j)._parent || null, S = n.filter((I) => C ? I._parent === C : !I._parent).map((I) => I._id).indexOf(j);
|
|
843
|
+
return { _id: j, oldParent: C, oldPosition: S };
|
|
844
|
+
}), B = k.find(({ _id: j }) => j === f[0]);
|
|
845
845
|
B && B.oldParent === y && B.oldPosition === b || (i(f, y, b), o({
|
|
846
|
-
undo: () => each(
|
|
847
|
-
i([j],
|
|
846
|
+
undo: () => each(k, ({ _id: j, oldParent: E, oldPosition: C }) => {
|
|
847
|
+
i([j], E, C);
|
|
848
848
|
}),
|
|
849
849
|
redo: () => i(f, y, b)
|
|
850
850
|
}));
|
|
@@ -857,25 +857,25 @@ const undoRedoStateAtom = atom({
|
|
|
857
857
|
},
|
|
858
858
|
removeBlocks: (f) => {
|
|
859
859
|
var B;
|
|
860
|
-
const y = (B = first(f)) == null ? void 0 : B._parent,
|
|
860
|
+
const y = (B = first(f)) == null ? void 0 : B._parent, k = n.filter((j) => y ? j._parent === y : !j._parent).indexOf(first(f));
|
|
861
861
|
l(map(f, "_id")), o({
|
|
862
|
-
undo: () => a(f, y,
|
|
862
|
+
undo: () => a(f, y, k),
|
|
863
863
|
redo: () => l(map(f, "_id"))
|
|
864
864
|
});
|
|
865
865
|
},
|
|
866
866
|
updateBlocks: (f, y, b) => {
|
|
867
|
-
let
|
|
867
|
+
let k = [];
|
|
868
868
|
if (b)
|
|
869
|
-
|
|
869
|
+
k = map(f, (B) => ({ _id: B, ...b }));
|
|
870
870
|
else {
|
|
871
871
|
const B = keys(y);
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
return each(B, (
|
|
872
|
+
k = map(f, (j) => {
|
|
873
|
+
const E = n.find((v) => v._id === j), C = { _id: j };
|
|
874
|
+
return each(B, (v) => C[v] = E[v]), C;
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
c(map(f, (B) => ({ _id: B, ...y }))), o({
|
|
878
|
-
undo: () => c(
|
|
878
|
+
undo: () => c(k),
|
|
879
879
|
redo: () => c(map(f, (B) => ({ _id: B, ...y })))
|
|
880
880
|
});
|
|
881
881
|
},
|
|
@@ -891,8 +891,8 @@ const undoRedoStateAtom = atom({
|
|
|
891
891
|
updateMultipleBlocksProps: (f) => {
|
|
892
892
|
let y = [];
|
|
893
893
|
y = map(f, (b) => {
|
|
894
|
-
const
|
|
895
|
-
return each(
|
|
894
|
+
const k = keys(b), B = n.find((E) => E._id === b._id), j = {};
|
|
895
|
+
return each(k, (E) => j[E] = B[E]), j;
|
|
896
896
|
}), c(f), o({
|
|
897
897
|
undo: () => c(y),
|
|
898
898
|
redo: () => c(f)
|
|
@@ -2366,8 +2366,8 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2366
2366
|
for (const y in f) {
|
|
2367
2367
|
const b = f[y];
|
|
2368
2368
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2369
|
-
const { baseClasses:
|
|
2370
|
-
f[y] = compact(flattenDeep([
|
|
2369
|
+
const { baseClasses: k, classes: B } = getSplitChaiClasses(b);
|
|
2370
|
+
f[y] = compact(flattenDeep([k, B])).join(" ");
|
|
2371
2371
|
} else
|
|
2372
2372
|
y !== "_id" && delete f[y];
|
|
2373
2373
|
}
|
|
@@ -2381,20 +2381,20 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2381
2381
|
try {
|
|
2382
2382
|
const b = p === u ? "" : p;
|
|
2383
2383
|
console.log("prompt", f);
|
|
2384
|
-
const
|
|
2385
|
-
if (
|
|
2386
|
-
a(
|
|
2384
|
+
const k = f.toLowerCase().includes("translate the content"), B = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p, k) : [m(x, d)], j = await l(h, addLangToPrompt(f, g, h), B, b), { blocks: E, error: C } = j;
|
|
2385
|
+
if (C) {
|
|
2386
|
+
a(C);
|
|
2387
2387
|
return;
|
|
2388
2388
|
}
|
|
2389
2389
|
if (h === "styles") {
|
|
2390
|
-
const
|
|
2391
|
-
for (const
|
|
2392
|
-
|
|
2393
|
-
return
|
|
2390
|
+
const v = E.map((S) => {
|
|
2391
|
+
for (const I in S)
|
|
2392
|
+
I !== "_id" && (S[I] = `${STYLES_KEY},${S[I]}`);
|
|
2393
|
+
return S;
|
|
2394
2394
|
});
|
|
2395
|
-
c(
|
|
2395
|
+
c(v);
|
|
2396
2396
|
} else
|
|
2397
|
-
i(
|
|
2397
|
+
i(E);
|
|
2398
2398
|
y && y(j);
|
|
2399
2399
|
} catch (b) {
|
|
2400
2400
|
a(b);
|
|
@@ -2999,8 +2999,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
2999
2999
|
}),
|
|
3000
3000
|
size({
|
|
3001
3001
|
boundary: u == null ? void 0 : u.body,
|
|
3002
|
-
apply({ availableWidth: y, availableHeight: b, elements:
|
|
3003
|
-
Object.assign(
|
|
3002
|
+
apply({ availableWidth: y, availableHeight: b, elements: k }) {
|
|
3003
|
+
Object.assign(k.floating.style, {
|
|
3004
3004
|
maxWidth: `${Math.max(200, y)}px`,
|
|
3005
3005
|
maxHeight: `${Math.max(100, b)}px`
|
|
3006
3006
|
});
|
|
@@ -3600,62 +3600,62 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3600
3600
|
}
|
|
3601
3601
|
), WithBlockTextEditor = memo(
|
|
3602
3602
|
({ block: o, children: n }) => {
|
|
3603
|
-
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent:
|
|
3604
|
-
var
|
|
3605
|
-
const
|
|
3606
|
-
let
|
|
3607
|
-
const
|
|
3608
|
-
return x && ((
|
|
3603
|
+
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: k, blockType: B } = useMemo(() => {
|
|
3604
|
+
var _;
|
|
3605
|
+
const S = o._type;
|
|
3606
|
+
let I = o[r];
|
|
3607
|
+
const A = getRegisteredChaiBlock(o._type);
|
|
3608
|
+
return x && ((_ = A == null ? void 0 : A.i18nProps) == null ? void 0 : _.includes(r)) && has(o, `${r}-${x}`) && (I = get(o, `${r}-${x}`)), { blockContent: I, blockType: S };
|
|
3609
3609
|
}, [o, x]), j = useCallback(
|
|
3610
|
-
(
|
|
3611
|
-
var
|
|
3612
|
-
const
|
|
3613
|
-
h([b], { [r]:
|
|
3610
|
+
(S) => {
|
|
3611
|
+
var A;
|
|
3612
|
+
const I = S || ((A = g.current) == null ? void 0 : A.innerText);
|
|
3613
|
+
h([b], { [r]: I }), u(null), c(null), d(-1), f(b ? [b] : []);
|
|
3614
3614
|
},
|
|
3615
3615
|
[b, h, c, f, x]
|
|
3616
|
-
),
|
|
3617
|
-
(
|
|
3618
|
-
h([b], { [r]:
|
|
3616
|
+
), E = useDebouncedCallback(
|
|
3617
|
+
(S) => {
|
|
3618
|
+
h([b], { [r]: S });
|
|
3619
3619
|
},
|
|
3620
3620
|
[b, o, h, x],
|
|
3621
3621
|
1e3
|
|
3622
|
-
),
|
|
3623
|
-
(
|
|
3624
|
-
|
|
3625
|
-
const
|
|
3626
|
-
y.current = null, f([
|
|
3622
|
+
), C = useCallback(
|
|
3623
|
+
(S) => {
|
|
3624
|
+
S.preventDefault(), b && (y.current = b), j(), setTimeout(() => {
|
|
3625
|
+
const I = y.current;
|
|
3626
|
+
y.current = null, f([I]);
|
|
3627
3627
|
}, 100);
|
|
3628
3628
|
},
|
|
3629
3629
|
[f, b, x]
|
|
3630
3630
|
);
|
|
3631
3631
|
useEffect(() => {
|
|
3632
|
-
var
|
|
3632
|
+
var w;
|
|
3633
3633
|
if (!b) return;
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3634
|
+
const S = `[data-block-id="${b}"]`, I = i >= 0 ? `[data-block-index="${i}"]` : "", A = a.querySelector(`${S}${I}`);
|
|
3635
|
+
A && ((w = A == null ? void 0 : A.classList) == null || w.add("sr-only"), u(A));
|
|
3636
3636
|
}, [b, B, a, i]);
|
|
3637
|
-
const
|
|
3637
|
+
const v = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
3638
3638
|
RichTextEditor,
|
|
3639
3639
|
{
|
|
3640
|
-
blockContent:
|
|
3640
|
+
blockContent: k,
|
|
3641
3641
|
editingElement: p,
|
|
3642
|
-
onChange:
|
|
3642
|
+
onChange: E,
|
|
3643
3643
|
onClose: j,
|
|
3644
|
-
onEscape:
|
|
3644
|
+
onEscape: C
|
|
3645
3645
|
}
|
|
3646
3646
|
) : /* @__PURE__ */ jsx(
|
|
3647
3647
|
MemoizedEditor,
|
|
3648
3648
|
{
|
|
3649
3649
|
editorRef: g,
|
|
3650
|
-
blockContent:
|
|
3650
|
+
blockContent: k,
|
|
3651
3651
|
editingElement: p,
|
|
3652
3652
|
onClose: j,
|
|
3653
|
-
onChange:
|
|
3654
|
-
onEscape:
|
|
3653
|
+
onChange: E,
|
|
3654
|
+
onEscape: C
|
|
3655
3655
|
}
|
|
3656
|
-
)) : null, [p, b, B,
|
|
3656
|
+
)) : null, [p, b, B, k, j, x]);
|
|
3657
3657
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3658
|
-
|
|
3658
|
+
v,
|
|
3659
3659
|
n
|
|
3660
3660
|
] });
|
|
3661
3661
|
},
|
|
@@ -3694,7 +3694,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3694
3694
|
key: f
|
|
3695
3695
|
}) : applyLanguage(i, d, c),
|
|
3696
3696
|
[i, d, c, g, m, x, f]
|
|
3697
|
-
), b = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]),
|
|
3697
|
+
), b = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), k = useMemo(
|
|
3698
3698
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3699
3699
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3700
3700
|
), B = useMemo(
|
|
@@ -3704,7 +3704,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3704
3704
|
lang: d || p,
|
|
3705
3705
|
...y,
|
|
3706
3706
|
...b,
|
|
3707
|
-
...
|
|
3707
|
+
...k,
|
|
3708
3708
|
...o
|
|
3709
3709
|
}),
|
|
3710
3710
|
[
|
|
@@ -3714,12 +3714,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3714
3714
|
p,
|
|
3715
3715
|
y,
|
|
3716
3716
|
b,
|
|
3717
|
-
|
|
3717
|
+
k,
|
|
3718
3718
|
o
|
|
3719
3719
|
]
|
|
3720
|
-
), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]),
|
|
3721
|
-
if (isNull(h) || !
|
|
3722
|
-
let
|
|
3720
|
+
), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), E = useMemo(() => get(i, "_show", !0), [i]);
|
|
3721
|
+
if (isNull(h) || !E) return null;
|
|
3722
|
+
let C = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
|
|
3723
3723
|
...B,
|
|
3724
3724
|
children: r({
|
|
3725
3725
|
_id: i._id,
|
|
@@ -3732,8 +3732,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3732
3732
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3733
3733
|
})
|
|
3734
3734
|
}) });
|
|
3735
|
-
const
|
|
3736
|
-
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children:
|
|
3735
|
+
const v = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: C }) : C;
|
|
3736
|
+
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: v }) : v;
|
|
3737
3737
|
}, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
|
|
3738
3738
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
3739
3739
|
(d) => {
|
|
@@ -3758,22 +3758,25 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3758
3758
|
] });
|
|
3759
3759
|
}, PartialBlocksRenderer = ({ partialBlockId: o }) => {
|
|
3760
3760
|
const { getPartailBlocks: n } = usePartialBlocksStore(), r = useMemo(() => n(o), [n, o]), a = useMemo(() => splitAtom(atom(r)), [r]);
|
|
3761
|
-
return isEmpty(r) ? null : /* @__PURE__ */ jsx(PartialWrapper$1, { partialBlockId: o, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: r }) });
|
|
3761
|
+
return isEmpty(r) ? null : /* @__PURE__ */ jsx(PartialWrapper$1, { partialBlockId: o, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: r, type: "PartialBlock" }) });
|
|
3762
3762
|
}, BlocksRenderer = ({
|
|
3763
3763
|
blocks: o,
|
|
3764
3764
|
parent: n = null,
|
|
3765
|
-
splitAtoms: r = void 0
|
|
3765
|
+
splitAtoms: r = void 0,
|
|
3766
|
+
type: a = ""
|
|
3766
3767
|
}) => {
|
|
3767
|
-
const
|
|
3768
|
-
|
|
3768
|
+
const l = useGetBlockAtom(r);
|
|
3769
|
+
let i = useMemo(
|
|
3770
|
+
() => filter(o, (d) => has(d, "_id") && (isEmpty(n) ? !d._parent : d._parent === n)),
|
|
3769
3771
|
[o, n]
|
|
3770
|
-
)
|
|
3771
|
-
|
|
3772
|
+
);
|
|
3773
|
+
const c = useCallback(
|
|
3774
|
+
(d) => filter(o, (p) => p._parent === d).length > 0,
|
|
3772
3775
|
[o]
|
|
3773
3776
|
);
|
|
3774
|
-
return map(
|
|
3775
|
-
const
|
|
3776
|
-
return
|
|
3777
|
+
return c && (a === "Heading" || a === "Paragraph" || a === "Link") && (i = adjustSpacingInContentBlocks(i)), map(i, (d) => {
|
|
3778
|
+
const p = l(d._id);
|
|
3779
|
+
return p ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: d, children: (u) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: p, asyncProps: u, children: ({ _id: g, _type: m, partialBlockId: h, repeaterItems: x, $repeaterItemsKey: f }) => m === "Repeater" ? isArray(x) && x.map((y, b) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: b, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: m }) }, `${g}-${b}`)) : m === "GlobalBlock" || m === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : c(g) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: m }) : null }) }, d._id) : null;
|
|
3777
3780
|
});
|
|
3778
3781
|
}, PageBlocksRenderer = () => {
|
|
3779
3782
|
const [o] = useBlocksStore();
|
|
@@ -3957,13 +3960,13 @@ const CanvasEventsWatcher = () => {
|
|
|
3957
3960
|
spellCheck: "false",
|
|
3958
3961
|
value: l,
|
|
3959
3962
|
onChange: (d) => c(d.target.value),
|
|
3960
|
-
placeholder: a("
|
|
3963
|
+
placeholder: a("SVG_code"),
|
|
3961
3964
|
rows: 2,
|
|
3962
3965
|
className: "no-scrollbar w-full rounded-md border border-border bg-background px-3 py-1.5 text-xs shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
3963
3966
|
}
|
|
3964
3967
|
)
|
|
3965
3968
|
] }),
|
|
3966
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste
|
|
3969
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG_code") })
|
|
3967
3970
|
] });
|
|
3968
3971
|
}, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
|
|
3969
3972
|
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (x) => {
|
|
@@ -4030,32 +4033,40 @@ const CanvasEventsWatcher = () => {
|
|
|
4030
4033
|
] });
|
|
4031
4034
|
};
|
|
4032
4035
|
MediaManagerModal.displayName = "MediaManagerModal";
|
|
4033
|
-
const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4036
|
+
const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==", getFileName = (o) => {
|
|
4037
|
+
var l;
|
|
4038
|
+
if (!o || startsWith(o, "data")) return "";
|
|
4039
|
+
const n = ((l = o.split("/").pop()) == null ? void 0 : l.split("?")[0]) || "";
|
|
4040
|
+
return [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".ico", ".avif"].some((i) => n.toLowerCase().endsWith(i)) ? n : "";
|
|
4041
|
+
}, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
4042
|
+
const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = r.split(".").pop() || "", u = i ? `_${p}Id-${i}` : `_${p}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), m = get(c, u, g ? c == null ? void 0 : c.assetId : ""), h = !!m || o !== PLACEHOLDER_IMAGE, x = (b) => {
|
|
4043
|
+
const k = isArray(b) ? first(b) : b;
|
|
4044
|
+
if (k) {
|
|
4045
|
+
n(k == null ? void 0 : k.url);
|
|
4046
|
+
const B = k == null ? void 0 : k.width, j = k == null ? void 0 : k.height, E = u.includes("mobile");
|
|
4039
4047
|
if (c != null && c._id) {
|
|
4040
|
-
const
|
|
4041
|
-
...
|
|
4042
|
-
...
|
|
4043
|
-
...
|
|
4048
|
+
const C = {
|
|
4049
|
+
...B && { [E ? "mobileWidth" : "width"]: B },
|
|
4050
|
+
...j && { [E ? "mobileHeight" : "height"]: j },
|
|
4051
|
+
...k.description && { alt: k.description }
|
|
4044
4052
|
};
|
|
4045
|
-
if (set(
|
|
4046
|
-
d([c._id],
|
|
4053
|
+
if (set(C, u, k.id), isEmpty(C)) return;
|
|
4054
|
+
d([c._id], C);
|
|
4047
4055
|
}
|
|
4048
4056
|
}
|
|
4049
4057
|
}, f = useCallback(() => {
|
|
4050
|
-
n(PLACEHOLDER_IMAGE), c != null && c._id
|
|
4051
|
-
|
|
4058
|
+
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
4059
|
+
const b = { assetId: "" }, k = u.includes("mobile");
|
|
4060
|
+
set(b, k ? "mobileWidth" : "width", ""), set(b, k ? "mobileHeight" : "height", ""), d([c._id], b);
|
|
4061
|
+
}
|
|
4062
|
+
}, [n, c == null ? void 0 : c._id, d, u]), y = getFileName(o);
|
|
4052
4063
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
4053
4064
|
o ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
4054
4065
|
/* @__PURE__ */ jsx(
|
|
4055
4066
|
"img",
|
|
4056
4067
|
{
|
|
4057
4068
|
src: o,
|
|
4058
|
-
className: "h-
|
|
4069
|
+
className: "h-14 w-14 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (m && m !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
|
|
4059
4070
|
alt: ""
|
|
4060
4071
|
}
|
|
4061
4072
|
),
|
|
@@ -4076,11 +4087,11 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4076
4087
|
children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-4 w-4 text-white" })
|
|
4077
4088
|
}
|
|
4078
4089
|
) })
|
|
4079
|
-
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, mode: "image", assetId: m, children: /* @__PURE__ */ jsx("div", { className: "h-
|
|
4090
|
+
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, mode: "image", assetId: m, children: /* @__PURE__ */ jsx("div", { className: "h-14 w-14 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
4080
4091
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4081
4092
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4082
|
-
/* @__PURE__ */ jsx(
|
|
4083
|
-
/* @__PURE__ */ jsx("small", { className: "-
|
|
4093
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 max-w-[250px] truncate pr-2 text-xs text-gray-400", children: y }),
|
|
4094
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 w-fit cursor-pointer rounded-md bg-secondary px-1 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: !isEmpty(o) && o !== PLACEHOLDER_IMAGE ? l("Replace image") : l("Choose image") }) })
|
|
4084
4095
|
] }),
|
|
4085
4096
|
/* @__PURE__ */ jsx(
|
|
4086
4097
|
"input",
|
|
@@ -4090,11 +4101,11 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4090
4101
|
autoCorrect: "off",
|
|
4091
4102
|
spellCheck: "false",
|
|
4092
4103
|
type: "url",
|
|
4093
|
-
className: "text-xs",
|
|
4104
|
+
className: "!hidden text-xs",
|
|
4094
4105
|
placeholder: l("Enter image URL"),
|
|
4095
4106
|
value: o,
|
|
4096
|
-
onBlur: ({ target: { value:
|
|
4097
|
-
onChange: (
|
|
4107
|
+
onBlur: ({ target: { value: b } }) => a(r, b),
|
|
4108
|
+
onChange: (b) => n(b.target.value)
|
|
4098
4109
|
}
|
|
4099
4110
|
)
|
|
4100
4111
|
] })
|
|
@@ -4164,7 +4175,7 @@ function NestedPathSelector({ data: o, onSelect: n, dataType: r = "value" }) {
|
|
|
4164
4175
|
Button,
|
|
4165
4176
|
{
|
|
4166
4177
|
size: "sm",
|
|
4167
|
-
variant: "
|
|
4178
|
+
variant: "ghost",
|
|
4168
4179
|
className: "h-5 rounded-sm px-1 py-0 text-[9px] text-muted-foreground",
|
|
4169
4180
|
role: "combobox",
|
|
4170
4181
|
"aria-expanded": a,
|
|
@@ -4210,13 +4221,13 @@ const DataBindingSelector = ({
|
|
|
4210
4221
|
n(`{{${g}}}`, {}, r);
|
|
4211
4222
|
return;
|
|
4212
4223
|
}
|
|
4213
|
-
const h = (b) => /[.,!?;:]/.test(b), x = (b,
|
|
4214
|
-
let j = "",
|
|
4215
|
-
const
|
|
4216
|
-
return
|
|
4217
|
-
text: j + B +
|
|
4224
|
+
const h = (b) => /[.,!?;:]/.test(b), x = (b, k, B) => {
|
|
4225
|
+
let j = "", E = "";
|
|
4226
|
+
const C = k > 0 ? b[k - 1] : "", v = k < b.length ? b[k] : "";
|
|
4227
|
+
return k > 0 && (C === "." || !h(C) && C !== " ") && (j = " "), k < b.length && !h(v) && v !== " " && (E = " "), {
|
|
4228
|
+
text: j + B + E,
|
|
4218
4229
|
prefixLength: j.length,
|
|
4219
|
-
suffixLength:
|
|
4230
|
+
suffixLength: E.length
|
|
4220
4231
|
};
|
|
4221
4232
|
}, f = document.getElementById(r);
|
|
4222
4233
|
if (!f) return;
|
|
@@ -4224,30 +4235,30 @@ const DataBindingSelector = ({
|
|
|
4224
4235
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4225
4236
|
const b = y.__chaiRTE;
|
|
4226
4237
|
if (b) {
|
|
4227
|
-
const
|
|
4238
|
+
const k = `{{${g}}}`;
|
|
4228
4239
|
b.commands.focus();
|
|
4229
4240
|
const { from: B, to: j } = b.state.selection;
|
|
4230
4241
|
if (B !== j)
|
|
4231
|
-
b.chain().deleteSelection().insertContent(
|
|
4242
|
+
b.chain().deleteSelection().insertContent(k).run();
|
|
4232
4243
|
else {
|
|
4233
|
-
const { state:
|
|
4234
|
-
let
|
|
4235
|
-
|
|
4236
|
-
let
|
|
4237
|
-
|
|
4244
|
+
const { state: C } = b, v = C.selection.from, S = C.doc.textBetween(Math.max(0, v - 1), v), I = C.doc.textBetween(v, Math.min(v + 1, C.doc.content.size));
|
|
4245
|
+
let A = "";
|
|
4246
|
+
v > 0 && S !== " " && !h(S) && (A = " ");
|
|
4247
|
+
let w = "";
|
|
4248
|
+
I && I !== " " && !h(I) && (w = " "), b.chain().insertContent(A + k + w).run();
|
|
4238
4249
|
}
|
|
4239
4250
|
setTimeout(() => n(b.getHTML(), {}, r), 100);
|
|
4240
4251
|
return;
|
|
4241
4252
|
}
|
|
4242
4253
|
} else {
|
|
4243
|
-
const b = f,
|
|
4244
|
-
if (j >
|
|
4245
|
-
const
|
|
4246
|
-
n(
|
|
4254
|
+
const b = f, k = b.selectionStart || 0, B = b.value || "", j = b.selectionEnd || k;
|
|
4255
|
+
if (j > k) {
|
|
4256
|
+
const I = `{{${g}}}`, { text: A } = x(B, k, I), w = B.slice(0, k) + A + B.slice(j);
|
|
4257
|
+
n(w, {}, r);
|
|
4247
4258
|
return;
|
|
4248
4259
|
}
|
|
4249
|
-
const
|
|
4250
|
-
n(
|
|
4260
|
+
const C = `{{${g}}}`, { text: v } = x(B, k, C), S = B.slice(0, k) + v + B.slice(k);
|
|
4261
|
+
n(S, {}, r);
|
|
4251
4262
|
}
|
|
4252
4263
|
},
|
|
4253
4264
|
[r, n, a, c == null ? void 0 : c._id, d]
|
|
@@ -4268,74 +4279,74 @@ const DataBindingSelector = ({
|
|
|
4268
4279
|
pageTypes: n,
|
|
4269
4280
|
onChange: r
|
|
4270
4281
|
}) => {
|
|
4271
|
-
var
|
|
4272
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (
|
|
4282
|
+
var I;
|
|
4283
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (A, w) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), k = useRef(null), B = (I = n == null ? void 0 : n.find((A) => A.key === u)) == null ? void 0 : I.name;
|
|
4273
4284
|
useEffect(() => {
|
|
4274
4285
|
if (h(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4275
|
-
const
|
|
4276
|
-
g(
|
|
4277
|
-
const
|
|
4278
|
-
|
|
4286
|
+
const A = split(o, ":"), w = get(A, 1, "page") || "page";
|
|
4287
|
+
g(w), (async () => {
|
|
4288
|
+
const _ = await l(w, [get(A, 2, "page")]);
|
|
4289
|
+
_ && Array.isArray(_) && h(get(_, [0, "name"], ""));
|
|
4279
4290
|
})();
|
|
4280
4291
|
}, [o]);
|
|
4281
4292
|
const j = useDebouncedCallback(
|
|
4282
|
-
async (
|
|
4283
|
-
if (isEmpty(
|
|
4293
|
+
async (A) => {
|
|
4294
|
+
if (isEmpty(A))
|
|
4284
4295
|
f([]);
|
|
4285
4296
|
else {
|
|
4286
|
-
const
|
|
4287
|
-
f(
|
|
4297
|
+
const w = await l(u, A);
|
|
4298
|
+
f(w);
|
|
4288
4299
|
}
|
|
4289
4300
|
c(!1), b(-1);
|
|
4290
4301
|
},
|
|
4291
4302
|
[u],
|
|
4292
4303
|
300
|
|
4293
|
-
),
|
|
4294
|
-
const
|
|
4295
|
-
|
|
4296
|
-
},
|
|
4297
|
-
switch (
|
|
4304
|
+
), E = (A) => {
|
|
4305
|
+
const w = ["pageType", u, A.id];
|
|
4306
|
+
w[1] && (r(w.join(":")), h(A.name), p(!1), f([]), b(-1));
|
|
4307
|
+
}, C = (A) => {
|
|
4308
|
+
switch (A.key) {
|
|
4298
4309
|
case "ArrowDown":
|
|
4299
|
-
|
|
4310
|
+
A.preventDefault(), b((w) => w < x.length - 1 ? w + 1 : w);
|
|
4300
4311
|
break;
|
|
4301
4312
|
case "ArrowUp":
|
|
4302
|
-
|
|
4313
|
+
A.preventDefault(), b((w) => w > 0 ? w - 1 : w);
|
|
4303
4314
|
break;
|
|
4304
4315
|
case "Enter":
|
|
4305
|
-
if (
|
|
4306
|
-
y >= 0 &&
|
|
4316
|
+
if (A.preventDefault(), x.length === 0) return;
|
|
4317
|
+
y >= 0 && E(x[y]);
|
|
4307
4318
|
break;
|
|
4308
4319
|
case "Escape":
|
|
4309
|
-
|
|
4320
|
+
A.preventDefault(), v();
|
|
4310
4321
|
break;
|
|
4311
4322
|
}
|
|
4312
4323
|
};
|
|
4313
4324
|
useEffect(() => {
|
|
4314
|
-
if (y >= 0 &&
|
|
4315
|
-
const
|
|
4316
|
-
|
|
4325
|
+
if (y >= 0 && k.current) {
|
|
4326
|
+
const A = k.current.children[y];
|
|
4327
|
+
A == null || A.scrollIntoView({ block: "nearest" });
|
|
4317
4328
|
}
|
|
4318
4329
|
}, [y]);
|
|
4319
|
-
const
|
|
4330
|
+
const v = () => {
|
|
4320
4331
|
h(""), f([]), b(-1), p(!1), r("");
|
|
4321
|
-
},
|
|
4322
|
-
h(
|
|
4332
|
+
}, S = (A) => {
|
|
4333
|
+
h(A), p(!isEmpty(A)), c(!0), j(A);
|
|
4323
4334
|
};
|
|
4324
4335
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4325
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (
|
|
4336
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (A) => g(A.target.value), children: map(n, (A) => /* @__PURE__ */ jsx("option", { value: A.key, children: A.name }, A.key)) }),
|
|
4326
4337
|
u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
4327
4338
|
/* @__PURE__ */ jsx(
|
|
4328
4339
|
"input",
|
|
4329
4340
|
{
|
|
4330
4341
|
type: "text",
|
|
4331
4342
|
value: m,
|
|
4332
|
-
onChange: (
|
|
4333
|
-
onKeyDown:
|
|
4343
|
+
onChange: (A) => S(A.target.value),
|
|
4344
|
+
onKeyDown: C,
|
|
4334
4345
|
placeholder: a(`Search ${B ?? ""}`),
|
|
4335
4346
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4336
4347
|
}
|
|
4337
4348
|
),
|
|
4338
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick:
|
|
4349
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: v, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
|
|
4339
4350
|
] }),
|
|
4340
4351
|
(i || !isEmpty(x) || d && isEmpty(x)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4341
4352
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4345,35 +4356,41 @@ const DataBindingSelector = ({
|
|
|
4345
4356
|
' "',
|
|
4346
4357
|
m,
|
|
4347
4358
|
'"'
|
|
4348
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref:
|
|
4359
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: k, children: map(x == null ? void 0 : x.slice(0, 20), (A, w) => /* @__PURE__ */ jsxs(
|
|
4349
4360
|
"li",
|
|
4350
4361
|
{
|
|
4351
|
-
onClick: () =>
|
|
4352
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
4362
|
+
onClick: () => E(A),
|
|
4363
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(A.id) ? "bg-blue-200" : w === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4353
4364
|
children: [
|
|
4354
|
-
|
|
4365
|
+
A.name,
|
|
4355
4366
|
" ",
|
|
4356
|
-
|
|
4367
|
+
A.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
4357
4368
|
"( ",
|
|
4358
|
-
|
|
4369
|
+
A.slug,
|
|
4359
4370
|
" )"
|
|
4360
4371
|
] })
|
|
4361
4372
|
]
|
|
4362
4373
|
},
|
|
4363
|
-
|
|
4374
|
+
A.id
|
|
4364
4375
|
)) }) })
|
|
4365
4376
|
] });
|
|
4366
4377
|
}, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
|
|
4367
|
-
const { t: l } = useTranslation(), { type: i = "pageType", href: c = "", target: d = "self" } = n, p = useBuilderProp("pageTypes", []), u
|
|
4378
|
+
const { t: l } = useTranslation(), { type: i = "pageType", href: c = "", target: d = "self" } = n ?? {}, p = useBuilderProp("pageTypes", []), { selectedLang: u, fallbackLang: g, languages: m } = useLanguages(), h = useMemo(
|
|
4379
|
+
() => isEmpty(m) ? "" : isEmpty(u) ? g : u,
|
|
4380
|
+
[m, u, g]
|
|
4381
|
+
), x = useMemo(() => get(LANGUAGES, h, h), [h]), f = i === "pageType" && isEmpty(p) ? "url" : i;
|
|
4368
4382
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4369
4383
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-x-2 text-xs font-medium", children: [
|
|
4370
|
-
|
|
4384
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4385
|
+
(o == null ? void 0 : o.title) ?? "Link",
|
|
4386
|
+
/* @__PURE__ */ jsx("span", { className: "pl-1 text-[9px] text-zinc-400", children: x })
|
|
4387
|
+
] }),
|
|
4371
4388
|
/* @__PURE__ */ jsx(
|
|
4372
4389
|
DataBindingSelector,
|
|
4373
4390
|
{
|
|
4374
4391
|
schema: o,
|
|
4375
|
-
onChange: (
|
|
4376
|
-
|
|
4392
|
+
onChange: (y) => {
|
|
4393
|
+
r({ ...n, href: y, ...f === "pageType" ? { type: "url" } : {} });
|
|
4377
4394
|
},
|
|
4378
4395
|
id: `root.${a}.href`,
|
|
4379
4396
|
formData: n
|
|
@@ -4381,7 +4398,7 @@ const DataBindingSelector = ({
|
|
|
4381
4398
|
)
|
|
4382
4399
|
] }),
|
|
4383
4400
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
4384
|
-
/* @__PURE__ */ jsx("select", { name: "type", value: i, onChange: (
|
|
4401
|
+
/* @__PURE__ */ jsx("select", { name: "type", value: i, onChange: (y) => r({ ...n, type: y.target.value }), children: map(
|
|
4385
4402
|
[
|
|
4386
4403
|
...isEmpty(p) ? [] : [{ const: "pageType", title: l("Goto Page") }],
|
|
4387
4404
|
{ const: "url", title: l("Open URL") },
|
|
@@ -4389,14 +4406,14 @@ const DataBindingSelector = ({
|
|
|
4389
4406
|
{ const: "telephone", title: l("Call Phone") },
|
|
4390
4407
|
{ const: "scroll", title: l("Scroll to element") }
|
|
4391
4408
|
],
|
|
4392
|
-
(
|
|
4409
|
+
(y) => /* @__PURE__ */ jsx("option", { value: y.const, children: y.title }, y.const)
|
|
4393
4410
|
) }),
|
|
4394
|
-
|
|
4411
|
+
f === "pageType" && !isEmpty(p) ? /* @__PURE__ */ jsx(
|
|
4395
4412
|
PageTypeField,
|
|
4396
4413
|
{
|
|
4397
4414
|
href: c,
|
|
4398
4415
|
pageTypes: p,
|
|
4399
|
-
onChange: (
|
|
4416
|
+
onChange: (y) => r({ ...n, href: y })
|
|
4400
4417
|
}
|
|
4401
4418
|
) : null,
|
|
4402
4419
|
/* @__PURE__ */ jsx(
|
|
@@ -4408,13 +4425,13 @@ const DataBindingSelector = ({
|
|
|
4408
4425
|
spellCheck: "false",
|
|
4409
4426
|
name: "href",
|
|
4410
4427
|
type: "text",
|
|
4411
|
-
className:
|
|
4428
|
+
className: f === "pageType" ? "!hidden" : "",
|
|
4412
4429
|
value: c,
|
|
4413
|
-
onChange: (
|
|
4430
|
+
onChange: (y) => r({ ...n, href: y.target.value }),
|
|
4414
4431
|
placeholder: l(i === "url" ? "Enter URL" : i === "scroll" ? "#ElementID" : "Enter details")
|
|
4415
4432
|
}
|
|
4416
4433
|
),
|
|
4417
|
-
|
|
4434
|
+
f === "url" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
4418
4435
|
/* @__PURE__ */ jsx(
|
|
4419
4436
|
"input",
|
|
4420
4437
|
{
|
|
@@ -4664,11 +4681,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4664
4681
|
if (x !== f)
|
|
4665
4682
|
u.chain().deleteSelection().insertContent(h).run();
|
|
4666
4683
|
else {
|
|
4667
|
-
const { state: b } = u,
|
|
4668
|
-
let
|
|
4669
|
-
|
|
4670
|
-
let
|
|
4671
|
-
j && j !== " " && !/[.,!?;:]/.test(j) && (
|
|
4684
|
+
const { state: b } = u, k = b.selection.from, B = b.doc.textBetween(Math.max(0, k - 1), k), j = b.doc.textBetween(k, Math.min(k + 1, b.doc.content.size));
|
|
4685
|
+
let E = "";
|
|
4686
|
+
k > 0 && B !== " " && !/[.,!?;:]/.test(B) && (E = " ");
|
|
4687
|
+
let C = "";
|
|
4688
|
+
j && j !== " " && !/[.,!?;:]/.test(j) && (C = " "), u.chain().insertContent(E + h + C).run();
|
|
4672
4689
|
}
|
|
4673
4690
|
};
|
|
4674
4691
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4952,98 +4969,116 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4952
4969
|
/* @__PURE__ */ jsx("option", { value: "", children: "Select" }),
|
|
4953
4970
|
u.map((g) => /* @__PURE__ */ jsx("option", { value: g.id, children: g.name }, g.id))
|
|
4954
4971
|
] }) });
|
|
4955
|
-
}, JSONFormFieldTemplate = ({
|
|
4956
|
-
id: o,
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
schema: p,
|
|
4965
|
-
formData: u,
|
|
4966
|
-
onChange: g
|
|
4967
|
-
}) => {
|
|
4968
|
-
const { selectedLang: m, fallbackLang: h, languages: x } = useLanguages(), f = useMemo(
|
|
4969
|
-
() => isEmpty(x) ? "" : isEmpty(m) ? h : m,
|
|
4970
|
-
[x, m, h]
|
|
4971
|
-
), y = useMemo(() => get(LANGUAGES, f, f), [f]), b = usePageExternalData(), C = useSelectedBlock(), B = useRegisteredChaiBlocks(), j = useMemo(
|
|
4972
|
-
() => get(B, [C == null ? void 0 : C._type, "i18nProps"], []),
|
|
4973
|
-
[B, C == null ? void 0 : C._type]
|
|
4974
|
-
), [_, w] = useState(null);
|
|
4975
|
-
if (c)
|
|
4972
|
+
}, JSONFormFieldTemplate = (o) => {
|
|
4973
|
+
const { id: n, classNames: r, label: a, children: l, errors: i, help: c, hidden: d, required: p, schema: u, formData: g, onChange: m } = o, { selectedLang: h, fallbackLang: x, languages: f } = useLanguages(), y = useMemo(
|
|
4974
|
+
() => isEmpty(f) ? "" : isEmpty(h) ? x : h,
|
|
4975
|
+
[f, h, x]
|
|
4976
|
+
), b = useMemo(() => get(LANGUAGES, y, y), [y]), k = usePageExternalData(), B = useSelectedBlock(), j = useRegisteredChaiBlocks(), E = useMemo(
|
|
4977
|
+
() => get(j, [B == null ? void 0 : B._type, "i18nProps"], []),
|
|
4978
|
+
[j, B == null ? void 0 : B._type]
|
|
4979
|
+
), [C, v] = useState(null);
|
|
4980
|
+
if (d)
|
|
4976
4981
|
return null;
|
|
4977
|
-
if (
|
|
4978
|
-
const
|
|
4979
|
-
if (
|
|
4980
|
-
const
|
|
4981
|
-
return /* @__PURE__ */ jsxs("div", { className: `${
|
|
4982
|
-
|
|
4982
|
+
if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: l });
|
|
4983
|
+
const I = E == null ? void 0 : E.includes(n.replace("root.", ""));
|
|
4984
|
+
if (u.type === "array") {
|
|
4985
|
+
const _ = C === n;
|
|
4986
|
+
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
4987
|
+
u.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
|
|
4983
4988
|
"label",
|
|
4984
4989
|
{
|
|
4985
|
-
htmlFor:
|
|
4986
|
-
onClick: () =>
|
|
4990
|
+
htmlFor: n,
|
|
4991
|
+
onClick: () => v(_ ? null : n),
|
|
4987
4992
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4988
4993
|
children: [
|
|
4989
|
-
|
|
4994
|
+
_ ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
4990
4995
|
/* @__PURE__ */ jsx(ListBulletIcon, { className: "h-3 w-3" }),
|
|
4991
|
-
/* @__PURE__ */ jsx("span", { className: "leading-tight", children:
|
|
4996
|
+
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: a }),
|
|
4992
4997
|
" ",
|
|
4993
|
-
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children:
|
|
4994
|
-
|
|
4998
|
+
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: g == null ? void 0 : g.length }) }),
|
|
4999
|
+
u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4995
5000
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
4996
5001
|
InfoCircledIcon,
|
|
4997
5002
|
{
|
|
4998
5003
|
className: "h-3 w-3 text-muted-foreground/70",
|
|
4999
|
-
onClick: (
|
|
5000
|
-
onMouseDown: (
|
|
5004
|
+
onClick: (L) => L.stopPropagation(),
|
|
5005
|
+
onMouseDown: (L) => L.stopPropagation()
|
|
5001
5006
|
}
|
|
5002
5007
|
) }),
|
|
5003
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children:
|
|
5008
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
|
|
5004
5009
|
] }) })
|
|
5005
5010
|
]
|
|
5006
5011
|
}
|
|
5007
5012
|
) }),
|
|
5008
|
-
(
|
|
5009
|
-
a,
|
|
5013
|
+
(g == null ? void 0 : g.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: l }) : /* @__PURE__ */ jsxs("div", { className: `${_ ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
5010
5014
|
l,
|
|
5011
|
-
i
|
|
5015
|
+
i,
|
|
5016
|
+
c
|
|
5012
5017
|
] })
|
|
5013
5018
|
] });
|
|
5014
5019
|
}
|
|
5015
|
-
|
|
5016
|
-
|
|
5020
|
+
const A = n.replace("root.", ""), w = E.includes(A) && !isEmpty(h) && isEmpty(g);
|
|
5021
|
+
return /* @__PURE__ */ jsxs("div", { className: r, children: [
|
|
5022
|
+
u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
5017
5023
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
5018
|
-
/* @__PURE__ */ jsxs("label", { htmlFor:
|
|
5019
|
-
|
|
5024
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: n, className: u.type === "object" ? "pb-2" : "", children: [
|
|
5025
|
+
a,
|
|
5020
5026
|
" ",
|
|
5021
|
-
|
|
5027
|
+
I && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5022
5028
|
" ",
|
|
5023
|
-
|
|
5029
|
+
b
|
|
5024
5030
|
] }),
|
|
5025
|
-
|
|
5031
|
+
p && u.type !== "object" ? " *" : null
|
|
5026
5032
|
] }),
|
|
5027
|
-
|
|
5033
|
+
u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
5028
5034
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(InfoCircledIcon, { className: "h-3 w-3 text-muted-foreground/70" }) }),
|
|
5029
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children:
|
|
5035
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
|
|
5030
5036
|
] }) })
|
|
5031
5037
|
] }),
|
|
5032
|
-
!
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5038
|
+
!u.enum && !u.oneOf && k && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
|
|
5039
|
+
w ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
5040
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
5041
|
+
"svg",
|
|
5042
|
+
{
|
|
5043
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5044
|
+
width: "24",
|
|
5045
|
+
height: "24",
|
|
5046
|
+
viewBox: "0 0 24 24",
|
|
5047
|
+
fill: "none",
|
|
5048
|
+
stroke: "currentColor",
|
|
5049
|
+
"stroke-width": "2",
|
|
5050
|
+
"stroke-linecap": "round",
|
|
5051
|
+
"stroke-linejoin": "round",
|
|
5052
|
+
className: "lucide lucide-triangle-alert-icon lucide-triangle-alert h-3 w-3 text-orange-400",
|
|
5053
|
+
children: [
|
|
5054
|
+
/* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
5055
|
+
/* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
|
|
5056
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
|
|
5057
|
+
]
|
|
5058
|
+
}
|
|
5059
|
+
) }),
|
|
5060
|
+
/* @__PURE__ */ jsxs(TooltipContent, { className: "max-w-xs", children: [
|
|
5061
|
+
"No translation provided. ",
|
|
5062
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
5063
|
+
"Using default language value."
|
|
5064
|
+
] })
|
|
5065
|
+
] }) : null,
|
|
5066
|
+
/* @__PURE__ */ jsx(
|
|
5067
|
+
DataBindingSelector,
|
|
5068
|
+
{
|
|
5069
|
+
schema: u,
|
|
5070
|
+
onChange: (_) => {
|
|
5071
|
+
m(_, g, n);
|
|
5072
|
+
},
|
|
5073
|
+
id: n,
|
|
5074
|
+
formData: g
|
|
5075
|
+
}
|
|
5076
|
+
)
|
|
5077
|
+
] })
|
|
5043
5078
|
] }),
|
|
5044
|
-
a,
|
|
5045
5079
|
l,
|
|
5046
|
-
i
|
|
5080
|
+
i,
|
|
5081
|
+
c
|
|
5047
5082
|
] });
|
|
5048
5083
|
}, RepeaterBindingWidget = ({ value: o, onChange: n }) => {
|
|
5049
5084
|
var i;
|
|
@@ -5140,43 +5175,43 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5140
5175
|
}), a;
|
|
5141
5176
|
};
|
|
5142
5177
|
function BlockSettings() {
|
|
5143
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData:
|
|
5144
|
-
|
|
5178
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData: C }, v, S) => {
|
|
5179
|
+
v && (c == null ? void 0 : c._id) === n._id && a([n._id], { [v]: get(C, v) }, S);
|
|
5145
5180
|
}, f = useCallback(
|
|
5146
|
-
debounce(({ formData:
|
|
5147
|
-
x({ formData:
|
|
5181
|
+
debounce(({ formData: C }, v, S) => {
|
|
5182
|
+
x({ formData: C }, v, S), d(C);
|
|
5148
5183
|
}, 1500),
|
|
5149
5184
|
[n == null ? void 0 : n._id, o]
|
|
5150
|
-
), y = ({ formData:
|
|
5151
|
-
|
|
5152
|
-
}, b = ({ formData:
|
|
5153
|
-
|
|
5154
|
-
}, { schema:
|
|
5155
|
-
const
|
|
5156
|
-
if (!
|
|
5185
|
+
), y = ({ formData: C }, v) => {
|
|
5186
|
+
v && (r([n._id], { [v]: get(C, v) }), f({ formData: C }, v, { [v]: get(c, v) }));
|
|
5187
|
+
}, b = ({ formData: C }, v) => {
|
|
5188
|
+
v && (r([g._id], { [v]: get(C, v) }), f({ formData: C }, v, { [v]: get(c, v) }));
|
|
5189
|
+
}, { schema: k, uiSchema: B } = useMemo(() => {
|
|
5190
|
+
const C = n == null ? void 0 : n._type;
|
|
5191
|
+
if (!C)
|
|
5157
5192
|
return { schema: {}, uiSchema: {} };
|
|
5158
5193
|
try {
|
|
5159
|
-
const { schema:
|
|
5160
|
-
if (
|
|
5161
|
-
const
|
|
5162
|
-
startsWith(
|
|
5194
|
+
const { schema: v, uiSchema: S } = getBlockFormSchemas(C);
|
|
5195
|
+
if (C === "Repeater") {
|
|
5196
|
+
const I = get(n, "repeaterItems", "");
|
|
5197
|
+
startsWith(I, `{{${COLLECTION_PREFIX}`) ? (set(S, "filter", { "ui:widget": "collectionSelect" }), set(S, "sort", { "ui:widget": "collectionSelect" })) : (set(S, "filter", { "ui:widget": "hidden" }), set(S, "sort", { "ui:widget": "hidden" }));
|
|
5163
5198
|
}
|
|
5164
|
-
return { schema:
|
|
5199
|
+
return { schema: v, uiSchema: S };
|
|
5165
5200
|
} catch {
|
|
5166
5201
|
return { schema: {}, uiSchema: {} };
|
|
5167
5202
|
}
|
|
5168
|
-
}, [n]), { wrapperSchema: j, wrapperUiSchema:
|
|
5203
|
+
}, [n]), { wrapperSchema: j, wrapperUiSchema: E } = useMemo(() => {
|
|
5169
5204
|
if (!g || !(g != null && g._type))
|
|
5170
5205
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5171
|
-
const
|
|
5172
|
-
return { wrapperSchema:
|
|
5206
|
+
const C = g == null ? void 0 : g._type, { schema: v = {}, uiSchema: S = {} } = getBlockFormSchemas(C);
|
|
5207
|
+
return { wrapperSchema: v, wrapperUiSchema: S };
|
|
5173
5208
|
}, [g]);
|
|
5174
5209
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5175
5210
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5176
5211
|
/* @__PURE__ */ jsxs(
|
|
5177
5212
|
"div",
|
|
5178
5213
|
{
|
|
5179
|
-
onClick: () => u((
|
|
5214
|
+
onClick: () => u((C) => !C),
|
|
5180
5215
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5181
5216
|
children: [
|
|
5182
5217
|
p ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 text-slate-400" }),
|
|
@@ -5198,17 +5233,17 @@ function BlockSettings() {
|
|
|
5198
5233
|
onChange: b,
|
|
5199
5234
|
formData: h,
|
|
5200
5235
|
schema: j,
|
|
5201
|
-
uiSchema:
|
|
5236
|
+
uiSchema: E
|
|
5202
5237
|
}
|
|
5203
5238
|
) })
|
|
5204
5239
|
] }),
|
|
5205
|
-
isEmpty(
|
|
5240
|
+
isEmpty(k) ? null : /* @__PURE__ */ jsx(
|
|
5206
5241
|
JSONForm,
|
|
5207
5242
|
{
|
|
5208
5243
|
blockId: n == null ? void 0 : n._id,
|
|
5209
5244
|
onChange: y,
|
|
5210
5245
|
formData: i,
|
|
5211
|
-
schema:
|
|
5246
|
+
schema: k,
|
|
5212
5247
|
uiSchema: B
|
|
5213
5248
|
}
|
|
5214
5249
|
)
|
|
@@ -5420,50 +5455,50 @@ const BlockStylingProps = () => {
|
|
|
5420
5455
|
},
|
|
5421
5456
|
a
|
|
5422
5457
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5423
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [
|
|
5458
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [k, B] = useState(!1), [j, E] = useState(!1);
|
|
5424
5459
|
useEffect(() => {
|
|
5425
|
-
const { value:
|
|
5426
|
-
if (
|
|
5427
|
-
l(
|
|
5460
|
+
const { value: A, unit: w } = getClassValueAndUnit(i);
|
|
5461
|
+
if (w === "") {
|
|
5462
|
+
l(A), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5428
5463
|
return;
|
|
5429
5464
|
}
|
|
5430
|
-
h(
|
|
5465
|
+
h(w), l(w === "class" || isEmpty(A) ? "" : A);
|
|
5431
5466
|
}, [i, p, u]);
|
|
5432
|
-
const
|
|
5433
|
-
(
|
|
5434
|
-
const
|
|
5435
|
-
if (get(
|
|
5467
|
+
const C = useThrottledCallback((A) => c(A), [c], THROTTLE_TIME), v = useThrottledCallback((A) => c(A, !1), [c], THROTTLE_TIME), S = useCallback(
|
|
5468
|
+
(A = !1) => {
|
|
5469
|
+
const w = getUserInputValues(`${a}`, u);
|
|
5470
|
+
if (get(w, "error", !1)) {
|
|
5436
5471
|
f(!0);
|
|
5437
5472
|
return;
|
|
5438
5473
|
}
|
|
5439
|
-
const
|
|
5440
|
-
if (
|
|
5441
|
-
|
|
5474
|
+
const _ = get(w, "unit") !== "" ? get(w, "unit") : m;
|
|
5475
|
+
if (_ === "auto" || _ === "none") {
|
|
5476
|
+
C(`${d}${_}`);
|
|
5442
5477
|
return;
|
|
5443
5478
|
}
|
|
5444
|
-
if (get(
|
|
5479
|
+
if (get(w, "value") === "")
|
|
5445
5480
|
return;
|
|
5446
|
-
const T = `${get(
|
|
5447
|
-
|
|
5481
|
+
const T = `${get(w, "value", "").startsWith("-") ? "-" : ""}${d}[${get(w, "value", "").replace("-", "")}${_ === "-" ? "" : _}]`;
|
|
5482
|
+
A ? v(T) : C(T);
|
|
5448
5483
|
},
|
|
5449
|
-
[
|
|
5450
|
-
),
|
|
5451
|
-
(
|
|
5452
|
-
const
|
|
5453
|
-
if (get(
|
|
5484
|
+
[C, v, a, m, d, u]
|
|
5485
|
+
), I = useCallback(
|
|
5486
|
+
(A) => {
|
|
5487
|
+
const w = getUserInputValues(`${a}`, u);
|
|
5488
|
+
if (get(w, "error", !1)) {
|
|
5454
5489
|
f(!0);
|
|
5455
5490
|
return;
|
|
5456
5491
|
}
|
|
5457
|
-
if (
|
|
5458
|
-
|
|
5492
|
+
if (A === "auto" || A === "none") {
|
|
5493
|
+
C(`${d}${A}`);
|
|
5459
5494
|
return;
|
|
5460
5495
|
}
|
|
5461
|
-
if (get(
|
|
5496
|
+
if (get(w, "value") === "")
|
|
5462
5497
|
return;
|
|
5463
|
-
const
|
|
5464
|
-
|
|
5498
|
+
const _ = get(w, "unit") !== "" ? get(w, "unit") : A, T = `${get(w, "value", "").startsWith("-") ? "-" : ""}${d}[${get(w, "value", "").replace("-", "")}${_ === "-" ? "" : _}]`;
|
|
5499
|
+
C(T);
|
|
5465
5500
|
},
|
|
5466
|
-
[
|
|
5501
|
+
[C, a, d, u]
|
|
5467
5502
|
);
|
|
5468
5503
|
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5469
5504
|
/* @__PURE__ */ jsx(
|
|
@@ -5478,37 +5513,37 @@ const BlockStylingProps = () => {
|
|
|
5478
5513
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
|
|
5479
5514
|
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
5480
5515
|
] })
|
|
5481
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${
|
|
5516
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${k ? "z-auto" : ""}`, children: [
|
|
5482
5517
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
5483
5518
|
["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
|
|
5484
5519
|
"input",
|
|
5485
5520
|
{
|
|
5486
5521
|
readOnly: m === "class",
|
|
5487
|
-
onKeyPress: (
|
|
5488
|
-
|
|
5522
|
+
onKeyPress: (A) => {
|
|
5523
|
+
A.key === "Enter" && S();
|
|
5489
5524
|
},
|
|
5490
|
-
onKeyDown: (
|
|
5491
|
-
if (
|
|
5525
|
+
onKeyDown: (A) => {
|
|
5526
|
+
if (A.keyCode !== 38 && A.keyCode !== 40)
|
|
5492
5527
|
return;
|
|
5493
|
-
|
|
5494
|
-
const
|
|
5495
|
-
let
|
|
5496
|
-
|
|
5497
|
-
const L = `${
|
|
5498
|
-
|
|
5528
|
+
A.preventDefault(), E(!0);
|
|
5529
|
+
const w = parseInt$1(A.target.value);
|
|
5530
|
+
let _ = isNaN$1(w) ? 0 : w;
|
|
5531
|
+
A.keyCode === 38 && (_ += 1), A.keyCode === 40 && (_ -= 1);
|
|
5532
|
+
const L = `${_}`, P = `${L.startsWith("-") ? "-" : ""}${d}[${L.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5533
|
+
v(P);
|
|
5499
5534
|
},
|
|
5500
|
-
onKeyUp: (
|
|
5501
|
-
j && (
|
|
5535
|
+
onKeyUp: (A) => {
|
|
5536
|
+
j && (A.preventDefault(), E(!1));
|
|
5502
5537
|
},
|
|
5503
|
-
onBlur: () =>
|
|
5504
|
-
onChange: (
|
|
5505
|
-
f(!1), l(
|
|
5538
|
+
onBlur: () => S(),
|
|
5539
|
+
onChange: (A) => {
|
|
5540
|
+
f(!1), l(A.target.value);
|
|
5506
5541
|
},
|
|
5507
|
-
onClick: (
|
|
5508
|
-
var
|
|
5509
|
-
(
|
|
5542
|
+
onClick: (A) => {
|
|
5543
|
+
var w;
|
|
5544
|
+
(w = A == null ? void 0 : A.target) == null || w.select(), r(!1);
|
|
5510
5545
|
},
|
|
5511
|
-
value:
|
|
5546
|
+
value: k ? y : a,
|
|
5512
5547
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5513
5548
|
" ",
|
|
5514
5549
|
x ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -5533,29 +5568,29 @@ const BlockStylingProps = () => {
|
|
|
5533
5568
|
{
|
|
5534
5569
|
units: u,
|
|
5535
5570
|
current: m,
|
|
5536
|
-
onSelect: (
|
|
5537
|
-
r(!1), h(
|
|
5571
|
+
onSelect: (A) => {
|
|
5572
|
+
r(!1), h(A), I(A);
|
|
5538
5573
|
}
|
|
5539
5574
|
}
|
|
5540
5575
|
) })
|
|
5541
5576
|
] })
|
|
5542
5577
|
] }),
|
|
5543
|
-
["none", "auto"].indexOf(m) !== -1 ||
|
|
5578
|
+
["none", "auto"].indexOf(m) !== -1 || k ? null : /* @__PURE__ */ jsx(
|
|
5544
5579
|
DragStyleButton,
|
|
5545
5580
|
{
|
|
5546
5581
|
onDragStart: () => B(!0),
|
|
5547
|
-
onDragEnd: (
|
|
5548
|
-
if (b(() => ""), B(!1), isEmpty(
|
|
5582
|
+
onDragEnd: (A) => {
|
|
5583
|
+
if (b(() => ""), B(!1), isEmpty(A))
|
|
5549
5584
|
return;
|
|
5550
|
-
const
|
|
5551
|
-
|
|
5585
|
+
const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5586
|
+
C(L);
|
|
5552
5587
|
},
|
|
5553
|
-
onDrag: (
|
|
5554
|
-
if (isEmpty(
|
|
5588
|
+
onDrag: (A) => {
|
|
5589
|
+
if (isEmpty(A))
|
|
5555
5590
|
return;
|
|
5556
|
-
b(
|
|
5557
|
-
const
|
|
5558
|
-
|
|
5591
|
+
b(A);
|
|
5592
|
+
const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5593
|
+
v(L);
|
|
5559
5594
|
},
|
|
5560
5595
|
currentValue: a,
|
|
5561
5596
|
unit: m,
|
|
@@ -6019,21 +6054,21 @@ const COLOR_PROP = {
|
|
|
6019
6054
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6020
6055
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6021
6056
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
|
|
6022
|
-
(
|
|
6023
|
-
const
|
|
6024
|
-
(p || u !== "") && (
|
|
6025
|
-
const
|
|
6026
|
-
h(f, [
|
|
6057
|
+
(v, S = !0) => {
|
|
6058
|
+
const I = { dark: p, mq: g, mod: u, cls: v, property: l, fullCls: "" };
|
|
6059
|
+
(p || u !== "") && (I.mq = "xs");
|
|
6060
|
+
const A = generateFullClsName(I);
|
|
6061
|
+
h(f, [A], S);
|
|
6027
6062
|
},
|
|
6028
6063
|
[f, p, g, u, l, h]
|
|
6029
|
-
),
|
|
6064
|
+
), k = useCallback(() => {
|
|
6030
6065
|
x(f, [y], !0);
|
|
6031
6066
|
}, [f, y, x]), B = useMemo(() => canChangeClass(m, g), [m, g]);
|
|
6032
6067
|
useEffect(() => {
|
|
6033
6068
|
i(B, m);
|
|
6034
6069
|
}, [B, i, m]);
|
|
6035
|
-
const [, , j] = useScreenSizeWidth(),
|
|
6036
|
-
(
|
|
6070
|
+
const [, , j] = useScreenSizeWidth(), E = useCallback(
|
|
6071
|
+
(v) => {
|
|
6037
6072
|
j({
|
|
6038
6073
|
xs: 400,
|
|
6039
6074
|
sm: 640,
|
|
@@ -6041,12 +6076,12 @@ const COLOR_PROP = {
|
|
|
6041
6076
|
lg: 1024,
|
|
6042
6077
|
xl: 1420,
|
|
6043
6078
|
"2xl": 1920
|
|
6044
|
-
}[
|
|
6079
|
+
}[v]);
|
|
6045
6080
|
},
|
|
6046
6081
|
[j]
|
|
6047
|
-
),
|
|
6048
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m &&
|
|
6049
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !
|
|
6082
|
+
), C = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
6083
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && C, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6084
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !C ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6050
6085
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6051
6086
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
6052
6087
|
r === "arbitrary" ? /* @__PURE__ */ jsx(
|
|
@@ -6065,7 +6100,7 @@ const COLOR_PROP = {
|
|
|
6065
6100
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6066
6101
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6067
6102
|
] }),
|
|
6068
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children:
|
|
6103
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: C ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => k(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6069
6104
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6070
6105
|
"button",
|
|
6071
6106
|
{
|
|
@@ -6085,7 +6120,7 @@ const COLOR_PROP = {
|
|
|
6085
6120
|
"button",
|
|
6086
6121
|
{
|
|
6087
6122
|
type: "button",
|
|
6088
|
-
onClick: () =>
|
|
6123
|
+
onClick: () => E(get(m, "mq")),
|
|
6089
6124
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6090
6125
|
children: [
|
|
6091
6126
|
"Switch to ",
|
|
@@ -6286,7 +6321,7 @@ const COLOR_PROP = {
|
|
|
6286
6321
|
tooltip: r = !0
|
|
6287
6322
|
}) => {
|
|
6288
6323
|
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
|
|
6289
|
-
u.includes(b) ? u.length > 2 && g(u.filter((
|
|
6324
|
+
u.includes(b) ? u.length > 2 && g(u.filter((k) => k !== b)) : g((k) => [...k, b]);
|
|
6290
6325
|
}, f = (b) => {
|
|
6291
6326
|
n || l(b), c(b);
|
|
6292
6327
|
}, y = getBreakpointValue(n ? i : a).toLowerCase();
|
|
@@ -6466,10 +6501,10 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6466
6501
|
};
|
|
6467
6502
|
function ManualClasses() {
|
|
6468
6503
|
var L;
|
|
6469
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")),
|
|
6504
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), k = b.split(" ").filter((T) => !isEmpty(T)), B = () => {
|
|
6470
6505
|
const T = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6471
6506
|
u(m, T, !0), f("");
|
|
6472
|
-
}, [j,
|
|
6507
|
+
}, [j, E] = useState([]), C = ({ value: T }) => {
|
|
6473
6508
|
const P = T.trim().toLowerCase(), R = P.match(/.+:/g);
|
|
6474
6509
|
let N = [];
|
|
6475
6510
|
if (R && R.length > 0) {
|
|
@@ -6480,10 +6515,10 @@ function ManualClasses() {
|
|
|
6480
6515
|
}));
|
|
6481
6516
|
} else
|
|
6482
6517
|
N = i.search(P);
|
|
6483
|
-
return
|
|
6484
|
-
},
|
|
6485
|
-
|
|
6486
|
-
},
|
|
6518
|
+
return E(map(N, "item"));
|
|
6519
|
+
}, v = () => {
|
|
6520
|
+
E([]);
|
|
6521
|
+
}, S = (T) => T.name, I = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), A = useMemo(
|
|
6487
6522
|
() => ({
|
|
6488
6523
|
ref: o,
|
|
6489
6524
|
autoComplete: "off",
|
|
@@ -6504,23 +6539,23 @@ function ManualClasses() {
|
|
|
6504
6539
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6505
6540
|
}),
|
|
6506
6541
|
[x, c, o]
|
|
6507
|
-
),
|
|
6542
|
+
), w = (T) => {
|
|
6508
6543
|
debugger;
|
|
6509
6544
|
const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6510
6545
|
g(m, [T]), u(m, P, !0), r(""), l(-1);
|
|
6511
|
-
},
|
|
6546
|
+
}, _ = () => {
|
|
6512
6547
|
if (navigator.clipboard === void 0) {
|
|
6513
6548
|
toast.error(c("Clipboard not supported"));
|
|
6514
6549
|
return;
|
|
6515
6550
|
}
|
|
6516
|
-
navigator.clipboard.writeText(
|
|
6551
|
+
navigator.clipboard.writeText(k.join(" ")), toast.success(c("Classes copied to clipboard"));
|
|
6517
6552
|
};
|
|
6518
6553
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
6519
6554
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
6520
6555
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
6521
6556
|
/* @__PURE__ */ jsx("span", { children: c("Classes") }),
|
|
6522
6557
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6523
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick:
|
|
6558
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: _, className: "cursor-pointer" }) }),
|
|
6524
6559
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
|
|
6525
6560
|
] })
|
|
6526
6561
|
] }),
|
|
@@ -6537,11 +6572,11 @@ function ManualClasses() {
|
|
|
6537
6572
|
Autosuggest,
|
|
6538
6573
|
{
|
|
6539
6574
|
suggestions: j,
|
|
6540
|
-
onSuggestionsFetchRequested:
|
|
6541
|
-
onSuggestionsClearRequested:
|
|
6542
|
-
getSuggestionValue:
|
|
6543
|
-
renderSuggestion:
|
|
6544
|
-
inputProps:
|
|
6575
|
+
onSuggestionsFetchRequested: C,
|
|
6576
|
+
onSuggestionsClearRequested: v,
|
|
6577
|
+
getSuggestionValue: S,
|
|
6578
|
+
renderSuggestion: I,
|
|
6579
|
+
inputProps: A,
|
|
6545
6580
|
containerProps: {
|
|
6546
6581
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
6547
6582
|
},
|
|
@@ -6564,7 +6599,7 @@ function ManualClasses() {
|
|
|
6564
6599
|
}
|
|
6565
6600
|
)
|
|
6566
6601
|
] }),
|
|
6567
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children:
|
|
6602
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: k.map(
|
|
6568
6603
|
(T, P) => a === P ? /* @__PURE__ */ jsx(
|
|
6569
6604
|
"input",
|
|
6570
6605
|
{
|
|
@@ -6572,10 +6607,10 @@ function ManualClasses() {
|
|
|
6572
6607
|
value: n,
|
|
6573
6608
|
onChange: (R) => r(R.target.value),
|
|
6574
6609
|
onBlur: () => {
|
|
6575
|
-
|
|
6610
|
+
w(T);
|
|
6576
6611
|
},
|
|
6577
6612
|
onKeyDown: (R) => {
|
|
6578
|
-
R.key === "Enter" &&
|
|
6613
|
+
R.key === "Enter" && w(T);
|
|
6579
6614
|
},
|
|
6580
6615
|
onFocus: (R) => {
|
|
6581
6616
|
setTimeout(() => {
|
|
@@ -6952,17 +6987,17 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6952
6987
|
draggable: x ? "true" : "false",
|
|
6953
6988
|
onDragStart: async (B) => {
|
|
6954
6989
|
const j = await c({ library: n, block: o });
|
|
6955
|
-
let
|
|
6956
|
-
if (y(first(j)) && (
|
|
6957
|
-
const
|
|
6958
|
-
if (B.dataTransfer.setData("text/plain", JSON.stringify(
|
|
6959
|
-
const
|
|
6960
|
-
|
|
6961
|
-
B.dataTransfer.setDragImage(
|
|
6990
|
+
let E = r;
|
|
6991
|
+
if (y(first(j)) && (E = null), !isEmpty(j)) {
|
|
6992
|
+
const C = { blocks: j, uiLibrary: !0, parent: E };
|
|
6993
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(C)), o.preview) {
|
|
6994
|
+
const v = new Image();
|
|
6995
|
+
v.src = o.preview, v.onload = () => {
|
|
6996
|
+
B.dataTransfer.setDragImage(v, 0, 0);
|
|
6962
6997
|
};
|
|
6963
6998
|
} else
|
|
6964
6999
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6965
|
-
f(
|
|
7000
|
+
f(C), setTimeout(() => {
|
|
6966
7001
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6967
7002
|
}, 200);
|
|
6968
7003
|
}
|
|
@@ -6982,13 +7017,10 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6982
7017
|
]
|
|
6983
7018
|
}
|
|
6984
7019
|
) }),
|
|
6985
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */
|
|
6986
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium", children: m }),
|
|
6987
|
-
h && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: h })
|
|
6988
|
-
] }) })
|
|
7020
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "max-w-xs", children: /* @__PURE__ */ jsx("p", { className: "font-medium", children: m }) }) })
|
|
6989
7021
|
] });
|
|
6990
7022
|
}, UILibrarySection = ({ parentId: o, position: n }) => {
|
|
6991
|
-
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((
|
|
7023
|
+
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((w) => w.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), x = useRef(null);
|
|
6992
7024
|
useEffect(() => {
|
|
6993
7025
|
c && c.length > 0 && (x.current = new Fuse(c, {
|
|
6994
7026
|
keys: ["name", "label", "description", "group"],
|
|
@@ -7000,27 +7032,27 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7000
7032
|
h([]);
|
|
7001
7033
|
return;
|
|
7002
7034
|
}
|
|
7003
|
-
const
|
|
7004
|
-
h(
|
|
7035
|
+
const w = x.current.search(u).map((_) => _.item);
|
|
7036
|
+
h(w);
|
|
7005
7037
|
}, [u]);
|
|
7006
|
-
const f = u.trim() && !isEmpty(m) ? m : c, y = groupBy(f, "group"), [b,
|
|
7038
|
+
const f = u.trim() && !isEmpty(m) ? m : c, y = groupBy(f, "group"), [b, k] = useState(null);
|
|
7007
7039
|
useEffect(() => {
|
|
7008
7040
|
if (isEmpty(keys(y))) {
|
|
7009
|
-
|
|
7041
|
+
k(null);
|
|
7010
7042
|
return;
|
|
7011
7043
|
}
|
|
7012
7044
|
if (!b || !y[b]) {
|
|
7013
|
-
|
|
7045
|
+
k(first(keys(y)));
|
|
7014
7046
|
return;
|
|
7015
7047
|
}
|
|
7016
7048
|
}, [y, b]);
|
|
7017
|
-
const B = get(y, b, []), j = useRef(null), { t:
|
|
7049
|
+
const B = get(y, b, []), j = useRef(null), { t: E } = useTranslation(), C = (w) => {
|
|
7018
7050
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7019
|
-
j.current &&
|
|
7051
|
+
j.current && k(w);
|
|
7020
7052
|
}, 400);
|
|
7021
|
-
},
|
|
7053
|
+
}, v = () => {
|
|
7022
7054
|
i != null && i.id && p(i.id);
|
|
7023
|
-
},
|
|
7055
|
+
}, S = () => {
|
|
7024
7056
|
g("");
|
|
7025
7057
|
};
|
|
7026
7058
|
if (d)
|
|
@@ -7028,23 +7060,23 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7028
7060
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7029
7061
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7030
7062
|
] });
|
|
7031
|
-
const
|
|
7063
|
+
const I = filter(B, (w, _) => _ % 2 === 0), A = filter(B, (w, _) => _ % 2 === 1);
|
|
7032
7064
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7033
7065
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7034
7066
|
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
7035
7067
|
/* @__PURE__ */ jsx(
|
|
7036
7068
|
Input$1,
|
|
7037
7069
|
{
|
|
7038
|
-
placeholder:
|
|
7070
|
+
placeholder: E("Search blocks..."),
|
|
7039
7071
|
value: u,
|
|
7040
|
-
onChange: (
|
|
7072
|
+
onChange: (w) => g(w.target.value),
|
|
7041
7073
|
className: "w-full pl-8 pr-8"
|
|
7042
7074
|
}
|
|
7043
7075
|
),
|
|
7044
7076
|
u && /* @__PURE__ */ jsx(
|
|
7045
7077
|
"button",
|
|
7046
7078
|
{
|
|
7047
|
-
onClick:
|
|
7079
|
+
onClick: S,
|
|
7048
7080
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7049
7081
|
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
7050
7082
|
}
|
|
@@ -7054,31 +7086,31 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7054
7086
|
/* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full w-60 min-w-60 max-w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7055
7087
|
/* @__PURE__ */ jsx(UILibrariesSelect, { library: i == null ? void 0 : i.id, setLibrary: a, uiLibraries: l }),
|
|
7056
7088
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7057
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7089
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
|
|
7058
7090
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7059
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children:
|
|
7060
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm", children:
|
|
7061
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
7091
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: E("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7092
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: E("Failed to load the UI library. Try again") }),
|
|
7093
|
+
/* @__PURE__ */ jsxs(Button, { onClick: v, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7062
7094
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
7063
|
-
|
|
7095
|
+
E("Retry")
|
|
7064
7096
|
] })
|
|
7065
|
-
] }) }) : map(y, (
|
|
7097
|
+
] }) }) : map(y, (w, _) => /* @__PURE__ */ jsxs(
|
|
7066
7098
|
"div",
|
|
7067
7099
|
{
|
|
7068
|
-
onMouseEnter: () =>
|
|
7100
|
+
onMouseEnter: () => C(_),
|
|
7069
7101
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7070
7102
|
role: "button",
|
|
7071
|
-
onClick: () =>
|
|
7103
|
+
onClick: () => k(_),
|
|
7072
7104
|
className: cn$2(
|
|
7073
7105
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7074
|
-
|
|
7106
|
+
_ === b ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
|
|
7075
7107
|
),
|
|
7076
7108
|
children: [
|
|
7077
|
-
/* @__PURE__ */ jsx("span", { children: capitalize(_
|
|
7109
|
+
/* @__PURE__ */ jsx("span", { children: capitalize(E(_.toLowerCase())) }),
|
|
7078
7110
|
/* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7079
7111
|
]
|
|
7080
7112
|
},
|
|
7081
|
-
|
|
7113
|
+
_
|
|
7082
7114
|
)) })
|
|
7083
7115
|
] })
|
|
7084
7116
|
] }),
|
|
@@ -7088,26 +7120,26 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7088
7120
|
onMouseEnter: () => j.current ? clearTimeout(j.current) : null,
|
|
7089
7121
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7090
7122
|
children: [
|
|
7091
|
-
isEmpty(B) && !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:
|
|
7092
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7123
|
+
isEmpty(B) && !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: E("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7124
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: I.map((w, _) => /* @__PURE__ */ jsx(
|
|
7093
7125
|
BlockCard,
|
|
7094
7126
|
{
|
|
7095
7127
|
parentId: o,
|
|
7096
7128
|
position: n,
|
|
7097
|
-
block:
|
|
7129
|
+
block: w,
|
|
7098
7130
|
library: i
|
|
7099
7131
|
},
|
|
7100
|
-
`block-${
|
|
7132
|
+
`block-${_}`
|
|
7101
7133
|
)) }),
|
|
7102
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7134
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: A.map((w, _) => /* @__PURE__ */ jsx(
|
|
7103
7135
|
BlockCard,
|
|
7104
7136
|
{
|
|
7105
7137
|
parentId: o,
|
|
7106
7138
|
position: n,
|
|
7107
|
-
block:
|
|
7139
|
+
block: w,
|
|
7108
7140
|
library: i
|
|
7109
7141
|
},
|
|
7110
|
-
`block-second-${
|
|
7142
|
+
`block-second-${_}`
|
|
7111
7143
|
)) })
|
|
7112
7144
|
] }),
|
|
7113
7145
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -7144,7 +7176,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7144
7176
|
}), g(!0);
|
|
7145
7177
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7146
7178
|
const h = Object.entries(a).map(([f, y]) => {
|
|
7147
|
-
const b = y,
|
|
7179
|
+
const b = y, k = b.type || "partial", B = formatReadableName(k);
|
|
7148
7180
|
return {
|
|
7149
7181
|
type: "PartialBlock",
|
|
7150
7182
|
// Set the type to PartialBlock
|
|
@@ -7206,44 +7238,44 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7206
7238
|
}, ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (o, n) => {
|
|
7207
7239
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7208
7240
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7209
|
-
var
|
|
7210
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (
|
|
7241
|
+
var A;
|
|
7242
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (A = find(c, (w) => w._id === r)) == null ? void 0 : A._type, [h, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
|
|
7211
7243
|
useEffect(() => {
|
|
7212
|
-
const
|
|
7213
|
-
var
|
|
7214
|
-
(
|
|
7244
|
+
const w = setTimeout(() => {
|
|
7245
|
+
var _;
|
|
7246
|
+
(_ = u.current) == null || _.focus();
|
|
7215
7247
|
}, 0);
|
|
7216
|
-
return () => clearTimeout(
|
|
7248
|
+
return () => clearTimeout(w);
|
|
7217
7249
|
}, [g]), useEffect(() => {
|
|
7218
7250
|
d && (x("all"), y(null));
|
|
7219
|
-
}, [d]), useEffect(() => (b.current = debounce((
|
|
7220
|
-
x(
|
|
7251
|
+
}, [d]), useEffect(() => (b.current = debounce((w) => {
|
|
7252
|
+
x(w);
|
|
7221
7253
|
}, 500), () => {
|
|
7222
7254
|
b.current && b.current.cancel();
|
|
7223
7255
|
}), []);
|
|
7224
|
-
const
|
|
7225
|
-
y(
|
|
7256
|
+
const k = useCallback((w) => {
|
|
7257
|
+
y(w), b.current && b.current(w);
|
|
7226
7258
|
}, []), B = useCallback(() => {
|
|
7227
7259
|
y(null), b.current && b.current.cancel();
|
|
7228
|
-
}, []), j = useCallback((
|
|
7229
|
-
b.current && b.current.cancel(), x(
|
|
7230
|
-
}, []),
|
|
7260
|
+
}, []), j = useCallback((w) => {
|
|
7261
|
+
b.current && b.current.cancel(), x(w), y(null);
|
|
7262
|
+
}, []), E = useMemo(
|
|
7231
7263
|
() => d ? values(n).filter(
|
|
7232
|
-
(
|
|
7233
|
-
var
|
|
7234
|
-
return (((
|
|
7264
|
+
(w) => {
|
|
7265
|
+
var _, L;
|
|
7266
|
+
return (((_ = w.label) == null ? void 0 : _.toLowerCase()) + " " + ((L = w.type) == null ? void 0 : L.toLowerCase())).includes(d.toLowerCase());
|
|
7235
7267
|
}
|
|
7236
7268
|
) : n,
|
|
7237
7269
|
[n, d]
|
|
7238
|
-
),
|
|
7270
|
+
), C = useMemo(
|
|
7239
7271
|
() => d ? o.filter(
|
|
7240
|
-
(
|
|
7241
|
-
) : o.filter((
|
|
7242
|
-
[n,
|
|
7243
|
-
),
|
|
7244
|
-
() => sortBy(
|
|
7245
|
-
[
|
|
7246
|
-
),
|
|
7272
|
+
(w) => reject(filter(values(E), { group: w }), { hidden: !0 }).length > 0
|
|
7273
|
+
) : o.filter((w) => reject(filter(values(n), { group: w }), { hidden: !0 }).length > 0),
|
|
7274
|
+
[n, E, o, d]
|
|
7275
|
+
), v = useMemo(
|
|
7276
|
+
() => sortBy(C, (w) => CORE_GROUPS.indexOf(w) === -1 ? 99 : CORE_GROUPS.indexOf(w)),
|
|
7277
|
+
[C]
|
|
7278
|
+
), S = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), I = useMemo(() => h === "all" ? v : [h], [v, h]);
|
|
7247
7279
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7248
7280
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7249
7281
|
Input$1,
|
|
@@ -7253,55 +7285,55 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7253
7285
|
placeholder: i("Search blocks..."),
|
|
7254
7286
|
value: d,
|
|
7255
7287
|
className: "-ml-2",
|
|
7256
|
-
onChange: (
|
|
7288
|
+
onChange: (w) => p(w.target.value)
|
|
7257
7289
|
}
|
|
7258
7290
|
) }),
|
|
7259
7291
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
|
|
7260
|
-
|
|
7292
|
+
v.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 p-2", children: [
|
|
7261
7293
|
/* @__PURE__ */ jsx(
|
|
7262
7294
|
"button",
|
|
7263
7295
|
{
|
|
7264
7296
|
onClick: () => j("all"),
|
|
7265
|
-
onMouseEnter: () =>
|
|
7297
|
+
onMouseEnter: () => k("all"),
|
|
7266
7298
|
onMouseLeave: B,
|
|
7267
7299
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7268
7300
|
children: i("All")
|
|
7269
7301
|
},
|
|
7270
7302
|
"sidebar-all"
|
|
7271
7303
|
),
|
|
7272
|
-
|
|
7304
|
+
v.map((w) => /* @__PURE__ */ jsx(
|
|
7273
7305
|
"button",
|
|
7274
7306
|
{
|
|
7275
|
-
onClick: () => j(
|
|
7276
|
-
onMouseEnter: () =>
|
|
7307
|
+
onClick: () => j(w),
|
|
7308
|
+
onMouseEnter: () => k(w),
|
|
7277
7309
|
onMouseLeave: B,
|
|
7278
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h ===
|
|
7279
|
-
children: capitalize(i(
|
|
7310
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === w || f === w ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7311
|
+
children: capitalize(i(w.toLowerCase()))
|
|
7280
7312
|
},
|
|
7281
|
-
`sidebar-${
|
|
7313
|
+
`sidebar-${w}`
|
|
7282
7314
|
))
|
|
7283
7315
|
] }) }) }),
|
|
7284
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children:
|
|
7316
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: C.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
7285
7317
|
i("No blocks found matching"),
|
|
7286
7318
|
' "',
|
|
7287
7319
|
d,
|
|
7288
7320
|
'"'
|
|
7289
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children:
|
|
7290
|
-
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(
|
|
7321
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: I.map((w) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7322
|
+
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(w.toLowerCase())) }),
|
|
7291
7323
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7292
|
-
h === "all" ? filter(values(
|
|
7324
|
+
h === "all" ? filter(values(S), { group: w }) : values(S),
|
|
7293
7325
|
{ hidden: !0 }
|
|
7294
|
-
).map((
|
|
7326
|
+
).map((_) => /* @__PURE__ */ jsx(
|
|
7295
7327
|
CoreBlock,
|
|
7296
7328
|
{
|
|
7297
7329
|
parentId: r,
|
|
7298
7330
|
position: a,
|
|
7299
|
-
block:
|
|
7300
|
-
disabled: !canAcceptChildBlock(m,
|
|
7331
|
+
block: _,
|
|
7332
|
+
disabled: !canAcceptChildBlock(m, _.type) || !canBeNestedInside(m, _.type)
|
|
7301
7333
|
},
|
|
7302
|
-
|
|
7334
|
+
_.type
|
|
7303
7335
|
)) })
|
|
7304
|
-
] },
|
|
7336
|
+
] }, w)) }) }) })
|
|
7305
7337
|
] })
|
|
7306
7338
|
] });
|
|
7307
7339
|
}, addBlockTabAtom = atomWithStorage("__add_block_tab", "library"), AddBlocksPanel = ({
|
|
@@ -7327,8 +7359,8 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7327
7359
|
/* @__PURE__ */ jsxs(
|
|
7328
7360
|
Tabs,
|
|
7329
7361
|
{
|
|
7330
|
-
onValueChange: (
|
|
7331
|
-
d(""), c(
|
|
7362
|
+
onValueChange: (k) => {
|
|
7363
|
+
d(""), c(k);
|
|
7332
7364
|
},
|
|
7333
7365
|
value: i,
|
|
7334
7366
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
@@ -7338,13 +7370,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7338
7370
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7339
7371
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7340
7372
|
f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7341
|
-
map(x, (
|
|
7373
|
+
map(x, (k) => /* @__PURE__ */ jsx(TabsTrigger, { value: k.id, children: React__default.createElement(k.tab) }, `tab-add-block-${k.id}`))
|
|
7342
7374
|
] }),
|
|
7343
7375
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7344
7376
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
7345
7377
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7346
7378
|
f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
7347
|
-
map(x, (
|
|
7379
|
+
map(x, (k) => /* @__PURE__ */ jsx(TabsContent, { value: k.id, children: React__default.createElement(k.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${k.id}`))
|
|
7348
7380
|
]
|
|
7349
7381
|
}
|
|
7350
7382
|
)
|
|
@@ -7654,19 +7686,19 @@ const Input = ({ node: o }) => {
|
|
|
7654
7686
|
var R;
|
|
7655
7687
|
const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
7656
7688
|
let d = null;
|
|
7657
|
-
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: y, isEditing: b, handleClick:
|
|
7689
|
+
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: y, isEditing: b, handleClick: k } = o, B = get(h, "_show", !0), j = (N) => {
|
|
7658
7690
|
N.stopPropagation(), B && o.toggle();
|
|
7659
|
-
},
|
|
7691
|
+
}, E = (N) => {
|
|
7660
7692
|
N.isInternal && (d = N.isOpen, N.isOpen && N.close());
|
|
7661
|
-
},
|
|
7693
|
+
}, C = (N) => {
|
|
7662
7694
|
N.isInternal && d !== null && (d ? N.open() : N.close(), d = null);
|
|
7663
|
-
}, [
|
|
7695
|
+
}, [v, S] = useAtom$1(currentAddSelection), I = () => {
|
|
7664
7696
|
var N;
|
|
7665
|
-
|
|
7666
|
-
},
|
|
7667
|
-
|
|
7668
|
-
},
|
|
7669
|
-
|
|
7697
|
+
A(), o.parent.isSelected || S((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
|
|
7698
|
+
}, A = () => {
|
|
7699
|
+
S(null);
|
|
7700
|
+
}, w = (N) => {
|
|
7701
|
+
A(), N.stopPropagation(), !o.isOpen && B && o.toggle(), k(N);
|
|
7670
7702
|
};
|
|
7671
7703
|
useEffect(() => {
|
|
7672
7704
|
const N = setTimeout(() => {
|
|
@@ -7674,13 +7706,13 @@ const Input = ({ node: o }) => {
|
|
|
7674
7706
|
}, 500);
|
|
7675
7707
|
return () => clearTimeout(N);
|
|
7676
7708
|
}, [f, o, y]);
|
|
7677
|
-
const
|
|
7709
|
+
const _ = (N, D) => {
|
|
7678
7710
|
const F = i.contentDocument || i.contentWindow.document, O = F.querySelector(`[data-block-id=${N}]`);
|
|
7679
7711
|
O && O.setAttribute("data-drop", D);
|
|
7680
7712
|
const M = O.getBoundingClientRect(), H = i.getBoundingClientRect();
|
|
7681
7713
|
M.top >= H.top && M.left >= H.left && M.bottom <= H.bottom && M.right <= H.right || (F.documentElement.scrollTop = O.offsetTop - H.top);
|
|
7682
7714
|
}, L = (N) => {
|
|
7683
|
-
|
|
7715
|
+
A();
|
|
7684
7716
|
const D = get(o, "parent.id");
|
|
7685
7717
|
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: N }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: N });
|
|
7686
7718
|
};
|
|
@@ -7708,20 +7740,20 @@ const Input = ({ node: o }) => {
|
|
|
7708
7740
|
{
|
|
7709
7741
|
onMouseEnter: () => u(m),
|
|
7710
7742
|
onMouseLeave: () => g(),
|
|
7711
|
-
onClick:
|
|
7743
|
+
onClick: w,
|
|
7712
7744
|
style: n,
|
|
7713
7745
|
"data-node-id": m,
|
|
7714
7746
|
ref: r,
|
|
7715
|
-
onDragStart: () =>
|
|
7716
|
-
onDragEnd: () =>
|
|
7747
|
+
onDragStart: () => E(o),
|
|
7748
|
+
onDragEnd: () => C(o),
|
|
7717
7749
|
onDragOver: (N) => {
|
|
7718
|
-
N.preventDefault(),
|
|
7750
|
+
N.preventDefault(), _(m, "yes");
|
|
7719
7751
|
},
|
|
7720
7752
|
onDragLeave: (N) => {
|
|
7721
|
-
N.preventDefault(),
|
|
7753
|
+
N.preventDefault(), _(m, "no");
|
|
7722
7754
|
},
|
|
7723
7755
|
onDrop: (N) => {
|
|
7724
|
-
N.preventDefault(),
|
|
7756
|
+
N.preventDefault(), _(m, "no");
|
|
7725
7757
|
},
|
|
7726
7758
|
children: [
|
|
7727
7759
|
c(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
@@ -7730,8 +7762,8 @@ const Input = ({ node: o }) => {
|
|
|
7730
7762
|
onClick: (N) => {
|
|
7731
7763
|
N.stopPropagation(), L(o.childIndex);
|
|
7732
7764
|
},
|
|
7733
|
-
onMouseEnter:
|
|
7734
|
-
onMouseLeave:
|
|
7765
|
+
onMouseEnter: I,
|
|
7766
|
+
onMouseLeave: A,
|
|
7735
7767
|
className: "absolute -top-0.5 h-0.5 w-[90%] rounded bg-primary/80 opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7736
7768
|
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-primary/80 p-1 outline outline-2 outline-white hover:bg-primary/80", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-2 w-2 stroke-[2] text-white" }) })
|
|
7737
7769
|
}
|
|
@@ -7743,7 +7775,7 @@ const Input = ({ node: o }) => {
|
|
|
7743
7775
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
7744
7776
|
x ? "bg-primary/20" : "hover:bg-primary/10",
|
|
7745
7777
|
f && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
7746
|
-
(o == null ? void 0 : o.id) ===
|
|
7778
|
+
(o == null ? void 0 : o.id) === v ? "bg-primary/10" : "",
|
|
7747
7779
|
y && "opacity-20",
|
|
7748
7780
|
B ? "" : "line-through opacity-50",
|
|
7749
7781
|
T && x && "bg-primary/20 text-primary"
|
|
@@ -8228,23 +8260,23 @@ const Input = ({ node: o }) => {
|
|
|
8228
8260
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8229
8261
|
const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8230
8262
|
if (d) {
|
|
8231
|
-
const
|
|
8232
|
-
DEFAULT_THEME_PRESET.forEach((
|
|
8233
|
-
const
|
|
8234
|
-
|
|
8263
|
+
const C = d.map((v) => Object.keys(v)[0]);
|
|
8264
|
+
DEFAULT_THEME_PRESET.forEach((v) => {
|
|
8265
|
+
const S = Object.keys(v)[0];
|
|
8266
|
+
C.includes(S) || d.push(v);
|
|
8235
8267
|
});
|
|
8236
8268
|
}
|
|
8237
8269
|
const [g, m] = useTheme(), h = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
|
|
8238
|
-
(
|
|
8239
|
-
const
|
|
8240
|
-
setPreviousTheme(
|
|
8270
|
+
(C) => {
|
|
8271
|
+
const v = { ...g };
|
|
8272
|
+
setPreviousTheme(v), m(C), toast.success("Theme updated", {
|
|
8241
8273
|
action: {
|
|
8242
8274
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8243
8275
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
8244
8276
|
" Undo"
|
|
8245
8277
|
] }),
|
|
8246
8278
|
onClick: () => {
|
|
8247
|
-
m(
|
|
8279
|
+
m(v), clearPreviousTheme(), toast.dismiss();
|
|
8248
8280
|
}
|
|
8249
8281
|
},
|
|
8250
8282
|
closeButton: !0,
|
|
@@ -8253,61 +8285,61 @@ const Input = ({ node: o }) => {
|
|
|
8253
8285
|
},
|
|
8254
8286
|
[g, m]
|
|
8255
8287
|
), y = () => {
|
|
8256
|
-
const
|
|
8257
|
-
if (
|
|
8258
|
-
const
|
|
8259
|
-
|
|
8288
|
+
const C = d.find((v) => Object.keys(v)[0] === a);
|
|
8289
|
+
if (C) {
|
|
8290
|
+
const v = Object.values(C)[0];
|
|
8291
|
+
v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (f(v), l("")) : console.error("Invalid preset structure:", v);
|
|
8260
8292
|
} else
|
|
8261
8293
|
console.error("Preset not found:", a);
|
|
8262
|
-
}, b = (
|
|
8263
|
-
f(
|
|
8264
|
-
},
|
|
8265
|
-
(
|
|
8294
|
+
}, b = (C) => {
|
|
8295
|
+
f(C), l("");
|
|
8296
|
+
}, k = useDebouncedCallback(
|
|
8297
|
+
(C, v) => {
|
|
8266
8298
|
m(() => ({
|
|
8267
8299
|
...g,
|
|
8268
8300
|
fontFamily: {
|
|
8269
8301
|
...g.fontFamily,
|
|
8270
|
-
[
|
|
8302
|
+
[C.replace(/font-/g, "")]: v
|
|
8271
8303
|
}
|
|
8272
8304
|
}));
|
|
8273
8305
|
},
|
|
8274
8306
|
[g],
|
|
8275
8307
|
200
|
|
8276
8308
|
), B = React.useCallback(
|
|
8277
|
-
(
|
|
8309
|
+
(C) => {
|
|
8278
8310
|
m(() => ({
|
|
8279
8311
|
...g,
|
|
8280
|
-
borderRadius: `${
|
|
8312
|
+
borderRadius: `${C}px`
|
|
8281
8313
|
}));
|
|
8282
8314
|
},
|
|
8283
8315
|
[g]
|
|
8284
8316
|
), j = useDebouncedCallback(
|
|
8285
|
-
(
|
|
8317
|
+
(C, v) => {
|
|
8286
8318
|
m(() => {
|
|
8287
|
-
const
|
|
8288
|
-
return n ? set(
|
|
8319
|
+
const S = get(g, `colors.${C}`);
|
|
8320
|
+
return n ? set(S, 1, v) : set(S, 0, v), {
|
|
8289
8321
|
...g,
|
|
8290
8322
|
colors: {
|
|
8291
8323
|
...g.colors,
|
|
8292
|
-
[
|
|
8324
|
+
[C]: S
|
|
8293
8325
|
}
|
|
8294
8326
|
};
|
|
8295
8327
|
});
|
|
8296
8328
|
},
|
|
8297
8329
|
[g],
|
|
8298
8330
|
200
|
|
8299
|
-
),
|
|
8300
|
-
const
|
|
8301
|
-
return
|
|
8331
|
+
), E = (C) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(C.items).map(([v]) => {
|
|
8332
|
+
const S = get(g, `colors.${v}.${n ? 1 : 0}`);
|
|
8333
|
+
return S ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8302
8334
|
/* @__PURE__ */ jsx(
|
|
8303
8335
|
ColorPickerInput,
|
|
8304
8336
|
{
|
|
8305
|
-
value:
|
|
8306
|
-
onChange: (
|
|
8337
|
+
value: S,
|
|
8338
|
+
onChange: (I) => j(v, I)
|
|
8307
8339
|
}
|
|
8308
8340
|
),
|
|
8309
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
8310
|
-
] },
|
|
8341
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
|
|
8342
|
+
] }, v) : null;
|
|
8311
8343
|
}) });
|
|
8312
8344
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8313
8345
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -8322,9 +8354,9 @@ const Input = ({ node: o }) => {
|
|
|
8322
8354
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8323
8355
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8324
8356
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8325
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
8326
|
-
const
|
|
8327
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
8357
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((C) => {
|
|
8358
|
+
const v = Object.keys(C)[0], S = v.replaceAll("_", " ");
|
|
8359
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(S) }, v);
|
|
8328
8360
|
}) })
|
|
8329
8361
|
] }) }),
|
|
8330
8362
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: x("Apply") }) })
|
|
@@ -8336,14 +8368,14 @@ const Input = ({ node: o }) => {
|
|
|
8336
8368
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8337
8369
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8338
8370
|
] }),
|
|
8339
|
-
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([
|
|
8371
|
+
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([C, v]) => /* @__PURE__ */ jsx(
|
|
8340
8372
|
FontSelector,
|
|
8341
8373
|
{
|
|
8342
|
-
label:
|
|
8343
|
-
value: g.fontFamily[
|
|
8344
|
-
onChange: (
|
|
8374
|
+
label: C,
|
|
8375
|
+
value: g.fontFamily[C.replace(/font-/g, "")] || v[Object.keys(v)[0]],
|
|
8376
|
+
onChange: (S) => k(C, S)
|
|
8345
8377
|
},
|
|
8346
|
-
|
|
8378
|
+
C
|
|
8347
8379
|
)) }),
|
|
8348
8380
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8349
8381
|
(h == null ? void 0 : h.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -8369,7 +8401,7 @@ const Input = ({ node: o }) => {
|
|
|
8369
8401
|
Switch,
|
|
8370
8402
|
{
|
|
8371
8403
|
checked: n,
|
|
8372
|
-
onCheckedChange: (
|
|
8404
|
+
onCheckedChange: (C) => r(C),
|
|
8373
8405
|
"aria-label": "Toggle dark mode",
|
|
8374
8406
|
className: "mx-1"
|
|
8375
8407
|
}
|
|
@@ -8377,7 +8409,7 @@ const Input = ({ node: o }) => {
|
|
|
8377
8409
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
8378
8410
|
] }) })
|
|
8379
8411
|
] }),
|
|
8380
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((
|
|
8412
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((C) => E(C)) })
|
|
8381
8413
|
] }),
|
|
8382
8414
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8383
8415
|
LazyCssImportModal,
|
|
@@ -8395,9 +8427,15 @@ const Input = ({ node: o }) => {
|
|
|
8395
8427
|
] }),
|
|
8396
8428
|
p && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(p) })
|
|
8397
8429
|
] }) : /* @__PURE__ */ jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsx("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto text-center", o), children: /* @__PURE__ */ jsx("div", { className: "mt-10 h-full items-center justify-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: "You don't have permission to edit the theme. Please contact your administrator to get access." }) }) }) });
|
|
8398
|
-
}), Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "
|
|
8430
|
+
}), Core = "Core", Import = "Import", Breakpoints = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Style", SVG_code = "Enter SVG code here", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", URL = "URL", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", Classes = "Classes", All = "All", Undo = "Undo", Redo = "Redo", Duplicate = "Duplicate", Close = "Close", Selected = "Selected", Select = "Select", Attributes = "Attributes", apply = "apply", presets = "presets", Orientation = "Orientation", Color = "Color", Upload = "Upload", Apply = "Apply", Back = "Back", Insert = "Insert", Rename = "Rename", Partials = "Partials", Happy = "Happy", Sad = "Sad", Retry = "Retry", canvas_empty = "Canvas is empty", Presets = "Presets", No = "No", Saving = "Saving", theme_config = { heading_font: "Heading Font", body_font: "Body Font", rounded_corner: "Rounded Corners", primary: "Primary", secondary: "Secondary", background: "Background", text_color: "Text Color", background_dark_mode: "Background (Dark Mode)", text_color_dark_mode: "Text Color (Dark Mode)" }, web_blocks = { box: "box", tag: "Tag", div: "div", level: "Level", header: "header", footer: "footer", section: "section", article: "article", aside: "aside", main: "main", nav: "navigation", figure: "figure", details: "details", summary: "summary", dialog: "dialog", strike: "strike", caption: "caption", legend: "legend", figcaption: "figure caption", mark: "mark", background_image: "Background Image", label: "Label", default: "default", icon_size: "Icon Size", icon_position: "Icon Position", start: "Start", end: "End", button: "Button", custom_html: "Custom HTML", html_code: "HTML Code", default_snippet: "The HTML snippet goes here...", placeholder: "Enter custom HTML code here", custom_script: "Custom Script", dark_mode: "Dark Mode", divider: "Divider", empty_box: "Empty Box", heading: "Heading", image: "Image", alt: "Alt", width: "Width", height: "Height", video: "Video", span: "Span", content: "Content", icon: "Icon", richtext: "Rich Text", list: "List", list_type: "List Type", listitem: "List Item", link: "Link", list_item: "List Item", none: "None", disc: "Disc", number: "Number", paragraph: "Paragraph", lightbox_link: "Lightbox Link", href: "Link", type: "Type", iframe: "iframe", inline: "inline", ajax: "ajax", autoplay: "Video autoplay", max_width: "Max Width", backdrop_color: "Background Color", gallery_name: "Gallery Name", slot: "Slot", empty_slot: "Empty Slot", text: "Text", video_url: "Video URL", controls: "Show Controls", loop: "Loop", muted: "Muted", checkbox: "Checkbox", required: "Required", checked: "Checked", submit_button: "Submit Button", form: "Form", submit_url: "Submit URL", error_message: "Error Message", success_message: "Success Message", input: "Input", value: "Value", show_label: "Show Label", field_name: "Field Name", radio: "Radio", multiple: "Multiple", options: "Options", select: "Select", multiple_choice: "Multiple Choice", textarea: "Textarea", rows: "Rows" }, lngEn = {
|
|
8399
8431
|
"Add block": "Add Block",
|
|
8432
|
+
"Add Block": "Add Block",
|
|
8400
8433
|
"Add blocks": "Add blocks",
|
|
8434
|
+
"Add inside": "Add inside",
|
|
8435
|
+
"Add before": "Add before",
|
|
8436
|
+
"Add after": "Add after",
|
|
8437
|
+
"Add block inside": "Add block inside",
|
|
8438
|
+
"Add field": "Add field",
|
|
8401
8439
|
"Enter or paste TailwindCSS HTML snippet": "Enter or paste TailwindCSS HTML snippet",
|
|
8402
8440
|
"Click to add block to page": "Click to add block to page",
|
|
8403
8441
|
Core,
|
|
@@ -8438,6 +8476,9 @@ const Input = ({ node: o }) => {
|
|
|
8438
8476
|
Preview,
|
|
8439
8477
|
Settings,
|
|
8440
8478
|
Styling,
|
|
8479
|
+
SVG_code,
|
|
8480
|
+
"Paste SVG_code": "Paste SVG code to use as an icon",
|
|
8481
|
+
"Enter Key": "Enter Key",
|
|
8441
8482
|
"Data Provider": "Data Provider",
|
|
8442
8483
|
"Remove Provider Confirmation": "Are you sure you want to remove <span class='text-blue-500'>{name}</span> provider?",
|
|
8443
8484
|
"Your data provider will be removed from this page and all added data binding will be not visible on blocks.": "Your data provider will be removed from this page and all added data binding will be not visible on blocks.",
|
|
@@ -8489,6 +8530,8 @@ const Input = ({ node: o }) => {
|
|
|
8489
8530
|
Value,
|
|
8490
8531
|
"Background Image": "Background Image",
|
|
8491
8532
|
"Enter image URL": "Enter image URL",
|
|
8533
|
+
"Enter URL": "Enter URL",
|
|
8534
|
+
URL,
|
|
8492
8535
|
"Replace image": "Replace image",
|
|
8493
8536
|
"Choose image": "Choose image",
|
|
8494
8537
|
Images,
|
|
@@ -8523,14 +8566,128 @@ const Input = ({ node: o }) => {
|
|
|
8523
8566
|
"Saving...": "Saving...",
|
|
8524
8567
|
"Improve writing": "Improve writing",
|
|
8525
8568
|
"Replace placeholder content": "Replace placeholder content",
|
|
8569
|
+
"Discard current placeholder content and replace with meaningful relevant content.": "Discard current placeholder content and replace with meaningful relevant content.",
|
|
8526
8570
|
"Fix grammar": "Fix grammar",
|
|
8571
|
+
"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors.": "Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors.",
|
|
8527
8572
|
"Make longer": "Make longer",
|
|
8573
|
+
"Make all text elements longer.": "Make all text elements longer.",
|
|
8528
8574
|
"Make shorter": "Make shorter",
|
|
8575
|
+
"Make all text elements shorter.": "Make all text elements shorter.",
|
|
8529
8576
|
"Add emojis": "Add emojis",
|
|
8577
|
+
"Add emojis to text elements if relevant.": "Add emojis to text elements if relevant.",
|
|
8530
8578
|
Randomize,
|
|
8579
|
+
"Randomize all text elements.": "Randomize all text elements.",
|
|
8531
8580
|
"Edit Block": "Edit Block",
|
|
8532
8581
|
"AI Assistant": "AI Assistant",
|
|
8533
|
-
"Theme Config": { "Heading Font": "Heading Font", "Body Font": "Body Font", "Rounded Corner": "Rounded Corners", Primary: "Primary", Secondary: "Secondary", Background: "Background", "Text Color": "Text Color", "Background Dark Mode": "Background (Dark Mode)", "Text Color Dark Mode": "Text Color (Dark Mode)" },
|
|
8582
|
+
"Theme Config": { "Heading Font": "Heading Font", "Body Font": "Body Font", "Rounded Corner": "Rounded Corners", Primary: "Primary", Secondary: "Secondary", Background: "Background", "Text Color": "Text Color", "Background Dark Mode": "Background (Dark Mode)", "Text Color Dark Mode": "Text Color (Dark Mode)", "Reset styles": "Reset styles" },
|
|
8583
|
+
"Copy classes to clipboard": "Copy classes to clipboard",
|
|
8584
|
+
"Classes copied to clipboard": "Classes copied to clipboard",
|
|
8585
|
+
Classes,
|
|
8586
|
+
All,
|
|
8587
|
+
"Enter classes separated by space": "Enter classes separated by space",
|
|
8588
|
+
"Show hidden blocks": "Show hidden blocks",
|
|
8589
|
+
"Expand all": "Expand all",
|
|
8590
|
+
"Collapse all": "Collapse all",
|
|
8591
|
+
"Choose library": "Choose library",
|
|
8592
|
+
"Close Preview": "Close Preview",
|
|
8593
|
+
Error: "Error",
|
|
8594
|
+
"Failed to copy template": "Failed to copy template",
|
|
8595
|
+
"Total tokens used": "Total tokens used",
|
|
8596
|
+
"Updated AI Context": "Updated AI Context",
|
|
8597
|
+
"You can now Ask AI to edit your content": "You can now Ask AI to edit your content",
|
|
8598
|
+
"Tell about this page eg this page is about": "Tell about this page eg this page is about..",
|
|
8599
|
+
"Delete Context": "Delete Context",
|
|
8600
|
+
"Keyboard shortcuts": "Keyboard shortcuts",
|
|
8601
|
+
Undo,
|
|
8602
|
+
Redo,
|
|
8603
|
+
Duplicate,
|
|
8604
|
+
"Deselect blocks": "Deselect blocks",
|
|
8605
|
+
"Delete block": "Delete block",
|
|
8606
|
+
"Save page": "Save page",
|
|
8607
|
+
"Scripts will be only executed in preview and live mode.": "Scripts will be only executed in preview and live mode.",
|
|
8608
|
+
"HTML Code Editor |": "HTML Code Editor |",
|
|
8609
|
+
Close,
|
|
8610
|
+
"Coming soon": "Coming soon",
|
|
8611
|
+
Selected,
|
|
8612
|
+
Select,
|
|
8613
|
+
"Choose Builder Layout": "Choose Builder Layout",
|
|
8614
|
+
"Single side panel": "Single side panel",
|
|
8615
|
+
"Suitable for smaller screens. Bigger canvas size.": "Suitable for smaller screens. Bigger canvas size.",
|
|
8616
|
+
"Dual side panel": "Dual side panel",
|
|
8617
|
+
"Suitable for larger screens. Smaller canvas size.": "Suitable for larger screens. Smaller canvas size.",
|
|
8618
|
+
"Dual side panel advanced": "Dual side panel advanced",
|
|
8619
|
+
"Suitable for heavy styling & block editing. Setting are always visible.": "Suitable for heavy styling & block editing. Setting are always visible.",
|
|
8620
|
+
"Block Settings": "Block Settings",
|
|
8621
|
+
"Visibility settings": "Visibility settings",
|
|
8622
|
+
"Show on canvas": "Show on canvas",
|
|
8623
|
+
Attributes,
|
|
8624
|
+
"Apply Presets": "Apply Presets",
|
|
8625
|
+
apply,
|
|
8626
|
+
presets,
|
|
8627
|
+
"Global presets": "Global presets",
|
|
8628
|
+
Orientation,
|
|
8629
|
+
Color,
|
|
8630
|
+
"Please select an image": "Please select an image",
|
|
8631
|
+
"click to upload": "click to upload",
|
|
8632
|
+
"SVG, PNG, JPG or GIF (Max. 2mb)": "SVG, PNG, JPG or GIF (Max. 2mb)",
|
|
8633
|
+
"Uploading...": "Uploading...",
|
|
8634
|
+
Upload,
|
|
8635
|
+
"Something went wrong": "Something went wrong",
|
|
8636
|
+
"Fetching...": "Fetching...",
|
|
8637
|
+
"No images found": "No images found",
|
|
8638
|
+
"It looks like you haven't uploaded any images yet. Start by clicking the upload button above.": "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.",
|
|
8639
|
+
"Open Code Editor": "Open Code Editor",
|
|
8640
|
+
"Clear search": "Clear search",
|
|
8641
|
+
"No results found for": "No results found for",
|
|
8642
|
+
"Search {{pageTypeName}}": "Search {{pageTypeName}}",
|
|
8643
|
+
"Goto Page": "Goto Page",
|
|
8644
|
+
"Open URL": "Open URL",
|
|
8645
|
+
"Compose Email": "Compose Email",
|
|
8646
|
+
"Call Phone": "Call Phone",
|
|
8647
|
+
"Scroll to element": "Scroll to element",
|
|
8648
|
+
"#ElementID": "#ElementID",
|
|
8649
|
+
"Enter details": "Enter details",
|
|
8650
|
+
"Open in new tab": "Open in new tab",
|
|
8651
|
+
Apply,
|
|
8652
|
+
Back,
|
|
8653
|
+
Insert,
|
|
8654
|
+
Rename,
|
|
8655
|
+
"Unlink from library": "Unlink from library",
|
|
8656
|
+
"Save to Library": "Save to Library",
|
|
8657
|
+
"No blocks found in this group": "No blocks found in this group",
|
|
8658
|
+
"No blocks found matching": "No blocks found matching",
|
|
8659
|
+
"No matching blocks found": "No matching blocks found",
|
|
8660
|
+
"Search blocks...": "Search blocks...",
|
|
8661
|
+
Partials,
|
|
8662
|
+
Happy,
|
|
8663
|
+
Sad,
|
|
8664
|
+
"Importing...": "Importing...",
|
|
8665
|
+
"Failed to load the UI library. Try again": "Failed to load the UI library. Try again",
|
|
8666
|
+
Retry,
|
|
8667
|
+
"Oops! Something went wrong.": "Oops! Something went wrong.",
|
|
8668
|
+
"Please try again.": "Please try again.",
|
|
8669
|
+
"No option found.": "No option found.",
|
|
8670
|
+
"Clipboard not supported": "Clipboard not supported",
|
|
8671
|
+
"Are you sure you want to clear the page?": "Are you sure you want to clear the page?",
|
|
8672
|
+
canvas_empty,
|
|
8673
|
+
Presets,
|
|
8674
|
+
"Reset style": "Reset style",
|
|
8675
|
+
"Reset styles": "Reset styles",
|
|
8676
|
+
"Clear styles": "Clear styles",
|
|
8677
|
+
"Open code editor": "Open code editor",
|
|
8678
|
+
"Style element": "Style element",
|
|
8679
|
+
"Repeater Data": "Repeater Data",
|
|
8680
|
+
"Toggle Data Binding": "Toggle Data Binding",
|
|
8681
|
+
No,
|
|
8682
|
+
Saving,
|
|
8683
|
+
"Screen sizes": "Screen sizes",
|
|
8684
|
+
"Theme Settings": "Theme Settings",
|
|
8685
|
+
"Import CSS Theme": "Import CSS Theme",
|
|
8686
|
+
"Import theme": "Import theme",
|
|
8687
|
+
"Import Theme": "Import Theme",
|
|
8688
|
+
"CSS Variables": "CSS Variables",
|
|
8689
|
+
"You don't have permission to edit settings or styles": "You don't have permission to edit settings or styles",
|
|
8690
|
+
"Please contact your administrator to get access": "Please contact your administrator to get access",
|
|
8534
8691
|
"flex.heading": "Flex Child",
|
|
8535
8692
|
"flex.basis": "Basis",
|
|
8536
8693
|
"flex.order": "Order",
|
|
@@ -8700,64 +8857,7 @@ const Input = ({ node: o }) => {
|
|
|
8700
8857
|
"effect.delay": "Delay",
|
|
8701
8858
|
"classes.heading": "Classes",
|
|
8702
8859
|
theme_config,
|
|
8703
|
-
web_blocks
|
|
8704
|
-
"Copy classes to clipboard": "Copy classes to clipboard",
|
|
8705
|
-
"Classes copied to clipboard": "Classes copied to clipboard",
|
|
8706
|
-
"Show hidden blocks": "Show hidden blocks",
|
|
8707
|
-
"Expand all": "Expand all",
|
|
8708
|
-
"Collapse all": "Collapse all",
|
|
8709
|
-
"Choose library": "Choose library",
|
|
8710
|
-
"Close Preview": "Close Preview",
|
|
8711
|
-
Error: "Error",
|
|
8712
|
-
"Failed to copy template": "Failed to copy template",
|
|
8713
|
-
"Total tokens used": "Total tokens used",
|
|
8714
|
-
"Updated AI Context": "Updated AI Context",
|
|
8715
|
-
"You can now Ask AI to edit your content": "You can now Ask AI to edit your content",
|
|
8716
|
-
"Tell about this page eg this page is about": "Tell about this page eg this page is about..",
|
|
8717
|
-
"Delete Context": "Delete Context",
|
|
8718
|
-
"Keyboard shortcuts": "Keyboard shortcuts",
|
|
8719
|
-
Undo,
|
|
8720
|
-
Redo,
|
|
8721
|
-
Duplicate,
|
|
8722
|
-
"Deselect blocks": "Deselect blocks",
|
|
8723
|
-
"Delete block": "Delete block",
|
|
8724
|
-
"Save page": "Save page",
|
|
8725
|
-
"Scripts will be only executed in preview and live mode.": "Scripts will be only executed in preview and live mode.",
|
|
8726
|
-
"HTML Code Editor |": "HTML Code Editor |",
|
|
8727
|
-
Close,
|
|
8728
|
-
"Coming soon": "Coming soon",
|
|
8729
|
-
Selected,
|
|
8730
|
-
Select,
|
|
8731
|
-
"Choose Builder Layout": "Choose Builder Layout",
|
|
8732
|
-
"Single side panel": "Single side panel",
|
|
8733
|
-
"Suitable for smaller screens. Bigger canvas size.": "Suitable for smaller screens. Bigger canvas size.",
|
|
8734
|
-
"Dual side panel": "Dual side panel",
|
|
8735
|
-
"Suitable for larger screens. Smaller canvas size.": "Suitable for larger screens. Smaller canvas size.",
|
|
8736
|
-
"Dual side panel advanced": "Dual side panel advanced",
|
|
8737
|
-
"Suitable for heavy styling & block editing. Setting are always visible.": "Suitable for heavy styling & block editing. Setting are always visible.",
|
|
8738
|
-
"Block Settings": "Block Settings",
|
|
8739
|
-
"Visibility settings": "Visibility settings",
|
|
8740
|
-
"Show on canvas": "Show on canvas",
|
|
8741
|
-
Attributes,
|
|
8742
|
-
"Apply Presets": "Apply Presets",
|
|
8743
|
-
apply,
|
|
8744
|
-
presets,
|
|
8745
|
-
"Global presets": "Global presets",
|
|
8746
|
-
Orientation,
|
|
8747
|
-
Color,
|
|
8748
|
-
"Please select an image": "Please select an image",
|
|
8749
|
-
"click to upload": "click to upload",
|
|
8750
|
-
"SVG, PNG, JPG or GIF (Max. 2mb)": "SVG, PNG, JPG or GIF (Max. 2mb)",
|
|
8751
|
-
"Uploading...": "Uploading...",
|
|
8752
|
-
Upload,
|
|
8753
|
-
"Something went wrong": "Something went wrong",
|
|
8754
|
-
"Fetching...": "Fetching...",
|
|
8755
|
-
"No images found": "No images found",
|
|
8756
|
-
"It looks like you haven't uploaded any images yet. Start by clicking the upload button above.": "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.",
|
|
8757
|
-
"Open Code Editor": "Open Code Editor",
|
|
8758
|
-
"Clear search": "Clear search",
|
|
8759
|
-
"No results found for": "No results found for",
|
|
8760
|
-
"Search {pageTypeName}": "Search {pageTypeName}"
|
|
8860
|
+
web_blocks
|
|
8761
8861
|
};
|
|
8762
8862
|
i18n.use(initReactI18next).init({
|
|
8763
8863
|
// the translations
|
|
@@ -8989,26 +9089,26 @@ function AIChatPanel() {
|
|
|
8989
9089
|
content: r,
|
|
8990
9090
|
timestamp: /* @__PURE__ */ new Date()
|
|
8991
9091
|
};
|
|
8992
|
-
n((
|
|
8993
|
-
const
|
|
9092
|
+
n((k) => [...k, b]), a(""), i(!0), setTimeout(() => {
|
|
9093
|
+
const k = {
|
|
8994
9094
|
id: (Date.now() + 1).toString(),
|
|
8995
9095
|
role: "assistant",
|
|
8996
9096
|
content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
|
|
8997
9097
|
timestamp: /* @__PURE__ */ new Date()
|
|
8998
9098
|
};
|
|
8999
|
-
n((B) => [...B,
|
|
9099
|
+
n((B) => [...B, k]), i(!1), d(null);
|
|
9000
9100
|
}, 1500);
|
|
9001
9101
|
}, h = (b) => {
|
|
9002
9102
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
|
|
9003
9103
|
}, x = (b) => {
|
|
9004
9104
|
var B;
|
|
9005
|
-
const
|
|
9006
|
-
if (
|
|
9105
|
+
const k = (B = b.target.files) == null ? void 0 : B[0];
|
|
9106
|
+
if (k) {
|
|
9007
9107
|
const j = new FileReader();
|
|
9008
|
-
j.onload = (
|
|
9009
|
-
var
|
|
9010
|
-
d((
|
|
9011
|
-
}, j.readAsDataURL(
|
|
9108
|
+
j.onload = (E) => {
|
|
9109
|
+
var C;
|
|
9110
|
+
d((C = E.target) == null ? void 0 : C.result);
|
|
9111
|
+
}, j.readAsDataURL(k);
|
|
9012
9112
|
}
|
|
9013
9113
|
}, f = () => {
|
|
9014
9114
|
var b;
|
|
@@ -9136,7 +9236,7 @@ const AiAssistant = () => {
|
|
|
9136
9236
|
] }) }),
|
|
9137
9237
|
/* @__PURE__ */ jsxs(AlertDialogContent, { className: "border-border", children: [
|
|
9138
9238
|
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
9139
|
-
/* @__PURE__ */ jsx(AlertDialogTitle, { className: "text-foreground", children: o("Clear whole canvas?
|
|
9239
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { className: "text-foreground", children: o("Clear whole canvas?") }),
|
|
9140
9240
|
/* @__PURE__ */ jsx(AlertDialogDescription, { children: o("Are you sure you want to clear the page?") })
|
|
9141
9241
|
] }),
|
|
9142
9242
|
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
@@ -9202,62 +9302,62 @@ const AiAssistant = () => {
|
|
|
9202
9302
|
preloadedAttributes: n = [],
|
|
9203
9303
|
onAttributesChange: r
|
|
9204
9304
|
}) {
|
|
9205
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData();
|
|
9305
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData(), { t: b } = useTranslation();
|
|
9206
9306
|
useEffect(() => {
|
|
9207
9307
|
l(n);
|
|
9208
9308
|
}, [n]);
|
|
9209
|
-
const
|
|
9309
|
+
const k = () => {
|
|
9210
9310
|
if (i.startsWith("@")) {
|
|
9211
9311
|
h("Attribute keys cannot start with '@'");
|
|
9212
9312
|
return;
|
|
9213
9313
|
}
|
|
9214
9314
|
if (i) {
|
|
9215
|
-
const
|
|
9216
|
-
r(
|
|
9315
|
+
const S = [...a, { key: i, value: d }];
|
|
9316
|
+
r(S), l(a), c(""), p(""), h("");
|
|
9217
9317
|
}
|
|
9218
|
-
},
|
|
9219
|
-
const
|
|
9220
|
-
r(
|
|
9221
|
-
},
|
|
9222
|
-
g(
|
|
9223
|
-
},
|
|
9318
|
+
}, B = (S) => {
|
|
9319
|
+
const I = a.filter((A, w) => w !== S);
|
|
9320
|
+
r(I), l(I);
|
|
9321
|
+
}, j = (S) => {
|
|
9322
|
+
g(S), c(a[S].key), p(a[S].value);
|
|
9323
|
+
}, E = () => {
|
|
9224
9324
|
if (i.startsWith("@")) {
|
|
9225
9325
|
h("Attribute keys cannot start with '@'");
|
|
9226
9326
|
return;
|
|
9227
9327
|
}
|
|
9228
9328
|
if (u !== null && i) {
|
|
9229
|
-
const
|
|
9230
|
-
|
|
9329
|
+
const S = [...a];
|
|
9330
|
+
S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), h("");
|
|
9231
9331
|
}
|
|
9232
|
-
},
|
|
9233
|
-
|
|
9234
|
-
},
|
|
9235
|
-
const
|
|
9236
|
-
let
|
|
9237
|
-
const
|
|
9238
|
-
return
|
|
9239
|
-
text:
|
|
9240
|
-
prefixLength:
|
|
9241
|
-
suffixLength:
|
|
9332
|
+
}, C = (S) => {
|
|
9333
|
+
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? E() : k());
|
|
9334
|
+
}, v = useCallback((S) => {
|
|
9335
|
+
const I = (_) => /[.,!?;:]/.test(_), A = (_, L, T) => {
|
|
9336
|
+
let P = "", R = "";
|
|
9337
|
+
const N = L > 0 ? _[L - 1] : "", D = L < _.length ? _[L] : "";
|
|
9338
|
+
return L > 0 && (N === "." || !I(N) && N !== " ") && (P = " "), L < _.length && !I(D) && D !== " " && (R = " "), {
|
|
9339
|
+
text: P + T + R,
|
|
9340
|
+
prefixLength: P.length,
|
|
9341
|
+
suffixLength: R.length
|
|
9242
9342
|
};
|
|
9243
|
-
},
|
|
9244
|
-
if (
|
|
9245
|
-
const
|
|
9246
|
-
if (
|
|
9247
|
-
const
|
|
9248
|
-
p(
|
|
9343
|
+
}, w = f.current;
|
|
9344
|
+
if (w) {
|
|
9345
|
+
const _ = w.selectionStart || 0, L = w.value || "", T = w.selectionEnd || _;
|
|
9346
|
+
if (T > _) {
|
|
9347
|
+
const F = `{{${S}}}`, { text: O } = A(L, _, F), M = L.slice(0, _) + O + L.slice(T);
|
|
9348
|
+
p(M);
|
|
9249
9349
|
return;
|
|
9250
9350
|
}
|
|
9251
|
-
const
|
|
9252
|
-
p(
|
|
9351
|
+
const R = `{{${S}}}`, { text: N } = A(L, _, R), D = L.slice(0, _) + N + L.slice(_);
|
|
9352
|
+
p(D);
|
|
9253
9353
|
}
|
|
9254
9354
|
}, []);
|
|
9255
9355
|
return /* @__PURE__ */ jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
9256
9356
|
/* @__PURE__ */ jsxs(
|
|
9257
9357
|
"form",
|
|
9258
9358
|
{
|
|
9259
|
-
onSubmit: (
|
|
9260
|
-
|
|
9359
|
+
onSubmit: (S) => {
|
|
9360
|
+
S.preventDefault(), u !== null ? E() : k();
|
|
9261
9361
|
},
|
|
9262
9362
|
className: "space-y-3",
|
|
9263
9363
|
children: [
|
|
@@ -9273,8 +9373,8 @@ const AiAssistant = () => {
|
|
|
9273
9373
|
id: "attrKey",
|
|
9274
9374
|
ref: x,
|
|
9275
9375
|
value: i,
|
|
9276
|
-
onChange: (
|
|
9277
|
-
placeholder: "Enter Key",
|
|
9376
|
+
onChange: (S) => c(S.target.value),
|
|
9377
|
+
placeholder: b("Enter Key"),
|
|
9278
9378
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
9279
9379
|
}
|
|
9280
9380
|
)
|
|
@@ -9282,7 +9382,7 @@ const AiAssistant = () => {
|
|
|
9282
9382
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9283
9383
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9284
9384
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9285
|
-
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect:
|
|
9385
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: v })
|
|
9286
9386
|
] }),
|
|
9287
9387
|
/* @__PURE__ */ jsx(
|
|
9288
9388
|
Textarea,
|
|
@@ -9294,8 +9394,8 @@ const AiAssistant = () => {
|
|
|
9294
9394
|
rows: 2,
|
|
9295
9395
|
ref: f,
|
|
9296
9396
|
value: d,
|
|
9297
|
-
onChange: (
|
|
9298
|
-
onKeyDown:
|
|
9397
|
+
onChange: (S) => p(S.target.value),
|
|
9398
|
+
onKeyDown: C,
|
|
9299
9399
|
placeholder: "Enter Value",
|
|
9300
9400
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
9301
9401
|
}
|
|
@@ -9307,16 +9407,16 @@ const AiAssistant = () => {
|
|
|
9307
9407
|
]
|
|
9308
9408
|
}
|
|
9309
9409
|
),
|
|
9310
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
9410
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, I) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9311
9411
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9312
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
9313
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children:
|
|
9412
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
|
|
9413
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
|
|
9314
9414
|
] }),
|
|
9315
9415
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9316
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9317
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9416
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => j(I), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9417
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(I), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9318
9418
|
] })
|
|
9319
|
-
] },
|
|
9419
|
+
] }, I)) })
|
|
9320
9420
|
] });
|
|
9321
9421
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9322
9422
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9421,9 +9521,9 @@ const PartialWrapper = ({ partialBlockId: o }) => {
|
|
|
9421
9521
|
/* @__PURE__ */ jsx("br", {})
|
|
9422
9522
|
] }) }) : /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: "settings", className: "flex flex-1 flex-col", children: [
|
|
9423
9523
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid h-auto w-full grid-cols-2 p-1 py-1", children: [
|
|
9424
|
-
/* @__PURE__ */ jsx(TabsTrigger, { value: "settings", className: "text-xs", children: "Settings" }),
|
|
9524
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "settings", className: "text-xs", children: n("Settings") }),
|
|
9425
9525
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "styles", className: "text-xs", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
9426
|
-
/* @__PURE__ */ jsx("span", { className: "w-[90%] text-center", children: "
|
|
9526
|
+
/* @__PURE__ */ jsx("span", { className: "w-[90%] text-center", children: n("Styling") }),
|
|
9427
9527
|
/* @__PURE__ */ jsx("span", { className: "w-[10%]", children: /* @__PURE__ */ jsx(ResetStylesButton, {}) })
|
|
9428
9528
|
] }) })
|
|
9429
9529
|
] }) }),
|
|
@@ -9486,38 +9586,38 @@ function useSidebarDefaultPanels() {
|
|
|
9486
9586
|
}, [o, n, r]);
|
|
9487
9587
|
}
|
|
9488
9588
|
const RootLayout = () => {
|
|
9489
|
-
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((
|
|
9490
|
-
|
|
9589
|
+
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((S) => {
|
|
9590
|
+
S.preventDefault();
|
|
9491
9591
|
}, []), x = useCallback(
|
|
9492
|
-
(
|
|
9493
|
-
console.log("handleMenuItemClick",
|
|
9592
|
+
(S) => {
|
|
9593
|
+
console.log("handleMenuItemClick", S, n), r(n === S ? null : S);
|
|
9494
9594
|
},
|
|
9495
9595
|
[n, r]
|
|
9496
9596
|
), { t: f } = useTranslation(), y = useMemo(
|
|
9497
9597
|
() => [...p, ...u, ...g],
|
|
9498
9598
|
[p, u, g]
|
|
9499
|
-
), b = useBuilderProp("htmlDir", "ltr"),
|
|
9599
|
+
), b = useBuilderProp("htmlDir", "ltr"), k = find(y, { id: n }) ?? first(y), B = get(k, "width", DEFAULT_PANEL_WIDTH);
|
|
9500
9600
|
useEffect(() => {
|
|
9501
9601
|
if (n !== null) {
|
|
9502
|
-
const
|
|
9503
|
-
|
|
9602
|
+
const S = find(y, { id: n });
|
|
9603
|
+
S && get(S, "view", "standard") === "standard" && (a.current = n, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
|
|
9504
9604
|
}
|
|
9505
9605
|
}, [n, y]);
|
|
9506
9606
|
const j = useMemo(() => {
|
|
9507
9607
|
if (n === null) return 0;
|
|
9508
|
-
const
|
|
9509
|
-
return get(
|
|
9510
|
-
}, [n, B, l, y]),
|
|
9608
|
+
const S = find(y, { id: n });
|
|
9609
|
+
return get(S, "view", "standard") === "standard" ? B : l;
|
|
9610
|
+
}, [n, B, l, y]), E = useCallback(() => {
|
|
9511
9611
|
r(a.current);
|
|
9512
|
-
}, [r, n]),
|
|
9612
|
+
}, [r, n]), C = useCallback(() => {
|
|
9513
9613
|
r("outline");
|
|
9514
9614
|
}, [r]);
|
|
9515
9615
|
useEffect(() => {
|
|
9516
9616
|
n !== null && !find(y, { id: n }) && r("outline");
|
|
9517
9617
|
}, [n, y]);
|
|
9518
|
-
const
|
|
9519
|
-
(
|
|
9520
|
-
x(
|
|
9618
|
+
const v = useCallback(
|
|
9619
|
+
(S) => {
|
|
9620
|
+
x(S);
|
|
9521
9621
|
},
|
|
9522
9622
|
[x]
|
|
9523
9623
|
);
|
|
@@ -9531,25 +9631,25 @@ const RootLayout = () => {
|
|
|
9531
9631
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9532
9632
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9533
9633
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9534
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9535
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9634
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((S, I) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9635
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9536
9636
|
position: "top",
|
|
9537
|
-
panelId:
|
|
9538
|
-
isActive: n ===
|
|
9539
|
-
show: () =>
|
|
9637
|
+
panelId: S.id,
|
|
9638
|
+
isActive: n === S.id,
|
|
9639
|
+
show: () => v(S.id)
|
|
9540
9640
|
}) }),
|
|
9541
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9542
|
-
] }, "button-top-" +
|
|
9641
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9642
|
+
] }, "button-top-" + I)) }),
|
|
9543
9643
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9544
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((
|
|
9545
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9644
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((S, I) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9645
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9546
9646
|
position: "bottom",
|
|
9547
|
-
panelId:
|
|
9548
|
-
isActive: n ===
|
|
9549
|
-
show: () =>
|
|
9647
|
+
panelId: S.id,
|
|
9648
|
+
isActive: n === S.id,
|
|
9649
|
+
show: () => v(S.id)
|
|
9550
9650
|
}) }),
|
|
9551
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9552
|
-
] }, "button-bottom-" +
|
|
9651
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9652
|
+
] }, "button-bottom-" + I)) })
|
|
9553
9653
|
] }),
|
|
9554
9654
|
/* @__PURE__ */ jsx(
|
|
9555
9655
|
motion.div,
|
|
@@ -9559,15 +9659,15 @@ const RootLayout = () => {
|
|
|
9559
9659
|
initial: { width: j },
|
|
9560
9660
|
animate: { width: j },
|
|
9561
9661
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9562
|
-
children: n !== null && get(
|
|
9662
|
+
children: n !== null && get(k, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9563
9663
|
/* @__PURE__ */ jsx(
|
|
9564
9664
|
"div",
|
|
9565
9665
|
{
|
|
9566
|
-
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(
|
|
9567
|
-
children: /* @__PURE__ */ jsx("span", { children: f(get(
|
|
9666
|
+
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(k, "isInternal", !1) ? "" : "w-64"}`,
|
|
9667
|
+
children: /* @__PURE__ */ jsx("span", { children: f(get(k, "label", "")) })
|
|
9568
9668
|
}
|
|
9569
9669
|
),
|
|
9570
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9670
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(k, "panel", NoopComponent), {}) }) })
|
|
9571
9671
|
] })
|
|
9572
9672
|
}
|
|
9573
9673
|
),
|
|
@@ -9613,7 +9713,7 @@ const RootLayout = () => {
|
|
|
9613
9713
|
}
|
|
9614
9714
|
),
|
|
9615
9715
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9616
|
-
n !== null && get(
|
|
9716
|
+
n !== null && get(k, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => E(), children: /* @__PURE__ */ jsxs(
|
|
9617
9717
|
SheetContent,
|
|
9618
9718
|
{
|
|
9619
9719
|
side: "left",
|
|
@@ -9621,26 +9721,26 @@ const RootLayout = () => {
|
|
|
9621
9721
|
style: { width: `${B}px` },
|
|
9622
9722
|
children: [
|
|
9623
9723
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9624
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9625
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9724
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(k, "icon", null) }),
|
|
9725
|
+
/* @__PURE__ */ jsx("span", { children: f(get(k, "label", "")) })
|
|
9626
9726
|
] }) }),
|
|
9627
|
-
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9628
|
-
close:
|
|
9727
|
+
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(k, "panel", NoopComponent), {
|
|
9728
|
+
close: C
|
|
9629
9729
|
}) }) })
|
|
9630
9730
|
]
|
|
9631
9731
|
}
|
|
9632
9732
|
) }),
|
|
9633
9733
|
" ",
|
|
9634
|
-
n !== null && get(
|
|
9734
|
+
n !== null && get(k, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => E(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${B}px` }, children: [
|
|
9635
9735
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9636
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9637
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9736
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(k, "icon", null) }),
|
|
9737
|
+
/* @__PURE__ */ jsx("span", { children: f(get(k, "label", "")) })
|
|
9638
9738
|
] }) }),
|
|
9639
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9640
|
-
close:
|
|
9739
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(k, "panel", NoopComponent), {
|
|
9740
|
+
close: C
|
|
9641
9741
|
}) }) })
|
|
9642
9742
|
] }) }),
|
|
9643
|
-
n !== null && get(
|
|
9743
|
+
n !== null && get(k, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9644
9744
|
motion.div,
|
|
9645
9745
|
{
|
|
9646
9746
|
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
@@ -9659,13 +9759,13 @@ const RootLayout = () => {
|
|
|
9659
9759
|
children: [
|
|
9660
9760
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9661
9761
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9662
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
9663
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9762
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(k, "icon", null) }),
|
|
9763
|
+
/* @__PURE__ */ jsx("span", { children: f(get(k, "label", "")) })
|
|
9664
9764
|
] }),
|
|
9665
|
-
/* @__PURE__ */ jsx(Button, { onClick: () =>
|
|
9765
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => E(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
9666
9766
|
] }),
|
|
9667
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9668
|
-
close:
|
|
9767
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(k, "panel", NoopComponent), {
|
|
9768
|
+
close: C
|
|
9669
9769
|
}) }) })
|
|
9670
9770
|
]
|
|
9671
9771
|
}
|
|
@@ -9707,8 +9807,8 @@ const RootLayout = () => {
|
|
|
9707
9807
|
const f = l.toLowerCase();
|
|
9708
9808
|
return Object.fromEntries(
|
|
9709
9809
|
Object.entries(a).filter(([y, b]) => {
|
|
9710
|
-
var
|
|
9711
|
-
return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((
|
|
9810
|
+
var k;
|
|
9811
|
+
return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((k = b == null ? void 0 : b.description) == null ? void 0 : k.toLowerCase().includes(f));
|
|
9712
9812
|
})
|
|
9713
9813
|
);
|
|
9714
9814
|
}, [a, l]), m = (f) => {
|
|
@@ -9718,8 +9818,8 @@ const RootLayout = () => {
|
|
|
9718
9818
|
});
|
|
9719
9819
|
}, h = (f) => {
|
|
9720
9820
|
if (!c) return;
|
|
9721
|
-
const y = f.clientX - p.x, b = f.clientY - p.y,
|
|
9722
|
-
r(
|
|
9821
|
+
const y = f.clientX - p.x, b = f.clientY - p.y, k = f.currentTarget, B = k.offsetWidth, j = k.offsetHeight, E = window.innerWidth - B, C = window.innerHeight - j, v = Math.max(0, Math.min(y, E)), S = Math.max(0, Math.min(b, C));
|
|
9822
|
+
r(v, S);
|
|
9723
9823
|
}, x = () => {
|
|
9724
9824
|
d(!1);
|
|
9725
9825
|
};
|
|
@@ -9961,59 +10061,59 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9961
10061
|
var r;
|
|
9962
10062
|
const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14], x = a[16], f = a[17], y = u(o, n);
|
|
9963
10063
|
if (isAtomStateInitialized(y) && (l.has(n) && i.get(n) !== y.n || Array.from(y.d).every(
|
|
9964
|
-
([
|
|
10064
|
+
([S, I]) => (
|
|
9965
10065
|
// Recursively, read the atom state of the dependency, and
|
|
9966
10066
|
// check if the atom epoch number is unchanged
|
|
9967
|
-
h(o,
|
|
10067
|
+
h(o, S).n === I
|
|
9968
10068
|
)
|
|
9969
10069
|
)))
|
|
9970
10070
|
return y;
|
|
9971
10071
|
y.d.clear();
|
|
9972
10072
|
let b = !0;
|
|
9973
|
-
function
|
|
10073
|
+
function k() {
|
|
9974
10074
|
l.has(n) && (f(o, n), m(o), g(o));
|
|
9975
10075
|
}
|
|
9976
|
-
function B(
|
|
9977
|
-
var
|
|
9978
|
-
if (isSelfAtom(n,
|
|
9979
|
-
const
|
|
9980
|
-
if (!isAtomStateInitialized(
|
|
9981
|
-
if (hasInitialValue(
|
|
9982
|
-
setAtomStateValueOrPromise(o,
|
|
10076
|
+
function B(S) {
|
|
10077
|
+
var I;
|
|
10078
|
+
if (isSelfAtom(n, S)) {
|
|
10079
|
+
const w = u(o, S);
|
|
10080
|
+
if (!isAtomStateInitialized(w))
|
|
10081
|
+
if (hasInitialValue(S))
|
|
10082
|
+
setAtomStateValueOrPromise(o, S, S.init);
|
|
9983
10083
|
else
|
|
9984
10084
|
throw new Error("no atom init");
|
|
9985
|
-
return returnAtomValue(
|
|
10085
|
+
return returnAtomValue(w);
|
|
9986
10086
|
}
|
|
9987
|
-
const
|
|
10087
|
+
const A = h(o, S);
|
|
9988
10088
|
try {
|
|
9989
|
-
return returnAtomValue(
|
|
10089
|
+
return returnAtomValue(A);
|
|
9990
10090
|
} finally {
|
|
9991
|
-
y.d.set(
|
|
10091
|
+
y.d.set(S, A.n), isPendingPromise(y.v) && addPendingPromiseToDependency(n, y.v, A), (I = l.get(S)) == null || I.t.add(n), b || k();
|
|
9992
10092
|
}
|
|
9993
10093
|
}
|
|
9994
|
-
let j,
|
|
9995
|
-
const
|
|
10094
|
+
let j, E;
|
|
10095
|
+
const C = {
|
|
9996
10096
|
get signal() {
|
|
9997
10097
|
return j || (j = new AbortController()), j.signal;
|
|
9998
10098
|
},
|
|
9999
10099
|
get setSelf() {
|
|
10000
|
-
return !
|
|
10100
|
+
return !E && isActuallyWritableAtom(n) && (E = (...S) => {
|
|
10001
10101
|
if (!b)
|
|
10002
10102
|
try {
|
|
10003
|
-
return x(o, n, ...
|
|
10103
|
+
return x(o, n, ...S);
|
|
10004
10104
|
} finally {
|
|
10005
10105
|
m(o), g(o);
|
|
10006
10106
|
}
|
|
10007
|
-
}),
|
|
10107
|
+
}), E;
|
|
10008
10108
|
}
|
|
10009
|
-
},
|
|
10109
|
+
}, v = y.n;
|
|
10010
10110
|
try {
|
|
10011
|
-
const
|
|
10012
|
-
return setAtomStateValueOrPromise(o, n,
|
|
10013
|
-
} catch (
|
|
10014
|
-
return delete y.v, y.e =
|
|
10111
|
+
const S = p(o, n, B, C);
|
|
10112
|
+
return setAtomStateValueOrPromise(o, n, S), isPromiseLike$1(S) && (registerAbortHandler(S, () => j == null ? void 0 : j.abort()), S.then(k, k)), y;
|
|
10113
|
+
} catch (S) {
|
|
10114
|
+
return delete y.v, y.e = S, ++y.n, y;
|
|
10015
10115
|
} finally {
|
|
10016
|
-
b = !1,
|
|
10116
|
+
b = !1, v !== y.n && i.get(n) === v && (i.set(n, y.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
10017
10117
|
}
|
|
10018
10118
|
}, invalidateDependents = (o, n) => {
|
|
10019
10119
|
const r = getBuildingBlocks(o), a = r[1], l = r[2], i = r[11], c = [n];
|
|
@@ -10027,18 +10127,18 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10027
10127
|
}, writeAtomState = (o, n, ...r) => {
|
|
10028
10128
|
const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], d = a[11], p = a[12], u = a[13], g = a[14], m = a[15], h = a[17];
|
|
10029
10129
|
let x = !0;
|
|
10030
|
-
const f = (b) => returnAtomValue(g(o, b)), y = (b, ...
|
|
10130
|
+
const f = (b) => returnAtomValue(g(o, b)), y = (b, ...k) => {
|
|
10031
10131
|
var B;
|
|
10032
10132
|
const j = d(o, b);
|
|
10033
10133
|
try {
|
|
10034
10134
|
if (isSelfAtom(n, b)) {
|
|
10035
10135
|
if (!hasInitialValue(b))
|
|
10036
10136
|
throw new Error("atom not writable");
|
|
10037
|
-
const
|
|
10038
|
-
setAtomStateValueOrPromise(o, b,
|
|
10137
|
+
const E = j.n, C = k[0];
|
|
10138
|
+
setAtomStateValueOrPromise(o, b, C), h(o, b), E !== j.n && (l.add(b), (B = i.c) == null || B.call(i, b), m(o, b));
|
|
10039
10139
|
return;
|
|
10040
10140
|
} else
|
|
10041
|
-
return writeAtomState(o, b, ...
|
|
10141
|
+
return writeAtomState(o, b, ...k);
|
|
10042
10142
|
} finally {
|
|
10043
10143
|
x || (u(o), p(o));
|
|
10044
10144
|
}
|
|
@@ -10079,7 +10179,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10079
10179
|
}, l.set(n, f), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
|
|
10080
10180
|
const y = () => {
|
|
10081
10181
|
let b = !0;
|
|
10082
|
-
const
|
|
10182
|
+
const k = (...B) => {
|
|
10083
10183
|
try {
|
|
10084
10184
|
return h(o, n, ...B);
|
|
10085
10185
|
} finally {
|
|
@@ -10087,7 +10187,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10087
10187
|
}
|
|
10088
10188
|
};
|
|
10089
10189
|
try {
|
|
10090
|
-
const B = d(o, n,
|
|
10190
|
+
const B = d(o, n, k);
|
|
10091
10191
|
B && (f.u = () => {
|
|
10092
10192
|
b = !0;
|
|
10093
10193
|
try {
|