@chaibuilder/sdk 1.2.97 → 1.2.98
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-_PTE1mX9.js → CodeEditor-JFNyNUeD.js} +2 -2
- package/dist/{CodeEditor-GTSuKJEp.cjs → CodeEditor-v6e1cv9g.cjs} +1 -1
- package/dist/{Topbar-JX3nxG-E.cjs → Topbar--bKmw8Qf.cjs} +1 -1
- package/dist/{Topbar-EPvh-p9w.js → Topbar-bca7NmyC.js} +2 -2
- package/dist/{UnsplashImages-KMn64LMV.cjs → UnsplashImages-Xfn4852d.cjs} +1 -1
- package/dist/{UnsplashImages-Pchz4LmI.js → UnsplashImages-vR5ig3Lz.js} +2 -2
- package/dist/{UploadImages-IbFQUJXm.cjs → UploadImages-Yl-90dxh.cjs} +1 -1
- package/dist/{UploadImages-9dzylU64.js → UploadImages-jCqfO33R.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +70 -69
- package/dist/iconBase-5hdsfZ0z.cjs +1 -0
- package/dist/{iconBase-HBZkvN04.js → iconBase-RFUjwZUN.js} +77 -68
- package/dist/{index-nHmebTrD.js → index-5aoq9X96.js} +810 -810
- package/dist/{index-XrC-UO0t.cjs → index-M74Ml_9k.cjs} +2 -2
- package/dist/web-blocks.cjs +3 -1
- package/dist/web-blocks.js +309 -302
- package/package.json +3 -3
- package/dist/iconBase-kuD_VwQx.cjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var W = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
+
var U = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
7
|
import { S as Skeleton, B as Button, C as ContextMenu, a as ContextMenuTrigger, b as ContextMenuContent, c as ContextMenuItem, T as Tooltip, d as TooltipTrigger, e as TooltipContent, f as Card, g as CardHeader, h as CardDescription, i as CardContent, L as Label, j as Textarea, k as CardFooter, D as Dialog, l as DialogTrigger, m as DialogContent, n as DialogHeader, o as DialogTitle, p as DialogDescription, q as DialogFooter, P as Popover, r as PopoverTrigger, s as PopoverContent, t as Command, u as CommandInput, v as CommandList, w as CommandEmpty, x as CommandGroup, y as CommandItem, z as Tabs, A as TabsList, E as TabsTrigger, F as TabsContent, G as Switch, H as Accordion, I as AccordionItem, J as AccordionTrigger, K as AccordionContent, M as useToast, N as Input$1, O as TooltipPortal, Q as DropdownMenu, R as DropdownMenuTrigger, U as DropdownMenuContent, V as ScrollArea, W as DropdownMenuLabel, X as DropdownMenuSeparator, Y as DropdownMenuGroup, Z as DropdownMenuItem, _ as DropdownMenuShortcut, $ as AlertDialog, a0 as AlertDialogContent, a1 as AlertDialogHeader, a2 as AlertDialogTitle, a3 as AlertDialogTrigger, a4 as AlertDialogDescription, a5 as AlertDialogFooter, a6 as AlertDialogCancel, a7 as AlertDialogAction, a8 as DropdownMenuCheckboxItem, a9 as HoverCard, aa as HoverCardTrigger, ab as HoverCardContent, ac as Separator, ad as Badge, ae as Select, af as SelectTrigger, ag as SelectValue, ah as SelectContent, ai as SelectItem, aj as TooltipProvider, ak as Toaster } from "./context-menu-9cWJcKdh.js";
|
|
8
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, chunk, forEach, throttle, memoize, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, cloneDeep, 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
|
-
import { g as generateUUID, a as getBreakpointValue,
|
|
10
|
+
import { g as generateUUID, a as getBreakpointValue, y, s, h, c as cn, G as GenIcon } from "./iconBase-RFUjwZUN.js";
|
|
11
11
|
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
12
12
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
13
13
|
import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-ooqqxWRQ.js";
|
|
@@ -89,278 +89,278 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
89
89
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
90
90
|
let a, l, i;
|
|
91
91
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
92
|
-
const c = (
|
|
93
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
94
|
-
const
|
|
95
|
-
if (o.set(
|
|
96
|
-
const
|
|
97
|
-
cancelPromise(
|
|
92
|
+
const c = (b) => o.get(b), d = (b, _) => {
|
|
93
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
|
|
94
|
+
const R = o.get(b);
|
|
95
|
+
if (o.set(b, _), r.has(b) || r.set(b, R), R && hasPromiseAtomValue(R)) {
|
|
96
|
+
const v = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
|
|
97
|
+
cancelPromise(R.v, v);
|
|
98
98
|
}
|
|
99
|
-
}, u = (
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
!
|
|
104
|
-
}), (
|
|
105
|
-
}, p = (
|
|
106
|
-
const
|
|
107
|
-
d: (
|
|
108
|
-
v:
|
|
99
|
+
}, u = (b, _, R) => {
|
|
100
|
+
const v = /* @__PURE__ */ new Map();
|
|
101
|
+
let I = !1;
|
|
102
|
+
R.forEach((L, P) => {
|
|
103
|
+
!L && P === b && (L = _), L ? (v.set(P, L), _.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
104
|
+
}), (I || _.d.size !== v.size) && (_.d = v);
|
|
105
|
+
}, p = (b, _, R) => {
|
|
106
|
+
const v = c(b), I = {
|
|
107
|
+
d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
|
|
108
|
+
v: _
|
|
109
109
|
};
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
|
|
110
|
+
if (R && u(b, I, R), v && isEqualAtomValue(v, I) && v.d === I.d)
|
|
111
|
+
return v;
|
|
112
|
+
if (v && hasPromiseAtomValue(v) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(v, I)) {
|
|
113
|
+
if (v.d === I.d)
|
|
114
|
+
return v;
|
|
115
|
+
I.v = v.v;
|
|
116
116
|
}
|
|
117
|
-
return d(
|
|
118
|
-
}, m = (
|
|
119
|
-
if (isPromiseLike$2(
|
|
120
|
-
let
|
|
121
|
-
const
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
(
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
return d(b, I), I;
|
|
118
|
+
}, m = (b, _, R, v) => {
|
|
119
|
+
if (isPromiseLike$2(_)) {
|
|
120
|
+
let I;
|
|
121
|
+
const L = new Promise((P, V) => {
|
|
122
|
+
let $ = !1;
|
|
123
|
+
_.then(
|
|
124
|
+
(O) => {
|
|
125
|
+
if (!$) {
|
|
126
|
+
$ = !0;
|
|
127
|
+
const M = c(b), H = p(
|
|
128
|
+
b,
|
|
129
|
+
L,
|
|
130
|
+
R
|
|
131
131
|
);
|
|
132
|
-
resolvePromise(
|
|
132
|
+
resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
|
-
(
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
(O) => {
|
|
136
|
+
if (!$) {
|
|
137
|
+
$ = !0;
|
|
138
|
+
const M = c(b), H = p(
|
|
139
|
+
b,
|
|
140
|
+
L,
|
|
141
|
+
R
|
|
142
142
|
);
|
|
143
|
-
rejectPromise(
|
|
143
|
+
rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
),
|
|
147
|
-
|
|
148
|
-
(
|
|
149
|
-
(
|
|
150
|
-
),
|
|
146
|
+
), I = (O) => {
|
|
147
|
+
$ || ($ = !0, O.then(
|
|
148
|
+
(M) => resolvePromise(L, M),
|
|
149
|
+
(M) => rejectPromise(L, M)
|
|
150
|
+
), P(O));
|
|
151
151
|
};
|
|
152
152
|
});
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
}), p(
|
|
153
|
+
return L.orig = _, L.status = "pending", registerCancelPromise(L, (P) => {
|
|
154
|
+
P && I(P), v == null || v();
|
|
155
|
+
}), p(b, L, R);
|
|
156
156
|
}
|
|
157
|
-
return p(
|
|
158
|
-
}, x = (
|
|
159
|
-
const
|
|
160
|
-
d: (
|
|
161
|
-
e:
|
|
157
|
+
return p(b, _, R);
|
|
158
|
+
}, x = (b, _, R) => {
|
|
159
|
+
const v = c(b), I = {
|
|
160
|
+
d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
|
|
161
|
+
e: _
|
|
162
162
|
};
|
|
163
|
-
return
|
|
164
|
-
}, g = (
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
}), Array.from(
|
|
169
|
-
const
|
|
170
|
-
return
|
|
171
|
-
|
|
163
|
+
return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
|
|
164
|
+
}, g = (b) => {
|
|
165
|
+
const _ = c(b);
|
|
166
|
+
if (_ && (_.d.forEach(($, O) => {
|
|
167
|
+
O !== b && !n.has(O) && g(O);
|
|
168
|
+
}), Array.from(_.d).every(([$, O]) => {
|
|
169
|
+
const M = c($);
|
|
170
|
+
return $ === b || M === O || // TODO This is a hack, we should find a better solution.
|
|
171
|
+
M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
|
|
172
172
|
})))
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
181
|
-
if (hasInitialValue(
|
|
182
|
-
return
|
|
173
|
+
return _;
|
|
174
|
+
const R = /* @__PURE__ */ new Map();
|
|
175
|
+
let v = !0;
|
|
176
|
+
const I = ($) => {
|
|
177
|
+
if ($ === b) {
|
|
178
|
+
const M = c($);
|
|
179
|
+
if (M)
|
|
180
|
+
return R.set($, M), returnAtomValue(M);
|
|
181
|
+
if (hasInitialValue($))
|
|
182
|
+
return R.set($, void 0), $.init;
|
|
183
183
|
throw new Error("no atom init");
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
return
|
|
185
|
+
const O = g($);
|
|
186
|
+
return R.set($, O), returnAtomValue(O);
|
|
187
187
|
};
|
|
188
|
-
let
|
|
189
|
-
const
|
|
188
|
+
let L, P;
|
|
189
|
+
const V = {
|
|
190
190
|
get signal() {
|
|
191
|
-
return
|
|
191
|
+
return L || (L = new AbortController()), L.signal;
|
|
192
192
|
},
|
|
193
193
|
get setSelf() {
|
|
194
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
195
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
196
|
-
return
|
|
197
|
-
}),
|
|
194
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...$) => {
|
|
195
|
+
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && v && console.warn("setSelf function cannot be called in sync"), !v)
|
|
196
|
+
return B(b, ...$);
|
|
197
|
+
}), P;
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
try {
|
|
201
|
-
const
|
|
201
|
+
const $ = b.read(I, V);
|
|
202
202
|
return m(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
() =>
|
|
203
|
+
b,
|
|
204
|
+
$,
|
|
205
|
+
R,
|
|
206
|
+
() => L == null ? void 0 : L.abort()
|
|
207
207
|
);
|
|
208
|
-
} catch (
|
|
209
|
-
return x(
|
|
208
|
+
} catch ($) {
|
|
209
|
+
return x(b, $, R);
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
v = !1;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
214
|
-
let
|
|
215
|
-
return
|
|
216
|
-
},
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
(
|
|
226
|
-
),
|
|
213
|
+
}, E = (b) => returnAtomValue(g(b)), f = (b) => {
|
|
214
|
+
let _ = n.get(b);
|
|
215
|
+
return _ || (_ = C(b)), _;
|
|
216
|
+
}, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
|
|
217
|
+
const _ = n.get(b);
|
|
218
|
+
_ && j(b, _) && w(b);
|
|
219
|
+
}, A = (b) => {
|
|
220
|
+
const _ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), v = (L) => {
|
|
221
|
+
const P = n.get(L);
|
|
222
|
+
P == null || P.t.forEach((V) => {
|
|
223
|
+
V !== L && (_.set(
|
|
224
|
+
V,
|
|
225
|
+
(_.get(V) || /* @__PURE__ */ new Set()).add(L)
|
|
226
|
+
), R.set(V, (R.get(V) || 0) + 1), v(V));
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
var
|
|
234
|
-
if (
|
|
235
|
-
let
|
|
236
|
-
if (
|
|
237
|
-
let
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
|
|
229
|
+
v(b);
|
|
230
|
+
const I = (L) => {
|
|
231
|
+
const P = n.get(L);
|
|
232
|
+
P == null || P.t.forEach((V) => {
|
|
233
|
+
var $;
|
|
234
|
+
if (V !== L) {
|
|
235
|
+
let O = R.get(V);
|
|
236
|
+
if (O && R.set(V, --O), !O) {
|
|
237
|
+
let M = !!(($ = _.get(V)) != null && $.size);
|
|
238
|
+
if (M) {
|
|
239
|
+
const H = c(V), F = g(V);
|
|
240
|
+
M = !H || !isEqualAtomValue(H, F);
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
M || _.forEach((H) => H.delete(V));
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
I(V);
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
let
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
254
|
-
if (!hasInitialValue(
|
|
248
|
+
I(b);
|
|
249
|
+
}, S = (b, ..._) => {
|
|
250
|
+
let R = !0;
|
|
251
|
+
const v = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
|
|
252
|
+
let $;
|
|
253
|
+
if (P === b) {
|
|
254
|
+
if (!hasInitialValue(P))
|
|
255
255
|
throw new Error("atom not writable");
|
|
256
|
-
const
|
|
257
|
-
(!
|
|
256
|
+
const O = c(P), M = m(P, V[0]);
|
|
257
|
+
(!O || !isEqualAtomValue(O, M)) && A(P);
|
|
258
258
|
} else
|
|
259
|
-
|
|
260
|
-
if (!
|
|
261
|
-
const
|
|
259
|
+
$ = S(P, ...V);
|
|
260
|
+
if (!R) {
|
|
261
|
+
const O = D();
|
|
262
262
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
263
|
-
(
|
|
263
|
+
(M) => M({ type: "async-write", flushed: O })
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
return
|
|
267
|
-
},
|
|
268
|
-
return
|
|
269
|
-
},
|
|
270
|
-
const
|
|
266
|
+
return $;
|
|
267
|
+
}, L = b.write(v, I, ..._);
|
|
268
|
+
return R = !1, L;
|
|
269
|
+
}, B = (b, ..._) => {
|
|
270
|
+
const R = S(b, ..._), v = D();
|
|
271
271
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
272
|
-
(
|
|
273
|
-
),
|
|
274
|
-
},
|
|
275
|
-
const
|
|
276
|
-
t: new Set(
|
|
272
|
+
(I) => I({ type: "write", flushed: v })
|
|
273
|
+
), R;
|
|
274
|
+
}, C = (b, _) => {
|
|
275
|
+
const R = {
|
|
276
|
+
t: new Set(_ && [_]),
|
|
277
277
|
l: /* @__PURE__ */ new Set()
|
|
278
278
|
};
|
|
279
|
-
if (n.set(
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
}), g(
|
|
283
|
-
const
|
|
284
|
-
|
|
279
|
+
if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), g(b).d.forEach((v, I) => {
|
|
280
|
+
const L = n.get(I);
|
|
281
|
+
L ? L.t.add(b) : I !== b && C(I, b);
|
|
282
|
+
}), g(b), isActuallyWritableAtom(b) && b.onMount) {
|
|
283
|
+
const v = b.onMount((...I) => B(b, ...I));
|
|
284
|
+
v && (R.u = v);
|
|
285
285
|
}
|
|
286
|
-
return
|
|
287
|
-
},
|
|
288
|
-
var
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
|
|
286
|
+
return R;
|
|
287
|
+
}, w = (b) => {
|
|
288
|
+
var _;
|
|
289
|
+
const R = (_ = n.get(b)) == null ? void 0 : _.u;
|
|
290
|
+
R && R(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
|
|
291
|
+
const v = c(b);
|
|
292
|
+
v ? (hasPromiseAtomValue(v) && cancelPromise(v.v), v.d.forEach((I, L) => {
|
|
293
|
+
if (L !== b) {
|
|
294
|
+
const P = n.get(L);
|
|
295
|
+
P && (P.t.delete(b), j(L, P) && w(L));
|
|
296
296
|
}
|
|
297
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
298
|
-
},
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
297
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
|
|
298
|
+
}, N = (b, _, R) => {
|
|
299
|
+
const v = new Set(_.d.keys());
|
|
300
|
+
R == null || R.forEach((I, L) => {
|
|
301
|
+
if (v.has(L)) {
|
|
302
|
+
v.delete(L);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
}),
|
|
308
|
-
const
|
|
309
|
-
|
|
305
|
+
const P = n.get(L);
|
|
306
|
+
P && (P.t.delete(b), j(L, P) && w(L));
|
|
307
|
+
}), v.forEach((I) => {
|
|
308
|
+
const L = n.get(I);
|
|
309
|
+
L ? L.t.add(b) : n.has(b) && C(I, b);
|
|
310
310
|
});
|
|
311
|
-
},
|
|
312
|
-
let
|
|
313
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
314
|
-
const
|
|
315
|
-
r.clear(),
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
311
|
+
}, D = () => {
|
|
312
|
+
let b;
|
|
313
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
|
|
314
|
+
const _ = Array.from(r);
|
|
315
|
+
r.clear(), _.forEach(([R, v]) => {
|
|
316
|
+
const I = c(R);
|
|
317
|
+
if (I) {
|
|
318
|
+
I.d !== (v == null ? void 0 : v.d) && N(R, I, v == null ? void 0 : v.d);
|
|
319
|
+
const L = n.get(R);
|
|
320
|
+
L && !// TODO This seems pretty hacky. Hope to fix it.
|
|
321
321
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
322
|
-
(
|
|
322
|
+
(v && !hasPromiseAtomValue(v) && (isEqualAtomValue(v, I) || isEqualAtomError(v, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(R));
|
|
323
323
|
} else
|
|
324
324
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
328
|
-
return a.forEach((
|
|
329
|
-
},
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
(
|
|
328
|
+
return a.forEach((_) => _("state")), b;
|
|
329
|
+
}, T = (b, _) => {
|
|
330
|
+
const R = f(b), v = D(), I = R.l;
|
|
331
|
+
return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
|
|
332
|
+
(L) => L({ type: "sub", flushed: v })
|
|
333
333
|
)), () => {
|
|
334
|
-
|
|
334
|
+
I.delete(_), k(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
337
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
338
|
-
get:
|
|
339
|
-
set:
|
|
340
|
-
sub:
|
|
338
|
+
get: E,
|
|
339
|
+
set: B,
|
|
340
|
+
sub: T,
|
|
341
341
|
// store dev methods (these are tentative and subject to change without notice)
|
|
342
|
-
dev_subscribe_store: (
|
|
342
|
+
dev_subscribe_store: (b, _) => _ !== 2 ? (console.warn(
|
|
343
343
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
344
|
-
), a.add(
|
|
345
|
-
a.delete(
|
|
346
|
-
}) : (l.add(
|
|
347
|
-
l.delete(
|
|
344
|
+
), a.add(b), () => {
|
|
345
|
+
a.delete(b);
|
|
346
|
+
}) : (l.add(b), () => {
|
|
347
|
+
l.delete(b);
|
|
348
348
|
}),
|
|
349
349
|
dev_get_mounted_atoms: () => i.values(),
|
|
350
|
-
dev_get_atom_state: (
|
|
351
|
-
dev_get_mounted: (
|
|
352
|
-
dev_restore_atoms: (
|
|
353
|
-
for (const [
|
|
354
|
-
hasInitialValue(
|
|
355
|
-
const
|
|
350
|
+
dev_get_atom_state: (b) => o.get(b),
|
|
351
|
+
dev_get_mounted: (b) => n.get(b),
|
|
352
|
+
dev_restore_atoms: (b) => {
|
|
353
|
+
for (const [R, v] of b)
|
|
354
|
+
hasInitialValue(R) && (m(R, v), A(R));
|
|
355
|
+
const _ = D();
|
|
356
356
|
l.forEach(
|
|
357
|
-
(
|
|
357
|
+
(R) => R({ type: "restore", flushed: _ })
|
|
358
358
|
);
|
|
359
359
|
}
|
|
360
360
|
} : {
|
|
361
|
-
get:
|
|
362
|
-
set:
|
|
363
|
-
sub:
|
|
361
|
+
get: E,
|
|
362
|
+
set: B,
|
|
363
|
+
sub: T
|
|
364
364
|
};
|
|
365
365
|
};
|
|
366
366
|
let defaultStore;
|
|
@@ -378,36 +378,36 @@ function splitAtom(o, n) {
|
|
|
378
378
|
if (u)
|
|
379
379
|
return u;
|
|
380
380
|
const p = d && r.get(d), m = [], x = [];
|
|
381
|
-
return c.forEach((g,
|
|
382
|
-
const
|
|
383
|
-
x[
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
m[
|
|
381
|
+
return c.forEach((g, E) => {
|
|
382
|
+
const f = n ? n(g) : E;
|
|
383
|
+
x[E] = f;
|
|
384
|
+
const j = p && p.atomList[p.keyList.indexOf(f)];
|
|
385
|
+
if (j) {
|
|
386
|
+
m[E] = j;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
const
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
return
|
|
389
|
+
const k = (S) => {
|
|
390
|
+
const B = S(l), C = S(o), N = a(C, B == null ? void 0 : B.arr).keyList.indexOf(f);
|
|
391
|
+
if (N < 0 || N >= C.length) {
|
|
392
|
+
const D = c[a(c).keyList.indexOf(f)];
|
|
393
|
+
if (D)
|
|
394
|
+
return D;
|
|
395
395
|
throw new Error("splitAtom: index out of bounds for read");
|
|
396
396
|
}
|
|
397
|
-
return
|
|
398
|
-
},
|
|
399
|
-
const
|
|
400
|
-
if (
|
|
397
|
+
return C[N];
|
|
398
|
+
}, A = (S, B, C) => {
|
|
399
|
+
const w = S(l), N = S(o), T = a(N, w == null ? void 0 : w.arr).keyList.indexOf(f);
|
|
400
|
+
if (T < 0 || T >= N.length)
|
|
401
401
|
throw new Error("splitAtom: index out of bounds for write");
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
...
|
|
405
|
-
|
|
406
|
-
...
|
|
402
|
+
const b = isFunction(C) ? C(N[T]) : C;
|
|
403
|
+
B(o, [
|
|
404
|
+
...N.slice(0, T),
|
|
405
|
+
b,
|
|
406
|
+
...N.slice(T + 1)
|
|
407
407
|
]);
|
|
408
408
|
};
|
|
409
|
-
m[
|
|
410
|
-
}), p && p.keyList.length === x.length && p.keyList.every((g,
|
|
409
|
+
m[E] = isWritable(o) ? atom(k, A) : atom(k);
|
|
410
|
+
}), 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;
|
|
411
411
|
}, l = atom((c) => {
|
|
412
412
|
const d = c(l), u = c(o);
|
|
413
413
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -1191,65 +1191,65 @@ const useBlocksStoreManager = () => {
|
|
|
1191
1191
|
updateBlocksProps: c
|
|
1192
1192
|
} = useBlocksStoreManager();
|
|
1193
1193
|
return {
|
|
1194
|
-
moveBlocks: (
|
|
1195
|
-
const
|
|
1196
|
-
const
|
|
1197
|
-
return { _id:
|
|
1198
|
-
}),
|
|
1199
|
-
|
|
1200
|
-
undo: () => each(
|
|
1201
|
-
i([
|
|
1194
|
+
moveBlocks: (f, j, k) => {
|
|
1195
|
+
const A = map(f, (B) => {
|
|
1196
|
+
const w = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => w ? T._parent === w : !T._parent).map((T) => T._id).indexOf(B);
|
|
1197
|
+
return { _id: B, oldParent: w, oldPosition: D };
|
|
1198
|
+
}), S = A.find(({ _id: B }) => B === f[0]);
|
|
1199
|
+
S && S.oldParent === j && S.oldPosition === k || (i(f, j, k), o({
|
|
1200
|
+
undo: () => each(A, ({ _id: B, oldParent: C, oldPosition: w }) => {
|
|
1201
|
+
i([B], C, w);
|
|
1202
1202
|
}),
|
|
1203
|
-
redo: () => i(
|
|
1203
|
+
redo: () => i(f, j, k)
|
|
1204
1204
|
}));
|
|
1205
1205
|
},
|
|
1206
|
-
addBlocks: (
|
|
1207
|
-
a(
|
|
1208
|
-
undo: () => l(map(
|
|
1209
|
-
redo: () => a(
|
|
1206
|
+
addBlocks: (f, j, k) => {
|
|
1207
|
+
a(f, j, k), o({
|
|
1208
|
+
undo: () => l(map(f, "_id")),
|
|
1209
|
+
redo: () => a(f, j, k)
|
|
1210
1210
|
});
|
|
1211
1211
|
},
|
|
1212
|
-
removeBlocks: (
|
|
1213
|
-
var
|
|
1214
|
-
const
|
|
1215
|
-
l(map(
|
|
1216
|
-
undo: () => a(
|
|
1217
|
-
redo: () => l(map(
|
|
1212
|
+
removeBlocks: (f) => {
|
|
1213
|
+
var S;
|
|
1214
|
+
const j = (S = first(f)) == null ? void 0 : S._parent, A = n.filter((B) => j ? B._parent === j : !B._parent).indexOf(first(f));
|
|
1215
|
+
l(map(f, "_id")), o({
|
|
1216
|
+
undo: () => a(f, j, A),
|
|
1217
|
+
redo: () => l(map(f, "_id"))
|
|
1218
1218
|
});
|
|
1219
1219
|
},
|
|
1220
|
-
updateBlocks: (
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1220
|
+
updateBlocks: (f, j, k) => {
|
|
1221
|
+
let A = [];
|
|
1222
|
+
if (k)
|
|
1223
|
+
A = map(f, (S) => ({ _id: S, ...k }));
|
|
1224
1224
|
else {
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
const
|
|
1228
|
-
return each(
|
|
1225
|
+
const S = keys(j);
|
|
1226
|
+
A = map(f, (B) => {
|
|
1227
|
+
const C = n.find((N) => N._id === B), w = { _id: B };
|
|
1228
|
+
return each(S, (N) => w[N] = C[N]), w;
|
|
1229
1229
|
});
|
|
1230
1230
|
}
|
|
1231
|
-
c(map(
|
|
1232
|
-
undo: () => c(
|
|
1233
|
-
redo: () => c(map(
|
|
1231
|
+
c(map(f, (S) => ({ _id: S, ...j }))), o({
|
|
1232
|
+
undo: () => c(A),
|
|
1233
|
+
redo: () => c(map(f, (S) => ({ _id: S, ...j })))
|
|
1234
1234
|
});
|
|
1235
1235
|
},
|
|
1236
|
-
updateBlocksRuntime: (
|
|
1237
|
-
c(map(
|
|
1236
|
+
updateBlocksRuntime: (f, j) => {
|
|
1237
|
+
c(map(f, (k) => ({ _id: k, ...j })));
|
|
1238
1238
|
},
|
|
1239
|
-
setNewBlocks: (
|
|
1240
|
-
r(
|
|
1239
|
+
setNewBlocks: (f) => {
|
|
1240
|
+
r(f), o({
|
|
1241
1241
|
undo: () => r(n),
|
|
1242
|
-
redo: () => r(
|
|
1242
|
+
redo: () => r(f)
|
|
1243
1243
|
});
|
|
1244
1244
|
},
|
|
1245
|
-
updateMultipleBlocksProps: (
|
|
1246
|
-
let
|
|
1247
|
-
|
|
1248
|
-
const
|
|
1249
|
-
return each(
|
|
1250
|
-
}), c(
|
|
1251
|
-
undo: () => c(
|
|
1252
|
-
redo: () => c(
|
|
1245
|
+
updateMultipleBlocksProps: (f) => {
|
|
1246
|
+
let j = [];
|
|
1247
|
+
j = map(f, (k) => {
|
|
1248
|
+
const A = keys(k), S = n.find((C) => C._id === k._id), B = {};
|
|
1249
|
+
return each(A, (C) => B[C] = S[C]), B;
|
|
1250
|
+
}), c(f), o({
|
|
1251
|
+
undo: () => c(j),
|
|
1252
|
+
redo: () => c(f)
|
|
1253
1253
|
});
|
|
1254
1254
|
}
|
|
1255
1255
|
};
|
|
@@ -1257,12 +1257,12 @@ const useBlocksStoreManager = () => {
|
|
|
1257
1257
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1258
1258
|
(i, c, d) => {
|
|
1259
1259
|
var g;
|
|
1260
|
-
for (let
|
|
1261
|
-
const { _id:
|
|
1262
|
-
i[
|
|
1263
|
-
const
|
|
1264
|
-
for (let
|
|
1265
|
-
|
|
1260
|
+
for (let E = 0; E < i.length; E++) {
|
|
1261
|
+
const { _id: f } = i[E];
|
|
1262
|
+
i[E]._id = generateUUID();
|
|
1263
|
+
const j = filter(i, { _parent: f });
|
|
1264
|
+
for (let k = 0; k < j.length; k++)
|
|
1265
|
+
j[k]._parent = i[E]._id;
|
|
1266
1266
|
}
|
|
1267
1267
|
const u = first(i);
|
|
1268
1268
|
let p, m;
|
|
@@ -1273,20 +1273,20 @@ const useBlocksStoreManager = () => {
|
|
|
1273
1273
|
return { addCoreBlock: useCallback(
|
|
1274
1274
|
(i, c, d) => {
|
|
1275
1275
|
if (has(i, "blocks")) {
|
|
1276
|
-
const
|
|
1277
|
-
return a(
|
|
1276
|
+
const k = i.blocks;
|
|
1277
|
+
return a(k, c, d);
|
|
1278
1278
|
}
|
|
1279
1279
|
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1280
|
-
forIn(p, (
|
|
1281
|
-
if (startsWith(
|
|
1282
|
-
const
|
|
1280
|
+
forIn(p, (k, A) => {
|
|
1281
|
+
if (startsWith(k, SLOT_KEY)) {
|
|
1282
|
+
const S = k.replace(SLOT_KEY, "");
|
|
1283
1283
|
m.push({
|
|
1284
|
-
_id:
|
|
1284
|
+
_id: S,
|
|
1285
1285
|
_type: "Slot",
|
|
1286
1286
|
_parent: u,
|
|
1287
|
-
_name: i.props[
|
|
1288
|
-
_styles: i.props[
|
|
1289
|
-
_emptyStyles: i.props[
|
|
1287
|
+
_name: i.props[A].name,
|
|
1288
|
+
_styles: i.props[A].styles,
|
|
1289
|
+
_emptyStyles: i.props[A].emptyStyles
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
1292
|
});
|
|
@@ -1295,10 +1295,10 @@ const useBlocksStoreManager = () => {
|
|
|
1295
1295
|
_id: u,
|
|
1296
1296
|
...p
|
|
1297
1297
|
};
|
|
1298
|
-
let g,
|
|
1299
|
-
c && (g = find(o, { _id: c }), x._parent = c,
|
|
1300
|
-
const
|
|
1301
|
-
return r(
|
|
1298
|
+
let g, E;
|
|
1299
|
+
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);
|
|
1300
|
+
const j = [x, ...m];
|
|
1301
|
+
return r(j, E, d), n([x._id]), x;
|
|
1302
1302
|
},
|
|
1303
1303
|
[a, o, n]
|
|
1304
1304
|
), addPredefinedBlock: a };
|
|
@@ -2414,7 +2414,7 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2414
2414
|
const g = find(l, pick(m, ["property"]));
|
|
2415
2415
|
x && (l = filter(
|
|
2416
2416
|
l,
|
|
2417
|
-
(
|
|
2417
|
+
(E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2418
2418
|
)), c.push({
|
|
2419
2419
|
...m,
|
|
2420
2420
|
fullCls: m.cls,
|
|
@@ -2568,10 +2568,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2568
2568
|
const d = o(c), u = a;
|
|
2569
2569
|
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2570
2570
|
return each(u, (x) => {
|
|
2571
|
-
const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"),
|
|
2572
|
-
p = p.replace(
|
|
2573
|
-
const
|
|
2574
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2571
|
+
const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
|
|
2572
|
+
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2573
|
+
const f = first(x.split(":"));
|
|
2574
|
+
includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
|
|
2575
2575
|
}), each(u, (x) => {
|
|
2576
2576
|
const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2577
2577
|
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
@@ -2877,7 +2877,7 @@ class Content extends Component {
|
|
|
2877
2877
|
return Children.only(this.props.children);
|
|
2878
2878
|
}
|
|
2879
2879
|
}
|
|
2880
|
-
|
|
2880
|
+
U(Content, "propTypes", {
|
|
2881
2881
|
children: PropTypes.element.isRequired,
|
|
2882
2882
|
contentDidMount: PropTypes.func.isRequired,
|
|
2883
2883
|
contentDidUpdate: PropTypes.func.isRequired
|
|
@@ -2885,17 +2885,17 @@ F(Content, "propTypes", {
|
|
|
2885
2885
|
class Frame extends Component {
|
|
2886
2886
|
constructor(r, a) {
|
|
2887
2887
|
super(r, a);
|
|
2888
|
-
|
|
2888
|
+
U(this, "setRef", (r) => {
|
|
2889
2889
|
this.nodeRef.current = r;
|
|
2890
2890
|
const { forwardedRef: a } = this.props;
|
|
2891
2891
|
typeof a == "function" ? a(r) : a && (a.current = r);
|
|
2892
2892
|
});
|
|
2893
|
-
|
|
2893
|
+
U(this, "handleLoad", () => {
|
|
2894
2894
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
2895
2895
|
});
|
|
2896
2896
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
2897
2897
|
// fallback to an interval to check if that's the case
|
|
2898
|
-
|
|
2898
|
+
U(this, "loadCheck", () => setInterval(() => {
|
|
2899
2899
|
this.handleLoad();
|
|
2900
2900
|
}, 500));
|
|
2901
2901
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -2936,7 +2936,7 @@ class Frame extends Component {
|
|
|
2936
2936
|
// also inject into the body and can mess up React. For this reason
|
|
2937
2937
|
// initialContent is expected to have a div inside of the body
|
|
2938
2938
|
// element that we render react into.
|
|
2939
|
-
|
|
2939
|
+
U(Frame, "propTypes", {
|
|
2940
2940
|
style: PropTypes.object,
|
|
2941
2941
|
// eslint-disable-line
|
|
2942
2942
|
head: PropTypes.node,
|
|
@@ -2946,7 +2946,7 @@ F(Frame, "propTypes", {
|
|
|
2946
2946
|
contentDidMount: PropTypes.func,
|
|
2947
2947
|
contentDidUpdate: PropTypes.func,
|
|
2948
2948
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
|
|
2949
|
-
}),
|
|
2949
|
+
}), U(Frame, "defaultProps", {
|
|
2950
2950
|
style: {},
|
|
2951
2951
|
head: null,
|
|
2952
2952
|
children: void 0,
|
|
@@ -3033,26 +3033,26 @@ const useDnd = () => {
|
|
|
3033
3033
|
g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
|
|
3034
3034
|
},
|
|
3035
3035
|
onDrop: (g) => {
|
|
3036
|
-
var
|
|
3037
|
-
const
|
|
3038
|
-
dropIndex = calculateDropIndex(
|
|
3039
|
-
const
|
|
3040
|
-
if ((
|
|
3036
|
+
var C;
|
|
3037
|
+
const E = dropTarget, j = getOrientation(E) === "vertical" ? g.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : g.clientX;
|
|
3038
|
+
dropIndex = calculateDropIndex(j, possiblePositions);
|
|
3039
|
+
const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3040
|
+
if ((k == null ? void 0 : k._id) === A || !S) {
|
|
3041
3041
|
x();
|
|
3042
3042
|
return;
|
|
3043
3043
|
}
|
|
3044
|
-
if (!has(
|
|
3045
|
-
a(
|
|
3044
|
+
if (!has(k, "_id")) {
|
|
3045
|
+
a(k, A === "canvas" ? null : A, dropIndex), setTimeout(x, 300);
|
|
3046
3046
|
return;
|
|
3047
3047
|
}
|
|
3048
|
-
let
|
|
3049
|
-
|
|
3048
|
+
let B = E.getAttribute("data-block-id");
|
|
3049
|
+
B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3050
3050
|
},
|
|
3051
3051
|
onDragEnter: (g) => {
|
|
3052
|
-
const
|
|
3053
|
-
dropTarget =
|
|
3054
|
-
const
|
|
3055
|
-
p(
|
|
3052
|
+
const E = g, f = E.target;
|
|
3053
|
+
dropTarget = f;
|
|
3054
|
+
const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
|
|
3055
|
+
p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
|
|
3056
3056
|
},
|
|
3057
3057
|
onDragLeave: (g) => {
|
|
3058
3058
|
g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
@@ -3211,13 +3211,13 @@ const useHandleCanvasDblClick = () => {
|
|
|
3211
3211
|
tabIndex: 0,
|
|
3212
3212
|
ref: p.setFloating,
|
|
3213
3213
|
style: u,
|
|
3214
|
-
onClick: (
|
|
3215
|
-
|
|
3214
|
+
onClick: (E) => {
|
|
3215
|
+
E.stopPropagation(), E.preventDefault();
|
|
3216
3216
|
},
|
|
3217
|
-
onMouseEnter: (
|
|
3218
|
-
|
|
3217
|
+
onMouseEnter: (E) => {
|
|
3218
|
+
E.stopPropagation(), i(null);
|
|
3219
3219
|
},
|
|
3220
|
-
onKeyDown: (
|
|
3220
|
+
onKeyDown: (E) => E.stopPropagation(),
|
|
3221
3221
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3222
3222
|
children: [
|
|
3223
3223
|
x && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3256,23 +3256,23 @@ const useHandleCanvasDblClick = () => {
|
|
|
3256
3256
|
u == null ? void 0 : u.getElementById("selected-block")
|
|
3257
3257
|
), [g] = useState(
|
|
3258
3258
|
u == null ? void 0 : u.getElementById("selected-styling-block")
|
|
3259
|
-
), [
|
|
3259
|
+
), [E] = useState(
|
|
3260
3260
|
u == null ? void 0 : u.getElementById("dragged-block")
|
|
3261
3261
|
);
|
|
3262
3262
|
useEffect(() => {
|
|
3263
3263
|
a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
|
|
3264
3264
|
}, [a, u]);
|
|
3265
|
-
const
|
|
3265
|
+
const f = get(n, "headingFont", "DM Sans"), j = get(n, "bodyFont", "DM Sans");
|
|
3266
3266
|
return useEffect(() => {
|
|
3267
|
-
const
|
|
3268
|
-
{ color:
|
|
3269
|
-
{ color:
|
|
3270
|
-
]),
|
|
3271
|
-
"bg-light":
|
|
3272
|
-
"bg-dark":
|
|
3273
|
-
"text-dark":
|
|
3274
|
-
"text-light":
|
|
3275
|
-
},
|
|
3267
|
+
const k = get(n, "primaryColor", "#000"), A = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), C = get(n, "bodyTextDarkColor", "#000"), w = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
|
|
3268
|
+
{ color: k, name: "primary" },
|
|
3269
|
+
{ color: A, name: "secondary" }
|
|
3270
|
+
]), D = {
|
|
3271
|
+
"bg-light": S,
|
|
3272
|
+
"bg-dark": B,
|
|
3273
|
+
"text-dark": C,
|
|
3274
|
+
"text-light": w
|
|
3275
|
+
}, T = get(n, "roundedCorners", "0");
|
|
3276
3276
|
!p || !p.tailwind || (p.tailwind.config = {
|
|
3277
3277
|
darkMode: "class",
|
|
3278
3278
|
theme: {
|
|
@@ -3285,56 +3285,56 @@ const useHandleCanvasDblClick = () => {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
},
|
|
3287
3287
|
fontFamily: {
|
|
3288
|
-
heading: [
|
|
3289
|
-
body: [
|
|
3288
|
+
heading: [f],
|
|
3289
|
+
body: [j]
|
|
3290
3290
|
},
|
|
3291
3291
|
borderRadius: {
|
|
3292
|
-
DEFAULT: `${
|
|
3292
|
+
DEFAULT: `${T || "0"}px`
|
|
3293
3293
|
},
|
|
3294
|
-
colors: { ...
|
|
3294
|
+
colors: { ...D, ...N }
|
|
3295
3295
|
}
|
|
3296
3296
|
},
|
|
3297
3297
|
plugins: [
|
|
3298
3298
|
typography$1,
|
|
3299
3299
|
forms,
|
|
3300
3300
|
aspectRatio,
|
|
3301
|
-
plugin(function({ addBase:
|
|
3302
|
-
|
|
3301
|
+
plugin(function({ addBase: b, theme: _ }) {
|
|
3302
|
+
b({
|
|
3303
3303
|
"h1,h2,h3,h4,h5,h6": {
|
|
3304
|
-
fontFamily:
|
|
3304
|
+
fontFamily: _("fontFamily.heading")
|
|
3305
3305
|
},
|
|
3306
3306
|
body: {
|
|
3307
|
-
fontFamily:
|
|
3308
|
-
color:
|
|
3309
|
-
backgroundColor:
|
|
3307
|
+
fontFamily: _("fontFamily.body"),
|
|
3308
|
+
color: _("colors.text-light"),
|
|
3309
|
+
backgroundColor: _("colors.bg-light")
|
|
3310
3310
|
},
|
|
3311
3311
|
".dark body": {
|
|
3312
|
-
color:
|
|
3313
|
-
backgroundColor:
|
|
3312
|
+
color: _("colors.text-dark"),
|
|
3313
|
+
backgroundColor: _("colors.bg-dark")
|
|
3314
3314
|
}
|
|
3315
3315
|
});
|
|
3316
3316
|
})
|
|
3317
3317
|
]
|
|
3318
3318
|
});
|
|
3319
|
-
}, [n, p,
|
|
3320
|
-
x && (x.textContent = `${map(r, (
|
|
3319
|
+
}, [n, p, f, j]), useEffect(() => {
|
|
3320
|
+
x && (x.textContent = `${map(r, (k) => `[data-block-id="${k}"]`).join(",")}{
|
|
3321
3321
|
outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3322
3322
|
}`);
|
|
3323
3323
|
}, [r, x]), useEffect(() => {
|
|
3324
|
-
|
|
3325
|
-
}, [c,
|
|
3324
|
+
E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3325
|
+
}, [c, E]), useEffect(() => {
|
|
3326
3326
|
m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3327
3327
|
}, [l, r, m]), useEffect(() => {
|
|
3328
|
-
g && (g.textContent = `${map(i, ({ id:
|
|
3328
|
+
g && (g.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
|
|
3329
3329
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3330
3330
|
}`);
|
|
3331
3331
|
}, [i, g]), useEffect(() => {
|
|
3332
3332
|
u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3333
|
-
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (
|
|
3333
|
+
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3334
3334
|
"link",
|
|
3335
3335
|
{
|
|
3336
3336
|
rel: "stylesheet",
|
|
3337
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3337
|
+
href: `https://fonts.googleapis.com/css2?family=${f ? `${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` : ""}${f && j && f !== j ? "&" : ""}${j && j !== f ? `family=${j.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`
|
|
3338
3338
|
}
|
|
3339
3339
|
) });
|
|
3340
3340
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
@@ -3444,50 +3444,50 @@ function isDescendant(o, n, r) {
|
|
|
3444
3444
|
}
|
|
3445
3445
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
|
|
3446
3446
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3447
|
-
const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), m = useCallback((
|
|
3448
|
-
(
|
|
3449
|
-
const
|
|
3450
|
-
return { ...
|
|
3447
|
+
const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), m = useCallback((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [g] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
|
|
3448
|
+
(f) => f.reduce((j, k) => {
|
|
3449
|
+
const A = get(d, k, {});
|
|
3450
|
+
return { ...j, ...A };
|
|
3451
3451
|
}, {}),
|
|
3452
3452
|
[d]
|
|
3453
3453
|
);
|
|
3454
3454
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3455
|
-
o.map((
|
|
3456
|
-
if (g ===
|
|
3455
|
+
o.map((f, j) => {
|
|
3456
|
+
if (g === f._id || u.includes(f._id))
|
|
3457
3457
|
return null;
|
|
3458
|
-
const
|
|
3459
|
-
if (
|
|
3460
|
-
const
|
|
3461
|
-
|
|
3458
|
+
const k = {}, A = filter(n, { _parent: f._id });
|
|
3459
|
+
if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
|
|
3460
|
+
const _ = p(f);
|
|
3461
|
+
k.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(_, (R) => !R._parent), allBlocks: _ });
|
|
3462
3462
|
}
|
|
3463
|
-
const
|
|
3464
|
-
if (isNull(
|
|
3465
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${
|
|
3466
|
-
const
|
|
3467
|
-
if (get(
|
|
3463
|
+
const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
|
|
3464
|
+
if (isNull(C))
|
|
3465
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3466
|
+
const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = m(f);
|
|
3467
|
+
if (get(D, "__isHidden", !1) && !includes(r, f._id))
|
|
3468
3468
|
return null;
|
|
3469
|
-
const
|
|
3470
|
-
...includes(r,
|
|
3471
|
-
"data-block-id":
|
|
3472
|
-
"data-block-type":
|
|
3469
|
+
const T = l && isDescendant(l._id, f._id, n), b = {
|
|
3470
|
+
...includes(r, f._id) ? { "force-show": "" } : {},
|
|
3471
|
+
"data-block-id": f._id,
|
|
3472
|
+
"data-block-type": f._type,
|
|
3473
3473
|
...l ? (
|
|
3474
3474
|
// @ts-ignore
|
|
3475
3475
|
{
|
|
3476
|
-
"data-dnd": canAcceptChildBlock(
|
|
3477
|
-
"data-dnd-dragged": l._id ===
|
|
3476
|
+
"data-dnd": canAcceptChildBlock(f._type, l == null ? void 0 : l._type) ? "yes" : "no",
|
|
3477
|
+
"data-dnd-dragged": l._id === f._id || T ? "yes" : "no"
|
|
3478
3478
|
}
|
|
3479
3479
|
) : {},
|
|
3480
|
-
...i ===
|
|
3481
|
-
...includes(a,
|
|
3480
|
+
...i === f._id && !T ? { "data-drop": "yes" } : {},
|
|
3481
|
+
...includes(a, f._id) ? { "data-cut-block": "yes" } : {}
|
|
3482
3482
|
};
|
|
3483
|
-
return
|
|
3484
|
-
blockProps:
|
|
3485
|
-
index:
|
|
3486
|
-
...applyBindings(
|
|
3487
|
-
...omit(
|
|
3488
|
-
...
|
|
3483
|
+
return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: b }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(C, {
|
|
3484
|
+
blockProps: b,
|
|
3485
|
+
index: j,
|
|
3486
|
+
...applyBindings(f, x),
|
|
3487
|
+
...omit(D, ["__isHidden"]),
|
|
3488
|
+
...k,
|
|
3489
3489
|
inBuilder: !0,
|
|
3490
|
-
blockState:
|
|
3490
|
+
blockState: N
|
|
3491
3491
|
}) });
|
|
3492
3492
|
})
|
|
3493
3493
|
) });
|
|
@@ -3537,47 +3537,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3537
3537
|
n(i);
|
|
3538
3538
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3539
3539
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3540
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [,
|
|
3541
|
-
u((
|
|
3540
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
|
|
3541
|
+
u((N) => ({ ...N, width: w }));
|
|
3542
3542
|
};
|
|
3543
3543
|
useEffect(() => {
|
|
3544
3544
|
if (!c.current)
|
|
3545
3545
|
return;
|
|
3546
|
-
const { clientWidth:
|
|
3547
|
-
u({ width:
|
|
3546
|
+
const { clientWidth: w, clientHeight: N } = c.current;
|
|
3547
|
+
u({ width: w, height: N });
|
|
3548
3548
|
}, [c, n]);
|
|
3549
|
-
const
|
|
3550
|
-
const { top:
|
|
3551
|
-
return
|
|
3549
|
+
const B = (w, N = 0) => {
|
|
3550
|
+
const { top: D } = w.getBoundingClientRect();
|
|
3551
|
+
return D + N >= 0 && D - N <= window.innerHeight;
|
|
3552
3552
|
};
|
|
3553
3553
|
useEffect(() => {
|
|
3554
|
-
var
|
|
3554
|
+
var w, N;
|
|
3555
3555
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3556
|
+
const D = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3557
|
+
D && (B(D) || (N = (w = i.current) == null ? void 0 : w.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
|
|
3558
3558
|
}
|
|
3559
3559
|
}, [a]), useEffect(() => {
|
|
3560
|
-
if (!isEmpty(
|
|
3561
|
-
const
|
|
3560
|
+
if (!isEmpty(f) && i.current) {
|
|
3561
|
+
const w = getElementByStyleId(
|
|
3562
3562
|
i.current.contentDocument,
|
|
3563
|
-
first(
|
|
3563
|
+
first(f).id
|
|
3564
3564
|
);
|
|
3565
|
-
g(
|
|
3565
|
+
g(w ? [w] : [null]);
|
|
3566
3566
|
} else
|
|
3567
3567
|
g([null]);
|
|
3568
|
-
}, [
|
|
3569
|
-
const
|
|
3570
|
-
let
|
|
3571
|
-
return
|
|
3568
|
+
}, [f]);
|
|
3569
|
+
const C = useMemo(() => {
|
|
3570
|
+
let w = IframeInitialContent;
|
|
3571
|
+
return w = w.replace("__HTML_DIR__", A), o === "offline" && (w = w.replace(
|
|
3572
3572
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3573
3573
|
"/offline/tailwind.cdn.js"
|
|
3574
|
-
),
|
|
3575
|
-
}, [o,
|
|
3576
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3574
|
+
), w = w.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), w = w.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), w;
|
|
3575
|
+
}, [o, A]);
|
|
3576
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3577
3577
|
"div",
|
|
3578
3578
|
{
|
|
3579
3579
|
onClick: () => {
|
|
3580
|
-
r([]),
|
|
3580
|
+
r([]), j([]);
|
|
3581
3581
|
},
|
|
3582
3582
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
3583
3583
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -3585,12 +3585,12 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3585
3585
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3586
3586
|
ChaiFrame,
|
|
3587
3587
|
{
|
|
3588
|
-
contentDidMount: () =>
|
|
3588
|
+
contentDidMount: () => E(i.current),
|
|
3589
3589
|
ref: i,
|
|
3590
3590
|
id: "canvas-iframe",
|
|
3591
3591
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3592
3592
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3593
|
-
initialContent:
|
|
3593
|
+
initialContent: C,
|
|
3594
3594
|
children: [
|
|
3595
3595
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3596
3596
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3602,7 +3602,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3602
3602
|
),
|
|
3603
3603
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
|
|
3604
3604
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
3605
|
-
|
|
3605
|
+
k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
3606
3606
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
3607
3607
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3608
3608
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -3713,7 +3713,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3713
3713
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
|
|
3714
3714
|
] }, l))
|
|
3715
3715
|
] }) });
|
|
3716
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3716
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-JFNyNUeD.js")), CanvasArea = () => {
|
|
3717
3717
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3718
3718
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3719
3719
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3788,42 +3788,42 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3788
3788
|
showHeading: o = !0,
|
|
3789
3789
|
className: n = ""
|
|
3790
3790
|
}) => {
|
|
3791
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3792
|
-
|
|
3791
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: C }, w) => {
|
|
3792
|
+
w && (a(C), i.current = C);
|
|
3793
3793
|
}, {
|
|
3794
3794
|
bodyFont: u,
|
|
3795
3795
|
headingFont: p,
|
|
3796
3796
|
primaryColor: m,
|
|
3797
3797
|
bodyTextDarkColor: x,
|
|
3798
3798
|
bodyTextLightColor: g,
|
|
3799
|
-
bodyBgDarkColor:
|
|
3800
|
-
secondaryColor:
|
|
3801
|
-
bodyBgLightColor:
|
|
3802
|
-
roundedCorners:
|
|
3799
|
+
bodyBgDarkColor: E,
|
|
3800
|
+
secondaryColor: f,
|
|
3801
|
+
bodyBgLightColor: j,
|
|
3802
|
+
roundedCorners: k
|
|
3803
3803
|
} = r;
|
|
3804
|
-
let
|
|
3805
|
-
headingFont:
|
|
3804
|
+
let A = {
|
|
3805
|
+
headingFont: y({
|
|
3806
3806
|
title: c("theme_config.heading_font"),
|
|
3807
3807
|
default: p,
|
|
3808
3808
|
options: FONTS
|
|
3809
3809
|
}),
|
|
3810
|
-
bodyFont:
|
|
3810
|
+
bodyFont: y({
|
|
3811
3811
|
title: c("theme_config.body_font"),
|
|
3812
3812
|
default: u,
|
|
3813
3813
|
options: FONTS
|
|
3814
3814
|
}),
|
|
3815
|
-
roundedCorners:
|
|
3815
|
+
roundedCorners: s({
|
|
3816
3816
|
title: c("theme_config.rounded_corner"),
|
|
3817
|
-
default: parseInt(
|
|
3817
|
+
default: parseInt(k || 5, 10)
|
|
3818
3818
|
}),
|
|
3819
3819
|
primaryColor: h({ title: c("theme_config.primary"), default: m }),
|
|
3820
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3820
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: f })
|
|
3821
3821
|
};
|
|
3822
|
-
l || (
|
|
3823
|
-
...
|
|
3822
|
+
l || (A = {
|
|
3823
|
+
...A,
|
|
3824
3824
|
bodyBgLightColor: h({
|
|
3825
3825
|
title: c("theme_config.background"),
|
|
3826
|
-
default:
|
|
3826
|
+
default: j
|
|
3827
3827
|
}),
|
|
3828
3828
|
bodyTextLightColor: h({
|
|
3829
3829
|
title: c("theme_config.text_color"),
|
|
@@ -3831,20 +3831,20 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3831
3831
|
}),
|
|
3832
3832
|
bodyBgDarkColor: h({
|
|
3833
3833
|
title: c("theme_config.background_dark_mode"),
|
|
3834
|
-
default:
|
|
3834
|
+
default: E
|
|
3835
3835
|
}),
|
|
3836
3836
|
bodyTextDarkColor: h({
|
|
3837
3837
|
title: c("theme_config.text_color_dark_mode"),
|
|
3838
3838
|
default: g
|
|
3839
3839
|
})
|
|
3840
3840
|
});
|
|
3841
|
-
const
|
|
3841
|
+
const S = {
|
|
3842
3842
|
type: "object",
|
|
3843
3843
|
properties: {}
|
|
3844
|
-
},
|
|
3845
|
-
return Object.keys(
|
|
3846
|
-
const
|
|
3847
|
-
return
|
|
3844
|
+
}, B = {};
|
|
3845
|
+
return Object.keys(A).forEach((C) => {
|
|
3846
|
+
const w = A[C];
|
|
3847
|
+
return S.properties || (S.properties = {}), S.properties[C] = w.schema, B[C] = w.uiSchema, !0;
|
|
3848
3848
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3849
3849
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
|
|
3850
3850
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3856,8 +3856,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3856
3856
|
omitExtraData: !0,
|
|
3857
3857
|
liveOmit: !0,
|
|
3858
3858
|
liveValidate: !0,
|
|
3859
|
-
uiSchema:
|
|
3860
|
-
schema:
|
|
3859
|
+
uiSchema: B,
|
|
3860
|
+
schema: S,
|
|
3861
3861
|
formData: r,
|
|
3862
3862
|
validator,
|
|
3863
3863
|
onChange: d
|
|
@@ -4040,34 +4040,34 @@ function BiExpandVertical(o) {
|
|
|
4040
4040
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4041
4041
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4042
4042
|
let p = null;
|
|
4043
|
-
const m = o.children.length > 0, { id: x, data: g, isSelected:
|
|
4044
|
-
|
|
4045
|
-
},
|
|
4046
|
-
|
|
4047
|
-
},
|
|
4048
|
-
|
|
4049
|
-
},
|
|
4050
|
-
|
|
4043
|
+
const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
|
|
4044
|
+
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4045
|
+
}, B = (T) => {
|
|
4046
|
+
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
4047
|
+
}, C = (T) => {
|
|
4048
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4049
|
+
}, w = (T) => {
|
|
4050
|
+
T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), A(T);
|
|
4051
4051
|
};
|
|
4052
4052
|
useEffect(() => {
|
|
4053
|
-
const
|
|
4054
|
-
|
|
4053
|
+
const T = setTimeout(() => {
|
|
4054
|
+
f && !o.isOpen && !j && !i.includes(x) && o.toggle();
|
|
4055
4055
|
}, 500);
|
|
4056
|
-
return () => clearTimeout(
|
|
4057
|
-
}, [
|
|
4058
|
-
const
|
|
4059
|
-
const
|
|
4060
|
-
for (let
|
|
4061
|
-
if (
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4056
|
+
return () => clearTimeout(T);
|
|
4057
|
+
}, [f, o, j]);
|
|
4058
|
+
const N = useMemo(() => {
|
|
4059
|
+
const T = Object.keys(g), b = [];
|
|
4060
|
+
for (let _ = 0; _ < T.length; _++)
|
|
4061
|
+
if (T[_].endsWith("_attrs")) {
|
|
4062
|
+
const R = g[T[_]], v = Object.keys(R).join("|");
|
|
4063
|
+
v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
|
|
4064
4064
|
}
|
|
4065
|
-
return
|
|
4066
|
-
}, [g]),
|
|
4067
|
-
const
|
|
4068
|
-
|
|
4069
|
-
const
|
|
4070
|
-
|
|
4065
|
+
return b;
|
|
4066
|
+
}, [g]), D = (T, b) => {
|
|
4067
|
+
const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
|
|
4068
|
+
R && R.setAttribute("data-drop", b);
|
|
4069
|
+
const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
4070
|
+
v.top >= I.top && v.left >= I.left && v.bottom <= I.bottom && v.right <= I.right || (_.documentElement.scrollTop = R.offsetTop - I.top);
|
|
4071
4071
|
};
|
|
4072
4072
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4073
4073
|
"button",
|
|
@@ -4083,26 +4083,26 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4083
4083
|
"div",
|
|
4084
4084
|
{
|
|
4085
4085
|
onMouseEnter: () => d(x),
|
|
4086
|
-
onClick:
|
|
4086
|
+
onClick: w,
|
|
4087
4087
|
style: n,
|
|
4088
4088
|
"data-node-id": x,
|
|
4089
4089
|
ref: i.includes(x) ? null : r,
|
|
4090
|
-
onDragStart: () =>
|
|
4091
|
-
onDragEnd: () =>
|
|
4092
|
-
onDragOver: (
|
|
4093
|
-
|
|
4090
|
+
onDragStart: () => B(o),
|
|
4091
|
+
onDragEnd: () => C(o),
|
|
4092
|
+
onDragOver: (T) => {
|
|
4093
|
+
T.preventDefault(), D(x, "yes");
|
|
4094
4094
|
},
|
|
4095
|
-
onDragLeave: (
|
|
4096
|
-
|
|
4095
|
+
onDragLeave: (T) => {
|
|
4096
|
+
T.preventDefault(), D(x, "no");
|
|
4097
4097
|
},
|
|
4098
|
-
onDrop: (
|
|
4099
|
-
|
|
4098
|
+
onDrop: (T) => {
|
|
4099
|
+
T.preventDefault(), D(x, "no");
|
|
4100
4100
|
},
|
|
4101
4101
|
className: cn(
|
|
4102
4102
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4103
|
+
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4104
|
+
f && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
|
|
4105
|
+
j && "opacity-20",
|
|
4106
4106
|
i.includes(x) ? "opacity-50" : ""
|
|
4107
4107
|
),
|
|
4108
4108
|
children: [
|
|
@@ -4111,39 +4111,39 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4111
4111
|
"div",
|
|
4112
4112
|
{
|
|
4113
4113
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
4114
|
-
children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4114
|
+
children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4115
4115
|
}
|
|
4116
4116
|
),
|
|
4117
4117
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4118
4118
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
|
|
4119
|
-
|
|
4119
|
+
k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4120
4120
|
"div",
|
|
4121
4121
|
{
|
|
4122
4122
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
4123
|
-
onDoubleClick: (
|
|
4124
|
-
|
|
4123
|
+
onDoubleClick: (T) => {
|
|
4124
|
+
T.stopPropagation(), o.edit(), o.deselect();
|
|
4125
4125
|
},
|
|
4126
4126
|
children: [
|
|
4127
4127
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4128
|
+
N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4129
|
+
N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4130
|
+
N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
4131
4131
|
]
|
|
4132
4132
|
}
|
|
4133
4133
|
)
|
|
4134
4134
|
] })
|
|
4135
4135
|
] }),
|
|
4136
4136
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
|
|
4137
|
-
!i.includes(x) && a.map((
|
|
4137
|
+
!i.includes(x) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4138
4138
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4139
4139
|
TooltipTrigger,
|
|
4140
4140
|
{
|
|
4141
4141
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
4142
4142
|
asChild: !0,
|
|
4143
|
-
children: React__default.createElement(
|
|
4143
|
+
children: React__default.createElement(T.item, { blockId: x })
|
|
4144
4144
|
}
|
|
4145
4145
|
),
|
|
4146
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children:
|
|
4146
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
|
|
4147
4147
|
] })),
|
|
4148
4148
|
canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4149
4149
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4161,8 +4161,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4161
4161
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4162
4162
|
TooltipTrigger,
|
|
4163
4163
|
{
|
|
4164
|
-
onClick: (
|
|
4165
|
-
|
|
4164
|
+
onClick: (T) => {
|
|
4165
|
+
T.stopPropagation(), c(x), o.isOpen && o.toggle();
|
|
4166
4166
|
},
|
|
4167
4167
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
|
|
4168
4168
|
asChild: !0,
|
|
@@ -4581,29 +4581,29 @@ function ExpandableObject(o) {
|
|
|
4581
4581
|
shouldExpandNode: p,
|
|
4582
4582
|
clickToExpandNode: m
|
|
4583
4583
|
} = o;
|
|
4584
|
-
const x = useRef(!1), [g,
|
|
4584
|
+
const x = useRef(!1), [g, E, f] = useBool(() => p(d, r, n));
|
|
4585
4585
|
useEffect(() => {
|
|
4586
|
-
x.current ?
|
|
4586
|
+
x.current ? f(p(d, r, n)) : x.current = !0;
|
|
4587
4587
|
}, [p]);
|
|
4588
|
-
const
|
|
4589
|
-
|
|
4588
|
+
const j = g ? u.collapseIcon : u.expandIcon, k = g ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
|
|
4589
|
+
w.key === " " && (w.preventDefault(), E());
|
|
4590
4590
|
};
|
|
4591
4591
|
return /* @__PURE__ */ createElement("div", {
|
|
4592
4592
|
className: u.basicChildStyle,
|
|
4593
4593
|
role: "list"
|
|
4594
4594
|
}, /* @__PURE__ */ createElement("span", {
|
|
4595
|
-
className:
|
|
4596
|
-
onClick:
|
|
4597
|
-
onKeyDown:
|
|
4595
|
+
className: j,
|
|
4596
|
+
onClick: E,
|
|
4597
|
+
onKeyDown: C,
|
|
4598
4598
|
role: "button",
|
|
4599
4599
|
tabIndex: 0,
|
|
4600
|
-
"aria-label":
|
|
4600
|
+
"aria-label": k,
|
|
4601
4601
|
"aria-expanded": g,
|
|
4602
|
-
"aria-controls": g ?
|
|
4602
|
+
"aria-controls": g ? A : void 0
|
|
4603
4603
|
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4604
4604
|
className: u.clickableLabel,
|
|
4605
|
-
onClick:
|
|
4606
|
-
onKeyDown:
|
|
4605
|
+
onClick: E,
|
|
4606
|
+
onKeyDown: C,
|
|
4607
4607
|
role: "button",
|
|
4608
4608
|
tabIndex: -1
|
|
4609
4609
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
@@ -4611,24 +4611,24 @@ function ExpandableObject(o) {
|
|
|
4611
4611
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4612
4612
|
className: u.punctuation
|
|
4613
4613
|
}, i), g ? /* @__PURE__ */ createElement("div", {
|
|
4614
|
-
id:
|
|
4615
|
-
}, a.map((
|
|
4616
|
-
key:
|
|
4617
|
-
field:
|
|
4618
|
-
value:
|
|
4614
|
+
id: A
|
|
4615
|
+
}, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4616
|
+
key: w[0] || N,
|
|
4617
|
+
field: w[0],
|
|
4618
|
+
value: w[1],
|
|
4619
4619
|
style: u,
|
|
4620
|
-
lastElement:
|
|
4621
|
-
level:
|
|
4620
|
+
lastElement: N === B,
|
|
4621
|
+
level: S,
|
|
4622
4622
|
shouldExpandNode: p,
|
|
4623
4623
|
clickToExpandNode: m
|
|
4624
4624
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4625
4625
|
className: u.collapsedContent,
|
|
4626
|
-
onClick:
|
|
4627
|
-
onKeyDown:
|
|
4626
|
+
onClick: E,
|
|
4627
|
+
onKeyDown: C,
|
|
4628
4628
|
role: "button",
|
|
4629
4629
|
tabIndex: -1,
|
|
4630
4630
|
"aria-hidden": !0,
|
|
4631
|
-
"aria-label":
|
|
4631
|
+
"aria-label": k,
|
|
4632
4632
|
"aria-expanded": g
|
|
4633
4633
|
}), /* @__PURE__ */ createElement("span", {
|
|
4634
4634
|
className: u.punctuation
|
|
@@ -4782,9 +4782,9 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4782
4782
|
dataType: i,
|
|
4783
4783
|
appliedBindings: c
|
|
4784
4784
|
}) => {
|
|
4785
|
-
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1),
|
|
4786
|
-
(
|
|
4787
|
-
) : d.filter((
|
|
4785
|
+
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(
|
|
4786
|
+
(f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
|
|
4787
|
+
) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
|
|
4788
4788
|
return useEffect(() => {
|
|
4789
4789
|
n && l(n);
|
|
4790
4790
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -4813,23 +4813,23 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4813
4813
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4814
4814
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4815
4815
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4816
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(
|
|
4816
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4817
4817
|
CommandItem,
|
|
4818
4818
|
{
|
|
4819
|
-
value:
|
|
4819
|
+
value: f,
|
|
4820
4820
|
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4821
|
-
onSelect: (
|
|
4822
|
-
r(find(
|
|
4821
|
+
onSelect: (j) => {
|
|
4822
|
+
r(find(E, (k) => k === j) || null), g(!1);
|
|
4823
4823
|
},
|
|
4824
4824
|
children: [
|
|
4825
4825
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4826
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4827
|
-
|
|
4826
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
|
|
4827
|
+
f
|
|
4828
4828
|
] }),
|
|
4829
|
-
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,
|
|
4829
|
+
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, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
|
|
4830
4830
|
]
|
|
4831
4831
|
},
|
|
4832
|
-
|
|
4832
|
+
f
|
|
4833
4833
|
)) })
|
|
4834
4834
|
] })
|
|
4835
4835
|
] }) })
|
|
@@ -4844,15 +4844,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4844
4844
|
item: a
|
|
4845
4845
|
}) => {
|
|
4846
4846
|
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4847
|
-
(
|
|
4848
|
-
if (isEmpty(
|
|
4847
|
+
(E, f) => {
|
|
4848
|
+
if (isEmpty(E))
|
|
4849
4849
|
return "";
|
|
4850
4850
|
{
|
|
4851
|
-
const
|
|
4852
|
-
if (isArray$1(
|
|
4851
|
+
const j = get(f === "PROP" ? u : p, E, "");
|
|
4852
|
+
if (isArray$1(j))
|
|
4853
4853
|
return "list";
|
|
4854
|
-
const
|
|
4855
|
-
return
|
|
4854
|
+
const k = typeof j;
|
|
4855
|
+
return k === "string" ? "text" : k === "object" ? "model" : k;
|
|
4856
4856
|
}
|
|
4857
4857
|
},
|
|
4858
4858
|
[u, p]
|
|
@@ -4871,9 +4871,9 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4871
4871
|
placeholder: "Enter prop key",
|
|
4872
4872
|
value: l,
|
|
4873
4873
|
setValue: i,
|
|
4874
|
-
onChange: (
|
|
4875
|
-
const
|
|
4876
|
-
i(
|
|
4874
|
+
onChange: (E) => {
|
|
4875
|
+
const f = m(E, "PROP");
|
|
4876
|
+
i(E), x !== f && d(""), g(f);
|
|
4877
4877
|
},
|
|
4878
4878
|
data: u,
|
|
4879
4879
|
dataType: x,
|
|
@@ -4889,9 +4889,9 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4889
4889
|
placeholder: "Enter data path",
|
|
4890
4890
|
value: c,
|
|
4891
4891
|
setValue: d,
|
|
4892
|
-
onChange: (
|
|
4893
|
-
const
|
|
4894
|
-
d(x ===
|
|
4892
|
+
onChange: (E) => {
|
|
4893
|
+
const f = m(E, "PATH");
|
|
4894
|
+
d(x === f ? E : "");
|
|
4895
4895
|
},
|
|
4896
4896
|
data: p,
|
|
4897
4897
|
dataType: x,
|
|
@@ -4976,10 +4976,10 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4976
4976
|
const x = last(i);
|
|
4977
4977
|
return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
|
|
4978
4978
|
}, [a, i]), u = (x) => {
|
|
4979
|
-
const g = filter(i, (
|
|
4979
|
+
const g = filter(i, (E) => E.key !== x.key);
|
|
4980
4980
|
c([...g, x]), m([...g, x]);
|
|
4981
4981
|
}, p = (x) => {
|
|
4982
|
-
const g = filter(i, (
|
|
4982
|
+
const g = filter(i, (E, f) => x !== f);
|
|
4983
4983
|
m([...g]);
|
|
4984
4984
|
}, m = useCallback(
|
|
4985
4985
|
(x = []) => {
|
|
@@ -4988,8 +4988,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4988
4988
|
return;
|
|
4989
4989
|
}
|
|
4990
4990
|
const g = {};
|
|
4991
|
-
forEach(x, (
|
|
4992
|
-
!isEmpty(
|
|
4991
|
+
forEach(x, (E) => {
|
|
4992
|
+
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
|
|
4993
4993
|
}), n(g);
|
|
4994
4994
|
},
|
|
4995
4995
|
[n]
|
|
@@ -5098,7 +5098,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5098
5098
|
}
|
|
5099
5099
|
)
|
|
5100
5100
|
] });
|
|
5101
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5101
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-vR5ig3Lz.js")), UploadImages = React__default.lazy(() => import("./UploadImages-jCqfO33R.js")), ImagesPanel = ({
|
|
5102
5102
|
isModalView: o = !1,
|
|
5103
5103
|
onSelect: n = () => {
|
|
5104
5104
|
}
|
|
@@ -5358,30 +5358,30 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5358
5358
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
|
|
5359
5359
|
};
|
|
5360
5360
|
function BlockSettings() {
|
|
5361
|
-
const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData:
|
|
5362
|
-
if (
|
|
5363
|
-
const
|
|
5364
|
-
r([o._id], { [
|
|
5361
|
+
const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, j, k) => {
|
|
5362
|
+
if (j && (i == null ? void 0 : i._id) === o._id) {
|
|
5363
|
+
const A = j.replace("root.", "");
|
|
5364
|
+
r([o._id], { [A]: get(f, A) }, k);
|
|
5365
5365
|
}
|
|
5366
5366
|
}, p = useCallback(
|
|
5367
|
-
debounce(({ formData:
|
|
5368
|
-
u({ formData:
|
|
5367
|
+
debounce(({ formData: f }, j, k) => {
|
|
5368
|
+
u({ formData: f }, j, k), c(f);
|
|
5369
5369
|
}, 1500),
|
|
5370
5370
|
[o == null ? void 0 : o._id]
|
|
5371
|
-
), m = ({ formData:
|
|
5372
|
-
if (
|
|
5373
|
-
const
|
|
5371
|
+
), m = ({ formData: f }, j) => {
|
|
5372
|
+
if (j) {
|
|
5373
|
+
const k = j.replace("root.", "");
|
|
5374
5374
|
n(
|
|
5375
5375
|
[o._id],
|
|
5376
|
-
convertDotNotationToObject(
|
|
5377
|
-
), p({ formData:
|
|
5376
|
+
convertDotNotationToObject(k, get(f, k.split(".")))
|
|
5377
|
+
), p({ formData: f }, j, { [k]: get(i, k) });
|
|
5378
5378
|
}
|
|
5379
5379
|
}, x = keys(get(l, "_bindings", {})), g = useMemo(() => {
|
|
5380
|
-
const
|
|
5381
|
-
return each(
|
|
5382
|
-
get(
|
|
5383
|
-
}), d && each(x, (
|
|
5384
|
-
}, [a, x, d]),
|
|
5380
|
+
const f = cloneDeep(get(a, "props", {}));
|
|
5381
|
+
return each(f, (j, k) => {
|
|
5382
|
+
get(j, "hidden", !1) && delete f[k];
|
|
5383
|
+
}), d && each(x, (j) => delete f[j]), f;
|
|
5384
|
+
}, [a, x, d]), E = get(a, "server", !1);
|
|
5385
5385
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5386
5386
|
d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5387
5387
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
@@ -5398,8 +5398,8 @@ function BlockSettings() {
|
|
|
5398
5398
|
DataBindingSetting$1,
|
|
5399
5399
|
{
|
|
5400
5400
|
bindingData: get(o, "_bindings", {}),
|
|
5401
|
-
onChange: (
|
|
5402
|
-
u({ formData: { _bindings:
|
|
5401
|
+
onChange: (f) => {
|
|
5402
|
+
u({ formData: { _bindings: f } }, "root._bindings");
|
|
5403
5403
|
}
|
|
5404
5404
|
}
|
|
5405
5405
|
) })
|
|
@@ -5438,7 +5438,7 @@ function BlockSettings() {
|
|
|
5438
5438
|
}
|
|
5439
5439
|
),
|
|
5440
5440
|
(o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5441
|
-
|
|
5441
|
+
E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
|
|
5442
5442
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5443
5443
|
] });
|
|
5444
5444
|
}
|
|
@@ -5460,14 +5460,14 @@ const getBlockWithChildren = (o, n) => {
|
|
|
5460
5460
|
if (l) {
|
|
5461
5461
|
n(!0), a(null);
|
|
5462
5462
|
try {
|
|
5463
|
-
const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((
|
|
5463
|
+
const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
|
|
5464
5464
|
set(g, "0._parent", null);
|
|
5465
|
-
const
|
|
5466
|
-
if (
|
|
5467
|
-
a(
|
|
5465
|
+
const E = await l(u, m, g), { blocks: f, error: j } = E;
|
|
5466
|
+
if (j) {
|
|
5467
|
+
a(j);
|
|
5468
5468
|
return;
|
|
5469
5469
|
}
|
|
5470
|
-
u === "styles" ? c(
|
|
5470
|
+
u === "styles" ? c(f) : i(f), x && x(E);
|
|
5471
5471
|
} catch (g) {
|
|
5472
5472
|
a(g);
|
|
5473
5473
|
} finally {
|
|
@@ -5549,8 +5549,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5549
5549
|
(g = d.current) == null || g.focus();
|
|
5550
5550
|
}, []);
|
|
5551
5551
|
const x = (g) => {
|
|
5552
|
-
const { usage:
|
|
5553
|
-
!l &&
|
|
5552
|
+
const { usage: E } = g || {};
|
|
5553
|
+
!l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5554
5554
|
};
|
|
5555
5555
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5556
5556
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5610,37 +5610,37 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5610
5610
|
keys: ["name"]
|
|
5611
5611
|
});
|
|
5612
5612
|
function ManualClasses() {
|
|
5613
|
-
var
|
|
5614
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (
|
|
5615
|
-
const
|
|
5616
|
-
a(i,
|
|
5617
|
-
}, [
|
|
5618
|
-
const
|
|
5619
|
-
let
|
|
5620
|
-
if (
|
|
5621
|
-
const [
|
|
5622
|
-
|
|
5623
|
-
...
|
|
5624
|
-
item: { ...
|
|
5613
|
+
var w;
|
|
5614
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
|
|
5615
|
+
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5616
|
+
a(i, N, !0), u("");
|
|
5617
|
+
}, [E, f] = useState([]), j = ({ value: N }) => {
|
|
5618
|
+
const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
|
|
5619
|
+
let b = [];
|
|
5620
|
+
if (T && T.length > 0) {
|
|
5621
|
+
const [_] = T, R = D.replace(_, "");
|
|
5622
|
+
b = fuse.search(R).map((I) => ({
|
|
5623
|
+
...I,
|
|
5624
|
+
item: { ...I.item, name: _ + I.item.name }
|
|
5625
5625
|
}));
|
|
5626
5626
|
} else
|
|
5627
|
-
|
|
5628
|
-
return
|
|
5629
|
-
},
|
|
5630
|
-
|
|
5631
|
-
},
|
|
5627
|
+
b = fuse.search(D);
|
|
5628
|
+
return f(map(b, "item"));
|
|
5629
|
+
}, k = () => {
|
|
5630
|
+
f([]);
|
|
5631
|
+
}, A = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5632
5632
|
autoComplete: "off",
|
|
5633
5633
|
autoCorrect: "off",
|
|
5634
5634
|
autoCapitalize: "off",
|
|
5635
5635
|
spellCheck: !1,
|
|
5636
5636
|
placeholder: o("enter_classes_separated_by_space"),
|
|
5637
5637
|
value: d,
|
|
5638
|
-
onKeyDown: (
|
|
5639
|
-
|
|
5638
|
+
onKeyDown: (N) => {
|
|
5639
|
+
N.key === "Enter" && d.trim() !== "" && g();
|
|
5640
5640
|
},
|
|
5641
|
-
onChange: (
|
|
5641
|
+
onChange: (N, { newValue: D }) => u(D),
|
|
5642
5642
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5643
|
-
},
|
|
5643
|
+
}, C = () => {
|
|
5644
5644
|
if (navigator.clipboard === void 0) {
|
|
5645
5645
|
p({
|
|
5646
5646
|
title: o("clipboard_not_supported"),
|
|
@@ -5657,13 +5657,13 @@ function ManualClasses() {
|
|
|
5657
5657
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5658
5658
|
"div",
|
|
5659
5659
|
{
|
|
5660
|
-
className: `flex ${
|
|
5660
|
+
className: `flex ${E.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
|
|
5661
5661
|
children: [
|
|
5662
5662
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
5663
5663
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5664
5664
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5665
5665
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5666
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5666
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: C, className: "cursor-pointer" }) }),
|
|
5667
5667
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
|
|
5668
5668
|
] })
|
|
5669
5669
|
] }),
|
|
@@ -5679,12 +5679,12 @@ function ManualClasses() {
|
|
|
5679
5679
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5680
5680
|
Autosuggest,
|
|
5681
5681
|
{
|
|
5682
|
-
suggestions:
|
|
5683
|
-
onSuggestionsFetchRequested:
|
|
5684
|
-
onSuggestionsClearRequested:
|
|
5685
|
-
getSuggestionValue:
|
|
5686
|
-
renderSuggestion:
|
|
5687
|
-
inputProps:
|
|
5682
|
+
suggestions: E,
|
|
5683
|
+
onSuggestionsFetchRequested: j,
|
|
5684
|
+
onSuggestionsClearRequested: k,
|
|
5685
|
+
getSuggestionValue: A,
|
|
5686
|
+
renderSuggestion: S,
|
|
5687
|
+
inputProps: B,
|
|
5688
5688
|
containerProps: {
|
|
5689
5689
|
className: "relative h-8 w-full gap-y-1 py-1 border-border"
|
|
5690
5690
|
},
|
|
@@ -5708,22 +5708,22 @@ function ManualClasses() {
|
|
|
5708
5708
|
)
|
|
5709
5709
|
] }),
|
|
5710
5710
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
|
|
5711
|
-
x.map((
|
|
5711
|
+
x.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5712
5712
|
"div",
|
|
5713
5713
|
{
|
|
5714
5714
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5715
5715
|
children: [
|
|
5716
|
-
|
|
5716
|
+
N,
|
|
5717
5717
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5718
5718
|
Cross2Icon,
|
|
5719
5719
|
{
|
|
5720
|
-
onClick: () => l(i, [
|
|
5720
|
+
onClick: () => l(i, [N]),
|
|
5721
5721
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5722
5722
|
}
|
|
5723
5723
|
)
|
|
5724
5724
|
]
|
|
5725
5725
|
},
|
|
5726
|
-
|
|
5726
|
+
N
|
|
5727
5727
|
))
|
|
5728
5728
|
) })
|
|
5729
5729
|
]
|
|
@@ -6116,8 +6116,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6116
6116
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6117
6117
|
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
|
|
6118
6118
|
// eslint-disable-next-line no-shadow
|
|
6119
|
-
(
|
|
6120
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6119
|
+
(f) => {
|
|
6120
|
+
["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((j) => ({ ...j, color: f, shade: j.shade ? j.shade : "500" })));
|
|
6121
6121
|
},
|
|
6122
6122
|
[c, u]
|
|
6123
6123
|
);
|
|
@@ -6126,18 +6126,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6126
6126
|
return c([]);
|
|
6127
6127
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6128
6128
|
}, [m]);
|
|
6129
|
-
const
|
|
6129
|
+
const E = useCallback(
|
|
6130
6130
|
// eslint-disable-next-line no-shadow
|
|
6131
|
-
(
|
|
6132
|
-
u({ color: m, shade:
|
|
6131
|
+
(f) => {
|
|
6132
|
+
u({ color: m, shade: f });
|
|
6133
6133
|
},
|
|
6134
6134
|
[m]
|
|
6135
6135
|
);
|
|
6136
6136
|
return useEffect(() => {
|
|
6137
6137
|
u({ color: "", shade: "" });
|
|
6138
6138
|
}, [r]), useEffect(() => {
|
|
6139
|
-
const
|
|
6140
|
-
|
|
6139
|
+
const j = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6140
|
+
j.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(j, o);
|
|
6141
6141
|
}, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
6142
6142
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6143
6143
|
DropDown,
|
|
@@ -6178,7 +6178,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6178
6178
|
]
|
|
6179
6179
|
}
|
|
6180
6180
|
) }),
|
|
6181
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange:
|
|
6181
|
+
/* @__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 }) })
|
|
6182
6182
|
] });
|
|
6183
6183
|
}, getUserInputValues = (o, n) => {
|
|
6184
6184
|
o = o.toLowerCase();
|
|
@@ -6373,50 +6373,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6373
6373
|
},
|
|
6374
6374
|
a
|
|
6375
6375
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6376
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [
|
|
6376
|
+
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, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
|
|
6377
6377
|
useEffect(() => {
|
|
6378
|
-
const { value:
|
|
6379
|
-
if (
|
|
6380
|
-
l(
|
|
6378
|
+
const { value: b, unit: _ } = getClassValueAndUnit(i);
|
|
6379
|
+
if (_ === "") {
|
|
6380
|
+
l(b), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6381
6381
|
return;
|
|
6382
6382
|
}
|
|
6383
|
-
g(
|
|
6383
|
+
g(_), l(_ === "class" || isEmpty(b) ? "" : b);
|
|
6384
6384
|
}, [i, u, p]);
|
|
6385
|
-
const
|
|
6386
|
-
(
|
|
6387
|
-
const
|
|
6388
|
-
if (get(
|
|
6389
|
-
|
|
6385
|
+
const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6386
|
+
(b = !1) => {
|
|
6387
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6388
|
+
if (get(_, "error", !1)) {
|
|
6389
|
+
f(!0);
|
|
6390
6390
|
return;
|
|
6391
6391
|
}
|
|
6392
|
-
const
|
|
6393
|
-
if (
|
|
6394
|
-
|
|
6392
|
+
const R = get(_, "unit") !== "" ? get(_, "unit") : x;
|
|
6393
|
+
if (R === "auto" || R === "none") {
|
|
6394
|
+
w(`${d}${R}`);
|
|
6395
6395
|
return;
|
|
6396
6396
|
}
|
|
6397
|
-
if (get(
|
|
6397
|
+
if (get(_, "value") === "")
|
|
6398
6398
|
return;
|
|
6399
|
-
const
|
|
6400
|
-
|
|
6399
|
+
const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
|
|
6400
|
+
b ? N(I) : w(I);
|
|
6401
6401
|
},
|
|
6402
|
-
[
|
|
6403
|
-
),
|
|
6404
|
-
(
|
|
6405
|
-
const
|
|
6406
|
-
if (get(
|
|
6407
|
-
|
|
6402
|
+
[w, N, a, x, d, p]
|
|
6403
|
+
), T = useCallback(
|
|
6404
|
+
(b) => {
|
|
6405
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6406
|
+
if (get(_, "error", !1)) {
|
|
6407
|
+
f(!0);
|
|
6408
6408
|
return;
|
|
6409
6409
|
}
|
|
6410
|
-
if (
|
|
6411
|
-
|
|
6410
|
+
if (b === "auto" || b === "none") {
|
|
6411
|
+
w(`${d}${b}`);
|
|
6412
6412
|
return;
|
|
6413
6413
|
}
|
|
6414
|
-
if (get(
|
|
6414
|
+
if (get(_, "value") === "")
|
|
6415
6415
|
return;
|
|
6416
|
-
const
|
|
6417
|
-
|
|
6416
|
+
const R = get(_, "unit") !== "" ? get(_, "unit") : b, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
|
|
6417
|
+
w(I);
|
|
6418
6418
|
},
|
|
6419
|
-
[
|
|
6419
|
+
[w, a, d, p]
|
|
6420
6420
|
);
|
|
6421
6421
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6422
6422
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
@@ -6424,40 +6424,40 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6424
6424
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
|
|
6425
6425
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6426
6426
|
] })
|
|
6427
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6427
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${A ? "z-auto" : ""}`, children: [
|
|
6428
6428
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6429
6429
|
["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6430
6430
|
"input",
|
|
6431
6431
|
{
|
|
6432
6432
|
readOnly: x === "class",
|
|
6433
|
-
onKeyPress: (
|
|
6434
|
-
|
|
6433
|
+
onKeyPress: (b) => {
|
|
6434
|
+
b.key === "Enter" && D();
|
|
6435
6435
|
},
|
|
6436
|
-
onKeyDown: (
|
|
6437
|
-
if (
|
|
6436
|
+
onKeyDown: (b) => {
|
|
6437
|
+
if (b.keyCode !== 38 && b.keyCode !== 40)
|
|
6438
6438
|
return;
|
|
6439
|
-
|
|
6440
|
-
const
|
|
6441
|
-
let
|
|
6442
|
-
|
|
6443
|
-
const
|
|
6444
|
-
|
|
6439
|
+
b.preventDefault(), C(!0);
|
|
6440
|
+
const _ = parseInt$1(b.target.value);
|
|
6441
|
+
let R = isNaN$1(_) ? 0 : _;
|
|
6442
|
+
b.keyCode === 38 && (R += 1), b.keyCode === 40 && (R -= 1);
|
|
6443
|
+
const v = `${R}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6444
|
+
N(L);
|
|
6445
6445
|
},
|
|
6446
|
-
onKeyUp: (
|
|
6447
|
-
|
|
6446
|
+
onKeyUp: (b) => {
|
|
6447
|
+
B && (b.preventDefault(), C(!1));
|
|
6448
6448
|
},
|
|
6449
|
-
onBlur: () =>
|
|
6450
|
-
onChange: (
|
|
6451
|
-
|
|
6449
|
+
onBlur: () => D(),
|
|
6450
|
+
onChange: (b) => {
|
|
6451
|
+
f(!1), l(b.target.value);
|
|
6452
6452
|
},
|
|
6453
|
-
onClick: (
|
|
6454
|
-
var
|
|
6455
|
-
(
|
|
6453
|
+
onClick: (b) => {
|
|
6454
|
+
var _;
|
|
6455
|
+
(_ = b == null ? void 0 : b.target) == null || _.select(), r(!1);
|
|
6456
6456
|
},
|
|
6457
|
-
value:
|
|
6457
|
+
value: A ? j : a,
|
|
6458
6458
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6459
6459
|
" ",
|
|
6460
|
-
|
|
6460
|
+
E ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
6461
6461
|
)
|
|
6462
6462
|
}
|
|
6463
6463
|
),
|
|
@@ -6479,29 +6479,29 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6479
6479
|
{
|
|
6480
6480
|
units: p,
|
|
6481
6481
|
current: x,
|
|
6482
|
-
onSelect: (
|
|
6483
|
-
r(!1), g(
|
|
6482
|
+
onSelect: (b) => {
|
|
6483
|
+
r(!1), g(b), T(b);
|
|
6484
6484
|
}
|
|
6485
6485
|
}
|
|
6486
6486
|
) }) })
|
|
6487
6487
|
] })
|
|
6488
6488
|
] }),
|
|
6489
|
-
["none", "auto"].indexOf(x) !== -1 ||
|
|
6489
|
+
["none", "auto"].indexOf(x) !== -1 || A ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6490
6490
|
DragStyleButton,
|
|
6491
6491
|
{
|
|
6492
|
-
onDragStart: () =>
|
|
6493
|
-
onDragEnd: (
|
|
6494
|
-
if (
|
|
6492
|
+
onDragStart: () => S(!0),
|
|
6493
|
+
onDragEnd: (b) => {
|
|
6494
|
+
if (k(() => ""), S(!1), isEmpty(b))
|
|
6495
6495
|
return;
|
|
6496
|
-
const
|
|
6497
|
-
|
|
6496
|
+
const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6497
|
+
w(v);
|
|
6498
6498
|
},
|
|
6499
|
-
onDrag: (
|
|
6500
|
-
if (isEmpty(
|
|
6499
|
+
onDrag: (b) => {
|
|
6500
|
+
if (isEmpty(b))
|
|
6501
6501
|
return;
|
|
6502
|
-
|
|
6503
|
-
const
|
|
6504
|
-
|
|
6502
|
+
k(b);
|
|
6503
|
+
const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6504
|
+
N(v);
|
|
6505
6505
|
},
|
|
6506
6506
|
currentValue: a,
|
|
6507
6507
|
unit: x,
|
|
@@ -6598,35 +6598,35 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6598
6598
|
"2xl": "1536px"
|
|
6599
6599
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6600
6600
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6601
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(),
|
|
6602
|
-
(
|
|
6603
|
-
const
|
|
6604
|
-
(u || p !== "") && (
|
|
6605
|
-
const
|
|
6606
|
-
g(
|
|
6601
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
|
|
6602
|
+
(N, D = !0) => {
|
|
6603
|
+
const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
|
|
6604
|
+
(u || p !== "") && (T.mq = "xs");
|
|
6605
|
+
const b = generateFullClsName(T);
|
|
6606
|
+
g(f, [b], D);
|
|
6607
6607
|
},
|
|
6608
|
-
[
|
|
6609
|
-
),
|
|
6610
|
-
|
|
6611
|
-
}, [
|
|
6608
|
+
[f, u, m, p, l, g]
|
|
6609
|
+
), A = useCallback(() => {
|
|
6610
|
+
E(f, [j]);
|
|
6611
|
+
}, [f, j, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
|
|
6612
6612
|
useEffect(() => {
|
|
6613
|
-
i(
|
|
6614
|
-
}, [
|
|
6615
|
-
const [, ,
|
|
6616
|
-
(
|
|
6617
|
-
|
|
6613
|
+
i(S, x);
|
|
6614
|
+
}, [S, i, x]);
|
|
6615
|
+
const [, , B] = useCanvasWidth(), C = useCallback(
|
|
6616
|
+
(N) => {
|
|
6617
|
+
B({
|
|
6618
6618
|
xs: 400,
|
|
6619
6619
|
sm: 640,
|
|
6620
6620
|
md: 800,
|
|
6621
6621
|
lg: 1024,
|
|
6622
6622
|
xl: 1420,
|
|
6623
6623
|
"2xl": 1920
|
|
6624
|
-
}[
|
|
6624
|
+
}[N]);
|
|
6625
6625
|
},
|
|
6626
|
-
[
|
|
6627
|
-
),
|
|
6628
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6629
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !
|
|
6626
|
+
[B]
|
|
6627
|
+
), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
|
|
6628
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6629
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6630
6630
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6631
6631
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6632
6632
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6635,17 +6635,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6635
6635
|
currentClass: get(x, "cls", ""),
|
|
6636
6636
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6637
6637
|
units: c || [],
|
|
6638
|
-
onChange:
|
|
6638
|
+
onChange: k,
|
|
6639
6639
|
negative: d,
|
|
6640
6640
|
cssProperty: l
|
|
6641
6641
|
}
|
|
6642
6642
|
) : null,
|
|
6643
|
-
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6644
|
-
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6645
|
-
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6646
|
-
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6643
|
+
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
|
|
6644
|
+
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
|
|
6645
|
+
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6646
|
+
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6647
6647
|
] }),
|
|
6648
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6648
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${j ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6649
6649
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6650
6650
|
"button",
|
|
6651
6651
|
{
|
|
@@ -6665,7 +6665,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6665
6665
|
"button",
|
|
6666
6666
|
{
|
|
6667
6667
|
type: "button",
|
|
6668
|
-
onClick: () =>
|
|
6668
|
+
onClick: () => C(get(x, "mq")),
|
|
6669
6669
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6670
6670
|
children: [
|
|
6671
6671
|
"Switch to ",
|
|
@@ -6695,18 +6695,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6695
6695
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6696
6696
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6697
6697
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6698
|
-
n.map(({ label: g, key:
|
|
6698
|
+
n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6699
6699
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6700
6700
|
"button",
|
|
6701
6701
|
{
|
|
6702
6702
|
type: "button",
|
|
6703
|
-
onClick: () => p(
|
|
6704
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6703
|
+
onClick: () => p(E),
|
|
6704
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6705
6705
|
children: [
|
|
6706
6706
|
React__default.createElement("div", {
|
|
6707
|
-
className: x(
|
|
6707
|
+
className: x(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6708
6708
|
}),
|
|
6709
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6709
|
+
React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6710
6710
|
]
|
|
6711
6711
|
}
|
|
6712
6712
|
) }),
|
|
@@ -6833,10 +6833,10 @@ function BlockStyling() {
|
|
|
6833
6833
|
const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
|
|
6834
6834
|
let g = parseFloat(i.dragStartValue);
|
|
6835
6835
|
g = isNaN(g) ? 0 : g;
|
|
6836
|
-
let
|
|
6837
|
-
(startsWith(x, "scale") || x === "opacity") && (
|
|
6838
|
-
let
|
|
6839
|
-
m &&
|
|
6836
|
+
let E = MAPPER[i.dragUnit];
|
|
6837
|
+
(startsWith(x, "scale") || x === "opacity") && (E = 10);
|
|
6838
|
+
let j = (i.dragStartY - p.pageY) / E + g;
|
|
6839
|
+
m && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
|
|
6840
6840
|
},
|
|
6841
6841
|
[i],
|
|
6842
6842
|
50
|
|
@@ -6922,33 +6922,33 @@ const BlockCard = ({
|
|
|
6922
6922
|
library: n,
|
|
6923
6923
|
parentId: r = void 0
|
|
6924
6924
|
}) => {
|
|
6925
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom),
|
|
6926
|
-
const
|
|
6927
|
-
return
|
|
6928
|
-
},
|
|
6929
|
-
async (
|
|
6930
|
-
if (
|
|
6925
|
+
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 = (k) => {
|
|
6926
|
+
const A = has(k, "styles_attrs.data-page-section");
|
|
6927
|
+
return k._type === "Box" && A;
|
|
6928
|
+
}, f = useCallback(
|
|
6929
|
+
async (k) => {
|
|
6930
|
+
if (k.stopPropagation(), has(o, "component")) {
|
|
6931
6931
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6932
6932
|
return;
|
|
6933
6933
|
}
|
|
6934
6934
|
l(!0);
|
|
6935
|
-
const
|
|
6936
|
-
isEmpty(
|
|
6935
|
+
const A = await i(n, o);
|
|
6936
|
+
isEmpty(A) || d(syncBlocksWithDefaults(A), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6937
6937
|
},
|
|
6938
6938
|
[o]
|
|
6939
|
-
),
|
|
6940
|
-
const
|
|
6941
|
-
let
|
|
6942
|
-
if (
|
|
6943
|
-
const
|
|
6944
|
-
if (
|
|
6945
|
-
const
|
|
6946
|
-
|
|
6947
|
-
|
|
6939
|
+
), j = async (k) => {
|
|
6940
|
+
const A = await i(n, o);
|
|
6941
|
+
let S = r;
|
|
6942
|
+
if (E(first(A)) && (S = null), !isEmpty(A)) {
|
|
6943
|
+
const B = { blocks: A, uiLibrary: !0, parent: S };
|
|
6944
|
+
if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
6945
|
+
const C = new Image();
|
|
6946
|
+
C.src = o.preview, C.onload = () => {
|
|
6947
|
+
k.dataTransfer.setDragImage(C, 0, 0);
|
|
6948
6948
|
};
|
|
6949
6949
|
} else
|
|
6950
|
-
|
|
6951
|
-
g(
|
|
6950
|
+
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6951
|
+
g(B), setTimeout(() => {
|
|
6952
6952
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6953
6953
|
}, 200);
|
|
6954
6954
|
}
|
|
@@ -6958,9 +6958,9 @@ const BlockCard = ({
|
|
|
6958
6958
|
"div",
|
|
6959
6959
|
{
|
|
6960
6960
|
onClick: a ? () => {
|
|
6961
|
-
} :
|
|
6961
|
+
} : f,
|
|
6962
6962
|
draggable: x ? "true" : "false",
|
|
6963
|
-
onDragStart:
|
|
6963
|
+
onDragStart: j,
|
|
6964
6964
|
className: clsx(
|
|
6965
6965
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
6966
6966
|
),
|
|
@@ -6989,9 +6989,9 @@ const BlockCard = ({
|
|
|
6989
6989
|
})();
|
|
6990
6990
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
6991
6991
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
6992
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((
|
|
6993
|
-
|
|
6994
|
-
|
|
6992
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
|
|
6993
|
+
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
6994
|
+
E.current && x(S);
|
|
6995
6995
|
}, 300);
|
|
6996
6996
|
};
|
|
6997
6997
|
if (u)
|
|
@@ -6999,30 +6999,30 @@ const BlockCard = ({
|
|
|
6999
6999
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7000
7000
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7001
7001
|
] });
|
|
7002
|
-
const
|
|
7002
|
+
const k = filter(g, (S, B) => B % 2 === 0), A = filter(g, (S, B) => B % 2 === 1);
|
|
7003
7003
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
|
|
7004
7004
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7005
7005
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7006
7006
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7007
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7007
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("groups") }),
|
|
7008
7008
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7009
7009
|
/* @__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(
|
|
7010
|
-
map(p, (
|
|
7010
|
+
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7011
7011
|
"div",
|
|
7012
7012
|
{
|
|
7013
|
-
onMouseEnter: () =>
|
|
7014
|
-
onMouseLeave: () => clearTimeout(
|
|
7015
|
-
onClick: () => x(
|
|
7013
|
+
onMouseEnter: () => j(B),
|
|
7014
|
+
onMouseLeave: () => clearTimeout(E.current),
|
|
7015
|
+
onClick: () => x(B),
|
|
7016
7016
|
className: cn(
|
|
7017
7017
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7018
|
-
|
|
7018
|
+
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7019
7019
|
),
|
|
7020
7020
|
children: [
|
|
7021
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7021
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
|
|
7022
7022
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7023
7023
|
]
|
|
7024
7024
|
},
|
|
7025
|
-
|
|
7025
|
+
B
|
|
7026
7026
|
))
|
|
7027
7027
|
) })
|
|
7028
7028
|
] })
|
|
@@ -7030,15 +7030,15 @@ const BlockCard = ({
|
|
|
7030
7030
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7031
7031
|
ScrollArea,
|
|
7032
7032
|
{
|
|
7033
|
-
onMouseEnter: () =>
|
|
7033
|
+
onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
|
|
7034
7034
|
className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
|
|
7035
7035
|
children: [
|
|
7036
7036
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7037
7037
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7038
|
-
|
|
7038
|
+
k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7039
7039
|
) }),
|
|
7040
7040
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7041
|
-
|
|
7041
|
+
A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7042
7042
|
) })
|
|
7043
7043
|
] }),
|
|
7044
7044
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7485,12 +7485,12 @@ i18n.use(initReactI18next).init({
|
|
|
7485
7485
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7486
7486
|
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
|
|
7487
7487
|
if (console.log("addBlockToPage", o, r), has(o, "blocks")) {
|
|
7488
|
-
const
|
|
7489
|
-
u(syncBlocksWithDefaults(
|
|
7488
|
+
const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7489
|
+
u(syncBlocksWithDefaults(f), r || null);
|
|
7490
7490
|
} else
|
|
7491
7491
|
d(o, r || null);
|
|
7492
7492
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7493
|
-
}, g = useFeature("dnd"), { t:
|
|
7493
|
+
}, g = useFeature("dnd"), { t: E } = useTranslation();
|
|
7494
7494
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7495
7495
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7496
7496
|
"button",
|
|
@@ -7498,8 +7498,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7498
7498
|
disabled: n,
|
|
7499
7499
|
onClick: x,
|
|
7500
7500
|
type: "button",
|
|
7501
|
-
onDragStart: (
|
|
7502
|
-
|
|
7501
|
+
onDragStart: (f) => {
|
|
7502
|
+
f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7503
7503
|
p([]), m(null);
|
|
7504
7504
|
}, 200);
|
|
7505
7505
|
},
|
|
@@ -7507,11 +7507,11 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7507
7507
|
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
|
|
7508
7508
|
children: [
|
|
7509
7509
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
7510
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
7510
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
|
|
7511
7511
|
]
|
|
7512
7512
|
}
|
|
7513
7513
|
) }),
|
|
7514
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7514
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
|
|
7515
7515
|
] }) });
|
|
7516
7516
|
}, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
|
|
7517
7517
|
const r = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
|
|
@@ -7674,12 +7674,12 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7674
7674
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7675
7675
|
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);
|
|
7676
7676
|
useEffect(() => {
|
|
7677
|
-
var
|
|
7678
|
-
(
|
|
7677
|
+
var f;
|
|
7678
|
+
(f = x.current) == null || f.focus();
|
|
7679
7679
|
}, []);
|
|
7680
|
-
const
|
|
7681
|
-
const { usage:
|
|
7682
|
-
!l &&
|
|
7680
|
+
const E = (f) => {
|
|
7681
|
+
const { usage: j } = f || {};
|
|
7682
|
+
!l && j && m(j), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
7683
7683
|
};
|
|
7684
7684
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7685
7685
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7699,12 +7699,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7699
7699
|
{
|
|
7700
7700
|
ref: x,
|
|
7701
7701
|
value: i,
|
|
7702
|
-
onChange: (
|
|
7702
|
+
onChange: (f) => c(f.target.value),
|
|
7703
7703
|
placeholder: n("Ask AI to edit content"),
|
|
7704
7704
|
className: "w-full",
|
|
7705
7705
|
rows: 3,
|
|
7706
|
-
onKeyDown: (
|
|
7707
|
-
|
|
7706
|
+
onKeyDown: (f) => {
|
|
7707
|
+
f.key === "Enter" && (f.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
|
|
7708
7708
|
}
|
|
7709
7709
|
}
|
|
7710
7710
|
),
|
|
@@ -7714,7 +7714,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7714
7714
|
{
|
|
7715
7715
|
disabled: i.trim().length < 5 || a,
|
|
7716
7716
|
onClick: () => {
|
|
7717
|
-
g.current && clearTimeout(g.current), m(void 0), r("content", o, i,
|
|
7717
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
|
|
7718
7718
|
},
|
|
7719
7719
|
variant: "default",
|
|
7720
7720
|
className: "w-fit",
|
|
@@ -7746,8 +7746,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7746
7746
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7747
7747
|
QuickPrompts,
|
|
7748
7748
|
{
|
|
7749
|
-
onClick: (
|
|
7750
|
-
g.current && clearTimeout(g.current), m(void 0), r("content", o,
|
|
7749
|
+
onClick: (f) => {
|
|
7750
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, f, E);
|
|
7751
7751
|
}
|
|
7752
7752
|
}
|
|
7753
7753
|
)
|
|
@@ -7761,15 +7761,15 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7761
7761
|
useEffect(() => {
|
|
7762
7762
|
n && a(n);
|
|
7763
7763
|
}, [n]);
|
|
7764
|
-
const
|
|
7764
|
+
const E = async () => {
|
|
7765
7765
|
try {
|
|
7766
7766
|
d(!0), p(null), await i(r), x({
|
|
7767
7767
|
title: o("Updated AI Context"),
|
|
7768
7768
|
description: o("You can now Ask AI to edit your content"),
|
|
7769
7769
|
variant: "default"
|
|
7770
7770
|
}), g.current.click();
|
|
7771
|
-
} catch (
|
|
7772
|
-
p(
|
|
7771
|
+
} catch (f) {
|
|
7772
|
+
p(f);
|
|
7773
7773
|
} finally {
|
|
7774
7774
|
d(!1);
|
|
7775
7775
|
}
|
|
@@ -7777,8 +7777,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7777
7777
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7778
7778
|
Accordion,
|
|
7779
7779
|
{
|
|
7780
|
-
onValueChange: (
|
|
7781
|
-
m(
|
|
7780
|
+
onValueChange: (f) => {
|
|
7781
|
+
m(f !== "");
|
|
7782
7782
|
},
|
|
7783
7783
|
type: "single",
|
|
7784
7784
|
collapsible: !0,
|
|
@@ -7790,12 +7790,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7790
7790
|
{
|
|
7791
7791
|
ref: l,
|
|
7792
7792
|
value: r,
|
|
7793
|
-
onChange: (
|
|
7793
|
+
onChange: (f) => a(f.target.value),
|
|
7794
7794
|
placeholder: o("Tell about this page eg this page is about"),
|
|
7795
7795
|
className: "mt-1 w-full",
|
|
7796
7796
|
rows: 10,
|
|
7797
|
-
onKeyDown: (
|
|
7798
|
-
|
|
7797
|
+
onKeyDown: (f) => {
|
|
7798
|
+
f.key === "Enter" && (f.preventDefault(), E());
|
|
7799
7799
|
}
|
|
7800
7800
|
}
|
|
7801
7801
|
),
|
|
@@ -7807,7 +7807,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7807
7807
|
Button,
|
|
7808
7808
|
{
|
|
7809
7809
|
disabled: r.trim().length < 5,
|
|
7810
|
-
onClick: () =>
|
|
7810
|
+
onClick: () => E(),
|
|
7811
7811
|
variant: "default",
|
|
7812
7812
|
className: "w-fit",
|
|
7813
7813
|
size: "sm",
|
|
@@ -7836,7 +7836,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7836
7836
|
AlertDialogAction,
|
|
7837
7837
|
{
|
|
7838
7838
|
onClick: () => {
|
|
7839
|
-
a(""),
|
|
7839
|
+
a(""), E();
|
|
7840
7840
|
},
|
|
7841
7841
|
children: o("Yes, Delete")
|
|
7842
7842
|
}
|
|
@@ -7857,42 +7857,42 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7857
7857
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7858
7858
|
] });
|
|
7859
7859
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7860
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""),
|
|
7860
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), f = useRef(null);
|
|
7861
7861
|
useEffect(() => {
|
|
7862
7862
|
l(n);
|
|
7863
7863
|
}, [n]);
|
|
7864
|
-
const
|
|
7864
|
+
const j = () => {
|
|
7865
7865
|
if (i.startsWith("@")) {
|
|
7866
7866
|
g("Attribute keys cannot start with '@'");
|
|
7867
7867
|
return;
|
|
7868
7868
|
}
|
|
7869
7869
|
if (i) {
|
|
7870
|
-
const
|
|
7871
|
-
r(
|
|
7870
|
+
const C = [...a, { key: i, value: d }];
|
|
7871
|
+
r(C), l(a), c(""), u(""), g("");
|
|
7872
7872
|
}
|
|
7873
|
-
},
|
|
7874
|
-
const
|
|
7875
|
-
r(
|
|
7876
|
-
},
|
|
7877
|
-
m(
|
|
7878
|
-
},
|
|
7873
|
+
}, k = (C) => {
|
|
7874
|
+
const w = a.filter((N, D) => D !== C);
|
|
7875
|
+
r(w), l(w);
|
|
7876
|
+
}, A = (C) => {
|
|
7877
|
+
m(C), c(a[C].key), u(a[C].value);
|
|
7878
|
+
}, S = () => {
|
|
7879
7879
|
if (i.startsWith("@")) {
|
|
7880
7880
|
g("Attribute keys cannot start with '@'");
|
|
7881
7881
|
return;
|
|
7882
7882
|
}
|
|
7883
7883
|
if (p !== null && i) {
|
|
7884
|
-
const
|
|
7885
|
-
|
|
7884
|
+
const C = [...a];
|
|
7885
|
+
C[p] = { key: i, value: d }, r(C), l(C), m(null), c(""), u(""), g("");
|
|
7886
7886
|
}
|
|
7887
|
-
},
|
|
7888
|
-
|
|
7887
|
+
}, B = (C) => {
|
|
7888
|
+
C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
|
|
7889
7889
|
};
|
|
7890
7890
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
7891
7891
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7892
7892
|
"form",
|
|
7893
7893
|
{
|
|
7894
|
-
onSubmit: (
|
|
7895
|
-
|
|
7894
|
+
onSubmit: (C) => {
|
|
7895
|
+
C.preventDefault(), p !== null ? S() : j();
|
|
7896
7896
|
},
|
|
7897
7897
|
className: "space-y-3",
|
|
7898
7898
|
children: [
|
|
@@ -7906,9 +7906,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7906
7906
|
autoCorrect: "off",
|
|
7907
7907
|
spellCheck: "false",
|
|
7908
7908
|
id: "attrKey",
|
|
7909
|
-
ref:
|
|
7909
|
+
ref: E,
|
|
7910
7910
|
value: i,
|
|
7911
|
-
onChange: (
|
|
7911
|
+
onChange: (C) => c(C.target.value),
|
|
7912
7912
|
placeholder: "Key",
|
|
7913
7913
|
className: "h-8 text-sm"
|
|
7914
7914
|
}
|
|
@@ -7924,10 +7924,10 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7924
7924
|
spellCheck: "false",
|
|
7925
7925
|
id: "attrValue",
|
|
7926
7926
|
rows: 2,
|
|
7927
|
-
ref:
|
|
7927
|
+
ref: f,
|
|
7928
7928
|
value: d,
|
|
7929
|
-
onChange: (
|
|
7930
|
-
onKeyDown:
|
|
7929
|
+
onChange: (C) => u(C.target.value),
|
|
7930
|
+
onKeyDown: B,
|
|
7931
7931
|
placeholder: "Value",
|
|
7932
7932
|
className: "bg-background text-sm"
|
|
7933
7933
|
}
|
|
@@ -7939,22 +7939,22 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7939
7939
|
]
|
|
7940
7940
|
}
|
|
7941
7941
|
),
|
|
7942
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
7942
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((C, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
7943
7943
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
7944
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
7945
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
7944
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: C.key }),
|
|
7945
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: C.value.toString() })
|
|
7946
7946
|
] }),
|
|
7947
7947
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
7948
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
7948
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(w), children: [
|
|
7949
7949
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
7950
7950
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
7951
7951
|
] }),
|
|
7952
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
7952
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: [
|
|
7953
7953
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
7954
7954
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
7955
7955
|
] })
|
|
7956
7956
|
] })
|
|
7957
|
-
] },
|
|
7957
|
+
] }, w)) })
|
|
7958
7958
|
] });
|
|
7959
7959
|
}), BlockAttributesEditor = React.memo(() => {
|
|
7960
7960
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8371,16 +8371,16 @@ function RemoveProviderConfirmation({
|
|
|
8371
8371
|
}
|
|
8372
8372
|
const PageDataProviders = () => {
|
|
8373
8373
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8374
|
-
filter(n, (
|
|
8374
|
+
filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
|
|
8375
8375
|
), [d, u] = useState(""), [p, m] = useState(null), x = filter(
|
|
8376
|
-
n.map((
|
|
8377
|
-
(
|
|
8378
|
-
), g = (
|
|
8379
|
-
const
|
|
8380
|
-
c((
|
|
8381
|
-
},
|
|
8382
|
-
c((
|
|
8383
|
-
},
|
|
8376
|
+
n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
|
|
8377
|
+
(j) => !isNull(j)
|
|
8378
|
+
), g = (j) => {
|
|
8379
|
+
const k = find(n, { providerKey: j });
|
|
8380
|
+
c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8381
|
+
}, E = (j) => {
|
|
8382
|
+
c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
|
|
8383
|
+
}, f = (j) => m(j);
|
|
8384
8384
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8385
8385
|
o("no_data_providers"),
|
|
8386
8386
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8388,11 +8388,11 @@ const PageDataProviders = () => {
|
|
|
8388
8388
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8389
8389
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8390
8390
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8391
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (
|
|
8391
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => g(j), children: [
|
|
8392
8392
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8393
8393
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8394
8394
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
8395
|
-
x.map((
|
|
8395
|
+
x.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: j.value, children: j.label }, j.value))
|
|
8396
8396
|
] })
|
|
8397
8397
|
] }) }),
|
|
8398
8398
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8401,21 +8401,21 @@ const PageDataProviders = () => {
|
|
|
8401
8401
|
o("page_data_providers"),
|
|
8402
8402
|
":"
|
|
8403
8403
|
] }),
|
|
8404
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((
|
|
8404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8405
8405
|
"div",
|
|
8406
8406
|
{
|
|
8407
8407
|
className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
|
|
8408
8408
|
"data-v0-t": "card",
|
|
8409
8409
|
children: [
|
|
8410
8410
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8411
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children:
|
|
8412
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children:
|
|
8411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: j.name }),
|
|
8412
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: j.description })
|
|
8413
8413
|
] }) }) }),
|
|
8414
8414
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
8415
8415
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8416
8416
|
"button",
|
|
8417
8417
|
{
|
|
8418
|
-
onClick: () =>
|
|
8418
|
+
onClick: () => f(j),
|
|
8419
8419
|
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",
|
|
8420
8420
|
children: [
|
|
8421
8421
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8441,7 +8441,7 @@ const PageDataProviders = () => {
|
|
|
8441
8441
|
]
|
|
8442
8442
|
}
|
|
8443
8443
|
),
|
|
8444
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () =>
|
|
8444
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(j), name: j.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-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", children: [
|
|
8445
8445
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8446
8446
|
"svg",
|
|
8447
8447
|
{
|
|
@@ -8467,7 +8467,7 @@ const PageDataProviders = () => {
|
|
|
8467
8467
|
] })
|
|
8468
8468
|
]
|
|
8469
8469
|
},
|
|
8470
|
-
|
|
8470
|
+
j.providerKey
|
|
8471
8471
|
)) }),
|
|
8472
8472
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
|
|
8473
8473
|
] })
|
|
@@ -8476,7 +8476,7 @@ const PageDataProviders = () => {
|
|
|
8476
8476
|
function AiFillDatabase(o) {
|
|
8477
8477
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8478
8478
|
}
|
|
8479
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8479
|
+
const TopBar = lazy(() => import("./Topbar-bca7NmyC.js"));
|
|
8480
8480
|
function useSidebarMenuItems(o) {
|
|
8481
8481
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8482
8482
|
return useMemo(() => {
|
|
@@ -8521,19 +8521,19 @@ const RootLayout = () => {
|
|
|
8521
8521
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
|
|
8522
8522
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8523
8523
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8524
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g,
|
|
8524
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8525
8525
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8526
8526
|
Button,
|
|
8527
8527
|
{
|
|
8528
|
-
variant: o ===
|
|
8528
|
+
variant: o === E ? "default" : "ghost",
|
|
8529
8529
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8530
|
-
onClick: () => d(
|
|
8530
|
+
onClick: () => d(E),
|
|
8531
8531
|
children: get(g, "icon", null)
|
|
8532
8532
|
},
|
|
8533
|
-
|
|
8533
|
+
E
|
|
8534
8534
|
) }),
|
|
8535
8535
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
|
|
8536
|
-
] }, "button" +
|
|
8536
|
+
] }, "button" + E)) }),
|
|
8537
8537
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
8538
8538
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8539
8539
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
|