@chaibuilder/sdk 2.0.0-beta.62 → 2.0.0-beta.64
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 +4 -4
- package/dist/core.js +540 -549
- package/dist/web-blocks.cjs +6 -6
- package/dist/web-blocks.js +3 -1
- package/package.json +1 -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,
|
|
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, forEach, unset, chunk, cloneDeep, pick, throttle, memoize, reverse, startCase, debounce, capitalize, split, findIndex, take, 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";
|
|
@@ -104,51 +104,51 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
104
104
|
c
|
|
105
105
|
] = o, d = (B) => {
|
|
106
106
|
let A = n(B);
|
|
107
|
-
return A || (A = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, r(B, A), i == null || i(B,
|
|
108
|
-
}, p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(),
|
|
107
|
+
return A || (A = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, r(B, A), i == null || i(B, N)), A;
|
|
108
|
+
}, p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), m = () => {
|
|
109
109
|
var B;
|
|
110
|
-
const A = [],
|
|
110
|
+
const A = [], _ = (L) => {
|
|
111
111
|
try {
|
|
112
112
|
L();
|
|
113
|
-
} catch (
|
|
114
|
-
A.push(
|
|
113
|
+
} catch (C) {
|
|
114
|
+
A.push(C);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
do {
|
|
118
|
-
(B =
|
|
119
|
-
const L = /* @__PURE__ */ new Set(),
|
|
118
|
+
(B = N[INTERNAL_flushStoreHook]) == null || B.call(N);
|
|
119
|
+
const L = /* @__PURE__ */ new Set(), C = L.add.bind(L);
|
|
120
120
|
u.forEach((T) => {
|
|
121
121
|
var D;
|
|
122
|
-
return (D = T.m) == null ? void 0 : D.l.forEach(
|
|
123
|
-
}), u.clear(), x.forEach(
|
|
124
|
-
} while (u.size || x.size ||
|
|
122
|
+
return (D = T.m) == null ? void 0 : D.l.forEach(C);
|
|
123
|
+
}), u.clear(), x.forEach(C), x.clear(), h.forEach(C), h.clear(), L.forEach(_), u.size && w();
|
|
124
|
+
} while (u.size || x.size || h.size);
|
|
125
125
|
if (A.length)
|
|
126
126
|
throw A[0];
|
|
127
|
-
}, f = (B, A,
|
|
128
|
-
const L = "v" in A,
|
|
129
|
-
if (isPromiseLike$2(
|
|
130
|
-
patchPromiseForCancelability(
|
|
127
|
+
}, f = (B, A, _) => {
|
|
128
|
+
const L = "v" in A, C = A.v, T = isPendingPromise(A.v) ? A.v : null;
|
|
129
|
+
if (isPromiseLike$2(_)) {
|
|
130
|
+
patchPromiseForCancelability(_);
|
|
131
131
|
for (const D of A.d.keys())
|
|
132
|
-
addPendingPromiseToDependency(B,
|
|
133
|
-
A.v =
|
|
132
|
+
addPendingPromiseToDependency(B, _, d(D));
|
|
133
|
+
A.v = _;
|
|
134
134
|
} else
|
|
135
|
-
A.v =
|
|
136
|
-
delete A.e, (!L || !Object.is(
|
|
137
|
-
},
|
|
135
|
+
A.v = _;
|
|
136
|
+
delete A.e, (!L || !Object.is(C, A.v)) && (++A.n, T && cancelPromise(T, _));
|
|
137
|
+
}, g = (B) => {
|
|
138
138
|
var A;
|
|
139
|
-
const
|
|
140
|
-
if (isAtomStateInitialized(
|
|
141
|
-
([M,
|
|
139
|
+
const _ = d(B);
|
|
140
|
+
if (isAtomStateInitialized(_) && (_.m && p.get(B) !== _.n || Array.from(_.d).every(
|
|
141
|
+
([M, O]) => (
|
|
142
142
|
// Recursively, read the atom state of the dependency, and
|
|
143
143
|
// check if the atom epoch number is unchanged
|
|
144
|
-
|
|
144
|
+
g(M).n === O
|
|
145
145
|
)
|
|
146
146
|
)))
|
|
147
|
-
return
|
|
148
|
-
|
|
147
|
+
return _;
|
|
148
|
+
_.d.clear();
|
|
149
149
|
let L = !0;
|
|
150
|
-
const
|
|
151
|
-
|
|
150
|
+
const C = () => {
|
|
151
|
+
_.m && (k(B, _), w(), m());
|
|
152
152
|
}, T = (M) => {
|
|
153
153
|
if (isSelfAtom(B, M)) {
|
|
154
154
|
const U = d(M);
|
|
@@ -159,15 +159,15 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
159
159
|
throw new Error("no atom init");
|
|
160
160
|
return returnAtomValue(U);
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const O = g(M);
|
|
163
163
|
try {
|
|
164
|
-
return returnAtomValue(
|
|
164
|
+
return returnAtomValue(O);
|
|
165
165
|
} finally {
|
|
166
|
-
addDependency(B,
|
|
166
|
+
addDependency(B, _, M, O), L || C();
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
let D, $;
|
|
170
|
-
const
|
|
170
|
+
const H = {
|
|
171
171
|
get signal() {
|
|
172
172
|
return D || (D = new AbortController()), D.signal;
|
|
173
173
|
},
|
|
@@ -179,122 +179,122 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
try {
|
|
182
|
-
const M = a(B, T,
|
|
183
|
-
return f(B,
|
|
182
|
+
const M = a(B, T, H);
|
|
183
|
+
return f(B, _, M), isPromiseLike$2(M) && ((A = M.onCancel) == null || A.call(M, () => D == null ? void 0 : D.abort()), M.then(C, C)), _;
|
|
184
184
|
} catch (M) {
|
|
185
|
-
return delete
|
|
185
|
+
return delete _.v, _.e = M, ++_.n, _;
|
|
186
186
|
} finally {
|
|
187
187
|
L = !1;
|
|
188
188
|
}
|
|
189
|
-
}, b = (B) => returnAtomValue(
|
|
189
|
+
}, b = (B) => returnAtomValue(g(B)), y = (B) => {
|
|
190
190
|
var A;
|
|
191
|
-
const
|
|
191
|
+
const _ = /* @__PURE__ */ new Map();
|
|
192
192
|
for (const L of ((A = B.m) == null ? void 0 : A.t) || []) {
|
|
193
|
-
const
|
|
194
|
-
|
|
193
|
+
const C = d(L);
|
|
194
|
+
C.m && _.set(L, C);
|
|
195
195
|
}
|
|
196
196
|
for (const L of B.p)
|
|
197
|
-
|
|
197
|
+
_.set(
|
|
198
198
|
L,
|
|
199
199
|
d(L)
|
|
200
200
|
);
|
|
201
|
-
return
|
|
201
|
+
return _;
|
|
202
202
|
}, R = (B) => {
|
|
203
203
|
const A = [B];
|
|
204
204
|
for (; A.length; ) {
|
|
205
|
-
const
|
|
206
|
-
for (const [L,
|
|
207
|
-
p.has(L) || (p.set(L,
|
|
205
|
+
const _ = A.pop();
|
|
206
|
+
for (const [L, C] of y(_))
|
|
207
|
+
p.has(L) || (p.set(L, C.n), A.push(C));
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, w = () => {
|
|
210
210
|
var B;
|
|
211
|
-
const A = [],
|
|
212
|
-
for (;
|
|
213
|
-
const [T, D] =
|
|
211
|
+
const A = [], _ = /* @__PURE__ */ new WeakSet(), L = /* @__PURE__ */ new WeakSet(), C = Array.from(u);
|
|
212
|
+
for (; C.length; ) {
|
|
213
|
+
const [T, D] = C[C.length - 1];
|
|
214
214
|
if (L.has(T)) {
|
|
215
|
-
|
|
215
|
+
C.pop();
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
219
|
-
p.get(T) === D.n ? A.push([T, D, D.n]) : (p.delete(T), u.set(T, D)), L.add(T),
|
|
218
|
+
if (_.has(T)) {
|
|
219
|
+
p.get(T) === D.n ? A.push([T, D, D.n]) : (p.delete(T), u.set(T, D)), L.add(T), C.pop();
|
|
220
220
|
continue;
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
for (const [$,
|
|
224
|
-
|
|
222
|
+
_.add(T);
|
|
223
|
+
for (const [$, H] of y(D))
|
|
224
|
+
_.has($) || C.push([$, H]);
|
|
225
225
|
}
|
|
226
226
|
for (let T = A.length - 1; T >= 0; --T) {
|
|
227
|
-
const [D, $,
|
|
227
|
+
const [D, $, H] = A[T];
|
|
228
228
|
let M = !1;
|
|
229
|
-
for (const
|
|
230
|
-
if (
|
|
229
|
+
for (const O of $.d.keys())
|
|
230
|
+
if (O !== D && u.has(O)) {
|
|
231
231
|
M = !0;
|
|
232
232
|
break;
|
|
233
233
|
}
|
|
234
|
-
M && (
|
|
234
|
+
M && (g(D), k(D, $), H !== $.n && (u.set(D, $), (B = $.u) == null || B.call($))), p.delete(D);
|
|
235
235
|
}
|
|
236
236
|
}, j = (B, ...A) => {
|
|
237
|
-
let
|
|
238
|
-
const L = (T) => returnAtomValue(
|
|
237
|
+
let _ = !0;
|
|
238
|
+
const L = (T) => returnAtomValue(g(T)), C = (T, ...D) => {
|
|
239
239
|
var $;
|
|
240
|
-
const
|
|
240
|
+
const H = d(T);
|
|
241
241
|
try {
|
|
242
242
|
if (isSelfAtom(B, T)) {
|
|
243
243
|
if (!hasInitialValue(T))
|
|
244
244
|
throw new Error("atom not writable");
|
|
245
|
-
const M =
|
|
246
|
-
f(T,
|
|
245
|
+
const M = H.n, O = D[0];
|
|
246
|
+
f(T, H, O), k(T, H), M !== H.n && (u.set(T, H), ($ = H.u) == null || $.call(H), R(H));
|
|
247
247
|
return;
|
|
248
248
|
} else
|
|
249
249
|
return j(T, ...D);
|
|
250
250
|
} finally {
|
|
251
|
-
|
|
251
|
+
_ || (w(), m());
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
try {
|
|
255
|
-
return l(B, L,
|
|
255
|
+
return l(B, L, C, ...A);
|
|
256
256
|
} finally {
|
|
257
|
-
|
|
257
|
+
_ = !1;
|
|
258
258
|
}
|
|
259
259
|
}, E = (B, ...A) => {
|
|
260
260
|
try {
|
|
261
261
|
return j(B, ...A);
|
|
262
262
|
} finally {
|
|
263
|
-
|
|
263
|
+
w(), m();
|
|
264
264
|
}
|
|
265
265
|
}, k = (B, A) => {
|
|
266
|
-
var
|
|
266
|
+
var _;
|
|
267
267
|
if (A.m && !isPendingPromise(A.v)) {
|
|
268
|
-
for (const [L,
|
|
268
|
+
for (const [L, C] of A.d)
|
|
269
269
|
if (!A.m.d.has(L)) {
|
|
270
270
|
const T = d(L);
|
|
271
|
-
|
|
271
|
+
S(L, T).t.add(B), A.m.d.add(L), C !== T.n && (u.set(L, T), (_ = T.u) == null || _.call(T), R(T));
|
|
272
272
|
}
|
|
273
273
|
for (const L of A.m.d || [])
|
|
274
274
|
if (!A.d.has(L)) {
|
|
275
275
|
A.m.d.delete(L);
|
|
276
|
-
const
|
|
277
|
-
|
|
276
|
+
const C = I(L, d(L));
|
|
277
|
+
C == null || C.t.delete(B);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
},
|
|
281
|
-
var
|
|
280
|
+
}, S = (B, A) => {
|
|
281
|
+
var _;
|
|
282
282
|
if (!A.m) {
|
|
283
|
-
|
|
283
|
+
g(B);
|
|
284
284
|
for (const L of A.d.keys())
|
|
285
|
-
|
|
285
|
+
S(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
|
-
}, (
|
|
291
|
-
const L = A.m,
|
|
290
|
+
}, (_ = A.h) == null || _.call(A), isActuallyWritableAtom(B)) {
|
|
291
|
+
const L = A.m, C = () => {
|
|
292
292
|
let T = !0;
|
|
293
293
|
const D = (...$) => {
|
|
294
294
|
try {
|
|
295
295
|
return j(B, ...$);
|
|
296
296
|
} finally {
|
|
297
|
-
T || (
|
|
297
|
+
T || (w(), m());
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
try {
|
|
@@ -311,37 +311,37 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
311
311
|
T = !1;
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
|
-
|
|
314
|
+
h.add(C);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return A.m;
|
|
318
|
-
},
|
|
319
|
-
var
|
|
318
|
+
}, I = (B, A) => {
|
|
319
|
+
var _;
|
|
320
320
|
if (A.m && !A.m.l.size && !Array.from(A.m.t).some((L) => {
|
|
321
|
-
var
|
|
322
|
-
return (
|
|
321
|
+
var C;
|
|
322
|
+
return (C = d(L).m) == null ? void 0 : C.d.has(B);
|
|
323
323
|
})) {
|
|
324
324
|
const L = A.m.u;
|
|
325
|
-
L && x.add(L), delete A.m, (
|
|
326
|
-
for (const
|
|
327
|
-
const T =
|
|
325
|
+
L && x.add(L), delete A.m, (_ = A.h) == null || _.call(A);
|
|
326
|
+
for (const C of A.d.keys()) {
|
|
327
|
+
const T = I(C, d(C));
|
|
328
328
|
T == null || T.t.delete(B);
|
|
329
329
|
}
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
return A.m;
|
|
333
|
-
},
|
|
333
|
+
}, N = {
|
|
334
334
|
get: b,
|
|
335
335
|
set: E,
|
|
336
336
|
sub: (B, A) => {
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
-
|
|
337
|
+
const _ = d(B), C = S(B, _).l;
|
|
338
|
+
return C.add(A), m(), () => {
|
|
339
|
+
C.delete(A), I(B, _), m();
|
|
340
340
|
};
|
|
341
341
|
},
|
|
342
342
|
unstable_derive: (B) => buildStore(...B(...o))
|
|
343
343
|
};
|
|
344
|
-
return
|
|
344
|
+
return N;
|
|
345
345
|
}, createStore = () => {
|
|
346
346
|
const o = /* @__PURE__ */ new WeakMap();
|
|
347
347
|
return buildStore(
|
|
@@ -373,37 +373,37 @@ function splitAtom(o, n) {
|
|
|
373
373
|
let p = r.get(c);
|
|
374
374
|
if (p)
|
|
375
375
|
return p;
|
|
376
|
-
const u = d && r.get(d), x = [],
|
|
376
|
+
const u = d && r.get(d), x = [], h = [];
|
|
377
377
|
return c.forEach((m, f) => {
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
const b = u && u.atomList[u.keyList.indexOf(
|
|
378
|
+
const g = f;
|
|
379
|
+
h[f] = g;
|
|
380
|
+
const b = u && u.atomList[u.keyList.indexOf(g)];
|
|
381
381
|
if (b) {
|
|
382
382
|
x[f] = b;
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
|
-
const y = (
|
|
386
|
-
const j =
|
|
387
|
-
if (
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
return
|
|
385
|
+
const y = (w) => {
|
|
386
|
+
const j = w(l), E = w(o), S = a(E, j == null ? void 0 : j.arr).keyList.indexOf(g);
|
|
387
|
+
if (S < 0 || S >= E.length) {
|
|
388
|
+
const I = c[a(c).keyList.indexOf(g)];
|
|
389
|
+
if (I)
|
|
390
|
+
return I;
|
|
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[S];
|
|
394
|
+
}, R = (w, j, E) => {
|
|
395
|
+
const k = w(l), S = w(o), P = a(S, k == null ? void 0 : k.arr).keyList.indexOf(g);
|
|
396
|
+
if (P < 0 || P >= S.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(S[P]) : E;
|
|
399
|
+
Object.is(S[P], v) || j(o, [
|
|
400
|
+
...S.slice(0, P),
|
|
401
401
|
v,
|
|
402
|
-
...
|
|
402
|
+
...S.slice(P + 1)
|
|
403
403
|
]);
|
|
404
404
|
};
|
|
405
405
|
x[f] = isWritable(o) ? atom(y, R) : atom(y);
|
|
406
|
-
}), u && u.keyList.length ===
|
|
406
|
+
}), u && u.keyList.length === h.length && u.keyList.every((m, f) => m === h[f]) ? p = u : p = { arr: c, atomList: x, keyList: h }, r.set(c, p), p;
|
|
407
407
|
}, l = atom((c) => {
|
|
408
408
|
const d = c(l), p = c(o);
|
|
409
409
|
return a(p, d == null ? void 0 : d.arr);
|
|
@@ -439,17 +439,17 @@ function splitAtom(o, n) {
|
|
|
439
439
|
case "move": {
|
|
440
440
|
const u = c(i).indexOf(p.atom), x = p.before ? c(i).indexOf(p.before) : c(i).length;
|
|
441
441
|
if (u >= 0 && x >= 0) {
|
|
442
|
-
const
|
|
442
|
+
const h = c(o);
|
|
443
443
|
u < x ? d(o, [
|
|
444
|
-
...
|
|
445
|
-
...
|
|
446
|
-
|
|
447
|
-
...
|
|
444
|
+
...h.slice(0, u),
|
|
445
|
+
...h.slice(u + 1, x),
|
|
446
|
+
h[u],
|
|
447
|
+
...h.slice(x)
|
|
448
448
|
]) : d(o, [
|
|
449
|
-
...
|
|
450
|
-
|
|
451
|
-
...
|
|
452
|
-
...
|
|
449
|
+
...h.slice(0, x),
|
|
450
|
+
h[u],
|
|
451
|
+
...h.slice(x, u),
|
|
452
|
+
...h.slice(u + 1)
|
|
453
453
|
]);
|
|
454
454
|
}
|
|
455
455
|
break;
|
|
@@ -475,18 +475,18 @@ function createJSONStorage(o = () => {
|
|
|
475
475
|
let a, l;
|
|
476
476
|
const i = {
|
|
477
477
|
getItem: (p, u) => {
|
|
478
|
-
var x,
|
|
479
|
-
const m = (
|
|
480
|
-
if (
|
|
478
|
+
var x, h;
|
|
479
|
+
const m = (g) => {
|
|
480
|
+
if (g = g || "", a !== g) {
|
|
481
481
|
try {
|
|
482
|
-
l = JSON.parse(
|
|
482
|
+
l = JSON.parse(g, n == null ? void 0 : n.reviver);
|
|
483
483
|
} catch {
|
|
484
484
|
return u;
|
|
485
485
|
}
|
|
486
|
-
a =
|
|
486
|
+
a = g;
|
|
487
487
|
}
|
|
488
488
|
return l;
|
|
489
|
-
}, f = (
|
|
489
|
+
}, f = (h = (x = o()) == null ? void 0 : x.getItem(p)) != null ? h : null;
|
|
490
490
|
return isPromiseLike$1(f) ? f.then(m) : m(f);
|
|
491
491
|
},
|
|
492
492
|
setItem: (p, u) => {
|
|
@@ -500,12 +500,12 @@ function createJSONStorage(o = () => {
|
|
|
500
500
|
var u;
|
|
501
501
|
return (u = o()) == null ? void 0 : u.removeItem(p);
|
|
502
502
|
}
|
|
503
|
-
}, c = (p) => (u, x,
|
|
503
|
+
}, c = (p) => (u, x, h) => p(u, (m) => {
|
|
504
504
|
let f;
|
|
505
505
|
try {
|
|
506
506
|
f = JSON.parse(m || "");
|
|
507
507
|
} catch {
|
|
508
|
-
f =
|
|
508
|
+
f = h;
|
|
509
509
|
}
|
|
510
510
|
x(f);
|
|
511
511
|
});
|
|
@@ -518,8 +518,8 @@ function createJSONStorage(o = () => {
|
|
|
518
518
|
if (!(o() instanceof window.Storage))
|
|
519
519
|
return () => {
|
|
520
520
|
};
|
|
521
|
-
const x = (
|
|
522
|
-
|
|
521
|
+
const x = (h) => {
|
|
522
|
+
h.storageArea === o() && h.key === p && u(h.newValue);
|
|
523
523
|
};
|
|
524
524
|
return window.addEventListener("storage", x), () => {
|
|
525
525
|
window.removeEventListener("storage", x);
|
|
@@ -1305,65 +1305,65 @@ const useBlocksStoreManager = () => {
|
|
|
1305
1305
|
updateBlocksProps: c
|
|
1306
1306
|
} = useBlocksStoreManager();
|
|
1307
1307
|
return {
|
|
1308
|
-
moveBlocks: (
|
|
1309
|
-
const R = map(
|
|
1310
|
-
const k = n.find((P) => P._id === j)._parent || null,
|
|
1311
|
-
return { _id: j, oldParent: k, oldPosition:
|
|
1312
|
-
}),
|
|
1313
|
-
|
|
1308
|
+
moveBlocks: (g, b, y) => {
|
|
1309
|
+
const R = map(g, (j) => {
|
|
1310
|
+
const k = n.find((P) => P._id === j)._parent || null, I = n.filter((P) => k ? P._parent === k : !P._parent).map((P) => P._id).indexOf(j);
|
|
1311
|
+
return { _id: j, oldParent: k, oldPosition: I };
|
|
1312
|
+
}), w = R.find(({ _id: j }) => j === g[0]);
|
|
1313
|
+
w && w.oldParent === b && w.oldPosition === y || (i(g, b, y), o({
|
|
1314
1314
|
undo: () => each(R, ({ _id: j, oldParent: E, oldPosition: k }) => {
|
|
1315
1315
|
i([j], E, k);
|
|
1316
1316
|
}),
|
|
1317
|
-
redo: () => i(
|
|
1317
|
+
redo: () => i(g, b, y)
|
|
1318
1318
|
}));
|
|
1319
1319
|
},
|
|
1320
|
-
addBlocks: (
|
|
1321
|
-
a(
|
|
1322
|
-
undo: () => l(map(
|
|
1323
|
-
redo: () => a(
|
|
1320
|
+
addBlocks: (g, b, y) => {
|
|
1321
|
+
a(g, b, y), o({
|
|
1322
|
+
undo: () => l(map(g, "_id")),
|
|
1323
|
+
redo: () => a(g, b, y)
|
|
1324
1324
|
});
|
|
1325
1325
|
},
|
|
1326
|
-
removeBlocks: (
|
|
1327
|
-
var
|
|
1328
|
-
const b = (
|
|
1329
|
-
l(map(
|
|
1330
|
-
undo: () => a(
|
|
1331
|
-
redo: () => l(map(
|
|
1326
|
+
removeBlocks: (g) => {
|
|
1327
|
+
var w;
|
|
1328
|
+
const b = (w = first(g)) == null ? void 0 : w._parent, R = n.filter((j) => b ? j._parent === b : !j._parent).indexOf(first(g));
|
|
1329
|
+
l(map(g, "_id")), o({
|
|
1330
|
+
undo: () => a(g, b, R),
|
|
1331
|
+
redo: () => l(map(g, "_id"))
|
|
1332
1332
|
});
|
|
1333
1333
|
},
|
|
1334
|
-
updateBlocks: (
|
|
1334
|
+
updateBlocks: (g, b, y) => {
|
|
1335
1335
|
let R = [];
|
|
1336
1336
|
if (y)
|
|
1337
|
-
R = map(
|
|
1337
|
+
R = map(g, (w) => ({ _id: w, ...y }));
|
|
1338
1338
|
else {
|
|
1339
|
-
const
|
|
1340
|
-
R = map(
|
|
1341
|
-
const E = n.find((
|
|
1342
|
-
return each(
|
|
1339
|
+
const w = keys(b);
|
|
1340
|
+
R = map(g, (j) => {
|
|
1341
|
+
const E = n.find((S) => S._id === j), k = { _id: j };
|
|
1342
|
+
return each(w, (S) => k[S] = E[S]), k;
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
|
-
c(map(
|
|
1345
|
+
c(map(g, (w) => ({ _id: w, ...b }))), o({
|
|
1346
1346
|
undo: () => c(R),
|
|
1347
|
-
redo: () => c(map(
|
|
1347
|
+
redo: () => c(map(g, (w) => ({ _id: w, ...b })))
|
|
1348
1348
|
});
|
|
1349
1349
|
},
|
|
1350
|
-
updateBlocksRuntime: (
|
|
1351
|
-
c(map(
|
|
1350
|
+
updateBlocksRuntime: (g, b) => {
|
|
1351
|
+
c(map(g, (y) => ({ _id: y, ...b })));
|
|
1352
1352
|
},
|
|
1353
|
-
setNewBlocks: (
|
|
1354
|
-
r(
|
|
1353
|
+
setNewBlocks: (g) => {
|
|
1354
|
+
r(g), o({
|
|
1355
1355
|
undo: () => r(n),
|
|
1356
|
-
redo: () => r(
|
|
1356
|
+
redo: () => r(g)
|
|
1357
1357
|
});
|
|
1358
1358
|
},
|
|
1359
|
-
updateMultipleBlocksProps: (
|
|
1359
|
+
updateMultipleBlocksProps: (g) => {
|
|
1360
1360
|
let b = [];
|
|
1361
|
-
b = map(
|
|
1362
|
-
const R = keys(y),
|
|
1363
|
-
return each(R, (E) => j[E] =
|
|
1364
|
-
}), c(
|
|
1361
|
+
b = map(g, (y) => {
|
|
1362
|
+
const R = keys(y), w = n.find((E) => E._id === y._id), j = {};
|
|
1363
|
+
return each(R, (E) => j[E] = w[E]), j;
|
|
1364
|
+
}), c(g), o({
|
|
1365
1365
|
undo: () => c(b),
|
|
1366
|
-
redo: () => c(
|
|
1366
|
+
redo: () => c(g)
|
|
1367
1367
|
});
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
@@ -1372,9 +1372,9 @@ const useBlocksStoreManager = () => {
|
|
|
1372
1372
|
(i, c, d) => {
|
|
1373
1373
|
var m;
|
|
1374
1374
|
for (let f = 0; f < i.length; f++) {
|
|
1375
|
-
const { _id:
|
|
1375
|
+
const { _id: g } = i[f];
|
|
1376
1376
|
i[f]._id = generateUUID();
|
|
1377
|
-
const b = filter(i, { _parent:
|
|
1377
|
+
const b = filter(i, { _parent: g });
|
|
1378
1378
|
for (let y = 0; y < b.length; y++)
|
|
1379
1379
|
b[y]._parent = i[f]._id;
|
|
1380
1380
|
}
|
|
@@ -1395,8 +1395,8 @@ const useBlocksStoreManager = () => {
|
|
|
1395
1395
|
_id: p,
|
|
1396
1396
|
...u
|
|
1397
1397
|
};
|
|
1398
|
-
let
|
|
1399
|
-
return c && (
|
|
1398
|
+
let h, m;
|
|
1399
|
+
return c && (h = find(o, { _id: c }), x._parent = c, m = c), !canAcceptChildBlock(h == null ? void 0 : h._type, x._type) && h && (x._parent = h._parent, m = h._parent), r([x], m, d), n([x._id]), x;
|
|
1400
1400
|
},
|
|
1401
1401
|
[r, a, o, n]
|
|
1402
1402
|
), addPredefinedBlock: a };
|
|
@@ -2605,8 +2605,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), add
|
|
|
2605
2605
|
const x = filter(
|
|
2606
2606
|
o,
|
|
2607
2607
|
(m) => isString(l) ? m._parent === l : !m._parent
|
|
2608
|
-
).indexOf(d) + 1,
|
|
2609
|
-
r(
|
|
2608
|
+
).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
|
|
2609
|
+
r(h, l, x), i.push(get(h, "0._id", ""));
|
|
2610
2610
|
}), n(i);
|
|
2611
2611
|
},
|
|
2612
2612
|
[o, n]
|
|
@@ -2699,13 +2699,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), add
|
|
|
2699
2699
|
return map(i, (c) => {
|
|
2700
2700
|
const d = o(c), p = a;
|
|
2701
2701
|
let { classes: u, baseClasses: x } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
|
|
2702
|
-
return each(p, (
|
|
2703
|
-
const m =
|
|
2702
|
+
return each(p, (h) => {
|
|
2703
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2704
2704
|
u = u.replace(f, " ").replace(/\s+/g, " ").trim();
|
|
2705
|
-
const
|
|
2706
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2707
|
-
}), each(p, (
|
|
2708
|
-
const m =
|
|
2705
|
+
const g = first(h.split(":"));
|
|
2706
|
+
includes(["2xl", "xl", "lg", "md", "sm"], g) && p.push(h.split(":").pop().trim());
|
|
2707
|
+
}), each(p, (h) => {
|
|
2708
|
+
const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
|
|
2709
2709
|
x = x.replace(f, " ").replace(/\s+/g, " ").trim();
|
|
2710
2710
|
}), {
|
|
2711
2711
|
ids: [d._id],
|
|
@@ -2770,7 +2770,7 @@ const useLanguages = () => {
|
|
|
2770
2770
|
selectedLang: r,
|
|
2771
2771
|
setSelectedLang: l
|
|
2772
2772
|
};
|
|
2773
|
-
}, updatePropsForLanguage =
|
|
2773
|
+
}, updatePropsForLanguage = (o, n, r) => {
|
|
2774
2774
|
const a = getRegisteredChaiBlock(get(r, "_type"));
|
|
2775
2775
|
if (!a) return o;
|
|
2776
2776
|
const l = { ...o };
|
|
@@ -2780,7 +2780,7 @@ const useLanguages = () => {
|
|
|
2780
2780
|
set(l, c, o[i]), unset(l, i);
|
|
2781
2781
|
}
|
|
2782
2782
|
}), l;
|
|
2783
|
-
}
|
|
2783
|
+
}, useUpdateBlocksProps = () => {
|
|
2784
2784
|
const { updateBlocks: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
|
|
2785
2785
|
return useCallback(
|
|
2786
2786
|
(a, l, i) => {
|
|
@@ -3119,39 +3119,39 @@ const getBlockWithChildren = (o, n) => {
|
|
|
3119
3119
|
return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
|
|
3120
3120
|
})
|
|
3121
3121
|
), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
3122
|
-
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u,
|
|
3123
|
-
const
|
|
3124
|
-
for (const b in
|
|
3125
|
-
const y =
|
|
3122
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u, h = (m, f) => {
|
|
3123
|
+
const g = cloneDeep(f.find((b) => b._id === m));
|
|
3124
|
+
for (const b in g) {
|
|
3125
|
+
const y = g[b];
|
|
3126
3126
|
if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
|
|
3127
|
-
const { baseClasses: R, classes:
|
|
3128
|
-
|
|
3127
|
+
const { baseClasses: R, classes: w } = getSplitChaiClasses(y);
|
|
3128
|
+
g[b] = compact(flattenDeep([R, w])).join(" ");
|
|
3129
3129
|
} else
|
|
3130
|
-
b !== "_id" && delete
|
|
3130
|
+
b !== "_id" && delete g[b];
|
|
3131
3131
|
}
|
|
3132
|
-
return
|
|
3132
|
+
return g;
|
|
3133
3133
|
};
|
|
3134
3134
|
return {
|
|
3135
3135
|
askAi: useCallback(
|
|
3136
|
-
async (m, f,
|
|
3136
|
+
async (m, f, g, b) => {
|
|
3137
3137
|
if (l) {
|
|
3138
3138
|
n(!0), a(null);
|
|
3139
3139
|
try {
|
|
3140
|
-
const y = p === u ? "" : p, R = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [
|
|
3140
|
+
const y = p === u ? "" : p, R = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], w = await l(m, addLangToPrompt(g, x, m), R, y), { blocks: j, error: E } = w;
|
|
3141
3141
|
if (E) {
|
|
3142
3142
|
a(E);
|
|
3143
3143
|
return;
|
|
3144
3144
|
}
|
|
3145
3145
|
if (m === "styles") {
|
|
3146
|
-
const k = j.map((
|
|
3147
|
-
for (const
|
|
3148
|
-
|
|
3149
|
-
return
|
|
3146
|
+
const k = j.map((S) => {
|
|
3147
|
+
for (const I in S)
|
|
3148
|
+
I !== "_id" && (S[I] = `${STYLES_KEY},${S[I]}`);
|
|
3149
|
+
return S;
|
|
3150
3150
|
});
|
|
3151
3151
|
c(k);
|
|
3152
3152
|
} else
|
|
3153
3153
|
i(j);
|
|
3154
|
-
b && b(
|
|
3154
|
+
b && b(w);
|
|
3155
3155
|
} catch (y) {
|
|
3156
3156
|
a(y);
|
|
3157
3157
|
} finally {
|
|
@@ -3248,7 +3248,7 @@ const pubsub = new PubSub(), draggedBlockAtom = atom$1(null), dropTargetBlockIdA
|
|
|
3248
3248
|
}
|
|
3249
3249
|
});
|
|
3250
3250
|
useResizeObserver(o, () => x(), o !== null);
|
|
3251
|
-
const
|
|
3251
|
+
const h = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3252
3252
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3253
3253
|
"div",
|
|
3254
3254
|
{
|
|
@@ -3265,12 +3265,12 @@ const pubsub = new PubSub(), draggedBlockAtom = atom$1(null), dropTargetBlockIdA
|
|
|
3265
3265
|
onKeyDown: (f) => f.stopPropagation(),
|
|
3266
3266
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3267
3267
|
children: [
|
|
3268
|
-
|
|
3268
|
+
h && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3269
3269
|
ArrowUpIcon,
|
|
3270
3270
|
{
|
|
3271
3271
|
className: "hover:scale-105",
|
|
3272
3272
|
onClick: () => {
|
|
3273
|
-
c([]), l([
|
|
3273
|
+
c([]), l([h]);
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
),
|
|
@@ -3346,14 +3346,14 @@ const pubsub = new PubSub(), draggedBlockAtom = atom$1(null), dropTargetBlockIdA
|
|
|
3346
3346
|
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
3347
3347
|
</body>
|
|
3348
3348
|
</html>`, useKeyEventWatcher = (o) => {
|
|
3349
|
-
const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks:
|
|
3349
|
+
const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(), m = o ? { document: o } : {};
|
|
3350
3350
|
useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(n), {}, [n, p]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
|
|
3351
3351
|
"ctrl+v,command+v",
|
|
3352
3352
|
() => {
|
|
3353
|
-
x(n[0]) &&
|
|
3353
|
+
x(n[0]) && h(n);
|
|
3354
3354
|
},
|
|
3355
3355
|
{ ...m, preventDefault: !0 },
|
|
3356
|
-
[n, x,
|
|
3356
|
+
[n, x, h]
|
|
3357
3357
|
), useHotkeys("esc", () => r([]), m, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...m, preventDefault: !0 }, [
|
|
3358
3358
|
n,
|
|
3359
3359
|
i
|
|
@@ -3448,7 +3448,7 @@ function removeDataDrop() {
|
|
|
3448
3448
|
const useDnd = () => {
|
|
3449
3449
|
const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, p] = useAtom$1(draggedBlockAtom), [, u] = useAtom$1(dropTargetBlockIdAtom);
|
|
3450
3450
|
if (!useFeature("dnd")) return {};
|
|
3451
|
-
const
|
|
3451
|
+
const h = () => {
|
|
3452
3452
|
removePlaceholder(), r(!1), p(null), u(null), possiblePositions = [];
|
|
3453
3453
|
};
|
|
3454
3454
|
return iframeDocument = o, {
|
|
@@ -3460,23 +3460,23 @@ const useDnd = () => {
|
|
|
3460
3460
|
var E;
|
|
3461
3461
|
const f = dropTarget, b = getOrientation(f) === "vertical" ? m.clientY + ((E = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : E.scrollY) : m.clientX;
|
|
3462
3462
|
dropIndex = calculateDropIndex(b, possiblePositions);
|
|
3463
|
-
const y = d, R = f.getAttribute("data-block-id"),
|
|
3464
|
-
if ((y == null ? void 0 : y._id) === R || !
|
|
3465
|
-
|
|
3463
|
+
const y = d, R = f.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3464
|
+
if ((y == null ? void 0 : y._id) === R || !w) {
|
|
3465
|
+
h();
|
|
3466
3466
|
return;
|
|
3467
3467
|
}
|
|
3468
3468
|
if (!has(y, "_id")) {
|
|
3469
|
-
a(y, R === "canvas" ? null : R, dropIndex), setTimeout(
|
|
3469
|
+
a(y, R === "canvas" ? null : R, dropIndex), setTimeout(h, 300);
|
|
3470
3470
|
return;
|
|
3471
3471
|
}
|
|
3472
3472
|
let j = f.getAttribute("data-block-id");
|
|
3473
|
-
j === null && (j = m.target.parentElement.getAttribute("data-block-id")), c([y._id], j === "canvas" ? null : j, dropIndex),
|
|
3473
|
+
j === null && (j = m.target.parentElement.getAttribute("data-block-id")), c([y._id], j === "canvas" ? null : j, dropIndex), h(), setTimeout(removePlaceholder, 300);
|
|
3474
3474
|
},
|
|
3475
3475
|
onDragEnter: (m) => {
|
|
3476
|
-
const f = m,
|
|
3477
|
-
dropTarget =
|
|
3478
|
-
const b =
|
|
3479
|
-
u(b), f.stopPropagation(), f.preventDefault(), possiblePositions = [], y && calculatePossiblePositions(
|
|
3476
|
+
const f = m, g = f.target;
|
|
3477
|
+
dropTarget = g;
|
|
3478
|
+
const b = g.getAttribute("data-block-id"), y = g.getAttribute("data-dnd-dragged") !== "yes";
|
|
3479
|
+
u(b), f.stopPropagation(), f.preventDefault(), possiblePositions = [], y && calculatePossiblePositions(g), r(!0), l(""), i([]);
|
|
3480
3480
|
},
|
|
3481
3481
|
onDragLeave: (m) => {
|
|
3482
3482
|
m.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
@@ -3499,7 +3499,7 @@ function destroyQuill(o) {
|
|
|
3499
3499
|
const useHandleCanvasDblClick = () => {
|
|
3500
3500
|
const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
|
|
3501
3501
|
return (i) => {
|
|
3502
|
-
var
|
|
3502
|
+
var h;
|
|
3503
3503
|
if (r) return;
|
|
3504
3504
|
const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
|
|
3505
3505
|
if (!d || !o.includes(d))
|
|
@@ -3517,7 +3517,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3517
3517
|
m.stopPropagation();
|
|
3518
3518
|
}), p.addEventListener("keydown", (m) => {
|
|
3519
3519
|
(m.key === "Enter" || m.key === "Escape") && x();
|
|
3520
|
-
}), u.focus(), (
|
|
3520
|
+
}), u.focus(), (h = p.querySelector(".ql-clipboard")) == null || h.remove(), a(c.getAttribute("data-block-id"));
|
|
3521
3521
|
};
|
|
3522
3522
|
}, useHandleCanvasClick = () => {
|
|
3523
3523
|
const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
|
|
@@ -3554,12 +3554,12 @@ const useHandleCanvasDblClick = () => {
|
|
|
3554
3554
|
setTimeout(() => {
|
|
3555
3555
|
if (!isEmpty(a))
|
|
3556
3556
|
return;
|
|
3557
|
-
const
|
|
3558
|
-
if (
|
|
3559
|
-
const m =
|
|
3557
|
+
const h = getElementByDataBlockId(n, first(r));
|
|
3558
|
+
if (h) {
|
|
3559
|
+
const m = h.getAttribute("data-style-prop");
|
|
3560
3560
|
if (m) {
|
|
3561
|
-
const f =
|
|
3562
|
-
l([{ id: f, prop: m, blockId:
|
|
3561
|
+
const f = h.getAttribute("data-style-id"), g = h.getAttribute("data-block-parent");
|
|
3562
|
+
l([{ id: f, prop: m, blockId: g }]);
|
|
3563
3563
|
}
|
|
3564
3564
|
}
|
|
3565
3565
|
}, 100);
|
|
@@ -3582,7 +3582,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3582
3582
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), HeadTags = () => {
|
|
3583
3583
|
const [o] = useTheme(), n = useThemeOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: p } = useFrame(), [u] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [x] = useState(
|
|
3584
3584
|
d == null ? void 0 : d.getElementById("selected-block")
|
|
3585
|
-
), [
|
|
3585
|
+
), [h] = useState(
|
|
3586
3586
|
d == null ? void 0 : d.getElementById("selected-styling-block")
|
|
3587
3587
|
), [m] = useState(
|
|
3588
3588
|
d == null ? void 0 : d.getElementById("dragged-block")
|
|
@@ -3632,19 +3632,19 @@ const useHandleCanvasDblClick = () => {
|
|
|
3632
3632
|
}, [i, m]), useEffect(() => {
|
|
3633
3633
|
u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
|
|
3634
3634
|
}, [u]), useEffect(() => {
|
|
3635
|
-
|
|
3635
|
+
h && (h.textContent = `${map(l, ({ id: b }) => `[data-style-id="${b}"]`).join(",")}{
|
|
3636
3636
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
3637
3637
|
}`);
|
|
3638
|
-
}, [l,
|
|
3638
|
+
}, [l, h]), useEffect(() => {
|
|
3639
3639
|
d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3640
3640
|
}, [c, d]);
|
|
3641
3641
|
const f = useMemo(
|
|
3642
3642
|
() => getChaiThemeCssVariables(o),
|
|
3643
3643
|
[o]
|
|
3644
|
-
),
|
|
3644
|
+
), g = useMemo(() => getThemeFontsLinkMarkup(pick(o, ["fontFamily"])), [o]);
|
|
3645
3645
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3646
3646
|
/* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children: f }),
|
|
3647
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html:
|
|
3647
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: g } })
|
|
3648
3648
|
] });
|
|
3649
3649
|
}, ResizableCanvasWrapper = ({ children: o, onMount: n, onResize: r }) => {
|
|
3650
3650
|
const [, a] = useSelectedBlockIds(), [, l] = useSelectedStylingBlocks(), i = useRef(null), c = useDebouncedCallback(
|
|
@@ -3721,18 +3721,18 @@ function applyLanguage(o, n, r) {
|
|
|
3721
3721
|
}), a;
|
|
3722
3722
|
}
|
|
3723
3723
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3724
|
-
const { selectedLang: r, fallbackLang: a } = useLanguages(), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [d] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), u = useCallback((m) => getStyleAttrs(m), []), [x] = useChaiExternalData(), [
|
|
3724
|
+
const { selectedLang: r, fallbackLang: a } = useLanguages(), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [d] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), u = useCallback((m) => getStyleAttrs(m), []), [x] = useChaiExternalData(), [h] = useAtom$1(inlineEditingActiveAtom);
|
|
3725
3725
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3726
3726
|
o.map((m, f) => {
|
|
3727
|
-
if (
|
|
3728
|
-
const
|
|
3729
|
-
if (
|
|
3730
|
-
const
|
|
3731
|
-
|
|
3727
|
+
if (h === m._id || d.includes(m._id)) return null;
|
|
3728
|
+
const g = {}, b = filter(n, { _parent: m._id });
|
|
3729
|
+
if (g.children = b.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: b }) : null, m._type === "GlobalBlock") {
|
|
3730
|
+
const I = p(m);
|
|
3731
|
+
g.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(I, (P) => !P._parent), allBlocks: I });
|
|
3732
3732
|
}
|
|
3733
3733
|
const y = getRegisteredChaiBlock(m._type), R = get(y, "component", null);
|
|
3734
3734
|
if (isNull(R)) return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${m == null ? void 0 : m._type} not registered -->` });
|
|
3735
|
-
const
|
|
3735
|
+
const w = u(m), j = i && isDescendant(i._id, m._id, n), k = {
|
|
3736
3736
|
blockProps: {
|
|
3737
3737
|
"data-block-id": m._id,
|
|
3738
3738
|
"data-block-type": m._type,
|
|
@@ -3748,8 +3748,8 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3748
3748
|
},
|
|
3749
3749
|
index: f,
|
|
3750
3750
|
...applyBindings(applyLanguage(m, r, y), x),
|
|
3751
|
-
...
|
|
3752
|
-
...
|
|
3751
|
+
...w,
|
|
3752
|
+
...g,
|
|
3753
3753
|
inBuilder: !0,
|
|
3754
3754
|
lang: r || a
|
|
3755
3755
|
};
|
|
@@ -3764,11 +3764,11 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3764
3764
|
props: k
|
|
3765
3765
|
}
|
|
3766
3766
|
) });
|
|
3767
|
-
const
|
|
3768
|
-
return
|
|
3767
|
+
const S = getRuntimeProps(m._type);
|
|
3768
|
+
return S ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3769
3769
|
RuntimePropsBlock,
|
|
3770
3770
|
{
|
|
3771
|
-
runtimeProps:
|
|
3771
|
+
runtimeProps: S,
|
|
3772
3772
|
block: m,
|
|
3773
3773
|
component: R,
|
|
3774
3774
|
props: k
|
|
@@ -3787,10 +3787,10 @@ const StaticBlocksRenderer = () => {
|
|
|
3787
3787
|
if (d < n) {
|
|
3788
3788
|
const u = parseFloat((d / n).toFixed(2).toString());
|
|
3789
3789
|
let x = {};
|
|
3790
|
-
const
|
|
3790
|
+
const h = p * u, m = d * u;
|
|
3791
3791
|
p && (x = {
|
|
3792
3792
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
3793
|
-
height: 100 + (p -
|
|
3793
|
+
height: 100 + (p - h) / h * 100 + "%",
|
|
3794
3794
|
width: 100 + (d - m) / m * 100 + "%"
|
|
3795
3795
|
}), i({
|
|
3796
3796
|
position: "relative",
|
|
@@ -3808,39 +3808,39 @@ const StaticBlocksRenderer = () => {
|
|
|
3808
3808
|
c();
|
|
3809
3809
|
}, [n, o, r, c]), l;
|
|
3810
3810
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
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,
|
|
3812
|
-
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, h] = useState([]), [, m] = useState([]), [, f] = useAtom$1(canvasIframeAtom), [g, b] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), R = useBuilderProp("htmlDir", "ltr"), w = (k) => {
|
|
3812
|
+
p((S) => ({ ...S, width: k }));
|
|
3813
3813
|
};
|
|
3814
3814
|
useEffect(() => {
|
|
3815
3815
|
if (!c.current) return;
|
|
3816
|
-
const { clientWidth: k, clientHeight:
|
|
3817
|
-
p({ width: k, height:
|
|
3816
|
+
const { clientWidth: k, clientHeight: S } = c.current;
|
|
3817
|
+
p({ width: k, height: S });
|
|
3818
3818
|
}, [c, n]);
|
|
3819
|
-
const j = (k,
|
|
3820
|
-
const { top:
|
|
3821
|
-
return
|
|
3819
|
+
const j = (k, S = 0) => {
|
|
3820
|
+
const { top: I } = k.getBoundingClientRect();
|
|
3821
|
+
return I + S >= 0 && I - S <= window.innerHeight;
|
|
3822
3822
|
};
|
|
3823
3823
|
useEffect(() => {
|
|
3824
|
-
var k,
|
|
3824
|
+
var k, S;
|
|
3825
3825
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3826
|
-
const
|
|
3827
|
-
|
|
3826
|
+
const I = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3827
|
+
I && (j(I) || (S = (k = i.current) == null ? void 0 : k.contentWindow) == null || S.scrollTo({ top: I.offsetTop, behavior: "smooth" }), h([I]));
|
|
3828
3828
|
}
|
|
3829
3829
|
}, [a]), useEffect(() => {
|
|
3830
|
-
if (!isEmpty(
|
|
3830
|
+
if (!isEmpty(g) && i.current) {
|
|
3831
3831
|
const k = getElementByStyleId(
|
|
3832
3832
|
i.current.contentDocument,
|
|
3833
|
-
first(
|
|
3833
|
+
first(g).id
|
|
3834
3834
|
);
|
|
3835
3835
|
m(k ? [k] : [null]);
|
|
3836
3836
|
} else
|
|
3837
3837
|
m([null]);
|
|
3838
|
-
}, [
|
|
3838
|
+
}, [g]);
|
|
3839
3839
|
const E = useMemo(() => {
|
|
3840
3840
|
let k = IframeInitialContent;
|
|
3841
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;
|
|
3842
3842
|
}, [o, R]);
|
|
3843
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3843
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3844
3844
|
"div",
|
|
3845
3845
|
{
|
|
3846
3846
|
onClick: () => {
|
|
@@ -4110,7 +4110,7 @@ const StaticBlocksRenderer = () => {
|
|
|
4110
4110
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
4111
4111
|
const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), [c, d] = useTheme(), p = useThemeOptions(), { t: u } = useTranslation(), x = (y) => {
|
|
4112
4112
|
a(y);
|
|
4113
|
-
},
|
|
4113
|
+
}, h = () => {
|
|
4114
4114
|
const y = l.find((R) => Object.keys(R)[0] === r);
|
|
4115
4115
|
if (y) {
|
|
4116
4116
|
const R = Object.values(y)[0];
|
|
@@ -4138,15 +4138,15 @@ const StaticBlocksRenderer = () => {
|
|
|
4138
4138
|
},
|
|
4139
4139
|
[c],
|
|
4140
4140
|
200
|
|
4141
|
-
),
|
|
4141
|
+
), g = useDebouncedCallback(
|
|
4142
4142
|
(y, R) => {
|
|
4143
4143
|
d(() => {
|
|
4144
|
-
const
|
|
4145
|
-
return n ? set(
|
|
4144
|
+
const w = get(c, `colors.${y}`);
|
|
4145
|
+
return n ? set(w, 1, R) : set(w, 0, R), {
|
|
4146
4146
|
...c,
|
|
4147
4147
|
colors: {
|
|
4148
4148
|
...c.colors,
|
|
4149
|
-
[y]:
|
|
4149
|
+
[y]: w
|
|
4150
4150
|
}
|
|
4151
4151
|
};
|
|
4152
4152
|
});
|
|
@@ -4154,13 +4154,13 @@ const StaticBlocksRenderer = () => {
|
|
|
4154
4154
|
[c],
|
|
4155
4155
|
200
|
|
4156
4156
|
), b = (y) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(y.items).map(([R]) => {
|
|
4157
|
-
const
|
|
4157
|
+
const w = get(c, `colors.${R}.${n ? 1 : 0}`);
|
|
4158
4158
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
4159
4159
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4160
4160
|
ColorPickerInput,
|
|
4161
4161
|
{
|
|
4162
|
-
value:
|
|
4163
|
-
onChange: (j) =>
|
|
4162
|
+
value: w,
|
|
4163
|
+
onChange: (j) => g(R, j)
|
|
4164
4164
|
}
|
|
4165
4165
|
),
|
|
4166
4166
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: R.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((j) => j.charAt(0).toUpperCase() + j.slice(1)).join(" ") + (!R.toLowerCase().includes("foreground") && !R.toLowerCase().includes("border") && !R.toLowerCase().includes("input") && !R.toLowerCase().includes("ring") && !R.toLowerCase().includes("background") ? " Background" : "") })
|
|
@@ -4190,7 +4190,7 @@ const StaticBlocksRenderer = () => {
|
|
|
4190
4190
|
className: "w-full text-sm",
|
|
4191
4191
|
disabled: r === "",
|
|
4192
4192
|
variant: "default",
|
|
4193
|
-
onClick:
|
|
4193
|
+
onClick: h,
|
|
4194
4194
|
children: u("Apply")
|
|
4195
4195
|
}
|
|
4196
4196
|
) })
|
|
@@ -4201,7 +4201,7 @@ const StaticBlocksRenderer = () => {
|
|
|
4201
4201
|
{
|
|
4202
4202
|
label: y,
|
|
4203
4203
|
value: c.fontFamily[y.replace(/font-/g, "")] || R[Object.keys(R)[0]],
|
|
4204
|
-
onChange: (
|
|
4204
|
+
onChange: (w) => m(y, w)
|
|
4205
4205
|
},
|
|
4206
4206
|
y
|
|
4207
4207
|
)) }),
|
|
@@ -4422,44 +4422,44 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4422
4422
|
onChange: r
|
|
4423
4423
|
}) => {
|
|
4424
4424
|
var P;
|
|
4425
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v,
|
|
4425
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, N) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [h, m] = useState(""), [f, g] = useState([]), [b, y] = useState(-1), R = useRef(null), w = (P = n == null ? void 0 : n.find((v) => v.key === u)) == null ? void 0 : P.name;
|
|
4426
4426
|
useEffect(() => {
|
|
4427
|
-
if (m(""),
|
|
4428
|
-
const v = split(o, ":"),
|
|
4429
|
-
x(
|
|
4430
|
-
const B = await l(
|
|
4427
|
+
if (m(""), g([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4428
|
+
const v = split(o, ":"), N = get(v, 1, "page") || "page";
|
|
4429
|
+
x(N), (async () => {
|
|
4430
|
+
const B = await l(N, [get(v, 2, "page")]);
|
|
4431
4431
|
B && Array.isArray(B) && m(get(B, [0, "name"], ""));
|
|
4432
4432
|
})();
|
|
4433
4433
|
}, [o]);
|
|
4434
4434
|
const j = useDebouncedCallback(
|
|
4435
4435
|
async (v) => {
|
|
4436
4436
|
if (isEmpty(v))
|
|
4437
|
-
|
|
4437
|
+
g([]);
|
|
4438
4438
|
else {
|
|
4439
|
-
const
|
|
4440
|
-
|
|
4439
|
+
const N = await l(u, v);
|
|
4440
|
+
g(N);
|
|
4441
4441
|
}
|
|
4442
4442
|
c(!1), y(-1);
|
|
4443
4443
|
},
|
|
4444
4444
|
[u],
|
|
4445
4445
|
300
|
|
4446
4446
|
), E = (v) => {
|
|
4447
|
-
const
|
|
4448
|
-
|
|
4447
|
+
const N = ["pageType", u, v.id];
|
|
4448
|
+
N[1] && (r(N.join(":")), m(v.name), p(!1), g([]), y(-1));
|
|
4449
4449
|
}, k = (v) => {
|
|
4450
4450
|
switch (v.key) {
|
|
4451
4451
|
case "ArrowDown":
|
|
4452
|
-
v.preventDefault(), y((
|
|
4452
|
+
v.preventDefault(), y((N) => N < f.length - 1 ? N + 1 : N);
|
|
4453
4453
|
break;
|
|
4454
4454
|
case "ArrowUp":
|
|
4455
|
-
v.preventDefault(), y((
|
|
4455
|
+
v.preventDefault(), y((N) => N > 0 ? N - 1 : N);
|
|
4456
4456
|
break;
|
|
4457
4457
|
case "Enter":
|
|
4458
4458
|
if (v.preventDefault(), f.length === 0) return;
|
|
4459
4459
|
b >= 0 && E(f[b]);
|
|
4460
4460
|
break;
|
|
4461
4461
|
case "Escape":
|
|
4462
|
-
v.preventDefault(),
|
|
4462
|
+
v.preventDefault(), S();
|
|
4463
4463
|
break;
|
|
4464
4464
|
}
|
|
4465
4465
|
};
|
|
@@ -4469,9 +4469,9 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4469
4469
|
v == null || v.scrollIntoView({ block: "nearest" });
|
|
4470
4470
|
}
|
|
4471
4471
|
}, [b]);
|
|
4472
|
-
const
|
|
4473
|
-
m(""),
|
|
4474
|
-
},
|
|
4472
|
+
const S = () => {
|
|
4473
|
+
m(""), g([]), y(-1), p(!1), r("");
|
|
4474
|
+
}, I = (v) => {
|
|
4475
4475
|
m(v), p(!isEmpty(v)), c(!0), j(v);
|
|
4476
4476
|
};
|
|
4477
4477
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
@@ -4481,28 +4481,28 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4481
4481
|
"input",
|
|
4482
4482
|
{
|
|
4483
4483
|
type: "text",
|
|
4484
|
-
value:
|
|
4485
|
-
onChange: (v) =>
|
|
4484
|
+
value: h,
|
|
4485
|
+
onChange: (v) => I(v.target.value),
|
|
4486
4486
|
onKeyDown: k,
|
|
4487
|
-
placeholder: a(`Search ${
|
|
4487
|
+
placeholder: a(`Search ${w ?? ""}`),
|
|
4488
4488
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4489
4489
|
}
|
|
4490
4490
|
),
|
|
4491
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children:
|
|
4491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
4492
4492
|
] }),
|
|
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: [
|
|
4493
|
+
(i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4494
4494
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
4495
4495
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
4496
4496
|
] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
4497
4497
|
a("No results found for"),
|
|
4498
4498
|
' "',
|
|
4499
|
-
|
|
4499
|
+
h,
|
|
4500
4500
|
'"'
|
|
4501
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: R, children: map(f == null ? void 0 : f.slice(0, 20), (v,
|
|
4501
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: R, children: map(f == null ? void 0 : f.slice(0, 20), (v, N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4502
4502
|
"li",
|
|
4503
4503
|
{
|
|
4504
4504
|
onClick: () => E(v),
|
|
4505
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" :
|
|
4505
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : N === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4506
4506
|
children: [
|
|
4507
4507
|
v.name,
|
|
4508
4508
|
" ",
|
|
@@ -4595,25 +4595,25 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4595
4595
|
}, [a]), useEffect(() => {
|
|
4596
4596
|
u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
|
|
4597
4597
|
}, [o, u]);
|
|
4598
|
-
const
|
|
4599
|
-
const
|
|
4600
|
-
if (
|
|
4601
|
-
const b = (
|
|
4598
|
+
const h = () => {
|
|
4599
|
+
const g = findIndex(u, { _id: x });
|
|
4600
|
+
if (g > -1) {
|
|
4601
|
+
const b = (g + 1) % u.length, y = get(u, [b, "_id"]);
|
|
4602
4602
|
if (!y) return;
|
|
4603
4603
|
n({ ...o, currentSlide: y }), c([y]);
|
|
4604
4604
|
}
|
|
4605
4605
|
}, m = () => {
|
|
4606
|
-
const
|
|
4607
|
-
if (
|
|
4608
|
-
const b = (
|
|
4606
|
+
const g = findIndex(u, { _id: x });
|
|
4607
|
+
if (g > -1) {
|
|
4608
|
+
const b = (g - 1 + u.length) % u.length, y = get(u, [b, "_id"]);
|
|
4609
4609
|
if (!y) return;
|
|
4610
4610
|
n({ ...o, currentSlide: y }), c([y]);
|
|
4611
4611
|
}
|
|
4612
4612
|
}, f = () => {
|
|
4613
|
-
const
|
|
4613
|
+
const g = i(
|
|
4614
4614
|
{ styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
|
|
4615
4615
|
p == null ? void 0 : p._id
|
|
4616
|
-
), b =
|
|
4616
|
+
), b = g == null ? void 0 : g._id;
|
|
4617
4617
|
b && (n({ ...o, currentSlide: b }), c([b]));
|
|
4618
4618
|
};
|
|
4619
4619
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
@@ -4627,7 +4627,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4627
4627
|
"/",
|
|
4628
4628
|
u.length
|
|
4629
4629
|
] }) : "-" }),
|
|
4630
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4630
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3 stroke-[3]" }) }),
|
|
4631
4631
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4632
4632
|
"button",
|
|
4633
4633
|
{
|
|
@@ -4692,8 +4692,8 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4692
4692
|
value: o == null ? void 0 : o.autoplayInterval,
|
|
4693
4693
|
className: "text-xs",
|
|
4694
4694
|
pattern: "[0-9]*",
|
|
4695
|
-
onChange: (
|
|
4696
|
-
let b =
|
|
4695
|
+
onChange: (g) => {
|
|
4696
|
+
let b = g.target.value;
|
|
4697
4697
|
b.length && (b = b.replace("-", "")), n({ ...o, autoplayInterval: b });
|
|
4698
4698
|
}
|
|
4699
4699
|
}
|
|
@@ -4732,22 +4732,22 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4732
4732
|
schema: u,
|
|
4733
4733
|
formData: x
|
|
4734
4734
|
}) => {
|
|
4735
|
-
const { selectedLang:
|
|
4735
|
+
const { selectedLang: h, fallbackLang: m, languages: f } = useLanguages(), g = isEmpty(f) ? "" : isEmpty(h) ? m : h, b = get(LANGUAGES, g, g), y = useSelectedBlock(), R = useRegisteredChaiBlocks(), w = get(R, [y == null ? void 0 : y._type, "i18nProps"], []) || [], [j, E] = useState(null);
|
|
4736
4736
|
if (d)
|
|
4737
4737
|
return null;
|
|
4738
4738
|
if (u.type === "boolean") return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n, children: a });
|
|
4739
|
-
const
|
|
4739
|
+
const S = w == null ? void 0 : w.includes(o.replace("root.", ""));
|
|
4740
4740
|
if (u.type === "array") {
|
|
4741
|
-
const
|
|
4741
|
+
const I = j === o;
|
|
4742
4742
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${n} relative`, children: [
|
|
4743
4743
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4744
4744
|
"label",
|
|
4745
4745
|
{
|
|
4746
4746
|
htmlFor: o,
|
|
4747
|
-
onClick: () => E(
|
|
4747
|
+
onClick: () => E(I ? null : o),
|
|
4748
4748
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4749
4749
|
children: [
|
|
4750
|
-
|
|
4750
|
+
I ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4751
4751
|
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-3 w-3" }),
|
|
4752
4752
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-tight", children: r }),
|
|
4753
4753
|
" ",
|
|
@@ -4755,7 +4755,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4755
4755
|
]
|
|
4756
4756
|
}
|
|
4757
4757
|
),
|
|
4758
|
-
(x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${
|
|
4758
|
+
(x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${I ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
4759
4759
|
c,
|
|
4760
4760
|
a,
|
|
4761
4761
|
l,
|
|
@@ -4767,7 +4767,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4767
4767
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
|
|
4768
4768
|
r,
|
|
4769
4769
|
" ",
|
|
4770
|
-
|
|
4770
|
+
S && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
4771
4771
|
" ",
|
|
4772
4772
|
b
|
|
4773
4773
|
] }),
|
|
@@ -4787,7 +4787,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4787
4787
|
useEffect(() => {
|
|
4788
4788
|
c(a);
|
|
4789
4789
|
}, [o, d]);
|
|
4790
|
-
const
|
|
4790
|
+
const h = useThrottledCallback(
|
|
4791
4791
|
async ({ formData: m }, f) => {
|
|
4792
4792
|
l({ formData: m }, f);
|
|
4793
4793
|
},
|
|
@@ -4829,7 +4829,9 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4829
4829
|
schema: n,
|
|
4830
4830
|
formData: i,
|
|
4831
4831
|
onChange: ({ formData: m }, f) => {
|
|
4832
|
-
|
|
4832
|
+
if (!f) return;
|
|
4833
|
+
const g = take(f.split("."), 2).join(".").replace("root.", "");
|
|
4834
|
+
c(m), h({ formData: m }, g);
|
|
4833
4835
|
}
|
|
4834
4836
|
},
|
|
4835
4837
|
d
|
|
@@ -4839,48 +4841,30 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
|
4839
4841
|
return forEach(keys(o), (l) => {
|
|
4840
4842
|
includes(get(r, "i18nProps", []), l) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
|
|
4841
4843
|
}), a;
|
|
4842
|
-
}, convertDotNotationToObject = (o, n) => {
|
|
4843
|
-
const r = {};
|
|
4844
|
-
return set(r, o, n), r;
|
|
4845
4844
|
};
|
|
4846
4845
|
function BlockSettings() {
|
|
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(),
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
}, h = useCallback(
|
|
4853
|
-
debounce(({ formData: k }, w, _) => {
|
|
4854
|
-
f({ formData: k }, w, _), d(k);
|
|
4846
|
+
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(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), m = formDataWithSelectedLang(x, o, h), f = ({ formData: k }, S, I) => {
|
|
4847
|
+
S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(k, S) }, I);
|
|
4848
|
+
}, g = useCallback(
|
|
4849
|
+
debounce(({ formData: k }, S, I) => {
|
|
4850
|
+
f({ formData: k }, S, I), d(k);
|
|
4855
4851
|
}, 1500),
|
|
4856
4852
|
[n == null ? void 0 : n._id, o]
|
|
4857
|
-
), b = ({ formData: k },
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
[n._id],
|
|
4862
|
-
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
4863
|
-
), h({ formData: k }, w, { [_]: get(c, _) });
|
|
4864
|
-
}
|
|
4865
|
-
}, y = ({ formData: k }, w) => {
|
|
4866
|
-
if (w) {
|
|
4867
|
-
const _ = w.replace("root.", "");
|
|
4868
|
-
r(
|
|
4869
|
-
[x._id],
|
|
4870
|
-
convertDotNotationToObject(_, get(k, _.split(".")))
|
|
4871
|
-
), h({ formData: k }, w, { [_]: get(c, _) });
|
|
4872
|
-
}
|
|
4853
|
+
), b = ({ formData: k }, S) => {
|
|
4854
|
+
S && (r([n._id], { [S]: get(k, S) }), g({ formData: k }, S, { [S]: get(c, S) }));
|
|
4855
|
+
}, y = ({ formData: k }, S) => {
|
|
4856
|
+
S && (r([x._id], { [S]: get(k, S) }), g({ formData: k }, S, { [S]: get(c, S) }));
|
|
4873
4857
|
};
|
|
4874
4858
|
keys(get(i, "_bindings", {}));
|
|
4875
|
-
const { schema: R, uiSchema:
|
|
4859
|
+
const { schema: R, uiSchema: w } = useMemo(() => {
|
|
4876
4860
|
const k = n == null ? void 0 : n._type;
|
|
4877
4861
|
if (k)
|
|
4878
4862
|
return getBlockFormSchemas(k);
|
|
4879
4863
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: E } = useMemo(() => {
|
|
4880
4864
|
if (!x || !(x != null && x._type))
|
|
4881
4865
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
4882
|
-
const k = x == null ? void 0 : x._type, { schema:
|
|
4883
|
-
return { wrapperSchema:
|
|
4866
|
+
const k = x == null ? void 0 : x._type, { schema: S = {}, uiSchema: I = {} } = getBlockFormSchemas(k);
|
|
4867
|
+
return { wrapperSchema: S, wrapperUiSchema: I };
|
|
4884
4868
|
}, [x]);
|
|
4885
4869
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
4886
4870
|
!isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -4920,7 +4904,7 @@ function BlockSettings() {
|
|
|
4920
4904
|
onChange: b,
|
|
4921
4905
|
formData: i,
|
|
4922
4906
|
schema: R,
|
|
4923
|
-
uiSchema:
|
|
4907
|
+
uiSchema: w
|
|
4924
4908
|
}
|
|
4925
4909
|
),
|
|
4926
4910
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null
|
|
@@ -4995,7 +4979,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
4995
4979
|
var m;
|
|
4996
4980
|
(m = d.current) == null || m.focus();
|
|
4997
4981
|
}, []);
|
|
4998
|
-
const
|
|
4982
|
+
const h = (m) => {
|
|
4999
4983
|
const { usage: f } = m || {};
|
|
5000
4984
|
!l && f && x(f), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
|
|
5001
4985
|
};
|
|
@@ -5011,7 +4995,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5011
4995
|
className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
|
|
5012
4996
|
rows: 4,
|
|
5013
4997
|
onKeyDown: (m) => {
|
|
5014
|
-
m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), x(void 0), r("styles", o, i,
|
|
4998
|
+
m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), x(void 0), r("styles", o, i, h));
|
|
5015
4999
|
}
|
|
5016
5000
|
}
|
|
5017
5001
|
),
|
|
@@ -5021,7 +5005,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5021
5005
|
{
|
|
5022
5006
|
disabled: i.trim().length < 5 || a,
|
|
5023
5007
|
onClick: () => {
|
|
5024
|
-
p.current && clearTimeout(p.current), x(void 0), r("styles", o, i,
|
|
5008
|
+
p.current && clearTimeout(p.current), x(void 0), r("styles", o, i, h);
|
|
5025
5009
|
},
|
|
5026
5010
|
variant: "default",
|
|
5027
5011
|
className: "w-fit",
|
|
@@ -5052,23 +5036,23 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5052
5036
|
] });
|
|
5053
5037
|
};
|
|
5054
5038
|
function ManualClasses() {
|
|
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(),
|
|
5039
|
+
var I;
|
|
5040
|
+
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(), h = (I = first(r)) == null ? void 0 : I.prop, { classes: m } = getSplitChaiClasses(get(a, h, "")), f = m.split(" ").filter((P) => !isEmpty(P)), g = () => {
|
|
5057
5041
|
const P = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5058
5042
|
l(c, P, !0), u("");
|
|
5059
5043
|
}, [b, y] = useState([]), R = ({ value: P }) => {
|
|
5060
|
-
const v = P.trim().toLowerCase(),
|
|
5044
|
+
const v = P.trim().toLowerCase(), N = v.match(/.+:/g);
|
|
5061
5045
|
let B = [];
|
|
5062
|
-
if (
|
|
5063
|
-
const [A] =
|
|
5064
|
-
B = o.search(
|
|
5065
|
-
...
|
|
5066
|
-
item: { ...
|
|
5046
|
+
if (N && N.length > 0) {
|
|
5047
|
+
const [A] = N, _ = v.replace(A, "");
|
|
5048
|
+
B = o.search(_).map((C) => ({
|
|
5049
|
+
...C,
|
|
5050
|
+
item: { ...C.item, name: A + C.item.name }
|
|
5067
5051
|
}));
|
|
5068
5052
|
} else
|
|
5069
5053
|
B = o.search(v);
|
|
5070
5054
|
return y(map(B, "item"));
|
|
5071
|
-
},
|
|
5055
|
+
}, w = () => {
|
|
5072
5056
|
y([]);
|
|
5073
5057
|
}, j = (P) => P.name, E = (P) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-1 rounded-md", children: P.name }), k = {
|
|
5074
5058
|
autoComplete: "off",
|
|
@@ -5078,11 +5062,11 @@ function ManualClasses() {
|
|
|
5078
5062
|
placeholder: n("Enter classes separated by space"),
|
|
5079
5063
|
value: p,
|
|
5080
5064
|
onKeyDown: (P) => {
|
|
5081
|
-
P.key === "Enter" && p.trim() !== "" &&
|
|
5065
|
+
P.key === "Enter" && p.trim() !== "" && g();
|
|
5082
5066
|
},
|
|
5083
5067
|
onChange: (P, { newValue: v }) => u(v),
|
|
5084
5068
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5085
|
-
},
|
|
5069
|
+
}, S = () => {
|
|
5086
5070
|
if (navigator.clipboard === void 0) {
|
|
5087
5071
|
x({
|
|
5088
5072
|
title: n("Clipboard not supported"),
|
|
@@ -5101,7 +5085,7 @@ function ManualClasses() {
|
|
|
5101
5085
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5102
5086
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Classes") }),
|
|
5103
5087
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5104
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5088
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: S, className: "cursor-pointer" }) }),
|
|
5105
5089
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: n("Copy classes to clipboard") }) })
|
|
5106
5090
|
] })
|
|
5107
5091
|
] }),
|
|
@@ -5119,7 +5103,7 @@ function ManualClasses() {
|
|
|
5119
5103
|
{
|
|
5120
5104
|
suggestions: b,
|
|
5121
5105
|
onSuggestionsFetchRequested: R,
|
|
5122
|
-
onSuggestionsClearRequested:
|
|
5106
|
+
onSuggestionsClearRequested: w,
|
|
5123
5107
|
getSuggestionValue: j,
|
|
5124
5108
|
renderSuggestion: E,
|
|
5125
5109
|
inputProps: k,
|
|
@@ -5138,7 +5122,7 @@ function ManualClasses() {
|
|
|
5138
5122
|
{
|
|
5139
5123
|
variant: "outline",
|
|
5140
5124
|
className: "h-6 border-border",
|
|
5141
|
-
onClick:
|
|
5125
|
+
onClick: g,
|
|
5142
5126
|
disabled: p.trim() === "",
|
|
5143
5127
|
size: "sm",
|
|
5144
5128
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -5548,7 +5532,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5548
5532
|
ringColor: "ring",
|
|
5549
5533
|
ringOffsetColor: "ring-offset"
|
|
5550
5534
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
5551
|
-
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""),
|
|
5535
|
+
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
|
|
5552
5536
|
// eslint-disable-next-line no-shadow
|
|
5553
5537
|
(b) => {
|
|
5554
5538
|
["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((y) => ({ ...y, color: b, shade: y.shade ? y.shade : "500" })));
|
|
@@ -5570,11 +5554,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5570
5554
|
useEffect(() => {
|
|
5571
5555
|
p({ color: "", shade: "" });
|
|
5572
5556
|
}, [r]);
|
|
5573
|
-
const { match:
|
|
5557
|
+
const { match: g } = useTailwindClassList();
|
|
5574
5558
|
return useEffect(() => {
|
|
5575
5559
|
const y = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
5576
|
-
|
|
5577
|
-
}, [
|
|
5560
|
+
g(o, y) && n(y, o);
|
|
5561
|
+
}, [g, d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
5578
5562
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5579
5563
|
DropDown,
|
|
5580
5564
|
{
|
|
@@ -5614,7 +5598,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5614
5598
|
]
|
|
5615
5599
|
}
|
|
5616
5600
|
) }),
|
|
5617
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected:
|
|
5601
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !x || !l, onChange: f, options: i }) })
|
|
5618
5602
|
] });
|
|
5619
5603
|
}, getUserInputValues = (o, n) => {
|
|
5620
5604
|
o = o.toLowerCase();
|
|
@@ -5761,52 +5745,52 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5761
5745
|
},
|
|
5762
5746
|
a
|
|
5763
5747
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5764
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [
|
|
5748
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, g] = useState(!1), [b, y] = useState(""), [R, w] = useState(!1), [j, E] = useState(!1);
|
|
5765
5749
|
useEffect(() => {
|
|
5766
|
-
const { value: v, unit:
|
|
5767
|
-
if (
|
|
5750
|
+
const { value: v, unit: N } = getClassValueAndUnit(i);
|
|
5751
|
+
if (N === "") {
|
|
5768
5752
|
l(v), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5769
5753
|
return;
|
|
5770
5754
|
}
|
|
5771
|
-
m(
|
|
5755
|
+
m(N), l(N === "class" || isEmpty(v) ? "" : v);
|
|
5772
5756
|
}, [i, p, u]);
|
|
5773
|
-
const k = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME),
|
|
5757
|
+
const k = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), S = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), I = useCallback(
|
|
5774
5758
|
(v = !1) => {
|
|
5775
|
-
const
|
|
5776
|
-
if (get(
|
|
5777
|
-
|
|
5759
|
+
const N = getUserInputValues(`${a}`, u);
|
|
5760
|
+
if (get(N, "error", !1)) {
|
|
5761
|
+
g(!0);
|
|
5778
5762
|
return;
|
|
5779
5763
|
}
|
|
5780
|
-
const B = get(
|
|
5764
|
+
const B = get(N, "unit") !== "" ? get(N, "unit") : h;
|
|
5781
5765
|
if (B === "auto" || B === "none") {
|
|
5782
5766
|
k(`${d}${B}`);
|
|
5783
5767
|
return;
|
|
5784
5768
|
}
|
|
5785
|
-
if (get(
|
|
5769
|
+
if (get(N, "value") === "")
|
|
5786
5770
|
return;
|
|
5787
|
-
const
|
|
5788
|
-
v ?
|
|
5771
|
+
const _ = `${get(N, "value", "").startsWith("-") ? "-" : ""}${d}[${get(N, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
|
|
5772
|
+
v ? S(_) : k(_);
|
|
5789
5773
|
},
|
|
5790
|
-
[k,
|
|
5774
|
+
[k, S, a, h, d, u]
|
|
5791
5775
|
), P = useCallback(
|
|
5792
5776
|
(v) => {
|
|
5793
|
-
const
|
|
5794
|
-
if (get(
|
|
5795
|
-
|
|
5777
|
+
const N = getUserInputValues(`${a}`, u);
|
|
5778
|
+
if (get(N, "error", !1)) {
|
|
5779
|
+
g(!0);
|
|
5796
5780
|
return;
|
|
5797
5781
|
}
|
|
5798
5782
|
if (v === "auto" || v === "none") {
|
|
5799
5783
|
k(`${d}${v}`);
|
|
5800
5784
|
return;
|
|
5801
5785
|
}
|
|
5802
|
-
if (get(
|
|
5786
|
+
if (get(N, "value") === "")
|
|
5803
5787
|
return;
|
|
5804
|
-
const B = get(
|
|
5805
|
-
k(
|
|
5788
|
+
const B = get(N, "unit") !== "" ? get(N, "unit") : v, _ = `${get(N, "value", "").startsWith("-") ? "-" : ""}${d}[${get(N, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
|
|
5789
|
+
k(_);
|
|
5806
5790
|
},
|
|
5807
5791
|
[k, a, d, u]
|
|
5808
5792
|
);
|
|
5809
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children:
|
|
5793
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5810
5794
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5811
5795
|
"input",
|
|
5812
5796
|
{
|
|
@@ -5821,33 +5805,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5821
5805
|
] })
|
|
5822
5806
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${R ? "z-auto" : ""}`, children: [
|
|
5823
5807
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
5824
|
-
["none", "auto"].indexOf(
|
|
5808
|
+
["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5825
5809
|
"input",
|
|
5826
5810
|
{
|
|
5827
|
-
readOnly:
|
|
5811
|
+
readOnly: h === "class",
|
|
5828
5812
|
onKeyPress: (v) => {
|
|
5829
|
-
v.key === "Enter" &&
|
|
5813
|
+
v.key === "Enter" && I();
|
|
5830
5814
|
},
|
|
5831
5815
|
onKeyDown: (v) => {
|
|
5832
5816
|
if (v.keyCode !== 38 && v.keyCode !== 40)
|
|
5833
5817
|
return;
|
|
5834
5818
|
v.preventDefault(), E(!0);
|
|
5835
|
-
const
|
|
5836
|
-
let B = isNaN$1(
|
|
5819
|
+
const N = parseInt$1(v.target.value);
|
|
5820
|
+
let B = isNaN$1(N) ? 0 : N;
|
|
5837
5821
|
v.keyCode === 38 && (B += 1), v.keyCode === 40 && (B -= 1);
|
|
5838
|
-
const A = `${B}`, L = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${
|
|
5839
|
-
|
|
5822
|
+
const A = `${B}`, L = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5823
|
+
S(L);
|
|
5840
5824
|
},
|
|
5841
5825
|
onKeyUp: (v) => {
|
|
5842
5826
|
j && (v.preventDefault(), E(!1));
|
|
5843
5827
|
},
|
|
5844
|
-
onBlur: () =>
|
|
5828
|
+
onBlur: () => I(),
|
|
5845
5829
|
onChange: (v) => {
|
|
5846
|
-
|
|
5830
|
+
g(!1), l(v.target.value);
|
|
5847
5831
|
},
|
|
5848
5832
|
onClick: (v) => {
|
|
5849
|
-
var
|
|
5850
|
-
(
|
|
5833
|
+
var N;
|
|
5834
|
+
(N = v == null ? void 0 : v.target) == null || N.select(), r(!1);
|
|
5851
5835
|
},
|
|
5852
5836
|
value: R ? b : a,
|
|
5853
5837
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -5864,7 +5848,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5864
5848
|
onClick: () => r(!n),
|
|
5865
5849
|
className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
|
|
5866
5850
|
children: [
|
|
5867
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children:
|
|
5851
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: h }),
|
|
5868
5852
|
u.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
|
|
5869
5853
|
]
|
|
5870
5854
|
}
|
|
@@ -5873,7 +5857,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5873
5857
|
UnitSelection,
|
|
5874
5858
|
{
|
|
5875
5859
|
units: u,
|
|
5876
|
-
current:
|
|
5860
|
+
current: h,
|
|
5877
5861
|
onSelect: (v) => {
|
|
5878
5862
|
r(!1), m(v), P(v);
|
|
5879
5863
|
}
|
|
@@ -5881,25 +5865,25 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5881
5865
|
) }) })
|
|
5882
5866
|
] })
|
|
5883
5867
|
] }),
|
|
5884
|
-
["none", "auto"].indexOf(
|
|
5868
|
+
["none", "auto"].indexOf(h) !== -1 || R ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5885
5869
|
DragStyleButton,
|
|
5886
5870
|
{
|
|
5887
|
-
onDragStart: () =>
|
|
5871
|
+
onDragStart: () => w(!0),
|
|
5888
5872
|
onDragEnd: (v) => {
|
|
5889
|
-
if (y(() => ""),
|
|
5873
|
+
if (y(() => ""), w(!1), isEmpty(v))
|
|
5890
5874
|
return;
|
|
5891
|
-
const
|
|
5875
|
+
const N = `${v}`, A = `${N.startsWith("-") ? "-" : ""}${d}[${N.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5892
5876
|
k(A);
|
|
5893
5877
|
},
|
|
5894
5878
|
onDrag: (v) => {
|
|
5895
5879
|
if (isEmpty(v))
|
|
5896
5880
|
return;
|
|
5897
5881
|
y(v);
|
|
5898
|
-
const
|
|
5899
|
-
|
|
5882
|
+
const N = `${v}`, A = `${N.startsWith("-") ? "-" : ""}${d}[${N.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5883
|
+
S(A);
|
|
5900
5884
|
},
|
|
5901
5885
|
currentValue: a,
|
|
5902
|
-
unit:
|
|
5886
|
+
unit: h,
|
|
5903
5887
|
negative: x,
|
|
5904
5888
|
cssProperty: p
|
|
5905
5889
|
}
|
|
@@ -5993,22 +5977,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
5993
5977
|
"2xl": "1536px"
|
|
5994
5978
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
5995
5979
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
5996
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(),
|
|
5997
|
-
(
|
|
5998
|
-
const P = { dark: p, mq: x, mod: u, cls:
|
|
5980
|
+
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), b = useMemo(() => get(h, "fullCls", ""), [h]), y = useCallback(
|
|
5981
|
+
(S, I = !0) => {
|
|
5982
|
+
const P = { dark: p, mq: x, mod: u, cls: S, property: l, fullCls: "" };
|
|
5999
5983
|
(p || u !== "") && (P.mq = "xs");
|
|
6000
5984
|
const v = generateFullClsName(P);
|
|
6001
|
-
m(
|
|
5985
|
+
m(g, [v], I);
|
|
6002
5986
|
},
|
|
6003
|
-
[
|
|
5987
|
+
[g, p, x, u, l, m]
|
|
6004
5988
|
), R = useCallback(() => {
|
|
6005
|
-
f(
|
|
6006
|
-
}, [
|
|
5989
|
+
f(g, [b]);
|
|
5990
|
+
}, [g, b, f]), w = useMemo(() => canChangeClass(h, x), [h, x]);
|
|
6007
5991
|
useEffect(() => {
|
|
6008
|
-
i(
|
|
6009
|
-
}, [
|
|
5992
|
+
i(w, h);
|
|
5993
|
+
}, [w, i, h]);
|
|
6010
5994
|
const [, , j] = useCanvasWidth(), E = useCallback(
|
|
6011
|
-
(
|
|
5995
|
+
(S) => {
|
|
6012
5996
|
j({
|
|
6013
5997
|
xs: 400,
|
|
6014
5998
|
sm: 640,
|
|
@@ -6016,18 +6000,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6016
6000
|
lg: 1024,
|
|
6017
6001
|
xl: 1420,
|
|
6018
6002
|
"2xl": 1920
|
|
6019
|
-
}[
|
|
6003
|
+
}[S]);
|
|
6020
6004
|
},
|
|
6021
6005
|
[j]
|
|
6022
|
-
), k = get(
|
|
6023
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6024
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${
|
|
6006
|
+
), k = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
|
|
6007
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: h && k, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6008
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !k ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6025
6009
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6026
6010
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6027
6011
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6028
6012
|
AdvanceChoices,
|
|
6029
6013
|
{
|
|
6030
|
-
currentClass: get(
|
|
6014
|
+
currentClass: get(h, "cls", ""),
|
|
6031
6015
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6032
6016
|
units: c || [],
|
|
6033
6017
|
onChange: y,
|
|
@@ -6040,7 +6024,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6040
6024
|
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: y }),
|
|
6041
6025
|
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: y })
|
|
6042
6026
|
] }),
|
|
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" }) }) :
|
|
6027
|
+
/* @__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" }) }) : w && h ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6044
6028
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6045
6029
|
"button",
|
|
6046
6030
|
{
|
|
@@ -6052,19 +6036,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6052
6036
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
6053
6037
|
"Current style is set at ",
|
|
6054
6038
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
|
|
6055
|
-
getBreakpoint(get(
|
|
6056
|
-
p && !
|
|
6039
|
+
getBreakpoint(get(h, "mq")),
|
|
6040
|
+
p && !h.dark ? "(Light mode)" : ""
|
|
6057
6041
|
] }),
|
|
6058
6042
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
6059
6043
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6060
6044
|
"button",
|
|
6061
6045
|
{
|
|
6062
6046
|
type: "button",
|
|
6063
|
-
onClick: () => E(get(
|
|
6047
|
+
onClick: () => E(get(h, "mq")),
|
|
6064
6048
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6065
6049
|
children: [
|
|
6066
6050
|
"Switch to ",
|
|
6067
|
-
get(
|
|
6051
|
+
get(h, "mq").toUpperCase()
|
|
6068
6052
|
]
|
|
6069
6053
|
}
|
|
6070
6054
|
)
|
|
@@ -6081,7 +6065,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6081
6065
|
units: i = basicUnits,
|
|
6082
6066
|
negative: c = !1
|
|
6083
6067
|
}) => {
|
|
6084
|
-
const { t: d } = useTranslation(), [p, u] = useState(n[0].key), x = useSelectedBlockCurrentClasses(),
|
|
6068
|
+
const { t: d } = useTranslation(), [p, u] = useState(n[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(x, "property").includes(m), [x]);
|
|
6085
6069
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6086
6070
|
"div",
|
|
6087
6071
|
{
|
|
@@ -6099,7 +6083,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6099
6083
|
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6100
6084
|
children: [
|
|
6101
6085
|
React__default.createElement("div", {
|
|
6102
|
-
className:
|
|
6086
|
+
className: h(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6103
6087
|
}),
|
|
6104
6088
|
React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6105
6089
|
]
|
|
@@ -6244,13 +6228,13 @@ function BlockStyling() {
|
|
|
6244
6228
|
cssProperty: ""
|
|
6245
6229
|
}), d = useThrottledCallback(
|
|
6246
6230
|
(u) => {
|
|
6247
|
-
const x = !get(i, "negative", !1),
|
|
6231
|
+
const x = !get(i, "negative", !1), h = get(i, "cssProperty", "");
|
|
6248
6232
|
let m = parseFloat(i.dragStartValue);
|
|
6249
6233
|
m = isNaN(m) ? 0 : m;
|
|
6250
6234
|
let f = MAPPER[i.dragUnit];
|
|
6251
|
-
(startsWith(
|
|
6235
|
+
(startsWith(h, "scale") || h === "opacity") && (f = 10);
|
|
6252
6236
|
let b = (i.dragStartY - u.pageY) / f + m;
|
|
6253
|
-
x && b < 0 && (b = 0),
|
|
6237
|
+
x && b < 0 && (b = 0), h === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
|
|
6254
6238
|
},
|
|
6255
6239
|
[i],
|
|
6256
6240
|
50
|
|
@@ -6292,14 +6276,14 @@ const CoreBlock = ({
|
|
|
6292
6276
|
parentId: r,
|
|
6293
6277
|
position: a
|
|
6294
6278
|
}) => {
|
|
6295
|
-
const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight:
|
|
6279
|
+
const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
|
|
6296
6280
|
if (has(o, "blocks")) {
|
|
6297
6281
|
const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
6298
6282
|
u(syncBlocksWithDefaults(b), r || null, a);
|
|
6299
6283
|
} else
|
|
6300
6284
|
p(o, r || null, a);
|
|
6301
6285
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6302
|
-
}, f = useFeature("dnd"), { t:
|
|
6286
|
+
}, f = useFeature("dnd"), { t: g } = useTranslation();
|
|
6303
6287
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6304
6288
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6305
6289
|
"button",
|
|
@@ -6309,18 +6293,18 @@ const CoreBlock = ({
|
|
|
6309
6293
|
type: "button",
|
|
6310
6294
|
onDragStart: (b) => {
|
|
6311
6295
|
b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
6312
|
-
x([]),
|
|
6296
|
+
x([]), h();
|
|
6313
6297
|
}, 200);
|
|
6314
6298
|
},
|
|
6315
6299
|
draggable: f ? "true" : "false",
|
|
6316
6300
|
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",
|
|
6317
6301
|
children: [
|
|
6318
6302
|
createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
6319
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
6303
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(g(d || i)) })
|
|
6320
6304
|
]
|
|
6321
6305
|
}
|
|
6322
6306
|
) }),
|
|
6323
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
6307
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g(d || i) }) })
|
|
6324
6308
|
] }) });
|
|
6325
6309
|
}, hasVideoEmbed = (o) => {
|
|
6326
6310
|
const n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, r = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
@@ -6489,7 +6473,7 @@ const CoreBlock = ({
|
|
|
6489
6473
|
}
|
|
6490
6474
|
}
|
|
6491
6475
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
6492
|
-
var
|
|
6476
|
+
var h, m, f, g, b, y, R, w;
|
|
6493
6477
|
if (r.type === "comment") return [];
|
|
6494
6478
|
console.log("node ===>", r);
|
|
6495
6479
|
let a = { _id: generateUUID() };
|
|
@@ -6530,10 +6514,10 @@ const CoreBlock = ({
|
|
|
6530
6514
|
];
|
|
6531
6515
|
a = {
|
|
6532
6516
|
...a,
|
|
6533
|
-
href: ((
|
|
6517
|
+
href: ((h = l.find((E) => E.key === "href")) == null ? void 0 : h.value) || "",
|
|
6534
6518
|
hrefType: ((m = l.find((E) => E.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
6535
6519
|
autoplay: ((f = l.find((E) => E.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
|
|
6536
|
-
maxWidth: ((b = (
|
|
6520
|
+
maxWidth: ((b = (g = l.find((E) => E.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : b.replace("px", "")) || "",
|
|
6537
6521
|
backdropColor: ((y = l.find((E) => E.key === "data-overlay")) == null ? void 0 : y.value) || "",
|
|
6538
6522
|
galleryName: ((R = l.find((E) => E.key === "data-gall")) == null ? void 0 : R.value) || ""
|
|
6539
6523
|
}, forEach(j, (E) => {
|
|
@@ -6546,14 +6530,14 @@ const CoreBlock = ({
|
|
|
6546
6530
|
a.content = getTextContent(j);
|
|
6547
6531
|
const E = find(
|
|
6548
6532
|
r.children || [],
|
|
6549
|
-
(k) => (k == null ? void 0 : k.tagName) === "span" && some(k.children || [], (
|
|
6533
|
+
(k) => (k == null ? void 0 : k.tagName) === "span" && some(k.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg")
|
|
6550
6534
|
);
|
|
6551
6535
|
if (E) {
|
|
6552
|
-
const k = find(E.children || [], (
|
|
6536
|
+
const k = find(E.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg");
|
|
6553
6537
|
if (k) {
|
|
6554
6538
|
a.icon = stringify([k]);
|
|
6555
|
-
const { height:
|
|
6556
|
-
a.iconHeight =
|
|
6539
|
+
const { height: S, width: I } = getSvgDimensions(k, "16px", "16px");
|
|
6540
|
+
a.iconHeight = S, a.iconWidth = I;
|
|
6557
6541
|
}
|
|
6558
6542
|
}
|
|
6559
6543
|
return [a];
|
|
@@ -6565,9 +6549,9 @@ const CoreBlock = ({
|
|
|
6565
6549
|
const j = stringify([r]);
|
|
6566
6550
|
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];
|
|
6567
6551
|
} else if (r.tagName === "svg") {
|
|
6568
|
-
const j = find(r.attributes, { key: "height" }), E = find(r.attributes, { key: "width" }), k = get(j, "value") ? `[${get(j, "value")}px]` : "24px",
|
|
6569
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${
|
|
6570
|
-
} else if (r.tagName == "option" && n && ((
|
|
6552
|
+
const j = find(r.attributes, { key: "height" }), E = find(r.attributes, { key: "width" }), k = get(j, "value") ? `[${get(j, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", I = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
6553
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${S} h-${k}`, I)}`.trim(), r.attributes = filter(r.attributes, (P) => !includes(["style", "width", "height", "class"], P.key)), a.icon = stringify([r]), [a];
|
|
6554
|
+
} else if (r.tagName == "option" && n && ((w = n.block) == null ? void 0 : w._type) === "Select")
|
|
6571
6555
|
return n.block.options.push({
|
|
6572
6556
|
label: getTextContent(r.children),
|
|
6573
6557
|
...getAttrs(r)
|
|
@@ -6670,8 +6654,8 @@ const CoreBlock = ({
|
|
|
6670
6654
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6671
6655
|
Tabs,
|
|
6672
6656
|
{
|
|
6673
|
-
onValueChange: (
|
|
6674
|
-
d(""), c(
|
|
6657
|
+
onValueChange: (h) => {
|
|
6658
|
+
d(""), c(h);
|
|
6675
6659
|
},
|
|
6676
6660
|
value: i,
|
|
6677
6661
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
@@ -6680,12 +6664,12 @@ const CoreBlock = ({
|
|
|
6680
6664
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: l("Library") }),
|
|
6681
6665
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
6682
6666
|
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
6683
|
-
map(u, (
|
|
6667
|
+
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: h.key, children: React__default.createElement(h.tab) }))
|
|
6684
6668
|
] }),
|
|
6685
6669
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "-mx-1.5 h-full max-h-full overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
6686
6670
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
6687
6671
|
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
6688
|
-
map(u, (
|
|
6672
|
+
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x, parentId: r, position: a }) }))
|
|
6689
6673
|
]
|
|
6690
6674
|
}
|
|
6691
6675
|
)
|
|
@@ -6742,9 +6726,9 @@ const BlockCard = ({
|
|
|
6742
6726
|
parentId: r = void 0,
|
|
6743
6727
|
position: a = -1
|
|
6744
6728
|
}) => {
|
|
6745
|
-
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(),
|
|
6746
|
-
const
|
|
6747
|
-
return R._type === "Box" &&
|
|
6729
|
+
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), g = (R) => {
|
|
6730
|
+
const w = has(R, "styles_attrs.data-page-section");
|
|
6731
|
+
return R._type === "Box" && w;
|
|
6748
6732
|
}, b = useCallback(
|
|
6749
6733
|
async (R) => {
|
|
6750
6734
|
if (R.stopPropagation(), has(o, "component")) {
|
|
@@ -6752,15 +6736,15 @@ const BlockCard = ({
|
|
|
6752
6736
|
return;
|
|
6753
6737
|
}
|
|
6754
6738
|
i(!0);
|
|
6755
|
-
const
|
|
6756
|
-
isEmpty(
|
|
6739
|
+
const w = await c(n, o);
|
|
6740
|
+
isEmpty(w) || p(syncBlocksWithDefaults(w), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6757
6741
|
},
|
|
6758
6742
|
[d, p, o, c, n, r, a]
|
|
6759
6743
|
), y = async (R) => {
|
|
6760
|
-
const
|
|
6744
|
+
const w = await c(n, o);
|
|
6761
6745
|
let j = r;
|
|
6762
|
-
if (
|
|
6763
|
-
const E = { blocks:
|
|
6746
|
+
if (g(first(w)) && (j = null), !isEmpty(w)) {
|
|
6747
|
+
const E = { blocks: w, uiLibrary: !0, parent: j };
|
|
6764
6748
|
if (R.dataTransfer.setData("text/plain", JSON.stringify(E)), o.preview) {
|
|
6765
6749
|
const k = new Image();
|
|
6766
6750
|
k.src = o.preview, k.onload = () => {
|
|
@@ -6789,11 +6773,11 @@ const BlockCard = ({
|
|
|
6789
6773
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
|
|
6790
6774
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
6791
6775
|
] }),
|
|
6792
|
-
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt:
|
|
6776
|
+
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: h }) : /* @__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: h }) })
|
|
6793
6777
|
]
|
|
6794
6778
|
}
|
|
6795
6779
|
) }),
|
|
6796
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
6780
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: h }) })
|
|
6797
6781
|
] });
|
|
6798
6782
|
}, libraryBlocksAtom = atom$1(
|
|
6799
6783
|
{}
|
|
@@ -6808,9 +6792,9 @@ const BlockCard = ({
|
|
|
6808
6792
|
})();
|
|
6809
6793
|
}, [o, l, i, c, r, a]), { data: l || [], isLoading: i === "loading" };
|
|
6810
6794
|
}, UILibrarySection = ({ parentId: o, position: n }) => {
|
|
6811
|
-
const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((j) => j.category === "custom"), d = l.find((j) => j.uuid === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), x = groupBy([...p, ...c], "group"), [
|
|
6812
|
-
|
|
6813
|
-
|
|
6795
|
+
const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((j) => j.category === "custom"), d = l.find((j) => j.uuid === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), x = groupBy([...p, ...c], "group"), [h, m] = useState("Hero"), f = get(x, h, []), g = useRef(null), { t: b } = useTranslation(), y = (j) => {
|
|
6796
|
+
g.current && (clearTimeout(g.current), g.current = null), g.current = setTimeout(() => {
|
|
6797
|
+
g.current && m(j);
|
|
6814
6798
|
}, 300);
|
|
6815
6799
|
};
|
|
6816
6800
|
if (u)
|
|
@@ -6818,7 +6802,7 @@ const BlockCard = ({
|
|
|
6818
6802
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
6819
6803
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
6820
6804
|
] });
|
|
6821
|
-
const R = filter(f, (j, E) => E % 2 === 0),
|
|
6805
|
+
const R = filter(f, (j, E) => E % 2 === 0), w = filter(f, (j, E) => E % 2 === 1);
|
|
6822
6806
|
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: [
|
|
6823
6807
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
6824
6808
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
|
|
@@ -6830,11 +6814,11 @@ const BlockCard = ({
|
|
|
6830
6814
|
"div",
|
|
6831
6815
|
{
|
|
6832
6816
|
onMouseEnter: () => y(E),
|
|
6833
|
-
onMouseLeave: () => clearTimeout(
|
|
6817
|
+
onMouseLeave: () => clearTimeout(g.current),
|
|
6834
6818
|
onClick: () => m(E),
|
|
6835
6819
|
className: cn(
|
|
6836
6820
|
"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",
|
|
6837
|
-
E ===
|
|
6821
|
+
E === h ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
6838
6822
|
),
|
|
6839
6823
|
children: [
|
|
6840
6824
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(E.toLowerCase())) }),
|
|
@@ -6849,7 +6833,7 @@ const BlockCard = ({
|
|
|
6849
6833
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6850
6834
|
ScrollArea,
|
|
6851
6835
|
{
|
|
6852
|
-
onMouseEnter: () =>
|
|
6836
|
+
onMouseEnter: () => g.current ? clearTimeout(g.current) : null,
|
|
6853
6837
|
className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
|
|
6854
6838
|
children: [
|
|
6855
6839
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
@@ -6857,7 +6841,7 @@ const BlockCard = ({
|
|
|
6857
6841
|
R.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: n, block: j, library: d }))
|
|
6858
6842
|
) }),
|
|
6859
6843
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
6860
|
-
|
|
6844
|
+
w.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: n, block: j, library: d }))
|
|
6861
6845
|
) })
|
|
6862
6846
|
] }),
|
|
6863
6847
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7080,50 +7064,50 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7080
7064
|
var L;
|
|
7081
7065
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
7082
7066
|
let p = null;
|
|
7083
|
-
const u = o.children.length > 0, { highlightBlock: x, clearHighlight:
|
|
7084
|
-
|
|
7085
|
-
}, E = (
|
|
7086
|
-
|
|
7087
|
-
}, k = (
|
|
7088
|
-
|
|
7089
|
-
}, [
|
|
7090
|
-
var
|
|
7091
|
-
v(), o.parent.isSelected ||
|
|
7067
|
+
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: g, willReceiveDrop: b, isDragging: y, isEditing: R, handleClick: w } = o, j = (C) => {
|
|
7068
|
+
C.stopPropagation(), !i.includes(m) && o.toggle();
|
|
7069
|
+
}, E = (C) => {
|
|
7070
|
+
C.isInternal && (p = C.isOpen, C.isOpen && C.close());
|
|
7071
|
+
}, k = (C) => {
|
|
7072
|
+
C.isInternal && p !== null && (p ? C.open() : C.close(), p = null);
|
|
7073
|
+
}, [S, I] = useAtom$1(currentAddSelection), P = () => {
|
|
7074
|
+
var C;
|
|
7075
|
+
v(), o.parent.isSelected || I((C = o == null ? void 0 : o.parent) == null ? void 0 : C.id);
|
|
7092
7076
|
}, v = () => {
|
|
7093
|
-
|
|
7094
|
-
},
|
|
7095
|
-
v(),
|
|
7077
|
+
I(null);
|
|
7078
|
+
}, N = (C) => {
|
|
7079
|
+
v(), C.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), w(C);
|
|
7096
7080
|
};
|
|
7097
7081
|
useEffect(() => {
|
|
7098
|
-
const
|
|
7082
|
+
const C = setTimeout(() => {
|
|
7099
7083
|
b && !o.isOpen && !y && !i.includes(m) && o.toggle();
|
|
7100
7084
|
}, 500);
|
|
7101
|
-
return () => clearTimeout(
|
|
7085
|
+
return () => clearTimeout(C);
|
|
7102
7086
|
}, [b, o, y]);
|
|
7103
7087
|
const B = useMemo(() => {
|
|
7104
|
-
const
|
|
7105
|
-
for (let D = 0; D <
|
|
7106
|
-
if (
|
|
7107
|
-
const $ = f[
|
|
7108
|
-
|
|
7088
|
+
const C = Object.keys(f), T = [];
|
|
7089
|
+
for (let D = 0; D < C.length; D++)
|
|
7090
|
+
if (C[D].endsWith("_attrs")) {
|
|
7091
|
+
const $ = f[C[D]], H = Object.keys($).join("|");
|
|
7092
|
+
H.match(/x-data/) && T.push("data"), H.match(/x-on/) && T.push("event"), H.match(/x-show|x-if/) && T.push("show");
|
|
7109
7093
|
}
|
|
7110
7094
|
return T;
|
|
7111
|
-
}, [f]), A = (
|
|
7112
|
-
const D = d.contentDocument || d.contentWindow.document, $ = D.querySelector(`[data-block-id=${
|
|
7095
|
+
}, [f]), A = (C, T) => {
|
|
7096
|
+
const D = d.contentDocument || d.contentWindow.document, $ = D.querySelector(`[data-block-id=${C}]`);
|
|
7113
7097
|
$ && $.setAttribute("data-drop", T);
|
|
7114
|
-
const
|
|
7115
|
-
|
|
7116
|
-
},
|
|
7098
|
+
const H = $.getBoundingClientRect(), M = d.getBoundingClientRect();
|
|
7099
|
+
H.top >= M.top && H.left >= M.left && H.bottom <= M.bottom && H.right <= M.right || (D.documentElement.scrollTop = $.offsetTop - M.top);
|
|
7100
|
+
}, _ = (C) => {
|
|
7117
7101
|
v();
|
|
7118
7102
|
const T = get(o, "parent.id");
|
|
7119
|
-
T !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: T, position:
|
|
7103
|
+
T !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: T, position: C }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: C });
|
|
7120
7104
|
};
|
|
7121
7105
|
return m === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
7122
7106
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
7123
7107
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7124
7108
|
"div",
|
|
7125
7109
|
{
|
|
7126
|
-
onClick: () =>
|
|
7110
|
+
onClick: () => _(-1),
|
|
7127
7111
|
className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
|
|
7128
7112
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-purple-500 px-3 py-1 text-[9px] leading-tight text-white hover:bg-purple-500", children: [
|
|
7129
7113
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
|
|
@@ -7137,28 +7121,28 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7137
7121
|
"div",
|
|
7138
7122
|
{
|
|
7139
7123
|
onMouseEnter: () => x(m),
|
|
7140
|
-
onMouseLeave: () =>
|
|
7141
|
-
onClick:
|
|
7124
|
+
onMouseLeave: () => h(),
|
|
7125
|
+
onClick: N,
|
|
7142
7126
|
style: n,
|
|
7143
7127
|
"data-node-id": m,
|
|
7144
7128
|
ref: i.includes(m) ? null : r,
|
|
7145
7129
|
onDragStart: () => E(o),
|
|
7146
7130
|
onDragEnd: () => k(o),
|
|
7147
|
-
onDragOver: (
|
|
7148
|
-
|
|
7131
|
+
onDragOver: (C) => {
|
|
7132
|
+
C.preventDefault(), A(m, "yes");
|
|
7149
7133
|
},
|
|
7150
|
-
onDragLeave: (
|
|
7151
|
-
|
|
7134
|
+
onDragLeave: (C) => {
|
|
7135
|
+
C.preventDefault(), A(m, "no");
|
|
7152
7136
|
},
|
|
7153
|
-
onDrop: (
|
|
7154
|
-
|
|
7137
|
+
onDrop: (C) => {
|
|
7138
|
+
C.preventDefault(), A(m, "no");
|
|
7155
7139
|
},
|
|
7156
7140
|
children: [
|
|
7157
7141
|
(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(
|
|
7158
7142
|
"div",
|
|
7159
7143
|
{
|
|
7160
|
-
onClick: (
|
|
7161
|
-
|
|
7144
|
+
onClick: (C) => {
|
|
7145
|
+
C.stopPropagation(), _(o.childIndex);
|
|
7162
7146
|
},
|
|
7163
7147
|
onMouseEnter: P,
|
|
7164
7148
|
onMouseLeave: v,
|
|
@@ -7171,9 +7155,9 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7171
7155
|
{
|
|
7172
7156
|
className: cn(
|
|
7173
7157
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
|
|
7174
|
-
|
|
7158
|
+
g ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
|
|
7175
7159
|
b && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
|
|
7176
|
-
(o == null ? void 0 : o.id) ===
|
|
7160
|
+
(o == null ? void 0 : o.id) === S ? "bg-purple-100" : "",
|
|
7177
7161
|
y && "opacity-20",
|
|
7178
7162
|
i.includes(m) ? "opacity-50" : ""
|
|
7179
7163
|
),
|
|
@@ -7186,7 +7170,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7186
7170
|
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7187
7171
|
ChevronRight,
|
|
7188
7172
|
{
|
|
7189
|
-
className: `h-3 w-3 stroke-[3] ${
|
|
7173
|
+
className: `h-3 w-3 stroke-[3] ${g ? "text-slate-200" : "text-slate-400"}`
|
|
7190
7174
|
}
|
|
7191
7175
|
) })
|
|
7192
7176
|
}
|
|
@@ -7197,8 +7181,8 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7197
7181
|
"div",
|
|
7198
7182
|
{
|
|
7199
7183
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
7200
|
-
onDoubleClick: (
|
|
7201
|
-
|
|
7184
|
+
onDoubleClick: (C) => {
|
|
7185
|
+
C.stopPropagation(), o.edit(), o.deselect();
|
|
7202
7186
|
},
|
|
7203
7187
|
children: [
|
|
7204
7188
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (f == null ? void 0 : f._name) || (f == null ? void 0 : f._type.split("/").pop()) }),
|
|
@@ -7211,16 +7195,16 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7211
7195
|
] })
|
|
7212
7196
|
] }),
|
|
7213
7197
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
|
|
7214
|
-
!i.includes(m) && a.map((
|
|
7198
|
+
!i.includes(m) && a.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7215
7199
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7216
7200
|
TooltipTrigger,
|
|
7217
7201
|
{
|
|
7218
7202
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
7219
7203
|
asChild: !0,
|
|
7220
|
-
children: React__default.createElement(
|
|
7204
|
+
children: React__default.createElement(C.item, { blockId: m })
|
|
7221
7205
|
}
|
|
7222
7206
|
),
|
|
7223
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children:
|
|
7207
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: C.tooltip })
|
|
7224
7208
|
] })),
|
|
7225
7209
|
canAddChildBlock(f == null ? void 0 : f._type) && !i.includes(m) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7226
7210
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -7238,8 +7222,8 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7238
7222
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7239
7223
|
TooltipTrigger,
|
|
7240
7224
|
{
|
|
7241
|
-
onClick: (
|
|
7242
|
-
|
|
7225
|
+
onClick: (C) => {
|
|
7226
|
+
C.stopPropagation(), c(m), o.isOpen && o.toggle();
|
|
7243
7227
|
},
|
|
7244
7228
|
className: "cursor-pointer rounded bg-transparent hover:text-black",
|
|
7245
7229
|
asChild: !0,
|
|
@@ -7899,13 +7883,13 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7899
7883
|
) }) });
|
|
7900
7884
|
}
|
|
7901
7885
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7902
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(),
|
|
7886
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), h = useRef(null), m = useRef(null);
|
|
7903
7887
|
useEffect(() => {
|
|
7904
|
-
var
|
|
7905
|
-
(
|
|
7888
|
+
var g;
|
|
7889
|
+
(g = h.current) == null || g.focus();
|
|
7906
7890
|
}, []);
|
|
7907
|
-
const f = (
|
|
7908
|
-
const { usage: b } =
|
|
7891
|
+
const f = (g) => {
|
|
7892
|
+
const { usage: b } = g || {};
|
|
7909
7893
|
!l && b && x(b), m.current = setTimeout(() => x(void 0), 1e4), l || c("");
|
|
7910
7894
|
};
|
|
7911
7895
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
@@ -7924,14 +7908,14 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7924
7908
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7925
7909
|
Textarea,
|
|
7926
7910
|
{
|
|
7927
|
-
ref:
|
|
7911
|
+
ref: h,
|
|
7928
7912
|
value: i,
|
|
7929
|
-
onChange: (
|
|
7913
|
+
onChange: (g) => c(g.target.value),
|
|
7930
7914
|
placeholder: n("Ask AI to edit content"),
|
|
7931
7915
|
className: "w-full",
|
|
7932
7916
|
rows: 3,
|
|
7933
|
-
onKeyDown: (
|
|
7934
|
-
|
|
7917
|
+
onKeyDown: (g) => {
|
|
7918
|
+
g.key === "Enter" && (g.preventDefault(), m.current && clearTimeout(m.current), x(void 0), r("content", o, i, f));
|
|
7935
7919
|
}
|
|
7936
7920
|
}
|
|
7937
7921
|
),
|
|
@@ -7973,8 +7957,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7973
7957
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7974
7958
|
QuickPrompts,
|
|
7975
7959
|
{
|
|
7976
|
-
onClick: (
|
|
7977
|
-
m.current && clearTimeout(m.current), x(void 0), r("content", o,
|
|
7960
|
+
onClick: (g) => {
|
|
7961
|
+
m.current && clearTimeout(m.current), x(void 0), r("content", o, g, f);
|
|
7978
7962
|
}
|
|
7979
7963
|
}
|
|
7980
7964
|
)
|
|
@@ -7984,19 +7968,19 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7984
7968
|
] }) }) : null
|
|
7985
7969
|
] });
|
|
7986
7970
|
}, AISetContext = () => {
|
|
7987
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast:
|
|
7971
|
+
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: h } = useToast(), m = useRef(null);
|
|
7988
7972
|
useEffect(() => {
|
|
7989
7973
|
n && a(n);
|
|
7990
7974
|
}, [n]);
|
|
7991
7975
|
const f = async () => {
|
|
7992
7976
|
try {
|
|
7993
|
-
d(!0), u(null), await i(r),
|
|
7977
|
+
d(!0), u(null), await i(r), h({
|
|
7994
7978
|
title: o("Updated AI Context"),
|
|
7995
7979
|
description: o("You can now Ask AI to edit your content"),
|
|
7996
7980
|
variant: "default"
|
|
7997
7981
|
}), m.current.click();
|
|
7998
|
-
} catch (
|
|
7999
|
-
u(
|
|
7982
|
+
} catch (g) {
|
|
7983
|
+
u(g);
|
|
8000
7984
|
} finally {
|
|
8001
7985
|
d(!1);
|
|
8002
7986
|
}
|
|
@@ -8004,8 +7988,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8004
7988
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8005
7989
|
Accordion,
|
|
8006
7990
|
{
|
|
8007
|
-
onValueChange: (
|
|
8008
|
-
x(
|
|
7991
|
+
onValueChange: (g) => {
|
|
7992
|
+
x(g !== "");
|
|
8009
7993
|
},
|
|
8010
7994
|
type: "single",
|
|
8011
7995
|
collapsible: !0,
|
|
@@ -8017,12 +8001,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8017
8001
|
{
|
|
8018
8002
|
ref: l,
|
|
8019
8003
|
value: r,
|
|
8020
|
-
onChange: (
|
|
8004
|
+
onChange: (g) => a(g.target.value),
|
|
8021
8005
|
placeholder: o("Tell about this page eg this page is about"),
|
|
8022
8006
|
className: "mt-1 w-full",
|
|
8023
8007
|
rows: 10,
|
|
8024
|
-
onKeyDown: (
|
|
8025
|
-
|
|
8008
|
+
onKeyDown: (g) => {
|
|
8009
|
+
g.key === "Enter" && (g.preventDefault(), f());
|
|
8026
8010
|
}
|
|
8027
8011
|
}
|
|
8028
8012
|
),
|
|
@@ -8317,7 +8301,7 @@ const ClearCanvas = () => {
|
|
|
8317
8301
|
] })
|
|
8318
8302
|
] });
|
|
8319
8303
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
8320
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [
|
|
8304
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h, m] = useState(""), f = useRef(null), g = useRef(null);
|
|
8321
8305
|
useEffect(() => {
|
|
8322
8306
|
l(n);
|
|
8323
8307
|
}, [n]);
|
|
@@ -8331,11 +8315,11 @@ const ClearCanvas = () => {
|
|
|
8331
8315
|
r(E), l(a), c(""), p(""), m("");
|
|
8332
8316
|
}
|
|
8333
8317
|
}, y = (E) => {
|
|
8334
|
-
const k = a.filter((
|
|
8318
|
+
const k = a.filter((S, I) => I !== E);
|
|
8335
8319
|
r(k), l(k);
|
|
8336
8320
|
}, R = (E) => {
|
|
8337
8321
|
x(E), c(a[E].key), p(a[E].value);
|
|
8338
|
-
},
|
|
8322
|
+
}, w = () => {
|
|
8339
8323
|
if (i.startsWith("@")) {
|
|
8340
8324
|
m("Attribute keys cannot start with '@'");
|
|
8341
8325
|
return;
|
|
@@ -8345,14 +8329,14 @@ const ClearCanvas = () => {
|
|
|
8345
8329
|
E[u] = { key: i, value: d }, r(E), l(E), x(null), c(""), p(""), m("");
|
|
8346
8330
|
}
|
|
8347
8331
|
}, j = (E) => {
|
|
8348
|
-
E.key === "Enter" && !E.shiftKey && (E.preventDefault(), u !== null ?
|
|
8332
|
+
E.key === "Enter" && !E.shiftKey && (E.preventDefault(), u !== null ? w() : b());
|
|
8349
8333
|
};
|
|
8350
8334
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
8351
8335
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8352
8336
|
"form",
|
|
8353
8337
|
{
|
|
8354
8338
|
onSubmit: (E) => {
|
|
8355
|
-
E.preventDefault(), u !== null ?
|
|
8339
|
+
E.preventDefault(), u !== null ? w() : b();
|
|
8356
8340
|
},
|
|
8357
8341
|
className: "space-y-3",
|
|
8358
8342
|
children: [
|
|
@@ -8384,7 +8368,7 @@ const ClearCanvas = () => {
|
|
|
8384
8368
|
spellCheck: "false",
|
|
8385
8369
|
id: "attrValue",
|
|
8386
8370
|
rows: 2,
|
|
8387
|
-
ref:
|
|
8371
|
+
ref: g,
|
|
8388
8372
|
value: d,
|
|
8389
8373
|
onChange: (E) => p(E.target.value),
|
|
8390
8374
|
onKeyDown: j,
|
|
@@ -8395,7 +8379,7 @@ const ClearCanvas = () => {
|
|
|
8395
8379
|
] })
|
|
8396
8380
|
] }),
|
|
8397
8381
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: !i.length, variant: "default", size: "sm", className: "h-8 w-24 text-xs", children: u !== null ? "Save" : "Add" }) }),
|
|
8398
|
-
|
|
8382
|
+
h && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: h })
|
|
8399
8383
|
]
|
|
8400
8384
|
}
|
|
8401
8385
|
),
|
|
@@ -8592,6 +8576,7 @@ function useSidebarMenuItems() {
|
|
|
8592
8576
|
{
|
|
8593
8577
|
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { size: 20 }),
|
|
8594
8578
|
label: "Outline",
|
|
8579
|
+
isInternal: !0,
|
|
8595
8580
|
component: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ListTree, {}) })
|
|
8596
8581
|
}
|
|
8597
8582
|
]), []);
|
|
@@ -8601,11 +8586,11 @@ const RootLayout = () => {
|
|
|
8601
8586
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
8602
8587
|
n(1);
|
|
8603
8588
|
});
|
|
8604
|
-
const c = useBuilderProp("sideBarComponents.top", []), d = useBuilderProp("sideBarComponents.bottom", []), p = (
|
|
8605
|
-
|
|
8606
|
-
}, u = (
|
|
8607
|
-
n(o ===
|
|
8608
|
-
}, x = useSidebarMenuItems(), { t:
|
|
8589
|
+
const c = useBuilderProp("sideBarComponents.top", []), d = useBuilderProp("sideBarComponents.bottom", []), p = (g) => {
|
|
8590
|
+
g.preventDefault();
|
|
8591
|
+
}, u = (g) => {
|
|
8592
|
+
n(o === g ? null : g);
|
|
8593
|
+
}, x = useSidebarMenuItems(), { t: h } = useTranslation(), m = [...x, ...c], f = useBuilderProp("htmlDir", "ltr");
|
|
8609
8594
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: f, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8610
8595
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8611
8596
|
"div",
|
|
@@ -8616,21 +8601,21 @@ const RootLayout = () => {
|
|
|
8616
8601
|
/* @__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, {}) }) }),
|
|
8617
8602
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8618
8603
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8619
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((
|
|
8604
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8620
8605
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8621
8606
|
Button,
|
|
8622
8607
|
{
|
|
8623
8608
|
variant: o === b ? "default" : "ghost",
|
|
8624
8609
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8625
8610
|
onClick: () => u(b),
|
|
8626
|
-
children: get(
|
|
8611
|
+
children: get(g, "icon", null)
|
|
8627
8612
|
},
|
|
8628
8613
|
b
|
|
8629
8614
|
) }),
|
|
8630
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g
|
|
8615
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: h(g.label) }) })
|
|
8631
8616
|
] }, "button" + b)) }),
|
|
8632
8617
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" }),
|
|
8633
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((
|
|
8618
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((g, b) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}), children: React__default.createElement(g, { key: b }) })) })
|
|
8634
8619
|
] }),
|
|
8635
8620
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8636
8621
|
motion.div,
|
|
@@ -8640,10 +8625,16 @@ const RootLayout = () => {
|
|
|
8640
8625
|
animate: { width: o !== null ? 280 : 0 },
|
|
8641
8626
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8642
8627
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
8643
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8628
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8629
|
+
"div",
|
|
8630
|
+
{
|
|
8631
|
+
className: `absolute top-2 z-50 flex h-10 items-center space-x-1 bg-white py-2 text-base font-bold ${get(m, `${o}.isInternal`, !1) ? "" : "w-64"}`,
|
|
8632
|
+
children: [
|
|
8633
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
8634
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: h(m[o].label) })
|
|
8635
|
+
]
|
|
8636
|
+
}
|
|
8637
|
+
),
|
|
8647
8638
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
|
|
8648
8639
|
] })
|
|
8649
8640
|
}
|
|
@@ -8663,11 +8654,11 @@ const RootLayout = () => {
|
|
|
8663
8654
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between gap-2", children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8664
8655
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
8665
8656
|
" ",
|
|
8666
|
-
|
|
8657
|
+
h("AI Assistant")
|
|
8667
8658
|
] }) }) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
8668
8659
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8669
8660
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
|
|
8670
|
-
|
|
8661
|
+
h("Theme Settings")
|
|
8671
8662
|
] }),
|
|
8672
8663
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8673
8664
|
Button,
|