@chaibuilder/sdk 2.5.4 → 2.5.6
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-CkrtJykq.js → apply-binding-BL-JPMms.js} +29 -26
- package/dist/apply-binding-T3HdSezj.cjs +1 -0
- package/dist/core.cjs +3 -3
- package/dist/core.js +236 -231
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/package.json +1 -1
- package/dist/apply-binding-DpBwzIf9.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, Chevro
|
|
|
15
15
|
import clsx$1, { clsx } from "clsx";
|
|
16
16
|
import { twMerge } from "tailwind-merge";
|
|
17
17
|
import TreeModel from "tree-model";
|
|
18
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY, f as getSplitChaiClasses, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, h as ROOT_TEMP_KEY } from "./apply-binding-
|
|
18
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, f as getSplitChaiClasses, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, h as ROOT_TEMP_KEY } from "./apply-binding-BL-JPMms.js";
|
|
19
19
|
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";
|
|
20
20
|
import { isObject } from "@rjsf/utils";
|
|
21
21
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
@@ -840,13 +840,13 @@ const undoRedoStateAtom = atom({
|
|
|
840
840
|
} = useBlocksStoreManager();
|
|
841
841
|
return {
|
|
842
842
|
moveBlocks: (x, y, b) => {
|
|
843
|
-
const A = map(x, (
|
|
844
|
-
const w = r.find((
|
|
845
|
-
return { _id:
|
|
846
|
-
}),
|
|
847
|
-
|
|
848
|
-
undo: () => each(A, ({ _id:
|
|
849
|
-
i([
|
|
843
|
+
const A = map(x, (_) => {
|
|
844
|
+
const w = r.find((B) => B._id === _)._parent || null, v = r.filter((B) => w ? B._parent === w : !B._parent).map((B) => B._id).indexOf(_);
|
|
845
|
+
return { _id: _, oldParent: w, oldPosition: v };
|
|
846
|
+
}), E = A.find(({ _id: _ }) => _ === x[0]);
|
|
847
|
+
E && E.oldParent === y && E.oldPosition === b || (i(x, y, b), o({
|
|
848
|
+
undo: () => each(A, ({ _id: _, oldParent: N, oldPosition: w }) => {
|
|
849
|
+
i([_], N, w);
|
|
850
850
|
}),
|
|
851
851
|
redo: () => i(x, y, b)
|
|
852
852
|
}));
|
|
@@ -858,8 +858,8 @@ const undoRedoStateAtom = atom({
|
|
|
858
858
|
});
|
|
859
859
|
},
|
|
860
860
|
removeBlocks: (x) => {
|
|
861
|
-
var
|
|
862
|
-
const y = (
|
|
861
|
+
var E;
|
|
862
|
+
const y = (E = first(x)) == null ? void 0 : E._parent, A = r.filter((_) => y ? _._parent === y : !_._parent).indexOf(first(x));
|
|
863
863
|
l(map(x, "_id")), o({
|
|
864
864
|
undo: () => a(x, y, A),
|
|
865
865
|
redo: () => l(map(x, "_id"))
|
|
@@ -868,17 +868,17 @@ const undoRedoStateAtom = atom({
|
|
|
868
868
|
updateBlocks: (x, y, b) => {
|
|
869
869
|
let A = [];
|
|
870
870
|
if (b)
|
|
871
|
-
A = map(x, (
|
|
871
|
+
A = map(x, (E) => ({ _id: E, ...b }));
|
|
872
872
|
else {
|
|
873
|
-
const
|
|
874
|
-
A = map(x, (
|
|
875
|
-
const N = r.find((k) => k._id ===
|
|
876
|
-
return each(
|
|
873
|
+
const E = keys(y);
|
|
874
|
+
A = map(x, (_) => {
|
|
875
|
+
const N = r.find((k) => k._id === _), w = { _id: _ };
|
|
876
|
+
return each(E, (k) => w[k] = N[k]), w;
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
c(map(x, (
|
|
879
|
+
c(map(x, (E) => ({ _id: E, ...y }))), o({
|
|
880
880
|
undo: () => c(A),
|
|
881
|
-
redo: () => c(map(x, (
|
|
881
|
+
redo: () => c(map(x, (E) => ({ _id: E, ...y })))
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
884
|
updateBlocksRuntime: (x, y) => {
|
|
@@ -893,8 +893,8 @@ const undoRedoStateAtom = atom({
|
|
|
893
893
|
updateMultipleBlocksProps: (x) => {
|
|
894
894
|
let y = [];
|
|
895
895
|
y = map(x, (b) => {
|
|
896
|
-
const A = keys(b),
|
|
897
|
-
return each(A, (N) =>
|
|
896
|
+
const A = keys(b), E = r.find((N) => N._id === b._id), _ = {};
|
|
897
|
+
return each(A, (N) => _[N] = E[N]), _;
|
|
898
898
|
}), c(x), o({
|
|
899
899
|
undo: () => c(y),
|
|
900
900
|
redo: () => c(x)
|
|
@@ -2352,12 +2352,15 @@ function getChildBlocks(o, r, n) {
|
|
|
2352
2352
|
const getBlockWithChildren = (o, r) => {
|
|
2353
2353
|
let n = [];
|
|
2354
2354
|
return n = flattenDeep([...n, ...getChildBlocks(r, o, n)]), n;
|
|
2355
|
-
}, pickOnlyAIProps = (o, r) => compact(
|
|
2356
|
-
o.map((
|
|
2357
|
-
const
|
|
2358
|
-
for (const
|
|
2359
|
-
|
|
2360
|
-
|
|
2355
|
+
}, pickOnlyAIProps = (o, r, n) => compact(
|
|
2356
|
+
o.map((a) => {
|
|
2357
|
+
const l = ["_id", "_type", "_parent"], i = pick(a, l), c = getRegisteredChaiBlock(a._type), d = {}, p = get(c, "aiProps", []);
|
|
2358
|
+
for (const u in a)
|
|
2359
|
+
if (!l.includes(u) && p.includes(u)) {
|
|
2360
|
+
const g = get(a, `${u}-${r}`, ""), h = get(a, u, "");
|
|
2361
|
+
d[u] = isString(g) && g.trim() || h, n && (d[u] = h);
|
|
2362
|
+
}
|
|
2363
|
+
return isEmpty(d) ? !1 : (has(i, "_parent") && isEmpty(i._parent) && delete i._parent, { ...i, ...d });
|
|
2361
2364
|
})
|
|
2362
2365
|
), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
|
|
2363
2366
|
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, f) => {
|
|
@@ -2365,8 +2368,8 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2365
2368
|
for (const y in x) {
|
|
2366
2369
|
const b = x[y];
|
|
2367
2370
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2368
|
-
const { baseClasses: A, classes:
|
|
2369
|
-
x[y] = compact(flattenDeep([A,
|
|
2371
|
+
const { baseClasses: A, classes: E } = getSplitChaiClasses(b);
|
|
2372
|
+
x[y] = compact(flattenDeep([A, E])).join(" ");
|
|
2370
2373
|
} else
|
|
2371
2374
|
y !== "_id" && delete x[y];
|
|
2372
2375
|
}
|
|
@@ -2378,20 +2381,22 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2378
2381
|
if (l) {
|
|
2379
2382
|
r(!0), a(null);
|
|
2380
2383
|
try {
|
|
2381
|
-
const b = p === u ? "" : p
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
+
const b = p === u ? "" : p;
|
|
2385
|
+
console.log("prompt", x);
|
|
2386
|
+
const A = x.toLowerCase().includes("translate the content"), E = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, A) : [h(f, d)], _ = await l(m, addLangToPrompt(x, g, m), E, b), { blocks: N, error: w } = _;
|
|
2387
|
+
if (w) {
|
|
2388
|
+
a(w);
|
|
2384
2389
|
return;
|
|
2385
2390
|
}
|
|
2386
2391
|
if (m === "styles") {
|
|
2387
|
-
const
|
|
2388
|
-
for (const
|
|
2389
|
-
|
|
2390
|
-
return
|
|
2392
|
+
const k = N.map((v) => {
|
|
2393
|
+
for (const B in v)
|
|
2394
|
+
B !== "_id" && (v[B] = `${STYLES_KEY},${v[B]}`);
|
|
2395
|
+
return v;
|
|
2391
2396
|
});
|
|
2392
|
-
c(
|
|
2397
|
+
c(k);
|
|
2393
2398
|
} else
|
|
2394
|
-
i(
|
|
2399
|
+
i(N);
|
|
2395
2400
|
y && y(_);
|
|
2396
2401
|
} catch (b) {
|
|
2397
2402
|
a(b);
|
|
@@ -3596,17 +3601,17 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3596
3601
|
}
|
|
3597
3602
|
), WithBlockTextEditor = memo(
|
|
3598
3603
|
({ block: o, children: r }) => {
|
|
3599
|
-
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: A, blockType:
|
|
3604
|
+
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: A, blockType: E } = useMemo(() => {
|
|
3600
3605
|
var j;
|
|
3601
3606
|
const v = o._type;
|
|
3602
|
-
let
|
|
3607
|
+
let B = o[n];
|
|
3603
3608
|
const S = getRegisteredChaiBlock(o._type);
|
|
3604
|
-
return f && ((j = S == null ? void 0 : S.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (
|
|
3605
|
-
}, [o, f]),
|
|
3609
|
+
return f && ((j = S == null ? void 0 : S.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (B = get(o, `${n}-${f}`)), { blockContent: B, blockType: v };
|
|
3610
|
+
}, [o, f]), _ = useCallback(
|
|
3606
3611
|
(v) => {
|
|
3607
3612
|
var S;
|
|
3608
|
-
const
|
|
3609
|
-
m([b], { [n]:
|
|
3613
|
+
const B = v || ((S = g.current) == null ? void 0 : S.innerText);
|
|
3614
|
+
m([b], { [n]: B }), u(null), c(null), d(-1), x(b ? [b] : []);
|
|
3610
3615
|
},
|
|
3611
3616
|
[b, m, c, x, f]
|
|
3612
3617
|
), N = useDebouncedCallback(
|
|
@@ -3617,9 +3622,9 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3617
3622
|
1e3
|
|
3618
3623
|
), w = useCallback(
|
|
3619
3624
|
(v) => {
|
|
3620
|
-
v.preventDefault(), b && (y.current = b),
|
|
3621
|
-
const
|
|
3622
|
-
y.current = null, x([
|
|
3625
|
+
v.preventDefault(), b && (y.current = b), _(), setTimeout(() => {
|
|
3626
|
+
const B = y.current;
|
|
3627
|
+
y.current = null, x([B]);
|
|
3623
3628
|
}, 100);
|
|
3624
3629
|
},
|
|
3625
3630
|
[x, b, f]
|
|
@@ -3627,16 +3632,16 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3627
3632
|
useEffect(() => {
|
|
3628
3633
|
var C;
|
|
3629
3634
|
if (!b) return;
|
|
3630
|
-
const v = `[data-block-id="${b}"]`,
|
|
3635
|
+
const v = `[data-block-id="${b}"]`, B = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${v}${B}`);
|
|
3631
3636
|
S && ((C = S == null ? void 0 : S.classList) == null || C.add("sr-only"), u(S));
|
|
3632
|
-
}, [b,
|
|
3633
|
-
const k = useMemo(() => p ? (h(),
|
|
3637
|
+
}, [b, E, a, i]);
|
|
3638
|
+
const k = useMemo(() => p ? (h(), E === "RichText" ? /* @__PURE__ */ jsx(
|
|
3634
3639
|
RichTextEditor,
|
|
3635
3640
|
{
|
|
3636
3641
|
blockContent: A,
|
|
3637
3642
|
editingElement: p,
|
|
3638
3643
|
onChange: N,
|
|
3639
|
-
onClose:
|
|
3644
|
+
onClose: _,
|
|
3640
3645
|
onEscape: w
|
|
3641
3646
|
}
|
|
3642
3647
|
) : /* @__PURE__ */ jsx(
|
|
@@ -3645,11 +3650,11 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3645
3650
|
editorRef: g,
|
|
3646
3651
|
blockContent: A,
|
|
3647
3652
|
editingElement: p,
|
|
3648
|
-
onClose:
|
|
3653
|
+
onClose: _,
|
|
3649
3654
|
onChange: N,
|
|
3650
3655
|
onEscape: w
|
|
3651
3656
|
}
|
|
3652
|
-
)) : null, [p, b,
|
|
3657
|
+
)) : null, [p, b, E, A, _, f]);
|
|
3653
3658
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3654
3659
|
k,
|
|
3655
3660
|
r
|
|
@@ -3690,17 +3695,17 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3690
3695
|
key: y
|
|
3691
3696
|
}) : applyLanguage(i, d, c),
|
|
3692
3697
|
[i, d, c, g, m, x, y]
|
|
3693
|
-
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]),
|
|
3698
|
+
), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), E = useMemo(
|
|
3694
3699
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3695
3700
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3696
|
-
),
|
|
3701
|
+
), _ = useMemo(
|
|
3697
3702
|
() => ({
|
|
3698
3703
|
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
|
|
3699
3704
|
inBuilder: !0,
|
|
3700
3705
|
lang: d || p,
|
|
3701
3706
|
...b,
|
|
3702
3707
|
...A,
|
|
3703
|
-
...
|
|
3708
|
+
...E,
|
|
3704
3709
|
...o
|
|
3705
3710
|
}),
|
|
3706
3711
|
[
|
|
@@ -3710,13 +3715,13 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3710
3715
|
p,
|
|
3711
3716
|
b,
|
|
3712
3717
|
A,
|
|
3713
|
-
|
|
3718
|
+
E,
|
|
3714
3719
|
o
|
|
3715
3720
|
]
|
|
3716
3721
|
), N = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3717
3722
|
if (isNull(f) || h.includes(i._id)) return null;
|
|
3718
3723
|
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
3719
|
-
...
|
|
3724
|
+
..._,
|
|
3720
3725
|
children: n({
|
|
3721
3726
|
_id: i._id,
|
|
3722
3727
|
_type: i._type,
|
|
@@ -4028,15 +4033,15 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4028
4033
|
const b = isArray(y) ? first(y) : y;
|
|
4029
4034
|
if (b) {
|
|
4030
4035
|
r(b == null ? void 0 : b.url);
|
|
4031
|
-
const A = b == null ? void 0 : b.width,
|
|
4036
|
+
const A = b == null ? void 0 : b.width, E = b == null ? void 0 : b.height;
|
|
4032
4037
|
if (c != null && c._id) {
|
|
4033
|
-
const
|
|
4038
|
+
const _ = {
|
|
4034
4039
|
...A && { width: A },
|
|
4035
|
-
...
|
|
4040
|
+
...E && { height: E },
|
|
4036
4041
|
...b.description && { alt: b.description }
|
|
4037
4042
|
};
|
|
4038
|
-
if (set(
|
|
4039
|
-
d([c._id],
|
|
4043
|
+
if (set(_, u, b.id), isEmpty(_)) return;
|
|
4044
|
+
d([c._id], _);
|
|
4040
4045
|
}
|
|
4041
4046
|
}
|
|
4042
4047
|
}, x = useCallback(() => {
|
|
@@ -4203,12 +4208,12 @@ const DataBindingSelector = ({
|
|
|
4203
4208
|
r(`{{${g}}}`, {}, n);
|
|
4204
4209
|
return;
|
|
4205
4210
|
}
|
|
4206
|
-
const m = (b) => /[.,!?;:]/.test(b), f = (b, A,
|
|
4207
|
-
let
|
|
4211
|
+
const m = (b) => /[.,!?;:]/.test(b), f = (b, A, E) => {
|
|
4212
|
+
let _ = "", N = "";
|
|
4208
4213
|
const w = A > 0 ? b[A - 1] : "", k = A < b.length ? b[A] : "";
|
|
4209
|
-
return A > 0 && (w === "." || !m(w) && w !== " ") && (
|
|
4210
|
-
text:
|
|
4211
|
-
prefixLength:
|
|
4214
|
+
return A > 0 && (w === "." || !m(w) && w !== " ") && (_ = " "), A < b.length && !m(k) && k !== " " && (N = " "), {
|
|
4215
|
+
text: _ + E + N,
|
|
4216
|
+
prefixLength: _.length,
|
|
4212
4217
|
suffixLength: N.length
|
|
4213
4218
|
};
|
|
4214
4219
|
}, x = document.getElementById(n);
|
|
@@ -4219,27 +4224,27 @@ const DataBindingSelector = ({
|
|
|
4219
4224
|
if (b) {
|
|
4220
4225
|
const A = `{{${g}}}`;
|
|
4221
4226
|
b.commands.focus();
|
|
4222
|
-
const { from:
|
|
4223
|
-
if (
|
|
4227
|
+
const { from: E, to: _ } = b.state.selection;
|
|
4228
|
+
if (E !== _)
|
|
4224
4229
|
b.chain().deleteSelection().insertContent(A).run();
|
|
4225
4230
|
else {
|
|
4226
|
-
const { state: w } = b, k = w.selection.from, v = w.doc.textBetween(Math.max(0, k - 1), k),
|
|
4231
|
+
const { state: w } = b, k = w.selection.from, v = w.doc.textBetween(Math.max(0, k - 1), k), B = w.doc.textBetween(k, Math.min(k + 1, w.doc.content.size));
|
|
4227
4232
|
let S = "";
|
|
4228
4233
|
k > 0 && v !== " " && !m(v) && (S = " ");
|
|
4229
4234
|
let C = "";
|
|
4230
|
-
|
|
4235
|
+
B && B !== " " && !m(B) && (C = " "), b.chain().insertContent(S + A + C).run();
|
|
4231
4236
|
}
|
|
4232
4237
|
setTimeout(() => r(b.getHTML(), {}, n), 100);
|
|
4233
4238
|
return;
|
|
4234
4239
|
}
|
|
4235
4240
|
} else {
|
|
4236
|
-
const b = x, A = b.selectionStart || 0,
|
|
4237
|
-
if (
|
|
4238
|
-
const
|
|
4241
|
+
const b = x, A = b.selectionStart || 0, E = b.value || "", _ = b.selectionEnd || A;
|
|
4242
|
+
if (_ > A) {
|
|
4243
|
+
const B = `{{${g}}}`, { text: S } = f(E, A, B), C = E.slice(0, A) + S + E.slice(_);
|
|
4239
4244
|
r(C, {}, n);
|
|
4240
4245
|
return;
|
|
4241
4246
|
}
|
|
4242
|
-
const w = `{{${g}}}`, { text: k } = f(
|
|
4247
|
+
const w = `{{${g}}}`, { text: k } = f(E, A, w), v = E.slice(0, A) + k + E.slice(A);
|
|
4243
4248
|
r(v, {}, n);
|
|
4244
4249
|
}
|
|
4245
4250
|
},
|
|
@@ -4261,8 +4266,8 @@ const DataBindingSelector = ({
|
|
|
4261
4266
|
pageTypes: r,
|
|
4262
4267
|
onChange: n
|
|
4263
4268
|
}) => {
|
|
4264
|
-
var
|
|
4265
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), A = useRef(null),
|
|
4269
|
+
var B;
|
|
4270
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), A = useRef(null), E = (B = r == null ? void 0 : r.find((S) => S.key === u)) == null ? void 0 : B.name;
|
|
4266
4271
|
useEffect(() => {
|
|
4267
4272
|
if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4268
4273
|
const S = split(o, ":"), C = get(S, 1, "page") || "page";
|
|
@@ -4271,7 +4276,7 @@ const DataBindingSelector = ({
|
|
|
4271
4276
|
j && Array.isArray(j) && m(get(j, [0, "name"], ""));
|
|
4272
4277
|
})();
|
|
4273
4278
|
}, [o]);
|
|
4274
|
-
const
|
|
4279
|
+
const _ = useDebouncedCallback(
|
|
4275
4280
|
async (S) => {
|
|
4276
4281
|
if (isEmpty(S))
|
|
4277
4282
|
x([]);
|
|
@@ -4312,7 +4317,7 @@ const DataBindingSelector = ({
|
|
|
4312
4317
|
const k = () => {
|
|
4313
4318
|
m(""), x([]), b(-1), p(!1), n("");
|
|
4314
4319
|
}, v = (S) => {
|
|
4315
|
-
m(S), p(!isEmpty(S)), c(!0),
|
|
4320
|
+
m(S), p(!isEmpty(S)), c(!0), _(S);
|
|
4316
4321
|
};
|
|
4317
4322
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4318
4323
|
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(r, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
|
|
@@ -4324,7 +4329,7 @@ const DataBindingSelector = ({
|
|
|
4324
4329
|
value: h,
|
|
4325
4330
|
onChange: (S) => v(S.target.value),
|
|
4326
4331
|
onKeyDown: w,
|
|
4327
|
-
placeholder: a(`Search ${
|
|
4332
|
+
placeholder: a(`Search ${E ?? ""}`),
|
|
4328
4333
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4329
4334
|
}
|
|
4330
4335
|
),
|
|
@@ -4657,11 +4662,11 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4657
4662
|
if (f !== x)
|
|
4658
4663
|
u.chain().deleteSelection().insertContent(m).run();
|
|
4659
4664
|
else {
|
|
4660
|
-
const { state: b } = u, A = b.selection.from,
|
|
4665
|
+
const { state: b } = u, A = b.selection.from, E = b.doc.textBetween(Math.max(0, A - 1), A), _ = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
|
|
4661
4666
|
let N = "";
|
|
4662
|
-
A > 0 &&
|
|
4667
|
+
A > 0 && E !== " " && !/[.,!?;:]/.test(E) && (N = " ");
|
|
4663
4668
|
let w = "";
|
|
4664
|
-
|
|
4669
|
+
_ && _ !== " " && !/[.,!?;:]/.test(_) && (w = " "), u.chain().insertContent(N + m + w).run();
|
|
4665
4670
|
}
|
|
4666
4671
|
};
|
|
4667
4672
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && r(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4961,25 +4966,25 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4961
4966
|
const { selectedLang: h, fallbackLang: m, languages: f } = useLanguages(), x = useMemo(
|
|
4962
4967
|
() => isEmpty(f) ? "" : isEmpty(h) ? m : h,
|
|
4963
4968
|
[f, h, m]
|
|
4964
|
-
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), A = useSelectedBlock(),
|
|
4965
|
-
() => get(
|
|
4966
|
-
[
|
|
4969
|
+
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), A = useSelectedBlock(), E = useRegisteredChaiBlocks(), _ = useMemo(
|
|
4970
|
+
() => get(E, [A == null ? void 0 : A._type, "i18nProps"], []),
|
|
4971
|
+
[E, A == null ? void 0 : A._type]
|
|
4967
4972
|
), [N, w] = useState(null);
|
|
4968
4973
|
if (c)
|
|
4969
4974
|
return null;
|
|
4970
4975
|
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
|
|
4971
|
-
const v =
|
|
4976
|
+
const v = _ == null ? void 0 : _.includes(o.replace("root.", ""));
|
|
4972
4977
|
if (p.type === "array") {
|
|
4973
|
-
const
|
|
4978
|
+
const B = N === o;
|
|
4974
4979
|
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
4975
4980
|
p.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
|
|
4976
4981
|
"label",
|
|
4977
4982
|
{
|
|
4978
4983
|
htmlFor: o,
|
|
4979
|
-
onClick: () => w(
|
|
4984
|
+
onClick: () => w(B ? null : o),
|
|
4980
4985
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4981
4986
|
children: [
|
|
4982
|
-
|
|
4987
|
+
B ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4983
4988
|
/* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
|
|
4984
4989
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: n }),
|
|
4985
4990
|
" ",
|
|
@@ -4998,7 +5003,7 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4998
5003
|
]
|
|
4999
5004
|
}
|
|
5000
5005
|
) }),
|
|
5001
|
-
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${
|
|
5006
|
+
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${B ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
5002
5007
|
a,
|
|
5003
5008
|
l,
|
|
5004
5009
|
i
|
|
@@ -5026,8 +5031,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5026
5031
|
DataBindingSelector,
|
|
5027
5032
|
{
|
|
5028
5033
|
schema: p,
|
|
5029
|
-
onChange: (
|
|
5030
|
-
g(
|
|
5034
|
+
onChange: (B) => {
|
|
5035
|
+
g(B, u, o);
|
|
5031
5036
|
},
|
|
5032
5037
|
id: o,
|
|
5033
5038
|
formData: u
|
|
@@ -5144,21 +5149,21 @@ function BlockSettings() {
|
|
|
5144
5149
|
k && (n([r._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5145
5150
|
}, b = ({ formData: w }, k) => {
|
|
5146
5151
|
k && (n([g._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5147
|
-
}, { schema: A, uiSchema:
|
|
5152
|
+
}, { schema: A, uiSchema: E } = useMemo(() => {
|
|
5148
5153
|
const w = r == null ? void 0 : r._type;
|
|
5149
5154
|
if (!w)
|
|
5150
5155
|
return { schema: {}, uiSchema: {} };
|
|
5151
5156
|
try {
|
|
5152
5157
|
const { schema: k, uiSchema: v } = getBlockFormSchemas(w);
|
|
5153
5158
|
if (w === "Repeater") {
|
|
5154
|
-
const
|
|
5155
|
-
startsWith(
|
|
5159
|
+
const B = get(r, "repeaterItems", "");
|
|
5160
|
+
startsWith(B, `{{${COLLECTION_PREFIX}`) ? (set(v, "filter", { "ui:widget": "collectionSelect" }), set(v, "sort", { "ui:widget": "collectionSelect" })) : (set(v, "filter", { "ui:widget": "hidden" }), set(v, "sort", { "ui:widget": "hidden" }));
|
|
5156
5161
|
}
|
|
5157
5162
|
return { schema: k, uiSchema: v };
|
|
5158
5163
|
} catch {
|
|
5159
5164
|
return { schema: {}, uiSchema: {} };
|
|
5160
5165
|
}
|
|
5161
|
-
}, [r]), { wrapperSchema:
|
|
5166
|
+
}, [r]), { wrapperSchema: _, wrapperUiSchema: N } = useMemo(() => {
|
|
5162
5167
|
if (!g || !(g != null && g._type))
|
|
5163
5168
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5164
5169
|
const w = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: v = {} } = getBlockFormSchemas(w);
|
|
@@ -5190,7 +5195,7 @@ function BlockSettings() {
|
|
|
5190
5195
|
blockId: g == null ? void 0 : g._id,
|
|
5191
5196
|
onChange: b,
|
|
5192
5197
|
formData: m,
|
|
5193
|
-
schema:
|
|
5198
|
+
schema: _,
|
|
5194
5199
|
uiSchema: N
|
|
5195
5200
|
}
|
|
5196
5201
|
) })
|
|
@@ -5202,7 +5207,7 @@ function BlockSettings() {
|
|
|
5202
5207
|
onChange: y,
|
|
5203
5208
|
formData: i,
|
|
5204
5209
|
schema: A,
|
|
5205
|
-
uiSchema:
|
|
5210
|
+
uiSchema: E
|
|
5206
5211
|
}
|
|
5207
5212
|
)
|
|
5208
5213
|
] });
|
|
@@ -5413,7 +5418,7 @@ const BlockStylingProps = () => {
|
|
|
5413
5418
|
},
|
|
5414
5419
|
a
|
|
5415
5420
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5416
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [A,
|
|
5421
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [A, E] = useState(!1), [_, N] = useState(!1);
|
|
5417
5422
|
useEffect(() => {
|
|
5418
5423
|
const { value: S, unit: C } = getClassValueAndUnit(i);
|
|
5419
5424
|
if (C === "") {
|
|
@@ -5440,7 +5445,7 @@ const BlockStylingProps = () => {
|
|
|
5440
5445
|
S ? k(T) : w(T);
|
|
5441
5446
|
},
|
|
5442
5447
|
[w, k, a, h, d, u]
|
|
5443
|
-
),
|
|
5448
|
+
), B = useCallback(
|
|
5444
5449
|
(S) => {
|
|
5445
5450
|
const C = getUserInputValues(`${a}`, u);
|
|
5446
5451
|
if (get(C, "error", !1)) {
|
|
@@ -5491,7 +5496,7 @@ const BlockStylingProps = () => {
|
|
|
5491
5496
|
k(R);
|
|
5492
5497
|
},
|
|
5493
5498
|
onKeyUp: (S) => {
|
|
5494
|
-
|
|
5499
|
+
_ && (S.preventDefault(), N(!1));
|
|
5495
5500
|
},
|
|
5496
5501
|
onBlur: () => v(),
|
|
5497
5502
|
onChange: (S) => {
|
|
@@ -5527,7 +5532,7 @@ const BlockStylingProps = () => {
|
|
|
5527
5532
|
units: u,
|
|
5528
5533
|
current: h,
|
|
5529
5534
|
onSelect: (S) => {
|
|
5530
|
-
n(!1), m(S),
|
|
5535
|
+
n(!1), m(S), B(S);
|
|
5531
5536
|
}
|
|
5532
5537
|
}
|
|
5533
5538
|
) })
|
|
@@ -5536,9 +5541,9 @@ const BlockStylingProps = () => {
|
|
|
5536
5541
|
["none", "auto"].indexOf(h) !== -1 || A ? null : /* @__PURE__ */ jsx(
|
|
5537
5542
|
DragStyleButton,
|
|
5538
5543
|
{
|
|
5539
|
-
onDragStart: () =>
|
|
5544
|
+
onDragStart: () => E(!0),
|
|
5540
5545
|
onDragEnd: (S) => {
|
|
5541
|
-
if (b(() => ""),
|
|
5546
|
+
if (b(() => ""), E(!1), isEmpty(S))
|
|
5542
5547
|
return;
|
|
5543
5548
|
const C = `${S}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5544
5549
|
w(I);
|
|
@@ -6013,21 +6018,21 @@ const COLOR_PROP = {
|
|
|
6013
6018
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6014
6019
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
|
|
6015
6020
|
(k, v = !0) => {
|
|
6016
|
-
const
|
|
6017
|
-
(p || u !== "") && (
|
|
6018
|
-
const S = generateFullClsName(
|
|
6021
|
+
const B = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
|
|
6022
|
+
(p || u !== "") && (B.mq = "xs");
|
|
6023
|
+
const S = generateFullClsName(B);
|
|
6019
6024
|
m(x, [S], v);
|
|
6020
6025
|
},
|
|
6021
6026
|
[x, p, g, u, l, m]
|
|
6022
6027
|
), A = useCallback(() => {
|
|
6023
6028
|
f(x, [y], !0);
|
|
6024
|
-
}, [x, y, f]),
|
|
6029
|
+
}, [x, y, f]), E = useMemo(() => canChangeClass(h, g), [h, g]);
|
|
6025
6030
|
useEffect(() => {
|
|
6026
|
-
i(
|
|
6027
|
-
}, [
|
|
6028
|
-
const [, ,
|
|
6031
|
+
i(E, h);
|
|
6032
|
+
}, [E, i, h]);
|
|
6033
|
+
const [, , _] = useScreenSizeWidth(), N = useCallback(
|
|
6029
6034
|
(k) => {
|
|
6030
|
-
|
|
6035
|
+
_({
|
|
6031
6036
|
xs: 400,
|
|
6032
6037
|
sm: 640,
|
|
6033
6038
|
md: 800,
|
|
@@ -6036,9 +6041,9 @@ const COLOR_PROP = {
|
|
|
6036
6041
|
"2xl": 1920
|
|
6037
6042
|
}[k]);
|
|
6038
6043
|
},
|
|
6039
|
-
[
|
|
6044
|
+
[_]
|
|
6040
6045
|
), w = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
|
|
6041
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6046
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: E, canReset: h && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6042
6047
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !w ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
6043
6048
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6044
6049
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6058,7 +6063,7 @@ const COLOR_PROP = {
|
|
|
6058
6063
|
n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6059
6064
|
n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6060
6065
|
] }),
|
|
6061
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) :
|
|
6066
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : E && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6062
6067
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6063
6068
|
"button",
|
|
6064
6069
|
{
|
|
@@ -6459,10 +6464,10 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6459
6464
|
};
|
|
6460
6465
|
function ManualClasses() {
|
|
6461
6466
|
var I;
|
|
6462
|
-
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), A = b.split(" ").filter((T) => !isEmpty(T)),
|
|
6467
|
+
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), A = b.split(" ").filter((T) => !isEmpty(T)), E = () => {
|
|
6463
6468
|
const T = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6464
6469
|
u(h, T, !0), x("");
|
|
6465
|
-
}, [
|
|
6470
|
+
}, [_, N] = useState([]), w = ({ value: T }) => {
|
|
6466
6471
|
const R = T.trim().toLowerCase(), L = R.match(/.+:/g);
|
|
6467
6472
|
let D = [];
|
|
6468
6473
|
if (L && L.length > 0) {
|
|
@@ -6476,7 +6481,7 @@ function ManualClasses() {
|
|
|
6476
6481
|
return N(map(D, "item"));
|
|
6477
6482
|
}, k = () => {
|
|
6478
6483
|
N([]);
|
|
6479
|
-
}, v = (T) => T.name,
|
|
6484
|
+
}, v = (T) => T.name, B = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), S = useMemo(
|
|
6480
6485
|
() => ({
|
|
6481
6486
|
ref: o,
|
|
6482
6487
|
autoComplete: "off",
|
|
@@ -6491,7 +6496,7 @@ function ManualClasses() {
|
|
|
6491
6496
|
}, 0);
|
|
6492
6497
|
},
|
|
6493
6498
|
onKeyDown: (T) => {
|
|
6494
|
-
T.key === "Enter" && f.trim() !== "" &&
|
|
6499
|
+
T.key === "Enter" && f.trim() !== "" && E();
|
|
6495
6500
|
},
|
|
6496
6501
|
onChange: (T, { newValue: R }) => x(R),
|
|
6497
6502
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -6529,11 +6534,11 @@ function ManualClasses() {
|
|
|
6529
6534
|
/* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
|
|
6530
6535
|
Autosuggest,
|
|
6531
6536
|
{
|
|
6532
|
-
suggestions:
|
|
6537
|
+
suggestions: _,
|
|
6533
6538
|
onSuggestionsFetchRequested: w,
|
|
6534
6539
|
onSuggestionsClearRequested: k,
|
|
6535
6540
|
getSuggestionValue: v,
|
|
6536
|
-
renderSuggestion:
|
|
6541
|
+
renderSuggestion: B,
|
|
6537
6542
|
inputProps: S,
|
|
6538
6543
|
containerProps: {
|
|
6539
6544
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
@@ -6550,7 +6555,7 @@ function ManualClasses() {
|
|
|
6550
6555
|
{
|
|
6551
6556
|
variant: "outline",
|
|
6552
6557
|
className: "h-6 border-border",
|
|
6553
|
-
onClick:
|
|
6558
|
+
onClick: E,
|
|
6554
6559
|
disabled: f.trim() === "",
|
|
6555
6560
|
size: "sm",
|
|
6556
6561
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
@@ -7013,7 +7018,7 @@ const CoreBlock = ({
|
|
|
7013
7018
|
}
|
|
7014
7019
|
}
|
|
7015
7020
|
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
7016
|
-
var h, m, f, x, y, b, A,
|
|
7021
|
+
var h, m, f, x, y, b, A, E, _, N;
|
|
7017
7022
|
if (n.type === "comment") return [];
|
|
7018
7023
|
let a = { _id: generateUUID() };
|
|
7019
7024
|
if (r && (a._parent = r.block._id), n.type === "text")
|
|
@@ -7069,14 +7074,14 @@ const CoreBlock = ({
|
|
|
7069
7074
|
a.content = getTextContent(w);
|
|
7070
7075
|
const k = find(
|
|
7071
7076
|
n.children || [],
|
|
7072
|
-
(v) => (v == null ? void 0 : v.tagName) === "span" && some(v.children || [], (
|
|
7077
|
+
(v) => (v == null ? void 0 : v.tagName) === "span" && some(v.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg")
|
|
7073
7078
|
);
|
|
7074
7079
|
if (k) {
|
|
7075
|
-
const v = find(k.children || [], (
|
|
7080
|
+
const v = find(k.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg");
|
|
7076
7081
|
if (v) {
|
|
7077
7082
|
a.icon = stringify([v]);
|
|
7078
|
-
const { height:
|
|
7079
|
-
a.iconHeight =
|
|
7083
|
+
const { height: B, width: S } = getSvgDimensions(v, "16px", "16px");
|
|
7084
|
+
a.iconHeight = B, a.iconWidth = S;
|
|
7080
7085
|
}
|
|
7081
7086
|
}
|
|
7082
7087
|
return [a];
|
|
@@ -7092,10 +7097,10 @@ const CoreBlock = ({
|
|
|
7092
7097
|
if (k && v)
|
|
7093
7098
|
a.styles = `${STYLES_KEY}, ${cn$2(`w-${v} h-${k}`, w)}`.trim(), a.height = k == null ? void 0 : k.replace("px", ""), a.width = v == null ? void 0 : v.replace("px", "");
|
|
7094
7099
|
else {
|
|
7095
|
-
const
|
|
7096
|
-
|
|
7100
|
+
const B = (E = find(n.attributes, { key: "height" })) == null ? void 0 : E.value, S = (_ = find(n.attributes, { key: "width" })) == null ? void 0 : _.value;
|
|
7101
|
+
B && S ? (a.styles = `${STYLES_KEY}, ${cn$2(`w-[${S}px] h-[${B}px]`, w)}`.trim(), a.height = B, a.width = S) : a.styles = `${STYLES_KEY}, ${cn$2("w-full h-full", w)}`.trim();
|
|
7097
7102
|
}
|
|
7098
|
-
return n.attributes = filter(n.attributes, (
|
|
7103
|
+
return n.attributes = filter(n.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([n]), [a];
|
|
7099
7104
|
} else if (n.tagName == "option" && r && ((N = r.block) == null ? void 0 : N._type) === "Select")
|
|
7100
7105
|
return r.block.options.push({
|
|
7101
7106
|
label: getTextContent(n.children),
|
|
@@ -7212,18 +7217,18 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7212
7217
|
parentId: n = void 0,
|
|
7213
7218
|
position: a = -1
|
|
7214
7219
|
}) => {
|
|
7215
|
-
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (
|
|
7216
|
-
const
|
|
7217
|
-
return
|
|
7220
|
+
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (E) => {
|
|
7221
|
+
const _ = has(E, "styles_attrs.data-page-section");
|
|
7222
|
+
return E._type === "Box" && _;
|
|
7218
7223
|
}, b = useCallback(
|
|
7219
|
-
async (
|
|
7220
|
-
if (
|
|
7224
|
+
async (E) => {
|
|
7225
|
+
if (E.stopPropagation(), has(o, "component")) {
|
|
7221
7226
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7222
7227
|
return;
|
|
7223
7228
|
}
|
|
7224
7229
|
i(!0);
|
|
7225
|
-
let
|
|
7226
|
-
typeof
|
|
7230
|
+
let _ = await c({ library: r, block: o });
|
|
7231
|
+
typeof _ == "string" && (_ = getBlocksFromHTML(_)), isEmpty(_) || p(syncBlocksWithDefaults(_), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7227
7232
|
},
|
|
7228
7233
|
[d, p, o, c, r, n, a]
|
|
7229
7234
|
);
|
|
@@ -7234,18 +7239,18 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7234
7239
|
onClick: l ? () => {
|
|
7235
7240
|
} : b,
|
|
7236
7241
|
draggable: f ? "true" : "false",
|
|
7237
|
-
onDragStart: async (
|
|
7238
|
-
const
|
|
7242
|
+
onDragStart: async (E) => {
|
|
7243
|
+
const _ = await c({ library: r, block: o });
|
|
7239
7244
|
let N = n;
|
|
7240
|
-
if (y(first(
|
|
7241
|
-
const w = { blocks:
|
|
7242
|
-
if (
|
|
7245
|
+
if (y(first(_)) && (N = null), !isEmpty(_)) {
|
|
7246
|
+
const w = { blocks: _, uiLibrary: !0, parent: N };
|
|
7247
|
+
if (E.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
7243
7248
|
const k = new Image();
|
|
7244
7249
|
k.src = o.preview, k.onload = () => {
|
|
7245
|
-
|
|
7250
|
+
E.dataTransfer.setDragImage(k, 0, 0);
|
|
7246
7251
|
};
|
|
7247
7252
|
} else
|
|
7248
|
-
|
|
7253
|
+
E.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7249
7254
|
x(w), setTimeout(() => {
|
|
7250
7255
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7251
7256
|
}, 200);
|
|
@@ -7298,9 +7303,9 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7298
7303
|
return;
|
|
7299
7304
|
}
|
|
7300
7305
|
}, [y, b]);
|
|
7301
|
-
const
|
|
7302
|
-
|
|
7303
|
-
|
|
7306
|
+
const E = get(y, b, []), _ = useRef(null), { t: N } = useTranslation(), w = (C) => {
|
|
7307
|
+
_.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
|
|
7308
|
+
_.current && A(C);
|
|
7304
7309
|
}, 400);
|
|
7305
7310
|
}, k = () => {
|
|
7306
7311
|
i != null && i.id && p(i.id);
|
|
@@ -7312,7 +7317,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7312
7317
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7313
7318
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7314
7319
|
] });
|
|
7315
|
-
const
|
|
7320
|
+
const B = filter(E, (C, j) => j % 2 === 0), S = filter(E, (C, j) => j % 2 === 1);
|
|
7316
7321
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7317
7322
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7318
7323
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7350,7 +7355,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7350
7355
|
"div",
|
|
7351
7356
|
{
|
|
7352
7357
|
onMouseEnter: () => w(j),
|
|
7353
|
-
onMouseLeave: () => clearTimeout(
|
|
7358
|
+
onMouseLeave: () => clearTimeout(_.current),
|
|
7354
7359
|
role: "button",
|
|
7355
7360
|
onClick: () => A(j),
|
|
7356
7361
|
className: cn$2(
|
|
@@ -7369,11 +7374,11 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7369
7374
|
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
|
|
7370
7375
|
ScrollArea,
|
|
7371
7376
|
{
|
|
7372
|
-
onMouseEnter: () =>
|
|
7377
|
+
onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
|
|
7373
7378
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7374
7379
|
children: [
|
|
7375
|
-
isEmpty(
|
|
7376
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7380
|
+
isEmpty(E) && !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: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7381
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: B.map((C, j) => /* @__PURE__ */ jsx(
|
|
7377
7382
|
BlockCard,
|
|
7378
7383
|
{
|
|
7379
7384
|
parentId: o,
|
|
@@ -7428,14 +7433,14 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7428
7433
|
}), g(!0);
|
|
7429
7434
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7430
7435
|
const m = Object.entries(a).map(([x, y]) => {
|
|
7431
|
-
const b = y, A = b.type || "partial",
|
|
7436
|
+
const b = y, A = b.type || "partial", E = formatReadableName(A);
|
|
7432
7437
|
return {
|
|
7433
7438
|
type: "PartialBlock",
|
|
7434
7439
|
// Set the type to PartialBlock
|
|
7435
7440
|
label: formatReadableName(b.name || x),
|
|
7436
7441
|
description: b.description || "",
|
|
7437
7442
|
icon: Globe,
|
|
7438
|
-
group:
|
|
7443
|
+
group: E,
|
|
7439
7444
|
// Use formatted type as group
|
|
7440
7445
|
category: "partial",
|
|
7441
7446
|
partialBlockId: x,
|
|
@@ -7507,9 +7512,9 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7507
7512
|
}), []);
|
|
7508
7513
|
const A = useCallback((C) => {
|
|
7509
7514
|
y(C), b.current && b.current(C);
|
|
7510
|
-
}, []),
|
|
7515
|
+
}, []), E = useCallback(() => {
|
|
7511
7516
|
y(null), b.current && b.current.cancel();
|
|
7512
|
-
}, []),
|
|
7517
|
+
}, []), _ = useCallback((C) => {
|
|
7513
7518
|
b.current && b.current.cancel(), f(C), y(null);
|
|
7514
7519
|
}, []), N = useMemo(
|
|
7515
7520
|
() => d ? values(r).filter(
|
|
@@ -7527,7 +7532,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7527
7532
|
), k = useMemo(
|
|
7528
7533
|
() => sortBy(w, (C) => CORE_GROUPS.indexOf(C) === -1 ? 99 : CORE_GROUPS.indexOf(C)),
|
|
7529
7534
|
[w]
|
|
7530
|
-
), v = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]),
|
|
7535
|
+
), v = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), B = useMemo(() => m === "all" ? k : [m], [k, m]);
|
|
7531
7536
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7532
7537
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7533
7538
|
Input$1,
|
|
@@ -7545,9 +7550,9 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7545
7550
|
/* @__PURE__ */ jsx(
|
|
7546
7551
|
"button",
|
|
7547
7552
|
{
|
|
7548
|
-
onClick: () =>
|
|
7553
|
+
onClick: () => _("all"),
|
|
7549
7554
|
onMouseEnter: () => A("all"),
|
|
7550
|
-
onMouseLeave:
|
|
7555
|
+
onMouseLeave: E,
|
|
7551
7556
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7552
7557
|
children: i("All")
|
|
7553
7558
|
},
|
|
@@ -7556,9 +7561,9 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7556
7561
|
k.map((C) => /* @__PURE__ */ jsx(
|
|
7557
7562
|
"button",
|
|
7558
7563
|
{
|
|
7559
|
-
onClick: () =>
|
|
7564
|
+
onClick: () => _(C),
|
|
7560
7565
|
onMouseEnter: () => A(C),
|
|
7561
|
-
onMouseLeave:
|
|
7566
|
+
onMouseLeave: E,
|
|
7562
7567
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === C || x === C ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7563
7568
|
children: capitalize(i(C.toLowerCase()))
|
|
7564
7569
|
},
|
|
@@ -7570,7 +7575,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7570
7575
|
' "',
|
|
7571
7576
|
d,
|
|
7572
7577
|
'"'
|
|
7573
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children:
|
|
7578
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: B.map((C) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7574
7579
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(C.toLowerCase())) }),
|
|
7575
7580
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7576
7581
|
m === "all" ? filter(values(v), { group: C }) : values(v),
|
|
@@ -7938,19 +7943,19 @@ const Input = ({ node: o }) => {
|
|
|
7938
7943
|
var R;
|
|
7939
7944
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7940
7945
|
let p = null;
|
|
7941
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: A, handleClick:
|
|
7946
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: A, handleClick: E } = o, _ = (L) => {
|
|
7942
7947
|
L.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7943
7948
|
}, N = (L) => {
|
|
7944
7949
|
L.isInternal && (p = L.isOpen, L.isOpen && L.close());
|
|
7945
7950
|
}, w = (L) => {
|
|
7946
7951
|
L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
|
|
7947
|
-
}, [k, v] = useAtom$1(currentAddSelection),
|
|
7952
|
+
}, [k, v] = useAtom$1(currentAddSelection), B = () => {
|
|
7948
7953
|
var L;
|
|
7949
7954
|
S(), o.parent.isSelected || v((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
|
|
7950
7955
|
}, S = () => {
|
|
7951
7956
|
v(null);
|
|
7952
7957
|
}, C = (L) => {
|
|
7953
|
-
S(), L.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(),
|
|
7958
|
+
S(), L.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), E(L);
|
|
7954
7959
|
};
|
|
7955
7960
|
useEffect(() => {
|
|
7956
7961
|
const L = setTimeout(() => {
|
|
@@ -8014,7 +8019,7 @@ const Input = ({ node: o }) => {
|
|
|
8014
8019
|
onClick: (L) => {
|
|
8015
8020
|
L.stopPropagation(), I(o.childIndex);
|
|
8016
8021
|
},
|
|
8017
|
-
onMouseEnter:
|
|
8022
|
+
onMouseEnter: B,
|
|
8018
8023
|
onMouseLeave: S,
|
|
8019
8024
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-primary opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
8020
8025
|
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 p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[4] text-white" }) })
|
|
@@ -8038,7 +8043,7 @@ const Input = ({ node: o }) => {
|
|
|
8038
8043
|
"div",
|
|
8039
8044
|
{
|
|
8040
8045
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
8041
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick:
|
|
8046
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
|
|
8042
8047
|
}
|
|
8043
8048
|
),
|
|
8044
8049
|
/* @__PURE__ */ jsxs(
|
|
@@ -8410,7 +8415,7 @@ const Input = ({ node: o }) => {
|
|
|
8410
8415
|
},
|
|
8411
8416
|
[g],
|
|
8412
8417
|
200
|
|
8413
|
-
),
|
|
8418
|
+
), E = React.useCallback(
|
|
8414
8419
|
(w) => {
|
|
8415
8420
|
h(() => ({
|
|
8416
8421
|
...g,
|
|
@@ -8418,7 +8423,7 @@ const Input = ({ node: o }) => {
|
|
|
8418
8423
|
}));
|
|
8419
8424
|
},
|
|
8420
8425
|
[g]
|
|
8421
|
-
),
|
|
8426
|
+
), _ = useDebouncedCallback(
|
|
8422
8427
|
(w, k) => {
|
|
8423
8428
|
h(() => {
|
|
8424
8429
|
const v = get(g, `colors.${w}`);
|
|
@@ -8440,10 +8445,10 @@ const Input = ({ node: o }) => {
|
|
|
8440
8445
|
ColorPickerInput,
|
|
8441
8446
|
{
|
|
8442
8447
|
value: v,
|
|
8443
|
-
onChange: (
|
|
8448
|
+
onChange: (B) => _(k, B)
|
|
8444
8449
|
}
|
|
8445
8450
|
),
|
|
8446
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((
|
|
8451
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((B) => B.charAt(0).toUpperCase() + B.slice(1)).join(" ") + (!k.toLowerCase().includes("foreground") && !k.toLowerCase().includes("border") && !k.toLowerCase().includes("input") && !k.toLowerCase().includes("ring") && !k.toLowerCase().includes("background") ? " Background" : "") })
|
|
8447
8452
|
] }, k) : null;
|
|
8448
8453
|
}) });
|
|
8449
8454
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
@@ -8491,7 +8496,7 @@ const Input = ({ node: o }) => {
|
|
|
8491
8496
|
] }),
|
|
8492
8497
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
8493
8498
|
] }),
|
|
8494
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange:
|
|
8499
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: E }) })
|
|
8495
8500
|
] }),
|
|
8496
8501
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8497
8502
|
(m == null ? void 0 : m.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
@@ -9250,19 +9255,19 @@ function AIChatPanel() {
|
|
|
9250
9255
|
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.",
|
|
9251
9256
|
timestamp: /* @__PURE__ */ new Date()
|
|
9252
9257
|
};
|
|
9253
|
-
r((
|
|
9258
|
+
r((E) => [...E, A]), i(!1), d(null);
|
|
9254
9259
|
}, 1500);
|
|
9255
9260
|
}, m = (b) => {
|
|
9256
9261
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
|
|
9257
9262
|
}, f = (b) => {
|
|
9258
|
-
var
|
|
9259
|
-
const A = (
|
|
9263
|
+
var E;
|
|
9264
|
+
const A = (E = b.target.files) == null ? void 0 : E[0];
|
|
9260
9265
|
if (A) {
|
|
9261
|
-
const
|
|
9262
|
-
|
|
9266
|
+
const _ = new FileReader();
|
|
9267
|
+
_.onload = (N) => {
|
|
9263
9268
|
var w;
|
|
9264
9269
|
d((w = N.target) == null ? void 0 : w.result);
|
|
9265
|
-
},
|
|
9270
|
+
}, _.readAsDataURL(A);
|
|
9266
9271
|
}
|
|
9267
9272
|
}, x = () => {
|
|
9268
9273
|
var b;
|
|
@@ -9470,11 +9475,11 @@ const AiAssistant = () => {
|
|
|
9470
9475
|
n(k), l(a), c(""), p(""), m("");
|
|
9471
9476
|
}
|
|
9472
9477
|
}, A = (k) => {
|
|
9473
|
-
const v = a.filter((
|
|
9478
|
+
const v = a.filter((B, S) => S !== k);
|
|
9474
9479
|
n(v), l(v);
|
|
9475
|
-
},
|
|
9480
|
+
}, E = (k) => {
|
|
9476
9481
|
g(k), c(a[k].key), p(a[k].value);
|
|
9477
|
-
},
|
|
9482
|
+
}, _ = () => {
|
|
9478
9483
|
if (i.startsWith("@")) {
|
|
9479
9484
|
m("Attribute keys cannot start with '@'");
|
|
9480
9485
|
return;
|
|
@@ -9484,9 +9489,9 @@ const AiAssistant = () => {
|
|
|
9484
9489
|
k[u] = { key: i, value: d }, n(k), l(k), g(null), c(""), p(""), m("");
|
|
9485
9490
|
}
|
|
9486
9491
|
}, N = (k) => {
|
|
9487
|
-
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ?
|
|
9492
|
+
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? _() : b());
|
|
9488
9493
|
}, w = useCallback((k) => {
|
|
9489
|
-
const v = (C) => /[.,!?;:]/.test(C),
|
|
9494
|
+
const v = (C) => /[.,!?;:]/.test(C), B = (C, j, I) => {
|
|
9490
9495
|
let T = "", R = "";
|
|
9491
9496
|
const L = j > 0 ? C[j - 1] : "", D = j < C.length ? C[j] : "";
|
|
9492
9497
|
return j > 0 && (L === "." || !v(L) && L !== " ") && (T = " "), j < C.length && !v(D) && D !== " " && (R = " "), {
|
|
@@ -9498,11 +9503,11 @@ const AiAssistant = () => {
|
|
|
9498
9503
|
if (S) {
|
|
9499
9504
|
const C = S.selectionStart || 0, j = S.value || "", I = S.selectionEnd || C;
|
|
9500
9505
|
if (I > C) {
|
|
9501
|
-
const P = `{{${k}}}`, { text: M } =
|
|
9506
|
+
const P = `{{${k}}}`, { text: M } = B(j, C, P), $ = j.slice(0, C) + M + j.slice(I);
|
|
9502
9507
|
p($);
|
|
9503
9508
|
return;
|
|
9504
9509
|
}
|
|
9505
|
-
const R = `{{${k}}}`, { text: L } =
|
|
9510
|
+
const R = `{{${k}}}`, { text: L } = B(j, C, R), D = j.slice(0, C) + L + j.slice(C);
|
|
9506
9511
|
p(D);
|
|
9507
9512
|
}
|
|
9508
9513
|
}, []);
|
|
@@ -9511,7 +9516,7 @@ const AiAssistant = () => {
|
|
|
9511
9516
|
"form",
|
|
9512
9517
|
{
|
|
9513
9518
|
onSubmit: (k) => {
|
|
9514
|
-
k.preventDefault(), u !== null ?
|
|
9519
|
+
k.preventDefault(), u !== null ? _() : b();
|
|
9515
9520
|
},
|
|
9516
9521
|
className: "space-y-3",
|
|
9517
9522
|
children: [
|
|
@@ -9567,7 +9572,7 @@ const AiAssistant = () => {
|
|
|
9567
9572
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
|
|
9568
9573
|
] }),
|
|
9569
9574
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9570
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9575
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => E(v), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
9571
9576
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(v), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
|
|
9572
9577
|
] })
|
|
9573
9578
|
] }, v)) })
|
|
@@ -9749,11 +9754,11 @@ const RootLayout = () => {
|
|
|
9749
9754
|
k && get(k, "view", "standard") === "standard" && (a.current = r, i(get(k, "width", DEFAULT_PANEL_WIDTH)));
|
|
9750
9755
|
}
|
|
9751
9756
|
}, [r, x]);
|
|
9752
|
-
const
|
|
9757
|
+
const E = useMemo(() => {
|
|
9753
9758
|
if (r === null) return 0;
|
|
9754
9759
|
const k = find(x, { id: r });
|
|
9755
9760
|
return get(k, "view", "standard") === "standard" ? A : l;
|
|
9756
|
-
}, [r, A, l, x]),
|
|
9761
|
+
}, [r, A, l, x]), _ = useCallback(() => {
|
|
9757
9762
|
n(a.current);
|
|
9758
9763
|
}, [n]), N = useCallback(() => {
|
|
9759
9764
|
n("outline");
|
|
@@ -9802,8 +9807,8 @@ const RootLayout = () => {
|
|
|
9802
9807
|
{
|
|
9803
9808
|
id: "left-panel",
|
|
9804
9809
|
className: "h-full max-h-full border-r border-border",
|
|
9805
|
-
initial: { width:
|
|
9806
|
-
animate: { width:
|
|
9810
|
+
initial: { width: E },
|
|
9811
|
+
animate: { width: E },
|
|
9807
9812
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9808
9813
|
children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9809
9814
|
/* @__PURE__ */ jsx(
|
|
@@ -9859,7 +9864,7 @@ const RootLayout = () => {
|
|
|
9859
9864
|
}
|
|
9860
9865
|
),
|
|
9861
9866
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9862
|
-
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () =>
|
|
9867
|
+
r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
|
|
9863
9868
|
SheetContent,
|
|
9864
9869
|
{
|
|
9865
9870
|
side: "left",
|
|
@@ -9877,7 +9882,7 @@ const RootLayout = () => {
|
|
|
9877
9882
|
}
|
|
9878
9883
|
) }),
|
|
9879
9884
|
" ",
|
|
9880
|
-
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () =>
|
|
9885
|
+
r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${A}px` }, children: [
|
|
9881
9886
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9882
9887
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
|
|
9883
9888
|
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
@@ -9908,7 +9913,7 @@ const RootLayout = () => {
|
|
|
9908
9913
|
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
|
|
9909
9914
|
/* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
|
|
9910
9915
|
] }),
|
|
9911
|
-
/* @__PURE__ */ jsx(Button, { onClick: () =>
|
|
9916
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9912
9917
|
] }),
|
|
9913
9918
|
/* @__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(b, "panel", NoopComponent), {
|
|
9914
9919
|
close: N
|
|
@@ -9964,7 +9969,7 @@ const RootLayout = () => {
|
|
|
9964
9969
|
});
|
|
9965
9970
|
}, m = (x) => {
|
|
9966
9971
|
if (!c) return;
|
|
9967
|
-
const y = x.clientX - p.x, b = x.clientY - p.y, A = x.currentTarget,
|
|
9972
|
+
const y = x.clientX - p.x, b = x.clientY - p.y, A = x.currentTarget, E = A.offsetWidth, _ = A.offsetHeight, N = window.innerWidth - E, w = window.innerHeight - _, k = Math.max(0, Math.min(y, N)), v = Math.max(0, Math.min(b, w));
|
|
9968
9973
|
n(k, v);
|
|
9969
9974
|
}, f = () => {
|
|
9970
9975
|
d(!1);
|
|
@@ -10143,10 +10148,10 @@ const RootLayout = () => {
|
|
|
10143
10148
|
return (x = m.onMount) == null ? void 0 : x.call(m, f);
|
|
10144
10149
|
}, ...h) => {
|
|
10145
10150
|
const m = h[0] || ((v) => {
|
|
10146
|
-
let
|
|
10147
|
-
return
|
|
10151
|
+
let B = o.get(v);
|
|
10152
|
+
return B || (B = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(v, B), u == null || u(v, k)), B;
|
|
10148
10153
|
}), f = h[1] || (() => {
|
|
10149
|
-
const v = [],
|
|
10154
|
+
const v = [], B = (S) => {
|
|
10150
10155
|
try {
|
|
10151
10156
|
S();
|
|
10152
10157
|
} catch (C) {
|
|
@@ -10154,30 +10159,30 @@ const RootLayout = () => {
|
|
|
10154
10159
|
}
|
|
10155
10160
|
};
|
|
10156
10161
|
do {
|
|
10157
|
-
c.f &&
|
|
10162
|
+
c.f && B(c.f);
|
|
10158
10163
|
const S = /* @__PURE__ */ new Set(), C = S.add.bind(S);
|
|
10159
10164
|
a.forEach((j) => {
|
|
10160
10165
|
var I;
|
|
10161
10166
|
return (I = r.get(j)) == null ? void 0 : I.l.forEach(C);
|
|
10162
|
-
}), a.clear(), i.forEach(C), i.clear(), l.forEach(C), l.clear(), S.forEach(
|
|
10167
|
+
}), a.clear(), i.forEach(C), i.clear(), l.forEach(C), l.clear(), S.forEach(B), a.size && x();
|
|
10163
10168
|
} while (a.size || i.size || l.size);
|
|
10164
10169
|
if (v.length)
|
|
10165
10170
|
throw new AggregateError(v);
|
|
10166
10171
|
}), x = h[2] || (() => {
|
|
10167
|
-
const v = [],
|
|
10172
|
+
const v = [], B = /* @__PURE__ */ new WeakSet(), S = /* @__PURE__ */ new WeakSet(), C = Array.from(a);
|
|
10168
10173
|
for (; C.length; ) {
|
|
10169
10174
|
const j = C[C.length - 1], I = m(j);
|
|
10170
10175
|
if (S.has(j)) {
|
|
10171
10176
|
C.pop();
|
|
10172
10177
|
continue;
|
|
10173
10178
|
}
|
|
10174
|
-
if (
|
|
10179
|
+
if (B.has(j)) {
|
|
10175
10180
|
n.get(j) === I.n && v.push([j, I]), S.add(j), C.pop();
|
|
10176
10181
|
continue;
|
|
10177
10182
|
}
|
|
10178
|
-
|
|
10183
|
+
B.add(j);
|
|
10179
10184
|
for (const T of getMountedOrPendingDependents(j, I, r))
|
|
10180
|
-
|
|
10185
|
+
B.has(T) || C.push(T);
|
|
10181
10186
|
}
|
|
10182
10187
|
for (let j = v.length - 1; j >= 0; --j) {
|
|
10183
10188
|
const [I, T] = v[j];
|
|
@@ -10187,10 +10192,10 @@ const RootLayout = () => {
|
|
|
10187
10192
|
R = !0;
|
|
10188
10193
|
break;
|
|
10189
10194
|
}
|
|
10190
|
-
R && (y(I),
|
|
10195
|
+
R && (y(I), E(I)), n.delete(I);
|
|
10191
10196
|
}
|
|
10192
10197
|
}), y = h[3] || ((v) => {
|
|
10193
|
-
var
|
|
10198
|
+
var B;
|
|
10194
10199
|
const S = m(v);
|
|
10195
10200
|
if (isAtomStateInitialized(S) && (r.has(v) && n.get(v) !== S.n || Array.from(S.d).every(
|
|
10196
10201
|
([P, M]) => (
|
|
@@ -10203,7 +10208,7 @@ const RootLayout = () => {
|
|
|
10203
10208
|
S.d.clear();
|
|
10204
10209
|
let C = !0;
|
|
10205
10210
|
const j = () => {
|
|
10206
|
-
r.has(v) && (
|
|
10211
|
+
r.has(v) && (E(v), x(), f());
|
|
10207
10212
|
}, I = (P) => {
|
|
10208
10213
|
var M;
|
|
10209
10214
|
if (isSelfAtom(v, P)) {
|
|
@@ -10247,18 +10252,18 @@ const RootLayout = () => {
|
|
|
10247
10252
|
} catch (P) {
|
|
10248
10253
|
return delete S.v, S.e = P, ++S.n, S;
|
|
10249
10254
|
} finally {
|
|
10250
|
-
C = !1, D !== S.n && n.get(v) === D && (n.set(v, S.n), a.add(v), (
|
|
10255
|
+
C = !1, D !== S.n && n.get(v) === D && (n.set(v, S.n), a.add(v), (B = c.c) == null || B.call(c, v));
|
|
10251
10256
|
}
|
|
10252
10257
|
}), b = h[4] || ((v) => {
|
|
10253
|
-
const
|
|
10254
|
-
for (;
|
|
10255
|
-
const S =
|
|
10258
|
+
const B = [v];
|
|
10259
|
+
for (; B.length; ) {
|
|
10260
|
+
const S = B.pop(), C = m(S);
|
|
10256
10261
|
for (const j of getMountedOrPendingDependents(S, C, r)) {
|
|
10257
10262
|
const I = m(j);
|
|
10258
|
-
n.set(j, I.n),
|
|
10263
|
+
n.set(j, I.n), B.push(j);
|
|
10259
10264
|
}
|
|
10260
10265
|
}
|
|
10261
|
-
}), A = h[5] || ((v, ...
|
|
10266
|
+
}), A = h[5] || ((v, ...B) => {
|
|
10262
10267
|
let S = !0;
|
|
10263
10268
|
const C = (I) => returnAtomValue(y(I)), j = (I, ...T) => {
|
|
10264
10269
|
var R;
|
|
@@ -10268,7 +10273,7 @@ const RootLayout = () => {
|
|
|
10268
10273
|
if (!hasInitialValue(I))
|
|
10269
10274
|
throw new Error("atom not writable");
|
|
10270
10275
|
const D = L.n, P = T[0];
|
|
10271
|
-
setAtomStateValueOrPromise(I, P, m),
|
|
10276
|
+
setAtomStateValueOrPromise(I, P, m), E(I), D !== L.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
|
|
10272
10277
|
return;
|
|
10273
10278
|
} else
|
|
10274
10279
|
return A(I, ...T);
|
|
@@ -10277,18 +10282,18 @@ const RootLayout = () => {
|
|
|
10277
10282
|
}
|
|
10278
10283
|
};
|
|
10279
10284
|
try {
|
|
10280
|
-
return p(v, C, j, ...
|
|
10285
|
+
return p(v, C, j, ...B);
|
|
10281
10286
|
} finally {
|
|
10282
10287
|
S = !1;
|
|
10283
10288
|
}
|
|
10284
|
-
}),
|
|
10285
|
-
var
|
|
10289
|
+
}), E = h[6] || ((v) => {
|
|
10290
|
+
var B;
|
|
10286
10291
|
const S = m(v), C = r.get(v);
|
|
10287
10292
|
if (C && !isPendingPromise(S.v)) {
|
|
10288
10293
|
for (const [j, I] of S.d)
|
|
10289
10294
|
if (!C.d.has(j)) {
|
|
10290
10295
|
const T = m(j);
|
|
10291
|
-
|
|
10296
|
+
_(j).t.add(v), C.d.add(j), I !== T.n && (a.add(j), (B = c.c) == null || B.call(c, j), b(j));
|
|
10292
10297
|
}
|
|
10293
10298
|
for (const j of C.d || [])
|
|
10294
10299
|
if (!S.d.has(j)) {
|
|
@@ -10297,19 +10302,19 @@ const RootLayout = () => {
|
|
|
10297
10302
|
I == null || I.t.delete(v);
|
|
10298
10303
|
}
|
|
10299
10304
|
}
|
|
10300
|
-
}),
|
|
10301
|
-
var
|
|
10305
|
+
}), _ = h[7] || ((v) => {
|
|
10306
|
+
var B;
|
|
10302
10307
|
const S = m(v);
|
|
10303
10308
|
let C = r.get(v);
|
|
10304
10309
|
if (!C) {
|
|
10305
10310
|
y(v);
|
|
10306
10311
|
for (const j of S.d.keys())
|
|
10307
|
-
|
|
10312
|
+
_(j).t.add(v);
|
|
10308
10313
|
if (C = {
|
|
10309
10314
|
l: /* @__PURE__ */ new Set(),
|
|
10310
10315
|
d: new Set(S.d.keys()),
|
|
10311
10316
|
t: /* @__PURE__ */ new Set()
|
|
10312
|
-
}, r.set(v, C), (
|
|
10317
|
+
}, r.set(v, C), (B = c.m) == null || B.call(c, v), isActuallyWritableAtom(v)) {
|
|
10313
10318
|
const j = () => {
|
|
10314
10319
|
let I = !0;
|
|
10315
10320
|
const T = (...R) => {
|
|
@@ -10338,14 +10343,14 @@ const RootLayout = () => {
|
|
|
10338
10343
|
}
|
|
10339
10344
|
return C;
|
|
10340
10345
|
}), N = h[8] || ((v) => {
|
|
10341
|
-
var
|
|
10346
|
+
var B;
|
|
10342
10347
|
const S = m(v);
|
|
10343
10348
|
let C = r.get(v);
|
|
10344
10349
|
if (C && !C.l.size && !Array.from(C.t).some((j) => {
|
|
10345
10350
|
var I;
|
|
10346
10351
|
return (I = r.get(j)) == null ? void 0 : I.d.has(v);
|
|
10347
10352
|
})) {
|
|
10348
|
-
C.u && i.add(C.u), C = void 0, r.delete(v), (
|
|
10353
|
+
C.u && i.add(C.u), C = void 0, r.delete(v), (B = c.u) == null || B.call(c, v);
|
|
10349
10354
|
for (const j of S.d.keys()) {
|
|
10350
10355
|
const I = N(j);
|
|
10351
10356
|
I == null || I.t.delete(v);
|
|
@@ -10374,22 +10379,22 @@ const RootLayout = () => {
|
|
|
10374
10379
|
y,
|
|
10375
10380
|
b,
|
|
10376
10381
|
A,
|
|
10382
|
+
E,
|
|
10377
10383
|
_,
|
|
10378
|
-
B,
|
|
10379
10384
|
N
|
|
10380
10385
|
], k = {
|
|
10381
10386
|
get: (v) => returnAtomValue(y(v)),
|
|
10382
|
-
set: (v, ...
|
|
10387
|
+
set: (v, ...B) => {
|
|
10383
10388
|
try {
|
|
10384
|
-
return A(v, ...
|
|
10389
|
+
return A(v, ...B);
|
|
10385
10390
|
} finally {
|
|
10386
10391
|
x(), f();
|
|
10387
10392
|
}
|
|
10388
10393
|
},
|
|
10389
|
-
sub: (v,
|
|
10390
|
-
const C =
|
|
10391
|
-
return C.add(
|
|
10392
|
-
C.delete(
|
|
10394
|
+
sub: (v, B) => {
|
|
10395
|
+
const C = _(v).l;
|
|
10396
|
+
return C.add(B), f(), () => {
|
|
10397
|
+
C.delete(B), N(v), f();
|
|
10393
10398
|
};
|
|
10394
10399
|
}
|
|
10395
10400
|
};
|