@chaibuilder/sdk 1.2.108 → 1.2.110
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-qrG-nsRa.cjs → CodeEditor-CLZUUbGV.cjs} +1 -1
- package/dist/{CodeEditor-kW6SrwIa.js → CodeEditor-p_MY9fHx.js} +2 -2
- package/dist/Topbar-_edNTuUL.js +163 -0
- package/dist/Topbar-sxJsvNJQ.cjs +1 -0
- package/dist/{UnsplashImages-OH1oIK1z.js → UnsplashImages-Ud9lZ6w-.js} +10 -13
- package/dist/{UnsplashImages-_tnynHFB.cjs → UnsplashImages-qlE_2pmY.cjs} +1 -1
- package/dist/{UploadImages-Yom319eJ.js → UploadImages-bHQHGRwC.js} +2 -2
- package/dist/{UploadImages-6xXHWwiA.cjs → UploadImages-bZWXchWP.cjs} +1 -1
- package/dist/{context-menu-YGd09SE1.js → context-menu-FPX89OKr.js} +72 -72
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +5 -5
- package/dist/index-2TBvmH_p.cjs +63 -0
- package/dist/{index-e6K6XOp1.js → index-ylSqM31Z.js} +1294 -1331
- package/dist/ui.js +2 -2
- package/package.json +1 -1
- package/dist/Topbar-3h7dkWBH.js +0 -124
- package/dist/Topbar-GjOHwHud.cjs +0 -1
- package/dist/index-hP_tO2sg.cjs +0 -63
|
@@ -4,7 +4,7 @@ var U = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
|
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { aq as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, N as Tooltip, O as TooltipTrigger, P as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, L as Label, T as Textarea, y as CardFooter, D as Dialog, r as DialogTrigger, s as DialogContent, t as DialogHeader, v as DialogTitle, w as DialogDescription, u as DialogFooter, U as Popover, V as PopoverTrigger, W as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, H as Tabs, J as TabsList, K as TabsTrigger, M as TabsContent, a as Switch, A as Accordion, d as AccordionItem, e as AccordionTrigger, f as AccordionContent, an as useToast, I as Input$1, R as TooltipPortal, a6 as DropdownMenu, a7 as DropdownMenuTrigger, a8 as DropdownMenuContent, S as ScrollArea, ac as DropdownMenuLabel, ad as DropdownMenuSeparator, af as DropdownMenuGroup, a9 as DropdownMenuItem, ae as DropdownMenuShortcut, i as AlertDialog, k as AlertDialogContent, l as AlertDialogHeader, n as AlertDialogTitle, j as AlertDialogTrigger, o as AlertDialogDescription, m as AlertDialogFooter, q as AlertDialogCancel, p as AlertDialogAction, aa as DropdownMenuCheckboxItem, X as HoverCard, Y as HoverCardTrigger, Z as HoverCardContent, al as Separator, g as Badge, _ as Select, a1 as SelectTrigger, a0 as SelectValue, a2 as SelectContent, a4 as SelectItem, Q as TooltipProvider, ap as Toaster } from "./context-menu-FPX89OKr.js";
|
|
8
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, merge, 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";
|
|
@@ -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,
|
|
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";
|
|
23
23
|
import { createEvent } from "react-event-hook";
|
|
24
24
|
import typography$1 from "@tailwindcss/typography";
|
|
25
25
|
import forms from "@tailwindcss/forms";
|
|
@@ -89,278 +89,278 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
89
89
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
90
90
|
let a, l, i;
|
|
91
91
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
92
|
-
const c = (
|
|
93
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
94
|
-
const
|
|
95
|
-
if (o.set(
|
|
96
|
-
const
|
|
97
|
-
cancelPromise(
|
|
92
|
+
const c = (f) => o.get(f), d = (f, _) => {
|
|
93
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
|
|
94
|
+
const C = o.get(f);
|
|
95
|
+
if (o.set(f, _), r.has(f) || r.set(f, C), C && hasPromiseAtomValue(C)) {
|
|
96
|
+
const w = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
|
|
97
|
+
cancelPromise(C.v, w);
|
|
98
98
|
}
|
|
99
|
-
},
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
!
|
|
104
|
-
}), (
|
|
105
|
-
},
|
|
106
|
-
const
|
|
107
|
-
d: (
|
|
108
|
-
v
|
|
99
|
+
}, u = (f, _, C) => {
|
|
100
|
+
const w = /* @__PURE__ */ new Map();
|
|
101
|
+
let I = !1;
|
|
102
|
+
C.forEach((N, D) => {
|
|
103
|
+
!N && D === f && (N = _), N ? (w.set(D, N), _.d.get(D) !== N && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
104
|
+
}), (I || _.d.size !== w.size) && (_.d = w);
|
|
105
|
+
}, p = (f, _, C) => {
|
|
106
|
+
const w = c(f), I = {
|
|
107
|
+
d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
|
|
108
|
+
v: _
|
|
109
109
|
};
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
|
|
110
|
+
if (C && u(f, I, C), w && isEqualAtomValue(w, I) && w.d === I.d)
|
|
111
|
+
return w;
|
|
112
|
+
if (w && hasPromiseAtomValue(w) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(w, I)) {
|
|
113
|
+
if (w.d === I.d)
|
|
114
|
+
return w;
|
|
115
|
+
I.v = w.v;
|
|
116
116
|
}
|
|
117
|
-
return d(
|
|
118
|
-
}, m = (
|
|
119
|
-
if (isPromiseLike$2(
|
|
120
|
-
let
|
|
121
|
-
const
|
|
117
|
+
return d(f, I), I;
|
|
118
|
+
}, m = (f, _, C, w) => {
|
|
119
|
+
if (isPromiseLike$2(_)) {
|
|
120
|
+
let I;
|
|
121
|
+
const N = new Promise((D, V) => {
|
|
122
122
|
let M = !1;
|
|
123
|
-
|
|
123
|
+
_.then(
|
|
124
124
|
(O) => {
|
|
125
125
|
if (!M) {
|
|
126
126
|
M = !0;
|
|
127
|
-
const $ = c(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const $ = c(f), H = p(
|
|
128
|
+
f,
|
|
129
|
+
N,
|
|
130
|
+
C
|
|
131
131
|
);
|
|
132
|
-
resolvePromise(
|
|
132
|
+
resolvePromise(N, O), D(O), ($ == null ? void 0 : $.d) !== H.d && T(f, H, $ == null ? void 0 : $.d);
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
(O) => {
|
|
136
136
|
if (!M) {
|
|
137
137
|
M = !0;
|
|
138
|
-
const $ = c(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
const $ = c(f), H = p(
|
|
139
|
+
f,
|
|
140
|
+
N,
|
|
141
|
+
C
|
|
142
142
|
);
|
|
143
|
-
rejectPromise(
|
|
143
|
+
rejectPromise(N, O), V(O), ($ == null ? void 0 : $.d) !== H.d && T(f, H, $ == null ? void 0 : $.d);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
),
|
|
146
|
+
), I = (O) => {
|
|
147
147
|
M || (M = !0, O.then(
|
|
148
|
-
($) => resolvePromise(
|
|
149
|
-
($) => rejectPromise(
|
|
150
|
-
),
|
|
148
|
+
($) => resolvePromise(N, $),
|
|
149
|
+
($) => rejectPromise(N, $)
|
|
150
|
+
), D(O));
|
|
151
151
|
};
|
|
152
152
|
});
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
}),
|
|
153
|
+
return N.orig = _, N.status = "pending", registerCancelPromise(N, (D) => {
|
|
154
|
+
D && I(D), w == null || w();
|
|
155
|
+
}), p(f, N, C);
|
|
156
156
|
}
|
|
157
|
-
return
|
|
158
|
-
},
|
|
159
|
-
const
|
|
160
|
-
d: (
|
|
161
|
-
e:
|
|
157
|
+
return p(f, _, C);
|
|
158
|
+
}, g = (f, _, C) => {
|
|
159
|
+
const w = c(f), I = {
|
|
160
|
+
d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
|
|
161
|
+
e: _
|
|
162
162
|
};
|
|
163
|
-
return
|
|
164
|
-
},
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
O !==
|
|
168
|
-
}), Array.from(
|
|
163
|
+
return C && u(f, I, C), w && isEqualAtomError(w, I) && w.d === I.d ? w : (d(f, I), I);
|
|
164
|
+
}, x = (f) => {
|
|
165
|
+
const _ = c(f);
|
|
166
|
+
if (_ && (_.d.forEach((M, O) => {
|
|
167
|
+
O !== f && !n.has(O) && x(O);
|
|
168
|
+
}), Array.from(_.d).every(([M, O]) => {
|
|
169
169
|
const $ = c(M);
|
|
170
|
-
return M ===
|
|
170
|
+
return M === f || $ === O || // TODO This is a hack, we should find a better solution.
|
|
171
171
|
$ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
|
|
172
172
|
})))
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
const
|
|
177
|
-
if (M ===
|
|
173
|
+
return _;
|
|
174
|
+
const C = /* @__PURE__ */ new Map();
|
|
175
|
+
let w = !0;
|
|
176
|
+
const I = (M) => {
|
|
177
|
+
if (M === f) {
|
|
178
178
|
const $ = c(M);
|
|
179
179
|
if ($)
|
|
180
|
-
return
|
|
180
|
+
return C.set(M, $), returnAtomValue($);
|
|
181
181
|
if (hasInitialValue(M))
|
|
182
|
-
return
|
|
182
|
+
return C.set(M, void 0), M.init;
|
|
183
183
|
throw new Error("no atom init");
|
|
184
184
|
}
|
|
185
|
-
const O =
|
|
186
|
-
return
|
|
185
|
+
const O = x(M);
|
|
186
|
+
return C.set(M, O), returnAtomValue(O);
|
|
187
187
|
};
|
|
188
|
-
let
|
|
188
|
+
let N, D;
|
|
189
189
|
const V = {
|
|
190
190
|
get signal() {
|
|
191
|
-
return
|
|
191
|
+
return N || (N = new AbortController()), N.signal;
|
|
192
192
|
},
|
|
193
193
|
get setSelf() {
|
|
194
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
195
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
196
|
-
return B(
|
|
197
|
-
}),
|
|
194
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
|
|
195
|
+
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && w && console.warn("setSelf function cannot be called in sync"), !w)
|
|
196
|
+
return B(f, ...M);
|
|
197
|
+
}), D;
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
try {
|
|
201
|
-
const M =
|
|
201
|
+
const M = f.read(I, V);
|
|
202
202
|
return m(
|
|
203
|
-
|
|
203
|
+
f,
|
|
204
204
|
M,
|
|
205
|
-
|
|
206
|
-
() =>
|
|
205
|
+
C,
|
|
206
|
+
() => N == null ? void 0 : N.abort()
|
|
207
207
|
);
|
|
208
208
|
} catch (M) {
|
|
209
|
-
return
|
|
209
|
+
return g(f, M, C);
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
w = !1;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
214
|
-
let
|
|
215
|
-
return
|
|
216
|
-
},
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
V !==
|
|
213
|
+
}, j = (f) => returnAtomValue(x(f)), E = (f) => {
|
|
214
|
+
let _ = n.get(f);
|
|
215
|
+
return _ || (_ = R(f)), _;
|
|
216
|
+
}, b = (f, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(f)), k = (f) => {
|
|
217
|
+
const _ = n.get(f);
|
|
218
|
+
_ && b(f, _) && A(f);
|
|
219
|
+
}, v = (f) => {
|
|
220
|
+
const _ = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), w = (N) => {
|
|
221
|
+
const D = n.get(N);
|
|
222
|
+
D == null || D.t.forEach((V) => {
|
|
223
|
+
V !== N && (_.set(
|
|
224
224
|
V,
|
|
225
|
-
(
|
|
226
|
-
),
|
|
225
|
+
(_.get(V) || /* @__PURE__ */ new Set()).add(N)
|
|
226
|
+
), C.set(V, (C.get(V) || 0) + 1), w(V));
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
229
|
+
w(f);
|
|
230
|
+
const I = (N) => {
|
|
231
|
+
const D = n.get(N);
|
|
232
|
+
D == null || D.t.forEach((V) => {
|
|
233
233
|
var M;
|
|
234
|
-
if (V !==
|
|
235
|
-
let O =
|
|
236
|
-
if (O &&
|
|
237
|
-
let $ = !!((M =
|
|
234
|
+
if (V !== N) {
|
|
235
|
+
let O = C.get(V);
|
|
236
|
+
if (O && C.set(V, --O), !O) {
|
|
237
|
+
let $ = !!((M = _.get(V)) != null && M.size);
|
|
238
238
|
if ($) {
|
|
239
|
-
const H = c(V), F =
|
|
239
|
+
const H = c(V), F = x(V);
|
|
240
240
|
$ = !H || !isEqualAtomValue(H, F);
|
|
241
241
|
}
|
|
242
|
-
$ ||
|
|
242
|
+
$ || _.forEach((H) => H.delete(V));
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
I(V);
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
let
|
|
251
|
-
const
|
|
248
|
+
I(f);
|
|
249
|
+
}, S = (f, ..._) => {
|
|
250
|
+
let C = !0;
|
|
251
|
+
const w = (D) => returnAtomValue(x(D)), I = (D, ...V) => {
|
|
252
252
|
let M;
|
|
253
|
-
if (
|
|
254
|
-
if (!hasInitialValue(
|
|
253
|
+
if (D === f) {
|
|
254
|
+
if (!hasInitialValue(D))
|
|
255
255
|
throw new Error("atom not writable");
|
|
256
|
-
const O = c(
|
|
257
|
-
(!O || !isEqualAtomValue(O, $)) &&
|
|
256
|
+
const O = c(D), $ = m(D, V[0]);
|
|
257
|
+
(!O || !isEqualAtomValue(O, $)) && v(D);
|
|
258
258
|
} else
|
|
259
|
-
M =
|
|
260
|
-
if (!
|
|
261
|
-
const O =
|
|
259
|
+
M = S(D, ...V);
|
|
260
|
+
if (!C) {
|
|
261
|
+
const O = L();
|
|
262
262
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
263
263
|
($) => $({ type: "async-write", flushed: O })
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
return M;
|
|
267
|
-
},
|
|
268
|
-
return
|
|
269
|
-
}, B = (
|
|
270
|
-
const
|
|
267
|
+
}, N = f.write(w, I, ..._);
|
|
268
|
+
return C = !1, N;
|
|
269
|
+
}, B = (f, ..._) => {
|
|
270
|
+
const C = S(f, ..._), w = L();
|
|
271
271
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
272
|
-
(
|
|
273
|
-
),
|
|
274
|
-
}, R = (
|
|
275
|
-
const
|
|
276
|
-
t: new Set(
|
|
272
|
+
(I) => I({ type: "write", flushed: w })
|
|
273
|
+
), C;
|
|
274
|
+
}, R = (f, _) => {
|
|
275
|
+
const C = {
|
|
276
|
+
t: new Set(_ && [_]),
|
|
277
277
|
l: /* @__PURE__ */ new Set()
|
|
278
278
|
};
|
|
279
|
-
if (n.set(
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
}),
|
|
283
|
-
const
|
|
284
|
-
|
|
279
|
+
if (n.set(f, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((w, I) => {
|
|
280
|
+
const N = n.get(I);
|
|
281
|
+
N ? N.t.add(f) : I !== f && R(I, f);
|
|
282
|
+
}), x(f), isActuallyWritableAtom(f) && f.onMount) {
|
|
283
|
+
const w = f.onMount((...I) => B(f, ...I));
|
|
284
|
+
w && (C.u = w);
|
|
285
285
|
}
|
|
286
|
-
return
|
|
287
|
-
}, A = (
|
|
288
|
-
var
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
|
|
286
|
+
return C;
|
|
287
|
+
}, A = (f) => {
|
|
288
|
+
var _;
|
|
289
|
+
const C = (_ = n.get(f)) == null ? void 0 : _.u;
|
|
290
|
+
C && C(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
|
|
291
|
+
const w = c(f);
|
|
292
|
+
w ? (hasPromiseAtomValue(w) && cancelPromise(w.v), w.d.forEach((I, N) => {
|
|
293
|
+
if (N !== f) {
|
|
294
|
+
const D = n.get(N);
|
|
295
|
+
D && (D.t.delete(f), b(N, D) && A(N));
|
|
296
296
|
}
|
|
297
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
298
|
-
},
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
297
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
|
|
298
|
+
}, T = (f, _, C) => {
|
|
299
|
+
const w = new Set(_.d.keys());
|
|
300
|
+
C == null || C.forEach((I, N) => {
|
|
301
|
+
if (w.has(N)) {
|
|
302
|
+
w.delete(N);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
}),
|
|
308
|
-
const
|
|
309
|
-
|
|
305
|
+
const D = n.get(N);
|
|
306
|
+
D && (D.t.delete(f), b(N, D) && A(N));
|
|
307
|
+
}), w.forEach((I) => {
|
|
308
|
+
const N = n.get(I);
|
|
309
|
+
N ? N.t.add(f) : n.has(f) && R(I, f);
|
|
310
310
|
});
|
|
311
|
-
},
|
|
312
|
-
let
|
|
313
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
314
|
-
const
|
|
315
|
-
r.clear(),
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
311
|
+
}, L = () => {
|
|
312
|
+
let f;
|
|
313
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
|
|
314
|
+
const _ = Array.from(r);
|
|
315
|
+
r.clear(), _.forEach(([C, w]) => {
|
|
316
|
+
const I = c(C);
|
|
317
|
+
if (I) {
|
|
318
|
+
I.d !== (w == null ? void 0 : w.d) && T(C, I, w == null ? void 0 : w.d);
|
|
319
|
+
const N = n.get(C);
|
|
320
|
+
N && !// TODO This seems pretty hacky. Hope to fix it.
|
|
321
321
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
322
|
-
(
|
|
322
|
+
(w && !hasPromiseAtomValue(w) && (isEqualAtomValue(w, I) || isEqualAtomError(w, I))) && (N.l.forEach((D) => D()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.add(C));
|
|
323
323
|
} else
|
|
324
324
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
328
|
-
return a.forEach((
|
|
329
|
-
},
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
(
|
|
328
|
+
return a.forEach((_) => _("state")), f;
|
|
329
|
+
}, P = (f, _) => {
|
|
330
|
+
const C = E(f), w = L(), I = C.l;
|
|
331
|
+
return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("sub")), l.forEach(
|
|
332
|
+
(N) => N({ type: "sub", flushed: w })
|
|
333
333
|
)), () => {
|
|
334
|
-
|
|
334
|
+
I.delete(_), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("unsub")), l.forEach((N) => N({ type: "unsub" })));
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
337
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
338
|
-
get:
|
|
338
|
+
get: j,
|
|
339
339
|
set: B,
|
|
340
|
-
sub:
|
|
340
|
+
sub: P,
|
|
341
341
|
// store dev methods (these are tentative and subject to change without notice)
|
|
342
|
-
dev_subscribe_store: (
|
|
342
|
+
dev_subscribe_store: (f, _) => _ !== 2 ? (console.warn(
|
|
343
343
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
344
|
-
), a.add(
|
|
345
|
-
a.delete(
|
|
346
|
-
}) : (l.add(
|
|
347
|
-
l.delete(
|
|
344
|
+
), a.add(f), () => {
|
|
345
|
+
a.delete(f);
|
|
346
|
+
}) : (l.add(f), () => {
|
|
347
|
+
l.delete(f);
|
|
348
348
|
}),
|
|
349
349
|
dev_get_mounted_atoms: () => i.values(),
|
|
350
|
-
dev_get_atom_state: (
|
|
351
|
-
dev_get_mounted: (
|
|
352
|
-
dev_restore_atoms: (
|
|
353
|
-
for (const [
|
|
354
|
-
hasInitialValue(
|
|
355
|
-
const
|
|
350
|
+
dev_get_atom_state: (f) => o.get(f),
|
|
351
|
+
dev_get_mounted: (f) => n.get(f),
|
|
352
|
+
dev_restore_atoms: (f) => {
|
|
353
|
+
for (const [C, w] of f)
|
|
354
|
+
hasInitialValue(C) && (m(C, w), v(C));
|
|
355
|
+
const _ = L();
|
|
356
356
|
l.forEach(
|
|
357
|
-
(
|
|
357
|
+
(C) => C({ type: "restore", flushed: _ })
|
|
358
358
|
);
|
|
359
359
|
}
|
|
360
360
|
} : {
|
|
361
|
-
get:
|
|
361
|
+
get: j,
|
|
362
362
|
set: B,
|
|
363
|
-
sub:
|
|
363
|
+
sub: P
|
|
364
364
|
};
|
|
365
365
|
};
|
|
366
366
|
let defaultStore;
|
|
@@ -374,86 +374,86 @@ function splitAtom(o, n) {
|
|
|
374
374
|
return memo2$1(
|
|
375
375
|
() => {
|
|
376
376
|
const r = /* @__PURE__ */ new WeakMap(), a = (c, d) => {
|
|
377
|
-
let
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
380
|
-
const
|
|
381
|
-
return c.forEach((
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
m[
|
|
377
|
+
let u = r.get(c);
|
|
378
|
+
if (u)
|
|
379
|
+
return u;
|
|
380
|
+
const p = d && r.get(d), m = [], g = [];
|
|
381
|
+
return c.forEach((x, j) => {
|
|
382
|
+
const E = n ? n(x) : j;
|
|
383
|
+
g[j] = E;
|
|
384
|
+
const b = p && p.atomList[p.keyList.indexOf(E)];
|
|
385
|
+
if (b) {
|
|
386
|
+
m[j] = b;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
const k = (
|
|
390
|
-
const B =
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
return
|
|
389
|
+
const k = (S) => {
|
|
390
|
+
const B = S(l), R = S(o), T = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
|
|
391
|
+
if (T < 0 || T >= R.length) {
|
|
392
|
+
const L = c[a(c).keyList.indexOf(E)];
|
|
393
|
+
if (L)
|
|
394
|
+
return L;
|
|
395
395
|
throw new Error("splitAtom: index out of bounds for read");
|
|
396
396
|
}
|
|
397
|
-
return R[
|
|
398
|
-
},
|
|
399
|
-
const A =
|
|
400
|
-
if (
|
|
397
|
+
return R[T];
|
|
398
|
+
}, v = (S, B, R) => {
|
|
399
|
+
const A = S(l), T = S(o), P = a(T, A == null ? void 0 : A.arr).keyList.indexOf(E);
|
|
400
|
+
if (P < 0 || P >= T.length)
|
|
401
401
|
throw new Error("splitAtom: index out of bounds for write");
|
|
402
|
-
const
|
|
402
|
+
const f = isFunction(R) ? R(T[P]) : R;
|
|
403
403
|
B(o, [
|
|
404
|
-
...
|
|
405
|
-
|
|
406
|
-
...
|
|
404
|
+
...T.slice(0, P),
|
|
405
|
+
f,
|
|
406
|
+
...T.slice(P + 1)
|
|
407
407
|
]);
|
|
408
408
|
};
|
|
409
|
-
m[
|
|
410
|
-
}),
|
|
409
|
+
m[j] = isWritable(o) ? atom(k, v) : atom(k);
|
|
410
|
+
}), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
|
|
411
411
|
}, l = atom((c) => {
|
|
412
|
-
const d = c(l),
|
|
413
|
-
return a(
|
|
412
|
+
const d = c(l), u = c(o);
|
|
413
|
+
return a(u, d == null ? void 0 : d.arr);
|
|
414
414
|
});
|
|
415
415
|
(define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (l.debugPrivate = !0), l.init = void 0;
|
|
416
416
|
const i = isWritable(o) ? atom(
|
|
417
417
|
(c) => c(l).atomList,
|
|
418
|
-
(c, d,
|
|
419
|
-
switch (
|
|
418
|
+
(c, d, u) => {
|
|
419
|
+
switch (u.type) {
|
|
420
420
|
case "remove": {
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
421
|
+
const p = c(i).indexOf(u.atom);
|
|
422
|
+
if (p >= 0) {
|
|
423
423
|
const m = c(o);
|
|
424
424
|
d(o, [
|
|
425
|
-
...m.slice(0,
|
|
426
|
-
...m.slice(
|
|
425
|
+
...m.slice(0, p),
|
|
426
|
+
...m.slice(p + 1)
|
|
427
427
|
]);
|
|
428
428
|
}
|
|
429
429
|
break;
|
|
430
430
|
}
|
|
431
431
|
case "insert": {
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
432
|
+
const p = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
433
|
+
if (p >= 0) {
|
|
434
434
|
const m = c(o);
|
|
435
435
|
d(o, [
|
|
436
|
-
...m.slice(0,
|
|
437
|
-
|
|
438
|
-
...m.slice(
|
|
436
|
+
...m.slice(0, p),
|
|
437
|
+
u.value,
|
|
438
|
+
...m.slice(p)
|
|
439
439
|
]);
|
|
440
440
|
}
|
|
441
441
|
break;
|
|
442
442
|
}
|
|
443
443
|
case "move": {
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
...
|
|
449
|
-
...
|
|
450
|
-
|
|
451
|
-
...
|
|
444
|
+
const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
445
|
+
if (p >= 0 && m >= 0) {
|
|
446
|
+
const g = c(o);
|
|
447
|
+
p < m ? d(o, [
|
|
448
|
+
...g.slice(0, p),
|
|
449
|
+
...g.slice(p + 1, m),
|
|
450
|
+
g[p],
|
|
451
|
+
...g.slice(m)
|
|
452
452
|
]) : d(o, [
|
|
453
|
-
...
|
|
454
|
-
|
|
455
|
-
...
|
|
456
|
-
...
|
|
453
|
+
...g.slice(0, m),
|
|
454
|
+
g[p],
|
|
455
|
+
...g.slice(m, p),
|
|
456
|
+
...g.slice(p + 1)
|
|
457
457
|
]);
|
|
458
458
|
}
|
|
459
459
|
break;
|
|
@@ -473,7 +473,7 @@ function createJSONStorage(o) {
|
|
|
473
473
|
const a = {
|
|
474
474
|
getItem: (l, i) => {
|
|
475
475
|
var c, d;
|
|
476
|
-
const
|
|
476
|
+
const u = (m) => {
|
|
477
477
|
if (m = m || "", n !== m) {
|
|
478
478
|
try {
|
|
479
479
|
r = JSON.parse(m);
|
|
@@ -483,8 +483,8 @@ function createJSONStorage(o) {
|
|
|
483
483
|
n = m;
|
|
484
484
|
}
|
|
485
485
|
return r;
|
|
486
|
-
},
|
|
487
|
-
return isPromiseLike$1(
|
|
486
|
+
}, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
|
|
487
|
+
return isPromiseLike$1(p) ? p.then(u) : u(p);
|
|
488
488
|
},
|
|
489
489
|
setItem: (l, i) => {
|
|
490
490
|
var c;
|
|
@@ -499,15 +499,15 @@ function createJSONStorage(o) {
|
|
|
499
499
|
if (!(o() instanceof window.Storage))
|
|
500
500
|
return () => {
|
|
501
501
|
};
|
|
502
|
-
const d = (
|
|
503
|
-
if (
|
|
504
|
-
let
|
|
502
|
+
const d = (u) => {
|
|
503
|
+
if (u.storageArea === o() && u.key === l) {
|
|
504
|
+
let p;
|
|
505
505
|
try {
|
|
506
|
-
|
|
506
|
+
p = JSON.parse(u.newValue || "");
|
|
507
507
|
} catch {
|
|
508
|
-
|
|
508
|
+
p = c;
|
|
509
509
|
}
|
|
510
|
-
i(
|
|
510
|
+
i(p);
|
|
511
511
|
}
|
|
512
512
|
};
|
|
513
513
|
return window.addEventListener("storage", d), () => {
|
|
@@ -524,13 +524,13 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
|
|
|
524
524
|
);
|
|
525
525
|
return (define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (i.debugPrivate = !0), i.onMount = (d) => {
|
|
526
526
|
l || d(r.getItem(o, n));
|
|
527
|
-
let
|
|
528
|
-
return r.subscribe && (
|
|
527
|
+
let u;
|
|
528
|
+
return r.subscribe && (u = r.subscribe(o, d, n)), u;
|
|
529
529
|
}, atom(
|
|
530
530
|
(d) => d(i),
|
|
531
|
-
(d,
|
|
532
|
-
const m = typeof
|
|
533
|
-
return m === RESET ? (
|
|
531
|
+
(d, u, p) => {
|
|
532
|
+
const m = typeof p == "function" ? p(d(i)) : p;
|
|
533
|
+
return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((g) => (u(i, g), r.setItem(o, g))) : (u(i, m), r.setItem(o, m));
|
|
534
534
|
}
|
|
535
535
|
);
|
|
536
536
|
}
|
|
@@ -554,26 +554,26 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
554
554
|
});
|
|
555
555
|
function useAtomValue(o, n) {
|
|
556
556
|
const r = useStore(n), [[a, l, i], c] = useReducer(
|
|
557
|
-
(
|
|
557
|
+
(p) => {
|
|
558
558
|
const m = r.get(o);
|
|
559
|
-
return Object.is(
|
|
559
|
+
return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
|
|
560
560
|
},
|
|
561
561
|
void 0,
|
|
562
562
|
() => [r.get(o), r, o]
|
|
563
563
|
);
|
|
564
564
|
let d = a;
|
|
565
565
|
(l !== r || i !== o) && (c(), d = r.get(o));
|
|
566
|
-
const
|
|
566
|
+
const u = n == null ? void 0 : n.delay;
|
|
567
567
|
return useEffect(() => {
|
|
568
|
-
const
|
|
569
|
-
if (typeof
|
|
570
|
-
setTimeout(c,
|
|
568
|
+
const p = r.sub(o, () => {
|
|
569
|
+
if (typeof u == "number") {
|
|
570
|
+
setTimeout(c, u);
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
573
|
c();
|
|
574
574
|
});
|
|
575
|
-
return c(),
|
|
576
|
-
}, [r, o,
|
|
575
|
+
return c(), p;
|
|
576
|
+
}, [r, o, u]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
|
|
577
577
|
}
|
|
578
578
|
function useSetAtom(o, n) {
|
|
579
579
|
const r = useStore(n);
|
|
@@ -638,10 +638,10 @@ const getSlots = (o) => {
|
|
|
638
638
|
filter(o, { _parent: n }).length > 0 && l.push(flatten(duplicateBlocks(o, n, a._id)));
|
|
639
639
|
const i = flatten(l);
|
|
640
640
|
return map(i, (c) => {
|
|
641
|
-
const d = c,
|
|
642
|
-
return Object.keys(
|
|
643
|
-
const m = find(i, { oldId: p
|
|
644
|
-
d[
|
|
641
|
+
const d = c, u = getSlots(d);
|
|
642
|
+
return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
|
|
643
|
+
const m = find(i, { oldId: u[p].replace("slot:", "") });
|
|
644
|
+
d[p] = `slot:${m._id}`;
|
|
645
645
|
}), omit(d, ["global", "oldId"]);
|
|
646
646
|
});
|
|
647
647
|
}, presentBlocksAtom = atom$1([]);
|
|
@@ -746,8 +746,8 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
746
746
|
}, getBlockJSONFromSchemas = (o, n, r) => {
|
|
747
747
|
switch (o.type) {
|
|
748
748
|
case "singular": {
|
|
749
|
-
const
|
|
750
|
-
return
|
|
749
|
+
const p = o.schema;
|
|
750
|
+
return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
|
|
751
751
|
}
|
|
752
752
|
case "model":
|
|
753
753
|
const { properties: a, title: l } = o, i = {
|
|
@@ -755,15 +755,15 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
755
755
|
type: "object",
|
|
756
756
|
properties: {}
|
|
757
757
|
};
|
|
758
|
-
return Object.keys(a).forEach((
|
|
759
|
-
const m = a[
|
|
758
|
+
return Object.keys(a).forEach((p) => {
|
|
759
|
+
const m = a[p];
|
|
760
760
|
if (includes(["slot", "styles"], m.type))
|
|
761
761
|
return;
|
|
762
|
-
const
|
|
763
|
-
i.properties[
|
|
762
|
+
const g = p;
|
|
763
|
+
i.properties[g] = getBlockJSONFromSchemas(m, n, r);
|
|
764
764
|
}), i;
|
|
765
765
|
case "list":
|
|
766
|
-
const { itemProperties: c, title: d } = o,
|
|
766
|
+
const { itemProperties: c, title: d } = o, u = {
|
|
767
767
|
title: titleWithLang(n(d), r, get(o, "i18n")),
|
|
768
768
|
type: "array",
|
|
769
769
|
items: {
|
|
@@ -771,17 +771,17 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
771
771
|
properties: {}
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
|
-
return Object.keys(c).forEach((
|
|
775
|
-
const m = c[
|
|
774
|
+
return Object.keys(c).forEach((p) => {
|
|
775
|
+
const m = c[p];
|
|
776
776
|
if (includes(["slot", "styles"], m.type))
|
|
777
777
|
return;
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
778
|
+
const g = p;
|
|
779
|
+
u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
|
|
780
|
+
u.items,
|
|
781
781
|
"title",
|
|
782
782
|
titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
|
|
783
783
|
);
|
|
784
|
-
}),
|
|
784
|
+
}), u;
|
|
785
785
|
default:
|
|
786
786
|
return {};
|
|
787
787
|
}
|
|
@@ -833,8 +833,8 @@ var undomanager = { exports: {} };
|
|
|
833
833
|
}
|
|
834
834
|
let r = function() {
|
|
835
835
|
let a = [], l = -1, i = 0, c = !1, d;
|
|
836
|
-
function p
|
|
837
|
-
return !
|
|
836
|
+
function u(p, m) {
|
|
837
|
+
return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
|
|
838
838
|
}
|
|
839
839
|
return {
|
|
840
840
|
/**
|
|
@@ -844,25 +844,25 @@ var undomanager = { exports: {} };
|
|
|
844
844
|
* @property {function} command.redo - Redo function
|
|
845
845
|
* @property {string} [command.groupId] - Optional group id
|
|
846
846
|
*/
|
|
847
|
-
add: function(
|
|
848
|
-
return c ? this : (a.splice(l + 1, a.length - l), a.push(
|
|
847
|
+
add: function(p) {
|
|
848
|
+
return c ? this : (a.splice(l + 1, a.length - l), a.push(p), i && a.length > i && n(a, 0, -(i + 1)), l = a.length - 1, d && d(), this);
|
|
849
849
|
},
|
|
850
850
|
/**
|
|
851
851
|
* Pass a function to be called on undo and redo actions.
|
|
852
852
|
* @property {function} callbackFunc - Callback function
|
|
853
853
|
*/
|
|
854
|
-
setCallback: function(
|
|
855
|
-
d =
|
|
854
|
+
setCallback: function(p) {
|
|
855
|
+
d = p;
|
|
856
856
|
},
|
|
857
857
|
/**
|
|
858
858
|
* Performs undo: call the undo function at the current index and decrease the index by 1.
|
|
859
859
|
*/
|
|
860
860
|
undo: function() {
|
|
861
|
-
let
|
|
862
|
-
if (!
|
|
861
|
+
let p = a[l];
|
|
862
|
+
if (!p)
|
|
863
863
|
return this;
|
|
864
|
-
const m =
|
|
865
|
-
for (;
|
|
864
|
+
const m = p.groupId;
|
|
865
|
+
for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
|
|
866
866
|
;
|
|
867
867
|
return d && d(), this;
|
|
868
868
|
},
|
|
@@ -870,11 +870,11 @@ var undomanager = { exports: {} };
|
|
|
870
870
|
* Performs redo: call the redo function at the next index and increase the index by 1.
|
|
871
871
|
*/
|
|
872
872
|
redo: function() {
|
|
873
|
-
let
|
|
874
|
-
if (!
|
|
873
|
+
let p = a[l + 1];
|
|
874
|
+
if (!p)
|
|
875
875
|
return this;
|
|
876
|
-
const m =
|
|
877
|
-
for (;
|
|
876
|
+
const m = p.groupId;
|
|
877
|
+
for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
|
|
878
878
|
;
|
|
879
879
|
return d && d(), this;
|
|
880
880
|
},
|
|
@@ -882,8 +882,8 @@ var undomanager = { exports: {} };
|
|
|
882
882
|
* Clears the memory, losing all stored states. Resets the index.
|
|
883
883
|
*/
|
|
884
884
|
clear: function() {
|
|
885
|
-
let
|
|
886
|
-
a = [], l = -1, d &&
|
|
885
|
+
let p = a.length;
|
|
886
|
+
a = [], l = -1, d && p > 0 && d();
|
|
887
887
|
},
|
|
888
888
|
/**
|
|
889
889
|
* Tests if any undo actions exist.
|
|
@@ -904,8 +904,8 @@ var undomanager = { exports: {} };
|
|
|
904
904
|
* @param {string} [groupId] - Optionally filter commands by group ID
|
|
905
905
|
* @returns {array}
|
|
906
906
|
*/
|
|
907
|
-
getCommands: function(
|
|
908
|
-
return
|
|
907
|
+
getCommands: function(p) {
|
|
908
|
+
return p ? a.filter((m) => m.groupId === p) : a;
|
|
909
909
|
},
|
|
910
910
|
/**
|
|
911
911
|
* Returns the index of the actions list.
|
|
@@ -918,8 +918,8 @@ var undomanager = { exports: {} };
|
|
|
918
918
|
* Sets the maximum number of undo steps. Default: 0 (unlimited).
|
|
919
919
|
* @property {number} max - Maximum number of undo steps
|
|
920
920
|
*/
|
|
921
|
-
setLimit: function(
|
|
922
|
-
i =
|
|
921
|
+
setLimit: function(p) {
|
|
922
|
+
i = p;
|
|
923
923
|
}
|
|
924
924
|
};
|
|
925
925
|
};
|
|
@@ -1063,13 +1063,13 @@ dataProvidersAtom.debugLabel = "dataProvidersAtom";
|
|
|
1063
1063
|
const usePageDataProviders = () => useAtom$1(dataProvidersAtom), builderSaveStateAtom = atom$1("SAVED");
|
|
1064
1064
|
builderSaveStateAtom.debugLabel = "builderSaveStateAtom";
|
|
1065
1065
|
const useSavePage = () => {
|
|
1066
|
-
const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (
|
|
1066
|
+
const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
|
|
1067
1067
|
}), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = usePageDataProviders(), [c] = useBrandingOptions();
|
|
1068
1068
|
return { savePage: useThrottledCallback(
|
|
1069
1069
|
async () => {
|
|
1070
1070
|
n("SAVING"), a("SAVING");
|
|
1071
|
-
const
|
|
1072
|
-
return await r({ blocks:
|
|
1071
|
+
const u = l();
|
|
1072
|
+
return await r({ blocks: u.blocks, providers: i, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
|
|
1073
1073
|
n("SAVED"), a("SAVED");
|
|
1074
1074
|
}, 100), !0;
|
|
1075
1075
|
},
|
|
@@ -1112,13 +1112,13 @@ function insertBlocksAtPosition(o, n, r, a) {
|
|
|
1112
1112
|
r && (l = o.filter((d) => d._parent === r));
|
|
1113
1113
|
const i = a !== void 0 ? a : l.length;
|
|
1114
1114
|
let c = o.length;
|
|
1115
|
-
for (let d = 0,
|
|
1115
|
+
for (let d = 0, u = 0; d < o.length; d++)
|
|
1116
1116
|
if (o[d]._parent === r) {
|
|
1117
|
-
if (
|
|
1117
|
+
if (u === i) {
|
|
1118
1118
|
c = d;
|
|
1119
1119
|
break;
|
|
1120
1120
|
}
|
|
1121
|
-
|
|
1121
|
+
u++;
|
|
1122
1122
|
}
|
|
1123
1123
|
return !r && a !== void 0 && a >= l.length && (c = o.length), [...o.slice(0, c), ...n, ...o.slice(c)];
|
|
1124
1124
|
}
|
|
@@ -1148,7 +1148,7 @@ function moveBlocksWithChildren(o, n, r, a) {
|
|
|
1148
1148
|
r = r || "root";
|
|
1149
1149
|
const i = new TreeModel().parse({ _id: "root", children: getBlocksTree(o) });
|
|
1150
1150
|
if (moveNode(i, n, r, a)) {
|
|
1151
|
-
const c = flattenTree(i), d = c.find((
|
|
1151
|
+
const c = flattenTree(i), d = c.find((u) => u._id === n);
|
|
1152
1152
|
return d && (d._parent = r === "root" ? null : r), c.shift(), c;
|
|
1153
1153
|
}
|
|
1154
1154
|
return o;
|
|
@@ -1195,82 +1195,82 @@ const useBlocksStoreManager = () => {
|
|
|
1195
1195
|
updateBlocksProps: c
|
|
1196
1196
|
} = useBlocksStoreManager();
|
|
1197
1197
|
return {
|
|
1198
|
-
moveBlocks: (
|
|
1199
|
-
const
|
|
1200
|
-
const A = n.find((
|
|
1201
|
-
return { _id: B, oldParent: A, oldPosition:
|
|
1202
|
-
}),
|
|
1203
|
-
|
|
1204
|
-
undo: () => each(
|
|
1198
|
+
moveBlocks: (E, b, k) => {
|
|
1199
|
+
const v = map(E, (B) => {
|
|
1200
|
+
const A = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => A ? P._parent === A : !P._parent).map((P) => P._id).indexOf(B);
|
|
1201
|
+
return { _id: B, oldParent: A, oldPosition: L };
|
|
1202
|
+
}), S = v.find(({ _id: B }) => B === E[0]);
|
|
1203
|
+
S && S.oldParent === b && S.oldPosition === k || (i(E, b, k), o({
|
|
1204
|
+
undo: () => each(v, ({ _id: B, oldParent: R, oldPosition: A }) => {
|
|
1205
1205
|
i([B], R, A);
|
|
1206
1206
|
}),
|
|
1207
|
-
redo: () => i(
|
|
1207
|
+
redo: () => i(E, b, k)
|
|
1208
1208
|
}));
|
|
1209
1209
|
},
|
|
1210
|
-
addBlocks: (
|
|
1211
|
-
a(
|
|
1212
|
-
undo: () => l(map(
|
|
1213
|
-
redo: () => a(
|
|
1210
|
+
addBlocks: (E, b, k) => {
|
|
1211
|
+
a(E, b, k), o({
|
|
1212
|
+
undo: () => l(map(E, "_id")),
|
|
1213
|
+
redo: () => a(E, b, k)
|
|
1214
1214
|
});
|
|
1215
1215
|
},
|
|
1216
|
-
removeBlocks: (
|
|
1217
|
-
var
|
|
1218
|
-
const
|
|
1219
|
-
l(map(
|
|
1220
|
-
undo: () => a(
|
|
1221
|
-
redo: () => l(map(
|
|
1216
|
+
removeBlocks: (E) => {
|
|
1217
|
+
var S;
|
|
1218
|
+
const b = (S = first(E)) == null ? void 0 : S._parent, v = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
|
|
1219
|
+
l(map(E, "_id")), o({
|
|
1220
|
+
undo: () => a(E, b, v),
|
|
1221
|
+
redo: () => l(map(E, "_id"))
|
|
1222
1222
|
});
|
|
1223
1223
|
},
|
|
1224
|
-
updateBlocks: (
|
|
1225
|
-
let
|
|
1224
|
+
updateBlocks: (E, b, k) => {
|
|
1225
|
+
let v = [];
|
|
1226
1226
|
if (k)
|
|
1227
|
-
|
|
1227
|
+
v = map(E, (S) => ({ _id: S, ...k }));
|
|
1228
1228
|
else {
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
const R = n.find((
|
|
1232
|
-
return each(
|
|
1229
|
+
const S = keys(b);
|
|
1230
|
+
v = map(E, (B) => {
|
|
1231
|
+
const R = n.find((T) => T._id === B), A = { _id: B };
|
|
1232
|
+
return each(S, (T) => A[T] = R[T]), A;
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
|
-
c(map(
|
|
1236
|
-
undo: () => c(
|
|
1237
|
-
redo: () => c(map(
|
|
1235
|
+
c(map(E, (S) => ({ _id: S, ...b }))), o({
|
|
1236
|
+
undo: () => c(v),
|
|
1237
|
+
redo: () => c(map(E, (S) => ({ _id: S, ...b })))
|
|
1238
1238
|
});
|
|
1239
1239
|
},
|
|
1240
|
-
updateBlocksRuntime: (
|
|
1241
|
-
c(map(
|
|
1240
|
+
updateBlocksRuntime: (E, b) => {
|
|
1241
|
+
c(map(E, (k) => ({ _id: k, ...b })));
|
|
1242
1242
|
},
|
|
1243
|
-
setNewBlocks: (
|
|
1244
|
-
r(
|
|
1243
|
+
setNewBlocks: (E) => {
|
|
1244
|
+
r(E), o({
|
|
1245
1245
|
undo: () => r(n),
|
|
1246
|
-
redo: () => r(
|
|
1246
|
+
redo: () => r(E)
|
|
1247
1247
|
});
|
|
1248
1248
|
},
|
|
1249
|
-
updateMultipleBlocksProps: (
|
|
1250
|
-
let
|
|
1251
|
-
|
|
1252
|
-
const
|
|
1253
|
-
return each(
|
|
1254
|
-
}), c(
|
|
1255
|
-
undo: () => c(
|
|
1256
|
-
redo: () => c(
|
|
1249
|
+
updateMultipleBlocksProps: (E) => {
|
|
1250
|
+
let b = [];
|
|
1251
|
+
b = map(E, (k) => {
|
|
1252
|
+
const v = keys(k), S = n.find((R) => R._id === k._id), B = {};
|
|
1253
|
+
return each(v, (R) => B[R] = S[R]), B;
|
|
1254
|
+
}), c(E), o({
|
|
1255
|
+
undo: () => c(b),
|
|
1256
|
+
redo: () => c(E)
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
1259
1259
|
};
|
|
1260
1260
|
}, useAddBlock = () => {
|
|
1261
1261
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1262
1262
|
(i, c, d) => {
|
|
1263
|
-
var
|
|
1264
|
-
for (let
|
|
1265
|
-
const { _id:
|
|
1266
|
-
i[
|
|
1267
|
-
const
|
|
1268
|
-
for (let k = 0; k <
|
|
1269
|
-
|
|
1263
|
+
var x;
|
|
1264
|
+
for (let j = 0; j < i.length; j++) {
|
|
1265
|
+
const { _id: E } = i[j];
|
|
1266
|
+
i[j]._id = generateUUID();
|
|
1267
|
+
const b = filter(i, { _parent: E });
|
|
1268
|
+
for (let k = 0; k < b.length; k++)
|
|
1269
|
+
b[k]._parent = i[j]._id;
|
|
1270
1270
|
}
|
|
1271
|
-
const
|
|
1272
|
-
let
|
|
1273
|
-
return c && (
|
|
1271
|
+
const u = first(i);
|
|
1272
|
+
let p, m;
|
|
1273
|
+
return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
|
|
1274
1274
|
},
|
|
1275
1275
|
[o, n]
|
|
1276
1276
|
);
|
|
@@ -1280,29 +1280,29 @@ const useBlocksStoreManager = () => {
|
|
|
1280
1280
|
const k = i.blocks;
|
|
1281
1281
|
return a(k, c, d);
|
|
1282
1282
|
}
|
|
1283
|
-
const
|
|
1284
|
-
forIn(
|
|
1283
|
+
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1284
|
+
forIn(p, (k, v) => {
|
|
1285
1285
|
if (startsWith(k, SLOT_KEY)) {
|
|
1286
|
-
const
|
|
1286
|
+
const S = k.replace(SLOT_KEY, "");
|
|
1287
1287
|
m.push({
|
|
1288
|
-
_id:
|
|
1288
|
+
_id: S,
|
|
1289
1289
|
_type: "Slot",
|
|
1290
|
-
_parent:
|
|
1291
|
-
_name: i.props[
|
|
1292
|
-
_styles: i.props[
|
|
1293
|
-
_emptyStyles: i.props[
|
|
1290
|
+
_parent: u,
|
|
1291
|
+
_name: i.props[v].name,
|
|
1292
|
+
_styles: i.props[v].styles,
|
|
1293
|
+
_emptyStyles: i.props[v].emptyStyles
|
|
1294
1294
|
});
|
|
1295
1295
|
}
|
|
1296
1296
|
});
|
|
1297
|
-
const
|
|
1297
|
+
const g = {
|
|
1298
1298
|
_type: i.type,
|
|
1299
|
-
_id:
|
|
1300
|
-
...
|
|
1299
|
+
_id: u,
|
|
1300
|
+
...p
|
|
1301
1301
|
};
|
|
1302
|
-
let
|
|
1303
|
-
c && (
|
|
1304
|
-
const
|
|
1305
|
-
return r(
|
|
1302
|
+
let x, j;
|
|
1303
|
+
c && (x = find(o, { _id: c }), g._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, g._type) && x && (g._parent = x._parent, j = x._parent);
|
|
1304
|
+
const b = [g, ...m];
|
|
1305
|
+
return r(b, j, d), n([g._id]), g;
|
|
1306
1306
|
},
|
|
1307
1307
|
[a, o, n]
|
|
1308
1308
|
), addPredefinedBlock: a };
|
|
@@ -2402,23 +2402,23 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2402
2402
|
o = o.trim().replace(/ +/g, "");
|
|
2403
2403
|
let a = filter(
|
|
2404
2404
|
map(o.split(" "), constructClassObject),
|
|
2405
|
-
(
|
|
2406
|
-
), l = filter(map(n.split(" "), constructClassObject), (
|
|
2405
|
+
(p) => !isNull(p)
|
|
2406
|
+
), l = filter(map(n.split(" "), constructClassObject), (p) => !isNull(p));
|
|
2407
2407
|
l = filter(
|
|
2408
2408
|
l,
|
|
2409
|
-
(
|
|
2409
|
+
(p) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, p.property)
|
|
2410
2410
|
);
|
|
2411
2411
|
const i = [], c = [];
|
|
2412
|
-
each(r, (
|
|
2413
|
-
const m = constructClassObject(
|
|
2414
|
-
if (
|
|
2412
|
+
each(r, (p) => {
|
|
2413
|
+
const m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
|
|
2414
|
+
if (g && (a = filter(
|
|
2415
2415
|
a,
|
|
2416
|
-
(
|
|
2417
|
-
)), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (
|
|
2418
|
-
const
|
|
2419
|
-
|
|
2416
|
+
(x) => x.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2417
|
+
)), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (x) => x.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
|
|
2418
|
+
const x = find(l, pick(m, ["property"]));
|
|
2419
|
+
g && (l = filter(
|
|
2420
2420
|
l,
|
|
2421
|
-
(
|
|
2421
|
+
(j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
|
|
2422
2422
|
)), c.push({
|
|
2423
2423
|
...m,
|
|
2424
2424
|
fullCls: m.cls,
|
|
@@ -2427,11 +2427,11 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2427
2427
|
}
|
|
2428
2428
|
});
|
|
2429
2429
|
const d = map(
|
|
2430
|
-
sortBy([...a, ...i], (
|
|
2430
|
+
sortBy([...a, ...i], (p) => MEDIA_QUERIES[p.mq]),
|
|
2431
2431
|
"fullCls"
|
|
2432
2432
|
).join(" ");
|
|
2433
2433
|
return `${map(
|
|
2434
|
-
sortBy([...l, ...c], (
|
|
2434
|
+
sortBy([...l, ...c], (p) => MEDIA_QUERIES[p.mq]),
|
|
2435
2435
|
"fullCls"
|
|
2436
2436
|
).join(" ").trim()},${d.trim()}`.trim().replace(/ +/g, "");
|
|
2437
2437
|
}
|
|
@@ -2449,10 +2449,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2449
2449
|
)
|
|
2450
2450
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2451
2451
|
return map(l, (c) => {
|
|
2452
|
-
const d = o(c),
|
|
2452
|
+
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
|
|
2453
2453
|
return {
|
|
2454
2454
|
ids: [d._id],
|
|
2455
|
-
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m,
|
|
2455
|
+
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
|
|
2456
2456
|
};
|
|
2457
2457
|
});
|
|
2458
2458
|
}), useAddClassesToBlocks = () => {
|
|
@@ -2501,13 +2501,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2501
2501
|
(a, l = null) => {
|
|
2502
2502
|
const i = [];
|
|
2503
2503
|
each(a, (c) => {
|
|
2504
|
-
const d = o.find((
|
|
2504
|
+
const d = o.find((x) => x._id === c);
|
|
2505
2505
|
l || (l = d._parent);
|
|
2506
2506
|
const m = filter(
|
|
2507
2507
|
o,
|
|
2508
|
-
(
|
|
2509
|
-
).indexOf(d) + 1,
|
|
2510
|
-
r(
|
|
2508
|
+
(x) => isString$1(l) ? x._parent === l : !d._parent
|
|
2509
|
+
).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
|
|
2510
|
+
r(g, l, m), i.push(get(g, "0._id", ""));
|
|
2511
2511
|
}), n(i);
|
|
2512
2512
|
},
|
|
2513
2513
|
[o, n]
|
|
@@ -2548,8 +2548,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2548
2548
|
),
|
|
2549
2549
|
pasteBlocks: useCallback(
|
|
2550
2550
|
(d) => {
|
|
2551
|
-
const
|
|
2552
|
-
isEmpty(o) ? l(n, d) : a(o,
|
|
2551
|
+
const u = Array.isArray(d) ? d[0] : d;
|
|
2552
|
+
isEmpty(o) ? l(n, d) : a(o, u), r([]);
|
|
2553
2553
|
},
|
|
2554
2554
|
[n, o, a, l, r]
|
|
2555
2555
|
)
|
|
@@ -2569,20 +2569,20 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2569
2569
|
)
|
|
2570
2570
|
);
|
|
2571
2571
|
return map(i, (c) => {
|
|
2572
|
-
const d = o(c),
|
|
2573
|
-
let { classes:
|
|
2574
|
-
return each(
|
|
2575
|
-
const
|
|
2576
|
-
|
|
2577
|
-
const
|
|
2578
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2579
|
-
}), each(
|
|
2580
|
-
const
|
|
2581
|
-
m = m.replace(
|
|
2572
|
+
const d = o(c), u = a;
|
|
2573
|
+
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2574
|
+
return each(u, (g) => {
|
|
2575
|
+
const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
|
|
2576
|
+
p = p.replace(j, " ").replace(/ +/g, " ").trim();
|
|
2577
|
+
const E = first(g.split(":"));
|
|
2578
|
+
includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(g.split(":").pop().trim());
|
|
2579
|
+
}), each(u, (g) => {
|
|
2580
|
+
const x = new RegExp(`(^| )${g.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2581
|
+
m = m.replace(x, " ").replace(/ +/g, " ").trim();
|
|
2582
2582
|
}), {
|
|
2583
2583
|
ids: [d._id],
|
|
2584
2584
|
props: {
|
|
2585
|
-
[l.prop]: `${STYLES_KEY}${m},${
|
|
2585
|
+
[l.prop]: `${STYLES_KEY}${m},${p}`
|
|
2586
2586
|
}
|
|
2587
2587
|
};
|
|
2588
2588
|
});
|
|
@@ -2680,10 +2680,10 @@ const useLanguages = () => {
|
|
|
2680
2680
|
const c = r[i];
|
|
2681
2681
|
if (isString$1(c)) {
|
|
2682
2682
|
const d = chunk(c.split(""), 12);
|
|
2683
|
-
let
|
|
2683
|
+
let u = "";
|
|
2684
2684
|
o([n], { [i]: "" });
|
|
2685
|
-
for (let
|
|
2686
|
-
|
|
2685
|
+
for (let p = 0; p < d.length; p++)
|
|
2686
|
+
u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
|
|
2687
2687
|
}
|
|
2688
2688
|
}
|
|
2689
2689
|
},
|
|
@@ -2748,18 +2748,18 @@ const xShowBlocksAtom = atom$1([]);
|
|
|
2748
2748
|
xShowBlocksAtom.debugLabel = "xShowBlocksAtom";
|
|
2749
2749
|
const selectedLibraryAtom = atomWithStorage("_selectedLibrary", null);
|
|
2750
2750
|
selectedLibraryAtom.debugLabel = "selectedLibraryAtom";
|
|
2751
|
-
let lastHighlighted
|
|
2751
|
+
let lastHighlighted = null;
|
|
2752
2752
|
const useBlockHighlight = () => {
|
|
2753
2753
|
const [o] = useAtom$1(canvasIframeAtom);
|
|
2754
2754
|
return { highlightBlock: (a) => {
|
|
2755
2755
|
var c;
|
|
2756
2756
|
const l = o.contentDocument || ((c = o.contentWindow) == null ? void 0 : c.document);
|
|
2757
|
-
lastHighlighted
|
|
2757
|
+
lastHighlighted && lastHighlighted.removeAttribute("data-highlighted");
|
|
2758
2758
|
const i = l.querySelector(`[data-block-id="${a}"]`);
|
|
2759
|
-
i ? (i.setAttribute("data-highlighted", "true"), lastHighlighted
|
|
2759
|
+
i ? (i.setAttribute("data-highlighted", "true"), lastHighlighted = i) : lastHighlighted = null;
|
|
2760
2760
|
}, clearHighlight: () => {
|
|
2761
|
-
lastHighlighted
|
|
2762
|
-
} };
|
|
2761
|
+
lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
|
|
2762
|
+
}, lastHighlighted };
|
|
2763
2763
|
}, globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}), useGlobalBlocksStore = () => {
|
|
2764
2764
|
const [o, n] = useAtom(globalBlocksStoreAtom), r = useCallback(
|
|
2765
2765
|
(l) => get(o, l == null ? void 0 : l.globalBlock, []),
|
|
@@ -2769,18 +2769,18 @@ const useBlockHighlight = () => {
|
|
|
2769
2769
|
}, [n]);
|
|
2770
2770
|
return { getGlobalBlocks: r, reset: a };
|
|
2771
2771
|
}, useWatchGlobalBlocks = () => {
|
|
2772
|
-
const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((
|
|
2772
|
+
const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((u) => u._type === "GlobalBlock").filter((u) => u._type === "GlobalBlock").map((u) => u.globalBlock), [o]);
|
|
2773
2773
|
useEffect(() => {
|
|
2774
2774
|
forEach(c, (d) => {
|
|
2775
|
-
has(n, d) || get(a, `${d}.loading`, !1) || (l((
|
|
2776
|
-
r((
|
|
2777
|
-
...
|
|
2775
|
+
has(n, d) || get(a, `${d}.loading`, !1) || (l((u) => ({ ...u, [d]: { loading: !0, error: null } })), i(d).then((u) => {
|
|
2776
|
+
r((p) => ({ ...p, [d]: u })), l((p) => ({
|
|
2777
|
+
...p,
|
|
2778
2778
|
[d]: { loading: !1, error: null }
|
|
2779
2779
|
}));
|
|
2780
|
-
}).catch((
|
|
2781
|
-
l((
|
|
2782
|
-
...
|
|
2783
|
-
[d]: { loading: !1, error:
|
|
2780
|
+
}).catch((u) => {
|
|
2781
|
+
l((p) => ({
|
|
2782
|
+
...p,
|
|
2783
|
+
[d]: { loading: !1, error: u.message }
|
|
2784
2784
|
}));
|
|
2785
2785
|
}));
|
|
2786
2786
|
});
|
|
@@ -2878,24 +2878,24 @@ const useBlockHighlight = () => {
|
|
|
2878
2878
|
</body>
|
|
2879
2879
|
</html>`, useCanvasScale = (o) => {
|
|
2880
2880
|
const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
|
|
2881
|
-
const { width: d, height:
|
|
2881
|
+
const { width: d, height: u } = o;
|
|
2882
2882
|
if (d < n) {
|
|
2883
|
-
const
|
|
2883
|
+
const p = parseFloat((d / n).toFixed(2).toString());
|
|
2884
2884
|
let m = {};
|
|
2885
|
-
const
|
|
2886
|
-
|
|
2885
|
+
const g = u * p, x = d * p;
|
|
2886
|
+
u && (m = {
|
|
2887
2887
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
2888
|
-
height: 100 + (
|
|
2889
|
-
width: 100 + (d -
|
|
2888
|
+
height: 100 + (u - g) / g * 100 + "%",
|
|
2889
|
+
width: 100 + (d - x) / x * 100 + "%"
|
|
2890
2890
|
}), i({
|
|
2891
2891
|
position: "relative",
|
|
2892
2892
|
top: 0,
|
|
2893
|
-
transform: `scale(${
|
|
2893
|
+
transform: `scale(${p})`,
|
|
2894
2894
|
transformOrigin: a === "rtl" ? "top right" : "top left",
|
|
2895
2895
|
...m,
|
|
2896
2896
|
maxWidth: "none"
|
|
2897
2897
|
// TODO: Add max-width to the wrapper
|
|
2898
|
-
}), r(
|
|
2898
|
+
}), r(p * 100);
|
|
2899
2899
|
} else
|
|
2900
2900
|
i({}), r(100);
|
|
2901
2901
|
}, [n, o, a, r]);
|
|
@@ -3016,8 +3016,8 @@ let iframeDocument = null, possiblePositions = [], dropTarget = null, dropIndex
|
|
|
3016
3016
|
const positionPlaceholder = (o, n, r) => {
|
|
3017
3017
|
if (!iframeDocument || !o)
|
|
3018
3018
|
return;
|
|
3019
|
-
const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([
|
|
3020
|
-
(
|
|
3019
|
+
const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([u]) => u), i = l.reduce(
|
|
3020
|
+
(u, p) => Math.abs(p - r) < Math.abs(u - r) ? p : u,
|
|
3021
3021
|
0
|
|
3022
3022
|
), c = l.indexOf(i);
|
|
3023
3023
|
if (!possiblePositions[c])
|
|
@@ -3062,41 +3062,41 @@ function removeDataDrop() {
|
|
|
3062
3062
|
o && o.removeAttribute("data-drop");
|
|
3063
3063
|
}
|
|
3064
3064
|
const useDnd = () => {
|
|
3065
|
-
const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d,
|
|
3065
|
+
const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, u] = useAtom$1(draggedBlockAtom), [, p] = useAtom$1(dropTargetBlockIdAtom);
|
|
3066
3066
|
if (!useFeature("dnd"))
|
|
3067
3067
|
return {};
|
|
3068
|
-
const
|
|
3069
|
-
removePlaceholder(), r(!1),
|
|
3068
|
+
const g = () => {
|
|
3069
|
+
removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
|
|
3070
3070
|
};
|
|
3071
3071
|
return iframeDocument = o, {
|
|
3072
3072
|
isDragging: n,
|
|
3073
|
-
onDragOver: (
|
|
3074
|
-
|
|
3073
|
+
onDragOver: (x) => {
|
|
3074
|
+
x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
|
|
3075
3075
|
},
|
|
3076
|
-
onDrop: (
|
|
3076
|
+
onDrop: (x) => {
|
|
3077
3077
|
var R;
|
|
3078
|
-
const
|
|
3079
|
-
dropIndex = calculateDropIndex(
|
|
3080
|
-
const k = d,
|
|
3081
|
-
if ((k == null ? void 0 : k._id) ===
|
|
3082
|
-
|
|
3078
|
+
const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
|
|
3079
|
+
dropIndex = calculateDropIndex(b, possiblePositions);
|
|
3080
|
+
const k = d, v = j.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3081
|
+
if ((k == null ? void 0 : k._id) === v || !S) {
|
|
3082
|
+
g();
|
|
3083
3083
|
return;
|
|
3084
3084
|
}
|
|
3085
3085
|
if (!has(k, "_id")) {
|
|
3086
|
-
a(k,
|
|
3086
|
+
a(k, v === "canvas" ? null : v, dropIndex), setTimeout(g, 300);
|
|
3087
3087
|
return;
|
|
3088
3088
|
}
|
|
3089
|
-
let B =
|
|
3090
|
-
B === null && (B =
|
|
3089
|
+
let B = j.getAttribute("data-block-id");
|
|
3090
|
+
B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
|
|
3091
3091
|
},
|
|
3092
|
-
onDragEnter: (
|
|
3093
|
-
const
|
|
3094
|
-
dropTarget =
|
|
3095
|
-
const
|
|
3096
|
-
|
|
3092
|
+
onDragEnter: (x) => {
|
|
3093
|
+
const j = x, E = j.target;
|
|
3094
|
+
dropTarget = E;
|
|
3095
|
+
const b = E.getAttribute("data-block-id"), k = E.getAttribute("data-dnd-dragged") !== "yes";
|
|
3096
|
+
p(b), j.stopPropagation(), j.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(E), r(!0), l(""), i([]);
|
|
3097
3097
|
},
|
|
3098
|
-
onDragLeave: (
|
|
3099
|
-
|
|
3098
|
+
onDragLeave: (x) => {
|
|
3099
|
+
x.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
3100
3100
|
}
|
|
3101
3101
|
};
|
|
3102
3102
|
};
|
|
@@ -3114,113 +3114,109 @@ function destroyQuill(o) {
|
|
|
3114
3114
|
n && n.parentNode.removeChild(n), o = null;
|
|
3115
3115
|
}
|
|
3116
3116
|
const useHandleCanvasDblClick = () => {
|
|
3117
|
-
const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom);
|
|
3118
|
-
return (
|
|
3119
|
-
var
|
|
3117
|
+
const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
|
|
3118
|
+
return (i) => {
|
|
3119
|
+
var g;
|
|
3120
3120
|
if (r)
|
|
3121
3121
|
return;
|
|
3122
|
-
const
|
|
3123
|
-
if (!
|
|
3122
|
+
const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
|
|
3123
|
+
if (!d || !o.includes(d))
|
|
3124
3124
|
return;
|
|
3125
|
-
const
|
|
3126
|
-
|
|
3127
|
-
x.name !== "class" &&
|
|
3128
|
-
}),
|
|
3129
|
-
const p = new Quill(
|
|
3130
|
-
function
|
|
3125
|
+
const u = c.cloneNode(!0);
|
|
3126
|
+
c.style.display = "none", Array.from(u.attributes).forEach((x) => {
|
|
3127
|
+
x.name !== "class" && u.removeAttribute(x.name);
|
|
3128
|
+
}), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
|
|
3129
|
+
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3130
|
+
function m() {
|
|
3131
3131
|
const x = p.getText(0, p.getLength());
|
|
3132
|
-
n([
|
|
3132
|
+
n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l();
|
|
3133
3133
|
}
|
|
3134
|
-
|
|
3135
|
-
(x.key === "Enter" || x.key === "Escape") &&
|
|
3136
|
-
}), p.focus(), (
|
|
3134
|
+
u.addEventListener("blur", m, !0), u.addEventListener("keydown", (x) => {
|
|
3135
|
+
(x.key === "Enter" || x.key === "Escape") && m();
|
|
3136
|
+
}), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
|
|
3137
3137
|
};
|
|
3138
3138
|
}, useHandleCanvasClick = () => {
|
|
3139
|
-
const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom);
|
|
3140
|
-
return (
|
|
3139
|
+
const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
|
|
3140
|
+
return (c) => {
|
|
3141
3141
|
if (a)
|
|
3142
3142
|
return;
|
|
3143
|
-
|
|
3144
|
-
const
|
|
3145
|
-
if (
|
|
3146
|
-
r([]), o([]),
|
|
3143
|
+
c.stopPropagation();
|
|
3144
|
+
const d = getTargetedBlock(c.target);
|
|
3145
|
+
if (d != null && d.getAttribute("data-block-id") && (d == null ? void 0 : d.getAttribute("data-block-id")) === "container") {
|
|
3146
|
+
r([]), o([]), i();
|
|
3147
3147
|
return;
|
|
3148
3148
|
}
|
|
3149
|
-
if (
|
|
3150
|
-
const
|
|
3151
|
-
n.includes(
|
|
3152
|
-
} else if (
|
|
3153
|
-
const
|
|
3154
|
-
n.includes(
|
|
3149
|
+
if (d != null && d.getAttribute("data-block-parent")) {
|
|
3150
|
+
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
|
|
3151
|
+
n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
|
|
3152
|
+
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3153
|
+
const u = d.getAttribute("data-block-id");
|
|
3154
|
+
n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
3155
3155
|
}
|
|
3156
|
-
|
|
3157
|
-
};
|
|
3158
|
-
};
|
|
3159
|
-
let lastHighlighted = null;
|
|
3160
|
-
const handleMouseMove = throttle((o) => {
|
|
3161
|
-
lastHighlighted && lastHighlighted.removeAttribute("data-highlighted");
|
|
3162
|
-
const n = getTargetedBlock(o.target);
|
|
3163
|
-
n ? (n.setAttribute("data-highlighted", "true"), lastHighlighted = n) : lastHighlighted = null;
|
|
3164
|
-
}, 16), useHandleMouseMove = () => {
|
|
3165
|
-
const [o] = useAtom$1(inlineEditingActiveAtom);
|
|
3166
|
-
return (n) => {
|
|
3167
|
-
o || handleMouseMove(n);
|
|
3156
|
+
i();
|
|
3168
3157
|
};
|
|
3169
|
-
},
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3158
|
+
}, useHandleMouseMove = () => {
|
|
3159
|
+
const [o] = useAtom$1(inlineEditingActiveAtom), { highlightBlock: n } = useBlockHighlight();
|
|
3160
|
+
return throttle((r) => {
|
|
3161
|
+
if (o)
|
|
3162
|
+
return;
|
|
3163
|
+
const a = getTargetedBlock(r.target);
|
|
3164
|
+
a && n(a.getAttribute("data-block-id"));
|
|
3165
|
+
}, 16);
|
|
3166
|
+
}, useHandleMouseLeave = () => {
|
|
3167
|
+
const { clearHighlight: o } = useBlockHighlight();
|
|
3168
|
+
return o;
|
|
3169
|
+
}, Canvas = ({ children: o }) => {
|
|
3170
|
+
const { document: n } = useFrame(), [r] = useSelectedBlockIds(), [a, l] = useSelectedStylingBlocks(), { clearHighlight: i } = useBlockHighlight();
|
|
3171
|
+
useEffect(() => i, [i]), useEffect(() => {
|
|
3176
3172
|
setTimeout(() => {
|
|
3177
3173
|
if (!isEmpty(a))
|
|
3178
3174
|
return;
|
|
3179
|
-
const
|
|
3180
|
-
if (
|
|
3181
|
-
const x =
|
|
3175
|
+
const g = getElementByDataBlockId(n, first(r));
|
|
3176
|
+
if (g) {
|
|
3177
|
+
const x = g.getAttribute("data-style-prop");
|
|
3182
3178
|
if (x) {
|
|
3183
|
-
const
|
|
3184
|
-
l([{ id:
|
|
3179
|
+
const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
|
|
3180
|
+
l([{ id: j, prop: x, blockId: E }]);
|
|
3185
3181
|
}
|
|
3186
3182
|
}
|
|
3187
3183
|
}, 100);
|
|
3188
3184
|
}, [n, r, l, a]);
|
|
3189
|
-
const
|
|
3185
|
+
const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), m = useDnd();
|
|
3190
3186
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3191
3187
|
"div",
|
|
3192
3188
|
{
|
|
3193
3189
|
"data-block-id": "canvas",
|
|
3194
3190
|
id: "canvas",
|
|
3195
|
-
onClick:
|
|
3196
|
-
onDoubleClick:
|
|
3197
|
-
onMouseMove:
|
|
3191
|
+
onClick: d,
|
|
3192
|
+
onDoubleClick: c,
|
|
3193
|
+
onMouseMove: u,
|
|
3198
3194
|
onMouseLeave: p,
|
|
3199
|
-
...omit(
|
|
3200
|
-
className: "relative h-full max-w-full p-px " + (
|
|
3195
|
+
...omit(m, "isDragging"),
|
|
3196
|
+
className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
|
|
3201
3197
|
children: o
|
|
3202
3198
|
}
|
|
3203
3199
|
);
|
|
3204
3200
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
|
|
3205
|
-
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [,
|
|
3206
|
-
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", () =>
|
|
3201
|
+
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
|
|
3202
|
+
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(
|
|
3207
3203
|
"ctrl+v,command+v",
|
|
3208
3204
|
() => {
|
|
3209
|
-
|
|
3205
|
+
p(n[0]) && m(n);
|
|
3210
3206
|
},
|
|
3211
3207
|
{},
|
|
3212
|
-
[n,
|
|
3208
|
+
[n, p, m]
|
|
3213
3209
|
);
|
|
3214
|
-
const
|
|
3215
|
-
useHotkeys("esc", () => r([]),
|
|
3210
|
+
const g = o ? { document: o } : {};
|
|
3211
|
+
useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
|
|
3216
3212
|
n,
|
|
3217
3213
|
l
|
|
3218
3214
|
]), useHotkeys(
|
|
3219
3215
|
"del, backspace",
|
|
3220
|
-
(
|
|
3221
|
-
|
|
3216
|
+
(x) => {
|
|
3217
|
+
x.preventDefault(), a(n);
|
|
3222
3218
|
},
|
|
3223
|
-
|
|
3219
|
+
g,
|
|
3224
3220
|
[n, a]
|
|
3225
3221
|
);
|
|
3226
3222
|
}, KeyboardHandler = () => {
|
|
@@ -3249,7 +3245,7 @@ const handleMouseMove = throttle((o) => {
|
|
|
3249
3245
|
}
|
|
3250
3246
|
);
|
|
3251
3247
|
}, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
|
|
3252
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles:
|
|
3248
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
|
|
3253
3249
|
placement: "top-start",
|
|
3254
3250
|
middleware: [shift(), flip()],
|
|
3255
3251
|
elements: {
|
|
@@ -3257,33 +3253,33 @@ const handleMouseMove = throttle((o) => {
|
|
|
3257
3253
|
}
|
|
3258
3254
|
});
|
|
3259
3255
|
useResizeObserver(o, () => m(), o !== null);
|
|
3260
|
-
const
|
|
3256
|
+
const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3261
3257
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3262
3258
|
"div",
|
|
3263
3259
|
{
|
|
3264
3260
|
role: "button",
|
|
3265
3261
|
tabIndex: 0,
|
|
3266
|
-
ref:
|
|
3267
|
-
style:
|
|
3268
|
-
onClick: (
|
|
3269
|
-
|
|
3262
|
+
ref: p.setFloating,
|
|
3263
|
+
style: u,
|
|
3264
|
+
onClick: (j) => {
|
|
3265
|
+
j.stopPropagation(), j.preventDefault();
|
|
3270
3266
|
},
|
|
3271
|
-
onMouseEnter: (
|
|
3272
|
-
|
|
3267
|
+
onMouseEnter: (j) => {
|
|
3268
|
+
j.stopPropagation(), i(null);
|
|
3273
3269
|
},
|
|
3274
|
-
onKeyDown: (
|
|
3270
|
+
onKeyDown: (j) => j.stopPropagation(),
|
|
3275
3271
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3276
3272
|
children: [
|
|
3277
|
-
|
|
3273
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3278
3274
|
ArrowUpIcon,
|
|
3279
3275
|
{
|
|
3280
3276
|
className: "hover:scale-105",
|
|
3281
3277
|
onClick: () => {
|
|
3282
|
-
c([]), l([
|
|
3278
|
+
c([]), l([g]);
|
|
3283
3279
|
}
|
|
3284
3280
|
}
|
|
3285
3281
|
),
|
|
3286
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label:
|
|
3282
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: x, block: n }),
|
|
3287
3283
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
|
|
3288
3284
|
canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3289
3285
|
PlusIcon,
|
|
@@ -3306,29 +3302,29 @@ const handleMouseMove = throttle((o) => {
|
|
|
3306
3302
|
}
|
|
3307
3303
|
) });
|
|
3308
3304
|
}, HeadTags = () => {
|
|
3309
|
-
const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [
|
|
3305
|
+
const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [u] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [p] = useState(
|
|
3310
3306
|
c == null ? void 0 : c.getElementById("selected-block")
|
|
3311
3307
|
), [m] = useState(
|
|
3312
3308
|
c == null ? void 0 : c.getElementById("selected-styling-block")
|
|
3313
|
-
), [
|
|
3309
|
+
), [g] = useState(
|
|
3314
3310
|
c == null ? void 0 : c.getElementById("dragged-block")
|
|
3315
3311
|
);
|
|
3316
3312
|
useEffect(() => {
|
|
3317
3313
|
r ? c == null || c.documentElement.classList.add("dark") : c == null || c.documentElement.classList.remove("dark");
|
|
3318
3314
|
}, [r, c]);
|
|
3319
|
-
const
|
|
3315
|
+
const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
|
|
3320
3316
|
return useEffect(() => {
|
|
3321
|
-
const
|
|
3322
|
-
colors: [
|
|
3317
|
+
const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), v = get(o, "bodyBgDarkColor", "#000"), S = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
|
|
3318
|
+
colors: [E, b],
|
|
3323
3319
|
names: ["primary", "secondary"]
|
|
3324
3320
|
});
|
|
3325
|
-
set(R, "primary.DEFAULT",
|
|
3321
|
+
set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
|
|
3326
3322
|
const A = {
|
|
3327
3323
|
"bg-light": k,
|
|
3328
|
-
"bg-dark":
|
|
3329
|
-
"text-dark":
|
|
3324
|
+
"bg-dark": v,
|
|
3325
|
+
"text-dark": S,
|
|
3330
3326
|
"text-light": B
|
|
3331
|
-
},
|
|
3327
|
+
}, T = get(o, "roundedCorners", "0");
|
|
3332
3328
|
!d || !d.tailwind || (d.tailwind.config = {
|
|
3333
3329
|
darkMode: "class",
|
|
3334
3330
|
theme: {
|
|
@@ -3341,11 +3337,11 @@ const handleMouseMove = throttle((o) => {
|
|
|
3341
3337
|
}
|
|
3342
3338
|
},
|
|
3343
3339
|
fontFamily: {
|
|
3344
|
-
heading: [
|
|
3345
|
-
body: [
|
|
3340
|
+
heading: [x],
|
|
3341
|
+
body: [j]
|
|
3346
3342
|
},
|
|
3347
3343
|
borderRadius: {
|
|
3348
|
-
DEFAULT: `${
|
|
3344
|
+
DEFAULT: `${T || "0"}px`
|
|
3349
3345
|
},
|
|
3350
3346
|
colors: { ...A, ...R }
|
|
3351
3347
|
}
|
|
@@ -3354,60 +3350,60 @@ const handleMouseMove = throttle((o) => {
|
|
|
3354
3350
|
typography$1,
|
|
3355
3351
|
forms,
|
|
3356
3352
|
aspectRatio,
|
|
3357
|
-
plugin(function({ addBase:
|
|
3358
|
-
|
|
3353
|
+
plugin(function({ addBase: L, theme: P }) {
|
|
3354
|
+
L({
|
|
3359
3355
|
"h1,h2,h3,h4,h5,h6": {
|
|
3360
|
-
fontFamily:
|
|
3356
|
+
fontFamily: P("fontFamily.heading")
|
|
3361
3357
|
},
|
|
3362
3358
|
body: {
|
|
3363
|
-
fontFamily:
|
|
3364
|
-
color:
|
|
3365
|
-
backgroundColor:
|
|
3359
|
+
fontFamily: P("fontFamily.body"),
|
|
3360
|
+
color: P("colors.text-light"),
|
|
3361
|
+
backgroundColor: P("colors.bg-light")
|
|
3366
3362
|
},
|
|
3367
3363
|
".dark body": {
|
|
3368
|
-
color:
|
|
3369
|
-
backgroundColor:
|
|
3364
|
+
color: P("colors.text-dark"),
|
|
3365
|
+
backgroundColor: P("colors.bg-dark")
|
|
3370
3366
|
}
|
|
3371
3367
|
});
|
|
3372
3368
|
})
|
|
3373
3369
|
]
|
|
3374
3370
|
});
|
|
3375
|
-
}, [o, d,
|
|
3376
|
-
|
|
3371
|
+
}, [o, d, x, j]), useEffect(() => {
|
|
3372
|
+
p && (p.textContent = `${map(n, (E) => `[data-block-id="${E}"]`).join(",")}{
|
|
3377
3373
|
outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3378
3374
|
}`);
|
|
3379
|
-
}, [n,
|
|
3380
|
-
|
|
3381
|
-
}, [l,
|
|
3382
|
-
|
|
3383
|
-
}, [
|
|
3384
|
-
m && (m.textContent = `${map(a, ({ id:
|
|
3375
|
+
}, [n, p]), useEffect(() => {
|
|
3376
|
+
g.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3377
|
+
}, [l, g]), useEffect(() => {
|
|
3378
|
+
u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
|
|
3379
|
+
}, [u]), useEffect(() => {
|
|
3380
|
+
m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
|
|
3385
3381
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3386
3382
|
}`);
|
|
3387
3383
|
}, [a, m]), useEffect(() => {
|
|
3388
3384
|
c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3389
|
-
}, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (
|
|
3385
|
+
}, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (x || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3390
3386
|
"link",
|
|
3391
3387
|
{
|
|
3392
3388
|
rel: "stylesheet",
|
|
3393
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3389
|
+
href: `https://fonts.googleapis.com/css2?family=${x ? `${x.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` : ""}${x && j && x !== j ? "&" : ""}${j && j !== x ? `family=${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
|
|
3394
3390
|
}
|
|
3395
3391
|
) });
|
|
3396
3392
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
3397
3393
|
const r = ["xs", "sm", "md", "lg", "xl", "2xl"], a = r.indexOf(n), l = o.split(" ");
|
|
3398
3394
|
let i = new Array(r.length).fill(!1);
|
|
3399
3395
|
for (const c of l) {
|
|
3400
|
-
let [d,
|
|
3401
|
-
|
|
3402
|
-
const
|
|
3403
|
-
if (
|
|
3404
|
-
const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"],
|
|
3405
|
-
if (m.includes(
|
|
3406
|
-
for (let
|
|
3407
|
-
i[
|
|
3408
|
-
else if (
|
|
3409
|
-
for (let
|
|
3410
|
-
i[
|
|
3396
|
+
let [d, u] = c.split(":");
|
|
3397
|
+
u || (u = d, d = "xs");
|
|
3398
|
+
const p = r.indexOf(d);
|
|
3399
|
+
if (p <= a) {
|
|
3400
|
+
const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
|
|
3401
|
+
if (m.includes(u))
|
|
3402
|
+
for (let x = p; x < r.length; x++)
|
|
3403
|
+
i[x] = !0;
|
|
3404
|
+
else if (g.includes(u))
|
|
3405
|
+
for (let x = p; x < r.length; x++)
|
|
3406
|
+
i[x] = !1;
|
|
3411
3407
|
}
|
|
3412
3408
|
}
|
|
3413
3409
|
return i[a];
|
|
@@ -3426,24 +3422,24 @@ const handleMouseMove = throttle((o) => {
|
|
|
3426
3422
|
);
|
|
3427
3423
|
return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
|
|
3428
3424
|
}, useWatchRSCBlocks = () => {
|
|
3429
|
-
const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (
|
|
3430
|
-
var
|
|
3431
|
-
return (
|
|
3432
|
-
}).map((
|
|
3425
|
+
const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
|
|
3426
|
+
var g;
|
|
3427
|
+
return (g = get(i, p._type)) == null ? void 0 : g.server;
|
|
3428
|
+
}).map((p) => p._id), [i, o]);
|
|
3433
3429
|
useEffect(() => {
|
|
3434
|
-
forEach(d, (
|
|
3435
|
-
if (get(n,
|
|
3430
|
+
forEach(d, (u) => {
|
|
3431
|
+
if (get(n, u, "") || get(a, `${u}.loading`, !1))
|
|
3436
3432
|
return;
|
|
3437
|
-
const
|
|
3438
|
-
l((m) => ({ ...m, [
|
|
3439
|
-
r((
|
|
3440
|
-
...
|
|
3441
|
-
[
|
|
3433
|
+
const p = o.find((m) => m._id === u);
|
|
3434
|
+
l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
|
|
3435
|
+
r((g) => ({ ...g, [u]: m })), l((g) => ({
|
|
3436
|
+
...g,
|
|
3437
|
+
[u]: { loading: !1, error: null }
|
|
3442
3438
|
}));
|
|
3443
3439
|
}).catch((m) => {
|
|
3444
|
-
l((
|
|
3445
|
-
...
|
|
3446
|
-
[
|
|
3440
|
+
l((g) => ({
|
|
3441
|
+
...g,
|
|
3442
|
+
[u]: { loading: !1, error: m.message }
|
|
3447
3443
|
}));
|
|
3448
3444
|
});
|
|
3449
3445
|
});
|
|
@@ -3508,50 +3504,50 @@ function applyLanguage(o, n, r) {
|
|
|
3508
3504
|
}), a;
|
|
3509
3505
|
}
|
|
3510
3506
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3511
|
-
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [
|
|
3512
|
-
(
|
|
3513
|
-
const
|
|
3514
|
-
return { ...k, ...
|
|
3507
|
+
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(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
|
|
3508
|
+
(b) => b.reduce((k, v) => {
|
|
3509
|
+
const S = get(u, v, {});
|
|
3510
|
+
return { ...k, ...S };
|
|
3515
3511
|
}, {}),
|
|
3516
|
-
[
|
|
3512
|
+
[u]
|
|
3517
3513
|
);
|
|
3518
3514
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3519
|
-
o.map((
|
|
3520
|
-
if (
|
|
3515
|
+
o.map((b, k) => {
|
|
3516
|
+
if (j === b._id || p.includes(b._id))
|
|
3521
3517
|
return null;
|
|
3522
|
-
const
|
|
3523
|
-
if (
|
|
3524
|
-
const
|
|
3525
|
-
|
|
3518
|
+
const v = {}, S = filter(n, { _parent: b._id });
|
|
3519
|
+
if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, b._type === "GlobalBlock") {
|
|
3520
|
+
const C = m(b);
|
|
3521
|
+
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (w) => !w._parent), allBlocks: C });
|
|
3526
3522
|
}
|
|
3527
|
-
const B = getBlockComponent(
|
|
3523
|
+
const B = getBlockComponent(b._type), R = get(B, "server", !1), A = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3528
3524
|
if (isNull(A))
|
|
3529
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${
|
|
3530
|
-
const
|
|
3531
|
-
if (get(
|
|
3525
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
|
|
3526
|
+
const T = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(T), P = g(b);
|
|
3527
|
+
if (get(P, "__isHidden", !1) && !includes(a, b._id))
|
|
3532
3528
|
return null;
|
|
3533
|
-
const
|
|
3534
|
-
...includes(a,
|
|
3535
|
-
"data-block-id":
|
|
3536
|
-
"data-block-type":
|
|
3529
|
+
const f = i && isDescendant(i._id, b._id, n), _ = {
|
|
3530
|
+
...includes(a, b._id) ? { "force-show": "" } : {},
|
|
3531
|
+
"data-block-id": b._id,
|
|
3532
|
+
"data-block-type": b._type,
|
|
3537
3533
|
...i ? (
|
|
3538
3534
|
// @ts-ignore
|
|
3539
3535
|
{
|
|
3540
|
-
"data-dnd": canAcceptChildBlock(
|
|
3541
|
-
"data-dnd-dragged": i._id ===
|
|
3536
|
+
"data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3537
|
+
"data-dnd-dragged": i._id === b._id || f ? "yes" : "no"
|
|
3542
3538
|
}
|
|
3543
3539
|
) : {},
|
|
3544
|
-
...c ===
|
|
3545
|
-
...includes(l,
|
|
3540
|
+
...c === b._id && !f ? { "data-drop": "yes" } : {},
|
|
3541
|
+
...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
|
|
3546
3542
|
};
|
|
3547
|
-
return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block:
|
|
3548
|
-
blockProps:
|
|
3543
|
+
return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: _ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
|
|
3544
|
+
blockProps: _,
|
|
3549
3545
|
index: k,
|
|
3550
|
-
...applyBindings(applyLanguage(
|
|
3551
|
-
...omit(
|
|
3552
|
-
...
|
|
3546
|
+
...applyBindings(applyLanguage(b, r, B), x),
|
|
3547
|
+
...omit(P, ["__isHidden"]),
|
|
3548
|
+
...v,
|
|
3553
3549
|
inBuilder: !0,
|
|
3554
|
-
blockState:
|
|
3550
|
+
blockState: L
|
|
3555
3551
|
}) });
|
|
3556
3552
|
})
|
|
3557
3553
|
) });
|
|
@@ -3563,7 +3559,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3563
3559
|
if (i) {
|
|
3564
3560
|
const c = (i == null ? void 0 : i.mockFn) || (i == null ? void 0 : i.dataFn);
|
|
3565
3561
|
c && c(l.args).then(
|
|
3566
|
-
(d) => n((
|
|
3562
|
+
(d) => n((u) => ({ ...u, [l.providerKey]: d }))
|
|
3567
3563
|
);
|
|
3568
3564
|
}
|
|
3569
3565
|
}), () => {
|
|
@@ -3588,60 +3584,64 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3588
3584
|
}
|
|
3589
3585
|
);
|
|
3590
3586
|
}, ResizableCanvasWrapper = ({ children: o, onMount: n, onResize: r }) => {
|
|
3591
|
-
const a = useRef(null),
|
|
3587
|
+
const [, a] = useSelectedBlockIds(), [, l] = useSelectedStylingBlocks(), i = useRef(null), c = useDebouncedCallback(
|
|
3592
3588
|
() => {
|
|
3593
|
-
const { clientWidth:
|
|
3594
|
-
r(
|
|
3589
|
+
const { clientWidth: u } = i.current;
|
|
3590
|
+
r(u);
|
|
3595
3591
|
},
|
|
3596
|
-
[
|
|
3592
|
+
[i.current],
|
|
3597
3593
|
100
|
|
3598
3594
|
);
|
|
3599
|
-
|
|
3600
|
-
const { clientWidth:
|
|
3601
|
-
n(
|
|
3602
|
-
}, [])
|
|
3595
|
+
useResizeObserver(i.current, c, i.current !== null), useEffect(() => {
|
|
3596
|
+
const { clientWidth: u } = i.current;
|
|
3597
|
+
n(u);
|
|
3598
|
+
}, []);
|
|
3599
|
+
const d = () => {
|
|
3600
|
+
a([]), l([]);
|
|
3601
|
+
};
|
|
3602
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
3603
3603
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3604
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d,
|
|
3605
|
-
|
|
3604
|
+
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, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
|
|
3605
|
+
u((T) => ({ ...T, width: A }));
|
|
3606
3606
|
};
|
|
3607
3607
|
useEffect(() => {
|
|
3608
3608
|
if (!c.current)
|
|
3609
3609
|
return;
|
|
3610
|
-
const { clientWidth: A, clientHeight:
|
|
3611
|
-
|
|
3610
|
+
const { clientWidth: A, clientHeight: T } = c.current;
|
|
3611
|
+
u({ width: A, height: T });
|
|
3612
3612
|
}, [c, n]);
|
|
3613
|
-
const B = (A,
|
|
3614
|
-
const { top:
|
|
3615
|
-
return
|
|
3613
|
+
const B = (A, T = 0) => {
|
|
3614
|
+
const { top: L } = A.getBoundingClientRect();
|
|
3615
|
+
return L + T >= 0 && L - T <= window.innerHeight;
|
|
3616
3616
|
};
|
|
3617
3617
|
useEffect(() => {
|
|
3618
|
-
var A,
|
|
3618
|
+
var A, T;
|
|
3619
3619
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3620
|
-
const
|
|
3621
|
-
|
|
3620
|
+
const L = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3621
|
+
L && (B(L) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
|
|
3622
3622
|
}
|
|
3623
3623
|
}, [a]), useEffect(() => {
|
|
3624
|
-
if (!isEmpty(
|
|
3624
|
+
if (!isEmpty(E) && i.current) {
|
|
3625
3625
|
const A = getElementByStyleId(
|
|
3626
3626
|
i.current.contentDocument,
|
|
3627
|
-
first(
|
|
3627
|
+
first(E).id
|
|
3628
3628
|
);
|
|
3629
|
-
|
|
3629
|
+
x(A ? [A] : [null]);
|
|
3630
3630
|
} else
|
|
3631
|
-
|
|
3632
|
-
}, [
|
|
3631
|
+
x([null]);
|
|
3632
|
+
}, [E]);
|
|
3633
3633
|
const R = useMemo(() => {
|
|
3634
3634
|
let A = IframeInitialContent;
|
|
3635
|
-
return A = A.replace("__HTML_DIR__",
|
|
3635
|
+
return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
|
|
3636
3636
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3637
3637
|
"/offline/tailwind.cdn.js"
|
|
3638
3638
|
), 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;
|
|
3639
|
-
}, [o,
|
|
3640
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3639
|
+
}, [o, v]);
|
|
3640
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3641
3641
|
"div",
|
|
3642
3642
|
{
|
|
3643
3643
|
onClick: () => {
|
|
3644
|
-
r([]),
|
|
3644
|
+
r([]), b([]);
|
|
3645
3645
|
},
|
|
3646
3646
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
3647
3647
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -3649,10 +3649,10 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3649
3649
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3650
3650
|
ChaiFrame,
|
|
3651
3651
|
{
|
|
3652
|
-
contentDidMount: () =>
|
|
3652
|
+
contentDidMount: () => j(i.current),
|
|
3653
3653
|
ref: i,
|
|
3654
3654
|
id: "canvas-iframe",
|
|
3655
|
-
style: { ...
|
|
3655
|
+
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3656
3656
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3657
3657
|
initialContent: R,
|
|
3658
3658
|
children: [
|
|
@@ -3777,7 +3777,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3777
3777
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3778
3778
|
] }, l))
|
|
3779
3779
|
] }) });
|
|
3780
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3780
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-p_MY9fHx.js")), CanvasArea = () => {
|
|
3781
3781
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3782
3782
|
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: [
|
|
3783
3783
|
/* @__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, {}) }) }),
|
|
@@ -3855,25 +3855,25 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3855
3855
|
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, A) => {
|
|
3856
3856
|
A && (a(R), i.current = R);
|
|
3857
3857
|
}, {
|
|
3858
|
-
bodyFont:
|
|
3859
|
-
headingFont:
|
|
3858
|
+
bodyFont: u,
|
|
3859
|
+
headingFont: p,
|
|
3860
3860
|
primaryColor: m,
|
|
3861
|
-
bodyTextDarkColor:
|
|
3862
|
-
bodyTextLightColor:
|
|
3863
|
-
bodyBgDarkColor:
|
|
3864
|
-
secondaryColor:
|
|
3865
|
-
bodyBgLightColor:
|
|
3861
|
+
bodyTextDarkColor: g,
|
|
3862
|
+
bodyTextLightColor: x,
|
|
3863
|
+
bodyBgDarkColor: j,
|
|
3864
|
+
secondaryColor: E,
|
|
3865
|
+
bodyBgLightColor: b,
|
|
3866
3866
|
roundedCorners: k
|
|
3867
3867
|
} = r;
|
|
3868
|
-
let
|
|
3868
|
+
let v = {
|
|
3869
3869
|
headingFont: y({
|
|
3870
3870
|
title: c("theme_config.heading_font"),
|
|
3871
|
-
default:
|
|
3871
|
+
default: p,
|
|
3872
3872
|
options: FONTS
|
|
3873
3873
|
}),
|
|
3874
3874
|
bodyFont: y({
|
|
3875
3875
|
title: c("theme_config.body_font"),
|
|
3876
|
-
default:
|
|
3876
|
+
default: u,
|
|
3877
3877
|
options: FONTS
|
|
3878
3878
|
}),
|
|
3879
3879
|
roundedCorners: s$1({
|
|
@@ -3881,34 +3881,34 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3881
3881
|
default: parseInt(k || 5, 10)
|
|
3882
3882
|
}),
|
|
3883
3883
|
primaryColor: h({ title: c("theme_config.primary"), default: m }),
|
|
3884
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3884
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: E })
|
|
3885
3885
|
};
|
|
3886
|
-
l || (
|
|
3887
|
-
...
|
|
3886
|
+
l || (v = {
|
|
3887
|
+
...v,
|
|
3888
3888
|
bodyBgLightColor: h({
|
|
3889
3889
|
title: c("theme_config.background"),
|
|
3890
|
-
default:
|
|
3890
|
+
default: b
|
|
3891
3891
|
}),
|
|
3892
3892
|
bodyTextLightColor: h({
|
|
3893
3893
|
title: c("theme_config.text_color"),
|
|
3894
|
-
default:
|
|
3894
|
+
default: g
|
|
3895
3895
|
}),
|
|
3896
3896
|
bodyBgDarkColor: h({
|
|
3897
3897
|
title: c("theme_config.background_dark_mode"),
|
|
3898
|
-
default:
|
|
3898
|
+
default: j
|
|
3899
3899
|
}),
|
|
3900
3900
|
bodyTextDarkColor: h({
|
|
3901
3901
|
title: c("theme_config.text_color_dark_mode"),
|
|
3902
|
-
default:
|
|
3902
|
+
default: x
|
|
3903
3903
|
})
|
|
3904
3904
|
});
|
|
3905
|
-
const
|
|
3905
|
+
const S = {
|
|
3906
3906
|
type: "object",
|
|
3907
3907
|
properties: {}
|
|
3908
3908
|
}, B = {};
|
|
3909
|
-
return Object.keys(
|
|
3910
|
-
const A =
|
|
3911
|
-
return
|
|
3909
|
+
return Object.keys(v).forEach((R) => {
|
|
3910
|
+
const A = v[R];
|
|
3911
|
+
return S.properties || (S.properties = {}), S.properties[R] = A.schema, B[R] = A.uiSchema, !0;
|
|
3912
3912
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3913
3913
|
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,
|
|
3914
3914
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3921,7 +3921,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3921
3921
|
liveOmit: !0,
|
|
3922
3922
|
liveValidate: !0,
|
|
3923
3923
|
uiSchema: B,
|
|
3924
|
-
schema:
|
|
3924
|
+
schema: S,
|
|
3925
3925
|
formData: r,
|
|
3926
3926
|
validator,
|
|
3927
3927
|
onChange: d
|
|
@@ -4103,35 +4103,35 @@ function BiExpandVertical(o) {
|
|
|
4103
4103
|
}
|
|
4104
4104
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4105
4105
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4106
|
-
let
|
|
4107
|
-
const
|
|
4108
|
-
|
|
4109
|
-
},
|
|
4110
|
-
|
|
4111
|
-
},
|
|
4112
|
-
|
|
4113
|
-
},
|
|
4114
|
-
|
|
4106
|
+
let u = null;
|
|
4107
|
+
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: v, handleClick: S } = o, B = (f) => {
|
|
4108
|
+
f.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4109
|
+
}, R = (f) => {
|
|
4110
|
+
f.isInternal && (u = f.isOpen, f.isOpen && f.close());
|
|
4111
|
+
}, A = (f) => {
|
|
4112
|
+
f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
|
|
4113
|
+
}, T = (f) => {
|
|
4114
|
+
f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), S(f);
|
|
4115
4115
|
};
|
|
4116
4116
|
useEffect(() => {
|
|
4117
|
-
const
|
|
4118
|
-
b && !o.isOpen && !
|
|
4117
|
+
const f = setTimeout(() => {
|
|
4118
|
+
b && !o.isOpen && !k && !i.includes(x) && o.toggle();
|
|
4119
4119
|
}, 500);
|
|
4120
|
-
return () => clearTimeout(
|
|
4121
|
-
}, [b, o,
|
|
4122
|
-
const
|
|
4123
|
-
const
|
|
4124
|
-
for (let
|
|
4125
|
-
if (
|
|
4126
|
-
const w =
|
|
4127
|
-
|
|
4120
|
+
return () => clearTimeout(f);
|
|
4121
|
+
}, [b, o, k]);
|
|
4122
|
+
const L = useMemo(() => {
|
|
4123
|
+
const f = Object.keys(j), _ = [];
|
|
4124
|
+
for (let C = 0; C < f.length; C++)
|
|
4125
|
+
if (f[C].endsWith("_attrs")) {
|
|
4126
|
+
const w = j[f[C]], I = Object.keys(w).join("|");
|
|
4127
|
+
I.match(/x-data/) && _.push("data"), I.match(/x-on/) && _.push("event"), I.match(/x-show|x-if/) && _.push("show");
|
|
4128
4128
|
}
|
|
4129
|
-
return
|
|
4130
|
-
}, [
|
|
4131
|
-
const
|
|
4132
|
-
w && w.setAttribute("data-drop",
|
|
4133
|
-
const
|
|
4134
|
-
|
|
4129
|
+
return _;
|
|
4130
|
+
}, [j]), P = (f, _) => {
|
|
4131
|
+
const C = d.contentDocument || d.contentWindow.document, w = C.querySelector(`[data-block-id=${f}]`);
|
|
4132
|
+
w && w.setAttribute("data-drop", _);
|
|
4133
|
+
const I = w.getBoundingClientRect(), N = d.getBoundingClientRect();
|
|
4134
|
+
I.top >= N.top && I.left >= N.left && I.bottom <= N.bottom && I.right <= N.right || (C.documentElement.scrollTop = w.offsetTop - N.top);
|
|
4135
4135
|
};
|
|
4136
4136
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4137
4137
|
"button",
|
|
@@ -4147,26 +4147,27 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4147
4147
|
"div",
|
|
4148
4148
|
{
|
|
4149
4149
|
onMouseEnter: () => m(x),
|
|
4150
|
-
|
|
4150
|
+
onMouseLeave: () => g(),
|
|
4151
|
+
onClick: T,
|
|
4151
4152
|
style: n,
|
|
4152
4153
|
"data-node-id": x,
|
|
4153
4154
|
ref: i.includes(x) ? null : r,
|
|
4154
|
-
onDragStart: () =>
|
|
4155
|
-
onDragEnd: () =>
|
|
4156
|
-
onDragOver: (
|
|
4157
|
-
|
|
4155
|
+
onDragStart: () => R(o),
|
|
4156
|
+
onDragEnd: () => A(o),
|
|
4157
|
+
onDragOver: (f) => {
|
|
4158
|
+
f.preventDefault(), P(x, "yes");
|
|
4158
4159
|
},
|
|
4159
|
-
onDragLeave: (
|
|
4160
|
-
|
|
4160
|
+
onDragLeave: (f) => {
|
|
4161
|
+
f.preventDefault(), P(x, "no");
|
|
4161
4162
|
},
|
|
4162
|
-
onDrop: (
|
|
4163
|
-
|
|
4163
|
+
onDrop: (f) => {
|
|
4164
|
+
f.preventDefault(), P(x, "no");
|
|
4164
4165
|
},
|
|
4165
4166
|
className: cn(
|
|
4166
4167
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4167
4168
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4168
|
-
b && canAcceptChildBlock(
|
|
4169
|
-
|
|
4169
|
+
b && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
|
|
4170
|
+
k && "opacity-20",
|
|
4170
4171
|
i.includes(x) ? "opacity-50" : ""
|
|
4171
4172
|
),
|
|
4172
4173
|
children: [
|
|
@@ -4175,41 +4176,41 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4175
4176
|
"div",
|
|
4176
4177
|
{
|
|
4177
4178
|
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" : ""}`,
|
|
4178
|
-
children:
|
|
4179
|
+
children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4179
4180
|
}
|
|
4180
4181
|
),
|
|
4181
4182
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4182
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4183
|
-
|
|
4183
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
|
|
4184
|
+
v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4184
4185
|
"div",
|
|
4185
4186
|
{
|
|
4186
4187
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
4187
|
-
onDoubleClick: (
|
|
4188
|
-
|
|
4188
|
+
onDoubleClick: (f) => {
|
|
4189
|
+
f.stopPropagation(), o.edit(), o.deselect();
|
|
4189
4190
|
},
|
|
4190
4191
|
children: [
|
|
4191
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4192
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
|
|
4193
|
+
L.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4194
|
+
L.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4195
|
+
L.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
4195
4196
|
]
|
|
4196
4197
|
}
|
|
4197
4198
|
)
|
|
4198
4199
|
] })
|
|
4199
4200
|
] }),
|
|
4200
4201
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
|
|
4201
|
-
!i.includes(x) && a.map((
|
|
4202
|
+
!i.includes(x) && a.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4202
4203
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4203
4204
|
TooltipTrigger,
|
|
4204
4205
|
{
|
|
4205
4206
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
4206
4207
|
asChild: !0,
|
|
4207
|
-
children: React__default.createElement(
|
|
4208
|
+
children: React__default.createElement(f.item, { blockId: x })
|
|
4208
4209
|
}
|
|
4209
4210
|
),
|
|
4210
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children:
|
|
4211
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
|
|
4211
4212
|
] })),
|
|
4212
|
-
canAddChildBlock(
|
|
4213
|
+
canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4213
4214
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4214
4215
|
TooltipTrigger,
|
|
4215
4216
|
{
|
|
@@ -4225,8 +4226,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4225
4226
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4226
4227
|
TooltipTrigger,
|
|
4227
4228
|
{
|
|
4228
|
-
onClick: (
|
|
4229
|
-
|
|
4229
|
+
onClick: (f) => {
|
|
4230
|
+
f.stopPropagation(), c(x), o.isOpen && o.toggle();
|
|
4230
4231
|
},
|
|
4231
4232
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
|
|
4232
4233
|
asChild: !0,
|
|
@@ -4421,7 +4422,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4421
4422
|
return o;
|
|
4422
4423
|
const n = /<video[^>]+src=['"]([^'">]+)['"]/, r = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = o.match(n), l = o.match(r), i = a ? a[1] : l ? l[1] : null, c = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, d = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
4423
4424
|
return i && (c.test(i) || d.test(i)) ? i : o;
|
|
4424
|
-
},
|
|
4425
|
+
}, NAME_ATTRIBUTES = ["chai-name", "data-chai-name"], ATTRIBUTE_MAP = {
|
|
4425
4426
|
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
4426
4427
|
video: {
|
|
4427
4428
|
src: "url",
|
|
@@ -4462,7 +4463,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4462
4463
|
return {};
|
|
4463
4464
|
const n = {}, r = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
|
|
4464
4465
|
return forEach(a, ({ key: l, value: i }) => {
|
|
4465
|
-
if (l
|
|
4466
|
+
if (!includes(NAME_ATTRIBUTES, l))
|
|
4466
4467
|
if (r[l]) {
|
|
4467
4468
|
if (o.tagName === "img" && l === "src" && !i.startsWith("http")) {
|
|
4468
4469
|
const c = find(o.attributes, { key: "width" }), d = find(o.attributes, { key: "height" });
|
|
@@ -4558,7 +4559,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4558
4559
|
return { _type: "TableBody" };
|
|
4559
4560
|
case "tfoot":
|
|
4560
4561
|
return { _type: "TableFooter" };
|
|
4561
|
-
|
|
4562
|
+
default: {
|
|
4562
4563
|
const l = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
4563
4564
|
return {
|
|
4564
4565
|
_type: l,
|
|
@@ -4568,7 +4569,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4568
4569
|
}
|
|
4569
4570
|
}
|
|
4570
4571
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
4571
|
-
var
|
|
4572
|
+
var u, p, m, g, x, j, E, b;
|
|
4572
4573
|
if (r.type === "comment")
|
|
4573
4574
|
return [];
|
|
4574
4575
|
let a = { _id: generateUUID() };
|
|
@@ -4585,7 +4586,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4585
4586
|
...getAttrs(r),
|
|
4586
4587
|
...getStyles(r)
|
|
4587
4588
|
}, r.attributes) {
|
|
4588
|
-
const k = r.attributes.find((
|
|
4589
|
+
const k = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
|
|
4589
4590
|
k && (a._name = k.value);
|
|
4590
4591
|
}
|
|
4591
4592
|
if (i)
|
|
@@ -4603,14 +4604,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4603
4604
|
];
|
|
4604
4605
|
a = {
|
|
4605
4606
|
...a,
|
|
4606
|
-
href: ((
|
|
4607
|
-
hrefType: ((
|
|
4608
|
-
autoplay: ((m = l.find((
|
|
4609
|
-
maxWidth: ((
|
|
4610
|
-
backdropColor: ((
|
|
4611
|
-
galleryName: ((
|
|
4612
|
-
}, forEach(k, (
|
|
4613
|
-
has(a, `styles_attrs.${
|
|
4607
|
+
href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
|
|
4608
|
+
hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
|
|
4609
|
+
autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
|
|
4610
|
+
maxWidth: ((x = (g = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
|
|
4611
|
+
backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
|
|
4612
|
+
galleryName: ((E = l.find((v) => v.key === "data-gall")) == null ? void 0 : E.value) || ""
|
|
4613
|
+
}, forEach(k, (v) => {
|
|
4614
|
+
has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
|
|
4614
4615
|
});
|
|
4615
4616
|
}
|
|
4616
4617
|
if (a._type === "Input") {
|
|
@@ -4620,14 +4621,13 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4620
4621
|
const k = stringify([r]);
|
|
4621
4622
|
return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), 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 = k, [a];
|
|
4622
4623
|
} else if (r.tagName === "svg") {
|
|
4623
|
-
const k = find(r.attributes, { key: "height" }),
|
|
4624
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${
|
|
4625
|
-
} else if (r.tagName == "option" && n && ((
|
|
4624
|
+
const k = find(r.attributes, { key: "height" }), v = find(r.attributes, { key: "width" }), S = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4625
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${S}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
|
|
4626
|
+
} else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
|
|
4626
4627
|
return n.block.options.push({
|
|
4627
4628
|
label: getTextContent(r.children),
|
|
4628
4629
|
...getAttrs(r)
|
|
4629
4630
|
}), [];
|
|
4630
|
-
console.log(a);
|
|
4631
4631
|
const d = traverseNodes(r.children, { block: a, node: r });
|
|
4632
4632
|
return [a, ...d];
|
|
4633
4633
|
}), getSanitizedHTML = (o) => {
|
|
@@ -4681,63 +4681,63 @@ function ExpandableObject(o) {
|
|
|
4681
4681
|
openBracket: i,
|
|
4682
4682
|
closeBracket: c,
|
|
4683
4683
|
level: d,
|
|
4684
|
-
style:
|
|
4685
|
-
shouldExpandNode:
|
|
4684
|
+
style: u,
|
|
4685
|
+
shouldExpandNode: p,
|
|
4686
4686
|
clickToExpandNode: m
|
|
4687
4687
|
} = o;
|
|
4688
|
-
const
|
|
4688
|
+
const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
|
|
4689
4689
|
useEffect(() => {
|
|
4690
|
-
|
|
4691
|
-
}, [
|
|
4692
|
-
const
|
|
4693
|
-
A.key === " " && (A.preventDefault(),
|
|
4690
|
+
g.current ? E(p(d, r, n)) : g.current = !0;
|
|
4691
|
+
}, [p]);
|
|
4692
|
+
const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, R = (A) => {
|
|
4693
|
+
A.key === " " && (A.preventDefault(), j());
|
|
4694
4694
|
};
|
|
4695
4695
|
return /* @__PURE__ */ createElement("div", {
|
|
4696
|
-
className:
|
|
4696
|
+
className: u.basicChildStyle,
|
|
4697
4697
|
role: "list"
|
|
4698
4698
|
}, /* @__PURE__ */ createElement("span", {
|
|
4699
|
-
className:
|
|
4700
|
-
onClick:
|
|
4699
|
+
className: b,
|
|
4700
|
+
onClick: j,
|
|
4701
4701
|
onKeyDown: R,
|
|
4702
4702
|
role: "button",
|
|
4703
4703
|
tabIndex: 0,
|
|
4704
4704
|
"aria-label": k,
|
|
4705
|
-
"aria-expanded":
|
|
4706
|
-
"aria-controls":
|
|
4705
|
+
"aria-expanded": x,
|
|
4706
|
+
"aria-controls": x ? v : void 0
|
|
4707
4707
|
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4708
|
-
className:
|
|
4709
|
-
onClick:
|
|
4708
|
+
className: u.clickableLabel,
|
|
4709
|
+
onClick: j,
|
|
4710
4710
|
onKeyDown: R,
|
|
4711
4711
|
role: "button",
|
|
4712
4712
|
tabIndex: -1
|
|
4713
4713
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
4714
|
-
className:
|
|
4714
|
+
className: u.label
|
|
4715
4715
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4716
|
-
className:
|
|
4717
|
-
}, i),
|
|
4718
|
-
id:
|
|
4719
|
-
}, a.map((A,
|
|
4720
|
-
key: A[0] ||
|
|
4716
|
+
className: u.punctuation
|
|
4717
|
+
}, i), x ? /* @__PURE__ */ createElement("div", {
|
|
4718
|
+
id: v
|
|
4719
|
+
}, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
|
|
4720
|
+
key: A[0] || T,
|
|
4721
4721
|
field: A[0],
|
|
4722
4722
|
value: A[1],
|
|
4723
|
-
style:
|
|
4724
|
-
lastElement:
|
|
4725
|
-
level:
|
|
4726
|
-
shouldExpandNode:
|
|
4723
|
+
style: u,
|
|
4724
|
+
lastElement: T === B,
|
|
4725
|
+
level: S,
|
|
4726
|
+
shouldExpandNode: p,
|
|
4727
4727
|
clickToExpandNode: m
|
|
4728
4728
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4729
|
-
className:
|
|
4730
|
-
onClick:
|
|
4729
|
+
className: u.collapsedContent,
|
|
4730
|
+
onClick: j,
|
|
4731
4731
|
onKeyDown: R,
|
|
4732
4732
|
role: "button",
|
|
4733
4733
|
tabIndex: -1,
|
|
4734
4734
|
"aria-hidden": !0,
|
|
4735
4735
|
"aria-label": k,
|
|
4736
|
-
"aria-expanded":
|
|
4736
|
+
"aria-expanded": x
|
|
4737
4737
|
}), /* @__PURE__ */ createElement("span", {
|
|
4738
|
-
className:
|
|
4738
|
+
className: u.punctuation
|
|
4739
4739
|
}, c), !l && /* @__PURE__ */ createElement("span", {
|
|
4740
|
-
className:
|
|
4740
|
+
className: u.punctuation
|
|
4741
4741
|
}, ","));
|
|
4742
4742
|
}
|
|
4743
4743
|
function JsonObject(o) {
|
|
@@ -4760,7 +4760,7 @@ function JsonObject(o) {
|
|
|
4760
4760
|
style: a,
|
|
4761
4761
|
shouldExpandNode: i,
|
|
4762
4762
|
clickToExpandNode: c,
|
|
4763
|
-
data: Object.keys(r).map((
|
|
4763
|
+
data: Object.keys(r).map((u) => [u, r[u]])
|
|
4764
4764
|
});
|
|
4765
4765
|
}
|
|
4766
4766
|
function JsonArray(o) {
|
|
@@ -4783,7 +4783,7 @@ function JsonArray(o) {
|
|
|
4783
4783
|
style: a,
|
|
4784
4784
|
shouldExpandNode: c,
|
|
4785
4785
|
clickToExpandNode: d,
|
|
4786
|
-
data: r.map((
|
|
4786
|
+
data: r.map((u) => [void 0, u])
|
|
4787
4787
|
});
|
|
4788
4788
|
}
|
|
4789
4789
|
function JsonPrimitiveValue(o) {
|
|
@@ -4847,8 +4847,8 @@ function getPathAndTypes(o) {
|
|
|
4847
4847
|
const n = [], r = {};
|
|
4848
4848
|
function a(l, i) {
|
|
4849
4849
|
forEach(i, (c, d) => {
|
|
4850
|
-
const
|
|
4851
|
-
n.push(
|
|
4850
|
+
const u = l ? `${l}.${d}` : d, p = isArray$1(c) ? "list" : typeof c;
|
|
4851
|
+
n.push(u), r[u] = p === "string" ? "text" : p === "object" ? "model" : p, p === "object" && !isArray$1(c) && a(u, c);
|
|
4852
4852
|
});
|
|
4853
4853
|
}
|
|
4854
4854
|
return a("", omit(o, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: n, pathsType: r };
|
|
@@ -4886,15 +4886,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4886
4886
|
dataType: i,
|
|
4887
4887
|
appliedBindings: c
|
|
4888
4888
|
}) => {
|
|
4889
|
-
const { paths: d, pathsType:
|
|
4890
|
-
(
|
|
4891
|
-
) : d.filter((
|
|
4889
|
+
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [g, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
|
|
4890
|
+
(E) => !includes(c, E) && get(p, `props.${first(split(E, "."))}.binding`)
|
|
4891
|
+
) : d.filter((E) => i === get(u, E, "")), [o, d, c, i, p]);
|
|
4892
4892
|
return useEffect(() => {
|
|
4893
4893
|
n && l(n);
|
|
4894
4894
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4895
4895
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
4896
4896
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
|
|
4897
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open:
|
|
4897
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: g, onOpenChange: x, children: [
|
|
4898
4898
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4899
4899
|
Button,
|
|
4900
4900
|
{
|
|
@@ -4917,23 +4917,23 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4917
4917
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4918
4918
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4919
4919
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4920
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(
|
|
4920
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(j, (E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4921
4921
|
CommandItem,
|
|
4922
4922
|
{
|
|
4923
|
-
value:
|
|
4923
|
+
value: E,
|
|
4924
4924
|
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4925
|
-
onSelect: (
|
|
4926
|
-
r(find(
|
|
4925
|
+
onSelect: (b) => {
|
|
4926
|
+
r(find(j, (k) => k === b) || null), x(!1);
|
|
4927
4927
|
},
|
|
4928
4928
|
children: [
|
|
4929
4929
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4930
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4931
|
-
|
|
4930
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === E ? "" : "opacity-0"}` }),
|
|
4931
|
+
E
|
|
4932
4932
|
] }),
|
|
4933
|
-
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(
|
|
4933
|
+
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, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
|
|
4934
4934
|
]
|
|
4935
4935
|
},
|
|
4936
|
-
|
|
4936
|
+
E
|
|
4937
4937
|
)) })
|
|
4938
4938
|
] })
|
|
4939
4939
|
] }) })
|
|
@@ -4947,20 +4947,20 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4947
4947
|
editMode: r,
|
|
4948
4948
|
item: a
|
|
4949
4949
|
}) => {
|
|
4950
|
-
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""),
|
|
4951
|
-
(
|
|
4952
|
-
if (isEmpty(
|
|
4950
|
+
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4951
|
+
(j, E) => {
|
|
4952
|
+
if (isEmpty(j))
|
|
4953
4953
|
return "";
|
|
4954
4954
|
{
|
|
4955
|
-
const
|
|
4956
|
-
if (isArray$1(
|
|
4955
|
+
const b = get(E === "PROP" ? u : p, j, "");
|
|
4956
|
+
if (isArray$1(b))
|
|
4957
4957
|
return "list";
|
|
4958
|
-
const k = typeof
|
|
4958
|
+
const k = typeof b;
|
|
4959
4959
|
return k === "string" ? "text" : k === "object" ? "model" : k;
|
|
4960
4960
|
}
|
|
4961
4961
|
},
|
|
4962
|
-
[
|
|
4963
|
-
), [
|
|
4962
|
+
[u, p]
|
|
4963
|
+
), [g, x] = useState(r ? m(a.key, "PROP") : "");
|
|
4964
4964
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4965
4965
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
|
|
4966
4966
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
|
|
@@ -4975,12 +4975,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4975
4975
|
placeholder: "Enter prop key",
|
|
4976
4976
|
value: l,
|
|
4977
4977
|
setValue: i,
|
|
4978
|
-
onChange: (
|
|
4979
|
-
const
|
|
4980
|
-
i(
|
|
4978
|
+
onChange: (j) => {
|
|
4979
|
+
const E = m(j, "PROP");
|
|
4980
|
+
i(j), g !== E && d(""), x(E);
|
|
4981
4981
|
},
|
|
4982
|
-
data:
|
|
4983
|
-
dataType:
|
|
4982
|
+
data: u,
|
|
4983
|
+
dataType: g,
|
|
4984
4984
|
appliedBindings: o
|
|
4985
4985
|
}
|
|
4986
4986
|
),
|
|
@@ -4993,12 +4993,12 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4993
4993
|
placeholder: "Enter data path",
|
|
4994
4994
|
value: c,
|
|
4995
4995
|
setValue: d,
|
|
4996
|
-
onChange: (
|
|
4997
|
-
const
|
|
4998
|
-
d(
|
|
4996
|
+
onChange: (j) => {
|
|
4997
|
+
const E = m(j, "PATH");
|
|
4998
|
+
d(g === E ? j : "");
|
|
4999
4999
|
},
|
|
5000
|
-
data:
|
|
5001
|
-
dataType:
|
|
5000
|
+
data: p,
|
|
5001
|
+
dataType: g,
|
|
5002
5002
|
appliedBindings: o
|
|
5003
5003
|
}
|
|
5004
5004
|
)
|
|
@@ -5024,8 +5024,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5024
5024
|
item: i,
|
|
5025
5025
|
editMode: l,
|
|
5026
5026
|
appliedBindings: a,
|
|
5027
|
-
onAddBinding: (
|
|
5028
|
-
r(
|
|
5027
|
+
onAddBinding: (u) => {
|
|
5028
|
+
r(u), d(!1);
|
|
5029
5029
|
}
|
|
5030
5030
|
}
|
|
5031
5031
|
) })
|
|
@@ -5038,18 +5038,18 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5038
5038
|
dataProvider: l,
|
|
5039
5039
|
appliedBindings: i
|
|
5040
5040
|
}) => {
|
|
5041
|
-
const [c, d] = useState("string"),
|
|
5042
|
-
if (isEmpty(
|
|
5041
|
+
const [c, d] = useState("string"), u = (p, m) => {
|
|
5042
|
+
if (isEmpty(p))
|
|
5043
5043
|
return "";
|
|
5044
5044
|
{
|
|
5045
|
-
const
|
|
5046
|
-
if (isArray$1(
|
|
5045
|
+
const g = get(m === "PROP" ? a : l, p, "");
|
|
5046
|
+
if (isArray$1(g))
|
|
5047
5047
|
return "list";
|
|
5048
|
-
const
|
|
5049
|
-
return
|
|
5048
|
+
const x = typeof g;
|
|
5049
|
+
return x === "string" ? "text" : x === "object" ? "model" : x;
|
|
5050
5050
|
}
|
|
5051
5051
|
};
|
|
5052
|
-
return useEffect(() => d(() =>
|
|
5052
|
+
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: [
|
|
5053
5053
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-normal text-gray-500", children: o.key }),
|
|
5054
5054
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium leading-5", children: o.value }),
|
|
5055
5055
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(l, o.value, "") }),
|
|
@@ -5067,34 +5067,34 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5067
5067
|
] });
|
|
5068
5068
|
}, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
|
|
5069
5069
|
const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
|
|
5070
|
-
map(o, (
|
|
5070
|
+
map(o, (g, x) => ({ key: x, value: g }))
|
|
5071
5071
|
);
|
|
5072
5072
|
useEffect(() => {
|
|
5073
|
-
c(map(o, (
|
|
5073
|
+
c(map(o, (g, x) => ({ key: x, value: g })));
|
|
5074
5074
|
}, [r == null ? void 0 : r._id, o]);
|
|
5075
5075
|
const d = useMemo(() => {
|
|
5076
5076
|
if (isEmpty(a))
|
|
5077
5077
|
return !0;
|
|
5078
5078
|
if (isEmpty(i))
|
|
5079
5079
|
return !1;
|
|
5080
|
-
const
|
|
5081
|
-
return isEmpty(
|
|
5082
|
-
}, [a, i]),
|
|
5083
|
-
const
|
|
5084
|
-
c([...
|
|
5085
|
-
},
|
|
5086
|
-
const
|
|
5087
|
-
m([...
|
|
5080
|
+
const g = last(i);
|
|
5081
|
+
return isEmpty(g == null ? void 0 : g.key) || isEmpty(g == null ? void 0 : g.value);
|
|
5082
|
+
}, [a, i]), u = (g) => {
|
|
5083
|
+
const x = filter(i, (j) => j.key !== g.key);
|
|
5084
|
+
c([...x, g]), m([...x, g]);
|
|
5085
|
+
}, p = (g) => {
|
|
5086
|
+
const x = filter(i, (j, E) => g !== E);
|
|
5087
|
+
m([...x]);
|
|
5088
5088
|
}, m = useCallback(
|
|
5089
|
-
(
|
|
5090
|
-
if (c(
|
|
5089
|
+
(g = []) => {
|
|
5090
|
+
if (c(g), isEmpty(g)) {
|
|
5091
5091
|
n({});
|
|
5092
5092
|
return;
|
|
5093
5093
|
}
|
|
5094
|
-
const
|
|
5095
|
-
forEach(
|
|
5096
|
-
!isEmpty(
|
|
5097
|
-
}), n(
|
|
5094
|
+
const x = {};
|
|
5095
|
+
forEach(g, (j) => {
|
|
5096
|
+
!isEmpty(j == null ? void 0 : j.key) && !isEmpty(j == null ? void 0 : j.value) && set(x, j.key, j.value);
|
|
5097
|
+
}), n(x);
|
|
5098
5098
|
},
|
|
5099
5099
|
[n]
|
|
5100
5100
|
);
|
|
@@ -5103,17 +5103,17 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5103
5103
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
5104
5104
|
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
5105
5105
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
5106
|
-
map(i, (
|
|
5106
|
+
map(i, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5107
5107
|
NewDataBindingPair,
|
|
5108
5108
|
{
|
|
5109
|
-
item:
|
|
5110
|
-
onAddBinding:
|
|
5111
|
-
onRemove: () =>
|
|
5109
|
+
item: g,
|
|
5110
|
+
onAddBinding: u,
|
|
5111
|
+
onRemove: () => p(x),
|
|
5112
5112
|
selectedBlock: r,
|
|
5113
5113
|
dataProvider: a,
|
|
5114
5114
|
appliedBindings: map(i, "key")
|
|
5115
5115
|
},
|
|
5116
|
-
|
|
5116
|
+
g.key
|
|
5117
5117
|
)),
|
|
5118
5118
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
|
|
5119
5119
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { disabled: isEmpty(a), className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5121,7 +5121,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5121
5121
|
{
|
|
5122
5122
|
disabled: d,
|
|
5123
5123
|
appliedBindings: map(i, "key"),
|
|
5124
|
-
onAddBinding:
|
|
5124
|
+
onAddBinding: u,
|
|
5125
5125
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5126
5126
|
"span",
|
|
5127
5127
|
{
|
|
@@ -5202,7 +5202,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5202
5202
|
}
|
|
5203
5203
|
)
|
|
5204
5204
|
] });
|
|
5205
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5205
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Ud9lZ6w-.js")), UploadImages = React__default.lazy(() => import("./UploadImages-bHQHGRwC.js")), ImagesPanel = ({
|
|
5206
5206
|
isModalView: o = !1,
|
|
5207
5207
|
onSelect: n = () => {
|
|
5208
5208
|
}
|
|
@@ -5212,7 +5212,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5212
5212
|
);
|
|
5213
5213
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [
|
|
5214
5214
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: o && l ? "Unsplash images" : o ? "Select or upload images" : "Images" }) }),
|
|
5215
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (
|
|
5215
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (u) => d(u), className: "flex h-full w-full flex-col py-2", children: [
|
|
5216
5216
|
!(l || i) && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "w-full", children: [
|
|
5217
5217
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "upload", className: "w-full", children: "Upload" }),
|
|
5218
5218
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "unsplash", className: "w-full", children: "Unsplash" })
|
|
@@ -5249,8 +5249,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5249
5249
|
className: "text-xs",
|
|
5250
5250
|
placeholder: c("enter_image_url"),
|
|
5251
5251
|
value: o,
|
|
5252
|
-
onBlur: ({ target: { value:
|
|
5253
|
-
onChange: (
|
|
5252
|
+
onBlur: ({ target: { value: u } }) => a(r, u),
|
|
5253
|
+
onChange: (u) => n(u.target.value)
|
|
5254
5254
|
}
|
|
5255
5255
|
)
|
|
5256
5256
|
] })
|
|
@@ -5292,25 +5292,25 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5292
5292
|
}
|
|
5293
5293
|
);
|
|
5294
5294
|
}, LinkField = ({ schema: o, formData: n, onChange: r }) => {
|
|
5295
|
-
const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target:
|
|
5295
|
+
const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: u = "self" } = n;
|
|
5296
5296
|
return useEffect(() => {
|
|
5297
5297
|
(async () => {
|
|
5298
|
-
const
|
|
5299
|
-
l(
|
|
5298
|
+
const p = await i();
|
|
5299
|
+
l(p || []);
|
|
5300
5300
|
})();
|
|
5301
5301
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5302
5302
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
|
|
5303
5303
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
5304
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (
|
|
5304
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (p) => r({ ...n, type: p.target.value }), children: [
|
|
5305
5305
|
{ const: "page", title: "Open Page" },
|
|
5306
5306
|
{ const: "url", title: "Open URL" },
|
|
5307
5307
|
{ const: "email", title: "Compose Email" },
|
|
5308
5308
|
{ const: "telephone", title: "Call Phone" },
|
|
5309
5309
|
{ const: "scroll", title: "Scroll to element" }
|
|
5310
|
-
].map((
|
|
5311
|
-
c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (
|
|
5310
|
+
].map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)) }),
|
|
5311
|
+
c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value || "#" }), children: [
|
|
5312
5312
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Choose page" }),
|
|
5313
|
-
map(a, (
|
|
5313
|
+
map(a, (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.slug, children: p.name }, p.uuid))
|
|
5314
5314
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5315
5315
|
"input",
|
|
5316
5316
|
{
|
|
@@ -5320,7 +5320,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5320
5320
|
name: "href",
|
|
5321
5321
|
type: "text",
|
|
5322
5322
|
value: d,
|
|
5323
|
-
onChange: (
|
|
5323
|
+
onChange: (p) => r({ ...n, href: p.target.value || "#" }),
|
|
5324
5324
|
placeholder: c === "page" || c === "url" ? "Enter URL" : c === "scroll" ? "#ElementID" : "Enter detail"
|
|
5325
5325
|
}
|
|
5326
5326
|
),
|
|
@@ -5332,9 +5332,9 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5332
5332
|
autoCorrect: "off",
|
|
5333
5333
|
spellCheck: "false",
|
|
5334
5334
|
type: "checkbox",
|
|
5335
|
-
defaultChecked:
|
|
5335
|
+
defaultChecked: u === "_blank",
|
|
5336
5336
|
className: "!w-fit cursor-pointer rounded-md border border-border",
|
|
5337
|
-
onChange: () => r({ ...n, target:
|
|
5337
|
+
onChange: () => r({ ...n, target: u === "_blank" ? "_self" : "_blank" })
|
|
5338
5338
|
}
|
|
5339
5339
|
),
|
|
5340
5340
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
|
|
@@ -5346,8 +5346,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5346
5346
|
if (typeof window > "u")
|
|
5347
5347
|
return null;
|
|
5348
5348
|
const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
|
|
5349
|
-
const
|
|
5350
|
-
a({ blockId:
|
|
5349
|
+
const u = l == null ? void 0 : l._id;
|
|
5350
|
+
a({ blockId: u, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
|
|
5351
5351
|
};
|
|
5352
5352
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-col gap-y-1", children: [
|
|
5353
5353
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5361,19 +5361,19 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5361
5361
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
|
|
5362
5362
|
] });
|
|
5363
5363
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5364
|
-
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t:
|
|
5365
|
-
Object.keys(n).forEach((
|
|
5366
|
-
const
|
|
5367
|
-
if (includes(["slot", "styles"],
|
|
5364
|
+
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: g } = useLanguages(), x = g.length === 0 ? "" : p.length ? p : m;
|
|
5365
|
+
Object.keys(n).forEach((E) => {
|
|
5366
|
+
const b = n[E];
|
|
5367
|
+
if (includes(["slot", "styles"], b.type))
|
|
5368
5368
|
return;
|
|
5369
|
-
const k =
|
|
5370
|
-
c.properties[k] = getBlockJSONFromSchemas(
|
|
5369
|
+
const k = E;
|
|
5370
|
+
c.properties[k] = getBlockJSONFromSchemas(b, u, x), d[k] = getBlockJSONFromUISchemas(b);
|
|
5371
5371
|
}), useEffect(() => {
|
|
5372
5372
|
i(r);
|
|
5373
|
-
}, [o,
|
|
5374
|
-
const
|
|
5375
|
-
async ({ formData:
|
|
5376
|
-
a({ formData:
|
|
5373
|
+
}, [o, p]);
|
|
5374
|
+
const j = useThrottledCallback(
|
|
5375
|
+
async ({ formData: E }, b) => {
|
|
5376
|
+
a({ formData: E }, b);
|
|
5377
5377
|
},
|
|
5378
5378
|
[a],
|
|
5379
5379
|
1e3
|
|
@@ -5399,8 +5399,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5399
5399
|
uiSchema: d,
|
|
5400
5400
|
schema: c,
|
|
5401
5401
|
formData: l,
|
|
5402
|
-
onChange: ({ formData:
|
|
5403
|
-
|
|
5402
|
+
onChange: ({ formData: E }, b) => {
|
|
5403
|
+
b && (i(E), j({ formData: E }, b));
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
5406
|
);
|
|
@@ -5422,7 +5422,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5422
5422
|
id: "show-on-canvas",
|
|
5423
5423
|
checked: c,
|
|
5424
5424
|
onCheckedChange: (d) => {
|
|
5425
|
-
d ? (n((
|
|
5425
|
+
d ? (n((u) => [...u, r._id]), a([r._id])) : n((u) => u.filter((p) => p !== r._id));
|
|
5426
5426
|
}
|
|
5427
5427
|
}
|
|
5428
5428
|
),
|
|
@@ -5469,32 +5469,32 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5469
5469
|
}), a;
|
|
5470
5470
|
};
|
|
5471
5471
|
function BlockSettings() {
|
|
5472
|
-
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),
|
|
5472
|
+
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: b }, k, v) => {
|
|
5473
5473
|
if (k && (c == null ? void 0 : c._id) === n._id) {
|
|
5474
|
-
const
|
|
5475
|
-
a([n._id], { [
|
|
5474
|
+
const S = k.replace("root.", "");
|
|
5475
|
+
a([n._id], { [S]: get(b, S) }, v);
|
|
5476
5476
|
}
|
|
5477
5477
|
}, m = useCallback(
|
|
5478
|
-
debounce(({ formData:
|
|
5479
|
-
|
|
5478
|
+
debounce(({ formData: b }, k, v) => {
|
|
5479
|
+
p({ formData: b }, k, v), d(b);
|
|
5480
5480
|
}, 1500),
|
|
5481
5481
|
[n == null ? void 0 : n._id, o]
|
|
5482
|
-
),
|
|
5482
|
+
), g = ({ formData: b }, k) => {
|
|
5483
5483
|
if (k) {
|
|
5484
|
-
const
|
|
5484
|
+
const v = k.replace("root.", "");
|
|
5485
5485
|
r(
|
|
5486
5486
|
[n._id],
|
|
5487
|
-
convertDotNotationToObject(
|
|
5488
|
-
), m({ formData:
|
|
5487
|
+
convertDotNotationToObject(v, get(b, v.split(".")))
|
|
5488
|
+
), m({ formData: b }, k, { [v]: get(c, v) });
|
|
5489
5489
|
}
|
|
5490
|
-
},
|
|
5491
|
-
const
|
|
5492
|
-
return each(
|
|
5493
|
-
get(k, "hidden", !1) && delete
|
|
5494
|
-
}),
|
|
5495
|
-
}, [l,
|
|
5490
|
+
}, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
|
|
5491
|
+
const b = cloneDeep(get(l, "props", {}));
|
|
5492
|
+
return each(b, (k, v) => {
|
|
5493
|
+
get(k, "hidden", !1) && delete b[v];
|
|
5494
|
+
}), u && each(x, (k) => delete b[k]), b;
|
|
5495
|
+
}, [l, x, u]), E = get(l, "server", !1);
|
|
5496
5496
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5497
|
-
|
|
5497
|
+
u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5498
5498
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
5499
5499
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
5500
5500
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5509,8 +5509,8 @@ function BlockSettings() {
|
|
|
5509
5509
|
DataBindingSetting$1,
|
|
5510
5510
|
{
|
|
5511
5511
|
bindingData: get(n, "_bindings", {}),
|
|
5512
|
-
onChange: (
|
|
5513
|
-
|
|
5512
|
+
onChange: (b) => {
|
|
5513
|
+
p({ formData: { _bindings: b } }, "root._bindings");
|
|
5514
5514
|
}
|
|
5515
5515
|
}
|
|
5516
5516
|
) })
|
|
@@ -5521,35 +5521,35 @@ function BlockSettings() {
|
|
|
5521
5521
|
"Static Content"
|
|
5522
5522
|
] }) }),
|
|
5523
5523
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
|
|
5524
|
-
isEmpty(
|
|
5524
|
+
isEmpty(x) ? 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: [
|
|
5525
5525
|
"Data binding is set for ",
|
|
5526
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(
|
|
5526
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(x, capitalize).join(", ") }),
|
|
5527
5527
|
" ",
|
|
5528
|
-
|
|
5528
|
+
x.length === 1 ? "property" : "properties",
|
|
5529
5529
|
". Remove data binding to edit static content."
|
|
5530
5530
|
] }),
|
|
5531
5531
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5532
5532
|
JSONForm,
|
|
5533
5533
|
{
|
|
5534
5534
|
id: n == null ? void 0 : n._id,
|
|
5535
|
-
onChange:
|
|
5535
|
+
onChange: g,
|
|
5536
5536
|
formData: i,
|
|
5537
|
-
properties:
|
|
5537
|
+
properties: j
|
|
5538
5538
|
}
|
|
5539
5539
|
)
|
|
5540
5540
|
] })
|
|
5541
5541
|
] })
|
|
5542
|
-
] }) : isEmpty(
|
|
5542
|
+
] }) : isEmpty(j) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5543
5543
|
JSONForm,
|
|
5544
5544
|
{
|
|
5545
5545
|
id: n == null ? void 0 : n._id,
|
|
5546
|
-
onChange:
|
|
5546
|
+
onChange: g,
|
|
5547
5547
|
formData: i,
|
|
5548
|
-
properties:
|
|
5548
|
+
properties: j
|
|
5549
5549
|
}
|
|
5550
5550
|
),
|
|
5551
5551
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5552
|
-
|
|
5552
|
+
E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
|
|
5553
5553
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5554
5554
|
] });
|
|
5555
5555
|
}
|
|
@@ -5573,25 +5573,25 @@ function promptWithLanguage(o, n, r) {
|
|
|
5573
5573
|
${a}`;
|
|
5574
5574
|
}
|
|
5575
5575
|
const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
5576
|
-
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang:
|
|
5576
|
+
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;
|
|
5577
5577
|
return {
|
|
5578
5578
|
askAi: useCallback(
|
|
5579
|
-
async (x,
|
|
5579
|
+
async (g, x, j, E) => {
|
|
5580
5580
|
if (l) {
|
|
5581
5581
|
n(!0), a(null);
|
|
5582
5582
|
try {
|
|
5583
|
-
const
|
|
5584
|
-
set(
|
|
5585
|
-
const k =
|
|
5583
|
+
const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
|
|
5584
|
+
set(b, "0._parent", null);
|
|
5585
|
+
const k = u === p ? "" : u, v = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: S, error: B } = v;
|
|
5586
5586
|
if (B) {
|
|
5587
5587
|
a(B);
|
|
5588
5588
|
return;
|
|
5589
5589
|
}
|
|
5590
|
-
|
|
5591
|
-
} catch (
|
|
5592
|
-
a(
|
|
5590
|
+
g === "styles" ? c(S) : i(S), E && E(v);
|
|
5591
|
+
} catch (b) {
|
|
5592
|
+
a(b);
|
|
5593
5593
|
} finally {
|
|
5594
|
-
n(!1),
|
|
5594
|
+
n(!1), E && E();
|
|
5595
5595
|
}
|
|
5596
5596
|
}
|
|
5597
5597
|
},
|
|
@@ -5599,8 +5599,8 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
|
5599
5599
|
l,
|
|
5600
5600
|
n,
|
|
5601
5601
|
d,
|
|
5602
|
-
p,
|
|
5603
5602
|
u,
|
|
5603
|
+
p,
|
|
5604
5604
|
m,
|
|
5605
5605
|
c,
|
|
5606
5606
|
i
|
|
@@ -5627,10 +5627,10 @@ function Countdown() {
|
|
|
5627
5627
|
const [o, n] = useState(SECONDS), [r, a] = useState(!1);
|
|
5628
5628
|
useEffect(() => {
|
|
5629
5629
|
if (r && o > 0) {
|
|
5630
|
-
const
|
|
5630
|
+
const u = setTimeout(() => {
|
|
5631
5631
|
n(o - 0.1);
|
|
5632
5632
|
}, 100);
|
|
5633
|
-
return () => clearTimeout(
|
|
5633
|
+
return () => clearTimeout(u);
|
|
5634
5634
|
} else
|
|
5635
5635
|
o <= 0 && (a(!1), n(SECONDS));
|
|
5636
5636
|
}, [r, o]);
|
|
@@ -5675,14 +5675,14 @@ function Countdown() {
|
|
|
5675
5675
|
] });
|
|
5676
5676
|
}
|
|
5677
5677
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5678
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null),
|
|
5678
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
|
|
5679
5679
|
useEffect(() => {
|
|
5680
|
-
var
|
|
5681
|
-
(
|
|
5680
|
+
var x;
|
|
5681
|
+
(x = d.current) == null || x.focus();
|
|
5682
5682
|
}, []);
|
|
5683
|
-
const
|
|
5684
|
-
const { usage:
|
|
5685
|
-
!l &&
|
|
5683
|
+
const g = (x) => {
|
|
5684
|
+
const { usage: j } = x || {};
|
|
5685
|
+
!l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5686
5686
|
};
|
|
5687
5687
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5688
5688
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5691,12 +5691,12 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5691
5691
|
{
|
|
5692
5692
|
ref: d,
|
|
5693
5693
|
value: i,
|
|
5694
|
-
onChange: (
|
|
5694
|
+
onChange: (x) => c(x.target.value),
|
|
5695
5695
|
placeholder: n("ask_ai_to_edit_styles"),
|
|
5696
5696
|
className: "w-full border border-border focus:border-0",
|
|
5697
5697
|
rows: 3,
|
|
5698
|
-
onKeyDown: (
|
|
5699
|
-
|
|
5698
|
+
onKeyDown: (x) => {
|
|
5699
|
+
x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
|
|
5700
5700
|
}
|
|
5701
5701
|
}
|
|
5702
5702
|
),
|
|
@@ -5706,7 +5706,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5706
5706
|
{
|
|
5707
5707
|
disabled: i.trim().length < 5 || a,
|
|
5708
5708
|
onClick: () => {
|
|
5709
|
-
|
|
5709
|
+
u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
|
|
5710
5710
|
},
|
|
5711
5711
|
variant: "default",
|
|
5712
5712
|
className: "w-fit",
|
|
@@ -5725,11 +5725,11 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5725
5725
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("stop") })
|
|
5726
5726
|
] }) : null
|
|
5727
5727
|
] }),
|
|
5728
|
-
|
|
5728
|
+
p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
|
|
5729
5729
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
5730
5730
|
n("Total tokens used"),
|
|
5731
5731
|
": ",
|
|
5732
|
-
|
|
5732
|
+
p.totalTokens
|
|
5733
5733
|
] }),
|
|
5734
5734
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
|
|
5735
5735
|
] }) }) : null,
|
|
@@ -5743,45 +5743,45 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5743
5743
|
});
|
|
5744
5744
|
function ManualClasses() {
|
|
5745
5745
|
var A;
|
|
5746
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d,
|
|
5747
|
-
const
|
|
5748
|
-
a(i,
|
|
5749
|
-
}, [
|
|
5750
|
-
const
|
|
5751
|
-
let
|
|
5752
|
-
if (
|
|
5753
|
-
const [
|
|
5754
|
-
|
|
5755
|
-
...
|
|
5756
|
-
item: { ...
|
|
5746
|
+
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, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
|
|
5747
|
+
const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5748
|
+
a(i, T, !0), u("");
|
|
5749
|
+
}, [j, E] = useState([]), b = ({ value: T }) => {
|
|
5750
|
+
const L = T.trim().toLowerCase(), P = L.match(/.+:/g);
|
|
5751
|
+
let f = [];
|
|
5752
|
+
if (P && P.length > 0) {
|
|
5753
|
+
const [_] = P, C = L.replace(_, "");
|
|
5754
|
+
f = fuse.search(C).map((I) => ({
|
|
5755
|
+
...I,
|
|
5756
|
+
item: { ...I.item, name: _ + I.item.name }
|
|
5757
5757
|
}));
|
|
5758
5758
|
} else
|
|
5759
|
-
|
|
5760
|
-
return
|
|
5759
|
+
f = fuse.search(L);
|
|
5760
|
+
return E(map(f, "item"));
|
|
5761
5761
|
}, k = () => {
|
|
5762
|
-
|
|
5763
|
-
},
|
|
5762
|
+
E([]);
|
|
5763
|
+
}, v = (T) => T.name, S = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), B = {
|
|
5764
5764
|
autoComplete: "off",
|
|
5765
5765
|
autoCorrect: "off",
|
|
5766
5766
|
autoCapitalize: "off",
|
|
5767
5767
|
spellCheck: !1,
|
|
5768
5768
|
placeholder: o("enter_classes_separated_by_space"),
|
|
5769
5769
|
value: d,
|
|
5770
|
-
onKeyDown: (
|
|
5771
|
-
|
|
5770
|
+
onKeyDown: (T) => {
|
|
5771
|
+
T.key === "Enter" && d.trim() !== "" && x();
|
|
5772
5772
|
},
|
|
5773
|
-
onChange: (
|
|
5773
|
+
onChange: (T, { newValue: L }) => u(L),
|
|
5774
5774
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5775
5775
|
}, R = () => {
|
|
5776
5776
|
if (navigator.clipboard === void 0) {
|
|
5777
|
-
|
|
5777
|
+
p({
|
|
5778
5778
|
title: o("clipboard_not_supported"),
|
|
5779
5779
|
description: o("please_use_chrome_firefox_or_safari"),
|
|
5780
5780
|
variant: "destructive"
|
|
5781
5781
|
});
|
|
5782
5782
|
return;
|
|
5783
5783
|
}
|
|
5784
|
-
navigator.clipboard.writeText(
|
|
5784
|
+
navigator.clipboard.writeText(g.join(" ")), p({
|
|
5785
5785
|
title: o("copied"),
|
|
5786
5786
|
description: o("classes_copied_to_clipboard")
|
|
5787
5787
|
});
|
|
@@ -5789,7 +5789,7 @@ function ManualClasses() {
|
|
|
5789
5789
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5790
5790
|
"div",
|
|
5791
5791
|
{
|
|
5792
|
-
className: `flex ${
|
|
5792
|
+
className: `flex ${j.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
|
|
5793
5793
|
children: [
|
|
5794
5794
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
5795
5795
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
@@ -5811,11 +5811,11 @@ function ManualClasses() {
|
|
|
5811
5811
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5812
5812
|
Autosuggest,
|
|
5813
5813
|
{
|
|
5814
|
-
suggestions:
|
|
5815
|
-
onSuggestionsFetchRequested:
|
|
5814
|
+
suggestions: j,
|
|
5815
|
+
onSuggestionsFetchRequested: b,
|
|
5816
5816
|
onSuggestionsClearRequested: k,
|
|
5817
|
-
getSuggestionValue:
|
|
5818
|
-
renderSuggestion:
|
|
5817
|
+
getSuggestionValue: v,
|
|
5818
|
+
renderSuggestion: S,
|
|
5819
5819
|
inputProps: B,
|
|
5820
5820
|
containerProps: {
|
|
5821
5821
|
className: "relative h-8 w-full gap-y-1 py-1 border-border"
|
|
@@ -5832,7 +5832,7 @@ function ManualClasses() {
|
|
|
5832
5832
|
{
|
|
5833
5833
|
variant: "outline",
|
|
5834
5834
|
className: "h-6 border-border",
|
|
5835
|
-
onClick:
|
|
5835
|
+
onClick: x,
|
|
5836
5836
|
disabled: d.trim() === "",
|
|
5837
5837
|
size: "sm",
|
|
5838
5838
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -5840,22 +5840,22 @@ function ManualClasses() {
|
|
|
5840
5840
|
)
|
|
5841
5841
|
] }),
|
|
5842
5842
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
|
|
5843
|
-
|
|
5843
|
+
g.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5844
5844
|
"div",
|
|
5845
5845
|
{
|
|
5846
5846
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5847
5847
|
children: [
|
|
5848
|
-
|
|
5848
|
+
T,
|
|
5849
5849
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5850
5850
|
Cross2Icon,
|
|
5851
5851
|
{
|
|
5852
|
-
onClick: () => l(i, [
|
|
5852
|
+
onClick: () => l(i, [T]),
|
|
5853
5853
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5854
5854
|
}
|
|
5855
5855
|
)
|
|
5856
5856
|
]
|
|
5857
5857
|
},
|
|
5858
|
-
|
|
5858
|
+
T
|
|
5859
5859
|
))
|
|
5860
5860
|
) })
|
|
5861
5861
|
]
|
|
@@ -6155,7 +6155,7 @@ const EDITOR_ICONS = {
|
|
|
6155
6155
|
DropDown,
|
|
6156
6156
|
{
|
|
6157
6157
|
rounded: o,
|
|
6158
|
-
onChange: (
|
|
6158
|
+
onChange: (u) => r(u, n),
|
|
6159
6159
|
selected: i,
|
|
6160
6160
|
options: a,
|
|
6161
6161
|
disabled: !c
|
|
@@ -6169,23 +6169,23 @@ function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disab
|
|
|
6169
6169
|
{
|
|
6170
6170
|
disabled: !a.length || l,
|
|
6171
6171
|
className: `${r ? "rounded-md border border-border" : "border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
|
|
6172
|
-
onChange: (
|
|
6173
|
-
onKeyDown: (
|
|
6174
|
-
|
|
6172
|
+
onChange: (u) => n(u.target.value),
|
|
6173
|
+
onKeyDown: (u) => {
|
|
6174
|
+
u.ctrlKey && (u.key === "z" && c(), u.key === "y" && d());
|
|
6175
6175
|
},
|
|
6176
6176
|
value: i,
|
|
6177
6177
|
children: [
|
|
6178
6178
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: "" }),
|
|
6179
6179
|
React__default.Children.toArray(
|
|
6180
|
-
a.map((
|
|
6180
|
+
a.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: u, children: u }))
|
|
6181
6181
|
)
|
|
6182
6182
|
]
|
|
6183
6183
|
}
|
|
6184
6184
|
);
|
|
6185
6185
|
}
|
|
6186
6186
|
const RangeChoices = ({ property: o, onChange: n }) => {
|
|
6187
|
-
const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0,
|
|
6188
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children:
|
|
6187
|
+
const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0, u = /\[.*\]/g.test(i);
|
|
6188
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[5px] px-2", children: i }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6189
6189
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6190
6190
|
"button",
|
|
6191
6191
|
{
|
|
@@ -6246,30 +6246,30 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6246
6246
|
ringColor: "ring",
|
|
6247
6247
|
ringOffsetColor: "ring-offset"
|
|
6248
6248
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6249
|
-
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d,
|
|
6249
|
+
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", ""), g = get(p, "2", ""), x = useCallback(
|
|
6250
6250
|
// eslint-disable-next-line no-shadow
|
|
6251
|
-
(
|
|
6252
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6251
|
+
(E) => {
|
|
6252
|
+
["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), u({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: E, shade: b.shade ? b.shade : "500" })));
|
|
6253
6253
|
},
|
|
6254
|
-
[c,
|
|
6254
|
+
[c, u]
|
|
6255
6255
|
);
|
|
6256
6256
|
useEffect(() => {
|
|
6257
6257
|
if (["current", "inherit", "transparent", "black", "white"].includes(m))
|
|
6258
6258
|
return c([]);
|
|
6259
6259
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6260
6260
|
}, [m]);
|
|
6261
|
-
const
|
|
6261
|
+
const j = useCallback(
|
|
6262
6262
|
// eslint-disable-next-line no-shadow
|
|
6263
|
-
(
|
|
6264
|
-
|
|
6263
|
+
(E) => {
|
|
6264
|
+
u({ color: m, shade: E });
|
|
6265
6265
|
},
|
|
6266
6266
|
[m]
|
|
6267
6267
|
);
|
|
6268
6268
|
return useEffect(() => {
|
|
6269
|
-
|
|
6269
|
+
u({ color: "", shade: "" });
|
|
6270
6270
|
}, [r]), useEffect(() => {
|
|
6271
|
-
const
|
|
6272
|
-
|
|
6271
|
+
const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6272
|
+
b.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(b, o);
|
|
6273
6273
|
}, [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: [
|
|
6274
6274
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6275
6275
|
DropDown,
|
|
@@ -6277,7 +6277,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6277
6277
|
disabled: !l,
|
|
6278
6278
|
rounded: !0,
|
|
6279
6279
|
selected: m,
|
|
6280
|
-
onChange:
|
|
6280
|
+
onChange: x,
|
|
6281
6281
|
options: [
|
|
6282
6282
|
"current",
|
|
6283
6283
|
"transparent",
|
|
@@ -6310,7 +6310,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6310
6310
|
]
|
|
6311
6311
|
}
|
|
6312
6312
|
) }),
|
|
6313
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected:
|
|
6313
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: j, options: i }) })
|
|
6314
6314
|
] });
|
|
6315
6315
|
}, getUserInputValues = (o, n) => {
|
|
6316
6316
|
o = o.toLowerCase();
|
|
@@ -6474,18 +6474,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6474
6474
|
"button",
|
|
6475
6475
|
{
|
|
6476
6476
|
type: "button",
|
|
6477
|
-
onMouseDown: (
|
|
6478
|
-
const
|
|
6477
|
+
onMouseDown: (u) => {
|
|
6478
|
+
const p = {
|
|
6479
6479
|
onDrag: r,
|
|
6480
6480
|
onDragEnd: a,
|
|
6481
6481
|
dragging: !0,
|
|
6482
|
-
dragStartY:
|
|
6482
|
+
dragStartY: u.pageY,
|
|
6483
6483
|
dragStartValue: `${n}`,
|
|
6484
6484
|
dragUnit: o,
|
|
6485
6485
|
negative: i,
|
|
6486
6486
|
cssProperty: c
|
|
6487
6487
|
};
|
|
6488
|
-
l(
|
|
6488
|
+
l(p), d(p);
|
|
6489
6489
|
},
|
|
6490
6490
|
color: void 0,
|
|
6491
6491
|
className: "relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",
|
|
@@ -6505,91 +6505,91 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6505
6505
|
},
|
|
6506
6506
|
a
|
|
6507
6507
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6508
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty:
|
|
6508
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [v, S] = useState(!1), [B, R] = useState(!1);
|
|
6509
6509
|
useEffect(() => {
|
|
6510
|
-
const { value:
|
|
6511
|
-
if (
|
|
6512
|
-
l(
|
|
6510
|
+
const { value: f, unit: _ } = getClassValueAndUnit(i);
|
|
6511
|
+
if (_ === "") {
|
|
6512
|
+
l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6513
6513
|
return;
|
|
6514
6514
|
}
|
|
6515
|
-
|
|
6516
|
-
}, [i,
|
|
6517
|
-
const A = useThrottledCallback((
|
|
6518
|
-
(
|
|
6519
|
-
const
|
|
6520
|
-
if (get(
|
|
6521
|
-
|
|
6515
|
+
x(_), l(_ === "class" || isEmpty(f) ? "" : f);
|
|
6516
|
+
}, [i, u, p]);
|
|
6517
|
+
const A = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), T = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
|
|
6518
|
+
(f = !1) => {
|
|
6519
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6520
|
+
if (get(_, "error", !1)) {
|
|
6521
|
+
E(!0);
|
|
6522
6522
|
return;
|
|
6523
6523
|
}
|
|
6524
|
-
const
|
|
6525
|
-
if (
|
|
6526
|
-
A(`${d}${
|
|
6524
|
+
const C = get(_, "unit") !== "" ? get(_, "unit") : g;
|
|
6525
|
+
if (C === "auto" || C === "none") {
|
|
6526
|
+
A(`${d}${C}`);
|
|
6527
6527
|
return;
|
|
6528
6528
|
}
|
|
6529
|
-
if (get(
|
|
6529
|
+
if (get(_, "value") === "")
|
|
6530
6530
|
return;
|
|
6531
|
-
const
|
|
6532
|
-
|
|
6531
|
+
const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6532
|
+
f ? T(I) : A(I);
|
|
6533
6533
|
},
|
|
6534
|
-
[A,
|
|
6535
|
-
),
|
|
6536
|
-
(
|
|
6537
|
-
const
|
|
6538
|
-
if (get(
|
|
6539
|
-
|
|
6534
|
+
[A, T, a, g, d, p]
|
|
6535
|
+
), P = useCallback(
|
|
6536
|
+
(f) => {
|
|
6537
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6538
|
+
if (get(_, "error", !1)) {
|
|
6539
|
+
E(!0);
|
|
6540
6540
|
return;
|
|
6541
6541
|
}
|
|
6542
|
-
if (
|
|
6543
|
-
A(`${d}${
|
|
6542
|
+
if (f === "auto" || f === "none") {
|
|
6543
|
+
A(`${d}${f}`);
|
|
6544
6544
|
return;
|
|
6545
6545
|
}
|
|
6546
|
-
if (get(
|
|
6546
|
+
if (get(_, "value") === "")
|
|
6547
6547
|
return;
|
|
6548
|
-
const
|
|
6549
|
-
A(
|
|
6548
|
+
const C = get(_, "unit") !== "" ? get(_, "unit") : f, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6549
|
+
A(I);
|
|
6550
6550
|
},
|
|
6551
|
-
[A, a, d,
|
|
6551
|
+
[A, a, d, p]
|
|
6552
6552
|
);
|
|
6553
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children:
|
|
6553
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6554
6554
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
6555
6555
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6556
6556
|
/* @__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, {}) }) }),
|
|
6557
6557
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6558
6558
|
] })
|
|
6559
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6559
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
|
|
6560
6560
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6561
|
-
["none", "auto"].indexOf(
|
|
6561
|
+
["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6562
6562
|
"input",
|
|
6563
6563
|
{
|
|
6564
|
-
readOnly:
|
|
6565
|
-
onKeyPress: (
|
|
6566
|
-
|
|
6564
|
+
readOnly: g === "class",
|
|
6565
|
+
onKeyPress: (f) => {
|
|
6566
|
+
f.key === "Enter" && L();
|
|
6567
6567
|
},
|
|
6568
|
-
onKeyDown: (
|
|
6569
|
-
if (
|
|
6568
|
+
onKeyDown: (f) => {
|
|
6569
|
+
if (f.keyCode !== 38 && f.keyCode !== 40)
|
|
6570
6570
|
return;
|
|
6571
|
-
|
|
6572
|
-
const
|
|
6573
|
-
let
|
|
6574
|
-
|
|
6575
|
-
const
|
|
6576
|
-
N
|
|
6571
|
+
f.preventDefault(), R(!0);
|
|
6572
|
+
const _ = parseInt$1(f.target.value);
|
|
6573
|
+
let C = isNaN$1(_) ? 0 : _;
|
|
6574
|
+
f.keyCode === 38 && (C += 1), f.keyCode === 40 && (C -= 1);
|
|
6575
|
+
const w = `${C}`, N = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6576
|
+
T(N);
|
|
6577
6577
|
},
|
|
6578
|
-
onKeyUp: (
|
|
6579
|
-
B && (
|
|
6578
|
+
onKeyUp: (f) => {
|
|
6579
|
+
B && (f.preventDefault(), R(!1));
|
|
6580
6580
|
},
|
|
6581
|
-
onBlur: () =>
|
|
6582
|
-
onChange: (
|
|
6583
|
-
|
|
6581
|
+
onBlur: () => L(),
|
|
6582
|
+
onChange: (f) => {
|
|
6583
|
+
E(!1), l(f.target.value);
|
|
6584
6584
|
},
|
|
6585
|
-
onClick: (
|
|
6586
|
-
var
|
|
6587
|
-
(
|
|
6585
|
+
onClick: (f) => {
|
|
6586
|
+
var _;
|
|
6587
|
+
(_ = f == null ? void 0 : f.target) == null || _.select(), r(!1);
|
|
6588
6588
|
},
|
|
6589
|
-
value:
|
|
6589
|
+
value: v ? b : a,
|
|
6590
6590
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6591
6591
|
" ",
|
|
6592
|
-
|
|
6592
|
+
j ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
6593
6593
|
)
|
|
6594
6594
|
}
|
|
6595
6595
|
),
|
|
@@ -6601,44 +6601,44 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6601
6601
|
onClick: () => r(!n),
|
|
6602
6602
|
className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
|
|
6603
6603
|
children: [
|
|
6604
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${
|
|
6605
|
-
|
|
6604
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
|
|
6605
|
+
p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
|
|
6606
6606
|
]
|
|
6607
6607
|
}
|
|
6608
6608
|
) }),
|
|
6609
6609
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6610
6610
|
UnitSelection,
|
|
6611
6611
|
{
|
|
6612
|
-
units:
|
|
6613
|
-
current:
|
|
6614
|
-
onSelect: (
|
|
6615
|
-
r(!1),
|
|
6612
|
+
units: p,
|
|
6613
|
+
current: g,
|
|
6614
|
+
onSelect: (f) => {
|
|
6615
|
+
r(!1), x(f), P(f);
|
|
6616
6616
|
}
|
|
6617
6617
|
}
|
|
6618
6618
|
) }) })
|
|
6619
6619
|
] })
|
|
6620
6620
|
] }),
|
|
6621
|
-
["none", "auto"].indexOf(
|
|
6621
|
+
["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6622
6622
|
DragStyleButton,
|
|
6623
6623
|
{
|
|
6624
|
-
onDragStart: () =>
|
|
6625
|
-
onDragEnd: (
|
|
6626
|
-
if (k(() => ""),
|
|
6624
|
+
onDragStart: () => S(!0),
|
|
6625
|
+
onDragEnd: (f) => {
|
|
6626
|
+
if (k(() => ""), S(!1), isEmpty(f))
|
|
6627
6627
|
return;
|
|
6628
|
-
const
|
|
6629
|
-
A(
|
|
6628
|
+
const _ = `${f}`, w = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6629
|
+
A(w);
|
|
6630
6630
|
},
|
|
6631
|
-
onDrag: (
|
|
6632
|
-
if (isEmpty(
|
|
6631
|
+
onDrag: (f) => {
|
|
6632
|
+
if (isEmpty(f))
|
|
6633
6633
|
return;
|
|
6634
|
-
k(
|
|
6635
|
-
const
|
|
6636
|
-
|
|
6634
|
+
k(f);
|
|
6635
|
+
const _ = `${f}`, w = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6636
|
+
T(w);
|
|
6637
6637
|
},
|
|
6638
6638
|
currentValue: a,
|
|
6639
|
-
unit:
|
|
6639
|
+
unit: g,
|
|
6640
6640
|
negative: m,
|
|
6641
|
-
cssProperty:
|
|
6641
|
+
cssProperty: u
|
|
6642
6642
|
}
|
|
6643
6643
|
)
|
|
6644
6644
|
] }) }) });
|
|
@@ -6730,22 +6730,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6730
6730
|
"2xl": "1536px"
|
|
6731
6731
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6732
6732
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6733
|
-
}, units: c, negative: d = !1 } = o, [
|
|
6734
|
-
(
|
|
6735
|
-
const
|
|
6736
|
-
(
|
|
6737
|
-
const
|
|
6738
|
-
|
|
6733
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), g = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), k = useCallback(
|
|
6734
|
+
(T, L = !0) => {
|
|
6735
|
+
const P = { dark: u, mq: m, mod: p, cls: T, property: l, fullCls: "" };
|
|
6736
|
+
(u || p !== "") && (P.mq = "xs");
|
|
6737
|
+
const f = generateFullClsName(P);
|
|
6738
|
+
x(E, [f], L);
|
|
6739
6739
|
},
|
|
6740
|
-
[
|
|
6741
|
-
),
|
|
6742
|
-
E
|
|
6743
|
-
}, [
|
|
6740
|
+
[E, u, m, p, l, x]
|
|
6741
|
+
), v = useCallback(() => {
|
|
6742
|
+
j(E, [b]);
|
|
6743
|
+
}, [E, b, j]), S = useMemo(() => canChangeClass(g, m), [g, m]);
|
|
6744
6744
|
useEffect(() => {
|
|
6745
|
-
i(
|
|
6746
|
-
}, [
|
|
6745
|
+
i(S, g);
|
|
6746
|
+
}, [S, i, g]);
|
|
6747
6747
|
const [, , B] = useCanvasWidth(), R = useCallback(
|
|
6748
|
-
(
|
|
6748
|
+
(T) => {
|
|
6749
6749
|
B({
|
|
6750
6750
|
xs: 400,
|
|
6751
6751
|
sm: 640,
|
|
@@ -6753,18 +6753,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6753
6753
|
lg: 1024,
|
|
6754
6754
|
xl: 1420,
|
|
6755
6755
|
"2xl": 1920
|
|
6756
|
-
}[
|
|
6756
|
+
}[T]);
|
|
6757
6757
|
},
|
|
6758
6758
|
[B]
|
|
6759
|
-
), A = get(
|
|
6760
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6761
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${
|
|
6759
|
+
), A = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
|
|
6760
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: g && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6761
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6762
6762
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6763
6763
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6764
6764
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6765
6765
|
AdvanceChoices,
|
|
6766
6766
|
{
|
|
6767
|
-
currentClass: get(
|
|
6767
|
+
currentClass: get(g, "cls", ""),
|
|
6768
6768
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6769
6769
|
units: c || [],
|
|
6770
6770
|
onChange: k,
|
|
@@ -6777,7 +6777,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6777
6777
|
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6778
6778
|
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6779
6779
|
] }),
|
|
6780
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6780
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "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 && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6781
6781
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6782
6782
|
"button",
|
|
6783
6783
|
{
|
|
@@ -6789,19 +6789,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6789
6789
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
6790
6790
|
"Current style is set at ",
|
|
6791
6791
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
|
|
6792
|
-
getBreakpoint(get(
|
|
6793
|
-
|
|
6792
|
+
getBreakpoint(get(g, "mq")),
|
|
6793
|
+
u && !g.dark ? "(Light mode)" : ""
|
|
6794
6794
|
] }),
|
|
6795
6795
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
6796
6796
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6797
6797
|
"button",
|
|
6798
6798
|
{
|
|
6799
6799
|
type: "button",
|
|
6800
|
-
onClick: () => R(get(
|
|
6800
|
+
onClick: () => R(get(g, "mq")),
|
|
6801
6801
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6802
6802
|
children: [
|
|
6803
6803
|
"Switch to ",
|
|
6804
|
-
get(
|
|
6804
|
+
get(g, "mq").toUpperCase()
|
|
6805
6805
|
]
|
|
6806
6806
|
}
|
|
6807
6807
|
)
|
|
@@ -6818,7 +6818,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6818
6818
|
units: i = basicUnits,
|
|
6819
6819
|
negative: c = !1
|
|
6820
6820
|
}) => {
|
|
6821
|
-
const { t: d } = useTranslation(), [
|
|
6821
|
+
const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
|
|
6822
6822
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6823
6823
|
"div",
|
|
6824
6824
|
{
|
|
@@ -6827,22 +6827,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6827
6827
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6828
6828
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6829
6829
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6830
|
-
n.map(({ label:
|
|
6830
|
+
n.map(({ label: x, key: j }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6831
6831
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6832
6832
|
"button",
|
|
6833
6833
|
{
|
|
6834
6834
|
type: "button",
|
|
6835
|
-
onClick: () =>
|
|
6836
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6835
|
+
onClick: () => p(j),
|
|
6836
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6837
6837
|
children: [
|
|
6838
6838
|
React__default.createElement("div", {
|
|
6839
|
-
className:
|
|
6839
|
+
className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6840
6840
|
}),
|
|
6841
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6841
|
+
React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6842
6842
|
]
|
|
6843
6843
|
}
|
|
6844
6844
|
) }),
|
|
6845
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(
|
|
6845
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(x)) })
|
|
6846
6846
|
] }) }))
|
|
6847
6847
|
) })
|
|
6848
6848
|
] }),
|
|
@@ -6852,7 +6852,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6852
6852
|
type: l,
|
|
6853
6853
|
units: [...i],
|
|
6854
6854
|
label: "",
|
|
6855
|
-
property:
|
|
6855
|
+
property: u,
|
|
6856
6856
|
negative: c
|
|
6857
6857
|
}
|
|
6858
6858
|
) })
|
|
@@ -6861,10 +6861,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6861
6861
|
);
|
|
6862
6862
|
}, NestedOptions = ({ heading: o, items: n }) => {
|
|
6863
6863
|
const { t: r } = useTranslation(), a = useSelectedBlockCurrentClasses(), l = useMemo(() => {
|
|
6864
|
-
const i = (
|
|
6865
|
-
|
|
6864
|
+
const i = (u) => flatten(
|
|
6865
|
+
u.map((p) => p.styleType === "multiple" ? map(p.options, "key") : p.property)
|
|
6866
6866
|
), c = flatten(
|
|
6867
|
-
n.map((
|
|
6867
|
+
n.map((u) => u.styleType === "accordion" ? i(u.items) : u.styleType === "multiple" ? map(u.options, "key") : u.property)
|
|
6868
6868
|
), d = map(a, "property");
|
|
6869
6869
|
return intersection(c, d).length > 0;
|
|
6870
6870
|
}, [a, n]);
|
|
@@ -6884,11 +6884,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6884
6884
|
const { t: n } = useTranslation(), r = useSelectedBlockCurrentClasses(), a = useCallback(
|
|
6885
6885
|
(i = []) => {
|
|
6886
6886
|
const c = {};
|
|
6887
|
-
for (let
|
|
6888
|
-
c[r[
|
|
6887
|
+
for (let u = 0; u < r.length; u++)
|
|
6888
|
+
c[r[u].property] = r[u].cls;
|
|
6889
6889
|
let d = !0;
|
|
6890
|
-
for (const
|
|
6891
|
-
if (!has(c,
|
|
6890
|
+
for (const u in i)
|
|
6891
|
+
if (!has(c, u) || c[u] !== i[u]) {
|
|
6892
6892
|
d = !1;
|
|
6893
6893
|
break;
|
|
6894
6894
|
}
|
|
@@ -6906,8 +6906,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6906
6906
|
const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a = useGlobalStylingPresets(), l = useAddClassesToBlocks(), i = getBlockComponent(o._type), c = get(first(n), "prop"), d = get(i.props, `${c}.presets`, {});
|
|
6907
6907
|
if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
|
|
6908
6908
|
return null;
|
|
6909
|
-
const
|
|
6910
|
-
const m =
|
|
6909
|
+
const u = (p) => {
|
|
6910
|
+
const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6911
6911
|
l([o._id], m, !0);
|
|
6912
6912
|
};
|
|
6913
6913
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
@@ -6923,16 +6923,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6923
6923
|
r("presets")
|
|
6924
6924
|
] }),
|
|
6925
6925
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
6926
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((
|
|
6927
|
-
capitalize(startCase(r(
|
|
6926
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(d[p]), children: [
|
|
6927
|
+
capitalize(startCase(r(p))),
|
|
6928
6928
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
|
|
6929
6929
|
] })) })
|
|
6930
6930
|
] }),
|
|
6931
6931
|
isEmpty(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6932
6932
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { children: r("Global presets") }),
|
|
6933
6933
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
6934
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((
|
|
6935
|
-
capitalize(startCase(r(
|
|
6934
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(a[p]), children: [
|
|
6935
|
+
capitalize(startCase(r(p))),
|
|
6936
6936
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
|
|
6937
6937
|
] })) })
|
|
6938
6938
|
] })
|
|
@@ -6952,8 +6952,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6952
6952
|
};
|
|
6953
6953
|
function BlockStyling() {
|
|
6954
6954
|
const { flexChild: o, gridChild: n } = useSelectedBlocksDisplayChild(), [r] = useSelectedStylingBlocks(), [a, l] = React__default.useState(""), [i, c] = React__default.useState({
|
|
6955
|
-
onDrag: (
|
|
6956
|
-
onDragEnd: (
|
|
6955
|
+
onDrag: (p) => p,
|
|
6956
|
+
onDragEnd: (p) => p,
|
|
6957
6957
|
dragStartY: 0,
|
|
6958
6958
|
dragging: !1,
|
|
6959
6959
|
dragStartValue: 0,
|
|
@@ -6961,21 +6961,21 @@ function BlockStyling() {
|
|
|
6961
6961
|
negative: !1,
|
|
6962
6962
|
cssProperty: ""
|
|
6963
6963
|
}), d = useThrottledCallback(
|
|
6964
|
-
(
|
|
6965
|
-
const m = !get(i, "negative", !1),
|
|
6966
|
-
let
|
|
6967
|
-
|
|
6968
|
-
let
|
|
6969
|
-
(startsWith(
|
|
6970
|
-
let
|
|
6971
|
-
m &&
|
|
6964
|
+
(p) => {
|
|
6965
|
+
const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
|
|
6966
|
+
let x = parseFloat(i.dragStartValue);
|
|
6967
|
+
x = isNaN(x) ? 0 : x;
|
|
6968
|
+
let j = MAPPER[i.dragUnit];
|
|
6969
|
+
(startsWith(g, "scale") || g === "opacity") && (j = 10);
|
|
6970
|
+
let b = (i.dragStartY - p.pageY) / j + x;
|
|
6971
|
+
m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
|
|
6972
6972
|
},
|
|
6973
6973
|
[i],
|
|
6974
6974
|
50
|
|
6975
|
-
),
|
|
6975
|
+
), u = useCallback(() => {
|
|
6976
6976
|
setTimeout(() => i.onDragEnd(`${a}`), 100), c({
|
|
6977
|
-
onDrag: (
|
|
6978
|
-
onDragEnd: (
|
|
6977
|
+
onDrag: (p) => p,
|
|
6978
|
+
onDragEnd: (p) => p,
|
|
6979
6979
|
dragStartY: 0,
|
|
6980
6980
|
dragging: !1,
|
|
6981
6981
|
dragStartValue: 0,
|
|
@@ -6989,7 +6989,7 @@ function BlockStyling() {
|
|
|
6989
6989
|
"div",
|
|
6990
6990
|
{
|
|
6991
6991
|
onMouseMove: d,
|
|
6992
|
-
onMouseUp: () =>
|
|
6992
|
+
onMouseUp: () => u(),
|
|
6993
6993
|
className: "absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"
|
|
6994
6994
|
}
|
|
6995
6995
|
) : null,
|
|
@@ -6998,7 +6998,7 @@ function BlockStyling() {
|
|
|
6998
6998
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
|
|
6999
6999
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION }),
|
|
7000
7000
|
n ? /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: GRID_CHILD_SECTION }) : null,
|
|
7001
|
-
SETTINGS_SECTIONS.map((
|
|
7001
|
+
SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p }, p.heading))
|
|
7002
7002
|
] })
|
|
7003
7003
|
] })
|
|
7004
7004
|
] });
|
|
@@ -7010,9 +7010,9 @@ const ChaiSelect = ({
|
|
|
7010
7010
|
placeholder: a = "Select",
|
|
7011
7011
|
className: l = ""
|
|
7012
7012
|
}) => {
|
|
7013
|
-
const [i, c] = useState(o), d = (
|
|
7014
|
-
const
|
|
7015
|
-
c(
|
|
7013
|
+
const [i, c] = useState(o), d = (u) => {
|
|
7014
|
+
const p = u.target.value;
|
|
7015
|
+
c(p), n(p);
|
|
7016
7016
|
};
|
|
7017
7017
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative inline-block w-full", l), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7018
7018
|
"select",
|
|
@@ -7022,7 +7022,7 @@ const ChaiSelect = ({
|
|
|
7022
7022
|
onChange: d,
|
|
7023
7023
|
children: [
|
|
7024
7024
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, children: a }),
|
|
7025
|
-
r.map((
|
|
7025
|
+
r.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.value, children: u.label }, u.value))
|
|
7026
7026
|
]
|
|
7027
7027
|
}
|
|
7028
7028
|
) });
|
|
@@ -7054,25 +7054,25 @@ const BlockCard = ({
|
|
|
7054
7054
|
library: n,
|
|
7055
7055
|
parentId: r = void 0
|
|
7056
7056
|
}) => {
|
|
7057
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [,
|
|
7058
|
-
const
|
|
7059
|
-
return k._type === "Box" &&
|
|
7060
|
-
},
|
|
7057
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
|
|
7058
|
+
const v = has(k, "styles_attrs.data-page-section");
|
|
7059
|
+
return k._type === "Box" && v;
|
|
7060
|
+
}, E = useCallback(
|
|
7061
7061
|
async (k) => {
|
|
7062
7062
|
if (k.stopPropagation(), has(o, "component")) {
|
|
7063
7063
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7064
7064
|
return;
|
|
7065
7065
|
}
|
|
7066
7066
|
l(!0);
|
|
7067
|
-
const
|
|
7068
|
-
isEmpty(
|
|
7067
|
+
const v = await i(n, o);
|
|
7068
|
+
isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7069
7069
|
},
|
|
7070
7070
|
[o]
|
|
7071
|
-
),
|
|
7072
|
-
const
|
|
7073
|
-
let
|
|
7074
|
-
if (
|
|
7075
|
-
const B = { blocks:
|
|
7071
|
+
), b = async (k) => {
|
|
7072
|
+
const v = await i(n, o);
|
|
7073
|
+
let S = r;
|
|
7074
|
+
if (j(first(v)) && (S = null), !isEmpty(v)) {
|
|
7075
|
+
const B = { blocks: v, uiLibrary: !0, parent: S };
|
|
7076
7076
|
if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
7077
7077
|
const R = new Image();
|
|
7078
7078
|
R.src = o.preview, R.onload = () => {
|
|
@@ -7080,8 +7080,8 @@ const BlockCard = ({
|
|
|
7080
7080
|
};
|
|
7081
7081
|
} else
|
|
7082
7082
|
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7083
|
-
|
|
7084
|
-
|
|
7083
|
+
x(B), setTimeout(() => {
|
|
7084
|
+
u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7085
7085
|
}, 200);
|
|
7086
7086
|
}
|
|
7087
7087
|
};
|
|
@@ -7090,9 +7090,9 @@ const BlockCard = ({
|
|
|
7090
7090
|
"div",
|
|
7091
7091
|
{
|
|
7092
7092
|
onClick: a ? () => {
|
|
7093
|
-
} :
|
|
7094
|
-
draggable:
|
|
7095
|
-
onDragStart:
|
|
7093
|
+
} : E,
|
|
7094
|
+
draggable: g ? "true" : "false",
|
|
7095
|
+
onDragStart: b,
|
|
7096
7096
|
className: clsx(
|
|
7097
7097
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
7098
7098
|
),
|
|
@@ -7115,42 +7115,42 @@ const BlockCard = ({
|
|
|
7115
7115
|
(async () => {
|
|
7116
7116
|
if (i === "complete" || c.current === "loading")
|
|
7117
7117
|
return;
|
|
7118
|
-
c.current = "loading", r((
|
|
7118
|
+
c.current = "loading", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
|
|
7119
7119
|
const d = await a(o);
|
|
7120
|
-
c.current = "idle", r((
|
|
7120
|
+
c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
|
|
7121
7121
|
})();
|
|
7122
7122
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7123
7123
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7124
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((
|
|
7125
|
-
|
|
7126
|
-
|
|
7124
|
+
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, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (S) => {
|
|
7125
|
+
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7126
|
+
j.current && g(S);
|
|
7127
7127
|
}, 300);
|
|
7128
7128
|
};
|
|
7129
|
-
if (
|
|
7129
|
+
if (u)
|
|
7130
7130
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid h-full w-full grid-cols-12 gap-2", children: [
|
|
7131
7131
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7132
7132
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7133
7133
|
] });
|
|
7134
|
-
const k = filter(
|
|
7134
|
+
const k = filter(x, (S, B) => B % 2 === 0), v = filter(x, (S, B) => B % 2 === 1);
|
|
7135
7135
|
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: [
|
|
7136
7136
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7137
7137
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7138
7138
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7139
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7139
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("groups") }),
|
|
7140
7140
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7141
7141
|
/* @__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(
|
|
7142
|
-
map(
|
|
7142
|
+
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7143
7143
|
"div",
|
|
7144
7144
|
{
|
|
7145
|
-
onMouseEnter: () =>
|
|
7146
|
-
onMouseLeave: () => clearTimeout(
|
|
7147
|
-
onClick: () =>
|
|
7145
|
+
onMouseEnter: () => b(B),
|
|
7146
|
+
onMouseLeave: () => clearTimeout(j.current),
|
|
7147
|
+
onClick: () => g(B),
|
|
7148
7148
|
className: cn(
|
|
7149
7149
|
"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",
|
|
7150
7150
|
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7151
7151
|
),
|
|
7152
7152
|
children: [
|
|
7153
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7153
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
|
|
7154
7154
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7155
7155
|
]
|
|
7156
7156
|
},
|
|
@@ -7162,15 +7162,15 @@ const BlockCard = ({
|
|
|
7162
7162
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7163
7163
|
ScrollArea,
|
|
7164
7164
|
{
|
|
7165
|
-
onMouseEnter: () =>
|
|
7165
|
+
onMouseEnter: () => j.current ? clearTimeout(j.current) : null,
|
|
7166
7166
|
className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
|
|
7167
7167
|
children: [
|
|
7168
7168
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7169
7169
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7170
|
-
k.map((
|
|
7170
|
+
k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7171
7171
|
) }),
|
|
7172
7172
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7173
|
-
|
|
7173
|
+
v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7174
7174
|
) })
|
|
7175
7175
|
] }),
|
|
7176
7176
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7615,54 +7615,54 @@ i18n.use(initReactI18next).init({
|
|
|
7615
7615
|
}
|
|
7616
7616
|
});
|
|
7617
7617
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7618
|
-
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock:
|
|
7618
|
+
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
|
|
7619
7619
|
if (has(o, "blocks")) {
|
|
7620
|
-
const
|
|
7621
|
-
|
|
7620
|
+
const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7621
|
+
u(syncBlocksWithDefaults(E), r || null);
|
|
7622
7622
|
} else
|
|
7623
7623
|
d(o, r || null);
|
|
7624
7624
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7625
|
-
},
|
|
7625
|
+
}, x = useFeature("dnd"), { t: j } = useTranslation();
|
|
7626
7626
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7627
7627
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7628
7628
|
"button",
|
|
7629
7629
|
{
|
|
7630
7630
|
disabled: n,
|
|
7631
|
-
onClick:
|
|
7631
|
+
onClick: g,
|
|
7632
7632
|
type: "button",
|
|
7633
|
-
onDragStart: (
|
|
7634
|
-
|
|
7635
|
-
|
|
7633
|
+
onDragStart: (E) => {
|
|
7634
|
+
E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7635
|
+
p([]), m();
|
|
7636
7636
|
}, 200);
|
|
7637
7637
|
},
|
|
7638
|
-
draggable:
|
|
7638
|
+
draggable: x ? "true" : "false",
|
|
7639
7639
|
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",
|
|
7640
7640
|
children: [
|
|
7641
7641
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
7642
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
7642
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(j(c || l)) })
|
|
7643
7643
|
]
|
|
7644
7644
|
}
|
|
7645
7645
|
) }),
|
|
7646
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7646
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: j(c || l) }) })
|
|
7647
7647
|
] }) });
|
|
7648
7648
|
}, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
|
|
7649
7649
|
const r = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
|
|
7650
7650
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: o, groups: c, blocks: i.core });
|
|
7651
7651
|
}, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, gridCols: a = "grid-cols-4" }) => {
|
|
7652
7652
|
var d;
|
|
7653
|
-
const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (
|
|
7653
|
+
const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (u) => u._id === r)) == null ? void 0 : d._type;
|
|
7654
7654
|
return React__default.Children.toArray(
|
|
7655
7655
|
map(
|
|
7656
|
-
sortBy(o, (
|
|
7657
|
-
(
|
|
7658
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(
|
|
7656
|
+
sortBy(o, (u) => CORE_GROUPS.indexOf(u) === -1 ? 99 : CORE_GROUPS.indexOf(u)),
|
|
7657
|
+
(u) => reject(filter(values(n), { group: u }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: u, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: u, className: "border-border", children: [
|
|
7658
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(u.toLowerCase())) }),
|
|
7659
7659
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-2 " + a, children: React__default.Children.toArray(
|
|
7660
|
-
reject(filter(values(n), { group:
|
|
7660
|
+
reject(filter(values(n), { group: u }), { hidden: !0 }).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7661
7661
|
CoreBlock,
|
|
7662
7662
|
{
|
|
7663
7663
|
parentId: r,
|
|
7664
|
-
block:
|
|
7665
|
-
disabled: !canAcceptChildBlock(c,
|
|
7664
|
+
block: p,
|
|
7665
|
+
disabled: !canAcceptChildBlock(c, p.type) || !canBeNestedInside(c, p.type)
|
|
7666
7666
|
}
|
|
7667
7667
|
))
|
|
7668
7668
|
) }) })
|
|
@@ -7683,8 +7683,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7683
7683
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7684
7684
|
Tabs,
|
|
7685
7685
|
{
|
|
7686
|
-
onValueChange: (
|
|
7687
|
-
c(""), i(
|
|
7686
|
+
onValueChange: (u) => {
|
|
7687
|
+
c(""), i(u);
|
|
7688
7688
|
},
|
|
7689
7689
|
value: l,
|
|
7690
7690
|
className: cn("h-max"),
|
|
@@ -7969,7 +7969,7 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7969
7969
|
icon: FaLanguage$1,
|
|
7970
7970
|
prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
|
|
7971
7971
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-2", children: i.map(
|
|
7972
|
-
({ name: c, icon: d, subMenus:
|
|
7972
|
+
({ name: c, icon: d, subMenus: u, prompt: p }) => u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
|
|
7973
7973
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7974
7974
|
"li",
|
|
7975
7975
|
{
|
|
@@ -7985,7 +7985,7 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7985
7985
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7986
7986
|
"li",
|
|
7987
7987
|
{
|
|
7988
|
-
onClick: () => o(
|
|
7988
|
+
onClick: () => o(p),
|
|
7989
7989
|
className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
7990
7990
|
children: [
|
|
7991
7991
|
/* @__PURE__ */ jsxRuntimeExports.jsx(d, { className: "h-4 w-4" }),
|
|
@@ -7997,20 +7997,20 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7997
7997
|
) }) });
|
|
7998
7998
|
}
|
|
7999
7999
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
8000
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d,
|
|
8000
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), g = useRef(null), x = useRef(null);
|
|
8001
8001
|
useEffect(() => {
|
|
8002
|
-
var
|
|
8003
|
-
(
|
|
8002
|
+
var E;
|
|
8003
|
+
(E = g.current) == null || E.focus();
|
|
8004
8004
|
}, []);
|
|
8005
|
-
const
|
|
8006
|
-
const { usage:
|
|
8007
|
-
!l &&
|
|
8005
|
+
const j = (E) => {
|
|
8006
|
+
const { usage: b } = E || {};
|
|
8007
|
+
!l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
8008
8008
|
};
|
|
8009
8009
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
8010
8010
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8011
8011
|
"div",
|
|
8012
8012
|
{
|
|
8013
|
-
onClick: () =>
|
|
8013
|
+
onClick: () => u(!d),
|
|
8014
8014
|
className: "flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",
|
|
8015
8015
|
children: [
|
|
8016
8016
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Ask AI") }),
|
|
@@ -8022,14 +8022,14 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8022
8022
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8023
8023
|
Textarea,
|
|
8024
8024
|
{
|
|
8025
|
-
ref:
|
|
8025
|
+
ref: g,
|
|
8026
8026
|
value: i,
|
|
8027
|
-
onChange: (
|
|
8027
|
+
onChange: (E) => c(E.target.value),
|
|
8028
8028
|
placeholder: n("Ask AI to edit content"),
|
|
8029
8029
|
className: "w-full",
|
|
8030
8030
|
rows: 3,
|
|
8031
|
-
onKeyDown: (
|
|
8032
|
-
|
|
8031
|
+
onKeyDown: (E) => {
|
|
8032
|
+
E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
|
|
8033
8033
|
}
|
|
8034
8034
|
}
|
|
8035
8035
|
),
|
|
@@ -8039,7 +8039,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8039
8039
|
{
|
|
8040
8040
|
disabled: i.trim().length < 5 || a,
|
|
8041
8041
|
onClick: () => {
|
|
8042
|
-
|
|
8042
|
+
x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
|
|
8043
8043
|
},
|
|
8044
8044
|
variant: "default",
|
|
8045
8045
|
className: "w-fit",
|
|
@@ -8058,11 +8058,11 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8058
8058
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
|
|
8059
8059
|
] }) : null
|
|
8060
8060
|
] }),
|
|
8061
|
-
|
|
8061
|
+
p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
|
|
8062
8062
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
8063
8063
|
n("Total tokens used"),
|
|
8064
8064
|
": ",
|
|
8065
|
-
|
|
8065
|
+
p.totalTokens
|
|
8066
8066
|
] }),
|
|
8067
8067
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
|
|
8068
8068
|
] }) }) : null,
|
|
@@ -8071,8 +8071,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8071
8071
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8072
8072
|
QuickPrompts,
|
|
8073
8073
|
{
|
|
8074
|
-
onClick: (
|
|
8075
|
-
|
|
8074
|
+
onClick: (E) => {
|
|
8075
|
+
x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
|
|
8076
8076
|
}
|
|
8077
8077
|
}
|
|
8078
8078
|
)
|
|
@@ -8082,19 +8082,19 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8082
8082
|
] }) }) : null
|
|
8083
8083
|
] });
|
|
8084
8084
|
}, AISetContext = () => {
|
|
8085
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [
|
|
8085
|
+
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: g } = useToast(), x = useRef(null);
|
|
8086
8086
|
useEffect(() => {
|
|
8087
8087
|
n && a(n);
|
|
8088
8088
|
}, [n]);
|
|
8089
|
-
const
|
|
8089
|
+
const j = async () => {
|
|
8090
8090
|
try {
|
|
8091
|
-
d(!0),
|
|
8091
|
+
d(!0), p(null), await i(r), g({
|
|
8092
8092
|
title: o("Updated AI Context"),
|
|
8093
8093
|
description: o("You can now Ask AI to edit your content"),
|
|
8094
8094
|
variant: "default"
|
|
8095
|
-
}),
|
|
8096
|
-
} catch (
|
|
8097
|
-
|
|
8095
|
+
}), x.current.click();
|
|
8096
|
+
} catch (E) {
|
|
8097
|
+
p(E);
|
|
8098
8098
|
} finally {
|
|
8099
8099
|
d(!1);
|
|
8100
8100
|
}
|
|
@@ -8102,25 +8102,25 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8102
8102
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8103
8103
|
Accordion,
|
|
8104
8104
|
{
|
|
8105
|
-
onValueChange: (
|
|
8106
|
-
m(
|
|
8105
|
+
onValueChange: (E) => {
|
|
8106
|
+
m(E !== "");
|
|
8107
8107
|
},
|
|
8108
8108
|
type: "single",
|
|
8109
8109
|
collapsible: !0,
|
|
8110
8110
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
8111
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref:
|
|
8111
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: x, 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") }) }) }),
|
|
8112
8112
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
8113
8113
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8114
8114
|
Textarea,
|
|
8115
8115
|
{
|
|
8116
8116
|
ref: l,
|
|
8117
8117
|
value: r,
|
|
8118
|
-
onChange: (
|
|
8118
|
+
onChange: (E) => a(E.target.value),
|
|
8119
8119
|
placeholder: o("Tell about this page eg this page is about"),
|
|
8120
8120
|
className: "mt-1 w-full",
|
|
8121
8121
|
rows: 10,
|
|
8122
|
-
onKeyDown: (
|
|
8123
|
-
|
|
8122
|
+
onKeyDown: (E) => {
|
|
8123
|
+
E.key === "Enter" && (E.preventDefault(), j());
|
|
8124
8124
|
}
|
|
8125
8125
|
}
|
|
8126
8126
|
),
|
|
@@ -8132,20 +8132,20 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8132
8132
|
Button,
|
|
8133
8133
|
{
|
|
8134
8134
|
disabled: r.trim().length < 5,
|
|
8135
|
-
onClick: () =>
|
|
8135
|
+
onClick: () => j(),
|
|
8136
8136
|
variant: "default",
|
|
8137
8137
|
className: "w-fit",
|
|
8138
8138
|
size: "sm",
|
|
8139
8139
|
children: c ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
8140
8140
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "h-5 w-5 animate-spin" }),
|
|
8141
|
-
o("
|
|
8141
|
+
o("Saving... Please wait...")
|
|
8142
8142
|
] }) : o("Save")
|
|
8143
8143
|
}
|
|
8144
8144
|
),
|
|
8145
8145
|
n.trim().length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialog, { children: [
|
|
8146
8146
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { disabled: n.trim().length === 0, variant: "ghost", className: "w-fit", size: "sm", children: c ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
8147
8147
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "h-5 w-5 animate-spin" }),
|
|
8148
|
-
o("
|
|
8148
|
+
o("Deleting... Please wait...")
|
|
8149
8149
|
] }) : o("Delete") }) }),
|
|
8150
8150
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogContent, { children: [
|
|
8151
8151
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDialogHeader, { children: [
|
|
@@ -8161,7 +8161,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8161
8161
|
AlertDialogAction,
|
|
8162
8162
|
{
|
|
8163
8163
|
onClick: () => {
|
|
8164
|
-
a(""),
|
|
8164
|
+
a(""), j();
|
|
8165
8165
|
},
|
|
8166
8166
|
children: o("Yes, Delete")
|
|
8167
8167
|
}
|
|
@@ -8170,7 +8170,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8170
8170
|
] })
|
|
8171
8171
|
] }) : null
|
|
8172
8172
|
] }),
|
|
8173
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children:
|
|
8173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: u.message }) })
|
|
8174
8174
|
] })
|
|
8175
8175
|
] })
|
|
8176
8176
|
}
|
|
@@ -8182,42 +8182,42 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8182
8182
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
8183
8183
|
] });
|
|
8184
8184
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
8185
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d,
|
|
8185
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
|
|
8186
8186
|
useEffect(() => {
|
|
8187
8187
|
l(n);
|
|
8188
8188
|
}, [n]);
|
|
8189
|
-
const
|
|
8189
|
+
const b = () => {
|
|
8190
8190
|
if (i.startsWith("@")) {
|
|
8191
|
-
|
|
8191
|
+
x("Attribute keys cannot start with '@'");
|
|
8192
8192
|
return;
|
|
8193
8193
|
}
|
|
8194
8194
|
if (i) {
|
|
8195
8195
|
const R = [...a, { key: i, value: d }];
|
|
8196
|
-
r(R), l(a), c(""),
|
|
8196
|
+
r(R), l(a), c(""), u(""), x("");
|
|
8197
8197
|
}
|
|
8198
8198
|
}, k = (R) => {
|
|
8199
|
-
const A = a.filter((
|
|
8199
|
+
const A = a.filter((T, L) => L !== R);
|
|
8200
8200
|
r(A), l(A);
|
|
8201
|
-
},
|
|
8202
|
-
m(R), c(a[R].key),
|
|
8203
|
-
},
|
|
8201
|
+
}, v = (R) => {
|
|
8202
|
+
m(R), c(a[R].key), u(a[R].value);
|
|
8203
|
+
}, S = () => {
|
|
8204
8204
|
if (i.startsWith("@")) {
|
|
8205
|
-
|
|
8205
|
+
x("Attribute keys cannot start with '@'");
|
|
8206
8206
|
return;
|
|
8207
8207
|
}
|
|
8208
|
-
if (
|
|
8208
|
+
if (p !== null && i) {
|
|
8209
8209
|
const R = [...a];
|
|
8210
|
-
R[
|
|
8210
|
+
R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
|
|
8211
8211
|
}
|
|
8212
8212
|
}, B = (R) => {
|
|
8213
|
-
R.key === "Enter" && !R.shiftKey && (R.preventDefault(),
|
|
8213
|
+
R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? S() : b());
|
|
8214
8214
|
};
|
|
8215
8215
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
8216
8216
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8217
8217
|
"form",
|
|
8218
8218
|
{
|
|
8219
8219
|
onSubmit: (R) => {
|
|
8220
|
-
R.preventDefault(),
|
|
8220
|
+
R.preventDefault(), p !== null ? S() : b();
|
|
8221
8221
|
},
|
|
8222
8222
|
className: "space-y-3",
|
|
8223
8223
|
children: [
|
|
@@ -8231,7 +8231,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8231
8231
|
autoCorrect: "off",
|
|
8232
8232
|
spellCheck: "false",
|
|
8233
8233
|
id: "attrKey",
|
|
8234
|
-
ref:
|
|
8234
|
+
ref: j,
|
|
8235
8235
|
value: i,
|
|
8236
8236
|
onChange: (R) => c(R.target.value),
|
|
8237
8237
|
placeholder: "Key",
|
|
@@ -8249,9 +8249,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8249
8249
|
spellCheck: "false",
|
|
8250
8250
|
id: "attrValue",
|
|
8251
8251
|
rows: 2,
|
|
8252
|
-
ref:
|
|
8252
|
+
ref: E,
|
|
8253
8253
|
value: d,
|
|
8254
|
-
onChange: (R) =>
|
|
8254
|
+
onChange: (R) => u(R.target.value),
|
|
8255
8255
|
onKeyDown: B,
|
|
8256
8256
|
placeholder: "Value",
|
|
8257
8257
|
className: "bg-background text-sm"
|
|
@@ -8259,8 +8259,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8259
8259
|
)
|
|
8260
8260
|
] })
|
|
8261
8261
|
] }),
|
|
8262
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children:
|
|
8263
|
-
|
|
8262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
|
|
8263
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
|
|
8264
8264
|
]
|
|
8265
8265
|
}
|
|
8266
8266
|
),
|
|
@@ -8270,7 +8270,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8270
8270
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
|
|
8271
8271
|
] }),
|
|
8272
8272
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
8273
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8273
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
|
|
8274
8274
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
8275
8275
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
8276
8276
|
] }),
|
|
@@ -8284,15 +8284,15 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8284
8284
|
}), BlockAttributesEditor = React.memo(() => {
|
|
8285
8285
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
8286
8286
|
React.useEffect(() => {
|
|
8287
|
-
const d = map(get(o, i), (
|
|
8287
|
+
const d = map(get(o, i), (u, p) => ({ key: p, value: u }));
|
|
8288
8288
|
isEmpty(d) ? r([]) : r(d);
|
|
8289
8289
|
}, [get(o, i)]);
|
|
8290
8290
|
const c = React.useCallback(
|
|
8291
8291
|
(d = []) => {
|
|
8292
|
-
const
|
|
8293
|
-
forEach(d, (
|
|
8294
|
-
isEmpty(
|
|
8295
|
-
}), l([get(o, "_id")], { [i]:
|
|
8292
|
+
const u = {};
|
|
8293
|
+
forEach(d, (p) => {
|
|
8294
|
+
isEmpty(p.key) || set(u, p.key, p.value);
|
|
8295
|
+
}), l([get(o, "_id")], { [i]: u });
|
|
8296
8296
|
},
|
|
8297
8297
|
[o, l, i]
|
|
8298
8298
|
);
|
|
@@ -8418,7 +8418,7 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8418
8418
|
] });
|
|
8419
8419
|
}, Breakpoints = () => {
|
|
8420
8420
|
const [, o, n] = useCanvasWidth(), [r, a] = useSelectedBreakpoints(), { t: l } = useTranslation(), i = useBuilderProp("breakpoints", WEB_BREAKPOINTS), c = (d) => {
|
|
8421
|
-
r.includes(d) ? r.length > 2 && a(r.filter((
|
|
8421
|
+
r.includes(d) ? r.length > 2 && a(r.filter((u) => u !== d)) : a((u) => [...u, d]);
|
|
8422
8422
|
};
|
|
8423
8423
|
return i.length < 4 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center rounded-md", children: map(i, (d) => /* @__PURE__ */ createElement(BreakpointCard, { ...d, onClick: n, key: d.breakpoint, currentBreakpoint: o })) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md", children: [
|
|
8424
8424
|
map(
|
|
@@ -8464,43 +8464,6 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8464
8464
|
] })
|
|
8465
8465
|
] })
|
|
8466
8466
|
] }) });
|
|
8467
|
-
}, LanguageSelector = () => {
|
|
8468
|
-
const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
|
|
8469
|
-
const c = [];
|
|
8470
|
-
return forEach(uniq([o, ...n]), (d) => {
|
|
8471
|
-
const p = get(LANGUAGES, d);
|
|
8472
|
-
p && c.push({ key: d, value: p, default: d === o });
|
|
8473
|
-
}), c;
|
|
8474
|
-
}, [o, n]);
|
|
8475
|
-
return isEmpty(n) && l === "en" ? null : isEmpty(n) && l !== "en" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600", children: [
|
|
8476
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(FaLanguage, { className: "h-4 w-4" }),
|
|
8477
|
-
get(LANGUAGES, l)
|
|
8478
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
8479
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
|
|
8480
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(FaLanguage, { className: "h-4 w-4" }),
|
|
8481
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
8482
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8483
|
-
" ",
|
|
8484
|
-
get(LANGUAGES, l)
|
|
8485
|
-
] }),
|
|
8486
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon, { className: "h-4 w-4" })
|
|
8487
|
-
] })
|
|
8488
|
-
] }) }),
|
|
8489
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { className: "border-border", children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8490
|
-
DropdownMenuItem,
|
|
8491
|
-
{
|
|
8492
|
-
className: cn(
|
|
8493
|
-
"flex cursor-pointer items-center text-sm",
|
|
8494
|
-
c.key === l && "!bg-blue-500 text-white hover:!text-white"
|
|
8495
|
-
),
|
|
8496
|
-
onClick: () => a(c.key),
|
|
8497
|
-
children: [
|
|
8498
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c.value }),
|
|
8499
|
-
c.key === o ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaStar, { className: "ml-2 h-4 w-4 text-yellow-400" }) : null
|
|
8500
|
-
]
|
|
8501
|
-
}
|
|
8502
|
-
)) })
|
|
8503
|
-
] });
|
|
8504
8467
|
}, CanvasTopBar = () => {
|
|
8505
8468
|
const o = useBuilderProp("darkMode", !0), [n] = useCanvasZoom();
|
|
8506
8469
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2", children: [
|
|
@@ -8522,10 +8485,7 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8522
8485
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { orientation: "vertical" }),
|
|
8523
8486
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UndoRedo, {})
|
|
8524
8487
|
] }),
|
|
8525
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8526
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(LanguageSelector, {}),
|
|
8527
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {})
|
|
8528
|
-
] })
|
|
8488
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center space-x-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {}) })
|
|
8529
8489
|
] });
|
|
8530
8490
|
};
|
|
8531
8491
|
function BlockAttributesToggle() {
|
|
@@ -8736,16 +8696,16 @@ function RemoveProviderConfirmation({
|
|
|
8736
8696
|
}
|
|
8737
8697
|
const PageDataProviders = () => {
|
|
8738
8698
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8739
|
-
filter(n, (
|
|
8740
|
-
), [d,
|
|
8741
|
-
n.map((
|
|
8742
|
-
(
|
|
8743
|
-
),
|
|
8744
|
-
const k = find(n, { providerKey:
|
|
8745
|
-
c((
|
|
8746
|
-
},
|
|
8747
|
-
c((k) => filter(k, (
|
|
8748
|
-
},
|
|
8699
|
+
filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
|
|
8700
|
+
), [d, u] = useState(""), [p, m] = useState(null), g = filter(
|
|
8701
|
+
n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
|
|
8702
|
+
(b) => !isNull(b)
|
|
8703
|
+
), x = (b) => {
|
|
8704
|
+
const k = find(n, { providerKey: b });
|
|
8705
|
+
c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8706
|
+
}, j = (b) => {
|
|
8707
|
+
c((k) => filter(k, (v) => v.providerKey !== b.providerKey)), a((k) => filter(k, (v) => v.providerKey !== b.providerKey)), l("UNSAVED");
|
|
8708
|
+
}, E = (b) => m(b);
|
|
8749
8709
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8750
8710
|
o("no_data_providers"),
|
|
8751
8711
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8753,11 +8713,11 @@ const PageDataProviders = () => {
|
|
|
8753
8713
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8754
8714
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8755
8715
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8756
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (
|
|
8716
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (b) => x(b), children: [
|
|
8757
8717
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8758
8718
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8759
8719
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
8760
|
-
|
|
8720
|
+
g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
|
|
8761
8721
|
] })
|
|
8762
8722
|
] }) }),
|
|
8763
8723
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8766,21 +8726,21 @@ const PageDataProviders = () => {
|
|
|
8766
8726
|
o("page_data_providers"),
|
|
8767
8727
|
":"
|
|
8768
8728
|
] }),
|
|
8769
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((
|
|
8729
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8770
8730
|
"div",
|
|
8771
8731
|
{
|
|
8772
8732
|
className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
|
|
8773
8733
|
"data-v0-t": "card",
|
|
8774
8734
|
children: [
|
|
8775
8735
|
/* @__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: [
|
|
8776
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children:
|
|
8777
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children:
|
|
8736
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: b.name }),
|
|
8737
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: b.description })
|
|
8778
8738
|
] }) }) }),
|
|
8779
8739
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
8780
8740
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8781
8741
|
"button",
|
|
8782
8742
|
{
|
|
8783
|
-
onClick: () => b
|
|
8743
|
+
onClick: () => E(b),
|
|
8784
8744
|
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",
|
|
8785
8745
|
children: [
|
|
8786
8746
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8806,7 +8766,7 @@ const PageDataProviders = () => {
|
|
|
8806
8766
|
]
|
|
8807
8767
|
}
|
|
8808
8768
|
),
|
|
8809
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () =>
|
|
8769
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => j(b), name: b.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: [
|
|
8810
8770
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8811
8771
|
"svg",
|
|
8812
8772
|
{
|
|
@@ -8832,16 +8792,16 @@ const PageDataProviders = () => {
|
|
|
8832
8792
|
] })
|
|
8833
8793
|
]
|
|
8834
8794
|
},
|
|
8835
|
-
|
|
8795
|
+
b.providerKey
|
|
8836
8796
|
)) }),
|
|
8837
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider:
|
|
8797
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
|
|
8838
8798
|
] })
|
|
8839
8799
|
] });
|
|
8840
8800
|
};
|
|
8841
8801
|
function AiFillDatabase(o) {
|
|
8842
8802
|
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);
|
|
8843
8803
|
}
|
|
8844
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8804
|
+
const TopBar = lazy(() => import("./Topbar-_edNTuUL.js"));
|
|
8845
8805
|
function useSidebarMenuItems(o) {
|
|
8846
8806
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8847
8807
|
return useMemo(() => {
|
|
@@ -8868,15 +8828,15 @@ function isDualLayout(o) {
|
|
|
8868
8828
|
}
|
|
8869
8829
|
const RootLayout = () => {
|
|
8870
8830
|
const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
|
|
8871
|
-
useChaiBuilderMsgListener(({ name:
|
|
8872
|
-
|
|
8831
|
+
useChaiBuilderMsgListener(({ name: x }) => {
|
|
8832
|
+
x === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
|
|
8873
8833
|
});
|
|
8874
|
-
const i = useBuilderProp("sideBarComponents.top", []), c = (
|
|
8875
|
-
|
|
8876
|
-
}, d = (
|
|
8877
|
-
n(o ===
|
|
8878
|
-
},
|
|
8879
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir:
|
|
8834
|
+
const i = useBuilderProp("sideBarComponents.top", []), c = (x) => {
|
|
8835
|
+
x.preventDefault();
|
|
8836
|
+
}, d = (x) => {
|
|
8837
|
+
n(o === x ? null : x);
|
|
8838
|
+
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
|
|
8839
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8880
8840
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8881
8841
|
"div",
|
|
8882
8842
|
{
|
|
@@ -8886,23 +8846,23 @@ const RootLayout = () => {
|
|
|
8886
8846
|
/* @__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, {}) }) }),
|
|
8887
8847
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8888
8848
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8889
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((
|
|
8849
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8890
8850
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8891
8851
|
Button,
|
|
8892
8852
|
{
|
|
8893
|
-
variant: o ===
|
|
8853
|
+
variant: o === j ? "default" : "ghost",
|
|
8894
8854
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8895
|
-
onClick: () => d(
|
|
8896
|
-
children: get(
|
|
8855
|
+
onClick: () => d(j),
|
|
8856
|
+
children: get(x, "icon", null)
|
|
8897
8857
|
},
|
|
8898
|
-
|
|
8858
|
+
j
|
|
8899
8859
|
) }),
|
|
8900
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
8901
|
-
] }, "button" +
|
|
8860
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(x.label) }) })
|
|
8861
|
+
] }, "button" + j)) }),
|
|
8902
8862
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
|
|
8903
8863
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8904
8864
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
|
|
8905
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
8865
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p("Choose Builder Layout") }) })
|
|
8906
8866
|
] }),
|
|
8907
8867
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HotKeys, {})
|
|
8908
8868
|
] })
|
|
@@ -8917,7 +8877,7 @@ const RootLayout = () => {
|
|
|
8917
8877
|
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: [
|
|
8918
8878
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8919
8879
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
8920
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children:
|
|
8880
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
|
|
8921
8881
|
] }),
|
|
8922
8882
|
/* @__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), {}) }) })
|
|
8923
8883
|
] }) })
|
|
@@ -8937,7 +8897,7 @@ const RootLayout = () => {
|
|
|
8937
8897
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-col p-3", children: [
|
|
8938
8898
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8939
8899
|
/* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
|
|
8940
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children:
|
|
8900
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
|
|
8941
8901
|
] }),
|
|
8942
8902
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
|
|
8943
8903
|
] }) })
|
|
@@ -9025,69 +8985,72 @@ const RootLayout = () => {
|
|
|
9025
8985
|
] }) }) });
|
|
9026
8986
|
};
|
|
9027
8987
|
export {
|
|
9028
|
-
|
|
8988
|
+
usePasteBlocks as $,
|
|
9029
8989
|
AddBlocksPanel$1 as A,
|
|
9030
8990
|
BlockSettings as B,
|
|
9031
8991
|
ChaiSelect$1 as C,
|
|
9032
8992
|
DefaultChaiBlocks as D,
|
|
9033
|
-
|
|
8993
|
+
useGlobalBlocksStore as E,
|
|
9034
8994
|
FaCheck as F,
|
|
9035
|
-
|
|
9036
|
-
|
|
8995
|
+
useBlocksStore as G,
|
|
8996
|
+
useUndoManager as H,
|
|
9037
8997
|
ImportHTML$1 as I,
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
8998
|
+
useBuilderReset as J,
|
|
8999
|
+
useAddBlock as K,
|
|
9000
|
+
LANGUAGES as L,
|
|
9001
|
+
useAddClassesToBlocks as M,
|
|
9002
|
+
useCanvasWidth as N,
|
|
9043
9003
|
Outline$1 as O,
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9004
|
+
useCanvasZoom as P,
|
|
9005
|
+
useCopyBlockIds as Q,
|
|
9006
|
+
useCopyToClipboard as R,
|
|
9007
|
+
useCurrentPage as S,
|
|
9048
9008
|
ThemeOptions as T,
|
|
9049
9009
|
UILibraries as U,
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9010
|
+
useCutBlockIds as V,
|
|
9011
|
+
useDarkMode as W,
|
|
9012
|
+
useDuplicateBlocks as X,
|
|
9013
|
+
useHiddenBlockIds as Y,
|
|
9014
|
+
useHighlightBlockId as Z,
|
|
9015
|
+
useBlockHighlight as _,
|
|
9056
9016
|
useSelectedBlockIds as a,
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9017
|
+
useBrandingOptions as a0,
|
|
9018
|
+
useRemoveBlocks as a1,
|
|
9019
|
+
useRemoveClassesFromBlocks as a2,
|
|
9020
|
+
useSelectedBlockCurrentClasses as a3,
|
|
9021
|
+
useSelectedBlockAllClasses as a4,
|
|
9022
|
+
useSelectedBlock as a5,
|
|
9023
|
+
useStylingBreakpoint as a6,
|
|
9024
|
+
useUILibraryBlocks as a7,
|
|
9025
|
+
useStylingState as a8,
|
|
9026
|
+
useSelectedBlocksDisplayChild as a9,
|
|
9027
|
+
useSelectedBreakpoints as aa,
|
|
9028
|
+
useSelectedStylingBlocks as ab,
|
|
9029
|
+
useLayoutVariant as ac,
|
|
9030
|
+
useBlocksStoreUndoableActions as ad,
|
|
9068
9031
|
useUpdateBlocksProps as b,
|
|
9069
9032
|
useUpdateBlocksPropsRealtime as c,
|
|
9070
9033
|
useBuilderProp as d,
|
|
9071
9034
|
useSavePage as e,
|
|
9072
9035
|
usePreviewMode as f,
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9036
|
+
useLanguages as g,
|
|
9037
|
+
FaLanguage as h,
|
|
9038
|
+
FaStar as i,
|
|
9039
|
+
CanvasArea$1 as j,
|
|
9040
|
+
BlockStyling as k,
|
|
9041
|
+
AddBlocksDialog as l,
|
|
9042
|
+
emitChaiBuilderMsg as m,
|
|
9043
|
+
useChaiBuilderMsgListener as n,
|
|
9044
|
+
CHAI_BUILDER_EVENTS as o,
|
|
9045
|
+
AISetContext as p,
|
|
9046
|
+
AIUserPrompt as q,
|
|
9047
|
+
BlockAttributesEditor as r,
|
|
9048
|
+
ChaiBuilderEditor as s,
|
|
9049
|
+
DarkMode as t,
|
|
9087
9050
|
useCodeEditor as u,
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9051
|
+
Breakpoints as v,
|
|
9052
|
+
UndoRedo as w,
|
|
9053
|
+
getClassValueAndUnit as x,
|
|
9054
|
+
getBlocksFromHTML as y,
|
|
9055
|
+
useGlobalBlocksList as z
|
|
9093
9056
|
};
|