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