@chaibuilder/sdk 2.0.0-beta.107 → 2.0.0-beta.108
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/core.cjs +4 -4
- package/dist/core.d.ts +1 -1
- package/dist/core.js +191 -254
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -13,7 +13,7 @@ import { useTranslation as Ve } from "react-i18next";
|
|
|
13
13
|
import { g as generateUUID, a as getBreakpointValue, c as cn$1, G as GenIcon } from "./iconBase-DHfFLkem.js";
|
|
14
14
|
import { flip } from "@floating-ui/dom";
|
|
15
15
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
16
|
-
import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon,
|
|
16
|
+
import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, BoxIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, CheckIcon, SunIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
17
17
|
import { useThrottledCallback, useDebouncedCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
18
18
|
import { useFeature, FlagsProvider } from "flagged";
|
|
19
19
|
import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
@@ -22,7 +22,7 @@ import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThe
|
|
|
22
22
|
import TreeModel from "tree-model";
|
|
23
23
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
24
24
|
import { toast } from "sonner";
|
|
25
|
-
import { PlusIcon as PlusIcon$1,
|
|
25
|
+
import { PlusIcon as PlusIcon$1, ChevronRight, DatabaseIcon, ChevronLeft, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, X, Plus, PlusCircle, ChevronDown, Loader, SparklesIcon, EyeOff, Eye, SmileIcon, ShuffleIcon, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
26
26
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
27
27
|
import StarterKit from "@tiptap/starter-kit";
|
|
28
28
|
import typography from "@tailwindcss/typography";
|
|
@@ -102,96 +102,96 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
102
102
|
return (b = f.onMount) == null ? void 0 : b.call(f, h);
|
|
103
103
|
}, ...m) => {
|
|
104
104
|
const f = m[0] || ((w) => {
|
|
105
|
-
let
|
|
106
|
-
return
|
|
105
|
+
let L = o.get(w);
|
|
106
|
+
return L || (L = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(w, L), u == null || u(w, _)), L;
|
|
107
107
|
}), h = m[1] || (() => {
|
|
108
|
-
let w,
|
|
108
|
+
let w, L;
|
|
109
109
|
const k = (v) => {
|
|
110
110
|
try {
|
|
111
111
|
v();
|
|
112
112
|
} catch (N) {
|
|
113
|
-
w || (w = !0,
|
|
113
|
+
w || (w = !0, L = N);
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
do {
|
|
117
117
|
c.f && k(c.f);
|
|
118
118
|
const v = /* @__PURE__ */ new Set(), N = v.add.bind(v);
|
|
119
|
-
a.forEach((
|
|
120
|
-
var
|
|
121
|
-
return (
|
|
119
|
+
a.forEach((T) => {
|
|
120
|
+
var I;
|
|
121
|
+
return (I = n.get(T)) == null ? void 0 : I.l.forEach(N);
|
|
122
122
|
}), a.clear(), i.forEach(N), i.clear(), l.forEach(N), l.clear(), v.forEach(k), a.size && b();
|
|
123
123
|
} while (a.size || i.size || l.size);
|
|
124
124
|
if (w)
|
|
125
|
-
throw
|
|
125
|
+
throw L;
|
|
126
126
|
}), b = m[2] || (() => {
|
|
127
|
-
const w = [],
|
|
127
|
+
const w = [], L = /* @__PURE__ */ new WeakSet(), k = /* @__PURE__ */ new WeakSet(), v = Array.from(a);
|
|
128
128
|
for (; v.length; ) {
|
|
129
|
-
const N = v[v.length - 1],
|
|
129
|
+
const N = v[v.length - 1], T = f(N);
|
|
130
130
|
if (k.has(N)) {
|
|
131
131
|
v.pop();
|
|
132
132
|
continue;
|
|
133
133
|
}
|
|
134
|
-
if (
|
|
135
|
-
r.get(N) ===
|
|
134
|
+
if (L.has(N)) {
|
|
135
|
+
r.get(N) === T.n && w.push([N, T]), k.add(N), v.pop();
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
for (const
|
|
140
|
-
|
|
138
|
+
L.add(N);
|
|
139
|
+
for (const I of getMountedOrPendingDependents(N, T, n))
|
|
140
|
+
L.has(I) || v.push(I);
|
|
141
141
|
}
|
|
142
142
|
for (let N = w.length - 1; N >= 0; --N) {
|
|
143
|
-
const [
|
|
144
|
-
let
|
|
145
|
-
for (const E of
|
|
146
|
-
if (E !==
|
|
147
|
-
|
|
143
|
+
const [T, I] = w[N];
|
|
144
|
+
let R = !1;
|
|
145
|
+
for (const E of I.d.keys())
|
|
146
|
+
if (E !== T && a.has(E)) {
|
|
147
|
+
R = !0;
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
R && (x(T), j(T)), r.delete(T);
|
|
151
151
|
}
|
|
152
152
|
}), x = m[3] || ((w) => {
|
|
153
|
-
var
|
|
153
|
+
var L, k;
|
|
154
154
|
const v = f(w);
|
|
155
155
|
if (isAtomStateInitialized(v) && (n.has(w) && r.get(w) !== v.n || Array.from(v.d).every(
|
|
156
|
-
([
|
|
156
|
+
([P, O]) => (
|
|
157
157
|
// Recursively, read the atom state of the dependency, and
|
|
158
158
|
// check if the atom epoch number is unchanged
|
|
159
|
-
x(
|
|
159
|
+
x(P).n === O
|
|
160
160
|
)
|
|
161
161
|
)))
|
|
162
162
|
return v;
|
|
163
163
|
v.d.clear();
|
|
164
164
|
let N = !0;
|
|
165
|
-
const
|
|
165
|
+
const T = () => {
|
|
166
166
|
n.has(w) && (j(w), b(), h());
|
|
167
|
-
},
|
|
167
|
+
}, I = (P) => {
|
|
168
168
|
var O;
|
|
169
|
-
if (isSelfAtom(w,
|
|
170
|
-
const H = f(
|
|
169
|
+
if (isSelfAtom(w, P)) {
|
|
170
|
+
const H = f(P);
|
|
171
171
|
if (!isAtomStateInitialized(H))
|
|
172
|
-
if (hasInitialValue(
|
|
173
|
-
setAtomStateValueOrPromise(
|
|
172
|
+
if (hasInitialValue(P))
|
|
173
|
+
setAtomStateValueOrPromise(P, P.init, f);
|
|
174
174
|
else
|
|
175
175
|
throw new Error("no atom init");
|
|
176
176
|
return returnAtomValue(H);
|
|
177
177
|
}
|
|
178
|
-
const $ = x(
|
|
178
|
+
const $ = x(P);
|
|
179
179
|
try {
|
|
180
180
|
return returnAtomValue($);
|
|
181
181
|
} finally {
|
|
182
|
-
v.d.set(
|
|
182
|
+
v.d.set(P, $.n), isPendingPromise(v.v) && addPendingPromiseToDependency(w, v.v, $), (O = n.get(P)) == null || O.t.add(w), N || T();
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
-
let
|
|
185
|
+
let R, E;
|
|
186
186
|
const D = {
|
|
187
187
|
get signal() {
|
|
188
|
-
return
|
|
188
|
+
return R || (R = new AbortController()), R.signal;
|
|
189
189
|
},
|
|
190
190
|
get setSelf() {
|
|
191
|
-
return !E && isActuallyWritableAtom(w) && (E = (...
|
|
191
|
+
return !E && isActuallyWritableAtom(w) && (E = (...P) => {
|
|
192
192
|
if (!N)
|
|
193
193
|
try {
|
|
194
|
-
return A(w, ...
|
|
194
|
+
return A(w, ...P);
|
|
195
195
|
} finally {
|
|
196
196
|
b(), h();
|
|
197
197
|
}
|
|
@@ -199,66 +199,66 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
199
199
|
}
|
|
200
200
|
}, M = v.n;
|
|
201
201
|
try {
|
|
202
|
-
const
|
|
203
|
-
return setAtomStateValueOrPromise(w,
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
const P = d(w, I, D);
|
|
203
|
+
return setAtomStateValueOrPromise(w, P, f), isPromiseLike$2(P) && ((L = P.onCancel) == null || L.call(P, () => R == null ? void 0 : R.abort()), P.then(
|
|
204
|
+
T,
|
|
205
|
+
T
|
|
206
206
|
)), v;
|
|
207
|
-
} catch (
|
|
208
|
-
return delete v.v, v.e =
|
|
207
|
+
} catch (P) {
|
|
208
|
+
return delete v.v, v.e = P, ++v.n, v;
|
|
209
209
|
} finally {
|
|
210
210
|
N = !1, M !== v.n && r.get(w) === M && (r.set(w, v.n), a.add(w), (k = c.c) == null || k.call(c, w));
|
|
211
211
|
}
|
|
212
212
|
}), y = m[4] || ((w) => {
|
|
213
|
-
const
|
|
214
|
-
for (;
|
|
215
|
-
const k =
|
|
213
|
+
const L = [w];
|
|
214
|
+
for (; L.length; ) {
|
|
215
|
+
const k = L.pop(), v = f(k);
|
|
216
216
|
for (const N of getMountedOrPendingDependents(k, v, n)) {
|
|
217
|
-
const
|
|
218
|
-
r.set(N,
|
|
217
|
+
const T = f(N);
|
|
218
|
+
r.set(N, T.n), L.push(N);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
}), A = m[5] || ((w, ...
|
|
221
|
+
}), A = m[5] || ((w, ...L) => {
|
|
222
222
|
let k = !0;
|
|
223
|
-
const v = (
|
|
224
|
-
var
|
|
225
|
-
const E = f(
|
|
223
|
+
const v = (T) => returnAtomValue(x(T)), N = (T, ...I) => {
|
|
224
|
+
var R;
|
|
225
|
+
const E = f(T);
|
|
226
226
|
try {
|
|
227
|
-
if (isSelfAtom(w,
|
|
228
|
-
if (!hasInitialValue(
|
|
227
|
+
if (isSelfAtom(w, T)) {
|
|
228
|
+
if (!hasInitialValue(T))
|
|
229
229
|
throw new Error("atom not writable");
|
|
230
|
-
const D = E.n, M =
|
|
231
|
-
setAtomStateValueOrPromise(
|
|
230
|
+
const D = E.n, M = I[0];
|
|
231
|
+
setAtomStateValueOrPromise(T, M, f), j(T), D !== E.n && (a.add(T), (R = c.c) == null || R.call(c, T), y(T));
|
|
232
232
|
return;
|
|
233
233
|
} else
|
|
234
|
-
return A(
|
|
234
|
+
return A(T, ...I);
|
|
235
235
|
} finally {
|
|
236
236
|
k || (b(), h());
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
try {
|
|
240
|
-
return p(w, v, N, ...
|
|
240
|
+
return p(w, v, N, ...L);
|
|
241
241
|
} finally {
|
|
242
242
|
k = !1;
|
|
243
243
|
}
|
|
244
244
|
}), j = m[6] || ((w) => {
|
|
245
|
-
var
|
|
245
|
+
var L;
|
|
246
246
|
const k = f(w), v = n.get(w);
|
|
247
247
|
if (v && !isPendingPromise(k.v)) {
|
|
248
|
-
for (const [N,
|
|
248
|
+
for (const [N, T] of k.d)
|
|
249
249
|
if (!v.d.has(N)) {
|
|
250
|
-
const
|
|
251
|
-
C(N).t.add(w), v.d.add(N),
|
|
250
|
+
const I = f(N);
|
|
251
|
+
C(N).t.add(w), v.d.add(N), T !== I.n && (a.add(N), (L = c.c) == null || L.call(c, N), y(N));
|
|
252
252
|
}
|
|
253
253
|
for (const N of v.d || [])
|
|
254
254
|
if (!k.d.has(N)) {
|
|
255
255
|
v.d.delete(N);
|
|
256
|
-
const
|
|
257
|
-
|
|
256
|
+
const T = S(N);
|
|
257
|
+
T == null || T.t.delete(w);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
}), C = m[7] || ((w) => {
|
|
261
|
-
var
|
|
261
|
+
var L;
|
|
262
262
|
const k = f(w);
|
|
263
263
|
let v = n.get(w);
|
|
264
264
|
if (!v) {
|
|
@@ -269,28 +269,28 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
269
269
|
l: /* @__PURE__ */ new Set(),
|
|
270
270
|
d: new Set(k.d.keys()),
|
|
271
271
|
t: /* @__PURE__ */ new Set()
|
|
272
|
-
}, n.set(w, v), (
|
|
272
|
+
}, n.set(w, v), (L = c.m) == null || L.call(c, w), isActuallyWritableAtom(w)) {
|
|
273
273
|
const N = () => {
|
|
274
|
-
let
|
|
275
|
-
const
|
|
274
|
+
let T = !0;
|
|
275
|
+
const I = (...R) => {
|
|
276
276
|
try {
|
|
277
|
-
return A(w, ...
|
|
277
|
+
return A(w, ...R);
|
|
278
278
|
} finally {
|
|
279
|
-
|
|
279
|
+
T || (b(), h());
|
|
280
280
|
}
|
|
281
281
|
};
|
|
282
282
|
try {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
const R = g(w, I);
|
|
284
|
+
R && (v.u = () => {
|
|
285
|
+
T = !0;
|
|
286
286
|
try {
|
|
287
|
-
|
|
287
|
+
R();
|
|
288
288
|
} finally {
|
|
289
|
-
|
|
289
|
+
T = !1;
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
} finally {
|
|
293
|
-
|
|
293
|
+
T = !1;
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
l.add(N);
|
|
@@ -298,17 +298,17 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
298
298
|
}
|
|
299
299
|
return v;
|
|
300
300
|
}), S = m[8] || ((w) => {
|
|
301
|
-
var
|
|
301
|
+
var L;
|
|
302
302
|
const k = f(w);
|
|
303
303
|
let v = n.get(w);
|
|
304
304
|
if (v && !v.l.size && !Array.from(v.t).some((N) => {
|
|
305
|
-
var
|
|
306
|
-
return (
|
|
305
|
+
var T;
|
|
306
|
+
return (T = n.get(N)) == null ? void 0 : T.d.has(w);
|
|
307
307
|
})) {
|
|
308
|
-
v.u && i.add(v.u), v = void 0, n.delete(w), (
|
|
308
|
+
v.u && i.add(v.u), v = void 0, n.delete(w), (L = c.u) == null || L.call(c, w);
|
|
309
309
|
for (const N of k.d.keys()) {
|
|
310
|
-
const
|
|
311
|
-
|
|
310
|
+
const T = S(N);
|
|
311
|
+
T == null || T.t.delete(w);
|
|
312
312
|
}
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
@@ -339,17 +339,17 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
|
|
|
339
339
|
S
|
|
340
340
|
], _ = {
|
|
341
341
|
get: (w) => returnAtomValue(x(w)),
|
|
342
|
-
set: (w, ...
|
|
342
|
+
set: (w, ...L) => {
|
|
343
343
|
try {
|
|
344
|
-
return A(w, ...
|
|
344
|
+
return A(w, ...L);
|
|
345
345
|
} finally {
|
|
346
346
|
b(), h();
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
|
-
sub: (w,
|
|
349
|
+
sub: (w, L) => {
|
|
350
350
|
const v = C(w).l;
|
|
351
|
-
return v.add(
|
|
352
|
-
v.delete(
|
|
351
|
+
return v.add(L), h(), () => {
|
|
352
|
+
v.delete(L), S(w), h();
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
};
|
|
@@ -407,14 +407,14 @@ function splitAtom(o, n) {
|
|
|
407
407
|
}
|
|
408
408
|
return S[_];
|
|
409
409
|
}, A = (j, C, S) => {
|
|
410
|
-
const B = j(l), _ = j(o),
|
|
411
|
-
if (
|
|
410
|
+
const B = j(l), _ = j(o), L = a(_, B == null ? void 0 : B.arr).keyList.indexOf(b);
|
|
411
|
+
if (L < 0 || L >= _.length)
|
|
412
412
|
throw new Error("splitAtom: index out of bounds for write");
|
|
413
|
-
const k = isFunction(S) ? S(_[
|
|
414
|
-
Object.is(_[
|
|
415
|
-
..._.slice(0,
|
|
413
|
+
const k = isFunction(S) ? S(_[L]) : S;
|
|
414
|
+
Object.is(_[L], k) || C(o, [
|
|
415
|
+
..._.slice(0, L),
|
|
416
416
|
k,
|
|
417
|
-
..._.slice(
|
|
417
|
+
..._.slice(L + 1)
|
|
418
418
|
]);
|
|
419
419
|
};
|
|
420
420
|
g[h] = isWritable(o) ? atom(y, A) : atom(y);
|
|
@@ -1346,7 +1346,7 @@ const useBlocksStoreManager = () => {
|
|
|
1346
1346
|
return {
|
|
1347
1347
|
moveBlocks: (b, x, y) => {
|
|
1348
1348
|
const A = map(b, (C) => {
|
|
1349
|
-
const B = n.find((
|
|
1349
|
+
const B = n.find((L) => L._id === C)._parent || null, w = n.filter((L) => B ? L._parent === B : !L._parent).map((L) => L._id).indexOf(C);
|
|
1350
1350
|
return { _id: C, oldParent: B, oldPosition: w };
|
|
1351
1351
|
}), j = A.find(({ _id: C }) => C === b[0]);
|
|
1352
1352
|
j && j.oldParent === x && j.oldPosition === y || (i(b, x, y), o({
|
|
@@ -3791,7 +3791,10 @@ const getBlockRuntimeProps = memoize((o) => {
|
|
|
3791
3791
|
const [r] = useAtom$1(o), a = useMemo(() => getRegisteredChaiBlock(r._type), [r._type]), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useBlockRuntimeProps(), d = usePageExternalData(), [p] = useHiddenBlockIds(), [u] = useAtom$1(dataBindingActiveAtom), g = get(a, "component", null), m = useMemo(
|
|
3792
3792
|
() => u ? applyBinding(applyLanguage(r, l, a), d) : applyLanguage(r, l, a),
|
|
3793
3793
|
[r, l, a, d, u]
|
|
3794
|
-
), f = useMemo(() => getBlockTagAttributes(r), [r
|
|
3794
|
+
), f = useMemo(() => getBlockTagAttributes(r), [r, getBlockTagAttributes]), h = useMemo(
|
|
3795
|
+
() => c(r._id, getBlockRuntimeProps(r._type)),
|
|
3796
|
+
[r._id, r._type, c, getBlockRuntimeProps]
|
|
3797
|
+
), b = useMemo(() => !has(a, "dataProvider") || !isFunction$1(a.dataProvider) ? {} : a.dataProvider(r, l), [r, l, a]), x = useMemo(
|
|
3795
3798
|
() => ({
|
|
3796
3799
|
blockProps: {
|
|
3797
3800
|
"data-block-id": r._id,
|
|
@@ -3804,7 +3807,16 @@ const getBlockRuntimeProps = memoize((o) => {
|
|
|
3804
3807
|
...h,
|
|
3805
3808
|
...b
|
|
3806
3809
|
}),
|
|
3807
|
-
[
|
|
3810
|
+
[
|
|
3811
|
+
r._id,
|
|
3812
|
+
r._type,
|
|
3813
|
+
l,
|
|
3814
|
+
i,
|
|
3815
|
+
m,
|
|
3816
|
+
f,
|
|
3817
|
+
h,
|
|
3818
|
+
b
|
|
3819
|
+
]
|
|
3808
3820
|
);
|
|
3809
3821
|
return isNull(g) || p.includes(r._id) ? null : /* @__PURE__ */ jsx(Suspense, { children: createElement(g, { ...x, children: n }) });
|
|
3810
3822
|
}, GlobalBlocksRenderer = ({ globalBlockId: o }) => {
|
|
@@ -3938,87 +3950,9 @@ const getBlockRuntimeProps = memoize((o) => {
|
|
|
3938
3950
|
}, FallbackError = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3939
3951
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3940
3952
|
/* @__PURE__ */ jsx("p", { children: "Please try again." })
|
|
3941
|
-
] }) }), TypeIcon = (o) => {
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
return /* @__PURE__ */ jsx(GlobeIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3945
|
-
case "Image":
|
|
3946
|
-
return /* @__PURE__ */ jsx(ImageIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3947
|
-
case "Heading":
|
|
3948
|
-
return /* @__PURE__ */ jsx(HeadingIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3949
|
-
case "Text":
|
|
3950
|
-
return /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3951
|
-
case "Link":
|
|
3952
|
-
return /* @__PURE__ */ jsx(Link1Icon, { className: "h-3 w-3 stroke-[2]" });
|
|
3953
|
-
case "Video":
|
|
3954
|
-
return /* @__PURE__ */ jsx(VideoIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3955
|
-
case "RichText":
|
|
3956
|
-
return /* @__PURE__ */ jsx(CursorTextIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3957
|
-
case "Button":
|
|
3958
|
-
case "DropdownButton":
|
|
3959
|
-
return /* @__PURE__ */ jsx(ButtonIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3960
|
-
case "CustomHTML":
|
|
3961
|
-
return /* @__PURE__ */ jsx(CodeIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3962
|
-
case "Divider":
|
|
3963
|
-
return /* @__PURE__ */ jsx(DividerHorizontalIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3964
|
-
case "Icon":
|
|
3965
|
-
return /* @__PURE__ */ jsx(SketchLogoIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3966
|
-
case "List":
|
|
3967
|
-
return /* @__PURE__ */ jsx(RowsIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3968
|
-
case "Paragraph":
|
|
3969
|
-
return /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3970
|
-
case "Row":
|
|
3971
|
-
return /* @__PURE__ */ jsx(Rows, { className: "h-3 w-3 stroke-[2]" });
|
|
3972
|
-
case "Column":
|
|
3973
|
-
return /* @__PURE__ */ jsx(Columns, { className: "h-3 w-3 stroke-[2]" });
|
|
3974
|
-
case "ListItem":
|
|
3975
|
-
return /* @__PURE__ */ jsx(ColumnsIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3976
|
-
case "LineBreak":
|
|
3977
|
-
return /* @__PURE__ */ jsx(SpaceBetweenVerticallyIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3978
|
-
case "Form":
|
|
3979
|
-
return /* @__PURE__ */ jsx(GroupIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3980
|
-
case "Checkbox":
|
|
3981
|
-
return /* @__PURE__ */ jsx(CheckboxIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3982
|
-
case "FormButton":
|
|
3983
|
-
return /* @__PURE__ */ jsx(ButtonIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3984
|
-
case "Input":
|
|
3985
|
-
case "TextArea":
|
|
3986
|
-
return /* @__PURE__ */ jsx(InputIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3987
|
-
case "Radio":
|
|
3988
|
-
return /* @__PURE__ */ jsx(RadiobuttonIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3989
|
-
case "Select":
|
|
3990
|
-
return /* @__PURE__ */ jsx(DropdownMenuIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3991
|
-
case "Table":
|
|
3992
|
-
return /* @__PURE__ */ jsx(TableIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3993
|
-
case "TableHead":
|
|
3994
|
-
return /* @__PURE__ */ jsx(BorderTopIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3995
|
-
case "TableBody":
|
|
3996
|
-
return /* @__PURE__ */ jsx(BorderAllIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3997
|
-
case "TableRow":
|
|
3998
|
-
return /* @__PURE__ */ jsx(ViewHorizontalIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
3999
|
-
case "TableCell":
|
|
4000
|
-
return /* @__PURE__ */ jsx(DragHandleHorizontalIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4001
|
-
case "DataProvider":
|
|
4002
|
-
return /* @__PURE__ */ jsx(DatabaseIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4003
|
-
case "Box":
|
|
4004
|
-
return /* @__PURE__ */ jsx(BoxIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4005
|
-
case "Dropdown":
|
|
4006
|
-
return /* @__PURE__ */ jsx(DropdownMenuIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4007
|
-
case "DropdownContent":
|
|
4008
|
-
return /* @__PURE__ */ jsx(ReaderIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4009
|
-
case "Slider":
|
|
4010
|
-
return /* @__PURE__ */ jsx(UnfoldHorizontal, { className: "h-3 w-3 stroke-[2]" });
|
|
4011
|
-
case "Slides":
|
|
4012
|
-
return /* @__PURE__ */ jsx(AlignHorizontalJustifyStart, { className: "h-3 w-3 stroke-[2]" });
|
|
4013
|
-
case "Slide":
|
|
4014
|
-
return /* @__PURE__ */ jsx(AppWindowIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4015
|
-
case "SlidePreviousButton":
|
|
4016
|
-
return /* @__PURE__ */ jsx(PanelRightOpen, { className: "h-3 w-3 stroke-[2]" });
|
|
4017
|
-
case "SlideNextButton":
|
|
4018
|
-
return /* @__PURE__ */ jsx(PanelRightClose, { className: "h-3 w-3 stroke-[2]" });
|
|
4019
|
-
default:
|
|
4020
|
-
return /* @__PURE__ */ jsx(BoxModelIcon, { className: "h-3 w-3 stroke-[2]" });
|
|
4021
|
-
}
|
|
3953
|
+
] }) }), ICON_CLASS = "h-3 w-3 stroke-[2]", TypeIcon = (o) => {
|
|
3954
|
+
const n = useRegisteredChaiBlocks(), r = get(n, [o == null ? void 0 : o.type, "icon"]);
|
|
3955
|
+
return r ? React__default.createElement(r, { className: ICON_CLASS }) : /* @__PURE__ */ jsx(BoxModelIcon, { className: ICON_CLASS });
|
|
4022
3956
|
}, Breadcrumb = () => {
|
|
4023
3957
|
const o = useSelectedBlockHierarchy(), [, n] = useSelectedBlockIds(), { highlightBlock: r } = useBlockHighlight();
|
|
4024
3958
|
return /* @__PURE__ */ jsx("div", { className: "-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
|
|
@@ -4803,8 +4737,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4803
4737
|
pageTypes: n,
|
|
4804
4738
|
onChange: r
|
|
4805
4739
|
}) => {
|
|
4806
|
-
var
|
|
4807
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (k, v) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, f] = useState(""), [h, b] = useState([]), [x, y] = useState(-1), A = useRef(null), j = (
|
|
4740
|
+
var L;
|
|
4741
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (k, v) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, f] = useState(""), [h, b] = useState([]), [x, y] = useState(-1), A = useRef(null), j = (L = n == null ? void 0 : n.find((k) => k.key === u)) == null ? void 0 : L.name;
|
|
4808
4742
|
useEffect(() => {
|
|
4809
4743
|
if (f(""), b([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4810
4744
|
const k = split(o, ":"), v = get(k, 1, "page") || "page";
|
|
@@ -5117,24 +5051,24 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5117
5051
|
}) => {
|
|
5118
5052
|
const { selectedLang: f, fallbackLang: h, languages: b } = useLanguages(), x = isEmpty(b) ? "" : isEmpty(f) ? h : f, y = get(LANGUAGES, x, x), A = usePageExternalData(), j = useSelectedBlock(), C = useRegisteredChaiBlocks(), S = get(C, [j == null ? void 0 : j._type, "i18nProps"], []) || [], [B, _] = useState(null), w = useCallback(
|
|
5119
5053
|
(v) => {
|
|
5120
|
-
const N = (E) => /[.,!?;:]/.test(E),
|
|
5121
|
-
let
|
|
5054
|
+
const N = (E) => /[.,!?;:]/.test(E), T = (E, D, M) => {
|
|
5055
|
+
let P = "", O = "";
|
|
5122
5056
|
const $ = D > 0 ? E[D - 1] : "", H = D < E.length ? E[D] : "";
|
|
5123
|
-
return D > 0 && ($ === "." || !N($) && $ !== " ") && (
|
|
5124
|
-
text:
|
|
5125
|
-
prefixLength:
|
|
5057
|
+
return D > 0 && ($ === "." || !N($) && $ !== " ") && (P = " "), D < E.length && !N(H) && H !== " " && (O = " "), {
|
|
5058
|
+
text: P + M + O,
|
|
5059
|
+
prefixLength: P.length,
|
|
5126
5060
|
suffixLength: O.length
|
|
5127
5061
|
};
|
|
5128
|
-
},
|
|
5129
|
-
if (!
|
|
5130
|
-
const
|
|
5131
|
-
if (
|
|
5132
|
-
const E =
|
|
5062
|
+
}, I = document.getElementById(o);
|
|
5063
|
+
if (!I) return;
|
|
5064
|
+
const R = document.getElementById(`chai-rte-${o}`) || document.getElementById(`chai-rte-modal-${o}`);
|
|
5065
|
+
if (R && (R.querySelector(".ProseMirror") || R.__chaiRTE)) {
|
|
5066
|
+
const E = R.__chaiRTE;
|
|
5133
5067
|
if (E) {
|
|
5134
5068
|
const D = `{{${v}}}`;
|
|
5135
5069
|
E.commands.focus();
|
|
5136
|
-
const { from: M, to:
|
|
5137
|
-
if (M !==
|
|
5070
|
+
const { from: M, to: P } = E.state.selection;
|
|
5071
|
+
if (M !== P)
|
|
5138
5072
|
E.chain().deleteSelection().insertContent(D).run();
|
|
5139
5073
|
else {
|
|
5140
5074
|
const { state: $ } = E, H = $.selection.from, F = $.doc.textBetween(Math.max(0, H - 1), H), U = $.doc.textBetween(H, Math.min(H + 1, $.doc.content.size));
|
|
@@ -5147,13 +5081,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5147
5081
|
return;
|
|
5148
5082
|
}
|
|
5149
5083
|
} else {
|
|
5150
|
-
const E =
|
|
5151
|
-
if (
|
|
5152
|
-
const U = `{{${v}}}`, { text: z } =
|
|
5084
|
+
const E = I, D = E.selectionStart || 0, M = E.value || "", P = E.selectionEnd || D;
|
|
5085
|
+
if (P > D) {
|
|
5086
|
+
const U = `{{${v}}}`, { text: z } = T(M, D, U), W = M.slice(0, D) + z + M.slice(P);
|
|
5153
5087
|
m(W, {}, o);
|
|
5154
5088
|
return;
|
|
5155
5089
|
}
|
|
5156
|
-
const $ = `{{${v}}}`, { text: H } =
|
|
5090
|
+
const $ = `{{${v}}}`, { text: H } = T(M, D, $), F = M.slice(0, D) + H + M.slice(D);
|
|
5157
5091
|
m(F, {}, o);
|
|
5158
5092
|
}
|
|
5159
5093
|
},
|
|
@@ -5254,7 +5188,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5254
5188
|
schema: n,
|
|
5255
5189
|
formData: a,
|
|
5256
5190
|
onChange: ({ formData: g }, m) => {
|
|
5257
|
-
if (
|
|
5191
|
+
if (!m || o !== (g == null ? void 0 : g._id)) return;
|
|
5258
5192
|
const f = take(m.split("."), 2).join(".").replace("root.", "");
|
|
5259
5193
|
u({ formData: g }, f);
|
|
5260
5194
|
}
|
|
@@ -5607,25 +5541,25 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5607
5541
|
] });
|
|
5608
5542
|
};
|
|
5609
5543
|
function ManualClasses() {
|
|
5610
|
-
var
|
|
5611
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), f = useBuilderProp("askAiCallBack", null), [h, b] = useState(""), x = (
|
|
5612
|
-
const
|
|
5613
|
-
u(m,
|
|
5614
|
-
}, [C, S] = useState([]), B = ({ value:
|
|
5615
|
-
const
|
|
5544
|
+
var T;
|
|
5545
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), f = useBuilderProp("askAiCallBack", null), [h, b] = useState(""), x = (T = first(d)) == null ? void 0 : T.prop, { classes: y } = getSplitChaiClasses(get(p, x, "")), A = y.split(" ").filter((I) => !isEmpty(I)), j = () => {
|
|
5546
|
+
const I = h.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5547
|
+
u(m, I, !0), b("");
|
|
5548
|
+
}, [C, S] = useState([]), B = ({ value: I }) => {
|
|
5549
|
+
const R = I.trim().toLowerCase(), E = R.match(/.+:/g);
|
|
5616
5550
|
let D = [];
|
|
5617
5551
|
if (E && E.length > 0) {
|
|
5618
|
-
const [M] = E,
|
|
5619
|
-
D = i.search(
|
|
5552
|
+
const [M] = E, P = R.replace(M, "");
|
|
5553
|
+
D = i.search(P).map(($) => ({
|
|
5620
5554
|
...$,
|
|
5621
5555
|
item: { ...$.item, name: M + $.item.name }
|
|
5622
5556
|
}));
|
|
5623
5557
|
} else
|
|
5624
|
-
D = i.search(
|
|
5558
|
+
D = i.search(R);
|
|
5625
5559
|
return S(map(D, "item"));
|
|
5626
5560
|
}, _ = () => {
|
|
5627
5561
|
S([]);
|
|
5628
|
-
}, w = (
|
|
5562
|
+
}, w = (I) => I.name, L = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), k = useMemo(
|
|
5629
5563
|
() => ({
|
|
5630
5564
|
ref: o,
|
|
5631
5565
|
autoComplete: "off",
|
|
@@ -5634,17 +5568,17 @@ function ManualClasses() {
|
|
|
5634
5568
|
spellCheck: !1,
|
|
5635
5569
|
placeholder: c("Enter classes separated by space"),
|
|
5636
5570
|
value: h,
|
|
5637
|
-
onKeyDown: (
|
|
5638
|
-
|
|
5571
|
+
onKeyDown: (I) => {
|
|
5572
|
+
I.key === "Enter" && h.trim() !== "" && j();
|
|
5639
5573
|
},
|
|
5640
|
-
onChange: (
|
|
5574
|
+
onChange: (I, { newValue: R }) => b(R),
|
|
5641
5575
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5642
5576
|
}),
|
|
5643
5577
|
[h, c, o]
|
|
5644
|
-
), v = (
|
|
5578
|
+
), v = (I) => {
|
|
5645
5579
|
debugger;
|
|
5646
|
-
const
|
|
5647
|
-
g(m, [
|
|
5580
|
+
const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5581
|
+
g(m, [I]), u(m, R, !0), r(""), l(-1);
|
|
5648
5582
|
}, N = () => {
|
|
5649
5583
|
if (navigator.clipboard === void 0) {
|
|
5650
5584
|
toast.error(c("Clipboard not supported"));
|
|
@@ -5677,7 +5611,7 @@ function ManualClasses() {
|
|
|
5677
5611
|
onSuggestionsFetchRequested: B,
|
|
5678
5612
|
onSuggestionsClearRequested: _,
|
|
5679
5613
|
getSuggestionValue: w,
|
|
5680
|
-
renderSuggestion:
|
|
5614
|
+
renderSuggestion: L,
|
|
5681
5615
|
inputProps: k,
|
|
5682
5616
|
containerProps: {
|
|
5683
5617
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
@@ -5702,37 +5636,37 @@ function ManualClasses() {
|
|
|
5702
5636
|
)
|
|
5703
5637
|
] }),
|
|
5704
5638
|
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: A.map(
|
|
5705
|
-
(
|
|
5639
|
+
(I, R) => a === R ? /* @__PURE__ */ jsx(
|
|
5706
5640
|
"input",
|
|
5707
5641
|
{
|
|
5708
5642
|
ref: o,
|
|
5709
5643
|
value: n,
|
|
5710
5644
|
onChange: (E) => r(E.target.value),
|
|
5711
5645
|
onBlur: () => {
|
|
5712
|
-
v(
|
|
5646
|
+
v(I);
|
|
5713
5647
|
},
|
|
5714
5648
|
onKeyDown: (E) => {
|
|
5715
|
-
E.key === "Enter" && v(
|
|
5649
|
+
E.key === "Enter" && v(I);
|
|
5716
5650
|
},
|
|
5717
5651
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
|
|
5718
5652
|
},
|
|
5719
|
-
|
|
5653
|
+
I
|
|
5720
5654
|
) : /* @__PURE__ */ jsxs(
|
|
5721
5655
|
"button",
|
|
5722
5656
|
{
|
|
5723
5657
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5724
5658
|
children: [
|
|
5725
|
-
|
|
5726
|
-
n !==
|
|
5659
|
+
I,
|
|
5660
|
+
n !== I && /* @__PURE__ */ jsx(
|
|
5727
5661
|
Cross2Icon,
|
|
5728
5662
|
{
|
|
5729
|
-
onClick: () => g(m, [
|
|
5663
|
+
onClick: () => g(m, [I], !0),
|
|
5730
5664
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5731
5665
|
}
|
|
5732
5666
|
)
|
|
5733
5667
|
]
|
|
5734
5668
|
},
|
|
5735
|
-
|
|
5669
|
+
I
|
|
5736
5670
|
)
|
|
5737
5671
|
) })
|
|
5738
5672
|
] });
|
|
@@ -6358,11 +6292,11 @@ const COLOR_PROP = {
|
|
|
6358
6292
|
}
|
|
6359
6293
|
if (get(v, "value") === "")
|
|
6360
6294
|
return;
|
|
6361
|
-
const
|
|
6362
|
-
k ? _(
|
|
6295
|
+
const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
6296
|
+
k ? _(I) : B(I);
|
|
6363
6297
|
},
|
|
6364
6298
|
[B, _, a, m, d, u]
|
|
6365
|
-
),
|
|
6299
|
+
), L = useCallback(
|
|
6366
6300
|
(k) => {
|
|
6367
6301
|
const v = getUserInputValues(`${a}`, u);
|
|
6368
6302
|
if (get(v, "error", !1)) {
|
|
@@ -6375,8 +6309,8 @@ const COLOR_PROP = {
|
|
|
6375
6309
|
}
|
|
6376
6310
|
if (get(v, "value") === "")
|
|
6377
6311
|
return;
|
|
6378
|
-
const N = get(v, "unit") !== "" ? get(v, "unit") : k,
|
|
6379
|
-
B(
|
|
6312
|
+
const N = get(v, "unit") !== "" ? get(v, "unit") : k, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
|
|
6313
|
+
B(I);
|
|
6380
6314
|
},
|
|
6381
6315
|
[B, a, d, u]
|
|
6382
6316
|
);
|
|
@@ -6409,8 +6343,8 @@ const COLOR_PROP = {
|
|
|
6409
6343
|
const v = parseInt$1(k.target.value);
|
|
6410
6344
|
let N = isNaN$1(v) ? 0 : v;
|
|
6411
6345
|
k.keyCode === 38 && (N += 1), k.keyCode === 40 && (N -= 1);
|
|
6412
|
-
const
|
|
6413
|
-
_(
|
|
6346
|
+
const T = `${N}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
6347
|
+
_(R);
|
|
6414
6348
|
},
|
|
6415
6349
|
onKeyUp: (k) => {
|
|
6416
6350
|
C && (k.preventDefault(), S(!1));
|
|
@@ -6449,7 +6383,7 @@ const COLOR_PROP = {
|
|
|
6449
6383
|
units: u,
|
|
6450
6384
|
current: m,
|
|
6451
6385
|
onSelect: (k) => {
|
|
6452
|
-
r(!1), f(k),
|
|
6386
|
+
r(!1), f(k), L(k);
|
|
6453
6387
|
}
|
|
6454
6388
|
}
|
|
6455
6389
|
) }) })
|
|
@@ -6462,15 +6396,15 @@ const COLOR_PROP = {
|
|
|
6462
6396
|
onDragEnd: (k) => {
|
|
6463
6397
|
if (y(() => ""), j(!1), isEmpty(k))
|
|
6464
6398
|
return;
|
|
6465
|
-
const v = `${k}`,
|
|
6466
|
-
B(
|
|
6399
|
+
const v = `${k}`, T = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
6400
|
+
B(T);
|
|
6467
6401
|
},
|
|
6468
6402
|
onDrag: (k) => {
|
|
6469
6403
|
if (isEmpty(k))
|
|
6470
6404
|
return;
|
|
6471
6405
|
y(k);
|
|
6472
|
-
const v = `${k}`,
|
|
6473
|
-
_(
|
|
6406
|
+
const v = `${k}`, T = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
6407
|
+
_(T);
|
|
6474
6408
|
},
|
|
6475
6409
|
currentValue: a,
|
|
6476
6410
|
unit: m,
|
|
@@ -6569,9 +6503,9 @@ const COLOR_PROP = {
|
|
|
6569
6503
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6570
6504
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), f = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), x = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
|
|
6571
6505
|
(_, w = !0) => {
|
|
6572
|
-
const
|
|
6573
|
-
(p || u !== "") && (
|
|
6574
|
-
const k = generateFullClsName(
|
|
6506
|
+
const L = { dark: p, mq: g, mod: u, cls: _, property: l, fullCls: "" };
|
|
6507
|
+
(p || u !== "") && (L.mq = "xs");
|
|
6508
|
+
const k = generateFullClsName(L);
|
|
6575
6509
|
f(b, [k], w);
|
|
6576
6510
|
},
|
|
6577
6511
|
[b, p, g, u, l, f]
|
|
@@ -6951,6 +6885,9 @@ const CoreBlock = ({
|
|
|
6951
6885
|
required: "required",
|
|
6952
6886
|
multiple: "multiple",
|
|
6953
6887
|
name: "fieldName"
|
|
6888
|
+
},
|
|
6889
|
+
form: {
|
|
6890
|
+
action: "action"
|
|
6954
6891
|
}
|
|
6955
6892
|
}, shouldAddText = (o, n) => o.children.length === 1 && includes(
|
|
6956
6893
|
["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
|
|
@@ -7156,7 +7093,7 @@ const CoreBlock = ({
|
|
|
7156
7093
|
return hasVideoEmbed(C) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(C)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = C, [a];
|
|
7157
7094
|
} else if (r.tagName === "svg") {
|
|
7158
7095
|
const C = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), B = get(C, "value") ? `[${get(C, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", w = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
7159
|
-
return a.styles = `${STYLES_KEY}, ${cn$1(`w-${_} h-${B}`, w)}`.trim(), r.attributes = filter(r.attributes, (
|
|
7096
|
+
return a.styles = `${STYLES_KEY}, ${cn$1(`w-${_} h-${B}`, w)}`.trim(), r.attributes = filter(r.attributes, (L) => !includes(["style", "width", "height", "class"], L.key)), a.icon = stringify([r]), [a];
|
|
7160
7097
|
} else if (r.tagName == "option" && n && ((j = n.block) == null ? void 0 : j._type) === "Select")
|
|
7161
7098
|
return n.block.options.push({
|
|
7162
7099
|
label: getTextContent(r.children),
|
|
@@ -7680,7 +7617,7 @@ function BiExpandVertical(o) {
|
|
|
7680
7617
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
|
|
7681
7618
|
}
|
|
7682
7619
|
const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
7683
|
-
var
|
|
7620
|
+
var R;
|
|
7684
7621
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
7685
7622
|
let p = null;
|
|
7686
7623
|
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: f, data: h, isSelected: b, willReceiveDrop: x, isDragging: y, isEditing: A, handleClick: j } = o, C = (E) => {
|
|
@@ -7689,7 +7626,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7689
7626
|
E.isInternal && (p = E.isOpen, E.isOpen && E.close());
|
|
7690
7627
|
}, B = (E) => {
|
|
7691
7628
|
E.isInternal && p !== null && (p ? E.open() : E.close(), p = null);
|
|
7692
|
-
}, [_, w] = useAtom$1(currentAddSelection),
|
|
7629
|
+
}, [_, w] = useAtom$1(currentAddSelection), L = () => {
|
|
7693
7630
|
var E;
|
|
7694
7631
|
k(), o.parent.isSelected || w((E = o == null ? void 0 : o.parent) == null ? void 0 : E.id);
|
|
7695
7632
|
}, k = () => {
|
|
@@ -7707,16 +7644,16 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7707
7644
|
const E = Object.keys(h), D = [];
|
|
7708
7645
|
for (let M = 0; M < E.length; M++)
|
|
7709
7646
|
if (E[M].endsWith("_attrs")) {
|
|
7710
|
-
const
|
|
7647
|
+
const P = h[E[M]], O = Object.keys(P).join("|");
|
|
7711
7648
|
O.match(/x-data/) && D.push("data"), O.match(/x-on/) && D.push("event"), O.match(/x-show|x-if/) && D.push("show");
|
|
7712
7649
|
}
|
|
7713
7650
|
return D;
|
|
7714
|
-
}, [h]),
|
|
7715
|
-
const M = d.contentDocument || d.contentWindow.document,
|
|
7716
|
-
|
|
7717
|
-
const O =
|
|
7718
|
-
O.top >= $.top && O.left >= $.left && O.bottom <= $.bottom && O.right <= $.right || (M.documentElement.scrollTop =
|
|
7719
|
-
},
|
|
7651
|
+
}, [h]), T = (E, D) => {
|
|
7652
|
+
const M = d.contentDocument || d.contentWindow.document, P = M.querySelector(`[data-block-id=${E}]`);
|
|
7653
|
+
P && P.setAttribute("data-drop", D);
|
|
7654
|
+
const O = P.getBoundingClientRect(), $ = d.getBoundingClientRect();
|
|
7655
|
+
O.top >= $.top && O.left >= $.left && O.bottom <= $.bottom && O.right <= $.right || (M.documentElement.scrollTop = P.offsetTop - $.top);
|
|
7656
|
+
}, I = (E) => {
|
|
7720
7657
|
k();
|
|
7721
7658
|
const D = get(o, "parent.id");
|
|
7722
7659
|
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: E }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: E });
|
|
@@ -7726,7 +7663,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7726
7663
|
/* @__PURE__ */ jsx(
|
|
7727
7664
|
"div",
|
|
7728
7665
|
{
|
|
7729
|
-
onClick: () =>
|
|
7666
|
+
onClick: () => I(-1),
|
|
7730
7667
|
className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
|
|
7731
7668
|
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-purple-500 px-3 py-1 text-[9px] leading-tight text-white hover:bg-purple-500", children: [
|
|
7732
7669
|
/* @__PURE__ */ jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
|
|
@@ -7748,22 +7685,22 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, drag
|
|
|
7748
7685
|
onDragStart: () => S(o),
|
|
7749
7686
|
onDragEnd: () => B(o),
|
|
7750
7687
|
onDragOver: (E) => {
|
|
7751
|
-
E.preventDefault(),
|
|
7688
|
+
E.preventDefault(), T(f, "yes");
|
|
7752
7689
|
},
|
|
7753
7690
|
onDragLeave: (E) => {
|
|
7754
|
-
E.preventDefault(),
|
|
7691
|
+
E.preventDefault(), T(f, "no");
|
|
7755
7692
|
},
|
|
7756
7693
|
onDrop: (E) => {
|
|
7757
|
-
E.preventDefault(),
|
|
7694
|
+
E.preventDefault(), T(f, "no");
|
|
7758
7695
|
},
|
|
7759
7696
|
children: [
|
|
7760
|
-
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((
|
|
7697
|
+
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
7761
7698
|
"div",
|
|
7762
7699
|
{
|
|
7763
7700
|
onClick: (E) => {
|
|
7764
|
-
E.stopPropagation(),
|
|
7701
|
+
E.stopPropagation(), I(o.childIndex);
|
|
7765
7702
|
},
|
|
7766
|
-
onMouseEnter:
|
|
7703
|
+
onMouseEnter: L,
|
|
7767
7704
|
onMouseLeave: k,
|
|
7768
7705
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-purple-500 opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7769
7706
|
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[4] text-white" }) })
|