@chaibuilder/sdk 2.0.0-beta.60 → 2.0.0-beta.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +3 -3
- package/dist/core.js +298 -310
- package/dist/getSplitClasses-DodqA_KW.cjs +1 -0
- package/dist/getSplitClasses-DphwgQiE.js +48 -0
- package/dist/render.cjs +2 -2
- package/dist/render.js +66 -66
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +4 -2
- package/package.json +1 -1
- package/dist/STRINGS-DtEft2kY.js +0 -5
- package/dist/STRINGS-n7COZtKr.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, Component, Children, useMemo, useState, useRef, Suspense, memo, createElement, lazy } from "react";
|
|
7
7
|
import { ag as useToast, S as Skeleton, B as Button, L as Label, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, T as Textarea, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, C as Card, x as CardHeader, E as CardDescription, F as CardContent, y as CardFooter, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, j as AlertDialog, k as AlertDialogTrigger, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, b as Switch, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-FCyNTUkl.js";
|
|
8
8
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
9
|
-
import { has, get, find, filter, flatten, map, omit, isString, includes, without, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, memoize, forEach, unset, chunk, cloneDeep, pick, throttle, reverse, startCase, debounce, capitalize, split, findIndex,
|
|
9
|
+
import { has, get, find, filter, flatten, map, omit, isString, includes, without, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, memoize, forEach, unset, chunk, cloneDeep, pick, throttle, reverse, startCase, debounce, capitalize, split, findIndex, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, isFunction as isFunction$1, flatMapDeep, some, groupBy, uniq, sortBy, reject, toUpper, round } from "lodash-es";
|
|
10
10
|
import { Provider } from "react-wrap-balancer";
|
|
11
11
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-DHfFLkem.js";
|
|
12
12
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
@@ -28,7 +28,7 @@ import forms from "@tailwindcss/forms";
|
|
|
28
28
|
import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
29
29
|
import containerQueries from "@tailwindcss/container-queries";
|
|
30
30
|
import { twMerge } from "tailwind-merge";
|
|
31
|
-
import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./
|
|
31
|
+
import { S as STYLES_KEY, g as getSplitChaiClasses, R as ROOT_TEMP_KEY } from "./getSplitClasses-DphwgQiE.js";
|
|
32
32
|
import ReactDOM from "react-dom";
|
|
33
33
|
import { ErrorBoundary } from "react-error-boundary";
|
|
34
34
|
import { Resizable } from "re-resizable";
|
|
@@ -107,25 +107,25 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
107
107
|
return A || (A = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, r(B, A), i == null || i(B, I)), A;
|
|
108
108
|
}, p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set(), m = () => {
|
|
109
109
|
var B;
|
|
110
|
-
const A = [], N = (
|
|
110
|
+
const A = [], N = (L) => {
|
|
111
111
|
try {
|
|
112
|
-
|
|
112
|
+
L();
|
|
113
113
|
} catch (S) {
|
|
114
114
|
A.push(S);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
do {
|
|
118
118
|
(B = I[INTERNAL_flushStoreHook]) == null || B.call(I);
|
|
119
|
-
const
|
|
120
|
-
u.forEach((
|
|
119
|
+
const L = /* @__PURE__ */ new Set(), S = L.add.bind(L);
|
|
120
|
+
u.forEach((T) => {
|
|
121
121
|
var D;
|
|
122
|
-
return (D =
|
|
123
|
-
}), u.clear(), x.forEach(S), x.clear(), g.forEach(S), g.clear(),
|
|
122
|
+
return (D = T.m) == null ? void 0 : D.l.forEach(S);
|
|
123
|
+
}), u.clear(), x.forEach(S), x.clear(), g.forEach(S), g.clear(), L.forEach(N), u.size && C();
|
|
124
124
|
} while (u.size || x.size || g.size);
|
|
125
125
|
if (A.length)
|
|
126
126
|
throw A[0];
|
|
127
127
|
}, f = (B, A, N) => {
|
|
128
|
-
const
|
|
128
|
+
const L = "v" in A, S = A.v, T = isPendingPromise(A.v) ? A.v : null;
|
|
129
129
|
if (isPromiseLike$2(N)) {
|
|
130
130
|
patchPromiseForCancelability(N);
|
|
131
131
|
for (const D of A.d.keys())
|
|
@@ -133,7 +133,7 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
133
133
|
A.v = N;
|
|
134
134
|
} else
|
|
135
135
|
A.v = N;
|
|
136
|
-
delete A.e, (!
|
|
136
|
+
delete A.e, (!L || !Object.is(S, A.v)) && (++A.n, T && cancelPromise(T, N));
|
|
137
137
|
}, h = (B) => {
|
|
138
138
|
var A;
|
|
139
139
|
const N = d(B);
|
|
@@ -146,10 +146,10 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
146
146
|
)))
|
|
147
147
|
return N;
|
|
148
148
|
N.d.clear();
|
|
149
|
-
let
|
|
149
|
+
let L = !0;
|
|
150
150
|
const S = () => {
|
|
151
|
-
N.m && (k(B, N),
|
|
152
|
-
},
|
|
151
|
+
N.m && (k(B, N), C(), m());
|
|
152
|
+
}, T = (M) => {
|
|
153
153
|
if (isSelfAtom(B, M)) {
|
|
154
154
|
const U = d(M);
|
|
155
155
|
if (!isAtomStateInitialized(U))
|
|
@@ -163,7 +163,7 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
163
163
|
try {
|
|
164
164
|
return returnAtomValue(H);
|
|
165
165
|
} finally {
|
|
166
|
-
addDependency(B, N, M, H),
|
|
166
|
+
addDependency(B, N, M, H), L || S();
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
let D, $;
|
|
@@ -173,58 +173,58 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
173
173
|
},
|
|
174
174
|
get setSelf() {
|
|
175
175
|
return !$ && isActuallyWritableAtom(B) && ($ = (...M) => {
|
|
176
|
-
if (!
|
|
176
|
+
if (!L)
|
|
177
177
|
return E(B, ...M);
|
|
178
178
|
}), $;
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
try {
|
|
182
|
-
const M = a(B,
|
|
182
|
+
const M = a(B, T, O);
|
|
183
183
|
return f(B, N, M), isPromiseLike$2(M) && ((A = M.onCancel) == null || A.call(M, () => D == null ? void 0 : D.abort()), M.then(S, S)), N;
|
|
184
184
|
} catch (M) {
|
|
185
185
|
return delete N.v, N.e = M, ++N.n, N;
|
|
186
186
|
} finally {
|
|
187
|
-
|
|
187
|
+
L = !1;
|
|
188
188
|
}
|
|
189
189
|
}, b = (B) => returnAtomValue(h(B)), y = (B) => {
|
|
190
190
|
var A;
|
|
191
191
|
const N = /* @__PURE__ */ new Map();
|
|
192
|
-
for (const
|
|
193
|
-
const S = d(
|
|
194
|
-
S.m && N.set(
|
|
192
|
+
for (const L of ((A = B.m) == null ? void 0 : A.t) || []) {
|
|
193
|
+
const S = d(L);
|
|
194
|
+
S.m && N.set(L, S);
|
|
195
195
|
}
|
|
196
|
-
for (const
|
|
196
|
+
for (const L of B.p)
|
|
197
197
|
N.set(
|
|
198
|
-
|
|
199
|
-
d(
|
|
198
|
+
L,
|
|
199
|
+
d(L)
|
|
200
200
|
);
|
|
201
201
|
return N;
|
|
202
202
|
}, R = (B) => {
|
|
203
203
|
const A = [B];
|
|
204
204
|
for (; A.length; ) {
|
|
205
205
|
const N = A.pop();
|
|
206
|
-
for (const [
|
|
207
|
-
p.has(
|
|
206
|
+
for (const [L, S] of y(N))
|
|
207
|
+
p.has(L) || (p.set(L, S.n), A.push(S));
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, C = () => {
|
|
210
210
|
var B;
|
|
211
|
-
const A = [], N = /* @__PURE__ */ new WeakSet(),
|
|
211
|
+
const A = [], N = /* @__PURE__ */ new WeakSet(), L = /* @__PURE__ */ new WeakSet(), S = Array.from(u);
|
|
212
212
|
for (; S.length; ) {
|
|
213
|
-
const [
|
|
214
|
-
if (
|
|
213
|
+
const [T, D] = S[S.length - 1];
|
|
214
|
+
if (L.has(T)) {
|
|
215
215
|
S.pop();
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
if (N.has(
|
|
219
|
-
p.get(
|
|
218
|
+
if (N.has(T)) {
|
|
219
|
+
p.get(T) === D.n ? A.push([T, D, D.n]) : (p.delete(T), u.set(T, D)), L.add(T), S.pop();
|
|
220
220
|
continue;
|
|
221
221
|
}
|
|
222
|
-
N.add(
|
|
222
|
+
N.add(T);
|
|
223
223
|
for (const [$, O] of y(D))
|
|
224
224
|
N.has($) || S.push([$, O]);
|
|
225
225
|
}
|
|
226
|
-
for (let
|
|
227
|
-
const [D, $, O] = A[
|
|
226
|
+
for (let T = A.length - 1; T >= 0; --T) {
|
|
227
|
+
const [D, $, O] = A[T];
|
|
228
228
|
let M = !1;
|
|
229
229
|
for (const H of $.d.keys())
|
|
230
230
|
if (H !== D && u.has(H)) {
|
|
@@ -235,24 +235,24 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
235
235
|
}
|
|
236
236
|
}, j = (B, ...A) => {
|
|
237
237
|
let N = !0;
|
|
238
|
-
const
|
|
238
|
+
const L = (T) => returnAtomValue(h(T)), S = (T, ...D) => {
|
|
239
239
|
var $;
|
|
240
|
-
const O = d(
|
|
240
|
+
const O = d(T);
|
|
241
241
|
try {
|
|
242
|
-
if (isSelfAtom(B,
|
|
243
|
-
if (!hasInitialValue(
|
|
242
|
+
if (isSelfAtom(B, T)) {
|
|
243
|
+
if (!hasInitialValue(T))
|
|
244
244
|
throw new Error("atom not writable");
|
|
245
245
|
const M = O.n, H = D[0];
|
|
246
|
-
f(
|
|
246
|
+
f(T, O, H), k(T, O), M !== O.n && (u.set(T, O), ($ = O.u) == null || $.call(O), R(O));
|
|
247
247
|
return;
|
|
248
248
|
} else
|
|
249
|
-
return j(
|
|
249
|
+
return j(T, ...D);
|
|
250
250
|
} finally {
|
|
251
|
-
N || (
|
|
251
|
+
N || (C(), m());
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
try {
|
|
255
|
-
return l(B,
|
|
255
|
+
return l(B, L, S, ...A);
|
|
256
256
|
} finally {
|
|
257
257
|
N = !1;
|
|
258
258
|
}
|
|
@@ -260,55 +260,55 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
260
260
|
try {
|
|
261
261
|
return j(B, ...A);
|
|
262
262
|
} finally {
|
|
263
|
-
|
|
263
|
+
C(), m();
|
|
264
264
|
}
|
|
265
265
|
}, k = (B, A) => {
|
|
266
266
|
var N;
|
|
267
267
|
if (A.m && !isPendingPromise(A.v)) {
|
|
268
|
-
for (const [
|
|
269
|
-
if (!A.m.d.has(
|
|
270
|
-
const
|
|
271
|
-
|
|
268
|
+
for (const [L, S] of A.d)
|
|
269
|
+
if (!A.m.d.has(L)) {
|
|
270
|
+
const T = d(L);
|
|
271
|
+
w(L, T).t.add(B), A.m.d.add(L), S !== T.n && (u.set(L, T), (N = T.u) == null || N.call(T), R(T));
|
|
272
272
|
}
|
|
273
|
-
for (const
|
|
274
|
-
if (!A.d.has(
|
|
275
|
-
A.m.d.delete(
|
|
276
|
-
const S = _(
|
|
273
|
+
for (const L of A.m.d || [])
|
|
274
|
+
if (!A.d.has(L)) {
|
|
275
|
+
A.m.d.delete(L);
|
|
276
|
+
const S = _(L, d(L));
|
|
277
277
|
S == null || S.t.delete(B);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, w = (B, A) => {
|
|
281
281
|
var N;
|
|
282
282
|
if (!A.m) {
|
|
283
283
|
h(B);
|
|
284
|
-
for (const
|
|
285
|
-
|
|
284
|
+
for (const L of A.d.keys())
|
|
285
|
+
w(L, d(L)).t.add(B);
|
|
286
286
|
if (A.m = {
|
|
287
287
|
l: /* @__PURE__ */ new Set(),
|
|
288
288
|
d: new Set(A.d.keys()),
|
|
289
289
|
t: /* @__PURE__ */ new Set()
|
|
290
290
|
}, (N = A.h) == null || N.call(A), isActuallyWritableAtom(B)) {
|
|
291
|
-
const
|
|
292
|
-
let
|
|
291
|
+
const L = A.m, S = () => {
|
|
292
|
+
let T = !0;
|
|
293
293
|
const D = (...$) => {
|
|
294
294
|
try {
|
|
295
295
|
return j(B, ...$);
|
|
296
296
|
} finally {
|
|
297
|
-
|
|
297
|
+
T || (C(), m());
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
try {
|
|
301
301
|
const $ = c(B, D);
|
|
302
|
-
$ && (
|
|
303
|
-
|
|
302
|
+
$ && (L.u = () => {
|
|
303
|
+
T = !0;
|
|
304
304
|
try {
|
|
305
305
|
$();
|
|
306
306
|
} finally {
|
|
307
|
-
|
|
307
|
+
T = !1;
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
} finally {
|
|
311
|
-
|
|
311
|
+
T = !1;
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
g.add(S);
|
|
@@ -317,15 +317,15 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
317
317
|
return A.m;
|
|
318
318
|
}, _ = (B, A) => {
|
|
319
319
|
var N;
|
|
320
|
-
if (A.m && !A.m.l.size && !Array.from(A.m.t).some((
|
|
320
|
+
if (A.m && !A.m.l.size && !Array.from(A.m.t).some((L) => {
|
|
321
321
|
var S;
|
|
322
|
-
return (S = d(
|
|
322
|
+
return (S = d(L).m) == null ? void 0 : S.d.has(B);
|
|
323
323
|
})) {
|
|
324
|
-
const
|
|
325
|
-
|
|
324
|
+
const L = A.m.u;
|
|
325
|
+
L && x.add(L), delete A.m, (N = A.h) == null || N.call(A);
|
|
326
326
|
for (const S of A.d.keys()) {
|
|
327
|
-
const
|
|
328
|
-
|
|
327
|
+
const T = _(S, d(S));
|
|
328
|
+
T == null || T.t.delete(B);
|
|
329
329
|
}
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
@@ -334,7 +334,7 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
334
334
|
get: b,
|
|
335
335
|
set: E,
|
|
336
336
|
sub: (B, A) => {
|
|
337
|
-
const N = d(B), S =
|
|
337
|
+
const N = d(B), S = w(B, N).l;
|
|
338
338
|
return S.add(A), m(), () => {
|
|
339
339
|
S.delete(A), _(B, N), m();
|
|
340
340
|
};
|
|
@@ -382,24 +382,24 @@ function splitAtom(o, n) {
|
|
|
382
382
|
x[f] = b;
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
|
-
const y = (
|
|
386
|
-
const j =
|
|
387
|
-
if (
|
|
385
|
+
const y = (C) => {
|
|
386
|
+
const j = C(l), E = C(o), w = a(E, j == null ? void 0 : j.arr).keyList.indexOf(h);
|
|
387
|
+
if (w < 0 || w >= E.length) {
|
|
388
388
|
const _ = c[a(c).keyList.indexOf(h)];
|
|
389
389
|
if (_)
|
|
390
390
|
return _;
|
|
391
391
|
throw new Error("splitAtom: index out of bounds for read");
|
|
392
392
|
}
|
|
393
|
-
return E[
|
|
394
|
-
}, R = (
|
|
395
|
-
const k =
|
|
396
|
-
if (P < 0 || P >=
|
|
393
|
+
return E[w];
|
|
394
|
+
}, R = (C, j, E) => {
|
|
395
|
+
const k = C(l), w = C(o), P = a(w, k == null ? void 0 : k.arr).keyList.indexOf(h);
|
|
396
|
+
if (P < 0 || P >= w.length)
|
|
397
397
|
throw new Error("splitAtom: index out of bounds for write");
|
|
398
|
-
const v = isFunction(E) ? E(
|
|
399
|
-
Object.is(
|
|
400
|
-
...
|
|
398
|
+
const v = isFunction(E) ? E(w[P]) : E;
|
|
399
|
+
Object.is(w[P], v) || j(o, [
|
|
400
|
+
...w.slice(0, P),
|
|
401
401
|
v,
|
|
402
|
-
...
|
|
402
|
+
...w.slice(P + 1)
|
|
403
403
|
]);
|
|
404
404
|
};
|
|
405
405
|
x[f] = isWritable(o) ? atom(y, R) : atom(y);
|
|
@@ -1309,8 +1309,8 @@ const useBlocksStoreManager = () => {
|
|
|
1309
1309
|
const R = map(h, (j) => {
|
|
1310
1310
|
const k = n.find((P) => P._id === j)._parent || null, _ = n.filter((P) => k ? P._parent === k : !P._parent).map((P) => P._id).indexOf(j);
|
|
1311
1311
|
return { _id: j, oldParent: k, oldPosition: _ };
|
|
1312
|
-
}),
|
|
1313
|
-
|
|
1312
|
+
}), C = R.find(({ _id: j }) => j === h[0]);
|
|
1313
|
+
C && C.oldParent === b && C.oldPosition === y || (i(h, b, y), o({
|
|
1314
1314
|
undo: () => each(R, ({ _id: j, oldParent: E, oldPosition: k }) => {
|
|
1315
1315
|
i([j], E, k);
|
|
1316
1316
|
}),
|
|
@@ -1324,8 +1324,8 @@ const useBlocksStoreManager = () => {
|
|
|
1324
1324
|
});
|
|
1325
1325
|
},
|
|
1326
1326
|
removeBlocks: (h) => {
|
|
1327
|
-
var
|
|
1328
|
-
const b = (
|
|
1327
|
+
var C;
|
|
1328
|
+
const b = (C = first(h)) == null ? void 0 : C._parent, R = n.filter((j) => b ? j._parent === b : !j._parent).indexOf(first(h));
|
|
1329
1329
|
l(map(h, "_id")), o({
|
|
1330
1330
|
undo: () => a(h, b, R),
|
|
1331
1331
|
redo: () => l(map(h, "_id"))
|
|
@@ -1334,17 +1334,17 @@ const useBlocksStoreManager = () => {
|
|
|
1334
1334
|
updateBlocks: (h, b, y) => {
|
|
1335
1335
|
let R = [];
|
|
1336
1336
|
if (y)
|
|
1337
|
-
R = map(h, (
|
|
1337
|
+
R = map(h, (C) => ({ _id: C, ...y }));
|
|
1338
1338
|
else {
|
|
1339
|
-
const
|
|
1339
|
+
const C = keys(b);
|
|
1340
1340
|
R = map(h, (j) => {
|
|
1341
|
-
const E = n.find((
|
|
1342
|
-
return each(
|
|
1341
|
+
const E = n.find((w) => w._id === j), k = { _id: j };
|
|
1342
|
+
return each(C, (w) => k[w] = E[w]), k;
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
|
-
c(map(h, (
|
|
1345
|
+
c(map(h, (C) => ({ _id: C, ...b }))), o({
|
|
1346
1346
|
undo: () => c(R),
|
|
1347
|
-
redo: () => c(map(h, (
|
|
1347
|
+
redo: () => c(map(h, (C) => ({ _id: C, ...b })))
|
|
1348
1348
|
});
|
|
1349
1349
|
},
|
|
1350
1350
|
updateBlocksRuntime: (h, b) => {
|
|
@@ -1359,8 +1359,8 @@ const useBlocksStoreManager = () => {
|
|
|
1359
1359
|
updateMultipleBlocksProps: (h) => {
|
|
1360
1360
|
let b = [];
|
|
1361
1361
|
b = map(h, (y) => {
|
|
1362
|
-
const R = keys(y),
|
|
1363
|
-
return each(R, (E) => j[E] =
|
|
1362
|
+
const R = keys(y), C = n.find((E) => E._id === y._id), j = {};
|
|
1363
|
+
return each(R, (E) => j[E] = C[E]), j;
|
|
1364
1364
|
}), c(h), o({
|
|
1365
1365
|
undo: () => c(b),
|
|
1366
1366
|
redo: () => c(h)
|
|
@@ -2527,10 +2527,7 @@ import.meta.vitest && test("removeDuplicateClasses (tailwind classes) at higher
|
|
|
2527
2527
|
});
|
|
2528
2528
|
const selectedStylingBlocksAtom = atom$1([]);
|
|
2529
2529
|
selectedStylingBlocksAtom.debugLabel = "selectedStylingBlocksAtom";
|
|
2530
|
-
const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom),
|
|
2531
|
-
const n = o.replace(STYLES_KEY, "").split(",");
|
|
2532
|
-
return { baseClasses: n[0], classes: n[1] };
|
|
2533
|
-
}, addClassesToBlocksAtom = atom$1(null, (o, n, { blockIds: r, newClasses: a }) => {
|
|
2530
|
+
const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), addClassesToBlocksAtom = atom$1(null, (o, n, { blockIds: r, newClasses: a }) => {
|
|
2534
2531
|
const l = filter(
|
|
2535
2532
|
o(pageBlocksAtomsAtom),
|
|
2536
2533
|
(c) => (
|
|
@@ -2539,7 +2536,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2539
2536
|
)
|
|
2540
2537
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2541
2538
|
return map(l, (c) => {
|
|
2542
|
-
const d = o(c), p = get(d, i.prop, `${STYLES_KEY},`), { classes: u } =
|
|
2539
|
+
const d = o(c), p = get(d, i.prop, `${STYLES_KEY},`), { classes: u } = getSplitChaiClasses(p);
|
|
2543
2540
|
return {
|
|
2544
2541
|
ids: [d._id],
|
|
2545
2542
|
props: {
|
|
@@ -2691,9 +2688,6 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2691
2688
|
}, previewModeAtom = atom$1(!1), usePreviewMode = () => {
|
|
2692
2689
|
const [o, n] = useAtom$1(previewModeAtom);
|
|
2693
2690
|
return [o, n];
|
|
2694
|
-
}, getSplitClasses = (o) => {
|
|
2695
|
-
const n = o.replace(STYLES_KEY, "").split(",");
|
|
2696
|
-
return { baseClasses: n[0], classes: n[1] };
|
|
2697
2691
|
}, removeClassFromBlocksAtom = atom$1(null, (o, n, { blockIds: r, fullClasses: a }) => {
|
|
2698
2692
|
const l = first(o(selectedStylingBlocksAtom)), i = filter(
|
|
2699
2693
|
o(pageBlocksAtomsAtom),
|
|
@@ -2704,7 +2698,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2704
2698
|
);
|
|
2705
2699
|
return map(i, (c) => {
|
|
2706
2700
|
const d = o(c), p = a;
|
|
2707
|
-
let { classes: u, baseClasses: x } =
|
|
2701
|
+
let { classes: u, baseClasses: x } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
|
|
2708
2702
|
return each(p, (g) => {
|
|
2709
2703
|
const m = g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2710
2704
|
u = u.replace(f, " ").replace(/\s+/g, " ").trim();
|
|
@@ -2732,8 +2726,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2732
2726
|
}, selectedBlockAllClassesAtom = atom$1((o) => {
|
|
2733
2727
|
const n = first(o(selectedStylingBlocksAtom)), r = o(selectedBlockAtom);
|
|
2734
2728
|
if (!n || n.blockId !== get(r, "_id", null)) return [];
|
|
2735
|
-
const
|
|
2736
|
-
return filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
|
|
2729
|
+
const a = get(r, n.prop, `${STYLES_KEY},`), { classes: l } = getSplitChaiClasses(a);
|
|
2730
|
+
return console.log("classes", l), filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
|
|
2737
2731
|
}), useSelectedBlockAllClasses = () => useAtomValue$1(selectedBlockAllClassesAtom), MQ = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, selectedBlockCurrentClassesAtom = atom$1((o) => {
|
|
2738
2732
|
const n = o(canvasBreakpointAtom), r = o(styleStateAtom), a = o(darkModeAtom), l = getQueries(n);
|
|
2739
2733
|
let i = filter(o(selectedBlockAllClassesAtom), { mod: r });
|
|
@@ -3129,7 +3123,11 @@ const getBlockWithChildren = (o, n) => {
|
|
|
3129
3123
|
const h = cloneDeep(f.find((b) => b._id === m));
|
|
3130
3124
|
for (const b in h) {
|
|
3131
3125
|
const y = h[b];
|
|
3132
|
-
typeof y == "string" && startsWith(y, STYLES_KEY)
|
|
3126
|
+
if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
|
|
3127
|
+
const { baseClasses: R, classes: C } = getSplitChaiClasses(y);
|
|
3128
|
+
h[b] = compact(flattenDeep([R, C])).join(" ");
|
|
3129
|
+
} else
|
|
3130
|
+
b !== "_id" && delete h[b];
|
|
3133
3131
|
}
|
|
3134
3132
|
return h;
|
|
3135
3133
|
};
|
|
@@ -3139,21 +3137,21 @@ const getBlockWithChildren = (o, n) => {
|
|
|
3139
3137
|
if (l) {
|
|
3140
3138
|
n(!0), a(null);
|
|
3141
3139
|
try {
|
|
3142
|
-
const y = p === u ? "" : p, R = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)],
|
|
3140
|
+
const y = p === u ? "" : p, R = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)], C = await l(m, addLangToPrompt(h, x, m), R, y), { blocks: j, error: E } = C;
|
|
3143
3141
|
if (E) {
|
|
3144
3142
|
a(E);
|
|
3145
3143
|
return;
|
|
3146
3144
|
}
|
|
3147
3145
|
if (m === "styles") {
|
|
3148
|
-
const k = j.map((
|
|
3149
|
-
for (const _ in
|
|
3150
|
-
_ !== "_id" && (
|
|
3151
|
-
return
|
|
3146
|
+
const k = j.map((w) => {
|
|
3147
|
+
for (const _ in w)
|
|
3148
|
+
_ !== "_id" && (w[_] = `${STYLES_KEY},${w[_]}`);
|
|
3149
|
+
return w;
|
|
3152
3150
|
});
|
|
3153
3151
|
c(k);
|
|
3154
3152
|
} else
|
|
3155
3153
|
i(j);
|
|
3156
|
-
b && b(
|
|
3154
|
+
b && b(C);
|
|
3157
3155
|
} catch (y) {
|
|
3158
3156
|
a(y);
|
|
3159
3157
|
} finally {
|
|
@@ -3462,8 +3460,8 @@ const useDnd = () => {
|
|
|
3462
3460
|
var E;
|
|
3463
3461
|
const f = dropTarget, b = getOrientation(f) === "vertical" ? m.clientY + ((E = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : E.scrollY) : m.clientX;
|
|
3464
3462
|
dropIndex = calculateDropIndex(b, possiblePositions);
|
|
3465
|
-
const y = d, R = f.getAttribute("data-block-id"),
|
|
3466
|
-
if ((y == null ? void 0 : y._id) === R || !
|
|
3463
|
+
const y = d, R = f.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3464
|
+
if ((y == null ? void 0 : y._id) === R || !C) {
|
|
3467
3465
|
g();
|
|
3468
3466
|
return;
|
|
3469
3467
|
}
|
|
@@ -3678,8 +3676,8 @@ function RuntimePropsBlock(o) {
|
|
|
3678
3676
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(o.component, { ...o.props, ...r }) });
|
|
3679
3677
|
}
|
|
3680
3678
|
const useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), generateClassNames = memoize((o) => {
|
|
3681
|
-
const n = o
|
|
3682
|
-
return twMerge(n
|
|
3679
|
+
const { baseClasses: n, classes: r } = getSplitChaiClasses(o);
|
|
3680
|
+
return twMerge(n, r);
|
|
3683
3681
|
});
|
|
3684
3682
|
function getElementAttrs(o, n) {
|
|
3685
3683
|
return get(o, `${n}_attrs`, {});
|
|
@@ -3734,7 +3732,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3734
3732
|
}
|
|
3735
3733
|
const y = getRegisteredChaiBlock(m._type), R = get(y, "component", null);
|
|
3736
3734
|
if (isNull(R)) return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${m == null ? void 0 : m._type} not registered -->` });
|
|
3737
|
-
const
|
|
3735
|
+
const C = u(m), j = i && isDescendant(i._id, m._id, n), k = {
|
|
3738
3736
|
blockProps: {
|
|
3739
3737
|
"data-block-id": m._id,
|
|
3740
3738
|
"data-block-type": m._type,
|
|
@@ -3750,7 +3748,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3750
3748
|
},
|
|
3751
3749
|
index: f,
|
|
3752
3750
|
...applyBindings(applyLanguage(m, r, y), x),
|
|
3753
|
-
...
|
|
3751
|
+
...C,
|
|
3754
3752
|
...h,
|
|
3755
3753
|
inBuilder: !0,
|
|
3756
3754
|
lang: r || a
|
|
@@ -3766,11 +3764,11 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3766
3764
|
props: k
|
|
3767
3765
|
}
|
|
3768
3766
|
) });
|
|
3769
|
-
const
|
|
3770
|
-
return
|
|
3767
|
+
const w = getRuntimeProps(m._type);
|
|
3768
|
+
return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3771
3769
|
RuntimePropsBlock,
|
|
3772
3770
|
{
|
|
3773
|
-
runtimeProps:
|
|
3771
|
+
runtimeProps: w,
|
|
3774
3772
|
block: m,
|
|
3775
3773
|
component: R,
|
|
3776
3774
|
props: k
|
|
@@ -3810,23 +3808,23 @@ const StaticBlocksRenderer = () => {
|
|
|
3810
3808
|
c();
|
|
3811
3809
|
}, [n, o, r, c]), l;
|
|
3812
3810
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3813
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, g] = useState([]), [, m] = useState([]), [, f] = useAtom$1(canvasIframeAtom), [h, b] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), R = useBuilderProp("htmlDir", "ltr"),
|
|
3814
|
-
p((
|
|
3811
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, g] = useState([]), [, m] = useState([]), [, f] = useAtom$1(canvasIframeAtom), [h, b] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), R = useBuilderProp("htmlDir", "ltr"), C = (k) => {
|
|
3812
|
+
p((w) => ({ ...w, width: k }));
|
|
3815
3813
|
};
|
|
3816
3814
|
useEffect(() => {
|
|
3817
3815
|
if (!c.current) return;
|
|
3818
|
-
const { clientWidth: k, clientHeight:
|
|
3819
|
-
p({ width: k, height:
|
|
3816
|
+
const { clientWidth: k, clientHeight: w } = c.current;
|
|
3817
|
+
p({ width: k, height: w });
|
|
3820
3818
|
}, [c, n]);
|
|
3821
|
-
const j = (k,
|
|
3819
|
+
const j = (k, w = 0) => {
|
|
3822
3820
|
const { top: _ } = k.getBoundingClientRect();
|
|
3823
|
-
return _ +
|
|
3821
|
+
return _ + w >= 0 && _ - w <= window.innerHeight;
|
|
3824
3822
|
};
|
|
3825
3823
|
useEffect(() => {
|
|
3826
|
-
var k,
|
|
3824
|
+
var k, w;
|
|
3827
3825
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3828
3826
|
const _ = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3829
|
-
_ && (j(_) || (
|
|
3827
|
+
_ && (j(_) || (w = (k = i.current) == null ? void 0 : k.contentWindow) == null || w.scrollTo({ top: _.offsetTop, behavior: "smooth" }), g([_]));
|
|
3830
3828
|
}
|
|
3831
3829
|
}, [a]), useEffect(() => {
|
|
3832
3830
|
if (!isEmpty(h) && i.current) {
|
|
@@ -3842,7 +3840,7 @@ const StaticBlocksRenderer = () => {
|
|
|
3842
3840
|
let k = IframeInitialContent;
|
|
3843
3841
|
return k = k.replace("__HTML_DIR__", R), o === "offline" && (k = k.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), k;
|
|
3844
3842
|
}, [o, R]);
|
|
3845
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3843
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3846
3844
|
"div",
|
|
3847
3845
|
{
|
|
3848
3846
|
onClick: () => {
|
|
@@ -4143,12 +4141,12 @@ const StaticBlocksRenderer = () => {
|
|
|
4143
4141
|
), h = useDebouncedCallback(
|
|
4144
4142
|
(y, R) => {
|
|
4145
4143
|
d(() => {
|
|
4146
|
-
const
|
|
4147
|
-
return n ? set(
|
|
4144
|
+
const C = get(c, `colors.${y}`);
|
|
4145
|
+
return n ? set(C, 1, R) : set(C, 0, R), {
|
|
4148
4146
|
...c,
|
|
4149
4147
|
colors: {
|
|
4150
4148
|
...c.colors,
|
|
4151
|
-
[y]:
|
|
4149
|
+
[y]: C
|
|
4152
4150
|
}
|
|
4153
4151
|
};
|
|
4154
4152
|
});
|
|
@@ -4156,12 +4154,12 @@ const StaticBlocksRenderer = () => {
|
|
|
4156
4154
|
[c],
|
|
4157
4155
|
200
|
|
4158
4156
|
), b = (y) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(y.items).map(([R]) => {
|
|
4159
|
-
const
|
|
4157
|
+
const C = get(c, `colors.${R}.${n ? 1 : 0}`);
|
|
4160
4158
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
4161
4159
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4162
4160
|
ColorPickerInput,
|
|
4163
4161
|
{
|
|
4164
|
-
value:
|
|
4162
|
+
value: C,
|
|
4165
4163
|
onChange: (j) => h(R, j)
|
|
4166
4164
|
}
|
|
4167
4165
|
),
|
|
@@ -4203,7 +4201,7 @@ const StaticBlocksRenderer = () => {
|
|
|
4203
4201
|
{
|
|
4204
4202
|
label: y,
|
|
4205
4203
|
value: c.fontFamily[y.replace(/font-/g, "")] || R[Object.keys(R)[0]],
|
|
4206
|
-
onChange: (
|
|
4204
|
+
onChange: (C) => m(y, C)
|
|
4207
4205
|
},
|
|
4208
4206
|
y
|
|
4209
4207
|
)) }),
|
|
@@ -4257,79 +4255,69 @@ const StaticBlocksRenderer = () => {
|
|
|
4257
4255
|
}
|
|
4258
4256
|
) })
|
|
4259
4257
|
] });
|
|
4260
|
-
}
|
|
4261
|
-
var client = {}, hasRequiredClient;
|
|
4262
|
-
function requireClient() {
|
|
4263
|
-
if (hasRequiredClient) return client;
|
|
4264
|
-
hasRequiredClient = 1;
|
|
4265
|
-
var o = ReactDOM;
|
|
4266
|
-
if (process.env.NODE_ENV === "production")
|
|
4267
|
-
client.createRoot = o.createRoot, client.hydrateRoot = o.hydrateRoot;
|
|
4268
|
-
else {
|
|
4269
|
-
var n = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
4270
|
-
client.createRoot = function(r, a) {
|
|
4271
|
-
n.usingClientEntryPoint = !0;
|
|
4272
|
-
try {
|
|
4273
|
-
return o.createRoot(r, a);
|
|
4274
|
-
} finally {
|
|
4275
|
-
n.usingClientEntryPoint = !1;
|
|
4276
|
-
}
|
|
4277
|
-
}, client.hydrateRoot = function(r, a, l) {
|
|
4278
|
-
n.usingClientEntryPoint = !0;
|
|
4279
|
-
try {
|
|
4280
|
-
return o.hydrateRoot(r, a, l);
|
|
4281
|
-
} finally {
|
|
4282
|
-
n.usingClientEntryPoint = !1;
|
|
4283
|
-
}
|
|
4284
|
-
};
|
|
4285
|
-
}
|
|
4286
|
-
return client;
|
|
4287
|
-
}
|
|
4288
|
-
var clientExports = requireClient();
|
|
4289
|
-
const getSvgMarkup = (o) => {
|
|
4258
|
+
}, ICON_PICKER_CONTAINER_ID = "icon-picker-item-container", removeSizeAttributes = (o) => {
|
|
4290
4259
|
try {
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
setTimeout(() => n.removeChild(r), 100);
|
|
4295
|
-
const c = new DOMParser().parseFromString(l, "image/svg+xml"), d = c.querySelector("svg");
|
|
4296
|
-
return d && (d.removeAttribute("width"), d.removeAttribute("height")), new XMLSerializer().serializeToString(c);
|
|
4297
|
-
} catch (n) {
|
|
4298
|
-
return console.error(n), "";
|
|
4260
|
+
return o.replace(/<svg([^>]*)\sheight="[^"]*"([^>]*)>/gi, "<svg$1$2>").replace(/<svg([^>]*)\swidth="[^"]*"([^>]*)>/gi, "<svg$1$2>");
|
|
4261
|
+
} catch {
|
|
4262
|
+
return o;
|
|
4299
4263
|
}
|
|
4300
|
-
},
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4264
|
+
}, getSvgMarkup = () => new Promise((o, n) => {
|
|
4265
|
+
setTimeout(() => {
|
|
4266
|
+
try {
|
|
4267
|
+
const r = document.getElementById(ICON_PICKER_CONTAINER_ID);
|
|
4268
|
+
let a = (r == null ? void 0 : r.innerHTML) || "";
|
|
4269
|
+
a = removeSizeAttributes(a), o(a);
|
|
4270
|
+
} catch (r) {
|
|
4271
|
+
n(r);
|
|
4272
|
+
}
|
|
4273
|
+
}, 300);
|
|
4274
|
+
}), IconPickerField = ({ value: o, onChange: n }) => {
|
|
4275
|
+
const { t: r } = useTranslation(), [a, l] = useState(null);
|
|
4276
|
+
useEffect(() => {
|
|
4277
|
+
l(null);
|
|
4278
|
+
}, [o]);
|
|
4279
|
+
const i = async (c) => {
|
|
4280
|
+
const d = a;
|
|
4281
|
+
try {
|
|
4282
|
+
l(c);
|
|
4283
|
+
const p = await getSvgMarkup();
|
|
4284
|
+
n(p);
|
|
4285
|
+
} catch {
|
|
4286
|
+
l(d);
|
|
4287
|
+
}
|
|
4305
4288
|
};
|
|
4306
4289
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex h-20 items-center gap-x-2", id: "icon-picker-field", children: [
|
|
4307
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
4308
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4290
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative h-12 w-12 cursor-pointer rounded-lg border duration-300 hover:bg-gray-100", children: [
|
|
4291
|
+
a ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4309
4292
|
"div",
|
|
4310
4293
|
{
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
}
|
|
4314
|
-
|
|
4294
|
+
id: ICON_PICKER_CONTAINER_ID,
|
|
4295
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform",
|
|
4296
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconPickerItem, { value: a })
|
|
4297
|
+
}
|
|
4298
|
+
) : o ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4299
|
+
"div",
|
|
4300
|
+
{
|
|
4301
|
+
className: "absolute left-1/2 top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform",
|
|
4302
|
+
dangerouslySetInnerHTML: { __html: o }
|
|
4303
|
+
}
|
|
4304
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4305
|
+
"div",
|
|
4306
|
+
{
|
|
4307
|
+
id: "icon-picker-item-container",
|
|
4308
|
+
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform",
|
|
4309
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconPickerItem, { value: "BiSolidGrid" })
|
|
4315
4310
|
}
|
|
4316
4311
|
),
|
|
4317
4312
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4318
4313
|
IconPicker,
|
|
4319
4314
|
{
|
|
4320
|
-
value:
|
|
4321
|
-
onChange:
|
|
4315
|
+
value: a || o,
|
|
4316
|
+
onChange: i,
|
|
4322
4317
|
pickButtonStyle: {
|
|
4323
|
-
position: "relative",
|
|
4324
4318
|
height: "48px",
|
|
4325
4319
|
width: "48px",
|
|
4326
|
-
|
|
4327
|
-
display: "flex",
|
|
4328
|
-
alignItems: "center",
|
|
4329
|
-
justifyContent: "center",
|
|
4330
|
-
borderRadius: "6px",
|
|
4331
|
-
backgroundColor: "transparent",
|
|
4332
|
-
zIndex: 1
|
|
4320
|
+
opacity: 0
|
|
4333
4321
|
},
|
|
4334
4322
|
searchInputStyle: {
|
|
4335
4323
|
backgroundColor: "transparent",
|
|
@@ -4348,9 +4336,9 @@ const getSvgMarkup = (o) => {
|
|
|
4348
4336
|
autoCorrect: "off",
|
|
4349
4337
|
spellCheck: "false",
|
|
4350
4338
|
value: o,
|
|
4351
|
-
onChange: (
|
|
4339
|
+
onChange: (c) => n(c.target.value),
|
|
4352
4340
|
placeholder: r("Choose Icon or SVG"),
|
|
4353
|
-
className: "no-scrollbar
|
|
4341
|
+
className: "no-scrollbar flex w-full rounded-md border border-border bg-background px-3 py-1.5 text-[10px] leading-4 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
4354
4342
|
}
|
|
4355
4343
|
)
|
|
4356
4344
|
] });
|
|
@@ -4434,7 +4422,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4434
4422
|
onChange: r
|
|
4435
4423
|
}) => {
|
|
4436
4424
|
var P;
|
|
4437
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, I) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [g, m] = useState(""), [f, h] = useState([]), [b, y] = useState(-1), R = useRef(null),
|
|
4425
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, I) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [g, m] = useState(""), [f, h] = useState([]), [b, y] = useState(-1), R = useRef(null), C = (P = n == null ? void 0 : n.find((v) => v.key === u)) == null ? void 0 : P.name;
|
|
4438
4426
|
useEffect(() => {
|
|
4439
4427
|
if (m(""), h([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4440
4428
|
const v = split(o, ":"), I = get(v, 1, "page") || "page";
|
|
@@ -4471,7 +4459,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4471
4459
|
b >= 0 && E(f[b]);
|
|
4472
4460
|
break;
|
|
4473
4461
|
case "Escape":
|
|
4474
|
-
v.preventDefault(),
|
|
4462
|
+
v.preventDefault(), w();
|
|
4475
4463
|
break;
|
|
4476
4464
|
}
|
|
4477
4465
|
};
|
|
@@ -4481,7 +4469,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4481
4469
|
v == null || v.scrollIntoView({ block: "nearest" });
|
|
4482
4470
|
}
|
|
4483
4471
|
}, [b]);
|
|
4484
|
-
const
|
|
4472
|
+
const w = () => {
|
|
4485
4473
|
m(""), h([]), y(-1), p(!1), r("");
|
|
4486
4474
|
}, _ = (v) => {
|
|
4487
4475
|
m(v), p(!isEmpty(v)), c(!0), j(v);
|
|
@@ -4496,11 +4484,11 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4496
4484
|
value: g,
|
|
4497
4485
|
onChange: (v) => _(v.target.value),
|
|
4498
4486
|
onKeyDown: k,
|
|
4499
|
-
placeholder: a(`Search ${
|
|
4487
|
+
placeholder: a(`Search ${C ?? ""}`),
|
|
4500
4488
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4501
4489
|
}
|
|
4502
4490
|
),
|
|
4503
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: w, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
4504
4492
|
] }),
|
|
4505
4493
|
(i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4506
4494
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4744,11 +4732,11 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4744
4732
|
schema: u,
|
|
4745
4733
|
formData: x
|
|
4746
4734
|
}) => {
|
|
4747
|
-
const { selectedLang: g, fallbackLang: m, languages: f } = useLanguages(), h = isEmpty(f) ? "" : isEmpty(g) ? m : g, b = get(LANGUAGES, h, h), y = useSelectedBlock(), R = useRegisteredChaiBlocks(),
|
|
4735
|
+
const { selectedLang: g, fallbackLang: m, languages: f } = useLanguages(), h = isEmpty(f) ? "" : isEmpty(g) ? m : g, b = get(LANGUAGES, h, h), y = useSelectedBlock(), R = useRegisteredChaiBlocks(), C = get(R, [y == null ? void 0 : y._type, "i18nProps"], []) || [], [j, E] = useState(null);
|
|
4748
4736
|
if (d)
|
|
4749
4737
|
return null;
|
|
4750
4738
|
if (u.type === "boolean") return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n, children: a });
|
|
4751
|
-
const
|
|
4739
|
+
const w = C == null ? void 0 : C.includes(o.replace("root.", ""));
|
|
4752
4740
|
if (u.type === "array") {
|
|
4753
4741
|
const _ = j === o;
|
|
4754
4742
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${n} relative`, children: [
|
|
@@ -4779,7 +4767,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4779
4767
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
|
|
4780
4768
|
r,
|
|
4781
4769
|
" ",
|
|
4782
|
-
|
|
4770
|
+
w && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4783
4771
|
" ",
|
|
4784
4772
|
b
|
|
4785
4773
|
] }),
|
|
@@ -4856,43 +4844,43 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4856
4844
|
return set(r, o, n), r;
|
|
4857
4845
|
};
|
|
4858
4846
|
function BlockSettings() {
|
|
4859
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), g = getRegisteredChaiBlock(x == null ? void 0 : x._type), m = formDataWithSelectedLang(x, o, g), f = ({ formData: k },
|
|
4860
|
-
if (
|
|
4861
|
-
const P =
|
|
4847
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), g = getRegisteredChaiBlock(x == null ? void 0 : x._type), m = formDataWithSelectedLang(x, o, g), f = ({ formData: k }, w, _) => {
|
|
4848
|
+
if (w && (c == null ? void 0 : c._id) === n._id) {
|
|
4849
|
+
const P = w.replace("root.", "");
|
|
4862
4850
|
a([n._id], { [P]: get(k, P) }, _);
|
|
4863
4851
|
}
|
|
4864
4852
|
}, h = useCallback(
|
|
4865
|
-
debounce(({ formData: k },
|
|
4866
|
-
f({ formData: k },
|
|
4853
|
+
debounce(({ formData: k }, w, _) => {
|
|
4854
|
+
f({ formData: k }, w, _), d(k);
|
|
4867
4855
|
}, 1500),
|
|
4868
4856
|
[n == null ? void 0 : n._id, o]
|
|
4869
|
-
), b = ({ formData: k },
|
|
4870
|
-
if (
|
|
4871
|
-
const _ =
|
|
4857
|
+
), b = ({ formData: k }, w) => {
|
|
4858
|
+
if (w) {
|
|
4859
|
+
const _ = w.replace("root.", "");
|
|
4872
4860
|
r(
|
|
4873
4861
|
[n._id],
|
|
4874
4862
|
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
4875
|
-
), h({ formData: k },
|
|
4863
|
+
), h({ formData: k }, w, { [_]: get(c, _) });
|
|
4876
4864
|
}
|
|
4877
|
-
}, y = ({ formData: k },
|
|
4878
|
-
if (
|
|
4879
|
-
const _ =
|
|
4865
|
+
}, y = ({ formData: k }, w) => {
|
|
4866
|
+
if (w) {
|
|
4867
|
+
const _ = w.replace("root.", "");
|
|
4880
4868
|
r(
|
|
4881
4869
|
[x._id],
|
|
4882
4870
|
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
4883
|
-
), h({ formData: k },
|
|
4871
|
+
), h({ formData: k }, w, { [_]: get(c, _) });
|
|
4884
4872
|
}
|
|
4885
4873
|
};
|
|
4886
4874
|
keys(get(i, "_bindings", {}));
|
|
4887
|
-
const { schema: R, uiSchema:
|
|
4875
|
+
const { schema: R, uiSchema: C } = useMemo(() => {
|
|
4888
4876
|
const k = n == null ? void 0 : n._type;
|
|
4889
4877
|
if (k)
|
|
4890
4878
|
return getBlockFormSchemas(k);
|
|
4891
4879
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: E } = useMemo(() => {
|
|
4892
4880
|
if (!x || !(x != null && x._type))
|
|
4893
4881
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
4894
|
-
const k = x == null ? void 0 : x._type, { schema:
|
|
4895
|
-
return { wrapperSchema:
|
|
4882
|
+
const k = x == null ? void 0 : x._type, { schema: w = {}, uiSchema: _ = {} } = getBlockFormSchemas(k);
|
|
4883
|
+
return { wrapperSchema: w, wrapperUiSchema: _ };
|
|
4896
4884
|
}, [x]);
|
|
4897
4885
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
4898
4886
|
!isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -4932,7 +4920,7 @@ function BlockSettings() {
|
|
|
4932
4920
|
onChange: b,
|
|
4933
4921
|
formData: i,
|
|
4934
4922
|
schema: R,
|
|
4935
|
-
uiSchema:
|
|
4923
|
+
uiSchema: C
|
|
4936
4924
|
}
|
|
4937
4925
|
),
|
|
4938
4926
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null
|
|
@@ -5064,37 +5052,37 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5064
5052
|
] });
|
|
5065
5053
|
};
|
|
5066
5054
|
function ManualClasses() {
|
|
5067
|
-
var
|
|
5068
|
-
const o = useFuseSearch(), { t: n } = useTranslation(), [r] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), g = (
|
|
5069
|
-
const
|
|
5070
|
-
l(c,
|
|
5071
|
-
}, [
|
|
5072
|
-
const
|
|
5073
|
-
let
|
|
5074
|
-
if (
|
|
5075
|
-
const [
|
|
5076
|
-
|
|
5077
|
-
...
|
|
5078
|
-
item: { ...
|
|
5055
|
+
var _;
|
|
5056
|
+
const o = useFuseSearch(), { t: n } = useTranslation(), [r] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), g = (_ = first(r)) == null ? void 0 : _.prop, { classes: m } = getSplitChaiClasses(get(a, g, "")), f = m.split(" ").filter((P) => !isEmpty(P)), h = () => {
|
|
5057
|
+
const P = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5058
|
+
l(c, P, !0), u("");
|
|
5059
|
+
}, [b, y] = useState([]), R = ({ value: P }) => {
|
|
5060
|
+
const v = P.trim().toLowerCase(), I = v.match(/.+:/g);
|
|
5061
|
+
let B = [];
|
|
5062
|
+
if (I && I.length > 0) {
|
|
5063
|
+
const [A] = I, N = v.replace(A, "");
|
|
5064
|
+
B = o.search(N).map((S) => ({
|
|
5065
|
+
...S,
|
|
5066
|
+
item: { ...S.item, name: A + S.item.name }
|
|
5079
5067
|
}));
|
|
5080
5068
|
} else
|
|
5081
|
-
|
|
5082
|
-
return
|
|
5083
|
-
},
|
|
5084
|
-
|
|
5085
|
-
},
|
|
5069
|
+
B = o.search(v);
|
|
5070
|
+
return y(map(B, "item"));
|
|
5071
|
+
}, C = () => {
|
|
5072
|
+
y([]);
|
|
5073
|
+
}, j = (P) => P.name, E = (P) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-1 rounded-md", children: P.name }), k = {
|
|
5086
5074
|
autoComplete: "off",
|
|
5087
5075
|
autoCorrect: "off",
|
|
5088
5076
|
autoCapitalize: "off",
|
|
5089
5077
|
spellCheck: !1,
|
|
5090
5078
|
placeholder: n("Enter classes separated by space"),
|
|
5091
5079
|
value: p,
|
|
5092
|
-
onKeyDown: (
|
|
5093
|
-
|
|
5080
|
+
onKeyDown: (P) => {
|
|
5081
|
+
P.key === "Enter" && p.trim() !== "" && h();
|
|
5094
5082
|
},
|
|
5095
|
-
onChange: (
|
|
5083
|
+
onChange: (P, { newValue: v }) => u(v),
|
|
5096
5084
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5097
|
-
},
|
|
5085
|
+
}, w = () => {
|
|
5098
5086
|
if (navigator.clipboard === void 0) {
|
|
5099
5087
|
x({
|
|
5100
5088
|
title: n("Clipboard not supported"),
|
|
@@ -5103,38 +5091,38 @@ function ManualClasses() {
|
|
|
5103
5091
|
});
|
|
5104
5092
|
return;
|
|
5105
5093
|
}
|
|
5106
|
-
navigator.clipboard.writeText(
|
|
5094
|
+
navigator.clipboard.writeText(f.join(" ")), x({
|
|
5107
5095
|
title: n("Copied"),
|
|
5108
5096
|
description: n("Classes copied to clipboard")
|
|
5109
5097
|
});
|
|
5110
5098
|
};
|
|
5111
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full flex-col gap-y-1.5
|
|
5099
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full flex-col gap-y-1.5 pb-4", children: [
|
|
5112
5100
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
5113
5101
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5114
5102
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Classes") }),
|
|
5115
5103
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5116
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5104
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
|
|
5117
5105
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: n("Copy classes to clipboard") }) })
|
|
5118
5106
|
] })
|
|
5119
5107
|
] }),
|
|
5120
5108
|
d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
|
|
5121
5109
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
|
|
5122
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SparklesIcon, { className: "
|
|
5110
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SparklesIcon, { className: "w-4 h-4" }),
|
|
5123
5111
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: n("Ask AI") })
|
|
5124
5112
|
] }) }),
|
|
5125
5113
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverContent, { side: "left", className: "p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AskAIStyles, { blockId: a == null ? void 0 : a._id }) })
|
|
5126
5114
|
] }) : null
|
|
5127
5115
|
] }),
|
|
5128
5116
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-center gap-x-3", children: [
|
|
5129
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full
|
|
5117
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex items-center w-full gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5130
5118
|
Autosuggest,
|
|
5131
5119
|
{
|
|
5132
|
-
suggestions:
|
|
5133
|
-
onSuggestionsFetchRequested:
|
|
5134
|
-
onSuggestionsClearRequested:
|
|
5135
|
-
getSuggestionValue:
|
|
5136
|
-
renderSuggestion:
|
|
5137
|
-
inputProps:
|
|
5120
|
+
suggestions: b,
|
|
5121
|
+
onSuggestionsFetchRequested: R,
|
|
5122
|
+
onSuggestionsClearRequested: C,
|
|
5123
|
+
getSuggestionValue: j,
|
|
5124
|
+
renderSuggestion: E,
|
|
5125
|
+
inputProps: k,
|
|
5138
5126
|
containerProps: {
|
|
5139
5127
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
5140
5128
|
},
|
|
@@ -5150,29 +5138,29 @@ function ManualClasses() {
|
|
|
5150
5138
|
{
|
|
5151
5139
|
variant: "outline",
|
|
5152
5140
|
className: "h-6 border-border",
|
|
5153
|
-
onClick:
|
|
5141
|
+
onClick: h,
|
|
5154
5142
|
disabled: p.trim() === "",
|
|
5155
5143
|
size: "sm",
|
|
5156
5144
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
5157
5145
|
}
|
|
5158
5146
|
)
|
|
5159
5147
|
] }),
|
|
5160
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full
|
|
5148
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap w-full gap-2 overflow-x-hidden", children: f.map((P) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5161
5149
|
"div",
|
|
5162
5150
|
{
|
|
5163
|
-
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5151
|
+
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5164
5152
|
children: [
|
|
5165
|
-
|
|
5153
|
+
P,
|
|
5166
5154
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5167
5155
|
Cross2Icon,
|
|
5168
5156
|
{
|
|
5169
|
-
onClick: () => i(c, [
|
|
5170
|
-
className: "invisible
|
|
5157
|
+
onClick: () => i(c, [P]),
|
|
5158
|
+
className: "absolute invisible bg-red-400 rounded-full right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5171
5159
|
}
|
|
5172
5160
|
)
|
|
5173
5161
|
]
|
|
5174
5162
|
},
|
|
5175
|
-
|
|
5163
|
+
P
|
|
5176
5164
|
)) })
|
|
5177
5165
|
] });
|
|
5178
5166
|
}
|
|
@@ -5773,7 +5761,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5773
5761
|
},
|
|
5774
5762
|
a
|
|
5775
5763
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5776
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [g, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, h] = useState(!1), [b, y] = useState(""), [R,
|
|
5764
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [g, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, h] = useState(!1), [b, y] = useState(""), [R, C] = useState(!1), [j, E] = useState(!1);
|
|
5777
5765
|
useEffect(() => {
|
|
5778
5766
|
const { value: v, unit: I } = getClassValueAndUnit(i);
|
|
5779
5767
|
if (I === "") {
|
|
@@ -5782,7 +5770,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5782
5770
|
}
|
|
5783
5771
|
m(I), l(I === "class" || isEmpty(v) ? "" : v);
|
|
5784
5772
|
}, [i, p, u]);
|
|
5785
|
-
const k = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME),
|
|
5773
|
+
const k = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), w = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), _ = useCallback(
|
|
5786
5774
|
(v = !1) => {
|
|
5787
5775
|
const I = getUserInputValues(`${a}`, u);
|
|
5788
5776
|
if (get(I, "error", !1)) {
|
|
@@ -5797,9 +5785,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5797
5785
|
if (get(I, "value") === "")
|
|
5798
5786
|
return;
|
|
5799
5787
|
const N = `${get(I, "value", "").startsWith("-") ? "-" : ""}${d}[${get(I, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
|
|
5800
|
-
v ?
|
|
5788
|
+
v ? w(N) : k(N);
|
|
5801
5789
|
},
|
|
5802
|
-
[k,
|
|
5790
|
+
[k, w, a, g, d, u]
|
|
5803
5791
|
), P = useCallback(
|
|
5804
5792
|
(v) => {
|
|
5805
5793
|
const I = getUserInputValues(`${a}`, u);
|
|
@@ -5847,8 +5835,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5847
5835
|
const I = parseInt$1(v.target.value);
|
|
5848
5836
|
let B = isNaN$1(I) ? 0 : I;
|
|
5849
5837
|
v.keyCode === 38 && (B += 1), v.keyCode === 40 && (B -= 1);
|
|
5850
|
-
const A = `${B}`,
|
|
5851
|
-
|
|
5838
|
+
const A = `${B}`, L = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
5839
|
+
w(L);
|
|
5852
5840
|
},
|
|
5853
5841
|
onKeyUp: (v) => {
|
|
5854
5842
|
j && (v.preventDefault(), E(!1));
|
|
@@ -5896,9 +5884,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5896
5884
|
["none", "auto"].indexOf(g) !== -1 || R ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5897
5885
|
DragStyleButton,
|
|
5898
5886
|
{
|
|
5899
|
-
onDragStart: () =>
|
|
5887
|
+
onDragStart: () => C(!0),
|
|
5900
5888
|
onDragEnd: (v) => {
|
|
5901
|
-
if (y(() => ""),
|
|
5889
|
+
if (y(() => ""), C(!1), isEmpty(v))
|
|
5902
5890
|
return;
|
|
5903
5891
|
const I = `${v}`, A = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
5904
5892
|
k(A);
|
|
@@ -5908,7 +5896,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5908
5896
|
return;
|
|
5909
5897
|
y(v);
|
|
5910
5898
|
const I = `${v}`, A = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
5911
|
-
|
|
5899
|
+
w(A);
|
|
5912
5900
|
},
|
|
5913
5901
|
currentValue: a,
|
|
5914
5902
|
unit: g,
|
|
@@ -6006,8 +5994,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6006
5994
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6007
5995
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6008
5996
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), g = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), y = useCallback(
|
|
6009
|
-
(
|
|
6010
|
-
const P = { dark: p, mq: x, mod: u, cls:
|
|
5997
|
+
(w, _ = !0) => {
|
|
5998
|
+
const P = { dark: p, mq: x, mod: u, cls: w, property: l, fullCls: "" };
|
|
6011
5999
|
(p || u !== "") && (P.mq = "xs");
|
|
6012
6000
|
const v = generateFullClsName(P);
|
|
6013
6001
|
m(h, [v], _);
|
|
@@ -6015,12 +6003,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6015
6003
|
[h, p, x, u, l, m]
|
|
6016
6004
|
), R = useCallback(() => {
|
|
6017
6005
|
f(h, [b]);
|
|
6018
|
-
}, [h, b, f]),
|
|
6006
|
+
}, [h, b, f]), C = useMemo(() => canChangeClass(g, x), [g, x]);
|
|
6019
6007
|
useEffect(() => {
|
|
6020
|
-
i(
|
|
6021
|
-
}, [
|
|
6008
|
+
i(C, g);
|
|
6009
|
+
}, [C, i, g]);
|
|
6022
6010
|
const [, , j] = useCanvasWidth(), E = useCallback(
|
|
6023
|
-
(
|
|
6011
|
+
(w) => {
|
|
6024
6012
|
j({
|
|
6025
6013
|
xs: 400,
|
|
6026
6014
|
sm: 640,
|
|
@@ -6028,11 +6016,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6028
6016
|
lg: 1024,
|
|
6029
6017
|
xl: 1420,
|
|
6030
6018
|
"2xl": 1920
|
|
6031
|
-
}[
|
|
6019
|
+
}[w]);
|
|
6032
6020
|
},
|
|
6033
6021
|
[j]
|
|
6034
6022
|
), k = get(g, "dark", null) === p && get(g, "mod", null) === u && get(g, "mq", null) === x;
|
|
6035
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6023
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: g && k, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6036
6024
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !k ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6037
6025
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6038
6026
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6052,7 +6040,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6052
6040
|
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: y }),
|
|
6053
6041
|
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: y })
|
|
6054
6042
|
] }),
|
|
6055
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: k ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => R(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) :
|
|
6043
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: k ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => R(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6056
6044
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6057
6045
|
"button",
|
|
6058
6046
|
{
|
|
@@ -6501,7 +6489,7 @@ const CoreBlock = ({
|
|
|
6501
6489
|
}
|
|
6502
6490
|
}
|
|
6503
6491
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
6504
|
-
var g, m, f, h, b, y, R,
|
|
6492
|
+
var g, m, f, h, b, y, R, C;
|
|
6505
6493
|
if (r.type === "comment") return [];
|
|
6506
6494
|
console.log("node ===>", r);
|
|
6507
6495
|
let a = { _id: generateUUID() };
|
|
@@ -6558,14 +6546,14 @@ const CoreBlock = ({
|
|
|
6558
6546
|
a.content = getTextContent(j);
|
|
6559
6547
|
const E = find(
|
|
6560
6548
|
r.children || [],
|
|
6561
|
-
(k) => (k == null ? void 0 : k.tagName) === "span" && some(k.children || [], (
|
|
6549
|
+
(k) => (k == null ? void 0 : k.tagName) === "span" && some(k.children || [], (w) => (w == null ? void 0 : w.tagName) === "svg")
|
|
6562
6550
|
);
|
|
6563
6551
|
if (E) {
|
|
6564
|
-
const k = find(E.children || [], (
|
|
6552
|
+
const k = find(E.children || [], (w) => (w == null ? void 0 : w.tagName) === "svg");
|
|
6565
6553
|
if (k) {
|
|
6566
6554
|
a.icon = stringify([k]);
|
|
6567
|
-
const { height:
|
|
6568
|
-
a.iconHeight =
|
|
6555
|
+
const { height: w, width: _ } = getSvgDimensions(k, "16px", "16px");
|
|
6556
|
+
a.iconHeight = w, a.iconWidth = _;
|
|
6569
6557
|
}
|
|
6570
6558
|
}
|
|
6571
6559
|
return [a];
|
|
@@ -6577,9 +6565,9 @@ const CoreBlock = ({
|
|
|
6577
6565
|
const j = stringify([r]);
|
|
6578
6566
|
return hasVideoEmbed(j) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(j)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = j, [a];
|
|
6579
6567
|
} else if (r.tagName === "svg") {
|
|
6580
|
-
const j = find(r.attributes, { key: "height" }), E = find(r.attributes, { key: "width" }), k = get(j, "value") ? `[${get(j, "value")}px]` : "24px",
|
|
6581
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${
|
|
6582
|
-
} else if (r.tagName == "option" && n && ((
|
|
6568
|
+
const j = find(r.attributes, { key: "height" }), E = find(r.attributes, { key: "width" }), k = get(j, "value") ? `[${get(j, "value")}px]` : "24px", w = get(E, "value") ? `[${get(E, "value")}px]` : "24px", _ = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
6569
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${w} h-${k}`, _)}`.trim(), r.attributes = filter(r.attributes, (P) => !includes(["style", "width", "height", "class"], P.key)), a.icon = stringify([r]), [a];
|
|
6570
|
+
} else if (r.tagName == "option" && n && ((C = n.block) == null ? void 0 : C._type) === "Select")
|
|
6583
6571
|
return n.block.options.push({
|
|
6584
6572
|
label: getTextContent(r.children),
|
|
6585
6573
|
...getAttrs(r)
|
|
@@ -6755,8 +6743,8 @@ const BlockCard = ({
|
|
|
6755
6743
|
position: a = -1
|
|
6756
6744
|
}) => {
|
|
6757
6745
|
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), g = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), h = (R) => {
|
|
6758
|
-
const
|
|
6759
|
-
return R._type === "Box" &&
|
|
6746
|
+
const C = has(R, "styles_attrs.data-page-section");
|
|
6747
|
+
return R._type === "Box" && C;
|
|
6760
6748
|
}, b = useCallback(
|
|
6761
6749
|
async (R) => {
|
|
6762
6750
|
if (R.stopPropagation(), has(o, "component")) {
|
|
@@ -6764,15 +6752,15 @@ const BlockCard = ({
|
|
|
6764
6752
|
return;
|
|
6765
6753
|
}
|
|
6766
6754
|
i(!0);
|
|
6767
|
-
const
|
|
6768
|
-
isEmpty(
|
|
6755
|
+
const C = await c(n, o);
|
|
6756
|
+
isEmpty(C) || p(syncBlocksWithDefaults(C), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6769
6757
|
},
|
|
6770
6758
|
[d, p, o, c, n, r, a]
|
|
6771
6759
|
), y = async (R) => {
|
|
6772
|
-
const
|
|
6760
|
+
const C = await c(n, o);
|
|
6773
6761
|
let j = r;
|
|
6774
|
-
if (h(first(
|
|
6775
|
-
const E = { blocks:
|
|
6762
|
+
if (h(first(C)) && (j = null), !isEmpty(C)) {
|
|
6763
|
+
const E = { blocks: C, uiLibrary: !0, parent: j };
|
|
6776
6764
|
if (R.dataTransfer.setData("text/plain", JSON.stringify(E)), o.preview) {
|
|
6777
6765
|
const k = new Image();
|
|
6778
6766
|
k.src = o.preview, k.onload = () => {
|
|
@@ -6830,7 +6818,7 @@ const BlockCard = ({
|
|
|
6830
6818
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
6831
6819
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
6832
6820
|
] });
|
|
6833
|
-
const R = filter(f, (j, E) => E % 2 === 0),
|
|
6821
|
+
const R = filter(f, (j, E) => E % 2 === 0), C = filter(f, (j, E) => E % 2 === 1);
|
|
6834
6822
|
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: [
|
|
6835
6823
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
6836
6824
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
|
|
@@ -6869,7 +6857,7 @@ const BlockCard = ({
|
|
|
6869
6857
|
R.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: n, block: j, library: d }))
|
|
6870
6858
|
) }),
|
|
6871
6859
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
6872
|
-
|
|
6860
|
+
C.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: n, block: j, library: d }))
|
|
6873
6861
|
) })
|
|
6874
6862
|
] }),
|
|
6875
6863
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7089,22 +7077,22 @@ function BiExpandVertical(o) {
|
|
|
7089
7077
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
|
|
7090
7078
|
}
|
|
7091
7079
|
const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7092
|
-
var
|
|
7080
|
+
var L;
|
|
7093
7081
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
7094
7082
|
let p = null;
|
|
7095
|
-
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: g } = useBlockHighlight(), { id: m, data: f, isSelected: h, willReceiveDrop: b, isDragging: y, isEditing: R, handleClick:
|
|
7083
|
+
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: g } = useBlockHighlight(), { id: m, data: f, isSelected: h, willReceiveDrop: b, isDragging: y, isEditing: R, handleClick: C } = o, j = (S) => {
|
|
7096
7084
|
S.stopPropagation(), !i.includes(m) && o.toggle();
|
|
7097
7085
|
}, E = (S) => {
|
|
7098
7086
|
S.isInternal && (p = S.isOpen, S.isOpen && S.close());
|
|
7099
7087
|
}, k = (S) => {
|
|
7100
7088
|
S.isInternal && p !== null && (p ? S.open() : S.close(), p = null);
|
|
7101
|
-
}, [
|
|
7089
|
+
}, [w, _] = useAtom$1(currentAddSelection), P = () => {
|
|
7102
7090
|
var S;
|
|
7103
7091
|
v(), o.parent.isSelected || _((S = o == null ? void 0 : o.parent) == null ? void 0 : S.id);
|
|
7104
7092
|
}, v = () => {
|
|
7105
7093
|
_(null);
|
|
7106
7094
|
}, I = (S) => {
|
|
7107
|
-
v(), S.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(),
|
|
7095
|
+
v(), S.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), C(S);
|
|
7108
7096
|
};
|
|
7109
7097
|
useEffect(() => {
|
|
7110
7098
|
const S = setTimeout(() => {
|
|
@@ -7113,22 +7101,22 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7113
7101
|
return () => clearTimeout(S);
|
|
7114
7102
|
}, [b, o, y]);
|
|
7115
7103
|
const B = useMemo(() => {
|
|
7116
|
-
const S = Object.keys(f),
|
|
7104
|
+
const S = Object.keys(f), T = [];
|
|
7117
7105
|
for (let D = 0; D < S.length; D++)
|
|
7118
7106
|
if (S[D].endsWith("_attrs")) {
|
|
7119
7107
|
const $ = f[S[D]], O = Object.keys($).join("|");
|
|
7120
|
-
O.match(/x-data/) &&
|
|
7108
|
+
O.match(/x-data/) && T.push("data"), O.match(/x-on/) && T.push("event"), O.match(/x-show|x-if/) && T.push("show");
|
|
7121
7109
|
}
|
|
7122
|
-
return
|
|
7123
|
-
}, [f]), A = (S,
|
|
7110
|
+
return T;
|
|
7111
|
+
}, [f]), A = (S, T) => {
|
|
7124
7112
|
const D = d.contentDocument || d.contentWindow.document, $ = D.querySelector(`[data-block-id=${S}]`);
|
|
7125
|
-
$ && $.setAttribute("data-drop",
|
|
7113
|
+
$ && $.setAttribute("data-drop", T);
|
|
7126
7114
|
const O = $.getBoundingClientRect(), M = d.getBoundingClientRect();
|
|
7127
7115
|
O.top >= M.top && O.left >= M.left && O.bottom <= M.bottom && O.right <= M.right || (D.documentElement.scrollTop = $.offsetTop - M.top);
|
|
7128
7116
|
}, N = (S) => {
|
|
7129
7117
|
v();
|
|
7130
|
-
const
|
|
7131
|
-
|
|
7118
|
+
const T = get(o, "parent.id");
|
|
7119
|
+
T !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: T, position: S }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: S });
|
|
7132
7120
|
};
|
|
7133
7121
|
return m === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
7134
7122
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7166,7 +7154,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7166
7154
|
S.preventDefault(), A(m, "no");
|
|
7167
7155
|
},
|
|
7168
7156
|
children: [
|
|
7169
|
-
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((
|
|
7157
|
+
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7170
7158
|
"div",
|
|
7171
7159
|
{
|
|
7172
7160
|
onClick: (S) => {
|
|
@@ -7185,7 +7173,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7185
7173
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
|
|
7186
7174
|
h ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
|
|
7187
7175
|
b && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
|
|
7188
|
-
(o == null ? void 0 : o.id) ===
|
|
7176
|
+
(o == null ? void 0 : o.id) === w ? "bg-purple-100" : "",
|
|
7189
7177
|
y && "opacity-20",
|
|
7190
7178
|
i.includes(m) ? "opacity-50" : ""
|
|
7191
7179
|
),
|
|
@@ -8343,11 +8331,11 @@ const ClearCanvas = () => {
|
|
|
8343
8331
|
r(E), l(a), c(""), p(""), m("");
|
|
8344
8332
|
}
|
|
8345
8333
|
}, y = (E) => {
|
|
8346
|
-
const k = a.filter((
|
|
8334
|
+
const k = a.filter((w, _) => _ !== E);
|
|
8347
8335
|
r(k), l(k);
|
|
8348
8336
|
}, R = (E) => {
|
|
8349
8337
|
x(E), c(a[E].key), p(a[E].value);
|
|
8350
|
-
},
|
|
8338
|
+
}, C = () => {
|
|
8351
8339
|
if (i.startsWith("@")) {
|
|
8352
8340
|
m("Attribute keys cannot start with '@'");
|
|
8353
8341
|
return;
|
|
@@ -8357,14 +8345,14 @@ const ClearCanvas = () => {
|
|
|
8357
8345
|
E[u] = { key: i, value: d }, r(E), l(E), x(null), c(""), p(""), m("");
|
|
8358
8346
|
}
|
|
8359
8347
|
}, j = (E) => {
|
|
8360
|
-
E.key === "Enter" && !E.shiftKey && (E.preventDefault(), u !== null ?
|
|
8348
|
+
E.key === "Enter" && !E.shiftKey && (E.preventDefault(), u !== null ? C() : b());
|
|
8361
8349
|
};
|
|
8362
8350
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
8363
8351
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8364
8352
|
"form",
|
|
8365
8353
|
{
|
|
8366
8354
|
onSubmit: (E) => {
|
|
8367
|
-
E.preventDefault(), u !== null ?
|
|
8355
|
+
E.preventDefault(), u !== null ? C() : b();
|
|
8368
8356
|
},
|
|
8369
8357
|
className: "space-y-3",
|
|
8370
8358
|
children: [
|