@chaibuilder/sdk 2.0.0-beta.29 → 2.0.0-beta.30
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/{CodeEditor-funqCist.cjs → CodeEditor-TiCZr6Ta.cjs} +1 -1
- package/dist/{Topbar-80aquFk1.cjs → Topbar-Rar8liE-.cjs} +1 -1
- package/dist/core.cjs +3 -3
- package/dist/core.d.ts +14 -14
- package/dist/core.js +148 -142
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +108 -100
- package/package.json +1 -1
- package/dist/{CodeEditor-NoUXWcBN.js → CodeEditor-4lhmWkV8.js} +1 -1
- package/dist/{Topbar-XOJDIb13.js → Topbar-iARshVmF.js} +1 -1
package/dist/core.js
CHANGED
|
@@ -27,11 +27,11 @@ import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
|
27
27
|
import { twMerge } from "tailwind-merge";
|
|
28
28
|
import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-BnWT5XcX.js";
|
|
29
29
|
import { Provider } from "react-wrap-balancer";
|
|
30
|
+
import { PlusIcon as PlusIcon$1, DatabaseIcon, Columns, Rows, GlobeIcon, ChevronRight, EyeOff, Eye, X, Plus, ChevronDown, List, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
30
31
|
import ReactDOM from "react-dom";
|
|
31
32
|
import PropTypes from "prop-types";
|
|
32
33
|
import { ErrorBoundary } from "react-error-boundary";
|
|
33
34
|
import { Resizable } from "re-resizable";
|
|
34
|
-
import { DatabaseIcon, Columns, Rows, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, Eye, X, Plus, ChevronDown, List, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
35
35
|
import { Tree } from "react-arborist";
|
|
36
36
|
import { parse, stringify } from "himalaya";
|
|
37
37
|
import RjForm from "@rjsf/core";
|
|
@@ -116,8 +116,8 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
116
116
|
}, p = (m, E, R) => {
|
|
117
117
|
const C = /* @__PURE__ */ new Map();
|
|
118
118
|
let N = !1;
|
|
119
|
-
R.forEach((
|
|
120
|
-
!
|
|
119
|
+
R.forEach((I, w) => {
|
|
120
|
+
!I && w === m && (I = E), I ? (C.set(w, I), E.d.get(w) !== I && (N = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
121
121
|
}), (N || E.d.size !== C.size) && (E.d = C);
|
|
122
122
|
}, u = (m, E, R) => {
|
|
123
123
|
const C = c(m), N = {
|
|
@@ -135,7 +135,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
135
135
|
}, x = (m, E, R, C) => {
|
|
136
136
|
if (isPromiseLike$2(E)) {
|
|
137
137
|
let N;
|
|
138
|
-
const
|
|
138
|
+
const I = new Promise((w, $) => {
|
|
139
139
|
let L = !1;
|
|
140
140
|
E.then(
|
|
141
141
|
(M) => {
|
|
@@ -143,10 +143,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
143
143
|
L = !0;
|
|
144
144
|
const D = c(m), O = u(
|
|
145
145
|
m,
|
|
146
|
-
|
|
146
|
+
I,
|
|
147
147
|
R
|
|
148
148
|
);
|
|
149
|
-
resolvePromise(
|
|
149
|
+
resolvePromise(I, M), w(M), (D == null ? void 0 : D.d) !== O.d && T(m, O, D == null ? void 0 : D.d);
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
(M) => {
|
|
@@ -154,22 +154,22 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
154
154
|
L = !0;
|
|
155
155
|
const D = c(m), O = u(
|
|
156
156
|
m,
|
|
157
|
-
|
|
157
|
+
I,
|
|
158
158
|
R
|
|
159
159
|
);
|
|
160
|
-
rejectPromise(
|
|
160
|
+
rejectPromise(I, M), $(M), (D == null ? void 0 : D.d) !== O.d && T(m, O, D == null ? void 0 : D.d);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
), N = (M) => {
|
|
164
164
|
L || (L = !0, M.then(
|
|
165
|
-
(D) => resolvePromise(
|
|
166
|
-
(D) => rejectPromise(
|
|
165
|
+
(D) => resolvePromise(I, D),
|
|
166
|
+
(D) => rejectPromise(I, D)
|
|
167
167
|
), w(M));
|
|
168
168
|
};
|
|
169
169
|
});
|
|
170
|
-
return
|
|
170
|
+
return I.orig = E, I.status = "pending", registerCancelPromise(I, (w) => {
|
|
171
171
|
w && N(w), C == null || C();
|
|
172
|
-
}), u(m,
|
|
172
|
+
}), u(m, I, R);
|
|
173
173
|
}
|
|
174
174
|
return u(m, E, R);
|
|
175
175
|
}, h = (m, E, R) => {
|
|
@@ -202,10 +202,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
202
202
|
const M = g(L);
|
|
203
203
|
return R.set(L, M), returnAtomValue(M);
|
|
204
204
|
};
|
|
205
|
-
let
|
|
205
|
+
let I, w;
|
|
206
206
|
const $ = {
|
|
207
207
|
get signal() {
|
|
208
|
-
return
|
|
208
|
+
return I || (I = new AbortController()), I.signal;
|
|
209
209
|
},
|
|
210
210
|
get setSelf() {
|
|
211
211
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(m) && console.warn("setSelf function cannot be used with read-only atom"), !w && isActuallyWritableAtom(m) && (w = (...L) => {
|
|
@@ -220,7 +220,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
220
220
|
m,
|
|
221
221
|
L,
|
|
222
222
|
R,
|
|
223
|
-
() =>
|
|
223
|
+
() => I == null ? void 0 : I.abort()
|
|
224
224
|
);
|
|
225
225
|
} catch (L) {
|
|
226
226
|
return h(m, L, R);
|
|
@@ -234,21 +234,21 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
234
234
|
const E = r.get(m);
|
|
235
235
|
E && f(m, E) && k(m);
|
|
236
236
|
}, v = (m) => {
|
|
237
|
-
const E = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), C = (
|
|
238
|
-
const w = r.get(
|
|
237
|
+
const E = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), C = (I) => {
|
|
238
|
+
const w = r.get(I);
|
|
239
239
|
w == null || w.t.forEach(($) => {
|
|
240
|
-
$ !==
|
|
240
|
+
$ !== I && (E.set(
|
|
241
241
|
$,
|
|
242
|
-
(E.get($) || /* @__PURE__ */ new Set()).add(
|
|
242
|
+
(E.get($) || /* @__PURE__ */ new Set()).add(I)
|
|
243
243
|
), R.set($, (R.get($) || 0) + 1), C($));
|
|
244
244
|
});
|
|
245
245
|
};
|
|
246
246
|
C(m);
|
|
247
|
-
const N = (
|
|
248
|
-
const w = r.get(
|
|
247
|
+
const N = (I) => {
|
|
248
|
+
const w = r.get(I);
|
|
249
249
|
w == null || w.t.forEach(($) => {
|
|
250
250
|
var L;
|
|
251
|
-
if ($ !==
|
|
251
|
+
if ($ !== I) {
|
|
252
252
|
let M = R.get($);
|
|
253
253
|
if (M && R.set($, --M), !M) {
|
|
254
254
|
let D = !!((L = E.get($)) != null && L.size);
|
|
@@ -281,8 +281,8 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
return L;
|
|
284
|
-
},
|
|
285
|
-
return R = !1,
|
|
284
|
+
}, I = m.write(C, N, ...E);
|
|
285
|
+
return R = !1, I;
|
|
286
286
|
}, A = (m, ...E) => {
|
|
287
287
|
const R = B(m, ...E), C = _();
|
|
288
288
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
@@ -294,8 +294,8 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
294
294
|
l: /* @__PURE__ */ new Set()
|
|
295
295
|
};
|
|
296
296
|
if (r.set(m, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(m), g(m).d.forEach((C, N) => {
|
|
297
|
-
const
|
|
298
|
-
|
|
297
|
+
const I = r.get(N);
|
|
298
|
+
I ? I.t.add(m) : N !== m && S(N, m);
|
|
299
299
|
}), g(m), isActuallyWritableAtom(m) && m.onMount) {
|
|
300
300
|
const C = m.onMount((...N) => A(m, ...N));
|
|
301
301
|
C && (R.u = C);
|
|
@@ -306,24 +306,24 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
306
306
|
const R = (E = r.get(m)) == null ? void 0 : E.u;
|
|
307
307
|
R && R(), r.delete(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(m);
|
|
308
308
|
const C = c(m);
|
|
309
|
-
C ? (hasPromiseAtomValue(C) && cancelPromise(C.v), C.d.forEach((N,
|
|
310
|
-
if (
|
|
311
|
-
const w = r.get(
|
|
312
|
-
w && (w.t.delete(m), f(
|
|
309
|
+
C ? (hasPromiseAtomValue(C) && cancelPromise(C.v), C.d.forEach((N, I) => {
|
|
310
|
+
if (I !== m) {
|
|
311
|
+
const w = r.get(I);
|
|
312
|
+
w && (w.t.delete(m), f(I, w) && k(I));
|
|
313
313
|
}
|
|
314
314
|
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", m);
|
|
315
|
-
},
|
|
315
|
+
}, T = (m, E, R) => {
|
|
316
316
|
const C = new Set(E.d.keys());
|
|
317
|
-
R == null || R.forEach((N,
|
|
318
|
-
if (C.has(
|
|
319
|
-
C.delete(
|
|
317
|
+
R == null || R.forEach((N, I) => {
|
|
318
|
+
if (C.has(I)) {
|
|
319
|
+
C.delete(I);
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
const w = r.get(
|
|
323
|
-
w && (w.t.delete(m), f(
|
|
322
|
+
const w = r.get(I);
|
|
323
|
+
w && (w.t.delete(m), f(I, w) && k(I));
|
|
324
324
|
}), C.forEach((N) => {
|
|
325
|
-
const
|
|
326
|
-
|
|
325
|
+
const I = r.get(N);
|
|
326
|
+
I ? I.t.add(m) : r.has(m) && S(N, m);
|
|
327
327
|
});
|
|
328
328
|
}, _ = () => {
|
|
329
329
|
let m;
|
|
@@ -332,11 +332,11 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
332
332
|
n.clear(), E.forEach(([R, C]) => {
|
|
333
333
|
const N = c(R);
|
|
334
334
|
if (N) {
|
|
335
|
-
N.d !== (C == null ? void 0 : C.d) &&
|
|
336
|
-
const
|
|
337
|
-
|
|
335
|
+
N.d !== (C == null ? void 0 : C.d) && T(R, N, C == null ? void 0 : C.d);
|
|
336
|
+
const I = r.get(R);
|
|
337
|
+
I && !// TODO This seems pretty hacky. Hope to fix it.
|
|
338
338
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
339
|
-
(C && !hasPromiseAtomValue(C) && (isEqualAtomValue(C, N) || isEqualAtomError(C, N))) && (
|
|
339
|
+
(C && !hasPromiseAtomValue(C) && (isEqualAtomValue(C, N) || isEqualAtomError(C, N))) && (I.l.forEach((w) => w()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(R));
|
|
340
340
|
} else
|
|
341
341
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
342
342
|
});
|
|
@@ -345,10 +345,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
345
345
|
return a.forEach((E) => E("state")), m;
|
|
346
346
|
}, P = (m, E) => {
|
|
347
347
|
const R = b(m), C = _(), N = R.l;
|
|
348
|
-
return N.add(E), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((
|
|
349
|
-
(
|
|
348
|
+
return N.add(E), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("sub")), l.forEach(
|
|
349
|
+
(I) => I({ type: "sub", flushed: C })
|
|
350
350
|
)), () => {
|
|
351
|
-
N.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((
|
|
351
|
+
N.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("unsub")), l.forEach((I) => I({ type: "unsub" })));
|
|
352
352
|
};
|
|
353
353
|
};
|
|
354
354
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -404,23 +404,23 @@ function splitAtom(o, r) {
|
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
const y = (B) => {
|
|
407
|
-
const A = B(l), S = B(o),
|
|
408
|
-
if (
|
|
407
|
+
const A = B(l), S = B(o), T = a(S, A == null ? void 0 : A.arr).keyList.indexOf(b);
|
|
408
|
+
if (T < 0 || T >= S.length) {
|
|
409
409
|
const _ = c[a(c).keyList.indexOf(b)];
|
|
410
410
|
if (_)
|
|
411
411
|
return _;
|
|
412
412
|
throw new Error("splitAtom: index out of bounds for read");
|
|
413
413
|
}
|
|
414
|
-
return S[
|
|
414
|
+
return S[T];
|
|
415
415
|
}, v = (B, A, S) => {
|
|
416
|
-
const k = B(l),
|
|
417
|
-
if (P < 0 || P >=
|
|
416
|
+
const k = B(l), T = B(o), P = a(T, k == null ? void 0 : k.arr).keyList.indexOf(b);
|
|
417
|
+
if (P < 0 || P >= T.length)
|
|
418
418
|
throw new Error("splitAtom: index out of bounds for write");
|
|
419
|
-
const m = isFunction(S) ? S(
|
|
419
|
+
const m = isFunction(S) ? S(T[P]) : S;
|
|
420
420
|
A(o, [
|
|
421
|
-
...
|
|
421
|
+
...T.slice(0, P),
|
|
422
422
|
m,
|
|
423
|
-
...
|
|
423
|
+
...T.slice(P + 1)
|
|
424
424
|
]);
|
|
425
425
|
};
|
|
426
426
|
x[j] = isWritable(o) ? atom(y, v) : atom(y);
|
|
@@ -1167,8 +1167,8 @@ const useBlocksStoreManager = () => {
|
|
|
1167
1167
|
else {
|
|
1168
1168
|
const B = keys(f);
|
|
1169
1169
|
v = map(b, (A) => {
|
|
1170
|
-
const S = r.find((
|
|
1171
|
-
return each(B, (
|
|
1170
|
+
const S = r.find((T) => T._id === A), k = { _id: A };
|
|
1171
|
+
return each(B, (T) => k[T] = S[T]), k;
|
|
1172
1172
|
});
|
|
1173
1173
|
}
|
|
1174
1174
|
c(map(b, (B) => ({ _id: B, ...f }))), o({
|
|
@@ -3041,10 +3041,10 @@ const getBlockWithChildren = (o, r) => {
|
|
|
3041
3041
|
return;
|
|
3042
3042
|
}
|
|
3043
3043
|
if (g === "styles") {
|
|
3044
|
-
const k = A.map((
|
|
3045
|
-
for (const _ in
|
|
3046
|
-
_ !== "_id" && (
|
|
3047
|
-
return
|
|
3044
|
+
const k = A.map((T) => {
|
|
3045
|
+
for (const _ in T)
|
|
3046
|
+
_ !== "_id" && (T[_] = `${STYLES_KEY},${T[_]}`);
|
|
3047
|
+
return T;
|
|
3048
3048
|
});
|
|
3049
3049
|
c(k);
|
|
3050
3050
|
} else
|
|
@@ -3482,17 +3482,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3482
3482
|
}
|
|
3483
3483
|
);
|
|
3484
3484
|
}, getElementByDataBlockId = (o, r) => o.querySelector(`[data-block-id="${r}"]`), useKeyEventWatcher = (o) => {
|
|
3485
|
-
const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks();
|
|
3485
|
+
const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(), g = o ? { document: o } : {};
|
|
3486
3486
|
useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(r), {}, [r, p]), useHotkeys("ctrl+c,command+c", () => u(r), {}, [r, u]), useHotkeys(
|
|
3487
3487
|
"ctrl+v,command+v",
|
|
3488
3488
|
() => {
|
|
3489
3489
|
x(r[0]) && h(r);
|
|
3490
3490
|
},
|
|
3491
|
-
{},
|
|
3491
|
+
{ ...g, preventDefault: !0 },
|
|
3492
3492
|
[r, x, h]
|
|
3493
|
-
)
|
|
3494
|
-
const g = o ? { document: o } : {};
|
|
3495
|
-
useHotkeys("esc", () => n([]), g, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...g, preventDefault: !0 }, [
|
|
3493
|
+
), useHotkeys("esc", () => n([]), g, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...g, preventDefault: !0 }, [
|
|
3496
3494
|
r,
|
|
3497
3495
|
i
|
|
3498
3496
|
]), useHotkeys(
|
|
@@ -3759,7 +3757,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
|
|
|
3759
3757
|
const A = getRegisteredChaiBlock(f._type), S = get(A, "component", null);
|
|
3760
3758
|
if (isNull(S))
|
|
3761
3759
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3762
|
-
const k = has(A, "getBlockStateFrom") ? A == null ? void 0 : A.getBlockStateFrom(f, r) : [],
|
|
3760
|
+
const k = has(A, "getBlockStateFrom") ? A == null ? void 0 : A.getBlockStateFrom(f, r) : [], T = b(k), _ = h(f);
|
|
3763
3761
|
if (get(_, "__isHidden", !1) && !includes(a, f._id))
|
|
3764
3762
|
return null;
|
|
3765
3763
|
const P = i && isDescendant(i._id, f._id, r), E = {
|
|
@@ -3782,7 +3780,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
|
|
|
3782
3780
|
...omit(_, ["__isHidden"]),
|
|
3783
3781
|
...v,
|
|
3784
3782
|
inBuilder: !0,
|
|
3785
|
-
blockState:
|
|
3783
|
+
blockState: T
|
|
3786
3784
|
};
|
|
3787
3785
|
if (has(A, "dataProvider"))
|
|
3788
3786
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3821,17 +3819,22 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3821
3819
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: r });
|
|
3822
3820
|
}, AddBlockAtBottom = () => {
|
|
3823
3821
|
const { t: o } = useTranslation();
|
|
3824
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3825
|
-
"
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
"
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3822
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer py-2", children: [
|
|
3823
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3824
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3825
|
+
"div",
|
|
3826
|
+
{
|
|
3827
|
+
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK),
|
|
3828
|
+
className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
|
|
3829
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-purple-500 px-3 py-1 text-xs leading-tight text-white hover:bg-purple-500", children: [
|
|
3830
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "size-2.5 stroke-[3]" }),
|
|
3831
|
+
" ",
|
|
3832
|
+
o("Add block")
|
|
3833
|
+
] })
|
|
3834
|
+
}
|
|
3835
|
+
),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
3837
|
+
] });
|
|
3835
3838
|
}, ResizableCanvasWrapper = ({ children: o, onMount: r, onResize: n }) => {
|
|
3836
3839
|
const [, a] = useSelectedBlockIds(), [, l] = useSelectedStylingBlocks(), i = useRef(null), c = useDebouncedCallback(
|
|
3837
3840
|
() => {
|
|
@@ -3851,23 +3854,23 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3851
3854
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
3852
3855
|
}, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
|
|
3853
3856
|
const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, h] = useState([]), [, g] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), B = (k) => {
|
|
3854
|
-
p((
|
|
3857
|
+
p((T) => ({ ...T, width: k }));
|
|
3855
3858
|
};
|
|
3856
3859
|
useEffect(() => {
|
|
3857
3860
|
if (!c.current)
|
|
3858
3861
|
return;
|
|
3859
|
-
const { clientWidth: k, clientHeight:
|
|
3860
|
-
p({ width: k, height:
|
|
3862
|
+
const { clientWidth: k, clientHeight: T } = c.current;
|
|
3863
|
+
p({ width: k, height: T });
|
|
3861
3864
|
}, [c, r]);
|
|
3862
|
-
const A = (k,
|
|
3865
|
+
const A = (k, T = 0) => {
|
|
3863
3866
|
const { top: _ } = k.getBoundingClientRect();
|
|
3864
|
-
return _ +
|
|
3867
|
+
return _ + T >= 0 && _ - T <= window.innerHeight;
|
|
3865
3868
|
};
|
|
3866
3869
|
useEffect(() => {
|
|
3867
|
-
var k,
|
|
3870
|
+
var k, T;
|
|
3868
3871
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3869
3872
|
const _ = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3870
|
-
_ && (A(_) || (
|
|
3873
|
+
_ && (A(_) || (T = (k = i.current) == null ? void 0 : k.contentWindow) == null || T.scrollTo({ top: _.offsetTop, behavior: "smooth" }), h([_]));
|
|
3871
3874
|
}
|
|
3872
3875
|
}, [a]), useEffect(() => {
|
|
3873
3876
|
if (!isEmpty(b) && i.current) {
|
|
@@ -4033,7 +4036,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4033
4036
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
4034
4037
|
] }, l))
|
|
4035
4038
|
] }) });
|
|
4036
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
4039
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-4lhmWkV8.js")), CanvasArea = () => {
|
|
4037
4040
|
const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
|
|
4038
4041
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
4039
4042
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -4435,7 +4438,7 @@ function BiExpandVertical(o) {
|
|
|
4435
4438
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
|
|
4436
4439
|
}
|
|
4437
4440
|
const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, dragHandle: n }) => {
|
|
4438
|
-
var
|
|
4441
|
+
var I;
|
|
4439
4442
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4440
4443
|
let p = null;
|
|
4441
4444
|
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id: g, data: j, isSelected: b, willReceiveDrop: f, isDragging: y, isEditing: v, handleClick: B } = o, A = (w) => {
|
|
@@ -4444,7 +4447,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4444
4447
|
w.isInternal && (p = w.isOpen, w.isOpen && w.close());
|
|
4445
4448
|
}, k = (w) => {
|
|
4446
4449
|
w.isInternal && p !== null && (p ? w.open() : w.close(), p = null);
|
|
4447
|
-
}, [
|
|
4450
|
+
}, [T, _] = useAtom$1(currentAddSelection), P = () => {
|
|
4448
4451
|
var w;
|
|
4449
4452
|
m(), o.parent.isSelected || _((w = o == null ? void 0 : o.parent) == null ? void 0 : w.id);
|
|
4450
4453
|
}, m = () => {
|
|
@@ -4512,7 +4515,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4512
4515
|
w.preventDefault(), C(g, "no");
|
|
4513
4516
|
},
|
|
4514
4517
|
children: [
|
|
4515
|
-
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((
|
|
4518
|
+
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4516
4519
|
"div",
|
|
4517
4520
|
{
|
|
4518
4521
|
onClick: (w) => {
|
|
@@ -4531,7 +4534,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4531
4534
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
|
|
4532
4535
|
b ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
|
|
4533
4536
|
f && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
|
|
4534
|
-
(o == null ? void 0 : o.id) ===
|
|
4537
|
+
(o == null ? void 0 : o.id) === T ? "bg-purple-100" : "",
|
|
4535
4538
|
y && "opacity-20",
|
|
4536
4539
|
i.includes(g) ? "opacity-50" : ""
|
|
4537
4540
|
),
|
|
@@ -4619,7 +4622,10 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4619
4622
|
"input",
|
|
4620
4623
|
{
|
|
4621
4624
|
autoFocus: !0,
|
|
4622
|
-
className:
|
|
4625
|
+
className: cn(
|
|
4626
|
+
"ml-2 !h-4 w-full rounded-sm border border-border bg-background px-1 text-[11px] leading-tight outline-none",
|
|
4627
|
+
o.isSelected ? "text-black dark:text-white" : ""
|
|
4628
|
+
),
|
|
4623
4629
|
type: "text",
|
|
4624
4630
|
defaultValue: ((r = o.data) == null ? void 0 : r._name) || ((n = o.data) == null ? void 0 : n._type),
|
|
4625
4631
|
onFocus: (a) => a.currentTarget.select(),
|
|
@@ -5073,7 +5079,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
5073
5079
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5074
5080
|
IconPicker,
|
|
5075
5081
|
{
|
|
5076
|
-
value: o
|
|
5082
|
+
value: o || "BiSolidGrid",
|
|
5077
5083
|
onChange: a,
|
|
5078
5084
|
pickButtonStyle: {
|
|
5079
5085
|
position: "relative",
|
|
@@ -5184,15 +5190,15 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5184
5190
|
className: "mt-1 rounded-md"
|
|
5185
5191
|
}
|
|
5186
5192
|
);
|
|
5187
|
-
},
|
|
5193
|
+
}, PageTypeField = ({
|
|
5188
5194
|
href: o,
|
|
5189
|
-
|
|
5195
|
+
pageTypes: r,
|
|
5190
5196
|
onChange: n
|
|
5191
5197
|
}) => {
|
|
5192
5198
|
var P;
|
|
5193
|
-
const { t: a } = useTranslation(), l = useBuilderProp("
|
|
5199
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (m, E) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [h, g] = useState(""), [j, b] = useState([]), [f, y] = useState(-1), v = useRef(null), B = (P = r == null ? void 0 : r.find((m) => m.key === u)) == null ? void 0 : P.name;
|
|
5194
5200
|
useEffect(() => {
|
|
5195
|
-
if (g(""), b([]), y(-1), p(!1), !o || i || !startsWith(o, "
|
|
5201
|
+
if (g(""), b([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:"))
|
|
5196
5202
|
return;
|
|
5197
5203
|
const m = split(o, ":"), E = get(m, 1, "page") || "page";
|
|
5198
5204
|
x(E), (async () => {
|
|
@@ -5213,7 +5219,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5213
5219
|
[u],
|
|
5214
5220
|
300
|
|
5215
5221
|
), S = (m) => {
|
|
5216
|
-
const E = ["
|
|
5222
|
+
const E = ["pageType", u, m.id];
|
|
5217
5223
|
E[1] && (n(E.join(":")), g(m.name), p(!1), b([]), y(-1));
|
|
5218
5224
|
}, k = (m) => {
|
|
5219
5225
|
switch (m.key) {
|
|
@@ -5229,7 +5235,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5229
5235
|
f >= 0 && S(j[f]);
|
|
5230
5236
|
break;
|
|
5231
5237
|
case "Escape":
|
|
5232
|
-
m.preventDefault(),
|
|
5238
|
+
m.preventDefault(), T();
|
|
5233
5239
|
break;
|
|
5234
5240
|
}
|
|
5235
5241
|
};
|
|
@@ -5239,13 +5245,13 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5239
5245
|
m == null || m.scrollIntoView({ block: "nearest" });
|
|
5240
5246
|
}
|
|
5241
5247
|
}, [f]);
|
|
5242
|
-
const
|
|
5248
|
+
const T = () => {
|
|
5243
5249
|
g(""), b([]), y(-1), p(!1), n("");
|
|
5244
5250
|
}, _ = (m) => {
|
|
5245
5251
|
g(m), p(!isEmpty(m)), c(!0), A(m);
|
|
5246
5252
|
};
|
|
5247
5253
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5248
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "
|
|
5254
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "pageType", value: u, onChange: (m) => x(m.target.value), children: map(r, (m) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: m.key, children: m.name }, m.key)) }),
|
|
5249
5255
|
u && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
5250
5256
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5251
5257
|
"input",
|
|
@@ -5254,11 +5260,11 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5254
5260
|
value: h,
|
|
5255
5261
|
onChange: (m) => _(m.target.value),
|
|
5256
5262
|
onKeyDown: k,
|
|
5257
|
-
placeholder: a(`Search ${B}`),
|
|
5263
|
+
placeholder: a(`Search ${B ?? ""}`),
|
|
5258
5264
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
5259
5265
|
}
|
|
5260
5266
|
),
|
|
5261
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
5267
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: T, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
5262
5268
|
] }),
|
|
5263
5269
|
(i || !isEmpty(j) || d && isEmpty(j)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
|
|
5264
5270
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -5287,13 +5293,13 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5287
5293
|
)) }) })
|
|
5288
5294
|
] });
|
|
5289
5295
|
}, LinkField = ({ schema: o, formData: r, onChange: n }) => {
|
|
5290
|
-
const { t: a } = useTranslation(), { type: l = "
|
|
5296
|
+
const { t: a } = useTranslation(), { type: l = "pageType", href: i = "", target: c = "self" } = r, d = useBuilderProp("pageTypes", []), p = l === "pageType" && isEmpty(d) ? "url" : l;
|
|
5291
5297
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5292
5298
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
|
|
5293
5299
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
5294
5300
|
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => n({ ...r, type: u.target.value }), children: map(
|
|
5295
5301
|
[
|
|
5296
|
-
...isEmpty(d) ? [] : [{ const: "
|
|
5302
|
+
...isEmpty(d) ? [] : [{ const: "pageType", title: a("Goto Page") }],
|
|
5297
5303
|
{ const: "url", title: a("Open URL") },
|
|
5298
5304
|
{ const: "email", title: a("Compose Email") },
|
|
5299
5305
|
{ const: "telephone", title: a("Call Phone") },
|
|
@@ -5301,11 +5307,11 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5301
5307
|
],
|
|
5302
5308
|
(u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
|
|
5303
5309
|
) }),
|
|
5304
|
-
p === "
|
|
5305
|
-
|
|
5310
|
+
p === "pageType" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5311
|
+
PageTypeField,
|
|
5306
5312
|
{
|
|
5307
5313
|
href: i,
|
|
5308
|
-
|
|
5314
|
+
pageTypes: d,
|
|
5309
5315
|
onChange: (u) => n({ ...r, href: u })
|
|
5310
5316
|
}
|
|
5311
5317
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5392,7 +5398,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5392
5398
|
return null;
|
|
5393
5399
|
if (u.type === "boolean")
|
|
5394
5400
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: r, children: a });
|
|
5395
|
-
const
|
|
5401
|
+
const T = B == null ? void 0 : B.includes(o.replace("root.", ""));
|
|
5396
5402
|
if (u.type === "array") {
|
|
5397
5403
|
const _ = A === o;
|
|
5398
5404
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${r} relative`, children: [
|
|
@@ -5423,7 +5429,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5423
5429
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
|
|
5424
5430
|
n,
|
|
5425
5431
|
" ",
|
|
5426
|
-
|
|
5432
|
+
T && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5427
5433
|
" ",
|
|
5428
5434
|
f
|
|
5429
5435
|
] }),
|
|
@@ -5552,31 +5558,31 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5552
5558
|
return set(n, o, r), n;
|
|
5553
5559
|
};
|
|
5554
5560
|
function BlockSettings() {
|
|
5555
|
-
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), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), g = formDataWithSelectedLang(x, o, h), j = ({ formData: k },
|
|
5556
|
-
if (
|
|
5557
|
-
const P =
|
|
5561
|
+
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), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), g = formDataWithSelectedLang(x, o, h), j = ({ formData: k }, T, _) => {
|
|
5562
|
+
if (T && (c == null ? void 0 : c._id) === r._id) {
|
|
5563
|
+
const P = T.replace("root.", "");
|
|
5558
5564
|
a([r._id], { [P]: get(k, P) }, _);
|
|
5559
5565
|
}
|
|
5560
5566
|
}, b = useCallback(
|
|
5561
|
-
debounce(({ formData: k },
|
|
5562
|
-
j({ formData: k },
|
|
5567
|
+
debounce(({ formData: k }, T, _) => {
|
|
5568
|
+
j({ formData: k }, T, _), d(k);
|
|
5563
5569
|
}, 1500),
|
|
5564
5570
|
[r == null ? void 0 : r._id, o]
|
|
5565
|
-
), f = ({ formData: k },
|
|
5566
|
-
if (
|
|
5567
|
-
const _ =
|
|
5571
|
+
), f = ({ formData: k }, T) => {
|
|
5572
|
+
if (T) {
|
|
5573
|
+
const _ = T.replace("root.", "");
|
|
5568
5574
|
n(
|
|
5569
5575
|
[r._id],
|
|
5570
5576
|
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
5571
|
-
), b({ formData: k },
|
|
5577
|
+
), b({ formData: k }, T, { [_]: get(c, _) });
|
|
5572
5578
|
}
|
|
5573
|
-
}, y = ({ formData: k },
|
|
5574
|
-
if (
|
|
5575
|
-
const _ =
|
|
5579
|
+
}, y = ({ formData: k }, T) => {
|
|
5580
|
+
if (T) {
|
|
5581
|
+
const _ = T.replace("root.", "");
|
|
5576
5582
|
n(
|
|
5577
5583
|
[x._id],
|
|
5578
5584
|
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
5579
|
-
), b({ formData: k },
|
|
5585
|
+
), b({ formData: k }, T, { [_]: get(c, _) });
|
|
5580
5586
|
}
|
|
5581
5587
|
};
|
|
5582
5588
|
keys(get(i, "_bindings", {}));
|
|
@@ -5587,8 +5593,8 @@ function BlockSettings() {
|
|
|
5587
5593
|
}, [r]), { wrapperSchema: A, wrapperUiSchema: S } = useMemo(() => {
|
|
5588
5594
|
if (!x || !(x != null && x._type))
|
|
5589
5595
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5590
|
-
const k = x == null ? void 0 : x._type, { schema:
|
|
5591
|
-
return { wrapperSchema:
|
|
5596
|
+
const k = x == null ? void 0 : x._type, { schema: T = {}, uiSchema: _ = {} } = getBlockFormSchemas(k);
|
|
5597
|
+
return { wrapperSchema: T, wrapperUiSchema: _ };
|
|
5592
5598
|
}, [x]);
|
|
5593
5599
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5594
5600
|
!isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -5762,8 +5768,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5762
5768
|
] });
|
|
5763
5769
|
};
|
|
5764
5770
|
function ManualClasses() {
|
|
5765
|
-
var
|
|
5766
|
-
const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (
|
|
5771
|
+
var T;
|
|
5772
|
+
const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (T = first(n)) == null ? void 0 : T.prop, g = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), j = () => {
|
|
5767
5773
|
const _ = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5768
5774
|
l(c, _, !0), u("");
|
|
5769
5775
|
}, [b, f] = useState([]), y = ({ value: _ }) => {
|
|
@@ -5771,9 +5777,9 @@ function ManualClasses() {
|
|
|
5771
5777
|
let E = [];
|
|
5772
5778
|
if (m && m.length > 0) {
|
|
5773
5779
|
const [R] = m, C = P.replace(R, "");
|
|
5774
|
-
E = o.search(C).map((
|
|
5775
|
-
...
|
|
5776
|
-
item: { ...
|
|
5780
|
+
E = o.search(C).map((I) => ({
|
|
5781
|
+
...I,
|
|
5782
|
+
item: { ...I.item, name: R + I.item.name }
|
|
5777
5783
|
}));
|
|
5778
5784
|
} else
|
|
5779
5785
|
E = o.search(P);
|
|
@@ -6536,7 +6542,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6536
6542
|
}
|
|
6537
6543
|
g(E), l(E === "class" || isEmpty(m) ? "" : m);
|
|
6538
6544
|
}, [i, p, u]);
|
|
6539
|
-
const k = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME),
|
|
6545
|
+
const k = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), T = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), _ = useCallback(
|
|
6540
6546
|
(m = !1) => {
|
|
6541
6547
|
const E = getUserInputValues(`${a}`, u);
|
|
6542
6548
|
if (get(E, "error", !1)) {
|
|
@@ -6551,9 +6557,9 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6551
6557
|
if (get(E, "value") === "")
|
|
6552
6558
|
return;
|
|
6553
6559
|
const N = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
|
|
6554
|
-
m ?
|
|
6560
|
+
m ? T(N) : k(N);
|
|
6555
6561
|
},
|
|
6556
|
-
[k,
|
|
6562
|
+
[k, T, a, h, d, u]
|
|
6557
6563
|
), P = useCallback(
|
|
6558
6564
|
(m) => {
|
|
6559
6565
|
const E = getUserInputValues(`${a}`, u);
|
|
@@ -6601,8 +6607,8 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6601
6607
|
const E = parseInt$1(m.target.value);
|
|
6602
6608
|
let R = isNaN$1(E) ? 0 : E;
|
|
6603
6609
|
m.keyCode === 38 && (R += 1), m.keyCode === 40 && (R -= 1);
|
|
6604
|
-
const C = `${R}`,
|
|
6605
|
-
I
|
|
6610
|
+
const C = `${R}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6611
|
+
T(I);
|
|
6606
6612
|
},
|
|
6607
6613
|
onKeyUp: (m) => {
|
|
6608
6614
|
A && (m.preventDefault(), S(!1));
|
|
@@ -6662,7 +6668,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6662
6668
|
return;
|
|
6663
6669
|
y(m);
|
|
6664
6670
|
const E = `${m}`, C = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6665
|
-
|
|
6671
|
+
T(C);
|
|
6666
6672
|
},
|
|
6667
6673
|
currentValue: a,
|
|
6668
6674
|
unit: h,
|
|
@@ -6760,8 +6766,8 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6760
6766
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6761
6767
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6762
6768
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(h, "fullCls", ""), [h]), y = useCallback(
|
|
6763
|
-
(
|
|
6764
|
-
const P = { dark: p, mq: x, mod: u, cls:
|
|
6769
|
+
(T, _ = !0) => {
|
|
6770
|
+
const P = { dark: p, mq: x, mod: u, cls: T, property: l, fullCls: "" };
|
|
6765
6771
|
(p || u !== "") && (P.mq = "xs");
|
|
6766
6772
|
const m = generateFullClsName(P);
|
|
6767
6773
|
g(b, [m], _);
|
|
@@ -6774,7 +6780,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6774
6780
|
i(B, h);
|
|
6775
6781
|
}, [B, i, h]);
|
|
6776
6782
|
const [, , A] = useCanvasWidth(), S = useCallback(
|
|
6777
|
-
(
|
|
6783
|
+
(T) => {
|
|
6778
6784
|
A({
|
|
6779
6785
|
xs: 400,
|
|
6780
6786
|
sm: 640,
|
|
@@ -6782,7 +6788,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6782
6788
|
lg: 1024,
|
|
6783
6789
|
xl: 1420,
|
|
6784
6790
|
"2xl": 1920
|
|
6785
|
-
}[
|
|
6791
|
+
}[T]);
|
|
6786
6792
|
},
|
|
6787
6793
|
[A]
|
|
6788
6794
|
), k = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
|
|
@@ -7706,7 +7712,7 @@ const BlockCard = ({
|
|
|
7706
7712
|
"Open Code Editor": "Open Code Editor",
|
|
7707
7713
|
"Clear search": "Clear search",
|
|
7708
7714
|
"No results found for": "No results found for",
|
|
7709
|
-
"Search {
|
|
7715
|
+
"Search {pageTypeName}": "Search {pageTypeName}"
|
|
7710
7716
|
};
|
|
7711
7717
|
i18n.use(initReactI18next).init({
|
|
7712
7718
|
// the translations
|
|
@@ -7831,7 +7837,7 @@ const CoreBlock = ({
|
|
|
7831
7837
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "-mx-1.5 h-full max-h-full overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: n, position: a }) }) }) }),
|
|
7832
7838
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(UILibraries, { parentId: n, position: a }) }),
|
|
7833
7839
|
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML$1, { parentId: n, position: a }) }) : null,
|
|
7834
|
-
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x }) }))
|
|
7840
|
+
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x, parentId: n, position: a }) }))
|
|
7835
7841
|
]
|
|
7836
7842
|
}
|
|
7837
7843
|
)
|
|
@@ -8145,7 +8151,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8145
8151
|
n(S), l(a), c(""), p(""), g("");
|
|
8146
8152
|
}
|
|
8147
8153
|
}, y = (S) => {
|
|
8148
|
-
const k = a.filter((
|
|
8154
|
+
const k = a.filter((T, _) => _ !== S);
|
|
8149
8155
|
n(k), l(k);
|
|
8150
8156
|
}, v = (S) => {
|
|
8151
8157
|
x(S), c(a[S].key), p(a[S].value);
|
|
@@ -8592,7 +8598,7 @@ const ChooseLayout = ({ open: o, close: r }) => {
|
|
|
8592
8598
|
)
|
|
8593
8599
|
] }) })
|
|
8594
8600
|
] }) });
|
|
8595
|
-
}, TopBar = lazy(() => import("./Topbar-
|
|
8601
|
+
}, TopBar = lazy(() => import("./Topbar-iARshVmF.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
|
|
8596
8602
|
function useSidebarMenuItems() {
|
|
8597
8603
|
return useMemo(() => compact([
|
|
8598
8604
|
{
|