@chaibuilder/sdk 2.2.37 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +3 -3
- package/dist/core.d.ts +22 -0
- package/dist/core.js +241 -225
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var U = Object.defineProperty;
|
|
2
2
|
var V = (o, n, r) => n in o ? U(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
-
var
|
|
3
|
+
var F = (o, n, r) => V(o, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
6
|
import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, ResetIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
@@ -283,7 +283,7 @@ import.meta.vitest && describe("canDropBlock Function", () => {
|
|
|
283
283
|
});
|
|
284
284
|
class PubSub {
|
|
285
285
|
constructor() {
|
|
286
|
-
|
|
286
|
+
F(this, "subscribers", /* @__PURE__ */ new Map());
|
|
287
287
|
}
|
|
288
288
|
subscribe(n, r) {
|
|
289
289
|
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
@@ -832,8 +832,8 @@ const undoRedoStateAtom = atom({
|
|
|
832
832
|
else {
|
|
833
833
|
const B = keys(k);
|
|
834
834
|
v = map(f, (w) => {
|
|
835
|
-
const _ = n.find((
|
|
836
|
-
return each(B, (
|
|
835
|
+
const _ = n.find((S) => S._id === w), E = { _id: w };
|
|
836
|
+
return each(B, (S) => E[S] = _[S]), E;
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
839
|
c(map(f, (B) => ({ _id: B, ...k }))), o({
|
|
@@ -2356,10 +2356,10 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2356
2356
|
return;
|
|
2357
2357
|
}
|
|
2358
2358
|
if (h === "styles") {
|
|
2359
|
-
const E = w.map((
|
|
2360
|
-
for (const A in
|
|
2361
|
-
A !== "_id" && (
|
|
2362
|
-
return
|
|
2359
|
+
const E = w.map((S) => {
|
|
2360
|
+
for (const A in S)
|
|
2361
|
+
A !== "_id" && (S[A] = `${STYLES_KEY},${S[A]}`);
|
|
2362
|
+
return S;
|
|
2363
2363
|
});
|
|
2364
2364
|
c(E);
|
|
2365
2365
|
} else
|
|
@@ -3056,17 +3056,17 @@ class Content extends Component {
|
|
|
3056
3056
|
class Frame extends Component {
|
|
3057
3057
|
constructor(r, a) {
|
|
3058
3058
|
super(r, a);
|
|
3059
|
-
|
|
3059
|
+
F(this, "setRef", (r) => {
|
|
3060
3060
|
this.nodeRef.current = r;
|
|
3061
3061
|
const { forwardedRef: a } = this.props;
|
|
3062
3062
|
typeof a == "function" ? a(r) : a && (a.current = r);
|
|
3063
3063
|
});
|
|
3064
|
-
|
|
3064
|
+
F(this, "handleLoad", () => {
|
|
3065
3065
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
3066
3066
|
});
|
|
3067
3067
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
3068
3068
|
// fallback to an interval to check if that's the case
|
|
3069
|
-
|
|
3069
|
+
F(this, "loadCheck", () => setInterval(() => {
|
|
3070
3070
|
this.handleLoad();
|
|
3071
3071
|
}, 500));
|
|
3072
3072
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -3103,7 +3103,7 @@ class Frame extends Component {
|
|
|
3103
3103
|
return delete r.head, delete r.initialContent, delete r.mountTarget, delete r.contentDidMount, delete r.contentDidUpdate, delete r.forwardedRef, /* @__PURE__ */ jsx("iframe", { ...r, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
|
|
3104
3104
|
}
|
|
3105
3105
|
}
|
|
3106
|
-
|
|
3106
|
+
F(Frame, "defaultProps", {
|
|
3107
3107
|
style: {},
|
|
3108
3108
|
head: null,
|
|
3109
3109
|
children: void 0,
|
|
@@ -3528,12 +3528,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3528
3528
|
var j;
|
|
3529
3529
|
const A = o._type;
|
|
3530
3530
|
let N = o[r];
|
|
3531
|
-
const
|
|
3532
|
-
return x && ((j =
|
|
3531
|
+
const C = getRegisteredChaiBlock(o._type);
|
|
3532
|
+
return x && ((j = C == null ? void 0 : C.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${x}`) && (N = get(o, `${r}-${x}`)), { blockContent: N, blockType: A };
|
|
3533
3533
|
}, [o, x]), w = useCallback(
|
|
3534
3534
|
(A) => {
|
|
3535
|
-
var
|
|
3536
|
-
const N = A || ((
|
|
3535
|
+
var C;
|
|
3536
|
+
const N = A || ((C = g.current) == null ? void 0 : C.innerText);
|
|
3537
3537
|
h([b], { [r]: N }), u(null), c(null), d(-1), f([]);
|
|
3538
3538
|
},
|
|
3539
3539
|
[b, h, c, f, x]
|
|
@@ -3555,10 +3555,10 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3555
3555
|
useEffect(() => {
|
|
3556
3556
|
var y;
|
|
3557
3557
|
if (!b) return;
|
|
3558
|
-
const A = `[data-block-id="${b}"]`, N = i >= 0 ? `[data-block-index="${i}"]` : "",
|
|
3559
|
-
|
|
3558
|
+
const A = `[data-block-id="${b}"]`, N = i >= 0 ? `[data-block-index="${i}"]` : "", C = a.querySelector(`${A}${N}`);
|
|
3559
|
+
C && ((y = C == null ? void 0 : C.classList) == null || y.add("sr-only"), u(C));
|
|
3560
3560
|
}, [b, B, a, i]);
|
|
3561
|
-
const
|
|
3561
|
+
const S = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
3562
3562
|
RichTextEditor,
|
|
3563
3563
|
{
|
|
3564
3564
|
blockContent: v,
|
|
@@ -3579,7 +3579,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3579
3579
|
}
|
|
3580
3580
|
)) : null, [p, b, B, v, w, x]);
|
|
3581
3581
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3582
|
-
|
|
3582
|
+
S,
|
|
3583
3583
|
n
|
|
3584
3584
|
] });
|
|
3585
3585
|
},
|
|
@@ -3656,8 +3656,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3656
3656
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3657
3657
|
})
|
|
3658
3658
|
}) });
|
|
3659
|
-
const
|
|
3660
|
-
return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children:
|
|
3659
|
+
const S = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
|
|
3660
|
+
return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: S }) : S;
|
|
3661
3661
|
}, PartialWrapper = ({ children: o, partialBlockId: n }) => {
|
|
3662
3662
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
3663
3663
|
(d) => {
|
|
@@ -4116,8 +4116,8 @@ const DataBindingSelector = ({
|
|
|
4116
4116
|
}
|
|
4117
4117
|
const h = (b) => /[.,!?;:]/.test(b), x = (b, v, B) => {
|
|
4118
4118
|
let w = "", _ = "";
|
|
4119
|
-
const E = v > 0 ? b[v - 1] : "",
|
|
4120
|
-
return v > 0 && (E === "." || !h(E) && E !== " ") && (w = " "), v < b.length && !h(
|
|
4119
|
+
const E = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
|
|
4120
|
+
return v > 0 && (E === "." || !h(E) && E !== " ") && (w = " "), v < b.length && !h(S) && S !== " " && (_ = " "), {
|
|
4121
4121
|
text: w + B + _,
|
|
4122
4122
|
prefixLength: w.length,
|
|
4123
4123
|
suffixLength: _.length
|
|
@@ -4134,11 +4134,11 @@ const DataBindingSelector = ({
|
|
|
4134
4134
|
if (B !== w)
|
|
4135
4135
|
b.chain().deleteSelection().insertContent(v).run();
|
|
4136
4136
|
else {
|
|
4137
|
-
const { state: E } = b,
|
|
4138
|
-
let
|
|
4139
|
-
|
|
4137
|
+
const { state: E } = b, S = E.selection.from, A = E.doc.textBetween(Math.max(0, S - 1), S), N = E.doc.textBetween(S, Math.min(S + 1, E.doc.content.size));
|
|
4138
|
+
let C = "";
|
|
4139
|
+
S > 0 && A !== " " && !h(A) && (C = " ");
|
|
4140
4140
|
let y = "";
|
|
4141
|
-
N && N !== " " && !h(N) && (y = " "), b.chain().insertContent(
|
|
4141
|
+
N && N !== " " && !h(N) && (y = " "), b.chain().insertContent(C + v + y).run();
|
|
4142
4142
|
}
|
|
4143
4143
|
setTimeout(() => n(b.getHTML(), {}, r), 100);
|
|
4144
4144
|
return;
|
|
@@ -4146,11 +4146,11 @@ const DataBindingSelector = ({
|
|
|
4146
4146
|
} else {
|
|
4147
4147
|
const b = f, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
|
|
4148
4148
|
if (w > v) {
|
|
4149
|
-
const N = `{{${g}}}`, { text:
|
|
4149
|
+
const N = `{{${g}}}`, { text: C } = x(B, v, N), y = B.slice(0, v) + C + B.slice(w);
|
|
4150
4150
|
n(y, {}, r);
|
|
4151
4151
|
return;
|
|
4152
4152
|
}
|
|
4153
|
-
const E = `{{${g}}}`, { text:
|
|
4153
|
+
const E = `{{${g}}}`, { text: S } = x(B, v, E), A = B.slice(0, v) + S + B.slice(v);
|
|
4154
4154
|
n(A, {}, r);
|
|
4155
4155
|
}
|
|
4156
4156
|
},
|
|
@@ -4173,73 +4173,73 @@ const DataBindingSelector = ({
|
|
|
4173
4173
|
onChange: r
|
|
4174
4174
|
}) => {
|
|
4175
4175
|
var N;
|
|
4176
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (
|
|
4176
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, y) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [k, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
|
|
4177
4177
|
useEffect(() => {
|
|
4178
4178
|
if (h(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4179
|
-
const
|
|
4179
|
+
const C = split(o, ":"), y = get(C, 1, "page") || "page";
|
|
4180
4180
|
g(y), (async () => {
|
|
4181
|
-
const j = await l(y, [get(
|
|
4181
|
+
const j = await l(y, [get(C, 2, "page")]);
|
|
4182
4182
|
j && Array.isArray(j) && h(get(j, [0, "name"], ""));
|
|
4183
4183
|
})();
|
|
4184
4184
|
}, [o]);
|
|
4185
4185
|
const w = useDebouncedCallback(
|
|
4186
|
-
async (
|
|
4187
|
-
if (isEmpty(
|
|
4186
|
+
async (C) => {
|
|
4187
|
+
if (isEmpty(C))
|
|
4188
4188
|
f([]);
|
|
4189
4189
|
else {
|
|
4190
|
-
const y = await l(u,
|
|
4190
|
+
const y = await l(u, C);
|
|
4191
4191
|
f(y);
|
|
4192
4192
|
}
|
|
4193
4193
|
c(!1), b(-1);
|
|
4194
4194
|
},
|
|
4195
4195
|
[u],
|
|
4196
4196
|
300
|
|
4197
|
-
), _ = (
|
|
4198
|
-
const y = ["pageType", u,
|
|
4199
|
-
y[1] && (r(y.join(":")), h(
|
|
4200
|
-
}, E = (
|
|
4201
|
-
switch (
|
|
4197
|
+
), _ = (C) => {
|
|
4198
|
+
const y = ["pageType", u, C.id];
|
|
4199
|
+
y[1] && (r(y.join(":")), h(C.name), p(!1), f([]), b(-1));
|
|
4200
|
+
}, E = (C) => {
|
|
4201
|
+
switch (C.key) {
|
|
4202
4202
|
case "ArrowDown":
|
|
4203
|
-
|
|
4203
|
+
C.preventDefault(), b((y) => y < x.length - 1 ? y + 1 : y);
|
|
4204
4204
|
break;
|
|
4205
4205
|
case "ArrowUp":
|
|
4206
|
-
|
|
4206
|
+
C.preventDefault(), b((y) => y > 0 ? y - 1 : y);
|
|
4207
4207
|
break;
|
|
4208
4208
|
case "Enter":
|
|
4209
|
-
if (
|
|
4209
|
+
if (C.preventDefault(), x.length === 0) return;
|
|
4210
4210
|
k >= 0 && _(x[k]);
|
|
4211
4211
|
break;
|
|
4212
4212
|
case "Escape":
|
|
4213
|
-
|
|
4213
|
+
C.preventDefault(), S();
|
|
4214
4214
|
break;
|
|
4215
4215
|
}
|
|
4216
4216
|
};
|
|
4217
4217
|
useEffect(() => {
|
|
4218
4218
|
if (k >= 0 && v.current) {
|
|
4219
|
-
const
|
|
4220
|
-
|
|
4219
|
+
const C = v.current.children[k];
|
|
4220
|
+
C == null || C.scrollIntoView({ block: "nearest" });
|
|
4221
4221
|
}
|
|
4222
4222
|
}, [k]);
|
|
4223
|
-
const
|
|
4223
|
+
const S = () => {
|
|
4224
4224
|
h(""), f([]), b(-1), p(!1), r("");
|
|
4225
|
-
}, A = (
|
|
4226
|
-
h(
|
|
4225
|
+
}, A = (C) => {
|
|
4226
|
+
h(C), p(!isEmpty(C)), c(!0), w(C);
|
|
4227
4227
|
};
|
|
4228
4228
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4229
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (
|
|
4229
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (C) => g(C.target.value), children: map(n, (C) => /* @__PURE__ */ jsx("option", { value: C.key, children: C.name }, C.key)) }),
|
|
4230
4230
|
u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
4231
4231
|
/* @__PURE__ */ jsx(
|
|
4232
4232
|
"input",
|
|
4233
4233
|
{
|
|
4234
4234
|
type: "text",
|
|
4235
4235
|
value: m,
|
|
4236
|
-
onChange: (
|
|
4236
|
+
onChange: (C) => A(C.target.value),
|
|
4237
4237
|
onKeyDown: E,
|
|
4238
4238
|
placeholder: a(`Search ${B ?? ""}`),
|
|
4239
4239
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4240
4240
|
}
|
|
4241
4241
|
),
|
|
4242
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick:
|
|
4242
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
4243
4243
|
] }),
|
|
4244
4244
|
(i || !isEmpty(x) || d && isEmpty(x)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4245
4245
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4249,22 +4249,22 @@ const DataBindingSelector = ({
|
|
|
4249
4249
|
' "',
|
|
4250
4250
|
m,
|
|
4251
4251
|
'"'
|
|
4252
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(x == null ? void 0 : x.slice(0, 20), (
|
|
4252
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(x == null ? void 0 : x.slice(0, 20), (C, y) => /* @__PURE__ */ jsxs(
|
|
4253
4253
|
"li",
|
|
4254
4254
|
{
|
|
4255
|
-
onClick: () => _(
|
|
4256
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
4255
|
+
onClick: () => _(C),
|
|
4256
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(C.id) ? "bg-blue-200" : y === k ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4257
4257
|
children: [
|
|
4258
|
-
|
|
4258
|
+
C.name,
|
|
4259
4259
|
" ",
|
|
4260
|
-
|
|
4260
|
+
C.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
4261
4261
|
"( ",
|
|
4262
|
-
|
|
4262
|
+
C.slug,
|
|
4263
4263
|
" )"
|
|
4264
4264
|
] })
|
|
4265
4265
|
]
|
|
4266
4266
|
},
|
|
4267
|
-
|
|
4267
|
+
C.id
|
|
4268
4268
|
)) }) })
|
|
4269
4269
|
] });
|
|
4270
4270
|
}, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
|
|
@@ -4876,22 +4876,22 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4876
4876
|
), b = useMemo(() => get(LANGUAGES, k, k), [k]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
|
|
4877
4877
|
() => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
|
|
4878
4878
|
[w, B == null ? void 0 : B._type]
|
|
4879
|
-
), [E,
|
|
4879
|
+
), [E, S] = useState(null);
|
|
4880
4880
|
if (d)
|
|
4881
4881
|
return null;
|
|
4882
4882
|
if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: n, children: a });
|
|
4883
4883
|
const N = _ == null ? void 0 : _.includes(o.replace("root.", ""));
|
|
4884
4884
|
if (u.type === "array") {
|
|
4885
|
-
const
|
|
4885
|
+
const C = E === o;
|
|
4886
4886
|
return /* @__PURE__ */ jsxs("div", { className: `${n} relative`, children: [
|
|
4887
4887
|
u.title && /* @__PURE__ */ jsxs(
|
|
4888
4888
|
"label",
|
|
4889
4889
|
{
|
|
4890
4890
|
htmlFor: o,
|
|
4891
|
-
onClick: () => C
|
|
4891
|
+
onClick: () => S(C ? null : o),
|
|
4892
4892
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4893
4893
|
children: [
|
|
4894
|
-
|
|
4894
|
+
C ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4895
4895
|
/* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
|
|
4896
4896
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: r }),
|
|
4897
4897
|
" ",
|
|
@@ -4899,7 +4899,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4899
4899
|
]
|
|
4900
4900
|
}
|
|
4901
4901
|
),
|
|
4902
|
-
(g == null ? void 0 : g.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${
|
|
4902
|
+
(g == null ? void 0 : g.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${C ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
4903
4903
|
c,
|
|
4904
4904
|
a,
|
|
4905
4905
|
l,
|
|
@@ -4922,8 +4922,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4922
4922
|
DataBindingSelector,
|
|
4923
4923
|
{
|
|
4924
4924
|
schema: u,
|
|
4925
|
-
onChange: (
|
|
4926
|
-
m(
|
|
4925
|
+
onChange: (C) => {
|
|
4926
|
+
m(C, g, o);
|
|
4927
4927
|
},
|
|
4928
4928
|
id: o,
|
|
4929
4929
|
formData: g
|
|
@@ -5027,36 +5027,36 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5027
5027
|
}), a;
|
|
5028
5028
|
};
|
|
5029
5029
|
function BlockSettings() {
|
|
5030
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData: E },
|
|
5031
|
-
|
|
5030
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData: E }, S, A) => {
|
|
5031
|
+
S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(E, S) }, A);
|
|
5032
5032
|
}, f = useCallback(
|
|
5033
|
-
debounce(({ formData: E },
|
|
5034
|
-
x({ formData: E },
|
|
5033
|
+
debounce(({ formData: E }, S, A) => {
|
|
5034
|
+
x({ formData: E }, S, A), d(E);
|
|
5035
5035
|
}, 1500),
|
|
5036
5036
|
[n == null ? void 0 : n._id, o]
|
|
5037
|
-
), k = ({ formData: E },
|
|
5038
|
-
|
|
5039
|
-
}, b = ({ formData: E },
|
|
5040
|
-
|
|
5037
|
+
), k = ({ formData: E }, S) => {
|
|
5038
|
+
S && (r([n._id], { [S]: get(E, S) }), f({ formData: E }, S, { [S]: get(c, S) }));
|
|
5039
|
+
}, b = ({ formData: E }, S) => {
|
|
5040
|
+
S && (r([g._id], { [S]: get(E, S) }), f({ formData: E }, S, { [S]: get(c, S) }));
|
|
5041
5041
|
}, { schema: v, uiSchema: B } = useMemo(() => {
|
|
5042
5042
|
const E = n == null ? void 0 : n._type;
|
|
5043
5043
|
if (!E)
|
|
5044
5044
|
return { schema: {}, uiSchema: {} };
|
|
5045
5045
|
try {
|
|
5046
|
-
const { schema:
|
|
5046
|
+
const { schema: S, uiSchema: A } = getBlockFormSchemas(E);
|
|
5047
5047
|
if (E === "Repeater") {
|
|
5048
5048
|
const N = get(n, "repeaterItems", "");
|
|
5049
5049
|
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" }));
|
|
5050
5050
|
}
|
|
5051
|
-
return { schema:
|
|
5051
|
+
return { schema: S, uiSchema: A };
|
|
5052
5052
|
} catch {
|
|
5053
5053
|
return { schema: {}, uiSchema: {} };
|
|
5054
5054
|
}
|
|
5055
5055
|
}, [n]), { wrapperSchema: w, wrapperUiSchema: _ } = useMemo(() => {
|
|
5056
5056
|
if (!g || !(g != null && g._type))
|
|
5057
5057
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5058
|
-
const E = g == null ? void 0 : g._type, { schema:
|
|
5059
|
-
return { wrapperSchema:
|
|
5058
|
+
const E = g == null ? void 0 : g._type, { schema: S = {}, uiSchema: A = {} } = getBlockFormSchemas(E);
|
|
5059
|
+
return { wrapperSchema: S, wrapperUiSchema: A };
|
|
5060
5060
|
}, [g]);
|
|
5061
5061
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5062
5062
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -5302,15 +5302,15 @@ const BlockStylingProps = () => {
|
|
|
5302
5302
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5303
5303
|
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [k, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
|
|
5304
5304
|
useEffect(() => {
|
|
5305
|
-
const { value:
|
|
5305
|
+
const { value: C, unit: y } = getClassValueAndUnit(i);
|
|
5306
5306
|
if (y === "") {
|
|
5307
|
-
l(
|
|
5307
|
+
l(C), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5308
5308
|
return;
|
|
5309
5309
|
}
|
|
5310
|
-
h(y), l(y === "class" || isEmpty(
|
|
5310
|
+
h(y), l(y === "class" || isEmpty(C) ? "" : C);
|
|
5311
5311
|
}, [i, p, u]);
|
|
5312
|
-
const E = useThrottledCallback((
|
|
5313
|
-
(
|
|
5312
|
+
const E = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), A = useCallback(
|
|
5313
|
+
(C = !1) => {
|
|
5314
5314
|
const y = getUserInputValues(`${a}`, u);
|
|
5315
5315
|
if (get(y, "error", !1)) {
|
|
5316
5316
|
f(!0);
|
|
@@ -5324,23 +5324,23 @@ const BlockStylingProps = () => {
|
|
|
5324
5324
|
if (get(y, "value") === "")
|
|
5325
5325
|
return;
|
|
5326
5326
|
const L = `${get(y, "value", "").startsWith("-") ? "-" : ""}${d}[${get(y, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5327
|
-
|
|
5327
|
+
C ? S(L) : E(L);
|
|
5328
5328
|
},
|
|
5329
|
-
[E,
|
|
5329
|
+
[E, S, a, m, d, u]
|
|
5330
5330
|
), N = useCallback(
|
|
5331
|
-
(
|
|
5331
|
+
(C) => {
|
|
5332
5332
|
const y = getUserInputValues(`${a}`, u);
|
|
5333
5333
|
if (get(y, "error", !1)) {
|
|
5334
5334
|
f(!0);
|
|
5335
5335
|
return;
|
|
5336
5336
|
}
|
|
5337
|
-
if (
|
|
5338
|
-
E(`${d}${
|
|
5337
|
+
if (C === "auto" || C === "none") {
|
|
5338
|
+
E(`${d}${C}`);
|
|
5339
5339
|
return;
|
|
5340
5340
|
}
|
|
5341
5341
|
if (get(y, "value") === "")
|
|
5342
5342
|
return;
|
|
5343
|
-
const j = get(y, "unit") !== "" ? get(y, "unit") :
|
|
5343
|
+
const j = get(y, "unit") !== "" ? get(y, "unit") : C, L = `${get(y, "value", "").startsWith("-") ? "-" : ""}${d}[${get(y, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5344
5344
|
E(L);
|
|
5345
5345
|
},
|
|
5346
5346
|
[E, a, d, u]
|
|
@@ -5364,29 +5364,29 @@ const BlockStylingProps = () => {
|
|
|
5364
5364
|
"input",
|
|
5365
5365
|
{
|
|
5366
5366
|
readOnly: m === "class",
|
|
5367
|
-
onKeyPress: (
|
|
5368
|
-
|
|
5367
|
+
onKeyPress: (C) => {
|
|
5368
|
+
C.key === "Enter" && A();
|
|
5369
5369
|
},
|
|
5370
|
-
onKeyDown: (
|
|
5371
|
-
if (
|
|
5370
|
+
onKeyDown: (C) => {
|
|
5371
|
+
if (C.keyCode !== 38 && C.keyCode !== 40)
|
|
5372
5372
|
return;
|
|
5373
|
-
|
|
5374
|
-
const y = parseInt$1(
|
|
5373
|
+
C.preventDefault(), _(!0);
|
|
5374
|
+
const y = parseInt$1(C.target.value);
|
|
5375
5375
|
let j = isNaN$1(y) ? 0 : y;
|
|
5376
|
-
|
|
5376
|
+
C.keyCode === 38 && (j += 1), C.keyCode === 40 && (j -= 1);
|
|
5377
5377
|
const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5378
|
-
|
|
5378
|
+
S(R);
|
|
5379
5379
|
},
|
|
5380
|
-
onKeyUp: (
|
|
5381
|
-
w && (
|
|
5380
|
+
onKeyUp: (C) => {
|
|
5381
|
+
w && (C.preventDefault(), _(!1));
|
|
5382
5382
|
},
|
|
5383
5383
|
onBlur: () => A(),
|
|
5384
|
-
onChange: (
|
|
5385
|
-
f(!1), l(
|
|
5384
|
+
onChange: (C) => {
|
|
5385
|
+
f(!1), l(C.target.value);
|
|
5386
5386
|
},
|
|
5387
|
-
onClick: (
|
|
5387
|
+
onClick: (C) => {
|
|
5388
5388
|
var y;
|
|
5389
|
-
(y =
|
|
5389
|
+
(y = C == null ? void 0 : C.target) == null || y.select(), r(!1);
|
|
5390
5390
|
},
|
|
5391
5391
|
value: v ? k : a,
|
|
5392
5392
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -5413,8 +5413,8 @@ const BlockStylingProps = () => {
|
|
|
5413
5413
|
{
|
|
5414
5414
|
units: u,
|
|
5415
5415
|
current: m,
|
|
5416
|
-
onSelect: (
|
|
5417
|
-
r(!1), h(
|
|
5416
|
+
onSelect: (C) => {
|
|
5417
|
+
r(!1), h(C), N(C);
|
|
5418
5418
|
}
|
|
5419
5419
|
}
|
|
5420
5420
|
) })
|
|
@@ -5424,18 +5424,18 @@ const BlockStylingProps = () => {
|
|
|
5424
5424
|
DragStyleButton,
|
|
5425
5425
|
{
|
|
5426
5426
|
onDragStart: () => B(!0),
|
|
5427
|
-
onDragEnd: (
|
|
5428
|
-
if (b(() => ""), B(!1), isEmpty(
|
|
5427
|
+
onDragEnd: (C) => {
|
|
5428
|
+
if (b(() => ""), B(!1), isEmpty(C))
|
|
5429
5429
|
return;
|
|
5430
|
-
const y = `${
|
|
5430
|
+
const y = `${C}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5431
5431
|
E(I);
|
|
5432
5432
|
},
|
|
5433
|
-
onDrag: (
|
|
5434
|
-
if (isEmpty(
|
|
5433
|
+
onDrag: (C) => {
|
|
5434
|
+
if (isEmpty(C))
|
|
5435
5435
|
return;
|
|
5436
|
-
b(
|
|
5437
|
-
const y = `${
|
|
5438
|
-
|
|
5436
|
+
b(C);
|
|
5437
|
+
const y = `${C}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5438
|
+
S(I);
|
|
5439
5439
|
},
|
|
5440
5440
|
currentValue: a,
|
|
5441
5441
|
unit: m,
|
|
@@ -5899,11 +5899,11 @@ const COLOR_PROP = {
|
|
|
5899
5899
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5900
5900
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5901
5901
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), k = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
|
|
5902
|
-
(
|
|
5903
|
-
const N = { dark: p, mq: g, mod: u, cls:
|
|
5902
|
+
(S, A = !0) => {
|
|
5903
|
+
const N = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
|
|
5904
5904
|
(p || u !== "") && (N.mq = "xs");
|
|
5905
|
-
const
|
|
5906
|
-
h(f, [
|
|
5905
|
+
const C = generateFullClsName(N);
|
|
5906
|
+
h(f, [C], A);
|
|
5907
5907
|
},
|
|
5908
5908
|
[f, p, g, u, l, h]
|
|
5909
5909
|
), v = useCallback(() => {
|
|
@@ -5913,7 +5913,7 @@ const COLOR_PROP = {
|
|
|
5913
5913
|
i(B, m);
|
|
5914
5914
|
}, [B, i, m]);
|
|
5915
5915
|
const [, , w] = useScreenSizeWidth(), _ = useCallback(
|
|
5916
|
-
(
|
|
5916
|
+
(S) => {
|
|
5917
5917
|
w({
|
|
5918
5918
|
xs: 400,
|
|
5919
5919
|
sm: 640,
|
|
@@ -5921,7 +5921,7 @@ const COLOR_PROP = {
|
|
|
5921
5921
|
lg: 1024,
|
|
5922
5922
|
xl: 1420,
|
|
5923
5923
|
"2xl": 1920
|
|
5924
|
-
}[
|
|
5924
|
+
}[S]);
|
|
5925
5925
|
},
|
|
5926
5926
|
[w]
|
|
5927
5927
|
), E = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
@@ -6361,9 +6361,9 @@ function ManualClasses() {
|
|
|
6361
6361
|
} else
|
|
6362
6362
|
D = i.search(R);
|
|
6363
6363
|
return _(map(D, "item"));
|
|
6364
|
-
},
|
|
6364
|
+
}, S = () => {
|
|
6365
6365
|
_([]);
|
|
6366
|
-
}, A = (L) => L.name, N = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }),
|
|
6366
|
+
}, A = (L) => L.name, N = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), C = useMemo(
|
|
6367
6367
|
() => ({
|
|
6368
6368
|
ref: o,
|
|
6369
6369
|
autoComplete: "off",
|
|
@@ -6418,10 +6418,10 @@ function ManualClasses() {
|
|
|
6418
6418
|
{
|
|
6419
6419
|
suggestions: w,
|
|
6420
6420
|
onSuggestionsFetchRequested: E,
|
|
6421
|
-
onSuggestionsClearRequested:
|
|
6421
|
+
onSuggestionsClearRequested: S,
|
|
6422
6422
|
getSuggestionValue: A,
|
|
6423
6423
|
renderSuggestion: N,
|
|
6424
|
-
inputProps:
|
|
6424
|
+
inputProps: C,
|
|
6425
6425
|
containerProps: {
|
|
6426
6426
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
6427
6427
|
},
|
|
@@ -6918,14 +6918,14 @@ const CoreBlock = ({
|
|
|
6918
6918
|
a.content = getTextContent(w);
|
|
6919
6919
|
const _ = find(
|
|
6920
6920
|
r.children || [],
|
|
6921
|
-
(E) => (E == null ? void 0 : E.tagName) === "span" && some(E.children || [], (
|
|
6921
|
+
(E) => (E == null ? void 0 : E.tagName) === "span" && some(E.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg")
|
|
6922
6922
|
);
|
|
6923
6923
|
if (_) {
|
|
6924
|
-
const E = find(_.children || [], (
|
|
6924
|
+
const E = find(_.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg");
|
|
6925
6925
|
if (E) {
|
|
6926
6926
|
a.icon = stringify([E]);
|
|
6927
|
-
const { height:
|
|
6928
|
-
a.iconHeight =
|
|
6927
|
+
const { height: S, width: A } = getSvgDimensions(E, "16px", "16px");
|
|
6928
|
+
a.iconHeight = S, a.iconWidth = A;
|
|
6929
6929
|
}
|
|
6930
6930
|
}
|
|
6931
6931
|
return [a];
|
|
@@ -6937,8 +6937,8 @@ const CoreBlock = ({
|
|
|
6937
6937
|
const w = stringify([r]);
|
|
6938
6938
|
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];
|
|
6939
6939
|
} else if (r.tagName === "svg") {
|
|
6940
|
-
const w = find(r.attributes, { key: "height" }), _ = find(r.attributes, { key: "width" }), E = get(w, "value") ? `[${get(w, "value")}px]` : "24px",
|
|
6941
|
-
return a.styles = `${STYLES_KEY}, ${cn$2(`w-${
|
|
6940
|
+
const w = find(r.attributes, { key: "height" }), _ = find(r.attributes, { key: "width" }), E = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(_, "value") ? `[${get(_, "value")}px]` : "24px", A = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
6941
|
+
return a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${E}`, A)}`.trim(), r.attributes = filter(r.attributes, (N) => !includes(["style", "width", "height", "class"], N.key)), a.icon = stringify([r]), [a];
|
|
6942
6942
|
} else if (r.tagName == "option" && n && ((B = n.block) == null ? void 0 : B._type) === "Select")
|
|
6943
6943
|
return n.block.options.push({
|
|
6944
6944
|
label: getTextContent(r.children),
|
|
@@ -7074,9 +7074,9 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7074
7074
|
if (k(first(w)) && (_ = null), !isEmpty(w)) {
|
|
7075
7075
|
const E = { blocks: w, uiLibrary: !0, parent: _ };
|
|
7076
7076
|
if (B.dataTransfer.setData("text/plain", JSON.stringify(E)), o.preview) {
|
|
7077
|
-
const
|
|
7078
|
-
|
|
7079
|
-
B.dataTransfer.setDragImage(
|
|
7077
|
+
const S = new Image();
|
|
7078
|
+
S.src = o.preview, S.onload = () => {
|
|
7079
|
+
B.dataTransfer.setDragImage(S, 0, 0);
|
|
7080
7080
|
};
|
|
7081
7081
|
} else
|
|
7082
7082
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
@@ -7136,7 +7136,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7136
7136
|
w.current && (clearTimeout(w.current), w.current = null), w.current = setTimeout(() => {
|
|
7137
7137
|
w.current && v(y);
|
|
7138
7138
|
}, 400);
|
|
7139
|
-
},
|
|
7139
|
+
}, S = () => {
|
|
7140
7140
|
i != null && i.id && p(i.id);
|
|
7141
7141
|
}, A = () => {
|
|
7142
7142
|
g("");
|
|
@@ -7146,7 +7146,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7146
7146
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7147
7147
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7148
7148
|
] });
|
|
7149
|
-
const N = filter(B, (y, j) => j % 2 === 0),
|
|
7149
|
+
const N = filter(B, (y, j) => j % 2 === 0), C = filter(B, (y, j) => j % 2 === 1);
|
|
7150
7150
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7151
7151
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7152
7152
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7176,7 +7176,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7176
7176
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7177
7177
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(k) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7178
7178
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: _("Failed to load the UI library. Try again") }),
|
|
7179
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
7179
|
+
/* @__PURE__ */ jsxs(Button, { onClick: S, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7180
7180
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
|
|
7181
7181
|
_("Retry")
|
|
7182
7182
|
] })
|
|
@@ -7217,7 +7217,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7217
7217
|
},
|
|
7218
7218
|
`block-${j}`
|
|
7219
7219
|
)) }),
|
|
7220
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7220
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: C.map((y, j) => /* @__PURE__ */ jsx(
|
|
7221
7221
|
BlockCard,
|
|
7222
7222
|
{
|
|
7223
7223
|
parentId: o,
|
|
@@ -7324,8 +7324,8 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7324
7324
|
}, ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (o, n) => {
|
|
7325
7325
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7326
7326
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7327
|
-
var
|
|
7328
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (
|
|
7327
|
+
var C;
|
|
7328
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (C = find(c, (y) => y._id === r)) == null ? void 0 : C._type, [h, x] = useState("all"), [f, k] = useState(null), b = useRef(null);
|
|
7329
7329
|
useEffect(() => {
|
|
7330
7330
|
const y = setTimeout(() => {
|
|
7331
7331
|
var j;
|
|
@@ -7358,10 +7358,10 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7358
7358
|
(y) => reject(filter(values(_), { group: y }), { hidden: !0 }).length > 0
|
|
7359
7359
|
) : o.filter((y) => reject(filter(values(n), { group: y }), { hidden: !0 }).length > 0),
|
|
7360
7360
|
[n, _, o, d]
|
|
7361
|
-
),
|
|
7361
|
+
), S = useMemo(
|
|
7362
7362
|
() => sortBy(E, (y) => CORE_GROUPS.indexOf(y) === -1 ? 99 : CORE_GROUPS.indexOf(y)),
|
|
7363
7363
|
[E]
|
|
7364
|
-
), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), N = useMemo(() => h === "all" ?
|
|
7364
|
+
), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
|
|
7365
7365
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7366
7366
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7367
7367
|
Input$1,
|
|
@@ -7375,7 +7375,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7375
7375
|
}
|
|
7376
7376
|
) }),
|
|
7377
7377
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
|
|
7378
|
-
|
|
7378
|
+
S.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
7379
7379
|
/* @__PURE__ */ jsx(
|
|
7380
7380
|
"button",
|
|
7381
7381
|
{
|
|
@@ -7387,7 +7387,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7387
7387
|
},
|
|
7388
7388
|
"sidebar-all"
|
|
7389
7389
|
),
|
|
7390
|
-
|
|
7390
|
+
S.map((y) => /* @__PURE__ */ jsx(
|
|
7391
7391
|
"button",
|
|
7392
7392
|
{
|
|
7393
7393
|
onClick: () => w(y),
|
|
@@ -7775,13 +7775,13 @@ const Input = ({ node: o }) => {
|
|
|
7775
7775
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
7776
7776
|
}, E = (T) => {
|
|
7777
7777
|
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
7778
|
-
}, [
|
|
7778
|
+
}, [S, A] = useAtom$1(currentAddSelection), N = () => {
|
|
7779
7779
|
var T;
|
|
7780
|
-
|
|
7781
|
-
},
|
|
7780
|
+
C(), o.parent.isSelected || A((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
7781
|
+
}, C = () => {
|
|
7782
7782
|
A(null);
|
|
7783
7783
|
}, y = (T) => {
|
|
7784
|
-
|
|
7784
|
+
C(), T.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(T);
|
|
7785
7785
|
};
|
|
7786
7786
|
useEffect(() => {
|
|
7787
7787
|
const T = setTimeout(() => {
|
|
@@ -7795,7 +7795,7 @@ const Input = ({ node: o }) => {
|
|
|
7795
7795
|
const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
|
|
7796
7796
|
$.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
|
|
7797
7797
|
}, I = (T) => {
|
|
7798
|
-
|
|
7798
|
+
C();
|
|
7799
7799
|
const D = get(o, "parent.id");
|
|
7800
7800
|
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
|
|
7801
7801
|
};
|
|
@@ -7846,7 +7846,7 @@ const Input = ({ node: o }) => {
|
|
|
7846
7846
|
T.stopPropagation(), I(o.childIndex);
|
|
7847
7847
|
},
|
|
7848
7848
|
onMouseEnter: N,
|
|
7849
|
-
onMouseLeave:
|
|
7849
|
+
onMouseLeave: C,
|
|
7850
7850
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-primary opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7851
7851
|
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" }) })
|
|
7852
7852
|
}
|
|
@@ -7858,7 +7858,7 @@ const Input = ({ node: o }) => {
|
|
|
7858
7858
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
7859
7859
|
f ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
|
|
7860
7860
|
k && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
|
|
7861
|
-
(o == null ? void 0 : o.id) ===
|
|
7861
|
+
(o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
|
|
7862
7862
|
b && "opacity-20",
|
|
7863
7863
|
l.includes(h) ? "opacity-50" : "",
|
|
7864
7864
|
L && f && "bg-primary/20 text-primary"
|
|
@@ -9216,26 +9216,26 @@ const AiAssistant = () => {
|
|
|
9216
9216
|
return;
|
|
9217
9217
|
}
|
|
9218
9218
|
if (i) {
|
|
9219
|
-
const
|
|
9220
|
-
r(
|
|
9219
|
+
const S = [...a, { key: i, value: d }];
|
|
9220
|
+
r(S), l(a), c(""), p(""), h("");
|
|
9221
9221
|
}
|
|
9222
|
-
}, v = (
|
|
9223
|
-
const A = a.filter((N,
|
|
9222
|
+
}, v = (S) => {
|
|
9223
|
+
const A = a.filter((N, C) => C !== S);
|
|
9224
9224
|
r(A), l(A);
|
|
9225
|
-
}, B = (
|
|
9226
|
-
g(
|
|
9225
|
+
}, B = (S) => {
|
|
9226
|
+
g(S), c(a[S].key), p(a[S].value);
|
|
9227
9227
|
}, w = () => {
|
|
9228
9228
|
if (i.startsWith("@")) {
|
|
9229
9229
|
h("Attribute keys cannot start with '@'");
|
|
9230
9230
|
return;
|
|
9231
9231
|
}
|
|
9232
9232
|
if (u !== null && i) {
|
|
9233
|
-
const
|
|
9234
|
-
|
|
9233
|
+
const S = [...a];
|
|
9234
|
+
S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), h("");
|
|
9235
9235
|
}
|
|
9236
|
-
}, _ = (
|
|
9237
|
-
|
|
9238
|
-
}, E = useCallback((
|
|
9236
|
+
}, _ = (S) => {
|
|
9237
|
+
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
|
|
9238
|
+
}, E = useCallback((S) => {
|
|
9239
9239
|
const A = (y) => /[.,!?;:]/.test(y), N = (y, j, I) => {
|
|
9240
9240
|
let L = "", R = "";
|
|
9241
9241
|
const T = j > 0 ? y[j - 1] : "", D = j < y.length ? y[j] : "";
|
|
@@ -9244,15 +9244,15 @@ const AiAssistant = () => {
|
|
|
9244
9244
|
prefixLength: L.length,
|
|
9245
9245
|
suffixLength: R.length
|
|
9246
9246
|
};
|
|
9247
|
-
},
|
|
9248
|
-
if (
|
|
9249
|
-
const y =
|
|
9247
|
+
}, C = f.current;
|
|
9248
|
+
if (C) {
|
|
9249
|
+
const y = C.selectionStart || 0, j = C.value || "", I = C.selectionEnd || y;
|
|
9250
9250
|
if (I > y) {
|
|
9251
|
-
const O = `{{${
|
|
9251
|
+
const O = `{{${S}}}`, { text: P } = N(j, y, O), $ = j.slice(0, y) + P + j.slice(I);
|
|
9252
9252
|
p($);
|
|
9253
9253
|
return;
|
|
9254
9254
|
}
|
|
9255
|
-
const R = `{{${
|
|
9255
|
+
const R = `{{${S}}}`, { text: T } = N(j, y, R), D = j.slice(0, y) + T + j.slice(y);
|
|
9256
9256
|
p(D);
|
|
9257
9257
|
}
|
|
9258
9258
|
}, []);
|
|
@@ -9260,8 +9260,8 @@ const AiAssistant = () => {
|
|
|
9260
9260
|
/* @__PURE__ */ jsxs(
|
|
9261
9261
|
"form",
|
|
9262
9262
|
{
|
|
9263
|
-
onSubmit: (
|
|
9264
|
-
|
|
9263
|
+
onSubmit: (S) => {
|
|
9264
|
+
S.preventDefault(), u !== null ? w() : b();
|
|
9265
9265
|
},
|
|
9266
9266
|
className: "space-y-3",
|
|
9267
9267
|
children: [
|
|
@@ -9277,7 +9277,7 @@ const AiAssistant = () => {
|
|
|
9277
9277
|
id: "attrKey",
|
|
9278
9278
|
ref: x,
|
|
9279
9279
|
value: i,
|
|
9280
|
-
onChange: (
|
|
9280
|
+
onChange: (S) => c(S.target.value),
|
|
9281
9281
|
placeholder: "Enter Key",
|
|
9282
9282
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
9283
9283
|
}
|
|
@@ -9298,7 +9298,7 @@ const AiAssistant = () => {
|
|
|
9298
9298
|
rows: 2,
|
|
9299
9299
|
ref: f,
|
|
9300
9300
|
value: d,
|
|
9301
|
-
onChange: (
|
|
9301
|
+
onChange: (S) => p(S.target.value),
|
|
9302
9302
|
onKeyDown: _,
|
|
9303
9303
|
placeholder: "Enter Value",
|
|
9304
9304
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
@@ -9311,10 +9311,10 @@ const AiAssistant = () => {
|
|
|
9311
9311
|
]
|
|
9312
9312
|
}
|
|
9313
9313
|
),
|
|
9314
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
9314
|
+
/* @__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: [
|
|
9315
9315
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9316
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
9317
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children:
|
|
9316
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
|
|
9317
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
|
|
9318
9318
|
] }),
|
|
9319
9319
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9320
9320
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
@@ -9438,11 +9438,11 @@ const RootLayout = () => {
|
|
|
9438
9438
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
9439
9439
|
r("outline");
|
|
9440
9440
|
});
|
|
9441
|
-
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = useCallback((
|
|
9442
|
-
|
|
9441
|
+
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = useCallback((S) => {
|
|
9442
|
+
S.preventDefault();
|
|
9443
9443
|
}, []), h = useCallback(
|
|
9444
|
-
(
|
|
9445
|
-
r(n ===
|
|
9444
|
+
(S) => {
|
|
9445
|
+
r(n === S ? null : S);
|
|
9446
9446
|
},
|
|
9447
9447
|
[n]
|
|
9448
9448
|
), { t: x } = useTranslation(), f = useMemo(
|
|
@@ -9451,14 +9451,14 @@ const RootLayout = () => {
|
|
|
9451
9451
|
), k = useBuilderProp("htmlDir", "ltr"), b = find(f, { id: n }) ?? first(f), v = get(b, "width", DEFAULT_PANEL_WIDTH);
|
|
9452
9452
|
useEffect(() => {
|
|
9453
9453
|
if (n !== null) {
|
|
9454
|
-
const
|
|
9455
|
-
|
|
9454
|
+
const S = find(f, { id: n });
|
|
9455
|
+
S && get(S, "view", "standard") === "standard" && (a.current = n, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
|
|
9456
9456
|
}
|
|
9457
9457
|
}, [n, f]);
|
|
9458
9458
|
const B = useMemo(() => {
|
|
9459
9459
|
if (n === null) return 0;
|
|
9460
|
-
const
|
|
9461
|
-
return get(
|
|
9460
|
+
const S = find(f, { id: n });
|
|
9461
|
+
return get(S, "view", "standard") === "standard" ? v : l;
|
|
9462
9462
|
}, [n, v, l, f]), w = useCallback(() => {
|
|
9463
9463
|
r(a.current);
|
|
9464
9464
|
}, [r]), _ = useCallback(() => {
|
|
@@ -9468,8 +9468,8 @@ const RootLayout = () => {
|
|
|
9468
9468
|
find(f, { id: n }) || r("outline");
|
|
9469
9469
|
}, [n, f]);
|
|
9470
9470
|
const E = useCallback(
|
|
9471
|
-
(
|
|
9472
|
-
h(
|
|
9471
|
+
(S) => {
|
|
9472
|
+
h(S);
|
|
9473
9473
|
},
|
|
9474
9474
|
[h]
|
|
9475
9475
|
);
|
|
@@ -9483,24 +9483,24 @@ const RootLayout = () => {
|
|
|
9483
9483
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9484
9484
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9485
9485
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9486
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9487
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9486
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9487
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9488
9488
|
position: "top",
|
|
9489
|
-
panelId:
|
|
9490
|
-
isActive: n ===
|
|
9491
|
-
show: () => E(
|
|
9489
|
+
panelId: S.id,
|
|
9490
|
+
isActive: n === S.id,
|
|
9491
|
+
show: () => E(S.id)
|
|
9492
9492
|
}) }),
|
|
9493
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9493
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
|
|
9494
9494
|
] }, "button-top-" + A)) }),
|
|
9495
9495
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9496
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((
|
|
9497
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9496
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9497
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
|
|
9498
9498
|
position: "bottom",
|
|
9499
|
-
panelId:
|
|
9500
|
-
isActive: n ===
|
|
9501
|
-
show: () => E(
|
|
9499
|
+
panelId: S.id,
|
|
9500
|
+
isActive: n === S.id,
|
|
9501
|
+
show: () => E(S.id)
|
|
9502
9502
|
}) }),
|
|
9503
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9503
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
|
|
9504
9504
|
] }, "button-bottom-" + A)) })
|
|
9505
9505
|
] }),
|
|
9506
9506
|
/* @__PURE__ */ jsx(
|
|
@@ -9634,7 +9634,17 @@ const RootLayout = () => {
|
|
|
9634
9634
|
] }),
|
|
9635
9635
|
/* @__PURE__ */ jsx("div", { children: a ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-96 w-full" }), children: React__default.createElement(a) }) : null })
|
|
9636
9636
|
] }) : null;
|
|
9637
|
-
}, CHAI_FEATURE_FLAGS = {},
|
|
9637
|
+
}, CHAI_FEATURE_FLAGS = {}, registerChaiFeatureFlag = (o, n) => {
|
|
9638
|
+
if (CHAI_FEATURE_FLAGS[o])
|
|
9639
|
+
throw new Error(`Flag ${o} already exists`);
|
|
9640
|
+
CHAI_FEATURE_FLAGS[o] = { key: o, value: !1, ...n };
|
|
9641
|
+
}, registerChaiFeatureFlags = (o) => {
|
|
9642
|
+
Object.entries(o).forEach(([n, r]) => {
|
|
9643
|
+
if (CHAI_FEATURE_FLAGS[n])
|
|
9644
|
+
throw new Error(`Flag ${n} already exists`);
|
|
9645
|
+
registerChaiFeatureFlag(n, r);
|
|
9646
|
+
});
|
|
9647
|
+
}, useChaiFeatureFlags = () => CHAI_FEATURE_FLAGS, featureFlagsAtom = atomWithStorage("chai-feature-flags", []), useChaiFeatureFlag = (o) => {
|
|
9638
9648
|
const [n] = useAtom$1(featureFlagsAtom);
|
|
9639
9649
|
return n.includes(o);
|
|
9640
9650
|
}, useToggleChaiFeatureFlag = (o) => {
|
|
@@ -9642,7 +9652,7 @@ const RootLayout = () => {
|
|
|
9642
9652
|
return () => {
|
|
9643
9653
|
n.includes(o) ? r(n.filter((l) => l !== o)) : r([...n, o]);
|
|
9644
9654
|
};
|
|
9645
|
-
}, FeatureToggle = ({
|
|
9655
|
+
}, IfChaiFeatureFlag = ({ flagKey: o, children: n }) => useChaiFeatureFlag(o) ? n : null, FeatureToggle = ({
|
|
9646
9656
|
featureKey: o,
|
|
9647
9657
|
options: n
|
|
9648
9658
|
}) => {
|
|
@@ -9764,10 +9774,10 @@ const RootLayout = () => {
|
|
|
9764
9774
|
}, ...m) => {
|
|
9765
9775
|
const h = m[0] || ((A) => {
|
|
9766
9776
|
let N = o.get(A);
|
|
9767
|
-
return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A,
|
|
9777
|
+
return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
|
|
9768
9778
|
}), x = m[1] || (() => {
|
|
9769
9779
|
let A, N;
|
|
9770
|
-
const
|
|
9780
|
+
const C = (y) => {
|
|
9771
9781
|
try {
|
|
9772
9782
|
y();
|
|
9773
9783
|
} catch (j) {
|
|
@@ -9775,25 +9785,25 @@ const RootLayout = () => {
|
|
|
9775
9785
|
}
|
|
9776
9786
|
};
|
|
9777
9787
|
do {
|
|
9778
|
-
c.f &&
|
|
9788
|
+
c.f && C(c.f);
|
|
9779
9789
|
const y = /* @__PURE__ */ new Set(), j = y.add.bind(y);
|
|
9780
9790
|
a.forEach((I) => {
|
|
9781
9791
|
var L;
|
|
9782
9792
|
return (L = n.get(I)) == null ? void 0 : L.l.forEach(j);
|
|
9783
|
-
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), y.forEach(
|
|
9793
|
+
}), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), y.forEach(C), a.size && f();
|
|
9784
9794
|
} while (a.size || i.size || l.size);
|
|
9785
9795
|
if (A)
|
|
9786
9796
|
throw N;
|
|
9787
9797
|
}), f = m[2] || (() => {
|
|
9788
|
-
const A = [], N = /* @__PURE__ */ new WeakSet(),
|
|
9798
|
+
const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), y = Array.from(a);
|
|
9789
9799
|
for (; y.length; ) {
|
|
9790
9800
|
const j = y[y.length - 1], I = h(j);
|
|
9791
|
-
if (
|
|
9801
|
+
if (C.has(j)) {
|
|
9792
9802
|
y.pop();
|
|
9793
9803
|
continue;
|
|
9794
9804
|
}
|
|
9795
9805
|
if (N.has(j)) {
|
|
9796
|
-
r.get(j) === I.n && A.push([j, I]),
|
|
9806
|
+
r.get(j) === I.n && A.push([j, I]), C.add(j), y.pop();
|
|
9797
9807
|
continue;
|
|
9798
9808
|
}
|
|
9799
9809
|
N.add(j);
|
|
@@ -9811,7 +9821,7 @@ const RootLayout = () => {
|
|
|
9811
9821
|
R && (k(I), B(I)), r.delete(I);
|
|
9812
9822
|
}
|
|
9813
9823
|
}), k = m[3] || ((A) => {
|
|
9814
|
-
var N,
|
|
9824
|
+
var N, C;
|
|
9815
9825
|
const y = h(A);
|
|
9816
9826
|
if (isAtomStateInitialized(y) && (n.has(A) && r.get(A) !== y.n || Array.from(y.d).every(
|
|
9817
9827
|
([P, $]) => (
|
|
@@ -9828,13 +9838,13 @@ const RootLayout = () => {
|
|
|
9828
9838
|
}, L = (P) => {
|
|
9829
9839
|
var $;
|
|
9830
9840
|
if (isSelfAtom(A, P)) {
|
|
9831
|
-
const
|
|
9832
|
-
if (!isAtomStateInitialized(
|
|
9841
|
+
const H = h(P);
|
|
9842
|
+
if (!isAtomStateInitialized(H))
|
|
9833
9843
|
if (hasInitialValue(P))
|
|
9834
9844
|
setAtomStateValueOrPromise(P, P.init, h);
|
|
9835
9845
|
else
|
|
9836
9846
|
throw new Error("no atom init");
|
|
9837
|
-
return returnAtomValue(
|
|
9847
|
+
return returnAtomValue(H);
|
|
9838
9848
|
}
|
|
9839
9849
|
const M = k(P);
|
|
9840
9850
|
try {
|
|
@@ -9868,19 +9878,19 @@ const RootLayout = () => {
|
|
|
9868
9878
|
} catch (P) {
|
|
9869
9879
|
return delete y.v, y.e = P, ++y.n, y;
|
|
9870
9880
|
} finally {
|
|
9871
|
-
j = !1, O !== y.n && r.get(A) === O && (r.set(A, y.n), a.add(A), (
|
|
9881
|
+
j = !1, O !== y.n && r.get(A) === O && (r.set(A, y.n), a.add(A), (C = c.c) == null || C.call(c, A));
|
|
9872
9882
|
}
|
|
9873
9883
|
}), b = m[4] || ((A) => {
|
|
9874
9884
|
const N = [A];
|
|
9875
9885
|
for (; N.length; ) {
|
|
9876
|
-
const
|
|
9877
|
-
for (const j of getMountedOrPendingDependents(
|
|
9886
|
+
const C = N.pop(), y = h(C);
|
|
9887
|
+
for (const j of getMountedOrPendingDependents(C, y, n)) {
|
|
9878
9888
|
const I = h(j);
|
|
9879
9889
|
r.set(j, I.n), N.push(j);
|
|
9880
9890
|
}
|
|
9881
9891
|
}
|
|
9882
9892
|
}), v = m[5] || ((A, ...N) => {
|
|
9883
|
-
let
|
|
9893
|
+
let C = !0;
|
|
9884
9894
|
const y = (I) => returnAtomValue(k(I)), j = (I, ...L) => {
|
|
9885
9895
|
var R;
|
|
9886
9896
|
const T = h(I);
|
|
@@ -9894,25 +9904,25 @@ const RootLayout = () => {
|
|
|
9894
9904
|
} else
|
|
9895
9905
|
return v(I, ...L);
|
|
9896
9906
|
} finally {
|
|
9897
|
-
|
|
9907
|
+
C || (f(), x());
|
|
9898
9908
|
}
|
|
9899
9909
|
};
|
|
9900
9910
|
try {
|
|
9901
9911
|
return p(A, y, j, ...N);
|
|
9902
9912
|
} finally {
|
|
9903
|
-
|
|
9913
|
+
C = !1;
|
|
9904
9914
|
}
|
|
9905
9915
|
}), B = m[6] || ((A) => {
|
|
9906
9916
|
var N;
|
|
9907
|
-
const
|
|
9908
|
-
if (y && !isPendingPromise(
|
|
9909
|
-
for (const [j, I] of
|
|
9917
|
+
const C = h(A), y = n.get(A);
|
|
9918
|
+
if (y && !isPendingPromise(C.v)) {
|
|
9919
|
+
for (const [j, I] of C.d)
|
|
9910
9920
|
if (!y.d.has(j)) {
|
|
9911
9921
|
const L = h(j);
|
|
9912
9922
|
w(j).t.add(A), y.d.add(j), I !== L.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
|
|
9913
9923
|
}
|
|
9914
9924
|
for (const j of y.d || [])
|
|
9915
|
-
if (!
|
|
9925
|
+
if (!C.d.has(j)) {
|
|
9916
9926
|
y.d.delete(j);
|
|
9917
9927
|
const I = _(j);
|
|
9918
9928
|
I == null || I.t.delete(A);
|
|
@@ -9920,15 +9930,15 @@ const RootLayout = () => {
|
|
|
9920
9930
|
}
|
|
9921
9931
|
}), w = m[7] || ((A) => {
|
|
9922
9932
|
var N;
|
|
9923
|
-
const
|
|
9933
|
+
const C = h(A);
|
|
9924
9934
|
let y = n.get(A);
|
|
9925
9935
|
if (!y) {
|
|
9926
9936
|
k(A);
|
|
9927
|
-
for (const j of
|
|
9937
|
+
for (const j of C.d.keys())
|
|
9928
9938
|
w(j).t.add(A);
|
|
9929
9939
|
if (y = {
|
|
9930
9940
|
l: /* @__PURE__ */ new Set(),
|
|
9931
|
-
d: new Set(
|
|
9941
|
+
d: new Set(C.d.keys()),
|
|
9932
9942
|
t: /* @__PURE__ */ new Set()
|
|
9933
9943
|
}, n.set(A, y), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
|
|
9934
9944
|
const j = () => {
|
|
@@ -9960,14 +9970,14 @@ const RootLayout = () => {
|
|
|
9960
9970
|
return y;
|
|
9961
9971
|
}), _ = m[8] || ((A) => {
|
|
9962
9972
|
var N;
|
|
9963
|
-
const
|
|
9973
|
+
const C = h(A);
|
|
9964
9974
|
let y = n.get(A);
|
|
9965
9975
|
if (y && !y.l.size && !Array.from(y.t).some((j) => {
|
|
9966
9976
|
var I;
|
|
9967
9977
|
return (I = n.get(j)) == null ? void 0 : I.d.has(A);
|
|
9968
9978
|
})) {
|
|
9969
9979
|
y.u && i.add(y.u), y = void 0, n.delete(A), (N = c.u) == null || N.call(c, A);
|
|
9970
|
-
for (const j of
|
|
9980
|
+
for (const j of C.d.keys()) {
|
|
9971
9981
|
const I = _(j);
|
|
9972
9982
|
I == null || I.t.delete(A);
|
|
9973
9983
|
}
|
|
@@ -9998,7 +10008,7 @@ const RootLayout = () => {
|
|
|
9998
10008
|
B,
|
|
9999
10009
|
w,
|
|
10000
10010
|
_
|
|
10001
|
-
],
|
|
10011
|
+
], S = {
|
|
10002
10012
|
get: (A) => returnAtomValue(k(A)),
|
|
10003
10013
|
set: (A, ...N) => {
|
|
10004
10014
|
try {
|
|
@@ -10014,7 +10024,7 @@ const RootLayout = () => {
|
|
|
10014
10024
|
};
|
|
10015
10025
|
}
|
|
10016
10026
|
};
|
|
10017
|
-
return Object.defineProperty(
|
|
10027
|
+
return Object.defineProperty(S, BUILDING_BLOCKS, { value: E }), S;
|
|
10018
10028
|
}, INTERNAL_buildStoreRev1 = buildStore, createStore = () => INTERNAL_buildStoreRev1();
|
|
10019
10029
|
let defaultStore;
|
|
10020
10030
|
const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore), StoreContext = createContext(
|
|
@@ -10155,6 +10165,7 @@ export {
|
|
|
10155
10165
|
ThemeConfigPanel as ChaiThemeConfigPanel,
|
|
10156
10166
|
UILibrariesPanel as ChaiUILibrariesPanel,
|
|
10157
10167
|
UndoRedo as ChaiUndoRedo,
|
|
10168
|
+
IfChaiFeatureFlag,
|
|
10158
10169
|
PERMISSIONS,
|
|
10159
10170
|
getBlocksFromHTML as convertHTMLToChaiBlocks,
|
|
10160
10171
|
generateUUID as generateBlockId,
|
|
@@ -10165,6 +10176,8 @@ export {
|
|
|
10165
10176
|
registerBlockSettingTemplate,
|
|
10166
10177
|
registerBlockSettingWidget,
|
|
10167
10178
|
registerChaiAddBlockTab,
|
|
10179
|
+
registerChaiFeatureFlag,
|
|
10180
|
+
registerChaiFeatureFlags,
|
|
10168
10181
|
registerChaiLibrary,
|
|
10169
10182
|
registerChaiMediaManager,
|
|
10170
10183
|
registerChaiSaveToLibrary,
|
|
@@ -10181,6 +10194,8 @@ export {
|
|
|
10181
10194
|
useBuilderReset,
|
|
10182
10195
|
useCanvasDisplayWidth,
|
|
10183
10196
|
useCanvasZoom,
|
|
10197
|
+
useChaiFeatureFlag,
|
|
10198
|
+
useChaiFeatureFlags,
|
|
10184
10199
|
useCodeEditor,
|
|
10185
10200
|
useCopyBlocks as useCopyBlockIds,
|
|
10186
10201
|
useCopyToClipboard,
|
|
@@ -10218,6 +10233,7 @@ export {
|
|
|
10218
10233
|
useStylingState,
|
|
10219
10234
|
useTheme,
|
|
10220
10235
|
useThemeOptions,
|
|
10236
|
+
useToggleChaiFeatureFlag,
|
|
10221
10237
|
Ve as useTranslation,
|
|
10222
10238
|
useUndoManager,
|
|
10223
10239
|
useUpdateBlocksProps,
|