@chaibuilder/sdk 1.2.98 → 1.2.99
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-v6e1cv9g.cjs → CodeEditor-Q8Qp8-DO.cjs} +1 -1
- package/dist/{CodeEditor-JFNyNUeD.js → CodeEditor-v7zBTMpR.js} +1 -1
- package/dist/{Topbar--bKmw8Qf.cjs → Topbar-Mh3drPuW.cjs} +1 -1
- package/dist/{Topbar-bca7NmyC.js → Topbar-ULSrUjT1.js} +1 -1
- package/dist/{UnsplashImages-vR5ig3Lz.js → UnsplashImages-LYK9w6rM.js} +1 -1
- package/dist/{UnsplashImages-Xfn4852d.cjs → UnsplashImages-pwoxxEVG.cjs} +1 -1
- package/dist/{UploadImages-jCqfO33R.js → UploadImages-D5RhqXgu.js} +1 -1
- package/dist/{UploadImages-Yl-90dxh.cjs → UploadImages-YTGwaLiS.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-5aoq9X96.js → index-ypVXAZEr.js} +320 -320
- package/dist/index-zg1mFs4g.cjs +61 -0
- package/package.json +1 -1
- package/dist/index-M74Ml_9k.cjs +0 -61
|
@@ -115,7 +115,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
115
115
|
I.v = v.v;
|
|
116
116
|
}
|
|
117
117
|
return d(b, I), I;
|
|
118
|
-
},
|
|
118
|
+
}, g = (b, _, R, v) => {
|
|
119
119
|
if (isPromiseLike$2(_)) {
|
|
120
120
|
let I;
|
|
121
121
|
const L = new Promise((P, V) => {
|
|
@@ -161,10 +161,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
161
161
|
e: _
|
|
162
162
|
};
|
|
163
163
|
return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
|
|
164
|
-
},
|
|
164
|
+
}, m = (b) => {
|
|
165
165
|
const _ = c(b);
|
|
166
166
|
if (_ && (_.d.forEach(($, O) => {
|
|
167
|
-
O !== b && !n.has(O) &&
|
|
167
|
+
O !== b && !n.has(O) && m(O);
|
|
168
168
|
}), Array.from(_.d).every(([$, O]) => {
|
|
169
169
|
const M = c($);
|
|
170
170
|
return $ === b || M === O || // TODO This is a hack, we should find a better solution.
|
|
@@ -182,7 +182,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
182
182
|
return R.set($, void 0), $.init;
|
|
183
183
|
throw new Error("no atom init");
|
|
184
184
|
}
|
|
185
|
-
const O =
|
|
185
|
+
const O = m($);
|
|
186
186
|
return R.set($, O), returnAtomValue(O);
|
|
187
187
|
};
|
|
188
188
|
let L, P;
|
|
@@ -199,7 +199,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
199
199
|
};
|
|
200
200
|
try {
|
|
201
201
|
const $ = b.read(I, V);
|
|
202
|
-
return
|
|
202
|
+
return g(
|
|
203
203
|
b,
|
|
204
204
|
$,
|
|
205
205
|
R,
|
|
@@ -210,7 +210,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
210
210
|
} finally {
|
|
211
211
|
v = !1;
|
|
212
212
|
}
|
|
213
|
-
}, E = (b) => returnAtomValue(
|
|
213
|
+
}, E = (b) => returnAtomValue(m(b)), f = (b) => {
|
|
214
214
|
let _ = n.get(b);
|
|
215
215
|
return _ || (_ = C(b)), _;
|
|
216
216
|
}, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
|
|
@@ -236,7 +236,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
236
236
|
if (O && R.set(V, --O), !O) {
|
|
237
237
|
let M = !!(($ = _.get(V)) != null && $.size);
|
|
238
238
|
if (M) {
|
|
239
|
-
const H = c(V), F =
|
|
239
|
+
const H = c(V), F = m(V);
|
|
240
240
|
M = !H || !isEqualAtomValue(H, F);
|
|
241
241
|
}
|
|
242
242
|
M || _.forEach((H) => H.delete(V));
|
|
@@ -248,12 +248,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
248
248
|
I(b);
|
|
249
249
|
}, S = (b, ..._) => {
|
|
250
250
|
let R = !0;
|
|
251
|
-
const v = (P) => returnAtomValue(
|
|
251
|
+
const v = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
|
|
252
252
|
let $;
|
|
253
253
|
if (P === b) {
|
|
254
254
|
if (!hasInitialValue(P))
|
|
255
255
|
throw new Error("atom not writable");
|
|
256
|
-
const O = c(P), M =
|
|
256
|
+
const O = c(P), M = g(P, V[0]);
|
|
257
257
|
(!O || !isEqualAtomValue(O, M)) && A(P);
|
|
258
258
|
} else
|
|
259
259
|
$ = S(P, ...V);
|
|
@@ -276,10 +276,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
276
276
|
t: new Set(_ && [_]),
|
|
277
277
|
l: /* @__PURE__ */ new Set()
|
|
278
278
|
};
|
|
279
|
-
if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b),
|
|
279
|
+
if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), m(b).d.forEach((v, I) => {
|
|
280
280
|
const L = n.get(I);
|
|
281
281
|
L ? L.t.add(b) : I !== b && C(I, b);
|
|
282
|
-
}),
|
|
282
|
+
}), m(b), isActuallyWritableAtom(b) && b.onMount) {
|
|
283
283
|
const v = b.onMount((...I) => B(b, ...I));
|
|
284
284
|
v && (R.u = v);
|
|
285
285
|
}
|
|
@@ -351,7 +351,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
351
351
|
dev_get_mounted: (b) => n.get(b),
|
|
352
352
|
dev_restore_atoms: (b) => {
|
|
353
353
|
for (const [R, v] of b)
|
|
354
|
-
hasInitialValue(R) && (
|
|
354
|
+
hasInitialValue(R) && (g(R, v), A(R));
|
|
355
355
|
const _ = D();
|
|
356
356
|
l.forEach(
|
|
357
357
|
(R) => R({ type: "restore", flushed: _ })
|
|
@@ -377,13 +377,13 @@ function splitAtom(o, n) {
|
|
|
377
377
|
let u = r.get(c);
|
|
378
378
|
if (u)
|
|
379
379
|
return u;
|
|
380
|
-
const p = d && r.get(d),
|
|
381
|
-
return c.forEach((
|
|
382
|
-
const f = n ? n(
|
|
380
|
+
const p = d && r.get(d), g = [], x = [];
|
|
381
|
+
return c.forEach((m, E) => {
|
|
382
|
+
const f = n ? n(m) : E;
|
|
383
383
|
x[E] = f;
|
|
384
384
|
const j = p && p.atomList[p.keyList.indexOf(f)];
|
|
385
385
|
if (j) {
|
|
386
|
-
|
|
386
|
+
g[E] = j;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
const k = (S) => {
|
|
@@ -406,8 +406,8 @@ function splitAtom(o, n) {
|
|
|
406
406
|
...N.slice(T + 1)
|
|
407
407
|
]);
|
|
408
408
|
};
|
|
409
|
-
|
|
410
|
-
}), p && p.keyList.length === x.length && p.keyList.every((
|
|
409
|
+
g[E] = isWritable(o) ? atom(k, A) : atom(k);
|
|
410
|
+
}), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, r.set(c, u), u;
|
|
411
411
|
}, l = atom((c) => {
|
|
412
412
|
const d = c(l), u = c(o);
|
|
413
413
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
|
|
|
420
420
|
case "remove": {
|
|
421
421
|
const p = c(i).indexOf(u.atom);
|
|
422
422
|
if (p >= 0) {
|
|
423
|
-
const
|
|
423
|
+
const g = c(o);
|
|
424
424
|
d(o, [
|
|
425
|
-
...
|
|
426
|
-
...
|
|
425
|
+
...g.slice(0, p),
|
|
426
|
+
...g.slice(p + 1)
|
|
427
427
|
]);
|
|
428
428
|
}
|
|
429
429
|
break;
|
|
@@ -431,28 +431,28 @@ function splitAtom(o, n) {
|
|
|
431
431
|
case "insert": {
|
|
432
432
|
const p = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
433
433
|
if (p >= 0) {
|
|
434
|
-
const
|
|
434
|
+
const g = c(o);
|
|
435
435
|
d(o, [
|
|
436
|
-
...
|
|
436
|
+
...g.slice(0, p),
|
|
437
437
|
u.value,
|
|
438
|
-
...
|
|
438
|
+
...g.slice(p)
|
|
439
439
|
]);
|
|
440
440
|
}
|
|
441
441
|
break;
|
|
442
442
|
}
|
|
443
443
|
case "move": {
|
|
444
|
-
const p = c(i).indexOf(u.atom),
|
|
445
|
-
if (p >= 0 &&
|
|
444
|
+
const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
445
|
+
if (p >= 0 && g >= 0) {
|
|
446
446
|
const x = c(o);
|
|
447
|
-
p <
|
|
447
|
+
p < g ? d(o, [
|
|
448
448
|
...x.slice(0, p),
|
|
449
|
-
...x.slice(p + 1,
|
|
449
|
+
...x.slice(p + 1, g),
|
|
450
450
|
x[p],
|
|
451
|
-
...x.slice(
|
|
451
|
+
...x.slice(g)
|
|
452
452
|
]) : d(o, [
|
|
453
|
-
...x.slice(0,
|
|
453
|
+
...x.slice(0, g),
|
|
454
454
|
x[p],
|
|
455
|
-
...x.slice(
|
|
455
|
+
...x.slice(g, p),
|
|
456
456
|
...x.slice(p + 1)
|
|
457
457
|
]);
|
|
458
458
|
}
|
|
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
|
|
|
473
473
|
const a = {
|
|
474
474
|
getItem: (l, i) => {
|
|
475
475
|
var c, d;
|
|
476
|
-
const u = (
|
|
477
|
-
if (
|
|
476
|
+
const u = (g) => {
|
|
477
|
+
if (g = g || "", n !== g) {
|
|
478
478
|
try {
|
|
479
|
-
r = JSON.parse(
|
|
479
|
+
r = JSON.parse(g);
|
|
480
480
|
} catch {
|
|
481
481
|
return i;
|
|
482
482
|
}
|
|
483
|
-
n =
|
|
483
|
+
n = g;
|
|
484
484
|
}
|
|
485
485
|
return r;
|
|
486
486
|
}, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
|
|
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
|
|
|
529
529
|
}, atom(
|
|
530
530
|
(d) => d(i),
|
|
531
531
|
(d, u, p) => {
|
|
532
|
-
const
|
|
533
|
-
return
|
|
532
|
+
const g = typeof p == "function" ? p(d(i)) : p;
|
|
533
|
+
return g === RESET ? (u(i, n), r.removeItem(o)) : g instanceof Promise ? g.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, g), r.setItem(o, g));
|
|
534
534
|
}
|
|
535
535
|
);
|
|
536
536
|
}
|
|
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
555
555
|
function useAtomValue(o, n) {
|
|
556
556
|
const r = useStore(n), [[a, l, i], c] = useReducer(
|
|
557
557
|
(p) => {
|
|
558
|
-
const
|
|
559
|
-
return Object.is(p[0],
|
|
558
|
+
const g = r.get(o);
|
|
559
|
+
return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
|
|
560
560
|
},
|
|
561
561
|
void 0,
|
|
562
562
|
() => [r.get(o), r, o]
|
|
@@ -640,8 +640,8 @@ const getSlots = (o) => {
|
|
|
640
640
|
return map(i, (c) => {
|
|
641
641
|
const d = c, u = getSlots(d);
|
|
642
642
|
return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
|
|
643
|
-
const
|
|
644
|
-
d[p] = `slot:${
|
|
643
|
+
const g = find(i, { oldId: u[p].replace("slot:", "") });
|
|
644
|
+
d[p] = `slot:${g._id}`;
|
|
645
645
|
}), omit(d, ["global", "oldId"]);
|
|
646
646
|
});
|
|
647
647
|
}, presentBlocksAtom = atom$1([]);
|
|
@@ -759,8 +759,8 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
759
759
|
const p = r[u];
|
|
760
760
|
if (includes(["slot", "styles"], p.type))
|
|
761
761
|
return;
|
|
762
|
-
const
|
|
763
|
-
l.properties[
|
|
762
|
+
const g = u;
|
|
763
|
+
l.properties[g] = getBlockJSONFromSchemas(p, n);
|
|
764
764
|
}), l;
|
|
765
765
|
case "list":
|
|
766
766
|
const { itemProperties: i, title: c } = o, d = {
|
|
@@ -775,8 +775,8 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
775
775
|
const p = i[u];
|
|
776
776
|
if (includes(["slot", "styles"], p.type))
|
|
777
777
|
return;
|
|
778
|
-
const
|
|
779
|
-
d.items.properties[
|
|
778
|
+
const g = u;
|
|
779
|
+
d.items.properties[g] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
|
|
780
780
|
}), d;
|
|
781
781
|
default:
|
|
782
782
|
return {};
|
|
@@ -829,8 +829,8 @@ var undomanager = { exports: {} };
|
|
|
829
829
|
}
|
|
830
830
|
let r = function() {
|
|
831
831
|
let a = [], l = -1, i = 0, c = !1, d;
|
|
832
|
-
function u(p,
|
|
833
|
-
return !p || typeof p[
|
|
832
|
+
function u(p, g) {
|
|
833
|
+
return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
|
|
834
834
|
}
|
|
835
835
|
return {
|
|
836
836
|
/**
|
|
@@ -857,8 +857,8 @@ var undomanager = { exports: {} };
|
|
|
857
857
|
let p = a[l];
|
|
858
858
|
if (!p)
|
|
859
859
|
return this;
|
|
860
|
-
const
|
|
861
|
-
for (; p.groupId ===
|
|
860
|
+
const g = p.groupId;
|
|
861
|
+
for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
|
|
862
862
|
;
|
|
863
863
|
return d && d(), this;
|
|
864
864
|
},
|
|
@@ -869,8 +869,8 @@ var undomanager = { exports: {} };
|
|
|
869
869
|
let p = a[l + 1];
|
|
870
870
|
if (!p)
|
|
871
871
|
return this;
|
|
872
|
-
const
|
|
873
|
-
for (; p.groupId ===
|
|
872
|
+
const g = p.groupId;
|
|
873
|
+
for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
|
|
874
874
|
;
|
|
875
875
|
return d && d(), this;
|
|
876
876
|
},
|
|
@@ -901,7 +901,7 @@ var undomanager = { exports: {} };
|
|
|
901
901
|
* @returns {array}
|
|
902
902
|
*/
|
|
903
903
|
getCommands: function(p) {
|
|
904
|
-
return p ? a.filter((
|
|
904
|
+
return p ? a.filter((g) => g.groupId === p) : a;
|
|
905
905
|
},
|
|
906
906
|
/**
|
|
907
907
|
* Returns the index of the actions list.
|
|
@@ -1256,7 +1256,7 @@ const useBlocksStoreManager = () => {
|
|
|
1256
1256
|
}, useAddBlock = () => {
|
|
1257
1257
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1258
1258
|
(i, c, d) => {
|
|
1259
|
-
var
|
|
1259
|
+
var m;
|
|
1260
1260
|
for (let E = 0; E < i.length; E++) {
|
|
1261
1261
|
const { _id: f } = i[E];
|
|
1262
1262
|
i[E]._id = generateUUID();
|
|
@@ -1265,8 +1265,8 @@ const useBlocksStoreManager = () => {
|
|
|
1265
1265
|
j[k]._parent = i[E]._id;
|
|
1266
1266
|
}
|
|
1267
1267
|
const u = first(i);
|
|
1268
|
-
let p,
|
|
1269
|
-
return c && (p = find(o, { _id: c }), i[0]._parent = c,
|
|
1268
|
+
let p, g;
|
|
1269
|
+
return c && (p = find(o, { _id: c }), i[0]._parent = c, g = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, g = p._parent), r(i, g, d), n([(m = first(i)) == null ? void 0 : m._id]), first(i);
|
|
1270
1270
|
},
|
|
1271
1271
|
[o, n]
|
|
1272
1272
|
);
|
|
@@ -1276,11 +1276,11 @@ const useBlocksStoreManager = () => {
|
|
|
1276
1276
|
const k = i.blocks;
|
|
1277
1277
|
return a(k, c, d);
|
|
1278
1278
|
}
|
|
1279
|
-
const u = generateUUID(), p = getBlockDefaultProps(i.props),
|
|
1279
|
+
const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
|
|
1280
1280
|
forIn(p, (k, A) => {
|
|
1281
1281
|
if (startsWith(k, SLOT_KEY)) {
|
|
1282
1282
|
const S = k.replace(SLOT_KEY, "");
|
|
1283
|
-
|
|
1283
|
+
g.push({
|
|
1284
1284
|
_id: S,
|
|
1285
1285
|
_type: "Slot",
|
|
1286
1286
|
_parent: u,
|
|
@@ -1295,9 +1295,9 @@ const useBlocksStoreManager = () => {
|
|
|
1295
1295
|
_id: u,
|
|
1296
1296
|
...p
|
|
1297
1297
|
};
|
|
1298
|
-
let
|
|
1299
|
-
c && (
|
|
1300
|
-
const j = [x, ...
|
|
1298
|
+
let m, E;
|
|
1299
|
+
c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
|
|
1300
|
+
const j = [x, ...g];
|
|
1301
1301
|
return r(j, E, d), n([x._id]), x;
|
|
1302
1302
|
},
|
|
1303
1303
|
[a, o, n]
|
|
@@ -2406,18 +2406,18 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2406
2406
|
);
|
|
2407
2407
|
const i = [], c = [];
|
|
2408
2408
|
each(r, (p) => {
|
|
2409
|
-
const
|
|
2409
|
+
const g = constructClassObject(p), x = find(a, pick(g, ["dark", "mq", "mod", "property"]));
|
|
2410
2410
|
if (x && (a = filter(
|
|
2411
2411
|
a,
|
|
2412
|
-
(
|
|
2413
|
-
)), i.push(
|
|
2414
|
-
const
|
|
2412
|
+
(m) => m.fullCls !== (x == null ? void 0 : x.fullCls)
|
|
2413
|
+
)), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (m) => m.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
|
|
2414
|
+
const m = find(l, pick(g, ["property"]));
|
|
2415
2415
|
x && (l = filter(
|
|
2416
2416
|
l,
|
|
2417
|
-
(E) => E.fullCls !== (
|
|
2417
|
+
(E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
|
|
2418
2418
|
)), c.push({
|
|
2419
|
-
...
|
|
2420
|
-
fullCls:
|
|
2419
|
+
...g,
|
|
2420
|
+
fullCls: g.cls,
|
|
2421
2421
|
mq: "xs"
|
|
2422
2422
|
});
|
|
2423
2423
|
}
|
|
@@ -2445,10 +2445,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2445
2445
|
)
|
|
2446
2446
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2447
2447
|
return map(l, (c) => {
|
|
2448
|
-
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes:
|
|
2448
|
+
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
|
|
2449
2449
|
return {
|
|
2450
2450
|
ids: [d._id],
|
|
2451
|
-
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(
|
|
2451
|
+
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
|
|
2452
2452
|
};
|
|
2453
2453
|
});
|
|
2454
2454
|
}), useAddClassesToBlocks = () => {
|
|
@@ -2497,13 +2497,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2497
2497
|
(a, l = null) => {
|
|
2498
2498
|
const i = [];
|
|
2499
2499
|
each(a, (c) => {
|
|
2500
|
-
const d = o.find((
|
|
2500
|
+
const d = o.find((m) => m._id === c);
|
|
2501
2501
|
l || (l = d._parent);
|
|
2502
|
-
const
|
|
2502
|
+
const g = filter(
|
|
2503
2503
|
o,
|
|
2504
|
-
(
|
|
2504
|
+
(m) => isString$1(l) ? m._parent === l : !d._parent
|
|
2505
2505
|
).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
|
|
2506
|
-
r(x, l,
|
|
2506
|
+
r(x, l, g), i.push(get(x, "0._id", ""));
|
|
2507
2507
|
}), n(i);
|
|
2508
2508
|
},
|
|
2509
2509
|
[o, n]
|
|
@@ -2566,19 +2566,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2566
2566
|
);
|
|
2567
2567
|
return map(i, (c) => {
|
|
2568
2568
|
const d = o(c), u = a;
|
|
2569
|
-
let { classes: p, baseClasses:
|
|
2569
|
+
let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2570
2570
|
return each(u, (x) => {
|
|
2571
|
-
const
|
|
2571
|
+
const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
|
|
2572
2572
|
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2573
2573
|
const f = first(x.split(":"));
|
|
2574
2574
|
includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
|
|
2575
2575
|
}), each(u, (x) => {
|
|
2576
|
-
const
|
|
2577
|
-
|
|
2576
|
+
const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2577
|
+
g = g.replace(m, " ").replace(/ +/g, " ").trim();
|
|
2578
2578
|
}), {
|
|
2579
2579
|
ids: [d._id],
|
|
2580
2580
|
props: {
|
|
2581
|
-
[l.prop]: `${STYLES_KEY}${
|
|
2581
|
+
[l.prop]: `${STYLES_KEY}${g},${p}`
|
|
2582
2582
|
}
|
|
2583
2583
|
};
|
|
2584
2584
|
});
|
|
@@ -2655,7 +2655,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2655
2655
|
let u = "";
|
|
2656
2656
|
o([n], { [i]: "" });
|
|
2657
2657
|
for (let p = 0; p < d.length; p++)
|
|
2658
|
-
u += d[p].join(""), o([n], { [i]: u }), await new Promise((
|
|
2658
|
+
u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
2661
|
},
|
|
@@ -2836,31 +2836,31 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
|
|
|
2836
2836
|
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
2837
2837
|
</body>
|
|
2838
2838
|
</html>`, useCanvasScale = (o) => {
|
|
2839
|
-
const [n] = useCanvasWidth(), [, r] = useCanvasZoom(),
|
|
2840
|
-
const { width:
|
|
2841
|
-
if (
|
|
2842
|
-
const
|
|
2843
|
-
let
|
|
2844
|
-
const
|
|
2845
|
-
|
|
2839
|
+
const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
|
|
2840
|
+
const { width: d, height: u } = o;
|
|
2841
|
+
if (d < n) {
|
|
2842
|
+
const p = parseFloat((d / n).toFixed(2).toString());
|
|
2843
|
+
let g = {};
|
|
2844
|
+
const x = u * p, m = d * p;
|
|
2845
|
+
u && (g = {
|
|
2846
2846
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
2847
|
-
height: 100 + (
|
|
2848
|
-
width: 100 + (
|
|
2849
|
-
}),
|
|
2847
|
+
height: 100 + (u - x) / x * 100 + "%",
|
|
2848
|
+
width: 100 + (d - m) / m * 100 + "%"
|
|
2849
|
+
}), i({
|
|
2850
2850
|
position: "relative",
|
|
2851
2851
|
top: 0,
|
|
2852
|
-
transform: `scale(${
|
|
2853
|
-
transformOrigin: "top left",
|
|
2854
|
-
...
|
|
2852
|
+
transform: `scale(${p})`,
|
|
2853
|
+
transformOrigin: a === "rtl" ? "top right" : "top left",
|
|
2854
|
+
...g,
|
|
2855
2855
|
maxWidth: "none"
|
|
2856
2856
|
// TODO: Add max-width to the wrapper
|
|
2857
|
-
}), r(
|
|
2857
|
+
}), r(p * 100);
|
|
2858
2858
|
} else
|
|
2859
|
-
|
|
2860
|
-
}, [n, o, r]);
|
|
2859
|
+
i({}), r(100);
|
|
2860
|
+
}, [n, o, a, r]);
|
|
2861
2861
|
return useEffect(() => {
|
|
2862
|
-
|
|
2863
|
-
}, [n, o, r,
|
|
2862
|
+
c();
|
|
2863
|
+
}, [n, o, r, c]), l;
|
|
2864
2864
|
};
|
|
2865
2865
|
let doc, win;
|
|
2866
2866
|
typeof document < "u" && (doc = document);
|
|
@@ -3029,12 +3029,12 @@ const useDnd = () => {
|
|
|
3029
3029
|
};
|
|
3030
3030
|
return iframeDocument = o, {
|
|
3031
3031
|
isDragging: n,
|
|
3032
|
-
onDragOver: (
|
|
3033
|
-
|
|
3032
|
+
onDragOver: (m) => {
|
|
3033
|
+
m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
|
|
3034
3034
|
},
|
|
3035
|
-
onDrop: (
|
|
3035
|
+
onDrop: (m) => {
|
|
3036
3036
|
var C;
|
|
3037
|
-
const E = dropTarget, j = getOrientation(E) === "vertical" ?
|
|
3037
|
+
const E = dropTarget, j = getOrientation(E) === "vertical" ? m.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : m.clientX;
|
|
3038
3038
|
dropIndex = calculateDropIndex(j, possiblePositions);
|
|
3039
3039
|
const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3040
3040
|
if ((k == null ? void 0 : k._id) === A || !S) {
|
|
@@ -3046,16 +3046,16 @@ const useDnd = () => {
|
|
|
3046
3046
|
return;
|
|
3047
3047
|
}
|
|
3048
3048
|
let B = E.getAttribute("data-block-id");
|
|
3049
|
-
B === null && (B =
|
|
3049
|
+
B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3050
3050
|
},
|
|
3051
|
-
onDragEnter: (
|
|
3052
|
-
const E =
|
|
3051
|
+
onDragEnter: (m) => {
|
|
3052
|
+
const E = m, f = E.target;
|
|
3053
3053
|
dropTarget = f;
|
|
3054
3054
|
const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
|
|
3055
3055
|
p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
|
|
3056
3056
|
},
|
|
3057
|
-
onDragLeave: (
|
|
3058
|
-
|
|
3057
|
+
onDragLeave: (m) => {
|
|
3058
|
+
m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
3059
3059
|
}
|
|
3060
3060
|
};
|
|
3061
3061
|
};
|
|
@@ -3077,16 +3077,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3077
3077
|
if (!d || !o.includes(d))
|
|
3078
3078
|
return;
|
|
3079
3079
|
const u = c.cloneNode(!0);
|
|
3080
|
-
c.style.display = "none", Array.from(u.attributes).forEach((
|
|
3081
|
-
|
|
3080
|
+
c.style.display = "none", Array.from(u.attributes).forEach((m) => {
|
|
3081
|
+
m.name !== "class" && u.removeAttribute(m.name);
|
|
3082
3082
|
}), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
|
|
3083
3083
|
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3084
|
-
function
|
|
3085
|
-
const
|
|
3086
|
-
n([c.getAttribute("data-block-id")], { content:
|
|
3084
|
+
function g() {
|
|
3085
|
+
const m = p.getText(0, p.getLength());
|
|
3086
|
+
n([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), l(""), r("");
|
|
3087
3087
|
}
|
|
3088
|
-
u.addEventListener("blur",
|
|
3089
|
-
(
|
|
3088
|
+
u.addEventListener("blur", g, !0), u.addEventListener("keydown", (m) => {
|
|
3089
|
+
(m.key === "Enter" || m.key === "Escape") && g();
|
|
3090
3090
|
}), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
|
|
3091
3091
|
};
|
|
3092
3092
|
}, useHandleCanvasClick = () => {
|
|
@@ -3101,8 +3101,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3101
3101
|
return;
|
|
3102
3102
|
}
|
|
3103
3103
|
if (d != null && d.getAttribute("data-block-parent")) {
|
|
3104
|
-
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"),
|
|
3105
|
-
n.includes(
|
|
3104
|
+
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
|
|
3105
|
+
n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
|
|
3106
3106
|
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3107
3107
|
let u = d.getAttribute("data-block-id");
|
|
3108
3108
|
n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
@@ -3125,10 +3125,10 @@ const useHandleCanvasDblClick = () => {
|
|
|
3125
3125
|
return;
|
|
3126
3126
|
const p = getElementByDataBlockId(n, first(r));
|
|
3127
3127
|
if (p) {
|
|
3128
|
-
const
|
|
3129
|
-
if (
|
|
3130
|
-
const x = p.getAttribute("data-style-id"),
|
|
3131
|
-
l([{ id: x, prop:
|
|
3128
|
+
const g = p.getAttribute("data-style-prop");
|
|
3129
|
+
if (g) {
|
|
3130
|
+
const x = p.getAttribute("data-style-id"), m = p.getAttribute("data-block-parent");
|
|
3131
|
+
l([{ id: x, prop: g, blockId: m }]);
|
|
3132
3132
|
}
|
|
3133
3133
|
}
|
|
3134
3134
|
}, 100);
|
|
@@ -3148,14 +3148,14 @@ const useHandleCanvasDblClick = () => {
|
|
|
3148
3148
|
}
|
|
3149
3149
|
);
|
|
3150
3150
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
|
|
3151
|
-
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks:
|
|
3151
|
+
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
|
|
3152
3152
|
useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
|
|
3153
3153
|
"ctrl+v,command+v",
|
|
3154
3154
|
() => {
|
|
3155
|
-
p(n[0]) &&
|
|
3155
|
+
p(n[0]) && g(n);
|
|
3156
3156
|
},
|
|
3157
3157
|
{},
|
|
3158
|
-
[n, p,
|
|
3158
|
+
[n, p, g]
|
|
3159
3159
|
);
|
|
3160
3160
|
const x = o ? { document: o } : {};
|
|
3161
3161
|
useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
|
|
@@ -3163,8 +3163,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3163
3163
|
l
|
|
3164
3164
|
]), useHotkeys(
|
|
3165
3165
|
"del, backspace",
|
|
3166
|
-
(
|
|
3167
|
-
|
|
3166
|
+
(m) => {
|
|
3167
|
+
m.preventDefault(), a(n);
|
|
3168
3168
|
},
|
|
3169
3169
|
x,
|
|
3170
3170
|
[n, a]
|
|
@@ -3195,15 +3195,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3195
3195
|
}
|
|
3196
3196
|
);
|
|
3197
3197
|
}, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
|
|
3198
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update:
|
|
3198
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
|
|
3199
3199
|
placement: "top-start",
|
|
3200
3200
|
middleware: [shift(), flip()],
|
|
3201
3201
|
elements: {
|
|
3202
3202
|
reference: o
|
|
3203
3203
|
}
|
|
3204
3204
|
});
|
|
3205
|
-
useResizeObserver(o, () =>
|
|
3206
|
-
const x = get(n, "_parent", null),
|
|
3205
|
+
useResizeObserver(o, () => g(), o !== null);
|
|
3206
|
+
const x = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3207
3207
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3208
3208
|
"div",
|
|
3209
3209
|
{
|
|
@@ -3229,7 +3229,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
3231
|
),
|
|
3232
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label:
|
|
3232
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: n }),
|
|
3233
3233
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
|
|
3234
3234
|
canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3235
3235
|
PlusIcon,
|
|
@@ -3252,9 +3252,9 @@ const useHandleCanvasDblClick = () => {
|
|
|
3252
3252
|
}
|
|
3253
3253
|
) });
|
|
3254
3254
|
}, HeadTags = ({ model: o }) => {
|
|
3255
|
-
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [
|
|
3255
|
+
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [g] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
|
|
3256
3256
|
u == null ? void 0 : u.getElementById("selected-block")
|
|
3257
|
-
), [
|
|
3257
|
+
), [m] = useState(
|
|
3258
3258
|
u == null ? void 0 : u.getElementById("selected-styling-block")
|
|
3259
3259
|
), [E] = useState(
|
|
3260
3260
|
u == null ? void 0 : u.getElementById("dragged-block")
|
|
@@ -3323,12 +3323,12 @@ const useHandleCanvasDblClick = () => {
|
|
|
3323
3323
|
}, [r, x]), useEffect(() => {
|
|
3324
3324
|
E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3325
3325
|
}, [c, E]), useEffect(() => {
|
|
3326
|
-
|
|
3327
|
-
}, [l, r,
|
|
3328
|
-
|
|
3326
|
+
g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3327
|
+
}, [l, r, g]), useEffect(() => {
|
|
3328
|
+
m && (m.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
|
|
3329
3329
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3330
3330
|
}`);
|
|
3331
|
-
}, [i,
|
|
3331
|
+
}, [i, m]), useEffect(() => {
|
|
3332
3332
|
u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3333
3333
|
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3334
3334
|
"link",
|
|
@@ -3345,13 +3345,13 @@ const useHandleCanvasDblClick = () => {
|
|
|
3345
3345
|
u || (u = d, d = "xs");
|
|
3346
3346
|
const p = r.indexOf(d);
|
|
3347
3347
|
if (p <= a) {
|
|
3348
|
-
const
|
|
3349
|
-
if (
|
|
3350
|
-
for (let
|
|
3351
|
-
i[
|
|
3348
|
+
const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
|
|
3349
|
+
if (g.includes(u))
|
|
3350
|
+
for (let m = p; m < r.length; m++)
|
|
3351
|
+
i[m] = !0;
|
|
3352
3352
|
else if (x.includes(u))
|
|
3353
|
-
for (let
|
|
3354
|
-
i[
|
|
3353
|
+
for (let m = p; m < r.length; m++)
|
|
3354
|
+
i[m] = !1;
|
|
3355
3355
|
}
|
|
3356
3356
|
}
|
|
3357
3357
|
return i[a];
|
|
@@ -3378,16 +3378,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3378
3378
|
forEach(d, (u) => {
|
|
3379
3379
|
if (get(n, u, "") || get(a, `${u}.loading`, !1))
|
|
3380
3380
|
return;
|
|
3381
|
-
const p = o.find((
|
|
3382
|
-
l((
|
|
3383
|
-
r((x) => ({ ...x, [u]:
|
|
3381
|
+
const p = o.find((g) => g._id === u);
|
|
3382
|
+
l((g) => ({ ...g, [u]: { loading: !0, error: null } })), c(p).then((g) => {
|
|
3383
|
+
r((x) => ({ ...x, [u]: g })), l((x) => ({
|
|
3384
3384
|
...x,
|
|
3385
3385
|
[u]: { loading: !1, error: null }
|
|
3386
3386
|
}));
|
|
3387
|
-
}).catch((
|
|
3387
|
+
}).catch((g) => {
|
|
3388
3388
|
l((x) => ({
|
|
3389
3389
|
...x,
|
|
3390
|
-
[u]: { loading: !1, error:
|
|
3390
|
+
[u]: { loading: !1, error: g.message }
|
|
3391
3391
|
}));
|
|
3392
3392
|
});
|
|
3393
3393
|
});
|
|
@@ -3444,7 +3444,7 @@ function isDescendant(o, n, r) {
|
|
|
3444
3444
|
}
|
|
3445
3445
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
|
|
3446
3446
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3447
|
-
const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(),
|
|
3447
|
+
const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), g = useCallback((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [m] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
|
|
3448
3448
|
(f) => f.reduce((j, k) => {
|
|
3449
3449
|
const A = get(d, k, {});
|
|
3450
3450
|
return { ...j, ...A };
|
|
@@ -3453,7 +3453,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3453
3453
|
);
|
|
3454
3454
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3455
3455
|
o.map((f, j) => {
|
|
3456
|
-
if (
|
|
3456
|
+
if (m === f._id || u.includes(f._id))
|
|
3457
3457
|
return null;
|
|
3458
3458
|
const k = {}, A = filter(n, { _parent: f._id });
|
|
3459
3459
|
if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
|
|
@@ -3463,7 +3463,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3463
3463
|
const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
|
|
3464
3464
|
if (isNull(C))
|
|
3465
3465
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3466
|
-
const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D =
|
|
3466
|
+
const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = g(f);
|
|
3467
3467
|
if (get(D, "__isHidden", !1) && !includes(r, f._id))
|
|
3468
3468
|
return null;
|
|
3469
3469
|
const T = l && isDescendant(l._id, f._id, n), b = {
|
|
@@ -3537,7 +3537,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3537
3537
|
n(i);
|
|
3538
3538
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3539
3539
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3540
|
-
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), [
|
|
3540
|
+
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), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
|
|
3541
3541
|
u((N) => ({ ...N, width: w }));
|
|
3542
3542
|
};
|
|
3543
3543
|
useEffect(() => {
|
|
@@ -3562,9 +3562,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3562
3562
|
i.current.contentDocument,
|
|
3563
3563
|
first(f).id
|
|
3564
3564
|
);
|
|
3565
|
-
|
|
3565
|
+
m(w ? [w] : [null]);
|
|
3566
3566
|
} else
|
|
3567
|
-
|
|
3567
|
+
m([null]);
|
|
3568
3568
|
}, [f]);
|
|
3569
3569
|
const C = useMemo(() => {
|
|
3570
3570
|
let w = IframeInitialContent;
|
|
@@ -3597,7 +3597,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3597
3597
|
BlockActionsStatic,
|
|
3598
3598
|
{
|
|
3599
3599
|
block: a,
|
|
3600
|
-
selectedBlockElement: first(
|
|
3600
|
+
selectedBlockElement: first(g)
|
|
3601
3601
|
}
|
|
3602
3602
|
),
|
|
3603
3603
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
|
|
@@ -3692,7 +3692,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3692
3692
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
|
|
3693
3693
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
|
|
3694
3694
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
|
|
3695
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
|
|
3695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3696
3696
|
] }),
|
|
3697
3697
|
reverse(o).map((a, l) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
|
|
3698
3698
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -3710,10 +3710,10 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3710
3710
|
]
|
|
3711
3711
|
}
|
|
3712
3712
|
),
|
|
3713
|
-
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
|
|
3713
|
+
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3714
3714
|
] }, l))
|
|
3715
3715
|
] }) });
|
|
3716
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3716
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-v7zBTMpR.js")), CanvasArea = () => {
|
|
3717
3717
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3718
3718
|
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: [
|
|
3719
3719
|
/* @__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, {}) }) }),
|
|
@@ -3793,9 +3793,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3793
3793
|
}, {
|
|
3794
3794
|
bodyFont: u,
|
|
3795
3795
|
headingFont: p,
|
|
3796
|
-
primaryColor:
|
|
3796
|
+
primaryColor: g,
|
|
3797
3797
|
bodyTextDarkColor: x,
|
|
3798
|
-
bodyTextLightColor:
|
|
3798
|
+
bodyTextLightColor: m,
|
|
3799
3799
|
bodyBgDarkColor: E,
|
|
3800
3800
|
secondaryColor: f,
|
|
3801
3801
|
bodyBgLightColor: j,
|
|
@@ -3816,7 +3816,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3816
3816
|
title: c("theme_config.rounded_corner"),
|
|
3817
3817
|
default: parseInt(k || 5, 10)
|
|
3818
3818
|
}),
|
|
3819
|
-
primaryColor: h({ title: c("theme_config.primary"), default:
|
|
3819
|
+
primaryColor: h({ title: c("theme_config.primary"), default: g }),
|
|
3820
3820
|
secondaryColor: h({ title: c("theme_config.secondary"), default: f })
|
|
3821
3821
|
};
|
|
3822
3822
|
l || (A = {
|
|
@@ -3835,7 +3835,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3835
3835
|
}),
|
|
3836
3836
|
bodyTextDarkColor: h({
|
|
3837
3837
|
title: c("theme_config.text_color_dark_mode"),
|
|
3838
|
-
default:
|
|
3838
|
+
default: m
|
|
3839
3839
|
})
|
|
3840
3840
|
});
|
|
3841
3841
|
const S = {
|
|
@@ -4040,7 +4040,7 @@ function BiExpandVertical(o) {
|
|
|
4040
4040
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4041
4041
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4042
4042
|
let p = null;
|
|
4043
|
-
const
|
|
4043
|
+
const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
|
|
4044
4044
|
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4045
4045
|
}, B = (T) => {
|
|
4046
4046
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
@@ -4056,14 +4056,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4056
4056
|
return () => clearTimeout(T);
|
|
4057
4057
|
}, [f, o, j]);
|
|
4058
4058
|
const N = useMemo(() => {
|
|
4059
|
-
const T = Object.keys(
|
|
4059
|
+
const T = Object.keys(m), b = [];
|
|
4060
4060
|
for (let _ = 0; _ < T.length; _++)
|
|
4061
4061
|
if (T[_].endsWith("_attrs")) {
|
|
4062
|
-
const R =
|
|
4062
|
+
const R = m[T[_]], v = Object.keys(R).join("|");
|
|
4063
4063
|
v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
|
|
4064
4064
|
}
|
|
4065
4065
|
return b;
|
|
4066
|
-
}, [
|
|
4066
|
+
}, [m]), D = (T, b) => {
|
|
4067
4067
|
const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
|
|
4068
4068
|
R && R.setAttribute("data-drop", b);
|
|
4069
4069
|
const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
@@ -4101,7 +4101,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4101
4101
|
className: cn(
|
|
4102
4102
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4103
4103
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4104
|
-
f && canAcceptChildBlock(
|
|
4104
|
+
f && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
|
|
4105
4105
|
j && "opacity-20",
|
|
4106
4106
|
i.includes(x) ? "opacity-50" : ""
|
|
4107
4107
|
),
|
|
@@ -4111,11 +4111,11 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4111
4111
|
"div",
|
|
4112
4112
|
{
|
|
4113
4113
|
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" : ""}`,
|
|
4114
|
-
children:
|
|
4114
|
+
children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4115
4115
|
}
|
|
4116
4116
|
),
|
|
4117
4117
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4118
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4118
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
|
|
4119
4119
|
k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4120
4120
|
"div",
|
|
4121
4121
|
{
|
|
@@ -4124,7 +4124,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4124
4124
|
T.stopPropagation(), o.edit(), o.deselect();
|
|
4125
4125
|
},
|
|
4126
4126
|
children: [
|
|
4127
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4127
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (m == null ? void 0 : m._name) || (m == null ? void 0 : m._type.split("/").pop()) }),
|
|
4128
4128
|
N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4129
4129
|
N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4130
4130
|
N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
@@ -4145,7 +4145,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4145
4145
|
),
|
|
4146
4146
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
|
|
4147
4147
|
] })),
|
|
4148
|
-
canAddChildBlock(
|
|
4148
|
+
canAddChildBlock(m == null ? void 0 : m._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4149
4149
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4150
4150
|
TooltipTrigger,
|
|
4151
4151
|
{
|
|
@@ -4213,7 +4213,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4213
4213
|
}, [treeData, cutBlocksIds]);
|
|
4214
4214
|
useEffect(() => {
|
|
4215
4215
|
setTreeRef(treeRef.current);
|
|
4216
|
-
}, [treeRef
|
|
4216
|
+
}, [setTreeRef, treeRef]);
|
|
4217
4217
|
const onRename = ({ id: o, name: n, node: r }) => {
|
|
4218
4218
|
updateBlockProps([o], { _name: n }, r.data._name);
|
|
4219
4219
|
}, onMove = ({ dragIds: o, parentId: n, index: r }) => {
|
|
@@ -4280,7 +4280,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4280
4280
|
size: "sm",
|
|
4281
4281
|
children: [
|
|
4282
4282
|
"+ ",
|
|
4283
|
-
t("
|
|
4283
|
+
t("Add Block")
|
|
4284
4284
|
]
|
|
4285
4285
|
}
|
|
4286
4286
|
)
|
|
@@ -4517,8 +4517,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4517
4517
|
const c = stringify([r]);
|
|
4518
4518
|
return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), 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 = c, [a];
|
|
4519
4519
|
} else if (r.tagName === "svg") {
|
|
4520
|
-
const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px",
|
|
4521
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`,
|
|
4520
|
+
const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", g = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4521
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, g)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
|
|
4522
4522
|
} else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
|
|
4523
4523
|
return n.block.options.push({
|
|
4524
4524
|
label: getTextContent(r.children),
|
|
@@ -4579,13 +4579,13 @@ function ExpandableObject(o) {
|
|
|
4579
4579
|
level: d,
|
|
4580
4580
|
style: u,
|
|
4581
4581
|
shouldExpandNode: p,
|
|
4582
|
-
clickToExpandNode:
|
|
4582
|
+
clickToExpandNode: g
|
|
4583
4583
|
} = o;
|
|
4584
|
-
const x = useRef(!1), [
|
|
4584
|
+
const x = useRef(!1), [m, E, f] = useBool(() => p(d, r, n));
|
|
4585
4585
|
useEffect(() => {
|
|
4586
4586
|
x.current ? f(p(d, r, n)) : x.current = !0;
|
|
4587
4587
|
}, [p]);
|
|
4588
|
-
const j =
|
|
4588
|
+
const j = m ? u.collapseIcon : u.expandIcon, k = m ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
|
|
4589
4589
|
w.key === " " && (w.preventDefault(), E());
|
|
4590
4590
|
};
|
|
4591
4591
|
return /* @__PURE__ */ createElement("div", {
|
|
@@ -4598,9 +4598,9 @@ function ExpandableObject(o) {
|
|
|
4598
4598
|
role: "button",
|
|
4599
4599
|
tabIndex: 0,
|
|
4600
4600
|
"aria-label": k,
|
|
4601
|
-
"aria-expanded":
|
|
4602
|
-
"aria-controls":
|
|
4603
|
-
}), n && (
|
|
4601
|
+
"aria-expanded": m,
|
|
4602
|
+
"aria-controls": m ? A : void 0
|
|
4603
|
+
}), n && (g ? /* @__PURE__ */ createElement("span", {
|
|
4604
4604
|
className: u.clickableLabel,
|
|
4605
4605
|
onClick: E,
|
|
4606
4606
|
onKeyDown: C,
|
|
@@ -4610,7 +4610,7 @@ function ExpandableObject(o) {
|
|
|
4610
4610
|
className: u.label
|
|
4611
4611
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4612
4612
|
className: u.punctuation
|
|
4613
|
-
}, i),
|
|
4613
|
+
}, i), m ? /* @__PURE__ */ createElement("div", {
|
|
4614
4614
|
id: A
|
|
4615
4615
|
}, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4616
4616
|
key: w[0] || N,
|
|
@@ -4620,7 +4620,7 @@ function ExpandableObject(o) {
|
|
|
4620
4620
|
lastElement: N === B,
|
|
4621
4621
|
level: S,
|
|
4622
4622
|
shouldExpandNode: p,
|
|
4623
|
-
clickToExpandNode:
|
|
4623
|
+
clickToExpandNode: g
|
|
4624
4624
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4625
4625
|
className: u.collapsedContent,
|
|
4626
4626
|
onClick: E,
|
|
@@ -4629,7 +4629,7 @@ function ExpandableObject(o) {
|
|
|
4629
4629
|
tabIndex: -1,
|
|
4630
4630
|
"aria-hidden": !0,
|
|
4631
4631
|
"aria-label": k,
|
|
4632
|
-
"aria-expanded":
|
|
4632
|
+
"aria-expanded": m
|
|
4633
4633
|
}), /* @__PURE__ */ createElement("span", {
|
|
4634
4634
|
className: u.punctuation
|
|
4635
4635
|
}, c), !l && /* @__PURE__ */ createElement("span", {
|
|
@@ -4782,7 +4782,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4782
4782
|
dataType: i,
|
|
4783
4783
|
appliedBindings: c
|
|
4784
4784
|
}) => {
|
|
4785
|
-
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {},
|
|
4785
|
+
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
|
|
4786
4786
|
(f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
|
|
4787
4787
|
) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
|
|
4788
4788
|
return useEffect(() => {
|
|
@@ -4790,7 +4790,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4790
4790
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4791
4791
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
4792
4792
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
|
|
4793
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange:
|
|
4793
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: m, children: [
|
|
4794
4794
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4795
4795
|
Button,
|
|
4796
4796
|
{
|
|
@@ -4799,7 +4799,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4799
4799
|
className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
|
|
4800
4800
|
children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4801
4801
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
|
|
4802
|
-
|
|
4802
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
|
|
4803
4803
|
n
|
|
4804
4804
|
] }),
|
|
4805
4805
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
|
|
@@ -4817,16 +4817,16 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4817
4817
|
CommandItem,
|
|
4818
4818
|
{
|
|
4819
4819
|
value: f,
|
|
4820
|
-
className: `cursor-pointer ${
|
|
4820
|
+
className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4821
4821
|
onSelect: (j) => {
|
|
4822
|
-
r(find(E, (k) => k === j) || null),
|
|
4822
|
+
r(find(E, (k) => k === j) || null), m(!1);
|
|
4823
4823
|
},
|
|
4824
4824
|
children: [
|
|
4825
4825
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4826
4826
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
|
|
4827
4827
|
f
|
|
4828
4828
|
] }),
|
|
4829
|
-
|
|
4829
|
+
g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
|
|
4830
4830
|
]
|
|
4831
4831
|
},
|
|
4832
4832
|
f
|
|
@@ -4835,7 +4835,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4835
4835
|
] }) })
|
|
4836
4836
|
] })
|
|
4837
4837
|
] }),
|
|
4838
|
-
!
|
|
4838
|
+
!g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
|
|
4839
4839
|
] });
|
|
4840
4840
|
}, AddBindingModalContent = ({
|
|
4841
4841
|
appliedBindings: o = [],
|
|
@@ -4843,7 +4843,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4843
4843
|
editMode: r,
|
|
4844
4844
|
item: a
|
|
4845
4845
|
}) => {
|
|
4846
|
-
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(),
|
|
4846
|
+
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
|
|
4847
4847
|
(E, f) => {
|
|
4848
4848
|
if (isEmpty(E))
|
|
4849
4849
|
return "";
|
|
@@ -4856,7 +4856,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4856
4856
|
}
|
|
4857
4857
|
},
|
|
4858
4858
|
[u, p]
|
|
4859
|
-
), [x,
|
|
4859
|
+
), [x, m] = useState(r ? g(a.key, "PROP") : "");
|
|
4860
4860
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4861
4861
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
|
|
4862
4862
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
|
|
@@ -4872,8 +4872,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4872
4872
|
value: l,
|
|
4873
4873
|
setValue: i,
|
|
4874
4874
|
onChange: (E) => {
|
|
4875
|
-
const f =
|
|
4876
|
-
i(E), x !== f && d(""),
|
|
4875
|
+
const f = g(E, "PROP");
|
|
4876
|
+
i(E), x !== f && d(""), m(f);
|
|
4877
4877
|
},
|
|
4878
4878
|
data: u,
|
|
4879
4879
|
dataType: x,
|
|
@@ -4890,7 +4890,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4890
4890
|
value: c,
|
|
4891
4891
|
setValue: d,
|
|
4892
4892
|
onChange: (E) => {
|
|
4893
|
-
const f =
|
|
4893
|
+
const f = g(E, "PATH");
|
|
4894
4894
|
d(x === f ? E : "");
|
|
4895
4895
|
},
|
|
4896
4896
|
data: p,
|
|
@@ -4934,15 +4934,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4934
4934
|
dataProvider: l,
|
|
4935
4935
|
appliedBindings: i
|
|
4936
4936
|
}) => {
|
|
4937
|
-
const [c, d] = useState("string"), u = (p,
|
|
4937
|
+
const [c, d] = useState("string"), u = (p, g) => {
|
|
4938
4938
|
if (isEmpty(p))
|
|
4939
4939
|
return "";
|
|
4940
4940
|
{
|
|
4941
|
-
const x = get(
|
|
4941
|
+
const x = get(g === "PROP" ? a : l, p, "");
|
|
4942
4942
|
if (isArray$1(x))
|
|
4943
4943
|
return "list";
|
|
4944
|
-
const
|
|
4945
|
-
return
|
|
4944
|
+
const m = typeof x;
|
|
4945
|
+
return m === "string" ? "text" : m === "object" ? "model" : m;
|
|
4946
4946
|
}
|
|
4947
4947
|
};
|
|
4948
4948
|
return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
|
|
@@ -4963,10 +4963,10 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4963
4963
|
] });
|
|
4964
4964
|
}, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
|
|
4965
4965
|
const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
|
|
4966
|
-
map(o, (x,
|
|
4966
|
+
map(o, (x, m) => ({ key: m, value: x }))
|
|
4967
4967
|
);
|
|
4968
4968
|
useEffect(() => {
|
|
4969
|
-
c(map(o, (x,
|
|
4969
|
+
c(map(o, (x, m) => ({ key: m, value: x })));
|
|
4970
4970
|
}, [r == null ? void 0 : r._id, o]);
|
|
4971
4971
|
const d = useMemo(() => {
|
|
4972
4972
|
if (isEmpty(a))
|
|
@@ -4976,21 +4976,21 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4976
4976
|
const x = last(i);
|
|
4977
4977
|
return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
|
|
4978
4978
|
}, [a, i]), u = (x) => {
|
|
4979
|
-
const
|
|
4980
|
-
c([...
|
|
4979
|
+
const m = filter(i, (E) => E.key !== x.key);
|
|
4980
|
+
c([...m, x]), g([...m, x]);
|
|
4981
4981
|
}, p = (x) => {
|
|
4982
|
-
const
|
|
4983
|
-
|
|
4984
|
-
},
|
|
4982
|
+
const m = filter(i, (E, f) => x !== f);
|
|
4983
|
+
g([...m]);
|
|
4984
|
+
}, g = useCallback(
|
|
4985
4985
|
(x = []) => {
|
|
4986
4986
|
if (c(x), isEmpty(x)) {
|
|
4987
4987
|
n({});
|
|
4988
4988
|
return;
|
|
4989
4989
|
}
|
|
4990
|
-
const
|
|
4990
|
+
const m = {};
|
|
4991
4991
|
forEach(x, (E) => {
|
|
4992
|
-
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(
|
|
4993
|
-
}), n(
|
|
4992
|
+
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(m, E.key, E.value);
|
|
4993
|
+
}), n(m);
|
|
4994
4994
|
},
|
|
4995
4995
|
[n]
|
|
4996
4996
|
);
|
|
@@ -4999,12 +4999,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4999
4999
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
5000
5000
|
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
5001
5001
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
5002
|
-
map(i, (x,
|
|
5002
|
+
map(i, (x, m) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5003
5003
|
NewDataBindingPair,
|
|
5004
5004
|
{
|
|
5005
5005
|
item: x,
|
|
5006
5006
|
onAddBinding: u,
|
|
5007
|
-
onRemove: () => p(
|
|
5007
|
+
onRemove: () => p(m),
|
|
5008
5008
|
selectedBlock: r,
|
|
5009
5009
|
dataProvider: a,
|
|
5010
5010
|
appliedBindings: map(i, "key")
|
|
@@ -5098,7 +5098,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5098
5098
|
}
|
|
5099
5099
|
)
|
|
5100
5100
|
] });
|
|
5101
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5101
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-LYK9w6rM.js")), UploadImages = React__default.lazy(() => import("./UploadImages-D5RhqXgu.js")), ImagesPanel = ({
|
|
5102
5102
|
isModalView: o = !1,
|
|
5103
5103
|
onSelect: n = () => {
|
|
5104
5104
|
}
|
|
@@ -5256,18 +5256,18 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5256
5256
|
] });
|
|
5257
5257
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5258
5258
|
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
|
|
5259
|
-
Object.keys(n).forEach((
|
|
5260
|
-
const x = n[
|
|
5259
|
+
Object.keys(n).forEach((g) => {
|
|
5260
|
+
const x = n[g];
|
|
5261
5261
|
if (includes(["slot", "styles"], x.type))
|
|
5262
5262
|
return;
|
|
5263
|
-
const
|
|
5264
|
-
c.properties[
|
|
5263
|
+
const m = g;
|
|
5264
|
+
c.properties[m] = getBlockJSONFromSchemas(x, u), d[m] = getBlockJSONFromUISchemas(x);
|
|
5265
5265
|
}), useEffect(() => {
|
|
5266
5266
|
i(r);
|
|
5267
5267
|
}, [o]);
|
|
5268
5268
|
const p = useThrottledCallback(
|
|
5269
|
-
async ({ formData:
|
|
5270
|
-
a({ formData:
|
|
5269
|
+
async ({ formData: g }, x) => {
|
|
5270
|
+
a({ formData: g }, x);
|
|
5271
5271
|
},
|
|
5272
5272
|
[a],
|
|
5273
5273
|
1e3
|
|
@@ -5293,8 +5293,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5293
5293
|
uiSchema: d,
|
|
5294
5294
|
schema: c,
|
|
5295
5295
|
formData: l,
|
|
5296
|
-
onChange: ({ formData:
|
|
5297
|
-
x && (i(
|
|
5296
|
+
onChange: ({ formData: g }, x) => {
|
|
5297
|
+
x && (i(g), p({ formData: g }, x));
|
|
5298
5298
|
}
|
|
5299
5299
|
}
|
|
5300
5300
|
);
|
|
@@ -5368,7 +5368,7 @@ function BlockSettings() {
|
|
|
5368
5368
|
u({ formData: f }, j, k), c(f);
|
|
5369
5369
|
}, 1500),
|
|
5370
5370
|
[o == null ? void 0 : o._id]
|
|
5371
|
-
),
|
|
5371
|
+
), g = ({ formData: f }, j) => {
|
|
5372
5372
|
if (j) {
|
|
5373
5373
|
const k = j.replace("root.", "");
|
|
5374
5374
|
n(
|
|
@@ -5376,7 +5376,7 @@ function BlockSettings() {
|
|
|
5376
5376
|
convertDotNotationToObject(k, get(f, k.split(".")))
|
|
5377
5377
|
), p({ formData: f }, j, { [k]: get(i, k) });
|
|
5378
5378
|
}
|
|
5379
|
-
}, x = keys(get(l, "_bindings", {})),
|
|
5379
|
+
}, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
|
|
5380
5380
|
const f = cloneDeep(get(a, "props", {}));
|
|
5381
5381
|
return each(f, (j, k) => {
|
|
5382
5382
|
get(j, "hidden", !1) && delete f[k];
|
|
@@ -5421,20 +5421,20 @@ function BlockSettings() {
|
|
|
5421
5421
|
JSONForm,
|
|
5422
5422
|
{
|
|
5423
5423
|
id: o == null ? void 0 : o._id,
|
|
5424
|
-
onChange:
|
|
5424
|
+
onChange: g,
|
|
5425
5425
|
formData: l,
|
|
5426
|
-
properties:
|
|
5426
|
+
properties: m
|
|
5427
5427
|
}
|
|
5428
5428
|
)
|
|
5429
5429
|
] })
|
|
5430
5430
|
] })
|
|
5431
|
-
] }) : isEmpty(
|
|
5431
|
+
] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5432
5432
|
JSONForm,
|
|
5433
5433
|
{
|
|
5434
5434
|
id: o == null ? void 0 : o._id,
|
|
5435
|
-
onChange:
|
|
5435
|
+
onChange: g,
|
|
5436
5436
|
formData: l,
|
|
5437
|
-
properties:
|
|
5437
|
+
properties: m
|
|
5438
5438
|
}
|
|
5439
5439
|
),
|
|
5440
5440
|
(o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
@@ -5456,20 +5456,20 @@ const getBlockWithChildren = (o, n) => {
|
|
|
5456
5456
|
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
|
|
5457
5457
|
return {
|
|
5458
5458
|
askAi: useCallback(
|
|
5459
|
-
async (u, p,
|
|
5459
|
+
async (u, p, g, x) => {
|
|
5460
5460
|
if (l) {
|
|
5461
5461
|
n(!0), a(null);
|
|
5462
5462
|
try {
|
|
5463
|
-
const
|
|
5464
|
-
set(
|
|
5465
|
-
const E = await l(u,
|
|
5463
|
+
const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
|
|
5464
|
+
set(m, "0._parent", null);
|
|
5465
|
+
const E = await l(u, g, m), { blocks: f, error: j } = E;
|
|
5466
5466
|
if (j) {
|
|
5467
5467
|
a(j);
|
|
5468
5468
|
return;
|
|
5469
5469
|
}
|
|
5470
5470
|
u === "styles" ? c(f) : i(f), x && x(E);
|
|
5471
|
-
} catch (
|
|
5472
|
-
a(
|
|
5471
|
+
} catch (m) {
|
|
5472
|
+
a(m);
|
|
5473
5473
|
} finally {
|
|
5474
5474
|
n(!1), x && x();
|
|
5475
5475
|
}
|
|
@@ -5543,14 +5543,14 @@ function Countdown() {
|
|
|
5543
5543
|
] });
|
|
5544
5544
|
}
|
|
5545
5545
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5546
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p,
|
|
5546
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
|
|
5547
5547
|
useEffect(() => {
|
|
5548
|
-
var
|
|
5549
|
-
(
|
|
5548
|
+
var m;
|
|
5549
|
+
(m = d.current) == null || m.focus();
|
|
5550
5550
|
}, []);
|
|
5551
|
-
const x = (
|
|
5552
|
-
const { usage: E } =
|
|
5553
|
-
!l && E &&
|
|
5551
|
+
const x = (m) => {
|
|
5552
|
+
const { usage: E } = m || {};
|
|
5553
|
+
!l && E && g(E), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
5554
5554
|
};
|
|
5555
5555
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5556
5556
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5559,12 +5559,12 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5559
5559
|
{
|
|
5560
5560
|
ref: d,
|
|
5561
5561
|
value: i,
|
|
5562
|
-
onChange: (
|
|
5562
|
+
onChange: (m) => c(m.target.value),
|
|
5563
5563
|
placeholder: n("ask_ai_to_edit_styles"),
|
|
5564
5564
|
className: "w-full border border-border focus:border-0",
|
|
5565
5565
|
rows: 3,
|
|
5566
|
-
onKeyDown: (
|
|
5567
|
-
|
|
5566
|
+
onKeyDown: (m) => {
|
|
5567
|
+
m.key === "Enter" && (m.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x));
|
|
5568
5568
|
}
|
|
5569
5569
|
}
|
|
5570
5570
|
),
|
|
@@ -5574,7 +5574,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5574
5574
|
{
|
|
5575
5575
|
disabled: i.trim().length < 5 || a,
|
|
5576
5576
|
onClick: () => {
|
|
5577
|
-
u.current && clearTimeout(u.current),
|
|
5577
|
+
u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x);
|
|
5578
5578
|
},
|
|
5579
5579
|
variant: "default",
|
|
5580
5580
|
className: "w-fit",
|
|
@@ -5611,7 +5611,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5611
5611
|
});
|
|
5612
5612
|
function ManualClasses() {
|
|
5613
5613
|
var w;
|
|
5614
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(),
|
|
5614
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
|
|
5615
5615
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5616
5616
|
a(i, N, !0), u("");
|
|
5617
5617
|
}, [E, f] = useState([]), j = ({ value: N }) => {
|
|
@@ -5636,7 +5636,7 @@ function ManualClasses() {
|
|
|
5636
5636
|
placeholder: o("enter_classes_separated_by_space"),
|
|
5637
5637
|
value: d,
|
|
5638
5638
|
onKeyDown: (N) => {
|
|
5639
|
-
N.key === "Enter" && d.trim() !== "" &&
|
|
5639
|
+
N.key === "Enter" && d.trim() !== "" && m();
|
|
5640
5640
|
},
|
|
5641
5641
|
onChange: (N, { newValue: D }) => u(D),
|
|
5642
5642
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -5700,7 +5700,7 @@ function ManualClasses() {
|
|
|
5700
5700
|
{
|
|
5701
5701
|
variant: "outline",
|
|
5702
5702
|
className: "h-6 border-border",
|
|
5703
|
-
onClick:
|
|
5703
|
+
onClick: m,
|
|
5704
5704
|
disabled: d.trim() === "",
|
|
5705
5705
|
size: "sm",
|
|
5706
5706
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -6114,7 +6114,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6114
6114
|
ringColor: "ring",
|
|
6115
6115
|
ringOffsetColor: "ring-offset"
|
|
6116
6116
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6117
|
-
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"),
|
|
6117
|
+
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), x = get(p, "2", ""), m = useCallback(
|
|
6118
6118
|
// eslint-disable-next-line no-shadow
|
|
6119
6119
|
(f) => {
|
|
6120
6120
|
["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((j) => ({ ...j, color: f, shade: j.shade ? j.shade : "500" })));
|
|
@@ -6122,16 +6122,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6122
6122
|
[c, u]
|
|
6123
6123
|
);
|
|
6124
6124
|
useEffect(() => {
|
|
6125
|
-
if (["current", "inherit", "transparent", "black", "white"].includes(
|
|
6125
|
+
if (["current", "inherit", "transparent", "black", "white"].includes(g))
|
|
6126
6126
|
return c([]);
|
|
6127
6127
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6128
|
-
}, [
|
|
6128
|
+
}, [g]);
|
|
6129
6129
|
const E = useCallback(
|
|
6130
6130
|
// eslint-disable-next-line no-shadow
|
|
6131
6131
|
(f) => {
|
|
6132
|
-
u({ color:
|
|
6132
|
+
u({ color: g, shade: f });
|
|
6133
6133
|
},
|
|
6134
|
-
[
|
|
6134
|
+
[g]
|
|
6135
6135
|
);
|
|
6136
6136
|
return useEffect(() => {
|
|
6137
6137
|
u({ color: "", shade: "" });
|
|
@@ -6144,8 +6144,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6144
6144
|
{
|
|
6145
6145
|
disabled: !l,
|
|
6146
6146
|
rounded: !0,
|
|
6147
|
-
selected:
|
|
6148
|
-
onChange:
|
|
6147
|
+
selected: g,
|
|
6148
|
+
onChange: m,
|
|
6149
6149
|
options: [
|
|
6150
6150
|
"current",
|
|
6151
6151
|
"transparent",
|
|
@@ -6178,7 +6178,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6178
6178
|
]
|
|
6179
6179
|
}
|
|
6180
6180
|
) }),
|
|
6181
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !
|
|
6181
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !g || !l, onChange: E, options: i }) })
|
|
6182
6182
|
] });
|
|
6183
6183
|
}, getUserInputValues = (o, n) => {
|
|
6184
6184
|
o = o.toLowerCase();
|
|
@@ -6373,14 +6373,14 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6373
6373
|
},
|
|
6374
6374
|
a
|
|
6375
6375
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6376
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative:
|
|
6376
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
|
|
6377
6377
|
useEffect(() => {
|
|
6378
6378
|
const { value: b, unit: _ } = getClassValueAndUnit(i);
|
|
6379
6379
|
if (_ === "") {
|
|
6380
|
-
l(b),
|
|
6380
|
+
l(b), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6381
6381
|
return;
|
|
6382
6382
|
}
|
|
6383
|
-
|
|
6383
|
+
m(_), l(_ === "class" || isEmpty(b) ? "" : b);
|
|
6384
6384
|
}, [i, u, p]);
|
|
6385
6385
|
const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6386
6386
|
(b = !1) => {
|
|
@@ -6480,7 +6480,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6480
6480
|
units: p,
|
|
6481
6481
|
current: x,
|
|
6482
6482
|
onSelect: (b) => {
|
|
6483
|
-
r(!1),
|
|
6483
|
+
r(!1), m(b), T(b);
|
|
6484
6484
|
}
|
|
6485
6485
|
}
|
|
6486
6486
|
) }) })
|
|
@@ -6505,7 +6505,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6505
6505
|
},
|
|
6506
6506
|
currentValue: a,
|
|
6507
6507
|
unit: x,
|
|
6508
|
-
negative:
|
|
6508
|
+
negative: g,
|
|
6509
6509
|
cssProperty: u
|
|
6510
6510
|
}
|
|
6511
6511
|
)
|
|
@@ -6598,17 +6598,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6598
6598
|
"2xl": "1536px"
|
|
6599
6599
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6600
6600
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6601
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [,
|
|
6601
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
|
|
6602
6602
|
(N, D = !0) => {
|
|
6603
|
-
const T = { dark: u, mq:
|
|
6603
|
+
const T = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
|
|
6604
6604
|
(u || p !== "") && (T.mq = "xs");
|
|
6605
6605
|
const b = generateFullClsName(T);
|
|
6606
|
-
|
|
6606
|
+
m(f, [b], D);
|
|
6607
6607
|
},
|
|
6608
|
-
[f, u,
|
|
6608
|
+
[f, u, g, p, l, m]
|
|
6609
6609
|
), A = useCallback(() => {
|
|
6610
6610
|
E(f, [j]);
|
|
6611
|
-
}, [f, j, E]), S = useMemo(() => canChangeClass(x,
|
|
6611
|
+
}, [f, j, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
|
|
6612
6612
|
useEffect(() => {
|
|
6613
6613
|
i(S, x);
|
|
6614
6614
|
}, [S, i, x]);
|
|
@@ -6624,7 +6624,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6624
6624
|
}[N]);
|
|
6625
6625
|
},
|
|
6626
6626
|
[B]
|
|
6627
|
-
), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) ===
|
|
6627
|
+
), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
|
|
6628
6628
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6629
6629
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6630
6630
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
@@ -6686,7 +6686,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6686
6686
|
units: i = basicUnits,
|
|
6687
6687
|
negative: c = !1
|
|
6688
6688
|
}) => {
|
|
6689
|
-
const { t: d } = useTranslation(), [u, p] = useState(n[0].key),
|
|
6689
|
+
const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), x = useCallback((m) => map(g, "property").includes(m), [g]);
|
|
6690
6690
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6691
6691
|
"div",
|
|
6692
6692
|
{
|
|
@@ -6695,7 +6695,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6695
6695
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6696
6696
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6697
6697
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6698
|
-
n.map(({ label:
|
|
6698
|
+
n.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6699
6699
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6700
6700
|
"button",
|
|
6701
6701
|
{
|
|
@@ -6710,7 +6710,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6710
6710
|
]
|
|
6711
6711
|
}
|
|
6712
6712
|
) }),
|
|
6713
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(
|
|
6713
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
|
|
6714
6714
|
] }) }))
|
|
6715
6715
|
) })
|
|
6716
6716
|
] }),
|
|
@@ -6775,8 +6775,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6775
6775
|
if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
|
|
6776
6776
|
return null;
|
|
6777
6777
|
const u = (p) => {
|
|
6778
|
-
const
|
|
6779
|
-
l([o._id],
|
|
6778
|
+
const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6779
|
+
l([o._id], g, !0);
|
|
6780
6780
|
};
|
|
6781
6781
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
6782
6782
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
|
|
@@ -6830,13 +6830,13 @@ function BlockStyling() {
|
|
|
6830
6830
|
cssProperty: ""
|
|
6831
6831
|
}), d = useThrottledCallback(
|
|
6832
6832
|
(p) => {
|
|
6833
|
-
const
|
|
6834
|
-
let
|
|
6835
|
-
|
|
6833
|
+
const g = !get(i, "negative", !1), x = get(i, "cssProperty", "");
|
|
6834
|
+
let m = parseFloat(i.dragStartValue);
|
|
6835
|
+
m = isNaN(m) ? 0 : m;
|
|
6836
6836
|
let E = MAPPER[i.dragUnit];
|
|
6837
6837
|
(startsWith(x, "scale") || x === "opacity") && (E = 10);
|
|
6838
|
-
let j = (i.dragStartY - p.pageY) / E +
|
|
6839
|
-
|
|
6838
|
+
let j = (i.dragStartY - p.pageY) / E + m;
|
|
6839
|
+
g && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
|
|
6840
6840
|
},
|
|
6841
6841
|
[i],
|
|
6842
6842
|
50
|
|
@@ -6922,7 +6922,7 @@ const BlockCard = ({
|
|
|
6922
6922
|
library: n,
|
|
6923
6923
|
parentId: r = void 0
|
|
6924
6924
|
}) => {
|
|
6925
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(),
|
|
6925
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (k) => {
|
|
6926
6926
|
const A = has(k, "styles_attrs.data-page-section");
|
|
6927
6927
|
return k._type === "Box" && A;
|
|
6928
6928
|
}, f = useCallback(
|
|
@@ -6948,7 +6948,7 @@ const BlockCard = ({
|
|
|
6948
6948
|
};
|
|
6949
6949
|
} else
|
|
6950
6950
|
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6951
|
-
|
|
6951
|
+
m(B), setTimeout(() => {
|
|
6952
6952
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6953
6953
|
}, 200);
|
|
6954
6954
|
}
|
|
@@ -6969,11 +6969,11 @@ const BlockCard = ({
|
|
|
6969
6969
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
|
|
6970
6970
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
6971
6971
|
] }),
|
|
6972
|
-
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt:
|
|
6972
|
+
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: g }) })
|
|
6973
6973
|
]
|
|
6974
6974
|
}
|
|
6975
6975
|
) }),
|
|
6976
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
6976
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
|
|
6977
6977
|
] });
|
|
6978
6978
|
}, libraryBlocksAtom = atom$1(
|
|
6979
6979
|
{}
|
|
@@ -6989,7 +6989,7 @@ const BlockCard = ({
|
|
|
6989
6989
|
})();
|
|
6990
6990
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
6991
6991
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
6992
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [
|
|
6992
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
|
|
6993
6993
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
6994
6994
|
E.current && x(S);
|
|
6995
6995
|
}, 300);
|
|
@@ -6999,7 +6999,7 @@ const BlockCard = ({
|
|
|
6999
6999
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7000
7000
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7001
7001
|
] });
|
|
7002
|
-
const k = filter(
|
|
7002
|
+
const k = filter(m, (S, B) => B % 2 === 0), A = filter(m, (S, B) => B % 2 === 1);
|
|
7003
7003
|
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: [
|
|
7004
7004
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7005
7005
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
@@ -7015,7 +7015,7 @@ const BlockCard = ({
|
|
|
7015
7015
|
onClick: () => x(B),
|
|
7016
7016
|
className: cn(
|
|
7017
7017
|
"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",
|
|
7018
|
-
B ===
|
|
7018
|
+
B === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7019
7019
|
),
|
|
7020
7020
|
children: [
|
|
7021
7021
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
|
|
@@ -7483,14 +7483,14 @@ i18n.use(initReactI18next).init({
|
|
|
7483
7483
|
}
|
|
7484
7484
|
});
|
|
7485
7485
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7486
|
-
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [,
|
|
7487
|
-
if (
|
|
7486
|
+
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
|
|
7487
|
+
if (has(o, "blocks")) {
|
|
7488
7488
|
const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7489
7489
|
u(syncBlocksWithDefaults(f), r || null);
|
|
7490
7490
|
} else
|
|
7491
7491
|
d(o, r || null);
|
|
7492
7492
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7493
|
-
},
|
|
7493
|
+
}, m = useFeature("dnd"), { t: E } = useTranslation();
|
|
7494
7494
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7495
7495
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7496
7496
|
"button",
|
|
@@ -7500,10 +7500,10 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7500
7500
|
type: "button",
|
|
7501
7501
|
onDragStart: (f) => {
|
|
7502
7502
|
f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7503
|
-
p([]),
|
|
7503
|
+
p([]), g(null);
|
|
7504
7504
|
}, 200);
|
|
7505
7505
|
},
|
|
7506
|
-
draggable:
|
|
7506
|
+
draggable: m ? "true" : "false",
|
|
7507
7507
|
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
|
|
7508
7508
|
children: [
|
|
7509
7509
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
@@ -7672,14 +7672,14 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7672
7672
|
) }) });
|
|
7673
7673
|
}
|
|
7674
7674
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7675
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p,
|
|
7675
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
|
|
7676
7676
|
useEffect(() => {
|
|
7677
7677
|
var f;
|
|
7678
7678
|
(f = x.current) == null || f.focus();
|
|
7679
7679
|
}, []);
|
|
7680
7680
|
const E = (f) => {
|
|
7681
7681
|
const { usage: j } = f || {};
|
|
7682
|
-
!l && j &&
|
|
7682
|
+
!l && j && g(j), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
7683
7683
|
};
|
|
7684
7684
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7685
7685
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7704,7 +7704,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7704
7704
|
className: "w-full",
|
|
7705
7705
|
rows: 3,
|
|
7706
7706
|
onKeyDown: (f) => {
|
|
7707
|
-
f.key === "Enter" && (f.preventDefault(),
|
|
7707
|
+
f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
|
|
7708
7708
|
}
|
|
7709
7709
|
}
|
|
7710
7710
|
),
|
|
@@ -7714,7 +7714,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7714
7714
|
{
|
|
7715
7715
|
disabled: i.trim().length < 5 || a,
|
|
7716
7716
|
onClick: () => {
|
|
7717
|
-
|
|
7717
|
+
m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E);
|
|
7718
7718
|
},
|
|
7719
7719
|
variant: "default",
|
|
7720
7720
|
className: "w-fit",
|
|
@@ -7747,7 +7747,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7747
7747
|
QuickPrompts,
|
|
7748
7748
|
{
|
|
7749
7749
|
onClick: (f) => {
|
|
7750
|
-
|
|
7750
|
+
m.current && clearTimeout(m.current), g(void 0), r("content", o, f, E);
|
|
7751
7751
|
}
|
|
7752
7752
|
}
|
|
7753
7753
|
)
|
|
@@ -7757,7 +7757,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7757
7757
|
] }) }) : null
|
|
7758
7758
|
] });
|
|
7759
7759
|
}, AISetContext = () => {
|
|
7760
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [,
|
|
7760
|
+
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, g] = useState(!1), { toast: x } = useToast(), m = useRef(null);
|
|
7761
7761
|
useEffect(() => {
|
|
7762
7762
|
n && a(n);
|
|
7763
7763
|
}, [n]);
|
|
@@ -7767,7 +7767,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7767
7767
|
title: o("Updated AI Context"),
|
|
7768
7768
|
description: o("You can now Ask AI to edit your content"),
|
|
7769
7769
|
variant: "default"
|
|
7770
|
-
}),
|
|
7770
|
+
}), m.current.click();
|
|
7771
7771
|
} catch (f) {
|
|
7772
7772
|
p(f);
|
|
7773
7773
|
} finally {
|
|
@@ -7778,12 +7778,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7778
7778
|
Accordion,
|
|
7779
7779
|
{
|
|
7780
7780
|
onValueChange: (f) => {
|
|
7781
|
-
|
|
7781
|
+
g(f !== "");
|
|
7782
7782
|
},
|
|
7783
7783
|
type: "single",
|
|
7784
7784
|
collapsible: !0,
|
|
7785
7785
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
7786
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref:
|
|
7786
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
|
|
7787
7787
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
7788
7788
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7789
7789
|
Textarea,
|
|
@@ -7857,32 +7857,32 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7857
7857
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7858
7858
|
] });
|
|
7859
7859
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7860
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p,
|
|
7860
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), f = useRef(null);
|
|
7861
7861
|
useEffect(() => {
|
|
7862
7862
|
l(n);
|
|
7863
7863
|
}, [n]);
|
|
7864
7864
|
const j = () => {
|
|
7865
7865
|
if (i.startsWith("@")) {
|
|
7866
|
-
|
|
7866
|
+
m("Attribute keys cannot start with '@'");
|
|
7867
7867
|
return;
|
|
7868
7868
|
}
|
|
7869
7869
|
if (i) {
|
|
7870
7870
|
const C = [...a, { key: i, value: d }];
|
|
7871
|
-
r(C), l(a), c(""), u(""),
|
|
7871
|
+
r(C), l(a), c(""), u(""), m("");
|
|
7872
7872
|
}
|
|
7873
7873
|
}, k = (C) => {
|
|
7874
7874
|
const w = a.filter((N, D) => D !== C);
|
|
7875
7875
|
r(w), l(w);
|
|
7876
7876
|
}, A = (C) => {
|
|
7877
|
-
|
|
7877
|
+
g(C), c(a[C].key), u(a[C].value);
|
|
7878
7878
|
}, S = () => {
|
|
7879
7879
|
if (i.startsWith("@")) {
|
|
7880
|
-
|
|
7880
|
+
m("Attribute keys cannot start with '@'");
|
|
7881
7881
|
return;
|
|
7882
7882
|
}
|
|
7883
7883
|
if (p !== null && i) {
|
|
7884
7884
|
const C = [...a];
|
|
7885
|
-
C[p] = { key: i, value: d }, r(C), l(C),
|
|
7885
|
+
C[p] = { key: i, value: d }, r(C), l(C), g(null), c(""), u(""), m("");
|
|
7886
7886
|
}
|
|
7887
7887
|
}, B = (C) => {
|
|
7888
7888
|
C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
|
|
@@ -8372,15 +8372,15 @@ function RemoveProviderConfirmation({
|
|
|
8372
8372
|
const PageDataProviders = () => {
|
|
8373
8373
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8374
8374
|
filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
|
|
8375
|
-
), [d, u] = useState(""), [p,
|
|
8375
|
+
), [d, u] = useState(""), [p, g] = useState(null), x = filter(
|
|
8376
8376
|
n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
|
|
8377
8377
|
(j) => !isNull(j)
|
|
8378
|
-
),
|
|
8378
|
+
), m = (j) => {
|
|
8379
8379
|
const k = find(n, { providerKey: j });
|
|
8380
8380
|
c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8381
8381
|
}, E = (j) => {
|
|
8382
8382
|
c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
|
|
8383
|
-
}, f = (j) =>
|
|
8383
|
+
}, f = (j) => g(j);
|
|
8384
8384
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8385
8385
|
o("no_data_providers"),
|
|
8386
8386
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8388,7 +8388,7 @@ const PageDataProviders = () => {
|
|
|
8388
8388
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8389
8389
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8390
8390
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8391
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) =>
|
|
8391
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => m(j), children: [
|
|
8392
8392
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8393
8393
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8394
8394
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
@@ -8469,14 +8469,14 @@ const PageDataProviders = () => {
|
|
|
8469
8469
|
},
|
|
8470
8470
|
j.providerKey
|
|
8471
8471
|
)) }),
|
|
8472
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () =>
|
|
8472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
|
|
8473
8473
|
] })
|
|
8474
8474
|
] });
|
|
8475
8475
|
};
|
|
8476
8476
|
function AiFillDatabase(o) {
|
|
8477
8477
|
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);
|
|
8478
8478
|
}
|
|
8479
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8479
|
+
const TopBar = lazy(() => import("./Topbar-ULSrUjT1.js"));
|
|
8480
8480
|
function useSidebarMenuItems(o) {
|
|
8481
8481
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8482
8482
|
return useMemo(() => {
|
|
@@ -8503,14 +8503,14 @@ function isDualLayout(o) {
|
|
|
8503
8503
|
}
|
|
8504
8504
|
const RootLayout = () => {
|
|
8505
8505
|
const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
|
|
8506
|
-
useChaiBuilderMsgListener(({ name:
|
|
8507
|
-
|
|
8506
|
+
useChaiBuilderMsgListener(({ name: m }) => {
|
|
8507
|
+
m === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
|
|
8508
8508
|
});
|
|
8509
|
-
const i = useBuilderProp("sideBarComponents.top", []), c = (
|
|
8510
|
-
|
|
8511
|
-
}, d = (
|
|
8512
|
-
n(o ===
|
|
8513
|
-
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(),
|
|
8509
|
+
const i = useBuilderProp("sideBarComponents.top", []), c = (m) => {
|
|
8510
|
+
m.preventDefault();
|
|
8511
|
+
}, d = (m) => {
|
|
8512
|
+
n(o === m ? null : m);
|
|
8513
|
+
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
|
|
8514
8514
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8515
8515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8516
8516
|
"div",
|
|
@@ -8521,18 +8521,18 @@ const RootLayout = () => {
|
|
|
8521
8521
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
|
|
8522
8522
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8523
8523
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8524
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children:
|
|
8524
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8525
8525
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8526
8526
|
Button,
|
|
8527
8527
|
{
|
|
8528
8528
|
variant: o === E ? "default" : "ghost",
|
|
8529
8529
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8530
8530
|
onClick: () => d(E),
|
|
8531
|
-
children: get(
|
|
8531
|
+
children: get(m, "icon", null)
|
|
8532
8532
|
},
|
|
8533
8533
|
E
|
|
8534
8534
|
) }),
|
|
8535
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(
|
|
8535
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(m.label) }) })
|
|
8536
8536
|
] }, "button" + E)) }),
|
|
8537
8537
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
8538
8538
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
@@ -8551,10 +8551,10 @@ const RootLayout = () => {
|
|
|
8551
8551
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8552
8552
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
|
|
8553
8553
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8554
|
-
get(
|
|
8555
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(
|
|
8554
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
|
|
8555
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
|
|
8556
8556
|
] }),
|
|
8557
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
8557
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(g, `${o}.component`, null), {}) }) })
|
|
8558
8558
|
] }) })
|
|
8559
8559
|
}
|
|
8560
8560
|
),
|
|
@@ -8571,7 +8571,7 @@ const RootLayout = () => {
|
|
|
8571
8571
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8572
8572
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-col p-3", children: [
|
|
8573
8573
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8574
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16" }),
|
|
8574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
|
|
8575
8575
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
|
|
8576
8576
|
] }),
|
|
8577
8577
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
|