@chaibuilder/sdk 1.2.103 → 1.2.105
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-NKqXoCPq.js → CodeEditor--uDNh1j6.js} +4 -5
- package/dist/CodeEditor-fWamdupk.cjs +1 -0
- package/dist/Topbar-1g4Mt9NG.cjs +1 -0
- package/dist/{Topbar-yEANMgiO.js → Topbar-XywrZPU2.js} +13 -14
- package/dist/{UnsplashImages-Z3xcNddA.js → UnsplashImages-DiPQWWzq.js} +4 -5
- package/dist/UnsplashImages-iO54sLUO.cjs +1 -0
- package/dist/{UploadImages-v50EQZLT.js → UploadImages-DXkjWO-U.js} +10 -11
- package/dist/UploadImages-qJllyNz6.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +73 -74
- package/dist/{index-aV4x9E1G.js → index-L91MgWqb.js} +551 -535
- package/dist/index-q9BQUIW_.cjs +63 -0
- package/dist/plugin-UiUFs2fK.js +44 -0
- package/dist/plugin-f6SDZ_Or.js +108 -0
- package/dist/plugin-jum1MjXp.cjs +1 -0
- package/dist/plugin-xOpS-UNV.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -2
- package/dist/render.js +77 -89
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +5 -9
- package/dist/tailwind.js +5 -17
- package/package.json +2 -2
- package/dist/CodeEditor-x97t1x8H.cjs +0 -1
- package/dist/Topbar-76FfrmEx.cjs +0 -1
- package/dist/UnsplashImages-LpHbt_-q.cjs +0 -1
- package/dist/UploadImages-PYkTPdPr.cjs +0 -1
- package/dist/index-K9hzPq-7.cjs +0 -63
- package/dist/plugin-3Y9Uv3RT.cjs +0 -1
- package/dist/plugin-KIpT3NWi.cjs +0 -1
- package/dist/plugin-LKCHtO27.js +0 -43
- package/dist/plugin-ooqqxWRQ.js +0 -55
|
@@ -10,7 +10,7 @@ import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, u
|
|
|
10
10
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
|
|
11
11
|
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
12
12
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
13
|
-
import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-
|
|
13
|
+
import { g as getDefaultExportFromCjs, s, p as plugin } from "./plugin-f6SDZ_Or.js";
|
|
14
14
|
import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
|
|
15
15
|
import TreeModel from "tree-model";
|
|
16
16
|
import ReactQuill, { Quill } from "react-quill";
|
|
@@ -19,12 +19,11 @@ import { useFeature, FlagsProvider } from "flagged";
|
|
|
19
19
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
20
20
|
import { flip } from "@floating-ui/dom";
|
|
21
21
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
22
|
-
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon,
|
|
22
|
+
import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ChevronDownIcon, 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";
|
|
26
26
|
import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
27
|
-
import getPalette from "tailwindcss-palette-generator";
|
|
28
27
|
import { twMerge } from "tailwind-merge";
|
|
29
28
|
import { Provider } from "react-wrap-balancer";
|
|
30
29
|
import ReactDOM from "react-dom";
|
|
@@ -34,7 +33,7 @@ import { Resizable } from "re-resizable";
|
|
|
34
33
|
import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
|
|
35
34
|
import validator from "@rjsf/validator-ajv8";
|
|
36
35
|
import Form from "@rjsf/core";
|
|
37
|
-
import { y, s, h } from "./controls-lEwMTdPQ.js";
|
|
36
|
+
import { y, s as s$1, h } from "./controls-lEwMTdPQ.js";
|
|
38
37
|
import { Tree } from "react-arborist";
|
|
39
38
|
import { parse, stringify } from "himalaya";
|
|
40
39
|
import IconPicker, { IconPickerItem } from "react-icons-picker";
|
|
@@ -90,101 +89,101 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
90
89
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
91
90
|
let a, l, i;
|
|
92
91
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
93
|
-
const c = (
|
|
94
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
95
|
-
const C = o.get(
|
|
96
|
-
if (o.set(
|
|
97
|
-
const R = "v" in
|
|
92
|
+
const c = (b) => o.get(b), d = (b, _) => {
|
|
93
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
|
|
94
|
+
const C = o.get(b);
|
|
95
|
+
if (o.set(b, _), r.has(b) || r.set(b, C), C && hasPromiseAtomValue(C)) {
|
|
96
|
+
const R = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
|
|
98
97
|
cancelPromise(C.v, R);
|
|
99
98
|
}
|
|
100
|
-
}, u = (
|
|
99
|
+
}, u = (b, _, C) => {
|
|
101
100
|
const R = /* @__PURE__ */ new Map();
|
|
102
101
|
let I = !1;
|
|
103
102
|
C.forEach((L, P) => {
|
|
104
|
-
!L && P ===
|
|
105
|
-
}), (I ||
|
|
106
|
-
}, p = (
|
|
107
|
-
const R = c(
|
|
103
|
+
!L && P === b && (L = _), L ? (R.set(P, L), _.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
104
|
+
}), (I || _.d.size !== R.size) && (_.d = R);
|
|
105
|
+
}, p = (b, _, C) => {
|
|
106
|
+
const R = c(b), I = {
|
|
108
107
|
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
109
|
-
v:
|
|
108
|
+
v: _
|
|
110
109
|
};
|
|
111
|
-
if (C && u(
|
|
110
|
+
if (C && u(b, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
|
|
112
111
|
return R;
|
|
113
112
|
if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
|
|
114
113
|
if (R.d === I.d)
|
|
115
114
|
return R;
|
|
116
115
|
I.v = R.v;
|
|
117
116
|
}
|
|
118
|
-
return d(
|
|
119
|
-
}, m = (
|
|
120
|
-
if (isPromiseLike$2(
|
|
117
|
+
return d(b, I), I;
|
|
118
|
+
}, m = (b, _, C, R) => {
|
|
119
|
+
if (isPromiseLike$2(_)) {
|
|
121
120
|
let I;
|
|
122
121
|
const L = new Promise((P, V) => {
|
|
123
|
-
let
|
|
124
|
-
|
|
122
|
+
let M = !1;
|
|
123
|
+
_.then(
|
|
125
124
|
(O) => {
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
125
|
+
if (!M) {
|
|
126
|
+
M = !0;
|
|
127
|
+
const $ = c(b), H = p(
|
|
128
|
+
b,
|
|
130
129
|
L,
|
|
131
130
|
C
|
|
132
131
|
);
|
|
133
|
-
resolvePromise(L, O), P(O), (
|
|
132
|
+
resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
|
|
134
133
|
}
|
|
135
134
|
},
|
|
136
135
|
(O) => {
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
136
|
+
if (!M) {
|
|
137
|
+
M = !0;
|
|
138
|
+
const $ = c(b), H = p(
|
|
139
|
+
b,
|
|
141
140
|
L,
|
|
142
141
|
C
|
|
143
142
|
);
|
|
144
|
-
rejectPromise(L, O), V(O), (
|
|
143
|
+
rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
), I = (O) => {
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
(
|
|
147
|
+
M || (M = !0, O.then(
|
|
148
|
+
($) => resolvePromise(L, $),
|
|
149
|
+
($) => rejectPromise(L, $)
|
|
151
150
|
), P(O));
|
|
152
151
|
};
|
|
153
152
|
});
|
|
154
|
-
return L.orig =
|
|
153
|
+
return L.orig = _, L.status = "pending", registerCancelPromise(L, (P) => {
|
|
155
154
|
P && I(P), R == null || R();
|
|
156
|
-
}), p(
|
|
155
|
+
}), p(b, L, C);
|
|
157
156
|
}
|
|
158
|
-
return p(
|
|
159
|
-
}, x = (
|
|
160
|
-
const R = c(
|
|
157
|
+
return p(b, _, C);
|
|
158
|
+
}, x = (b, _, C) => {
|
|
159
|
+
const R = c(b), I = {
|
|
161
160
|
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
162
|
-
e:
|
|
161
|
+
e: _
|
|
163
162
|
};
|
|
164
|
-
return C && u(
|
|
165
|
-
}, g = (
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
O !==
|
|
169
|
-
}), Array.from(
|
|
170
|
-
const
|
|
171
|
-
return
|
|
172
|
-
|
|
163
|
+
return C && u(b, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(b, I), I);
|
|
164
|
+
}, g = (b) => {
|
|
165
|
+
const _ = c(b);
|
|
166
|
+
if (_ && (_.d.forEach((M, O) => {
|
|
167
|
+
O !== b && !n.has(O) && g(O);
|
|
168
|
+
}), Array.from(_.d).every(([M, O]) => {
|
|
169
|
+
const $ = c(M);
|
|
170
|
+
return M === b || $ === O || // TODO This is a hack, we should find a better solution.
|
|
171
|
+
$ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
|
|
173
172
|
})))
|
|
174
|
-
return
|
|
173
|
+
return _;
|
|
175
174
|
const C = /* @__PURE__ */ new Map();
|
|
176
175
|
let R = !0;
|
|
177
|
-
const I = (
|
|
178
|
-
if (
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
return C.set(
|
|
182
|
-
if (hasInitialValue(
|
|
183
|
-
return C.set(
|
|
176
|
+
const I = (M) => {
|
|
177
|
+
if (M === b) {
|
|
178
|
+
const $ = c(M);
|
|
179
|
+
if ($)
|
|
180
|
+
return C.set(M, $), returnAtomValue($);
|
|
181
|
+
if (hasInitialValue(M))
|
|
182
|
+
return C.set(M, void 0), M.init;
|
|
184
183
|
throw new Error("no atom init");
|
|
185
184
|
}
|
|
186
|
-
const O = g(
|
|
187
|
-
return C.set(
|
|
185
|
+
const O = g(M);
|
|
186
|
+
return C.set(M, O), returnAtomValue(O);
|
|
188
187
|
};
|
|
189
188
|
let L, P;
|
|
190
189
|
const V = {
|
|
@@ -192,147 +191,147 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
192
191
|
return L || (L = new AbortController()), L.signal;
|
|
193
192
|
},
|
|
194
193
|
get setSelf() {
|
|
195
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
194
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...M) => {
|
|
196
195
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
|
|
197
|
-
return B(
|
|
196
|
+
return B(b, ...M);
|
|
198
197
|
}), P;
|
|
199
198
|
}
|
|
200
199
|
};
|
|
201
200
|
try {
|
|
202
|
-
const
|
|
201
|
+
const M = b.read(I, V);
|
|
203
202
|
return m(
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
b,
|
|
204
|
+
M,
|
|
206
205
|
C,
|
|
207
206
|
() => L == null ? void 0 : L.abort()
|
|
208
207
|
);
|
|
209
|
-
} catch (
|
|
210
|
-
return x(
|
|
208
|
+
} catch (M) {
|
|
209
|
+
return x(b, M, C);
|
|
211
210
|
} finally {
|
|
212
211
|
R = !1;
|
|
213
212
|
}
|
|
214
|
-
}, E = (
|
|
215
|
-
let
|
|
216
|
-
return
|
|
217
|
-
}, f = (
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
}, v = (
|
|
221
|
-
const
|
|
213
|
+
}, E = (b) => returnAtomValue(g(b)), j = (b) => {
|
|
214
|
+
let _ = n.get(b);
|
|
215
|
+
return _ || (_ = A(b)), _;
|
|
216
|
+
}, f = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
|
|
217
|
+
const _ = n.get(b);
|
|
218
|
+
_ && f(b, _) && w(b);
|
|
219
|
+
}, v = (b) => {
|
|
220
|
+
const _ = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
|
|
222
221
|
const P = n.get(L);
|
|
223
222
|
P == null || P.t.forEach((V) => {
|
|
224
|
-
V !== L && (
|
|
223
|
+
V !== L && (_.set(
|
|
225
224
|
V,
|
|
226
|
-
(
|
|
225
|
+
(_.get(V) || /* @__PURE__ */ new Set()).add(L)
|
|
227
226
|
), C.set(V, (C.get(V) || 0) + 1), R(V));
|
|
228
227
|
});
|
|
229
228
|
};
|
|
230
|
-
R(
|
|
229
|
+
R(b);
|
|
231
230
|
const I = (L) => {
|
|
232
231
|
const P = n.get(L);
|
|
233
232
|
P == null || P.t.forEach((V) => {
|
|
234
|
-
var
|
|
233
|
+
var M;
|
|
235
234
|
if (V !== L) {
|
|
236
235
|
let O = C.get(V);
|
|
237
236
|
if (O && C.set(V, --O), !O) {
|
|
238
|
-
let
|
|
239
|
-
if (
|
|
237
|
+
let $ = !!((M = _.get(V)) != null && M.size);
|
|
238
|
+
if ($) {
|
|
240
239
|
const H = c(V), F = g(V);
|
|
241
|
-
|
|
240
|
+
$ = !H || !isEqualAtomValue(H, F);
|
|
242
241
|
}
|
|
243
|
-
|
|
242
|
+
$ || _.forEach((H) => H.delete(V));
|
|
244
243
|
}
|
|
245
244
|
I(V);
|
|
246
245
|
}
|
|
247
246
|
});
|
|
248
247
|
};
|
|
249
|
-
I(
|
|
250
|
-
}, S = (
|
|
248
|
+
I(b);
|
|
249
|
+
}, S = (b, ..._) => {
|
|
251
250
|
let C = !0;
|
|
252
251
|
const R = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
|
|
253
|
-
let
|
|
254
|
-
if (P ===
|
|
252
|
+
let M;
|
|
253
|
+
if (P === b) {
|
|
255
254
|
if (!hasInitialValue(P))
|
|
256
255
|
throw new Error("atom not writable");
|
|
257
|
-
const O = c(P),
|
|
258
|
-
(!O || !isEqualAtomValue(O,
|
|
256
|
+
const O = c(P), $ = m(P, V[0]);
|
|
257
|
+
(!O || !isEqualAtomValue(O, $)) && v(P);
|
|
259
258
|
} else
|
|
260
|
-
|
|
259
|
+
M = S(P, ...V);
|
|
261
260
|
if (!C) {
|
|
262
261
|
const O = D();
|
|
263
262
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
264
|
-
(
|
|
263
|
+
($) => $({ type: "async-write", flushed: O })
|
|
265
264
|
);
|
|
266
265
|
}
|
|
267
|
-
return
|
|
268
|
-
}, L =
|
|
266
|
+
return M;
|
|
267
|
+
}, L = b.write(R, I, ..._);
|
|
269
268
|
return C = !1, L;
|
|
270
|
-
}, B = (
|
|
271
|
-
const C = S(
|
|
269
|
+
}, B = (b, ..._) => {
|
|
270
|
+
const C = S(b, ..._), R = D();
|
|
272
271
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
273
272
|
(I) => I({ type: "write", flushed: R })
|
|
274
273
|
), C;
|
|
275
|
-
},
|
|
274
|
+
}, A = (b, _) => {
|
|
276
275
|
const C = {
|
|
277
|
-
t: new Set(
|
|
276
|
+
t: new Set(_ && [_]),
|
|
278
277
|
l: /* @__PURE__ */ new Set()
|
|
279
278
|
};
|
|
280
|
-
if (n.set(
|
|
279
|
+
if (n.set(b, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), g(b).d.forEach((R, I) => {
|
|
281
280
|
const L = n.get(I);
|
|
282
|
-
L ? L.t.add(
|
|
283
|
-
}), g(
|
|
284
|
-
const R =
|
|
281
|
+
L ? L.t.add(b) : I !== b && A(I, b);
|
|
282
|
+
}), g(b), isActuallyWritableAtom(b) && b.onMount) {
|
|
283
|
+
const R = b.onMount((...I) => B(b, ...I));
|
|
285
284
|
R && (C.u = R);
|
|
286
285
|
}
|
|
287
286
|
return C;
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
const C = (
|
|
291
|
-
C && C(), n.delete(
|
|
292
|
-
const R = c(
|
|
287
|
+
}, w = (b) => {
|
|
288
|
+
var _;
|
|
289
|
+
const C = (_ = n.get(b)) == null ? void 0 : _.u;
|
|
290
|
+
C && C(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
|
|
291
|
+
const R = c(b);
|
|
293
292
|
R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
|
|
294
|
-
if (L !==
|
|
293
|
+
if (L !== b) {
|
|
295
294
|
const P = n.get(L);
|
|
296
|
-
P && (P.t.delete(
|
|
295
|
+
P && (P.t.delete(b), f(L, P) && w(L));
|
|
297
296
|
}
|
|
298
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
299
|
-
}, N = (
|
|
300
|
-
const R = new Set(
|
|
297
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
|
|
298
|
+
}, N = (b, _, C) => {
|
|
299
|
+
const R = new Set(_.d.keys());
|
|
301
300
|
C == null || C.forEach((I, L) => {
|
|
302
301
|
if (R.has(L)) {
|
|
303
302
|
R.delete(L);
|
|
304
303
|
return;
|
|
305
304
|
}
|
|
306
305
|
const P = n.get(L);
|
|
307
|
-
P && (P.t.delete(
|
|
306
|
+
P && (P.t.delete(b), f(L, P) && w(L));
|
|
308
307
|
}), R.forEach((I) => {
|
|
309
308
|
const L = n.get(I);
|
|
310
|
-
L ? L.t.add(
|
|
309
|
+
L ? L.t.add(b) : n.has(b) && A(I, b);
|
|
311
310
|
});
|
|
312
311
|
}, D = () => {
|
|
313
|
-
let
|
|
314
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
315
|
-
const
|
|
316
|
-
r.clear(),
|
|
312
|
+
let b;
|
|
313
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
|
|
314
|
+
const _ = Array.from(r);
|
|
315
|
+
r.clear(), _.forEach(([C, R]) => {
|
|
317
316
|
const I = c(C);
|
|
318
317
|
if (I) {
|
|
319
318
|
I.d !== (R == null ? void 0 : R.d) && N(C, I, R == null ? void 0 : R.d);
|
|
320
319
|
const L = n.get(C);
|
|
321
320
|
L && !// TODO This seems pretty hacky. Hope to fix it.
|
|
322
321
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
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" &&
|
|
322
|
+
(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
323
|
} else
|
|
325
324
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
326
325
|
});
|
|
327
326
|
}
|
|
328
327
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
329
|
-
return a.forEach((
|
|
330
|
-
}, T = (
|
|
331
|
-
const C = b
|
|
332
|
-
return I.add(
|
|
328
|
+
return a.forEach((_) => _("state")), b;
|
|
329
|
+
}, T = (b, _) => {
|
|
330
|
+
const C = j(b), R = D(), I = C.l;
|
|
331
|
+
return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
|
|
333
332
|
(L) => L({ type: "sub", flushed: R })
|
|
334
333
|
)), () => {
|
|
335
|
-
I.delete(
|
|
334
|
+
I.delete(_), k(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
|
|
336
335
|
};
|
|
337
336
|
};
|
|
338
337
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -340,22 +339,22 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
340
339
|
set: B,
|
|
341
340
|
sub: T,
|
|
342
341
|
// store dev methods (these are tentative and subject to change without notice)
|
|
343
|
-
dev_subscribe_store: (
|
|
342
|
+
dev_subscribe_store: (b, _) => _ !== 2 ? (console.warn(
|
|
344
343
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
345
|
-
), a.add(
|
|
346
|
-
a.delete(
|
|
347
|
-
}) : (l.add(
|
|
348
|
-
l.delete(
|
|
344
|
+
), a.add(b), () => {
|
|
345
|
+
a.delete(b);
|
|
346
|
+
}) : (l.add(b), () => {
|
|
347
|
+
l.delete(b);
|
|
349
348
|
}),
|
|
350
349
|
dev_get_mounted_atoms: () => i.values(),
|
|
351
|
-
dev_get_atom_state: (
|
|
352
|
-
dev_get_mounted: (
|
|
353
|
-
dev_restore_atoms: (
|
|
354
|
-
for (const [C, R] of
|
|
350
|
+
dev_get_atom_state: (b) => o.get(b),
|
|
351
|
+
dev_get_mounted: (b) => n.get(b),
|
|
352
|
+
dev_restore_atoms: (b) => {
|
|
353
|
+
for (const [C, R] of b)
|
|
355
354
|
hasInitialValue(C) && (m(C, R), v(C));
|
|
356
|
-
const
|
|
355
|
+
const _ = D();
|
|
357
356
|
l.forEach(
|
|
358
|
-
(C) => C({ type: "restore", flushed:
|
|
357
|
+
(C) => C({ type: "restore", flushed: _ })
|
|
359
358
|
);
|
|
360
359
|
}
|
|
361
360
|
} : {
|
|
@@ -380,34 +379,34 @@ function splitAtom(o, n) {
|
|
|
380
379
|
return u;
|
|
381
380
|
const p = d && r.get(d), m = [], x = [];
|
|
382
381
|
return c.forEach((g, E) => {
|
|
383
|
-
const
|
|
384
|
-
x[E] =
|
|
385
|
-
const f = p && p.atomList[p.keyList.indexOf(
|
|
382
|
+
const j = n ? n(g) : E;
|
|
383
|
+
x[E] = j;
|
|
384
|
+
const f = p && p.atomList[p.keyList.indexOf(j)];
|
|
386
385
|
if (f) {
|
|
387
386
|
m[E] = f;
|
|
388
387
|
return;
|
|
389
388
|
}
|
|
390
|
-
const
|
|
391
|
-
const B = S(l),
|
|
392
|
-
if (N < 0 || N >=
|
|
393
|
-
const D = c[a(c).keyList.indexOf(
|
|
389
|
+
const k = (S) => {
|
|
390
|
+
const B = S(l), A = S(o), N = a(A, B == null ? void 0 : B.arr).keyList.indexOf(j);
|
|
391
|
+
if (N < 0 || N >= A.length) {
|
|
392
|
+
const D = c[a(c).keyList.indexOf(j)];
|
|
394
393
|
if (D)
|
|
395
394
|
return D;
|
|
396
395
|
throw new Error("splitAtom: index out of bounds for read");
|
|
397
396
|
}
|
|
398
|
-
return
|
|
399
|
-
}, v = (S, B,
|
|
400
|
-
const
|
|
397
|
+
return A[N];
|
|
398
|
+
}, v = (S, B, A) => {
|
|
399
|
+
const w = S(l), N = S(o), T = a(N, w == null ? void 0 : w.arr).keyList.indexOf(j);
|
|
401
400
|
if (T < 0 || T >= N.length)
|
|
402
401
|
throw new Error("splitAtom: index out of bounds for write");
|
|
403
|
-
const
|
|
402
|
+
const b = isFunction(A) ? A(N[T]) : A;
|
|
404
403
|
B(o, [
|
|
405
404
|
...N.slice(0, T),
|
|
406
|
-
|
|
405
|
+
b,
|
|
407
406
|
...N.slice(T + 1)
|
|
408
407
|
]);
|
|
409
408
|
};
|
|
410
|
-
m[E] = isWritable(o) ? atom(
|
|
409
|
+
m[E] = isWritable(o) ? atom(k, v) : atom(k);
|
|
411
410
|
}), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
|
|
412
411
|
}, l = atom((c) => {
|
|
413
412
|
const d = c(l), u = c(o);
|
|
@@ -1196,65 +1195,65 @@ const useBlocksStoreManager = () => {
|
|
|
1196
1195
|
updateBlocksProps: c
|
|
1197
1196
|
} = useBlocksStoreManager();
|
|
1198
1197
|
return {
|
|
1199
|
-
moveBlocks: (
|
|
1200
|
-
const v = map(
|
|
1201
|
-
const
|
|
1202
|
-
return { _id: B, oldParent:
|
|
1203
|
-
}), S = v.find(({ _id: B }) => B ===
|
|
1204
|
-
S && S.oldParent === f && S.oldPosition ===
|
|
1205
|
-
undo: () => each(v, ({ _id: B, oldParent:
|
|
1206
|
-
i([B],
|
|
1198
|
+
moveBlocks: (j, f, k) => {
|
|
1199
|
+
const v = map(j, (B) => {
|
|
1200
|
+
const w = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => w ? T._parent === w : !T._parent).map((T) => T._id).indexOf(B);
|
|
1201
|
+
return { _id: B, oldParent: w, oldPosition: D };
|
|
1202
|
+
}), S = v.find(({ _id: B }) => B === j[0]);
|
|
1203
|
+
S && S.oldParent === f && S.oldPosition === k || (i(j, f, k), o({
|
|
1204
|
+
undo: () => each(v, ({ _id: B, oldParent: A, oldPosition: w }) => {
|
|
1205
|
+
i([B], A, w);
|
|
1207
1206
|
}),
|
|
1208
|
-
redo: () => i(
|
|
1207
|
+
redo: () => i(j, f, k)
|
|
1209
1208
|
}));
|
|
1210
1209
|
},
|
|
1211
|
-
addBlocks: (
|
|
1212
|
-
a(
|
|
1213
|
-
undo: () => l(map(
|
|
1214
|
-
redo: () => a(
|
|
1210
|
+
addBlocks: (j, f, k) => {
|
|
1211
|
+
a(j, f, k), o({
|
|
1212
|
+
undo: () => l(map(j, "_id")),
|
|
1213
|
+
redo: () => a(j, f, k)
|
|
1215
1214
|
});
|
|
1216
1215
|
},
|
|
1217
|
-
removeBlocks: (
|
|
1216
|
+
removeBlocks: (j) => {
|
|
1218
1217
|
var S;
|
|
1219
|
-
const f = (S = first(
|
|
1220
|
-
l(map(
|
|
1221
|
-
undo: () => a(
|
|
1222
|
-
redo: () => l(map(
|
|
1218
|
+
const f = (S = first(j)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(j));
|
|
1219
|
+
l(map(j, "_id")), o({
|
|
1220
|
+
undo: () => a(j, f, v),
|
|
1221
|
+
redo: () => l(map(j, "_id"))
|
|
1223
1222
|
});
|
|
1224
1223
|
},
|
|
1225
|
-
updateBlocks: (
|
|
1224
|
+
updateBlocks: (j, f, k) => {
|
|
1226
1225
|
let v = [];
|
|
1227
|
-
if (
|
|
1228
|
-
v = map(
|
|
1226
|
+
if (k)
|
|
1227
|
+
v = map(j, (S) => ({ _id: S, ...k }));
|
|
1229
1228
|
else {
|
|
1230
1229
|
const S = keys(f);
|
|
1231
|
-
v = map(
|
|
1232
|
-
const
|
|
1233
|
-
return each(S, (N) =>
|
|
1230
|
+
v = map(j, (B) => {
|
|
1231
|
+
const A = n.find((N) => N._id === B), w = { _id: B };
|
|
1232
|
+
return each(S, (N) => w[N] = A[N]), w;
|
|
1234
1233
|
});
|
|
1235
1234
|
}
|
|
1236
|
-
c(map(
|
|
1235
|
+
c(map(j, (S) => ({ _id: S, ...f }))), o({
|
|
1237
1236
|
undo: () => c(v),
|
|
1238
|
-
redo: () => c(map(
|
|
1237
|
+
redo: () => c(map(j, (S) => ({ _id: S, ...f })))
|
|
1239
1238
|
});
|
|
1240
1239
|
},
|
|
1241
|
-
updateBlocksRuntime: (
|
|
1242
|
-
c(map(
|
|
1240
|
+
updateBlocksRuntime: (j, f) => {
|
|
1241
|
+
c(map(j, (k) => ({ _id: k, ...f })));
|
|
1243
1242
|
},
|
|
1244
|
-
setNewBlocks: (
|
|
1245
|
-
r(
|
|
1243
|
+
setNewBlocks: (j) => {
|
|
1244
|
+
r(j), o({
|
|
1246
1245
|
undo: () => r(n),
|
|
1247
|
-
redo: () => r(
|
|
1246
|
+
redo: () => r(j)
|
|
1248
1247
|
});
|
|
1249
1248
|
},
|
|
1250
|
-
updateMultipleBlocksProps: (
|
|
1249
|
+
updateMultipleBlocksProps: (j) => {
|
|
1251
1250
|
let f = [];
|
|
1252
|
-
f = map(
|
|
1253
|
-
const v = keys(
|
|
1254
|
-
return each(v, (
|
|
1255
|
-
}), c(
|
|
1251
|
+
f = map(j, (k) => {
|
|
1252
|
+
const v = keys(k), S = n.find((A) => A._id === k._id), B = {};
|
|
1253
|
+
return each(v, (A) => B[A] = S[A]), B;
|
|
1254
|
+
}), c(j), o({
|
|
1256
1255
|
undo: () => c(f),
|
|
1257
|
-
redo: () => c(
|
|
1256
|
+
redo: () => c(j)
|
|
1258
1257
|
});
|
|
1259
1258
|
}
|
|
1260
1259
|
};
|
|
@@ -1263,11 +1262,11 @@ const useBlocksStoreManager = () => {
|
|
|
1263
1262
|
(i, c, d) => {
|
|
1264
1263
|
var g;
|
|
1265
1264
|
for (let E = 0; E < i.length; E++) {
|
|
1266
|
-
const { _id:
|
|
1265
|
+
const { _id: j } = i[E];
|
|
1267
1266
|
i[E]._id = generateUUID();
|
|
1268
|
-
const f = filter(i, { _parent:
|
|
1269
|
-
for (let
|
|
1270
|
-
f[
|
|
1267
|
+
const f = filter(i, { _parent: j });
|
|
1268
|
+
for (let k = 0; k < f.length; k++)
|
|
1269
|
+
f[k]._parent = i[E]._id;
|
|
1271
1270
|
}
|
|
1272
1271
|
const u = first(i);
|
|
1273
1272
|
let p, m;
|
|
@@ -1278,13 +1277,13 @@ const useBlocksStoreManager = () => {
|
|
|
1278
1277
|
return { addCoreBlock: useCallback(
|
|
1279
1278
|
(i, c, d) => {
|
|
1280
1279
|
if (has(i, "blocks")) {
|
|
1281
|
-
const
|
|
1282
|
-
return a(
|
|
1280
|
+
const k = i.blocks;
|
|
1281
|
+
return a(k, c, d);
|
|
1283
1282
|
}
|
|
1284
1283
|
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1285
|
-
forIn(p, (
|
|
1286
|
-
if (startsWith(
|
|
1287
|
-
const S =
|
|
1284
|
+
forIn(p, (k, v) => {
|
|
1285
|
+
if (startsWith(k, SLOT_KEY)) {
|
|
1286
|
+
const S = k.replace(SLOT_KEY, "");
|
|
1288
1287
|
m.push({
|
|
1289
1288
|
_id: S,
|
|
1290
1289
|
_type: "Slot",
|
|
@@ -2575,8 +2574,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2575
2574
|
return each(u, (x) => {
|
|
2576
2575
|
const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
|
|
2577
2576
|
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2578
|
-
const
|
|
2579
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2577
|
+
const j = first(x.split(":"));
|
|
2578
|
+
includes(["2xl", "xl", "lg", "md", "sm"], j) && u.push(x.split(":").pop().trim());
|
|
2580
2579
|
}), each(u, (x) => {
|
|
2581
2580
|
const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2582
2581
|
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
@@ -3063,26 +3062,26 @@ const useDnd = () => {
|
|
|
3063
3062
|
g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
|
|
3064
3063
|
},
|
|
3065
3064
|
onDrop: (g) => {
|
|
3066
|
-
var
|
|
3067
|
-
const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((
|
|
3065
|
+
var A;
|
|
3066
|
+
const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((A = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : A.scrollY) : g.clientX;
|
|
3068
3067
|
dropIndex = calculateDropIndex(f, possiblePositions);
|
|
3069
|
-
const
|
|
3070
|
-
if ((
|
|
3068
|
+
const k = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3069
|
+
if ((k == null ? void 0 : k._id) === v || !S) {
|
|
3071
3070
|
x();
|
|
3072
3071
|
return;
|
|
3073
3072
|
}
|
|
3074
|
-
if (!has(
|
|
3075
|
-
a(
|
|
3073
|
+
if (!has(k, "_id")) {
|
|
3074
|
+
a(k, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
|
|
3076
3075
|
return;
|
|
3077
3076
|
}
|
|
3078
3077
|
let B = E.getAttribute("data-block-id");
|
|
3079
|
-
B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([
|
|
3078
|
+
B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
|
|
3080
3079
|
},
|
|
3081
3080
|
onDragEnter: (g) => {
|
|
3082
|
-
const E = g,
|
|
3083
|
-
dropTarget =
|
|
3084
|
-
const f =
|
|
3085
|
-
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [],
|
|
3081
|
+
const E = g, j = E.target;
|
|
3082
|
+
dropTarget = j;
|
|
3083
|
+
const f = j.getAttribute("data-block-id"), k = j.getAttribute("data-dnd-dragged") !== "yes";
|
|
3084
|
+
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(j), r(!0), l(""), i([]);
|
|
3086
3085
|
},
|
|
3087
3086
|
onDragLeave: (g) => {
|
|
3088
3087
|
g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
@@ -3281,29 +3280,31 @@ const useHandleCanvasDblClick = () => {
|
|
|
3281
3280
|
]
|
|
3282
3281
|
}
|
|
3283
3282
|
) });
|
|
3284
|
-
}, HeadTags = (
|
|
3285
|
-
const [
|
|
3286
|
-
|
|
3283
|
+
}, HeadTags = () => {
|
|
3284
|
+
const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useHighlightBlockId(), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: u } = useFrame(), [p] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [m] = useState(
|
|
3285
|
+
d == null ? void 0 : d.getElementById("selected-block")
|
|
3286
|
+
), [x] = useState(
|
|
3287
|
+
d == null ? void 0 : d.getElementById("selected-styling-block")
|
|
3287
3288
|
), [g] = useState(
|
|
3288
|
-
|
|
3289
|
-
), [E] = useState(
|
|
3290
|
-
u == null ? void 0 : u.getElementById("dragged-block")
|
|
3289
|
+
d == null ? void 0 : d.getElementById("dragged-block")
|
|
3291
3290
|
);
|
|
3292
3291
|
useEffect(() => {
|
|
3293
|
-
|
|
3294
|
-
}, [
|
|
3295
|
-
const
|
|
3292
|
+
r ? d == null || d.documentElement.classList.add("dark") : d == null || d.documentElement.classList.remove("dark");
|
|
3293
|
+
}, [r, d]);
|
|
3294
|
+
const E = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
|
|
3296
3295
|
return useEffect(() => {
|
|
3297
|
-
const
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
"
|
|
3296
|
+
const f = get(o, "primaryColor", "#000"), k = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), B = get(o, "bodyTextDarkColor", "#000"), A = get(o, "bodyTextLightColor", "#fff"), w = s({
|
|
3297
|
+
colors: [f, k],
|
|
3298
|
+
names: ["primary", "secondary"]
|
|
3299
|
+
});
|
|
3300
|
+
set(w, "primary.DEFAULT", f), set(w, "secondary.DEFAULT", k);
|
|
3301
|
+
const N = {
|
|
3302
|
+
"bg-light": v,
|
|
3303
|
+
"bg-dark": S,
|
|
3304
|
+
"text-dark": B,
|
|
3304
3305
|
"text-light": A
|
|
3305
|
-
},
|
|
3306
|
-
!
|
|
3306
|
+
}, D = get(o, "roundedCorners", "0");
|
|
3307
|
+
!u || !u.tailwind || (u.tailwind.config = {
|
|
3307
3308
|
darkMode: "class",
|
|
3308
3309
|
theme: {
|
|
3309
3310
|
extend: {
|
|
@@ -3315,56 +3316,56 @@ const useHandleCanvasDblClick = () => {
|
|
|
3315
3316
|
}
|
|
3316
3317
|
},
|
|
3317
3318
|
fontFamily: {
|
|
3318
|
-
heading: [
|
|
3319
|
-
body: [
|
|
3319
|
+
heading: [E],
|
|
3320
|
+
body: [j]
|
|
3320
3321
|
},
|
|
3321
3322
|
borderRadius: {
|
|
3322
|
-
DEFAULT: `${
|
|
3323
|
+
DEFAULT: `${D || "0"}px`
|
|
3323
3324
|
},
|
|
3324
|
-
colors: { ...
|
|
3325
|
+
colors: { ...N, ...w }
|
|
3325
3326
|
}
|
|
3326
3327
|
},
|
|
3327
3328
|
plugins: [
|
|
3328
3329
|
typography$1,
|
|
3329
3330
|
forms,
|
|
3330
3331
|
aspectRatio,
|
|
3331
|
-
plugin(function({ addBase:
|
|
3332
|
-
|
|
3332
|
+
plugin(function({ addBase: T, theme: b }) {
|
|
3333
|
+
T({
|
|
3333
3334
|
"h1,h2,h3,h4,h5,h6": {
|
|
3334
|
-
fontFamily:
|
|
3335
|
+
fontFamily: b("fontFamily.heading")
|
|
3335
3336
|
},
|
|
3336
3337
|
body: {
|
|
3337
|
-
fontFamily:
|
|
3338
|
-
color:
|
|
3339
|
-
backgroundColor:
|
|
3338
|
+
fontFamily: b("fontFamily.body"),
|
|
3339
|
+
color: b("colors.text-light"),
|
|
3340
|
+
backgroundColor: b("colors.bg-light")
|
|
3340
3341
|
},
|
|
3341
3342
|
".dark body": {
|
|
3342
|
-
color:
|
|
3343
|
-
backgroundColor:
|
|
3343
|
+
color: b("colors.text-dark"),
|
|
3344
|
+
backgroundColor: b("colors.bg-dark")
|
|
3344
3345
|
}
|
|
3345
3346
|
});
|
|
3346
3347
|
})
|
|
3347
3348
|
]
|
|
3348
3349
|
});
|
|
3349
|
-
}, [
|
|
3350
|
-
|
|
3351
|
-
outline: 1px solid ${
|
|
3350
|
+
}, [o, u, E, j]), useEffect(() => {
|
|
3351
|
+
m && (m.textContent = `${map(n, (f) => `[data-block-id="${f}"]`).join(",")}{
|
|
3352
|
+
outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3352
3353
|
}`);
|
|
3353
|
-
}, [
|
|
3354
|
-
|
|
3355
|
-
}, [
|
|
3356
|
-
|
|
3357
|
-
}, [
|
|
3358
|
-
|
|
3354
|
+
}, [n, m]), useEffect(() => {
|
|
3355
|
+
g.textContent = i ? `[data-block-id="${i._id}"], [data-block-id="${i._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3356
|
+
}, [i, g]), useEffect(() => {
|
|
3357
|
+
p && (p.textContent = a ? `[data-style-id="${a}"], [data-block-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
|
|
3358
|
+
}, [a, n, p]), useEffect(() => {
|
|
3359
|
+
x && (x.textContent = `${map(l, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
|
|
3359
3360
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3360
3361
|
}`);
|
|
3361
|
-
}, [
|
|
3362
|
-
|
|
3363
|
-
}, [
|
|
3362
|
+
}, [l, x]), useEffect(() => {
|
|
3363
|
+
d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3364
|
+
}, [c]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (E || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3364
3365
|
"link",
|
|
3365
3366
|
{
|
|
3366
3367
|
rel: "stylesheet",
|
|
3367
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
3368
|
+
href: `https://fonts.googleapis.com/css2?family=${E ? `${E.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${E && j && E !== j ? "&" : ""}${j && j !== E ? `family=${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
|
|
3368
3369
|
}
|
|
3369
3370
|
) });
|
|
3370
3371
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
@@ -3482,15 +3483,15 @@ function applyLanguage(o, n, r) {
|
|
|
3482
3483
|
}), a;
|
|
3483
3484
|
}
|
|
3484
3485
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3485
|
-
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom),
|
|
3486
|
-
(f) => f.reduce((
|
|
3486
|
+
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
|
|
3487
|
+
(f) => f.reduce((k, v) => {
|
|
3487
3488
|
const S = get(u, v, {});
|
|
3488
|
-
return { ...
|
|
3489
|
+
return { ...k, ...S };
|
|
3489
3490
|
}, {}),
|
|
3490
3491
|
[u]
|
|
3491
3492
|
);
|
|
3492
3493
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3493
|
-
o.map((f,
|
|
3494
|
+
o.map((f, k) => {
|
|
3494
3495
|
if (E === f._id || p.includes(f._id))
|
|
3495
3496
|
return null;
|
|
3496
3497
|
const v = {}, S = filter(n, { _parent: f._id });
|
|
@@ -3498,13 +3499,13 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3498
3499
|
const C = m(f);
|
|
3499
3500
|
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
|
|
3500
3501
|
}
|
|
3501
|
-
const B = getBlockComponent(f._type),
|
|
3502
|
-
if (isNull(
|
|
3502
|
+
const B = getBlockComponent(f._type), A = get(B, "server", !1), w = A ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
|
|
3503
|
+
if (isNull(w))
|
|
3503
3504
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3504
|
-
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D =
|
|
3505
|
+
const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = j(N), T = x(f);
|
|
3505
3506
|
if (get(T, "__isHidden", !1) && !includes(a, f._id))
|
|
3506
3507
|
return null;
|
|
3507
|
-
const
|
|
3508
|
+
const b = i && isDescendant(i._id, f._id, n), _ = {
|
|
3508
3509
|
...includes(a, f._id) ? { "force-show": "" } : {},
|
|
3509
3510
|
"data-block-id": f._id,
|
|
3510
3511
|
"data-block-type": f._type,
|
|
@@ -3512,15 +3513,15 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3512
3513
|
// @ts-ignore
|
|
3513
3514
|
{
|
|
3514
3515
|
"data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3515
|
-
"data-dnd-dragged": i._id === f._id ||
|
|
3516
|
+
"data-dnd-dragged": i._id === f._id || b ? "yes" : "no"
|
|
3516
3517
|
}
|
|
3517
3518
|
) : {},
|
|
3518
|
-
...c === f._id && !
|
|
3519
|
+
...c === f._id && !b ? { "data-drop": "yes" } : {},
|
|
3519
3520
|
...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
|
|
3520
3521
|
};
|
|
3521
|
-
return
|
|
3522
|
-
blockProps:
|
|
3523
|
-
index:
|
|
3522
|
+
return A ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: _ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(w, {
|
|
3523
|
+
blockProps: _,
|
|
3524
|
+
index: k,
|
|
3524
3525
|
...applyBindings(applyLanguage(f, r, B), g),
|
|
3525
3526
|
...omit(T, ["__isHidden"]),
|
|
3526
3527
|
...v,
|
|
@@ -3575,41 +3576,41 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3575
3576
|
n(i);
|
|
3576
3577
|
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
|
|
3577
3578
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3578
|
-
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [
|
|
3579
|
-
u((N) => ({ ...N, width:
|
|
3579
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [j, f] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (w) => {
|
|
3580
|
+
u((N) => ({ ...N, width: w }));
|
|
3580
3581
|
};
|
|
3581
3582
|
useEffect(() => {
|
|
3582
3583
|
if (!c.current)
|
|
3583
3584
|
return;
|
|
3584
|
-
const { clientWidth:
|
|
3585
|
-
u({ width:
|
|
3585
|
+
const { clientWidth: w, clientHeight: N } = c.current;
|
|
3586
|
+
u({ width: w, height: N });
|
|
3586
3587
|
}, [c, n]);
|
|
3587
|
-
const B = (
|
|
3588
|
-
const { top: D } =
|
|
3588
|
+
const B = (w, N = 0) => {
|
|
3589
|
+
const { top: D } = w.getBoundingClientRect();
|
|
3589
3590
|
return D + N >= 0 && D - N <= window.innerHeight;
|
|
3590
3591
|
};
|
|
3591
3592
|
useEffect(() => {
|
|
3592
|
-
var
|
|
3593
|
+
var w, N;
|
|
3593
3594
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3594
3595
|
const D = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3595
|
-
D && (B(D) || (N = (
|
|
3596
|
+
D && (B(D) || (N = (w = i.current) == null ? void 0 : w.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
|
|
3596
3597
|
}
|
|
3597
3598
|
}, [a]), useEffect(() => {
|
|
3598
|
-
if (!isEmpty(
|
|
3599
|
-
const
|
|
3599
|
+
if (!isEmpty(j) && i.current) {
|
|
3600
|
+
const w = getElementByStyleId(
|
|
3600
3601
|
i.current.contentDocument,
|
|
3601
|
-
first(
|
|
3602
|
+
first(j).id
|
|
3602
3603
|
);
|
|
3603
|
-
g(
|
|
3604
|
+
g(w ? [w] : [null]);
|
|
3604
3605
|
} else
|
|
3605
3606
|
g([null]);
|
|
3606
|
-
}, [
|
|
3607
|
-
const
|
|
3608
|
-
let
|
|
3609
|
-
return
|
|
3607
|
+
}, [j]);
|
|
3608
|
+
const A = useMemo(() => {
|
|
3609
|
+
let w = IframeInitialContent;
|
|
3610
|
+
return w = w.replace("__HTML_DIR__", v), o === "offline" && (w = w.replace(
|
|
3610
3611
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3611
3612
|
"/offline/tailwind.cdn.js"
|
|
3612
|
-
),
|
|
3613
|
+
), w = w.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), w = w.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), w;
|
|
3613
3614
|
}, [o, v]);
|
|
3614
3615
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3615
3616
|
"div",
|
|
@@ -3628,7 +3629,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3628
3629
|
id: "canvas-iframe",
|
|
3629
3630
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3630
3631
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3631
|
-
initialContent:
|
|
3632
|
+
initialContent: A,
|
|
3632
3633
|
children: [
|
|
3633
3634
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3634
3635
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3638,9 +3639,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3638
3639
|
selectedBlockElement: first(m)
|
|
3639
3640
|
}
|
|
3640
3641
|
),
|
|
3641
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {
|
|
3642
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
|
|
3642
3643
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
3643
|
-
|
|
3644
|
+
k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
3644
3645
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
3645
3646
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3646
3647
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -3751,7 +3752,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3751
3752
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3752
3753
|
] }, l))
|
|
3753
3754
|
] }) });
|
|
3754
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor
|
|
3755
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor--uDNh1j6.js")), CanvasArea = () => {
|
|
3755
3756
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3756
3757
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3757
3758
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
@@ -3826,8 +3827,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3826
3827
|
showHeading: o = !0,
|
|
3827
3828
|
className: n = ""
|
|
3828
3829
|
}) => {
|
|
3829
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3830
|
-
|
|
3830
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: A }, w) => {
|
|
3831
|
+
w && (a(A), i.current = A);
|
|
3831
3832
|
}, {
|
|
3832
3833
|
bodyFont: u,
|
|
3833
3834
|
headingFont: p,
|
|
@@ -3835,9 +3836,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3835
3836
|
bodyTextDarkColor: x,
|
|
3836
3837
|
bodyTextLightColor: g,
|
|
3837
3838
|
bodyBgDarkColor: E,
|
|
3838
|
-
secondaryColor:
|
|
3839
|
+
secondaryColor: j,
|
|
3839
3840
|
bodyBgLightColor: f,
|
|
3840
|
-
roundedCorners:
|
|
3841
|
+
roundedCorners: k
|
|
3841
3842
|
} = r;
|
|
3842
3843
|
let v = {
|
|
3843
3844
|
headingFont: y({
|
|
@@ -3850,12 +3851,12 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3850
3851
|
default: u,
|
|
3851
3852
|
options: FONTS
|
|
3852
3853
|
}),
|
|
3853
|
-
roundedCorners: s({
|
|
3854
|
+
roundedCorners: s$1({
|
|
3854
3855
|
title: c("theme_config.rounded_corner"),
|
|
3855
|
-
default: parseInt(
|
|
3856
|
+
default: parseInt(k || 5, 10)
|
|
3856
3857
|
}),
|
|
3857
3858
|
primaryColor: h({ title: c("theme_config.primary"), default: m }),
|
|
3858
|
-
secondaryColor: h({ title: c("theme_config.secondary"), default:
|
|
3859
|
+
secondaryColor: h({ title: c("theme_config.secondary"), default: j })
|
|
3859
3860
|
};
|
|
3860
3861
|
l || (v = {
|
|
3861
3862
|
...v,
|
|
@@ -3880,9 +3881,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3880
3881
|
type: "object",
|
|
3881
3882
|
properties: {}
|
|
3882
3883
|
}, B = {};
|
|
3883
|
-
return Object.keys(v).forEach((
|
|
3884
|
-
const
|
|
3885
|
-
return S.properties || (S.properties = {}), S.properties[
|
|
3884
|
+
return Object.keys(v).forEach((A) => {
|
|
3885
|
+
const w = v[A];
|
|
3886
|
+
return S.properties || (S.properties = {}), S.properties[A] = w.schema, B[A] = w.uiSchema, !0;
|
|
3886
3887
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3887
3888
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
|
|
3888
3889
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4078,34 +4079,34 @@ function BiExpandVertical(o) {
|
|
|
4078
4079
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4079
4080
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
|
|
4080
4081
|
let p = null;
|
|
4081
|
-
const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop:
|
|
4082
|
+
const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: j, isDragging: f, isEditing: k, handleClick: v } = o, S = (T) => {
|
|
4082
4083
|
T.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4083
4084
|
}, B = (T) => {
|
|
4084
4085
|
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
4085
|
-
}, w = (T) => {
|
|
4086
|
-
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4087
4086
|
}, A = (T) => {
|
|
4087
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4088
|
+
}, w = (T) => {
|
|
4088
4089
|
T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), v(T);
|
|
4089
4090
|
};
|
|
4090
4091
|
useEffect(() => {
|
|
4091
4092
|
const T = setTimeout(() => {
|
|
4092
|
-
|
|
4093
|
+
j && !o.isOpen && !f && !i.includes(x) && o.toggle();
|
|
4093
4094
|
}, 500);
|
|
4094
4095
|
return () => clearTimeout(T);
|
|
4095
|
-
}, [
|
|
4096
|
+
}, [j, o, f]);
|
|
4096
4097
|
const N = useMemo(() => {
|
|
4097
|
-
const T = Object.keys(g),
|
|
4098
|
-
for (let
|
|
4099
|
-
if (T[
|
|
4100
|
-
const C = g[T[
|
|
4101
|
-
R.match(/x-data/) &&
|
|
4098
|
+
const T = Object.keys(g), b = [];
|
|
4099
|
+
for (let _ = 0; _ < T.length; _++)
|
|
4100
|
+
if (T[_].endsWith("_attrs")) {
|
|
4101
|
+
const C = g[T[_]], R = Object.keys(C).join("|");
|
|
4102
|
+
R.match(/x-data/) && b.push("data"), R.match(/x-on/) && b.push("event"), R.match(/x-show|x-if/) && b.push("show");
|
|
4102
4103
|
}
|
|
4103
|
-
return
|
|
4104
|
-
}, [g]), D = (T,
|
|
4105
|
-
const
|
|
4106
|
-
C && C.setAttribute("data-drop",
|
|
4104
|
+
return b;
|
|
4105
|
+
}, [g]), D = (T, b) => {
|
|
4106
|
+
const _ = u.contentDocument || u.contentWindow.document, C = _.querySelector(`[data-block-id=${T}]`);
|
|
4107
|
+
C && C.setAttribute("data-drop", b);
|
|
4107
4108
|
const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
|
|
4108
|
-
R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (
|
|
4109
|
+
R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (_.documentElement.scrollTop = C.offsetTop - I.top);
|
|
4109
4110
|
};
|
|
4110
4111
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4111
4112
|
"button",
|
|
@@ -4121,12 +4122,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4121
4122
|
"div",
|
|
4122
4123
|
{
|
|
4123
4124
|
onMouseEnter: () => d(x),
|
|
4124
|
-
onClick:
|
|
4125
|
+
onClick: w,
|
|
4125
4126
|
style: n,
|
|
4126
4127
|
"data-node-id": x,
|
|
4127
4128
|
ref: i.includes(x) ? null : r,
|
|
4128
4129
|
onDragStart: () => B(o),
|
|
4129
|
-
onDragEnd: () =>
|
|
4130
|
+
onDragEnd: () => A(o),
|
|
4130
4131
|
onDragOver: (T) => {
|
|
4131
4132
|
T.preventDefault(), D(x, "yes");
|
|
4132
4133
|
},
|
|
@@ -4139,7 +4140,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4139
4140
|
className: cn(
|
|
4140
4141
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4141
4142
|
E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4142
|
-
|
|
4143
|
+
j && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
|
|
4143
4144
|
f && "opacity-20",
|
|
4144
4145
|
i.includes(x) ? "opacity-50" : ""
|
|
4145
4146
|
),
|
|
@@ -4154,7 +4155,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4154
4155
|
),
|
|
4155
4156
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4156
4157
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
|
|
4157
|
-
|
|
4158
|
+
k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4158
4159
|
"div",
|
|
4159
4160
|
{
|
|
4160
4161
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
@@ -4619,12 +4620,12 @@ function ExpandableObject(o) {
|
|
|
4619
4620
|
shouldExpandNode: p,
|
|
4620
4621
|
clickToExpandNode: m
|
|
4621
4622
|
} = o;
|
|
4622
|
-
const x = useRef(!1), [g, E,
|
|
4623
|
+
const x = useRef(!1), [g, E, j] = useBool(() => p(d, r, n));
|
|
4623
4624
|
useEffect(() => {
|
|
4624
|
-
x.current ?
|
|
4625
|
+
x.current ? j(p(d, r, n)) : x.current = !0;
|
|
4625
4626
|
}, [p]);
|
|
4626
|
-
const f = g ? u.collapseIcon : u.expandIcon,
|
|
4627
|
-
|
|
4627
|
+
const f = g ? u.collapseIcon : u.expandIcon, k = g ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, A = (w) => {
|
|
4628
|
+
w.key === " " && (w.preventDefault(), E());
|
|
4628
4629
|
};
|
|
4629
4630
|
return /* @__PURE__ */ createElement("div", {
|
|
4630
4631
|
className: u.basicChildStyle,
|
|
@@ -4632,16 +4633,16 @@ function ExpandableObject(o) {
|
|
|
4632
4633
|
}, /* @__PURE__ */ createElement("span", {
|
|
4633
4634
|
className: f,
|
|
4634
4635
|
onClick: E,
|
|
4635
|
-
onKeyDown:
|
|
4636
|
+
onKeyDown: A,
|
|
4636
4637
|
role: "button",
|
|
4637
4638
|
tabIndex: 0,
|
|
4638
|
-
"aria-label":
|
|
4639
|
+
"aria-label": k,
|
|
4639
4640
|
"aria-expanded": g,
|
|
4640
4641
|
"aria-controls": g ? v : void 0
|
|
4641
4642
|
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4642
4643
|
className: u.clickableLabel,
|
|
4643
4644
|
onClick: E,
|
|
4644
|
-
onKeyDown:
|
|
4645
|
+
onKeyDown: A,
|
|
4645
4646
|
role: "button",
|
|
4646
4647
|
tabIndex: -1
|
|
4647
4648
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
@@ -4650,10 +4651,10 @@ function ExpandableObject(o) {
|
|
|
4650
4651
|
className: u.punctuation
|
|
4651
4652
|
}, i), g ? /* @__PURE__ */ createElement("div", {
|
|
4652
4653
|
id: v
|
|
4653
|
-
}, a.map((
|
|
4654
|
-
key:
|
|
4655
|
-
field:
|
|
4656
|
-
value:
|
|
4654
|
+
}, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4655
|
+
key: w[0] || N,
|
|
4656
|
+
field: w[0],
|
|
4657
|
+
value: w[1],
|
|
4657
4658
|
style: u,
|
|
4658
4659
|
lastElement: N === B,
|
|
4659
4660
|
level: S,
|
|
@@ -4662,11 +4663,11 @@ function ExpandableObject(o) {
|
|
|
4662
4663
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4663
4664
|
className: u.collapsedContent,
|
|
4664
4665
|
onClick: E,
|
|
4665
|
-
onKeyDown:
|
|
4666
|
+
onKeyDown: A,
|
|
4666
4667
|
role: "button",
|
|
4667
4668
|
tabIndex: -1,
|
|
4668
4669
|
"aria-hidden": !0,
|
|
4669
|
-
"aria-label":
|
|
4670
|
+
"aria-label": k,
|
|
4670
4671
|
"aria-expanded": g
|
|
4671
4672
|
}), /* @__PURE__ */ createElement("span", {
|
|
4672
4673
|
className: u.punctuation
|
|
@@ -4821,8 +4822,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4821
4822
|
appliedBindings: c
|
|
4822
4823
|
}) => {
|
|
4823
4824
|
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
|
|
4824
|
-
(
|
|
4825
|
-
) : d.filter((
|
|
4825
|
+
(j) => !includes(c, j) && get(p, `props.${first(split(j, "."))}.binding`)
|
|
4826
|
+
) : d.filter((j) => i === get(u, j, "")), [o, d, c, i, p]);
|
|
4826
4827
|
return useEffect(() => {
|
|
4827
4828
|
n && l(n);
|
|
4828
4829
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -4851,23 +4852,23 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4851
4852
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
|
|
4852
4853
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
|
|
4853
4854
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
|
|
4854
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (
|
|
4855
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4855
4856
|
CommandItem,
|
|
4856
4857
|
{
|
|
4857
|
-
value:
|
|
4858
|
+
value: j,
|
|
4858
4859
|
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4859
4860
|
onSelect: (f) => {
|
|
4860
|
-
r(find(E, (
|
|
4861
|
+
r(find(E, (k) => k === f) || null), g(!1);
|
|
4861
4862
|
},
|
|
4862
4863
|
children: [
|
|
4863
4864
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
4864
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n ===
|
|
4865
|
-
|
|
4865
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === j ? "" : "opacity-0"}` }),
|
|
4866
|
+
j
|
|
4866
4867
|
] }),
|
|
4867
|
-
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u,
|
|
4868
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
|
|
4868
4869
|
]
|
|
4869
4870
|
},
|
|
4870
|
-
|
|
4871
|
+
j
|
|
4871
4872
|
)) })
|
|
4872
4873
|
] })
|
|
4873
4874
|
] }) })
|
|
@@ -4882,15 +4883,15 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4882
4883
|
item: a
|
|
4883
4884
|
}) => {
|
|
4884
4885
|
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4885
|
-
(E,
|
|
4886
|
+
(E, j) => {
|
|
4886
4887
|
if (isEmpty(E))
|
|
4887
4888
|
return "";
|
|
4888
4889
|
{
|
|
4889
|
-
const f = get(
|
|
4890
|
+
const f = get(j === "PROP" ? u : p, E, "");
|
|
4890
4891
|
if (isArray$1(f))
|
|
4891
4892
|
return "list";
|
|
4892
|
-
const
|
|
4893
|
-
return
|
|
4893
|
+
const k = typeof f;
|
|
4894
|
+
return k === "string" ? "text" : k === "object" ? "model" : k;
|
|
4894
4895
|
}
|
|
4895
4896
|
},
|
|
4896
4897
|
[u, p]
|
|
@@ -4910,8 +4911,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4910
4911
|
value: l,
|
|
4911
4912
|
setValue: i,
|
|
4912
4913
|
onChange: (E) => {
|
|
4913
|
-
const
|
|
4914
|
-
i(E), x !==
|
|
4914
|
+
const j = m(E, "PROP");
|
|
4915
|
+
i(E), x !== j && d(""), g(j);
|
|
4915
4916
|
},
|
|
4916
4917
|
data: u,
|
|
4917
4918
|
dataType: x,
|
|
@@ -4928,8 +4929,8 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4928
4929
|
value: c,
|
|
4929
4930
|
setValue: d,
|
|
4930
4931
|
onChange: (E) => {
|
|
4931
|
-
const
|
|
4932
|
-
d(x ===
|
|
4932
|
+
const j = m(E, "PATH");
|
|
4933
|
+
d(x === j ? E : "");
|
|
4933
4934
|
},
|
|
4934
4935
|
data: p,
|
|
4935
4936
|
dataType: x,
|
|
@@ -5017,7 +5018,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5017
5018
|
const g = filter(i, (E) => E.key !== x.key);
|
|
5018
5019
|
c([...g, x]), m([...g, x]);
|
|
5019
5020
|
}, p = (x) => {
|
|
5020
|
-
const g = filter(i, (E,
|
|
5021
|
+
const g = filter(i, (E, j) => x !== j);
|
|
5021
5022
|
m([...g]);
|
|
5022
5023
|
}, m = useCallback(
|
|
5023
5024
|
(x = []) => {
|
|
@@ -5136,7 +5137,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5136
5137
|
}
|
|
5137
5138
|
)
|
|
5138
5139
|
] });
|
|
5139
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5140
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-DiPQWWzq.js")), UploadImages = React__default.lazy(() => import("./UploadImages-DXkjWO-U.js")), ImagesPanel = ({
|
|
5140
5141
|
isModalView: o = !1,
|
|
5141
5142
|
onSelect: n = () => {
|
|
5142
5143
|
}
|
|
@@ -5296,18 +5297,18 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5296
5297
|
] });
|
|
5297
5298
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5298
5299
|
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: x } = useLanguages(), g = x.length === 0 ? "" : p.length ? p : m;
|
|
5299
|
-
Object.keys(n).forEach((
|
|
5300
|
-
const f = n[
|
|
5300
|
+
Object.keys(n).forEach((j) => {
|
|
5301
|
+
const f = n[j];
|
|
5301
5302
|
if (includes(["slot", "styles"], f.type))
|
|
5302
5303
|
return;
|
|
5303
|
-
const
|
|
5304
|
-
c.properties[
|
|
5304
|
+
const k = j;
|
|
5305
|
+
c.properties[k] = getBlockJSONFromSchemas(f, u, g), d[k] = getBlockJSONFromUISchemas(f);
|
|
5305
5306
|
}), useEffect(() => {
|
|
5306
5307
|
i(r);
|
|
5307
5308
|
}, [o, p]);
|
|
5308
5309
|
const E = useThrottledCallback(
|
|
5309
|
-
async ({ formData:
|
|
5310
|
-
a({ formData:
|
|
5310
|
+
async ({ formData: j }, f) => {
|
|
5311
|
+
a({ formData: j }, f);
|
|
5311
5312
|
},
|
|
5312
5313
|
[a],
|
|
5313
5314
|
1e3
|
|
@@ -5333,8 +5334,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5333
5334
|
uiSchema: d,
|
|
5334
5335
|
schema: c,
|
|
5335
5336
|
formData: l,
|
|
5336
|
-
onChange: ({ formData:
|
|
5337
|
-
f && (i(
|
|
5337
|
+
onChange: ({ formData: j }, f) => {
|
|
5338
|
+
f && (i(j), E({ formData: j }, f));
|
|
5338
5339
|
}
|
|
5339
5340
|
}
|
|
5340
5341
|
);
|
|
@@ -5403,30 +5404,30 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5403
5404
|
}), a;
|
|
5404
5405
|
};
|
|
5405
5406
|
function BlockSettings() {
|
|
5406
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f },
|
|
5407
|
-
if (
|
|
5408
|
-
const S =
|
|
5407
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, k, v) => {
|
|
5408
|
+
if (k && (c == null ? void 0 : c._id) === n._id) {
|
|
5409
|
+
const S = k.replace("root.", "");
|
|
5409
5410
|
a([n._id], { [S]: get(f, S) }, v);
|
|
5410
5411
|
}
|
|
5411
5412
|
}, m = useCallback(
|
|
5412
|
-
debounce(({ formData: f },
|
|
5413
|
-
p({ formData: f },
|
|
5413
|
+
debounce(({ formData: f }, k, v) => {
|
|
5414
|
+
p({ formData: f }, k, v), d(f);
|
|
5414
5415
|
}, 1500),
|
|
5415
5416
|
[n == null ? void 0 : n._id, o]
|
|
5416
|
-
), x = ({ formData: f },
|
|
5417
|
-
if (
|
|
5418
|
-
const v =
|
|
5417
|
+
), x = ({ formData: f }, k) => {
|
|
5418
|
+
if (k) {
|
|
5419
|
+
const v = k.replace("root.", "");
|
|
5419
5420
|
r(
|
|
5420
5421
|
[n._id],
|
|
5421
5422
|
convertDotNotationToObject(v, get(f, v.split(".")))
|
|
5422
|
-
), m({ formData: f },
|
|
5423
|
+
), m({ formData: f }, k, { [v]: get(c, v) });
|
|
5423
5424
|
}
|
|
5424
5425
|
}, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
|
|
5425
5426
|
const f = cloneDeep(get(l, "props", {}));
|
|
5426
|
-
return each(f, (
|
|
5427
|
-
get(
|
|
5428
|
-
}), u && each(g, (
|
|
5429
|
-
}, [l, g, u]),
|
|
5427
|
+
return each(f, (k, v) => {
|
|
5428
|
+
get(k, "hidden", !1) && delete f[v];
|
|
5429
|
+
}), u && each(g, (k) => delete f[k]), f;
|
|
5430
|
+
}, [l, g, u]), j = get(l, "server", !1);
|
|
5430
5431
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5431
5432
|
u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
|
|
5432
5433
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
|
|
@@ -5483,7 +5484,7 @@ function BlockSettings() {
|
|
|
5483
5484
|
}
|
|
5484
5485
|
),
|
|
5485
5486
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
5486
|
-
|
|
5487
|
+
j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
|
|
5487
5488
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
|
|
5488
5489
|
] });
|
|
5489
5490
|
}
|
|
@@ -5510,22 +5511,22 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
|
5510
5511
|
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), m = u.length ? u : p;
|
|
5511
5512
|
return {
|
|
5512
5513
|
askAi: useCallback(
|
|
5513
|
-
async (x, g, E,
|
|
5514
|
+
async (x, g, E, j) => {
|
|
5514
5515
|
if (l) {
|
|
5515
5516
|
n(!0), a(null);
|
|
5516
5517
|
try {
|
|
5517
5518
|
const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((B) => B._id === g))];
|
|
5518
5519
|
set(f, "0._parent", null);
|
|
5519
|
-
const
|
|
5520
|
+
const k = await l(x, promptWithLanguage(E, m, x), f), { blocks: v, error: S } = k;
|
|
5520
5521
|
if (S) {
|
|
5521
5522
|
a(S);
|
|
5522
5523
|
return;
|
|
5523
5524
|
}
|
|
5524
|
-
x === "styles" ? c(v) : i(v),
|
|
5525
|
+
x === "styles" ? c(v) : i(v), j && j(k);
|
|
5525
5526
|
} catch (f) {
|
|
5526
5527
|
a(f);
|
|
5527
5528
|
} finally {
|
|
5528
|
-
n(!1),
|
|
5529
|
+
n(!1), j && j();
|
|
5529
5530
|
}
|
|
5530
5531
|
}
|
|
5531
5532
|
},
|
|
@@ -5664,24 +5665,24 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5664
5665
|
keys: ["name"]
|
|
5665
5666
|
});
|
|
5666
5667
|
function ManualClasses() {
|
|
5667
|
-
var
|
|
5668
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (
|
|
5668
|
+
var w;
|
|
5669
|
+
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
|
|
5669
5670
|
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5670
5671
|
a(i, N, !0), u("");
|
|
5671
|
-
}, [E,
|
|
5672
|
+
}, [E, j] = useState([]), f = ({ value: N }) => {
|
|
5672
5673
|
const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
|
|
5673
|
-
let
|
|
5674
|
+
let b = [];
|
|
5674
5675
|
if (T && T.length > 0) {
|
|
5675
|
-
const [
|
|
5676
|
-
|
|
5676
|
+
const [_] = T, C = D.replace(_, "");
|
|
5677
|
+
b = fuse.search(C).map((I) => ({
|
|
5677
5678
|
...I,
|
|
5678
|
-
item: { ...I.item, name:
|
|
5679
|
+
item: { ...I.item, name: _ + I.item.name }
|
|
5679
5680
|
}));
|
|
5680
5681
|
} else
|
|
5681
|
-
|
|
5682
|
-
return
|
|
5683
|
-
},
|
|
5684
|
-
|
|
5682
|
+
b = fuse.search(D);
|
|
5683
|
+
return j(map(b, "item"));
|
|
5684
|
+
}, k = () => {
|
|
5685
|
+
j([]);
|
|
5685
5686
|
}, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
|
|
5686
5687
|
autoComplete: "off",
|
|
5687
5688
|
autoCorrect: "off",
|
|
@@ -5694,7 +5695,7 @@ function ManualClasses() {
|
|
|
5694
5695
|
},
|
|
5695
5696
|
onChange: (N, { newValue: D }) => u(D),
|
|
5696
5697
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5697
|
-
},
|
|
5698
|
+
}, A = () => {
|
|
5698
5699
|
if (navigator.clipboard === void 0) {
|
|
5699
5700
|
p({
|
|
5700
5701
|
title: o("clipboard_not_supported"),
|
|
@@ -5717,7 +5718,7 @@ function ManualClasses() {
|
|
|
5717
5718
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5718
5719
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5719
5720
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5720
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5721
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: A, className: "cursor-pointer" }) }),
|
|
5721
5722
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
|
|
5722
5723
|
] })
|
|
5723
5724
|
] }),
|
|
@@ -5735,7 +5736,7 @@ function ManualClasses() {
|
|
|
5735
5736
|
{
|
|
5736
5737
|
suggestions: E,
|
|
5737
5738
|
onSuggestionsFetchRequested: f,
|
|
5738
|
-
onSuggestionsClearRequested:
|
|
5739
|
+
onSuggestionsClearRequested: k,
|
|
5739
5740
|
getSuggestionValue: v,
|
|
5740
5741
|
renderSuggestion: S,
|
|
5741
5742
|
inputProps: B,
|
|
@@ -6170,8 +6171,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6170
6171
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6171
6172
|
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
|
|
6172
6173
|
// eslint-disable-next-line no-shadow
|
|
6173
|
-
(
|
|
6174
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6174
|
+
(j) => {
|
|
6175
|
+
["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), u({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
|
|
6175
6176
|
},
|
|
6176
6177
|
[c, u]
|
|
6177
6178
|
);
|
|
@@ -6182,8 +6183,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6182
6183
|
}, [m]);
|
|
6183
6184
|
const E = useCallback(
|
|
6184
6185
|
// eslint-disable-next-line no-shadow
|
|
6185
|
-
(
|
|
6186
|
-
u({ color: m, shade:
|
|
6186
|
+
(j) => {
|
|
6187
|
+
u({ color: m, shade: j });
|
|
6187
6188
|
},
|
|
6188
6189
|
[m]
|
|
6189
6190
|
);
|
|
@@ -6427,50 +6428,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6427
6428
|
},
|
|
6428
6429
|
a
|
|
6429
6430
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6430
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E,
|
|
6431
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, j] = useState(!1), [f, k] = useState(""), [v, S] = useState(!1), [B, A] = useState(!1);
|
|
6431
6432
|
useEffect(() => {
|
|
6432
|
-
const { value:
|
|
6433
|
-
if (
|
|
6434
|
-
l(
|
|
6433
|
+
const { value: b, unit: _ } = getClassValueAndUnit(i);
|
|
6434
|
+
if (_ === "") {
|
|
6435
|
+
l(b), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6435
6436
|
return;
|
|
6436
6437
|
}
|
|
6437
|
-
g(
|
|
6438
|
+
g(_), l(_ === "class" || isEmpty(b) ? "" : b);
|
|
6438
6439
|
}, [i, u, p]);
|
|
6439
|
-
const
|
|
6440
|
-
(
|
|
6441
|
-
const
|
|
6442
|
-
if (get(
|
|
6443
|
-
|
|
6440
|
+
const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
|
|
6441
|
+
(b = !1) => {
|
|
6442
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6443
|
+
if (get(_, "error", !1)) {
|
|
6444
|
+
j(!0);
|
|
6444
6445
|
return;
|
|
6445
6446
|
}
|
|
6446
|
-
const C = get(
|
|
6447
|
+
const C = get(_, "unit") !== "" ? get(_, "unit") : x;
|
|
6447
6448
|
if (C === "auto" || C === "none") {
|
|
6448
|
-
|
|
6449
|
+
w(`${d}${C}`);
|
|
6449
6450
|
return;
|
|
6450
6451
|
}
|
|
6451
|
-
if (get(
|
|
6452
|
+
if (get(_, "value") === "")
|
|
6452
6453
|
return;
|
|
6453
|
-
const I = `${get(
|
|
6454
|
-
|
|
6454
|
+
const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6455
|
+
b ? N(I) : w(I);
|
|
6455
6456
|
},
|
|
6456
|
-
[
|
|
6457
|
+
[w, N, a, x, d, p]
|
|
6457
6458
|
), T = useCallback(
|
|
6458
|
-
(
|
|
6459
|
-
const
|
|
6460
|
-
if (get(
|
|
6461
|
-
|
|
6459
|
+
(b) => {
|
|
6460
|
+
const _ = getUserInputValues(`${a}`, p);
|
|
6461
|
+
if (get(_, "error", !1)) {
|
|
6462
|
+
j(!0);
|
|
6462
6463
|
return;
|
|
6463
6464
|
}
|
|
6464
|
-
if (
|
|
6465
|
-
|
|
6465
|
+
if (b === "auto" || b === "none") {
|
|
6466
|
+
w(`${d}${b}`);
|
|
6466
6467
|
return;
|
|
6467
6468
|
}
|
|
6468
|
-
if (get(
|
|
6469
|
+
if (get(_, "value") === "")
|
|
6469
6470
|
return;
|
|
6470
|
-
const C = get(
|
|
6471
|
-
|
|
6471
|
+
const C = get(_, "unit") !== "" ? get(_, "unit") : b, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
|
|
6472
|
+
w(I);
|
|
6472
6473
|
},
|
|
6473
|
-
[
|
|
6474
|
+
[w, a, d, p]
|
|
6474
6475
|
);
|
|
6475
6476
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6476
6477
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
@@ -6484,29 +6485,29 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6484
6485
|
"input",
|
|
6485
6486
|
{
|
|
6486
6487
|
readOnly: x === "class",
|
|
6487
|
-
onKeyPress: (
|
|
6488
|
-
|
|
6488
|
+
onKeyPress: (b) => {
|
|
6489
|
+
b.key === "Enter" && D();
|
|
6489
6490
|
},
|
|
6490
|
-
onKeyDown: (
|
|
6491
|
-
if (
|
|
6491
|
+
onKeyDown: (b) => {
|
|
6492
|
+
if (b.keyCode !== 38 && b.keyCode !== 40)
|
|
6492
6493
|
return;
|
|
6493
|
-
|
|
6494
|
-
const
|
|
6495
|
-
let C = isNaN$1(
|
|
6496
|
-
|
|
6494
|
+
b.preventDefault(), A(!0);
|
|
6495
|
+
const _ = parseInt$1(b.target.value);
|
|
6496
|
+
let C = isNaN$1(_) ? 0 : _;
|
|
6497
|
+
b.keyCode === 38 && (C += 1), b.keyCode === 40 && (C -= 1);
|
|
6497
6498
|
const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6498
6499
|
N(L);
|
|
6499
6500
|
},
|
|
6500
|
-
onKeyUp: (
|
|
6501
|
-
B && (
|
|
6501
|
+
onKeyUp: (b) => {
|
|
6502
|
+
B && (b.preventDefault(), A(!1));
|
|
6502
6503
|
},
|
|
6503
6504
|
onBlur: () => D(),
|
|
6504
|
-
onChange: (
|
|
6505
|
-
|
|
6505
|
+
onChange: (b) => {
|
|
6506
|
+
j(!1), l(b.target.value);
|
|
6506
6507
|
},
|
|
6507
|
-
onClick: (
|
|
6508
|
-
var
|
|
6509
|
-
(
|
|
6508
|
+
onClick: (b) => {
|
|
6509
|
+
var _;
|
|
6510
|
+
(_ = b == null ? void 0 : b.target) == null || _.select(), r(!1);
|
|
6510
6511
|
},
|
|
6511
6512
|
value: v ? f : a,
|
|
6512
6513
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -6533,8 +6534,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6533
6534
|
{
|
|
6534
6535
|
units: p,
|
|
6535
6536
|
current: x,
|
|
6536
|
-
onSelect: (
|
|
6537
|
-
r(!1), g(
|
|
6537
|
+
onSelect: (b) => {
|
|
6538
|
+
r(!1), g(b), T(b);
|
|
6538
6539
|
}
|
|
6539
6540
|
}
|
|
6540
6541
|
) }) })
|
|
@@ -6544,17 +6545,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6544
6545
|
DragStyleButton,
|
|
6545
6546
|
{
|
|
6546
6547
|
onDragStart: () => S(!0),
|
|
6547
|
-
onDragEnd: (
|
|
6548
|
-
if (
|
|
6548
|
+
onDragEnd: (b) => {
|
|
6549
|
+
if (k(() => ""), S(!1), isEmpty(b))
|
|
6549
6550
|
return;
|
|
6550
|
-
const
|
|
6551
|
-
|
|
6551
|
+
const _ = `${b}`, R = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6552
|
+
w(R);
|
|
6552
6553
|
},
|
|
6553
|
-
onDrag: (
|
|
6554
|
-
if (isEmpty(
|
|
6554
|
+
onDrag: (b) => {
|
|
6555
|
+
if (isEmpty(b))
|
|
6555
6556
|
return;
|
|
6556
|
-
|
|
6557
|
-
const
|
|
6557
|
+
k(b);
|
|
6558
|
+
const _ = `${b}`, R = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
|
|
6558
6559
|
N(R);
|
|
6559
6560
|
},
|
|
6560
6561
|
currentValue: a,
|
|
@@ -6652,21 +6653,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6652
6653
|
"2xl": "1536px"
|
|
6653
6654
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6654
6655
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6655
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [
|
|
6656
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
|
|
6656
6657
|
(N, D = !0) => {
|
|
6657
6658
|
const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
|
|
6658
6659
|
(u || p !== "") && (T.mq = "xs");
|
|
6659
|
-
const
|
|
6660
|
-
g(
|
|
6660
|
+
const b = generateFullClsName(T);
|
|
6661
|
+
g(j, [b], D);
|
|
6661
6662
|
},
|
|
6662
|
-
[
|
|
6663
|
+
[j, u, m, p, l, g]
|
|
6663
6664
|
), v = useCallback(() => {
|
|
6664
|
-
E(
|
|
6665
|
-
}, [
|
|
6665
|
+
E(j, [f]);
|
|
6666
|
+
}, [j, f, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
|
|
6666
6667
|
useEffect(() => {
|
|
6667
6668
|
i(S, x);
|
|
6668
6669
|
}, [S, i, x]);
|
|
6669
|
-
const [, , B] = useCanvasWidth(),
|
|
6670
|
+
const [, , B] = useCanvasWidth(), A = useCallback(
|
|
6670
6671
|
(N) => {
|
|
6671
6672
|
B({
|
|
6672
6673
|
xs: 400,
|
|
@@ -6678,9 +6679,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6678
6679
|
}[N]);
|
|
6679
6680
|
},
|
|
6680
6681
|
[B]
|
|
6681
|
-
),
|
|
6682
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x &&
|
|
6683
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !
|
|
6682
|
+
), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
|
|
6683
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6684
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6684
6685
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6685
6686
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6686
6687
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6689,17 +6690,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6689
6690
|
currentClass: get(x, "cls", ""),
|
|
6690
6691
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6691
6692
|
units: c || [],
|
|
6692
|
-
onChange:
|
|
6693
|
+
onChange: k,
|
|
6693
6694
|
negative: d,
|
|
6694
6695
|
cssProperty: l
|
|
6695
6696
|
}
|
|
6696
6697
|
) : null,
|
|
6697
|
-
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6698
|
-
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6699
|
-
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6700
|
-
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6698
|
+
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
|
|
6699
|
+
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
|
|
6700
|
+
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6701
|
+
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6701
6702
|
] }),
|
|
6702
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children:
|
|
6703
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6703
6704
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6704
6705
|
"button",
|
|
6705
6706
|
{
|
|
@@ -6719,7 +6720,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6719
6720
|
"button",
|
|
6720
6721
|
{
|
|
6721
6722
|
type: "button",
|
|
6722
|
-
onClick: () =>
|
|
6723
|
+
onClick: () => A(get(x, "mq")),
|
|
6723
6724
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6724
6725
|
children: [
|
|
6725
6726
|
"Switch to ",
|
|
@@ -6976,12 +6977,12 @@ const BlockCard = ({
|
|
|
6976
6977
|
library: n,
|
|
6977
6978
|
parentId: r = void 0
|
|
6978
6979
|
}) => {
|
|
6979
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (
|
|
6980
|
-
const v = has(
|
|
6981
|
-
return
|
|
6982
|
-
},
|
|
6983
|
-
async (
|
|
6984
|
-
if (
|
|
6980
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (k) => {
|
|
6981
|
+
const v = has(k, "styles_attrs.data-page-section");
|
|
6982
|
+
return k._type === "Box" && v;
|
|
6983
|
+
}, j = useCallback(
|
|
6984
|
+
async (k) => {
|
|
6985
|
+
if (k.stopPropagation(), has(o, "component")) {
|
|
6985
6986
|
c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6986
6987
|
return;
|
|
6987
6988
|
}
|
|
@@ -6990,18 +6991,18 @@ const BlockCard = ({
|
|
|
6990
6991
|
isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
6991
6992
|
},
|
|
6992
6993
|
[o]
|
|
6993
|
-
), f = async (
|
|
6994
|
+
), f = async (k) => {
|
|
6994
6995
|
const v = await i(n, o);
|
|
6995
6996
|
let S = r;
|
|
6996
6997
|
if (E(first(v)) && (S = null), !isEmpty(v)) {
|
|
6997
6998
|
const B = { blocks: v, uiLibrary: !0, parent: S };
|
|
6998
|
-
if (
|
|
6999
|
-
const
|
|
7000
|
-
|
|
7001
|
-
|
|
6999
|
+
if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
7000
|
+
const A = new Image();
|
|
7001
|
+
A.src = o.preview, A.onload = () => {
|
|
7002
|
+
k.dataTransfer.setDragImage(A, 0, 0);
|
|
7002
7003
|
};
|
|
7003
7004
|
} else
|
|
7004
|
-
|
|
7005
|
+
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7005
7006
|
g(B), setTimeout(() => {
|
|
7006
7007
|
u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
7007
7008
|
}, 200);
|
|
@@ -7012,7 +7013,7 @@ const BlockCard = ({
|
|
|
7012
7013
|
"div",
|
|
7013
7014
|
{
|
|
7014
7015
|
onClick: a ? () => {
|
|
7015
|
-
} :
|
|
7016
|
+
} : j,
|
|
7016
7017
|
draggable: x ? "true" : "false",
|
|
7017
7018
|
onDragStart: f,
|
|
7018
7019
|
className: clsx(
|
|
@@ -7043,7 +7044,7 @@ const BlockCard = ({
|
|
|
7043
7044
|
})();
|
|
7044
7045
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7045
7046
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7046
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t:
|
|
7047
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: j } = useTranslation(), f = (S) => {
|
|
7047
7048
|
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
7048
7049
|
E.current && x(S);
|
|
7049
7050
|
}, 300);
|
|
@@ -7053,12 +7054,12 @@ const BlockCard = ({
|
|
|
7053
7054
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7054
7055
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7055
7056
|
] });
|
|
7056
|
-
const
|
|
7057
|
+
const k = filter(g, (S, B) => B % 2 === 0), v = filter(g, (S, B) => B % 2 === 1);
|
|
7057
7058
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
|
|
7058
7059
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7059
7060
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7060
7061
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7061
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7062
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("groups") }),
|
|
7062
7063
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7063
7064
|
/* @__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(
|
|
7064
7065
|
map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7072,7 +7073,7 @@ const BlockCard = ({
|
|
|
7072
7073
|
B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7073
7074
|
),
|
|
7074
7075
|
children: [
|
|
7075
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7076
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(j(B.toLowerCase())) }),
|
|
7076
7077
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7077
7078
|
]
|
|
7078
7079
|
},
|
|
@@ -7089,7 +7090,7 @@ const BlockCard = ({
|
|
|
7089
7090
|
children: [
|
|
7090
7091
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7091
7092
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7092
|
-
|
|
7093
|
+
k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
7093
7094
|
) }),
|
|
7094
7095
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7095
7096
|
v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
|
|
@@ -7539,8 +7540,8 @@ i18n.use(initReactI18next).init({
|
|
|
7539
7540
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7540
7541
|
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
|
|
7541
7542
|
if (has(o, "blocks")) {
|
|
7542
|
-
const
|
|
7543
|
-
u(syncBlocksWithDefaults(
|
|
7543
|
+
const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7544
|
+
u(syncBlocksWithDefaults(j), r || null);
|
|
7544
7545
|
} else
|
|
7545
7546
|
d(o, r || null);
|
|
7546
7547
|
emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
|
|
@@ -7552,8 +7553,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7552
7553
|
disabled: n,
|
|
7553
7554
|
onClick: x,
|
|
7554
7555
|
type: "button",
|
|
7555
|
-
onDragStart: (
|
|
7556
|
-
|
|
7556
|
+
onDragStart: (j) => {
|
|
7557
|
+
j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), j.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7557
7558
|
p([]), m(null);
|
|
7558
7559
|
}, 200);
|
|
7559
7560
|
},
|
|
@@ -7646,6 +7647,12 @@ function FaCheck(o) {
|
|
|
7646
7647
|
function FaFilePen(o) {
|
|
7647
7648
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V299.6l-94.7 94.7c-8.2 8.2-14 18.5-16.8 29.7l-15 60.1c-2.3 9.4-1.8 19 1.4 27.8H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z" }, child: [] }] })(o);
|
|
7648
7649
|
}
|
|
7650
|
+
function FaLanguage(o) {
|
|
7651
|
+
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 640 512" }, child: [{ tag: "path", attr: { d: "M0 128C0 92.7 28.7 64 64 64H256h48 16H576c35.3 0 64 28.7 64 64V384c0 35.3-28.7 64-64 64H320 304 256 64c-35.3 0-64-28.7-64-64V128zm320 0V384H576V128H320zM178.3 175.9c-3.2-7.2-10.4-11.9-18.3-11.9s-15.1 4.7-18.3 11.9l-64 144c-4.5 10.1 .1 21.9 10.2 26.4s21.9-.1 26.4-10.2l8.9-20.1h73.6l8.9 20.1c4.5 10.1 16.3 14.6 26.4 10.2s14.6-16.3 10.2-26.4l-64-144zM160 233.2L179 276H141l19-42.8zM448 164c11 0 20 9 20 20v4h44 16c11 0 20 9 20 20s-9 20-20 20h-2l-1.6 4.5c-8.9 24.4-22.4 46.6-39.6 65.4c.9 .6 1.8 1.1 2.7 1.6l18.9 11.3c9.5 5.7 12.5 18 6.9 27.4s-18 12.5-27.4 6.9l-18.9-11.3c-4.5-2.7-8.8-5.5-13.1-8.5c-10.6 7.5-21.9 14-34 19.4l-3.6 1.6c-10.1 4.5-21.9-.1-26.4-10.2s.1-21.9 10.2-26.4l3.6-1.6c6.4-2.9 12.6-6.1 18.5-9.8l-12.2-12.2c-7.8-7.8-7.8-20.5 0-28.3s20.5-7.8 28.3 0l14.6 14.6 .5 .5c12.4-13.1 22.5-28.3 29.8-45H448 376c-11 0-20-9-20-20s9-20 20-20h52v-4c0-11 9-20 20-20z" }, child: [] }] })(o);
|
|
7652
|
+
}
|
|
7653
|
+
function FaStar(o) {
|
|
7654
|
+
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z" }, child: [] }] })(o);
|
|
7655
|
+
}
|
|
7649
7656
|
const QUICK_PROMPTS = [
|
|
7650
7657
|
{
|
|
7651
7658
|
name: "Improve writing",
|
|
@@ -7728,11 +7735,11 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7728
7735
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7729
7736
|
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
|
|
7730
7737
|
useEffect(() => {
|
|
7731
|
-
var
|
|
7732
|
-
(
|
|
7738
|
+
var j;
|
|
7739
|
+
(j = x.current) == null || j.focus();
|
|
7733
7740
|
}, []);
|
|
7734
|
-
const E = (
|
|
7735
|
-
const { usage: f } =
|
|
7741
|
+
const E = (j) => {
|
|
7742
|
+
const { usage: f } = j || {};
|
|
7736
7743
|
!l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
7737
7744
|
};
|
|
7738
7745
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
@@ -7753,12 +7760,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7753
7760
|
{
|
|
7754
7761
|
ref: x,
|
|
7755
7762
|
value: i,
|
|
7756
|
-
onChange: (
|
|
7763
|
+
onChange: (j) => c(j.target.value),
|
|
7757
7764
|
placeholder: n("Ask AI to edit content"),
|
|
7758
7765
|
className: "w-full",
|
|
7759
7766
|
rows: 3,
|
|
7760
|
-
onKeyDown: (
|
|
7761
|
-
|
|
7767
|
+
onKeyDown: (j) => {
|
|
7768
|
+
j.key === "Enter" && (j.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
|
|
7762
7769
|
}
|
|
7763
7770
|
}
|
|
7764
7771
|
),
|
|
@@ -7800,8 +7807,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7800
7807
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7801
7808
|
QuickPrompts,
|
|
7802
7809
|
{
|
|
7803
|
-
onClick: (
|
|
7804
|
-
g.current && clearTimeout(g.current), m(void 0), r("content", o,
|
|
7810
|
+
onClick: (j) => {
|
|
7811
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, j, E);
|
|
7805
7812
|
}
|
|
7806
7813
|
}
|
|
7807
7814
|
)
|
|
@@ -7822,8 +7829,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7822
7829
|
description: o("You can now Ask AI to edit your content"),
|
|
7823
7830
|
variant: "default"
|
|
7824
7831
|
}), g.current.click();
|
|
7825
|
-
} catch (
|
|
7826
|
-
p(
|
|
7832
|
+
} catch (j) {
|
|
7833
|
+
p(j);
|
|
7827
7834
|
} finally {
|
|
7828
7835
|
d(!1);
|
|
7829
7836
|
}
|
|
@@ -7831,8 +7838,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7831
7838
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7832
7839
|
Accordion,
|
|
7833
7840
|
{
|
|
7834
|
-
onValueChange: (
|
|
7835
|
-
m(
|
|
7841
|
+
onValueChange: (j) => {
|
|
7842
|
+
m(j !== "");
|
|
7836
7843
|
},
|
|
7837
7844
|
type: "single",
|
|
7838
7845
|
collapsible: !0,
|
|
@@ -7844,12 +7851,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7844
7851
|
{
|
|
7845
7852
|
ref: l,
|
|
7846
7853
|
value: r,
|
|
7847
|
-
onChange: (
|
|
7854
|
+
onChange: (j) => a(j.target.value),
|
|
7848
7855
|
placeholder: o("Tell about this page eg this page is about"),
|
|
7849
7856
|
className: "mt-1 w-full",
|
|
7850
7857
|
rows: 10,
|
|
7851
|
-
onKeyDown: (
|
|
7852
|
-
|
|
7858
|
+
onKeyDown: (j) => {
|
|
7859
|
+
j.key === "Enter" && (j.preventDefault(), E());
|
|
7853
7860
|
}
|
|
7854
7861
|
}
|
|
7855
7862
|
),
|
|
@@ -7911,7 +7918,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7911
7918
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
7912
7919
|
] });
|
|
7913
7920
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
7914
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null),
|
|
7921
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), j = useRef(null);
|
|
7915
7922
|
useEffect(() => {
|
|
7916
7923
|
l(n);
|
|
7917
7924
|
}, [n]);
|
|
@@ -7921,32 +7928,32 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7921
7928
|
return;
|
|
7922
7929
|
}
|
|
7923
7930
|
if (i) {
|
|
7924
|
-
const
|
|
7925
|
-
r(
|
|
7931
|
+
const A = [...a, { key: i, value: d }];
|
|
7932
|
+
r(A), l(a), c(""), u(""), g("");
|
|
7926
7933
|
}
|
|
7927
|
-
},
|
|
7928
|
-
const
|
|
7929
|
-
r(
|
|
7930
|
-
}, v = (
|
|
7931
|
-
m(
|
|
7934
|
+
}, k = (A) => {
|
|
7935
|
+
const w = a.filter((N, D) => D !== A);
|
|
7936
|
+
r(w), l(w);
|
|
7937
|
+
}, v = (A) => {
|
|
7938
|
+
m(A), c(a[A].key), u(a[A].value);
|
|
7932
7939
|
}, S = () => {
|
|
7933
7940
|
if (i.startsWith("@")) {
|
|
7934
7941
|
g("Attribute keys cannot start with '@'");
|
|
7935
7942
|
return;
|
|
7936
7943
|
}
|
|
7937
7944
|
if (p !== null && i) {
|
|
7938
|
-
const
|
|
7939
|
-
|
|
7945
|
+
const A = [...a];
|
|
7946
|
+
A[p] = { key: i, value: d }, r(A), l(A), m(null), c(""), u(""), g("");
|
|
7940
7947
|
}
|
|
7941
|
-
}, B = (
|
|
7942
|
-
|
|
7948
|
+
}, B = (A) => {
|
|
7949
|
+
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? S() : f());
|
|
7943
7950
|
};
|
|
7944
7951
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
7945
7952
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7946
7953
|
"form",
|
|
7947
7954
|
{
|
|
7948
|
-
onSubmit: (
|
|
7949
|
-
|
|
7955
|
+
onSubmit: (A) => {
|
|
7956
|
+
A.preventDefault(), p !== null ? S() : f();
|
|
7950
7957
|
},
|
|
7951
7958
|
className: "space-y-3",
|
|
7952
7959
|
children: [
|
|
@@ -7962,7 +7969,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7962
7969
|
id: "attrKey",
|
|
7963
7970
|
ref: E,
|
|
7964
7971
|
value: i,
|
|
7965
|
-
onChange: (
|
|
7972
|
+
onChange: (A) => c(A.target.value),
|
|
7966
7973
|
placeholder: "Key",
|
|
7967
7974
|
className: "h-8 text-sm"
|
|
7968
7975
|
}
|
|
@@ -7978,9 +7985,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7978
7985
|
spellCheck: "false",
|
|
7979
7986
|
id: "attrValue",
|
|
7980
7987
|
rows: 2,
|
|
7981
|
-
ref:
|
|
7988
|
+
ref: j,
|
|
7982
7989
|
value: d,
|
|
7983
|
-
onChange: (
|
|
7990
|
+
onChange: (A) => u(A.target.value),
|
|
7984
7991
|
onKeyDown: B,
|
|
7985
7992
|
placeholder: "Value",
|
|
7986
7993
|
className: "bg-background text-sm"
|
|
@@ -7993,22 +8000,22 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7993
8000
|
]
|
|
7994
8001
|
}
|
|
7995
8002
|
),
|
|
7996
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
8003
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((A, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
7997
8004
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
7998
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
7999
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
8005
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: A.key }),
|
|
8006
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: A.value.toString() })
|
|
8000
8007
|
] }),
|
|
8001
8008
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
8002
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(
|
|
8009
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(w), children: [
|
|
8003
8010
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
8004
8011
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
8005
8012
|
] }),
|
|
8006
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8013
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: [
|
|
8007
8014
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
8008
8015
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
8009
8016
|
] })
|
|
8010
8017
|
] })
|
|
8011
|
-
] },
|
|
8018
|
+
] }, w)) })
|
|
8012
8019
|
] });
|
|
8013
8020
|
}), BlockAttributesEditor = React.memo(() => {
|
|
8014
8021
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8384,30 +8391,39 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8384
8391
|
}, LanguageSelector = () => {
|
|
8385
8392
|
const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
|
|
8386
8393
|
const c = [];
|
|
8387
|
-
return forEach(uniq([...n
|
|
8394
|
+
return forEach(uniq([o, ...n]), (d) => {
|
|
8388
8395
|
const u = get(LANGUAGES, d);
|
|
8389
8396
|
u && c.push({ key: d, value: u, default: d === o });
|
|
8390
8397
|
}), c;
|
|
8391
8398
|
}, [o, n]);
|
|
8392
|
-
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm", children: [
|
|
8393
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8394
|
-
get(LANGUAGES, l)
|
|
8395
|
-
l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
|
|
8399
|
+
return isEmpty(n) && l === "en" ? null : isEmpty(n) && l !== "en" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600", children: [
|
|
8400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FaLanguage, { className: "h-4 w-4" }),
|
|
8401
|
+
get(LANGUAGES, l)
|
|
8396
8402
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
8397
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "
|
|
8398
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8399
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-
|
|
8403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
|
|
8404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FaLanguage, { className: "h-4 w-4" }),
|
|
8405
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
8400
8406
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
8401
8407
|
" ",
|
|
8402
8408
|
get(LANGUAGES, l)
|
|
8403
8409
|
] }),
|
|
8404
|
-
|
|
8410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon, { className: "h-4 w-4" })
|
|
8405
8411
|
] })
|
|
8406
8412
|
] }) }),
|
|
8407
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8413
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { className: "border-border", children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8414
|
+
DropdownMenuItem,
|
|
8415
|
+
{
|
|
8416
|
+
className: cn(
|
|
8417
|
+
"flex cursor-pointer items-center text-sm",
|
|
8418
|
+
c.key === l && "!bg-blue-500 text-white hover:!text-white"
|
|
8419
|
+
),
|
|
8420
|
+
onClick: () => a(c.key),
|
|
8421
|
+
children: [
|
|
8422
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c.value }),
|
|
8423
|
+
c.key === o ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaStar, { className: "ml-2 h-4 w-4 text-yellow-400" }) : null
|
|
8424
|
+
]
|
|
8425
|
+
}
|
|
8426
|
+
)) })
|
|
8411
8427
|
] });
|
|
8412
8428
|
}, CanvasTopBar = () => {
|
|
8413
8429
|
const o = useBuilderProp("darkMode", !0), [n] = useCanvasZoom();
|
|
@@ -8649,11 +8665,11 @@ const PageDataProviders = () => {
|
|
|
8649
8665
|
n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
|
|
8650
8666
|
(f) => !isNull(f)
|
|
8651
8667
|
), g = (f) => {
|
|
8652
|
-
const
|
|
8653
|
-
c((v) => [...v,
|
|
8668
|
+
const k = find(n, { providerKey: f });
|
|
8669
|
+
c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8654
8670
|
}, E = (f) => {
|
|
8655
|
-
c((
|
|
8656
|
-
},
|
|
8671
|
+
c((k) => filter(k, (v) => v.providerKey !== f.providerKey)), a((k) => filter(k, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
|
|
8672
|
+
}, j = (f) => m(f);
|
|
8657
8673
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8658
8674
|
o("no_data_providers"),
|
|
8659
8675
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8688,7 +8704,7 @@ const PageDataProviders = () => {
|
|
|
8688
8704
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8689
8705
|
"button",
|
|
8690
8706
|
{
|
|
8691
|
-
onClick: () =>
|
|
8707
|
+
onClick: () => j(f),
|
|
8692
8708
|
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",
|
|
8693
8709
|
children: [
|
|
8694
8710
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8749,7 +8765,7 @@ const PageDataProviders = () => {
|
|
|
8749
8765
|
function AiFillDatabase(o) {
|
|
8750
8766
|
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);
|
|
8751
8767
|
}
|
|
8752
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8768
|
+
const TopBar = lazy(() => import("./Topbar-XywrZPU2.js"));
|
|
8753
8769
|
function useSidebarMenuItems(o) {
|
|
8754
8770
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8755
8771
|
return useMemo(() => {
|