@chaibuilder/sdk 2.2.22 → 2.2.23
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/core.cjs +3 -3
- package/dist/core.js +197 -192
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -799,10 +799,10 @@ const undoRedoStateAtom = atom({
|
|
|
799
799
|
return {
|
|
800
800
|
moveBlocks: (x, y, b) => {
|
|
801
801
|
const v = map(x, (w) => {
|
|
802
|
-
const _ = r.find((N) => N._id === w)._parent || null,
|
|
803
|
-
return { _id: w, oldParent: _, oldPosition:
|
|
804
|
-
}),
|
|
805
|
-
|
|
802
|
+
const _ = r.find((N) => N._id === w)._parent || null, A = r.filter((N) => _ ? N._parent === _ : !N._parent).map((N) => N._id).indexOf(w);
|
|
803
|
+
return { _id: w, oldParent: _, oldPosition: A };
|
|
804
|
+
}), B = v.find(({ _id: w }) => w === x[0]);
|
|
805
|
+
B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
|
|
806
806
|
undo: () => each(v, ({ _id: w, oldParent: E, oldPosition: _ }) => {
|
|
807
807
|
i([w], E, _);
|
|
808
808
|
}),
|
|
@@ -816,8 +816,8 @@ const undoRedoStateAtom = atom({
|
|
|
816
816
|
});
|
|
817
817
|
},
|
|
818
818
|
removeBlocks: (x) => {
|
|
819
|
-
var
|
|
820
|
-
const y = (
|
|
819
|
+
var B;
|
|
820
|
+
const y = (B = first(x)) == null ? void 0 : B._parent, v = r.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
|
|
821
821
|
l(map(x, "_id")), o({
|
|
822
822
|
undo: () => a(x, y, v),
|
|
823
823
|
redo: () => l(map(x, "_id"))
|
|
@@ -826,17 +826,17 @@ const undoRedoStateAtom = atom({
|
|
|
826
826
|
updateBlocks: (x, y, b) => {
|
|
827
827
|
let v = [];
|
|
828
828
|
if (b)
|
|
829
|
-
v = map(x, (
|
|
829
|
+
v = map(x, (B) => ({ _id: B, ...b }));
|
|
830
830
|
else {
|
|
831
|
-
const
|
|
831
|
+
const B = keys(y);
|
|
832
832
|
v = map(x, (w) => {
|
|
833
833
|
const E = r.find((S) => S._id === w), _ = { _id: w };
|
|
834
|
-
return each(
|
|
834
|
+
return each(B, (S) => _[S] = E[S]), _;
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
|
-
c(map(x, (
|
|
837
|
+
c(map(x, (B) => ({ _id: B, ...y }))), o({
|
|
838
838
|
undo: () => c(v),
|
|
839
|
-
redo: () => c(map(x, (
|
|
839
|
+
redo: () => c(map(x, (B) => ({ _id: B, ...y })))
|
|
840
840
|
});
|
|
841
841
|
},
|
|
842
842
|
updateBlocksRuntime: (x, y) => {
|
|
@@ -851,8 +851,8 @@ const undoRedoStateAtom = atom({
|
|
|
851
851
|
updateMultipleBlocksProps: (x) => {
|
|
852
852
|
let y = [];
|
|
853
853
|
y = map(x, (b) => {
|
|
854
|
-
const v = keys(b),
|
|
855
|
-
return each(v, (E) => w[E] =
|
|
854
|
+
const v = keys(b), B = r.find((E) => E._id === b._id), w = {};
|
|
855
|
+
return each(v, (E) => w[E] = B[E]), w;
|
|
856
856
|
}), c(x), o({
|
|
857
857
|
undo: () => c(y),
|
|
858
858
|
redo: () => c(x)
|
|
@@ -2341,8 +2341,8 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2341
2341
|
for (const y in x) {
|
|
2342
2342
|
const b = x[y];
|
|
2343
2343
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2344
|
-
const { baseClasses: v, classes:
|
|
2345
|
-
x[y] = compact(flattenDeep([v,
|
|
2344
|
+
const { baseClasses: v, classes: B } = getSplitChaiClasses(b);
|
|
2345
|
+
x[y] = compact(flattenDeep([v, B])).join(" ");
|
|
2346
2346
|
} else
|
|
2347
2347
|
y !== "_id" && delete x[y];
|
|
2348
2348
|
}
|
|
@@ -2354,21 +2354,21 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2354
2354
|
if (l) {
|
|
2355
2355
|
r(!0), a(null);
|
|
2356
2356
|
try {
|
|
2357
|
-
const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)],
|
|
2357
|
+
const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)], B = await l(h, addLangToPrompt(x, m, h), v, b), { blocks: w, error: E } = B;
|
|
2358
2358
|
if (E) {
|
|
2359
2359
|
a(E);
|
|
2360
2360
|
return;
|
|
2361
2361
|
}
|
|
2362
2362
|
if (h === "styles") {
|
|
2363
2363
|
const _ = w.map((S) => {
|
|
2364
|
-
for (const
|
|
2365
|
-
|
|
2364
|
+
for (const A in S)
|
|
2365
|
+
A !== "_id" && (S[A] = `${STYLES_KEY},${S[A]}`);
|
|
2366
2366
|
return S;
|
|
2367
2367
|
});
|
|
2368
2368
|
c(_);
|
|
2369
2369
|
} else
|
|
2370
2370
|
i(w);
|
|
2371
|
-
y && y(
|
|
2371
|
+
y && y(B);
|
|
2372
2372
|
} catch (b) {
|
|
2373
2373
|
a(b);
|
|
2374
2374
|
} finally {
|
|
@@ -3493,16 +3493,16 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3493
3493
|
var C;
|
|
3494
3494
|
const _ = o._type;
|
|
3495
3495
|
let S = o[n];
|
|
3496
|
-
const
|
|
3497
|
-
return g && ((C =
|
|
3496
|
+
const A = getRegisteredChaiBlock(o._type);
|
|
3497
|
+
return g && ((C = A == null ? void 0 : A.i18nProps) == null ? void 0 : C.includes(n)) && has(o, `${n}-${g}`) && (S = get(o, `${n}-${g}`)), { blockContent: S, blockType: _ };
|
|
3498
3498
|
}, [o, g]), v = useCallback(
|
|
3499
3499
|
(_) => {
|
|
3500
|
-
var
|
|
3501
|
-
const S = _ || ((
|
|
3500
|
+
var A;
|
|
3501
|
+
const S = _ || ((A = p.current) == null ? void 0 : A.innerText);
|
|
3502
3502
|
m([x], { [n]: S }), d(null), i(null), h([]);
|
|
3503
3503
|
},
|
|
3504
3504
|
[x, m, i, h, g]
|
|
3505
|
-
),
|
|
3505
|
+
), B = useDebouncedCallback(
|
|
3506
3506
|
(_) => {
|
|
3507
3507
|
m([x], { [n]: _ });
|
|
3508
3508
|
},
|
|
@@ -3528,7 +3528,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3528
3528
|
{
|
|
3529
3529
|
blockContent: y,
|
|
3530
3530
|
editingElement: c,
|
|
3531
|
-
onChange:
|
|
3531
|
+
onChange: B,
|
|
3532
3532
|
onClose: v,
|
|
3533
3533
|
onEscape: w
|
|
3534
3534
|
}
|
|
@@ -3539,7 +3539,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3539
3539
|
blockContent: y,
|
|
3540
3540
|
editingElement: c,
|
|
3541
3541
|
onClose: v,
|
|
3542
|
-
onChange:
|
|
3542
|
+
onChange: B,
|
|
3543
3543
|
onEscape: w
|
|
3544
3544
|
}
|
|
3545
3545
|
)) : null, [c, x, b, y, v, g]);
|
|
@@ -3586,7 +3586,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3586
3586
|
), b = useMemo(() => getBlockTagAttributes(l), [l, getBlockTagAttributes]), v = useMemo(
|
|
3587
3587
|
() => p(l._id, getBlockRuntimeProps(l._type)),
|
|
3588
3588
|
[l._id, l._type, p, getBlockRuntimeProps]
|
|
3589
|
-
),
|
|
3589
|
+
), B = useMemo(
|
|
3590
3590
|
() => ({
|
|
3591
3591
|
blockProps: { "data-block-id": l._id, "data-block-type": l._type },
|
|
3592
3592
|
inBuilder: !0,
|
|
@@ -3609,7 +3609,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3609
3609
|
), w = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]);
|
|
3610
3610
|
if (isNull(h) || m.includes(l._id)) return null;
|
|
3611
3611
|
let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
|
|
3612
|
-
...
|
|
3612
|
+
...B,
|
|
3613
3613
|
children: n({
|
|
3614
3614
|
_id: l._id,
|
|
3615
3615
|
_type: l._type,
|
|
@@ -4057,11 +4057,11 @@ const DataBindingSelector = ({
|
|
|
4057
4057
|
r(`{{${m}}}`, {}, n);
|
|
4058
4058
|
return;
|
|
4059
4059
|
}
|
|
4060
|
-
const h = (b) => /[.,!?;:]/.test(b), f = (b, v,
|
|
4060
|
+
const h = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
|
|
4061
4061
|
let w = "", E = "";
|
|
4062
4062
|
const _ = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
|
|
4063
4063
|
return v > 0 && (_ === "." || !h(_) && _ !== " ") && (w = " "), v < b.length && !h(S) && S !== " " && (E = " "), {
|
|
4064
|
-
text: w +
|
|
4064
|
+
text: w + B + E,
|
|
4065
4065
|
prefixLength: w.length,
|
|
4066
4066
|
suffixLength: E.length
|
|
4067
4067
|
};
|
|
@@ -4073,13 +4073,13 @@ const DataBindingSelector = ({
|
|
|
4073
4073
|
if (b) {
|
|
4074
4074
|
const v = `{{${m}}}`;
|
|
4075
4075
|
b.commands.focus();
|
|
4076
|
-
const { from:
|
|
4077
|
-
if (
|
|
4076
|
+
const { from: B, to: w } = b.state.selection;
|
|
4077
|
+
if (B !== w)
|
|
4078
4078
|
b.chain().deleteSelection().insertContent(v).run();
|
|
4079
4079
|
else {
|
|
4080
|
-
const { state: _ } = b, S = _.selection.from,
|
|
4080
|
+
const { state: _ } = b, S = _.selection.from, A = _.doc.textBetween(Math.max(0, S - 1), S), N = _.doc.textBetween(S, Math.min(S + 1, _.doc.content.size));
|
|
4081
4081
|
let C = "";
|
|
4082
|
-
S > 0 &&
|
|
4082
|
+
S > 0 && A !== " " && !h(A) && (C = " ");
|
|
4083
4083
|
let k = "";
|
|
4084
4084
|
N && N !== " " && !h(N) && (k = " "), b.chain().insertContent(C + v + k).run();
|
|
4085
4085
|
}
|
|
@@ -4087,14 +4087,14 @@ const DataBindingSelector = ({
|
|
|
4087
4087
|
return;
|
|
4088
4088
|
}
|
|
4089
4089
|
} else {
|
|
4090
|
-
const b = x, v = b.selectionStart || 0,
|
|
4090
|
+
const b = x, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
|
|
4091
4091
|
if (w > v) {
|
|
4092
|
-
const N = `{{${m}}}`, { text: C } = f(
|
|
4092
|
+
const N = `{{${m}}}`, { text: C } = f(B, v, N), k = B.slice(0, v) + C + B.slice(w);
|
|
4093
4093
|
r(k, {}, n);
|
|
4094
4094
|
return;
|
|
4095
4095
|
}
|
|
4096
|
-
const _ = `{{${m}}}`, { text: S } = f(
|
|
4097
|
-
r(
|
|
4096
|
+
const _ = `{{${m}}}`, { text: S } = f(B, v, _), A = B.slice(0, v) + S + B.slice(v);
|
|
4097
|
+
r(A, {}, n);
|
|
4098
4098
|
}
|
|
4099
4099
|
},
|
|
4100
4100
|
[n, r, a, c == null ? void 0 : c._id, d]
|
|
@@ -4116,7 +4116,7 @@ const DataBindingSelector = ({
|
|
|
4116
4116
|
onChange: n
|
|
4117
4117
|
}) => {
|
|
4118
4118
|
var N;
|
|
4119
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [g, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null),
|
|
4119
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [g, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = r == null ? void 0 : r.find((C) => C.key === u)) == null ? void 0 : N.name;
|
|
4120
4120
|
useEffect(() => {
|
|
4121
4121
|
if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4122
4122
|
const C = split(o, ":"), k = get(C, 1, "page") || "page";
|
|
@@ -4165,7 +4165,7 @@ const DataBindingSelector = ({
|
|
|
4165
4165
|
}, [y]);
|
|
4166
4166
|
const S = () => {
|
|
4167
4167
|
h(""), x([]), b(-1), p(!1), n("");
|
|
4168
|
-
},
|
|
4168
|
+
}, A = (C) => {
|
|
4169
4169
|
h(C), p(!isEmpty(C)), c(!0), w(C);
|
|
4170
4170
|
};
|
|
4171
4171
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4176,9 +4176,9 @@ const DataBindingSelector = ({
|
|
|
4176
4176
|
{
|
|
4177
4177
|
type: "text",
|
|
4178
4178
|
value: g,
|
|
4179
|
-
onChange: (C) =>
|
|
4179
|
+
onChange: (C) => A(C.target.value),
|
|
4180
4180
|
onKeyDown: _,
|
|
4181
|
-
placeholder: a(`Search ${
|
|
4181
|
+
placeholder: a(`Search ${B ?? ""}`),
|
|
4182
4182
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4183
4183
|
}
|
|
4184
4184
|
),
|
|
@@ -4511,9 +4511,9 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4511
4511
|
if (f !== x)
|
|
4512
4512
|
u.chain().deleteSelection().insertContent(h).run();
|
|
4513
4513
|
else {
|
|
4514
|
-
const { state: b } = u, v = b.selection.from,
|
|
4514
|
+
const { state: b } = u, v = b.selection.from, B = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
|
|
4515
4515
|
let E = "";
|
|
4516
|
-
v > 0 &&
|
|
4516
|
+
v > 0 && B !== " " && !/[.,!?;:]/.test(B) && (E = " ");
|
|
4517
4517
|
let _ = "";
|
|
4518
4518
|
w && w !== " " && !/[.,!?;:]/.test(w) && (_ = " "), u.chain().insertContent(E + h + _).run();
|
|
4519
4519
|
}
|
|
@@ -4816,9 +4816,9 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4816
4816
|
const { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
|
|
4817
4817
|
() => isEmpty(x) ? "" : isEmpty(h) ? f : h,
|
|
4818
4818
|
[x, h, f]
|
|
4819
|
-
), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(),
|
|
4820
|
-
() => get(w, [
|
|
4821
|
-
[w,
|
|
4819
|
+
), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), E = useMemo(
|
|
4820
|
+
() => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
|
|
4821
|
+
[w, B == null ? void 0 : B._type]
|
|
4822
4822
|
), [_, S] = useState(null);
|
|
4823
4823
|
if (d)
|
|
4824
4824
|
return null;
|
|
@@ -4940,31 +4940,36 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4940
4940
|
}), a;
|
|
4941
4941
|
};
|
|
4942
4942
|
function BlockSettings() {
|
|
4943
|
-
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), m = useWrapperBlock(), g = getRegisteredChaiBlock(m == null ? void 0 : m._type), h = formDataWithSelectedLang(m, o, g), f = ({ formData: _ }, S,
|
|
4944
|
-
S && (c == null ? void 0 : c._id) === r._id && a([r._id], { [S]: get(_, S) },
|
|
4943
|
+
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), m = useWrapperBlock(), g = getRegisteredChaiBlock(m == null ? void 0 : m._type), h = formDataWithSelectedLang(m, o, g), f = ({ formData: _ }, S, A) => {
|
|
4944
|
+
S && (c == null ? void 0 : c._id) === r._id && a([r._id], { [S]: get(_, S) }, A);
|
|
4945
4945
|
}, x = useCallback(
|
|
4946
|
-
debounce(({ formData: _ }, S,
|
|
4947
|
-
f({ formData: _ }, S,
|
|
4946
|
+
debounce(({ formData: _ }, S, A) => {
|
|
4947
|
+
f({ formData: _ }, S, A), d(_);
|
|
4948
4948
|
}, 1500),
|
|
4949
4949
|
[r == null ? void 0 : r._id, o]
|
|
4950
4950
|
), y = ({ formData: _ }, S) => {
|
|
4951
4951
|
S && (n([r._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(c, S) }));
|
|
4952
4952
|
}, b = ({ formData: _ }, S) => {
|
|
4953
4953
|
S && (n([m._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(c, S) }));
|
|
4954
|
-
}, { schema: v, uiSchema:
|
|
4954
|
+
}, { schema: v, uiSchema: B } = useMemo(() => {
|
|
4955
4955
|
const _ = r == null ? void 0 : r._type;
|
|
4956
4956
|
if (!_)
|
|
4957
4957
|
return { schema: {}, uiSchema: {} };
|
|
4958
4958
|
try {
|
|
4959
|
-
|
|
4959
|
+
const { schema: S, uiSchema: A } = getBlockFormSchemas(_);
|
|
4960
|
+
if (_ === "Repeater") {
|
|
4961
|
+
const N = get(r, "repeaterItems", "");
|
|
4962
|
+
startsWith(N, `{{${COLLECTION_PREFIX}`) ? (set(A, "filter", { "ui:widget": "collectionSelect" }), set(A, "sort", { "ui:widget": "collectionSelect" })) : (set(A, "filter", { "ui:widget": "hidden" }), set(A, "sort", { "ui:widget": "hidden" }));
|
|
4963
|
+
}
|
|
4964
|
+
return { schema: S, uiSchema: A };
|
|
4960
4965
|
} catch {
|
|
4961
4966
|
return { schema: {}, uiSchema: {} };
|
|
4962
4967
|
}
|
|
4963
4968
|
}, [r]), { wrapperSchema: w, wrapperUiSchema: E } = useMemo(() => {
|
|
4964
4969
|
if (!m || !(m != null && m._type))
|
|
4965
4970
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
4966
|
-
const _ = m == null ? void 0 : m._type, { schema: S = {}, uiSchema:
|
|
4967
|
-
return { wrapperSchema: S, wrapperUiSchema:
|
|
4971
|
+
const _ = m == null ? void 0 : m._type, { schema: S = {}, uiSchema: A = {} } = getBlockFormSchemas(_);
|
|
4972
|
+
return { wrapperSchema: S, wrapperUiSchema: A };
|
|
4968
4973
|
}, [m]);
|
|
4969
4974
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
4970
4975
|
!isEmpty(m) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -5004,7 +5009,7 @@ function BlockSettings() {
|
|
|
5004
5009
|
onChange: y,
|
|
5005
5010
|
formData: i,
|
|
5006
5011
|
schema: v,
|
|
5007
|
-
uiSchema:
|
|
5012
|
+
uiSchema: B
|
|
5008
5013
|
}
|
|
5009
5014
|
)
|
|
5010
5015
|
] });
|
|
@@ -5181,7 +5186,7 @@ const BlockStylingProps = () => {
|
|
|
5181
5186
|
},
|
|
5182
5187
|
a
|
|
5183
5188
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5184
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [g, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v,
|
|
5189
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [g, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, E] = useState(!1);
|
|
5185
5190
|
useEffect(() => {
|
|
5186
5191
|
const { value: C, unit: k } = getClassValueAndUnit(i);
|
|
5187
5192
|
if (k === "") {
|
|
@@ -5190,7 +5195,7 @@ const BlockStylingProps = () => {
|
|
|
5190
5195
|
}
|
|
5191
5196
|
h(k), l(k === "class" || isEmpty(C) ? "" : C);
|
|
5192
5197
|
}, [i, p, u]);
|
|
5193
|
-
const _ = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME),
|
|
5198
|
+
const _ = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), A = useCallback(
|
|
5194
5199
|
(C = !1) => {
|
|
5195
5200
|
const k = getUserInputValues(`${a}`, u);
|
|
5196
5201
|
if (get(k, "error", !1)) {
|
|
@@ -5246,7 +5251,7 @@ const BlockStylingProps = () => {
|
|
|
5246
5251
|
{
|
|
5247
5252
|
readOnly: g === "class",
|
|
5248
5253
|
onKeyPress: (C) => {
|
|
5249
|
-
C.key === "Enter" &&
|
|
5254
|
+
C.key === "Enter" && A();
|
|
5250
5255
|
},
|
|
5251
5256
|
onKeyDown: (C) => {
|
|
5252
5257
|
if (C.keyCode !== 38 && C.keyCode !== 40)
|
|
@@ -5261,7 +5266,7 @@ const BlockStylingProps = () => {
|
|
|
5261
5266
|
onKeyUp: (C) => {
|
|
5262
5267
|
w && (C.preventDefault(), E(!1));
|
|
5263
5268
|
},
|
|
5264
|
-
onBlur: () =>
|
|
5269
|
+
onBlur: () => A(),
|
|
5265
5270
|
onChange: (C) => {
|
|
5266
5271
|
x(!1), l(C.target.value);
|
|
5267
5272
|
},
|
|
@@ -5304,9 +5309,9 @@ const BlockStylingProps = () => {
|
|
|
5304
5309
|
["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsx(
|
|
5305
5310
|
DragStyleButton,
|
|
5306
5311
|
{
|
|
5307
|
-
onDragStart: () =>
|
|
5312
|
+
onDragStart: () => B(!0),
|
|
5308
5313
|
onDragEnd: (C) => {
|
|
5309
|
-
if (b(() => ""),
|
|
5314
|
+
if (b(() => ""), B(!1), isEmpty(C))
|
|
5310
5315
|
return;
|
|
5311
5316
|
const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
5312
5317
|
_(T);
|
|
@@ -5780,19 +5785,19 @@ const COLOR_PROP = {
|
|
|
5780
5785
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5781
5786
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5782
5787
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useScreenSizeWidth(), g = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(g, "fullCls", ""), [g]), b = useCallback(
|
|
5783
|
-
(S,
|
|
5788
|
+
(S, A = !0) => {
|
|
5784
5789
|
const N = { dark: p, mq: m, mod: u, cls: S, property: l, fullCls: "" };
|
|
5785
5790
|
(p || u !== "") && (N.mq = "xs");
|
|
5786
5791
|
const C = generateFullClsName(N);
|
|
5787
|
-
h(x, [C],
|
|
5792
|
+
h(x, [C], A);
|
|
5788
5793
|
},
|
|
5789
5794
|
[x, p, m, u, l, h]
|
|
5790
5795
|
), v = useCallback(() => {
|
|
5791
5796
|
f(x, [y], !0);
|
|
5792
|
-
}, [x, y, f]),
|
|
5797
|
+
}, [x, y, f]), B = useMemo(() => canChangeClass(g, m), [g, m]);
|
|
5793
5798
|
useEffect(() => {
|
|
5794
|
-
i(
|
|
5795
|
-
}, [
|
|
5799
|
+
i(B, g);
|
|
5800
|
+
}, [B, i, g]);
|
|
5796
5801
|
const [, , w] = useScreenSizeWidth(), E = useCallback(
|
|
5797
5802
|
(S) => {
|
|
5798
5803
|
w({
|
|
@@ -5806,7 +5811,7 @@ const COLOR_PROP = {
|
|
|
5806
5811
|
},
|
|
5807
5812
|
[w]
|
|
5808
5813
|
), _ = get(g, "dark", null) === p && get(g, "mod", null) === u && get(g, "mq", null) === m;
|
|
5809
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
5814
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: g && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
5810
5815
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
5811
5816
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
5812
5817
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -5826,7 +5831,7 @@ const COLOR_PROP = {
|
|
|
5826
5831
|
n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
5827
5832
|
n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
5828
5833
|
] }),
|
|
5829
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) :
|
|
5834
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), 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 && g ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
5830
5835
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
5831
5836
|
"button",
|
|
5832
5837
|
{
|
|
@@ -6227,7 +6232,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6227
6232
|
};
|
|
6228
6233
|
function ManualClasses() {
|
|
6229
6234
|
var T;
|
|
6230
|
-
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((I) => !isEmpty(I)),
|
|
6235
|
+
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((I) => !isEmpty(I)), B = () => {
|
|
6231
6236
|
const I = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6232
6237
|
u(g, I, !0), x("");
|
|
6233
6238
|
}, [w, E] = useState([]), _ = ({ value: I }) => {
|
|
@@ -6244,7 +6249,7 @@ function ManualClasses() {
|
|
|
6244
6249
|
return E(map(D, "item"));
|
|
6245
6250
|
}, S = () => {
|
|
6246
6251
|
E([]);
|
|
6247
|
-
},
|
|
6252
|
+
}, A = (I) => I.name, N = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), C = useMemo(
|
|
6248
6253
|
() => ({
|
|
6249
6254
|
ref: o,
|
|
6250
6255
|
autoComplete: "off",
|
|
@@ -6259,7 +6264,7 @@ function ManualClasses() {
|
|
|
6259
6264
|
}, 0);
|
|
6260
6265
|
},
|
|
6261
6266
|
onKeyDown: (I) => {
|
|
6262
|
-
I.key === "Enter" && f.trim() !== "" &&
|
|
6267
|
+
I.key === "Enter" && f.trim() !== "" && B();
|
|
6263
6268
|
},
|
|
6264
6269
|
onChange: (I, { newValue: P }) => x(P),
|
|
6265
6270
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -6300,7 +6305,7 @@ function ManualClasses() {
|
|
|
6300
6305
|
suggestions: w,
|
|
6301
6306
|
onSuggestionsFetchRequested: _,
|
|
6302
6307
|
onSuggestionsClearRequested: S,
|
|
6303
|
-
getSuggestionValue:
|
|
6308
|
+
getSuggestionValue: A,
|
|
6304
6309
|
renderSuggestion: N,
|
|
6305
6310
|
inputProps: C,
|
|
6306
6311
|
containerProps: {
|
|
@@ -6318,7 +6323,7 @@ function ManualClasses() {
|
|
|
6318
6323
|
{
|
|
6319
6324
|
variant: "outline",
|
|
6320
6325
|
className: "h-6 border-border",
|
|
6321
|
-
onClick:
|
|
6326
|
+
onClick: B,
|
|
6322
6327
|
disabled: f.trim() === "",
|
|
6323
6328
|
size: "sm",
|
|
6324
6329
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
@@ -6743,7 +6748,7 @@ const CoreBlock = ({
|
|
|
6743
6748
|
}
|
|
6744
6749
|
}
|
|
6745
6750
|
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
6746
|
-
var g, h, f, x, y, b, v,
|
|
6751
|
+
var g, h, f, x, y, b, v, B;
|
|
6747
6752
|
if (n.type === "comment") return [];
|
|
6748
6753
|
console.log("node ===>", n);
|
|
6749
6754
|
let a = { _id: generateUUID() };
|
|
@@ -6806,8 +6811,8 @@ const CoreBlock = ({
|
|
|
6806
6811
|
const _ = find(E.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg");
|
|
6807
6812
|
if (_) {
|
|
6808
6813
|
a.icon = stringify([_]);
|
|
6809
|
-
const { height: S, width:
|
|
6810
|
-
a.iconHeight = S, a.iconWidth =
|
|
6814
|
+
const { height: S, width: A } = getSvgDimensions(_, "16px", "16px");
|
|
6815
|
+
a.iconHeight = S, a.iconWidth = A;
|
|
6811
6816
|
}
|
|
6812
6817
|
}
|
|
6813
6818
|
return [a];
|
|
@@ -6819,9 +6824,9 @@ const CoreBlock = ({
|
|
|
6819
6824
|
const w = stringify([n]);
|
|
6820
6825
|
return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
|
|
6821
6826
|
} else if (n.tagName === "svg") {
|
|
6822
|
-
const w = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px",
|
|
6823
|
-
return a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${_}`,
|
|
6824
|
-
} else if (n.tagName == "option" && r && ((
|
|
6827
|
+
const w = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", A = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
|
|
6828
|
+
return a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${_}`, A)}`.trim(), n.attributes = filter(n.attributes, (N) => !includes(["style", "width", "height", "class"], N.key)), a.icon = stringify([n]), [a];
|
|
6829
|
+
} else if (n.tagName == "option" && r && ((B = r.block) == null ? void 0 : B._type) === "Select")
|
|
6825
6830
|
return r.block.options.push({
|
|
6826
6831
|
label: getTextContent(n.children),
|
|
6827
6832
|
...getAttrs(n)
|
|
@@ -6925,12 +6930,12 @@ const BlockCard = ({
|
|
|
6925
6930
|
parentId: n = void 0,
|
|
6926
6931
|
position: a = -1
|
|
6927
6932
|
}) => {
|
|
6928
|
-
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (
|
|
6929
|
-
const w = has(
|
|
6930
|
-
return
|
|
6933
|
+
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (B) => {
|
|
6934
|
+
const w = has(B, "styles_attrs.data-page-section");
|
|
6935
|
+
return B._type === "Box" && w;
|
|
6931
6936
|
}, b = useCallback(
|
|
6932
|
-
async (
|
|
6933
|
-
if (
|
|
6937
|
+
async (B) => {
|
|
6938
|
+
if (B.stopPropagation(), has(o, "component")) {
|
|
6934
6939
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6935
6940
|
return;
|
|
6936
6941
|
}
|
|
@@ -6947,18 +6952,18 @@ const BlockCard = ({
|
|
|
6947
6952
|
onClick: l ? () => {
|
|
6948
6953
|
} : b,
|
|
6949
6954
|
draggable: f ? "true" : "false",
|
|
6950
|
-
onDragStart: async (
|
|
6955
|
+
onDragStart: async (B) => {
|
|
6951
6956
|
const w = await c(r, o);
|
|
6952
6957
|
let E = n;
|
|
6953
6958
|
if (y(first(w)) && (E = null), !isEmpty(w)) {
|
|
6954
6959
|
const _ = { blocks: w, uiLibrary: !0, parent: E };
|
|
6955
|
-
if (
|
|
6960
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
|
|
6956
6961
|
const S = new Image();
|
|
6957
6962
|
S.src = o.preview, S.onload = () => {
|
|
6958
|
-
|
|
6963
|
+
B.dataTransfer.setDragImage(S, 0, 0);
|
|
6959
6964
|
};
|
|
6960
6965
|
} else
|
|
6961
|
-
|
|
6966
|
+
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6962
6967
|
x(_), setTimeout(() => {
|
|
6963
6968
|
u([]), m(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6964
6969
|
}, 200);
|
|
@@ -7011,13 +7016,13 @@ const BlockCard = ({
|
|
|
7011
7016
|
return;
|
|
7012
7017
|
}
|
|
7013
7018
|
}, [y, b]);
|
|
7014
|
-
const
|
|
7019
|
+
const B = get(y, b, []), w = useRef(null), { t: E } = useTranslation(), _ = (k) => {
|
|
7015
7020
|
w.current && (clearTimeout(w.current), w.current = null), w.current = setTimeout(() => {
|
|
7016
7021
|
w.current && v(k);
|
|
7017
7022
|
}, 400);
|
|
7018
7023
|
}, S = () => {
|
|
7019
7024
|
i != null && i.id && p(i.id);
|
|
7020
|
-
},
|
|
7025
|
+
}, A = () => {
|
|
7021
7026
|
m("");
|
|
7022
7027
|
};
|
|
7023
7028
|
if (d)
|
|
@@ -7025,7 +7030,7 @@ const BlockCard = ({
|
|
|
7025
7030
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7026
7031
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7027
7032
|
] });
|
|
7028
|
-
const N = filter(
|
|
7033
|
+
const N = filter(B, (k, j) => j % 2 === 0), C = filter(B, (k, j) => j % 2 === 1);
|
|
7029
7034
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7030
7035
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7031
7036
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7041,7 +7046,7 @@ const BlockCard = ({
|
|
|
7041
7046
|
u && /* @__PURE__ */ jsx(
|
|
7042
7047
|
"button",
|
|
7043
7048
|
{
|
|
7044
|
-
onClick:
|
|
7049
|
+
onClick: A,
|
|
7045
7050
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7046
7051
|
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
7047
7052
|
}
|
|
@@ -7085,7 +7090,7 @@ const BlockCard = ({
|
|
|
7085
7090
|
onMouseEnter: () => w.current ? clearTimeout(w.current) : null,
|
|
7086
7091
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7087
7092
|
children: [
|
|
7088
|
-
isEmpty(
|
|
7093
|
+
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: [
|
|
7089
7094
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: N.map((k, j) => /* @__PURE__ */ jsx(
|
|
7090
7095
|
BlockCard,
|
|
7091
7096
|
{
|
|
@@ -7141,14 +7146,14 @@ const BlockCard = ({
|
|
|
7141
7146
|
}), m(!0);
|
|
7142
7147
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7143
7148
|
const h = Object.entries(a).map(([x, y]) => {
|
|
7144
|
-
const b = y, v = b.type || "partial",
|
|
7149
|
+
const b = y, v = b.type || "partial", B = formatReadableName(v);
|
|
7145
7150
|
return {
|
|
7146
7151
|
type: "PartialBlock",
|
|
7147
7152
|
// Set the type to PartialBlock
|
|
7148
7153
|
label: formatReadableName(b.name || x),
|
|
7149
7154
|
description: b.description || "",
|
|
7150
7155
|
icon: Globe,
|
|
7151
|
-
group:
|
|
7156
|
+
group: B,
|
|
7152
7157
|
// Use formatted type as group
|
|
7153
7158
|
category: "partial",
|
|
7154
7159
|
partialBlockId: x,
|
|
@@ -7220,7 +7225,7 @@ const BlockCard = ({
|
|
|
7220
7225
|
}), []);
|
|
7221
7226
|
const v = useCallback((k) => {
|
|
7222
7227
|
y(k), b.current && b.current(k);
|
|
7223
|
-
}, []),
|
|
7228
|
+
}, []), B = useCallback(() => {
|
|
7224
7229
|
y(null), b.current && b.current.cancel();
|
|
7225
7230
|
}, []), w = useCallback((k) => {
|
|
7226
7231
|
b.current && b.current.cancel(), f(k), y(null);
|
|
@@ -7240,7 +7245,7 @@ const BlockCard = ({
|
|
|
7240
7245
|
), S = useMemo(
|
|
7241
7246
|
() => sortBy(_, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
|
|
7242
7247
|
[_]
|
|
7243
|
-
),
|
|
7248
|
+
), A = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
|
|
7244
7249
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7245
7250
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7246
7251
|
Input$1,
|
|
@@ -7260,7 +7265,7 @@ const BlockCard = ({
|
|
|
7260
7265
|
{
|
|
7261
7266
|
onClick: () => w("all"),
|
|
7262
7267
|
onMouseEnter: () => v("all"),
|
|
7263
|
-
onMouseLeave:
|
|
7268
|
+
onMouseLeave: B,
|
|
7264
7269
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7265
7270
|
children: i("All")
|
|
7266
7271
|
},
|
|
@@ -7271,7 +7276,7 @@ const BlockCard = ({
|
|
|
7271
7276
|
{
|
|
7272
7277
|
onClick: () => w(k),
|
|
7273
7278
|
onMouseEnter: () => v(k),
|
|
7274
|
-
onMouseLeave:
|
|
7279
|
+
onMouseLeave: B,
|
|
7275
7280
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7276
7281
|
children: capitalize(i(k.toLowerCase()))
|
|
7277
7282
|
},
|
|
@@ -7286,7 +7291,7 @@ const BlockCard = ({
|
|
|
7286
7291
|
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: N.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7287
7292
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
|
|
7288
7293
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7289
|
-
h === "all" ? filter(values(
|
|
7294
|
+
h === "all" ? filter(values(A), { group: k }) : values(A),
|
|
7290
7295
|
{ hidden: !0 }
|
|
7291
7296
|
).map((j) => /* @__PURE__ */ jsx(
|
|
7292
7297
|
CoreBlock,
|
|
@@ -7648,19 +7653,19 @@ const Input = ({ node: o }) => {
|
|
|
7648
7653
|
var P;
|
|
7649
7654
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7650
7655
|
let p = null;
|
|
7651
|
-
const u = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick:
|
|
7656
|
+
const u = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (L) => {
|
|
7652
7657
|
L.stopPropagation(), !l.includes(h) && o.toggle();
|
|
7653
7658
|
}, E = (L) => {
|
|
7654
7659
|
L.isInternal && (p = L.isOpen, L.isOpen && L.close());
|
|
7655
7660
|
}, _ = (L) => {
|
|
7656
7661
|
L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
|
|
7657
|
-
}, [S,
|
|
7662
|
+
}, [S, A] = useAtom$1(currentAddSelection), N = () => {
|
|
7658
7663
|
var L;
|
|
7659
|
-
C(), o.parent.isSelected ||
|
|
7664
|
+
C(), o.parent.isSelected || A((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
|
|
7660
7665
|
}, C = () => {
|
|
7661
|
-
|
|
7666
|
+
A(null);
|
|
7662
7667
|
}, k = (L) => {
|
|
7663
|
-
C(), L.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(),
|
|
7668
|
+
C(), L.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(L);
|
|
7664
7669
|
};
|
|
7665
7670
|
useEffect(() => {
|
|
7666
7671
|
const L = setTimeout(() => {
|
|
@@ -8070,19 +8075,19 @@ const Input = ({ node: o }) => {
|
|
|
8070
8075
|
const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: m } = useTranslation(), g = (v) => {
|
|
8071
8076
|
a(v);
|
|
8072
8077
|
}, h = () => {
|
|
8073
|
-
const v = l.find((
|
|
8078
|
+
const v = l.find((B) => Object.keys(B)[0] === n);
|
|
8074
8079
|
if (v) {
|
|
8075
|
-
const
|
|
8076
|
-
|
|
8080
|
+
const B = Object.values(v)[0];
|
|
8081
|
+
B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
|
|
8077
8082
|
} else
|
|
8078
8083
|
console.error("Preset not found:", n);
|
|
8079
8084
|
}, f = useDebouncedCallback(
|
|
8080
|
-
(v,
|
|
8085
|
+
(v, B) => {
|
|
8081
8086
|
p(() => ({
|
|
8082
8087
|
...d,
|
|
8083
8088
|
fontFamily: {
|
|
8084
8089
|
...d.fontFamily,
|
|
8085
|
-
[v.replace(/font-/g, "")]:
|
|
8090
|
+
[v.replace(/font-/g, "")]: B
|
|
8086
8091
|
}
|
|
8087
8092
|
}));
|
|
8088
8093
|
},
|
|
@@ -8098,10 +8103,10 @@ const Input = ({ node: o }) => {
|
|
|
8098
8103
|
[d],
|
|
8099
8104
|
200
|
|
8100
8105
|
), y = useDebouncedCallback(
|
|
8101
|
-
(v,
|
|
8106
|
+
(v, B) => {
|
|
8102
8107
|
p(() => {
|
|
8103
8108
|
const w = get(d, `colors.${v}`);
|
|
8104
|
-
return r ? set(w, 1,
|
|
8109
|
+
return r ? set(w, 1, B) : set(w, 0, B), {
|
|
8105
8110
|
...d,
|
|
8106
8111
|
colors: {
|
|
8107
8112
|
...d.colors,
|
|
@@ -8112,18 +8117,18 @@ const Input = ({ node: o }) => {
|
|
|
8112
8117
|
},
|
|
8113
8118
|
[d],
|
|
8114
8119
|
200
|
|
8115
|
-
), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([
|
|
8116
|
-
const w = get(d, `colors.${
|
|
8120
|
+
), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([B]) => {
|
|
8121
|
+
const w = get(d, `colors.${B}.${r ? 1 : 0}`);
|
|
8117
8122
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8118
8123
|
/* @__PURE__ */ jsx(
|
|
8119
8124
|
ColorPickerInput,
|
|
8120
8125
|
{
|
|
8121
8126
|
value: w,
|
|
8122
|
-
onChange: (E) => y(
|
|
8127
|
+
onChange: (E) => y(B, E)
|
|
8123
8128
|
}
|
|
8124
8129
|
),
|
|
8125
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
8126
|
-
] },
|
|
8130
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: B.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!B.toLowerCase().includes("foreground") && !B.toLowerCase().includes("border") && !B.toLowerCase().includes("input") && !B.toLowerCase().includes("ring") && !B.toLowerCase().includes("background") ? " Background" : "") })
|
|
8131
|
+
] }, B);
|
|
8127
8132
|
}) });
|
|
8128
8133
|
return c("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8129
8134
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -8155,11 +8160,11 @@ const Input = ({ node: o }) => {
|
|
|
8155
8160
|
) })
|
|
8156
8161
|
] }),
|
|
8157
8162
|
/* @__PURE__ */ jsxs("div", { className: cn$2("space-y-2", o), children: [
|
|
8158
|
-
(u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v,
|
|
8163
|
+
(u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v, B]) => /* @__PURE__ */ jsx(
|
|
8159
8164
|
FontSelector,
|
|
8160
8165
|
{
|
|
8161
8166
|
label: v,
|
|
8162
|
-
value: d.fontFamily[v.replace(/font-/g, "")] ||
|
|
8167
|
+
value: d.fontFamily[v.replace(/font-/g, "")] || B[Object.keys(B)[0]],
|
|
8163
8168
|
onChange: (w) => f(v, w)
|
|
8164
8169
|
},
|
|
8165
8170
|
v
|
|
@@ -8879,13 +8884,13 @@ function AIChatPanel() {
|
|
|
8879
8884
|
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.",
|
|
8880
8885
|
timestamp: /* @__PURE__ */ new Date()
|
|
8881
8886
|
};
|
|
8882
|
-
r((
|
|
8887
|
+
r((B) => [...B, v]), i(!1), d(null);
|
|
8883
8888
|
}, 1500);
|
|
8884
8889
|
}, h = (b) => {
|
|
8885
8890
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), g());
|
|
8886
8891
|
}, f = (b) => {
|
|
8887
|
-
var
|
|
8888
|
-
const v = (
|
|
8892
|
+
var B;
|
|
8893
|
+
const v = (B = b.target.files) == null ? void 0 : B[0];
|
|
8889
8894
|
if (v) {
|
|
8890
8895
|
const w = new FileReader();
|
|
8891
8896
|
w.onload = (E) => {
|
|
@@ -9099,9 +9104,9 @@ const AiAssistant = () => {
|
|
|
9099
9104
|
n(S), l(a), c(""), p(""), h("");
|
|
9100
9105
|
}
|
|
9101
9106
|
}, v = (S) => {
|
|
9102
|
-
const
|
|
9103
|
-
n(
|
|
9104
|
-
},
|
|
9107
|
+
const A = a.filter((N, C) => C !== S);
|
|
9108
|
+
n(A), l(A);
|
|
9109
|
+
}, B = (S) => {
|
|
9105
9110
|
m(S), c(a[S].key), p(a[S].value);
|
|
9106
9111
|
}, w = () => {
|
|
9107
9112
|
if (i.startsWith("@")) {
|
|
@@ -9115,10 +9120,10 @@ const AiAssistant = () => {
|
|
|
9115
9120
|
}, E = (S) => {
|
|
9116
9121
|
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
|
|
9117
9122
|
}, _ = useCallback((S) => {
|
|
9118
|
-
const
|
|
9123
|
+
const A = (k) => /[.,!?;:]/.test(k), N = (k, j, T) => {
|
|
9119
9124
|
let I = "", P = "";
|
|
9120
9125
|
const L = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
|
|
9121
|
-
return j > 0 && (L === "." || !
|
|
9126
|
+
return j > 0 && (L === "." || !A(L) && L !== " ") && (I = " "), j < k.length && !A(D) && D !== " " && (P = " "), {
|
|
9122
9127
|
text: I + T + P,
|
|
9123
9128
|
prefixLength: I.length,
|
|
9124
9129
|
suffixLength: P.length
|
|
@@ -9190,16 +9195,16 @@ const AiAssistant = () => {
|
|
|
9190
9195
|
]
|
|
9191
9196
|
}
|
|
9192
9197
|
),
|
|
9193
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S,
|
|
9198
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9194
9199
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9195
9200
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
|
|
9196
9201
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
|
|
9197
9202
|
] }),
|
|
9198
9203
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9199
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A
|
|
9200
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(
|
|
9204
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
9205
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
|
|
9201
9206
|
] })
|
|
9202
|
-
] },
|
|
9207
|
+
] }, A)) })
|
|
9203
9208
|
] });
|
|
9204
9209
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9205
9210
|
const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9328,7 +9333,7 @@ const RootLayout = () => {
|
|
|
9328
9333
|
S && get(S, "view", "standard") === "standard" && (a.current = r, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
|
|
9329
9334
|
}
|
|
9330
9335
|
}, [r, x]);
|
|
9331
|
-
const
|
|
9336
|
+
const B = useMemo(() => {
|
|
9332
9337
|
if (r === null) return 0;
|
|
9333
9338
|
const S = find(x, { id: r });
|
|
9334
9339
|
return get(S, "view", "standard") === "standard" ? v : l;
|
|
@@ -9356,7 +9361,7 @@ const RootLayout = () => {
|
|
|
9356
9361
|
/* @__PURE__ */ jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9357
9362
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9358
9363
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9359
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: x.map((S,
|
|
9364
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: x.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9360
9365
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9361
9366
|
position: "top",
|
|
9362
9367
|
panelId: S.id,
|
|
@@ -9364,9 +9369,9 @@ const RootLayout = () => {
|
|
|
9364
9369
|
show: () => _(S.id)
|
|
9365
9370
|
}) }),
|
|
9366
9371
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9367
|
-
] }, "button-top-" +
|
|
9372
|
+
] }, "button-top-" + A)) }),
|
|
9368
9373
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9369
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: u == null ? void 0 : u.map((S,
|
|
9374
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: u == null ? void 0 : u.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9370
9375
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9371
9376
|
position: "bottom",
|
|
9372
9377
|
panelId: S.id,
|
|
@@ -9374,15 +9379,15 @@ const RootLayout = () => {
|
|
|
9374
9379
|
show: () => _(S.id)
|
|
9375
9380
|
}) }),
|
|
9376
9381
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
|
|
9377
|
-
] }, "button-bottom-" +
|
|
9382
|
+
] }, "button-bottom-" + A)) })
|
|
9378
9383
|
] }),
|
|
9379
9384
|
/* @__PURE__ */ jsx(
|
|
9380
9385
|
motion.div,
|
|
9381
9386
|
{
|
|
9382
9387
|
id: "left-panel",
|
|
9383
9388
|
className: "h-full max-h-full border-r border-border",
|
|
9384
|
-
initial: { width:
|
|
9385
|
-
animate: { width:
|
|
9389
|
+
initial: { width: B },
|
|
9390
|
+
animate: { width: B },
|
|
9386
9391
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9387
9392
|
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: [
|
|
9388
9393
|
/* @__PURE__ */ jsx(
|
|
@@ -9586,16 +9591,16 @@ const FEATURE_TOGGLES = {
|
|
|
9586
9591
|
var x;
|
|
9587
9592
|
return (x = h.onMount) == null ? void 0 : x.call(h, f);
|
|
9588
9593
|
}, ...g) => {
|
|
9589
|
-
const h = g[0] || ((
|
|
9590
|
-
let N = o.get(
|
|
9591
|
-
return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(
|
|
9594
|
+
const h = g[0] || ((A) => {
|
|
9595
|
+
let N = o.get(A);
|
|
9596
|
+
return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
|
|
9592
9597
|
}), f = g[1] || (() => {
|
|
9593
|
-
let
|
|
9598
|
+
let A, N;
|
|
9594
9599
|
const C = (k) => {
|
|
9595
9600
|
try {
|
|
9596
9601
|
k();
|
|
9597
9602
|
} catch (j) {
|
|
9598
|
-
|
|
9603
|
+
A || (A = !0, N = j);
|
|
9599
9604
|
}
|
|
9600
9605
|
};
|
|
9601
9606
|
do {
|
|
@@ -9606,10 +9611,10 @@ const FEATURE_TOGGLES = {
|
|
|
9606
9611
|
return (I = r.get(T)) == null ? void 0 : I.l.forEach(j);
|
|
9607
9612
|
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
|
|
9608
9613
|
} while (a.size || i.size || l.size);
|
|
9609
|
-
if (
|
|
9614
|
+
if (A)
|
|
9610
9615
|
throw N;
|
|
9611
9616
|
}), x = g[2] || (() => {
|
|
9612
|
-
const
|
|
9617
|
+
const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
|
|
9613
9618
|
for (; k.length; ) {
|
|
9614
9619
|
const j = k[k.length - 1], T = h(j);
|
|
9615
9620
|
if (C.has(j)) {
|
|
@@ -9617,27 +9622,27 @@ const FEATURE_TOGGLES = {
|
|
|
9617
9622
|
continue;
|
|
9618
9623
|
}
|
|
9619
9624
|
if (N.has(j)) {
|
|
9620
|
-
n.get(j) === T.n &&
|
|
9625
|
+
n.get(j) === T.n && A.push([j, T]), C.add(j), k.pop();
|
|
9621
9626
|
continue;
|
|
9622
9627
|
}
|
|
9623
9628
|
N.add(j);
|
|
9624
9629
|
for (const I of getMountedOrPendingDependents(j, T, r))
|
|
9625
9630
|
N.has(I) || k.push(I);
|
|
9626
9631
|
}
|
|
9627
|
-
for (let j =
|
|
9628
|
-
const [T, I] =
|
|
9632
|
+
for (let j = A.length - 1; j >= 0; --j) {
|
|
9633
|
+
const [T, I] = A[j];
|
|
9629
9634
|
let P = !1;
|
|
9630
9635
|
for (const L of I.d.keys())
|
|
9631
9636
|
if (L !== T && a.has(L)) {
|
|
9632
9637
|
P = !0;
|
|
9633
9638
|
break;
|
|
9634
9639
|
}
|
|
9635
|
-
P && (y(T),
|
|
9640
|
+
P && (y(T), B(T)), n.delete(T);
|
|
9636
9641
|
}
|
|
9637
|
-
}), y = g[3] || ((
|
|
9642
|
+
}), y = g[3] || ((A) => {
|
|
9638
9643
|
var N, C;
|
|
9639
|
-
const k = h(
|
|
9640
|
-
if (isAtomStateInitialized(k) && (r.has(
|
|
9644
|
+
const k = h(A);
|
|
9645
|
+
if (isAtomStateInitialized(k) && (r.has(A) && n.get(A) !== k.n || Array.from(k.d).every(
|
|
9641
9646
|
([R, $]) => (
|
|
9642
9647
|
// Recursively, read the atom state of the dependency, and
|
|
9643
9648
|
// check if the atom epoch number is unchanged
|
|
@@ -9648,10 +9653,10 @@ const FEATURE_TOGGLES = {
|
|
|
9648
9653
|
k.d.clear();
|
|
9649
9654
|
let j = !0;
|
|
9650
9655
|
const T = () => {
|
|
9651
|
-
r.has(
|
|
9656
|
+
r.has(A) && (B(A), x(), f());
|
|
9652
9657
|
}, I = (R) => {
|
|
9653
9658
|
var $;
|
|
9654
|
-
if (isSelfAtom(
|
|
9659
|
+
if (isSelfAtom(A, R)) {
|
|
9655
9660
|
const H = h(R);
|
|
9656
9661
|
if (!isAtomStateInitialized(H))
|
|
9657
9662
|
if (hasInitialValue(R))
|
|
@@ -9664,7 +9669,7 @@ const FEATURE_TOGGLES = {
|
|
|
9664
9669
|
try {
|
|
9665
9670
|
return returnAtomValue(M);
|
|
9666
9671
|
} finally {
|
|
9667
|
-
k.d.set(R, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(
|
|
9672
|
+
k.d.set(R, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(A, k.v, M), ($ = r.get(R)) == null || $.t.add(A), j || T();
|
|
9668
9673
|
}
|
|
9669
9674
|
};
|
|
9670
9675
|
let P, L;
|
|
@@ -9673,10 +9678,10 @@ const FEATURE_TOGGLES = {
|
|
|
9673
9678
|
return P || (P = new AbortController()), P.signal;
|
|
9674
9679
|
},
|
|
9675
9680
|
get setSelf() {
|
|
9676
|
-
return !L && isActuallyWritableAtom(
|
|
9681
|
+
return !L && isActuallyWritableAtom(A) && (L = (...R) => {
|
|
9677
9682
|
if (!j)
|
|
9678
9683
|
try {
|
|
9679
|
-
return v(
|
|
9684
|
+
return v(A, ...R);
|
|
9680
9685
|
} finally {
|
|
9681
9686
|
x(), f();
|
|
9682
9687
|
}
|
|
@@ -9684,18 +9689,18 @@ const FEATURE_TOGGLES = {
|
|
|
9684
9689
|
}
|
|
9685
9690
|
}, O = k.n;
|
|
9686
9691
|
try {
|
|
9687
|
-
const R = d(
|
|
9688
|
-
return setAtomStateValueOrPromise(
|
|
9692
|
+
const R = d(A, I, D);
|
|
9693
|
+
return setAtomStateValueOrPromise(A, R, h), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
|
|
9689
9694
|
T,
|
|
9690
9695
|
T
|
|
9691
9696
|
)), k;
|
|
9692
9697
|
} catch (R) {
|
|
9693
9698
|
return delete k.v, k.e = R, ++k.n, k;
|
|
9694
9699
|
} finally {
|
|
9695
|
-
j = !1, O !== k.n && n.get(
|
|
9700
|
+
j = !1, O !== k.n && n.get(A) === O && (n.set(A, k.n), a.add(A), (C = c.c) == null || C.call(c, A));
|
|
9696
9701
|
}
|
|
9697
|
-
}), b = g[4] || ((
|
|
9698
|
-
const N = [
|
|
9702
|
+
}), b = g[4] || ((A) => {
|
|
9703
|
+
const N = [A];
|
|
9699
9704
|
for (; N.length; ) {
|
|
9700
9705
|
const C = N.pop(), k = h(C);
|
|
9701
9706
|
for (const j of getMountedOrPendingDependents(C, k, r)) {
|
|
@@ -9703,17 +9708,17 @@ const FEATURE_TOGGLES = {
|
|
|
9703
9708
|
n.set(j, T.n), N.push(j);
|
|
9704
9709
|
}
|
|
9705
9710
|
}
|
|
9706
|
-
}), v = g[5] || ((
|
|
9711
|
+
}), v = g[5] || ((A, ...N) => {
|
|
9707
9712
|
let C = !0;
|
|
9708
9713
|
const k = (T) => returnAtomValue(y(T)), j = (T, ...I) => {
|
|
9709
9714
|
var P;
|
|
9710
9715
|
const L = h(T);
|
|
9711
9716
|
try {
|
|
9712
|
-
if (isSelfAtom(
|
|
9717
|
+
if (isSelfAtom(A, T)) {
|
|
9713
9718
|
if (!hasInitialValue(T))
|
|
9714
9719
|
throw new Error("atom not writable");
|
|
9715
9720
|
const D = L.n, O = I[0];
|
|
9716
|
-
setAtomStateValueOrPromise(T, O, h),
|
|
9721
|
+
setAtomStateValueOrPromise(T, O, h), B(T), D !== L.n && (a.add(T), (P = c.c) == null || P.call(c, T), b(T));
|
|
9717
9722
|
return;
|
|
9718
9723
|
} else
|
|
9719
9724
|
return v(T, ...I);
|
|
@@ -9722,50 +9727,50 @@ const FEATURE_TOGGLES = {
|
|
|
9722
9727
|
}
|
|
9723
9728
|
};
|
|
9724
9729
|
try {
|
|
9725
|
-
return p(
|
|
9730
|
+
return p(A, k, j, ...N);
|
|
9726
9731
|
} finally {
|
|
9727
9732
|
C = !1;
|
|
9728
9733
|
}
|
|
9729
|
-
}),
|
|
9734
|
+
}), B = g[6] || ((A) => {
|
|
9730
9735
|
var N;
|
|
9731
|
-
const C = h(
|
|
9736
|
+
const C = h(A), k = r.get(A);
|
|
9732
9737
|
if (k && !isPendingPromise(C.v)) {
|
|
9733
9738
|
for (const [j, T] of C.d)
|
|
9734
9739
|
if (!k.d.has(j)) {
|
|
9735
9740
|
const I = h(j);
|
|
9736
|
-
w(j).t.add(
|
|
9741
|
+
w(j).t.add(A), k.d.add(j), T !== I.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
|
|
9737
9742
|
}
|
|
9738
9743
|
for (const j of k.d || [])
|
|
9739
9744
|
if (!C.d.has(j)) {
|
|
9740
9745
|
k.d.delete(j);
|
|
9741
9746
|
const T = E(j);
|
|
9742
|
-
T == null || T.t.delete(
|
|
9747
|
+
T == null || T.t.delete(A);
|
|
9743
9748
|
}
|
|
9744
9749
|
}
|
|
9745
|
-
}), w = g[7] || ((
|
|
9750
|
+
}), w = g[7] || ((A) => {
|
|
9746
9751
|
var N;
|
|
9747
|
-
const C = h(
|
|
9748
|
-
let k = r.get(
|
|
9752
|
+
const C = h(A);
|
|
9753
|
+
let k = r.get(A);
|
|
9749
9754
|
if (!k) {
|
|
9750
|
-
y(
|
|
9755
|
+
y(A);
|
|
9751
9756
|
for (const j of C.d.keys())
|
|
9752
|
-
w(j).t.add(
|
|
9757
|
+
w(j).t.add(A);
|
|
9753
9758
|
if (k = {
|
|
9754
9759
|
l: /* @__PURE__ */ new Set(),
|
|
9755
9760
|
d: new Set(C.d.keys()),
|
|
9756
9761
|
t: /* @__PURE__ */ new Set()
|
|
9757
|
-
}, r.set(
|
|
9762
|
+
}, r.set(A, k), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
|
|
9758
9763
|
const j = () => {
|
|
9759
9764
|
let T = !0;
|
|
9760
9765
|
const I = (...P) => {
|
|
9761
9766
|
try {
|
|
9762
|
-
return v(
|
|
9767
|
+
return v(A, ...P);
|
|
9763
9768
|
} finally {
|
|
9764
9769
|
T || (x(), f());
|
|
9765
9770
|
}
|
|
9766
9771
|
};
|
|
9767
9772
|
try {
|
|
9768
|
-
const P = m(
|
|
9773
|
+
const P = m(A, I);
|
|
9769
9774
|
P && (k.u = () => {
|
|
9770
9775
|
T = !0;
|
|
9771
9776
|
try {
|
|
@@ -9782,18 +9787,18 @@ const FEATURE_TOGGLES = {
|
|
|
9782
9787
|
}
|
|
9783
9788
|
}
|
|
9784
9789
|
return k;
|
|
9785
|
-
}), E = g[8] || ((
|
|
9790
|
+
}), E = g[8] || ((A) => {
|
|
9786
9791
|
var N;
|
|
9787
|
-
const C = h(
|
|
9788
|
-
let k = r.get(
|
|
9792
|
+
const C = h(A);
|
|
9793
|
+
let k = r.get(A);
|
|
9789
9794
|
if (k && !k.l.size && !Array.from(k.t).some((j) => {
|
|
9790
9795
|
var T;
|
|
9791
|
-
return (T = r.get(j)) == null ? void 0 : T.d.has(
|
|
9796
|
+
return (T = r.get(j)) == null ? void 0 : T.d.has(A);
|
|
9792
9797
|
})) {
|
|
9793
|
-
k.u && i.add(k.u), k = void 0, r.delete(
|
|
9798
|
+
k.u && i.add(k.u), k = void 0, r.delete(A), (N = c.u) == null || N.call(c, A);
|
|
9794
9799
|
for (const j of C.d.keys()) {
|
|
9795
9800
|
const T = E(j);
|
|
9796
|
-
T == null || T.t.delete(
|
|
9801
|
+
T == null || T.t.delete(A);
|
|
9797
9802
|
}
|
|
9798
9803
|
return;
|
|
9799
9804
|
}
|
|
@@ -9819,22 +9824,22 @@ const FEATURE_TOGGLES = {
|
|
|
9819
9824
|
y,
|
|
9820
9825
|
b,
|
|
9821
9826
|
v,
|
|
9822
|
-
|
|
9827
|
+
B,
|
|
9823
9828
|
w,
|
|
9824
9829
|
E
|
|
9825
9830
|
], S = {
|
|
9826
|
-
get: (
|
|
9827
|
-
set: (
|
|
9831
|
+
get: (A) => returnAtomValue(y(A)),
|
|
9832
|
+
set: (A, ...N) => {
|
|
9828
9833
|
try {
|
|
9829
|
-
return v(
|
|
9834
|
+
return v(A, ...N);
|
|
9830
9835
|
} finally {
|
|
9831
9836
|
x(), f();
|
|
9832
9837
|
}
|
|
9833
9838
|
},
|
|
9834
|
-
sub: (
|
|
9835
|
-
const k = w(
|
|
9839
|
+
sub: (A, N) => {
|
|
9840
|
+
const k = w(A).l;
|
|
9836
9841
|
return k.add(N), f(), () => {
|
|
9837
|
-
k.delete(N), E(
|
|
9842
|
+
k.delete(N), E(A), f();
|
|
9838
9843
|
};
|
|
9839
9844
|
}
|
|
9840
9845
|
};
|