@chaibuilder/sdk 1.2.101 → 1.2.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodeEditor-JwQBcXXn.js → CodeEditor-NKqXoCPq.js} +1 -1
- package/dist/{CodeEditor-6H3xdrCM.cjs → CodeEditor-x97t1x8H.cjs} +1 -1
- package/dist/{Topbar-ImKs0qxq.cjs → Topbar-76FfrmEx.cjs} +1 -1
- package/dist/{Topbar-WwuC_EF0.js → Topbar-yEANMgiO.js} +1 -1
- package/dist/{UnsplashImages-Scb7a22J.cjs → UnsplashImages-LpHbt_-q.cjs} +1 -1
- package/dist/{UnsplashImages-auPssWRE.js → UnsplashImages-Z3xcNddA.js} +1 -1
- package/dist/{UploadImages-OREmjJoH.cjs → UploadImages-PYkTPdPr.cjs} +1 -1
- package/dist/{UploadImages-e-UF1mAe.js → UploadImages-v50EQZLT.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +12 -0
- package/dist/core.js +32 -31
- package/dist/index-K9hzPq-7.cjs +63 -0
- package/dist/{index-eEpCjNMA.js → index-aV4x9E1G.js} +1147 -876
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +3 -2
- package/dist/render.js +103 -92
- package/package.json +1 -3
- package/dist/index-4gjDYh6v.cjs +0 -61
|
@@ -5,7 +5,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
7
|
import { a as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, P as Tooltip, Q as TooltipTrigger, R as TooltipContent, C as Card, z as CardHeader, G as CardDescription, H as CardContent, L as Label, T as Textarea, E as CardFooter, D as Dialog, t as DialogTrigger, u as DialogContent, v as DialogHeader, x as DialogTitle, y as DialogDescription, w as DialogFooter, W as Popover, X as PopoverTrigger, Y as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, K as Tabs, M as TabsList, N as TabsTrigger, O as TabsContent, d as Switch, A as Accordion, f as AccordionItem, g as AccordionTrigger, h as AccordionContent, ao as useToast, I as Input$1, V as TooltipPortal, a8 as DropdownMenu, a9 as DropdownMenuTrigger, aa as DropdownMenuContent, S as ScrollArea, ae as DropdownMenuLabel, af as DropdownMenuSeparator, ah as DropdownMenuGroup, ab as DropdownMenuItem, ag as DropdownMenuShortcut, k as AlertDialog, m as AlertDialogContent, n as AlertDialogHeader, p as AlertDialogTitle, l as AlertDialogTrigger, q as AlertDialogDescription, o as AlertDialogFooter, s as AlertDialogCancel, r as AlertDialogAction, ac as DropdownMenuCheckboxItem, Z as HoverCard, _ as HoverCardTrigger, $ as HoverCardContent, b as Separator, i as Badge, a0 as Select, a3 as SelectTrigger, a2 as SelectValue, a4 as SelectContent, a6 as SelectItem, U as TooltipProvider, aq as Toaster } from "./context-menu-YGd09SE1.js";
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy,
|
|
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";
|
|
@@ -19,7 +19,7 @@ import { useFeature, FlagsProvider } from "flagged";
|
|
|
19
19
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
20
20
|
import { flip } from "@floating-ui/dom";
|
|
21
21
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
22
|
-
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
22
|
+
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, GlobeIcon as GlobeIcon$1, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
23
23
|
import { createEvent } from "react-event-hook";
|
|
24
24
|
import typography$1 from "@tailwindcss/typography";
|
|
25
25
|
import forms from "@tailwindcss/forms";
|
|
@@ -90,58 +90,58 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
90
90
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
91
91
|
let a, l, i;
|
|
92
92
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
93
|
-
const c = (
|
|
94
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
95
|
-
const
|
|
96
|
-
if (o.set(
|
|
97
|
-
const
|
|
98
|
-
cancelPromise(
|
|
93
|
+
const c = (j) => o.get(j), d = (j, k) => {
|
|
94
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
|
|
95
|
+
const C = o.get(j);
|
|
96
|
+
if (o.set(j, k), r.has(j) || r.set(j, C), C && hasPromiseAtomValue(C)) {
|
|
97
|
+
const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
|
|
98
|
+
cancelPromise(C.v, R);
|
|
99
99
|
}
|
|
100
|
-
}, u = (
|
|
101
|
-
const
|
|
100
|
+
}, u = (j, k, C) => {
|
|
101
|
+
const R = /* @__PURE__ */ new Map();
|
|
102
102
|
let I = !1;
|
|
103
|
-
|
|
104
|
-
!L && P ===
|
|
105
|
-
}), (I ||
|
|
106
|
-
}, p = (
|
|
107
|
-
const
|
|
108
|
-
d: (
|
|
109
|
-
v:
|
|
103
|
+
C.forEach((L, P) => {
|
|
104
|
+
!L && P === j && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
105
|
+
}), (I || k.d.size !== R.size) && (k.d = R);
|
|
106
|
+
}, p = (j, k, C) => {
|
|
107
|
+
const R = c(j), I = {
|
|
108
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
109
|
+
v: k
|
|
110
110
|
};
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
113
|
-
if (
|
|
114
|
-
if (
|
|
115
|
-
return
|
|
116
|
-
I.v =
|
|
111
|
+
if (C && u(j, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
|
|
112
|
+
return R;
|
|
113
|
+
if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
|
|
114
|
+
if (R.d === I.d)
|
|
115
|
+
return R;
|
|
116
|
+
I.v = R.v;
|
|
117
117
|
}
|
|
118
|
-
return d(
|
|
119
|
-
},
|
|
120
|
-
if (isPromiseLike$2(
|
|
118
|
+
return d(j, I), I;
|
|
119
|
+
}, m = (j, k, C, R) => {
|
|
120
|
+
if (isPromiseLike$2(k)) {
|
|
121
121
|
let I;
|
|
122
122
|
const L = new Promise((P, V) => {
|
|
123
123
|
let $ = !1;
|
|
124
|
-
|
|
124
|
+
k.then(
|
|
125
125
|
(O) => {
|
|
126
126
|
if (!$) {
|
|
127
127
|
$ = !0;
|
|
128
|
-
const M = c(
|
|
129
|
-
|
|
128
|
+
const M = c(j), H = p(
|
|
129
|
+
j,
|
|
130
130
|
L,
|
|
131
|
-
|
|
131
|
+
C
|
|
132
132
|
);
|
|
133
|
-
resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(
|
|
133
|
+
resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(j, H, M == null ? void 0 : M.d);
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
(O) => {
|
|
137
137
|
if (!$) {
|
|
138
138
|
$ = !0;
|
|
139
|
-
const M = c(
|
|
140
|
-
|
|
139
|
+
const M = c(j), H = p(
|
|
140
|
+
j,
|
|
141
141
|
L,
|
|
142
|
-
|
|
142
|
+
C
|
|
143
143
|
);
|
|
144
|
-
rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(
|
|
144
|
+
rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(j, H, M == null ? void 0 : M.d);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
), I = (O) => {
|
|
@@ -151,40 +151,40 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
151
151
|
), P(O));
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
|
-
return L.orig =
|
|
155
|
-
P && I(P),
|
|
156
|
-
}), p(
|
|
154
|
+
return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
|
|
155
|
+
P && I(P), R == null || R();
|
|
156
|
+
}), p(j, L, C);
|
|
157
157
|
}
|
|
158
|
-
return p(
|
|
159
|
-
}, x = (
|
|
160
|
-
const
|
|
161
|
-
d: (
|
|
162
|
-
e:
|
|
158
|
+
return p(j, k, C);
|
|
159
|
+
}, x = (j, k, C) => {
|
|
160
|
+
const R = c(j), I = {
|
|
161
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
162
|
+
e: k
|
|
163
163
|
};
|
|
164
|
-
return
|
|
165
|
-
},
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
O !==
|
|
169
|
-
}), Array.from(
|
|
164
|
+
return C && u(j, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(j, I), I);
|
|
165
|
+
}, g = (j) => {
|
|
166
|
+
const k = c(j);
|
|
167
|
+
if (k && (k.d.forEach(($, O) => {
|
|
168
|
+
O !== j && !n.has(O) && g(O);
|
|
169
|
+
}), Array.from(k.d).every(([$, O]) => {
|
|
170
170
|
const M = c($);
|
|
171
|
-
return $ ===
|
|
171
|
+
return $ === j || M === O || // TODO This is a hack, we should find a better solution.
|
|
172
172
|
M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
|
|
173
173
|
})))
|
|
174
|
-
return
|
|
175
|
-
const
|
|
176
|
-
let
|
|
174
|
+
return k;
|
|
175
|
+
const C = /* @__PURE__ */ new Map();
|
|
176
|
+
let R = !0;
|
|
177
177
|
const I = ($) => {
|
|
178
|
-
if ($ ===
|
|
178
|
+
if ($ === j) {
|
|
179
179
|
const M = c($);
|
|
180
180
|
if (M)
|
|
181
|
-
return
|
|
181
|
+
return C.set($, M), returnAtomValue(M);
|
|
182
182
|
if (hasInitialValue($))
|
|
183
|
-
return
|
|
183
|
+
return C.set($, void 0), $.init;
|
|
184
184
|
throw new Error("no atom init");
|
|
185
185
|
}
|
|
186
|
-
const O =
|
|
187
|
-
return
|
|
186
|
+
const O = g($);
|
|
187
|
+
return C.set($, O), returnAtomValue(O);
|
|
188
188
|
};
|
|
189
189
|
let L, P;
|
|
190
190
|
const V = {
|
|
@@ -192,147 +192,147 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
192
192
|
return L || (L = new AbortController()), L.signal;
|
|
193
193
|
},
|
|
194
194
|
get setSelf() {
|
|
195
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
196
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
197
|
-
return B(
|
|
195
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(j) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(j) && (P = (...$) => {
|
|
196
|
+
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(j, ...$);
|
|
198
198
|
}), P;
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
try {
|
|
202
|
-
const $ =
|
|
203
|
-
return
|
|
204
|
-
|
|
202
|
+
const $ = j.read(I, V);
|
|
203
|
+
return m(
|
|
204
|
+
j,
|
|
205
205
|
$,
|
|
206
|
-
|
|
206
|
+
C,
|
|
207
207
|
() => L == null ? void 0 : L.abort()
|
|
208
208
|
);
|
|
209
209
|
} catch ($) {
|
|
210
|
-
return x(
|
|
210
|
+
return x(j, $, C);
|
|
211
211
|
} finally {
|
|
212
|
-
|
|
212
|
+
R = !1;
|
|
213
213
|
}
|
|
214
|
-
}, E = (
|
|
215
|
-
let
|
|
216
|
-
return
|
|
217
|
-
},
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
},
|
|
221
|
-
const
|
|
214
|
+
}, E = (j) => returnAtomValue(g(j)), b = (j) => {
|
|
215
|
+
let k = n.get(j);
|
|
216
|
+
return k || (k = w(j)), k;
|
|
217
|
+
}, f = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), _ = (j) => {
|
|
218
|
+
const k = n.get(j);
|
|
219
|
+
k && f(j, k) && A(j);
|
|
220
|
+
}, v = (j) => {
|
|
221
|
+
const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
|
|
222
222
|
const P = n.get(L);
|
|
223
223
|
P == null || P.t.forEach((V) => {
|
|
224
|
-
V !== L && (
|
|
224
|
+
V !== L && (k.set(
|
|
225
225
|
V,
|
|
226
|
-
(
|
|
227
|
-
),
|
|
226
|
+
(k.get(V) || /* @__PURE__ */ new Set()).add(L)
|
|
227
|
+
), C.set(V, (C.get(V) || 0) + 1), R(V));
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
|
|
230
|
+
R(j);
|
|
231
231
|
const I = (L) => {
|
|
232
232
|
const P = n.get(L);
|
|
233
233
|
P == null || P.t.forEach((V) => {
|
|
234
234
|
var $;
|
|
235
235
|
if (V !== L) {
|
|
236
|
-
let O =
|
|
237
|
-
if (O &&
|
|
238
|
-
let M = !!(($ =
|
|
236
|
+
let O = C.get(V);
|
|
237
|
+
if (O && C.set(V, --O), !O) {
|
|
238
|
+
let M = !!(($ = k.get(V)) != null && $.size);
|
|
239
239
|
if (M) {
|
|
240
|
-
const H = c(V), F =
|
|
240
|
+
const H = c(V), F = g(V);
|
|
241
241
|
M = !H || !isEqualAtomValue(H, F);
|
|
242
242
|
}
|
|
243
|
-
M ||
|
|
243
|
+
M || k.forEach((H) => H.delete(V));
|
|
244
244
|
}
|
|
245
245
|
I(V);
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
};
|
|
249
|
-
I(
|
|
250
|
-
}, S = (
|
|
251
|
-
let
|
|
252
|
-
const
|
|
249
|
+
I(j);
|
|
250
|
+
}, S = (j, ...k) => {
|
|
251
|
+
let C = !0;
|
|
252
|
+
const R = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
|
|
253
253
|
let $;
|
|
254
|
-
if (P ===
|
|
254
|
+
if (P === j) {
|
|
255
255
|
if (!hasInitialValue(P))
|
|
256
256
|
throw new Error("atom not writable");
|
|
257
|
-
const O = c(P), M =
|
|
258
|
-
(!O || !isEqualAtomValue(O, M)) &&
|
|
257
|
+
const O = c(P), M = m(P, V[0]);
|
|
258
|
+
(!O || !isEqualAtomValue(O, M)) && v(P);
|
|
259
259
|
} else
|
|
260
260
|
$ = S(P, ...V);
|
|
261
|
-
if (!
|
|
261
|
+
if (!C) {
|
|
262
262
|
const O = D();
|
|
263
263
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
264
264
|
(M) => M({ type: "async-write", flushed: O })
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
267
|
return $;
|
|
268
|
-
}, L =
|
|
269
|
-
return
|
|
270
|
-
}, B = (
|
|
271
|
-
const
|
|
268
|
+
}, L = j.write(R, I, ...k);
|
|
269
|
+
return C = !1, L;
|
|
270
|
+
}, B = (j, ...k) => {
|
|
271
|
+
const C = S(j, ...k), R = D();
|
|
272
272
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
273
|
-
(I) => I({ type: "write", flushed:
|
|
274
|
-
),
|
|
275
|
-
},
|
|
276
|
-
const
|
|
277
|
-
t: new Set(
|
|
273
|
+
(I) => I({ type: "write", flushed: R })
|
|
274
|
+
), C;
|
|
275
|
+
}, w = (j, k) => {
|
|
276
|
+
const C = {
|
|
277
|
+
t: new Set(k && [k]),
|
|
278
278
|
l: /* @__PURE__ */ new Set()
|
|
279
279
|
};
|
|
280
|
-
if (n.set(
|
|
280
|
+
if (n.set(j, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, I) => {
|
|
281
281
|
const L = n.get(I);
|
|
282
|
-
L ? L.t.add(
|
|
283
|
-
}),
|
|
284
|
-
const
|
|
285
|
-
|
|
282
|
+
L ? L.t.add(j) : I !== j && w(I, j);
|
|
283
|
+
}), g(j), isActuallyWritableAtom(j) && j.onMount) {
|
|
284
|
+
const R = j.onMount((...I) => B(j, ...I));
|
|
285
|
+
R && (C.u = R);
|
|
286
286
|
}
|
|
287
|
-
return
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
if (L !==
|
|
287
|
+
return C;
|
|
288
|
+
}, A = (j) => {
|
|
289
|
+
var k;
|
|
290
|
+
const C = (k = n.get(j)) == null ? void 0 : k.u;
|
|
291
|
+
C && C(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
|
|
292
|
+
const R = c(j);
|
|
293
|
+
R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
|
|
294
|
+
if (L !== j) {
|
|
295
295
|
const P = n.get(L);
|
|
296
|
-
P && (P.t.delete(
|
|
296
|
+
P && (P.t.delete(j), f(L, P) && A(L));
|
|
297
297
|
}
|
|
298
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
299
|
-
}, N = (
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
|
|
298
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
|
|
299
|
+
}, N = (j, k, C) => {
|
|
300
|
+
const R = new Set(k.d.keys());
|
|
301
|
+
C == null || C.forEach((I, L) => {
|
|
302
|
+
if (R.has(L)) {
|
|
303
|
+
R.delete(L);
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
306
|
const P = n.get(L);
|
|
307
|
-
P && (P.t.delete(
|
|
308
|
-
}),
|
|
307
|
+
P && (P.t.delete(j), f(L, P) && A(L));
|
|
308
|
+
}), R.forEach((I) => {
|
|
309
309
|
const L = n.get(I);
|
|
310
|
-
L ? L.t.add(
|
|
310
|
+
L ? L.t.add(j) : n.has(j) && w(I, j);
|
|
311
311
|
});
|
|
312
312
|
}, D = () => {
|
|
313
|
-
let
|
|
314
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
315
|
-
const
|
|
316
|
-
r.clear(),
|
|
317
|
-
const I = c(
|
|
313
|
+
let j;
|
|
314
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
|
|
315
|
+
const k = Array.from(r);
|
|
316
|
+
r.clear(), k.forEach(([C, R]) => {
|
|
317
|
+
const I = c(C);
|
|
318
318
|
if (I) {
|
|
319
|
-
I.d !== (
|
|
320
|
-
const L = n.get(
|
|
319
|
+
I.d !== (R == null ? void 0 : R.d) && N(C, I, R == null ? void 0 : R.d);
|
|
320
|
+
const L = n.get(C);
|
|
321
321
|
L && !// TODO This seems pretty hacky. Hope to fix it.
|
|
322
322
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
323
|
-
(
|
|
323
|
+
(R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(C));
|
|
324
324
|
} else
|
|
325
325
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
329
|
-
return a.forEach((
|
|
330
|
-
}, T = (
|
|
331
|
-
const
|
|
332
|
-
return I.add(
|
|
333
|
-
(L) => L({ type: "sub", flushed:
|
|
329
|
+
return a.forEach((k) => k("state")), j;
|
|
330
|
+
}, T = (j, k) => {
|
|
331
|
+
const C = b(j), R = D(), I = C.l;
|
|
332
|
+
return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
|
|
333
|
+
(L) => L({ type: "sub", flushed: R })
|
|
334
334
|
)), () => {
|
|
335
|
-
I.delete(
|
|
335
|
+
I.delete(k), _(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
|
|
336
336
|
};
|
|
337
337
|
};
|
|
338
338
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -340,22 +340,22 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
340
340
|
set: B,
|
|
341
341
|
sub: T,
|
|
342
342
|
// store dev methods (these are tentative and subject to change without notice)
|
|
343
|
-
dev_subscribe_store: (
|
|
343
|
+
dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
|
|
344
344
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
345
|
-
), a.add(
|
|
346
|
-
a.delete(
|
|
347
|
-
}) : (l.add(
|
|
348
|
-
l.delete(
|
|
345
|
+
), a.add(j), () => {
|
|
346
|
+
a.delete(j);
|
|
347
|
+
}) : (l.add(j), () => {
|
|
348
|
+
l.delete(j);
|
|
349
349
|
}),
|
|
350
350
|
dev_get_mounted_atoms: () => i.values(),
|
|
351
|
-
dev_get_atom_state: (
|
|
352
|
-
dev_get_mounted: (
|
|
353
|
-
dev_restore_atoms: (
|
|
354
|
-
for (const [
|
|
355
|
-
hasInitialValue(
|
|
356
|
-
const
|
|
351
|
+
dev_get_atom_state: (j) => o.get(j),
|
|
352
|
+
dev_get_mounted: (j) => n.get(j),
|
|
353
|
+
dev_restore_atoms: (j) => {
|
|
354
|
+
for (const [C, R] of j)
|
|
355
|
+
hasInitialValue(C) && (m(C, R), v(C));
|
|
356
|
+
const k = D();
|
|
357
357
|
l.forEach(
|
|
358
|
-
(
|
|
358
|
+
(C) => C({ type: "restore", flushed: k })
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
361
|
} : {
|
|
@@ -378,37 +378,37 @@ function splitAtom(o, n) {
|
|
|
378
378
|
let u = r.get(c);
|
|
379
379
|
if (u)
|
|
380
380
|
return u;
|
|
381
|
-
const p = d && r.get(d),
|
|
382
|
-
return c.forEach((
|
|
383
|
-
const
|
|
384
|
-
x[E] =
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
|
|
381
|
+
const p = d && r.get(d), m = [], x = [];
|
|
382
|
+
return c.forEach((g, E) => {
|
|
383
|
+
const b = n ? n(g) : E;
|
|
384
|
+
x[E] = b;
|
|
385
|
+
const f = p && p.atomList[p.keyList.indexOf(b)];
|
|
386
|
+
if (f) {
|
|
387
|
+
m[E] = f;
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
const
|
|
391
|
-
const B = S(l),
|
|
392
|
-
if (N < 0 || N >=
|
|
393
|
-
const D = c[a(c).keyList.indexOf(
|
|
390
|
+
const _ = (S) => {
|
|
391
|
+
const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(b);
|
|
392
|
+
if (N < 0 || N >= w.length) {
|
|
393
|
+
const D = c[a(c).keyList.indexOf(b)];
|
|
394
394
|
if (D)
|
|
395
395
|
return D;
|
|
396
396
|
throw new Error("splitAtom: index out of bounds for read");
|
|
397
397
|
}
|
|
398
|
-
return
|
|
399
|
-
},
|
|
400
|
-
const
|
|
398
|
+
return w[N];
|
|
399
|
+
}, v = (S, B, w) => {
|
|
400
|
+
const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
|
|
401
401
|
if (T < 0 || T >= N.length)
|
|
402
402
|
throw new Error("splitAtom: index out of bounds for write");
|
|
403
|
-
const
|
|
403
|
+
const j = isFunction(w) ? w(N[T]) : w;
|
|
404
404
|
B(o, [
|
|
405
405
|
...N.slice(0, T),
|
|
406
|
-
|
|
406
|
+
j,
|
|
407
407
|
...N.slice(T + 1)
|
|
408
408
|
]);
|
|
409
409
|
};
|
|
410
|
-
|
|
411
|
-
}), p && p.keyList.length === x.length && p.keyList.every((
|
|
410
|
+
m[E] = isWritable(o) ? atom(_, v) : atom(_);
|
|
411
|
+
}), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
|
|
412
412
|
}, l = atom((c) => {
|
|
413
413
|
const d = c(l), u = c(o);
|
|
414
414
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -421,10 +421,10 @@ function splitAtom(o, n) {
|
|
|
421
421
|
case "remove": {
|
|
422
422
|
const p = c(i).indexOf(u.atom);
|
|
423
423
|
if (p >= 0) {
|
|
424
|
-
const
|
|
424
|
+
const m = c(o);
|
|
425
425
|
d(o, [
|
|
426
|
-
...
|
|
427
|
-
...
|
|
426
|
+
...m.slice(0, p),
|
|
427
|
+
...m.slice(p + 1)
|
|
428
428
|
]);
|
|
429
429
|
}
|
|
430
430
|
break;
|
|
@@ -432,28 +432,28 @@ function splitAtom(o, n) {
|
|
|
432
432
|
case "insert": {
|
|
433
433
|
const p = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
434
434
|
if (p >= 0) {
|
|
435
|
-
const
|
|
435
|
+
const m = c(o);
|
|
436
436
|
d(o, [
|
|
437
|
-
...
|
|
437
|
+
...m.slice(0, p),
|
|
438
438
|
u.value,
|
|
439
|
-
...
|
|
439
|
+
...m.slice(p)
|
|
440
440
|
]);
|
|
441
441
|
}
|
|
442
442
|
break;
|
|
443
443
|
}
|
|
444
444
|
case "move": {
|
|
445
|
-
const p = c(i).indexOf(u.atom),
|
|
446
|
-
if (p >= 0 &&
|
|
445
|
+
const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
446
|
+
if (p >= 0 && m >= 0) {
|
|
447
447
|
const x = c(o);
|
|
448
|
-
p <
|
|
448
|
+
p < m ? d(o, [
|
|
449
449
|
...x.slice(0, p),
|
|
450
|
-
...x.slice(p + 1,
|
|
450
|
+
...x.slice(p + 1, m),
|
|
451
451
|
x[p],
|
|
452
|
-
...x.slice(
|
|
452
|
+
...x.slice(m)
|
|
453
453
|
]) : d(o, [
|
|
454
|
-
...x.slice(0,
|
|
454
|
+
...x.slice(0, m),
|
|
455
455
|
x[p],
|
|
456
|
-
...x.slice(
|
|
456
|
+
...x.slice(m, p),
|
|
457
457
|
...x.slice(p + 1)
|
|
458
458
|
]);
|
|
459
459
|
}
|
|
@@ -474,14 +474,14 @@ function createJSONStorage(o) {
|
|
|
474
474
|
const a = {
|
|
475
475
|
getItem: (l, i) => {
|
|
476
476
|
var c, d;
|
|
477
|
-
const u = (
|
|
478
|
-
if (
|
|
477
|
+
const u = (m) => {
|
|
478
|
+
if (m = m || "", n !== m) {
|
|
479
479
|
try {
|
|
480
|
-
r = JSON.parse(
|
|
480
|
+
r = JSON.parse(m);
|
|
481
481
|
} catch {
|
|
482
482
|
return i;
|
|
483
483
|
}
|
|
484
|
-
n =
|
|
484
|
+
n = m;
|
|
485
485
|
}
|
|
486
486
|
return r;
|
|
487
487
|
}, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
|
|
@@ -530,8 +530,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
|
|
|
530
530
|
}, atom(
|
|
531
531
|
(d) => d(i),
|
|
532
532
|
(d, u, p) => {
|
|
533
|
-
const
|
|
534
|
-
return
|
|
533
|
+
const m = typeof p == "function" ? p(d(i)) : p;
|
|
534
|
+
return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, m), r.setItem(o, m));
|
|
535
535
|
}
|
|
536
536
|
);
|
|
537
537
|
}
|
|
@@ -556,8 +556,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
556
556
|
function useAtomValue(o, n) {
|
|
557
557
|
const r = useStore(n), [[a, l, i], c] = useReducer(
|
|
558
558
|
(p) => {
|
|
559
|
-
const
|
|
560
|
-
return Object.is(p[0],
|
|
559
|
+
const m = r.get(o);
|
|
560
|
+
return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
|
|
561
561
|
},
|
|
562
562
|
void 0,
|
|
563
563
|
() => [r.get(o), r, o]
|
|
@@ -641,8 +641,8 @@ const getSlots = (o) => {
|
|
|
641
641
|
return map(i, (c) => {
|
|
642
642
|
const d = c, u = getSlots(d);
|
|
643
643
|
return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
|
|
644
|
-
const
|
|
645
|
-
d[p] = `slot:${
|
|
644
|
+
const m = find(i, { oldId: u[p].replace("slot:", "") });
|
|
645
|
+
d[p] = `slot:${m._id}`;
|
|
646
646
|
}), omit(d, ["global", "oldId"]);
|
|
647
647
|
});
|
|
648
648
|
}, presentBlocksAtom = atom$1([]);
|
|
@@ -717,7 +717,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
717
717
|
[n]
|
|
718
718
|
);
|
|
719
719
|
return [o, n, r];
|
|
720
|
-
}, getBlockJSONFromUISchemas = (o) => {
|
|
720
|
+
}, titleWithLang = (o, n, r) => endsWith(o, `(${n})`) || isEmpty(n) || !r ? o : `${o} (${n})`, getBlockJSONFromUISchemas = (o) => {
|
|
721
721
|
switch (o.type) {
|
|
722
722
|
case "singular":
|
|
723
723
|
return o.uiSchema;
|
|
@@ -744,41 +744,45 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
744
744
|
default:
|
|
745
745
|
return {};
|
|
746
746
|
}
|
|
747
|
-
}, getBlockJSONFromSchemas = (o, n) => {
|
|
747
|
+
}, getBlockJSONFromSchemas = (o, n, r) => {
|
|
748
748
|
switch (o.type) {
|
|
749
749
|
case "singular": {
|
|
750
|
-
const
|
|
751
|
-
return
|
|
750
|
+
const p = o.schema;
|
|
751
|
+
return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
|
|
752
752
|
}
|
|
753
753
|
case "model":
|
|
754
|
-
const { properties:
|
|
755
|
-
title: n(
|
|
754
|
+
const { properties: a, title: l } = o, i = {
|
|
755
|
+
title: titleWithLang(n(l), r, get(o, "i18n")),
|
|
756
756
|
type: "object",
|
|
757
757
|
properties: {}
|
|
758
758
|
};
|
|
759
|
-
return Object.keys(
|
|
760
|
-
const
|
|
761
|
-
if (includes(["slot", "styles"],
|
|
759
|
+
return Object.keys(a).forEach((p) => {
|
|
760
|
+
const m = a[p];
|
|
761
|
+
if (includes(["slot", "styles"], m.type))
|
|
762
762
|
return;
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
}),
|
|
763
|
+
const x = p;
|
|
764
|
+
i.properties[x] = getBlockJSONFromSchemas(m, n, r);
|
|
765
|
+
}), i;
|
|
766
766
|
case "list":
|
|
767
|
-
const { itemProperties:
|
|
768
|
-
title: n(
|
|
767
|
+
const { itemProperties: c, title: d } = o, u = {
|
|
768
|
+
title: titleWithLang(n(d), r, get(o, "i18n")),
|
|
769
769
|
type: "array",
|
|
770
770
|
items: {
|
|
771
771
|
type: "object",
|
|
772
772
|
properties: {}
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
|
-
return Object.keys(
|
|
776
|
-
const
|
|
777
|
-
if (includes(["slot", "styles"],
|
|
775
|
+
return Object.keys(c).forEach((p) => {
|
|
776
|
+
const m = c[p];
|
|
777
|
+
if (includes(["slot", "styles"], m.type))
|
|
778
778
|
return;
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
779
|
+
const x = p;
|
|
780
|
+
u.items.properties[x] = getBlockJSONFromSchemas(m, n, r), set(
|
|
781
|
+
u.items,
|
|
782
|
+
"title",
|
|
783
|
+
titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
|
|
784
|
+
);
|
|
785
|
+
}), u;
|
|
782
786
|
default:
|
|
783
787
|
return {};
|
|
784
788
|
}
|
|
@@ -830,8 +834,8 @@ var undomanager = { exports: {} };
|
|
|
830
834
|
}
|
|
831
835
|
let r = function() {
|
|
832
836
|
let a = [], l = -1, i = 0, c = !1, d;
|
|
833
|
-
function u(p,
|
|
834
|
-
return !p || typeof p[
|
|
837
|
+
function u(p, m) {
|
|
838
|
+
return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
|
|
835
839
|
}
|
|
836
840
|
return {
|
|
837
841
|
/**
|
|
@@ -858,8 +862,8 @@ var undomanager = { exports: {} };
|
|
|
858
862
|
let p = a[l];
|
|
859
863
|
if (!p)
|
|
860
864
|
return this;
|
|
861
|
-
const
|
|
862
|
-
for (; p.groupId ===
|
|
865
|
+
const m = p.groupId;
|
|
866
|
+
for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
|
|
863
867
|
;
|
|
864
868
|
return d && d(), this;
|
|
865
869
|
},
|
|
@@ -870,8 +874,8 @@ var undomanager = { exports: {} };
|
|
|
870
874
|
let p = a[l + 1];
|
|
871
875
|
if (!p)
|
|
872
876
|
return this;
|
|
873
|
-
const
|
|
874
|
-
for (; p.groupId ===
|
|
877
|
+
const m = p.groupId;
|
|
878
|
+
for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
|
|
875
879
|
;
|
|
876
880
|
return d && d(), this;
|
|
877
881
|
},
|
|
@@ -902,7 +906,7 @@ var undomanager = { exports: {} };
|
|
|
902
906
|
* @returns {array}
|
|
903
907
|
*/
|
|
904
908
|
getCommands: function(p) {
|
|
905
|
-
return p ? a.filter((
|
|
909
|
+
return p ? a.filter((m) => m.groupId === p) : a;
|
|
906
910
|
},
|
|
907
911
|
/**
|
|
908
912
|
* Returns the index of the actions list.
|
|
@@ -1192,102 +1196,102 @@ const useBlocksStoreManager = () => {
|
|
|
1192
1196
|
updateBlocksProps: c
|
|
1193
1197
|
} = useBlocksStoreManager();
|
|
1194
1198
|
return {
|
|
1195
|
-
moveBlocks: (
|
|
1196
|
-
const
|
|
1197
|
-
const
|
|
1198
|
-
return { _id: B, oldParent:
|
|
1199
|
-
}), S =
|
|
1200
|
-
S && S.oldParent ===
|
|
1201
|
-
undo: () => each(
|
|
1202
|
-
i([B],
|
|
1199
|
+
moveBlocks: (b, f, _) => {
|
|
1200
|
+
const v = map(b, (B) => {
|
|
1201
|
+
const A = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => A ? T._parent === A : !T._parent).map((T) => T._id).indexOf(B);
|
|
1202
|
+
return { _id: B, oldParent: A, oldPosition: D };
|
|
1203
|
+
}), S = v.find(({ _id: B }) => B === b[0]);
|
|
1204
|
+
S && S.oldParent === f && S.oldPosition === _ || (i(b, f, _), o({
|
|
1205
|
+
undo: () => each(v, ({ _id: B, oldParent: w, oldPosition: A }) => {
|
|
1206
|
+
i([B], w, A);
|
|
1203
1207
|
}),
|
|
1204
|
-
redo: () => i(
|
|
1208
|
+
redo: () => i(b, f, _)
|
|
1205
1209
|
}));
|
|
1206
1210
|
},
|
|
1207
|
-
addBlocks: (
|
|
1208
|
-
a(
|
|
1209
|
-
undo: () => l(map(
|
|
1210
|
-
redo: () => a(
|
|
1211
|
+
addBlocks: (b, f, _) => {
|
|
1212
|
+
a(b, f, _), o({
|
|
1213
|
+
undo: () => l(map(b, "_id")),
|
|
1214
|
+
redo: () => a(b, f, _)
|
|
1211
1215
|
});
|
|
1212
1216
|
},
|
|
1213
|
-
removeBlocks: (
|
|
1217
|
+
removeBlocks: (b) => {
|
|
1214
1218
|
var S;
|
|
1215
|
-
const
|
|
1216
|
-
l(map(
|
|
1217
|
-
undo: () => a(
|
|
1218
|
-
redo: () => l(map(
|
|
1219
|
+
const f = (S = first(b)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(b));
|
|
1220
|
+
l(map(b, "_id")), o({
|
|
1221
|
+
undo: () => a(b, f, v),
|
|
1222
|
+
redo: () => l(map(b, "_id"))
|
|
1219
1223
|
});
|
|
1220
1224
|
},
|
|
1221
|
-
updateBlocks: (
|
|
1222
|
-
let
|
|
1223
|
-
if (
|
|
1224
|
-
|
|
1225
|
+
updateBlocks: (b, f, _) => {
|
|
1226
|
+
let v = [];
|
|
1227
|
+
if (_)
|
|
1228
|
+
v = map(b, (S) => ({ _id: S, ..._ }));
|
|
1225
1229
|
else {
|
|
1226
|
-
const S = keys(
|
|
1227
|
-
|
|
1228
|
-
const
|
|
1229
|
-
return each(S, (N) =>
|
|
1230
|
+
const S = keys(f);
|
|
1231
|
+
v = map(b, (B) => {
|
|
1232
|
+
const w = n.find((N) => N._id === B), A = { _id: B };
|
|
1233
|
+
return each(S, (N) => A[N] = w[N]), A;
|
|
1230
1234
|
});
|
|
1231
1235
|
}
|
|
1232
|
-
c(map(
|
|
1233
|
-
undo: () => c(
|
|
1234
|
-
redo: () => c(map(
|
|
1236
|
+
c(map(b, (S) => ({ _id: S, ...f }))), o({
|
|
1237
|
+
undo: () => c(v),
|
|
1238
|
+
redo: () => c(map(b, (S) => ({ _id: S, ...f })))
|
|
1235
1239
|
});
|
|
1236
1240
|
},
|
|
1237
|
-
updateBlocksRuntime: (
|
|
1238
|
-
c(map(
|
|
1241
|
+
updateBlocksRuntime: (b, f) => {
|
|
1242
|
+
c(map(b, (_) => ({ _id: _, ...f })));
|
|
1239
1243
|
},
|
|
1240
|
-
setNewBlocks: (
|
|
1241
|
-
r(
|
|
1244
|
+
setNewBlocks: (b) => {
|
|
1245
|
+
r(b), o({
|
|
1242
1246
|
undo: () => r(n),
|
|
1243
|
-
redo: () => r(
|
|
1247
|
+
redo: () => r(b)
|
|
1244
1248
|
});
|
|
1245
1249
|
},
|
|
1246
|
-
updateMultipleBlocksProps: (
|
|
1247
|
-
let
|
|
1248
|
-
|
|
1249
|
-
const
|
|
1250
|
-
return each(
|
|
1251
|
-
}), c(
|
|
1252
|
-
undo: () => c(
|
|
1253
|
-
redo: () => c(
|
|
1250
|
+
updateMultipleBlocksProps: (b) => {
|
|
1251
|
+
let f = [];
|
|
1252
|
+
f = map(b, (_) => {
|
|
1253
|
+
const v = keys(_), S = n.find((w) => w._id === _._id), B = {};
|
|
1254
|
+
return each(v, (w) => B[w] = S[w]), B;
|
|
1255
|
+
}), c(b), o({
|
|
1256
|
+
undo: () => c(f),
|
|
1257
|
+
redo: () => c(b)
|
|
1254
1258
|
});
|
|
1255
1259
|
}
|
|
1256
1260
|
};
|
|
1257
1261
|
}, useAddBlock = () => {
|
|
1258
1262
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1259
1263
|
(i, c, d) => {
|
|
1260
|
-
var
|
|
1264
|
+
var g;
|
|
1261
1265
|
for (let E = 0; E < i.length; E++) {
|
|
1262
|
-
const { _id:
|
|
1266
|
+
const { _id: b } = i[E];
|
|
1263
1267
|
i[E]._id = generateUUID();
|
|
1264
|
-
const
|
|
1265
|
-
for (let
|
|
1266
|
-
|
|
1268
|
+
const f = filter(i, { _parent: b });
|
|
1269
|
+
for (let _ = 0; _ < f.length; _++)
|
|
1270
|
+
f[_]._parent = i[E]._id;
|
|
1267
1271
|
}
|
|
1268
1272
|
const u = first(i);
|
|
1269
|
-
let p,
|
|
1270
|
-
return c && (p = find(o, { _id: c }), i[0]._parent = c,
|
|
1273
|
+
let p, m;
|
|
1274
|
+
return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
|
|
1271
1275
|
},
|
|
1272
1276
|
[o, n]
|
|
1273
1277
|
);
|
|
1274
1278
|
return { addCoreBlock: useCallback(
|
|
1275
1279
|
(i, c, d) => {
|
|
1276
1280
|
if (has(i, "blocks")) {
|
|
1277
|
-
const
|
|
1278
|
-
return a(
|
|
1281
|
+
const _ = i.blocks;
|
|
1282
|
+
return a(_, c, d);
|
|
1279
1283
|
}
|
|
1280
|
-
const u = generateUUID(), p = getBlockDefaultProps(i.props),
|
|
1281
|
-
forIn(p, (
|
|
1282
|
-
if (startsWith(
|
|
1283
|
-
const S =
|
|
1284
|
-
|
|
1284
|
+
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1285
|
+
forIn(p, (_, v) => {
|
|
1286
|
+
if (startsWith(_, SLOT_KEY)) {
|
|
1287
|
+
const S = _.replace(SLOT_KEY, "");
|
|
1288
|
+
m.push({
|
|
1285
1289
|
_id: S,
|
|
1286
1290
|
_type: "Slot",
|
|
1287
1291
|
_parent: u,
|
|
1288
|
-
_name: i.props[
|
|
1289
|
-
_styles: i.props[
|
|
1290
|
-
_emptyStyles: i.props[
|
|
1292
|
+
_name: i.props[v].name,
|
|
1293
|
+
_styles: i.props[v].styles,
|
|
1294
|
+
_emptyStyles: i.props[v].emptyStyles
|
|
1291
1295
|
});
|
|
1292
1296
|
}
|
|
1293
1297
|
});
|
|
@@ -1296,10 +1300,10 @@ const useBlocksStoreManager = () => {
|
|
|
1296
1300
|
_id: u,
|
|
1297
1301
|
...p
|
|
1298
1302
|
};
|
|
1299
|
-
let
|
|
1300
|
-
c && (
|
|
1301
|
-
const
|
|
1302
|
-
return r(
|
|
1303
|
+
let g, E;
|
|
1304
|
+
c && (g = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, E = g._parent);
|
|
1305
|
+
const f = [x, ...m];
|
|
1306
|
+
return r(f, E, d), n([x._id]), x;
|
|
1303
1307
|
},
|
|
1304
1308
|
[a, o, n]
|
|
1305
1309
|
), addPredefinedBlock: a };
|
|
@@ -2407,18 +2411,18 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2407
2411
|
);
|
|
2408
2412
|
const i = [], c = [];
|
|
2409
2413
|
each(r, (p) => {
|
|
2410
|
-
const
|
|
2414
|
+
const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
|
|
2411
2415
|
if (x && (a = filter(
|
|
2412
2416
|
a,
|
|
2413
|
-
(
|
|
2414
|
-
)), i.push(
|
|
2415
|
-
const
|
|
2417
|
+
(g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
|
|
2418
|
+
)), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
|
|
2419
|
+
const g = find(l, pick(m, ["property"]));
|
|
2416
2420
|
x && (l = filter(
|
|
2417
2421
|
l,
|
|
2418
|
-
(E) => E.fullCls !== (
|
|
2422
|
+
(E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2419
2423
|
)), c.push({
|
|
2420
|
-
...
|
|
2421
|
-
fullCls:
|
|
2424
|
+
...m,
|
|
2425
|
+
fullCls: m.cls,
|
|
2422
2426
|
mq: "xs"
|
|
2423
2427
|
});
|
|
2424
2428
|
}
|
|
@@ -2446,10 +2450,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2446
2450
|
)
|
|
2447
2451
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2448
2452
|
return map(l, (c) => {
|
|
2449
|
-
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes:
|
|
2453
|
+
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
|
|
2450
2454
|
return {
|
|
2451
2455
|
ids: [d._id],
|
|
2452
|
-
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(
|
|
2456
|
+
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
|
|
2453
2457
|
};
|
|
2454
2458
|
});
|
|
2455
2459
|
}), useAddClassesToBlocks = () => {
|
|
@@ -2498,13 +2502,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2498
2502
|
(a, l = null) => {
|
|
2499
2503
|
const i = [];
|
|
2500
2504
|
each(a, (c) => {
|
|
2501
|
-
const d = o.find((
|
|
2505
|
+
const d = o.find((g) => g._id === c);
|
|
2502
2506
|
l || (l = d._parent);
|
|
2503
|
-
const
|
|
2507
|
+
const m = filter(
|
|
2504
2508
|
o,
|
|
2505
|
-
(
|
|
2509
|
+
(g) => isString$1(l) ? g._parent === l : !d._parent
|
|
2506
2510
|
).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
|
|
2507
|
-
r(x, l,
|
|
2511
|
+
r(x, l, m), i.push(get(x, "0._id", ""));
|
|
2508
2512
|
}), n(i);
|
|
2509
2513
|
},
|
|
2510
2514
|
[o, n]
|
|
@@ -2567,19 +2571,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2567
2571
|
);
|
|
2568
2572
|
return map(i, (c) => {
|
|
2569
2573
|
const d = o(c), u = a;
|
|
2570
|
-
let { classes: p, baseClasses:
|
|
2574
|
+
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2571
2575
|
return each(u, (x) => {
|
|
2572
|
-
const
|
|
2576
|
+
const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
|
|
2573
2577
|
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2574
|
-
const
|
|
2575
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2578
|
+
const b = first(x.split(":"));
|
|
2579
|
+
includes(["2xl", "xl", "lg", "md", "sm"], b) && u.push(x.split(":").pop().trim());
|
|
2576
2580
|
}), each(u, (x) => {
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2581
|
+
const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2582
|
+
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
2579
2583
|
}), {
|
|
2580
2584
|
ids: [d._id],
|
|
2581
2585
|
props: {
|
|
2582
|
-
[l.prop]: `${STYLES_KEY}${
|
|
2586
|
+
[l.prop]: `${STYLES_KEY}${m},${p}`
|
|
2583
2587
|
}
|
|
2584
2588
|
};
|
|
2585
2589
|
});
|
|
@@ -2628,13 +2632,37 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2628
2632
|
break;
|
|
2629
2633
|
}
|
|
2630
2634
|
return n;
|
|
2631
|
-
}, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom),
|
|
2632
|
-
|
|
2635
|
+
}, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom), languageAtom = atom$1("");
|
|
2636
|
+
languageAtom.debugLabel = "selectedLanguageAtom";
|
|
2637
|
+
const useLanguages = () => {
|
|
2638
|
+
const o = useBuilderProp("languages", []), n = useBuilderProp("fallbackLang", "en"), [r, a] = useAtom$1(languageAtom), l = (i) => {
|
|
2639
|
+
a(n === i ? "" : i);
|
|
2640
|
+
};
|
|
2641
|
+
return {
|
|
2642
|
+
languages: o == null ? void 0 : o.filter((i) => i !== n),
|
|
2643
|
+
fallbackLang: n,
|
|
2644
|
+
selectedLang: r,
|
|
2645
|
+
setSelectedLang: l
|
|
2646
|
+
};
|
|
2647
|
+
}, updatePropsForLanguage = memoize((o, n, r) => {
|
|
2648
|
+
const a = getBlockComponent(get(r, "_type"));
|
|
2649
|
+
if (!a)
|
|
2650
|
+
return o;
|
|
2651
|
+
const l = { ...o };
|
|
2652
|
+
return forEach(keys(o), (i) => {
|
|
2653
|
+
if (get(a, ["props", i, "i18n"]) && !isEmpty(n)) {
|
|
2654
|
+
const c = `${i}-${n}`;
|
|
2655
|
+
set(l, c, o[i]), unset(l, i);
|
|
2656
|
+
}
|
|
2657
|
+
}), l;
|
|
2658
|
+
}), useUpdateBlocksProps = () => {
|
|
2659
|
+
const { updateBlocks: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
|
|
2633
2660
|
return useCallback(
|
|
2634
|
-
(
|
|
2635
|
-
|
|
2661
|
+
(a, l, i) => {
|
|
2662
|
+
const c = updatePropsForLanguage(l, n, r);
|
|
2663
|
+
o(a, c, i);
|
|
2636
2664
|
},
|
|
2637
|
-
[o]
|
|
2665
|
+
[o, n]
|
|
2638
2666
|
);
|
|
2639
2667
|
}, useUpdateMultipleBlocksProps = () => {
|
|
2640
2668
|
const { updateMultipleBlocksProps: o } = useBlocksStoreUndoableActions();
|
|
@@ -2656,7 +2684,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2656
2684
|
let u = "";
|
|
2657
2685
|
o([n], { [i]: "" });
|
|
2658
2686
|
for (let p = 0; p < d.length; p++)
|
|
2659
|
-
u += d[p].join(""), o([n], { [i]: u }), await new Promise((
|
|
2687
|
+
u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
|
|
2660
2688
|
}
|
|
2661
2689
|
}
|
|
2662
2690
|
},
|
|
@@ -2673,12 +2701,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2673
2701
|
[o]
|
|
2674
2702
|
);
|
|
2675
2703
|
}, useUpdateBlocksPropsRealtime = () => {
|
|
2676
|
-
const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions();
|
|
2704
|
+
const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
|
|
2677
2705
|
return useCallback(
|
|
2678
|
-
(
|
|
2679
|
-
|
|
2706
|
+
(a, l) => {
|
|
2707
|
+
const i = updatePropsForLanguage(l, n, r);
|
|
2708
|
+
o(a, i);
|
|
2680
2709
|
},
|
|
2681
|
-
[o]
|
|
2710
|
+
[o, n]
|
|
2682
2711
|
);
|
|
2683
2712
|
}, selectedBreakpointsAtom = atomWithStorage("selectedBreakpoints", ["XS", "MD", "XL"]), useSelectedBreakpoints = () => {
|
|
2684
2713
|
const [o, n] = useAtom$1(selectedBreakpointsAtom);
|
|
@@ -2841,18 +2870,18 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
|
|
|
2841
2870
|
const { width: d, height: u } = o;
|
|
2842
2871
|
if (d < n) {
|
|
2843
2872
|
const p = parseFloat((d / n).toFixed(2).toString());
|
|
2844
|
-
let
|
|
2845
|
-
const x = u * p,
|
|
2846
|
-
u && (
|
|
2873
|
+
let m = {};
|
|
2874
|
+
const x = u * p, g = d * p;
|
|
2875
|
+
u && (m = {
|
|
2847
2876
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
2848
2877
|
height: 100 + (u - x) / x * 100 + "%",
|
|
2849
|
-
width: 100 + (d -
|
|
2878
|
+
width: 100 + (d - g) / g * 100 + "%"
|
|
2850
2879
|
}), i({
|
|
2851
2880
|
position: "relative",
|
|
2852
2881
|
top: 0,
|
|
2853
2882
|
transform: `scale(${p})`,
|
|
2854
2883
|
transformOrigin: a === "rtl" ? "top right" : "top left",
|
|
2855
|
-
...
|
|
2884
|
+
...m,
|
|
2856
2885
|
maxWidth: "none"
|
|
2857
2886
|
// TODO: Add max-width to the wrapper
|
|
2858
2887
|
}), r(p * 100);
|
|
@@ -3030,33 +3059,33 @@ const useDnd = () => {
|
|
|
3030
3059
|
};
|
|
3031
3060
|
return iframeDocument = o, {
|
|
3032
3061
|
isDragging: n,
|
|
3033
|
-
onDragOver: (
|
|
3034
|
-
|
|
3062
|
+
onDragOver: (g) => {
|
|
3063
|
+
g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
|
|
3035
3064
|
},
|
|
3036
|
-
onDrop: (
|
|
3037
|
-
var
|
|
3038
|
-
const E = dropTarget,
|
|
3039
|
-
dropIndex = calculateDropIndex(
|
|
3040
|
-
const
|
|
3041
|
-
if ((
|
|
3065
|
+
onDrop: (g) => {
|
|
3066
|
+
var w;
|
|
3067
|
+
const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
|
|
3068
|
+
dropIndex = calculateDropIndex(f, possiblePositions);
|
|
3069
|
+
const _ = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3070
|
+
if ((_ == null ? void 0 : _._id) === v || !S) {
|
|
3042
3071
|
x();
|
|
3043
3072
|
return;
|
|
3044
3073
|
}
|
|
3045
|
-
if (!has(
|
|
3046
|
-
a(
|
|
3074
|
+
if (!has(_, "_id")) {
|
|
3075
|
+
a(_, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
|
|
3047
3076
|
return;
|
|
3048
3077
|
}
|
|
3049
3078
|
let B = E.getAttribute("data-block-id");
|
|
3050
|
-
B === null && (B =
|
|
3079
|
+
B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([_._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3051
3080
|
},
|
|
3052
|
-
onDragEnter: (
|
|
3053
|
-
const E =
|
|
3054
|
-
dropTarget =
|
|
3055
|
-
const
|
|
3056
|
-
p(
|
|
3081
|
+
onDragEnter: (g) => {
|
|
3082
|
+
const E = g, b = E.target;
|
|
3083
|
+
dropTarget = b;
|
|
3084
|
+
const f = b.getAttribute("data-block-id"), _ = b.getAttribute("data-dnd-dragged") !== "yes";
|
|
3085
|
+
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(b), r(!0), l(""), i([]);
|
|
3057
3086
|
},
|
|
3058
|
-
onDragLeave: (
|
|
3059
|
-
|
|
3087
|
+
onDragLeave: (g) => {
|
|
3088
|
+
g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
3060
3089
|
}
|
|
3061
3090
|
};
|
|
3062
3091
|
};
|
|
@@ -3078,16 +3107,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3078
3107
|
if (!d || !o.includes(d))
|
|
3079
3108
|
return;
|
|
3080
3109
|
const u = c.cloneNode(!0);
|
|
3081
|
-
c.style.display = "none", Array.from(u.attributes).forEach((
|
|
3082
|
-
|
|
3110
|
+
c.style.display = "none", Array.from(u.attributes).forEach((g) => {
|
|
3111
|
+
g.name !== "class" && u.removeAttribute(g.name);
|
|
3083
3112
|
}), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
|
|
3084
3113
|
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3085
|
-
function
|
|
3086
|
-
const
|
|
3087
|
-
n([c.getAttribute("data-block-id")], { content:
|
|
3114
|
+
function m() {
|
|
3115
|
+
const g = p.getText(0, p.getLength());
|
|
3116
|
+
n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
|
|
3088
3117
|
}
|
|
3089
|
-
u.addEventListener("blur",
|
|
3090
|
-
(
|
|
3118
|
+
u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
|
|
3119
|
+
(g.key === "Enter" || g.key === "Escape") && m();
|
|
3091
3120
|
}), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
|
|
3092
3121
|
};
|
|
3093
3122
|
}, useHandleCanvasClick = () => {
|
|
@@ -3102,8 +3131,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3102
3131
|
return;
|
|
3103
3132
|
}
|
|
3104
3133
|
if (d != null && d.getAttribute("data-block-parent")) {
|
|
3105
|
-
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"),
|
|
3106
|
-
n.includes(
|
|
3134
|
+
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
|
|
3135
|
+
n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
|
|
3107
3136
|
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3108
3137
|
const u = d.getAttribute("data-block-id");
|
|
3109
3138
|
n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
@@ -3126,10 +3155,10 @@ const useHandleCanvasDblClick = () => {
|
|
|
3126
3155
|
return;
|
|
3127
3156
|
const p = getElementByDataBlockId(n, first(r));
|
|
3128
3157
|
if (p) {
|
|
3129
|
-
const
|
|
3130
|
-
if (
|
|
3131
|
-
const x = p.getAttribute("data-style-id"),
|
|
3132
|
-
l([{ id: x, prop:
|
|
3158
|
+
const m = p.getAttribute("data-style-prop");
|
|
3159
|
+
if (m) {
|
|
3160
|
+
const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
|
|
3161
|
+
l([{ id: x, prop: m, blockId: g }]);
|
|
3133
3162
|
}
|
|
3134
3163
|
}
|
|
3135
3164
|
}, 100);
|
|
@@ -3149,14 +3178,14 @@ const useHandleCanvasDblClick = () => {
|
|
|
3149
3178
|
}
|
|
3150
3179
|
);
|
|
3151
3180
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
|
|
3152
|
-
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks:
|
|
3181
|
+
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
|
|
3153
3182
|
useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
|
|
3154
3183
|
"ctrl+v,command+v",
|
|
3155
3184
|
() => {
|
|
3156
|
-
p(n[0]) &&
|
|
3185
|
+
p(n[0]) && m(n);
|
|
3157
3186
|
},
|
|
3158
3187
|
{},
|
|
3159
|
-
[n, p,
|
|
3188
|
+
[n, p, m]
|
|
3160
3189
|
);
|
|
3161
3190
|
const x = o ? { document: o } : {};
|
|
3162
3191
|
useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
|
|
@@ -3164,8 +3193,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3164
3193
|
l
|
|
3165
3194
|
]), useHotkeys(
|
|
3166
3195
|
"del, backspace",
|
|
3167
|
-
(
|
|
3168
|
-
|
|
3196
|
+
(g) => {
|
|
3197
|
+
g.preventDefault(), a(n);
|
|
3169
3198
|
},
|
|
3170
3199
|
x,
|
|
3171
3200
|
[n, a]
|
|
@@ -3196,15 +3225,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3196
3225
|
}
|
|
3197
3226
|
);
|
|
3198
3227
|
}, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
|
|
3199
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update:
|
|
3228
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
|
|
3200
3229
|
placement: "top-start",
|
|
3201
3230
|
middleware: [shift(), flip()],
|
|
3202
3231
|
elements: {
|
|
3203
3232
|
reference: o
|
|
3204
3233
|
}
|
|
3205
3234
|
});
|
|
3206
|
-
useResizeObserver(o, () =>
|
|
3207
|
-
const x = get(n, "_parent", null),
|
|
3235
|
+
useResizeObserver(o, () => m(), o !== null);
|
|
3236
|
+
const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3208
3237
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3209
3238
|
"div",
|
|
3210
3239
|
{
|
|
@@ -3230,7 +3259,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3230
3259
|
}
|
|
3231
3260
|
}
|
|
3232
3261
|
),
|
|
3233
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label:
|
|
3262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
|
|
3234
3263
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
|
|
3235
3264
|
canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3236
3265
|
PlusIcon,
|
|
@@ -3253,9 +3282,9 @@ const useHandleCanvasDblClick = () => {
|
|
|
3253
3282
|
}
|
|
3254
3283
|
) });
|
|
3255
3284
|
}, HeadTags = ({ model: o }) => {
|
|
3256
|
-
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [
|
|
3285
|
+
const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [m] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
|
|
3257
3286
|
u == null ? void 0 : u.getElementById("selected-block")
|
|
3258
|
-
), [
|
|
3287
|
+
), [g] = useState(
|
|
3259
3288
|
u == null ? void 0 : u.getElementById("selected-styling-block")
|
|
3260
3289
|
), [E] = useState(
|
|
3261
3290
|
u == null ? void 0 : u.getElementById("dragged-block")
|
|
@@ -3263,16 +3292,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3263
3292
|
useEffect(() => {
|
|
3264
3293
|
a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
|
|
3265
3294
|
}, [a, u]);
|
|
3266
|
-
const
|
|
3295
|
+
const b = get(n, "headingFont", "DM Sans"), f = get(n, "bodyFont", "DM Sans");
|
|
3267
3296
|
return useEffect(() => {
|
|
3268
|
-
const
|
|
3269
|
-
{ color:
|
|
3270
|
-
{ color:
|
|
3297
|
+
const _ = get(n, "primaryColor", "#000"), v = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
|
|
3298
|
+
{ color: _, name: "primary" },
|
|
3299
|
+
{ color: v, name: "secondary" }
|
|
3271
3300
|
]), D = {
|
|
3272
3301
|
"bg-light": S,
|
|
3273
3302
|
"bg-dark": B,
|
|
3274
|
-
"text-dark":
|
|
3275
|
-
"text-light":
|
|
3303
|
+
"text-dark": w,
|
|
3304
|
+
"text-light": A
|
|
3276
3305
|
}, T = get(n, "roundedCorners", "0");
|
|
3277
3306
|
!p || !p.tailwind || (p.tailwind.config = {
|
|
3278
3307
|
darkMode: "class",
|
|
@@ -3286,8 +3315,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3286
3315
|
}
|
|
3287
3316
|
},
|
|
3288
3317
|
fontFamily: {
|
|
3289
|
-
heading: [
|
|
3290
|
-
body: [
|
|
3318
|
+
heading: [b],
|
|
3319
|
+
body: [f]
|
|
3291
3320
|
},
|
|
3292
3321
|
borderRadius: {
|
|
3293
3322
|
DEFAULT: `${T || "0"}px`
|
|
@@ -3299,43 +3328,43 @@ const useHandleCanvasDblClick = () => {
|
|
|
3299
3328
|
typography$1,
|
|
3300
3329
|
forms,
|
|
3301
3330
|
aspectRatio,
|
|
3302
|
-
plugin(function({ addBase:
|
|
3303
|
-
|
|
3331
|
+
plugin(function({ addBase: j, theme: k }) {
|
|
3332
|
+
j({
|
|
3304
3333
|
"h1,h2,h3,h4,h5,h6": {
|
|
3305
|
-
fontFamily:
|
|
3334
|
+
fontFamily: k("fontFamily.heading")
|
|
3306
3335
|
},
|
|
3307
3336
|
body: {
|
|
3308
|
-
fontFamily:
|
|
3309
|
-
color:
|
|
3310
|
-
backgroundColor:
|
|
3337
|
+
fontFamily: k("fontFamily.body"),
|
|
3338
|
+
color: k("colors.text-light"),
|
|
3339
|
+
backgroundColor: k("colors.bg-light")
|
|
3311
3340
|
},
|
|
3312
3341
|
".dark body": {
|
|
3313
|
-
color:
|
|
3314
|
-
backgroundColor:
|
|
3342
|
+
color: k("colors.text-dark"),
|
|
3343
|
+
backgroundColor: k("colors.bg-dark")
|
|
3315
3344
|
}
|
|
3316
3345
|
});
|
|
3317
3346
|
})
|
|
3318
3347
|
]
|
|
3319
3348
|
});
|
|
3320
|
-
}, [n, p,
|
|
3321
|
-
x && (x.textContent = `${map(r, (
|
|
3349
|
+
}, [n, p, b, f]), useEffect(() => {
|
|
3350
|
+
x && (x.textContent = `${map(r, (_) => `[data-block-id="${_}"]`).join(",")}{
|
|
3322
3351
|
outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3323
3352
|
}`);
|
|
3324
3353
|
}, [r, x]), useEffect(() => {
|
|
3325
3354
|
E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3326
3355
|
}, [c, E]), useEffect(() => {
|
|
3327
|
-
|
|
3328
|
-
}, [l, r,
|
|
3329
|
-
|
|
3356
|
+
m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3357
|
+
}, [l, r, m]), useEffect(() => {
|
|
3358
|
+
g && (g.textContent = `${map(i, ({ id: _ }) => `[data-style-id="${_}"]`).join(",")}{
|
|
3330
3359
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3331
3360
|
}`);
|
|
3332
|
-
}, [i,
|
|
3361
|
+
}, [i, g]), useEffect(() => {
|
|
3333
3362
|
u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3334
|
-
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (
|
|
3363
|
+
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || f) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3335
3364
|
"link",
|
|
3336
3365
|
{
|
|
3337
3366
|
rel: "stylesheet",
|
|
3338
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3367
|
+
href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && f && b !== f ? "&" : ""}${f && f !== b ? `family=${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
|
|
3339
3368
|
}
|
|
3340
3369
|
) });
|
|
3341
3370
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
@@ -3346,13 +3375,13 @@ const useHandleCanvasDblClick = () => {
|
|
|
3346
3375
|
u || (u = d, d = "xs");
|
|
3347
3376
|
const p = r.indexOf(d);
|
|
3348
3377
|
if (p <= a) {
|
|
3349
|
-
const
|
|
3350
|
-
if (
|
|
3351
|
-
for (let
|
|
3352
|
-
i[
|
|
3378
|
+
const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
|
|
3379
|
+
if (m.includes(u))
|
|
3380
|
+
for (let g = p; g < r.length; g++)
|
|
3381
|
+
i[g] = !0;
|
|
3353
3382
|
else if (x.includes(u))
|
|
3354
|
-
for (let
|
|
3355
|
-
i[
|
|
3383
|
+
for (let g = p; g < r.length; g++)
|
|
3384
|
+
i[g] = !1;
|
|
3356
3385
|
}
|
|
3357
3386
|
}
|
|
3358
3387
|
return i[a];
|
|
@@ -3379,16 +3408,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3379
3408
|
forEach(d, (u) => {
|
|
3380
3409
|
if (get(n, u, "") || get(a, `${u}.loading`, !1))
|
|
3381
3410
|
return;
|
|
3382
|
-
const p = o.find((
|
|
3383
|
-
l((
|
|
3384
|
-
r((x) => ({ ...x, [u]:
|
|
3411
|
+
const p = o.find((m) => m._id === u);
|
|
3412
|
+
l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
|
|
3413
|
+
r((x) => ({ ...x, [u]: m })), l((x) => ({
|
|
3385
3414
|
...x,
|
|
3386
3415
|
[u]: { loading: !1, error: null }
|
|
3387
3416
|
}));
|
|
3388
|
-
}).catch((
|
|
3417
|
+
}).catch((m) => {
|
|
3389
3418
|
l((x) => ({
|
|
3390
3419
|
...x,
|
|
3391
|
-
[u]: { loading: !1, error:
|
|
3420
|
+
[u]: { loading: !1, error: m.message }
|
|
3392
3421
|
}));
|
|
3393
3422
|
});
|
|
3394
3423
|
});
|
|
@@ -3444,51 +3473,59 @@ function isDescendant(o, n, r) {
|
|
|
3444
3473
|
return l.some((i) => i._id === n) ? !0 : l.some((i) => isDescendant(i._id, n, r));
|
|
3445
3474
|
}
|
|
3446
3475
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
|
|
3476
|
+
function applyLanguage(o, n, r) {
|
|
3477
|
+
if (isEmpty(n))
|
|
3478
|
+
return o;
|
|
3479
|
+
const a = cloneDeep(o);
|
|
3480
|
+
return forEach(keys(a), (l) => {
|
|
3481
|
+
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(a, `${l}-${n}`, a[l]));
|
|
3482
|
+
}), a;
|
|
3483
|
+
}
|
|
3447
3484
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3448
|
-
const [
|
|
3449
|
-
(f) => f.reduce((
|
|
3450
|
-
const
|
|
3451
|
-
return { ...
|
|
3485
|
+
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
|
|
3486
|
+
(f) => f.reduce((_, v) => {
|
|
3487
|
+
const S = get(u, v, {});
|
|
3488
|
+
return { ..._, ...S };
|
|
3452
3489
|
}, {}),
|
|
3453
|
-
[
|
|
3490
|
+
[u]
|
|
3454
3491
|
);
|
|
3455
3492
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3456
|
-
o.map((f,
|
|
3457
|
-
if (
|
|
3493
|
+
o.map((f, _) => {
|
|
3494
|
+
if (E === f._id || p.includes(f._id))
|
|
3458
3495
|
return null;
|
|
3459
|
-
const
|
|
3460
|
-
if (
|
|
3461
|
-
const
|
|
3462
|
-
|
|
3496
|
+
const v = {}, S = filter(n, { _parent: f._id });
|
|
3497
|
+
if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, f._type === "GlobalBlock") {
|
|
3498
|
+
const C = m(f);
|
|
3499
|
+
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
|
|
3463
3500
|
}
|
|
3464
|
-
const
|
|
3465
|
-
if (isNull(
|
|
3501
|
+
const B = getBlockComponent(f._type), w = get(B, "server", !1), A = w ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3502
|
+
if (isNull(A))
|
|
3466
3503
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3467
|
-
const
|
|
3468
|
-
if (get(
|
|
3504
|
+
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = b(N), T = x(f);
|
|
3505
|
+
if (get(T, "__isHidden", !1) && !includes(a, f._id))
|
|
3469
3506
|
return null;
|
|
3470
|
-
const
|
|
3471
|
-
...includes(
|
|
3507
|
+
const j = i && isDescendant(i._id, f._id, n), k = {
|
|
3508
|
+
...includes(a, f._id) ? { "force-show": "" } : {},
|
|
3472
3509
|
"data-block-id": f._id,
|
|
3473
3510
|
"data-block-type": f._type,
|
|
3474
|
-
...
|
|
3511
|
+
...i ? (
|
|
3475
3512
|
// @ts-ignore
|
|
3476
3513
|
{
|
|
3477
|
-
"data-dnd": canAcceptChildBlock(f._type,
|
|
3478
|
-
"data-dnd-dragged":
|
|
3514
|
+
"data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3515
|
+
"data-dnd-dragged": i._id === f._id || j ? "yes" : "no"
|
|
3479
3516
|
}
|
|
3480
3517
|
) : {},
|
|
3481
|
-
...
|
|
3482
|
-
...includes(
|
|
3518
|
+
...c === f._id && !j ? { "data-drop": "yes" } : {},
|
|
3519
|
+
...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
|
|
3483
3520
|
};
|
|
3484
|
-
return
|
|
3485
|
-
blockProps:
|
|
3486
|
-
index:
|
|
3487
|
-
...applyBindings(f,
|
|
3488
|
-
...omit(
|
|
3489
|
-
...
|
|
3521
|
+
return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
|
|
3522
|
+
blockProps: k,
|
|
3523
|
+
index: _,
|
|
3524
|
+
...applyBindings(applyLanguage(f, r, B), g),
|
|
3525
|
+
...omit(T, ["__isHidden"]),
|
|
3526
|
+
...v,
|
|
3490
3527
|
inBuilder: !0,
|
|
3491
|
-
blockState:
|
|
3528
|
+
blockState: D
|
|
3492
3529
|
}) });
|
|
3493
3530
|
})
|
|
3494
3531
|
) });
|
|
@@ -3538,47 +3575,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3538
3575
|
n(i);
|
|
3539
3576
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3540
3577
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3541
|
-
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), [
|
|
3542
|
-
u((N) => ({ ...N, width:
|
|
3578
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), _ = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
|
|
3579
|
+
u((N) => ({ ...N, width: A }));
|
|
3543
3580
|
};
|
|
3544
3581
|
useEffect(() => {
|
|
3545
3582
|
if (!c.current)
|
|
3546
3583
|
return;
|
|
3547
|
-
const { clientWidth:
|
|
3548
|
-
u({ width:
|
|
3584
|
+
const { clientWidth: A, clientHeight: N } = c.current;
|
|
3585
|
+
u({ width: A, height: N });
|
|
3549
3586
|
}, [c, n]);
|
|
3550
|
-
const B = (
|
|
3551
|
-
const { top: D } =
|
|
3587
|
+
const B = (A, N = 0) => {
|
|
3588
|
+
const { top: D } = A.getBoundingClientRect();
|
|
3552
3589
|
return D + N >= 0 && D - N <= window.innerHeight;
|
|
3553
3590
|
};
|
|
3554
3591
|
useEffect(() => {
|
|
3555
|
-
var
|
|
3592
|
+
var A, N;
|
|
3556
3593
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3557
3594
|
const D = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3558
|
-
D && (B(D) || (N = (
|
|
3595
|
+
D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
|
|
3559
3596
|
}
|
|
3560
3597
|
}, [a]), useEffect(() => {
|
|
3561
|
-
if (!isEmpty(
|
|
3562
|
-
const
|
|
3598
|
+
if (!isEmpty(b) && i.current) {
|
|
3599
|
+
const A = getElementByStyleId(
|
|
3563
3600
|
i.current.contentDocument,
|
|
3564
|
-
first(
|
|
3601
|
+
first(b).id
|
|
3565
3602
|
);
|
|
3566
|
-
|
|
3603
|
+
g(A ? [A] : [null]);
|
|
3567
3604
|
} else
|
|
3568
|
-
|
|
3569
|
-
}, [
|
|
3570
|
-
const
|
|
3571
|
-
let
|
|
3572
|
-
return
|
|
3605
|
+
g([null]);
|
|
3606
|
+
}, [b]);
|
|
3607
|
+
const w = useMemo(() => {
|
|
3608
|
+
let A = IframeInitialContent;
|
|
3609
|
+
return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
|
|
3573
3610
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3574
3611
|
"/offline/tailwind.cdn.js"
|
|
3575
|
-
),
|
|
3576
|
-
}, [o,
|
|
3612
|
+
), A = A.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), A = A.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), A;
|
|
3613
|
+
}, [o, v]);
|
|
3577
3614
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3578
3615
|
"div",
|
|
3579
3616
|
{
|
|
3580
3617
|
onClick: () => {
|
|
3581
|
-
r([]),
|
|
3618
|
+
r([]), f([]);
|
|
3582
3619
|
},
|
|
3583
3620
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
3584
3621
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -3591,19 +3628,19 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3591
3628
|
id: "canvas-iframe",
|
|
3592
3629
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3593
3630
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3594
|
-
initialContent:
|
|
3631
|
+
initialContent: w,
|
|
3595
3632
|
children: [
|
|
3596
3633
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3597
3634
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3598
3635
|
BlockActionsStatic,
|
|
3599
3636
|
{
|
|
3600
3637
|
block: a,
|
|
3601
|
-
selectedBlockElement: first(
|
|
3638
|
+
selectedBlockElement: first(m)
|
|
3602
3639
|
}
|
|
3603
3640
|
),
|
|
3604
3641
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
|
|
3605
3642
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
3606
|
-
|
|
3643
|
+
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
3607
3644
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
3608
3645
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3609
3646
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -3714,7 +3751,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3714
3751
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3715
3752
|
] }, l))
|
|
3716
3753
|
] }) });
|
|
3717
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3754
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-NKqXoCPq.js")), CanvasArea = () => {
|
|
3718
3755
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3719
3756
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3720
3757
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3789,20 +3826,20 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3789
3826
|
showHeading: o = !0,
|
|
3790
3827
|
className: n = ""
|
|
3791
3828
|
}) => {
|
|
3792
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3793
|
-
|
|
3829
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
|
|
3830
|
+
A && (a(w), i.current = w);
|
|
3794
3831
|
}, {
|
|
3795
3832
|
bodyFont: u,
|
|
3796
3833
|
headingFont: p,
|
|
3797
|
-
primaryColor:
|
|
3834
|
+
primaryColor: m,
|
|
3798
3835
|
bodyTextDarkColor: x,
|
|
3799
|
-
bodyTextLightColor:
|
|
3836
|
+
bodyTextLightColor: g,
|
|
3800
3837
|
bodyBgDarkColor: E,
|
|
3801
|
-
secondaryColor:
|
|
3802
|
-
bodyBgLightColor:
|
|
3803
|
-
roundedCorners:
|
|
3838
|
+
secondaryColor: b,
|
|
3839
|
+
bodyBgLightColor: f,
|
|
3840
|
+
roundedCorners: _
|
|
3804
3841
|
} = r;
|
|
3805
|
-
let
|
|
3842
|
+
let v = {
|
|
3806
3843
|
headingFont: y({
|
|
3807
3844
|
title: c("theme_config.heading_font"),
|
|
3808
3845
|
default: p,
|
|
@@ -3815,16 +3852,16 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3815
3852
|
}),
|
|
3816
3853
|
roundedCorners: s({
|
|
3817
3854
|
title: c("theme_config.rounded_corner"),
|
|
3818
|
-
default: parseInt(
|
|
3855
|
+
default: parseInt(_ || 5, 10)
|
|
3819
3856
|
}),
|
|
3820
|
-
primaryColor: h({ title: c("theme_config.primary"), default:
|
|
3821
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3857
|
+
primaryColor: h({ title: c("theme_config.primary"), default: m }),
|
|
3858
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: b })
|
|
3822
3859
|
};
|
|
3823
|
-
l || (
|
|
3824
|
-
...
|
|
3860
|
+
l || (v = {
|
|
3861
|
+
...v,
|
|
3825
3862
|
bodyBgLightColor: h({
|
|
3826
3863
|
title: c("theme_config.background"),
|
|
3827
|
-
default:
|
|
3864
|
+
default: f
|
|
3828
3865
|
}),
|
|
3829
3866
|
bodyTextLightColor: h({
|
|
3830
3867
|
title: c("theme_config.text_color"),
|
|
@@ -3836,16 +3873,16 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3836
3873
|
}),
|
|
3837
3874
|
bodyTextDarkColor: h({
|
|
3838
3875
|
title: c("theme_config.text_color_dark_mode"),
|
|
3839
|
-
default:
|
|
3876
|
+
default: g
|
|
3840
3877
|
})
|
|
3841
3878
|
});
|
|
3842
3879
|
const S = {
|
|
3843
3880
|
type: "object",
|
|
3844
3881
|
properties: {}
|
|
3845
3882
|
}, B = {};
|
|
3846
|
-
return Object.keys(
|
|
3847
|
-
const
|
|
3848
|
-
return S.properties || (S.properties = {}), S.properties[
|
|
3883
|
+
return Object.keys(v).forEach((w) => {
|
|
3884
|
+
const A = v[w];
|
|
3885
|
+
return S.properties || (S.properties = {}), S.properties[w] = A.schema, B[w] = A.uiSchema, !0;
|
|
3849
3886
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3850
3887
|
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,
|
|
3851
3888
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4041,34 +4078,34 @@ function BiExpandVertical(o) {
|
|
|
4041
4078
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4042
4079
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4043
4080
|
let p = null;
|
|
4044
|
-
const
|
|
4081
|
+
const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: b, isDragging: f, isEditing: _, handleClick: v } = o, S = (T) => {
|
|
4045
4082
|
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4046
4083
|
}, B = (T) => {
|
|
4047
4084
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
4048
|
-
}, C = (T) => {
|
|
4049
|
-
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4050
4085
|
}, w = (T) => {
|
|
4051
|
-
T.
|
|
4086
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4087
|
+
}, A = (T) => {
|
|
4088
|
+
T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), v(T);
|
|
4052
4089
|
};
|
|
4053
4090
|
useEffect(() => {
|
|
4054
4091
|
const T = setTimeout(() => {
|
|
4055
|
-
|
|
4092
|
+
b && !o.isOpen && !f && !i.includes(x) && o.toggle();
|
|
4056
4093
|
}, 500);
|
|
4057
4094
|
return () => clearTimeout(T);
|
|
4058
|
-
}, [
|
|
4095
|
+
}, [b, o, f]);
|
|
4059
4096
|
const N = useMemo(() => {
|
|
4060
|
-
const T = Object.keys(
|
|
4061
|
-
for (let
|
|
4062
|
-
if (T[
|
|
4063
|
-
const
|
|
4064
|
-
|
|
4097
|
+
const T = Object.keys(g), j = [];
|
|
4098
|
+
for (let k = 0; k < T.length; k++)
|
|
4099
|
+
if (T[k].endsWith("_attrs")) {
|
|
4100
|
+
const C = g[T[k]], R = Object.keys(C).join("|");
|
|
4101
|
+
R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
|
|
4065
4102
|
}
|
|
4066
|
-
return
|
|
4067
|
-
}, [
|
|
4068
|
-
const
|
|
4069
|
-
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4103
|
+
return j;
|
|
4104
|
+
}, [g]), D = (T, j) => {
|
|
4105
|
+
const k = u.contentDocument || u.contentWindow.document, C = k.querySelector(`[data-block-id=${T}]`);
|
|
4106
|
+
C && C.setAttribute("data-drop", j);
|
|
4107
|
+
const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
4108
|
+
R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (k.documentElement.scrollTop = C.offsetTop - I.top);
|
|
4072
4109
|
};
|
|
4073
4110
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4074
4111
|
"button",
|
|
@@ -4084,12 +4121,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4084
4121
|
"div",
|
|
4085
4122
|
{
|
|
4086
4123
|
onMouseEnter: () => d(x),
|
|
4087
|
-
onClick:
|
|
4124
|
+
onClick: A,
|
|
4088
4125
|
style: n,
|
|
4089
4126
|
"data-node-id": x,
|
|
4090
4127
|
ref: i.includes(x) ? null : r,
|
|
4091
4128
|
onDragStart: () => B(o),
|
|
4092
|
-
onDragEnd: () =>
|
|
4129
|
+
onDragEnd: () => w(o),
|
|
4093
4130
|
onDragOver: (T) => {
|
|
4094
4131
|
T.preventDefault(), D(x, "yes");
|
|
4095
4132
|
},
|
|
@@ -4102,8 +4139,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4102
4139
|
className: cn(
|
|
4103
4140
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4104
4141
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4105
|
-
|
|
4106
|
-
|
|
4142
|
+
b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
|
|
4143
|
+
f && "opacity-20",
|
|
4107
4144
|
i.includes(x) ? "opacity-50" : ""
|
|
4108
4145
|
),
|
|
4109
4146
|
children: [
|
|
@@ -4112,12 +4149,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4112
4149
|
"div",
|
|
4113
4150
|
{
|
|
4114
4151
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
4115
|
-
children:
|
|
4152
|
+
children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4116
4153
|
}
|
|
4117
4154
|
),
|
|
4118
4155
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4119
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4120
|
-
|
|
4156
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
|
|
4157
|
+
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4121
4158
|
"div",
|
|
4122
4159
|
{
|
|
4123
4160
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
@@ -4125,7 +4162,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4125
4162
|
T.stopPropagation(), o.edit(), o.deselect();
|
|
4126
4163
|
},
|
|
4127
4164
|
children: [
|
|
4128
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4165
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
|
|
4129
4166
|
N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4130
4167
|
N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4131
4168
|
N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
@@ -4146,7 +4183,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4146
4183
|
),
|
|
4147
4184
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
|
|
4148
4185
|
] })),
|
|
4149
|
-
canAddChildBlock(
|
|
4186
|
+
canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4150
4187
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4151
4188
|
TooltipTrigger,
|
|
4152
4189
|
{
|
|
@@ -4518,8 +4555,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4518
4555
|
const c = stringify([r]);
|
|
4519
4556
|
return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
|
|
4520
4557
|
} else if (r.tagName === "svg") {
|
|
4521
|
-
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",
|
|
4522
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`,
|
|
4558
|
+
const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4559
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
|
|
4523
4560
|
} else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
|
|
4524
4561
|
return n.block.options.push({
|
|
4525
4562
|
label: getTextContent(r.children),
|
|
@@ -4580,57 +4617,57 @@ function ExpandableObject(o) {
|
|
|
4580
4617
|
level: d,
|
|
4581
4618
|
style: u,
|
|
4582
4619
|
shouldExpandNode: p,
|
|
4583
|
-
clickToExpandNode:
|
|
4620
|
+
clickToExpandNode: m
|
|
4584
4621
|
} = o;
|
|
4585
|
-
const x = useRef(!1), [
|
|
4622
|
+
const x = useRef(!1), [g, E, b] = useBool(() => p(d, r, n));
|
|
4586
4623
|
useEffect(() => {
|
|
4587
|
-
x.current ?
|
|
4624
|
+
x.current ? b(p(d, r, n)) : x.current = !0;
|
|
4588
4625
|
}, [p]);
|
|
4589
|
-
const
|
|
4590
|
-
|
|
4626
|
+
const f = g ? u.collapseIcon : u.expandIcon, _ = g ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, w = (A) => {
|
|
4627
|
+
A.key === " " && (A.preventDefault(), E());
|
|
4591
4628
|
};
|
|
4592
4629
|
return /* @__PURE__ */ createElement("div", {
|
|
4593
4630
|
className: u.basicChildStyle,
|
|
4594
4631
|
role: "list"
|
|
4595
4632
|
}, /* @__PURE__ */ createElement("span", {
|
|
4596
|
-
className:
|
|
4633
|
+
className: f,
|
|
4597
4634
|
onClick: E,
|
|
4598
|
-
onKeyDown:
|
|
4635
|
+
onKeyDown: w,
|
|
4599
4636
|
role: "button",
|
|
4600
4637
|
tabIndex: 0,
|
|
4601
|
-
"aria-label":
|
|
4602
|
-
"aria-expanded":
|
|
4603
|
-
"aria-controls":
|
|
4604
|
-
}), n && (
|
|
4638
|
+
"aria-label": _,
|
|
4639
|
+
"aria-expanded": g,
|
|
4640
|
+
"aria-controls": g ? v : void 0
|
|
4641
|
+
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4605
4642
|
className: u.clickableLabel,
|
|
4606
4643
|
onClick: E,
|
|
4607
|
-
onKeyDown:
|
|
4644
|
+
onKeyDown: w,
|
|
4608
4645
|
role: "button",
|
|
4609
4646
|
tabIndex: -1
|
|
4610
4647
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
4611
4648
|
className: u.label
|
|
4612
4649
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4613
4650
|
className: u.punctuation
|
|
4614
|
-
}, i),
|
|
4615
|
-
id:
|
|
4616
|
-
}, a.map((
|
|
4617
|
-
key:
|
|
4618
|
-
field:
|
|
4619
|
-
value:
|
|
4651
|
+
}, i), g ? /* @__PURE__ */ createElement("div", {
|
|
4652
|
+
id: v
|
|
4653
|
+
}, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4654
|
+
key: A[0] || N,
|
|
4655
|
+
field: A[0],
|
|
4656
|
+
value: A[1],
|
|
4620
4657
|
style: u,
|
|
4621
4658
|
lastElement: N === B,
|
|
4622
4659
|
level: S,
|
|
4623
4660
|
shouldExpandNode: p,
|
|
4624
|
-
clickToExpandNode:
|
|
4661
|
+
clickToExpandNode: m
|
|
4625
4662
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4626
4663
|
className: u.collapsedContent,
|
|
4627
4664
|
onClick: E,
|
|
4628
|
-
onKeyDown:
|
|
4665
|
+
onKeyDown: w,
|
|
4629
4666
|
role: "button",
|
|
4630
4667
|
tabIndex: -1,
|
|
4631
4668
|
"aria-hidden": !0,
|
|
4632
|
-
"aria-label":
|
|
4633
|
-
"aria-expanded":
|
|
4669
|
+
"aria-label": _,
|
|
4670
|
+
"aria-expanded": g
|
|
4634
4671
|
}), /* @__PURE__ */ createElement("span", {
|
|
4635
4672
|
className: u.punctuation
|
|
4636
4673
|
}, c), !l && /* @__PURE__ */ createElement("span", {
|
|
@@ -4783,15 +4820,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4783
4820
|
dataType: i,
|
|
4784
4821
|
appliedBindings: c
|
|
4785
4822
|
}) => {
|
|
4786
|
-
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {},
|
|
4787
|
-
(
|
|
4788
|
-
) : d.filter((
|
|
4823
|
+
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
|
|
4824
|
+
(b) => !includes(c, b) && get(p, `props.${first(split(b, "."))}.binding`)
|
|
4825
|
+
) : d.filter((b) => i === get(u, b, "")), [o, d, c, i, p]);
|
|
4789
4826
|
return useEffect(() => {
|
|
4790
4827
|
n && l(n);
|
|
4791
4828
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4792
4829
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
4793
4830
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
|
|
4794
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange:
|
|
4831
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
|
|
4795
4832
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4796
4833
|
Button,
|
|
4797
4834
|
{
|
|
@@ -4800,7 +4837,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4800
4837
|
className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
|
|
4801
4838
|
children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4802
4839
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
|
|
4803
|
-
|
|
4840
|
+
m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
|
|
4804
4841
|
n
|
|
4805
4842
|
] }),
|
|
4806
4843
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
|
|
@@ -4814,29 +4851,29 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4814
4851
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4815
4852
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4816
4853
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4817
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (
|
|
4854
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4818
4855
|
CommandItem,
|
|
4819
4856
|
{
|
|
4820
|
-
value:
|
|
4821
|
-
className: `cursor-pointer ${
|
|
4822
|
-
onSelect: (
|
|
4823
|
-
r(find(E, (
|
|
4857
|
+
value: b,
|
|
4858
|
+
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4859
|
+
onSelect: (f) => {
|
|
4860
|
+
r(find(E, (_) => _ === f) || null), g(!1);
|
|
4824
4861
|
},
|
|
4825
4862
|
children: [
|
|
4826
4863
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4827
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4828
|
-
|
|
4864
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
|
|
4865
|
+
b
|
|
4829
4866
|
] }),
|
|
4830
|
-
|
|
4867
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
|
|
4831
4868
|
]
|
|
4832
4869
|
},
|
|
4833
|
-
|
|
4870
|
+
b
|
|
4834
4871
|
)) })
|
|
4835
4872
|
] })
|
|
4836
4873
|
] }) })
|
|
4837
4874
|
] })
|
|
4838
4875
|
] }),
|
|
4839
|
-
!
|
|
4876
|
+
!m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
|
|
4840
4877
|
] });
|
|
4841
4878
|
}, AddBindingModalContent = ({
|
|
4842
4879
|
appliedBindings: o = [],
|
|
@@ -4844,20 +4881,20 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4844
4881
|
editMode: r,
|
|
4845
4882
|
item: a
|
|
4846
4883
|
}) => {
|
|
4847
|
-
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(),
|
|
4848
|
-
(E,
|
|
4884
|
+
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4885
|
+
(E, b) => {
|
|
4849
4886
|
if (isEmpty(E))
|
|
4850
4887
|
return "";
|
|
4851
4888
|
{
|
|
4852
|
-
const
|
|
4853
|
-
if (isArray$1(
|
|
4889
|
+
const f = get(b === "PROP" ? u : p, E, "");
|
|
4890
|
+
if (isArray$1(f))
|
|
4854
4891
|
return "list";
|
|
4855
|
-
const
|
|
4856
|
-
return
|
|
4892
|
+
const _ = typeof f;
|
|
4893
|
+
return _ === "string" ? "text" : _ === "object" ? "model" : _;
|
|
4857
4894
|
}
|
|
4858
4895
|
},
|
|
4859
4896
|
[u, p]
|
|
4860
|
-
), [x,
|
|
4897
|
+
), [x, g] = useState(r ? m(a.key, "PROP") : "");
|
|
4861
4898
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4862
4899
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
|
|
4863
4900
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
|
|
@@ -4873,8 +4910,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4873
4910
|
value: l,
|
|
4874
4911
|
setValue: i,
|
|
4875
4912
|
onChange: (E) => {
|
|
4876
|
-
const
|
|
4877
|
-
i(E), x !==
|
|
4913
|
+
const b = m(E, "PROP");
|
|
4914
|
+
i(E), x !== b && d(""), g(b);
|
|
4878
4915
|
},
|
|
4879
4916
|
data: u,
|
|
4880
4917
|
dataType: x,
|
|
@@ -4891,8 +4928,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4891
4928
|
value: c,
|
|
4892
4929
|
setValue: d,
|
|
4893
4930
|
onChange: (E) => {
|
|
4894
|
-
const
|
|
4895
|
-
d(x ===
|
|
4931
|
+
const b = m(E, "PATH");
|
|
4932
|
+
d(x === b ? E : "");
|
|
4896
4933
|
},
|
|
4897
4934
|
data: p,
|
|
4898
4935
|
dataType: x,
|
|
@@ -4935,15 +4972,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4935
4972
|
dataProvider: l,
|
|
4936
4973
|
appliedBindings: i
|
|
4937
4974
|
}) => {
|
|
4938
|
-
const [c, d] = useState("string"), u = (p,
|
|
4975
|
+
const [c, d] = useState("string"), u = (p, m) => {
|
|
4939
4976
|
if (isEmpty(p))
|
|
4940
4977
|
return "";
|
|
4941
4978
|
{
|
|
4942
|
-
const x = get(
|
|
4979
|
+
const x = get(m === "PROP" ? a : l, p, "");
|
|
4943
4980
|
if (isArray$1(x))
|
|
4944
4981
|
return "list";
|
|
4945
|
-
const
|
|
4946
|
-
return
|
|
4982
|
+
const g = typeof x;
|
|
4983
|
+
return g === "string" ? "text" : g === "object" ? "model" : g;
|
|
4947
4984
|
}
|
|
4948
4985
|
};
|
|
4949
4986
|
return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
|
|
@@ -4964,10 +5001,10 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4964
5001
|
] });
|
|
4965
5002
|
}, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
|
|
4966
5003
|
const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
|
|
4967
|
-
map(o, (x,
|
|
5004
|
+
map(o, (x, g) => ({ key: g, value: x }))
|
|
4968
5005
|
);
|
|
4969
5006
|
useEffect(() => {
|
|
4970
|
-
c(map(o, (x,
|
|
5007
|
+
c(map(o, (x, g) => ({ key: g, value: x })));
|
|
4971
5008
|
}, [r == null ? void 0 : r._id, o]);
|
|
4972
5009
|
const d = useMemo(() => {
|
|
4973
5010
|
if (isEmpty(a))
|
|
@@ -4977,21 +5014,21 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4977
5014
|
const x = last(i);
|
|
4978
5015
|
return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
|
|
4979
5016
|
}, [a, i]), u = (x) => {
|
|
4980
|
-
const
|
|
4981
|
-
c([...
|
|
5017
|
+
const g = filter(i, (E) => E.key !== x.key);
|
|
5018
|
+
c([...g, x]), m([...g, x]);
|
|
4982
5019
|
}, p = (x) => {
|
|
4983
|
-
const
|
|
4984
|
-
|
|
4985
|
-
},
|
|
5020
|
+
const g = filter(i, (E, b) => x !== b);
|
|
5021
|
+
m([...g]);
|
|
5022
|
+
}, m = useCallback(
|
|
4986
5023
|
(x = []) => {
|
|
4987
5024
|
if (c(x), isEmpty(x)) {
|
|
4988
5025
|
n({});
|
|
4989
5026
|
return;
|
|
4990
5027
|
}
|
|
4991
|
-
const
|
|
5028
|
+
const g = {};
|
|
4992
5029
|
forEach(x, (E) => {
|
|
4993
|
-
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(
|
|
4994
|
-
}), n(
|
|
5030
|
+
!isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
|
|
5031
|
+
}), n(g);
|
|
4995
5032
|
},
|
|
4996
5033
|
[n]
|
|
4997
5034
|
);
|
|
@@ -5000,12 +5037,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5000
5037
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
5001
5038
|
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
5002
5039
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
5003
|
-
map(i, (x,
|
|
5040
|
+
map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5004
5041
|
NewDataBindingPair,
|
|
5005
5042
|
{
|
|
5006
5043
|
item: x,
|
|
5007
5044
|
onAddBinding: u,
|
|
5008
|
-
onRemove: () => p(
|
|
5045
|
+
onRemove: () => p(g),
|
|
5009
5046
|
selectedBlock: r,
|
|
5010
5047
|
dataProvider: a,
|
|
5011
5048
|
appliedBindings: map(i, "key")
|
|
@@ -5099,7 +5136,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5099
5136
|
}
|
|
5100
5137
|
)
|
|
5101
5138
|
] });
|
|
5102
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5139
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Z3xcNddA.js")), UploadImages = React__default.lazy(() => import("./UploadImages-v50EQZLT.js")), ImagesPanel = ({
|
|
5103
5140
|
isModalView: o = !1,
|
|
5104
5141
|
onSelect: n = () => {
|
|
5105
5142
|
}
|
|
@@ -5128,11 +5165,11 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5128
5165
|
};
|
|
5129
5166
|
ImagePickerModal.displayName = "ImagePickerModal";
|
|
5130
5167
|
const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
5131
|
-
const l = useBuilderProp("uploadMediaCallback"), i = useBuilderProp("unsplashAccessKey"), { t: c } = useTranslation(), d = l
|
|
5168
|
+
const l = useBuilderProp("uploadMediaCallback"), i = useBuilderProp("unsplashAccessKey"), { t: c } = useTranslation(), d = l !== void 0 || i !== void 0;
|
|
5132
5169
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
5133
5170
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
5134
5171
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
5135
|
-
|
|
5172
|
+
d && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5136
5173
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? c("Replace image") : c("Choose image") }) }),
|
|
5137
5174
|
/* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
|
|
5138
5175
|
] }),
|
|
@@ -5146,8 +5183,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5146
5183
|
className: "text-xs",
|
|
5147
5184
|
placeholder: c("enter_image_url"),
|
|
5148
5185
|
value: o,
|
|
5149
|
-
onBlur: ({ target: { value:
|
|
5150
|
-
onChange: (
|
|
5186
|
+
onBlur: ({ target: { value: u } }) => a(r, u),
|
|
5187
|
+
onChange: (u) => n(u.target.value)
|
|
5151
5188
|
}
|
|
5152
5189
|
)
|
|
5153
5190
|
] })
|
|
@@ -5258,19 +5295,19 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5258
5295
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
|
|
5259
5296
|
] });
|
|
5260
5297
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5261
|
-
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
|
|
5262
|
-
Object.keys(n).forEach((
|
|
5263
|
-
const
|
|
5264
|
-
if (includes(["slot", "styles"],
|
|
5298
|
+
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: x } = useLanguages(), g = x.length === 0 ? "" : p.length ? p : m;
|
|
5299
|
+
Object.keys(n).forEach((b) => {
|
|
5300
|
+
const f = n[b];
|
|
5301
|
+
if (includes(["slot", "styles"], f.type))
|
|
5265
5302
|
return;
|
|
5266
|
-
const
|
|
5267
|
-
c.properties[
|
|
5303
|
+
const _ = b;
|
|
5304
|
+
c.properties[_] = getBlockJSONFromSchemas(f, u, g), d[_] = getBlockJSONFromUISchemas(f);
|
|
5268
5305
|
}), useEffect(() => {
|
|
5269
5306
|
i(r);
|
|
5270
|
-
}, [o]);
|
|
5271
|
-
const
|
|
5272
|
-
async ({ formData:
|
|
5273
|
-
a({ formData:
|
|
5307
|
+
}, [o, p]);
|
|
5308
|
+
const E = useThrottledCallback(
|
|
5309
|
+
async ({ formData: b }, f) => {
|
|
5310
|
+
a({ formData: b }, f);
|
|
5274
5311
|
},
|
|
5275
5312
|
[a],
|
|
5276
5313
|
1e3
|
|
@@ -5296,8 +5333,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5296
5333
|
uiSchema: d,
|
|
5297
5334
|
schema: c,
|
|
5298
5335
|
formData: l,
|
|
5299
|
-
onChange: ({ formData:
|
|
5300
|
-
|
|
5336
|
+
onChange: ({ formData: b }, f) => {
|
|
5337
|
+
f && (i(b), E({ formData: b }, f));
|
|
5301
5338
|
}
|
|
5302
5339
|
}
|
|
5303
5340
|
);
|
|
@@ -5359,40 +5396,45 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5359
5396
|
}, ResetRSCBlockButton = ({ blockId: o }) => {
|
|
5360
5397
|
const { t: n } = useTranslation(), { reset: r } = useRSCBlocksStore();
|
|
5361
5398
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
|
|
5399
|
+
}, formDataWithSelectedLang = (o, n, r) => {
|
|
5400
|
+
const a = cloneDeep(o);
|
|
5401
|
+
return forEach(keys(o), (l) => {
|
|
5402
|
+
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
|
|
5403
|
+
}), a;
|
|
5362
5404
|
};
|
|
5363
5405
|
function BlockSettings() {
|
|
5364
|
-
const o =
|
|
5365
|
-
if (
|
|
5366
|
-
const
|
|
5367
|
-
|
|
5406
|
+
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 }, _, v) => {
|
|
5407
|
+
if (_ && (c == null ? void 0 : c._id) === n._id) {
|
|
5408
|
+
const S = _.replace("root.", "");
|
|
5409
|
+
a([n._id], { [S]: get(f, S) }, v);
|
|
5368
5410
|
}
|
|
5369
|
-
},
|
|
5370
|
-
debounce(({ formData: f },
|
|
5371
|
-
|
|
5411
|
+
}, m = useCallback(
|
|
5412
|
+
debounce(({ formData: f }, _, v) => {
|
|
5413
|
+
p({ formData: f }, _, v), d(f);
|
|
5372
5414
|
}, 1500),
|
|
5373
|
-
[
|
|
5374
|
-
),
|
|
5375
|
-
if (
|
|
5376
|
-
const
|
|
5377
|
-
|
|
5378
|
-
[
|
|
5379
|
-
convertDotNotationToObject(
|
|
5380
|
-
),
|
|
5415
|
+
[n == null ? void 0 : n._id, o]
|
|
5416
|
+
), x = ({ formData: f }, _) => {
|
|
5417
|
+
if (_) {
|
|
5418
|
+
const v = _.replace("root.", "");
|
|
5419
|
+
r(
|
|
5420
|
+
[n._id],
|
|
5421
|
+
convertDotNotationToObject(v, get(f, v.split(".")))
|
|
5422
|
+
), m({ formData: f }, _, { [v]: get(c, v) });
|
|
5381
5423
|
}
|
|
5382
|
-
},
|
|
5383
|
-
const f = cloneDeep(get(
|
|
5384
|
-
return each(f, (
|
|
5385
|
-
get(
|
|
5386
|
-
}),
|
|
5387
|
-
}, [
|
|
5424
|
+
}, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
|
|
5425
|
+
const f = cloneDeep(get(l, "props", {}));
|
|
5426
|
+
return each(f, (_, v) => {
|
|
5427
|
+
get(_, "hidden", !1) && delete f[v];
|
|
5428
|
+
}), u && each(g, (_) => delete f[_]), f;
|
|
5429
|
+
}, [l, g, u]), b = get(l, "server", !1);
|
|
5388
5430
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5389
|
-
|
|
5431
|
+
u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5390
5432
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
5391
5433
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
5392
5434
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5393
5435
|
"div",
|
|
5394
5436
|
{
|
|
5395
|
-
className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(
|
|
5437
|
+
className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(n, "_bindings", {})) ? "bg-gray-300" : "bg-blue-500"}`
|
|
5396
5438
|
}
|
|
5397
5439
|
),
|
|
5398
5440
|
"Data Binding"
|
|
@@ -5400,9 +5442,9 @@ function BlockSettings() {
|
|
|
5400
5442
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5401
5443
|
DataBindingSetting$1,
|
|
5402
5444
|
{
|
|
5403
|
-
bindingData: get(
|
|
5445
|
+
bindingData: get(n, "_bindings", {}),
|
|
5404
5446
|
onChange: (f) => {
|
|
5405
|
-
|
|
5447
|
+
p({ formData: { _bindings: f } }, "root._bindings");
|
|
5406
5448
|
}
|
|
5407
5449
|
}
|
|
5408
5450
|
) })
|
|
@@ -5413,35 +5455,35 @@ function BlockSettings() {
|
|
|
5413
5455
|
"Static Content"
|
|
5414
5456
|
] }) }),
|
|
5415
5457
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
|
|
5416
|
-
isEmpty(
|
|
5458
|
+
isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
|
|
5417
5459
|
"Data binding is set for ",
|
|
5418
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(
|
|
5460
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(g, capitalize).join(", ") }),
|
|
5419
5461
|
" ",
|
|
5420
|
-
|
|
5462
|
+
g.length === 1 ? "property" : "properties",
|
|
5421
5463
|
". Remove data binding to edit static content."
|
|
5422
5464
|
] }),
|
|
5423
5465
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5424
5466
|
JSONForm,
|
|
5425
5467
|
{
|
|
5426
|
-
id:
|
|
5427
|
-
onChange:
|
|
5428
|
-
formData:
|
|
5429
|
-
properties:
|
|
5468
|
+
id: n == null ? void 0 : n._id,
|
|
5469
|
+
onChange: x,
|
|
5470
|
+
formData: i,
|
|
5471
|
+
properties: E
|
|
5430
5472
|
}
|
|
5431
5473
|
)
|
|
5432
5474
|
] })
|
|
5433
5475
|
] })
|
|
5434
|
-
] }) : isEmpty(
|
|
5476
|
+
] }) : isEmpty(E) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5435
5477
|
JSONForm,
|
|
5436
5478
|
{
|
|
5437
|
-
id:
|
|
5438
|
-
onChange:
|
|
5439
|
-
formData:
|
|
5440
|
-
properties:
|
|
5479
|
+
id: n == null ? void 0 : n._id,
|
|
5480
|
+
onChange: x,
|
|
5481
|
+
formData: i,
|
|
5482
|
+
properties: E
|
|
5441
5483
|
}
|
|
5442
5484
|
),
|
|
5443
|
-
(
|
|
5444
|
-
|
|
5485
|
+
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5486
|
+
b ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
|
|
5445
5487
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5446
5488
|
] });
|
|
5447
5489
|
}
|
|
@@ -5455,26 +5497,35 @@ function getChildBlocks(o, n, r) {
|
|
|
5455
5497
|
const getBlockWithChildren = (o, n) => {
|
|
5456
5498
|
let r = [];
|
|
5457
5499
|
return r = flattenDeep([...r, ...getChildBlocks(n, o, r)]), r;
|
|
5458
|
-
}
|
|
5459
|
-
|
|
5500
|
+
};
|
|
5501
|
+
function promptWithLanguage(o, n, r) {
|
|
5502
|
+
if (!n || r !== "content")
|
|
5503
|
+
return o;
|
|
5504
|
+
const a = `Please provide the response in "${n}" language.`;
|
|
5505
|
+
return `${o}
|
|
5506
|
+
|
|
5507
|
+
${a}`;
|
|
5508
|
+
}
|
|
5509
|
+
const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
5510
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), m = u.length ? u : p;
|
|
5460
5511
|
return {
|
|
5461
5512
|
askAi: useCallback(
|
|
5462
|
-
async (
|
|
5513
|
+
async (x, g, E, b) => {
|
|
5463
5514
|
if (l) {
|
|
5464
5515
|
n(!0), a(null);
|
|
5465
5516
|
try {
|
|
5466
|
-
const
|
|
5467
|
-
set(
|
|
5468
|
-
const
|
|
5469
|
-
if (
|
|
5470
|
-
a(
|
|
5517
|
+
const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((B) => B._id === g))];
|
|
5518
|
+
set(f, "0._parent", null);
|
|
5519
|
+
const _ = await l(x, promptWithLanguage(E, m, x), f), { blocks: v, error: S } = _;
|
|
5520
|
+
if (S) {
|
|
5521
|
+
a(S);
|
|
5471
5522
|
return;
|
|
5472
5523
|
}
|
|
5473
|
-
|
|
5474
|
-
} catch (
|
|
5475
|
-
a(
|
|
5524
|
+
x === "styles" ? c(v) : i(v), b && b(_);
|
|
5525
|
+
} catch (f) {
|
|
5526
|
+
a(f);
|
|
5476
5527
|
} finally {
|
|
5477
|
-
n(!1),
|
|
5528
|
+
n(!1), b && b();
|
|
5478
5529
|
}
|
|
5479
5530
|
}
|
|
5480
5531
|
},
|
|
@@ -5546,14 +5597,14 @@ function Countdown() {
|
|
|
5546
5597
|
] });
|
|
5547
5598
|
}
|
|
5548
5599
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5549
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p,
|
|
5600
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
|
|
5550
5601
|
useEffect(() => {
|
|
5551
|
-
var
|
|
5552
|
-
(
|
|
5602
|
+
var g;
|
|
5603
|
+
(g = d.current) == null || g.focus();
|
|
5553
5604
|
}, []);
|
|
5554
|
-
const x = (
|
|
5555
|
-
const { usage: E } =
|
|
5556
|
-
!l && E &&
|
|
5605
|
+
const x = (g) => {
|
|
5606
|
+
const { usage: E } = g || {};
|
|
5607
|
+
!l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5557
5608
|
};
|
|
5558
5609
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5559
5610
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5562,12 +5613,12 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5562
5613
|
{
|
|
5563
5614
|
ref: d,
|
|
5564
5615
|
value: i,
|
|
5565
|
-
onChange: (
|
|
5616
|
+
onChange: (g) => c(g.target.value),
|
|
5566
5617
|
placeholder: n("ask_ai_to_edit_styles"),
|
|
5567
5618
|
className: "w-full border border-border focus:border-0",
|
|
5568
5619
|
rows: 3,
|
|
5569
|
-
onKeyDown: (
|
|
5570
|
-
|
|
5620
|
+
onKeyDown: (g) => {
|
|
5621
|
+
g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
|
|
5571
5622
|
}
|
|
5572
5623
|
}
|
|
5573
5624
|
),
|
|
@@ -5577,7 +5628,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5577
5628
|
{
|
|
5578
5629
|
disabled: i.trim().length < 5 || a,
|
|
5579
5630
|
onClick: () => {
|
|
5580
|
-
u.current && clearTimeout(u.current),
|
|
5631
|
+
u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
|
|
5581
5632
|
},
|
|
5582
5633
|
variant: "default",
|
|
5583
5634
|
className: "w-fit",
|
|
@@ -5613,25 +5664,25 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5613
5664
|
keys: ["name"]
|
|
5614
5665
|
});
|
|
5615
5666
|
function ManualClasses() {
|
|
5616
|
-
var
|
|
5617
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(),
|
|
5667
|
+
var A;
|
|
5668
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
|
|
5618
5669
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5619
5670
|
a(i, N, !0), u("");
|
|
5620
|
-
}, [E,
|
|
5671
|
+
}, [E, b] = useState([]), f = ({ value: N }) => {
|
|
5621
5672
|
const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
|
|
5622
|
-
let
|
|
5673
|
+
let j = [];
|
|
5623
5674
|
if (T && T.length > 0) {
|
|
5624
|
-
const [
|
|
5625
|
-
|
|
5675
|
+
const [k] = T, C = D.replace(k, "");
|
|
5676
|
+
j = fuse.search(C).map((I) => ({
|
|
5626
5677
|
...I,
|
|
5627
|
-
item: { ...I.item, name:
|
|
5678
|
+
item: { ...I.item, name: k + I.item.name }
|
|
5628
5679
|
}));
|
|
5629
5680
|
} else
|
|
5630
|
-
|
|
5631
|
-
return
|
|
5632
|
-
},
|
|
5633
|
-
|
|
5634
|
-
},
|
|
5681
|
+
j = fuse.search(D);
|
|
5682
|
+
return b(map(j, "item"));
|
|
5683
|
+
}, _ = () => {
|
|
5684
|
+
b([]);
|
|
5685
|
+
}, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5635
5686
|
autoComplete: "off",
|
|
5636
5687
|
autoCorrect: "off",
|
|
5637
5688
|
autoCapitalize: "off",
|
|
@@ -5639,11 +5690,11 @@ function ManualClasses() {
|
|
|
5639
5690
|
placeholder: o("enter_classes_separated_by_space"),
|
|
5640
5691
|
value: d,
|
|
5641
5692
|
onKeyDown: (N) => {
|
|
5642
|
-
N.key === "Enter" && d.trim() !== "" &&
|
|
5693
|
+
N.key === "Enter" && d.trim() !== "" && g();
|
|
5643
5694
|
},
|
|
5644
5695
|
onChange: (N, { newValue: D }) => u(D),
|
|
5645
5696
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5646
|
-
},
|
|
5697
|
+
}, w = () => {
|
|
5647
5698
|
if (navigator.clipboard === void 0) {
|
|
5648
5699
|
p({
|
|
5649
5700
|
title: o("clipboard_not_supported"),
|
|
@@ -5666,7 +5717,7 @@ function ManualClasses() {
|
|
|
5666
5717
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5667
5718
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5668
5719
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5669
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5720
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
|
|
5670
5721
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
|
|
5671
5722
|
] })
|
|
5672
5723
|
] }),
|
|
@@ -5683,9 +5734,9 @@ function ManualClasses() {
|
|
|
5683
5734
|
Autosuggest,
|
|
5684
5735
|
{
|
|
5685
5736
|
suggestions: E,
|
|
5686
|
-
onSuggestionsFetchRequested:
|
|
5687
|
-
onSuggestionsClearRequested:
|
|
5688
|
-
getSuggestionValue:
|
|
5737
|
+
onSuggestionsFetchRequested: f,
|
|
5738
|
+
onSuggestionsClearRequested: _,
|
|
5739
|
+
getSuggestionValue: v,
|
|
5689
5740
|
renderSuggestion: S,
|
|
5690
5741
|
inputProps: B,
|
|
5691
5742
|
containerProps: {
|
|
@@ -5703,7 +5754,7 @@ function ManualClasses() {
|
|
|
5703
5754
|
{
|
|
5704
5755
|
variant: "outline",
|
|
5705
5756
|
className: "h-6 border-border",
|
|
5706
|
-
onClick:
|
|
5757
|
+
onClick: g,
|
|
5707
5758
|
disabled: d.trim() === "",
|
|
5708
5759
|
size: "sm",
|
|
5709
5760
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -6117,38 +6168,38 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6117
6168
|
ringColor: "ring",
|
|
6118
6169
|
ringOffsetColor: "ring-offset"
|
|
6119
6170
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6120
|
-
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"),
|
|
6171
|
+
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
|
|
6121
6172
|
// eslint-disable-next-line no-shadow
|
|
6122
|
-
(
|
|
6123
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6173
|
+
(b) => {
|
|
6174
|
+
["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: b, shade: f.shade ? f.shade : "500" })));
|
|
6124
6175
|
},
|
|
6125
6176
|
[c, u]
|
|
6126
6177
|
);
|
|
6127
6178
|
useEffect(() => {
|
|
6128
|
-
if (["current", "inherit", "transparent", "black", "white"].includes(
|
|
6179
|
+
if (["current", "inherit", "transparent", "black", "white"].includes(m))
|
|
6129
6180
|
return c([]);
|
|
6130
6181
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6131
|
-
}, [
|
|
6182
|
+
}, [m]);
|
|
6132
6183
|
const E = useCallback(
|
|
6133
6184
|
// eslint-disable-next-line no-shadow
|
|
6134
|
-
(
|
|
6135
|
-
u({ color:
|
|
6185
|
+
(b) => {
|
|
6186
|
+
u({ color: m, shade: b });
|
|
6136
6187
|
},
|
|
6137
|
-
[
|
|
6188
|
+
[m]
|
|
6138
6189
|
);
|
|
6139
6190
|
return useEffect(() => {
|
|
6140
6191
|
u({ color: "", shade: "" });
|
|
6141
6192
|
}, [r]), useEffect(() => {
|
|
6142
|
-
const
|
|
6143
|
-
|
|
6193
|
+
const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6194
|
+
f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
|
|
6144
6195
|
}, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
6145
6196
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6146
6197
|
DropDown,
|
|
6147
6198
|
{
|
|
6148
6199
|
disabled: !l,
|
|
6149
6200
|
rounded: !0,
|
|
6150
|
-
selected:
|
|
6151
|
-
onChange:
|
|
6201
|
+
selected: m,
|
|
6202
|
+
onChange: g,
|
|
6152
6203
|
options: [
|
|
6153
6204
|
"current",
|
|
6154
6205
|
"transparent",
|
|
@@ -6181,7 +6232,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6181
6232
|
]
|
|
6182
6233
|
}
|
|
6183
6234
|
) }),
|
|
6184
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !
|
|
6235
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: E, options: i }) })
|
|
6185
6236
|
] });
|
|
6186
6237
|
}, getUserInputValues = (o, n) => {
|
|
6187
6238
|
o = o.toLowerCase();
|
|
@@ -6376,50 +6427,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6376
6427
|
},
|
|
6377
6428
|
a
|
|
6378
6429
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6379
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative:
|
|
6430
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, b] = useState(!1), [f, _] = useState(""), [v, S] = useState(!1), [B, w] = useState(!1);
|
|
6380
6431
|
useEffect(() => {
|
|
6381
|
-
const { value:
|
|
6382
|
-
if (
|
|
6383
|
-
l(
|
|
6432
|
+
const { value: j, unit: k } = getClassValueAndUnit(i);
|
|
6433
|
+
if (k === "") {
|
|
6434
|
+
l(j), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6384
6435
|
return;
|
|
6385
6436
|
}
|
|
6386
|
-
|
|
6437
|
+
g(k), l(k === "class" || isEmpty(j) ? "" : j);
|
|
6387
6438
|
}, [i, u, p]);
|
|
6388
|
-
const
|
|
6389
|
-
(
|
|
6390
|
-
const
|
|
6391
|
-
if (get(
|
|
6392
|
-
|
|
6439
|
+
const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6440
|
+
(j = !1) => {
|
|
6441
|
+
const k = getUserInputValues(`${a}`, p);
|
|
6442
|
+
if (get(k, "error", !1)) {
|
|
6443
|
+
b(!0);
|
|
6393
6444
|
return;
|
|
6394
6445
|
}
|
|
6395
|
-
const
|
|
6396
|
-
if (
|
|
6397
|
-
|
|
6446
|
+
const C = get(k, "unit") !== "" ? get(k, "unit") : x;
|
|
6447
|
+
if (C === "auto" || C === "none") {
|
|
6448
|
+
A(`${d}${C}`);
|
|
6398
6449
|
return;
|
|
6399
6450
|
}
|
|
6400
|
-
if (get(
|
|
6451
|
+
if (get(k, "value") === "")
|
|
6401
6452
|
return;
|
|
6402
|
-
const I = `${get(
|
|
6403
|
-
|
|
6453
|
+
const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6454
|
+
j ? N(I) : A(I);
|
|
6404
6455
|
},
|
|
6405
|
-
[
|
|
6456
|
+
[A, N, a, x, d, p]
|
|
6406
6457
|
), T = useCallback(
|
|
6407
|
-
(
|
|
6408
|
-
const
|
|
6409
|
-
if (get(
|
|
6410
|
-
|
|
6458
|
+
(j) => {
|
|
6459
|
+
const k = getUserInputValues(`${a}`, p);
|
|
6460
|
+
if (get(k, "error", !1)) {
|
|
6461
|
+
b(!0);
|
|
6411
6462
|
return;
|
|
6412
6463
|
}
|
|
6413
|
-
if (
|
|
6414
|
-
|
|
6464
|
+
if (j === "auto" || j === "none") {
|
|
6465
|
+
A(`${d}${j}`);
|
|
6415
6466
|
return;
|
|
6416
6467
|
}
|
|
6417
|
-
if (get(
|
|
6468
|
+
if (get(k, "value") === "")
|
|
6418
6469
|
return;
|
|
6419
|
-
const
|
|
6420
|
-
|
|
6470
|
+
const C = get(k, "unit") !== "" ? get(k, "unit") : j, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6471
|
+
A(I);
|
|
6421
6472
|
},
|
|
6422
|
-
[
|
|
6473
|
+
[A, a, d, p]
|
|
6423
6474
|
);
|
|
6424
6475
|
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: [
|
|
6425
6476
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
@@ -6427,37 +6478,37 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6427
6478
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
|
|
6428
6479
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6429
6480
|
] })
|
|
6430
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6481
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
|
|
6431
6482
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6432
6483
|
["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6433
6484
|
"input",
|
|
6434
6485
|
{
|
|
6435
6486
|
readOnly: x === "class",
|
|
6436
|
-
onKeyPress: (
|
|
6437
|
-
|
|
6487
|
+
onKeyPress: (j) => {
|
|
6488
|
+
j.key === "Enter" && D();
|
|
6438
6489
|
},
|
|
6439
|
-
onKeyDown: (
|
|
6440
|
-
if (
|
|
6490
|
+
onKeyDown: (j) => {
|
|
6491
|
+
if (j.keyCode !== 38 && j.keyCode !== 40)
|
|
6441
6492
|
return;
|
|
6442
|
-
|
|
6443
|
-
const
|
|
6444
|
-
let
|
|
6445
|
-
|
|
6446
|
-
const
|
|
6493
|
+
j.preventDefault(), w(!0);
|
|
6494
|
+
const k = parseInt$1(j.target.value);
|
|
6495
|
+
let C = isNaN$1(k) ? 0 : k;
|
|
6496
|
+
j.keyCode === 38 && (C += 1), j.keyCode === 40 && (C -= 1);
|
|
6497
|
+
const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6447
6498
|
N(L);
|
|
6448
6499
|
},
|
|
6449
|
-
onKeyUp: (
|
|
6450
|
-
B && (
|
|
6500
|
+
onKeyUp: (j) => {
|
|
6501
|
+
B && (j.preventDefault(), w(!1));
|
|
6451
6502
|
},
|
|
6452
6503
|
onBlur: () => D(),
|
|
6453
|
-
onChange: (
|
|
6454
|
-
|
|
6504
|
+
onChange: (j) => {
|
|
6505
|
+
b(!1), l(j.target.value);
|
|
6455
6506
|
},
|
|
6456
|
-
onClick: (
|
|
6457
|
-
var
|
|
6458
|
-
(
|
|
6507
|
+
onClick: (j) => {
|
|
6508
|
+
var k;
|
|
6509
|
+
(k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
|
|
6459
6510
|
},
|
|
6460
|
-
value:
|
|
6511
|
+
value: v ? f : a,
|
|
6461
6512
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6462
6513
|
" ",
|
|
6463
6514
|
E ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -6482,33 +6533,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6482
6533
|
{
|
|
6483
6534
|
units: p,
|
|
6484
6535
|
current: x,
|
|
6485
|
-
onSelect: (
|
|
6486
|
-
r(!1),
|
|
6536
|
+
onSelect: (j) => {
|
|
6537
|
+
r(!1), g(j), T(j);
|
|
6487
6538
|
}
|
|
6488
6539
|
}
|
|
6489
6540
|
) }) })
|
|
6490
6541
|
] })
|
|
6491
6542
|
] }),
|
|
6492
|
-
["none", "auto"].indexOf(x) !== -1 ||
|
|
6543
|
+
["none", "auto"].indexOf(x) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6493
6544
|
DragStyleButton,
|
|
6494
6545
|
{
|
|
6495
6546
|
onDragStart: () => S(!0),
|
|
6496
|
-
onDragEnd: (
|
|
6497
|
-
if (
|
|
6547
|
+
onDragEnd: (j) => {
|
|
6548
|
+
if (_(() => ""), S(!1), isEmpty(j))
|
|
6498
6549
|
return;
|
|
6499
|
-
const
|
|
6500
|
-
|
|
6550
|
+
const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6551
|
+
A(R);
|
|
6501
6552
|
},
|
|
6502
|
-
onDrag: (
|
|
6503
|
-
if (isEmpty(
|
|
6553
|
+
onDrag: (j) => {
|
|
6554
|
+
if (isEmpty(j))
|
|
6504
6555
|
return;
|
|
6505
|
-
|
|
6506
|
-
const
|
|
6507
|
-
N(
|
|
6556
|
+
_(j);
|
|
6557
|
+
const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6558
|
+
N(R);
|
|
6508
6559
|
},
|
|
6509
6560
|
currentValue: a,
|
|
6510
6561
|
unit: x,
|
|
6511
|
-
negative:
|
|
6562
|
+
negative: m,
|
|
6512
6563
|
cssProperty: u
|
|
6513
6564
|
}
|
|
6514
6565
|
)
|
|
@@ -6601,21 +6652,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6601
6652
|
"2xl": "1536px"
|
|
6602
6653
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6603
6654
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6604
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [,
|
|
6655
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), _ = useCallback(
|
|
6605
6656
|
(N, D = !0) => {
|
|
6606
|
-
const T = { dark: u, mq:
|
|
6657
|
+
const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
|
|
6607
6658
|
(u || p !== "") && (T.mq = "xs");
|
|
6608
|
-
const
|
|
6609
|
-
|
|
6659
|
+
const j = generateFullClsName(T);
|
|
6660
|
+
g(b, [j], D);
|
|
6610
6661
|
},
|
|
6611
|
-
[
|
|
6612
|
-
),
|
|
6613
|
-
E(
|
|
6614
|
-
}, [
|
|
6662
|
+
[b, u, m, p, l, g]
|
|
6663
|
+
), v = useCallback(() => {
|
|
6664
|
+
E(b, [f]);
|
|
6665
|
+
}, [b, f, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
|
|
6615
6666
|
useEffect(() => {
|
|
6616
6667
|
i(S, x);
|
|
6617
6668
|
}, [S, i, x]);
|
|
6618
|
-
const [, , B] = useCanvasWidth(),
|
|
6669
|
+
const [, , B] = useCanvasWidth(), w = useCallback(
|
|
6619
6670
|
(N) => {
|
|
6620
6671
|
B({
|
|
6621
6672
|
xs: 400,
|
|
@@ -6627,9 +6678,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6627
6678
|
}[N]);
|
|
6628
6679
|
},
|
|
6629
6680
|
[B]
|
|
6630
|
-
),
|
|
6631
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x &&
|
|
6632
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !
|
|
6681
|
+
), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
|
|
6682
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6683
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6633
6684
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6634
6685
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6635
6686
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6638,17 +6689,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6638
6689
|
currentClass: get(x, "cls", ""),
|
|
6639
6690
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6640
6691
|
units: c || [],
|
|
6641
|
-
onChange:
|
|
6692
|
+
onChange: _,
|
|
6642
6693
|
negative: d,
|
|
6643
6694
|
cssProperty: l
|
|
6644
6695
|
}
|
|
6645
6696
|
) : null,
|
|
6646
|
-
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6647
|
-
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6648
|
-
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6649
|
-
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6697
|
+
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: _ }),
|
|
6698
|
+
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: _ }),
|
|
6699
|
+
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: _ }),
|
|
6700
|
+
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: _ })
|
|
6650
6701
|
] }),
|
|
6651
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6702
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__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: [
|
|
6652
6703
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6653
6704
|
"button",
|
|
6654
6705
|
{
|
|
@@ -6668,7 +6719,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6668
6719
|
"button",
|
|
6669
6720
|
{
|
|
6670
6721
|
type: "button",
|
|
6671
|
-
onClick: () =>
|
|
6722
|
+
onClick: () => w(get(x, "mq")),
|
|
6672
6723
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6673
6724
|
children: [
|
|
6674
6725
|
"Switch to ",
|
|
@@ -6689,7 +6740,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6689
6740
|
units: i = basicUnits,
|
|
6690
6741
|
negative: c = !1
|
|
6691
6742
|
}) => {
|
|
6692
|
-
const { t: d } = useTranslation(), [u, p] = useState(n[0].key),
|
|
6743
|
+
const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
|
|
6693
6744
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6694
6745
|
"div",
|
|
6695
6746
|
{
|
|
@@ -6698,7 +6749,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6698
6749
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6699
6750
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6700
6751
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6701
|
-
n.map(({ label:
|
|
6752
|
+
n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6702
6753
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6703
6754
|
"button",
|
|
6704
6755
|
{
|
|
@@ -6713,7 +6764,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6713
6764
|
]
|
|
6714
6765
|
}
|
|
6715
6766
|
) }),
|
|
6716
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(
|
|
6767
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
|
|
6717
6768
|
] }) }))
|
|
6718
6769
|
) })
|
|
6719
6770
|
] }),
|
|
@@ -6778,8 +6829,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6778
6829
|
if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
|
|
6779
6830
|
return null;
|
|
6780
6831
|
const u = (p) => {
|
|
6781
|
-
const
|
|
6782
|
-
l([o._id],
|
|
6832
|
+
const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6833
|
+
l([o._id], m, !0);
|
|
6783
6834
|
};
|
|
6784
6835
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
6785
6836
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
|
|
@@ -6833,13 +6884,13 @@ function BlockStyling() {
|
|
|
6833
6884
|
cssProperty: ""
|
|
6834
6885
|
}), d = useThrottledCallback(
|
|
6835
6886
|
(p) => {
|
|
6836
|
-
const
|
|
6837
|
-
let
|
|
6838
|
-
|
|
6887
|
+
const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
|
|
6888
|
+
let g = parseFloat(i.dragStartValue);
|
|
6889
|
+
g = isNaN(g) ? 0 : g;
|
|
6839
6890
|
let E = MAPPER[i.dragUnit];
|
|
6840
6891
|
(startsWith(x, "scale") || x === "opacity") && (E = 10);
|
|
6841
|
-
let
|
|
6842
|
-
|
|
6892
|
+
let f = (i.dragStartY - p.pageY) / E + g;
|
|
6893
|
+
m && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
|
|
6843
6894
|
},
|
|
6844
6895
|
[i],
|
|
6845
6896
|
50
|
|
@@ -6925,33 +6976,33 @@ const BlockCard = ({
|
|
|
6925
6976
|
library: n,
|
|
6926
6977
|
parentId: r = void 0
|
|
6927
6978
|
}) => {
|
|
6928
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(),
|
|
6929
|
-
const
|
|
6930
|
-
return
|
|
6931
|
-
},
|
|
6932
|
-
async (
|
|
6933
|
-
if (
|
|
6979
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (_) => {
|
|
6980
|
+
const v = has(_, "styles_attrs.data-page-section");
|
|
6981
|
+
return _._type === "Box" && v;
|
|
6982
|
+
}, b = useCallback(
|
|
6983
|
+
async (_) => {
|
|
6984
|
+
if (_.stopPropagation(), has(o, "component")) {
|
|
6934
6985
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6935
6986
|
return;
|
|
6936
6987
|
}
|
|
6937
6988
|
l(!0);
|
|
6938
|
-
const
|
|
6939
|
-
isEmpty(
|
|
6989
|
+
const v = await i(n, o);
|
|
6990
|
+
isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6940
6991
|
},
|
|
6941
6992
|
[o]
|
|
6942
|
-
),
|
|
6943
|
-
const
|
|
6993
|
+
), f = async (_) => {
|
|
6994
|
+
const v = await i(n, o);
|
|
6944
6995
|
let S = r;
|
|
6945
|
-
if (E(first(
|
|
6946
|
-
const B = { blocks:
|
|
6947
|
-
if (
|
|
6948
|
-
const
|
|
6949
|
-
|
|
6950
|
-
|
|
6996
|
+
if (E(first(v)) && (S = null), !isEmpty(v)) {
|
|
6997
|
+
const B = { blocks: v, uiLibrary: !0, parent: S };
|
|
6998
|
+
if (_.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
6999
|
+
const w = new Image();
|
|
7000
|
+
w.src = o.preview, w.onload = () => {
|
|
7001
|
+
_.dataTransfer.setDragImage(w, 0, 0);
|
|
6951
7002
|
};
|
|
6952
7003
|
} else
|
|
6953
|
-
|
|
6954
|
-
|
|
7004
|
+
_.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7005
|
+
g(B), setTimeout(() => {
|
|
6955
7006
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6956
7007
|
}, 200);
|
|
6957
7008
|
}
|
|
@@ -6961,9 +7012,9 @@ const BlockCard = ({
|
|
|
6961
7012
|
"div",
|
|
6962
7013
|
{
|
|
6963
7014
|
onClick: a ? () => {
|
|
6964
|
-
} :
|
|
7015
|
+
} : b,
|
|
6965
7016
|
draggable: x ? "true" : "false",
|
|
6966
|
-
onDragStart:
|
|
7017
|
+
onDragStart: f,
|
|
6967
7018
|
className: clsx(
|
|
6968
7019
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
6969
7020
|
),
|
|
@@ -6972,11 +7023,11 @@ const BlockCard = ({
|
|
|
6972
7023
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
|
|
6973
7024
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
6974
7025
|
] }),
|
|
6975
|
-
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt:
|
|
7026
|
+
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
|
|
6976
7027
|
]
|
|
6977
7028
|
}
|
|
6978
7029
|
) }),
|
|
6979
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
|
|
6980
7031
|
] });
|
|
6981
7032
|
}, libraryBlocksAtom = atom$1(
|
|
6982
7033
|
{}
|
|
@@ -6992,7 +7043,7 @@ const BlockCard = ({
|
|
|
6992
7043
|
})();
|
|
6993
7044
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
6994
7045
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
6995
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [
|
|
7046
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: b } = useTranslation(), f = (S) => {
|
|
6996
7047
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
6997
7048
|
E.current && x(S);
|
|
6998
7049
|
}, 300);
|
|
@@ -7002,26 +7053,26 @@ const BlockCard = ({
|
|
|
7002
7053
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7003
7054
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7004
7055
|
] });
|
|
7005
|
-
const
|
|
7056
|
+
const _ = filter(g, (S, B) => B % 2 === 0), v = filter(g, (S, B) => B % 2 === 1);
|
|
7006
7057
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
|
|
7007
7058
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7008
7059
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7009
7060
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7010
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
|
|
7011
7062
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7012
7063
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
|
|
7013
7064
|
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7014
7065
|
"div",
|
|
7015
7066
|
{
|
|
7016
|
-
onMouseEnter: () =>
|
|
7067
|
+
onMouseEnter: () => f(B),
|
|
7017
7068
|
onMouseLeave: () => clearTimeout(E.current),
|
|
7018
7069
|
onClick: () => x(B),
|
|
7019
7070
|
className: cn(
|
|
7020
7071
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7021
|
-
B ===
|
|
7072
|
+
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7022
7073
|
),
|
|
7023
7074
|
children: [
|
|
7024
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7075
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(B.toLowerCase())) }),
|
|
7025
7076
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7026
7077
|
]
|
|
7027
7078
|
},
|
|
@@ -7038,10 +7089,10 @@ const BlockCard = ({
|
|
|
7038
7089
|
children: [
|
|
7039
7090
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7040
7091
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7041
|
-
|
|
7092
|
+
_.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7042
7093
|
) }),
|
|
7043
7094
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7044
|
-
|
|
7095
|
+
v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7045
7096
|
) })
|
|
7046
7097
|
] }),
|
|
7047
7098
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7486,14 +7537,14 @@ i18n.use(initReactI18next).init({
|
|
|
7486
7537
|
}
|
|
7487
7538
|
});
|
|
7488
7539
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7489
|
-
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [,
|
|
7540
|
+
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
|
|
7490
7541
|
if (has(o, "blocks")) {
|
|
7491
|
-
const
|
|
7492
|
-
u(syncBlocksWithDefaults(
|
|
7542
|
+
const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7543
|
+
u(syncBlocksWithDefaults(b), r || null);
|
|
7493
7544
|
} else
|
|
7494
7545
|
d(o, r || null);
|
|
7495
7546
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7496
|
-
},
|
|
7547
|
+
}, g = useFeature("dnd"), { t: E } = useTranslation();
|
|
7497
7548
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7498
7549
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7499
7550
|
"button",
|
|
@@ -7501,12 +7552,12 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7501
7552
|
disabled: n,
|
|
7502
7553
|
onClick: x,
|
|
7503
7554
|
type: "button",
|
|
7504
|
-
onDragStart: (
|
|
7505
|
-
|
|
7506
|
-
p([]),
|
|
7555
|
+
onDragStart: (b) => {
|
|
7556
|
+
b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7557
|
+
p([]), m(null);
|
|
7507
7558
|
}, 200);
|
|
7508
7559
|
},
|
|
7509
|
-
draggable:
|
|
7560
|
+
draggable: g ? "true" : "false",
|
|
7510
7561
|
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
|
|
7511
7562
|
children: [
|
|
7512
7563
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
@@ -7675,14 +7726,14 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7675
7726
|
) }) });
|
|
7676
7727
|
}
|
|
7677
7728
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7678
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p,
|
|
7729
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
|
|
7679
7730
|
useEffect(() => {
|
|
7680
|
-
var
|
|
7681
|
-
(
|
|
7731
|
+
var b;
|
|
7732
|
+
(b = x.current) == null || b.focus();
|
|
7682
7733
|
}, []);
|
|
7683
|
-
const E = (
|
|
7684
|
-
const { usage:
|
|
7685
|
-
!l &&
|
|
7734
|
+
const E = (b) => {
|
|
7735
|
+
const { usage: f } = b || {};
|
|
7736
|
+
!l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
7686
7737
|
};
|
|
7687
7738
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7688
7739
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7702,12 +7753,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7702
7753
|
{
|
|
7703
7754
|
ref: x,
|
|
7704
7755
|
value: i,
|
|
7705
|
-
onChange: (
|
|
7756
|
+
onChange: (b) => c(b.target.value),
|
|
7706
7757
|
placeholder: n("Ask AI to edit content"),
|
|
7707
7758
|
className: "w-full",
|
|
7708
7759
|
rows: 3,
|
|
7709
|
-
onKeyDown: (
|
|
7710
|
-
|
|
7760
|
+
onKeyDown: (b) => {
|
|
7761
|
+
b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
|
|
7711
7762
|
}
|
|
7712
7763
|
}
|
|
7713
7764
|
),
|
|
@@ -7717,7 +7768,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7717
7768
|
{
|
|
7718
7769
|
disabled: i.trim().length < 5 || a,
|
|
7719
7770
|
onClick: () => {
|
|
7720
|
-
|
|
7771
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
|
|
7721
7772
|
},
|
|
7722
7773
|
variant: "default",
|
|
7723
7774
|
className: "w-fit",
|
|
@@ -7749,8 +7800,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7749
7800
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7750
7801
|
QuickPrompts,
|
|
7751
7802
|
{
|
|
7752
|
-
onClick: (
|
|
7753
|
-
|
|
7803
|
+
onClick: (b) => {
|
|
7804
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, b, E);
|
|
7754
7805
|
}
|
|
7755
7806
|
}
|
|
7756
7807
|
)
|
|
@@ -7760,7 +7811,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7760
7811
|
] }) }) : null
|
|
7761
7812
|
] });
|
|
7762
7813
|
}, AISetContext = () => {
|
|
7763
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [,
|
|
7814
|
+
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
|
|
7764
7815
|
useEffect(() => {
|
|
7765
7816
|
n && a(n);
|
|
7766
7817
|
}, [n]);
|
|
@@ -7770,9 +7821,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7770
7821
|
title: o("Updated AI Context"),
|
|
7771
7822
|
description: o("You can now Ask AI to edit your content"),
|
|
7772
7823
|
variant: "default"
|
|
7773
|
-
}),
|
|
7774
|
-
} catch (
|
|
7775
|
-
p(
|
|
7824
|
+
}), g.current.click();
|
|
7825
|
+
} catch (b) {
|
|
7826
|
+
p(b);
|
|
7776
7827
|
} finally {
|
|
7777
7828
|
d(!1);
|
|
7778
7829
|
}
|
|
@@ -7780,25 +7831,25 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7780
7831
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7781
7832
|
Accordion,
|
|
7782
7833
|
{
|
|
7783
|
-
onValueChange: (
|
|
7784
|
-
|
|
7834
|
+
onValueChange: (b) => {
|
|
7835
|
+
m(b !== "");
|
|
7785
7836
|
},
|
|
7786
7837
|
type: "single",
|
|
7787
7838
|
collapsible: !0,
|
|
7788
7839
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
7789
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref:
|
|
7840
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
|
|
7790
7841
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
7791
7842
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7792
7843
|
Textarea,
|
|
7793
7844
|
{
|
|
7794
7845
|
ref: l,
|
|
7795
7846
|
value: r,
|
|
7796
|
-
onChange: (
|
|
7847
|
+
onChange: (b) => a(b.target.value),
|
|
7797
7848
|
placeholder: o("Tell about this page eg this page is about"),
|
|
7798
7849
|
className: "mt-1 w-full",
|
|
7799
7850
|
rows: 10,
|
|
7800
|
-
onKeyDown: (
|
|
7801
|
-
|
|
7851
|
+
onKeyDown: (b) => {
|
|
7852
|
+
b.key === "Enter" && (b.preventDefault(), E());
|
|
7802
7853
|
}
|
|
7803
7854
|
}
|
|
7804
7855
|
),
|
|
@@ -7860,42 +7911,42 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7860
7911
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7861
7912
|
] });
|
|
7862
7913
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7863
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p,
|
|
7914
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), b = useRef(null);
|
|
7864
7915
|
useEffect(() => {
|
|
7865
7916
|
l(n);
|
|
7866
7917
|
}, [n]);
|
|
7867
|
-
const
|
|
7918
|
+
const f = () => {
|
|
7868
7919
|
if (i.startsWith("@")) {
|
|
7869
|
-
|
|
7920
|
+
g("Attribute keys cannot start with '@'");
|
|
7870
7921
|
return;
|
|
7871
7922
|
}
|
|
7872
7923
|
if (i) {
|
|
7873
|
-
const
|
|
7874
|
-
r(
|
|
7924
|
+
const w = [...a, { key: i, value: d }];
|
|
7925
|
+
r(w), l(a), c(""), u(""), g("");
|
|
7875
7926
|
}
|
|
7876
|
-
},
|
|
7877
|
-
const
|
|
7878
|
-
r(
|
|
7879
|
-
},
|
|
7880
|
-
|
|
7927
|
+
}, _ = (w) => {
|
|
7928
|
+
const A = a.filter((N, D) => D !== w);
|
|
7929
|
+
r(A), l(A);
|
|
7930
|
+
}, v = (w) => {
|
|
7931
|
+
m(w), c(a[w].key), u(a[w].value);
|
|
7881
7932
|
}, S = () => {
|
|
7882
7933
|
if (i.startsWith("@")) {
|
|
7883
|
-
|
|
7934
|
+
g("Attribute keys cannot start with '@'");
|
|
7884
7935
|
return;
|
|
7885
7936
|
}
|
|
7886
7937
|
if (p !== null && i) {
|
|
7887
|
-
const
|
|
7888
|
-
|
|
7938
|
+
const w = [...a];
|
|
7939
|
+
w[p] = { key: i, value: d }, r(w), l(w), m(null), c(""), u(""), g("");
|
|
7889
7940
|
}
|
|
7890
|
-
}, B = (
|
|
7891
|
-
|
|
7941
|
+
}, B = (w) => {
|
|
7942
|
+
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? S() : f());
|
|
7892
7943
|
};
|
|
7893
7944
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
7894
7945
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7895
7946
|
"form",
|
|
7896
7947
|
{
|
|
7897
|
-
onSubmit: (
|
|
7898
|
-
|
|
7948
|
+
onSubmit: (w) => {
|
|
7949
|
+
w.preventDefault(), p !== null ? S() : f();
|
|
7899
7950
|
},
|
|
7900
7951
|
className: "space-y-3",
|
|
7901
7952
|
children: [
|
|
@@ -7911,7 +7962,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7911
7962
|
id: "attrKey",
|
|
7912
7963
|
ref: E,
|
|
7913
7964
|
value: i,
|
|
7914
|
-
onChange: (
|
|
7965
|
+
onChange: (w) => c(w.target.value),
|
|
7915
7966
|
placeholder: "Key",
|
|
7916
7967
|
className: "h-8 text-sm"
|
|
7917
7968
|
}
|
|
@@ -7927,9 +7978,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7927
7978
|
spellCheck: "false",
|
|
7928
7979
|
id: "attrValue",
|
|
7929
7980
|
rows: 2,
|
|
7930
|
-
ref:
|
|
7981
|
+
ref: b,
|
|
7931
7982
|
value: d,
|
|
7932
|
-
onChange: (
|
|
7983
|
+
onChange: (w) => u(w.target.value),
|
|
7933
7984
|
onKeyDown: B,
|
|
7934
7985
|
placeholder: "Value",
|
|
7935
7986
|
className: "bg-background text-sm"
|
|
@@ -7942,22 +7993,22 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7942
7993
|
]
|
|
7943
7994
|
}
|
|
7944
7995
|
),
|
|
7945
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
7996
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
7946
7997
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
7947
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
7948
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
7998
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
|
|
7999
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
|
|
7949
8000
|
] }),
|
|
7950
8001
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
7951
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A
|
|
8002
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
|
|
7952
8003
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
7953
8004
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
7954
8005
|
] }),
|
|
7955
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8006
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
|
|
7956
8007
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
7957
8008
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
7958
8009
|
] })
|
|
7959
8010
|
] })
|
|
7960
|
-
] },
|
|
8011
|
+
] }, A)) })
|
|
7961
8012
|
] });
|
|
7962
8013
|
}), BlockAttributesEditor = React.memo(() => {
|
|
7963
8014
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8142,6 +8193,222 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8142
8193
|
] })
|
|
8143
8194
|
] })
|
|
8144
8195
|
] }) });
|
|
8196
|
+
}, LANGUAGES = {
|
|
8197
|
+
ab: "Abkhazian",
|
|
8198
|
+
aa: "Afar",
|
|
8199
|
+
af: "Afrikaans",
|
|
8200
|
+
ak: "Akan",
|
|
8201
|
+
sq: "Albanian",
|
|
8202
|
+
am: "Amharic",
|
|
8203
|
+
ar: "Arabic",
|
|
8204
|
+
an: "Aragonese",
|
|
8205
|
+
hy: "Armenian",
|
|
8206
|
+
as: "Assamese",
|
|
8207
|
+
av: "Avaric",
|
|
8208
|
+
ae: "Avestan",
|
|
8209
|
+
ay: "Aymara",
|
|
8210
|
+
az: "Azerbaijani",
|
|
8211
|
+
bm: "Bambara",
|
|
8212
|
+
ba: "Bashkir",
|
|
8213
|
+
eu: "Basque",
|
|
8214
|
+
be: "Belarusian",
|
|
8215
|
+
bn: "Bengali",
|
|
8216
|
+
bh: "Bihari",
|
|
8217
|
+
bi: "Bislama",
|
|
8218
|
+
bs: "Bosnian",
|
|
8219
|
+
br: "Breton",
|
|
8220
|
+
bg: "Bulgarian",
|
|
8221
|
+
my: "Burmese",
|
|
8222
|
+
ca: "Catalan",
|
|
8223
|
+
ch: "Chamorro",
|
|
8224
|
+
ce: "Chechen",
|
|
8225
|
+
ny: "Chichewa",
|
|
8226
|
+
zh: "Chinese",
|
|
8227
|
+
"zh-Hans": "Chinese (Simplified)",
|
|
8228
|
+
"zh-Hant": "Chinese (Traditional)",
|
|
8229
|
+
cv: "Chuvash",
|
|
8230
|
+
kw: "Cornish",
|
|
8231
|
+
co: "Corsican",
|
|
8232
|
+
cr: "Cree",
|
|
8233
|
+
hr: "Croatian",
|
|
8234
|
+
cs: "Czech",
|
|
8235
|
+
da: "Danish",
|
|
8236
|
+
dv: "Maldivian",
|
|
8237
|
+
nl: "Dutch",
|
|
8238
|
+
dz: "Dzongkha",
|
|
8239
|
+
en: "English",
|
|
8240
|
+
eo: "Esperanto",
|
|
8241
|
+
et: "Estonian",
|
|
8242
|
+
ee: "Ewe",
|
|
8243
|
+
fo: "Faroese",
|
|
8244
|
+
fj: "Fijian",
|
|
8245
|
+
fi: "Finnish",
|
|
8246
|
+
fr: "French",
|
|
8247
|
+
ff: "Fula, Pular",
|
|
8248
|
+
gl: "Galician",
|
|
8249
|
+
gd: "Gaelic (Scottish)",
|
|
8250
|
+
gv: "Manx",
|
|
8251
|
+
ka: "Georgian",
|
|
8252
|
+
de: "German",
|
|
8253
|
+
el: "Greek",
|
|
8254
|
+
kl: "Kalaallisut",
|
|
8255
|
+
gn: "Guarani",
|
|
8256
|
+
gu: "Gujarati",
|
|
8257
|
+
ht: "Haitian Creole",
|
|
8258
|
+
ha: "Hausa",
|
|
8259
|
+
he: "Hebrew",
|
|
8260
|
+
hz: "Herero",
|
|
8261
|
+
hi: "Hindi",
|
|
8262
|
+
ho: "Hiri Motu",
|
|
8263
|
+
hu: "Hungarian",
|
|
8264
|
+
is: "Icelandic",
|
|
8265
|
+
io: "Ido",
|
|
8266
|
+
ig: "Igbo",
|
|
8267
|
+
id: "Indonesian",
|
|
8268
|
+
ia: "Interlingua",
|
|
8269
|
+
ie: "Interlingue",
|
|
8270
|
+
iu: "Inuktitut",
|
|
8271
|
+
ik: "Inupiak",
|
|
8272
|
+
ga: "Irish",
|
|
8273
|
+
it: "Italian",
|
|
8274
|
+
ja: "Japanese",
|
|
8275
|
+
jv: "Javanese",
|
|
8276
|
+
kn: "Kannada",
|
|
8277
|
+
kr: "Kanuri",
|
|
8278
|
+
ks: "Kashmiri",
|
|
8279
|
+
kk: "Kazakh",
|
|
8280
|
+
km: "Khmer",
|
|
8281
|
+
ki: "Kikuyu",
|
|
8282
|
+
rw: "Kinyarwanda",
|
|
8283
|
+
rn: "Kirundi",
|
|
8284
|
+
ky: "Kyrgyz",
|
|
8285
|
+
kv: "Komi",
|
|
8286
|
+
kg: "Kongo",
|
|
8287
|
+
ko: "Korean",
|
|
8288
|
+
ku: "Kurdish",
|
|
8289
|
+
kj: "Kwanyama",
|
|
8290
|
+
lo: "Lao",
|
|
8291
|
+
la: "Latin",
|
|
8292
|
+
lv: "Latvian",
|
|
8293
|
+
li: "Limburgish",
|
|
8294
|
+
ln: "Lingala",
|
|
8295
|
+
lt: "Lithuanian",
|
|
8296
|
+
lu: "Luga-Katanga",
|
|
8297
|
+
lg: "Luganda, Ganda",
|
|
8298
|
+
lb: "Luxembourgish",
|
|
8299
|
+
mk: "Macedonian",
|
|
8300
|
+
mg: "Malagasy",
|
|
8301
|
+
ms: "Malay",
|
|
8302
|
+
ml: "Malayalam",
|
|
8303
|
+
mt: "Maltese",
|
|
8304
|
+
mi: "Maori",
|
|
8305
|
+
mr: "Marathi",
|
|
8306
|
+
mh: "Marshallese",
|
|
8307
|
+
mo: "Moldavian",
|
|
8308
|
+
mn: "Mongolian",
|
|
8309
|
+
na: "Nauru",
|
|
8310
|
+
nv: "Navajo",
|
|
8311
|
+
ng: "Ndonga",
|
|
8312
|
+
nd: "Northern Ndebele",
|
|
8313
|
+
ne: "Nepali",
|
|
8314
|
+
no: "Norwegian",
|
|
8315
|
+
nb: "Norwegian bokmål",
|
|
8316
|
+
nn: "Norwegian nynorsk",
|
|
8317
|
+
ii: "Sichuan Yi",
|
|
8318
|
+
oc: "Occitan",
|
|
8319
|
+
oj: "Ojibwe",
|
|
8320
|
+
cu: "Old Church Slavonic",
|
|
8321
|
+
or: "Oriya",
|
|
8322
|
+
om: "Oromo",
|
|
8323
|
+
os: "Ossetian",
|
|
8324
|
+
pi: "Pāli",
|
|
8325
|
+
ps: "Pashto, Pushto",
|
|
8326
|
+
fa: "Persian (Farsi)",
|
|
8327
|
+
pl: "Polish",
|
|
8328
|
+
pt: "Portuguese",
|
|
8329
|
+
pa: "Punjabi (Eastern)",
|
|
8330
|
+
qu: "Quechua",
|
|
8331
|
+
rm: "Romansh",
|
|
8332
|
+
ro: "Romanian",
|
|
8333
|
+
ru: "Russian",
|
|
8334
|
+
se: "Sami",
|
|
8335
|
+
sm: "Samoan",
|
|
8336
|
+
sg: "Sango",
|
|
8337
|
+
sa: "Sanskrit",
|
|
8338
|
+
sr: "Serbian",
|
|
8339
|
+
sh: "Serbo-Croatian",
|
|
8340
|
+
st: "Sesotho",
|
|
8341
|
+
tn: "Setswana",
|
|
8342
|
+
sn: "Shona",
|
|
8343
|
+
sd: "Sindhi",
|
|
8344
|
+
si: "Sinhalese",
|
|
8345
|
+
ss: "Swati",
|
|
8346
|
+
sk: "Slovak",
|
|
8347
|
+
sl: "Slovenian",
|
|
8348
|
+
so: "Somali",
|
|
8349
|
+
nr: "Southern Ndebele",
|
|
8350
|
+
es: "Spanish",
|
|
8351
|
+
su: "Sundanese",
|
|
8352
|
+
sw: "Swahili (Kiswahili)",
|
|
8353
|
+
sv: "Swedish",
|
|
8354
|
+
tl: "Tagalog",
|
|
8355
|
+
ty: "Tahitian",
|
|
8356
|
+
tg: "Tajik",
|
|
8357
|
+
ta: "Tamil",
|
|
8358
|
+
tt: "Tatar",
|
|
8359
|
+
te: "Telugu",
|
|
8360
|
+
th: "Thai",
|
|
8361
|
+
bo: "Tibetan",
|
|
8362
|
+
ti: "Tigrinya",
|
|
8363
|
+
to: "Tonga",
|
|
8364
|
+
ts: "Tsonga",
|
|
8365
|
+
tr: "Turkish",
|
|
8366
|
+
tk: "Turkmen",
|
|
8367
|
+
tw: "Twi",
|
|
8368
|
+
ug: "Uyghur",
|
|
8369
|
+
uk: "Ukrainian",
|
|
8370
|
+
ur: "Urdu",
|
|
8371
|
+
uz: "Uzbek",
|
|
8372
|
+
ve: "Venda",
|
|
8373
|
+
vi: "Vietnamese",
|
|
8374
|
+
vo: "Volapük",
|
|
8375
|
+
wa: "Wallon",
|
|
8376
|
+
cy: "Welsh",
|
|
8377
|
+
wo: "Wolof",
|
|
8378
|
+
fy: "Western Frisian",
|
|
8379
|
+
xh: "Xhosa",
|
|
8380
|
+
yi: "Yiddish",
|
|
8381
|
+
yo: "Yoruba",
|
|
8382
|
+
za: "Zhuang, Chuang",
|
|
8383
|
+
zu: "Zulu"
|
|
8384
|
+
}, LanguageSelector = () => {
|
|
8385
|
+
const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
|
|
8386
|
+
const c = [];
|
|
8387
|
+
return forEach(uniq([...n, o]), (d) => {
|
|
8388
|
+
const u = get(LANGUAGES, d);
|
|
8389
|
+
u && c.push({ key: d, value: u, default: d === o });
|
|
8390
|
+
}), c;
|
|
8391
|
+
}, [o, n]);
|
|
8392
|
+
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm", children: [
|
|
8393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
|
|
8394
|
+
get(LANGUAGES, l),
|
|
8395
|
+
l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
|
|
8396
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
8397
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "outline", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
|
|
8398
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
|
|
8399
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-end", children: [
|
|
8400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8401
|
+
" ",
|
|
8402
|
+
get(LANGUAGES, l)
|
|
8403
|
+
] }),
|
|
8404
|
+
l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-gray-400", children: "Default" })
|
|
8405
|
+
] })
|
|
8406
|
+
] }) }),
|
|
8407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-end", onClick: () => a(c.key), children: [
|
|
8408
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c.value }),
|
|
8409
|
+
c.key === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
|
|
8410
|
+
] })) })
|
|
8411
|
+
] });
|
|
8145
8412
|
}, CanvasTopBar = () => {
|
|
8146
8413
|
const o = useBuilderProp("darkMode", !0), [n] = useCanvasZoom();
|
|
8147
8414
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2", children: [
|
|
@@ -8163,7 +8430,10 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8163
8430
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { orientation: "vertical" }),
|
|
8164
8431
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UndoRedo, {})
|
|
8165
8432
|
] }),
|
|
8166
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8433
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
|
|
8434
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LanguageSelector, {}),
|
|
8435
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {})
|
|
8436
|
+
] })
|
|
8167
8437
|
] });
|
|
8168
8438
|
};
|
|
8169
8439
|
function BlockAttributesToggle() {
|
|
@@ -8374,16 +8644,16 @@ function RemoveProviderConfirmation({
|
|
|
8374
8644
|
}
|
|
8375
8645
|
const PageDataProviders = () => {
|
|
8376
8646
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8377
|
-
filter(n, (
|
|
8378
|
-
), [d, u] = useState(""), [p,
|
|
8379
|
-
n.map((
|
|
8380
|
-
(
|
|
8381
|
-
),
|
|
8382
|
-
const
|
|
8383
|
-
c((
|
|
8384
|
-
}, E = (
|
|
8385
|
-
c((
|
|
8386
|
-
},
|
|
8647
|
+
filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
|
|
8648
|
+
), [d, u] = useState(""), [p, m] = useState(null), x = filter(
|
|
8649
|
+
n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
|
|
8650
|
+
(f) => !isNull(f)
|
|
8651
|
+
), g = (f) => {
|
|
8652
|
+
const _ = find(n, { providerKey: f });
|
|
8653
|
+
c((v) => [...v, _]), a((v) => [...v, { providerKey: _.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8654
|
+
}, E = (f) => {
|
|
8655
|
+
c((_) => filter(_, (v) => v.providerKey !== f.providerKey)), a((_) => filter(_, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
|
|
8656
|
+
}, b = (f) => m(f);
|
|
8387
8657
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8388
8658
|
o("no_data_providers"),
|
|
8389
8659
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8391,11 +8661,11 @@ const PageDataProviders = () => {
|
|
|
8391
8661
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8392
8662
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8393
8663
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8394
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (
|
|
8664
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) => g(f), children: [
|
|
8395
8665
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8396
8666
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8397
8667
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
8398
|
-
x.map((
|
|
8668
|
+
x.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: f.value, children: f.label }, f.value))
|
|
8399
8669
|
] })
|
|
8400
8670
|
] }) }),
|
|
8401
8671
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8404,21 +8674,21 @@ const PageDataProviders = () => {
|
|
|
8404
8674
|
o("page_data_providers"),
|
|
8405
8675
|
":"
|
|
8406
8676
|
] }),
|
|
8407
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((
|
|
8677
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8408
8678
|
"div",
|
|
8409
8679
|
{
|
|
8410
8680
|
className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
|
|
8411
8681
|
"data-v0-t": "card",
|
|
8412
8682
|
children: [
|
|
8413
8683
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8414
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children:
|
|
8415
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children:
|
|
8684
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: f.name }),
|
|
8685
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: f.description })
|
|
8416
8686
|
] }) }) }),
|
|
8417
8687
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
8418
8688
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8419
8689
|
"button",
|
|
8420
8690
|
{
|
|
8421
|
-
onClick: () => f
|
|
8691
|
+
onClick: () => b(f),
|
|
8422
8692
|
className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
8423
8693
|
children: [
|
|
8424
8694
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8444,7 +8714,7 @@ const PageDataProviders = () => {
|
|
|
8444
8714
|
]
|
|
8445
8715
|
}
|
|
8446
8716
|
),
|
|
8447
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(
|
|
8717
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(f), name: f.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
|
|
8448
8718
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8449
8719
|
"svg",
|
|
8450
8720
|
{
|
|
@@ -8470,16 +8740,16 @@ const PageDataProviders = () => {
|
|
|
8470
8740
|
] })
|
|
8471
8741
|
]
|
|
8472
8742
|
},
|
|
8473
|
-
|
|
8743
|
+
f.providerKey
|
|
8474
8744
|
)) }),
|
|
8475
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () =>
|
|
8745
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
|
|
8476
8746
|
] })
|
|
8477
8747
|
] });
|
|
8478
8748
|
};
|
|
8479
8749
|
function AiFillDatabase(o) {
|
|
8480
8750
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
|
|
8481
8751
|
}
|
|
8482
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8752
|
+
const TopBar = lazy(() => import("./Topbar-yEANMgiO.js"));
|
|
8483
8753
|
function useSidebarMenuItems(o) {
|
|
8484
8754
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8485
8755
|
return useMemo(() => {
|
|
@@ -8506,14 +8776,14 @@ function isDualLayout(o) {
|
|
|
8506
8776
|
}
|
|
8507
8777
|
const RootLayout = () => {
|
|
8508
8778
|
const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
|
|
8509
|
-
useChaiBuilderMsgListener(({ name:
|
|
8510
|
-
|
|
8779
|
+
useChaiBuilderMsgListener(({ name: g }) => {
|
|
8780
|
+
g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
|
|
8511
8781
|
});
|
|
8512
|
-
const i = useBuilderProp("sideBarComponents.top", []), c = (
|
|
8513
|
-
|
|
8514
|
-
}, d = (
|
|
8515
|
-
n(o ===
|
|
8516
|
-
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(),
|
|
8782
|
+
const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
|
|
8783
|
+
g.preventDefault();
|
|
8784
|
+
}, d = (g) => {
|
|
8785
|
+
n(o === g ? null : g);
|
|
8786
|
+
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
|
|
8517
8787
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8518
8788
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8519
8789
|
"div",
|
|
@@ -8524,18 +8794,18 @@ const RootLayout = () => {
|
|
|
8524
8794
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
|
|
8525
8795
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8526
8796
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8527
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children:
|
|
8797
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8528
8798
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8529
8799
|
Button,
|
|
8530
8800
|
{
|
|
8531
8801
|
variant: o === E ? "default" : "ghost",
|
|
8532
8802
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8533
8803
|
onClick: () => d(E),
|
|
8534
|
-
children: get(
|
|
8804
|
+
children: get(g, "icon", null)
|
|
8535
8805
|
},
|
|
8536
8806
|
E
|
|
8537
8807
|
) }),
|
|
8538
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(
|
|
8808
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
|
|
8539
8809
|
] }, "button" + E)) }),
|
|
8540
8810
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
8541
8811
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
@@ -8554,10 +8824,10 @@ const RootLayout = () => {
|
|
|
8554
8824
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8555
8825
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
|
|
8556
8826
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8557
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
8558
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(
|
|
8827
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
8828
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
|
|
8559
8829
|
] }),
|
|
8560
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
8830
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
|
|
8561
8831
|
] }) })
|
|
8562
8832
|
}
|
|
8563
8833
|
),
|
|
@@ -8639,7 +8909,7 @@ const RootLayout = () => {
|
|
|
8639
8909
|
}, [o]), useEffect(() => {
|
|
8640
8910
|
builderStore.set(dataProvidersAtom, o.dataProviders || []);
|
|
8641
8911
|
}, [o.dataProviders]), useEffect(() => {
|
|
8642
|
-
n(
|
|
8912
|
+
n(o.blocks || []), a();
|
|
8643
8913
|
}, [o.blocks]), useEffect(() => {
|
|
8644
8914
|
i18n.changeLanguage(o.locale || "en");
|
|
8645
8915
|
}, [o.locale]), useEffect(() => {
|
|
@@ -8699,8 +8969,9 @@ export {
|
|
|
8699
8969
|
useSelectedBlocksDisplayChild as a4,
|
|
8700
8970
|
useSelectedBreakpoints as a5,
|
|
8701
8971
|
useSelectedStylingBlocks as a6,
|
|
8702
|
-
|
|
8703
|
-
|
|
8972
|
+
useLanguages as a7,
|
|
8973
|
+
useLayoutVariant as a8,
|
|
8974
|
+
useBlocksStoreUndoableActions as a9,
|
|
8704
8975
|
useUpdateBlocksProps as b,
|
|
8705
8976
|
useUpdateBlocksPropsRealtime as c,
|
|
8706
8977
|
useBuilderProp as d,
|