@chaibuilder/sdk 1.2.112 → 1.2.113
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-OFX9fvtD.cjs → CodeEditor-DDtmhfy3.cjs} +1 -1
- package/dist/{CodeEditor-jYbEyzBc.js → CodeEditor-ouljm9CI.js} +1 -1
- package/dist/{Topbar-INi1ISbz.cjs → Topbar-6F-qYFQ1.cjs} +1 -1
- package/dist/{Topbar--pIiTNKx.js → Topbar-Lvb5K8c2.js} +1 -1
- package/dist/{UnsplashImages-fIWjSjdU.cjs → UnsplashImages-djUTOetI.cjs} +1 -1
- package/dist/{UnsplashImages-ZioqVljV.js → UnsplashImages-nDgC7Fr9.js} +1 -1
- package/dist/{UploadImages-yuV6rhCT.js → UploadImages-9KvJB0jW.js} +1 -1
- package/dist/{UploadImages-rLpU_xPR.cjs → UploadImages-vK-3HLTs.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-s0DEFawb.cjs → index-NY4-KFVf.cjs} +4 -4
- package/dist/{index-vR8OFnh5.js → index-V7Y_OFKT.js} +412 -343
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var F = (o, n, r) => (
|
|
2
|
+
var G = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
+
var F = (o, n, r) => (G(o, typeof n != "symbol" ? n + "" : n, r), r);
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
@@ -30,7 +30,7 @@ import ReactDOM from "react-dom";
|
|
|
30
30
|
import PropTypes from "prop-types";
|
|
31
31
|
import { ErrorBoundary } from "react-error-boundary";
|
|
32
32
|
import { Resizable } from "re-resizable";
|
|
33
|
-
import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
|
|
33
|
+
import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, SearchIcon, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
|
|
34
34
|
import validator from "@rjsf/validator-ajv8";
|
|
35
35
|
import Form$1 from "@rjsf/core";
|
|
36
36
|
import { y, s as s$1, h } from "./controls-lEwMTdPQ.js";
|
|
@@ -89,23 +89,23 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
89
89
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
90
90
|
let a, l, i;
|
|
91
91
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
92
|
-
const c = (f) => o.get(f), d = (f,
|
|
93
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
92
|
+
const c = (f) => o.get(f), d = (f, S) => {
|
|
93
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(S);
|
|
94
94
|
const w = o.get(f);
|
|
95
|
-
if (o.set(f,
|
|
96
|
-
const A = "v" in
|
|
95
|
+
if (o.set(f, S), r.has(f) || r.set(f, w), w && hasPromiseAtomValue(w)) {
|
|
96
|
+
const A = "v" in S ? S.v instanceof Promise ? S.v : Promise.resolve(S.v) : Promise.reject(S.e);
|
|
97
97
|
cancelPromise(w.v, A);
|
|
98
98
|
}
|
|
99
|
-
}, u = (f,
|
|
99
|
+
}, u = (f, S, w) => {
|
|
100
100
|
const A = /* @__PURE__ */ new Map();
|
|
101
101
|
let I = !1;
|
|
102
102
|
w.forEach((T, D) => {
|
|
103
|
-
!T && D === f && (T =
|
|
104
|
-
}), (I ||
|
|
105
|
-
}, p = (f,
|
|
103
|
+
!T && D === f && (T = S), T ? (A.set(D, T), S.d.get(D) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
104
|
+
}), (I || S.d.size !== A.size) && (S.d = A);
|
|
105
|
+
}, p = (f, S, w) => {
|
|
106
106
|
const A = c(f), I = {
|
|
107
107
|
d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
|
|
108
|
-
v
|
|
108
|
+
v: S
|
|
109
109
|
};
|
|
110
110
|
if (w && u(f, I, w), A && isEqualAtomValue(A, I) && A.d === I.d)
|
|
111
111
|
return A;
|
|
@@ -115,12 +115,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
115
115
|
I.v = A.v;
|
|
116
116
|
}
|
|
117
117
|
return d(f, I), I;
|
|
118
|
-
}, m = (f,
|
|
119
|
-
if (isPromiseLike$2(
|
|
118
|
+
}, m = (f, S, w, A) => {
|
|
119
|
+
if (isPromiseLike$2(S)) {
|
|
120
120
|
let I;
|
|
121
121
|
const T = new Promise((D, O) => {
|
|
122
122
|
let M = !1;
|
|
123
|
-
|
|
123
|
+
S.then(
|
|
124
124
|
(V) => {
|
|
125
125
|
if (!M) {
|
|
126
126
|
M = !0;
|
|
@@ -150,27 +150,27 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
150
150
|
), D(V));
|
|
151
151
|
};
|
|
152
152
|
});
|
|
153
|
-
return T.orig =
|
|
153
|
+
return T.orig = S, T.status = "pending", registerCancelPromise(T, (D) => {
|
|
154
154
|
D && I(D), A == null || A();
|
|
155
155
|
}), p(f, T, w);
|
|
156
156
|
}
|
|
157
|
-
return p(f,
|
|
158
|
-
}, g = (f,
|
|
157
|
+
return p(f, S, w);
|
|
158
|
+
}, g = (f, S, w) => {
|
|
159
159
|
const A = c(f), I = {
|
|
160
160
|
d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
|
|
161
|
-
e:
|
|
161
|
+
e: S
|
|
162
162
|
};
|
|
163
163
|
return w && u(f, I, w), A && isEqualAtomError(A, I) && A.d === I.d ? A : (d(f, I), I);
|
|
164
164
|
}, x = (f) => {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
165
|
+
const S = c(f);
|
|
166
|
+
if (S && (S.d.forEach((M, V) => {
|
|
167
167
|
V !== f && !n.has(V) && x(V);
|
|
168
|
-
}), Array.from(
|
|
168
|
+
}), Array.from(S.d).every(([M, V]) => {
|
|
169
169
|
const $ = c(M);
|
|
170
170
|
return M === f || $ === V || // TODO This is a hack, we should find a better solution.
|
|
171
171
|
$ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
|
|
172
172
|
})))
|
|
173
|
-
return
|
|
173
|
+
return S;
|
|
174
174
|
const w = /* @__PURE__ */ new Map();
|
|
175
175
|
let A = !0;
|
|
176
176
|
const I = (M) => {
|
|
@@ -193,7 +193,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
193
193
|
get setSelf() {
|
|
194
194
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
|
|
195
195
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && A && console.warn("setSelf function cannot be called in sync"), !A)
|
|
196
|
-
return
|
|
196
|
+
return B(f, ...M);
|
|
197
197
|
}), D;
|
|
198
198
|
}
|
|
199
199
|
};
|
|
@@ -211,18 +211,18 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
211
211
|
A = !1;
|
|
212
212
|
}
|
|
213
213
|
}, j = (f) => returnAtomValue(x(f)), E = (f) => {
|
|
214
|
-
let
|
|
215
|
-
return
|
|
216
|
-
}, b = (f,
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
const
|
|
214
|
+
let S = n.get(f);
|
|
215
|
+
return S || (S = R(f)), S;
|
|
216
|
+
}, b = (f, S) => !S.l.size && (!S.t.size || S.t.size === 1 && S.t.has(f)), k = (f) => {
|
|
217
|
+
const S = n.get(f);
|
|
218
|
+
S && b(f, S) && _(f);
|
|
219
|
+
}, v = (f) => {
|
|
220
|
+
const S = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), A = (T) => {
|
|
221
221
|
const D = n.get(T);
|
|
222
222
|
D == null || D.t.forEach((O) => {
|
|
223
|
-
O !== T && (
|
|
223
|
+
O !== T && (S.set(
|
|
224
224
|
O,
|
|
225
|
-
(
|
|
225
|
+
(S.get(O) || /* @__PURE__ */ new Set()).add(T)
|
|
226
226
|
), w.set(O, (w.get(O) || 0) + 1), A(O));
|
|
227
227
|
});
|
|
228
228
|
};
|
|
@@ -234,19 +234,19 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
234
234
|
if (O !== T) {
|
|
235
235
|
let V = w.get(O);
|
|
236
236
|
if (V && w.set(O, --V), !V) {
|
|
237
|
-
let $ = !!((M =
|
|
237
|
+
let $ = !!((M = S.get(O)) != null && M.size);
|
|
238
238
|
if ($) {
|
|
239
239
|
const H = c(O), U = x(O);
|
|
240
240
|
$ = !H || !isEqualAtomValue(H, U);
|
|
241
241
|
}
|
|
242
|
-
$ ||
|
|
242
|
+
$ || S.forEach((H) => H.delete(O));
|
|
243
243
|
}
|
|
244
244
|
I(O);
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
248
|
I(f);
|
|
249
|
-
},
|
|
249
|
+
}, C = (f, ...S) => {
|
|
250
250
|
let w = !0;
|
|
251
251
|
const A = (D) => returnAtomValue(x(D)), I = (D, ...O) => {
|
|
252
252
|
let M;
|
|
@@ -254,9 +254,9 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
254
254
|
if (!hasInitialValue(D))
|
|
255
255
|
throw new Error("atom not writable");
|
|
256
256
|
const V = c(D), $ = m(D, O[0]);
|
|
257
|
-
(!V || !isEqualAtomValue(V, $)) &&
|
|
257
|
+
(!V || !isEqualAtomValue(V, $)) && v(D);
|
|
258
258
|
} else
|
|
259
|
-
M =
|
|
259
|
+
M = C(D, ...O);
|
|
260
260
|
if (!w) {
|
|
261
261
|
const V = L();
|
|
262
262
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
@@ -264,55 +264,55 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
return M;
|
|
267
|
-
}, T = f.write(A, I, ...
|
|
267
|
+
}, T = f.write(A, I, ...S);
|
|
268
268
|
return w = !1, T;
|
|
269
|
-
},
|
|
270
|
-
const w =
|
|
269
|
+
}, B = (f, ...S) => {
|
|
270
|
+
const w = C(f, ...S), A = L();
|
|
271
271
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
272
272
|
(I) => I({ type: "write", flushed: A })
|
|
273
273
|
), w;
|
|
274
|
-
},
|
|
274
|
+
}, R = (f, S) => {
|
|
275
275
|
const w = {
|
|
276
|
-
t: new Set(
|
|
276
|
+
t: new Set(S && [S]),
|
|
277
277
|
l: /* @__PURE__ */ new Set()
|
|
278
278
|
};
|
|
279
279
|
if (n.set(f, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((A, I) => {
|
|
280
280
|
const T = n.get(I);
|
|
281
|
-
T ? T.t.add(f) : I !== f &&
|
|
281
|
+
T ? T.t.add(f) : I !== f && R(I, f);
|
|
282
282
|
}), x(f), isActuallyWritableAtom(f) && f.onMount) {
|
|
283
|
-
const A = f.onMount((...I) =>
|
|
283
|
+
const A = f.onMount((...I) => B(f, ...I));
|
|
284
284
|
A && (w.u = A);
|
|
285
285
|
}
|
|
286
286
|
return w;
|
|
287
|
-
},
|
|
288
|
-
var
|
|
289
|
-
const w = (
|
|
287
|
+
}, _ = (f) => {
|
|
288
|
+
var S;
|
|
289
|
+
const w = (S = n.get(f)) == null ? void 0 : S.u;
|
|
290
290
|
w && w(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
|
|
291
291
|
const A = c(f);
|
|
292
292
|
A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((I, T) => {
|
|
293
293
|
if (T !== f) {
|
|
294
294
|
const D = n.get(T);
|
|
295
|
-
D && (D.t.delete(f), b(T, D) &&
|
|
295
|
+
D && (D.t.delete(f), b(T, D) && _(T));
|
|
296
296
|
}
|
|
297
297
|
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
|
|
298
|
-
}, N = (f,
|
|
299
|
-
const A = new Set(
|
|
298
|
+
}, N = (f, S, w) => {
|
|
299
|
+
const A = new Set(S.d.keys());
|
|
300
300
|
w == null || w.forEach((I, T) => {
|
|
301
301
|
if (A.has(T)) {
|
|
302
302
|
A.delete(T);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
305
|
const D = n.get(T);
|
|
306
|
-
D && (D.t.delete(f), b(T, D) &&
|
|
306
|
+
D && (D.t.delete(f), b(T, D) && _(T));
|
|
307
307
|
}), A.forEach((I) => {
|
|
308
308
|
const T = n.get(I);
|
|
309
|
-
T ? T.t.add(f) : n.has(f) &&
|
|
309
|
+
T ? T.t.add(f) : n.has(f) && R(I, f);
|
|
310
310
|
});
|
|
311
311
|
}, L = () => {
|
|
312
312
|
let f;
|
|
313
313
|
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
|
|
314
|
-
const
|
|
315
|
-
r.clear(),
|
|
314
|
+
const S = Array.from(r);
|
|
315
|
+
r.clear(), S.forEach(([w, A]) => {
|
|
316
316
|
const I = c(w);
|
|
317
317
|
if (I) {
|
|
318
318
|
I.d !== (A == null ? void 0 : A.d) && N(w, I, A == null ? void 0 : A.d);
|
|
@@ -325,21 +325,21 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
328
|
-
return a.forEach((
|
|
329
|
-
}, P = (f,
|
|
328
|
+
return a.forEach((S) => S("state")), f;
|
|
329
|
+
}, P = (f, S) => {
|
|
330
330
|
const w = E(f), A = L(), I = w.l;
|
|
331
|
-
return I.add(
|
|
331
|
+
return I.add(S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
|
|
332
332
|
(T) => T({ type: "sub", flushed: A })
|
|
333
333
|
)), () => {
|
|
334
|
-
I.delete(
|
|
334
|
+
I.delete(S), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
337
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
338
338
|
get: j,
|
|
339
|
-
set:
|
|
339
|
+
set: B,
|
|
340
340
|
sub: P,
|
|
341
341
|
// store dev methods (these are tentative and subject to change without notice)
|
|
342
|
-
dev_subscribe_store: (f,
|
|
342
|
+
dev_subscribe_store: (f, S) => S !== 2 ? (console.warn(
|
|
343
343
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
344
344
|
), a.add(f), () => {
|
|
345
345
|
a.delete(f);
|
|
@@ -351,15 +351,15 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
351
351
|
dev_get_mounted: (f) => n.get(f),
|
|
352
352
|
dev_restore_atoms: (f) => {
|
|
353
353
|
for (const [w, A] of f)
|
|
354
|
-
hasInitialValue(w) && (m(w, A),
|
|
355
|
-
const
|
|
354
|
+
hasInitialValue(w) && (m(w, A), v(w));
|
|
355
|
+
const S = L();
|
|
356
356
|
l.forEach(
|
|
357
|
-
(w) => w({ type: "restore", flushed:
|
|
357
|
+
(w) => w({ type: "restore", flushed: S })
|
|
358
358
|
);
|
|
359
359
|
}
|
|
360
360
|
} : {
|
|
361
361
|
get: j,
|
|
362
|
-
set:
|
|
362
|
+
set: B,
|
|
363
363
|
sub: P
|
|
364
364
|
};
|
|
365
365
|
};
|
|
@@ -386,27 +386,27 @@ function splitAtom(o, n) {
|
|
|
386
386
|
m[j] = b;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
const k = (
|
|
390
|
-
const
|
|
391
|
-
if (N < 0 || N >=
|
|
389
|
+
const k = (C) => {
|
|
390
|
+
const B = C(l), R = C(o), N = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
|
|
391
|
+
if (N < 0 || N >= R.length) {
|
|
392
392
|
const L = c[a(c).keyList.indexOf(E)];
|
|
393
393
|
if (L)
|
|
394
394
|
return L;
|
|
395
395
|
throw new Error("splitAtom: index out of bounds for read");
|
|
396
396
|
}
|
|
397
|
-
return
|
|
398
|
-
},
|
|
399
|
-
const
|
|
397
|
+
return R[N];
|
|
398
|
+
}, v = (C, B, R) => {
|
|
399
|
+
const _ = C(l), N = C(o), P = a(N, _ == null ? void 0 : _.arr).keyList.indexOf(E);
|
|
400
400
|
if (P < 0 || P >= N.length)
|
|
401
401
|
throw new Error("splitAtom: index out of bounds for write");
|
|
402
|
-
const f = isFunction(
|
|
403
|
-
|
|
402
|
+
const f = isFunction(R) ? R(N[P]) : R;
|
|
403
|
+
B(o, [
|
|
404
404
|
...N.slice(0, P),
|
|
405
405
|
f,
|
|
406
406
|
...N.slice(P + 1)
|
|
407
407
|
]);
|
|
408
408
|
};
|
|
409
|
-
m[j] = isWritable(o) ? atom(k,
|
|
409
|
+
m[j] = isWritable(o) ? atom(k, v) : atom(k);
|
|
410
410
|
}), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
|
|
411
411
|
}, l = atom((c) => {
|
|
412
412
|
const d = c(l), u = c(o);
|
|
@@ -1202,13 +1202,13 @@ const useBlocksStoreManager = () => {
|
|
|
1202
1202
|
} = useBlocksStoreManager();
|
|
1203
1203
|
return {
|
|
1204
1204
|
moveBlocks: (E, b, k) => {
|
|
1205
|
-
const
|
|
1206
|
-
const
|
|
1207
|
-
return { _id:
|
|
1208
|
-
}),
|
|
1209
|
-
|
|
1210
|
-
undo: () => each(
|
|
1211
|
-
i([
|
|
1205
|
+
const v = map(E, (B) => {
|
|
1206
|
+
const _ = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => _ ? P._parent === _ : !P._parent).map((P) => P._id).indexOf(B);
|
|
1207
|
+
return { _id: B, oldParent: _, oldPosition: L };
|
|
1208
|
+
}), C = v.find(({ _id: B }) => B === E[0]);
|
|
1209
|
+
C && C.oldParent === b && C.oldPosition === k || (i(E, b, k), o({
|
|
1210
|
+
undo: () => each(v, ({ _id: B, oldParent: R, oldPosition: _ }) => {
|
|
1211
|
+
i([B], R, _);
|
|
1212
1212
|
}),
|
|
1213
1213
|
redo: () => i(E, b, k)
|
|
1214
1214
|
}));
|
|
@@ -1220,27 +1220,27 @@ const useBlocksStoreManager = () => {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
},
|
|
1222
1222
|
removeBlocks: (E) => {
|
|
1223
|
-
var
|
|
1224
|
-
const b = (
|
|
1223
|
+
var C;
|
|
1224
|
+
const b = (C = first(E)) == null ? void 0 : C._parent, v = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
|
|
1225
1225
|
l(map(E, "_id")), o({
|
|
1226
|
-
undo: () => a(E, b,
|
|
1226
|
+
undo: () => a(E, b, v),
|
|
1227
1227
|
redo: () => l(map(E, "_id"))
|
|
1228
1228
|
});
|
|
1229
1229
|
},
|
|
1230
1230
|
updateBlocks: (E, b, k) => {
|
|
1231
|
-
let
|
|
1231
|
+
let v = [];
|
|
1232
1232
|
if (k)
|
|
1233
|
-
|
|
1233
|
+
v = map(E, (C) => ({ _id: C, ...k }));
|
|
1234
1234
|
else {
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
const
|
|
1238
|
-
return each(
|
|
1235
|
+
const C = keys(b);
|
|
1236
|
+
v = map(E, (B) => {
|
|
1237
|
+
const R = n.find((N) => N._id === B), _ = { _id: B };
|
|
1238
|
+
return each(C, (N) => _[N] = R[N]), _;
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
|
-
c(map(E, (
|
|
1242
|
-
undo: () => c(
|
|
1243
|
-
redo: () => c(map(E, (
|
|
1241
|
+
c(map(E, (C) => ({ _id: C, ...b }))), o({
|
|
1242
|
+
undo: () => c(v),
|
|
1243
|
+
redo: () => c(map(E, (C) => ({ _id: C, ...b })))
|
|
1244
1244
|
});
|
|
1245
1245
|
},
|
|
1246
1246
|
updateBlocksRuntime: (E, b) => {
|
|
@@ -1255,8 +1255,8 @@ const useBlocksStoreManager = () => {
|
|
|
1255
1255
|
updateMultipleBlocksProps: (E) => {
|
|
1256
1256
|
let b = [];
|
|
1257
1257
|
b = map(E, (k) => {
|
|
1258
|
-
const
|
|
1259
|
-
return each(
|
|
1258
|
+
const v = keys(k), C = n.find((R) => R._id === k._id), B = {};
|
|
1259
|
+
return each(v, (R) => B[R] = C[R]), B;
|
|
1260
1260
|
}), c(E), o({
|
|
1261
1261
|
undo: () => c(b),
|
|
1262
1262
|
redo: () => c(E)
|
|
@@ -1287,16 +1287,16 @@ const useBlocksStoreManager = () => {
|
|
|
1287
1287
|
return a(k, c, d);
|
|
1288
1288
|
}
|
|
1289
1289
|
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1290
|
-
forIn(p, (k,
|
|
1290
|
+
forIn(p, (k, v) => {
|
|
1291
1291
|
if (startsWith(k, SLOT_KEY)) {
|
|
1292
|
-
const
|
|
1292
|
+
const C = k.replace(SLOT_KEY, "");
|
|
1293
1293
|
m.push({
|
|
1294
|
-
_id:
|
|
1294
|
+
_id: C,
|
|
1295
1295
|
_type: "Slot",
|
|
1296
1296
|
_parent: u,
|
|
1297
|
-
_name: i.props[
|
|
1298
|
-
_styles: i.props[
|
|
1299
|
-
_emptyStyles: i.props[
|
|
1297
|
+
_name: i.props[v].name,
|
|
1298
|
+
_styles: i.props[v].styles,
|
|
1299
|
+
_emptyStyles: i.props[v].emptyStyles
|
|
1300
1300
|
});
|
|
1301
1301
|
}
|
|
1302
1302
|
});
|
|
@@ -3080,20 +3080,20 @@ const useDnd = () => {
|
|
|
3080
3080
|
x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
|
|
3081
3081
|
},
|
|
3082
3082
|
onDrop: (x) => {
|
|
3083
|
-
var
|
|
3084
|
-
const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((
|
|
3083
|
+
var R;
|
|
3084
|
+
const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
|
|
3085
3085
|
dropIndex = calculateDropIndex(b, possiblePositions);
|
|
3086
|
-
const k = d,
|
|
3087
|
-
if ((k == null ? void 0 : k._id) ===
|
|
3086
|
+
const k = d, v = j.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3087
|
+
if ((k == null ? void 0 : k._id) === v || !C) {
|
|
3088
3088
|
g();
|
|
3089
3089
|
return;
|
|
3090
3090
|
}
|
|
3091
3091
|
if (!has(k, "_id")) {
|
|
3092
|
-
a(k,
|
|
3092
|
+
a(k, v === "canvas" ? null : v, dropIndex), setTimeout(g, 300);
|
|
3093
3093
|
return;
|
|
3094
3094
|
}
|
|
3095
|
-
let
|
|
3096
|
-
|
|
3095
|
+
let B = j.getAttribute("data-block-id");
|
|
3096
|
+
B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
|
|
3097
3097
|
},
|
|
3098
3098
|
onDragEnter: (x) => {
|
|
3099
3099
|
const j = x, E = j.target;
|
|
@@ -3322,16 +3322,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3322
3322
|
}, [r, c]);
|
|
3323
3323
|
const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
|
|
3324
3324
|
return useEffect(() => {
|
|
3325
|
-
const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"),
|
|
3325
|
+
const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), v = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
|
|
3326
3326
|
colors: [E, b],
|
|
3327
3327
|
names: ["primary", "secondary"]
|
|
3328
3328
|
});
|
|
3329
|
-
set(
|
|
3330
|
-
const
|
|
3329
|
+
set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
|
|
3330
|
+
const _ = {
|
|
3331
3331
|
"bg-light": k,
|
|
3332
|
-
"bg-dark":
|
|
3333
|
-
"text-dark":
|
|
3334
|
-
"text-light":
|
|
3332
|
+
"bg-dark": v,
|
|
3333
|
+
"text-dark": C,
|
|
3334
|
+
"text-light": B
|
|
3335
3335
|
}, N = get(o, "roundedCorners", "0");
|
|
3336
3336
|
!d || !d.tailwind || (d.tailwind.config = {
|
|
3337
3337
|
darkMode: "class",
|
|
@@ -3351,7 +3351,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3351
3351
|
borderRadius: {
|
|
3352
3352
|
DEFAULT: `${N || "0"}px`
|
|
3353
3353
|
},
|
|
3354
|
-
colors: { ...
|
|
3354
|
+
colors: { ..._, ...R }
|
|
3355
3355
|
}
|
|
3356
3356
|
},
|
|
3357
3357
|
plugins: [
|
|
@@ -3513,9 +3513,9 @@ function applyLanguage(o, n, r) {
|
|
|
3513
3513
|
}
|
|
3514
3514
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3515
3515
|
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
|
|
3516
|
-
(b) => b.reduce((k,
|
|
3517
|
-
const
|
|
3518
|
-
return { ...k, ...
|
|
3516
|
+
(b) => b.reduce((k, v) => {
|
|
3517
|
+
const C = get(u, v, {});
|
|
3518
|
+
return { ...k, ...C };
|
|
3519
3519
|
}, {}),
|
|
3520
3520
|
[u]
|
|
3521
3521
|
);
|
|
@@ -3523,18 +3523,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3523
3523
|
o.map((b, k) => {
|
|
3524
3524
|
if (j === b._id || p.includes(b._id))
|
|
3525
3525
|
return null;
|
|
3526
|
-
const
|
|
3527
|
-
if (
|
|
3526
|
+
const v = {}, C = filter(n, { _parent: b._id });
|
|
3527
|
+
if (v.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, b._type === "GlobalBlock") {
|
|
3528
3528
|
const w = m(b);
|
|
3529
|
-
|
|
3529
|
+
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (A) => !A._parent), allBlocks: w });
|
|
3530
3530
|
}
|
|
3531
|
-
const
|
|
3532
|
-
if (isNull(
|
|
3531
|
+
const B = getBlockComponent(b._type), R = get(B, "server", !1), _ = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3532
|
+
if (isNull(_))
|
|
3533
3533
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
|
|
3534
|
-
const N = has(
|
|
3534
|
+
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(N), P = g(b);
|
|
3535
3535
|
if (get(P, "__isHidden", !1) && !includes(a, b._id))
|
|
3536
3536
|
return null;
|
|
3537
|
-
const f = i && isDescendant(i._id, b._id, n),
|
|
3537
|
+
const f = i && isDescendant(i._id, b._id, n), S = {
|
|
3538
3538
|
...includes(a, b._id) ? { "force-show": "" } : {},
|
|
3539
3539
|
"data-block-id": b._id,
|
|
3540
3540
|
"data-block-type": b._type,
|
|
@@ -3548,12 +3548,12 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3548
3548
|
...c === b._id && !f ? { "data-drop": "yes" } : {},
|
|
3549
3549
|
...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
|
|
3550
3550
|
};
|
|
3551
|
-
return
|
|
3552
|
-
blockProps:
|
|
3551
|
+
return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: S }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(_, {
|
|
3552
|
+
blockProps: S,
|
|
3553
3553
|
index: k,
|
|
3554
|
-
...applyBindings(applyLanguage(b, r,
|
|
3554
|
+
...applyBindings(applyLanguage(b, r, B), x),
|
|
3555
3555
|
...omit(P, ["__isHidden"]),
|
|
3556
|
-
...
|
|
3556
|
+
...v,
|
|
3557
3557
|
inBuilder: !0,
|
|
3558
3558
|
blockState: L
|
|
3559
3559
|
}) });
|
|
@@ -3609,43 +3609,43 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3609
3609
|
};
|
|
3610
3610
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
3611
3611
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3612
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1),
|
|
3613
|
-
u((N) => ({ ...N, width:
|
|
3612
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (_) => {
|
|
3613
|
+
u((N) => ({ ...N, width: _ }));
|
|
3614
3614
|
};
|
|
3615
3615
|
useEffect(() => {
|
|
3616
3616
|
if (!c.current)
|
|
3617
3617
|
return;
|
|
3618
|
-
const { clientWidth:
|
|
3619
|
-
u({ width:
|
|
3618
|
+
const { clientWidth: _, clientHeight: N } = c.current;
|
|
3619
|
+
u({ width: _, height: N });
|
|
3620
3620
|
}, [c, n]);
|
|
3621
|
-
const
|
|
3622
|
-
const { top: L } =
|
|
3621
|
+
const B = (_, N = 0) => {
|
|
3622
|
+
const { top: L } = _.getBoundingClientRect();
|
|
3623
3623
|
return L + N >= 0 && L - N <= window.innerHeight;
|
|
3624
3624
|
};
|
|
3625
3625
|
useEffect(() => {
|
|
3626
|
-
var
|
|
3626
|
+
var _, N;
|
|
3627
3627
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3628
3628
|
const L = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3629
|
-
L && (
|
|
3629
|
+
L && (B(L) || (N = (_ = i.current) == null ? void 0 : _.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
|
|
3630
3630
|
}
|
|
3631
3631
|
}, [a]), useEffect(() => {
|
|
3632
3632
|
if (!isEmpty(E) && i.current) {
|
|
3633
|
-
const
|
|
3633
|
+
const _ = getElementByStyleId(
|
|
3634
3634
|
i.current.contentDocument,
|
|
3635
3635
|
first(E).id
|
|
3636
3636
|
);
|
|
3637
|
-
x(
|
|
3637
|
+
x(_ ? [_] : [null]);
|
|
3638
3638
|
} else
|
|
3639
3639
|
x([null]);
|
|
3640
3640
|
}, [E]);
|
|
3641
|
-
const
|
|
3642
|
-
let
|
|
3643
|
-
return
|
|
3641
|
+
const R = useMemo(() => {
|
|
3642
|
+
let _ = IframeInitialContent;
|
|
3643
|
+
return _ = _.replace("__HTML_DIR__", v), o === "offline" && (_ = _.replace(
|
|
3644
3644
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3645
3645
|
"/offline/tailwind.cdn.js"
|
|
3646
|
-
),
|
|
3647
|
-
}, [o,
|
|
3648
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3646
|
+
), _ = _.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), _ = _.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), _;
|
|
3647
|
+
}, [o, v]);
|
|
3648
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3649
3649
|
"div",
|
|
3650
3650
|
{
|
|
3651
3651
|
onClick: () => {
|
|
@@ -3662,7 +3662,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3662
3662
|
id: "canvas-iframe",
|
|
3663
3663
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3664
3664
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3665
|
-
initialContent:
|
|
3665
|
+
initialContent: R,
|
|
3666
3666
|
children: [
|
|
3667
3667
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3668
3668
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3785,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3785
3785
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3786
3786
|
] }, l))
|
|
3787
3787
|
] }) });
|
|
3788
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3788
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ouljm9CI.js")), CanvasArea = () => {
|
|
3789
3789
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3790
3790
|
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: [
|
|
3791
3791
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3860,8 +3860,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3860
3860
|
showHeading: o = !0,
|
|
3861
3861
|
className: n = ""
|
|
3862
3862
|
}) => {
|
|
3863
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3864
|
-
|
|
3863
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, _) => {
|
|
3864
|
+
_ && (a(R), i.current = R);
|
|
3865
3865
|
}, {
|
|
3866
3866
|
bodyFont: u,
|
|
3867
3867
|
headingFont: p,
|
|
@@ -3873,7 +3873,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3873
3873
|
bodyBgLightColor: b,
|
|
3874
3874
|
roundedCorners: k
|
|
3875
3875
|
} = r;
|
|
3876
|
-
let
|
|
3876
|
+
let v = {
|
|
3877
3877
|
headingFont: y({
|
|
3878
3878
|
title: c("Theme Config.Heading Font"),
|
|
3879
3879
|
default: p,
|
|
@@ -3891,8 +3891,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3891
3891
|
primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
|
|
3892
3892
|
secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
|
|
3893
3893
|
};
|
|
3894
|
-
l || (
|
|
3895
|
-
...
|
|
3894
|
+
l || (v = {
|
|
3895
|
+
...v,
|
|
3896
3896
|
bodyBgLightColor: h({
|
|
3897
3897
|
title: c("Theme Config.Background"),
|
|
3898
3898
|
default: b
|
|
@@ -3910,13 +3910,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3910
3910
|
default: x
|
|
3911
3911
|
})
|
|
3912
3912
|
});
|
|
3913
|
-
const
|
|
3913
|
+
const C = {
|
|
3914
3914
|
type: "object",
|
|
3915
3915
|
properties: {}
|
|
3916
|
-
},
|
|
3917
|
-
return Object.keys(
|
|
3918
|
-
const
|
|
3919
|
-
return
|
|
3916
|
+
}, B = {};
|
|
3917
|
+
return Object.keys(v).forEach((R) => {
|
|
3918
|
+
const _ = v[R];
|
|
3919
|
+
return C.properties || (C.properties = {}), C.properties[R] = _.schema, B[R] = _.uiSchema, !0;
|
|
3920
3920
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3921
3921
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
|
|
3922
3922
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3928,8 +3928,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3928
3928
|
omitExtraData: !0,
|
|
3929
3929
|
liveOmit: !0,
|
|
3930
3930
|
liveValidate: !0,
|
|
3931
|
-
uiSchema:
|
|
3932
|
-
schema:
|
|
3931
|
+
uiSchema: B,
|
|
3932
|
+
schema: C,
|
|
3933
3933
|
formData: r,
|
|
3934
3934
|
validator,
|
|
3935
3935
|
onChange: d
|
|
@@ -4112,14 +4112,14 @@ function BiExpandVertical(o) {
|
|
|
4112
4112
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4113
4113
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4114
4114
|
let u = null;
|
|
4115
|
-
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing:
|
|
4115
|
+
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: v, handleClick: C } = o, B = (f) => {
|
|
4116
4116
|
f.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4117
|
-
},
|
|
4117
|
+
}, R = (f) => {
|
|
4118
4118
|
f.isInternal && (u = f.isOpen, f.isOpen && f.close());
|
|
4119
|
-
},
|
|
4119
|
+
}, _ = (f) => {
|
|
4120
4120
|
f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
|
|
4121
4121
|
}, N = (f) => {
|
|
4122
|
-
f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(),
|
|
4122
|
+
f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), C(f);
|
|
4123
4123
|
};
|
|
4124
4124
|
useEffect(() => {
|
|
4125
4125
|
const f = setTimeout(() => {
|
|
@@ -4128,16 +4128,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4128
4128
|
return () => clearTimeout(f);
|
|
4129
4129
|
}, [b, o, k]);
|
|
4130
4130
|
const L = useMemo(() => {
|
|
4131
|
-
const f = Object.keys(j),
|
|
4131
|
+
const f = Object.keys(j), S = [];
|
|
4132
4132
|
for (let w = 0; w < f.length; w++)
|
|
4133
4133
|
if (f[w].endsWith("_attrs")) {
|
|
4134
4134
|
const A = j[f[w]], I = Object.keys(A).join("|");
|
|
4135
|
-
I.match(/x-data/) &&
|
|
4135
|
+
I.match(/x-data/) && S.push("data"), I.match(/x-on/) && S.push("event"), I.match(/x-show|x-if/) && S.push("show");
|
|
4136
4136
|
}
|
|
4137
|
-
return
|
|
4138
|
-
}, [j]), P = (f,
|
|
4137
|
+
return S;
|
|
4138
|
+
}, [j]), P = (f, S) => {
|
|
4139
4139
|
const w = d.contentDocument || d.contentWindow.document, A = w.querySelector(`[data-block-id=${f}]`);
|
|
4140
|
-
A && A.setAttribute("data-drop",
|
|
4140
|
+
A && A.setAttribute("data-drop", S);
|
|
4141
4141
|
const I = A.getBoundingClientRect(), T = d.getBoundingClientRect();
|
|
4142
4142
|
I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (w.documentElement.scrollTop = A.offsetTop - T.top);
|
|
4143
4143
|
};
|
|
@@ -4160,8 +4160,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4160
4160
|
style: n,
|
|
4161
4161
|
"data-node-id": x,
|
|
4162
4162
|
ref: i.includes(x) ? null : r,
|
|
4163
|
-
onDragStart: () =>
|
|
4164
|
-
onDragEnd: () =>
|
|
4163
|
+
onDragStart: () => R(o),
|
|
4164
|
+
onDragEnd: () => _(o),
|
|
4165
4165
|
onDragOver: (f) => {
|
|
4166
4166
|
f.preventDefault(), P(x, "yes");
|
|
4167
4167
|
},
|
|
@@ -4184,12 +4184,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4184
4184
|
"div",
|
|
4185
4185
|
{
|
|
4186
4186
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
4187
|
-
children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4187
|
+
children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4188
4188
|
}
|
|
4189
4189
|
),
|
|
4190
4190
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4191
4191
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
|
|
4192
|
-
|
|
4192
|
+
v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4193
4193
|
"div",
|
|
4194
4194
|
{
|
|
4195
4195
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
@@ -4594,7 +4594,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4594
4594
|
...getAttrs(r),
|
|
4595
4595
|
...getStyles(r)
|
|
4596
4596
|
}, r.attributes) {
|
|
4597
|
-
const k = r.attributes.find((
|
|
4597
|
+
const k = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
|
|
4598
4598
|
k && (a._name = k.value);
|
|
4599
4599
|
}
|
|
4600
4600
|
if (i)
|
|
@@ -4612,14 +4612,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4612
4612
|
];
|
|
4613
4613
|
a = {
|
|
4614
4614
|
...a,
|
|
4615
|
-
href: ((u = l.find((
|
|
4616
|
-
hrefType: ((p = l.find((
|
|
4617
|
-
autoplay: ((m = l.find((
|
|
4618
|
-
maxWidth: ((x = (g = l.find((
|
|
4619
|
-
backdropColor: ((j = l.find((
|
|
4620
|
-
galleryName: ((E = l.find((
|
|
4621
|
-
}, forEach(k, (
|
|
4622
|
-
has(a, `styles_attrs.${
|
|
4615
|
+
href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
|
|
4616
|
+
hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
|
|
4617
|
+
autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
|
|
4618
|
+
maxWidth: ((x = (g = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
|
|
4619
|
+
backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
|
|
4620
|
+
galleryName: ((E = l.find((v) => v.key === "data-gall")) == null ? void 0 : E.value) || ""
|
|
4621
|
+
}, forEach(k, (v) => {
|
|
4622
|
+
has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
|
|
4623
4623
|
});
|
|
4624
4624
|
}
|
|
4625
4625
|
if (a._type === "Input") {
|
|
@@ -4629,8 +4629,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4629
4629
|
const k = stringify([r]);
|
|
4630
4630
|
return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = k, [a];
|
|
4631
4631
|
} else if (r.tagName === "svg") {
|
|
4632
|
-
const k = find(r.attributes, { key: "height" }),
|
|
4633
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${
|
|
4632
|
+
const k = find(r.attributes, { key: "height" }), v = find(r.attributes, { key: "width" }), C = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4633
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (_) => !includes(["style", "width", "height", "class"], _.key)), a.icon = stringify([r]), [a];
|
|
4634
4634
|
} else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
|
|
4635
4635
|
return n.block.options.push({
|
|
4636
4636
|
label: getTextContent(r.children),
|
|
@@ -4697,8 +4697,8 @@ function ExpandableObject(o) {
|
|
|
4697
4697
|
useEffect(() => {
|
|
4698
4698
|
g.current ? E(p(d, r, n)) : g.current = !0;
|
|
4699
4699
|
}, [p]);
|
|
4700
|
-
const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON",
|
|
4701
|
-
|
|
4700
|
+
const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", v = useComponentId(), C = d + 1, B = a.length - 1, R = (_) => {
|
|
4701
|
+
_.key === " " && (_.preventDefault(), j());
|
|
4702
4702
|
};
|
|
4703
4703
|
return /* @__PURE__ */ createElement("div", {
|
|
4704
4704
|
className: u.basicChildStyle,
|
|
@@ -4706,16 +4706,16 @@ function ExpandableObject(o) {
|
|
|
4706
4706
|
}, /* @__PURE__ */ createElement("span", {
|
|
4707
4707
|
className: b,
|
|
4708
4708
|
onClick: j,
|
|
4709
|
-
onKeyDown:
|
|
4709
|
+
onKeyDown: R,
|
|
4710
4710
|
role: "button",
|
|
4711
4711
|
tabIndex: 0,
|
|
4712
4712
|
"aria-label": k,
|
|
4713
4713
|
"aria-expanded": x,
|
|
4714
|
-
"aria-controls": x ?
|
|
4714
|
+
"aria-controls": x ? v : void 0
|
|
4715
4715
|
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4716
4716
|
className: u.clickableLabel,
|
|
4717
4717
|
onClick: j,
|
|
4718
|
-
onKeyDown:
|
|
4718
|
+
onKeyDown: R,
|
|
4719
4719
|
role: "button",
|
|
4720
4720
|
tabIndex: -1
|
|
4721
4721
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
@@ -4723,20 +4723,20 @@ function ExpandableObject(o) {
|
|
|
4723
4723
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4724
4724
|
className: u.punctuation
|
|
4725
4725
|
}, i), x ? /* @__PURE__ */ createElement("div", {
|
|
4726
|
-
id:
|
|
4727
|
-
}, a.map((
|
|
4728
|
-
key:
|
|
4729
|
-
field:
|
|
4730
|
-
value:
|
|
4726
|
+
id: v
|
|
4727
|
+
}, a.map((_, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4728
|
+
key: _[0] || N,
|
|
4729
|
+
field: _[0],
|
|
4730
|
+
value: _[1],
|
|
4731
4731
|
style: u,
|
|
4732
|
-
lastElement: N ===
|
|
4733
|
-
level:
|
|
4732
|
+
lastElement: N === B,
|
|
4733
|
+
level: C,
|
|
4734
4734
|
shouldExpandNode: p,
|
|
4735
4735
|
clickToExpandNode: m
|
|
4736
4736
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4737
4737
|
className: u.collapsedContent,
|
|
4738
4738
|
onClick: j,
|
|
4739
|
-
onKeyDown:
|
|
4739
|
+
onKeyDown: R,
|
|
4740
4740
|
role: "button",
|
|
4741
4741
|
tabIndex: -1,
|
|
4742
4742
|
"aria-hidden": !0,
|
|
@@ -5210,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5210
5210
|
}
|
|
5211
5211
|
)
|
|
5212
5212
|
] });
|
|
5213
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5213
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-nDgC7Fr9.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9KvJB0jW.js")), ImagesPanel = ({
|
|
5214
5214
|
isModalView: o = !1,
|
|
5215
5215
|
onSelect: n = () => {
|
|
5216
5216
|
}
|
|
@@ -5299,27 +5299,94 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5299
5299
|
className: "mt-1 rounded-md"
|
|
5300
5300
|
}
|
|
5301
5301
|
);
|
|
5302
|
-
},
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5302
|
+
}, CollectionField = ({
|
|
5303
|
+
formData: o,
|
|
5304
|
+
collections: n,
|
|
5305
|
+
onChange: r
|
|
5306
|
+
}) => {
|
|
5307
|
+
var k;
|
|
5308
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, C) => []), [i, c] = useState(""), [d, u] = useState("pages"), [p, m] = useState(""), [g, x] = useState([]), j = (k = n == null ? void 0 : n.find((v) => v.key === d)) == null ? void 0 : k.name;
|
|
5309
|
+
useEffect(() => {
|
|
5310
|
+
const v = split((o == null ? void 0 : o.href) || "", ":"), C = get(v, 1, "pages") || "pages";
|
|
5311
|
+
u(C), m(""), x([]), (async () => {
|
|
5312
|
+
c("FETCHING_INIT_VALUE");
|
|
5313
|
+
const B = await l(C, [get(v, 2, "pages")]);
|
|
5314
|
+
B && Array.isArray(B) && m(get(B, [0, "name"], "")), c("");
|
|
5308
5315
|
})();
|
|
5309
|
-
}, [])
|
|
5316
|
+
}, [o.href]);
|
|
5317
|
+
const E = useCallback(
|
|
5318
|
+
debounce(async (v) => {
|
|
5319
|
+
if (isEmpty(v))
|
|
5320
|
+
x([]);
|
|
5321
|
+
else {
|
|
5322
|
+
const C = await l(d, v);
|
|
5323
|
+
x(C);
|
|
5324
|
+
}
|
|
5325
|
+
c("");
|
|
5326
|
+
}, 300),
|
|
5327
|
+
[d]
|
|
5328
|
+
), b = (v) => {
|
|
5329
|
+
const C = ["collection", d, v.id];
|
|
5330
|
+
C[1] && r({ ...o, href: C.join(":") });
|
|
5331
|
+
};
|
|
5332
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: d, onChange: (v) => u(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
|
|
5334
|
+
d && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
5335
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5336
|
+
"input",
|
|
5337
|
+
{
|
|
5338
|
+
type: "text",
|
|
5339
|
+
value: p,
|
|
5340
|
+
onChange: (v) => {
|
|
5341
|
+
m(v.target.value), c("FETCHING_COLLECTION_ITEMS"), E(v.target.value);
|
|
5342
|
+
},
|
|
5343
|
+
placeholder: a(`Search ${j}`),
|
|
5344
|
+
disabled: i === "FETCHING_INIT_VALUE",
|
|
5345
|
+
className: "w-full rounded-md border border-gray-300 p-2"
|
|
5346
|
+
}
|
|
5347
|
+
),
|
|
5348
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { className: "absolute right-2 top-2 hidden h-5 w-5 pt-0.5 text-gray-400 group-hover:block" })
|
|
5349
|
+
] }),
|
|
5350
|
+
i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 pt-2", children: [
|
|
5351
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
5352
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
5353
|
+
] }) : !isEmpty(g) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "mt-2 max-h-40 overflow-y-auto rounded-md border border-gray-300", children: map(g == null ? void 0 : g.slice(0, 20), (v) => {
|
|
5354
|
+
var C;
|
|
5355
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5356
|
+
"li",
|
|
5357
|
+
{
|
|
5358
|
+
onClick: () => b(v),
|
|
5359
|
+
className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(v.id) ? "bg-blue-200" : "hover:bg-gray-100"}`,
|
|
5360
|
+
children: [
|
|
5361
|
+
v.name,
|
|
5362
|
+
" ",
|
|
5363
|
+
v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
|
|
5364
|
+
"( ",
|
|
5365
|
+
v.slug,
|
|
5366
|
+
" )"
|
|
5367
|
+
] })
|
|
5368
|
+
]
|
|
5369
|
+
},
|
|
5370
|
+
v.id
|
|
5371
|
+
);
|
|
5372
|
+
}) })
|
|
5373
|
+
] });
|
|
5374
|
+
}, LinkField = ({ schema: o, formData: n, onChange: r }) => {
|
|
5375
|
+
const { t: a } = useTranslation(), { type: l = "page", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
|
|
5376
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5310
5377
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
|
|
5311
5378
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
5312
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value:
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value:
|
|
5321
|
-
|
|
5322
|
-
|
|
5379
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => r({ ...n, type: u.target.value }), children: map(
|
|
5380
|
+
[
|
|
5381
|
+
...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
|
|
5382
|
+
{ const: "url", title: a("Open URL") },
|
|
5383
|
+
{ const: "email", title: a("Compose Email") },
|
|
5384
|
+
{ const: "telephone", title: a("Call Phone") },
|
|
5385
|
+
{ const: "scroll", title: a("Scroll to element") }
|
|
5386
|
+
],
|
|
5387
|
+
(u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
|
|
5388
|
+
) }),
|
|
5389
|
+
l === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionField, { formData: n, collections: d, onChange: r }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5323
5390
|
"input",
|
|
5324
5391
|
{
|
|
5325
5392
|
autoCapitalize: "off",
|
|
@@ -5327,12 +5394,14 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5327
5394
|
spellCheck: "false",
|
|
5328
5395
|
name: "href",
|
|
5329
5396
|
type: "text",
|
|
5330
|
-
value:
|
|
5331
|
-
onChange: (
|
|
5332
|
-
placeholder:
|
|
5397
|
+
value: i,
|
|
5398
|
+
onChange: (u) => r({ ...n, href: u.target.value }),
|
|
5399
|
+
placeholder: a(
|
|
5400
|
+
l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details"
|
|
5401
|
+
)
|
|
5333
5402
|
}
|
|
5334
5403
|
),
|
|
5335
|
-
|
|
5404
|
+
l === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5336
5405
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5337
5406
|
"input",
|
|
5338
5407
|
{
|
|
@@ -5340,12 +5409,12 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5340
5409
|
autoCorrect: "off",
|
|
5341
5410
|
spellCheck: "false",
|
|
5342
5411
|
type: "checkbox",
|
|
5343
|
-
defaultChecked:
|
|
5412
|
+
defaultChecked: c === "_blank",
|
|
5344
5413
|
className: "!w-fit cursor-pointer rounded-md border border-border",
|
|
5345
|
-
onChange: () => r({ ...n, target:
|
|
5414
|
+
onChange: () => r({ ...n, target: c === "_blank" ? "_self" : "_blank" })
|
|
5346
5415
|
}
|
|
5347
5416
|
),
|
|
5348
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
|
|
5417
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: a("Open in new tab") })
|
|
5349
5418
|
] })
|
|
5350
5419
|
] })
|
|
5351
5420
|
] });
|
|
@@ -5478,28 +5547,28 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5478
5547
|
}), a;
|
|
5479
5548
|
};
|
|
5480
5549
|
function BlockSettings() {
|
|
5481
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k,
|
|
5550
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, v) => {
|
|
5482
5551
|
if (k && (c == null ? void 0 : c._id) === n._id) {
|
|
5483
|
-
const
|
|
5484
|
-
a([n._id], { [
|
|
5552
|
+
const C = k.replace("root.", "");
|
|
5553
|
+
a([n._id], { [C]: get(b, C) }, v);
|
|
5485
5554
|
}
|
|
5486
5555
|
}, m = useCallback(
|
|
5487
|
-
debounce(({ formData: b }, k,
|
|
5488
|
-
p({ formData: b }, k,
|
|
5556
|
+
debounce(({ formData: b }, k, v) => {
|
|
5557
|
+
p({ formData: b }, k, v), d(b);
|
|
5489
5558
|
}, 1500),
|
|
5490
5559
|
[n == null ? void 0 : n._id, o]
|
|
5491
5560
|
), g = ({ formData: b }, k) => {
|
|
5492
5561
|
if (k) {
|
|
5493
|
-
const
|
|
5562
|
+
const v = k.replace("root.", "");
|
|
5494
5563
|
r(
|
|
5495
5564
|
[n._id],
|
|
5496
|
-
convertDotNotationToObject(
|
|
5497
|
-
), m({ formData: b }, k, { [
|
|
5565
|
+
convertDotNotationToObject(v, get(b, v.split(".")))
|
|
5566
|
+
), m({ formData: b }, k, { [v]: get(c, v) });
|
|
5498
5567
|
}
|
|
5499
5568
|
}, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
|
|
5500
5569
|
const b = cloneDeep(get(l, "props", {}));
|
|
5501
|
-
return each(b, (k,
|
|
5502
|
-
get(k, "hidden", !1) && delete b[
|
|
5570
|
+
return each(b, (k, v) => {
|
|
5571
|
+
get(k, "hidden", !1) && delete b[v];
|
|
5503
5572
|
}), u && each(x, (k) => delete b[k]), b;
|
|
5504
5573
|
}, [l, x, u]), E = get(l, "server", !1);
|
|
5505
5574
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
@@ -5589,14 +5658,14 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
|
5589
5658
|
if (l) {
|
|
5590
5659
|
n(!0), a(null);
|
|
5591
5660
|
try {
|
|
5592
|
-
const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((
|
|
5661
|
+
const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
|
|
5593
5662
|
set(b, "0._parent", null);
|
|
5594
|
-
const k = u === p ? "" : u,
|
|
5595
|
-
if (
|
|
5596
|
-
a(
|
|
5663
|
+
const k = u === p ? "" : u, v = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: C, error: B } = v;
|
|
5664
|
+
if (B) {
|
|
5665
|
+
a(B);
|
|
5597
5666
|
return;
|
|
5598
5667
|
}
|
|
5599
|
-
g === "styles" ? c(
|
|
5668
|
+
g === "styles" ? c(C) : i(C), E && E(v);
|
|
5600
5669
|
} catch (b) {
|
|
5601
5670
|
a(b);
|
|
5602
5671
|
} finally {
|
|
@@ -5751,25 +5820,25 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5751
5820
|
keys: ["name"]
|
|
5752
5821
|
});
|
|
5753
5822
|
function ManualClasses() {
|
|
5754
|
-
var
|
|
5755
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (
|
|
5823
|
+
var _;
|
|
5824
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (_ = first(n)) == null ? void 0 : _.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
|
|
5756
5825
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5757
5826
|
a(i, N, !0), u("");
|
|
5758
5827
|
}, [j, E] = useState([]), b = ({ value: N }) => {
|
|
5759
5828
|
const L = N.trim().toLowerCase(), P = L.match(/.+:/g);
|
|
5760
5829
|
let f = [];
|
|
5761
5830
|
if (P && P.length > 0) {
|
|
5762
|
-
const [
|
|
5831
|
+
const [S] = P, w = L.replace(S, "");
|
|
5763
5832
|
f = fuse.search(w).map((I) => ({
|
|
5764
5833
|
...I,
|
|
5765
|
-
item: { ...I.item, name:
|
|
5834
|
+
item: { ...I.item, name: S + I.item.name }
|
|
5766
5835
|
}));
|
|
5767
5836
|
} else
|
|
5768
5837
|
f = fuse.search(L);
|
|
5769
5838
|
return E(map(f, "item"));
|
|
5770
5839
|
}, k = () => {
|
|
5771
5840
|
E([]);
|
|
5772
|
-
},
|
|
5841
|
+
}, v = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5773
5842
|
autoComplete: "off",
|
|
5774
5843
|
autoCorrect: "off",
|
|
5775
5844
|
autoCapitalize: "off",
|
|
@@ -5781,7 +5850,7 @@ function ManualClasses() {
|
|
|
5781
5850
|
},
|
|
5782
5851
|
onChange: (N, { newValue: L }) => u(L),
|
|
5783
5852
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5784
|
-
},
|
|
5853
|
+
}, R = () => {
|
|
5785
5854
|
if (navigator.clipboard === void 0) {
|
|
5786
5855
|
p({
|
|
5787
5856
|
title: o("Clipboard not supported"),
|
|
@@ -5804,7 +5873,7 @@ function ManualClasses() {
|
|
|
5804
5873
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5805
5874
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5806
5875
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5807
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5876
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
|
|
5808
5877
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("Copy classes to clipboard") }) })
|
|
5809
5878
|
] })
|
|
5810
5879
|
] }),
|
|
@@ -5823,9 +5892,9 @@ function ManualClasses() {
|
|
|
5823
5892
|
suggestions: j,
|
|
5824
5893
|
onSuggestionsFetchRequested: b,
|
|
5825
5894
|
onSuggestionsClearRequested: k,
|
|
5826
|
-
getSuggestionValue:
|
|
5827
|
-
renderSuggestion:
|
|
5828
|
-
inputProps:
|
|
5895
|
+
getSuggestionValue: v,
|
|
5896
|
+
renderSuggestion: C,
|
|
5897
|
+
inputProps: B,
|
|
5829
5898
|
containerProps: {
|
|
5830
5899
|
className: "relative h-8 w-full gap-y-1 py-1 border-border"
|
|
5831
5900
|
},
|
|
@@ -6514,50 +6583,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6514
6583
|
},
|
|
6515
6584
|
a
|
|
6516
6585
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6517
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [
|
|
6586
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [v, C] = useState(!1), [B, R] = useState(!1);
|
|
6518
6587
|
useEffect(() => {
|
|
6519
|
-
const { value: f, unit:
|
|
6520
|
-
if (
|
|
6588
|
+
const { value: f, unit: S } = getClassValueAndUnit(i);
|
|
6589
|
+
if (S === "") {
|
|
6521
6590
|
l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6522
6591
|
return;
|
|
6523
6592
|
}
|
|
6524
|
-
x(
|
|
6593
|
+
x(S), l(S === "class" || isEmpty(f) ? "" : f);
|
|
6525
6594
|
}, [i, u, p]);
|
|
6526
|
-
const
|
|
6595
|
+
const _ = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
|
|
6527
6596
|
(f = !1) => {
|
|
6528
|
-
const
|
|
6529
|
-
if (get(
|
|
6597
|
+
const S = getUserInputValues(`${a}`, p);
|
|
6598
|
+
if (get(S, "error", !1)) {
|
|
6530
6599
|
E(!0);
|
|
6531
6600
|
return;
|
|
6532
6601
|
}
|
|
6533
|
-
const w = get(
|
|
6602
|
+
const w = get(S, "unit") !== "" ? get(S, "unit") : g;
|
|
6534
6603
|
if (w === "auto" || w === "none") {
|
|
6535
|
-
|
|
6604
|
+
_(`${d}${w}`);
|
|
6536
6605
|
return;
|
|
6537
6606
|
}
|
|
6538
|
-
if (get(
|
|
6607
|
+
if (get(S, "value") === "")
|
|
6539
6608
|
return;
|
|
6540
|
-
const I = `${get(
|
|
6541
|
-
f ? N(I) :
|
|
6609
|
+
const I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
|
|
6610
|
+
f ? N(I) : _(I);
|
|
6542
6611
|
},
|
|
6543
|
-
[
|
|
6612
|
+
[_, N, a, g, d, p]
|
|
6544
6613
|
), P = useCallback(
|
|
6545
6614
|
(f) => {
|
|
6546
|
-
const
|
|
6547
|
-
if (get(
|
|
6615
|
+
const S = getUserInputValues(`${a}`, p);
|
|
6616
|
+
if (get(S, "error", !1)) {
|
|
6548
6617
|
E(!0);
|
|
6549
6618
|
return;
|
|
6550
6619
|
}
|
|
6551
6620
|
if (f === "auto" || f === "none") {
|
|
6552
|
-
|
|
6621
|
+
_(`${d}${f}`);
|
|
6553
6622
|
return;
|
|
6554
6623
|
}
|
|
6555
|
-
if (get(
|
|
6624
|
+
if (get(S, "value") === "")
|
|
6556
6625
|
return;
|
|
6557
|
-
const w = get(
|
|
6558
|
-
|
|
6626
|
+
const w = get(S, "unit") !== "" ? get(S, "unit") : f, I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
|
|
6627
|
+
_(I);
|
|
6559
6628
|
},
|
|
6560
|
-
[
|
|
6629
|
+
[_, a, d, p]
|
|
6561
6630
|
);
|
|
6562
6631
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6563
6632
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
@@ -6565,7 +6634,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6565
6634
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
|
|
6566
6635
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6567
6636
|
] })
|
|
6568
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6637
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
|
|
6569
6638
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6570
6639
|
["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6571
6640
|
"input",
|
|
@@ -6577,25 +6646,25 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6577
6646
|
onKeyDown: (f) => {
|
|
6578
6647
|
if (f.keyCode !== 38 && f.keyCode !== 40)
|
|
6579
6648
|
return;
|
|
6580
|
-
f.preventDefault(),
|
|
6581
|
-
const
|
|
6582
|
-
let w = isNaN$1(
|
|
6649
|
+
f.preventDefault(), R(!0);
|
|
6650
|
+
const S = parseInt$1(f.target.value);
|
|
6651
|
+
let w = isNaN$1(S) ? 0 : S;
|
|
6583
6652
|
f.keyCode === 38 && (w += 1), f.keyCode === 40 && (w -= 1);
|
|
6584
6653
|
const A = `${w}`, T = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6585
6654
|
N(T);
|
|
6586
6655
|
},
|
|
6587
6656
|
onKeyUp: (f) => {
|
|
6588
|
-
|
|
6657
|
+
B && (f.preventDefault(), R(!1));
|
|
6589
6658
|
},
|
|
6590
6659
|
onBlur: () => L(),
|
|
6591
6660
|
onChange: (f) => {
|
|
6592
6661
|
E(!1), l(f.target.value);
|
|
6593
6662
|
},
|
|
6594
6663
|
onClick: (f) => {
|
|
6595
|
-
var
|
|
6596
|
-
(
|
|
6664
|
+
var S;
|
|
6665
|
+
(S = f == null ? void 0 : f.target) == null || S.select(), r(!1);
|
|
6597
6666
|
},
|
|
6598
|
-
value:
|
|
6667
|
+
value: v ? b : a,
|
|
6599
6668
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6600
6669
|
" ",
|
|
6601
6670
|
j ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -6627,21 +6696,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6627
6696
|
) }) })
|
|
6628
6697
|
] })
|
|
6629
6698
|
] }),
|
|
6630
|
-
["none", "auto"].indexOf(g) !== -1 ||
|
|
6699
|
+
["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6631
6700
|
DragStyleButton,
|
|
6632
6701
|
{
|
|
6633
|
-
onDragStart: () =>
|
|
6702
|
+
onDragStart: () => C(!0),
|
|
6634
6703
|
onDragEnd: (f) => {
|
|
6635
|
-
if (k(() => ""),
|
|
6704
|
+
if (k(() => ""), C(!1), isEmpty(f))
|
|
6636
6705
|
return;
|
|
6637
|
-
const
|
|
6638
|
-
|
|
6706
|
+
const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6707
|
+
_(A);
|
|
6639
6708
|
},
|
|
6640
6709
|
onDrag: (f) => {
|
|
6641
6710
|
if (isEmpty(f))
|
|
6642
6711
|
return;
|
|
6643
6712
|
k(f);
|
|
6644
|
-
const
|
|
6713
|
+
const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6645
6714
|
N(A);
|
|
6646
6715
|
},
|
|
6647
6716
|
currentValue: a,
|
|
@@ -6747,15 +6816,15 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6747
6816
|
x(E, [f], L);
|
|
6748
6817
|
},
|
|
6749
6818
|
[E, u, m, p, l, x]
|
|
6750
|
-
),
|
|
6819
|
+
), v = useCallback(() => {
|
|
6751
6820
|
j(E, [b]);
|
|
6752
|
-
}, [E, b, j]),
|
|
6821
|
+
}, [E, b, j]), C = useMemo(() => canChangeClass(g, m), [g, m]);
|
|
6753
6822
|
useEffect(() => {
|
|
6754
|
-
i(
|
|
6755
|
-
}, [
|
|
6756
|
-
const [, ,
|
|
6823
|
+
i(C, g);
|
|
6824
|
+
}, [C, i, g]);
|
|
6825
|
+
const [, , B] = useCanvasWidth(), R = useCallback(
|
|
6757
6826
|
(N) => {
|
|
6758
|
-
|
|
6827
|
+
B({
|
|
6759
6828
|
xs: 400,
|
|
6760
6829
|
sm: 640,
|
|
6761
6830
|
md: 800,
|
|
@@ -6764,10 +6833,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6764
6833
|
"2xl": 1920
|
|
6765
6834
|
}[N]);
|
|
6766
6835
|
},
|
|
6767
|
-
[
|
|
6768
|
-
),
|
|
6769
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6770
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !
|
|
6836
|
+
[B]
|
|
6837
|
+
), _ = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
|
|
6838
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: g && _, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6839
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6771
6840
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6772
6841
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6773
6842
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6786,7 +6855,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6786
6855
|
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6787
6856
|
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6788
6857
|
] }),
|
|
6789
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children:
|
|
6858
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6790
6859
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6791
6860
|
"button",
|
|
6792
6861
|
{
|
|
@@ -6806,7 +6875,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6806
6875
|
"button",
|
|
6807
6876
|
{
|
|
6808
6877
|
type: "button",
|
|
6809
|
-
onClick: () =>
|
|
6878
|
+
onClick: () => R(get(g, "mq")),
|
|
6810
6879
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6811
6880
|
children: [
|
|
6812
6881
|
"Switch to ",
|
|
@@ -7064,8 +7133,8 @@ const BlockCard = ({
|
|
|
7064
7133
|
parentId: r = void 0
|
|
7065
7134
|
}) => {
|
|
7066
7135
|
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
|
|
7067
|
-
const
|
|
7068
|
-
return k._type === "Box" &&
|
|
7136
|
+
const v = has(k, "styles_attrs.data-page-section");
|
|
7137
|
+
return k._type === "Box" && v;
|
|
7069
7138
|
}, E = useCallback(
|
|
7070
7139
|
async (k) => {
|
|
7071
7140
|
if (k.stopPropagation(), has(o, "component")) {
|
|
@@ -7073,23 +7142,23 @@ const BlockCard = ({
|
|
|
7073
7142
|
return;
|
|
7074
7143
|
}
|
|
7075
7144
|
l(!0);
|
|
7076
|
-
const
|
|
7077
|
-
isEmpty(
|
|
7145
|
+
const v = await i(n, o);
|
|
7146
|
+
isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7078
7147
|
},
|
|
7079
7148
|
[o]
|
|
7080
7149
|
), b = async (k) => {
|
|
7081
|
-
const
|
|
7082
|
-
let
|
|
7083
|
-
if (j(first(
|
|
7084
|
-
const
|
|
7085
|
-
if (k.dataTransfer.setData("text/plain", JSON.stringify(
|
|
7086
|
-
const
|
|
7087
|
-
|
|
7088
|
-
k.dataTransfer.setDragImage(
|
|
7150
|
+
const v = await i(n, o);
|
|
7151
|
+
let C = r;
|
|
7152
|
+
if (j(first(v)) && (C = null), !isEmpty(v)) {
|
|
7153
|
+
const B = { blocks: v, uiLibrary: !0, parent: C };
|
|
7154
|
+
if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
7155
|
+
const R = new Image();
|
|
7156
|
+
R.src = o.preview, R.onload = () => {
|
|
7157
|
+
k.dataTransfer.setDragImage(R, 0, 0);
|
|
7089
7158
|
};
|
|
7090
7159
|
} else
|
|
7091
7160
|
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7092
|
-
x(
|
|
7161
|
+
x(B), setTimeout(() => {
|
|
7093
7162
|
u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7094
7163
|
}, 200);
|
|
7095
7164
|
}
|
|
@@ -7130,9 +7199,9 @@ const BlockCard = ({
|
|
|
7130
7199
|
})();
|
|
7131
7200
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7132
7201
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7133
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((
|
|
7202
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (C) => {
|
|
7134
7203
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7135
|
-
j.current && g(
|
|
7204
|
+
j.current && g(C);
|
|
7136
7205
|
}, 300);
|
|
7137
7206
|
};
|
|
7138
7207
|
if (u)
|
|
@@ -7140,7 +7209,7 @@ const BlockCard = ({
|
|
|
7140
7209
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7141
7210
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7142
7211
|
] });
|
|
7143
|
-
const k = filter(x, (
|
|
7212
|
+
const k = filter(x, (C, B) => B % 2 === 0), v = filter(x, (C, B) => B % 2 === 1);
|
|
7144
7213
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
|
|
7145
7214
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7146
7215
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
@@ -7148,22 +7217,22 @@ const BlockCard = ({
|
|
|
7148
7217
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
|
|
7149
7218
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7150
7219
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
|
|
7151
|
-
map(p, (
|
|
7220
|
+
map(p, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7152
7221
|
"div",
|
|
7153
7222
|
{
|
|
7154
|
-
onMouseEnter: () => b(
|
|
7223
|
+
onMouseEnter: () => b(B),
|
|
7155
7224
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7156
|
-
onClick: () => g(
|
|
7225
|
+
onClick: () => g(B),
|
|
7157
7226
|
className: cn(
|
|
7158
7227
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7159
|
-
|
|
7228
|
+
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7160
7229
|
),
|
|
7161
7230
|
children: [
|
|
7162
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(
|
|
7231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
|
|
7163
7232
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7164
7233
|
]
|
|
7165
7234
|
},
|
|
7166
|
-
|
|
7235
|
+
B
|
|
7167
7236
|
))
|
|
7168
7237
|
) })
|
|
7169
7238
|
] })
|
|
@@ -7176,10 +7245,10 @@ const BlockCard = ({
|
|
|
7176
7245
|
children: [
|
|
7177
7246
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7178
7247
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7179
|
-
k.map((
|
|
7248
|
+
k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
|
|
7180
7249
|
) }),
|
|
7181
7250
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7182
|
-
|
|
7251
|
+
v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
|
|
7183
7252
|
) })
|
|
7184
7253
|
] }),
|
|
7185
7254
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8257,32 +8326,32 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8257
8326
|
return;
|
|
8258
8327
|
}
|
|
8259
8328
|
if (i) {
|
|
8260
|
-
const
|
|
8261
|
-
r(
|
|
8329
|
+
const R = [...a, { key: i, value: d }];
|
|
8330
|
+
r(R), l(a), c(""), u(""), x("");
|
|
8262
8331
|
}
|
|
8263
|
-
}, k = (
|
|
8264
|
-
const
|
|
8265
|
-
r(
|
|
8266
|
-
},
|
|
8267
|
-
m(
|
|
8268
|
-
},
|
|
8332
|
+
}, k = (R) => {
|
|
8333
|
+
const _ = a.filter((N, L) => L !== R);
|
|
8334
|
+
r(_), l(_);
|
|
8335
|
+
}, v = (R) => {
|
|
8336
|
+
m(R), c(a[R].key), u(a[R].value);
|
|
8337
|
+
}, C = () => {
|
|
8269
8338
|
if (i.startsWith("@")) {
|
|
8270
8339
|
x("Attribute keys cannot start with '@'");
|
|
8271
8340
|
return;
|
|
8272
8341
|
}
|
|
8273
8342
|
if (p !== null && i) {
|
|
8274
|
-
const
|
|
8275
|
-
|
|
8343
|
+
const R = [...a];
|
|
8344
|
+
R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
|
|
8276
8345
|
}
|
|
8277
|
-
},
|
|
8278
|
-
|
|
8346
|
+
}, B = (R) => {
|
|
8347
|
+
R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? C() : b());
|
|
8279
8348
|
};
|
|
8280
8349
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
8281
8350
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8282
8351
|
"form",
|
|
8283
8352
|
{
|
|
8284
|
-
onSubmit: (
|
|
8285
|
-
|
|
8353
|
+
onSubmit: (R) => {
|
|
8354
|
+
R.preventDefault(), p !== null ? C() : b();
|
|
8286
8355
|
},
|
|
8287
8356
|
className: "space-y-3",
|
|
8288
8357
|
children: [
|
|
@@ -8298,7 +8367,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8298
8367
|
id: "attrKey",
|
|
8299
8368
|
ref: j,
|
|
8300
8369
|
value: i,
|
|
8301
|
-
onChange: (
|
|
8370
|
+
onChange: (R) => c(R.target.value),
|
|
8302
8371
|
placeholder: "Key",
|
|
8303
8372
|
className: "h-8 text-sm"
|
|
8304
8373
|
}
|
|
@@ -8316,8 +8385,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8316
8385
|
rows: 2,
|
|
8317
8386
|
ref: E,
|
|
8318
8387
|
value: d,
|
|
8319
|
-
onChange: (
|
|
8320
|
-
onKeyDown:
|
|
8388
|
+
onChange: (R) => u(R.target.value),
|
|
8389
|
+
onKeyDown: B,
|
|
8321
8390
|
placeholder: "Value",
|
|
8322
8391
|
className: "bg-background text-sm"
|
|
8323
8392
|
}
|
|
@@ -8329,22 +8398,22 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8329
8398
|
]
|
|
8330
8399
|
}
|
|
8331
8400
|
),
|
|
8332
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
8401
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
8333
8402
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
8334
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
8335
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
8403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
|
|
8404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
|
|
8336
8405
|
] }),
|
|
8337
8406
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
8338
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(_), children: [
|
|
8339
8408
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
8340
8409
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
8341
8410
|
] }),
|
|
8342
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(
|
|
8411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(_), children: [
|
|
8343
8412
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
8344
8413
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
8345
8414
|
] })
|
|
8346
8415
|
] })
|
|
8347
|
-
] },
|
|
8416
|
+
] }, _)) })
|
|
8348
8417
|
] });
|
|
8349
8418
|
}), BlockAttributesEditor = React.memo(() => {
|
|
8350
8419
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8767,9 +8836,9 @@ const PageDataProviders = () => {
|
|
|
8767
8836
|
(b) => !isNull(b)
|
|
8768
8837
|
), x = (b) => {
|
|
8769
8838
|
const k = find(n, { providerKey: b });
|
|
8770
|
-
c((
|
|
8839
|
+
c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8771
8840
|
}, j = (b) => {
|
|
8772
|
-
c((k) => filter(k, (
|
|
8841
|
+
c((k) => filter(k, (v) => v.providerKey !== b.providerKey)), a((k) => filter(k, (v) => v.providerKey !== b.providerKey)), l("UNSAVED");
|
|
8773
8842
|
}, E = (b) => m(b);
|
|
8774
8843
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8775
8844
|
o("You have no data providers registered. Please add a data provider to your project."),
|
|
@@ -8866,7 +8935,7 @@ const PageDataProviders = () => {
|
|
|
8866
8935
|
function AiFillDatabase(o) {
|
|
8867
8936
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8868
8937
|
}
|
|
8869
|
-
const TopBar = lazy(() => import("./Topbar
|
|
8938
|
+
const TopBar = lazy(() => import("./Topbar-Lvb5K8c2.js"));
|
|
8870
8939
|
function useSidebarMenuItems(o) {
|
|
8871
8940
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8872
8941
|
return useMemo(() => {
|