@chaibuilder/sdk 1.2.100 → 1.2.102
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-4u3Q97EK.js → CodeEditor-7Q9lFDq1.js} +1 -1
- package/dist/{CodeEditor-arptm_-Q.cjs → CodeEditor-Z9tCJ_hE.cjs} +1 -1
- package/dist/{Topbar-i55trLGw.js → Topbar-Uk6diO3g.js} +1 -1
- package/dist/{Topbar-ziTrNsmI.cjs → Topbar-vTIW51su.cjs} +1 -1
- package/dist/{UnsplashImages-y0LQATX2.js → UnsplashImages-EGgHjvre.js} +1 -1
- package/dist/{UnsplashImages-9-OD1Sje.cjs → UnsplashImages-jaKmRyo0.cjs} +1 -1
- package/dist/{UploadImages-Nbpt6WL2.js → UploadImages-D43sz4A8.js} +1 -1
- package/dist/{UploadImages--tvMDTKi.cjs → UploadImages-G6OulTS8.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +21 -0
- package/dist/core.js +32 -31
- package/dist/index-Mj5uWCca.cjs +63 -0
- package/dist/{index-jfezM1fH.js → index-bdrCoYdD.js} +890 -621
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -1
- package/dist/render.js +118 -107
- package/package.json +1 -3
- package/dist/index-EyRQyWtP.cjs +0 -61
|
@@ -5,7 +5,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
7
|
import { a as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, P as Tooltip, Q as TooltipTrigger, R as TooltipContent, C as Card, z as CardHeader, G as CardDescription, H as CardContent, L as Label, T as Textarea, E as CardFooter, D as Dialog, t as DialogTrigger, u as DialogContent, v as DialogHeader, x as DialogTitle, y as DialogDescription, w as DialogFooter, W as Popover, X as PopoverTrigger, Y as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, K as Tabs, M as TabsList, N as TabsTrigger, O as TabsContent, d as Switch, A as Accordion, f as AccordionItem, g as AccordionTrigger, h as AccordionContent, ao as useToast, I as Input$1, V as TooltipPortal, a8 as DropdownMenu, a9 as DropdownMenuTrigger, aa as DropdownMenuContent, S as ScrollArea, ae as DropdownMenuLabel, af as DropdownMenuSeparator, ah as DropdownMenuGroup, ab as DropdownMenuItem, ag as DropdownMenuShortcut, k as AlertDialog, m as AlertDialogContent, n as AlertDialogHeader, p as AlertDialogTitle, l as AlertDialogTrigger, q as AlertDialogDescription, o as AlertDialogFooter, s as AlertDialogCancel, r as AlertDialogAction, ac as DropdownMenuCheckboxItem, Z as HoverCard, _ as HoverCardTrigger, $ as HoverCardContent, b as Separator, i as Badge, a0 as Select, a3 as SelectTrigger, a2 as SelectValue, a4 as SelectContent, a6 as SelectItem, U as TooltipProvider, aq as Toaster } from "./context-menu-YGd09SE1.js";
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy,
|
|
8
|
+
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
|
|
9
9
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
10
10
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
|
|
11
11
|
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
@@ -19,7 +19,7 @@ import { useFeature, FlagsProvider } from "flagged";
|
|
|
19
19
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
20
20
|
import { flip } from "@floating-ui/dom";
|
|
21
21
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
22
|
-
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
22
|
+
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, GlobeIcon as GlobeIcon$1, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
23
23
|
import { createEvent } from "react-event-hook";
|
|
24
24
|
import typography$1 from "@tailwindcss/typography";
|
|
25
25
|
import forms from "@tailwindcss/forms";
|
|
@@ -90,101 +90,101 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
90
90
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
91
91
|
let a, l, i;
|
|
92
92
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
93
|
-
const c = (b) => o.get(b), d = (b,
|
|
94
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
95
|
-
const
|
|
96
|
-
if (o.set(b,
|
|
97
|
-
const
|
|
98
|
-
cancelPromise(
|
|
93
|
+
const c = (b) => o.get(b), d = (b, k) => {
|
|
94
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
|
|
95
|
+
const C = o.get(b);
|
|
96
|
+
if (o.set(b, k), r.has(b) || r.set(b, C), C && hasPromiseAtomValue(C)) {
|
|
97
|
+
const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
|
|
98
|
+
cancelPromise(C.v, R);
|
|
99
99
|
}
|
|
100
|
-
}, u = (b,
|
|
101
|
-
const
|
|
100
|
+
}, u = (b, k, C) => {
|
|
101
|
+
const R = /* @__PURE__ */ new Map();
|
|
102
102
|
let I = !1;
|
|
103
|
-
|
|
104
|
-
!L && P === b && (L =
|
|
105
|
-
}), (I ||
|
|
106
|
-
}, p = (b,
|
|
107
|
-
const
|
|
108
|
-
d: (
|
|
109
|
-
v:
|
|
103
|
+
C.forEach((L, P) => {
|
|
104
|
+
!L && P === b && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
105
|
+
}), (I || k.d.size !== R.size) && (k.d = R);
|
|
106
|
+
}, p = (b, k, C) => {
|
|
107
|
+
const R = c(b), I = {
|
|
108
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
109
|
+
v: k
|
|
110
110
|
};
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
113
|
-
if (
|
|
114
|
-
if (
|
|
115
|
-
return
|
|
116
|
-
I.v =
|
|
111
|
+
if (C && u(b, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
|
|
112
|
+
return R;
|
|
113
|
+
if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
|
|
114
|
+
if (R.d === I.d)
|
|
115
|
+
return R;
|
|
116
|
+
I.v = R.v;
|
|
117
117
|
}
|
|
118
118
|
return d(b, I), I;
|
|
119
|
-
}, g = (b,
|
|
120
|
-
if (isPromiseLike$2(
|
|
119
|
+
}, g = (b, k, C, R) => {
|
|
120
|
+
if (isPromiseLike$2(k)) {
|
|
121
121
|
let I;
|
|
122
122
|
const L = new Promise((P, V) => {
|
|
123
|
-
let
|
|
124
|
-
|
|
123
|
+
let M = !1;
|
|
124
|
+
k.then(
|
|
125
125
|
(O) => {
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
const
|
|
126
|
+
if (!M) {
|
|
127
|
+
M = !0;
|
|
128
|
+
const $ = c(b), H = p(
|
|
129
129
|
b,
|
|
130
130
|
L,
|
|
131
|
-
|
|
131
|
+
C
|
|
132
132
|
);
|
|
133
|
-
resolvePromise(L, O), P(O), (
|
|
133
|
+
resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
(O) => {
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
const
|
|
137
|
+
if (!M) {
|
|
138
|
+
M = !0;
|
|
139
|
+
const $ = c(b), H = p(
|
|
140
140
|
b,
|
|
141
141
|
L,
|
|
142
|
-
|
|
142
|
+
C
|
|
143
143
|
);
|
|
144
|
-
rejectPromise(L, O), V(O), (
|
|
144
|
+
rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
), I = (O) => {
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
(
|
|
148
|
+
M || (M = !0, O.then(
|
|
149
|
+
($) => resolvePromise(L, $),
|
|
150
|
+
($) => rejectPromise(L, $)
|
|
151
151
|
), P(O));
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
|
-
return L.orig =
|
|
155
|
-
P && I(P),
|
|
156
|
-
}), p(b, L,
|
|
154
|
+
return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
|
|
155
|
+
P && I(P), R == null || R();
|
|
156
|
+
}), p(b, L, C);
|
|
157
157
|
}
|
|
158
|
-
return p(b,
|
|
159
|
-
}, x = (b,
|
|
160
|
-
const
|
|
161
|
-
d: (
|
|
162
|
-
e:
|
|
158
|
+
return p(b, k, C);
|
|
159
|
+
}, x = (b, k, C) => {
|
|
160
|
+
const R = c(b), I = {
|
|
161
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
162
|
+
e: k
|
|
163
163
|
};
|
|
164
|
-
return
|
|
164
|
+
return C && u(b, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(b, I), I);
|
|
165
165
|
}, m = (b) => {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
166
|
+
const k = c(b);
|
|
167
|
+
if (k && (k.d.forEach((M, O) => {
|
|
168
168
|
O !== b && !n.has(O) && m(O);
|
|
169
|
-
}), Array.from(
|
|
170
|
-
const
|
|
171
|
-
return
|
|
172
|
-
|
|
169
|
+
}), Array.from(k.d).every(([M, O]) => {
|
|
170
|
+
const $ = c(M);
|
|
171
|
+
return M === b || $ === O || // TODO This is a hack, we should find a better solution.
|
|
172
|
+
$ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
|
|
173
173
|
})))
|
|
174
|
-
return
|
|
175
|
-
const
|
|
176
|
-
let
|
|
177
|
-
const I = (
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
if (hasInitialValue(
|
|
183
|
-
return
|
|
174
|
+
return k;
|
|
175
|
+
const C = /* @__PURE__ */ new Map();
|
|
176
|
+
let R = !0;
|
|
177
|
+
const I = (M) => {
|
|
178
|
+
if (M === b) {
|
|
179
|
+
const $ = c(M);
|
|
180
|
+
if ($)
|
|
181
|
+
return C.set(M, $), returnAtomValue($);
|
|
182
|
+
if (hasInitialValue(M))
|
|
183
|
+
return C.set(M, void 0), M.init;
|
|
184
184
|
throw new Error("no atom init");
|
|
185
185
|
}
|
|
186
|
-
const O = m(
|
|
187
|
-
return
|
|
186
|
+
const O = m(M);
|
|
187
|
+
return C.set(M, O), returnAtomValue(O);
|
|
188
188
|
};
|
|
189
189
|
let L, P;
|
|
190
190
|
const V = {
|
|
@@ -192,147 +192,147 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
192
192
|
return L || (L = new AbortController()), L.signal;
|
|
193
193
|
},
|
|
194
194
|
get setSelf() {
|
|
195
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (
|
|
196
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
197
|
-
return B(b,
|
|
195
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...M) => {
|
|
196
|
+
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
|
|
197
|
+
return B(b, ...M);
|
|
198
198
|
}), P;
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
try {
|
|
202
|
-
const
|
|
202
|
+
const M = b.read(I, V);
|
|
203
203
|
return g(
|
|
204
204
|
b,
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
M,
|
|
206
|
+
C,
|
|
207
207
|
() => L == null ? void 0 : L.abort()
|
|
208
208
|
);
|
|
209
|
-
} catch (
|
|
210
|
-
return x(b,
|
|
209
|
+
} catch (M) {
|
|
210
|
+
return x(b, M, C);
|
|
211
211
|
} finally {
|
|
212
|
-
|
|
212
|
+
R = !1;
|
|
213
213
|
}
|
|
214
|
-
}, E = (b) => returnAtomValue(m(b)),
|
|
215
|
-
let
|
|
216
|
-
return
|
|
217
|
-
},
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
},
|
|
221
|
-
const
|
|
214
|
+
}, E = (b) => returnAtomValue(m(b)), j = (b) => {
|
|
215
|
+
let k = n.get(b);
|
|
216
|
+
return k || (k = w(b)), k;
|
|
217
|
+
}, f = (b, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(b)), _ = (b) => {
|
|
218
|
+
const k = n.get(b);
|
|
219
|
+
k && f(b, k) && A(b);
|
|
220
|
+
}, v = (b) => {
|
|
221
|
+
const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
|
|
222
222
|
const P = n.get(L);
|
|
223
223
|
P == null || P.t.forEach((V) => {
|
|
224
|
-
V !== L && (
|
|
224
|
+
V !== L && (k.set(
|
|
225
225
|
V,
|
|
226
|
-
(
|
|
227
|
-
),
|
|
226
|
+
(k.get(V) || /* @__PURE__ */ new Set()).add(L)
|
|
227
|
+
), C.set(V, (C.get(V) || 0) + 1), R(V));
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
|
|
230
|
+
R(b);
|
|
231
231
|
const I = (L) => {
|
|
232
232
|
const P = n.get(L);
|
|
233
233
|
P == null || P.t.forEach((V) => {
|
|
234
|
-
var
|
|
234
|
+
var M;
|
|
235
235
|
if (V !== L) {
|
|
236
|
-
let O =
|
|
237
|
-
if (O &&
|
|
238
|
-
let
|
|
239
|
-
if (
|
|
236
|
+
let O = C.get(V);
|
|
237
|
+
if (O && C.set(V, --O), !O) {
|
|
238
|
+
let $ = !!((M = k.get(V)) != null && M.size);
|
|
239
|
+
if ($) {
|
|
240
240
|
const H = c(V), F = m(V);
|
|
241
|
-
|
|
241
|
+
$ = !H || !isEqualAtomValue(H, F);
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
$ || k.forEach((H) => H.delete(V));
|
|
244
244
|
}
|
|
245
245
|
I(V);
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
};
|
|
249
249
|
I(b);
|
|
250
|
-
}, S = (b, ...
|
|
251
|
-
let
|
|
252
|
-
const
|
|
253
|
-
let
|
|
250
|
+
}, S = (b, ...k) => {
|
|
251
|
+
let C = !0;
|
|
252
|
+
const R = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
|
|
253
|
+
let M;
|
|
254
254
|
if (P === b) {
|
|
255
255
|
if (!hasInitialValue(P))
|
|
256
256
|
throw new Error("atom not writable");
|
|
257
|
-
const O = c(P),
|
|
258
|
-
(!O || !isEqualAtomValue(O,
|
|
257
|
+
const O = c(P), $ = g(P, V[0]);
|
|
258
|
+
(!O || !isEqualAtomValue(O, $)) && v(P);
|
|
259
259
|
} else
|
|
260
|
-
|
|
261
|
-
if (!
|
|
260
|
+
M = S(P, ...V);
|
|
261
|
+
if (!C) {
|
|
262
262
|
const O = D();
|
|
263
263
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
264
|
-
(
|
|
264
|
+
($) => $({ type: "async-write", flushed: O })
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
|
-
return
|
|
268
|
-
}, L = b.write(
|
|
269
|
-
return
|
|
270
|
-
}, B = (b, ...
|
|
271
|
-
const
|
|
267
|
+
return M;
|
|
268
|
+
}, L = b.write(R, I, ...k);
|
|
269
|
+
return C = !1, L;
|
|
270
|
+
}, B = (b, ...k) => {
|
|
271
|
+
const C = S(b, ...k), R = D();
|
|
272
272
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
273
|
-
(I) => I({ type: "write", flushed:
|
|
274
|
-
),
|
|
275
|
-
},
|
|
276
|
-
const
|
|
277
|
-
t: new Set(
|
|
273
|
+
(I) => I({ type: "write", flushed: R })
|
|
274
|
+
), C;
|
|
275
|
+
}, w = (b, k) => {
|
|
276
|
+
const C = {
|
|
277
|
+
t: new Set(k && [k]),
|
|
278
278
|
l: /* @__PURE__ */ new Set()
|
|
279
279
|
};
|
|
280
|
-
if (n.set(b,
|
|
280
|
+
if (n.set(b, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), m(b).d.forEach((R, I) => {
|
|
281
281
|
const L = n.get(I);
|
|
282
|
-
L ? L.t.add(b) : I !== b &&
|
|
282
|
+
L ? L.t.add(b) : I !== b && w(I, b);
|
|
283
283
|
}), m(b), isActuallyWritableAtom(b) && b.onMount) {
|
|
284
|
-
const
|
|
285
|
-
|
|
284
|
+
const R = b.onMount((...I) => B(b, ...I));
|
|
285
|
+
R && (C.u = R);
|
|
286
286
|
}
|
|
287
|
-
return
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
287
|
+
return C;
|
|
288
|
+
}, A = (b) => {
|
|
289
|
+
var k;
|
|
290
|
+
const C = (k = n.get(b)) == null ? void 0 : k.u;
|
|
291
|
+
C && C(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
|
|
292
|
+
const R = c(b);
|
|
293
|
+
R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
|
|
294
294
|
if (L !== b) {
|
|
295
295
|
const P = n.get(L);
|
|
296
|
-
P && (P.t.delete(b),
|
|
296
|
+
P && (P.t.delete(b), f(L, P) && A(L));
|
|
297
297
|
}
|
|
298
298
|
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
|
|
299
|
-
}, N = (b,
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
|
|
299
|
+
}, N = (b, k, C) => {
|
|
300
|
+
const R = new Set(k.d.keys());
|
|
301
|
+
C == null || C.forEach((I, L) => {
|
|
302
|
+
if (R.has(L)) {
|
|
303
|
+
R.delete(L);
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
306
|
const P = n.get(L);
|
|
307
|
-
P && (P.t.delete(b),
|
|
308
|
-
}),
|
|
307
|
+
P && (P.t.delete(b), f(L, P) && A(L));
|
|
308
|
+
}), R.forEach((I) => {
|
|
309
309
|
const L = n.get(I);
|
|
310
|
-
L ? L.t.add(b) : n.has(b) &&
|
|
310
|
+
L ? L.t.add(b) : n.has(b) && w(I, b);
|
|
311
311
|
});
|
|
312
312
|
}, D = () => {
|
|
313
313
|
let b;
|
|
314
314
|
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
|
|
315
|
-
const
|
|
316
|
-
r.clear(),
|
|
317
|
-
const I = c(
|
|
315
|
+
const k = Array.from(r);
|
|
316
|
+
r.clear(), k.forEach(([C, R]) => {
|
|
317
|
+
const I = c(C);
|
|
318
318
|
if (I) {
|
|
319
|
-
I.d !== (
|
|
320
|
-
const L = n.get(
|
|
319
|
+
I.d !== (R == null ? void 0 : R.d) && N(C, I, R == null ? void 0 : R.d);
|
|
320
|
+
const L = n.get(C);
|
|
321
321
|
L && !// TODO This seems pretty hacky. Hope to fix it.
|
|
322
322
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
323
|
-
(
|
|
323
|
+
(R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(C));
|
|
324
324
|
} else
|
|
325
325
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
329
|
-
return a.forEach((
|
|
330
|
-
}, T = (b,
|
|
331
|
-
const
|
|
332
|
-
return I.add(
|
|
333
|
-
(L) => L({ type: "sub", flushed:
|
|
329
|
+
return a.forEach((k) => k("state")), b;
|
|
330
|
+
}, T = (b, k) => {
|
|
331
|
+
const C = j(b), R = D(), I = C.l;
|
|
332
|
+
return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
|
|
333
|
+
(L) => L({ type: "sub", flushed: R })
|
|
334
334
|
)), () => {
|
|
335
|
-
I.delete(
|
|
335
|
+
I.delete(k), _(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
|
|
336
336
|
};
|
|
337
337
|
};
|
|
338
338
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -340,7 +340,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
340
340
|
set: B,
|
|
341
341
|
sub: T,
|
|
342
342
|
// store dev methods (these are tentative and subject to change without notice)
|
|
343
|
-
dev_subscribe_store: (b,
|
|
343
|
+
dev_subscribe_store: (b, k) => k !== 2 ? (console.warn(
|
|
344
344
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
345
345
|
), a.add(b), () => {
|
|
346
346
|
a.delete(b);
|
|
@@ -351,11 +351,11 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
351
351
|
dev_get_atom_state: (b) => o.get(b),
|
|
352
352
|
dev_get_mounted: (b) => n.get(b),
|
|
353
353
|
dev_restore_atoms: (b) => {
|
|
354
|
-
for (const [
|
|
355
|
-
hasInitialValue(
|
|
356
|
-
const
|
|
354
|
+
for (const [C, R] of b)
|
|
355
|
+
hasInitialValue(C) && (g(C, R), v(C));
|
|
356
|
+
const k = D();
|
|
357
357
|
l.forEach(
|
|
358
|
-
(
|
|
358
|
+
(C) => C({ type: "restore", flushed: k })
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
361
|
} : {
|
|
@@ -380,34 +380,34 @@ function splitAtom(o, n) {
|
|
|
380
380
|
return u;
|
|
381
381
|
const p = d && r.get(d), g = [], x = [];
|
|
382
382
|
return c.forEach((m, E) => {
|
|
383
|
-
const
|
|
384
|
-
x[E] =
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
g[E] =
|
|
383
|
+
const j = n ? n(m) : E;
|
|
384
|
+
x[E] = j;
|
|
385
|
+
const f = p && p.atomList[p.keyList.indexOf(j)];
|
|
386
|
+
if (f) {
|
|
387
|
+
g[E] = f;
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
const
|
|
391
|
-
const B = S(l),
|
|
392
|
-
if (N < 0 || N >=
|
|
393
|
-
const D = c[a(c).keyList.indexOf(
|
|
390
|
+
const _ = (S) => {
|
|
391
|
+
const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(j);
|
|
392
|
+
if (N < 0 || N >= w.length) {
|
|
393
|
+
const D = c[a(c).keyList.indexOf(j)];
|
|
394
394
|
if (D)
|
|
395
395
|
return D;
|
|
396
396
|
throw new Error("splitAtom: index out of bounds for read");
|
|
397
397
|
}
|
|
398
|
-
return
|
|
399
|
-
},
|
|
400
|
-
const
|
|
398
|
+
return w[N];
|
|
399
|
+
}, v = (S, B, w) => {
|
|
400
|
+
const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(j);
|
|
401
401
|
if (T < 0 || T >= N.length)
|
|
402
402
|
throw new Error("splitAtom: index out of bounds for write");
|
|
403
|
-
const b = isFunction(
|
|
403
|
+
const b = isFunction(w) ? w(N[T]) : w;
|
|
404
404
|
B(o, [
|
|
405
405
|
...N.slice(0, T),
|
|
406
406
|
b,
|
|
407
407
|
...N.slice(T + 1)
|
|
408
408
|
]);
|
|
409
409
|
};
|
|
410
|
-
g[E] = isWritable(o) ? atom(
|
|
410
|
+
g[E] = isWritable(o) ? atom(_, v) : atom(_);
|
|
411
411
|
}), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, r.set(c, u), u;
|
|
412
412
|
}, l = atom((c) => {
|
|
413
413
|
const d = c(l), u = c(o);
|
|
@@ -1192,65 +1192,65 @@ const useBlocksStoreManager = () => {
|
|
|
1192
1192
|
updateBlocksProps: c
|
|
1193
1193
|
} = useBlocksStoreManager();
|
|
1194
1194
|
return {
|
|
1195
|
-
moveBlocks: (
|
|
1196
|
-
const
|
|
1197
|
-
const
|
|
1198
|
-
return { _id: B, oldParent:
|
|
1199
|
-
}), S =
|
|
1200
|
-
S && S.oldParent ===
|
|
1201
|
-
undo: () => each(
|
|
1202
|
-
i([B],
|
|
1195
|
+
moveBlocks: (j, f, _) => {
|
|
1196
|
+
const v = map(j, (B) => {
|
|
1197
|
+
const A = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => A ? T._parent === A : !T._parent).map((T) => T._id).indexOf(B);
|
|
1198
|
+
return { _id: B, oldParent: A, oldPosition: D };
|
|
1199
|
+
}), S = v.find(({ _id: B }) => B === j[0]);
|
|
1200
|
+
S && S.oldParent === f && S.oldPosition === _ || (i(j, f, _), o({
|
|
1201
|
+
undo: () => each(v, ({ _id: B, oldParent: w, oldPosition: A }) => {
|
|
1202
|
+
i([B], w, A);
|
|
1203
1203
|
}),
|
|
1204
|
-
redo: () => i(
|
|
1204
|
+
redo: () => i(j, f, _)
|
|
1205
1205
|
}));
|
|
1206
1206
|
},
|
|
1207
|
-
addBlocks: (
|
|
1208
|
-
a(
|
|
1209
|
-
undo: () => l(map(
|
|
1210
|
-
redo: () => a(
|
|
1207
|
+
addBlocks: (j, f, _) => {
|
|
1208
|
+
a(j, f, _), o({
|
|
1209
|
+
undo: () => l(map(j, "_id")),
|
|
1210
|
+
redo: () => a(j, f, _)
|
|
1211
1211
|
});
|
|
1212
1212
|
},
|
|
1213
|
-
removeBlocks: (
|
|
1213
|
+
removeBlocks: (j) => {
|
|
1214
1214
|
var S;
|
|
1215
|
-
const
|
|
1216
|
-
l(map(
|
|
1217
|
-
undo: () => a(
|
|
1218
|
-
redo: () => l(map(
|
|
1215
|
+
const f = (S = first(j)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(j));
|
|
1216
|
+
l(map(j, "_id")), o({
|
|
1217
|
+
undo: () => a(j, f, v),
|
|
1218
|
+
redo: () => l(map(j, "_id"))
|
|
1219
1219
|
});
|
|
1220
1220
|
},
|
|
1221
|
-
updateBlocks: (
|
|
1222
|
-
let
|
|
1223
|
-
if (
|
|
1224
|
-
|
|
1221
|
+
updateBlocks: (j, f, _) => {
|
|
1222
|
+
let v = [];
|
|
1223
|
+
if (_)
|
|
1224
|
+
v = map(j, (S) => ({ _id: S, ..._ }));
|
|
1225
1225
|
else {
|
|
1226
|
-
const S = keys(
|
|
1227
|
-
|
|
1228
|
-
const
|
|
1229
|
-
return each(S, (N) =>
|
|
1226
|
+
const S = keys(f);
|
|
1227
|
+
v = map(j, (B) => {
|
|
1228
|
+
const w = n.find((N) => N._id === B), A = { _id: B };
|
|
1229
|
+
return each(S, (N) => A[N] = w[N]), A;
|
|
1230
1230
|
});
|
|
1231
1231
|
}
|
|
1232
|
-
c(map(
|
|
1233
|
-
undo: () => c(
|
|
1234
|
-
redo: () => c(map(
|
|
1232
|
+
c(map(j, (S) => ({ _id: S, ...f }))), o({
|
|
1233
|
+
undo: () => c(v),
|
|
1234
|
+
redo: () => c(map(j, (S) => ({ _id: S, ...f })))
|
|
1235
1235
|
});
|
|
1236
1236
|
},
|
|
1237
|
-
updateBlocksRuntime: (
|
|
1238
|
-
c(map(
|
|
1237
|
+
updateBlocksRuntime: (j, f) => {
|
|
1238
|
+
c(map(j, (_) => ({ _id: _, ...f })));
|
|
1239
1239
|
},
|
|
1240
|
-
setNewBlocks: (
|
|
1241
|
-
r(
|
|
1240
|
+
setNewBlocks: (j) => {
|
|
1241
|
+
r(j), o({
|
|
1242
1242
|
undo: () => r(n),
|
|
1243
|
-
redo: () => r(
|
|
1243
|
+
redo: () => r(j)
|
|
1244
1244
|
});
|
|
1245
1245
|
},
|
|
1246
|
-
updateMultipleBlocksProps: (
|
|
1247
|
-
let
|
|
1248
|
-
|
|
1249
|
-
const
|
|
1250
|
-
return each(
|
|
1251
|
-
}), c(
|
|
1252
|
-
undo: () => c(
|
|
1253
|
-
redo: () => c(
|
|
1246
|
+
updateMultipleBlocksProps: (j) => {
|
|
1247
|
+
let f = [];
|
|
1248
|
+
f = map(j, (_) => {
|
|
1249
|
+
const v = keys(_), S = n.find((w) => w._id === _._id), B = {};
|
|
1250
|
+
return each(v, (w) => B[w] = S[w]), B;
|
|
1251
|
+
}), c(j), o({
|
|
1252
|
+
undo: () => c(f),
|
|
1253
|
+
redo: () => c(j)
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
};
|
|
@@ -1259,11 +1259,11 @@ const useBlocksStoreManager = () => {
|
|
|
1259
1259
|
(i, c, d) => {
|
|
1260
1260
|
var m;
|
|
1261
1261
|
for (let E = 0; E < i.length; E++) {
|
|
1262
|
-
const { _id:
|
|
1262
|
+
const { _id: j } = i[E];
|
|
1263
1263
|
i[E]._id = generateUUID();
|
|
1264
|
-
const
|
|
1265
|
-
for (let
|
|
1266
|
-
|
|
1264
|
+
const f = filter(i, { _parent: j });
|
|
1265
|
+
for (let _ = 0; _ < f.length; _++)
|
|
1266
|
+
f[_]._parent = i[E]._id;
|
|
1267
1267
|
}
|
|
1268
1268
|
const u = first(i);
|
|
1269
1269
|
let p, g;
|
|
@@ -1274,20 +1274,20 @@ const useBlocksStoreManager = () => {
|
|
|
1274
1274
|
return { addCoreBlock: useCallback(
|
|
1275
1275
|
(i, c, d) => {
|
|
1276
1276
|
if (has(i, "blocks")) {
|
|
1277
|
-
const
|
|
1278
|
-
return a(
|
|
1277
|
+
const _ = i.blocks;
|
|
1278
|
+
return a(_, c, d);
|
|
1279
1279
|
}
|
|
1280
1280
|
const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
|
|
1281
|
-
forIn(p, (
|
|
1282
|
-
if (startsWith(
|
|
1283
|
-
const S =
|
|
1281
|
+
forIn(p, (_, v) => {
|
|
1282
|
+
if (startsWith(_, SLOT_KEY)) {
|
|
1283
|
+
const S = _.replace(SLOT_KEY, "");
|
|
1284
1284
|
g.push({
|
|
1285
1285
|
_id: S,
|
|
1286
1286
|
_type: "Slot",
|
|
1287
1287
|
_parent: u,
|
|
1288
|
-
_name: i.props[
|
|
1289
|
-
_styles: i.props[
|
|
1290
|
-
_emptyStyles: i.props[
|
|
1288
|
+
_name: i.props[v].name,
|
|
1289
|
+
_styles: i.props[v].styles,
|
|
1290
|
+
_emptyStyles: i.props[v].emptyStyles
|
|
1291
1291
|
});
|
|
1292
1292
|
}
|
|
1293
1293
|
});
|
|
@@ -1298,8 +1298,8 @@ const useBlocksStoreManager = () => {
|
|
|
1298
1298
|
};
|
|
1299
1299
|
let m, E;
|
|
1300
1300
|
c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
|
|
1301
|
-
const
|
|
1302
|
-
return r(
|
|
1301
|
+
const f = [x, ...g];
|
|
1302
|
+
return r(f, E, d), n([x._id]), x;
|
|
1303
1303
|
},
|
|
1304
1304
|
[a, o, n]
|
|
1305
1305
|
), addPredefinedBlock: a };
|
|
@@ -2571,8 +2571,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2571
2571
|
return each(u, (x) => {
|
|
2572
2572
|
const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
|
|
2573
2573
|
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2574
|
-
const
|
|
2575
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2574
|
+
const j = first(x.split(":"));
|
|
2575
|
+
includes(["2xl", "xl", "lg", "md", "sm"], j) && u.push(x.split(":").pop().trim());
|
|
2576
2576
|
}), each(u, (x) => {
|
|
2577
2577
|
const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2578
2578
|
g = g.replace(m, " ").replace(/ +/g, " ").trim();
|
|
@@ -2628,13 +2628,37 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2628
2628
|
break;
|
|
2629
2629
|
}
|
|
2630
2630
|
return n;
|
|
2631
|
-
}, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom),
|
|
2632
|
-
|
|
2631
|
+
}, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom), languageAtom = atom$1("");
|
|
2632
|
+
languageAtom.debugLabel = "selectedLanguageAtom";
|
|
2633
|
+
const useLanguages = () => {
|
|
2634
|
+
const o = useBuilderProp("languages", []), n = useBuilderProp("fallbackLang", "en"), [r, a] = useAtom$1(languageAtom), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks();
|
|
2635
|
+
return {
|
|
2636
|
+
languages: o,
|
|
2637
|
+
fallbackLang: n,
|
|
2638
|
+
selectedLang: r,
|
|
2639
|
+
setSelectedLang: (u) => {
|
|
2640
|
+
r !== (n === u ? "" : u) && (l([]), i(null), c([]), a(n === u ? "" : u));
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
}, updatePropsForLanguage = memoize((o, n, r) => {
|
|
2644
|
+
const a = getBlockComponent(get(r, "_type"));
|
|
2645
|
+
if (!a)
|
|
2646
|
+
return o;
|
|
2647
|
+
const l = { ...o };
|
|
2648
|
+
return forEach(keys(o), (i) => {
|
|
2649
|
+
if (get(a, ["props", i, "i18n"]) && !isEmpty(n)) {
|
|
2650
|
+
const c = `${i}-${n}`;
|
|
2651
|
+
set(l, c, o[i]), unset(l, i);
|
|
2652
|
+
}
|
|
2653
|
+
}), l;
|
|
2654
|
+
}), useUpdateBlocksProps = () => {
|
|
2655
|
+
const { updateBlocks: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
|
|
2633
2656
|
return useCallback(
|
|
2634
|
-
(
|
|
2635
|
-
|
|
2657
|
+
(a, l, i) => {
|
|
2658
|
+
const c = updatePropsForLanguage(l, n, r);
|
|
2659
|
+
o(a, c, i);
|
|
2636
2660
|
},
|
|
2637
|
-
[o]
|
|
2661
|
+
[o, n]
|
|
2638
2662
|
);
|
|
2639
2663
|
}, useUpdateMultipleBlocksProps = () => {
|
|
2640
2664
|
const { updateMultipleBlocksProps: o } = useBlocksStoreUndoableActions();
|
|
@@ -2673,12 +2697,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2673
2697
|
[o]
|
|
2674
2698
|
);
|
|
2675
2699
|
}, useUpdateBlocksPropsRealtime = () => {
|
|
2676
|
-
const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions();
|
|
2700
|
+
const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
|
|
2677
2701
|
return useCallback(
|
|
2678
|
-
(
|
|
2679
|
-
|
|
2702
|
+
(a, l) => {
|
|
2703
|
+
const i = updatePropsForLanguage(l, n, r);
|
|
2704
|
+
o(a, i);
|
|
2680
2705
|
},
|
|
2681
|
-
[o]
|
|
2706
|
+
[o, n]
|
|
2682
2707
|
);
|
|
2683
2708
|
}, selectedBreakpointsAtom = atomWithStorage("selectedBreakpoints", ["XS", "MD", "XL"]), useSelectedBreakpoints = () => {
|
|
2684
2709
|
const [o, n] = useAtom$1(selectedBreakpointsAtom);
|
|
@@ -3034,26 +3059,26 @@ const useDnd = () => {
|
|
|
3034
3059
|
m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
|
|
3035
3060
|
},
|
|
3036
3061
|
onDrop: (m) => {
|
|
3037
|
-
var
|
|
3038
|
-
const E = dropTarget,
|
|
3039
|
-
dropIndex = calculateDropIndex(
|
|
3040
|
-
const
|
|
3041
|
-
if ((
|
|
3062
|
+
var w;
|
|
3063
|
+
const E = dropTarget, f = getOrientation(E) === "vertical" ? m.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : m.clientX;
|
|
3064
|
+
dropIndex = calculateDropIndex(f, possiblePositions);
|
|
3065
|
+
const _ = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3066
|
+
if ((_ == null ? void 0 : _._id) === v || !S) {
|
|
3042
3067
|
x();
|
|
3043
3068
|
return;
|
|
3044
3069
|
}
|
|
3045
|
-
if (!has(
|
|
3046
|
-
a(
|
|
3070
|
+
if (!has(_, "_id")) {
|
|
3071
|
+
a(_, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
|
|
3047
3072
|
return;
|
|
3048
3073
|
}
|
|
3049
3074
|
let B = E.getAttribute("data-block-id");
|
|
3050
|
-
B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([
|
|
3075
|
+
B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([_._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3051
3076
|
},
|
|
3052
3077
|
onDragEnter: (m) => {
|
|
3053
|
-
const E = m,
|
|
3054
|
-
dropTarget =
|
|
3055
|
-
const
|
|
3056
|
-
p(
|
|
3078
|
+
const E = m, j = E.target;
|
|
3079
|
+
dropTarget = j;
|
|
3080
|
+
const f = j.getAttribute("data-block-id"), _ = j.getAttribute("data-dnd-dragged") !== "yes";
|
|
3081
|
+
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(j), r(!0), l(""), i([]);
|
|
3057
3082
|
},
|
|
3058
3083
|
onDragLeave: (m) => {
|
|
3059
3084
|
m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
@@ -3065,7 +3090,7 @@ function getTargetedBlock(o) {
|
|
|
3065
3090
|
}
|
|
3066
3091
|
function destroyQuill(o) {
|
|
3067
3092
|
o.container.innerHTML = "", o.container.parentNode.removeChild(o.container);
|
|
3068
|
-
|
|
3093
|
+
const n = document.querySelector(".ql-toolbar");
|
|
3069
3094
|
n && n.parentNode.removeChild(n), o = null;
|
|
3070
3095
|
}
|
|
3071
3096
|
const useHandleCanvasDblClick = () => {
|
|
@@ -3105,7 +3130,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3105
3130
|
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
|
|
3106
3131
|
n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
|
|
3107
3132
|
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3108
|
-
|
|
3133
|
+
const u = d.getAttribute("data-block-id");
|
|
3109
3134
|
n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
3110
3135
|
}
|
|
3111
3136
|
a("");
|
|
@@ -3263,16 +3288,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3263
3288
|
useEffect(() => {
|
|
3264
3289
|
a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
|
|
3265
3290
|
}, [a, u]);
|
|
3266
|
-
const
|
|
3291
|
+
const j = get(n, "headingFont", "DM Sans"), f = get(n, "bodyFont", "DM Sans");
|
|
3267
3292
|
return useEffect(() => {
|
|
3268
|
-
const
|
|
3269
|
-
{ color:
|
|
3270
|
-
{ color:
|
|
3293
|
+
const _ = get(n, "primaryColor", "#000"), v = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
|
|
3294
|
+
{ color: _, name: "primary" },
|
|
3295
|
+
{ color: v, name: "secondary" }
|
|
3271
3296
|
]), D = {
|
|
3272
3297
|
"bg-light": S,
|
|
3273
3298
|
"bg-dark": B,
|
|
3274
|
-
"text-dark":
|
|
3275
|
-
"text-light":
|
|
3299
|
+
"text-dark": w,
|
|
3300
|
+
"text-light": A
|
|
3276
3301
|
}, T = get(n, "roundedCorners", "0");
|
|
3277
3302
|
!p || !p.tailwind || (p.tailwind.config = {
|
|
3278
3303
|
darkMode: "class",
|
|
@@ -3286,8 +3311,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3286
3311
|
}
|
|
3287
3312
|
},
|
|
3288
3313
|
fontFamily: {
|
|
3289
|
-
heading: [
|
|
3290
|
-
body: [
|
|
3314
|
+
heading: [j],
|
|
3315
|
+
body: [f]
|
|
3291
3316
|
},
|
|
3292
3317
|
borderRadius: {
|
|
3293
3318
|
DEFAULT: `${T || "0"}px`
|
|
@@ -3299,26 +3324,26 @@ const useHandleCanvasDblClick = () => {
|
|
|
3299
3324
|
typography$1,
|
|
3300
3325
|
forms,
|
|
3301
3326
|
aspectRatio,
|
|
3302
|
-
plugin(function({ addBase: b, theme:
|
|
3327
|
+
plugin(function({ addBase: b, theme: k }) {
|
|
3303
3328
|
b({
|
|
3304
3329
|
"h1,h2,h3,h4,h5,h6": {
|
|
3305
|
-
fontFamily:
|
|
3330
|
+
fontFamily: k("fontFamily.heading")
|
|
3306
3331
|
},
|
|
3307
3332
|
body: {
|
|
3308
|
-
fontFamily:
|
|
3309
|
-
color:
|
|
3310
|
-
backgroundColor:
|
|
3333
|
+
fontFamily: k("fontFamily.body"),
|
|
3334
|
+
color: k("colors.text-light"),
|
|
3335
|
+
backgroundColor: k("colors.bg-light")
|
|
3311
3336
|
},
|
|
3312
3337
|
".dark body": {
|
|
3313
|
-
color:
|
|
3314
|
-
backgroundColor:
|
|
3338
|
+
color: k("colors.text-dark"),
|
|
3339
|
+
backgroundColor: k("colors.bg-dark")
|
|
3315
3340
|
}
|
|
3316
3341
|
});
|
|
3317
3342
|
})
|
|
3318
3343
|
]
|
|
3319
3344
|
});
|
|
3320
|
-
}, [n, p,
|
|
3321
|
-
x && (x.textContent = `${map(r, (
|
|
3345
|
+
}, [n, p, j, f]), useEffect(() => {
|
|
3346
|
+
x && (x.textContent = `${map(r, (_) => `[data-block-id="${_}"]`).join(",")}{
|
|
3322
3347
|
outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3323
3348
|
}`);
|
|
3324
3349
|
}, [r, x]), useEffect(() => {
|
|
@@ -3326,16 +3351,16 @@ const useHandleCanvasDblClick = () => {
|
|
|
3326
3351
|
}, [c, E]), useEffect(() => {
|
|
3327
3352
|
g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3328
3353
|
}, [l, r, g]), useEffect(() => {
|
|
3329
|
-
m && (m.textContent = `${map(i, ({ id:
|
|
3354
|
+
m && (m.textContent = `${map(i, ({ id: _ }) => `[data-style-id="${_}"]`).join(",")}{
|
|
3330
3355
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3331
3356
|
}`);
|
|
3332
3357
|
}, [i, m]), useEffect(() => {
|
|
3333
3358
|
u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3334
|
-
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (
|
|
3359
|
+
}, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (j || f) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3335
3360
|
"link",
|
|
3336
3361
|
{
|
|
3337
3362
|
rel: "stylesheet",
|
|
3338
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3363
|
+
href: `https://fonts.googleapis.com/css2?family=${j ? `${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` : ""}${j && f && j !== f ? "&" : ""}${f && f !== j ? `family=${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
|
|
3339
3364
|
}
|
|
3340
3365
|
) });
|
|
3341
3366
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
@@ -3444,51 +3469,59 @@ function isDescendant(o, n, r) {
|
|
|
3444
3469
|
return l.some((i) => i._id === n) ? !0 : l.some((i) => isDescendant(i._id, n, r));
|
|
3445
3470
|
}
|
|
3446
3471
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
|
|
3472
|
+
function applyLanguage(o, n, r) {
|
|
3473
|
+
if (isEmpty(n))
|
|
3474
|
+
return o;
|
|
3475
|
+
const a = cloneDeep(o);
|
|
3476
|
+
return forEach(keys(a), (l) => {
|
|
3477
|
+
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(a, `${l}-${n}`, a[l]));
|
|
3478
|
+
}), a;
|
|
3479
|
+
}
|
|
3447
3480
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3448
|
-
const [
|
|
3449
|
-
(f) => f.reduce((
|
|
3450
|
-
const
|
|
3451
|
-
return { ...
|
|
3481
|
+
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: g } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [m] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
|
|
3482
|
+
(f) => f.reduce((_, v) => {
|
|
3483
|
+
const S = get(u, v, {});
|
|
3484
|
+
return { ..._, ...S };
|
|
3452
3485
|
}, {}),
|
|
3453
|
-
[
|
|
3486
|
+
[u]
|
|
3454
3487
|
);
|
|
3455
3488
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3456
|
-
o.map((f,
|
|
3457
|
-
if (
|
|
3489
|
+
o.map((f, _) => {
|
|
3490
|
+
if (E === f._id || p.includes(f._id))
|
|
3458
3491
|
return null;
|
|
3459
|
-
const
|
|
3460
|
-
if (
|
|
3461
|
-
const
|
|
3462
|
-
|
|
3492
|
+
const v = {}, S = filter(n, { _parent: f._id });
|
|
3493
|
+
if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, f._type === "GlobalBlock") {
|
|
3494
|
+
const C = g(f);
|
|
3495
|
+
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
|
|
3463
3496
|
}
|
|
3464
|
-
const
|
|
3465
|
-
if (isNull(
|
|
3497
|
+
const B = getBlockComponent(f._type), w = get(B, "server", !1), A = w ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3498
|
+
if (isNull(A))
|
|
3466
3499
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3467
|
-
const
|
|
3468
|
-
if (get(
|
|
3500
|
+
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = j(N), T = x(f);
|
|
3501
|
+
if (get(T, "__isHidden", !1) && !includes(a, f._id))
|
|
3469
3502
|
return null;
|
|
3470
|
-
const
|
|
3471
|
-
...includes(
|
|
3503
|
+
const b = i && isDescendant(i._id, f._id, n), k = {
|
|
3504
|
+
...includes(a, f._id) ? { "force-show": "" } : {},
|
|
3472
3505
|
"data-block-id": f._id,
|
|
3473
3506
|
"data-block-type": f._type,
|
|
3474
|
-
...
|
|
3507
|
+
...i ? (
|
|
3475
3508
|
// @ts-ignore
|
|
3476
3509
|
{
|
|
3477
|
-
"data-dnd": canAcceptChildBlock(f._type,
|
|
3478
|
-
"data-dnd-dragged":
|
|
3510
|
+
"data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3511
|
+
"data-dnd-dragged": i._id === f._id || b ? "yes" : "no"
|
|
3479
3512
|
}
|
|
3480
3513
|
) : {},
|
|
3481
|
-
...
|
|
3482
|
-
...includes(
|
|
3514
|
+
...c === f._id && !b ? { "data-drop": "yes" } : {},
|
|
3515
|
+
...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
|
|
3483
3516
|
};
|
|
3484
|
-
return
|
|
3485
|
-
blockProps:
|
|
3486
|
-
index:
|
|
3487
|
-
...applyBindings(f,
|
|
3488
|
-
...omit(
|
|
3489
|
-
...
|
|
3517
|
+
return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
|
|
3518
|
+
blockProps: k,
|
|
3519
|
+
index: _,
|
|
3520
|
+
...applyBindings(applyLanguage(f, r, B), m),
|
|
3521
|
+
...omit(T, ["__isHidden"]),
|
|
3522
|
+
...v,
|
|
3490
3523
|
inBuilder: !0,
|
|
3491
|
-
blockState:
|
|
3524
|
+
blockState: D
|
|
3492
3525
|
}) });
|
|
3493
3526
|
})
|
|
3494
3527
|
) });
|
|
@@ -3538,47 +3571,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3538
3571
|
n(i);
|
|
3539
3572
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3540
3573
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3541
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [
|
|
3542
|
-
u((N) => ({ ...N, width:
|
|
3574
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [j, f] = useSelectedStylingBlocks(), _ = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
|
|
3575
|
+
u((N) => ({ ...N, width: A }));
|
|
3543
3576
|
};
|
|
3544
3577
|
useEffect(() => {
|
|
3545
3578
|
if (!c.current)
|
|
3546
3579
|
return;
|
|
3547
|
-
const { clientWidth:
|
|
3548
|
-
u({ width:
|
|
3580
|
+
const { clientWidth: A, clientHeight: N } = c.current;
|
|
3581
|
+
u({ width: A, height: N });
|
|
3549
3582
|
}, [c, n]);
|
|
3550
|
-
const B = (
|
|
3551
|
-
const { top: D } =
|
|
3583
|
+
const B = (A, N = 0) => {
|
|
3584
|
+
const { top: D } = A.getBoundingClientRect();
|
|
3552
3585
|
return D + N >= 0 && D - N <= window.innerHeight;
|
|
3553
3586
|
};
|
|
3554
3587
|
useEffect(() => {
|
|
3555
|
-
var
|
|
3588
|
+
var A, N;
|
|
3556
3589
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3557
3590
|
const D = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3558
|
-
D && (B(D) || (N = (
|
|
3591
|
+
D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
|
|
3559
3592
|
}
|
|
3560
3593
|
}, [a]), useEffect(() => {
|
|
3561
|
-
if (!isEmpty(
|
|
3562
|
-
const
|
|
3594
|
+
if (!isEmpty(j) && i.current) {
|
|
3595
|
+
const A = getElementByStyleId(
|
|
3563
3596
|
i.current.contentDocument,
|
|
3564
|
-
first(
|
|
3597
|
+
first(j).id
|
|
3565
3598
|
);
|
|
3566
|
-
m(
|
|
3599
|
+
m(A ? [A] : [null]);
|
|
3567
3600
|
} else
|
|
3568
3601
|
m([null]);
|
|
3569
|
-
}, [
|
|
3570
|
-
const
|
|
3571
|
-
let
|
|
3572
|
-
return
|
|
3602
|
+
}, [j]);
|
|
3603
|
+
const w = useMemo(() => {
|
|
3604
|
+
let A = IframeInitialContent;
|
|
3605
|
+
return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
|
|
3573
3606
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3574
3607
|
"/offline/tailwind.cdn.js"
|
|
3575
|
-
),
|
|
3576
|
-
}, [o,
|
|
3608
|
+
), 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;
|
|
3609
|
+
}, [o, v]);
|
|
3577
3610
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3578
3611
|
"div",
|
|
3579
3612
|
{
|
|
3580
3613
|
onClick: () => {
|
|
3581
|
-
r([]),
|
|
3614
|
+
r([]), f([]);
|
|
3582
3615
|
},
|
|
3583
3616
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
3584
3617
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -3591,7 +3624,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3591
3624
|
id: "canvas-iframe",
|
|
3592
3625
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3593
3626
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3594
|
-
initialContent:
|
|
3627
|
+
initialContent: w,
|
|
3595
3628
|
children: [
|
|
3596
3629
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3597
3630
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3603,7 +3636,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3603
3636
|
),
|
|
3604
3637
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
|
|
3605
3638
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
3606
|
-
|
|
3639
|
+
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
3607
3640
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
3608
3641
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3609
3642
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -3714,7 +3747,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3714
3747
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3715
3748
|
] }, l))
|
|
3716
3749
|
] }) });
|
|
3717
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3750
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-7Q9lFDq1.js")), CanvasArea = () => {
|
|
3718
3751
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3719
3752
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3720
3753
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3789,8 +3822,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3789
3822
|
showHeading: o = !0,
|
|
3790
3823
|
className: n = ""
|
|
3791
3824
|
}) => {
|
|
3792
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3793
|
-
|
|
3825
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
|
|
3826
|
+
A && (a(w), i.current = w);
|
|
3794
3827
|
}, {
|
|
3795
3828
|
bodyFont: u,
|
|
3796
3829
|
headingFont: p,
|
|
@@ -3798,11 +3831,11 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3798
3831
|
bodyTextDarkColor: x,
|
|
3799
3832
|
bodyTextLightColor: m,
|
|
3800
3833
|
bodyBgDarkColor: E,
|
|
3801
|
-
secondaryColor:
|
|
3802
|
-
bodyBgLightColor:
|
|
3803
|
-
roundedCorners:
|
|
3834
|
+
secondaryColor: j,
|
|
3835
|
+
bodyBgLightColor: f,
|
|
3836
|
+
roundedCorners: _
|
|
3804
3837
|
} = r;
|
|
3805
|
-
let
|
|
3838
|
+
let v = {
|
|
3806
3839
|
headingFont: y({
|
|
3807
3840
|
title: c("theme_config.heading_font"),
|
|
3808
3841
|
default: p,
|
|
@@ -3815,16 +3848,16 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3815
3848
|
}),
|
|
3816
3849
|
roundedCorners: s({
|
|
3817
3850
|
title: c("theme_config.rounded_corner"),
|
|
3818
|
-
default: parseInt(
|
|
3851
|
+
default: parseInt(_ || 5, 10)
|
|
3819
3852
|
}),
|
|
3820
3853
|
primaryColor: h({ title: c("theme_config.primary"), default: g }),
|
|
3821
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3854
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: j })
|
|
3822
3855
|
};
|
|
3823
|
-
l || (
|
|
3824
|
-
...
|
|
3856
|
+
l || (v = {
|
|
3857
|
+
...v,
|
|
3825
3858
|
bodyBgLightColor: h({
|
|
3826
3859
|
title: c("theme_config.background"),
|
|
3827
|
-
default:
|
|
3860
|
+
default: f
|
|
3828
3861
|
}),
|
|
3829
3862
|
bodyTextLightColor: h({
|
|
3830
3863
|
title: c("theme_config.text_color"),
|
|
@@ -3843,9 +3876,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3843
3876
|
type: "object",
|
|
3844
3877
|
properties: {}
|
|
3845
3878
|
}, B = {};
|
|
3846
|
-
return Object.keys(
|
|
3847
|
-
const
|
|
3848
|
-
return S.properties || (S.properties = {}), S.properties[
|
|
3879
|
+
return Object.keys(v).forEach((w) => {
|
|
3880
|
+
const A = v[w];
|
|
3881
|
+
return S.properties || (S.properties = {}), S.properties[w] = A.schema, B[w] = A.uiSchema, !0;
|
|
3849
3882
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3850
3883
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
|
|
3851
3884
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4041,34 +4074,34 @@ function BiExpandVertical(o) {
|
|
|
4041
4074
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4042
4075
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4043
4076
|
let p = null;
|
|
4044
|
-
const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop:
|
|
4077
|
+
const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: j, isDragging: f, isEditing: _, handleClick: v } = o, S = (T) => {
|
|
4045
4078
|
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4046
4079
|
}, B = (T) => {
|
|
4047
4080
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
4048
|
-
}, C = (T) => {
|
|
4049
|
-
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4050
4081
|
}, w = (T) => {
|
|
4051
|
-
T.
|
|
4082
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4083
|
+
}, A = (T) => {
|
|
4084
|
+
T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), v(T);
|
|
4052
4085
|
};
|
|
4053
4086
|
useEffect(() => {
|
|
4054
4087
|
const T = setTimeout(() => {
|
|
4055
|
-
|
|
4088
|
+
j && !o.isOpen && !f && !i.includes(x) && o.toggle();
|
|
4056
4089
|
}, 500);
|
|
4057
4090
|
return () => clearTimeout(T);
|
|
4058
|
-
}, [
|
|
4091
|
+
}, [j, o, f]);
|
|
4059
4092
|
const N = useMemo(() => {
|
|
4060
4093
|
const T = Object.keys(m), b = [];
|
|
4061
|
-
for (let
|
|
4062
|
-
if (T[
|
|
4063
|
-
const
|
|
4064
|
-
|
|
4094
|
+
for (let k = 0; k < T.length; k++)
|
|
4095
|
+
if (T[k].endsWith("_attrs")) {
|
|
4096
|
+
const C = m[T[k]], R = Object.keys(C).join("|");
|
|
4097
|
+
R.match(/x-data/) && b.push("data"), R.match(/x-on/) && b.push("event"), R.match(/x-show|x-if/) && b.push("show");
|
|
4065
4098
|
}
|
|
4066
4099
|
return b;
|
|
4067
4100
|
}, [m]), D = (T, b) => {
|
|
4068
|
-
const
|
|
4069
|
-
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4101
|
+
const k = u.contentDocument || u.contentWindow.document, C = k.querySelector(`[data-block-id=${T}]`);
|
|
4102
|
+
C && C.setAttribute("data-drop", b);
|
|
4103
|
+
const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
4104
|
+
R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (k.documentElement.scrollTop = C.offsetTop - I.top);
|
|
4072
4105
|
};
|
|
4073
4106
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4074
4107
|
"button",
|
|
@@ -4084,12 +4117,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4084
4117
|
"div",
|
|
4085
4118
|
{
|
|
4086
4119
|
onMouseEnter: () => d(x),
|
|
4087
|
-
onClick:
|
|
4120
|
+
onClick: A,
|
|
4088
4121
|
style: n,
|
|
4089
4122
|
"data-node-id": x,
|
|
4090
4123
|
ref: i.includes(x) ? null : r,
|
|
4091
4124
|
onDragStart: () => B(o),
|
|
4092
|
-
onDragEnd: () =>
|
|
4125
|
+
onDragEnd: () => w(o),
|
|
4093
4126
|
onDragOver: (T) => {
|
|
4094
4127
|
T.preventDefault(), D(x, "yes");
|
|
4095
4128
|
},
|
|
@@ -4102,8 +4135,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4102
4135
|
className: cn(
|
|
4103
4136
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4104
4137
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4105
|
-
|
|
4106
|
-
|
|
4138
|
+
j && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
|
|
4139
|
+
f && "opacity-20",
|
|
4107
4140
|
i.includes(x) ? "opacity-50" : ""
|
|
4108
4141
|
),
|
|
4109
4142
|
children: [
|
|
@@ -4117,7 +4150,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4117
4150
|
),
|
|
4118
4151
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4119
4152
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
|
|
4120
|
-
|
|
4153
|
+
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4121
4154
|
"div",
|
|
4122
4155
|
{
|
|
4123
4156
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
@@ -4582,29 +4615,29 @@ function ExpandableObject(o) {
|
|
|
4582
4615
|
shouldExpandNode: p,
|
|
4583
4616
|
clickToExpandNode: g
|
|
4584
4617
|
} = o;
|
|
4585
|
-
const x = useRef(!1), [m, E,
|
|
4618
|
+
const x = useRef(!1), [m, E, j] = useBool(() => p(d, r, n));
|
|
4586
4619
|
useEffect(() => {
|
|
4587
|
-
x.current ?
|
|
4620
|
+
x.current ? j(p(d, r, n)) : x.current = !0;
|
|
4588
4621
|
}, [p]);
|
|
4589
|
-
const
|
|
4590
|
-
|
|
4622
|
+
const f = m ? u.collapseIcon : u.expandIcon, _ = m ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, w = (A) => {
|
|
4623
|
+
A.key === " " && (A.preventDefault(), E());
|
|
4591
4624
|
};
|
|
4592
4625
|
return /* @__PURE__ */ createElement("div", {
|
|
4593
4626
|
className: u.basicChildStyle,
|
|
4594
4627
|
role: "list"
|
|
4595
4628
|
}, /* @__PURE__ */ createElement("span", {
|
|
4596
|
-
className:
|
|
4629
|
+
className: f,
|
|
4597
4630
|
onClick: E,
|
|
4598
|
-
onKeyDown:
|
|
4631
|
+
onKeyDown: w,
|
|
4599
4632
|
role: "button",
|
|
4600
4633
|
tabIndex: 0,
|
|
4601
|
-
"aria-label":
|
|
4634
|
+
"aria-label": _,
|
|
4602
4635
|
"aria-expanded": m,
|
|
4603
|
-
"aria-controls": m ?
|
|
4636
|
+
"aria-controls": m ? v : void 0
|
|
4604
4637
|
}), n && (g ? /* @__PURE__ */ createElement("span", {
|
|
4605
4638
|
className: u.clickableLabel,
|
|
4606
4639
|
onClick: E,
|
|
4607
|
-
onKeyDown:
|
|
4640
|
+
onKeyDown: w,
|
|
4608
4641
|
role: "button",
|
|
4609
4642
|
tabIndex: -1
|
|
4610
4643
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
@@ -4612,11 +4645,11 @@ function ExpandableObject(o) {
|
|
|
4612
4645
|
}, n, ":")), /* @__PURE__ */ createElement("span", {
|
|
4613
4646
|
className: u.punctuation
|
|
4614
4647
|
}, i), m ? /* @__PURE__ */ createElement("div", {
|
|
4615
|
-
id:
|
|
4616
|
-
}, a.map((
|
|
4617
|
-
key:
|
|
4618
|
-
field:
|
|
4619
|
-
value:
|
|
4648
|
+
id: v
|
|
4649
|
+
}, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4650
|
+
key: A[0] || N,
|
|
4651
|
+
field: A[0],
|
|
4652
|
+
value: A[1],
|
|
4620
4653
|
style: u,
|
|
4621
4654
|
lastElement: N === B,
|
|
4622
4655
|
level: S,
|
|
@@ -4625,11 +4658,11 @@ function ExpandableObject(o) {
|
|
|
4625
4658
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4626
4659
|
className: u.collapsedContent,
|
|
4627
4660
|
onClick: E,
|
|
4628
|
-
onKeyDown:
|
|
4661
|
+
onKeyDown: w,
|
|
4629
4662
|
role: "button",
|
|
4630
4663
|
tabIndex: -1,
|
|
4631
4664
|
"aria-hidden": !0,
|
|
4632
|
-
"aria-label":
|
|
4665
|
+
"aria-label": _,
|
|
4633
4666
|
"aria-expanded": m
|
|
4634
4667
|
}), /* @__PURE__ */ createElement("span", {
|
|
4635
4668
|
className: u.punctuation
|
|
@@ -4784,8 +4817,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4784
4817
|
appliedBindings: c
|
|
4785
4818
|
}) => {
|
|
4786
4819
|
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
|
|
4787
|
-
(
|
|
4788
|
-
) : d.filter((
|
|
4820
|
+
(j) => !includes(c, j) && get(p, `props.${first(split(j, "."))}.binding`)
|
|
4821
|
+
) : d.filter((j) => i === get(u, j, "")), [o, d, c, i, p]);
|
|
4789
4822
|
return useEffect(() => {
|
|
4790
4823
|
n && l(n);
|
|
4791
4824
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -4814,23 +4847,23 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4814
4847
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4815
4848
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4816
4849
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4817
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (
|
|
4850
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4818
4851
|
CommandItem,
|
|
4819
4852
|
{
|
|
4820
|
-
value:
|
|
4853
|
+
value: j,
|
|
4821
4854
|
className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4822
|
-
onSelect: (
|
|
4823
|
-
r(find(E, (
|
|
4855
|
+
onSelect: (f) => {
|
|
4856
|
+
r(find(E, (_) => _ === f) || null), m(!1);
|
|
4824
4857
|
},
|
|
4825
4858
|
children: [
|
|
4826
4859
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4827
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4828
|
-
|
|
4860
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === j ? "" : "opacity-0"}` }),
|
|
4861
|
+
j
|
|
4829
4862
|
] }),
|
|
4830
|
-
g ? /* @__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,
|
|
4863
|
+
g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
|
|
4831
4864
|
]
|
|
4832
4865
|
},
|
|
4833
|
-
|
|
4866
|
+
j
|
|
4834
4867
|
)) })
|
|
4835
4868
|
] })
|
|
4836
4869
|
] }) })
|
|
@@ -4845,15 +4878,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4845
4878
|
item: a
|
|
4846
4879
|
}) => {
|
|
4847
4880
|
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
|
|
4848
|
-
(E,
|
|
4881
|
+
(E, j) => {
|
|
4849
4882
|
if (isEmpty(E))
|
|
4850
4883
|
return "";
|
|
4851
4884
|
{
|
|
4852
|
-
const
|
|
4853
|
-
if (isArray$1(
|
|
4885
|
+
const f = get(j === "PROP" ? u : p, E, "");
|
|
4886
|
+
if (isArray$1(f))
|
|
4854
4887
|
return "list";
|
|
4855
|
-
const
|
|
4856
|
-
return
|
|
4888
|
+
const _ = typeof f;
|
|
4889
|
+
return _ === "string" ? "text" : _ === "object" ? "model" : _;
|
|
4857
4890
|
}
|
|
4858
4891
|
},
|
|
4859
4892
|
[u, p]
|
|
@@ -4873,8 +4906,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4873
4906
|
value: l,
|
|
4874
4907
|
setValue: i,
|
|
4875
4908
|
onChange: (E) => {
|
|
4876
|
-
const
|
|
4877
|
-
i(E), x !==
|
|
4909
|
+
const j = g(E, "PROP");
|
|
4910
|
+
i(E), x !== j && d(""), m(j);
|
|
4878
4911
|
},
|
|
4879
4912
|
data: u,
|
|
4880
4913
|
dataType: x,
|
|
@@ -4891,8 +4924,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4891
4924
|
value: c,
|
|
4892
4925
|
setValue: d,
|
|
4893
4926
|
onChange: (E) => {
|
|
4894
|
-
const
|
|
4895
|
-
d(x ===
|
|
4927
|
+
const j = g(E, "PATH");
|
|
4928
|
+
d(x === j ? E : "");
|
|
4896
4929
|
},
|
|
4897
4930
|
data: p,
|
|
4898
4931
|
dataType: x,
|
|
@@ -4980,7 +5013,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4980
5013
|
const m = filter(i, (E) => E.key !== x.key);
|
|
4981
5014
|
c([...m, x]), g([...m, x]);
|
|
4982
5015
|
}, p = (x) => {
|
|
4983
|
-
const m = filter(i, (E,
|
|
5016
|
+
const m = filter(i, (E, j) => x !== j);
|
|
4984
5017
|
g([...m]);
|
|
4985
5018
|
}, g = useCallback(
|
|
4986
5019
|
(x = []) => {
|
|
@@ -5099,7 +5132,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5099
5132
|
}
|
|
5100
5133
|
)
|
|
5101
5134
|
] });
|
|
5102
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5135
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-EGgHjvre.js")), UploadImages = React__default.lazy(() => import("./UploadImages-D43sz4A8.js")), ImagesPanel = ({
|
|
5103
5136
|
isModalView: o = !1,
|
|
5104
5137
|
onSelect: n = () => {
|
|
5105
5138
|
}
|
|
@@ -5118,19 +5151,21 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5118
5151
|
] })
|
|
5119
5152
|
] });
|
|
5120
5153
|
}, ImagesPanel$1 = ImagesPanel, ImagePickerModal = ({ children: o, onSelect: n }) => {
|
|
5121
|
-
const [r, a] = useState(!1), l = (...
|
|
5122
|
-
n.call(void 0, ...
|
|
5154
|
+
const [r, a] = useState(!1), l = useBuilderProp("mediaManagerComponent", ImagesPanel$1), i = (...c) => {
|
|
5155
|
+
n.call(void 0, ...c), a(!1);
|
|
5123
5156
|
};
|
|
5124
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: r, onOpenChange: (
|
|
5157
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: r, onOpenChange: (c) => a(c), children: [
|
|
5125
5158
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTrigger, { asChild: !0, children: o }),
|
|
5126
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "flex h-3/4 max-w-5xl border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5159
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "flex h-3/4 max-w-5xl border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(l, { isModalView: !0, onSelect: i }) }) })
|
|
5127
5160
|
] });
|
|
5128
|
-
}
|
|
5129
|
-
|
|
5161
|
+
};
|
|
5162
|
+
ImagePickerModal.displayName = "ImagePickerModal";
|
|
5163
|
+
const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
5164
|
+
const l = useBuilderProp("uploadMediaCallback"), i = useBuilderProp("unsplashAccessKey"), { t: c } = useTranslation(), d = l !== void 0 || i !== void 0;
|
|
5130
5165
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
5131
5166
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
5132
5167
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
5133
|
-
|
|
5168
|
+
d && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5134
5169
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? c("Replace image") : c("Choose image") }) }),
|
|
5135
5170
|
/* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
|
|
5136
5171
|
] }),
|
|
@@ -5144,8 +5179,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5144
5179
|
className: "text-xs",
|
|
5145
5180
|
placeholder: c("enter_image_url"),
|
|
5146
5181
|
value: o,
|
|
5147
|
-
onBlur: ({ target: { value:
|
|
5148
|
-
onChange: (
|
|
5182
|
+
onBlur: ({ target: { value: u } }) => a(r, u),
|
|
5183
|
+
onChange: (u) => n(u.target.value)
|
|
5149
5184
|
}
|
|
5150
5185
|
)
|
|
5151
5186
|
] })
|
|
@@ -5357,40 +5392,45 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5357
5392
|
}, ResetRSCBlockButton = ({ blockId: o }) => {
|
|
5358
5393
|
const { t: n } = useTranslation(), { reset: r } = useRSCBlocksStore();
|
|
5359
5394
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
|
|
5395
|
+
}, formDataWithSelectedLang = (o, n, r) => {
|
|
5396
|
+
const a = cloneDeep(o);
|
|
5397
|
+
return forEach(keys(o), (l) => {
|
|
5398
|
+
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
|
|
5399
|
+
}), a;
|
|
5360
5400
|
};
|
|
5361
5401
|
function BlockSettings() {
|
|
5362
|
-
const o =
|
|
5363
|
-
if (
|
|
5364
|
-
const
|
|
5365
|
-
|
|
5402
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, _, v) => {
|
|
5403
|
+
if (_ && (c == null ? void 0 : c._id) === n._id) {
|
|
5404
|
+
const S = _.replace("root.", "");
|
|
5405
|
+
a([n._id], { [S]: get(f, S) }, v);
|
|
5366
5406
|
}
|
|
5367
|
-
},
|
|
5368
|
-
debounce(({ formData: f },
|
|
5369
|
-
|
|
5407
|
+
}, g = useCallback(
|
|
5408
|
+
debounce(({ formData: f }, _, v) => {
|
|
5409
|
+
p({ formData: f }, _, v), d(f);
|
|
5370
5410
|
}, 1500),
|
|
5371
|
-
[
|
|
5372
|
-
),
|
|
5373
|
-
if (
|
|
5374
|
-
const
|
|
5375
|
-
|
|
5376
|
-
[
|
|
5377
|
-
convertDotNotationToObject(
|
|
5378
|
-
),
|
|
5411
|
+
[n == null ? void 0 : n._id, o]
|
|
5412
|
+
), x = ({ formData: f }, _) => {
|
|
5413
|
+
if (_) {
|
|
5414
|
+
const v = _.replace("root.", "");
|
|
5415
|
+
r(
|
|
5416
|
+
[n._id],
|
|
5417
|
+
convertDotNotationToObject(v, get(f, v.split(".")))
|
|
5418
|
+
), g({ formData: f }, _, { [v]: get(c, v) });
|
|
5379
5419
|
}
|
|
5380
|
-
},
|
|
5381
|
-
const f = cloneDeep(get(
|
|
5382
|
-
return each(f, (
|
|
5383
|
-
get(
|
|
5384
|
-
}),
|
|
5385
|
-
}, [
|
|
5420
|
+
}, m = keys(get(i, "_bindings", {})), E = useMemo(() => {
|
|
5421
|
+
const f = cloneDeep(get(l, "props", {}));
|
|
5422
|
+
return each(f, (_, v) => {
|
|
5423
|
+
get(_, "hidden", !1) && delete f[v];
|
|
5424
|
+
}), u && each(m, (_) => delete f[_]), f;
|
|
5425
|
+
}, [l, m, u]), j = get(l, "server", !1);
|
|
5386
5426
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5387
|
-
|
|
5427
|
+
u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5388
5428
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
5389
5429
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
5390
5430
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5391
5431
|
"div",
|
|
5392
5432
|
{
|
|
5393
|
-
className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(
|
|
5433
|
+
className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(n, "_bindings", {})) ? "bg-gray-300" : "bg-blue-500"}`
|
|
5394
5434
|
}
|
|
5395
5435
|
),
|
|
5396
5436
|
"Data Binding"
|
|
@@ -5398,9 +5438,9 @@ function BlockSettings() {
|
|
|
5398
5438
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5399
5439
|
DataBindingSetting$1,
|
|
5400
5440
|
{
|
|
5401
|
-
bindingData: get(
|
|
5441
|
+
bindingData: get(n, "_bindings", {}),
|
|
5402
5442
|
onChange: (f) => {
|
|
5403
|
-
|
|
5443
|
+
p({ formData: { _bindings: f } }, "root._bindings");
|
|
5404
5444
|
}
|
|
5405
5445
|
}
|
|
5406
5446
|
) })
|
|
@@ -5411,35 +5451,35 @@ function BlockSettings() {
|
|
|
5411
5451
|
"Static Content"
|
|
5412
5452
|
] }) }),
|
|
5413
5453
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
|
|
5414
|
-
isEmpty(
|
|
5454
|
+
isEmpty(m) ? 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: [
|
|
5415
5455
|
"Data binding is set for ",
|
|
5416
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(
|
|
5456
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(m, capitalize).join(", ") }),
|
|
5417
5457
|
" ",
|
|
5418
|
-
|
|
5458
|
+
m.length === 1 ? "property" : "properties",
|
|
5419
5459
|
". Remove data binding to edit static content."
|
|
5420
5460
|
] }),
|
|
5421
5461
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5422
5462
|
JSONForm,
|
|
5423
5463
|
{
|
|
5424
|
-
id:
|
|
5425
|
-
onChange:
|
|
5426
|
-
formData:
|
|
5427
|
-
properties:
|
|
5464
|
+
id: n == null ? void 0 : n._id,
|
|
5465
|
+
onChange: x,
|
|
5466
|
+
formData: i,
|
|
5467
|
+
properties: E
|
|
5428
5468
|
}
|
|
5429
5469
|
)
|
|
5430
5470
|
] })
|
|
5431
5471
|
] })
|
|
5432
|
-
] }) : isEmpty(
|
|
5472
|
+
] }) : isEmpty(E) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5433
5473
|
JSONForm,
|
|
5434
5474
|
{
|
|
5435
|
-
id:
|
|
5436
|
-
onChange:
|
|
5437
|
-
formData:
|
|
5438
|
-
properties:
|
|
5475
|
+
id: n == null ? void 0 : n._id,
|
|
5476
|
+
onChange: x,
|
|
5477
|
+
formData: i,
|
|
5478
|
+
properties: E
|
|
5439
5479
|
}
|
|
5440
5480
|
),
|
|
5441
|
-
(
|
|
5442
|
-
|
|
5481
|
+
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5482
|
+
j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
|
|
5443
5483
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5444
5484
|
] });
|
|
5445
5485
|
}
|
|
@@ -5453,26 +5493,35 @@ function getChildBlocks(o, n, r) {
|
|
|
5453
5493
|
const getBlockWithChildren = (o, n) => {
|
|
5454
5494
|
let r = [];
|
|
5455
5495
|
return r = flattenDeep([...r, ...getChildBlocks(n, o, r)]), r;
|
|
5456
|
-
}
|
|
5457
|
-
|
|
5496
|
+
};
|
|
5497
|
+
function promptWithLanguage(o, n, r) {
|
|
5498
|
+
if (!n || r !== "content")
|
|
5499
|
+
return o;
|
|
5500
|
+
const a = `Please provide the response in "${n}" language.`;
|
|
5501
|
+
return `${o}
|
|
5502
|
+
|
|
5503
|
+
${a}`;
|
|
5504
|
+
}
|
|
5505
|
+
const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
5506
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), g = u.length ? u : p;
|
|
5458
5507
|
return {
|
|
5459
5508
|
askAi: useCallback(
|
|
5460
|
-
async (
|
|
5509
|
+
async (x, m, E, j) => {
|
|
5461
5510
|
if (l) {
|
|
5462
5511
|
n(!0), a(null);
|
|
5463
5512
|
try {
|
|
5464
|
-
const
|
|
5465
|
-
set(
|
|
5466
|
-
const
|
|
5467
|
-
if (
|
|
5468
|
-
a(
|
|
5513
|
+
const f = x === "content" ? cloneDeep(getBlockWithChildren(m, d)) : [cloneDeep(d.find((B) => B._id === m))];
|
|
5514
|
+
set(f, "0._parent", null);
|
|
5515
|
+
const _ = await l(x, promptWithLanguage(E, g, x), f), { blocks: v, error: S } = _;
|
|
5516
|
+
if (S) {
|
|
5517
|
+
a(S);
|
|
5469
5518
|
return;
|
|
5470
5519
|
}
|
|
5471
|
-
|
|
5472
|
-
} catch (
|
|
5473
|
-
a(
|
|
5520
|
+
x === "styles" ? c(v) : i(v), j && j(_);
|
|
5521
|
+
} catch (f) {
|
|
5522
|
+
a(f);
|
|
5474
5523
|
} finally {
|
|
5475
|
-
n(!1),
|
|
5524
|
+
n(!1), j && j();
|
|
5476
5525
|
}
|
|
5477
5526
|
}
|
|
5478
5527
|
},
|
|
@@ -5611,25 +5660,25 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5611
5660
|
keys: ["name"]
|
|
5612
5661
|
});
|
|
5613
5662
|
function ManualClasses() {
|
|
5614
|
-
var
|
|
5615
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (
|
|
5663
|
+
var A;
|
|
5664
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
|
|
5616
5665
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5617
5666
|
a(i, N, !0), u("");
|
|
5618
|
-
}, [E,
|
|
5667
|
+
}, [E, j] = useState([]), f = ({ value: N }) => {
|
|
5619
5668
|
const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
|
|
5620
5669
|
let b = [];
|
|
5621
5670
|
if (T && T.length > 0) {
|
|
5622
|
-
const [
|
|
5623
|
-
b = fuse.search(
|
|
5671
|
+
const [k] = T, C = D.replace(k, "");
|
|
5672
|
+
b = fuse.search(C).map((I) => ({
|
|
5624
5673
|
...I,
|
|
5625
|
-
item: { ...I.item, name:
|
|
5674
|
+
item: { ...I.item, name: k + I.item.name }
|
|
5626
5675
|
}));
|
|
5627
5676
|
} else
|
|
5628
5677
|
b = fuse.search(D);
|
|
5629
|
-
return
|
|
5630
|
-
},
|
|
5631
|
-
|
|
5632
|
-
},
|
|
5678
|
+
return j(map(b, "item"));
|
|
5679
|
+
}, _ = () => {
|
|
5680
|
+
j([]);
|
|
5681
|
+
}, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5633
5682
|
autoComplete: "off",
|
|
5634
5683
|
autoCorrect: "off",
|
|
5635
5684
|
autoCapitalize: "off",
|
|
@@ -5641,7 +5690,7 @@ function ManualClasses() {
|
|
|
5641
5690
|
},
|
|
5642
5691
|
onChange: (N, { newValue: D }) => u(D),
|
|
5643
5692
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5644
|
-
},
|
|
5693
|
+
}, w = () => {
|
|
5645
5694
|
if (navigator.clipboard === void 0) {
|
|
5646
5695
|
p({
|
|
5647
5696
|
title: o("clipboard_not_supported"),
|
|
@@ -5664,7 +5713,7 @@ function ManualClasses() {
|
|
|
5664
5713
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5665
5714
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5666
5715
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5667
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5716
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
|
|
5668
5717
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
|
|
5669
5718
|
] })
|
|
5670
5719
|
] }),
|
|
@@ -5681,9 +5730,9 @@ function ManualClasses() {
|
|
|
5681
5730
|
Autosuggest,
|
|
5682
5731
|
{
|
|
5683
5732
|
suggestions: E,
|
|
5684
|
-
onSuggestionsFetchRequested:
|
|
5685
|
-
onSuggestionsClearRequested:
|
|
5686
|
-
getSuggestionValue:
|
|
5733
|
+
onSuggestionsFetchRequested: f,
|
|
5734
|
+
onSuggestionsClearRequested: _,
|
|
5735
|
+
getSuggestionValue: v,
|
|
5687
5736
|
renderSuggestion: S,
|
|
5688
5737
|
inputProps: B,
|
|
5689
5738
|
containerProps: {
|
|
@@ -6117,8 +6166,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6117
6166
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6118
6167
|
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), x = get(p, "2", ""), m = useCallback(
|
|
6119
6168
|
// eslint-disable-next-line no-shadow
|
|
6120
|
-
(
|
|
6121
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6169
|
+
(j) => {
|
|
6170
|
+
["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), u({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
|
|
6122
6171
|
},
|
|
6123
6172
|
[c, u]
|
|
6124
6173
|
);
|
|
@@ -6129,16 +6178,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6129
6178
|
}, [g]);
|
|
6130
6179
|
const E = useCallback(
|
|
6131
6180
|
// eslint-disable-next-line no-shadow
|
|
6132
|
-
(
|
|
6133
|
-
u({ color: g, shade:
|
|
6181
|
+
(j) => {
|
|
6182
|
+
u({ color: g, shade: j });
|
|
6134
6183
|
},
|
|
6135
6184
|
[g]
|
|
6136
6185
|
);
|
|
6137
6186
|
return useEffect(() => {
|
|
6138
6187
|
u({ color: "", shade: "" });
|
|
6139
6188
|
}, [r]), useEffect(() => {
|
|
6140
|
-
const
|
|
6141
|
-
|
|
6189
|
+
const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6190
|
+
f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
|
|
6142
6191
|
}, [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: [
|
|
6143
6192
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6144
6193
|
DropDown,
|
|
@@ -6374,50 +6423,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6374
6423
|
},
|
|
6375
6424
|
a
|
|
6376
6425
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6377
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E,
|
|
6426
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, j] = useState(!1), [f, _] = useState(""), [v, S] = useState(!1), [B, w] = useState(!1);
|
|
6378
6427
|
useEffect(() => {
|
|
6379
|
-
const { value: b, unit:
|
|
6380
|
-
if (
|
|
6428
|
+
const { value: b, unit: k } = getClassValueAndUnit(i);
|
|
6429
|
+
if (k === "") {
|
|
6381
6430
|
l(b), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6382
6431
|
return;
|
|
6383
6432
|
}
|
|
6384
|
-
m(
|
|
6433
|
+
m(k), l(k === "class" || isEmpty(b) ? "" : b);
|
|
6385
6434
|
}, [i, u, p]);
|
|
6386
|
-
const
|
|
6435
|
+
const A = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6387
6436
|
(b = !1) => {
|
|
6388
|
-
const
|
|
6389
|
-
if (get(
|
|
6390
|
-
|
|
6437
|
+
const k = getUserInputValues(`${a}`, p);
|
|
6438
|
+
if (get(k, "error", !1)) {
|
|
6439
|
+
j(!0);
|
|
6391
6440
|
return;
|
|
6392
6441
|
}
|
|
6393
|
-
const
|
|
6394
|
-
if (
|
|
6395
|
-
|
|
6442
|
+
const C = get(k, "unit") !== "" ? get(k, "unit") : x;
|
|
6443
|
+
if (C === "auto" || C === "none") {
|
|
6444
|
+
A(`${d}${C}`);
|
|
6396
6445
|
return;
|
|
6397
6446
|
}
|
|
6398
|
-
if (get(
|
|
6447
|
+
if (get(k, "value") === "")
|
|
6399
6448
|
return;
|
|
6400
|
-
const I = `${get(
|
|
6401
|
-
b ? N(I) :
|
|
6449
|
+
const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6450
|
+
b ? N(I) : A(I);
|
|
6402
6451
|
},
|
|
6403
|
-
[
|
|
6452
|
+
[A, N, a, x, d, p]
|
|
6404
6453
|
), T = useCallback(
|
|
6405
6454
|
(b) => {
|
|
6406
|
-
const
|
|
6407
|
-
if (get(
|
|
6408
|
-
|
|
6455
|
+
const k = getUserInputValues(`${a}`, p);
|
|
6456
|
+
if (get(k, "error", !1)) {
|
|
6457
|
+
j(!0);
|
|
6409
6458
|
return;
|
|
6410
6459
|
}
|
|
6411
6460
|
if (b === "auto" || b === "none") {
|
|
6412
|
-
|
|
6461
|
+
A(`${d}${b}`);
|
|
6413
6462
|
return;
|
|
6414
6463
|
}
|
|
6415
|
-
if (get(
|
|
6464
|
+
if (get(k, "value") === "")
|
|
6416
6465
|
return;
|
|
6417
|
-
const
|
|
6418
|
-
|
|
6466
|
+
const C = get(k, "unit") !== "" ? get(k, "unit") : b, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6467
|
+
A(I);
|
|
6419
6468
|
},
|
|
6420
|
-
[
|
|
6469
|
+
[A, a, d, p]
|
|
6421
6470
|
);
|
|
6422
6471
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6423
6472
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
@@ -6425,7 +6474,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6425
6474
|
/* @__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, {}) }) }),
|
|
6426
6475
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6427
6476
|
] })
|
|
6428
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6477
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
|
|
6429
6478
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6430
6479
|
["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6431
6480
|
"input",
|
|
@@ -6437,25 +6486,25 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6437
6486
|
onKeyDown: (b) => {
|
|
6438
6487
|
if (b.keyCode !== 38 && b.keyCode !== 40)
|
|
6439
6488
|
return;
|
|
6440
|
-
b.preventDefault(),
|
|
6441
|
-
const
|
|
6442
|
-
let
|
|
6443
|
-
b.keyCode === 38 && (
|
|
6444
|
-
const
|
|
6489
|
+
b.preventDefault(), w(!0);
|
|
6490
|
+
const k = parseInt$1(b.target.value);
|
|
6491
|
+
let C = isNaN$1(k) ? 0 : k;
|
|
6492
|
+
b.keyCode === 38 && (C += 1), b.keyCode === 40 && (C -= 1);
|
|
6493
|
+
const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6445
6494
|
N(L);
|
|
6446
6495
|
},
|
|
6447
6496
|
onKeyUp: (b) => {
|
|
6448
|
-
B && (b.preventDefault(),
|
|
6497
|
+
B && (b.preventDefault(), w(!1));
|
|
6449
6498
|
},
|
|
6450
6499
|
onBlur: () => D(),
|
|
6451
6500
|
onChange: (b) => {
|
|
6452
|
-
|
|
6501
|
+
j(!1), l(b.target.value);
|
|
6453
6502
|
},
|
|
6454
6503
|
onClick: (b) => {
|
|
6455
|
-
var
|
|
6456
|
-
(
|
|
6504
|
+
var k;
|
|
6505
|
+
(k = b == null ? void 0 : b.target) == null || k.select(), r(!1);
|
|
6457
6506
|
},
|
|
6458
|
-
value:
|
|
6507
|
+
value: v ? f : a,
|
|
6459
6508
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6460
6509
|
" ",
|
|
6461
6510
|
E ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -6487,22 +6536,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6487
6536
|
) }) })
|
|
6488
6537
|
] })
|
|
6489
6538
|
] }),
|
|
6490
|
-
["none", "auto"].indexOf(x) !== -1 ||
|
|
6539
|
+
["none", "auto"].indexOf(x) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6491
6540
|
DragStyleButton,
|
|
6492
6541
|
{
|
|
6493
6542
|
onDragStart: () => S(!0),
|
|
6494
6543
|
onDragEnd: (b) => {
|
|
6495
|
-
if (
|
|
6544
|
+
if (_(() => ""), S(!1), isEmpty(b))
|
|
6496
6545
|
return;
|
|
6497
|
-
const
|
|
6498
|
-
|
|
6546
|
+
const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6547
|
+
A(R);
|
|
6499
6548
|
},
|
|
6500
6549
|
onDrag: (b) => {
|
|
6501
6550
|
if (isEmpty(b))
|
|
6502
6551
|
return;
|
|
6503
|
-
|
|
6504
|
-
const
|
|
6505
|
-
N(
|
|
6552
|
+
_(b);
|
|
6553
|
+
const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6554
|
+
N(R);
|
|
6506
6555
|
},
|
|
6507
6556
|
currentValue: a,
|
|
6508
6557
|
unit: x,
|
|
@@ -6599,21 +6648,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6599
6648
|
"2xl": "1536px"
|
|
6600
6649
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6601
6650
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6602
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [
|
|
6651
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), _ = useCallback(
|
|
6603
6652
|
(N, D = !0) => {
|
|
6604
6653
|
const T = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
|
|
6605
6654
|
(u || p !== "") && (T.mq = "xs");
|
|
6606
6655
|
const b = generateFullClsName(T);
|
|
6607
|
-
m(
|
|
6656
|
+
m(j, [b], D);
|
|
6608
6657
|
},
|
|
6609
|
-
[
|
|
6610
|
-
),
|
|
6611
|
-
E(
|
|
6612
|
-
}, [
|
|
6658
|
+
[j, u, g, p, l, m]
|
|
6659
|
+
), v = useCallback(() => {
|
|
6660
|
+
E(j, [f]);
|
|
6661
|
+
}, [j, f, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
|
|
6613
6662
|
useEffect(() => {
|
|
6614
6663
|
i(S, x);
|
|
6615
6664
|
}, [S, i, x]);
|
|
6616
|
-
const [, , B] = useCanvasWidth(),
|
|
6665
|
+
const [, , B] = useCanvasWidth(), w = useCallback(
|
|
6617
6666
|
(N) => {
|
|
6618
6667
|
B({
|
|
6619
6668
|
xs: 400,
|
|
@@ -6625,9 +6674,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6625
6674
|
}[N]);
|
|
6626
6675
|
},
|
|
6627
6676
|
[B]
|
|
6628
|
-
),
|
|
6629
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x &&
|
|
6630
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !
|
|
6677
|
+
), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
|
|
6678
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6679
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6631
6680
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6632
6681
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6633
6682
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6636,17 +6685,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6636
6685
|
currentClass: get(x, "cls", ""),
|
|
6637
6686
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6638
6687
|
units: c || [],
|
|
6639
|
-
onChange:
|
|
6688
|
+
onChange: _,
|
|
6640
6689
|
negative: d,
|
|
6641
6690
|
cssProperty: l
|
|
6642
6691
|
}
|
|
6643
6692
|
) : null,
|
|
6644
|
-
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6645
|
-
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6646
|
-
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6647
|
-
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6693
|
+
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: _ }),
|
|
6694
|
+
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: _ }),
|
|
6695
|
+
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: _ }),
|
|
6696
|
+
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: _ })
|
|
6648
6697
|
] }),
|
|
6649
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6698
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6650
6699
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6651
6700
|
"button",
|
|
6652
6701
|
{
|
|
@@ -6666,7 +6715,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6666
6715
|
"button",
|
|
6667
6716
|
{
|
|
6668
6717
|
type: "button",
|
|
6669
|
-
onClick: () =>
|
|
6718
|
+
onClick: () => w(get(x, "mq")),
|
|
6670
6719
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6671
6720
|
children: [
|
|
6672
6721
|
"Switch to ",
|
|
@@ -6836,8 +6885,8 @@ function BlockStyling() {
|
|
|
6836
6885
|
m = isNaN(m) ? 0 : m;
|
|
6837
6886
|
let E = MAPPER[i.dragUnit];
|
|
6838
6887
|
(startsWith(x, "scale") || x === "opacity") && (E = 10);
|
|
6839
|
-
let
|
|
6840
|
-
g &&
|
|
6888
|
+
let f = (i.dragStartY - p.pageY) / E + m;
|
|
6889
|
+
g && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
|
|
6841
6890
|
},
|
|
6842
6891
|
[i],
|
|
6843
6892
|
50
|
|
@@ -6923,32 +6972,32 @@ const BlockCard = ({
|
|
|
6923
6972
|
library: n,
|
|
6924
6973
|
parentId: r = void 0
|
|
6925
6974
|
}) => {
|
|
6926
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (
|
|
6927
|
-
const
|
|
6928
|
-
return
|
|
6929
|
-
},
|
|
6930
|
-
async (
|
|
6931
|
-
if (
|
|
6975
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (_) => {
|
|
6976
|
+
const v = has(_, "styles_attrs.data-page-section");
|
|
6977
|
+
return _._type === "Box" && v;
|
|
6978
|
+
}, j = useCallback(
|
|
6979
|
+
async (_) => {
|
|
6980
|
+
if (_.stopPropagation(), has(o, "component")) {
|
|
6932
6981
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6933
6982
|
return;
|
|
6934
6983
|
}
|
|
6935
6984
|
l(!0);
|
|
6936
|
-
const
|
|
6937
|
-
isEmpty(
|
|
6985
|
+
const v = await i(n, o);
|
|
6986
|
+
isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6938
6987
|
},
|
|
6939
6988
|
[o]
|
|
6940
|
-
),
|
|
6941
|
-
const
|
|
6989
|
+
), f = async (_) => {
|
|
6990
|
+
const v = await i(n, o);
|
|
6942
6991
|
let S = r;
|
|
6943
|
-
if (E(first(
|
|
6944
|
-
const B = { blocks:
|
|
6945
|
-
if (
|
|
6946
|
-
const
|
|
6947
|
-
|
|
6948
|
-
|
|
6992
|
+
if (E(first(v)) && (S = null), !isEmpty(v)) {
|
|
6993
|
+
const B = { blocks: v, uiLibrary: !0, parent: S };
|
|
6994
|
+
if (_.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
6995
|
+
const w = new Image();
|
|
6996
|
+
w.src = o.preview, w.onload = () => {
|
|
6997
|
+
_.dataTransfer.setDragImage(w, 0, 0);
|
|
6949
6998
|
};
|
|
6950
6999
|
} else
|
|
6951
|
-
|
|
7000
|
+
_.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6952
7001
|
m(B), setTimeout(() => {
|
|
6953
7002
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6954
7003
|
}, 200);
|
|
@@ -6959,9 +7008,9 @@ const BlockCard = ({
|
|
|
6959
7008
|
"div",
|
|
6960
7009
|
{
|
|
6961
7010
|
onClick: a ? () => {
|
|
6962
|
-
} :
|
|
7011
|
+
} : j,
|
|
6963
7012
|
draggable: x ? "true" : "false",
|
|
6964
|
-
onDragStart:
|
|
7013
|
+
onDragStart: f,
|
|
6965
7014
|
className: clsx(
|
|
6966
7015
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
6967
7016
|
),
|
|
@@ -6990,7 +7039,7 @@ const BlockCard = ({
|
|
|
6990
7039
|
})();
|
|
6991
7040
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
6992
7041
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
6993
|
-
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"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t:
|
|
7042
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: j } = useTranslation(), f = (S) => {
|
|
6994
7043
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
6995
7044
|
E.current && x(S);
|
|
6996
7045
|
}, 300);
|
|
@@ -7000,18 +7049,18 @@ const BlockCard = ({
|
|
|
7000
7049
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7001
7050
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7002
7051
|
] });
|
|
7003
|
-
const
|
|
7052
|
+
const _ = filter(m, (S, B) => B % 2 === 0), v = filter(m, (S, B) => B % 2 === 1);
|
|
7004
7053
|
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: [
|
|
7005
7054
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7006
7055
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7007
7056
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7008
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7057
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("groups") }),
|
|
7009
7058
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7010
7059
|
/* @__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(
|
|
7011
7060
|
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7012
7061
|
"div",
|
|
7013
7062
|
{
|
|
7014
|
-
onMouseEnter: () =>
|
|
7063
|
+
onMouseEnter: () => f(B),
|
|
7015
7064
|
onMouseLeave: () => clearTimeout(E.current),
|
|
7016
7065
|
onClick: () => x(B),
|
|
7017
7066
|
className: cn(
|
|
@@ -7019,7 +7068,7 @@ const BlockCard = ({
|
|
|
7019
7068
|
B === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7020
7069
|
),
|
|
7021
7070
|
children: [
|
|
7022
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7071
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(j(B.toLowerCase())) }),
|
|
7023
7072
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7024
7073
|
]
|
|
7025
7074
|
},
|
|
@@ -7036,10 +7085,10 @@ const BlockCard = ({
|
|
|
7036
7085
|
children: [
|
|
7037
7086
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7038
7087
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7039
|
-
|
|
7088
|
+
_.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7040
7089
|
) }),
|
|
7041
7090
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7042
|
-
|
|
7091
|
+
v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7043
7092
|
) })
|
|
7044
7093
|
] }),
|
|
7045
7094
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7486,8 +7535,8 @@ i18n.use(initReactI18next).init({
|
|
|
7486
7535
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7487
7536
|
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
|
|
7488
7537
|
if (has(o, "blocks")) {
|
|
7489
|
-
const
|
|
7490
|
-
u(syncBlocksWithDefaults(
|
|
7538
|
+
const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7539
|
+
u(syncBlocksWithDefaults(j), r || null);
|
|
7491
7540
|
} else
|
|
7492
7541
|
d(o, r || null);
|
|
7493
7542
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
@@ -7499,8 +7548,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7499
7548
|
disabled: n,
|
|
7500
7549
|
onClick: x,
|
|
7501
7550
|
type: "button",
|
|
7502
|
-
onDragStart: (
|
|
7503
|
-
|
|
7551
|
+
onDragStart: (j) => {
|
|
7552
|
+
j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), j.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7504
7553
|
p([]), g(null);
|
|
7505
7554
|
}, 200);
|
|
7506
7555
|
},
|
|
@@ -7675,12 +7724,12 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7675
7724
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7676
7725
|
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
|
|
7677
7726
|
useEffect(() => {
|
|
7678
|
-
var
|
|
7679
|
-
(
|
|
7727
|
+
var j;
|
|
7728
|
+
(j = x.current) == null || j.focus();
|
|
7680
7729
|
}, []);
|
|
7681
|
-
const E = (
|
|
7682
|
-
const { usage:
|
|
7683
|
-
!l &&
|
|
7730
|
+
const E = (j) => {
|
|
7731
|
+
const { usage: f } = j || {};
|
|
7732
|
+
!l && f && g(f), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
7684
7733
|
};
|
|
7685
7734
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7686
7735
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7700,12 +7749,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7700
7749
|
{
|
|
7701
7750
|
ref: x,
|
|
7702
7751
|
value: i,
|
|
7703
|
-
onChange: (
|
|
7752
|
+
onChange: (j) => c(j.target.value),
|
|
7704
7753
|
placeholder: n("Ask AI to edit content"),
|
|
7705
7754
|
className: "w-full",
|
|
7706
7755
|
rows: 3,
|
|
7707
|
-
onKeyDown: (
|
|
7708
|
-
|
|
7756
|
+
onKeyDown: (j) => {
|
|
7757
|
+
j.key === "Enter" && (j.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
|
|
7709
7758
|
}
|
|
7710
7759
|
}
|
|
7711
7760
|
),
|
|
@@ -7747,8 +7796,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7747
7796
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7748
7797
|
QuickPrompts,
|
|
7749
7798
|
{
|
|
7750
|
-
onClick: (
|
|
7751
|
-
m.current && clearTimeout(m.current), g(void 0), r("content", o,
|
|
7799
|
+
onClick: (j) => {
|
|
7800
|
+
m.current && clearTimeout(m.current), g(void 0), r("content", o, j, E);
|
|
7752
7801
|
}
|
|
7753
7802
|
}
|
|
7754
7803
|
)
|
|
@@ -7769,8 +7818,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7769
7818
|
description: o("You can now Ask AI to edit your content"),
|
|
7770
7819
|
variant: "default"
|
|
7771
7820
|
}), m.current.click();
|
|
7772
|
-
} catch (
|
|
7773
|
-
p(
|
|
7821
|
+
} catch (j) {
|
|
7822
|
+
p(j);
|
|
7774
7823
|
} finally {
|
|
7775
7824
|
d(!1);
|
|
7776
7825
|
}
|
|
@@ -7778,8 +7827,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7778
7827
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7779
7828
|
Accordion,
|
|
7780
7829
|
{
|
|
7781
|
-
onValueChange: (
|
|
7782
|
-
g(
|
|
7830
|
+
onValueChange: (j) => {
|
|
7831
|
+
g(j !== "");
|
|
7783
7832
|
},
|
|
7784
7833
|
type: "single",
|
|
7785
7834
|
collapsible: !0,
|
|
@@ -7791,12 +7840,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7791
7840
|
{
|
|
7792
7841
|
ref: l,
|
|
7793
7842
|
value: r,
|
|
7794
|
-
onChange: (
|
|
7843
|
+
onChange: (j) => a(j.target.value),
|
|
7795
7844
|
placeholder: o("Tell about this page eg this page is about"),
|
|
7796
7845
|
className: "mt-1 w-full",
|
|
7797
7846
|
rows: 10,
|
|
7798
|
-
onKeyDown: (
|
|
7799
|
-
|
|
7847
|
+
onKeyDown: (j) => {
|
|
7848
|
+
j.key === "Enter" && (j.preventDefault(), E());
|
|
7800
7849
|
}
|
|
7801
7850
|
}
|
|
7802
7851
|
),
|
|
@@ -7858,42 +7907,42 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7858
7907
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7859
7908
|
] });
|
|
7860
7909
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7861
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null),
|
|
7910
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), j = useRef(null);
|
|
7862
7911
|
useEffect(() => {
|
|
7863
7912
|
l(n);
|
|
7864
7913
|
}, [n]);
|
|
7865
|
-
const
|
|
7914
|
+
const f = () => {
|
|
7866
7915
|
if (i.startsWith("@")) {
|
|
7867
7916
|
m("Attribute keys cannot start with '@'");
|
|
7868
7917
|
return;
|
|
7869
7918
|
}
|
|
7870
7919
|
if (i) {
|
|
7871
|
-
const
|
|
7872
|
-
r(
|
|
7920
|
+
const w = [...a, { key: i, value: d }];
|
|
7921
|
+
r(w), l(a), c(""), u(""), m("");
|
|
7873
7922
|
}
|
|
7874
|
-
},
|
|
7875
|
-
const
|
|
7876
|
-
r(
|
|
7877
|
-
},
|
|
7878
|
-
g(
|
|
7923
|
+
}, _ = (w) => {
|
|
7924
|
+
const A = a.filter((N, D) => D !== w);
|
|
7925
|
+
r(A), l(A);
|
|
7926
|
+
}, v = (w) => {
|
|
7927
|
+
g(w), c(a[w].key), u(a[w].value);
|
|
7879
7928
|
}, S = () => {
|
|
7880
7929
|
if (i.startsWith("@")) {
|
|
7881
7930
|
m("Attribute keys cannot start with '@'");
|
|
7882
7931
|
return;
|
|
7883
7932
|
}
|
|
7884
7933
|
if (p !== null && i) {
|
|
7885
|
-
const
|
|
7886
|
-
|
|
7934
|
+
const w = [...a];
|
|
7935
|
+
w[p] = { key: i, value: d }, r(w), l(w), g(null), c(""), u(""), m("");
|
|
7887
7936
|
}
|
|
7888
|
-
}, B = (
|
|
7889
|
-
|
|
7937
|
+
}, B = (w) => {
|
|
7938
|
+
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? S() : f());
|
|
7890
7939
|
};
|
|
7891
7940
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
7892
7941
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7893
7942
|
"form",
|
|
7894
7943
|
{
|
|
7895
|
-
onSubmit: (
|
|
7896
|
-
|
|
7944
|
+
onSubmit: (w) => {
|
|
7945
|
+
w.preventDefault(), p !== null ? S() : f();
|
|
7897
7946
|
},
|
|
7898
7947
|
className: "space-y-3",
|
|
7899
7948
|
children: [
|
|
@@ -7909,7 +7958,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7909
7958
|
id: "attrKey",
|
|
7910
7959
|
ref: E,
|
|
7911
7960
|
value: i,
|
|
7912
|
-
onChange: (
|
|
7961
|
+
onChange: (w) => c(w.target.value),
|
|
7913
7962
|
placeholder: "Key",
|
|
7914
7963
|
className: "h-8 text-sm"
|
|
7915
7964
|
}
|
|
@@ -7925,9 +7974,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7925
7974
|
spellCheck: "false",
|
|
7926
7975
|
id: "attrValue",
|
|
7927
7976
|
rows: 2,
|
|
7928
|
-
ref:
|
|
7977
|
+
ref: j,
|
|
7929
7978
|
value: d,
|
|
7930
|
-
onChange: (
|
|
7979
|
+
onChange: (w) => u(w.target.value),
|
|
7931
7980
|
onKeyDown: B,
|
|
7932
7981
|
placeholder: "Value",
|
|
7933
7982
|
className: "bg-background text-sm"
|
|
@@ -7940,22 +7989,22 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7940
7989
|
]
|
|
7941
7990
|
}
|
|
7942
7991
|
),
|
|
7943
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
7992
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
7944
7993
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
7945
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
7946
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
7994
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
|
|
7995
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
|
|
7947
7996
|
] }),
|
|
7948
7997
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
7949
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A
|
|
7998
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
|
|
7950
7999
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
7951
8000
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
7952
8001
|
] }),
|
|
7953
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8002
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
|
|
7954
8003
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
7955
8004
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
7956
8005
|
] })
|
|
7957
8006
|
] })
|
|
7958
|
-
] },
|
|
8007
|
+
] }, A)) })
|
|
7959
8008
|
] });
|
|
7960
8009
|
}), BlockAttributesEditor = React.memo(() => {
|
|
7961
8010
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8140,6 +8189,222 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8140
8189
|
] })
|
|
8141
8190
|
] })
|
|
8142
8191
|
] }) });
|
|
8192
|
+
}, LANGUAGES = {
|
|
8193
|
+
ab: "Abkhazian",
|
|
8194
|
+
aa: "Afar",
|
|
8195
|
+
af: "Afrikaans",
|
|
8196
|
+
ak: "Akan",
|
|
8197
|
+
sq: "Albanian",
|
|
8198
|
+
am: "Amharic",
|
|
8199
|
+
ar: "Arabic",
|
|
8200
|
+
an: "Aragonese",
|
|
8201
|
+
hy: "Armenian",
|
|
8202
|
+
as: "Assamese",
|
|
8203
|
+
av: "Avaric",
|
|
8204
|
+
ae: "Avestan",
|
|
8205
|
+
ay: "Aymara",
|
|
8206
|
+
az: "Azerbaijani",
|
|
8207
|
+
bm: "Bambara",
|
|
8208
|
+
ba: "Bashkir",
|
|
8209
|
+
eu: "Basque",
|
|
8210
|
+
be: "Belarusian",
|
|
8211
|
+
bn: "Bengali",
|
|
8212
|
+
bh: "Bihari",
|
|
8213
|
+
bi: "Bislama",
|
|
8214
|
+
bs: "Bosnian",
|
|
8215
|
+
br: "Breton",
|
|
8216
|
+
bg: "Bulgarian",
|
|
8217
|
+
my: "Burmese",
|
|
8218
|
+
ca: "Catalan",
|
|
8219
|
+
ch: "Chamorro",
|
|
8220
|
+
ce: "Chechen",
|
|
8221
|
+
ny: "Chichewa",
|
|
8222
|
+
zh: "Chinese",
|
|
8223
|
+
"zh-Hans": "Chinese (Simplified)",
|
|
8224
|
+
"zh-Hant": "Chinese (Traditional)",
|
|
8225
|
+
cv: "Chuvash",
|
|
8226
|
+
kw: "Cornish",
|
|
8227
|
+
co: "Corsican",
|
|
8228
|
+
cr: "Cree",
|
|
8229
|
+
hr: "Croatian",
|
|
8230
|
+
cs: "Czech",
|
|
8231
|
+
da: "Danish",
|
|
8232
|
+
dv: "Maldivian",
|
|
8233
|
+
nl: "Dutch",
|
|
8234
|
+
dz: "Dzongkha",
|
|
8235
|
+
en: "English",
|
|
8236
|
+
eo: "Esperanto",
|
|
8237
|
+
et: "Estonian",
|
|
8238
|
+
ee: "Ewe",
|
|
8239
|
+
fo: "Faroese",
|
|
8240
|
+
fj: "Fijian",
|
|
8241
|
+
fi: "Finnish",
|
|
8242
|
+
fr: "French",
|
|
8243
|
+
ff: "Fula, Pular",
|
|
8244
|
+
gl: "Galician",
|
|
8245
|
+
gd: "Gaelic (Scottish)",
|
|
8246
|
+
gv: "Manx",
|
|
8247
|
+
ka: "Georgian",
|
|
8248
|
+
de: "German",
|
|
8249
|
+
el: "Greek",
|
|
8250
|
+
kl: "Kalaallisut",
|
|
8251
|
+
gn: "Guarani",
|
|
8252
|
+
gu: "Gujarati",
|
|
8253
|
+
ht: "Haitian Creole",
|
|
8254
|
+
ha: "Hausa",
|
|
8255
|
+
he: "Hebrew",
|
|
8256
|
+
hz: "Herero",
|
|
8257
|
+
hi: "Hindi",
|
|
8258
|
+
ho: "Hiri Motu",
|
|
8259
|
+
hu: "Hungarian",
|
|
8260
|
+
is: "Icelandic",
|
|
8261
|
+
io: "Ido",
|
|
8262
|
+
ig: "Igbo",
|
|
8263
|
+
id: "Indonesian",
|
|
8264
|
+
ia: "Interlingua",
|
|
8265
|
+
ie: "Interlingue",
|
|
8266
|
+
iu: "Inuktitut",
|
|
8267
|
+
ik: "Inupiak",
|
|
8268
|
+
ga: "Irish",
|
|
8269
|
+
it: "Italian",
|
|
8270
|
+
ja: "Japanese",
|
|
8271
|
+
jv: "Javanese",
|
|
8272
|
+
kn: "Kannada",
|
|
8273
|
+
kr: "Kanuri",
|
|
8274
|
+
ks: "Kashmiri",
|
|
8275
|
+
kk: "Kazakh",
|
|
8276
|
+
km: "Khmer",
|
|
8277
|
+
ki: "Kikuyu",
|
|
8278
|
+
rw: "Kinyarwanda",
|
|
8279
|
+
rn: "Kirundi",
|
|
8280
|
+
ky: "Kyrgyz",
|
|
8281
|
+
kv: "Komi",
|
|
8282
|
+
kg: "Kongo",
|
|
8283
|
+
ko: "Korean",
|
|
8284
|
+
ku: "Kurdish",
|
|
8285
|
+
kj: "Kwanyama",
|
|
8286
|
+
lo: "Lao",
|
|
8287
|
+
la: "Latin",
|
|
8288
|
+
lv: "Latvian",
|
|
8289
|
+
li: "Limburgish",
|
|
8290
|
+
ln: "Lingala",
|
|
8291
|
+
lt: "Lithuanian",
|
|
8292
|
+
lu: "Luga-Katanga",
|
|
8293
|
+
lg: "Luganda, Ganda",
|
|
8294
|
+
lb: "Luxembourgish",
|
|
8295
|
+
mk: "Macedonian",
|
|
8296
|
+
mg: "Malagasy",
|
|
8297
|
+
ms: "Malay",
|
|
8298
|
+
ml: "Malayalam",
|
|
8299
|
+
mt: "Maltese",
|
|
8300
|
+
mi: "Maori",
|
|
8301
|
+
mr: "Marathi",
|
|
8302
|
+
mh: "Marshallese",
|
|
8303
|
+
mo: "Moldavian",
|
|
8304
|
+
mn: "Mongolian",
|
|
8305
|
+
na: "Nauru",
|
|
8306
|
+
nv: "Navajo",
|
|
8307
|
+
ng: "Ndonga",
|
|
8308
|
+
nd: "Northern Ndebele",
|
|
8309
|
+
ne: "Nepali",
|
|
8310
|
+
no: "Norwegian",
|
|
8311
|
+
nb: "Norwegian bokmål",
|
|
8312
|
+
nn: "Norwegian nynorsk",
|
|
8313
|
+
ii: "Sichuan Yi",
|
|
8314
|
+
oc: "Occitan",
|
|
8315
|
+
oj: "Ojibwe",
|
|
8316
|
+
cu: "Old Church Slavonic",
|
|
8317
|
+
or: "Oriya",
|
|
8318
|
+
om: "Oromo",
|
|
8319
|
+
os: "Ossetian",
|
|
8320
|
+
pi: "Pāli",
|
|
8321
|
+
ps: "Pashto, Pushto",
|
|
8322
|
+
fa: "Persian (Farsi)",
|
|
8323
|
+
pl: "Polish",
|
|
8324
|
+
pt: "Portuguese",
|
|
8325
|
+
pa: "Punjabi (Eastern)",
|
|
8326
|
+
qu: "Quechua",
|
|
8327
|
+
rm: "Romansh",
|
|
8328
|
+
ro: "Romanian",
|
|
8329
|
+
ru: "Russian",
|
|
8330
|
+
se: "Sami",
|
|
8331
|
+
sm: "Samoan",
|
|
8332
|
+
sg: "Sango",
|
|
8333
|
+
sa: "Sanskrit",
|
|
8334
|
+
sr: "Serbian",
|
|
8335
|
+
sh: "Serbo-Croatian",
|
|
8336
|
+
st: "Sesotho",
|
|
8337
|
+
tn: "Setswana",
|
|
8338
|
+
sn: "Shona",
|
|
8339
|
+
sd: "Sindhi",
|
|
8340
|
+
si: "Sinhalese",
|
|
8341
|
+
ss: "Swati",
|
|
8342
|
+
sk: "Slovak",
|
|
8343
|
+
sl: "Slovenian",
|
|
8344
|
+
so: "Somali",
|
|
8345
|
+
nr: "Southern Ndebele",
|
|
8346
|
+
es: "Spanish",
|
|
8347
|
+
su: "Sundanese",
|
|
8348
|
+
sw: "Swahili (Kiswahili)",
|
|
8349
|
+
sv: "Swedish",
|
|
8350
|
+
tl: "Tagalog",
|
|
8351
|
+
ty: "Tahitian",
|
|
8352
|
+
tg: "Tajik",
|
|
8353
|
+
ta: "Tamil",
|
|
8354
|
+
tt: "Tatar",
|
|
8355
|
+
te: "Telugu",
|
|
8356
|
+
th: "Thai",
|
|
8357
|
+
bo: "Tibetan",
|
|
8358
|
+
ti: "Tigrinya",
|
|
8359
|
+
to: "Tonga",
|
|
8360
|
+
ts: "Tsonga",
|
|
8361
|
+
tr: "Turkish",
|
|
8362
|
+
tk: "Turkmen",
|
|
8363
|
+
tw: "Twi",
|
|
8364
|
+
ug: "Uyghur",
|
|
8365
|
+
uk: "Ukrainian",
|
|
8366
|
+
ur: "Urdu",
|
|
8367
|
+
uz: "Uzbek",
|
|
8368
|
+
ve: "Venda",
|
|
8369
|
+
vi: "Vietnamese",
|
|
8370
|
+
vo: "Volapük",
|
|
8371
|
+
wa: "Wallon",
|
|
8372
|
+
cy: "Welsh",
|
|
8373
|
+
wo: "Wolof",
|
|
8374
|
+
fy: "Western Frisian",
|
|
8375
|
+
xh: "Xhosa",
|
|
8376
|
+
yi: "Yiddish",
|
|
8377
|
+
yo: "Yoruba",
|
|
8378
|
+
za: "Zhuang, Chuang",
|
|
8379
|
+
zu: "Zulu"
|
|
8380
|
+
}, LanguageSelector = () => {
|
|
8381
|
+
const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
|
|
8382
|
+
const c = [];
|
|
8383
|
+
return forEach(uniq([...n, o]), (d) => {
|
|
8384
|
+
const u = get(LANGUAGES, d);
|
|
8385
|
+
u && c.push({ key: d, value: u, default: d === o });
|
|
8386
|
+
}), c;
|
|
8387
|
+
}, [o, n]);
|
|
8388
|
+
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm", children: [
|
|
8389
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
|
|
8390
|
+
get(LANGUAGES, l),
|
|
8391
|
+
l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
|
|
8392
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
8393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "outline", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
|
|
8394
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
|
|
8395
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-end", children: [
|
|
8396
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8397
|
+
" ",
|
|
8398
|
+
get(LANGUAGES, l)
|
|
8399
|
+
] }),
|
|
8400
|
+
l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-gray-400", children: "Default" })
|
|
8401
|
+
] })
|
|
8402
|
+
] }) }),
|
|
8403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-end", onClick: () => a(c.key), children: [
|
|
8404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c.value }),
|
|
8405
|
+
c.key === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
|
|
8406
|
+
] })) })
|
|
8407
|
+
] });
|
|
8143
8408
|
}, CanvasTopBar = () => {
|
|
8144
8409
|
const o = useBuilderProp("darkMode", !0), [n] = useCanvasZoom();
|
|
8145
8410
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2", children: [
|
|
@@ -8161,7 +8426,10 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8161
8426
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { orientation: "vertical" }),
|
|
8162
8427
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UndoRedo, {})
|
|
8163
8428
|
] }),
|
|
8164
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8429
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
|
|
8430
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LanguageSelector, {}),
|
|
8431
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {})
|
|
8432
|
+
] })
|
|
8165
8433
|
] });
|
|
8166
8434
|
};
|
|
8167
8435
|
function BlockAttributesToggle() {
|
|
@@ -8372,16 +8640,16 @@ function RemoveProviderConfirmation({
|
|
|
8372
8640
|
}
|
|
8373
8641
|
const PageDataProviders = () => {
|
|
8374
8642
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8375
|
-
filter(n, (
|
|
8643
|
+
filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
|
|
8376
8644
|
), [d, u] = useState(""), [p, g] = useState(null), x = filter(
|
|
8377
|
-
n.map((
|
|
8378
|
-
(
|
|
8379
|
-
), m = (
|
|
8380
|
-
const
|
|
8381
|
-
c((
|
|
8382
|
-
}, E = (
|
|
8383
|
-
c((
|
|
8384
|
-
},
|
|
8645
|
+
n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
|
|
8646
|
+
(f) => !isNull(f)
|
|
8647
|
+
), m = (f) => {
|
|
8648
|
+
const _ = find(n, { providerKey: f });
|
|
8649
|
+
c((v) => [...v, _]), a((v) => [...v, { providerKey: _.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8650
|
+
}, E = (f) => {
|
|
8651
|
+
c((_) => filter(_, (v) => v.providerKey !== f.providerKey)), a((_) => filter(_, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
|
|
8652
|
+
}, j = (f) => g(f);
|
|
8385
8653
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8386
8654
|
o("no_data_providers"),
|
|
8387
8655
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8389,11 +8657,11 @@ const PageDataProviders = () => {
|
|
|
8389
8657
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
|
|
8390
8658
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8391
8659
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
|
|
8392
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (
|
|
8660
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) => m(f), children: [
|
|
8393
8661
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
|
|
8394
8662
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8395
8663
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
|
|
8396
|
-
x.map((
|
|
8664
|
+
x.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: f.value, children: f.label }, f.value))
|
|
8397
8665
|
] })
|
|
8398
8666
|
] }) }),
|
|
8399
8667
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8402,21 +8670,21 @@ const PageDataProviders = () => {
|
|
|
8402
8670
|
o("page_data_providers"),
|
|
8403
8671
|
":"
|
|
8404
8672
|
] }),
|
|
8405
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((
|
|
8673
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8406
8674
|
"div",
|
|
8407
8675
|
{
|
|
8408
8676
|
className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
|
|
8409
8677
|
"data-v0-t": "card",
|
|
8410
8678
|
children: [
|
|
8411
8679
|
/* @__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: [
|
|
8412
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children:
|
|
8413
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children:
|
|
8680
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: f.name }),
|
|
8681
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: f.description })
|
|
8414
8682
|
] }) }) }),
|
|
8415
8683
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
8416
8684
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8417
8685
|
"button",
|
|
8418
8686
|
{
|
|
8419
|
-
onClick: () => f
|
|
8687
|
+
onClick: () => j(f),
|
|
8420
8688
|
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",
|
|
8421
8689
|
children: [
|
|
8422
8690
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8442,7 +8710,7 @@ const PageDataProviders = () => {
|
|
|
8442
8710
|
]
|
|
8443
8711
|
}
|
|
8444
8712
|
),
|
|
8445
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(
|
|
8713
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(f), name: f.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
|
|
8446
8714
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8447
8715
|
"svg",
|
|
8448
8716
|
{
|
|
@@ -8468,7 +8736,7 @@ const PageDataProviders = () => {
|
|
|
8468
8736
|
] })
|
|
8469
8737
|
]
|
|
8470
8738
|
},
|
|
8471
|
-
|
|
8739
|
+
f.providerKey
|
|
8472
8740
|
)) }),
|
|
8473
8741
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
|
|
8474
8742
|
] })
|
|
@@ -8477,7 +8745,7 @@ const PageDataProviders = () => {
|
|
|
8477
8745
|
function AiFillDatabase(o) {
|
|
8478
8746
|
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);
|
|
8479
8747
|
}
|
|
8480
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8748
|
+
const TopBar = lazy(() => import("./Topbar-Uk6diO3g.js"));
|
|
8481
8749
|
function useSidebarMenuItems(o) {
|
|
8482
8750
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8483
8751
|
return useMemo(() => {
|
|
@@ -8637,7 +8905,7 @@ const RootLayout = () => {
|
|
|
8637
8905
|
}, [o]), useEffect(() => {
|
|
8638
8906
|
builderStore.set(dataProvidersAtom, o.dataProviders || []);
|
|
8639
8907
|
}, [o.dataProviders]), useEffect(() => {
|
|
8640
|
-
n(
|
|
8908
|
+
n(o.blocks || []), a();
|
|
8641
8909
|
}, [o.blocks]), useEffect(() => {
|
|
8642
8910
|
i18n.changeLanguage(o.locale || "en");
|
|
8643
8911
|
}, [o.locale]), useEffect(() => {
|
|
@@ -8697,8 +8965,9 @@ export {
|
|
|
8697
8965
|
useSelectedBlocksDisplayChild as a4,
|
|
8698
8966
|
useSelectedBreakpoints as a5,
|
|
8699
8967
|
useSelectedStylingBlocks as a6,
|
|
8700
|
-
|
|
8701
|
-
|
|
8968
|
+
useLanguages as a7,
|
|
8969
|
+
useLayoutVariant as a8,
|
|
8970
|
+
useBlocksStoreUndoableActions as a9,
|
|
8702
8971
|
useUpdateBlocksProps as b,
|
|
8703
8972
|
useUpdateBlocksPropsRealtime as c,
|
|
8704
8973
|
useBuilderProp as d,
|