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