@chaibuilder/sdk 1.2.102 → 1.2.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodeEditor-7Q9lFDq1.js → CodeEditor-NKqXoCPq.js} +1 -1
- package/dist/{CodeEditor-Z9tCJ_hE.cjs → CodeEditor-x97t1x8H.cjs} +1 -1
- package/dist/{Topbar-vTIW51su.cjs → Topbar-76FfrmEx.cjs} +1 -1
- package/dist/{Topbar-Uk6diO3g.js → Topbar-yEANMgiO.js} +1 -1
- package/dist/{UnsplashImages-jaKmRyo0.cjs → UnsplashImages-LpHbt_-q.cjs} +1 -1
- package/dist/{UnsplashImages-EGgHjvre.js → UnsplashImages-Z3xcNddA.js} +1 -1
- package/dist/{UploadImages-G6OulTS8.cjs → UploadImages-PYkTPdPr.cjs} +1 -1
- package/dist/{UploadImages-D43sz4A8.js → UploadImages-v50EQZLT.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-Mj5uWCca.cjs → index-K9hzPq-7.cjs} +5 -5
- package/dist/{index-bdrCoYdD.js → index-aV4x9E1G.js} +573 -569
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +1 -1
- package/dist/render.js +58 -58
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
7
|
import { a as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, P as Tooltip, Q as TooltipTrigger, R as TooltipContent, C as Card, z as CardHeader, G as CardDescription, H as CardContent, L as Label, T as Textarea, E as CardFooter, D as Dialog, t as DialogTrigger, u as DialogContent, v as DialogHeader, x as DialogTitle, y as DialogDescription, w as DialogFooter, W as Popover, X as PopoverTrigger, Y as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, K as Tabs, M as TabsList, N as TabsTrigger, O as TabsContent, d as Switch, A as Accordion, f as AccordionItem, g as AccordionTrigger, h as AccordionContent, ao as useToast, I as Input$1, V as TooltipPortal, a8 as DropdownMenu, a9 as DropdownMenuTrigger, aa as DropdownMenuContent, S as ScrollArea, ae as DropdownMenuLabel, af as DropdownMenuSeparator, ah as DropdownMenuGroup, ab as DropdownMenuItem, ag as DropdownMenuShortcut, k as AlertDialog, m as AlertDialogContent, n as AlertDialogHeader, p as AlertDialogTitle, l as AlertDialogTrigger, q as AlertDialogDescription, o as AlertDialogFooter, s as AlertDialogCancel, r as AlertDialogAction, ac as DropdownMenuCheckboxItem, Z as HoverCard, _ as HoverCardTrigger, $ as HoverCardContent, b as Separator, i as Badge, a0 as Select, a3 as SelectTrigger, a2 as SelectValue, a4 as SelectContent, a6 as SelectItem, U as TooltipProvider, aq as Toaster } from "./context-menu-YGd09SE1.js";
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
|
|
8
|
+
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
|
|
9
9
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
10
10
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
|
|
11
11
|
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
@@ -90,101 +90,101 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
90
90
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
91
91
|
let a, l, i;
|
|
92
92
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
93
|
-
const c = (
|
|
93
|
+
const c = (j) => o.get(j), d = (j, k) => {
|
|
94
94
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
|
|
95
|
-
const C = o.get(
|
|
96
|
-
if (o.set(
|
|
95
|
+
const C = o.get(j);
|
|
96
|
+
if (o.set(j, k), r.has(j) || r.set(j, C), C && hasPromiseAtomValue(C)) {
|
|
97
97
|
const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
|
|
98
98
|
cancelPromise(C.v, R);
|
|
99
99
|
}
|
|
100
|
-
}, u = (
|
|
100
|
+
}, u = (j, k, C) => {
|
|
101
101
|
const R = /* @__PURE__ */ new Map();
|
|
102
102
|
let I = !1;
|
|
103
103
|
C.forEach((L, P) => {
|
|
104
|
-
!L && P ===
|
|
104
|
+
!L && P === j && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
105
105
|
}), (I || k.d.size !== R.size) && (k.d = R);
|
|
106
|
-
}, p = (
|
|
107
|
-
const R = c(
|
|
106
|
+
}, p = (j, k, C) => {
|
|
107
|
+
const R = c(j), I = {
|
|
108
108
|
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
109
109
|
v: k
|
|
110
110
|
};
|
|
111
|
-
if (C && u(
|
|
111
|
+
if (C && u(j, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
|
|
112
112
|
return R;
|
|
113
113
|
if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
|
|
114
114
|
if (R.d === I.d)
|
|
115
115
|
return R;
|
|
116
116
|
I.v = R.v;
|
|
117
117
|
}
|
|
118
|
-
return d(
|
|
119
|
-
},
|
|
118
|
+
return d(j, I), I;
|
|
119
|
+
}, m = (j, k, C, R) => {
|
|
120
120
|
if (isPromiseLike$2(k)) {
|
|
121
121
|
let I;
|
|
122
122
|
const L = new Promise((P, V) => {
|
|
123
|
-
let
|
|
123
|
+
let $ = !1;
|
|
124
124
|
k.then(
|
|
125
125
|
(O) => {
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
126
|
+
if (!$) {
|
|
127
|
+
$ = !0;
|
|
128
|
+
const M = c(j), H = p(
|
|
129
|
+
j,
|
|
130
130
|
L,
|
|
131
131
|
C
|
|
132
132
|
);
|
|
133
|
-
resolvePromise(L, O), P(O), (
|
|
133
|
+
resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(j, H, M == null ? void 0 : M.d);
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
(O) => {
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
137
|
+
if (!$) {
|
|
138
|
+
$ = !0;
|
|
139
|
+
const M = c(j), H = p(
|
|
140
|
+
j,
|
|
141
141
|
L,
|
|
142
142
|
C
|
|
143
143
|
);
|
|
144
|
-
rejectPromise(L, O), V(O), (
|
|
144
|
+
rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(j, H, M == null ? void 0 : M.d);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
), I = (O) => {
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
(
|
|
148
|
+
$ || ($ = !0, O.then(
|
|
149
|
+
(M) => resolvePromise(L, M),
|
|
150
|
+
(M) => rejectPromise(L, M)
|
|
151
151
|
), P(O));
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
154
|
return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
|
|
155
155
|
P && I(P), R == null || R();
|
|
156
|
-
}), p(
|
|
156
|
+
}), p(j, L, C);
|
|
157
157
|
}
|
|
158
|
-
return p(
|
|
159
|
-
}, x = (
|
|
160
|
-
const R = c(
|
|
158
|
+
return p(j, k, C);
|
|
159
|
+
}, x = (j, k, C) => {
|
|
160
|
+
const R = c(j), I = {
|
|
161
161
|
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
162
162
|
e: k
|
|
163
163
|
};
|
|
164
|
-
return C && u(
|
|
165
|
-
},
|
|
166
|
-
const k = c(
|
|
167
|
-
if (k && (k.d.forEach((
|
|
168
|
-
O !==
|
|
169
|
-
}), Array.from(k.d).every(([
|
|
170
|
-
const
|
|
171
|
-
return
|
|
172
|
-
|
|
164
|
+
return C && u(j, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(j, I), I);
|
|
165
|
+
}, g = (j) => {
|
|
166
|
+
const k = c(j);
|
|
167
|
+
if (k && (k.d.forEach(($, O) => {
|
|
168
|
+
O !== j && !n.has(O) && g(O);
|
|
169
|
+
}), Array.from(k.d).every(([$, O]) => {
|
|
170
|
+
const M = c($);
|
|
171
|
+
return $ === j || M === O || // TODO This is a hack, we should find a better solution.
|
|
172
|
+
M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
|
|
173
173
|
})))
|
|
174
174
|
return k;
|
|
175
175
|
const C = /* @__PURE__ */ new Map();
|
|
176
176
|
let R = !0;
|
|
177
|
-
const I = (
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
return C.set(M
|
|
182
|
-
if (hasInitialValue(
|
|
183
|
-
return C.set(
|
|
177
|
+
const I = ($) => {
|
|
178
|
+
if ($ === j) {
|
|
179
|
+
const M = c($);
|
|
180
|
+
if (M)
|
|
181
|
+
return C.set($, M), returnAtomValue(M);
|
|
182
|
+
if (hasInitialValue($))
|
|
183
|
+
return C.set($, void 0), $.init;
|
|
184
184
|
throw new Error("no atom init");
|
|
185
185
|
}
|
|
186
|
-
const O =
|
|
187
|
-
return C.set(
|
|
186
|
+
const O = g($);
|
|
187
|
+
return C.set($, O), returnAtomValue(O);
|
|
188
188
|
};
|
|
189
189
|
let L, P;
|
|
190
190
|
const V = {
|
|
@@ -192,32 +192,32 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
192
192
|
return L || (L = new AbortController()), L.signal;
|
|
193
193
|
},
|
|
194
194
|
get setSelf() {
|
|
195
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
195
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(j) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(j) && (P = (...$) => {
|
|
196
196
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
|
|
197
|
-
return B(
|
|
197
|
+
return B(j, ...$);
|
|
198
198
|
}), P;
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
try {
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
const $ = j.read(I, V);
|
|
203
|
+
return m(
|
|
204
|
+
j,
|
|
205
|
+
$,
|
|
206
206
|
C,
|
|
207
207
|
() => L == null ? void 0 : L.abort()
|
|
208
208
|
);
|
|
209
|
-
} catch (
|
|
210
|
-
return x(
|
|
209
|
+
} catch ($) {
|
|
210
|
+
return x(j, $, C);
|
|
211
211
|
} finally {
|
|
212
212
|
R = !1;
|
|
213
213
|
}
|
|
214
|
-
}, E = (
|
|
215
|
-
let k = n.get(
|
|
216
|
-
return k || (k = w(
|
|
217
|
-
}, f = (
|
|
218
|
-
const k = n.get(
|
|
219
|
-
k && f(
|
|
220
|
-
}, v = (
|
|
214
|
+
}, E = (j) => returnAtomValue(g(j)), b = (j) => {
|
|
215
|
+
let k = n.get(j);
|
|
216
|
+
return k || (k = w(j)), k;
|
|
217
|
+
}, f = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), _ = (j) => {
|
|
218
|
+
const k = n.get(j);
|
|
219
|
+
k && f(j, k) && A(j);
|
|
220
|
+
}, v = (j) => {
|
|
221
221
|
const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
|
|
222
222
|
const P = n.get(L);
|
|
223
223
|
P == null || P.t.forEach((V) => {
|
|
@@ -227,76 +227,76 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
227
227
|
), C.set(V, (C.get(V) || 0) + 1), R(V));
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
R(
|
|
230
|
+
R(j);
|
|
231
231
|
const I = (L) => {
|
|
232
232
|
const P = n.get(L);
|
|
233
233
|
P == null || P.t.forEach((V) => {
|
|
234
|
-
var
|
|
234
|
+
var $;
|
|
235
235
|
if (V !== L) {
|
|
236
236
|
let O = C.get(V);
|
|
237
237
|
if (O && C.set(V, --O), !O) {
|
|
238
|
-
let
|
|
239
|
-
if (
|
|
240
|
-
const H = c(V), F =
|
|
241
|
-
|
|
238
|
+
let M = !!(($ = k.get(V)) != null && $.size);
|
|
239
|
+
if (M) {
|
|
240
|
+
const H = c(V), F = g(V);
|
|
241
|
+
M = !H || !isEqualAtomValue(H, F);
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
M || k.forEach((H) => H.delete(V));
|
|
244
244
|
}
|
|
245
245
|
I(V);
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
};
|
|
249
|
-
I(
|
|
250
|
-
}, S = (
|
|
249
|
+
I(j);
|
|
250
|
+
}, S = (j, ...k) => {
|
|
251
251
|
let C = !0;
|
|
252
|
-
const R = (P) => returnAtomValue(
|
|
253
|
-
let
|
|
254
|
-
if (P ===
|
|
252
|
+
const R = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
|
|
253
|
+
let $;
|
|
254
|
+
if (P === j) {
|
|
255
255
|
if (!hasInitialValue(P))
|
|
256
256
|
throw new Error("atom not writable");
|
|
257
|
-
const O = c(P),
|
|
258
|
-
(!O || !isEqualAtomValue(O,
|
|
257
|
+
const O = c(P), M = m(P, V[0]);
|
|
258
|
+
(!O || !isEqualAtomValue(O, M)) && v(P);
|
|
259
259
|
} else
|
|
260
|
-
|
|
260
|
+
$ = S(P, ...V);
|
|
261
261
|
if (!C) {
|
|
262
262
|
const O = D();
|
|
263
263
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
264
|
-
(
|
|
264
|
+
(M) => M({ type: "async-write", flushed: O })
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
|
-
return
|
|
268
|
-
}, L =
|
|
267
|
+
return $;
|
|
268
|
+
}, L = j.write(R, I, ...k);
|
|
269
269
|
return C = !1, L;
|
|
270
|
-
}, B = (
|
|
271
|
-
const C = S(
|
|
270
|
+
}, B = (j, ...k) => {
|
|
271
|
+
const C = S(j, ...k), R = D();
|
|
272
272
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
273
273
|
(I) => I({ type: "write", flushed: R })
|
|
274
274
|
), C;
|
|
275
|
-
}, w = (
|
|
275
|
+
}, w = (j, k) => {
|
|
276
276
|
const C = {
|
|
277
277
|
t: new Set(k && [k]),
|
|
278
278
|
l: /* @__PURE__ */ new Set()
|
|
279
279
|
};
|
|
280
|
-
if (n.set(
|
|
280
|
+
if (n.set(j, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, I) => {
|
|
281
281
|
const L = n.get(I);
|
|
282
|
-
L ? L.t.add(
|
|
283
|
-
}),
|
|
284
|
-
const R =
|
|
282
|
+
L ? L.t.add(j) : I !== j && w(I, j);
|
|
283
|
+
}), g(j), isActuallyWritableAtom(j) && j.onMount) {
|
|
284
|
+
const R = j.onMount((...I) => B(j, ...I));
|
|
285
285
|
R && (C.u = R);
|
|
286
286
|
}
|
|
287
287
|
return C;
|
|
288
|
-
}, A = (
|
|
288
|
+
}, A = (j) => {
|
|
289
289
|
var k;
|
|
290
|
-
const C = (k = n.get(
|
|
291
|
-
C && C(), n.delete(
|
|
292
|
-
const R = c(
|
|
290
|
+
const C = (k = n.get(j)) == null ? void 0 : k.u;
|
|
291
|
+
C && C(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
|
|
292
|
+
const R = c(j);
|
|
293
293
|
R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
|
|
294
|
-
if (L !==
|
|
294
|
+
if (L !== j) {
|
|
295
295
|
const P = n.get(L);
|
|
296
|
-
P && (P.t.delete(
|
|
296
|
+
P && (P.t.delete(j), f(L, P) && A(L));
|
|
297
297
|
}
|
|
298
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
299
|
-
}, N = (
|
|
298
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
|
|
299
|
+
}, N = (j, k, C) => {
|
|
300
300
|
const R = new Set(k.d.keys());
|
|
301
301
|
C == null || C.forEach((I, L) => {
|
|
302
302
|
if (R.has(L)) {
|
|
@@ -304,14 +304,14 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
306
|
const P = n.get(L);
|
|
307
|
-
P && (P.t.delete(
|
|
307
|
+
P && (P.t.delete(j), f(L, P) && A(L));
|
|
308
308
|
}), R.forEach((I) => {
|
|
309
309
|
const L = n.get(I);
|
|
310
|
-
L ? L.t.add(
|
|
310
|
+
L ? L.t.add(j) : n.has(j) && w(I, j);
|
|
311
311
|
});
|
|
312
312
|
}, D = () => {
|
|
313
|
-
let
|
|
314
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
313
|
+
let j;
|
|
314
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
|
|
315
315
|
const k = Array.from(r);
|
|
316
316
|
r.clear(), k.forEach(([C, R]) => {
|
|
317
317
|
const I = c(C);
|
|
@@ -320,19 +320,19 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
320
320
|
const L = n.get(C);
|
|
321
321
|
L && !// TODO This seems pretty hacky. Hope to fix it.
|
|
322
322
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
323
|
-
(R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
323
|
+
(R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(C));
|
|
324
324
|
} else
|
|
325
325
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
329
|
-
return a.forEach((k) => k("state")),
|
|
330
|
-
}, T = (
|
|
331
|
-
const C = j
|
|
329
|
+
return a.forEach((k) => k("state")), j;
|
|
330
|
+
}, T = (j, k) => {
|
|
331
|
+
const C = b(j), R = D(), I = C.l;
|
|
332
332
|
return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
|
|
333
333
|
(L) => L({ type: "sub", flushed: R })
|
|
334
334
|
)), () => {
|
|
335
|
-
I.delete(k), _(
|
|
335
|
+
I.delete(k), _(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
|
|
336
336
|
};
|
|
337
337
|
};
|
|
338
338
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -340,19 +340,19 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
340
340
|
set: B,
|
|
341
341
|
sub: T,
|
|
342
342
|
// store dev methods (these are tentative and subject to change without notice)
|
|
343
|
-
dev_subscribe_store: (
|
|
343
|
+
dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
|
|
344
344
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
345
|
-
), a.add(
|
|
346
|
-
a.delete(
|
|
347
|
-
}) : (l.add(
|
|
348
|
-
l.delete(
|
|
345
|
+
), a.add(j), () => {
|
|
346
|
+
a.delete(j);
|
|
347
|
+
}) : (l.add(j), () => {
|
|
348
|
+
l.delete(j);
|
|
349
349
|
}),
|
|
350
350
|
dev_get_mounted_atoms: () => i.values(),
|
|
351
|
-
dev_get_atom_state: (
|
|
352
|
-
dev_get_mounted: (
|
|
353
|
-
dev_restore_atoms: (
|
|
354
|
-
for (const [C, R] of
|
|
355
|
-
hasInitialValue(C) && (
|
|
351
|
+
dev_get_atom_state: (j) => o.get(j),
|
|
352
|
+
dev_get_mounted: (j) => n.get(j),
|
|
353
|
+
dev_restore_atoms: (j) => {
|
|
354
|
+
for (const [C, R] of j)
|
|
355
|
+
hasInitialValue(C) && (m(C, R), v(C));
|
|
356
356
|
const k = D();
|
|
357
357
|
l.forEach(
|
|
358
358
|
(C) => C({ type: "restore", flushed: k })
|
|
@@ -378,37 +378,37 @@ function splitAtom(o, n) {
|
|
|
378
378
|
let u = r.get(c);
|
|
379
379
|
if (u)
|
|
380
380
|
return u;
|
|
381
|
-
const p = d && r.get(d),
|
|
382
|
-
return c.forEach((
|
|
383
|
-
const
|
|
384
|
-
x[E] =
|
|
385
|
-
const f = p && p.atomList[p.keyList.indexOf(
|
|
381
|
+
const p = d && r.get(d), m = [], x = [];
|
|
382
|
+
return c.forEach((g, E) => {
|
|
383
|
+
const b = n ? n(g) : E;
|
|
384
|
+
x[E] = b;
|
|
385
|
+
const f = p && p.atomList[p.keyList.indexOf(b)];
|
|
386
386
|
if (f) {
|
|
387
|
-
|
|
387
|
+
m[E] = f;
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
const _ = (S) => {
|
|
391
|
-
const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(
|
|
391
|
+
const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(b);
|
|
392
392
|
if (N < 0 || N >= w.length) {
|
|
393
|
-
const D = c[a(c).keyList.indexOf(
|
|
393
|
+
const D = c[a(c).keyList.indexOf(b)];
|
|
394
394
|
if (D)
|
|
395
395
|
return D;
|
|
396
396
|
throw new Error("splitAtom: index out of bounds for read");
|
|
397
397
|
}
|
|
398
398
|
return w[N];
|
|
399
399
|
}, v = (S, B, w) => {
|
|
400
|
-
const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(
|
|
400
|
+
const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
|
|
401
401
|
if (T < 0 || T >= N.length)
|
|
402
402
|
throw new Error("splitAtom: index out of bounds for write");
|
|
403
|
-
const
|
|
403
|
+
const j = isFunction(w) ? w(N[T]) : w;
|
|
404
404
|
B(o, [
|
|
405
405
|
...N.slice(0, T),
|
|
406
|
-
|
|
406
|
+
j,
|
|
407
407
|
...N.slice(T + 1)
|
|
408
408
|
]);
|
|
409
409
|
};
|
|
410
|
-
|
|
411
|
-
}), p && p.keyList.length === x.length && p.keyList.every((
|
|
410
|
+
m[E] = isWritable(o) ? atom(_, v) : atom(_);
|
|
411
|
+
}), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
|
|
412
412
|
}, l = atom((c) => {
|
|
413
413
|
const d = c(l), u = c(o);
|
|
414
414
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -421,10 +421,10 @@ function splitAtom(o, n) {
|
|
|
421
421
|
case "remove": {
|
|
422
422
|
const p = c(i).indexOf(u.atom);
|
|
423
423
|
if (p >= 0) {
|
|
424
|
-
const
|
|
424
|
+
const m = c(o);
|
|
425
425
|
d(o, [
|
|
426
|
-
...
|
|
427
|
-
...
|
|
426
|
+
...m.slice(0, p),
|
|
427
|
+
...m.slice(p + 1)
|
|
428
428
|
]);
|
|
429
429
|
}
|
|
430
430
|
break;
|
|
@@ -432,28 +432,28 @@ function splitAtom(o, n) {
|
|
|
432
432
|
case "insert": {
|
|
433
433
|
const p = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
434
434
|
if (p >= 0) {
|
|
435
|
-
const
|
|
435
|
+
const m = c(o);
|
|
436
436
|
d(o, [
|
|
437
|
-
...
|
|
437
|
+
...m.slice(0, p),
|
|
438
438
|
u.value,
|
|
439
|
-
...
|
|
439
|
+
...m.slice(p)
|
|
440
440
|
]);
|
|
441
441
|
}
|
|
442
442
|
break;
|
|
443
443
|
}
|
|
444
444
|
case "move": {
|
|
445
|
-
const p = c(i).indexOf(u.atom),
|
|
446
|
-
if (p >= 0 &&
|
|
445
|
+
const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
446
|
+
if (p >= 0 && m >= 0) {
|
|
447
447
|
const x = c(o);
|
|
448
|
-
p <
|
|
448
|
+
p < m ? d(o, [
|
|
449
449
|
...x.slice(0, p),
|
|
450
|
-
...x.slice(p + 1,
|
|
450
|
+
...x.slice(p + 1, m),
|
|
451
451
|
x[p],
|
|
452
|
-
...x.slice(
|
|
452
|
+
...x.slice(m)
|
|
453
453
|
]) : d(o, [
|
|
454
|
-
...x.slice(0,
|
|
454
|
+
...x.slice(0, m),
|
|
455
455
|
x[p],
|
|
456
|
-
...x.slice(
|
|
456
|
+
...x.slice(m, p),
|
|
457
457
|
...x.slice(p + 1)
|
|
458
458
|
]);
|
|
459
459
|
}
|
|
@@ -474,14 +474,14 @@ function createJSONStorage(o) {
|
|
|
474
474
|
const a = {
|
|
475
475
|
getItem: (l, i) => {
|
|
476
476
|
var c, d;
|
|
477
|
-
const u = (
|
|
478
|
-
if (
|
|
477
|
+
const u = (m) => {
|
|
478
|
+
if (m = m || "", n !== m) {
|
|
479
479
|
try {
|
|
480
|
-
r = JSON.parse(
|
|
480
|
+
r = JSON.parse(m);
|
|
481
481
|
} catch {
|
|
482
482
|
return i;
|
|
483
483
|
}
|
|
484
|
-
n =
|
|
484
|
+
n = m;
|
|
485
485
|
}
|
|
486
486
|
return r;
|
|
487
487
|
}, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
|
|
@@ -530,8 +530,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
|
|
|
530
530
|
}, atom(
|
|
531
531
|
(d) => d(i),
|
|
532
532
|
(d, u, p) => {
|
|
533
|
-
const
|
|
534
|
-
return
|
|
533
|
+
const m = typeof p == "function" ? p(d(i)) : p;
|
|
534
|
+
return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, m), r.setItem(o, m));
|
|
535
535
|
}
|
|
536
536
|
);
|
|
537
537
|
}
|
|
@@ -556,8 +556,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
556
556
|
function useAtomValue(o, n) {
|
|
557
557
|
const r = useStore(n), [[a, l, i], c] = useReducer(
|
|
558
558
|
(p) => {
|
|
559
|
-
const
|
|
560
|
-
return Object.is(p[0],
|
|
559
|
+
const m = r.get(o);
|
|
560
|
+
return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
|
|
561
561
|
},
|
|
562
562
|
void 0,
|
|
563
563
|
() => [r.get(o), r, o]
|
|
@@ -641,8 +641,8 @@ const getSlots = (o) => {
|
|
|
641
641
|
return map(i, (c) => {
|
|
642
642
|
const d = c, u = getSlots(d);
|
|
643
643
|
return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
|
|
644
|
-
const
|
|
645
|
-
d[p] = `slot:${
|
|
644
|
+
const m = find(i, { oldId: u[p].replace("slot:", "") });
|
|
645
|
+
d[p] = `slot:${m._id}`;
|
|
646
646
|
}), omit(d, ["global", "oldId"]);
|
|
647
647
|
});
|
|
648
648
|
}, presentBlocksAtom = atom$1([]);
|
|
@@ -717,7 +717,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
717
717
|
[n]
|
|
718
718
|
);
|
|
719
719
|
return [o, n, r];
|
|
720
|
-
}, getBlockJSONFromUISchemas = (o) => {
|
|
720
|
+
}, titleWithLang = (o, n, r) => endsWith(o, `(${n})`) || isEmpty(n) || !r ? o : `${o} (${n})`, getBlockJSONFromUISchemas = (o) => {
|
|
721
721
|
switch (o.type) {
|
|
722
722
|
case "singular":
|
|
723
723
|
return o.uiSchema;
|
|
@@ -744,41 +744,45 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
744
744
|
default:
|
|
745
745
|
return {};
|
|
746
746
|
}
|
|
747
|
-
}, getBlockJSONFromSchemas = (o, n) => {
|
|
747
|
+
}, getBlockJSONFromSchemas = (o, n, r) => {
|
|
748
748
|
switch (o.type) {
|
|
749
749
|
case "singular": {
|
|
750
|
-
const
|
|
751
|
-
return
|
|
750
|
+
const p = o.schema;
|
|
751
|
+
return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
|
|
752
752
|
}
|
|
753
753
|
case "model":
|
|
754
|
-
const { properties:
|
|
755
|
-
title: n(
|
|
754
|
+
const { properties: a, title: l } = o, i = {
|
|
755
|
+
title: titleWithLang(n(l), r, get(o, "i18n")),
|
|
756
756
|
type: "object",
|
|
757
757
|
properties: {}
|
|
758
758
|
};
|
|
759
|
-
return Object.keys(
|
|
760
|
-
const
|
|
761
|
-
if (includes(["slot", "styles"],
|
|
759
|
+
return Object.keys(a).forEach((p) => {
|
|
760
|
+
const m = a[p];
|
|
761
|
+
if (includes(["slot", "styles"], m.type))
|
|
762
762
|
return;
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
}),
|
|
763
|
+
const x = p;
|
|
764
|
+
i.properties[x] = getBlockJSONFromSchemas(m, n, r);
|
|
765
|
+
}), i;
|
|
766
766
|
case "list":
|
|
767
|
-
const { itemProperties:
|
|
768
|
-
title: n(
|
|
767
|
+
const { itemProperties: c, title: d } = o, u = {
|
|
768
|
+
title: titleWithLang(n(d), r, get(o, "i18n")),
|
|
769
769
|
type: "array",
|
|
770
770
|
items: {
|
|
771
771
|
type: "object",
|
|
772
772
|
properties: {}
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
|
-
return Object.keys(
|
|
776
|
-
const
|
|
777
|
-
if (includes(["slot", "styles"],
|
|
775
|
+
return Object.keys(c).forEach((p) => {
|
|
776
|
+
const m = c[p];
|
|
777
|
+
if (includes(["slot", "styles"], m.type))
|
|
778
778
|
return;
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
779
|
+
const x = p;
|
|
780
|
+
u.items.properties[x] = getBlockJSONFromSchemas(m, n, r), set(
|
|
781
|
+
u.items,
|
|
782
|
+
"title",
|
|
783
|
+
titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
|
|
784
|
+
);
|
|
785
|
+
}), u;
|
|
782
786
|
default:
|
|
783
787
|
return {};
|
|
784
788
|
}
|
|
@@ -830,8 +834,8 @@ var undomanager = { exports: {} };
|
|
|
830
834
|
}
|
|
831
835
|
let r = function() {
|
|
832
836
|
let a = [], l = -1, i = 0, c = !1, d;
|
|
833
|
-
function u(p,
|
|
834
|
-
return !p || typeof p[
|
|
837
|
+
function u(p, m) {
|
|
838
|
+
return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
|
|
835
839
|
}
|
|
836
840
|
return {
|
|
837
841
|
/**
|
|
@@ -858,8 +862,8 @@ var undomanager = { exports: {} };
|
|
|
858
862
|
let p = a[l];
|
|
859
863
|
if (!p)
|
|
860
864
|
return this;
|
|
861
|
-
const
|
|
862
|
-
for (; p.groupId ===
|
|
865
|
+
const m = p.groupId;
|
|
866
|
+
for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
|
|
863
867
|
;
|
|
864
868
|
return d && d(), this;
|
|
865
869
|
},
|
|
@@ -870,8 +874,8 @@ var undomanager = { exports: {} };
|
|
|
870
874
|
let p = a[l + 1];
|
|
871
875
|
if (!p)
|
|
872
876
|
return this;
|
|
873
|
-
const
|
|
874
|
-
for (; p.groupId ===
|
|
877
|
+
const m = p.groupId;
|
|
878
|
+
for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
|
|
875
879
|
;
|
|
876
880
|
return d && d(), this;
|
|
877
881
|
},
|
|
@@ -902,7 +906,7 @@ var undomanager = { exports: {} };
|
|
|
902
906
|
* @returns {array}
|
|
903
907
|
*/
|
|
904
908
|
getCommands: function(p) {
|
|
905
|
-
return p ? a.filter((
|
|
909
|
+
return p ? a.filter((m) => m.groupId === p) : a;
|
|
906
910
|
},
|
|
907
911
|
/**
|
|
908
912
|
* Returns the index of the actions list.
|
|
@@ -1192,82 +1196,82 @@ const useBlocksStoreManager = () => {
|
|
|
1192
1196
|
updateBlocksProps: c
|
|
1193
1197
|
} = useBlocksStoreManager();
|
|
1194
1198
|
return {
|
|
1195
|
-
moveBlocks: (
|
|
1196
|
-
const v = map(
|
|
1199
|
+
moveBlocks: (b, f, _) => {
|
|
1200
|
+
const v = map(b, (B) => {
|
|
1197
1201
|
const A = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => A ? T._parent === A : !T._parent).map((T) => T._id).indexOf(B);
|
|
1198
1202
|
return { _id: B, oldParent: A, oldPosition: D };
|
|
1199
|
-
}), S = v.find(({ _id: B }) => B ===
|
|
1200
|
-
S && S.oldParent === f && S.oldPosition === _ || (i(
|
|
1203
|
+
}), S = v.find(({ _id: B }) => B === b[0]);
|
|
1204
|
+
S && S.oldParent === f && S.oldPosition === _ || (i(b, f, _), o({
|
|
1201
1205
|
undo: () => each(v, ({ _id: B, oldParent: w, oldPosition: A }) => {
|
|
1202
1206
|
i([B], w, A);
|
|
1203
1207
|
}),
|
|
1204
|
-
redo: () => i(
|
|
1208
|
+
redo: () => i(b, f, _)
|
|
1205
1209
|
}));
|
|
1206
1210
|
},
|
|
1207
|
-
addBlocks: (
|
|
1208
|
-
a(
|
|
1209
|
-
undo: () => l(map(
|
|
1210
|
-
redo: () => a(
|
|
1211
|
+
addBlocks: (b, f, _) => {
|
|
1212
|
+
a(b, f, _), o({
|
|
1213
|
+
undo: () => l(map(b, "_id")),
|
|
1214
|
+
redo: () => a(b, f, _)
|
|
1211
1215
|
});
|
|
1212
1216
|
},
|
|
1213
|
-
removeBlocks: (
|
|
1217
|
+
removeBlocks: (b) => {
|
|
1214
1218
|
var S;
|
|
1215
|
-
const f = (S = first(
|
|
1216
|
-
l(map(
|
|
1217
|
-
undo: () => a(
|
|
1218
|
-
redo: () => l(map(
|
|
1219
|
+
const f = (S = first(b)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(b));
|
|
1220
|
+
l(map(b, "_id")), o({
|
|
1221
|
+
undo: () => a(b, f, v),
|
|
1222
|
+
redo: () => l(map(b, "_id"))
|
|
1219
1223
|
});
|
|
1220
1224
|
},
|
|
1221
|
-
updateBlocks: (
|
|
1225
|
+
updateBlocks: (b, f, _) => {
|
|
1222
1226
|
let v = [];
|
|
1223
1227
|
if (_)
|
|
1224
|
-
v = map(
|
|
1228
|
+
v = map(b, (S) => ({ _id: S, ..._ }));
|
|
1225
1229
|
else {
|
|
1226
1230
|
const S = keys(f);
|
|
1227
|
-
v = map(
|
|
1231
|
+
v = map(b, (B) => {
|
|
1228
1232
|
const w = n.find((N) => N._id === B), A = { _id: B };
|
|
1229
1233
|
return each(S, (N) => A[N] = w[N]), A;
|
|
1230
1234
|
});
|
|
1231
1235
|
}
|
|
1232
|
-
c(map(
|
|
1236
|
+
c(map(b, (S) => ({ _id: S, ...f }))), o({
|
|
1233
1237
|
undo: () => c(v),
|
|
1234
|
-
redo: () => c(map(
|
|
1238
|
+
redo: () => c(map(b, (S) => ({ _id: S, ...f })))
|
|
1235
1239
|
});
|
|
1236
1240
|
},
|
|
1237
|
-
updateBlocksRuntime: (
|
|
1238
|
-
c(map(
|
|
1241
|
+
updateBlocksRuntime: (b, f) => {
|
|
1242
|
+
c(map(b, (_) => ({ _id: _, ...f })));
|
|
1239
1243
|
},
|
|
1240
|
-
setNewBlocks: (
|
|
1241
|
-
r(
|
|
1244
|
+
setNewBlocks: (b) => {
|
|
1245
|
+
r(b), o({
|
|
1242
1246
|
undo: () => r(n),
|
|
1243
|
-
redo: () => r(
|
|
1247
|
+
redo: () => r(b)
|
|
1244
1248
|
});
|
|
1245
1249
|
},
|
|
1246
|
-
updateMultipleBlocksProps: (
|
|
1250
|
+
updateMultipleBlocksProps: (b) => {
|
|
1247
1251
|
let f = [];
|
|
1248
|
-
f = map(
|
|
1252
|
+
f = map(b, (_) => {
|
|
1249
1253
|
const v = keys(_), S = n.find((w) => w._id === _._id), B = {};
|
|
1250
1254
|
return each(v, (w) => B[w] = S[w]), B;
|
|
1251
|
-
}), c(
|
|
1255
|
+
}), c(b), o({
|
|
1252
1256
|
undo: () => c(f),
|
|
1253
|
-
redo: () => c(
|
|
1257
|
+
redo: () => c(b)
|
|
1254
1258
|
});
|
|
1255
1259
|
}
|
|
1256
1260
|
};
|
|
1257
1261
|
}, useAddBlock = () => {
|
|
1258
1262
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1259
1263
|
(i, c, d) => {
|
|
1260
|
-
var
|
|
1264
|
+
var g;
|
|
1261
1265
|
for (let E = 0; E < i.length; E++) {
|
|
1262
|
-
const { _id:
|
|
1266
|
+
const { _id: b } = i[E];
|
|
1263
1267
|
i[E]._id = generateUUID();
|
|
1264
|
-
const f = filter(i, { _parent:
|
|
1268
|
+
const f = filter(i, { _parent: b });
|
|
1265
1269
|
for (let _ = 0; _ < f.length; _++)
|
|
1266
1270
|
f[_]._parent = i[E]._id;
|
|
1267
1271
|
}
|
|
1268
1272
|
const u = first(i);
|
|
1269
|
-
let p,
|
|
1270
|
-
return c && (p = find(o, { _id: c }), i[0]._parent = c,
|
|
1273
|
+
let p, m;
|
|
1274
|
+
return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
|
|
1271
1275
|
},
|
|
1272
1276
|
[o, n]
|
|
1273
1277
|
);
|
|
@@ -1277,11 +1281,11 @@ const useBlocksStoreManager = () => {
|
|
|
1277
1281
|
const _ = i.blocks;
|
|
1278
1282
|
return a(_, c, d);
|
|
1279
1283
|
}
|
|
1280
|
-
const u = generateUUID(), p = getBlockDefaultProps(i.props),
|
|
1284
|
+
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1281
1285
|
forIn(p, (_, v) => {
|
|
1282
1286
|
if (startsWith(_, SLOT_KEY)) {
|
|
1283
1287
|
const S = _.replace(SLOT_KEY, "");
|
|
1284
|
-
|
|
1288
|
+
m.push({
|
|
1285
1289
|
_id: S,
|
|
1286
1290
|
_type: "Slot",
|
|
1287
1291
|
_parent: u,
|
|
@@ -1296,9 +1300,9 @@ const useBlocksStoreManager = () => {
|
|
|
1296
1300
|
_id: u,
|
|
1297
1301
|
...p
|
|
1298
1302
|
};
|
|
1299
|
-
let
|
|
1300
|
-
c && (
|
|
1301
|
-
const f = [x, ...
|
|
1303
|
+
let g, E;
|
|
1304
|
+
c && (g = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, E = g._parent);
|
|
1305
|
+
const f = [x, ...m];
|
|
1302
1306
|
return r(f, E, d), n([x._id]), x;
|
|
1303
1307
|
},
|
|
1304
1308
|
[a, o, n]
|
|
@@ -2407,18 +2411,18 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2407
2411
|
);
|
|
2408
2412
|
const i = [], c = [];
|
|
2409
2413
|
each(r, (p) => {
|
|
2410
|
-
const
|
|
2414
|
+
const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
|
|
2411
2415
|
if (x && (a = filter(
|
|
2412
2416
|
a,
|
|
2413
|
-
(
|
|
2414
|
-
)), i.push(
|
|
2415
|
-
const
|
|
2417
|
+
(g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
|
|
2418
|
+
)), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
|
|
2419
|
+
const g = find(l, pick(m, ["property"]));
|
|
2416
2420
|
x && (l = filter(
|
|
2417
2421
|
l,
|
|
2418
|
-
(E) => E.fullCls !== (
|
|
2422
|
+
(E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2419
2423
|
)), c.push({
|
|
2420
|
-
...
|
|
2421
|
-
fullCls:
|
|
2424
|
+
...m,
|
|
2425
|
+
fullCls: m.cls,
|
|
2422
2426
|
mq: "xs"
|
|
2423
2427
|
});
|
|
2424
2428
|
}
|
|
@@ -2446,10 +2450,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2446
2450
|
)
|
|
2447
2451
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2448
2452
|
return map(l, (c) => {
|
|
2449
|
-
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes:
|
|
2453
|
+
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
|
|
2450
2454
|
return {
|
|
2451
2455
|
ids: [d._id],
|
|
2452
|
-
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(
|
|
2456
|
+
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
|
|
2453
2457
|
};
|
|
2454
2458
|
});
|
|
2455
2459
|
}), useAddClassesToBlocks = () => {
|
|
@@ -2498,13 +2502,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2498
2502
|
(a, l = null) => {
|
|
2499
2503
|
const i = [];
|
|
2500
2504
|
each(a, (c) => {
|
|
2501
|
-
const d = o.find((
|
|
2505
|
+
const d = o.find((g) => g._id === c);
|
|
2502
2506
|
l || (l = d._parent);
|
|
2503
|
-
const
|
|
2507
|
+
const m = filter(
|
|
2504
2508
|
o,
|
|
2505
|
-
(
|
|
2509
|
+
(g) => isString$1(l) ? g._parent === l : !d._parent
|
|
2506
2510
|
).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
|
|
2507
|
-
r(x, l,
|
|
2511
|
+
r(x, l, m), i.push(get(x, "0._id", ""));
|
|
2508
2512
|
}), n(i);
|
|
2509
2513
|
},
|
|
2510
2514
|
[o, n]
|
|
@@ -2567,19 +2571,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2567
2571
|
);
|
|
2568
2572
|
return map(i, (c) => {
|
|
2569
2573
|
const d = o(c), u = a;
|
|
2570
|
-
let { classes: p, baseClasses:
|
|
2574
|
+
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2571
2575
|
return each(u, (x) => {
|
|
2572
|
-
const
|
|
2576
|
+
const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
|
|
2573
2577
|
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2574
|
-
const
|
|
2575
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2578
|
+
const b = first(x.split(":"));
|
|
2579
|
+
includes(["2xl", "xl", "lg", "md", "sm"], b) && u.push(x.split(":").pop().trim());
|
|
2576
2580
|
}), each(u, (x) => {
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2581
|
+
const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2582
|
+
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
2579
2583
|
}), {
|
|
2580
2584
|
ids: [d._id],
|
|
2581
2585
|
props: {
|
|
2582
|
-
[l.prop]: `${STYLES_KEY}${
|
|
2586
|
+
[l.prop]: `${STYLES_KEY}${m},${p}`
|
|
2583
2587
|
}
|
|
2584
2588
|
};
|
|
2585
2589
|
});
|
|
@@ -2631,14 +2635,14 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2631
2635
|
}, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom), languageAtom = atom$1("");
|
|
2632
2636
|
languageAtom.debugLabel = "selectedLanguageAtom";
|
|
2633
2637
|
const useLanguages = () => {
|
|
2634
|
-
const o = useBuilderProp("languages", []), n = useBuilderProp("fallbackLang", "en"), [r, a] = useAtom$1(languageAtom),
|
|
2638
|
+
const o = useBuilderProp("languages", []), n = useBuilderProp("fallbackLang", "en"), [r, a] = useAtom$1(languageAtom), l = (i) => {
|
|
2639
|
+
a(n === i ? "" : i);
|
|
2640
|
+
};
|
|
2635
2641
|
return {
|
|
2636
|
-
languages: o,
|
|
2642
|
+
languages: o == null ? void 0 : o.filter((i) => i !== n),
|
|
2637
2643
|
fallbackLang: n,
|
|
2638
2644
|
selectedLang: r,
|
|
2639
|
-
setSelectedLang:
|
|
2640
|
-
r !== (n === u ? "" : u) && (l([]), i(null), c([]), a(n === u ? "" : u));
|
|
2641
|
-
}
|
|
2645
|
+
setSelectedLang: l
|
|
2642
2646
|
};
|
|
2643
2647
|
}, updatePropsForLanguage = memoize((o, n, r) => {
|
|
2644
2648
|
const a = getBlockComponent(get(r, "_type"));
|
|
@@ -2680,7 +2684,7 @@ const useLanguages = () => {
|
|
|
2680
2684
|
let u = "";
|
|
2681
2685
|
o([n], { [i]: "" });
|
|
2682
2686
|
for (let p = 0; p < d.length; p++)
|
|
2683
|
-
u += d[p].join(""), o([n], { [i]: u }), await new Promise((
|
|
2687
|
+
u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
|
|
2684
2688
|
}
|
|
2685
2689
|
}
|
|
2686
2690
|
},
|
|
@@ -2866,18 +2870,18 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
|
|
|
2866
2870
|
const { width: d, height: u } = o;
|
|
2867
2871
|
if (d < n) {
|
|
2868
2872
|
const p = parseFloat((d / n).toFixed(2).toString());
|
|
2869
|
-
let
|
|
2870
|
-
const x = u * p,
|
|
2871
|
-
u && (
|
|
2873
|
+
let m = {};
|
|
2874
|
+
const x = u * p, g = d * p;
|
|
2875
|
+
u && (m = {
|
|
2872
2876
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
2873
2877
|
height: 100 + (u - x) / x * 100 + "%",
|
|
2874
|
-
width: 100 + (d -
|
|
2878
|
+
width: 100 + (d - g) / g * 100 + "%"
|
|
2875
2879
|
}), i({
|
|
2876
2880
|
position: "relative",
|
|
2877
2881
|
top: 0,
|
|
2878
2882
|
transform: `scale(${p})`,
|
|
2879
2883
|
transformOrigin: a === "rtl" ? "top right" : "top left",
|
|
2880
|
-
...
|
|
2884
|
+
...m,
|
|
2881
2885
|
maxWidth: "none"
|
|
2882
2886
|
// TODO: Add max-width to the wrapper
|
|
2883
2887
|
}), r(p * 100);
|
|
@@ -3055,12 +3059,12 @@ const useDnd = () => {
|
|
|
3055
3059
|
};
|
|
3056
3060
|
return iframeDocument = o, {
|
|
3057
3061
|
isDragging: n,
|
|
3058
|
-
onDragOver: (
|
|
3059
|
-
|
|
3062
|
+
onDragOver: (g) => {
|
|
3063
|
+
g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
|
|
3060
3064
|
},
|
|
3061
|
-
onDrop: (
|
|
3065
|
+
onDrop: (g) => {
|
|
3062
3066
|
var w;
|
|
3063
|
-
const E = dropTarget, f = getOrientation(E) === "vertical" ?
|
|
3067
|
+
const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
|
|
3064
3068
|
dropIndex = calculateDropIndex(f, possiblePositions);
|
|
3065
3069
|
const _ = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3066
3070
|
if ((_ == null ? void 0 : _._id) === v || !S) {
|
|
@@ -3072,16 +3076,16 @@ const useDnd = () => {
|
|
|
3072
3076
|
return;
|
|
3073
3077
|
}
|
|
3074
3078
|
let B = E.getAttribute("data-block-id");
|
|
3075
|
-
B === null && (B =
|
|
3079
|
+
B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([_._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3076
3080
|
},
|
|
3077
|
-
onDragEnter: (
|
|
3078
|
-
const E =
|
|
3079
|
-
dropTarget =
|
|
3080
|
-
const f =
|
|
3081
|
-
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(
|
|
3081
|
+
onDragEnter: (g) => {
|
|
3082
|
+
const E = g, b = E.target;
|
|
3083
|
+
dropTarget = b;
|
|
3084
|
+
const f = b.getAttribute("data-block-id"), _ = b.getAttribute("data-dnd-dragged") !== "yes";
|
|
3085
|
+
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(b), r(!0), l(""), i([]);
|
|
3082
3086
|
},
|
|
3083
|
-
onDragLeave: (
|
|
3084
|
-
|
|
3087
|
+
onDragLeave: (g) => {
|
|
3088
|
+
g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
3085
3089
|
}
|
|
3086
3090
|
};
|
|
3087
3091
|
};
|
|
@@ -3103,16 +3107,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3103
3107
|
if (!d || !o.includes(d))
|
|
3104
3108
|
return;
|
|
3105
3109
|
const u = c.cloneNode(!0);
|
|
3106
|
-
c.style.display = "none", Array.from(u.attributes).forEach((
|
|
3107
|
-
|
|
3110
|
+
c.style.display = "none", Array.from(u.attributes).forEach((g) => {
|
|
3111
|
+
g.name !== "class" && u.removeAttribute(g.name);
|
|
3108
3112
|
}), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
|
|
3109
3113
|
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3110
|
-
function
|
|
3111
|
-
const
|
|
3112
|
-
n([c.getAttribute("data-block-id")], { content:
|
|
3114
|
+
function m() {
|
|
3115
|
+
const g = p.getText(0, p.getLength());
|
|
3116
|
+
n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
|
|
3113
3117
|
}
|
|
3114
|
-
u.addEventListener("blur",
|
|
3115
|
-
(
|
|
3118
|
+
u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
|
|
3119
|
+
(g.key === "Enter" || g.key === "Escape") && m();
|
|
3116
3120
|
}), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
|
|
3117
3121
|
};
|
|
3118
3122
|
}, useHandleCanvasClick = () => {
|
|
@@ -3127,8 +3131,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3127
3131
|
return;
|
|
3128
3132
|
}
|
|
3129
3133
|
if (d != null && d.getAttribute("data-block-parent")) {
|
|
3130
|
-
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"),
|
|
3131
|
-
n.includes(
|
|
3134
|
+
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
|
|
3135
|
+
n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
|
|
3132
3136
|
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3133
3137
|
const u = d.getAttribute("data-block-id");
|
|
3134
3138
|
n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
@@ -3151,10 +3155,10 @@ const useHandleCanvasDblClick = () => {
|
|
|
3151
3155
|
return;
|
|
3152
3156
|
const p = getElementByDataBlockId(n, first(r));
|
|
3153
3157
|
if (p) {
|
|
3154
|
-
const
|
|
3155
|
-
if (
|
|
3156
|
-
const x = p.getAttribute("data-style-id"),
|
|
3157
|
-
l([{ id: x, prop:
|
|
3158
|
+
const m = p.getAttribute("data-style-prop");
|
|
3159
|
+
if (m) {
|
|
3160
|
+
const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
|
|
3161
|
+
l([{ id: x, prop: m, blockId: g }]);
|
|
3158
3162
|
}
|
|
3159
3163
|
}
|
|
3160
3164
|
}, 100);
|
|
@@ -3174,14 +3178,14 @@ const useHandleCanvasDblClick = () => {
|
|
|
3174
3178
|
}
|
|
3175
3179
|
);
|
|
3176
3180
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
|
|
3177
|
-
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks:
|
|
3181
|
+
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
|
|
3178
3182
|
useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
|
|
3179
3183
|
"ctrl+v,command+v",
|
|
3180
3184
|
() => {
|
|
3181
|
-
p(n[0]) &&
|
|
3185
|
+
p(n[0]) && m(n);
|
|
3182
3186
|
},
|
|
3183
3187
|
{},
|
|
3184
|
-
[n, p,
|
|
3188
|
+
[n, p, m]
|
|
3185
3189
|
);
|
|
3186
3190
|
const x = o ? { document: o } : {};
|
|
3187
3191
|
useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
|
|
@@ -3189,8 +3193,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3189
3193
|
l
|
|
3190
3194
|
]), useHotkeys(
|
|
3191
3195
|
"del, backspace",
|
|
3192
|
-
(
|
|
3193
|
-
|
|
3196
|
+
(g) => {
|
|
3197
|
+
g.preventDefault(), a(n);
|
|
3194
3198
|
},
|
|
3195
3199
|
x,
|
|
3196
3200
|
[n, a]
|
|
@@ -3221,15 +3225,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3221
3225
|
}
|
|
3222
3226
|
);
|
|
3223
3227
|
}, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
|
|
3224
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update:
|
|
3228
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
|
|
3225
3229
|
placement: "top-start",
|
|
3226
3230
|
middleware: [shift(), flip()],
|
|
3227
3231
|
elements: {
|
|
3228
3232
|
reference: o
|
|
3229
3233
|
}
|
|
3230
3234
|
});
|
|
3231
|
-
useResizeObserver(o, () =>
|
|
3232
|
-
const x = get(n, "_parent", null),
|
|
3235
|
+
useResizeObserver(o, () => m(), o !== null);
|
|
3236
|
+
const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3233
3237
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3234
3238
|
"div",
|
|
3235
3239
|
{
|
|
@@ -3255,7 +3259,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3255
3259
|
}
|
|
3256
3260
|
}
|
|
3257
3261
|
),
|
|
3258
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label:
|
|
3262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
|
|
3259
3263
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
|
|
3260
3264
|
canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3261
3265
|
PlusIcon,
|
|
@@ -3278,9 +3282,9 @@ const useHandleCanvasDblClick = () => {
|
|
|
3278
3282
|
}
|
|
3279
3283
|
) });
|
|
3280
3284
|
}, HeadTags = ({ model: o }) => {
|
|
3281
|
-
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [
|
|
3285
|
+
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [m] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
|
|
3282
3286
|
u == null ? void 0 : u.getElementById("selected-block")
|
|
3283
|
-
), [
|
|
3287
|
+
), [g] = useState(
|
|
3284
3288
|
u == null ? void 0 : u.getElementById("selected-styling-block")
|
|
3285
3289
|
), [E] = useState(
|
|
3286
3290
|
u == null ? void 0 : u.getElementById("dragged-block")
|
|
@@ -3288,7 +3292,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3288
3292
|
useEffect(() => {
|
|
3289
3293
|
a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
|
|
3290
3294
|
}, [a, u]);
|
|
3291
|
-
const
|
|
3295
|
+
const b = get(n, "headingFont", "DM Sans"), f = get(n, "bodyFont", "DM Sans");
|
|
3292
3296
|
return useEffect(() => {
|
|
3293
3297
|
const _ = get(n, "primaryColor", "#000"), v = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
|
|
3294
3298
|
{ color: _, name: "primary" },
|
|
@@ -3311,7 +3315,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3311
3315
|
}
|
|
3312
3316
|
},
|
|
3313
3317
|
fontFamily: {
|
|
3314
|
-
heading: [
|
|
3318
|
+
heading: [b],
|
|
3315
3319
|
body: [f]
|
|
3316
3320
|
},
|
|
3317
3321
|
borderRadius: {
|
|
@@ -3324,8 +3328,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3324
3328
|
typography$1,
|
|
3325
3329
|
forms,
|
|
3326
3330
|
aspectRatio,
|
|
3327
|
-
plugin(function({ addBase:
|
|
3328
|
-
|
|
3331
|
+
plugin(function({ addBase: j, theme: k }) {
|
|
3332
|
+
j({
|
|
3329
3333
|
"h1,h2,h3,h4,h5,h6": {
|
|
3330
3334
|
fontFamily: k("fontFamily.heading")
|
|
3331
3335
|
},
|
|
@@ -3342,25 +3346,25 @@ const useHandleCanvasDblClick = () => {
|
|
|
3342
3346
|
})
|
|
3343
3347
|
]
|
|
3344
3348
|
});
|
|
3345
|
-
}, [n, p,
|
|
3349
|
+
}, [n, p, b, f]), useEffect(() => {
|
|
3346
3350
|
x && (x.textContent = `${map(r, (_) => `[data-block-id="${_}"]`).join(",")}{
|
|
3347
3351
|
outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3348
3352
|
}`);
|
|
3349
3353
|
}, [r, x]), useEffect(() => {
|
|
3350
3354
|
E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3351
3355
|
}, [c, E]), useEffect(() => {
|
|
3352
|
-
|
|
3353
|
-
}, [l, r,
|
|
3354
|
-
|
|
3356
|
+
m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3357
|
+
}, [l, r, m]), useEffect(() => {
|
|
3358
|
+
g && (g.textContent = `${map(i, ({ id: _ }) => `[data-style-id="${_}"]`).join(",")}{
|
|
3355
3359
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3356
3360
|
}`);
|
|
3357
|
-
}, [i,
|
|
3361
|
+
}, [i, g]), useEffect(() => {
|
|
3358
3362
|
u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3359
|
-
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (
|
|
3363
|
+
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || f) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3360
3364
|
"link",
|
|
3361
3365
|
{
|
|
3362
3366
|
rel: "stylesheet",
|
|
3363
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3367
|
+
href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && f && b !== f ? "&" : ""}${f && f !== b ? `family=${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
|
|
3364
3368
|
}
|
|
3365
3369
|
) });
|
|
3366
3370
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
@@ -3371,13 +3375,13 @@ const useHandleCanvasDblClick = () => {
|
|
|
3371
3375
|
u || (u = d, d = "xs");
|
|
3372
3376
|
const p = r.indexOf(d);
|
|
3373
3377
|
if (p <= a) {
|
|
3374
|
-
const
|
|
3375
|
-
if (
|
|
3376
|
-
for (let
|
|
3377
|
-
i[
|
|
3378
|
+
const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
|
|
3379
|
+
if (m.includes(u))
|
|
3380
|
+
for (let g = p; g < r.length; g++)
|
|
3381
|
+
i[g] = !0;
|
|
3378
3382
|
else if (x.includes(u))
|
|
3379
|
-
for (let
|
|
3380
|
-
i[
|
|
3383
|
+
for (let g = p; g < r.length; g++)
|
|
3384
|
+
i[g] = !1;
|
|
3381
3385
|
}
|
|
3382
3386
|
}
|
|
3383
3387
|
return i[a];
|
|
@@ -3404,16 +3408,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3404
3408
|
forEach(d, (u) => {
|
|
3405
3409
|
if (get(n, u, "") || get(a, `${u}.loading`, !1))
|
|
3406
3410
|
return;
|
|
3407
|
-
const p = o.find((
|
|
3408
|
-
l((
|
|
3409
|
-
r((x) => ({ ...x, [u]:
|
|
3411
|
+
const p = o.find((m) => m._id === u);
|
|
3412
|
+
l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
|
|
3413
|
+
r((x) => ({ ...x, [u]: m })), l((x) => ({
|
|
3410
3414
|
...x,
|
|
3411
3415
|
[u]: { loading: !1, error: null }
|
|
3412
3416
|
}));
|
|
3413
|
-
}).catch((
|
|
3417
|
+
}).catch((m) => {
|
|
3414
3418
|
l((x) => ({
|
|
3415
3419
|
...x,
|
|
3416
|
-
[u]: { loading: !1, error:
|
|
3420
|
+
[u]: { loading: !1, error: m.message }
|
|
3417
3421
|
}));
|
|
3418
3422
|
});
|
|
3419
3423
|
});
|
|
@@ -3478,7 +3482,7 @@ function applyLanguage(o, n, r) {
|
|
|
3478
3482
|
}), a;
|
|
3479
3483
|
}
|
|
3480
3484
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3481
|
-
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks:
|
|
3485
|
+
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
|
|
3482
3486
|
(f) => f.reduce((_, v) => {
|
|
3483
3487
|
const S = get(u, v, {});
|
|
3484
3488
|
return { ..._, ...S };
|
|
@@ -3491,16 +3495,16 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3491
3495
|
return null;
|
|
3492
3496
|
const v = {}, S = filter(n, { _parent: f._id });
|
|
3493
3497
|
if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, f._type === "GlobalBlock") {
|
|
3494
|
-
const C =
|
|
3498
|
+
const C = m(f);
|
|
3495
3499
|
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
|
|
3496
3500
|
}
|
|
3497
3501
|
const B = getBlockComponent(f._type), w = get(B, "server", !1), A = w ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3498
3502
|
if (isNull(A))
|
|
3499
3503
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3500
|
-
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D =
|
|
3504
|
+
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = b(N), T = x(f);
|
|
3501
3505
|
if (get(T, "__isHidden", !1) && !includes(a, f._id))
|
|
3502
3506
|
return null;
|
|
3503
|
-
const
|
|
3507
|
+
const j = i && isDescendant(i._id, f._id, n), k = {
|
|
3504
3508
|
...includes(a, f._id) ? { "force-show": "" } : {},
|
|
3505
3509
|
"data-block-id": f._id,
|
|
3506
3510
|
"data-block-type": f._type,
|
|
@@ -3508,16 +3512,16 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3508
3512
|
// @ts-ignore
|
|
3509
3513
|
{
|
|
3510
3514
|
"data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3511
|
-
"data-dnd-dragged": i._id === f._id ||
|
|
3515
|
+
"data-dnd-dragged": i._id === f._id || j ? "yes" : "no"
|
|
3512
3516
|
}
|
|
3513
3517
|
) : {},
|
|
3514
|
-
...c === f._id && !
|
|
3518
|
+
...c === f._id && !j ? { "data-drop": "yes" } : {},
|
|
3515
3519
|
...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
|
|
3516
3520
|
};
|
|
3517
3521
|
return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
|
|
3518
3522
|
blockProps: k,
|
|
3519
3523
|
index: _,
|
|
3520
|
-
...applyBindings(applyLanguage(f, r, B),
|
|
3524
|
+
...applyBindings(applyLanguage(f, r, B), g),
|
|
3521
3525
|
...omit(T, ["__isHidden"]),
|
|
3522
3526
|
...v,
|
|
3523
3527
|
inBuilder: !0,
|
|
@@ -3571,7 +3575,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3571
3575
|
n(i);
|
|
3572
3576
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3573
3577
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3574
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [
|
|
3578
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), _ = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
|
|
3575
3579
|
u((N) => ({ ...N, width: A }));
|
|
3576
3580
|
};
|
|
3577
3581
|
useEffect(() => {
|
|
@@ -3591,15 +3595,15 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3591
3595
|
D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
|
|
3592
3596
|
}
|
|
3593
3597
|
}, [a]), useEffect(() => {
|
|
3594
|
-
if (!isEmpty(
|
|
3598
|
+
if (!isEmpty(b) && i.current) {
|
|
3595
3599
|
const A = getElementByStyleId(
|
|
3596
3600
|
i.current.contentDocument,
|
|
3597
|
-
first(
|
|
3601
|
+
first(b).id
|
|
3598
3602
|
);
|
|
3599
|
-
|
|
3603
|
+
g(A ? [A] : [null]);
|
|
3600
3604
|
} else
|
|
3601
|
-
|
|
3602
|
-
}, [
|
|
3605
|
+
g([null]);
|
|
3606
|
+
}, [b]);
|
|
3603
3607
|
const w = useMemo(() => {
|
|
3604
3608
|
let A = IframeInitialContent;
|
|
3605
3609
|
return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
|
|
@@ -3631,7 +3635,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3631
3635
|
BlockActionsStatic,
|
|
3632
3636
|
{
|
|
3633
3637
|
block: a,
|
|
3634
|
-
selectedBlockElement: first(
|
|
3638
|
+
selectedBlockElement: first(m)
|
|
3635
3639
|
}
|
|
3636
3640
|
),
|
|
3637
3641
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
|
|
@@ -3747,7 +3751,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3747
3751
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3748
3752
|
] }, l))
|
|
3749
3753
|
] }) });
|
|
3750
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3754
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-NKqXoCPq.js")), CanvasArea = () => {
|
|
3751
3755
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3752
3756
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3753
3757
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3827,11 +3831,11 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3827
3831
|
}, {
|
|
3828
3832
|
bodyFont: u,
|
|
3829
3833
|
headingFont: p,
|
|
3830
|
-
primaryColor:
|
|
3834
|
+
primaryColor: m,
|
|
3831
3835
|
bodyTextDarkColor: x,
|
|
3832
|
-
bodyTextLightColor:
|
|
3836
|
+
bodyTextLightColor: g,
|
|
3833
3837
|
bodyBgDarkColor: E,
|
|
3834
|
-
secondaryColor:
|
|
3838
|
+
secondaryColor: b,
|
|
3835
3839
|
bodyBgLightColor: f,
|
|
3836
3840
|
roundedCorners: _
|
|
3837
3841
|
} = r;
|
|
@@ -3850,8 +3854,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3850
3854
|
title: c("theme_config.rounded_corner"),
|
|
3851
3855
|
default: parseInt(_ || 5, 10)
|
|
3852
3856
|
}),
|
|
3853
|
-
primaryColor: h({ title: c("theme_config.primary"), default:
|
|
3854
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3857
|
+
primaryColor: h({ title: c("theme_config.primary"), default: m }),
|
|
3858
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: b })
|
|
3855
3859
|
};
|
|
3856
3860
|
l || (v = {
|
|
3857
3861
|
...v,
|
|
@@ -3869,7 +3873,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3869
3873
|
}),
|
|
3870
3874
|
bodyTextDarkColor: h({
|
|
3871
3875
|
title: c("theme_config.text_color_dark_mode"),
|
|
3872
|
-
default:
|
|
3876
|
+
default: g
|
|
3873
3877
|
})
|
|
3874
3878
|
});
|
|
3875
3879
|
const S = {
|
|
@@ -4074,7 +4078,7 @@ function BiExpandVertical(o) {
|
|
|
4074
4078
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4075
4079
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4076
4080
|
let p = null;
|
|
4077
|
-
const
|
|
4081
|
+
const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: b, isDragging: f, isEditing: _, handleClick: v } = o, S = (T) => {
|
|
4078
4082
|
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4079
4083
|
}, B = (T) => {
|
|
4080
4084
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
@@ -4085,21 +4089,21 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4085
4089
|
};
|
|
4086
4090
|
useEffect(() => {
|
|
4087
4091
|
const T = setTimeout(() => {
|
|
4088
|
-
|
|
4092
|
+
b && !o.isOpen && !f && !i.includes(x) && o.toggle();
|
|
4089
4093
|
}, 500);
|
|
4090
4094
|
return () => clearTimeout(T);
|
|
4091
|
-
}, [
|
|
4095
|
+
}, [b, o, f]);
|
|
4092
4096
|
const N = useMemo(() => {
|
|
4093
|
-
const T = Object.keys(
|
|
4097
|
+
const T = Object.keys(g), j = [];
|
|
4094
4098
|
for (let k = 0; k < T.length; k++)
|
|
4095
4099
|
if (T[k].endsWith("_attrs")) {
|
|
4096
|
-
const C =
|
|
4097
|
-
R.match(/x-data/) &&
|
|
4100
|
+
const C = g[T[k]], R = Object.keys(C).join("|");
|
|
4101
|
+
R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
|
|
4098
4102
|
}
|
|
4099
|
-
return
|
|
4100
|
-
}, [
|
|
4103
|
+
return j;
|
|
4104
|
+
}, [g]), D = (T, j) => {
|
|
4101
4105
|
const k = u.contentDocument || u.contentWindow.document, C = k.querySelector(`[data-block-id=${T}]`);
|
|
4102
|
-
C && C.setAttribute("data-drop",
|
|
4106
|
+
C && C.setAttribute("data-drop", j);
|
|
4103
4107
|
const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
4104
4108
|
R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (k.documentElement.scrollTop = C.offsetTop - I.top);
|
|
4105
4109
|
};
|
|
@@ -4135,7 +4139,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4135
4139
|
className: cn(
|
|
4136
4140
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4137
4141
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4138
|
-
|
|
4142
|
+
b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
|
|
4139
4143
|
f && "opacity-20",
|
|
4140
4144
|
i.includes(x) ? "opacity-50" : ""
|
|
4141
4145
|
),
|
|
@@ -4145,11 +4149,11 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4145
4149
|
"div",
|
|
4146
4150
|
{
|
|
4147
4151
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
4148
|
-
children:
|
|
4152
|
+
children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4149
4153
|
}
|
|
4150
4154
|
),
|
|
4151
4155
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4152
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4156
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
|
|
4153
4157
|
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4154
4158
|
"div",
|
|
4155
4159
|
{
|
|
@@ -4158,7 +4162,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4158
4162
|
T.stopPropagation(), o.edit(), o.deselect();
|
|
4159
4163
|
},
|
|
4160
4164
|
children: [
|
|
4161
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4165
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
|
|
4162
4166
|
N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4163
4167
|
N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4164
4168
|
N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
@@ -4179,7 +4183,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4179
4183
|
),
|
|
4180
4184
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
|
|
4181
4185
|
] })),
|
|
4182
|
-
canAddChildBlock(
|
|
4186
|
+
canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4183
4187
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4184
4188
|
TooltipTrigger,
|
|
4185
4189
|
{
|
|
@@ -4551,8 +4555,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4551
4555
|
const c = stringify([r]);
|
|
4552
4556
|
return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
|
|
4553
4557
|
} else if (r.tagName === "svg") {
|
|
4554
|
-
const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px",
|
|
4555
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`,
|
|
4558
|
+
const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4559
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
|
|
4556
4560
|
} else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
|
|
4557
4561
|
return n.block.options.push({
|
|
4558
4562
|
label: getTextContent(r.children),
|
|
@@ -4613,13 +4617,13 @@ function ExpandableObject(o) {
|
|
|
4613
4617
|
level: d,
|
|
4614
4618
|
style: u,
|
|
4615
4619
|
shouldExpandNode: p,
|
|
4616
|
-
clickToExpandNode:
|
|
4620
|
+
clickToExpandNode: m
|
|
4617
4621
|
} = o;
|
|
4618
|
-
const x = useRef(!1), [
|
|
4622
|
+
const x = useRef(!1), [g, E, b] = useBool(() => p(d, r, n));
|
|
4619
4623
|
useEffect(() => {
|
|
4620
|
-
x.current ?
|
|
4624
|
+
x.current ? b(p(d, r, n)) : x.current = !0;
|
|
4621
4625
|
}, [p]);
|
|
4622
|
-
const f =
|
|
4626
|
+
const f = g ? u.collapseIcon : u.expandIcon, _ = g ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, w = (A) => {
|
|
4623
4627
|
A.key === " " && (A.preventDefault(), E());
|
|
4624
4628
|
};
|
|
4625
4629
|
return /* @__PURE__ */ createElement("div", {
|
|
@@ -4632,9 +4636,9 @@ function ExpandableObject(o) {
|
|
|
4632
4636
|
role: "button",
|
|
4633
4637
|
tabIndex: 0,
|
|
4634
4638
|
"aria-label": _,
|
|
4635
|
-
"aria-expanded":
|
|
4636
|
-
"aria-controls":
|
|
4637
|
-
}), n && (
|
|
4639
|
+
"aria-expanded": g,
|
|
4640
|
+
"aria-controls": g ? v : void 0
|
|
4641
|
+
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4638
4642
|
className: u.clickableLabel,
|
|
4639
4643
|
onClick: E,
|
|
4640
4644
|
onKeyDown: w,
|
|
@@ -4644,7 +4648,7 @@ function ExpandableObject(o) {
|
|
|
4644
4648
|
className: u.label
|
|
4645
4649
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4646
4650
|
className: u.punctuation
|
|
4647
|
-
}, i),
|
|
4651
|
+
}, i), g ? /* @__PURE__ */ createElement("div", {
|
|
4648
4652
|
id: v
|
|
4649
4653
|
}, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4650
4654
|
key: A[0] || N,
|
|
@@ -4654,7 +4658,7 @@ function ExpandableObject(o) {
|
|
|
4654
4658
|
lastElement: N === B,
|
|
4655
4659
|
level: S,
|
|
4656
4660
|
shouldExpandNode: p,
|
|
4657
|
-
clickToExpandNode:
|
|
4661
|
+
clickToExpandNode: m
|
|
4658
4662
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4659
4663
|
className: u.collapsedContent,
|
|
4660
4664
|
onClick: E,
|
|
@@ -4663,7 +4667,7 @@ function ExpandableObject(o) {
|
|
|
4663
4667
|
tabIndex: -1,
|
|
4664
4668
|
"aria-hidden": !0,
|
|
4665
4669
|
"aria-label": _,
|
|
4666
|
-
"aria-expanded":
|
|
4670
|
+
"aria-expanded": g
|
|
4667
4671
|
}), /* @__PURE__ */ createElement("span", {
|
|
4668
4672
|
className: u.punctuation
|
|
4669
4673
|
}, c), !l && /* @__PURE__ */ createElement("span", {
|
|
@@ -4816,15 +4820,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4816
4820
|
dataType: i,
|
|
4817
4821
|
appliedBindings: c
|
|
4818
4822
|
}) => {
|
|
4819
|
-
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {},
|
|
4820
|
-
(
|
|
4821
|
-
) : d.filter((
|
|
4823
|
+
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
|
|
4824
|
+
(b) => !includes(c, b) && get(p, `props.${first(split(b, "."))}.binding`)
|
|
4825
|
+
) : d.filter((b) => i === get(u, b, "")), [o, d, c, i, p]);
|
|
4822
4826
|
return useEffect(() => {
|
|
4823
4827
|
n && l(n);
|
|
4824
4828
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4825
4829
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
4826
4830
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
|
|
4827
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange:
|
|
4831
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
|
|
4828
4832
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4829
4833
|
Button,
|
|
4830
4834
|
{
|
|
@@ -4833,7 +4837,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4833
4837
|
className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
|
|
4834
4838
|
children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4835
4839
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
|
|
4836
|
-
|
|
4840
|
+
m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
|
|
4837
4841
|
n
|
|
4838
4842
|
] }),
|
|
4839
4843
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
|
|
@@ -4847,29 +4851,29 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4847
4851
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4848
4852
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4849
4853
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4850
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (
|
|
4854
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4851
4855
|
CommandItem,
|
|
4852
4856
|
{
|
|
4853
|
-
value:
|
|
4854
|
-
className: `cursor-pointer ${
|
|
4857
|
+
value: b,
|
|
4858
|
+
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4855
4859
|
onSelect: (f) => {
|
|
4856
|
-
r(find(E, (_) => _ === f) || null),
|
|
4860
|
+
r(find(E, (_) => _ === f) || null), g(!1);
|
|
4857
4861
|
},
|
|
4858
4862
|
children: [
|
|
4859
4863
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4860
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4861
|
-
|
|
4864
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
|
|
4865
|
+
b
|
|
4862
4866
|
] }),
|
|
4863
|
-
|
|
4867
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
|
|
4864
4868
|
]
|
|
4865
4869
|
},
|
|
4866
|
-
|
|
4870
|
+
b
|
|
4867
4871
|
)) })
|
|
4868
4872
|
] })
|
|
4869
4873
|
] }) })
|
|
4870
4874
|
] })
|
|
4871
4875
|
] }),
|
|
4872
|
-
!
|
|
4876
|
+
!m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
|
|
4873
4877
|
] });
|
|
4874
4878
|
}, AddBindingModalContent = ({
|
|
4875
4879
|
appliedBindings: o = [],
|
|
@@ -4877,12 +4881,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4877
4881
|
editMode: r,
|
|
4878
4882
|
item: a
|
|
4879
4883
|
}) => {
|
|
4880
|
-
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(),
|
|
4881
|
-
(E,
|
|
4884
|
+
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4885
|
+
(E, b) => {
|
|
4882
4886
|
if (isEmpty(E))
|
|
4883
4887
|
return "";
|
|
4884
4888
|
{
|
|
4885
|
-
const f = get(
|
|
4889
|
+
const f = get(b === "PROP" ? u : p, E, "");
|
|
4886
4890
|
if (isArray$1(f))
|
|
4887
4891
|
return "list";
|
|
4888
4892
|
const _ = typeof f;
|
|
@@ -4890,7 +4894,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4890
4894
|
}
|
|
4891
4895
|
},
|
|
4892
4896
|
[u, p]
|
|
4893
|
-
), [x,
|
|
4897
|
+
), [x, g] = useState(r ? m(a.key, "PROP") : "");
|
|
4894
4898
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4895
4899
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
|
|
4896
4900
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
|
|
@@ -4906,8 +4910,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4906
4910
|
value: l,
|
|
4907
4911
|
setValue: i,
|
|
4908
4912
|
onChange: (E) => {
|
|
4909
|
-
const
|
|
4910
|
-
i(E), x !==
|
|
4913
|
+
const b = m(E, "PROP");
|
|
4914
|
+
i(E), x !== b && d(""), g(b);
|
|
4911
4915
|
},
|
|
4912
4916
|
data: u,
|
|
4913
4917
|
dataType: x,
|
|
@@ -4924,8 +4928,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4924
4928
|
value: c,
|
|
4925
4929
|
setValue: d,
|
|
4926
4930
|
onChange: (E) => {
|
|
4927
|
-
const
|
|
4928
|
-
d(x ===
|
|
4931
|
+
const b = m(E, "PATH");
|
|
4932
|
+
d(x === b ? E : "");
|
|
4929
4933
|
},
|
|
4930
4934
|
data: p,
|
|
4931
4935
|
dataType: x,
|
|
@@ -4968,15 +4972,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4968
4972
|
dataProvider: l,
|
|
4969
4973
|
appliedBindings: i
|
|
4970
4974
|
}) => {
|
|
4971
|
-
const [c, d] = useState("string"), u = (p,
|
|
4975
|
+
const [c, d] = useState("string"), u = (p, m) => {
|
|
4972
4976
|
if (isEmpty(p))
|
|
4973
4977
|
return "";
|
|
4974
4978
|
{
|
|
4975
|
-
const x = get(
|
|
4979
|
+
const x = get(m === "PROP" ? a : l, p, "");
|
|
4976
4980
|
if (isArray$1(x))
|
|
4977
4981
|
return "list";
|
|
4978
|
-
const
|
|
4979
|
-
return
|
|
4982
|
+
const g = typeof x;
|
|
4983
|
+
return g === "string" ? "text" : g === "object" ? "model" : g;
|
|
4980
4984
|
}
|
|
4981
4985
|
};
|
|
4982
4986
|
return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
|
|
@@ -4997,10 +5001,10 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4997
5001
|
] });
|
|
4998
5002
|
}, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
|
|
4999
5003
|
const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
|
|
5000
|
-
map(o, (x,
|
|
5004
|
+
map(o, (x, g) => ({ key: g, value: x }))
|
|
5001
5005
|
);
|
|
5002
5006
|
useEffect(() => {
|
|
5003
|
-
c(map(o, (x,
|
|
5007
|
+
c(map(o, (x, g) => ({ key: g, value: x })));
|
|
5004
5008
|
}, [r == null ? void 0 : r._id, o]);
|
|
5005
5009
|
const d = useMemo(() => {
|
|
5006
5010
|
if (isEmpty(a))
|
|
@@ -5010,21 +5014,21 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5010
5014
|
const x = last(i);
|
|
5011
5015
|
return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
|
|
5012
5016
|
}, [a, i]), u = (x) => {
|
|
5013
|
-
const
|
|
5014
|
-
c([...
|
|
5017
|
+
const g = filter(i, (E) => E.key !== x.key);
|
|
5018
|
+
c([...g, x]), m([...g, x]);
|
|
5015
5019
|
}, p = (x) => {
|
|
5016
|
-
const
|
|
5017
|
-
|
|
5018
|
-
},
|
|
5020
|
+
const g = filter(i, (E, b) => x !== b);
|
|
5021
|
+
m([...g]);
|
|
5022
|
+
}, m = useCallback(
|
|
5019
5023
|
(x = []) => {
|
|
5020
5024
|
if (c(x), isEmpty(x)) {
|
|
5021
5025
|
n({});
|
|
5022
5026
|
return;
|
|
5023
5027
|
}
|
|
5024
|
-
const
|
|
5028
|
+
const g = {};
|
|
5025
5029
|
forEach(x, (E) => {
|
|
5026
|
-
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(
|
|
5027
|
-
}), n(
|
|
5030
|
+
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
|
|
5031
|
+
}), n(g);
|
|
5028
5032
|
},
|
|
5029
5033
|
[n]
|
|
5030
5034
|
);
|
|
@@ -5033,12 +5037,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5033
5037
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
5034
5038
|
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
5035
5039
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
5036
|
-
map(i, (x,
|
|
5040
|
+
map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5037
5041
|
NewDataBindingPair,
|
|
5038
5042
|
{
|
|
5039
5043
|
item: x,
|
|
5040
5044
|
onAddBinding: u,
|
|
5041
|
-
onRemove: () => p(
|
|
5045
|
+
onRemove: () => p(g),
|
|
5042
5046
|
selectedBlock: r,
|
|
5043
5047
|
dataProvider: a,
|
|
5044
5048
|
appliedBindings: map(i, "key")
|
|
@@ -5132,7 +5136,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5132
5136
|
}
|
|
5133
5137
|
)
|
|
5134
5138
|
] });
|
|
5135
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5139
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Z3xcNddA.js")), UploadImages = React__default.lazy(() => import("./UploadImages-v50EQZLT.js")), ImagesPanel = ({
|
|
5136
5140
|
isModalView: o = !1,
|
|
5137
5141
|
onSelect: n = () => {
|
|
5138
5142
|
}
|
|
@@ -5291,19 +5295,19 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5291
5295
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
|
|
5292
5296
|
] });
|
|
5293
5297
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5294
|
-
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
|
|
5295
|
-
Object.keys(n).forEach((
|
|
5296
|
-
const
|
|
5297
|
-
if (includes(["slot", "styles"],
|
|
5298
|
+
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: x } = useLanguages(), g = x.length === 0 ? "" : p.length ? p : m;
|
|
5299
|
+
Object.keys(n).forEach((b) => {
|
|
5300
|
+
const f = n[b];
|
|
5301
|
+
if (includes(["slot", "styles"], f.type))
|
|
5298
5302
|
return;
|
|
5299
|
-
const
|
|
5300
|
-
c.properties[
|
|
5303
|
+
const _ = b;
|
|
5304
|
+
c.properties[_] = getBlockJSONFromSchemas(f, u, g), d[_] = getBlockJSONFromUISchemas(f);
|
|
5301
5305
|
}), useEffect(() => {
|
|
5302
5306
|
i(r);
|
|
5303
|
-
}, [o]);
|
|
5304
|
-
const
|
|
5305
|
-
async ({ formData:
|
|
5306
|
-
a({ formData:
|
|
5307
|
+
}, [o, p]);
|
|
5308
|
+
const E = useThrottledCallback(
|
|
5309
|
+
async ({ formData: b }, f) => {
|
|
5310
|
+
a({ formData: b }, f);
|
|
5307
5311
|
},
|
|
5308
5312
|
[a],
|
|
5309
5313
|
1e3
|
|
@@ -5329,8 +5333,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5329
5333
|
uiSchema: d,
|
|
5330
5334
|
schema: c,
|
|
5331
5335
|
formData: l,
|
|
5332
|
-
onChange: ({ formData:
|
|
5333
|
-
|
|
5336
|
+
onChange: ({ formData: b }, f) => {
|
|
5337
|
+
f && (i(b), E({ formData: b }, f));
|
|
5334
5338
|
}
|
|
5335
5339
|
}
|
|
5336
5340
|
);
|
|
@@ -5404,7 +5408,7 @@ function BlockSettings() {
|
|
|
5404
5408
|
const S = _.replace("root.", "");
|
|
5405
5409
|
a([n._id], { [S]: get(f, S) }, v);
|
|
5406
5410
|
}
|
|
5407
|
-
},
|
|
5411
|
+
}, m = useCallback(
|
|
5408
5412
|
debounce(({ formData: f }, _, v) => {
|
|
5409
5413
|
p({ formData: f }, _, v), d(f);
|
|
5410
5414
|
}, 1500),
|
|
@@ -5415,14 +5419,14 @@ function BlockSettings() {
|
|
|
5415
5419
|
r(
|
|
5416
5420
|
[n._id],
|
|
5417
5421
|
convertDotNotationToObject(v, get(f, v.split(".")))
|
|
5418
|
-
),
|
|
5422
|
+
), m({ formData: f }, _, { [v]: get(c, v) });
|
|
5419
5423
|
}
|
|
5420
|
-
},
|
|
5424
|
+
}, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
|
|
5421
5425
|
const f = cloneDeep(get(l, "props", {}));
|
|
5422
5426
|
return each(f, (_, v) => {
|
|
5423
5427
|
get(_, "hidden", !1) && delete f[v];
|
|
5424
|
-
}), u && each(
|
|
5425
|
-
}, [l,
|
|
5428
|
+
}), u && each(g, (_) => delete f[_]), f;
|
|
5429
|
+
}, [l, g, u]), b = get(l, "server", !1);
|
|
5426
5430
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5427
5431
|
u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5428
5432
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
@@ -5451,11 +5455,11 @@ function BlockSettings() {
|
|
|
5451
5455
|
"Static Content"
|
|
5452
5456
|
] }) }),
|
|
5453
5457
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
|
|
5454
|
-
isEmpty(
|
|
5458
|
+
isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
|
|
5455
5459
|
"Data binding is set for ",
|
|
5456
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(
|
|
5460
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(g, capitalize).join(", ") }),
|
|
5457
5461
|
" ",
|
|
5458
|
-
|
|
5462
|
+
g.length === 1 ? "property" : "properties",
|
|
5459
5463
|
". Remove data binding to edit static content."
|
|
5460
5464
|
] }),
|
|
5461
5465
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5479,7 +5483,7 @@ function BlockSettings() {
|
|
|
5479
5483
|
}
|
|
5480
5484
|
),
|
|
5481
5485
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5482
|
-
|
|
5486
|
+
b ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
|
|
5483
5487
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5484
5488
|
] });
|
|
5485
5489
|
}
|
|
@@ -5503,25 +5507,25 @@ function promptWithLanguage(o, n, r) {
|
|
|
5503
5507
|
${a}`;
|
|
5504
5508
|
}
|
|
5505
5509
|
const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
5506
|
-
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(),
|
|
5510
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), m = u.length ? u : p;
|
|
5507
5511
|
return {
|
|
5508
5512
|
askAi: useCallback(
|
|
5509
|
-
async (x,
|
|
5513
|
+
async (x, g, E, b) => {
|
|
5510
5514
|
if (l) {
|
|
5511
5515
|
n(!0), a(null);
|
|
5512
5516
|
try {
|
|
5513
|
-
const f = x === "content" ? cloneDeep(getBlockWithChildren(
|
|
5517
|
+
const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((B) => B._id === g))];
|
|
5514
5518
|
set(f, "0._parent", null);
|
|
5515
|
-
const _ = await l(x, promptWithLanguage(E,
|
|
5519
|
+
const _ = await l(x, promptWithLanguage(E, m, x), f), { blocks: v, error: S } = _;
|
|
5516
5520
|
if (S) {
|
|
5517
5521
|
a(S);
|
|
5518
5522
|
return;
|
|
5519
5523
|
}
|
|
5520
|
-
x === "styles" ? c(v) : i(v),
|
|
5524
|
+
x === "styles" ? c(v) : i(v), b && b(_);
|
|
5521
5525
|
} catch (f) {
|
|
5522
5526
|
a(f);
|
|
5523
5527
|
} finally {
|
|
5524
|
-
n(!1),
|
|
5528
|
+
n(!1), b && b();
|
|
5525
5529
|
}
|
|
5526
5530
|
}
|
|
5527
5531
|
},
|
|
@@ -5593,14 +5597,14 @@ function Countdown() {
|
|
|
5593
5597
|
] });
|
|
5594
5598
|
}
|
|
5595
5599
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5596
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p,
|
|
5600
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
|
|
5597
5601
|
useEffect(() => {
|
|
5598
|
-
var
|
|
5599
|
-
(
|
|
5602
|
+
var g;
|
|
5603
|
+
(g = d.current) == null || g.focus();
|
|
5600
5604
|
}, []);
|
|
5601
|
-
const x = (
|
|
5602
|
-
const { usage: E } =
|
|
5603
|
-
!l && E &&
|
|
5605
|
+
const x = (g) => {
|
|
5606
|
+
const { usage: E } = g || {};
|
|
5607
|
+
!l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5604
5608
|
};
|
|
5605
5609
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5606
5610
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5609,12 +5613,12 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5609
5613
|
{
|
|
5610
5614
|
ref: d,
|
|
5611
5615
|
value: i,
|
|
5612
|
-
onChange: (
|
|
5616
|
+
onChange: (g) => c(g.target.value),
|
|
5613
5617
|
placeholder: n("ask_ai_to_edit_styles"),
|
|
5614
5618
|
className: "w-full border border-border focus:border-0",
|
|
5615
5619
|
rows: 3,
|
|
5616
|
-
onKeyDown: (
|
|
5617
|
-
|
|
5620
|
+
onKeyDown: (g) => {
|
|
5621
|
+
g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
|
|
5618
5622
|
}
|
|
5619
5623
|
}
|
|
5620
5624
|
),
|
|
@@ -5624,7 +5628,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5624
5628
|
{
|
|
5625
5629
|
disabled: i.trim().length < 5 || a,
|
|
5626
5630
|
onClick: () => {
|
|
5627
|
-
u.current && clearTimeout(u.current),
|
|
5631
|
+
u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
|
|
5628
5632
|
},
|
|
5629
5633
|
variant: "default",
|
|
5630
5634
|
className: "w-fit",
|
|
@@ -5661,23 +5665,23 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5661
5665
|
});
|
|
5662
5666
|
function ManualClasses() {
|
|
5663
5667
|
var A;
|
|
5664
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(),
|
|
5668
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
|
|
5665
5669
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5666
5670
|
a(i, N, !0), u("");
|
|
5667
|
-
}, [E,
|
|
5671
|
+
}, [E, b] = useState([]), f = ({ value: N }) => {
|
|
5668
5672
|
const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
|
|
5669
|
-
let
|
|
5673
|
+
let j = [];
|
|
5670
5674
|
if (T && T.length > 0) {
|
|
5671
5675
|
const [k] = T, C = D.replace(k, "");
|
|
5672
|
-
|
|
5676
|
+
j = fuse.search(C).map((I) => ({
|
|
5673
5677
|
...I,
|
|
5674
5678
|
item: { ...I.item, name: k + I.item.name }
|
|
5675
5679
|
}));
|
|
5676
5680
|
} else
|
|
5677
|
-
|
|
5678
|
-
return
|
|
5681
|
+
j = fuse.search(D);
|
|
5682
|
+
return b(map(j, "item"));
|
|
5679
5683
|
}, _ = () => {
|
|
5680
|
-
|
|
5684
|
+
b([]);
|
|
5681
5685
|
}, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5682
5686
|
autoComplete: "off",
|
|
5683
5687
|
autoCorrect: "off",
|
|
@@ -5686,7 +5690,7 @@ function ManualClasses() {
|
|
|
5686
5690
|
placeholder: o("enter_classes_separated_by_space"),
|
|
5687
5691
|
value: d,
|
|
5688
5692
|
onKeyDown: (N) => {
|
|
5689
|
-
N.key === "Enter" && d.trim() !== "" &&
|
|
5693
|
+
N.key === "Enter" && d.trim() !== "" && g();
|
|
5690
5694
|
},
|
|
5691
5695
|
onChange: (N, { newValue: D }) => u(D),
|
|
5692
5696
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -5750,7 +5754,7 @@ function ManualClasses() {
|
|
|
5750
5754
|
{
|
|
5751
5755
|
variant: "outline",
|
|
5752
5756
|
className: "h-6 border-border",
|
|
5753
|
-
onClick:
|
|
5757
|
+
onClick: g,
|
|
5754
5758
|
disabled: d.trim() === "",
|
|
5755
5759
|
size: "sm",
|
|
5756
5760
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -6164,24 +6168,24 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6164
6168
|
ringColor: "ring",
|
|
6165
6169
|
ringOffsetColor: "ring-offset"
|
|
6166
6170
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6167
|
-
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"),
|
|
6171
|
+
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
|
|
6168
6172
|
// eslint-disable-next-line no-shadow
|
|
6169
|
-
(
|
|
6170
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6173
|
+
(b) => {
|
|
6174
|
+
["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: b, shade: f.shade ? f.shade : "500" })));
|
|
6171
6175
|
},
|
|
6172
6176
|
[c, u]
|
|
6173
6177
|
);
|
|
6174
6178
|
useEffect(() => {
|
|
6175
|
-
if (["current", "inherit", "transparent", "black", "white"].includes(
|
|
6179
|
+
if (["current", "inherit", "transparent", "black", "white"].includes(m))
|
|
6176
6180
|
return c([]);
|
|
6177
6181
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6178
|
-
}, [
|
|
6182
|
+
}, [m]);
|
|
6179
6183
|
const E = useCallback(
|
|
6180
6184
|
// eslint-disable-next-line no-shadow
|
|
6181
|
-
(
|
|
6182
|
-
u({ color:
|
|
6185
|
+
(b) => {
|
|
6186
|
+
u({ color: m, shade: b });
|
|
6183
6187
|
},
|
|
6184
|
-
[
|
|
6188
|
+
[m]
|
|
6185
6189
|
);
|
|
6186
6190
|
return useEffect(() => {
|
|
6187
6191
|
u({ color: "", shade: "" });
|
|
@@ -6194,8 +6198,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6194
6198
|
{
|
|
6195
6199
|
disabled: !l,
|
|
6196
6200
|
rounded: !0,
|
|
6197
|
-
selected:
|
|
6198
|
-
onChange:
|
|
6201
|
+
selected: m,
|
|
6202
|
+
onChange: g,
|
|
6199
6203
|
options: [
|
|
6200
6204
|
"current",
|
|
6201
6205
|
"transparent",
|
|
@@ -6228,7 +6232,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6228
6232
|
]
|
|
6229
6233
|
}
|
|
6230
6234
|
) }),
|
|
6231
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !
|
|
6235
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: E, options: i }) })
|
|
6232
6236
|
] });
|
|
6233
6237
|
}, getUserInputValues = (o, n) => {
|
|
6234
6238
|
o = o.toLowerCase();
|
|
@@ -6423,20 +6427,20 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6423
6427
|
},
|
|
6424
6428
|
a
|
|
6425
6429
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6426
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative:
|
|
6430
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, b] = useState(!1), [f, _] = useState(""), [v, S] = useState(!1), [B, w] = useState(!1);
|
|
6427
6431
|
useEffect(() => {
|
|
6428
|
-
const { value:
|
|
6432
|
+
const { value: j, unit: k } = getClassValueAndUnit(i);
|
|
6429
6433
|
if (k === "") {
|
|
6430
|
-
l(
|
|
6434
|
+
l(j), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6431
6435
|
return;
|
|
6432
6436
|
}
|
|
6433
|
-
|
|
6437
|
+
g(k), l(k === "class" || isEmpty(j) ? "" : j);
|
|
6434
6438
|
}, [i, u, p]);
|
|
6435
|
-
const A = useThrottledCallback((
|
|
6436
|
-
(
|
|
6439
|
+
const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6440
|
+
(j = !1) => {
|
|
6437
6441
|
const k = getUserInputValues(`${a}`, p);
|
|
6438
6442
|
if (get(k, "error", !1)) {
|
|
6439
|
-
|
|
6443
|
+
b(!0);
|
|
6440
6444
|
return;
|
|
6441
6445
|
}
|
|
6442
6446
|
const C = get(k, "unit") !== "" ? get(k, "unit") : x;
|
|
@@ -6447,23 +6451,23 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6447
6451
|
if (get(k, "value") === "")
|
|
6448
6452
|
return;
|
|
6449
6453
|
const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6450
|
-
|
|
6454
|
+
j ? N(I) : A(I);
|
|
6451
6455
|
},
|
|
6452
6456
|
[A, N, a, x, d, p]
|
|
6453
6457
|
), T = useCallback(
|
|
6454
|
-
(
|
|
6458
|
+
(j) => {
|
|
6455
6459
|
const k = getUserInputValues(`${a}`, p);
|
|
6456
6460
|
if (get(k, "error", !1)) {
|
|
6457
|
-
|
|
6461
|
+
b(!0);
|
|
6458
6462
|
return;
|
|
6459
6463
|
}
|
|
6460
|
-
if (
|
|
6461
|
-
A(`${d}${
|
|
6464
|
+
if (j === "auto" || j === "none") {
|
|
6465
|
+
A(`${d}${j}`);
|
|
6462
6466
|
return;
|
|
6463
6467
|
}
|
|
6464
6468
|
if (get(k, "value") === "")
|
|
6465
6469
|
return;
|
|
6466
|
-
const C = get(k, "unit") !== "" ? get(k, "unit") :
|
|
6470
|
+
const C = get(k, "unit") !== "" ? get(k, "unit") : j, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6467
6471
|
A(I);
|
|
6468
6472
|
},
|
|
6469
6473
|
[A, a, d, p]
|
|
@@ -6480,29 +6484,29 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6480
6484
|
"input",
|
|
6481
6485
|
{
|
|
6482
6486
|
readOnly: x === "class",
|
|
6483
|
-
onKeyPress: (
|
|
6484
|
-
|
|
6487
|
+
onKeyPress: (j) => {
|
|
6488
|
+
j.key === "Enter" && D();
|
|
6485
6489
|
},
|
|
6486
|
-
onKeyDown: (
|
|
6487
|
-
if (
|
|
6490
|
+
onKeyDown: (j) => {
|
|
6491
|
+
if (j.keyCode !== 38 && j.keyCode !== 40)
|
|
6488
6492
|
return;
|
|
6489
|
-
|
|
6490
|
-
const k = parseInt$1(
|
|
6493
|
+
j.preventDefault(), w(!0);
|
|
6494
|
+
const k = parseInt$1(j.target.value);
|
|
6491
6495
|
let C = isNaN$1(k) ? 0 : k;
|
|
6492
|
-
|
|
6496
|
+
j.keyCode === 38 && (C += 1), j.keyCode === 40 && (C -= 1);
|
|
6493
6497
|
const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6494
6498
|
N(L);
|
|
6495
6499
|
},
|
|
6496
|
-
onKeyUp: (
|
|
6497
|
-
B && (
|
|
6500
|
+
onKeyUp: (j) => {
|
|
6501
|
+
B && (j.preventDefault(), w(!1));
|
|
6498
6502
|
},
|
|
6499
6503
|
onBlur: () => D(),
|
|
6500
|
-
onChange: (
|
|
6501
|
-
|
|
6504
|
+
onChange: (j) => {
|
|
6505
|
+
b(!1), l(j.target.value);
|
|
6502
6506
|
},
|
|
6503
|
-
onClick: (
|
|
6507
|
+
onClick: (j) => {
|
|
6504
6508
|
var k;
|
|
6505
|
-
(k =
|
|
6509
|
+
(k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
|
|
6506
6510
|
},
|
|
6507
6511
|
value: v ? f : a,
|
|
6508
6512
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -6529,8 +6533,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6529
6533
|
{
|
|
6530
6534
|
units: p,
|
|
6531
6535
|
current: x,
|
|
6532
|
-
onSelect: (
|
|
6533
|
-
r(!1),
|
|
6536
|
+
onSelect: (j) => {
|
|
6537
|
+
r(!1), g(j), T(j);
|
|
6534
6538
|
}
|
|
6535
6539
|
}
|
|
6536
6540
|
) }) })
|
|
@@ -6540,22 +6544,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6540
6544
|
DragStyleButton,
|
|
6541
6545
|
{
|
|
6542
6546
|
onDragStart: () => S(!0),
|
|
6543
|
-
onDragEnd: (
|
|
6544
|
-
if (_(() => ""), S(!1), isEmpty(
|
|
6547
|
+
onDragEnd: (j) => {
|
|
6548
|
+
if (_(() => ""), S(!1), isEmpty(j))
|
|
6545
6549
|
return;
|
|
6546
|
-
const k = `${
|
|
6550
|
+
const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6547
6551
|
A(R);
|
|
6548
6552
|
},
|
|
6549
|
-
onDrag: (
|
|
6550
|
-
if (isEmpty(
|
|
6553
|
+
onDrag: (j) => {
|
|
6554
|
+
if (isEmpty(j))
|
|
6551
6555
|
return;
|
|
6552
|
-
_(
|
|
6553
|
-
const k = `${
|
|
6556
|
+
_(j);
|
|
6557
|
+
const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6554
6558
|
N(R);
|
|
6555
6559
|
},
|
|
6556
6560
|
currentValue: a,
|
|
6557
6561
|
unit: x,
|
|
6558
|
-
negative:
|
|
6562
|
+
negative: m,
|
|
6559
6563
|
cssProperty: u
|
|
6560
6564
|
}
|
|
6561
6565
|
)
|
|
@@ -6648,17 +6652,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6648
6652
|
"2xl": "1536px"
|
|
6649
6653
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6650
6654
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6651
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [,
|
|
6655
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), _ = useCallback(
|
|
6652
6656
|
(N, D = !0) => {
|
|
6653
|
-
const T = { dark: u, mq:
|
|
6657
|
+
const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
|
|
6654
6658
|
(u || p !== "") && (T.mq = "xs");
|
|
6655
|
-
const
|
|
6656
|
-
|
|
6659
|
+
const j = generateFullClsName(T);
|
|
6660
|
+
g(b, [j], D);
|
|
6657
6661
|
},
|
|
6658
|
-
[
|
|
6662
|
+
[b, u, m, p, l, g]
|
|
6659
6663
|
), v = useCallback(() => {
|
|
6660
|
-
E(
|
|
6661
|
-
}, [
|
|
6664
|
+
E(b, [f]);
|
|
6665
|
+
}, [b, f, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
|
|
6662
6666
|
useEffect(() => {
|
|
6663
6667
|
i(S, x);
|
|
6664
6668
|
}, [S, i, x]);
|
|
@@ -6674,7 +6678,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6674
6678
|
}[N]);
|
|
6675
6679
|
},
|
|
6676
6680
|
[B]
|
|
6677
|
-
), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) ===
|
|
6681
|
+
), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
|
|
6678
6682
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6679
6683
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6680
6684
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
@@ -6736,7 +6740,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6736
6740
|
units: i = basicUnits,
|
|
6737
6741
|
negative: c = !1
|
|
6738
6742
|
}) => {
|
|
6739
|
-
const { t: d } = useTranslation(), [u, p] = useState(n[0].key),
|
|
6743
|
+
const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
|
|
6740
6744
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6741
6745
|
"div",
|
|
6742
6746
|
{
|
|
@@ -6745,7 +6749,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6745
6749
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6746
6750
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6747
6751
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6748
|
-
n.map(({ label:
|
|
6752
|
+
n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6749
6753
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6750
6754
|
"button",
|
|
6751
6755
|
{
|
|
@@ -6760,7 +6764,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6760
6764
|
]
|
|
6761
6765
|
}
|
|
6762
6766
|
) }),
|
|
6763
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(
|
|
6767
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
|
|
6764
6768
|
] }) }))
|
|
6765
6769
|
) })
|
|
6766
6770
|
] }),
|
|
@@ -6825,8 +6829,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6825
6829
|
if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
|
|
6826
6830
|
return null;
|
|
6827
6831
|
const u = (p) => {
|
|
6828
|
-
const
|
|
6829
|
-
l([o._id],
|
|
6832
|
+
const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6833
|
+
l([o._id], m, !0);
|
|
6830
6834
|
};
|
|
6831
6835
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
6832
6836
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
|
|
@@ -6880,13 +6884,13 @@ function BlockStyling() {
|
|
|
6880
6884
|
cssProperty: ""
|
|
6881
6885
|
}), d = useThrottledCallback(
|
|
6882
6886
|
(p) => {
|
|
6883
|
-
const
|
|
6884
|
-
let
|
|
6885
|
-
|
|
6887
|
+
const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
|
|
6888
|
+
let g = parseFloat(i.dragStartValue);
|
|
6889
|
+
g = isNaN(g) ? 0 : g;
|
|
6886
6890
|
let E = MAPPER[i.dragUnit];
|
|
6887
6891
|
(startsWith(x, "scale") || x === "opacity") && (E = 10);
|
|
6888
|
-
let f = (i.dragStartY - p.pageY) / E +
|
|
6889
|
-
|
|
6892
|
+
let f = (i.dragStartY - p.pageY) / E + g;
|
|
6893
|
+
m && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
|
|
6890
6894
|
},
|
|
6891
6895
|
[i],
|
|
6892
6896
|
50
|
|
@@ -6972,10 +6976,10 @@ const BlockCard = ({
|
|
|
6972
6976
|
library: n,
|
|
6973
6977
|
parentId: r = void 0
|
|
6974
6978
|
}) => {
|
|
6975
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(),
|
|
6979
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (_) => {
|
|
6976
6980
|
const v = has(_, "styles_attrs.data-page-section");
|
|
6977
6981
|
return _._type === "Box" && v;
|
|
6978
|
-
},
|
|
6982
|
+
}, b = useCallback(
|
|
6979
6983
|
async (_) => {
|
|
6980
6984
|
if (_.stopPropagation(), has(o, "component")) {
|
|
6981
6985
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
@@ -6998,7 +7002,7 @@ const BlockCard = ({
|
|
|
6998
7002
|
};
|
|
6999
7003
|
} else
|
|
7000
7004
|
_.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7001
|
-
|
|
7005
|
+
g(B), setTimeout(() => {
|
|
7002
7006
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7003
7007
|
}, 200);
|
|
7004
7008
|
}
|
|
@@ -7008,7 +7012,7 @@ const BlockCard = ({
|
|
|
7008
7012
|
"div",
|
|
7009
7013
|
{
|
|
7010
7014
|
onClick: a ? () => {
|
|
7011
|
-
} :
|
|
7015
|
+
} : b,
|
|
7012
7016
|
draggable: x ? "true" : "false",
|
|
7013
7017
|
onDragStart: f,
|
|
7014
7018
|
className: clsx(
|
|
@@ -7019,11 +7023,11 @@ const BlockCard = ({
|
|
|
7019
7023
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
|
|
7020
7024
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
7021
7025
|
] }),
|
|
7022
|
-
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt:
|
|
7026
|
+
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__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: m }) })
|
|
7023
7027
|
]
|
|
7024
7028
|
}
|
|
7025
7029
|
) }),
|
|
7026
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
|
|
7027
7031
|
] });
|
|
7028
7032
|
}, libraryBlocksAtom = atom$1(
|
|
7029
7033
|
{}
|
|
@@ -7039,7 +7043,7 @@ const BlockCard = ({
|
|
|
7039
7043
|
})();
|
|
7040
7044
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7041
7045
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7042
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [
|
|
7046
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: b } = useTranslation(), f = (S) => {
|
|
7043
7047
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
7044
7048
|
E.current && x(S);
|
|
7045
7049
|
}, 300);
|
|
@@ -7049,12 +7053,12 @@ const BlockCard = ({
|
|
|
7049
7053
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7050
7054
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7051
7055
|
] });
|
|
7052
|
-
const _ = filter(
|
|
7056
|
+
const _ = filter(g, (S, B) => B % 2 === 0), v = filter(g, (S, B) => B % 2 === 1);
|
|
7053
7057
|
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: [
|
|
7054
7058
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7055
7059
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7056
7060
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7057
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
|
|
7058
7062
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7059
7063
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
|
|
7060
7064
|
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7065,10 +7069,10 @@ const BlockCard = ({
|
|
|
7065
7069
|
onClick: () => x(B),
|
|
7066
7070
|
className: cn(
|
|
7067
7071
|
"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",
|
|
7068
|
-
B ===
|
|
7072
|
+
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7069
7073
|
),
|
|
7070
7074
|
children: [
|
|
7071
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7075
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(B.toLowerCase())) }),
|
|
7072
7076
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7073
7077
|
]
|
|
7074
7078
|
},
|
|
@@ -7533,14 +7537,14 @@ i18n.use(initReactI18next).init({
|
|
|
7533
7537
|
}
|
|
7534
7538
|
});
|
|
7535
7539
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7536
|
-
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [,
|
|
7540
|
+
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
|
|
7537
7541
|
if (has(o, "blocks")) {
|
|
7538
|
-
const
|
|
7539
|
-
u(syncBlocksWithDefaults(
|
|
7542
|
+
const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7543
|
+
u(syncBlocksWithDefaults(b), r || null);
|
|
7540
7544
|
} else
|
|
7541
7545
|
d(o, r || null);
|
|
7542
7546
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7543
|
-
},
|
|
7547
|
+
}, g = useFeature("dnd"), { t: E } = useTranslation();
|
|
7544
7548
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7545
7549
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7546
7550
|
"button",
|
|
@@ -7548,12 +7552,12 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7548
7552
|
disabled: n,
|
|
7549
7553
|
onClick: x,
|
|
7550
7554
|
type: "button",
|
|
7551
|
-
onDragStart: (
|
|
7552
|
-
|
|
7553
|
-
p([]),
|
|
7555
|
+
onDragStart: (b) => {
|
|
7556
|
+
b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7557
|
+
p([]), m(null);
|
|
7554
7558
|
}, 200);
|
|
7555
7559
|
},
|
|
7556
|
-
draggable:
|
|
7560
|
+
draggable: g ? "true" : "false",
|
|
7557
7561
|
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",
|
|
7558
7562
|
children: [
|
|
7559
7563
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
@@ -7722,14 +7726,14 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7722
7726
|
) }) });
|
|
7723
7727
|
}
|
|
7724
7728
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7725
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p,
|
|
7729
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
|
|
7726
7730
|
useEffect(() => {
|
|
7727
|
-
var
|
|
7728
|
-
(
|
|
7731
|
+
var b;
|
|
7732
|
+
(b = x.current) == null || b.focus();
|
|
7729
7733
|
}, []);
|
|
7730
|
-
const E = (
|
|
7731
|
-
const { usage: f } =
|
|
7732
|
-
!l && f &&
|
|
7734
|
+
const E = (b) => {
|
|
7735
|
+
const { usage: f } = b || {};
|
|
7736
|
+
!l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
7733
7737
|
};
|
|
7734
7738
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7735
7739
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7749,12 +7753,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7749
7753
|
{
|
|
7750
7754
|
ref: x,
|
|
7751
7755
|
value: i,
|
|
7752
|
-
onChange: (
|
|
7756
|
+
onChange: (b) => c(b.target.value),
|
|
7753
7757
|
placeholder: n("Ask AI to edit content"),
|
|
7754
7758
|
className: "w-full",
|
|
7755
7759
|
rows: 3,
|
|
7756
|
-
onKeyDown: (
|
|
7757
|
-
|
|
7760
|
+
onKeyDown: (b) => {
|
|
7761
|
+
b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
|
|
7758
7762
|
}
|
|
7759
7763
|
}
|
|
7760
7764
|
),
|
|
@@ -7764,7 +7768,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7764
7768
|
{
|
|
7765
7769
|
disabled: i.trim().length < 5 || a,
|
|
7766
7770
|
onClick: () => {
|
|
7767
|
-
|
|
7771
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
|
|
7768
7772
|
},
|
|
7769
7773
|
variant: "default",
|
|
7770
7774
|
className: "w-fit",
|
|
@@ -7796,8 +7800,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7796
7800
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7797
7801
|
QuickPrompts,
|
|
7798
7802
|
{
|
|
7799
|
-
onClick: (
|
|
7800
|
-
|
|
7803
|
+
onClick: (b) => {
|
|
7804
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, b, E);
|
|
7801
7805
|
}
|
|
7802
7806
|
}
|
|
7803
7807
|
)
|
|
@@ -7807,7 +7811,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7807
7811
|
] }) }) : null
|
|
7808
7812
|
] });
|
|
7809
7813
|
}, AISetContext = () => {
|
|
7810
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [,
|
|
7814
|
+
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
|
|
7811
7815
|
useEffect(() => {
|
|
7812
7816
|
n && a(n);
|
|
7813
7817
|
}, [n]);
|
|
@@ -7817,9 +7821,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7817
7821
|
title: o("Updated AI Context"),
|
|
7818
7822
|
description: o("You can now Ask AI to edit your content"),
|
|
7819
7823
|
variant: "default"
|
|
7820
|
-
}),
|
|
7821
|
-
} catch (
|
|
7822
|
-
p(
|
|
7824
|
+
}), g.current.click();
|
|
7825
|
+
} catch (b) {
|
|
7826
|
+
p(b);
|
|
7823
7827
|
} finally {
|
|
7824
7828
|
d(!1);
|
|
7825
7829
|
}
|
|
@@ -7827,25 +7831,25 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7827
7831
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7828
7832
|
Accordion,
|
|
7829
7833
|
{
|
|
7830
|
-
onValueChange: (
|
|
7831
|
-
|
|
7834
|
+
onValueChange: (b) => {
|
|
7835
|
+
m(b !== "");
|
|
7832
7836
|
},
|
|
7833
7837
|
type: "single",
|
|
7834
7838
|
collapsible: !0,
|
|
7835
7839
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
7836
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref:
|
|
7840
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
|
|
7837
7841
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
7838
7842
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7839
7843
|
Textarea,
|
|
7840
7844
|
{
|
|
7841
7845
|
ref: l,
|
|
7842
7846
|
value: r,
|
|
7843
|
-
onChange: (
|
|
7847
|
+
onChange: (b) => a(b.target.value),
|
|
7844
7848
|
placeholder: o("Tell about this page eg this page is about"),
|
|
7845
7849
|
className: "mt-1 w-full",
|
|
7846
7850
|
rows: 10,
|
|
7847
|
-
onKeyDown: (
|
|
7848
|
-
|
|
7851
|
+
onKeyDown: (b) => {
|
|
7852
|
+
b.key === "Enter" && (b.preventDefault(), E());
|
|
7849
7853
|
}
|
|
7850
7854
|
}
|
|
7851
7855
|
),
|
|
@@ -7907,32 +7911,32 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7907
7911
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7908
7912
|
] });
|
|
7909
7913
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7910
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p,
|
|
7914
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), b = useRef(null);
|
|
7911
7915
|
useEffect(() => {
|
|
7912
7916
|
l(n);
|
|
7913
7917
|
}, [n]);
|
|
7914
7918
|
const f = () => {
|
|
7915
7919
|
if (i.startsWith("@")) {
|
|
7916
|
-
|
|
7920
|
+
g("Attribute keys cannot start with '@'");
|
|
7917
7921
|
return;
|
|
7918
7922
|
}
|
|
7919
7923
|
if (i) {
|
|
7920
7924
|
const w = [...a, { key: i, value: d }];
|
|
7921
|
-
r(w), l(a), c(""), u(""),
|
|
7925
|
+
r(w), l(a), c(""), u(""), g("");
|
|
7922
7926
|
}
|
|
7923
7927
|
}, _ = (w) => {
|
|
7924
7928
|
const A = a.filter((N, D) => D !== w);
|
|
7925
7929
|
r(A), l(A);
|
|
7926
7930
|
}, v = (w) => {
|
|
7927
|
-
|
|
7931
|
+
m(w), c(a[w].key), u(a[w].value);
|
|
7928
7932
|
}, S = () => {
|
|
7929
7933
|
if (i.startsWith("@")) {
|
|
7930
|
-
|
|
7934
|
+
g("Attribute keys cannot start with '@'");
|
|
7931
7935
|
return;
|
|
7932
7936
|
}
|
|
7933
7937
|
if (p !== null && i) {
|
|
7934
7938
|
const w = [...a];
|
|
7935
|
-
w[p] = { key: i, value: d }, r(w), l(w),
|
|
7939
|
+
w[p] = { key: i, value: d }, r(w), l(w), m(null), c(""), u(""), g("");
|
|
7936
7940
|
}
|
|
7937
7941
|
}, B = (w) => {
|
|
7938
7942
|
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? S() : f());
|
|
@@ -7974,7 +7978,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7974
7978
|
spellCheck: "false",
|
|
7975
7979
|
id: "attrValue",
|
|
7976
7980
|
rows: 2,
|
|
7977
|
-
ref:
|
|
7981
|
+
ref: b,
|
|
7978
7982
|
value: d,
|
|
7979
7983
|
onChange: (w) => u(w.target.value),
|
|
7980
7984
|
onKeyDown: B,
|
|
@@ -8641,15 +8645,15 @@ function RemoveProviderConfirmation({
|
|
|
8641
8645
|
const PageDataProviders = () => {
|
|
8642
8646
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8643
8647
|
filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
|
|
8644
|
-
), [d, u] = useState(""), [p,
|
|
8648
|
+
), [d, u] = useState(""), [p, m] = useState(null), x = filter(
|
|
8645
8649
|
n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
|
|
8646
8650
|
(f) => !isNull(f)
|
|
8647
|
-
),
|
|
8651
|
+
), g = (f) => {
|
|
8648
8652
|
const _ = find(n, { providerKey: f });
|
|
8649
8653
|
c((v) => [...v, _]), a((v) => [...v, { providerKey: _.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8650
8654
|
}, E = (f) => {
|
|
8651
8655
|
c((_) => filter(_, (v) => v.providerKey !== f.providerKey)), a((_) => filter(_, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
|
|
8652
|
-
},
|
|
8656
|
+
}, b = (f) => m(f);
|
|
8653
8657
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8654
8658
|
o("no_data_providers"),
|
|
8655
8659
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8657,7 +8661,7 @@ const PageDataProviders = () => {
|
|
|
8657
8661
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8658
8662
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8659
8663
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8660
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) =>
|
|
8664
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) => g(f), children: [
|
|
8661
8665
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8662
8666
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8663
8667
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
@@ -8684,7 +8688,7 @@ const PageDataProviders = () => {
|
|
|
8684
8688
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8685
8689
|
"button",
|
|
8686
8690
|
{
|
|
8687
|
-
onClick: () =>
|
|
8691
|
+
onClick: () => b(f),
|
|
8688
8692
|
className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
8689
8693
|
children: [
|
|
8690
8694
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8738,14 +8742,14 @@ const PageDataProviders = () => {
|
|
|
8738
8742
|
},
|
|
8739
8743
|
f.providerKey
|
|
8740
8744
|
)) }),
|
|
8741
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () =>
|
|
8745
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
|
|
8742
8746
|
] })
|
|
8743
8747
|
] });
|
|
8744
8748
|
};
|
|
8745
8749
|
function AiFillDatabase(o) {
|
|
8746
8750
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8747
8751
|
}
|
|
8748
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8752
|
+
const TopBar = lazy(() => import("./Topbar-yEANMgiO.js"));
|
|
8749
8753
|
function useSidebarMenuItems(o) {
|
|
8750
8754
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8751
8755
|
return useMemo(() => {
|
|
@@ -8772,14 +8776,14 @@ function isDualLayout(o) {
|
|
|
8772
8776
|
}
|
|
8773
8777
|
const RootLayout = () => {
|
|
8774
8778
|
const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
|
|
8775
|
-
useChaiBuilderMsgListener(({ name:
|
|
8776
|
-
|
|
8779
|
+
useChaiBuilderMsgListener(({ name: g }) => {
|
|
8780
|
+
g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
|
|
8777
8781
|
});
|
|
8778
|
-
const i = useBuilderProp("sideBarComponents.top", []), c = (
|
|
8779
|
-
|
|
8780
|
-
}, d = (
|
|
8781
|
-
n(o ===
|
|
8782
|
-
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(),
|
|
8782
|
+
const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
|
|
8783
|
+
g.preventDefault();
|
|
8784
|
+
}, d = (g) => {
|
|
8785
|
+
n(o === g ? null : g);
|
|
8786
|
+
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
|
|
8783
8787
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8784
8788
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8785
8789
|
"div",
|
|
@@ -8790,18 +8794,18 @@ const RootLayout = () => {
|
|
|
8790
8794
|
/* @__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, {}) }) }),
|
|
8791
8795
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8792
8796
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8793
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children:
|
|
8797
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8794
8798
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8795
8799
|
Button,
|
|
8796
8800
|
{
|
|
8797
8801
|
variant: o === E ? "default" : "ghost",
|
|
8798
8802
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8799
8803
|
onClick: () => d(E),
|
|
8800
|
-
children: get(
|
|
8804
|
+
children: get(g, "icon", null)
|
|
8801
8805
|
},
|
|
8802
8806
|
E
|
|
8803
8807
|
) }),
|
|
8804
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(
|
|
8808
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
|
|
8805
8809
|
] }, "button" + E)) }),
|
|
8806
8810
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
8807
8811
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
@@ -8820,10 +8824,10 @@ const RootLayout = () => {
|
|
|
8820
8824
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8821
8825
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
|
|
8822
8826
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8823
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
8824
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(
|
|
8827
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
8828
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
|
|
8825
8829
|
] }),
|
|
8826
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
8830
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
|
|
8827
8831
|
] }) })
|
|
8828
8832
|
}
|
|
8829
8833
|
),
|