@chaibuilder/sdk 1.2.114 → 1.2.115
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-BWHGysUw.cjs → CodeEditor-Dl56nrsL.cjs} +1 -1
- package/dist/{CodeEditor-q9he9IC8.js → CodeEditor-lBqxrWBC.js} +1 -1
- package/dist/{Topbar-8LnyJF7S.cjs → Topbar-55E9bvvx.cjs} +1 -1
- package/dist/{Topbar-86JxE7Uw.js → Topbar-W4Ri5E2K.js} +1 -1
- package/dist/{UnsplashImages-chQ74Yzq.js → UnsplashImages--HU-110a.js} +1 -1
- package/dist/{UnsplashImages-MLEjengP.cjs → UnsplashImages-UlBSnkVK.cjs} +1 -1
- package/dist/{UploadImages-Auy8ZPBl.js → UploadImages-bc0b7i8I.js} +1 -1
- package/dist/{UploadImages--77rHMEx.cjs → UploadImages-e8RX7lNs.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-KsZZcMSu.cjs → index-UAobRy8V.cjs} +5 -5
- package/dist/{index-IZpHf_8d.js → index-suTYVyMn.js} +732 -728
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var F = (o, n, r) => (
|
|
2
|
+
var W = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
+
var F = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
@@ -89,249 +89,249 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
89
89
|
const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
|
|
90
90
|
let a, l, i;
|
|
91
91
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
92
|
-
const c = (
|
|
93
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(
|
|
94
|
-
const
|
|
95
|
-
if (o.set(
|
|
96
|
-
const
|
|
97
|
-
cancelPromise(
|
|
92
|
+
const c = (f) => o.get(f), d = (f, C) => {
|
|
93
|
+
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(C);
|
|
94
|
+
const v = o.get(f);
|
|
95
|
+
if (o.set(f, C), r.has(f) || r.set(f, v), v && hasPromiseAtomValue(v)) {
|
|
96
|
+
const R = "v" in C ? C.v instanceof Promise ? C.v : Promise.resolve(C.v) : Promise.reject(C.e);
|
|
97
|
+
cancelPromise(v.v, R);
|
|
98
98
|
}
|
|
99
|
-
}, u = (
|
|
100
|
-
const
|
|
99
|
+
}, u = (f, C, v) => {
|
|
100
|
+
const R = /* @__PURE__ */ new Map();
|
|
101
101
|
let I = !1;
|
|
102
|
-
|
|
103
|
-
!
|
|
104
|
-
}), (I ||
|
|
105
|
-
}, p = (
|
|
106
|
-
const
|
|
107
|
-
d: (
|
|
108
|
-
v
|
|
102
|
+
v.forEach((T, P) => {
|
|
103
|
+
!T && P === f && (T = C), T ? (R.set(P, T), C.d.get(P) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
104
|
+
}), (I || C.d.size !== R.size) && (C.d = R);
|
|
105
|
+
}, p = (f, C, v) => {
|
|
106
|
+
const R = c(f), I = {
|
|
107
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
108
|
+
v: C
|
|
109
109
|
};
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
I.v =
|
|
110
|
+
if (v && u(f, I, v), R && isEqualAtomValue(R, I) && R.d === I.d)
|
|
111
|
+
return R;
|
|
112
|
+
if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
|
|
113
|
+
if (R.d === I.d)
|
|
114
|
+
return R;
|
|
115
|
+
I.v = R.v;
|
|
116
116
|
}
|
|
117
|
-
return d(
|
|
118
|
-
},
|
|
119
|
-
if (isPromiseLike$2(
|
|
117
|
+
return d(f, I), I;
|
|
118
|
+
}, m = (f, C, v, R) => {
|
|
119
|
+
if (isPromiseLike$2(C)) {
|
|
120
120
|
let I;
|
|
121
|
-
const
|
|
121
|
+
const T = new Promise((P, O) => {
|
|
122
122
|
let M = !1;
|
|
123
|
-
|
|
123
|
+
C.then(
|
|
124
124
|
(V) => {
|
|
125
125
|
if (!M) {
|
|
126
126
|
M = !0;
|
|
127
|
-
const $ = c(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const $ = c(f), H = p(
|
|
128
|
+
f,
|
|
129
|
+
T,
|
|
130
|
+
v
|
|
131
131
|
);
|
|
132
|
-
resolvePromise(
|
|
132
|
+
resolvePromise(T, V), P(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
(V) => {
|
|
136
136
|
if (!M) {
|
|
137
137
|
M = !0;
|
|
138
|
-
const $ = c(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
const $ = c(f), H = p(
|
|
139
|
+
f,
|
|
140
|
+
T,
|
|
141
|
+
v
|
|
142
142
|
);
|
|
143
|
-
rejectPromise(
|
|
143
|
+
rejectPromise(T, V), O(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
), I = (V) => {
|
|
147
147
|
M || (M = !0, V.then(
|
|
148
|
-
($) => resolvePromise(
|
|
149
|
-
($) => rejectPromise(
|
|
148
|
+
($) => resolvePromise(T, $),
|
|
149
|
+
($) => rejectPromise(T, $)
|
|
150
150
|
), P(V));
|
|
151
151
|
};
|
|
152
152
|
});
|
|
153
|
-
return
|
|
154
|
-
P && I(P),
|
|
155
|
-
}), p(
|
|
153
|
+
return T.orig = C, T.status = "pending", registerCancelPromise(T, (P) => {
|
|
154
|
+
P && I(P), R == null || R();
|
|
155
|
+
}), p(f, T, v);
|
|
156
156
|
}
|
|
157
|
-
return p(
|
|
158
|
-
},
|
|
159
|
-
const
|
|
160
|
-
d: (
|
|
161
|
-
e:
|
|
157
|
+
return p(f, C, v);
|
|
158
|
+
}, g = (f, C, v) => {
|
|
159
|
+
const R = c(f), I = {
|
|
160
|
+
d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
|
|
161
|
+
e: C
|
|
162
162
|
};
|
|
163
|
-
return
|
|
164
|
-
}, x = (
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
V !==
|
|
168
|
-
}), Array.from(
|
|
163
|
+
return v && u(f, I, v), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(f, I), I);
|
|
164
|
+
}, x = (f) => {
|
|
165
|
+
const C = c(f);
|
|
166
|
+
if (C && (C.d.forEach((M, V) => {
|
|
167
|
+
V !== f && !n.has(V) && x(V);
|
|
168
|
+
}), Array.from(C.d).every(([M, V]) => {
|
|
169
169
|
const $ = c(M);
|
|
170
|
-
return M ===
|
|
170
|
+
return M === f || $ === V || // TODO This is a hack, we should find a better solution.
|
|
171
171
|
$ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
|
|
172
172
|
})))
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
let
|
|
173
|
+
return C;
|
|
174
|
+
const v = /* @__PURE__ */ new Map();
|
|
175
|
+
let R = !0;
|
|
176
176
|
const I = (M) => {
|
|
177
|
-
if (M ===
|
|
177
|
+
if (M === f) {
|
|
178
178
|
const $ = c(M);
|
|
179
179
|
if ($)
|
|
180
|
-
return
|
|
180
|
+
return v.set(M, $), returnAtomValue($);
|
|
181
181
|
if (hasInitialValue(M))
|
|
182
|
-
return
|
|
182
|
+
return v.set(M, void 0), M.init;
|
|
183
183
|
throw new Error("no atom init");
|
|
184
184
|
}
|
|
185
185
|
const V = x(M);
|
|
186
|
-
return
|
|
186
|
+
return v.set(M, V), returnAtomValue(V);
|
|
187
187
|
};
|
|
188
|
-
let
|
|
188
|
+
let T, P;
|
|
189
189
|
const O = {
|
|
190
190
|
get signal() {
|
|
191
|
-
return
|
|
191
|
+
return T || (T = new AbortController()), T.signal;
|
|
192
192
|
},
|
|
193
193
|
get setSelf() {
|
|
194
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(
|
|
195
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
196
|
-
return _(
|
|
194
|
+
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(f) && (P = (...M) => {
|
|
195
|
+
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
|
|
196
|
+
return _(f, ...M);
|
|
197
197
|
}), P;
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
try {
|
|
201
|
-
const M =
|
|
202
|
-
return
|
|
203
|
-
|
|
201
|
+
const M = f.read(I, O);
|
|
202
|
+
return m(
|
|
203
|
+
f,
|
|
204
204
|
M,
|
|
205
|
-
|
|
206
|
-
() =>
|
|
205
|
+
v,
|
|
206
|
+
() => T == null ? void 0 : T.abort()
|
|
207
207
|
);
|
|
208
208
|
} catch (M) {
|
|
209
|
-
return f
|
|
209
|
+
return g(f, M, v);
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
R = !1;
|
|
212
212
|
}
|
|
213
|
-
}, j = (
|
|
214
|
-
let
|
|
215
|
-
return
|
|
216
|
-
}, b = (
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
}, S = (
|
|
220
|
-
const
|
|
221
|
-
const P = n.get(
|
|
213
|
+
}, j = (f) => returnAtomValue(x(f)), E = (f) => {
|
|
214
|
+
let C = n.get(f);
|
|
215
|
+
return C || (C = A(f)), C;
|
|
216
|
+
}, b = (f, C) => !C.l.size && (!C.t.size || C.t.size === 1 && C.t.has(f)), k = (f) => {
|
|
217
|
+
const C = n.get(f);
|
|
218
|
+
C && b(f, C) && B(f);
|
|
219
|
+
}, S = (f) => {
|
|
220
|
+
const C = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new WeakMap(), R = (T) => {
|
|
221
|
+
const P = n.get(T);
|
|
222
222
|
P == null || P.t.forEach((O) => {
|
|
223
|
-
O !==
|
|
223
|
+
O !== T && (C.set(
|
|
224
224
|
O,
|
|
225
|
-
(
|
|
226
|
-
),
|
|
225
|
+
(C.get(O) || /* @__PURE__ */ new Set()).add(T)
|
|
226
|
+
), v.set(O, (v.get(O) || 0) + 1), R(O));
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
const I = (
|
|
231
|
-
const P = n.get(
|
|
229
|
+
R(f);
|
|
230
|
+
const I = (T) => {
|
|
231
|
+
const P = n.get(T);
|
|
232
232
|
P == null || P.t.forEach((O) => {
|
|
233
233
|
var M;
|
|
234
|
-
if (O !==
|
|
235
|
-
let V =
|
|
236
|
-
if (V &&
|
|
237
|
-
let $ = !!((M =
|
|
234
|
+
if (O !== T) {
|
|
235
|
+
let V = v.get(O);
|
|
236
|
+
if (V && v.set(O, --V), !V) {
|
|
237
|
+
let $ = !!((M = C.get(O)) != null && M.size);
|
|
238
238
|
if ($) {
|
|
239
239
|
const H = c(O), U = x(O);
|
|
240
240
|
$ = !H || !isEqualAtomValue(H, U);
|
|
241
241
|
}
|
|
242
|
-
$ ||
|
|
242
|
+
$ || C.forEach((H) => H.delete(O));
|
|
243
243
|
}
|
|
244
244
|
I(O);
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
I(
|
|
249
|
-
}, w = (
|
|
250
|
-
let
|
|
251
|
-
const
|
|
248
|
+
I(f);
|
|
249
|
+
}, w = (f, ...C) => {
|
|
250
|
+
let v = !0;
|
|
251
|
+
const R = (P) => returnAtomValue(x(P)), I = (P, ...O) => {
|
|
252
252
|
let M;
|
|
253
|
-
if (P ===
|
|
253
|
+
if (P === f) {
|
|
254
254
|
if (!hasInitialValue(P))
|
|
255
255
|
throw new Error("atom not writable");
|
|
256
|
-
const V = c(P), $ =
|
|
256
|
+
const V = c(P), $ = m(P, O[0]);
|
|
257
257
|
(!V || !isEqualAtomValue(V, $)) && S(P);
|
|
258
258
|
} else
|
|
259
259
|
M = w(P, ...O);
|
|
260
|
-
if (!
|
|
260
|
+
if (!v) {
|
|
261
261
|
const V = L();
|
|
262
262
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
263
263
|
($) => $({ type: "async-write", flushed: V })
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
return M;
|
|
267
|
-
},
|
|
268
|
-
return
|
|
269
|
-
}, _ = (
|
|
270
|
-
const
|
|
267
|
+
}, T = f.write(R, I, ...C);
|
|
268
|
+
return v = !1, T;
|
|
269
|
+
}, _ = (f, ...C) => {
|
|
270
|
+
const v = w(f, ...C), R = L();
|
|
271
271
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
272
|
-
(I) => I({ type: "write", flushed:
|
|
273
|
-
),
|
|
274
|
-
},
|
|
275
|
-
const
|
|
276
|
-
t: new Set(
|
|
272
|
+
(I) => I({ type: "write", flushed: R })
|
|
273
|
+
), v;
|
|
274
|
+
}, A = (f, C) => {
|
|
275
|
+
const v = {
|
|
276
|
+
t: new Set(C && [C]),
|
|
277
277
|
l: /* @__PURE__ */ new Set()
|
|
278
278
|
};
|
|
279
|
-
if (n.set(
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
}), x(
|
|
283
|
-
const
|
|
284
|
-
|
|
279
|
+
if (n.set(f, v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((R, I) => {
|
|
280
|
+
const T = n.get(I);
|
|
281
|
+
T ? T.t.add(f) : I !== f && A(I, f);
|
|
282
|
+
}), x(f), isActuallyWritableAtom(f) && f.onMount) {
|
|
283
|
+
const R = f.onMount((...I) => _(f, ...I));
|
|
284
|
+
R && (v.u = R);
|
|
285
285
|
}
|
|
286
|
-
return
|
|
287
|
-
},
|
|
288
|
-
var
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
const P = n.get(
|
|
295
|
-
P && (P.t.delete(
|
|
286
|
+
return v;
|
|
287
|
+
}, B = (f) => {
|
|
288
|
+
var C;
|
|
289
|
+
const v = (C = n.get(f)) == null ? void 0 : C.u;
|
|
290
|
+
v && v(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
|
|
291
|
+
const R = c(f);
|
|
292
|
+
R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, T) => {
|
|
293
|
+
if (T !== f) {
|
|
294
|
+
const P = n.get(T);
|
|
295
|
+
P && (P.t.delete(f), b(T, P) && B(T));
|
|
296
296
|
}
|
|
297
|
-
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount",
|
|
298
|
-
},
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
297
|
+
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
|
|
298
|
+
}, N = (f, C, v) => {
|
|
299
|
+
const R = new Set(C.d.keys());
|
|
300
|
+
v == null || v.forEach((I, T) => {
|
|
301
|
+
if (R.has(T)) {
|
|
302
|
+
R.delete(T);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
const P = n.get(
|
|
306
|
-
P && (P.t.delete(
|
|
307
|
-
}),
|
|
308
|
-
const
|
|
309
|
-
|
|
305
|
+
const P = n.get(T);
|
|
306
|
+
P && (P.t.delete(f), b(T, P) && B(T));
|
|
307
|
+
}), R.forEach((I) => {
|
|
308
|
+
const T = n.get(I);
|
|
309
|
+
T ? T.t.add(f) : n.has(f) && A(I, f);
|
|
310
310
|
});
|
|
311
311
|
}, L = () => {
|
|
312
|
-
let
|
|
313
|
-
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (
|
|
314
|
-
const
|
|
315
|
-
r.clear(),
|
|
316
|
-
const I = c(
|
|
312
|
+
let f;
|
|
313
|
+
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
|
|
314
|
+
const C = Array.from(r);
|
|
315
|
+
r.clear(), C.forEach(([v, R]) => {
|
|
316
|
+
const I = c(v);
|
|
317
317
|
if (I) {
|
|
318
|
-
I.d !== (
|
|
319
|
-
const
|
|
320
|
-
|
|
318
|
+
I.d !== (R == null ? void 0 : R.d) && N(v, I, R == null ? void 0 : R.d);
|
|
319
|
+
const T = n.get(v);
|
|
320
|
+
T && !// TODO This seems pretty hacky. Hope to fix it.
|
|
321
321
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
322
|
-
(
|
|
322
|
+
(R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (T.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.add(v));
|
|
323
323
|
} else
|
|
324
324
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
328
|
-
return a.forEach((
|
|
329
|
-
}, D = (
|
|
330
|
-
const
|
|
331
|
-
return I.add(
|
|
332
|
-
(
|
|
328
|
+
return a.forEach((C) => C("state")), f;
|
|
329
|
+
}, D = (f, C) => {
|
|
330
|
+
const v = E(f), R = L(), I = v.l;
|
|
331
|
+
return I.add(C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
|
|
332
|
+
(T) => T({ type: "sub", flushed: R })
|
|
333
333
|
)), () => {
|
|
334
|
-
I.delete(
|
|
334
|
+
I.delete(C), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
337
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
@@ -339,22 +339,22 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
339
339
|
set: _,
|
|
340
340
|
sub: D,
|
|
341
341
|
// store dev methods (these are tentative and subject to change without notice)
|
|
342
|
-
dev_subscribe_store: (
|
|
342
|
+
dev_subscribe_store: (f, C) => C !== 2 ? (console.warn(
|
|
343
343
|
"The current StoreListener revision is 2. The older ones are deprecated."
|
|
344
|
-
), a.add(
|
|
345
|
-
a.delete(
|
|
346
|
-
}) : (l.add(
|
|
347
|
-
l.delete(
|
|
344
|
+
), a.add(f), () => {
|
|
345
|
+
a.delete(f);
|
|
346
|
+
}) : (l.add(f), () => {
|
|
347
|
+
l.delete(f);
|
|
348
348
|
}),
|
|
349
349
|
dev_get_mounted_atoms: () => i.values(),
|
|
350
|
-
dev_get_atom_state: (
|
|
351
|
-
dev_get_mounted: (
|
|
352
|
-
dev_restore_atoms: (
|
|
353
|
-
for (const [
|
|
354
|
-
hasInitialValue(
|
|
355
|
-
const
|
|
350
|
+
dev_get_atom_state: (f) => o.get(f),
|
|
351
|
+
dev_get_mounted: (f) => n.get(f),
|
|
352
|
+
dev_restore_atoms: (f) => {
|
|
353
|
+
for (const [v, R] of f)
|
|
354
|
+
hasInitialValue(v) && (m(v, R), S(v));
|
|
355
|
+
const C = L();
|
|
356
356
|
l.forEach(
|
|
357
|
-
(
|
|
357
|
+
(v) => v({ type: "restore", flushed: C })
|
|
358
358
|
);
|
|
359
359
|
}
|
|
360
360
|
} : {
|
|
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
|
|
|
377
377
|
let u = r.get(c);
|
|
378
378
|
if (u)
|
|
379
379
|
return u;
|
|
380
|
-
const p = d && r.get(d),
|
|
380
|
+
const p = d && r.get(d), m = [], g = [];
|
|
381
381
|
return c.forEach((x, j) => {
|
|
382
382
|
const E = n ? n(x) : j;
|
|
383
|
-
|
|
383
|
+
g[j] = E;
|
|
384
384
|
const b = p && p.atomList[p.keyList.indexOf(E)];
|
|
385
385
|
if (b) {
|
|
386
|
-
|
|
386
|
+
m[j] = b;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
const k = (w) => {
|
|
390
|
-
const _ = w(l),
|
|
391
|
-
if (
|
|
390
|
+
const _ = w(l), A = w(o), N = a(A, _ == null ? void 0 : _.arr).keyList.indexOf(E);
|
|
391
|
+
if (N < 0 || N >= A.length) {
|
|
392
392
|
const L = c[a(c).keyList.indexOf(E)];
|
|
393
393
|
if (L)
|
|
394
394
|
return L;
|
|
395
395
|
throw new Error("splitAtom: index out of bounds for read");
|
|
396
396
|
}
|
|
397
|
-
return
|
|
398
|
-
}, S = (w, _,
|
|
399
|
-
const
|
|
400
|
-
if (D < 0 || D >=
|
|
397
|
+
return A[N];
|
|
398
|
+
}, S = (w, _, A) => {
|
|
399
|
+
const B = w(l), N = w(o), D = a(N, B == null ? void 0 : B.arr).keyList.indexOf(E);
|
|
400
|
+
if (D < 0 || D >= N.length)
|
|
401
401
|
throw new Error("splitAtom: index out of bounds for write");
|
|
402
|
-
const
|
|
402
|
+
const f = isFunction(A) ? A(N[D]) : A;
|
|
403
403
|
_(o, [
|
|
404
|
-
...
|
|
405
|
-
|
|
406
|
-
...
|
|
404
|
+
...N.slice(0, D),
|
|
405
|
+
f,
|
|
406
|
+
...N.slice(D + 1)
|
|
407
407
|
]);
|
|
408
408
|
};
|
|
409
|
-
|
|
410
|
-
}), p && p.keyList.length ===
|
|
409
|
+
m[j] = isWritable(o) ? atom(k, S) : atom(k);
|
|
410
|
+
}), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
|
|
411
411
|
}, l = atom((c) => {
|
|
412
412
|
const d = c(l), u = c(o);
|
|
413
413
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
|
|
|
420
420
|
case "remove": {
|
|
421
421
|
const p = c(i).indexOf(u.atom);
|
|
422
422
|
if (p >= 0) {
|
|
423
|
-
const
|
|
423
|
+
const m = c(o);
|
|
424
424
|
d(o, [
|
|
425
|
-
...
|
|
426
|
-
...
|
|
425
|
+
...m.slice(0, p),
|
|
426
|
+
...m.slice(p + 1)
|
|
427
427
|
]);
|
|
428
428
|
}
|
|
429
429
|
break;
|
|
@@ -431,29 +431,29 @@ function splitAtom(o, n) {
|
|
|
431
431
|
case "insert": {
|
|
432
432
|
const p = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
433
433
|
if (p >= 0) {
|
|
434
|
-
const
|
|
434
|
+
const m = c(o);
|
|
435
435
|
d(o, [
|
|
436
|
-
...
|
|
436
|
+
...m.slice(0, p),
|
|
437
437
|
u.value,
|
|
438
|
-
...
|
|
438
|
+
...m.slice(p)
|
|
439
439
|
]);
|
|
440
440
|
}
|
|
441
441
|
break;
|
|
442
442
|
}
|
|
443
443
|
case "move": {
|
|
444
|
-
const p = c(i).indexOf(u.atom),
|
|
445
|
-
if (p >= 0 &&
|
|
446
|
-
const
|
|
447
|
-
p <
|
|
448
|
-
...
|
|
449
|
-
...
|
|
450
|
-
|
|
451
|
-
...
|
|
444
|
+
const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
|
|
445
|
+
if (p >= 0 && m >= 0) {
|
|
446
|
+
const g = c(o);
|
|
447
|
+
p < m ? d(o, [
|
|
448
|
+
...g.slice(0, p),
|
|
449
|
+
...g.slice(p + 1, m),
|
|
450
|
+
g[p],
|
|
451
|
+
...g.slice(m)
|
|
452
452
|
]) : d(o, [
|
|
453
|
-
...
|
|
454
|
-
|
|
455
|
-
...
|
|
456
|
-
...
|
|
453
|
+
...g.slice(0, m),
|
|
454
|
+
g[p],
|
|
455
|
+
...g.slice(m, p),
|
|
456
|
+
...g.slice(p + 1)
|
|
457
457
|
]);
|
|
458
458
|
}
|
|
459
459
|
break;
|
|
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
|
|
|
473
473
|
const a = {
|
|
474
474
|
getItem: (l, i) => {
|
|
475
475
|
var c, d;
|
|
476
|
-
const u = (
|
|
477
|
-
if (
|
|
476
|
+
const u = (m) => {
|
|
477
|
+
if (m = m || "", n !== m) {
|
|
478
478
|
try {
|
|
479
|
-
r = JSON.parse(
|
|
479
|
+
r = JSON.parse(m);
|
|
480
480
|
} catch {
|
|
481
481
|
return i;
|
|
482
482
|
}
|
|
483
|
-
n =
|
|
483
|
+
n = m;
|
|
484
484
|
}
|
|
485
485
|
return r;
|
|
486
486
|
}, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
|
|
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
|
|
|
529
529
|
}, atom(
|
|
530
530
|
(d) => d(i),
|
|
531
531
|
(d, u, p) => {
|
|
532
|
-
const
|
|
533
|
-
return
|
|
532
|
+
const m = typeof p == "function" ? p(d(i)) : p;
|
|
533
|
+
return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((g) => (u(i, g), r.setItem(o, g))) : (u(i, m), r.setItem(o, m));
|
|
534
534
|
}
|
|
535
535
|
);
|
|
536
536
|
}
|
|
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
555
555
|
function useAtomValue(o, n) {
|
|
556
556
|
const r = useStore(n), [[a, l, i], c] = useReducer(
|
|
557
557
|
(p) => {
|
|
558
|
-
const
|
|
559
|
-
return Object.is(p[0],
|
|
558
|
+
const m = r.get(o);
|
|
559
|
+
return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
|
|
560
560
|
},
|
|
561
561
|
void 0,
|
|
562
562
|
() => [r.get(o), r, o]
|
|
@@ -640,8 +640,8 @@ const getSlots = (o) => {
|
|
|
640
640
|
return map(i, (c) => {
|
|
641
641
|
const d = c, u = getSlots(d);
|
|
642
642
|
return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
|
|
643
|
-
const
|
|
644
|
-
d[p] = `slot:${
|
|
643
|
+
const m = find(i, { oldId: u[p].replace("slot:", "") });
|
|
644
|
+
d[p] = `slot:${m._id}`;
|
|
645
645
|
}), omit(d, ["global", "oldId"]);
|
|
646
646
|
});
|
|
647
647
|
}, presentBlocksAtom = atom$1([]);
|
|
@@ -747,7 +747,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
747
747
|
switch (o.type) {
|
|
748
748
|
case "singular": {
|
|
749
749
|
const p = o.schema;
|
|
750
|
-
return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((
|
|
750
|
+
return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
|
|
751
751
|
}
|
|
752
752
|
case "model":
|
|
753
753
|
const { properties: a, title: l } = o, i = {
|
|
@@ -756,11 +756,11 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
756
756
|
properties: {}
|
|
757
757
|
};
|
|
758
758
|
return Object.keys(a).forEach((p) => {
|
|
759
|
-
const
|
|
760
|
-
if (includes(["slot", "styles"],
|
|
759
|
+
const m = a[p];
|
|
760
|
+
if (includes(["slot", "styles"], m.type))
|
|
761
761
|
return;
|
|
762
|
-
const
|
|
763
|
-
i.properties[
|
|
762
|
+
const g = p;
|
|
763
|
+
i.properties[g] = getBlockJSONFromSchemas(m, n, r);
|
|
764
764
|
}), i;
|
|
765
765
|
case "list":
|
|
766
766
|
const { itemProperties: c, title: d } = o, u = {
|
|
@@ -772,14 +772,14 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
774
|
return Object.keys(c).forEach((p) => {
|
|
775
|
-
const
|
|
776
|
-
if (includes(["slot", "styles"],
|
|
775
|
+
const m = c[p];
|
|
776
|
+
if (includes(["slot", "styles"], m.type))
|
|
777
777
|
return;
|
|
778
|
-
const
|
|
779
|
-
u.items.properties[
|
|
778
|
+
const g = p;
|
|
779
|
+
u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
|
|
780
780
|
u.items,
|
|
781
781
|
"title",
|
|
782
|
-
titleWithLang(get(
|
|
782
|
+
titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
|
|
783
783
|
);
|
|
784
784
|
}), u;
|
|
785
785
|
default:
|
|
@@ -833,8 +833,8 @@ var undomanager = { exports: {} };
|
|
|
833
833
|
}
|
|
834
834
|
let r = function() {
|
|
835
835
|
let a = [], l = -1, i = 0, c = !1, d;
|
|
836
|
-
function u(p,
|
|
837
|
-
return !p || typeof p[
|
|
836
|
+
function u(p, m) {
|
|
837
|
+
return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
|
|
838
838
|
}
|
|
839
839
|
return {
|
|
840
840
|
/**
|
|
@@ -861,8 +861,8 @@ var undomanager = { exports: {} };
|
|
|
861
861
|
let p = a[l];
|
|
862
862
|
if (!p)
|
|
863
863
|
return this;
|
|
864
|
-
const
|
|
865
|
-
for (; p.groupId ===
|
|
864
|
+
const m = p.groupId;
|
|
865
|
+
for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
|
|
866
866
|
;
|
|
867
867
|
return d && d(), this;
|
|
868
868
|
},
|
|
@@ -873,8 +873,8 @@ var undomanager = { exports: {} };
|
|
|
873
873
|
let p = a[l + 1];
|
|
874
874
|
if (!p)
|
|
875
875
|
return this;
|
|
876
|
-
const
|
|
877
|
-
for (; p.groupId ===
|
|
876
|
+
const m = p.groupId;
|
|
877
|
+
for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
|
|
878
878
|
;
|
|
879
879
|
return d && d(), this;
|
|
880
880
|
},
|
|
@@ -905,7 +905,7 @@ var undomanager = { exports: {} };
|
|
|
905
905
|
* @returns {array}
|
|
906
906
|
*/
|
|
907
907
|
getCommands: function(p) {
|
|
908
|
-
return p ? a.filter((
|
|
908
|
+
return p ? a.filter((m) => m.groupId === p) : a;
|
|
909
909
|
},
|
|
910
910
|
/**
|
|
911
911
|
* Returns the index of the actions list.
|
|
@@ -1203,12 +1203,12 @@ const useBlocksStoreManager = () => {
|
|
|
1203
1203
|
return {
|
|
1204
1204
|
moveBlocks: (E, b, k) => {
|
|
1205
1205
|
const S = map(E, (_) => {
|
|
1206
|
-
const
|
|
1207
|
-
return { _id: _, oldParent:
|
|
1206
|
+
const B = n.find((D) => D._id === _)._parent || null, L = n.filter((D) => B ? D._parent === B : !D._parent).map((D) => D._id).indexOf(_);
|
|
1207
|
+
return { _id: _, oldParent: B, oldPosition: L };
|
|
1208
1208
|
}), w = S.find(({ _id: _ }) => _ === E[0]);
|
|
1209
1209
|
w && w.oldParent === b && w.oldPosition === k || (i(E, b, k), o({
|
|
1210
|
-
undo: () => each(S, ({ _id: _, oldParent:
|
|
1211
|
-
i([_],
|
|
1210
|
+
undo: () => each(S, ({ _id: _, oldParent: A, oldPosition: B }) => {
|
|
1211
|
+
i([_], A, B);
|
|
1212
1212
|
}),
|
|
1213
1213
|
redo: () => i(E, b, k)
|
|
1214
1214
|
}));
|
|
@@ -1234,8 +1234,8 @@ const useBlocksStoreManager = () => {
|
|
|
1234
1234
|
else {
|
|
1235
1235
|
const w = keys(b);
|
|
1236
1236
|
S = map(E, (_) => {
|
|
1237
|
-
const
|
|
1238
|
-
return each(w, (
|
|
1237
|
+
const A = n.find((N) => N._id === _), B = { _id: _ };
|
|
1238
|
+
return each(w, (N) => B[N] = A[N]), B;
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
1241
|
c(map(E, (w) => ({ _id: w, ...b }))), o({
|
|
@@ -1255,8 +1255,8 @@ const useBlocksStoreManager = () => {
|
|
|
1255
1255
|
updateMultipleBlocksProps: (E) => {
|
|
1256
1256
|
let b = [];
|
|
1257
1257
|
b = map(E, (k) => {
|
|
1258
|
-
const S = keys(k), w = n.find((
|
|
1259
|
-
return each(S, (
|
|
1258
|
+
const S = keys(k), w = n.find((A) => A._id === k._id), _ = {};
|
|
1259
|
+
return each(S, (A) => _[A] = w[A]), _;
|
|
1260
1260
|
}), c(E), o({
|
|
1261
1261
|
undo: () => c(b),
|
|
1262
1262
|
redo: () => c(E)
|
|
@@ -1275,8 +1275,8 @@ const useBlocksStoreManager = () => {
|
|
|
1275
1275
|
b[k]._parent = i[j]._id;
|
|
1276
1276
|
}
|
|
1277
1277
|
const u = first(i);
|
|
1278
|
-
let p,
|
|
1279
|
-
return c && (p = find(o, { _id: c }), i[0]._parent = c,
|
|
1278
|
+
let p, m;
|
|
1279
|
+
return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
|
|
1280
1280
|
},
|
|
1281
1281
|
[o, n]
|
|
1282
1282
|
);
|
|
@@ -1286,11 +1286,11 @@ const useBlocksStoreManager = () => {
|
|
|
1286
1286
|
const k = i.blocks;
|
|
1287
1287
|
return a(k, c, d);
|
|
1288
1288
|
}
|
|
1289
|
-
const u = generateUUID(), p = getBlockDefaultProps(i.props),
|
|
1289
|
+
const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
|
|
1290
1290
|
forIn(p, (k, S) => {
|
|
1291
1291
|
if (startsWith(k, SLOT_KEY)) {
|
|
1292
1292
|
const w = k.replace(SLOT_KEY, "");
|
|
1293
|
-
|
|
1293
|
+
m.push({
|
|
1294
1294
|
_id: w,
|
|
1295
1295
|
_type: "Slot",
|
|
1296
1296
|
_parent: u,
|
|
@@ -1300,15 +1300,15 @@ const useBlocksStoreManager = () => {
|
|
|
1300
1300
|
});
|
|
1301
1301
|
}
|
|
1302
1302
|
});
|
|
1303
|
-
const
|
|
1303
|
+
const g = {
|
|
1304
1304
|
_type: i.type,
|
|
1305
1305
|
_id: u,
|
|
1306
1306
|
...p
|
|
1307
1307
|
};
|
|
1308
1308
|
let x, j;
|
|
1309
|
-
c && (x = find(o, { _id: c }),
|
|
1310
|
-
const b = [
|
|
1311
|
-
return r(b, j, d), n([
|
|
1309
|
+
c && (x = find(o, { _id: c }), g._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, g._type) && x && (g._parent = x._parent, j = x._parent);
|
|
1310
|
+
const b = [g, ...m];
|
|
1311
|
+
return r(b, j, d), n([g._id]), g;
|
|
1312
1312
|
},
|
|
1313
1313
|
[a, o, n]
|
|
1314
1314
|
), addPredefinedBlock: a };
|
|
@@ -2416,18 +2416,18 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2416
2416
|
);
|
|
2417
2417
|
const i = [], c = [];
|
|
2418
2418
|
each(r, (p) => {
|
|
2419
|
-
const
|
|
2420
|
-
if (
|
|
2419
|
+
const m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
|
|
2420
|
+
if (g && (a = filter(
|
|
2421
2421
|
a,
|
|
2422
|
-
(x) => x.fullCls !== (
|
|
2423
|
-
)), i.push(
|
|
2424
|
-
const x = find(l, pick(
|
|
2425
|
-
|
|
2422
|
+
(x) => x.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2423
|
+
)), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (x) => x.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
|
|
2424
|
+
const x = find(l, pick(m, ["property"]));
|
|
2425
|
+
g && (l = filter(
|
|
2426
2426
|
l,
|
|
2427
2427
|
(j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
|
|
2428
2428
|
)), c.push({
|
|
2429
|
-
...
|
|
2430
|
-
fullCls:
|
|
2429
|
+
...m,
|
|
2430
|
+
fullCls: m.cls,
|
|
2431
2431
|
mq: "xs"
|
|
2432
2432
|
});
|
|
2433
2433
|
}
|
|
@@ -2455,10 +2455,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2455
2455
|
)
|
|
2456
2456
|
), i = first(o(selectedStylingBlocksAtom));
|
|
2457
2457
|
return map(l, (c) => {
|
|
2458
|
-
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes:
|
|
2458
|
+
const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
|
|
2459
2459
|
return {
|
|
2460
2460
|
ids: [d._id],
|
|
2461
|
-
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(
|
|
2461
|
+
props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
|
|
2462
2462
|
};
|
|
2463
2463
|
});
|
|
2464
2464
|
}), useAddClassesToBlocks = () => {
|
|
@@ -2509,11 +2509,11 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2509
2509
|
each(a, (c) => {
|
|
2510
2510
|
const d = o.find((x) => x._id === c);
|
|
2511
2511
|
l || (l = d._parent);
|
|
2512
|
-
const
|
|
2512
|
+
const m = filter(
|
|
2513
2513
|
o,
|
|
2514
2514
|
(x) => isString$1(l) ? x._parent === l : !d._parent
|
|
2515
|
-
).indexOf(d) + 1,
|
|
2516
|
-
r(
|
|
2515
|
+
).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
|
|
2516
|
+
r(g, l, m), i.push(get(g, "0._id", ""));
|
|
2517
2517
|
}), n(i);
|
|
2518
2518
|
},
|
|
2519
2519
|
[o, n]
|
|
@@ -2576,19 +2576,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2576
2576
|
);
|
|
2577
2577
|
return map(i, (c) => {
|
|
2578
2578
|
const d = o(c), u = a;
|
|
2579
|
-
let { classes: p, baseClasses:
|
|
2580
|
-
return each(u, (
|
|
2581
|
-
const x =
|
|
2579
|
+
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2580
|
+
return each(u, (g) => {
|
|
2581
|
+
const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
|
|
2582
2582
|
p = p.replace(j, " ").replace(/ +/g, " ").trim();
|
|
2583
|
-
const E = first(
|
|
2584
|
-
includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(
|
|
2585
|
-
}), each(u, (
|
|
2586
|
-
const x = new RegExp(`(^| )${
|
|
2587
|
-
|
|
2583
|
+
const E = first(g.split(":"));
|
|
2584
|
+
includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(g.split(":").pop().trim());
|
|
2585
|
+
}), each(u, (g) => {
|
|
2586
|
+
const x = new RegExp(`(^| )${g.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2587
|
+
m = m.replace(x, " ").replace(/ +/g, " ").trim();
|
|
2588
2588
|
}), {
|
|
2589
2589
|
ids: [d._id],
|
|
2590
2590
|
props: {
|
|
2591
|
-
[l.prop]: `${STYLES_KEY}${
|
|
2591
|
+
[l.prop]: `${STYLES_KEY}${m},${p}`
|
|
2592
2592
|
}
|
|
2593
2593
|
};
|
|
2594
2594
|
});
|
|
@@ -2689,7 +2689,7 @@ const useLanguages = () => {
|
|
|
2689
2689
|
let u = "";
|
|
2690
2690
|
o([n], { [i]: "" });
|
|
2691
2691
|
for (let p = 0; p < d.length; p++)
|
|
2692
|
-
u += d[p].join(""), o([n], { [i]: u }), await new Promise((
|
|
2692
|
+
u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
2695
|
},
|
|
@@ -2887,18 +2887,18 @@ const useBlockHighlight = () => {
|
|
|
2887
2887
|
const { width: d, height: u } = o;
|
|
2888
2888
|
if (d < n) {
|
|
2889
2889
|
const p = parseFloat((d / n).toFixed(2).toString());
|
|
2890
|
-
let
|
|
2891
|
-
const
|
|
2892
|
-
u && (
|
|
2890
|
+
let m = {};
|
|
2891
|
+
const g = u * p, x = d * p;
|
|
2892
|
+
u && (m = {
|
|
2893
2893
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
2894
|
-
height: 100 + (u -
|
|
2894
|
+
height: 100 + (u - g) / g * 100 + "%",
|
|
2895
2895
|
width: 100 + (d - x) / x * 100 + "%"
|
|
2896
2896
|
}), i({
|
|
2897
2897
|
position: "relative",
|
|
2898
2898
|
top: 0,
|
|
2899
2899
|
transform: `scale(${p})`,
|
|
2900
2900
|
transformOrigin: a === "rtl" ? "top right" : "top left",
|
|
2901
|
-
...
|
|
2901
|
+
...m,
|
|
2902
2902
|
maxWidth: "none"
|
|
2903
2903
|
// TODO: Add max-width to the wrapper
|
|
2904
2904
|
}), r(p * 100);
|
|
@@ -3071,7 +3071,7 @@ const useDnd = () => {
|
|
|
3071
3071
|
const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, u] = useAtom$1(draggedBlockAtom), [, p] = useAtom$1(dropTargetBlockIdAtom);
|
|
3072
3072
|
if (!useFeature("dnd"))
|
|
3073
3073
|
return {};
|
|
3074
|
-
const
|
|
3074
|
+
const g = () => {
|
|
3075
3075
|
removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
|
|
3076
3076
|
};
|
|
3077
3077
|
return iframeDocument = o, {
|
|
@@ -3080,20 +3080,20 @@ const useDnd = () => {
|
|
|
3080
3080
|
x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
|
|
3081
3081
|
},
|
|
3082
3082
|
onDrop: (x) => {
|
|
3083
|
-
var
|
|
3084
|
-
const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((
|
|
3083
|
+
var A;
|
|
3084
|
+
const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((A = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : A.scrollY) : x.clientX;
|
|
3085
3085
|
dropIndex = calculateDropIndex(b, possiblePositions);
|
|
3086
3086
|
const k = d, S = j.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3087
3087
|
if ((k == null ? void 0 : k._id) === S || !w) {
|
|
3088
|
-
|
|
3088
|
+
g();
|
|
3089
3089
|
return;
|
|
3090
3090
|
}
|
|
3091
3091
|
if (!has(k, "_id")) {
|
|
3092
|
-
a(k, S === "canvas" ? null : S, dropIndex), setTimeout(
|
|
3092
|
+
a(k, S === "canvas" ? null : S, dropIndex), setTimeout(g, 300);
|
|
3093
3093
|
return;
|
|
3094
3094
|
}
|
|
3095
3095
|
let _ = j.getAttribute("data-block-id");
|
|
3096
|
-
_ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex),
|
|
3096
|
+
_ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex), g(), setTimeout(removePlaceholder, 300);
|
|
3097
3097
|
},
|
|
3098
3098
|
onDragEnter: (x) => {
|
|
3099
3099
|
const j = x, E = j.target;
|
|
@@ -3122,7 +3122,7 @@ function destroyQuill(o) {
|
|
|
3122
3122
|
const useHandleCanvasDblClick = () => {
|
|
3123
3123
|
const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
|
|
3124
3124
|
return (i) => {
|
|
3125
|
-
var
|
|
3125
|
+
var g;
|
|
3126
3126
|
if (r)
|
|
3127
3127
|
return;
|
|
3128
3128
|
const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
|
|
@@ -3133,15 +3133,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3133
3133
|
x.name !== "class" && u.removeAttribute(x.name);
|
|
3134
3134
|
}), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
|
|
3135
3135
|
const p = new Quill(u, { placeholder: "Type here..." });
|
|
3136
|
-
function
|
|
3136
|
+
function m() {
|
|
3137
3137
|
const x = p.getText(0, p.getLength());
|
|
3138
|
-
n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur",
|
|
3138
|
+
n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
|
|
3139
3139
|
}
|
|
3140
|
-
u.addEventListener("blur",
|
|
3140
|
+
u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
|
|
3141
3141
|
x.stopPropagation();
|
|
3142
3142
|
}), u.addEventListener("keydown", (x) => {
|
|
3143
|
-
(x.key === "Enter" || x.key === "Escape") &&
|
|
3144
|
-
}), p.focus(), (
|
|
3143
|
+
(x.key === "Enter" || x.key === "Escape") && m();
|
|
3144
|
+
}), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
|
|
3145
3145
|
};
|
|
3146
3146
|
}, useHandleCanvasClick = () => {
|
|
3147
3147
|
const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
|
|
@@ -3155,8 +3155,8 @@ const useHandleCanvasDblClick = () => {
|
|
|
3155
3155
|
return;
|
|
3156
3156
|
}
|
|
3157
3157
|
if (d != null && d.getAttribute("data-block-parent")) {
|
|
3158
|
-
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"),
|
|
3159
|
-
n.includes(
|
|
3158
|
+
const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
|
|
3159
|
+
n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
|
|
3160
3160
|
} else if (d != null && d.getAttribute("data-block-id")) {
|
|
3161
3161
|
const u = d.getAttribute("data-block-id");
|
|
3162
3162
|
n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
|
|
@@ -3180,17 +3180,17 @@ const useHandleCanvasDblClick = () => {
|
|
|
3180
3180
|
setTimeout(() => {
|
|
3181
3181
|
if (!isEmpty(a))
|
|
3182
3182
|
return;
|
|
3183
|
-
const
|
|
3184
|
-
if (
|
|
3185
|
-
const x =
|
|
3183
|
+
const g = getElementByDataBlockId(n, first(r));
|
|
3184
|
+
if (g) {
|
|
3185
|
+
const x = g.getAttribute("data-style-prop");
|
|
3186
3186
|
if (x) {
|
|
3187
|
-
const j =
|
|
3187
|
+
const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
|
|
3188
3188
|
l([{ id: j, prop: x, blockId: E }]);
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
3191
|
}, 100);
|
|
3192
3192
|
}, [n, r, l, a]);
|
|
3193
|
-
const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(),
|
|
3193
|
+
const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), m = useDnd();
|
|
3194
3194
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3195
3195
|
"div",
|
|
3196
3196
|
{
|
|
@@ -3200,23 +3200,23 @@ const useHandleCanvasDblClick = () => {
|
|
|
3200
3200
|
onDoubleClick: c,
|
|
3201
3201
|
onMouseMove: u,
|
|
3202
3202
|
onMouseLeave: p,
|
|
3203
|
-
...omit(
|
|
3204
|
-
className: "relative h-full max-w-full p-px " + (
|
|
3203
|
+
...omit(m, "isDragging"),
|
|
3204
|
+
className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
|
|
3205
3205
|
children: o
|
|
3206
3206
|
}
|
|
3207
3207
|
);
|
|
3208
3208
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
|
|
3209
|
-
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks:
|
|
3209
|
+
const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
|
|
3210
3210
|
useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
|
|
3211
3211
|
"ctrl+v,command+v",
|
|
3212
3212
|
() => {
|
|
3213
|
-
p(n[0]) &&
|
|
3213
|
+
p(n[0]) && m(n);
|
|
3214
3214
|
},
|
|
3215
3215
|
{},
|
|
3216
|
-
[n, p,
|
|
3216
|
+
[n, p, m]
|
|
3217
3217
|
);
|
|
3218
|
-
const
|
|
3219
|
-
useHotkeys("esc", () => r([]),
|
|
3218
|
+
const g = o ? { document: o } : {};
|
|
3219
|
+
useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
|
|
3220
3220
|
n,
|
|
3221
3221
|
l
|
|
3222
3222
|
]), useHotkeys(
|
|
@@ -3224,7 +3224,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3224
3224
|
(x) => {
|
|
3225
3225
|
x.preventDefault(), a(n);
|
|
3226
3226
|
},
|
|
3227
|
-
|
|
3227
|
+
g,
|
|
3228
3228
|
[n, a]
|
|
3229
3229
|
);
|
|
3230
3230
|
}, KeyboardHandler = () => {
|
|
@@ -3253,15 +3253,15 @@ const useHandleCanvasDblClick = () => {
|
|
|
3253
3253
|
}
|
|
3254
3254
|
);
|
|
3255
3255
|
}, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
|
|
3256
|
-
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update:
|
|
3256
|
+
const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
|
|
3257
3257
|
placement: "top-start",
|
|
3258
3258
|
middleware: [shift(), flip()],
|
|
3259
3259
|
elements: {
|
|
3260
3260
|
reference: o
|
|
3261
3261
|
}
|
|
3262
3262
|
});
|
|
3263
|
-
useResizeObserver(o, () =>
|
|
3264
|
-
const
|
|
3263
|
+
useResizeObserver(o, () => m(), o !== null);
|
|
3264
|
+
const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3265
3265
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3266
3266
|
"div",
|
|
3267
3267
|
{
|
|
@@ -3278,12 +3278,12 @@ const useHandleCanvasDblClick = () => {
|
|
|
3278
3278
|
onKeyDown: (j) => j.stopPropagation(),
|
|
3279
3279
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3280
3280
|
children: [
|
|
3281
|
-
|
|
3281
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3282
3282
|
ArrowUpIcon,
|
|
3283
3283
|
{
|
|
3284
3284
|
className: "hover:scale-105",
|
|
3285
3285
|
onClick: () => {
|
|
3286
|
-
c([]), l([
|
|
3286
|
+
c([]), l([g]);
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
3289
|
),
|
|
@@ -3312,9 +3312,9 @@ const useHandleCanvasDblClick = () => {
|
|
|
3312
3312
|
}, HeadTags = () => {
|
|
3313
3313
|
const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [u] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [p] = useState(
|
|
3314
3314
|
c == null ? void 0 : c.getElementById("selected-block")
|
|
3315
|
-
), [
|
|
3315
|
+
), [m] = useState(
|
|
3316
3316
|
c == null ? void 0 : c.getElementById("selected-styling-block")
|
|
3317
|
-
), [
|
|
3317
|
+
), [g] = useState(
|
|
3318
3318
|
c == null ? void 0 : c.getElementById("dragged-block")
|
|
3319
3319
|
);
|
|
3320
3320
|
useEffect(() => {
|
|
@@ -3322,17 +3322,17 @@ const useHandleCanvasDblClick = () => {
|
|
|
3322
3322
|
}, [r, c]);
|
|
3323
3323
|
const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
|
|
3324
3324
|
return useEffect(() => {
|
|
3325
|
-
const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"),
|
|
3325
|
+
const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), A = s({
|
|
3326
3326
|
colors: [E, b],
|
|
3327
3327
|
names: ["primary", "secondary"]
|
|
3328
3328
|
});
|
|
3329
|
-
set(
|
|
3330
|
-
const
|
|
3329
|
+
set(A, "primary.DEFAULT", E), set(A, "secondary.DEFAULT", b);
|
|
3330
|
+
const B = {
|
|
3331
3331
|
"bg-light": k,
|
|
3332
3332
|
"bg-dark": S,
|
|
3333
3333
|
"text-dark": w,
|
|
3334
3334
|
"text-light": _
|
|
3335
|
-
},
|
|
3335
|
+
}, N = get(o, "roundedCorners", "0");
|
|
3336
3336
|
!d || !d.tailwind || (d.tailwind.config = {
|
|
3337
3337
|
darkMode: "class",
|
|
3338
3338
|
theme: {
|
|
@@ -3349,9 +3349,9 @@ const useHandleCanvasDblClick = () => {
|
|
|
3349
3349
|
body: [j]
|
|
3350
3350
|
},
|
|
3351
3351
|
borderRadius: {
|
|
3352
|
-
DEFAULT: `${
|
|
3352
|
+
DEFAULT: `${N || "0"}px`
|
|
3353
3353
|
},
|
|
3354
|
-
colors: { ...
|
|
3354
|
+
colors: { ...B, ...A }
|
|
3355
3355
|
}
|
|
3356
3356
|
},
|
|
3357
3357
|
plugins: [
|
|
@@ -3381,14 +3381,14 @@ const useHandleCanvasDblClick = () => {
|
|
|
3381
3381
|
outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3382
3382
|
}`);
|
|
3383
3383
|
}, [n, p]), useEffect(() => {
|
|
3384
|
-
|
|
3385
|
-
}, [l,
|
|
3384
|
+
g.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3385
|
+
}, [l, g]), useEffect(() => {
|
|
3386
3386
|
u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
|
|
3387
3387
|
}, [u]), useEffect(() => {
|
|
3388
|
-
|
|
3388
|
+
m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
|
|
3389
3389
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3390
3390
|
}`);
|
|
3391
|
-
}, [a,
|
|
3391
|
+
}, [a, m]), useEffect(() => {
|
|
3392
3392
|
c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3393
3393
|
}, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (x || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3394
3394
|
"link",
|
|
@@ -3405,11 +3405,11 @@ const useHandleCanvasDblClick = () => {
|
|
|
3405
3405
|
u || (u = d, d = "xs");
|
|
3406
3406
|
const p = r.indexOf(d);
|
|
3407
3407
|
if (p <= a) {
|
|
3408
|
-
const
|
|
3409
|
-
if (
|
|
3408
|
+
const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
|
|
3409
|
+
if (m.includes(u))
|
|
3410
3410
|
for (let x = p; x < r.length; x++)
|
|
3411
3411
|
i[x] = !0;
|
|
3412
|
-
else if (
|
|
3412
|
+
else if (g.includes(u))
|
|
3413
3413
|
for (let x = p; x < r.length; x++)
|
|
3414
3414
|
i[x] = !1;
|
|
3415
3415
|
}
|
|
@@ -3431,23 +3431,23 @@ const useHandleCanvasDblClick = () => {
|
|
|
3431
3431
|
return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
|
|
3432
3432
|
}, useWatchRSCBlocks = () => {
|
|
3433
3433
|
const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
|
|
3434
|
-
var
|
|
3435
|
-
return (
|
|
3434
|
+
var g;
|
|
3435
|
+
return (g = get(i, p._type)) == null ? void 0 : g.server;
|
|
3436
3436
|
}).map((p) => p._id), [i, o]);
|
|
3437
3437
|
useEffect(() => {
|
|
3438
3438
|
forEach(d, (u) => {
|
|
3439
3439
|
if (get(n, u, "") || get(a, `${u}.loading`, !1))
|
|
3440
3440
|
return;
|
|
3441
|
-
const p = o.find((
|
|
3442
|
-
l((
|
|
3443
|
-
r((
|
|
3444
|
-
...
|
|
3441
|
+
const p = o.find((m) => m._id === u);
|
|
3442
|
+
l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
|
|
3443
|
+
r((g) => ({ ...g, [u]: m })), l((g) => ({
|
|
3444
|
+
...g,
|
|
3445
3445
|
[u]: { loading: !1, error: null }
|
|
3446
3446
|
}));
|
|
3447
|
-
}).catch((
|
|
3448
|
-
l((
|
|
3449
|
-
...
|
|
3450
|
-
[u]: { loading: !1, error:
|
|
3447
|
+
}).catch((m) => {
|
|
3448
|
+
l((g) => ({
|
|
3449
|
+
...g,
|
|
3450
|
+
[u]: { loading: !1, error: m.message }
|
|
3451
3451
|
}));
|
|
3452
3452
|
});
|
|
3453
3453
|
});
|
|
@@ -3512,7 +3512,7 @@ function applyLanguage(o, n, r) {
|
|
|
3512
3512
|
}), a;
|
|
3513
3513
|
}
|
|
3514
3514
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3515
|
-
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:
|
|
3515
|
+
const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
|
|
3516
3516
|
(b) => b.reduce((k, S) => {
|
|
3517
3517
|
const w = get(u, S, {});
|
|
3518
3518
|
return { ...k, ...w };
|
|
@@ -3525,16 +3525,16 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3525
3525
|
return null;
|
|
3526
3526
|
const S = {}, w = filter(n, { _parent: b._id });
|
|
3527
3527
|
if (S.children = w.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: w }) : null, b._type === "GlobalBlock") {
|
|
3528
|
-
const
|
|
3529
|
-
S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(
|
|
3528
|
+
const v = m(b);
|
|
3529
|
+
S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(v, (R) => !R._parent), allBlocks: v });
|
|
3530
3530
|
}
|
|
3531
|
-
const _ = getBlockComponent(b._type),
|
|
3532
|
-
if (isNull(
|
|
3531
|
+
const _ = getBlockComponent(b._type), A = get(_, "server", !1), B = A ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
|
|
3532
|
+
if (isNull(B))
|
|
3533
3533
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
|
|
3534
|
-
const
|
|
3534
|
+
const N = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(N), D = g(b);
|
|
3535
3535
|
if (get(D, "__isHidden", !1) && !includes(a, b._id))
|
|
3536
3536
|
return null;
|
|
3537
|
-
const
|
|
3537
|
+
const f = i && isDescendant(i._id, b._id, n), C = {
|
|
3538
3538
|
...includes(a, b._id) ? { "force-show": "" } : {},
|
|
3539
3539
|
"data-block-id": b._id,
|
|
3540
3540
|
"data-block-type": b._type,
|
|
@@ -3542,14 +3542,14 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
3542
3542
|
// @ts-ignore
|
|
3543
3543
|
{
|
|
3544
3544
|
"data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3545
|
-
"data-dnd-dragged": i._id === b._id ||
|
|
3545
|
+
"data-dnd-dragged": i._id === b._id || f ? "yes" : "no"
|
|
3546
3546
|
}
|
|
3547
3547
|
) : {},
|
|
3548
|
-
...c === b._id && !
|
|
3548
|
+
...c === b._id && !f ? { "data-drop": "yes" } : {},
|
|
3549
3549
|
...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
|
|
3550
3550
|
};
|
|
3551
|
-
return
|
|
3552
|
-
blockProps:
|
|
3551
|
+
return A ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: C }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(B, {
|
|
3552
|
+
blockProps: C,
|
|
3553
3553
|
index: k,
|
|
3554
3554
|
...applyBindings(applyLanguage(b, r, _), x),
|
|
3555
3555
|
...omit(D, ["__isHidden"]),
|
|
@@ -3609,41 +3609,41 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3609
3609
|
};
|
|
3610
3610
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
3611
3611
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
3612
|
-
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), [
|
|
3613
|
-
u((
|
|
3612
|
+
const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), w = (B) => {
|
|
3613
|
+
u((N) => ({ ...N, width: B }));
|
|
3614
3614
|
};
|
|
3615
3615
|
useEffect(() => {
|
|
3616
3616
|
if (!c.current)
|
|
3617
3617
|
return;
|
|
3618
|
-
const { clientWidth:
|
|
3619
|
-
u({ width:
|
|
3618
|
+
const { clientWidth: B, clientHeight: N } = c.current;
|
|
3619
|
+
u({ width: B, height: N });
|
|
3620
3620
|
}, [c, n]);
|
|
3621
|
-
const _ = (
|
|
3622
|
-
const { top: L } =
|
|
3623
|
-
return L +
|
|
3621
|
+
const _ = (B, N = 0) => {
|
|
3622
|
+
const { top: L } = B.getBoundingClientRect();
|
|
3623
|
+
return L + N >= 0 && L - N <= window.innerHeight;
|
|
3624
3624
|
};
|
|
3625
3625
|
useEffect(() => {
|
|
3626
|
-
var
|
|
3626
|
+
var B, N;
|
|
3627
3627
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3628
3628
|
const L = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3629
|
-
L && (_(L) || (
|
|
3629
|
+
L && (_(L) || (N = (B = i.current) == null ? void 0 : B.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
|
|
3630
3630
|
}
|
|
3631
3631
|
}, [a]), useEffect(() => {
|
|
3632
3632
|
if (!isEmpty(E) && i.current) {
|
|
3633
|
-
const
|
|
3633
|
+
const B = getElementByStyleId(
|
|
3634
3634
|
i.current.contentDocument,
|
|
3635
3635
|
first(E).id
|
|
3636
3636
|
);
|
|
3637
|
-
x(
|
|
3637
|
+
x(B ? [B] : [null]);
|
|
3638
3638
|
} else
|
|
3639
3639
|
x([null]);
|
|
3640
3640
|
}, [E]);
|
|
3641
|
-
const
|
|
3642
|
-
let
|
|
3643
|
-
return
|
|
3641
|
+
const A = useMemo(() => {
|
|
3642
|
+
let B = IframeInitialContent;
|
|
3643
|
+
return B = B.replace("__HTML_DIR__", S), o === "offline" && (B = B.replace(
|
|
3644
3644
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3645
3645
|
"/offline/tailwind.cdn.js"
|
|
3646
|
-
),
|
|
3646
|
+
), B = B.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), B = B.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), B;
|
|
3647
3647
|
}, [o, S]);
|
|
3648
3648
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3649
3649
|
"div",
|
|
@@ -3662,14 +3662,14 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3662
3662
|
id: "canvas-iframe",
|
|
3663
3663
|
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
3664
3664
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3665
|
-
initialContent:
|
|
3665
|
+
initialContent: A,
|
|
3666
3666
|
children: [
|
|
3667
3667
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3668
3668
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3669
3669
|
BlockActionsStatic,
|
|
3670
3670
|
{
|
|
3671
3671
|
block: a,
|
|
3672
|
-
selectedBlockElement: first(
|
|
3672
|
+
selectedBlockElement: first(m)
|
|
3673
3673
|
}
|
|
3674
3674
|
),
|
|
3675
3675
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
|
|
@@ -3785,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3785
3785
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
3786
3786
|
] }, l))
|
|
3787
3787
|
] }) });
|
|
3788
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3788
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-lBqxrWBC.js")), CanvasArea = () => {
|
|
3789
3789
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3790
3790
|
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: [
|
|
3791
3791
|
/* @__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, {}) }) }),
|
|
@@ -3860,13 +3860,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3860
3860
|
showHeading: o = !0,
|
|
3861
3861
|
className: n = ""
|
|
3862
3862
|
}) => {
|
|
3863
|
-
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData:
|
|
3864
|
-
|
|
3863
|
+
const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: A }, B) => {
|
|
3864
|
+
B && (a(A), i.current = A);
|
|
3865
3865
|
}, {
|
|
3866
3866
|
bodyFont: u,
|
|
3867
3867
|
headingFont: p,
|
|
3868
|
-
primaryColor:
|
|
3869
|
-
bodyTextDarkColor:
|
|
3868
|
+
primaryColor: m,
|
|
3869
|
+
bodyTextDarkColor: g,
|
|
3870
3870
|
bodyTextLightColor: x,
|
|
3871
3871
|
bodyBgDarkColor: j,
|
|
3872
3872
|
secondaryColor: E,
|
|
@@ -3888,7 +3888,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3888
3888
|
title: c("Theme Config.Rounded Corner"),
|
|
3889
3889
|
default: parseInt(k || 5, 10)
|
|
3890
3890
|
}),
|
|
3891
|
-
primaryColor: h({ title: c("Theme Config.Primary"), default:
|
|
3891
|
+
primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
|
|
3892
3892
|
secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
|
|
3893
3893
|
};
|
|
3894
3894
|
l || (S = {
|
|
@@ -3899,7 +3899,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3899
3899
|
}),
|
|
3900
3900
|
bodyTextLightColor: h({
|
|
3901
3901
|
title: c("Theme Config.Text Color"),
|
|
3902
|
-
default:
|
|
3902
|
+
default: g
|
|
3903
3903
|
}),
|
|
3904
3904
|
bodyBgDarkColor: h({
|
|
3905
3905
|
title: c("Theme Config.Background Dark Mode"),
|
|
@@ -3914,9 +3914,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
|
|
|
3914
3914
|
type: "object",
|
|
3915
3915
|
properties: {}
|
|
3916
3916
|
}, _ = {};
|
|
3917
|
-
return Object.keys(S).forEach((
|
|
3918
|
-
const
|
|
3919
|
-
return w.properties || (w.properties = {}), w.properties[
|
|
3917
|
+
return Object.keys(S).forEach((A) => {
|
|
3918
|
+
const B = S[A];
|
|
3919
|
+
return w.properties || (w.properties = {}), w.properties[A] = B.schema, _[A] = B.uiSchema, !0;
|
|
3920
3920
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
|
|
3921
3921
|
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,
|
|
3922
3922
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4112,34 +4112,34 @@ function BiExpandVertical(o) {
|
|
|
4112
4112
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4113
4113
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4114
4114
|
let u = null;
|
|
4115
|
-
const p = o.children.length > 0, { highlightBlock:
|
|
4116
|
-
|
|
4117
|
-
},
|
|
4118
|
-
|
|
4119
|
-
},
|
|
4120
|
-
|
|
4121
|
-
},
|
|
4122
|
-
|
|
4115
|
+
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: S, handleClick: w } = o, _ = (f) => {
|
|
4116
|
+
f.stopPropagation(), !i.includes(x) && o.toggle();
|
|
4117
|
+
}, A = (f) => {
|
|
4118
|
+
f.isInternal && (u = f.isOpen, f.isOpen && f.close());
|
|
4119
|
+
}, B = (f) => {
|
|
4120
|
+
f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
|
|
4121
|
+
}, N = (f) => {
|
|
4122
|
+
f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), w(f);
|
|
4123
4123
|
};
|
|
4124
4124
|
useEffect(() => {
|
|
4125
|
-
const
|
|
4125
|
+
const f = setTimeout(() => {
|
|
4126
4126
|
b && !o.isOpen && !k && !i.includes(x) && o.toggle();
|
|
4127
4127
|
}, 500);
|
|
4128
|
-
return () => clearTimeout(
|
|
4128
|
+
return () => clearTimeout(f);
|
|
4129
4129
|
}, [b, o, k]);
|
|
4130
4130
|
const L = useMemo(() => {
|
|
4131
|
-
const
|
|
4132
|
-
for (let
|
|
4133
|
-
if (
|
|
4134
|
-
const
|
|
4135
|
-
I.match(/x-data/) &&
|
|
4131
|
+
const f = Object.keys(j), C = [];
|
|
4132
|
+
for (let v = 0; v < f.length; v++)
|
|
4133
|
+
if (f[v].endsWith("_attrs")) {
|
|
4134
|
+
const R = j[f[v]], I = Object.keys(R).join("|");
|
|
4135
|
+
I.match(/x-data/) && C.push("data"), I.match(/x-on/) && C.push("event"), I.match(/x-show|x-if/) && C.push("show");
|
|
4136
4136
|
}
|
|
4137
|
-
return
|
|
4138
|
-
}, [j]), D = (
|
|
4139
|
-
const
|
|
4140
|
-
|
|
4141
|
-
const I =
|
|
4142
|
-
I.top >=
|
|
4137
|
+
return C;
|
|
4138
|
+
}, [j]), D = (f, C) => {
|
|
4139
|
+
const v = d.contentDocument || d.contentWindow.document, R = v.querySelector(`[data-block-id=${f}]`);
|
|
4140
|
+
R && R.setAttribute("data-drop", C);
|
|
4141
|
+
const I = R.getBoundingClientRect(), T = d.getBoundingClientRect();
|
|
4142
|
+
I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (v.documentElement.scrollTop = R.offsetTop - T.top);
|
|
4143
4143
|
};
|
|
4144
4144
|
return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4145
4145
|
"button",
|
|
@@ -4154,22 +4154,22 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4154
4154
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: x, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4155
4155
|
"div",
|
|
4156
4156
|
{
|
|
4157
|
-
onMouseEnter: () =>
|
|
4158
|
-
onMouseLeave: () =>
|
|
4159
|
-
onClick:
|
|
4157
|
+
onMouseEnter: () => m(x),
|
|
4158
|
+
onMouseLeave: () => g(),
|
|
4159
|
+
onClick: N,
|
|
4160
4160
|
style: n,
|
|
4161
4161
|
"data-node-id": x,
|
|
4162
4162
|
ref: i.includes(x) ? null : r,
|
|
4163
|
-
onDragStart: () =>
|
|
4164
|
-
onDragEnd: () =>
|
|
4165
|
-
onDragOver: (
|
|
4166
|
-
|
|
4163
|
+
onDragStart: () => A(o),
|
|
4164
|
+
onDragEnd: () => B(o),
|
|
4165
|
+
onDragOver: (f) => {
|
|
4166
|
+
f.preventDefault(), D(x, "yes");
|
|
4167
4167
|
},
|
|
4168
|
-
onDragLeave: (
|
|
4169
|
-
|
|
4168
|
+
onDragLeave: (f) => {
|
|
4169
|
+
f.preventDefault(), D(x, "no");
|
|
4170
4170
|
},
|
|
4171
|
-
onDrop: (
|
|
4172
|
-
|
|
4171
|
+
onDrop: (f) => {
|
|
4172
|
+
f.preventDefault(), D(x, "no");
|
|
4173
4173
|
},
|
|
4174
4174
|
className: cn(
|
|
4175
4175
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
@@ -4193,8 +4193,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4193
4193
|
"div",
|
|
4194
4194
|
{
|
|
4195
4195
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
4196
|
-
onDoubleClick: (
|
|
4197
|
-
|
|
4196
|
+
onDoubleClick: (f) => {
|
|
4197
|
+
f.stopPropagation(), o.edit(), o.deselect();
|
|
4198
4198
|
},
|
|
4199
4199
|
children: [
|
|
4200
4200
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
|
|
@@ -4207,16 +4207,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4207
4207
|
] })
|
|
4208
4208
|
] }),
|
|
4209
4209
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
|
|
4210
|
-
!i.includes(x) && a.map((
|
|
4210
|
+
!i.includes(x) && a.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4211
4211
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4212
4212
|
TooltipTrigger,
|
|
4213
4213
|
{
|
|
4214
4214
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
4215
4215
|
asChild: !0,
|
|
4216
|
-
children: React__default.createElement(
|
|
4216
|
+
children: React__default.createElement(f.item, { blockId: x })
|
|
4217
4217
|
}
|
|
4218
4218
|
),
|
|
4219
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children:
|
|
4219
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
|
|
4220
4220
|
] })),
|
|
4221
4221
|
canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4222
4222
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4234,8 +4234,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4234
4234
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4235
4235
|
TooltipTrigger,
|
|
4236
4236
|
{
|
|
4237
|
-
onClick: (
|
|
4238
|
-
|
|
4237
|
+
onClick: (f) => {
|
|
4238
|
+
f.stopPropagation(), c(x), o.isOpen && o.toggle();
|
|
4239
4239
|
},
|
|
4240
4240
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
|
|
4241
4241
|
asChild: !0,
|
|
@@ -4577,7 +4577,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4577
4577
|
}
|
|
4578
4578
|
}
|
|
4579
4579
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
4580
|
-
var u, p,
|
|
4580
|
+
var u, p, m, g, x, j, E, b;
|
|
4581
4581
|
if (r.type === "comment")
|
|
4582
4582
|
return [];
|
|
4583
4583
|
let a = { _id: generateUUID() };
|
|
@@ -4614,8 +4614,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4614
4614
|
...a,
|
|
4615
4615
|
href: ((u = l.find((S) => S.key === "href")) == null ? void 0 : u.value) || "",
|
|
4616
4616
|
hrefType: ((p = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
|
|
4617
|
-
autoplay: ((
|
|
4618
|
-
maxWidth: ((x = (
|
|
4617
|
+
autoplay: ((m = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
|
|
4618
|
+
maxWidth: ((x = (g = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
|
|
4619
4619
|
backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
|
|
4620
4620
|
galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
|
|
4621
4621
|
}, forEach(k, (S) => {
|
|
@@ -4629,8 +4629,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4629
4629
|
const k = stringify([r]);
|
|
4630
4630
|
return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = k, [a];
|
|
4631
4631
|
} else if (r.tagName === "svg") {
|
|
4632
|
-
const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), w = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px",
|
|
4633
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`,
|
|
4632
|
+
const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), w = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", A = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4633
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`, A)}`.trim(), r.attributes = filter(r.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([r]), [a];
|
|
4634
4634
|
} else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
|
|
4635
4635
|
return n.block.options.push({
|
|
4636
4636
|
label: getTextContent(r.children),
|
|
@@ -4691,14 +4691,14 @@ function ExpandableObject(o) {
|
|
|
4691
4691
|
level: d,
|
|
4692
4692
|
style: u,
|
|
4693
4693
|
shouldExpandNode: p,
|
|
4694
|
-
clickToExpandNode:
|
|
4694
|
+
clickToExpandNode: m
|
|
4695
4695
|
} = o;
|
|
4696
|
-
const
|
|
4696
|
+
const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
|
|
4697
4697
|
useEffect(() => {
|
|
4698
|
-
|
|
4698
|
+
g.current ? E(p(d, r, n)) : g.current = !0;
|
|
4699
4699
|
}, [p]);
|
|
4700
|
-
const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), w = d + 1, _ = a.length - 1,
|
|
4701
|
-
|
|
4700
|
+
const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), w = d + 1, _ = a.length - 1, A = (B) => {
|
|
4701
|
+
B.key === " " && (B.preventDefault(), j());
|
|
4702
4702
|
};
|
|
4703
4703
|
return /* @__PURE__ */ createElement("div", {
|
|
4704
4704
|
className: u.basicChildStyle,
|
|
@@ -4706,16 +4706,16 @@ function ExpandableObject(o) {
|
|
|
4706
4706
|
}, /* @__PURE__ */ createElement("span", {
|
|
4707
4707
|
className: b,
|
|
4708
4708
|
onClick: j,
|
|
4709
|
-
onKeyDown:
|
|
4709
|
+
onKeyDown: A,
|
|
4710
4710
|
role: "button",
|
|
4711
4711
|
tabIndex: 0,
|
|
4712
4712
|
"aria-label": k,
|
|
4713
4713
|
"aria-expanded": x,
|
|
4714
4714
|
"aria-controls": x ? S : void 0
|
|
4715
|
-
}), n && (
|
|
4715
|
+
}), n && (m ? /* @__PURE__ */ createElement("span", {
|
|
4716
4716
|
className: u.clickableLabel,
|
|
4717
4717
|
onClick: j,
|
|
4718
|
-
onKeyDown:
|
|
4718
|
+
onKeyDown: A,
|
|
4719
4719
|
role: "button",
|
|
4720
4720
|
tabIndex: -1
|
|
4721
4721
|
}, n, ":") : /* @__PURE__ */ createElement("span", {
|
|
@@ -4724,19 +4724,19 @@ function ExpandableObject(o) {
|
|
|
4724
4724
|
className: u.punctuation
|
|
4725
4725
|
}, i), x ? /* @__PURE__ */ createElement("div", {
|
|
4726
4726
|
id: S
|
|
4727
|
-
}, a.map((
|
|
4728
|
-
key:
|
|
4729
|
-
field:
|
|
4730
|
-
value:
|
|
4727
|
+
}, a.map((B, N) => /* @__PURE__ */ createElement(DataRender, {
|
|
4728
|
+
key: B[0] || N,
|
|
4729
|
+
field: B[0],
|
|
4730
|
+
value: B[1],
|
|
4731
4731
|
style: u,
|
|
4732
|
-
lastElement:
|
|
4732
|
+
lastElement: N === _,
|
|
4733
4733
|
level: w,
|
|
4734
4734
|
shouldExpandNode: p,
|
|
4735
|
-
clickToExpandNode:
|
|
4735
|
+
clickToExpandNode: m
|
|
4736
4736
|
}))) : /* @__PURE__ */ createElement("span", {
|
|
4737
4737
|
className: u.collapsedContent,
|
|
4738
4738
|
onClick: j,
|
|
4739
|
-
onKeyDown:
|
|
4739
|
+
onKeyDown: A,
|
|
4740
4740
|
role: "button",
|
|
4741
4741
|
tabIndex: -1,
|
|
4742
4742
|
"aria-hidden": !0,
|
|
@@ -4894,7 +4894,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4894
4894
|
dataType: i,
|
|
4895
4895
|
appliedBindings: c
|
|
4896
4896
|
}) => {
|
|
4897
|
-
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {},
|
|
4897
|
+
const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [g, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
|
|
4898
4898
|
(E) => !includes(c, E) && get(p, `props.${first(split(E, "."))}.binding`)
|
|
4899
4899
|
) : d.filter((E) => i === get(u, E, "")), [o, d, c, i, p]);
|
|
4900
4900
|
return useEffect(() => {
|
|
@@ -4902,7 +4902,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4902
4902
|
}, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4903
4903
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
4904
4904
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
|
|
4905
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open:
|
|
4905
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: g, onOpenChange: x, children: [
|
|
4906
4906
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4907
4907
|
Button,
|
|
4908
4908
|
{
|
|
@@ -4911,7 +4911,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4911
4911
|
className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
|
|
4912
4912
|
children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4913
4913
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
|
|
4914
|
-
|
|
4914
|
+
m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
|
|
4915
4915
|
n
|
|
4916
4916
|
] }),
|
|
4917
4917
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
|
|
@@ -4929,7 +4929,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4929
4929
|
CommandItem,
|
|
4930
4930
|
{
|
|
4931
4931
|
value: E,
|
|
4932
|
-
className: `cursor-pointer ${
|
|
4932
|
+
className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
|
|
4933
4933
|
onSelect: (b) => {
|
|
4934
4934
|
r(find(j, (k) => k === b) || null), x(!1);
|
|
4935
4935
|
},
|
|
@@ -4938,7 +4938,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4938
4938
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === E ? "" : "opacity-0"}` }),
|
|
4939
4939
|
E
|
|
4940
4940
|
] }),
|
|
4941
|
-
|
|
4941
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
|
|
4942
4942
|
]
|
|
4943
4943
|
},
|
|
4944
4944
|
E
|
|
@@ -4947,7 +4947,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4947
4947
|
] }) })
|
|
4948
4948
|
] })
|
|
4949
4949
|
] }),
|
|
4950
|
-
!
|
|
4950
|
+
!m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
|
|
4951
4951
|
] });
|
|
4952
4952
|
}, AddBindingModalContent = ({
|
|
4953
4953
|
appliedBindings: o = [],
|
|
@@ -4955,7 +4955,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4955
4955
|
editMode: r,
|
|
4956
4956
|
item: a
|
|
4957
4957
|
}) => {
|
|
4958
|
-
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(),
|
|
4958
|
+
const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
|
|
4959
4959
|
(j, E) => {
|
|
4960
4960
|
if (isEmpty(j))
|
|
4961
4961
|
return "";
|
|
@@ -4968,7 +4968,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4968
4968
|
}
|
|
4969
4969
|
},
|
|
4970
4970
|
[u, p]
|
|
4971
|
-
), [
|
|
4971
|
+
), [g, x] = useState(r ? m(a.key, "PROP") : "");
|
|
4972
4972
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4973
4973
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
|
|
4974
4974
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
|
|
@@ -4984,11 +4984,11 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
4984
4984
|
value: l,
|
|
4985
4985
|
setValue: i,
|
|
4986
4986
|
onChange: (j) => {
|
|
4987
|
-
const E =
|
|
4988
|
-
i(j),
|
|
4987
|
+
const E = m(j, "PROP");
|
|
4988
|
+
i(j), g !== E && d(""), x(E);
|
|
4989
4989
|
},
|
|
4990
4990
|
data: u,
|
|
4991
|
-
dataType:
|
|
4991
|
+
dataType: g,
|
|
4992
4992
|
appliedBindings: o
|
|
4993
4993
|
}
|
|
4994
4994
|
),
|
|
@@ -5002,11 +5002,11 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5002
5002
|
value: c,
|
|
5003
5003
|
setValue: d,
|
|
5004
5004
|
onChange: (j) => {
|
|
5005
|
-
const E =
|
|
5006
|
-
d(
|
|
5005
|
+
const E = m(j, "PATH");
|
|
5006
|
+
d(g === E ? j : "");
|
|
5007
5007
|
},
|
|
5008
5008
|
data: p,
|
|
5009
|
-
dataType:
|
|
5009
|
+
dataType: g,
|
|
5010
5010
|
appliedBindings: o
|
|
5011
5011
|
}
|
|
5012
5012
|
)
|
|
@@ -5046,14 +5046,14 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5046
5046
|
dataProvider: l,
|
|
5047
5047
|
appliedBindings: i
|
|
5048
5048
|
}) => {
|
|
5049
|
-
const [c, d] = useState("string"), u = (p,
|
|
5049
|
+
const [c, d] = useState("string"), u = (p, m) => {
|
|
5050
5050
|
if (isEmpty(p))
|
|
5051
5051
|
return "";
|
|
5052
5052
|
{
|
|
5053
|
-
const
|
|
5054
|
-
if (isArray$1(
|
|
5053
|
+
const g = get(m === "PROP" ? a : l, p, "");
|
|
5054
|
+
if (isArray$1(g))
|
|
5055
5055
|
return "list";
|
|
5056
|
-
const x = typeof
|
|
5056
|
+
const x = typeof g;
|
|
5057
5057
|
return x === "string" ? "text" : x === "object" ? "model" : x;
|
|
5058
5058
|
}
|
|
5059
5059
|
};
|
|
@@ -5075,32 +5075,32 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5075
5075
|
] });
|
|
5076
5076
|
}, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
|
|
5077
5077
|
const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
|
|
5078
|
-
map(o, (
|
|
5078
|
+
map(o, (g, x) => ({ key: x, value: g }))
|
|
5079
5079
|
);
|
|
5080
5080
|
useEffect(() => {
|
|
5081
|
-
c(map(o, (
|
|
5081
|
+
c(map(o, (g, x) => ({ key: x, value: g })));
|
|
5082
5082
|
}, [r == null ? void 0 : r._id, o]);
|
|
5083
5083
|
const d = useMemo(() => {
|
|
5084
5084
|
if (isEmpty(a))
|
|
5085
5085
|
return !0;
|
|
5086
5086
|
if (isEmpty(i))
|
|
5087
5087
|
return !1;
|
|
5088
|
-
const
|
|
5089
|
-
return isEmpty(
|
|
5090
|
-
}, [a, i]), u = (
|
|
5091
|
-
const x = filter(i, (j) => j.key !==
|
|
5092
|
-
c([...x,
|
|
5093
|
-
}, p = (
|
|
5094
|
-
const x = filter(i, (j, E) =>
|
|
5095
|
-
|
|
5096
|
-
},
|
|
5097
|
-
(
|
|
5098
|
-
if (c(
|
|
5088
|
+
const g = last(i);
|
|
5089
|
+
return isEmpty(g == null ? void 0 : g.key) || isEmpty(g == null ? void 0 : g.value);
|
|
5090
|
+
}, [a, i]), u = (g) => {
|
|
5091
|
+
const x = filter(i, (j) => j.key !== g.key);
|
|
5092
|
+
c([...x, g]), m([...x, g]);
|
|
5093
|
+
}, p = (g) => {
|
|
5094
|
+
const x = filter(i, (j, E) => g !== E);
|
|
5095
|
+
m([...x]);
|
|
5096
|
+
}, m = useCallback(
|
|
5097
|
+
(g = []) => {
|
|
5098
|
+
if (c(g), isEmpty(g)) {
|
|
5099
5099
|
n({});
|
|
5100
5100
|
return;
|
|
5101
5101
|
}
|
|
5102
5102
|
const x = {};
|
|
5103
|
-
forEach(
|
|
5103
|
+
forEach(g, (j) => {
|
|
5104
5104
|
!isEmpty(j == null ? void 0 : j.key) && !isEmpty(j == null ? void 0 : j.value) && set(x, j.key, j.value);
|
|
5105
5105
|
}), n(x);
|
|
5106
5106
|
},
|
|
@@ -5111,17 +5111,17 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5111
5111
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
5112
5112
|
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
5113
5113
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
5114
|
-
map(i, (
|
|
5114
|
+
map(i, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5115
5115
|
NewDataBindingPair,
|
|
5116
5116
|
{
|
|
5117
|
-
item:
|
|
5117
|
+
item: g,
|
|
5118
5118
|
onAddBinding: u,
|
|
5119
5119
|
onRemove: () => p(x),
|
|
5120
5120
|
selectedBlock: r,
|
|
5121
5121
|
dataProvider: a,
|
|
5122
5122
|
appliedBindings: map(i, "key")
|
|
5123
5123
|
},
|
|
5124
|
-
|
|
5124
|
+
g.key
|
|
5125
5125
|
)),
|
|
5126
5126
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
|
|
5127
5127
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { disabled: isEmpty(a), className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5210,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
|
|
|
5210
5210
|
}
|
|
5211
5211
|
)
|
|
5212
5212
|
] });
|
|
5213
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
5213
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages--HU-110a.js")), UploadImages = React__default.lazy(() => import("./UploadImages-bc0b7i8I.js")), ImagesPanel = ({
|
|
5214
5214
|
isModalView: o = !1,
|
|
5215
5215
|
onSelect: n = () => {
|
|
5216
5216
|
}
|
|
@@ -5300,115 +5300,114 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5300
5300
|
}
|
|
5301
5301
|
);
|
|
5302
5302
|
}, CollectionField = ({
|
|
5303
|
-
|
|
5303
|
+
href: o,
|
|
5304
5304
|
collections: n,
|
|
5305
5305
|
onChange: r
|
|
5306
5306
|
}) => {
|
|
5307
|
-
var
|
|
5308
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (
|
|
5307
|
+
var C;
|
|
5308
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, R) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, m] = useState(!1), [g, x] = useState("pages"), [j, E] = useState(""), [b, k] = useState([]), [S, w] = useState(-1), _ = useRef(null), A = (C = n == null ? void 0 : n.find((v) => v.key === g)) == null ? void 0 : C.name;
|
|
5309
5309
|
useEffect(() => {
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5310
|
+
if (!o || d || !startsWith(o, "collection:") || i)
|
|
5311
|
+
return;
|
|
5312
|
+
const v = split(o, ":"), R = get(v, 1, "pages") || "pages";
|
|
5313
|
+
x(R), E(""), k([]), w(-1), (async () => {
|
|
5314
|
+
u(!0);
|
|
5315
|
+
const I = await l(R, [get(v, 2, "pages")]);
|
|
5316
|
+
I && Array.isArray(I) && E(get(I, [0, "name"], "")), c(!0), u(!1);
|
|
5315
5317
|
})();
|
|
5316
|
-
}, [o
|
|
5317
|
-
const
|
|
5318
|
-
|
|
5319
|
-
if (isEmpty(
|
|
5320
|
-
|
|
5318
|
+
}, [o]);
|
|
5319
|
+
const B = useDebouncedCallback(
|
|
5320
|
+
async (v) => {
|
|
5321
|
+
if (isEmpty(v))
|
|
5322
|
+
k([]);
|
|
5321
5323
|
else {
|
|
5322
|
-
const
|
|
5323
|
-
|
|
5324
|
+
const R = await l(g, v);
|
|
5325
|
+
k(R);
|
|
5324
5326
|
}
|
|
5325
|
-
|
|
5326
|
-
},
|
|
5327
|
-
[
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5327
|
+
u(!1), w(-1);
|
|
5328
|
+
},
|
|
5329
|
+
[g],
|
|
5330
|
+
300
|
|
5331
|
+
), N = (v) => {
|
|
5332
|
+
const R = ["collection", g, v.id];
|
|
5333
|
+
R[1] && (r(R.join(":")), E(v.name), m(!1), k([]), w(-1));
|
|
5334
|
+
}, L = (v) => {
|
|
5335
|
+
switch (v.key) {
|
|
5333
5336
|
case "ArrowDown":
|
|
5334
|
-
|
|
5337
|
+
v.preventDefault(), w((R) => R < b.length - 1 ? R + 1 : R);
|
|
5335
5338
|
break;
|
|
5336
5339
|
case "ArrowUp":
|
|
5337
|
-
|
|
5340
|
+
v.preventDefault(), w((R) => R > 0 ? R - 1 : R);
|
|
5338
5341
|
break;
|
|
5339
5342
|
case "Enter":
|
|
5340
|
-
if (
|
|
5343
|
+
if (v.preventDefault(), b.length === 0)
|
|
5341
5344
|
return;
|
|
5342
|
-
|
|
5345
|
+
S >= 0 && N(b[S]);
|
|
5343
5346
|
break;
|
|
5344
5347
|
case "Escape":
|
|
5345
|
-
|
|
5348
|
+
v.preventDefault(), D();
|
|
5346
5349
|
break;
|
|
5347
5350
|
}
|
|
5348
5351
|
};
|
|
5349
5352
|
useEffect(() => {
|
|
5350
|
-
if (
|
|
5351
|
-
const
|
|
5352
|
-
|
|
5353
|
+
if (S >= 0 && _.current) {
|
|
5354
|
+
const v = _.current.children[S];
|
|
5355
|
+
v == null || v.scrollIntoView({ block: "nearest" });
|
|
5353
5356
|
}
|
|
5354
|
-
}, [
|
|
5355
|
-
const
|
|
5356
|
-
|
|
5357
|
-
},
|
|
5358
|
-
|
|
5357
|
+
}, [S]);
|
|
5358
|
+
const D = () => {
|
|
5359
|
+
E(""), k([]), w(-1), m(!1), r("");
|
|
5360
|
+
}, f = (v) => {
|
|
5361
|
+
E(v), m(!isEmpty(v)), u(!0), B(v);
|
|
5359
5362
|
};
|
|
5360
5363
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5361
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value:
|
|
5362
|
-
|
|
5364
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: g, onChange: (v) => x(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
|
|
5365
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
5363
5366
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5364
5367
|
"input",
|
|
5365
5368
|
{
|
|
5366
5369
|
type: "text",
|
|
5367
|
-
value:
|
|
5368
|
-
onChange: (
|
|
5369
|
-
onKeyDown:
|
|
5370
|
-
placeholder: a(`Search ${
|
|
5371
|
-
disabled: i === "FETCHING_INIT_VALUE",
|
|
5370
|
+
value: j,
|
|
5371
|
+
onChange: (v) => f(v.target.value),
|
|
5372
|
+
onKeyDown: L,
|
|
5373
|
+
placeholder: a(`Search ${A}`),
|
|
5372
5374
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
5373
5375
|
}
|
|
5374
5376
|
),
|
|
5375
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children:
|
|
5377
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: j && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: D, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
5376
5378
|
] }),
|
|
5377
|
-
(
|
|
5379
|
+
(d || !isEmpty(b) || p && isEmpty(b)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: d ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
|
|
5378
5380
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
5379
5381
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
5380
|
-
] }) :
|
|
5382
|
+
] }) : p && isEmpty(b) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
5381
5383
|
a("No results found for"),
|
|
5382
5384
|
' "',
|
|
5383
|
-
|
|
5385
|
+
j,
|
|
5384
5386
|
'"'
|
|
5385
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref:
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
{
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
" ",
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
m.id
|
|
5403
|
-
);
|
|
5404
|
-
}) }) })
|
|
5387
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: _, children: map(b == null ? void 0 : b.slice(0, 20), (v, R) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5388
|
+
"li",
|
|
5389
|
+
{
|
|
5390
|
+
onClick: () => N(v),
|
|
5391
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : R === S ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
5392
|
+
children: [
|
|
5393
|
+
v.name,
|
|
5394
|
+
" ",
|
|
5395
|
+
v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
|
|
5396
|
+
"( ",
|
|
5397
|
+
v.slug,
|
|
5398
|
+
" )"
|
|
5399
|
+
] })
|
|
5400
|
+
]
|
|
5401
|
+
},
|
|
5402
|
+
v.id
|
|
5403
|
+
)) }) })
|
|
5405
5404
|
] });
|
|
5406
5405
|
}, LinkField = ({ schema: o, formData: n, onChange: r }) => {
|
|
5407
|
-
const { t: a } = useTranslation(), { type: l = "collection", href: i = "
|
|
5406
|
+
const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty(d) ? "url" : l;
|
|
5408
5407
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5409
5408
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
|
|
5410
5409
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
5411
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (
|
|
5410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (p) => r({ ...n, type: p.target.value }), children: map(
|
|
5412
5411
|
[
|
|
5413
5412
|
...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
|
|
5414
5413
|
{ const: "url", title: a("Open URL") },
|
|
@@ -5416,9 +5415,16 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5416
5415
|
{ const: "telephone", title: a("Call Phone") },
|
|
5417
5416
|
{ const: "scroll", title: a("Scroll to element") }
|
|
5418
5417
|
],
|
|
5419
|
-
(
|
|
5418
|
+
(p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)
|
|
5420
5419
|
) }),
|
|
5421
|
-
|
|
5420
|
+
u === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5421
|
+
CollectionField,
|
|
5422
|
+
{
|
|
5423
|
+
href: i,
|
|
5424
|
+
collections: d,
|
|
5425
|
+
onChange: (p) => r({ ...n, href: p })
|
|
5426
|
+
}
|
|
5427
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5422
5428
|
"input",
|
|
5423
5429
|
{
|
|
5424
5430
|
autoCapitalize: "off",
|
|
@@ -5427,13 +5433,11 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5427
5433
|
name: "href",
|
|
5428
5434
|
type: "text",
|
|
5429
5435
|
value: i,
|
|
5430
|
-
onChange: (
|
|
5431
|
-
placeholder: a(
|
|
5432
|
-
l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details"
|
|
5433
|
-
)
|
|
5436
|
+
onChange: (p) => r({ ...n, href: p.target.value }),
|
|
5437
|
+
placeholder: a(l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details")
|
|
5434
5438
|
}
|
|
5435
5439
|
),
|
|
5436
|
-
|
|
5440
|
+
u === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5437
5441
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5438
5442
|
"input",
|
|
5439
5443
|
{
|
|
@@ -5470,7 +5474,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
|
|
|
5470
5474
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
|
|
5471
5475
|
] });
|
|
5472
5476
|
}, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
|
|
5473
|
-
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang:
|
|
5477
|
+
const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: g } = useLanguages(), x = g.length === 0 ? "" : p.length ? p : m;
|
|
5474
5478
|
Object.keys(n).forEach((E) => {
|
|
5475
5479
|
const b = n[E];
|
|
5476
5480
|
if (includes(["slot", "styles"], b.type))
|
|
@@ -5584,18 +5588,18 @@ function BlockSettings() {
|
|
|
5584
5588
|
const w = k.replace("root.", "");
|
|
5585
5589
|
a([n._id], { [w]: get(b, w) }, S);
|
|
5586
5590
|
}
|
|
5587
|
-
},
|
|
5591
|
+
}, m = useCallback(
|
|
5588
5592
|
debounce(({ formData: b }, k, S) => {
|
|
5589
5593
|
p({ formData: b }, k, S), d(b);
|
|
5590
5594
|
}, 1500),
|
|
5591
5595
|
[n == null ? void 0 : n._id, o]
|
|
5592
|
-
),
|
|
5596
|
+
), g = ({ formData: b }, k) => {
|
|
5593
5597
|
if (k) {
|
|
5594
5598
|
const S = k.replace("root.", "");
|
|
5595
5599
|
r(
|
|
5596
5600
|
[n._id],
|
|
5597
5601
|
convertDotNotationToObject(S, get(b, S.split(".")))
|
|
5598
|
-
),
|
|
5602
|
+
), m({ formData: b }, k, { [S]: get(c, S) });
|
|
5599
5603
|
}
|
|
5600
5604
|
}, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
|
|
5601
5605
|
const b = cloneDeep(get(l, "props", {}));
|
|
@@ -5642,7 +5646,7 @@ function BlockSettings() {
|
|
|
5642
5646
|
JSONForm,
|
|
5643
5647
|
{
|
|
5644
5648
|
id: n == null ? void 0 : n._id,
|
|
5645
|
-
onChange:
|
|
5649
|
+
onChange: g,
|
|
5646
5650
|
formData: i,
|
|
5647
5651
|
properties: j
|
|
5648
5652
|
}
|
|
@@ -5653,7 +5657,7 @@ function BlockSettings() {
|
|
|
5653
5657
|
JSONForm,
|
|
5654
5658
|
{
|
|
5655
5659
|
id: n == null ? void 0 : n._id,
|
|
5656
|
-
onChange:
|
|
5660
|
+
onChange: g,
|
|
5657
5661
|
formData: i,
|
|
5658
5662
|
properties: j
|
|
5659
5663
|
}
|
|
@@ -5683,21 +5687,21 @@ function promptWithLanguage(o, n, r) {
|
|
|
5683
5687
|
${a}`;
|
|
5684
5688
|
}
|
|
5685
5689
|
const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
5686
|
-
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(),
|
|
5690
|
+
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;
|
|
5687
5691
|
return {
|
|
5688
5692
|
askAi: useCallback(
|
|
5689
|
-
async (
|
|
5693
|
+
async (g, x, j, E) => {
|
|
5690
5694
|
if (l) {
|
|
5691
5695
|
n(!0), a(null);
|
|
5692
5696
|
try {
|
|
5693
|
-
const b =
|
|
5697
|
+
const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((A) => A._id === x))];
|
|
5694
5698
|
set(b, "0._parent", null);
|
|
5695
|
-
const k = u === p ? "" : u, S = await l(
|
|
5699
|
+
const k = u === p ? "" : u, S = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: w, error: _ } = S;
|
|
5696
5700
|
if (_) {
|
|
5697
5701
|
a(_);
|
|
5698
5702
|
return;
|
|
5699
5703
|
}
|
|
5700
|
-
|
|
5704
|
+
g === "styles" ? c(w) : i(w), E && E(S);
|
|
5701
5705
|
} catch (b) {
|
|
5702
5706
|
a(b);
|
|
5703
5707
|
} finally {
|
|
@@ -5711,7 +5715,7 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
|
5711
5715
|
d,
|
|
5712
5716
|
u,
|
|
5713
5717
|
p,
|
|
5714
|
-
|
|
5718
|
+
m,
|
|
5715
5719
|
c,
|
|
5716
5720
|
i
|
|
5717
5721
|
]
|
|
@@ -5785,14 +5789,14 @@ function Countdown() {
|
|
|
5785
5789
|
] });
|
|
5786
5790
|
}
|
|
5787
5791
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5788
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p,
|
|
5792
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
|
|
5789
5793
|
useEffect(() => {
|
|
5790
5794
|
var x;
|
|
5791
5795
|
(x = d.current) == null || x.focus();
|
|
5792
5796
|
}, []);
|
|
5793
|
-
const
|
|
5797
|
+
const g = (x) => {
|
|
5794
5798
|
const { usage: j } = x || {};
|
|
5795
|
-
!l && j &&
|
|
5799
|
+
!l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5796
5800
|
};
|
|
5797
5801
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5798
5802
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
|
|
@@ -5806,7 +5810,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5806
5810
|
className: "w-full border border-border focus:border-0",
|
|
5807
5811
|
rows: 3,
|
|
5808
5812
|
onKeyDown: (x) => {
|
|
5809
|
-
x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current),
|
|
5813
|
+
x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
|
|
5810
5814
|
}
|
|
5811
5815
|
}
|
|
5812
5816
|
),
|
|
@@ -5816,7 +5820,7 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5816
5820
|
{
|
|
5817
5821
|
disabled: i.trim().length < 5 || a,
|
|
5818
5822
|
onClick: () => {
|
|
5819
|
-
u.current && clearTimeout(u.current),
|
|
5823
|
+
u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
|
|
5820
5824
|
},
|
|
5821
5825
|
variant: "default",
|
|
5822
5826
|
className: "w-fit",
|
|
@@ -5852,37 +5856,37 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5852
5856
|
keys: ["name"]
|
|
5853
5857
|
});
|
|
5854
5858
|
function ManualClasses() {
|
|
5855
|
-
var
|
|
5856
|
-
const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(),
|
|
5857
|
-
const
|
|
5858
|
-
a(i,
|
|
5859
|
-
}, [j, E] = useState([]), b = ({ value:
|
|
5860
|
-
const L =
|
|
5861
|
-
let
|
|
5859
|
+
var B;
|
|
5860
|
+
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 = (B = first(n)) == null ? void 0 : B.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
|
|
5861
|
+
const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5862
|
+
a(i, N, !0), u("");
|
|
5863
|
+
}, [j, E] = useState([]), b = ({ value: N }) => {
|
|
5864
|
+
const L = N.trim().toLowerCase(), D = L.match(/.+:/g);
|
|
5865
|
+
let f = [];
|
|
5862
5866
|
if (D && D.length > 0) {
|
|
5863
|
-
const [
|
|
5864
|
-
|
|
5867
|
+
const [C] = D, v = L.replace(C, "");
|
|
5868
|
+
f = fuse.search(v).map((I) => ({
|
|
5865
5869
|
...I,
|
|
5866
|
-
item: { ...I.item, name:
|
|
5870
|
+
item: { ...I.item, name: C + I.item.name }
|
|
5867
5871
|
}));
|
|
5868
5872
|
} else
|
|
5869
|
-
|
|
5870
|
-
return E(map(
|
|
5873
|
+
f = fuse.search(L);
|
|
5874
|
+
return E(map(f, "item"));
|
|
5871
5875
|
}, k = () => {
|
|
5872
5876
|
E([]);
|
|
5873
|
-
}, S = (
|
|
5877
|
+
}, S = (N) => N.name, w = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), _ = {
|
|
5874
5878
|
autoComplete: "off",
|
|
5875
5879
|
autoCorrect: "off",
|
|
5876
5880
|
autoCapitalize: "off",
|
|
5877
5881
|
spellCheck: !1,
|
|
5878
5882
|
placeholder: o("Enter classes separated by space"),
|
|
5879
5883
|
value: d,
|
|
5880
|
-
onKeyDown: (
|
|
5881
|
-
|
|
5884
|
+
onKeyDown: (N) => {
|
|
5885
|
+
N.key === "Enter" && d.trim() !== "" && x();
|
|
5882
5886
|
},
|
|
5883
|
-
onChange: (
|
|
5887
|
+
onChange: (N, { newValue: L }) => u(L),
|
|
5884
5888
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5885
|
-
},
|
|
5889
|
+
}, A = () => {
|
|
5886
5890
|
if (navigator.clipboard === void 0) {
|
|
5887
5891
|
p({
|
|
5888
5892
|
title: o("Clipboard not supported"),
|
|
@@ -5891,7 +5895,7 @@ function ManualClasses() {
|
|
|
5891
5895
|
});
|
|
5892
5896
|
return;
|
|
5893
5897
|
}
|
|
5894
|
-
navigator.clipboard.writeText(
|
|
5898
|
+
navigator.clipboard.writeText(g.join(" ")), p({
|
|
5895
5899
|
title: o("Copied"),
|
|
5896
5900
|
description: o("Classes copied to clipboard")
|
|
5897
5901
|
});
|
|
@@ -5905,7 +5909,7 @@ function ManualClasses() {
|
|
|
5905
5909
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5906
5910
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
|
|
5907
5911
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5908
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5912
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: A, className: "cursor-pointer" }) }),
|
|
5909
5913
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("Copy classes to clipboard") }) })
|
|
5910
5914
|
] })
|
|
5911
5915
|
] }),
|
|
@@ -5950,22 +5954,22 @@ function ManualClasses() {
|
|
|
5950
5954
|
)
|
|
5951
5955
|
] }),
|
|
5952
5956
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
|
|
5953
|
-
|
|
5957
|
+
g.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5954
5958
|
"div",
|
|
5955
5959
|
{
|
|
5956
5960
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5957
5961
|
children: [
|
|
5958
|
-
|
|
5962
|
+
N,
|
|
5959
5963
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5960
5964
|
Cross2Icon,
|
|
5961
5965
|
{
|
|
5962
|
-
onClick: () => l(i, [
|
|
5966
|
+
onClick: () => l(i, [N]),
|
|
5963
5967
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5964
5968
|
}
|
|
5965
5969
|
)
|
|
5966
5970
|
]
|
|
5967
5971
|
},
|
|
5968
|
-
|
|
5972
|
+
N
|
|
5969
5973
|
))
|
|
5970
5974
|
) })
|
|
5971
5975
|
]
|
|
@@ -6356,7 +6360,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6356
6360
|
ringColor: "ring",
|
|
6357
6361
|
ringOffsetColor: "ring-offset"
|
|
6358
6362
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6359
|
-
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("-"),
|
|
6363
|
+
const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), g = get(p, "2", ""), x = useCallback(
|
|
6360
6364
|
// eslint-disable-next-line no-shadow
|
|
6361
6365
|
(E) => {
|
|
6362
6366
|
["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), u({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: E, shade: b.shade ? b.shade : "500" })));
|
|
@@ -6364,16 +6368,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6364
6368
|
[c, u]
|
|
6365
6369
|
);
|
|
6366
6370
|
useEffect(() => {
|
|
6367
|
-
if (["current", "inherit", "transparent", "black", "white"].includes(
|
|
6371
|
+
if (["current", "inherit", "transparent", "black", "white"].includes(m))
|
|
6368
6372
|
return c([]);
|
|
6369
6373
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6370
|
-
}, [
|
|
6374
|
+
}, [m]);
|
|
6371
6375
|
const j = useCallback(
|
|
6372
6376
|
// eslint-disable-next-line no-shadow
|
|
6373
6377
|
(E) => {
|
|
6374
|
-
u({ color:
|
|
6378
|
+
u({ color: m, shade: E });
|
|
6375
6379
|
},
|
|
6376
|
-
[
|
|
6380
|
+
[m]
|
|
6377
6381
|
);
|
|
6378
6382
|
return useEffect(() => {
|
|
6379
6383
|
u({ color: "", shade: "" });
|
|
@@ -6386,7 +6390,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6386
6390
|
{
|
|
6387
6391
|
disabled: !l,
|
|
6388
6392
|
rounded: !0,
|
|
6389
|
-
selected:
|
|
6393
|
+
selected: m,
|
|
6390
6394
|
onChange: x,
|
|
6391
6395
|
options: [
|
|
6392
6396
|
"current",
|
|
@@ -6420,7 +6424,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6420
6424
|
]
|
|
6421
6425
|
}
|
|
6422
6426
|
) }),
|
|
6423
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected:
|
|
6427
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: j, options: i }) })
|
|
6424
6428
|
] });
|
|
6425
6429
|
}, getUserInputValues = (o, n) => {
|
|
6426
6430
|
o = o.toLowerCase();
|
|
@@ -6615,52 +6619,52 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6615
6619
|
},
|
|
6616
6620
|
a
|
|
6617
6621
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6618
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative:
|
|
6622
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [S, w] = useState(!1), [_, A] = useState(!1);
|
|
6619
6623
|
useEffect(() => {
|
|
6620
|
-
const { value:
|
|
6621
|
-
if (
|
|
6622
|
-
l(
|
|
6624
|
+
const { value: f, unit: C } = getClassValueAndUnit(i);
|
|
6625
|
+
if (C === "") {
|
|
6626
|
+
l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6623
6627
|
return;
|
|
6624
6628
|
}
|
|
6625
|
-
x(
|
|
6629
|
+
x(C), l(C === "class" || isEmpty(f) ? "" : f);
|
|
6626
6630
|
}, [i, u, p]);
|
|
6627
|
-
const
|
|
6628
|
-
(
|
|
6629
|
-
const
|
|
6630
|
-
if (get(
|
|
6631
|
+
const B = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
|
|
6632
|
+
(f = !1) => {
|
|
6633
|
+
const C = getUserInputValues(`${a}`, p);
|
|
6634
|
+
if (get(C, "error", !1)) {
|
|
6631
6635
|
E(!0);
|
|
6632
6636
|
return;
|
|
6633
6637
|
}
|
|
6634
|
-
const
|
|
6635
|
-
if (
|
|
6636
|
-
|
|
6638
|
+
const v = get(C, "unit") !== "" ? get(C, "unit") : g;
|
|
6639
|
+
if (v === "auto" || v === "none") {
|
|
6640
|
+
B(`${d}${v}`);
|
|
6637
6641
|
return;
|
|
6638
6642
|
}
|
|
6639
|
-
if (get(
|
|
6643
|
+
if (get(C, "value") === "")
|
|
6640
6644
|
return;
|
|
6641
|
-
const I = `${get(
|
|
6642
|
-
|
|
6645
|
+
const I = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${v === "-" ? "" : v}]`;
|
|
6646
|
+
f ? N(I) : B(I);
|
|
6643
6647
|
},
|
|
6644
|
-
[
|
|
6648
|
+
[B, N, a, g, d, p]
|
|
6645
6649
|
), D = useCallback(
|
|
6646
|
-
(
|
|
6647
|
-
const
|
|
6648
|
-
if (get(
|
|
6650
|
+
(f) => {
|
|
6651
|
+
const C = getUserInputValues(`${a}`, p);
|
|
6652
|
+
if (get(C, "error", !1)) {
|
|
6649
6653
|
E(!0);
|
|
6650
6654
|
return;
|
|
6651
6655
|
}
|
|
6652
|
-
if (
|
|
6653
|
-
|
|
6656
|
+
if (f === "auto" || f === "none") {
|
|
6657
|
+
B(`${d}${f}`);
|
|
6654
6658
|
return;
|
|
6655
6659
|
}
|
|
6656
|
-
if (get(
|
|
6660
|
+
if (get(C, "value") === "")
|
|
6657
6661
|
return;
|
|
6658
|
-
const
|
|
6659
|
-
|
|
6662
|
+
const v = get(C, "unit") !== "" ? get(C, "unit") : f, I = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${v === "-" ? "" : v}]`;
|
|
6663
|
+
B(I);
|
|
6660
6664
|
},
|
|
6661
|
-
[
|
|
6665
|
+
[B, a, d, p]
|
|
6662
6666
|
);
|
|
6663
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children:
|
|
6667
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6664
6668
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
|
|
6665
6669
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6666
6670
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
|
|
@@ -6668,33 +6672,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6668
6672
|
] })
|
|
6669
6673
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
|
|
6670
6674
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6671
|
-
["none", "auto"].indexOf(
|
|
6675
|
+
["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6672
6676
|
"input",
|
|
6673
6677
|
{
|
|
6674
|
-
readOnly:
|
|
6675
|
-
onKeyPress: (
|
|
6676
|
-
|
|
6678
|
+
readOnly: g === "class",
|
|
6679
|
+
onKeyPress: (f) => {
|
|
6680
|
+
f.key === "Enter" && L();
|
|
6677
6681
|
},
|
|
6678
|
-
onKeyDown: (
|
|
6679
|
-
if (
|
|
6682
|
+
onKeyDown: (f) => {
|
|
6683
|
+
if (f.keyCode !== 38 && f.keyCode !== 40)
|
|
6680
6684
|
return;
|
|
6681
|
-
|
|
6682
|
-
const
|
|
6683
|
-
let
|
|
6684
|
-
|
|
6685
|
-
const
|
|
6686
|
-
T
|
|
6685
|
+
f.preventDefault(), A(!0);
|
|
6686
|
+
const C = parseInt$1(f.target.value);
|
|
6687
|
+
let v = isNaN$1(C) ? 0 : C;
|
|
6688
|
+
f.keyCode === 38 && (v += 1), f.keyCode === 40 && (v -= 1);
|
|
6689
|
+
const R = `${v}`, T = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6690
|
+
N(T);
|
|
6687
6691
|
},
|
|
6688
|
-
onKeyUp: (
|
|
6689
|
-
_ && (
|
|
6692
|
+
onKeyUp: (f) => {
|
|
6693
|
+
_ && (f.preventDefault(), A(!1));
|
|
6690
6694
|
},
|
|
6691
6695
|
onBlur: () => L(),
|
|
6692
|
-
onChange: (
|
|
6693
|
-
E(!1), l(
|
|
6696
|
+
onChange: (f) => {
|
|
6697
|
+
E(!1), l(f.target.value);
|
|
6694
6698
|
},
|
|
6695
|
-
onClick: (
|
|
6696
|
-
var
|
|
6697
|
-
(
|
|
6699
|
+
onClick: (f) => {
|
|
6700
|
+
var C;
|
|
6701
|
+
(C = f == null ? void 0 : f.target) == null || C.select(), r(!1);
|
|
6698
6702
|
},
|
|
6699
6703
|
value: S ? b : a,
|
|
6700
6704
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
@@ -6711,7 +6715,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6711
6715
|
onClick: () => r(!n),
|
|
6712
6716
|
className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
|
|
6713
6717
|
children: [
|
|
6714
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children:
|
|
6718
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
|
|
6715
6719
|
p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
|
|
6716
6720
|
]
|
|
6717
6721
|
}
|
|
@@ -6720,34 +6724,34 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6720
6724
|
UnitSelection,
|
|
6721
6725
|
{
|
|
6722
6726
|
units: p,
|
|
6723
|
-
current:
|
|
6724
|
-
onSelect: (
|
|
6725
|
-
r(!1), x(
|
|
6727
|
+
current: g,
|
|
6728
|
+
onSelect: (f) => {
|
|
6729
|
+
r(!1), x(f), D(f);
|
|
6726
6730
|
}
|
|
6727
6731
|
}
|
|
6728
6732
|
) }) })
|
|
6729
6733
|
] })
|
|
6730
6734
|
] }),
|
|
6731
|
-
["none", "auto"].indexOf(
|
|
6735
|
+
["none", "auto"].indexOf(g) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6732
6736
|
DragStyleButton,
|
|
6733
6737
|
{
|
|
6734
6738
|
onDragStart: () => w(!0),
|
|
6735
|
-
onDragEnd: (
|
|
6736
|
-
if (k(() => ""), w(!1), isEmpty(
|
|
6739
|
+
onDragEnd: (f) => {
|
|
6740
|
+
if (k(() => ""), w(!1), isEmpty(f))
|
|
6737
6741
|
return;
|
|
6738
|
-
const
|
|
6739
|
-
|
|
6742
|
+
const C = `${f}`, R = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6743
|
+
B(R);
|
|
6740
6744
|
},
|
|
6741
|
-
onDrag: (
|
|
6742
|
-
if (isEmpty(
|
|
6745
|
+
onDrag: (f) => {
|
|
6746
|
+
if (isEmpty(f))
|
|
6743
6747
|
return;
|
|
6744
|
-
k(
|
|
6745
|
-
const
|
|
6746
|
-
|
|
6748
|
+
k(f);
|
|
6749
|
+
const C = `${f}`, R = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${g === "-" ? "" : g}]`;
|
|
6750
|
+
N(R);
|
|
6747
6751
|
},
|
|
6748
6752
|
currentValue: a,
|
|
6749
|
-
unit:
|
|
6750
|
-
negative:
|
|
6753
|
+
unit: g,
|
|
6754
|
+
negative: m,
|
|
6751
6755
|
cssProperty: u
|
|
6752
6756
|
}
|
|
6753
6757
|
)
|
|
@@ -6840,22 +6844,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6840
6844
|
"2xl": "1536px"
|
|
6841
6845
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6842
6846
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6843
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [,
|
|
6844
|
-
(
|
|
6845
|
-
const D = { dark: u, mq:
|
|
6847
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), g = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), k = useCallback(
|
|
6848
|
+
(N, L = !0) => {
|
|
6849
|
+
const D = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
|
|
6846
6850
|
(u || p !== "") && (D.mq = "xs");
|
|
6847
|
-
const
|
|
6848
|
-
x(E, [
|
|
6851
|
+
const f = generateFullClsName(D);
|
|
6852
|
+
x(E, [f], L);
|
|
6849
6853
|
},
|
|
6850
|
-
[E, u,
|
|
6854
|
+
[E, u, m, p, l, x]
|
|
6851
6855
|
), S = useCallback(() => {
|
|
6852
6856
|
j(E, [b]);
|
|
6853
|
-
}, [E, b, j]), w = useMemo(() => canChangeClass(
|
|
6857
|
+
}, [E, b, j]), w = useMemo(() => canChangeClass(g, m), [g, m]);
|
|
6854
6858
|
useEffect(() => {
|
|
6855
|
-
i(w,
|
|
6856
|
-
}, [w, i,
|
|
6857
|
-
const [, , _] = useCanvasWidth(),
|
|
6858
|
-
(
|
|
6859
|
+
i(w, g);
|
|
6860
|
+
}, [w, i, g]);
|
|
6861
|
+
const [, , _] = useCanvasWidth(), A = useCallback(
|
|
6862
|
+
(N) => {
|
|
6859
6863
|
_({
|
|
6860
6864
|
xs: 400,
|
|
6861
6865
|
sm: 640,
|
|
@@ -6863,18 +6867,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6863
6867
|
lg: 1024,
|
|
6864
6868
|
xl: 1420,
|
|
6865
6869
|
"2xl": 1920
|
|
6866
|
-
}[
|
|
6870
|
+
}[N]);
|
|
6867
6871
|
},
|
|
6868
6872
|
[_]
|
|
6869
|
-
),
|
|
6870
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset:
|
|
6871
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${
|
|
6873
|
+
), B = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
|
|
6874
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: g && B, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6875
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !B ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6872
6876
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6873
6877
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6874
6878
|
r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6875
6879
|
AdvanceChoices,
|
|
6876
6880
|
{
|
|
6877
|
-
currentClass: get(
|
|
6881
|
+
currentClass: get(g, "cls", ""),
|
|
6878
6882
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6879
6883
|
units: c || [],
|
|
6880
6884
|
onChange: k,
|
|
@@ -6887,7 +6891,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6887
6891
|
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6888
6892
|
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6889
6893
|
] }),
|
|
6890
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children:
|
|
6894
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), 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" }) }) : w && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6891
6895
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6892
6896
|
"button",
|
|
6893
6897
|
{
|
|
@@ -6899,19 +6903,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6899
6903
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
6900
6904
|
"Current style is set at ",
|
|
6901
6905
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
|
|
6902
|
-
getBreakpoint(get(
|
|
6903
|
-
u && !
|
|
6906
|
+
getBreakpoint(get(g, "mq")),
|
|
6907
|
+
u && !g.dark ? "(Light mode)" : ""
|
|
6904
6908
|
] }),
|
|
6905
6909
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
6906
6910
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6907
6911
|
"button",
|
|
6908
6912
|
{
|
|
6909
6913
|
type: "button",
|
|
6910
|
-
onClick: () =>
|
|
6914
|
+
onClick: () => A(get(g, "mq")),
|
|
6911
6915
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6912
6916
|
children: [
|
|
6913
6917
|
"Switch to ",
|
|
6914
|
-
get(
|
|
6918
|
+
get(g, "mq").toUpperCase()
|
|
6915
6919
|
]
|
|
6916
6920
|
}
|
|
6917
6921
|
)
|
|
@@ -6928,7 +6932,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6928
6932
|
units: i = basicUnits,
|
|
6929
6933
|
negative: c = !1
|
|
6930
6934
|
}) => {
|
|
6931
|
-
const { t: d } = useTranslation(), [u, p] = useState(n[0].key),
|
|
6935
|
+
const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
|
|
6932
6936
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6933
6937
|
"div",
|
|
6934
6938
|
{
|
|
@@ -6946,7 +6950,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6946
6950
|
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6947
6951
|
children: [
|
|
6948
6952
|
React__default.createElement("div", {
|
|
6949
|
-
className:
|
|
6953
|
+
className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6950
6954
|
}),
|
|
6951
6955
|
React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6952
6956
|
]
|
|
@@ -7017,8 +7021,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
7017
7021
|
if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
|
|
7018
7022
|
return null;
|
|
7019
7023
|
const u = (p) => {
|
|
7020
|
-
const
|
|
7021
|
-
l([o._id],
|
|
7024
|
+
const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
7025
|
+
l([o._id], m, !0);
|
|
7022
7026
|
};
|
|
7023
7027
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
7024
7028
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
|
|
@@ -7072,13 +7076,13 @@ function BlockStyling() {
|
|
|
7072
7076
|
cssProperty: ""
|
|
7073
7077
|
}), d = useThrottledCallback(
|
|
7074
7078
|
(p) => {
|
|
7075
|
-
const
|
|
7079
|
+
const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
|
|
7076
7080
|
let x = parseFloat(i.dragStartValue);
|
|
7077
7081
|
x = isNaN(x) ? 0 : x;
|
|
7078
7082
|
let j = MAPPER[i.dragUnit];
|
|
7079
|
-
(startsWith(
|
|
7083
|
+
(startsWith(g, "scale") || g === "opacity") && (j = 10);
|
|
7080
7084
|
let b = (i.dragStartY - p.pageY) / j + x;
|
|
7081
|
-
|
|
7085
|
+
m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
|
|
7082
7086
|
},
|
|
7083
7087
|
[i],
|
|
7084
7088
|
50
|
|
@@ -7164,7 +7168,7 @@ const BlockCard = ({
|
|
|
7164
7168
|
library: n,
|
|
7165
7169
|
parentId: r = void 0
|
|
7166
7170
|
}) => {
|
|
7167
|
-
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(),
|
|
7171
|
+
const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
|
|
7168
7172
|
const S = has(k, "styles_attrs.data-page-section");
|
|
7169
7173
|
return k._type === "Box" && S;
|
|
7170
7174
|
}, E = useCallback(
|
|
@@ -7184,9 +7188,9 @@ const BlockCard = ({
|
|
|
7184
7188
|
if (j(first(S)) && (w = null), !isEmpty(S)) {
|
|
7185
7189
|
const _ = { blocks: S, uiLibrary: !0, parent: w };
|
|
7186
7190
|
if (k.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
|
|
7187
|
-
const
|
|
7188
|
-
|
|
7189
|
-
k.dataTransfer.setDragImage(
|
|
7191
|
+
const A = new Image();
|
|
7192
|
+
A.src = o.preview, A.onload = () => {
|
|
7193
|
+
k.dataTransfer.setDragImage(A, 0, 0);
|
|
7190
7194
|
};
|
|
7191
7195
|
} else
|
|
7192
7196
|
k.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
@@ -7201,7 +7205,7 @@ const BlockCard = ({
|
|
|
7201
7205
|
{
|
|
7202
7206
|
onClick: a ? () => {
|
|
7203
7207
|
} : E,
|
|
7204
|
-
draggable:
|
|
7208
|
+
draggable: g ? "true" : "false",
|
|
7205
7209
|
onDragStart: b,
|
|
7206
7210
|
className: clsx(
|
|
7207
7211
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
@@ -7211,11 +7215,11 @@ const BlockCard = ({
|
|
|
7211
7215
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
|
|
7212
7216
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
7213
7217
|
] }),
|
|
7214
|
-
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt:
|
|
7218
|
+
o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
|
|
7215
7219
|
]
|
|
7216
7220
|
}
|
|
7217
7221
|
) }),
|
|
7218
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7222
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
|
|
7219
7223
|
] });
|
|
7220
7224
|
}, libraryBlocksAtom = atom$1(
|
|
7221
7225
|
{}
|
|
@@ -7231,9 +7235,9 @@ const BlockCard = ({
|
|
|
7231
7235
|
})();
|
|
7232
7236
|
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7233
7237
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7234
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [
|
|
7238
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (w) => {
|
|
7235
7239
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7236
|
-
j.current &&
|
|
7240
|
+
j.current && g(w);
|
|
7237
7241
|
}, 300);
|
|
7238
7242
|
};
|
|
7239
7243
|
if (u)
|
|
@@ -7254,10 +7258,10 @@ const BlockCard = ({
|
|
|
7254
7258
|
{
|
|
7255
7259
|
onMouseEnter: () => b(_),
|
|
7256
7260
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7257
|
-
onClick: () =>
|
|
7261
|
+
onClick: () => g(_),
|
|
7258
7262
|
className: cn(
|
|
7259
7263
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7260
|
-
_ ===
|
|
7264
|
+
_ === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7261
7265
|
),
|
|
7262
7266
|
children: [
|
|
7263
7267
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
|
|
@@ -7784,7 +7788,7 @@ i18n.use(initReactI18next).init({
|
|
|
7784
7788
|
}
|
|
7785
7789
|
});
|
|
7786
7790
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7787
|
-
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight:
|
|
7791
|
+
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
|
|
7788
7792
|
if (has(o, "blocks")) {
|
|
7789
7793
|
const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7790
7794
|
u(syncBlocksWithDefaults(E), r || null);
|
|
@@ -7797,11 +7801,11 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7797
7801
|
"button",
|
|
7798
7802
|
{
|
|
7799
7803
|
disabled: n,
|
|
7800
|
-
onClick:
|
|
7804
|
+
onClick: g,
|
|
7801
7805
|
type: "button",
|
|
7802
7806
|
onDragStart: (E) => {
|
|
7803
7807
|
E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7804
|
-
p([]),
|
|
7808
|
+
p([]), m();
|
|
7805
7809
|
}, 200);
|
|
7806
7810
|
},
|
|
7807
7811
|
draggable: x ? "true" : "false",
|
|
@@ -8166,14 +8170,14 @@ function QuickPrompts({ onClick: o }) {
|
|
|
8166
8170
|
) }) });
|
|
8167
8171
|
}
|
|
8168
8172
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
8169
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p,
|
|
8173
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), g = useRef(null), x = useRef(null);
|
|
8170
8174
|
useEffect(() => {
|
|
8171
8175
|
var E;
|
|
8172
|
-
(E =
|
|
8176
|
+
(E = g.current) == null || E.focus();
|
|
8173
8177
|
}, []);
|
|
8174
8178
|
const j = (E) => {
|
|
8175
8179
|
const { usage: b } = E || {};
|
|
8176
|
-
!l && b &&
|
|
8180
|
+
!l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
8177
8181
|
};
|
|
8178
8182
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
8179
8183
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8191,14 +8195,14 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8191
8195
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8192
8196
|
Textarea,
|
|
8193
8197
|
{
|
|
8194
|
-
ref:
|
|
8198
|
+
ref: g,
|
|
8195
8199
|
value: i,
|
|
8196
8200
|
onChange: (E) => c(E.target.value),
|
|
8197
8201
|
placeholder: n("Ask AI to edit content"),
|
|
8198
8202
|
className: "w-full",
|
|
8199
8203
|
rows: 3,
|
|
8200
8204
|
onKeyDown: (E) => {
|
|
8201
|
-
E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current),
|
|
8205
|
+
E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
|
|
8202
8206
|
}
|
|
8203
8207
|
}
|
|
8204
8208
|
),
|
|
@@ -8208,7 +8212,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8208
8212
|
{
|
|
8209
8213
|
disabled: i.trim().length < 5 || a,
|
|
8210
8214
|
onClick: () => {
|
|
8211
|
-
x.current && clearTimeout(x.current),
|
|
8215
|
+
x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
|
|
8212
8216
|
},
|
|
8213
8217
|
variant: "default",
|
|
8214
8218
|
className: "w-fit",
|
|
@@ -8241,7 +8245,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8241
8245
|
QuickPrompts,
|
|
8242
8246
|
{
|
|
8243
8247
|
onClick: (E) => {
|
|
8244
|
-
x.current && clearTimeout(x.current),
|
|
8248
|
+
x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
|
|
8245
8249
|
}
|
|
8246
8250
|
}
|
|
8247
8251
|
)
|
|
@@ -8251,13 +8255,13 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8251
8255
|
] }) }) : null
|
|
8252
8256
|
] });
|
|
8253
8257
|
}, AISetContext = () => {
|
|
8254
|
-
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [,
|
|
8258
|
+
const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: g } = useToast(), x = useRef(null);
|
|
8255
8259
|
useEffect(() => {
|
|
8256
8260
|
n && a(n);
|
|
8257
8261
|
}, [n]);
|
|
8258
8262
|
const j = async () => {
|
|
8259
8263
|
try {
|
|
8260
|
-
d(!0), p(null), await i(r),
|
|
8264
|
+
d(!0), p(null), await i(r), g({
|
|
8261
8265
|
title: o("Updated AI Context"),
|
|
8262
8266
|
description: o("You can now Ask AI to edit your content"),
|
|
8263
8267
|
variant: "default"
|
|
@@ -8272,7 +8276,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8272
8276
|
Accordion,
|
|
8273
8277
|
{
|
|
8274
8278
|
onValueChange: (E) => {
|
|
8275
|
-
|
|
8279
|
+
m(E !== "");
|
|
8276
8280
|
},
|
|
8277
8281
|
type: "single",
|
|
8278
8282
|
collapsible: !0,
|
|
@@ -8351,7 +8355,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8351
8355
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
8352
8356
|
] });
|
|
8353
8357
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
8354
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p,
|
|
8358
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
|
|
8355
8359
|
useEffect(() => {
|
|
8356
8360
|
l(n);
|
|
8357
8361
|
}, [n]);
|
|
@@ -8361,32 +8365,32 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8361
8365
|
return;
|
|
8362
8366
|
}
|
|
8363
8367
|
if (i) {
|
|
8364
|
-
const
|
|
8365
|
-
r(
|
|
8368
|
+
const A = [...a, { key: i, value: d }];
|
|
8369
|
+
r(A), l(a), c(""), u(""), x("");
|
|
8366
8370
|
}
|
|
8367
|
-
}, k = (
|
|
8368
|
-
const
|
|
8369
|
-
r(
|
|
8370
|
-
}, S = (
|
|
8371
|
-
|
|
8371
|
+
}, k = (A) => {
|
|
8372
|
+
const B = a.filter((N, L) => L !== A);
|
|
8373
|
+
r(B), l(B);
|
|
8374
|
+
}, S = (A) => {
|
|
8375
|
+
m(A), c(a[A].key), u(a[A].value);
|
|
8372
8376
|
}, w = () => {
|
|
8373
8377
|
if (i.startsWith("@")) {
|
|
8374
8378
|
x("Attribute keys cannot start with '@'");
|
|
8375
8379
|
return;
|
|
8376
8380
|
}
|
|
8377
8381
|
if (p !== null && i) {
|
|
8378
|
-
const
|
|
8379
|
-
|
|
8382
|
+
const A = [...a];
|
|
8383
|
+
A[p] = { key: i, value: d }, r(A), l(A), m(null), c(""), u(""), x("");
|
|
8380
8384
|
}
|
|
8381
|
-
}, _ = (
|
|
8382
|
-
|
|
8385
|
+
}, _ = (A) => {
|
|
8386
|
+
A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? w() : b());
|
|
8383
8387
|
};
|
|
8384
8388
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
|
|
8385
8389
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8386
8390
|
"form",
|
|
8387
8391
|
{
|
|
8388
|
-
onSubmit: (
|
|
8389
|
-
|
|
8392
|
+
onSubmit: (A) => {
|
|
8393
|
+
A.preventDefault(), p !== null ? w() : b();
|
|
8390
8394
|
},
|
|
8391
8395
|
className: "space-y-3",
|
|
8392
8396
|
children: [
|
|
@@ -8402,7 +8406,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8402
8406
|
id: "attrKey",
|
|
8403
8407
|
ref: j,
|
|
8404
8408
|
value: i,
|
|
8405
|
-
onChange: (
|
|
8409
|
+
onChange: (A) => c(A.target.value),
|
|
8406
8410
|
placeholder: "Key",
|
|
8407
8411
|
className: "h-8 text-sm"
|
|
8408
8412
|
}
|
|
@@ -8420,7 +8424,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8420
8424
|
rows: 2,
|
|
8421
8425
|
ref: E,
|
|
8422
8426
|
value: d,
|
|
8423
|
-
onChange: (
|
|
8427
|
+
onChange: (A) => u(A.target.value),
|
|
8424
8428
|
onKeyDown: _,
|
|
8425
8429
|
placeholder: "Value",
|
|
8426
8430
|
className: "bg-background text-sm"
|
|
@@ -8429,26 +8433,26 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8429
8433
|
] })
|
|
8430
8434
|
] }),
|
|
8431
8435
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
|
|
8432
|
-
|
|
8436
|
+
g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
|
|
8433
8437
|
]
|
|
8434
8438
|
}
|
|
8435
8439
|
),
|
|
8436
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((
|
|
8440
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((A, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
|
|
8437
8441
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
|
|
8438
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children:
|
|
8439
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children:
|
|
8442
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: A.key }),
|
|
8443
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: A.value.toString() })
|
|
8440
8444
|
] }),
|
|
8441
8445
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
8442
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(
|
|
8446
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(B), children: [
|
|
8443
8447
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
|
|
8444
8448
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
8445
8449
|
] }),
|
|
8446
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(
|
|
8450
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(B), children: [
|
|
8447
8451
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
8448
8452
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
8449
8453
|
] })
|
|
8450
8454
|
] })
|
|
8451
|
-
] },
|
|
8455
|
+
] }, B)) })
|
|
8452
8456
|
] });
|
|
8453
8457
|
}), BlockAttributesEditor = React.memo(() => {
|
|
8454
8458
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8866,7 +8870,7 @@ function RemoveProviderConfirmation({
|
|
|
8866
8870
|
const PageDataProviders = () => {
|
|
8867
8871
|
const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
|
|
8868
8872
|
filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
|
|
8869
|
-
), [d, u] = useState(""), [p,
|
|
8873
|
+
), [d, u] = useState(""), [p, m] = useState(null), g = filter(
|
|
8870
8874
|
n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
|
|
8871
8875
|
(b) => !isNull(b)
|
|
8872
8876
|
), x = (b) => {
|
|
@@ -8874,7 +8878,7 @@ const PageDataProviders = () => {
|
|
|
8874
8878
|
c((S) => [...S, k]), a((S) => [...S, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
|
|
8875
8879
|
}, j = (b) => {
|
|
8876
8880
|
c((k) => filter(k, (S) => S.providerKey !== b.providerKey)), a((k) => filter(k, (S) => S.providerKey !== b.providerKey)), l("UNSAVED");
|
|
8877
|
-
}, E = (b) =>
|
|
8881
|
+
}, E = (b) => m(b);
|
|
8878
8882
|
return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
8879
8883
|
o("You have no data providers registered. Please add a data provider to your project."),
|
|
8880
8884
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8886,7 +8890,7 @@ const PageDataProviders = () => {
|
|
|
8886
8890
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("Select a provider") }) }),
|
|
8887
8891
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
8888
8892
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("Choose") }),
|
|
8889
|
-
|
|
8893
|
+
g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
|
|
8890
8894
|
] })
|
|
8891
8895
|
] }) }),
|
|
8892
8896
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -8963,14 +8967,14 @@ const PageDataProviders = () => {
|
|
|
8963
8967
|
},
|
|
8964
8968
|
b.providerKey
|
|
8965
8969
|
)) }),
|
|
8966
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () =>
|
|
8970
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
|
|
8967
8971
|
] })
|
|
8968
8972
|
] });
|
|
8969
8973
|
};
|
|
8970
8974
|
function AiFillDatabase(o) {
|
|
8971
8975
|
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);
|
|
8972
8976
|
}
|
|
8973
|
-
const TopBar = lazy(() => import("./Topbar-
|
|
8977
|
+
const TopBar = lazy(() => import("./Topbar-W4Ri5E2K.js"));
|
|
8974
8978
|
function useSidebarMenuItems(o) {
|
|
8975
8979
|
const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
|
|
8976
8980
|
return useMemo(() => {
|
|
@@ -9004,8 +9008,8 @@ const RootLayout = () => {
|
|
|
9004
9008
|
x.preventDefault();
|
|
9005
9009
|
}, d = (x) => {
|
|
9006
9010
|
n(o === x ? null : x);
|
|
9007
|
-
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(),
|
|
9008
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir:
|
|
9011
|
+
}, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
|
|
9012
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
9009
9013
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
9010
9014
|
"div",
|
|
9011
9015
|
{
|
|
@@ -9015,7 +9019,7 @@ const RootLayout = () => {
|
|
|
9015
9019
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
|
|
9016
9020
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9017
9021
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9018
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children:
|
|
9022
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
9019
9023
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9020
9024
|
Button,
|
|
9021
9025
|
{
|
|
@@ -9045,10 +9049,10 @@ const RootLayout = () => {
|
|
|
9045
9049
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9046
9050
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
|
|
9047
9051
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
9048
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
9049
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(
|
|
9052
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
9053
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
|
|
9050
9054
|
] }),
|
|
9051
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9055
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
|
|
9052
9056
|
] }) })
|
|
9053
9057
|
}
|
|
9054
9058
|
),
|