@chaibuilder/sdk 2.0.0-beta.10 → 2.0.0-beta.12
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-pceepCns.cjs → CodeEditor-6Qv04yjE.cjs} +1 -1
- package/dist/{CodeEditor-9qjIOTD0.js → CodeEditor-CqMwiE7m.js} +2 -2
- package/dist/STRINGS-26RPxXyi.cjs +1 -0
- package/dist/STRINGS-BnWT5XcX.js +5 -0
- package/dist/{Topbar-7bGqLcSJ.js → Topbar-700eX1kn.js} +2 -2
- package/dist/{Topbar-EXPx1Yg2.cjs → Topbar-vstGSwGj.cjs} +1 -1
- package/dist/core.cjs +6 -6
- package/dist/core.d.ts +4 -4
- package/dist/core.js +816 -941
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +5 -4
- package/dist/render.js +85 -104
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -20
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +1066 -701
- package/package.json +5 -7
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
var V = Object.defineProperty;
|
|
2
2
|
var U = (o, n, r) => n in o ? V(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
|
|
3
|
-
var
|
|
3
|
+
var O = (o, n, r) => (U(o, typeof n != "symbol" ? n + "" : n, r), r);
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, useState, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
|
|
7
|
-
import { S as Skeleton, B as Button, L as Label,
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact,
|
|
7
|
+
import { S as Skeleton, B as Button, L as Label, ah as ContextMenu, ai as ContextMenuTrigger, aj as ContextMenuContent, ak as ContextMenuItem, M as Tooltip, N as TooltipTrigger, O as TooltipContent, C as Card, v as CardHeader, y as CardDescription, z as CardContent, T as Textarea, w as CardFooter, D as Dialog, q as DialogTrigger, a as DialogContent, b as Switch, ae as useToast, R as Popover, U as PopoverTrigger, V as PopoverContent, I as Input$1, Q as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, Z as DropdownMenu, _ as DropdownMenuTrigger, $ as DropdownMenuContent, E as ScrollArea, a3 as DropdownMenuLabel, a4 as DropdownMenuSeparator, a6 as DropdownMenuGroup, a0 as DropdownMenuItem, a5 as DropdownMenuShortcut, A as Accordion, G as Tabs, H as TabsList, J as TabsTrigger, h as AlertDialog, j as AlertDialogContent, k as AlertDialogHeader, m as AlertDialogTitle, i as AlertDialogTrigger, n as AlertDialogDescription, l as AlertDialogFooter, p as AlertDialogCancel, o as AlertDialogAction, a1 as DropdownMenuCheckboxItem, W as HoverCard, X as HoverCardTrigger, Y as HoverCardContent, ac as Separator, K as TabsContent, P as TooltipProvider, ag as Toaster } from "./context-menu-oLipAPzI.js";
|
|
8
|
+
import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact, isObject, each, set, first, noop, isEmpty as isEmpty$1, keys, range, values, flattenDeep, startsWith, isNull, pick, sortBy, memoize, forEach, unset, chunk, cloneDeep, throttle, uniq, reverse, debounce, capitalize, flatMapDeep, split, startCase as startCase$1, reject, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, toUpper, round } from "lodash-es";
|
|
9
9
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
10
10
|
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
|
|
11
|
-
import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
12
|
-
import { registerChaiBlock as Xe } from "@chaibuilder/runtime";
|
|
13
11
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
14
|
-
import { useTranslation as
|
|
12
|
+
import { useTranslation as Xe } from "react-i18next";
|
|
15
13
|
import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-ooqqxWRQ.js";
|
|
16
14
|
import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
|
|
17
|
-
import { isEmpty
|
|
15
|
+
import { isEmpty, startCase } from "lodash";
|
|
18
16
|
import TreeModel from "tree-model";
|
|
17
|
+
import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
18
|
+
import { registerChaiBlock as Ze } from "@chaibuilder/runtime";
|
|
19
19
|
import ReactQuill, { Quill } from "react-quill";
|
|
20
|
-
import { a as SLOT_KEY, I as I18N_KEY, S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-Xxstm-7I.js";
|
|
21
20
|
import { useFeature, FlagsProvider } from "flagged";
|
|
22
21
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
23
22
|
import { flip } from "@floating-ui/dom";
|
|
@@ -27,12 +26,13 @@ import typography from "@tailwindcss/typography";
|
|
|
27
26
|
import forms from "@tailwindcss/forms";
|
|
28
27
|
import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
29
28
|
import { twMerge } from "tailwind-merge";
|
|
29
|
+
import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-BnWT5XcX.js";
|
|
30
30
|
import { Provider } from "react-wrap-balancer";
|
|
31
31
|
import ReactDOM from "react-dom";
|
|
32
32
|
import PropTypes from "prop-types";
|
|
33
33
|
import { ErrorBoundary } from "react-error-boundary";
|
|
34
34
|
import { Resizable } from "re-resizable";
|
|
35
|
-
import { DatabaseIcon, GlobeIcon, ChevronRight,
|
|
35
|
+
import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, X, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
36
36
|
import { Tree } from "react-arborist";
|
|
37
37
|
import { parse, stringify } from "himalaya";
|
|
38
38
|
import RjForm from "@rjsf/core";
|
|
@@ -42,7 +42,7 @@ import Autosuggest from "react-autosuggest";
|
|
|
42
42
|
import Fuse from "fuse.js";
|
|
43
43
|
import clsx from "clsx";
|
|
44
44
|
import i18n from "i18next";
|
|
45
|
-
import { default as
|
|
45
|
+
import { default as Je } from "i18next";
|
|
46
46
|
import { motion } from "framer-motion";
|
|
47
47
|
import "@radix-ui/react-switch";
|
|
48
48
|
import "@radix-ui/react-accordion";
|
|
@@ -63,19 +63,19 @@ import "@radix-ui/react-context-menu";
|
|
|
63
63
|
const canAcceptChildBlock = (o, n) => {
|
|
64
64
|
if (!o)
|
|
65
65
|
return !0;
|
|
66
|
-
const r =
|
|
66
|
+
const r = getRegisteredChaiBlock(o);
|
|
67
67
|
return r && has(r, "canAcceptBlock") ? r.canAcceptBlock(n) : !1;
|
|
68
68
|
}, canAddChildBlock = (o) => {
|
|
69
|
-
const n =
|
|
69
|
+
const n = getRegisteredChaiBlock(o);
|
|
70
70
|
return n ? has(n, "canAcceptBlock") : !1;
|
|
71
71
|
}, canBeNestedInside = (o, n) => {
|
|
72
|
-
const r =
|
|
72
|
+
const r = getRegisteredChaiBlock(n);
|
|
73
73
|
return r && has(r, "canBeNested") ? r.canBeNested(o) : !0;
|
|
74
74
|
}, canDuplicateBlock = (o) => {
|
|
75
|
-
const n =
|
|
75
|
+
const n = getRegisteredChaiBlock(o);
|
|
76
76
|
return n && has(n, "canDuplicate") ? n.canDuplicate() : !0;
|
|
77
77
|
}, canDeleteBlock = (o) => {
|
|
78
|
-
const n =
|
|
78
|
+
const n = getRegisteredChaiBlock(o);
|
|
79
79
|
return n && has(n, "canDelete") ? n.canDelete() : !0;
|
|
80
80
|
};
|
|
81
81
|
var define_import_meta_env_default$2 = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", VITE_JOTAI_DEVTOOL_ENABLED: "true", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
|
|
@@ -109,235 +109,235 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
109
109
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
|
|
110
110
|
const c = (x) => o.get(x), d = (x, j) => {
|
|
111
111
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(j);
|
|
112
|
-
const
|
|
113
|
-
if (o.set(x, j), r.has(x) || r.set(x,
|
|
114
|
-
const
|
|
115
|
-
cancelPromise(
|
|
112
|
+
const k = o.get(x);
|
|
113
|
+
if (o.set(x, j), r.has(x) || r.set(x, k), k && hasPromiseAtomValue(k)) {
|
|
114
|
+
const S = "v" in j ? j.v instanceof Promise ? j.v : Promise.resolve(j.v) : Promise.reject(j.e);
|
|
115
|
+
cancelPromise(k.v, S);
|
|
116
116
|
}
|
|
117
|
-
}, u = (x, j,
|
|
118
|
-
const
|
|
117
|
+
}, u = (x, j, k) => {
|
|
118
|
+
const S = /* @__PURE__ */ new Map();
|
|
119
119
|
let _ = !1;
|
|
120
|
-
|
|
121
|
-
!B && L === x && (B = j), B ? (
|
|
122
|
-
}), (_ || j.d.size !==
|
|
123
|
-
}, p = (x, j,
|
|
124
|
-
const
|
|
125
|
-
d: (
|
|
120
|
+
k.forEach((B, L) => {
|
|
121
|
+
!B && L === x && (B = j), B ? (S.set(L, B), j.d.get(L) !== B && (_ = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
|
|
122
|
+
}), (_ || j.d.size !== S.size) && (j.d = S);
|
|
123
|
+
}, p = (x, j, k) => {
|
|
124
|
+
const S = c(x), _ = {
|
|
125
|
+
d: (S == null ? void 0 : S.d) || /* @__PURE__ */ new Map(),
|
|
126
126
|
v: j
|
|
127
127
|
};
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
130
|
-
if (
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
_.v =
|
|
128
|
+
if (k && u(x, _, k), S && isEqualAtomValue(S, _) && S.d === _.d)
|
|
129
|
+
return S;
|
|
130
|
+
if (S && hasPromiseAtomValue(S) && hasPromiseAtomValue(_) && isEqualPromiseAtomValue(S, _)) {
|
|
131
|
+
if (S.d === _.d)
|
|
132
|
+
return S;
|
|
133
|
+
_.v = S.v;
|
|
134
134
|
}
|
|
135
135
|
return d(x, _), _;
|
|
136
|
-
}, m = (x, j,
|
|
136
|
+
}, m = (x, j, k, S) => {
|
|
137
137
|
if (isPromiseLike$2(j)) {
|
|
138
138
|
let _;
|
|
139
|
-
const B = new Promise((L,
|
|
139
|
+
const B = new Promise((L, M) => {
|
|
140
140
|
let D = !1;
|
|
141
141
|
j.then(
|
|
142
|
-
(
|
|
142
|
+
($) => {
|
|
143
143
|
if (!D) {
|
|
144
144
|
D = !0;
|
|
145
|
-
const P = c(x),
|
|
145
|
+
const P = c(x), F = p(
|
|
146
146
|
x,
|
|
147
147
|
B,
|
|
148
|
-
|
|
148
|
+
k
|
|
149
149
|
);
|
|
150
|
-
resolvePromise(B,
|
|
150
|
+
resolvePromise(B, $), L($), (P == null ? void 0 : P.d) !== F.d && I(x, F, P == null ? void 0 : P.d);
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
|
-
(
|
|
153
|
+
($) => {
|
|
154
154
|
if (!D) {
|
|
155
155
|
D = !0;
|
|
156
|
-
const P = c(x),
|
|
156
|
+
const P = c(x), F = p(
|
|
157
157
|
x,
|
|
158
158
|
B,
|
|
159
|
-
|
|
159
|
+
k
|
|
160
160
|
);
|
|
161
|
-
rejectPromise(B,
|
|
161
|
+
rejectPromise(B, $), M($), (P == null ? void 0 : P.d) !== F.d && I(x, F, P == null ? void 0 : P.d);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
), _ = (
|
|
165
|
-
D || (D = !0,
|
|
164
|
+
), _ = ($) => {
|
|
165
|
+
D || (D = !0, $.then(
|
|
166
166
|
(P) => resolvePromise(B, P),
|
|
167
167
|
(P) => rejectPromise(B, P)
|
|
168
|
-
), L(
|
|
168
|
+
), L($));
|
|
169
169
|
};
|
|
170
170
|
});
|
|
171
171
|
return B.orig = j, B.status = "pending", registerCancelPromise(B, (L) => {
|
|
172
|
-
L && _(L),
|
|
173
|
-
}), p(x, B,
|
|
172
|
+
L && _(L), S == null || S();
|
|
173
|
+
}), p(x, B, k);
|
|
174
174
|
}
|
|
175
|
-
return p(x, j,
|
|
176
|
-
}, h = (x, j,
|
|
177
|
-
const
|
|
178
|
-
d: (
|
|
175
|
+
return p(x, j, k);
|
|
176
|
+
}, h = (x, j, k) => {
|
|
177
|
+
const S = c(x), _ = {
|
|
178
|
+
d: (S == null ? void 0 : S.d) || /* @__PURE__ */ new Map(),
|
|
179
179
|
e: j
|
|
180
180
|
};
|
|
181
|
-
return
|
|
181
|
+
return k && u(x, _, k), S && isEqualAtomError(S, _) && S.d === _.d ? S : (d(x, _), _);
|
|
182
182
|
}, g = (x) => {
|
|
183
183
|
const j = c(x);
|
|
184
|
-
if (j && (j.d.forEach((D,
|
|
185
|
-
|
|
186
|
-
}), Array.from(j.d).every(([D,
|
|
184
|
+
if (j && (j.d.forEach((D, $) => {
|
|
185
|
+
$ !== x && !n.has($) && g($);
|
|
186
|
+
}), Array.from(j.d).every(([D, $]) => {
|
|
187
187
|
const P = c(D);
|
|
188
|
-
return D === x || P ===
|
|
189
|
-
P && !hasPromiseAtomValue(P) && isEqualAtomValue(P,
|
|
188
|
+
return D === x || P === $ || // TODO This is a hack, we should find a better solution.
|
|
189
|
+
P && !hasPromiseAtomValue(P) && isEqualAtomValue(P, $);
|
|
190
190
|
})))
|
|
191
191
|
return j;
|
|
192
|
-
const
|
|
193
|
-
let
|
|
192
|
+
const k = /* @__PURE__ */ new Map();
|
|
193
|
+
let S = !0;
|
|
194
194
|
const _ = (D) => {
|
|
195
195
|
if (D === x) {
|
|
196
196
|
const P = c(D);
|
|
197
197
|
if (P)
|
|
198
|
-
return
|
|
198
|
+
return k.set(D, P), returnAtomValue(P);
|
|
199
199
|
if (hasInitialValue(D))
|
|
200
|
-
return
|
|
200
|
+
return k.set(D, void 0), D.init;
|
|
201
201
|
throw new Error("no atom init");
|
|
202
202
|
}
|
|
203
|
-
const
|
|
204
|
-
return
|
|
203
|
+
const $ = g(D);
|
|
204
|
+
return k.set(D, $), returnAtomValue($);
|
|
205
205
|
};
|
|
206
206
|
let B, L;
|
|
207
|
-
const
|
|
207
|
+
const M = {
|
|
208
208
|
get signal() {
|
|
209
209
|
return B || (B = new AbortController()), B.signal;
|
|
210
210
|
},
|
|
211
211
|
get setSelf() {
|
|
212
212
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(x) && console.warn("setSelf function cannot be used with read-only atom"), !L && isActuallyWritableAtom(x) && (L = (...D) => {
|
|
213
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" &&
|
|
214
|
-
return
|
|
213
|
+
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && S && console.warn("setSelf function cannot be called in sync"), !S)
|
|
214
|
+
return w(x, ...D);
|
|
215
215
|
}), L;
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
try {
|
|
219
|
-
const D = x.read(_,
|
|
219
|
+
const D = x.read(_, M);
|
|
220
220
|
return m(
|
|
221
221
|
x,
|
|
222
222
|
D,
|
|
223
|
-
|
|
223
|
+
k,
|
|
224
224
|
() => B == null ? void 0 : B.abort()
|
|
225
225
|
);
|
|
226
226
|
} catch (D) {
|
|
227
|
-
return h(x, D,
|
|
227
|
+
return h(x, D, k);
|
|
228
228
|
} finally {
|
|
229
|
-
|
|
229
|
+
S = !1;
|
|
230
230
|
}
|
|
231
|
-
},
|
|
231
|
+
}, E = (x) => returnAtomValue(g(x)), y = (x) => {
|
|
232
232
|
let j = n.get(x);
|
|
233
|
-
return j || (j =
|
|
234
|
-
},
|
|
233
|
+
return j || (j = R(x)), j;
|
|
234
|
+
}, f = (x, j) => !j.l.size && (!j.t.size || j.t.size === 1 && j.t.has(x)), b = (x) => {
|
|
235
235
|
const j = n.get(x);
|
|
236
|
-
j &&
|
|
237
|
-
},
|
|
238
|
-
const j = /* @__PURE__ */ new Map(),
|
|
236
|
+
j && f(x, j) && A(x);
|
|
237
|
+
}, v = (x) => {
|
|
238
|
+
const j = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new WeakMap(), S = (B) => {
|
|
239
239
|
const L = n.get(B);
|
|
240
|
-
L == null || L.t.forEach((
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
(j.get(
|
|
244
|
-
),
|
|
240
|
+
L == null || L.t.forEach((M) => {
|
|
241
|
+
M !== B && (j.set(
|
|
242
|
+
M,
|
|
243
|
+
(j.get(M) || /* @__PURE__ */ new Set()).add(B)
|
|
244
|
+
), k.set(M, (k.get(M) || 0) + 1), S(M));
|
|
245
245
|
});
|
|
246
246
|
};
|
|
247
|
-
|
|
247
|
+
S(x);
|
|
248
248
|
const _ = (B) => {
|
|
249
249
|
const L = n.get(B);
|
|
250
|
-
L == null || L.t.forEach((
|
|
250
|
+
L == null || L.t.forEach((M) => {
|
|
251
251
|
var D;
|
|
252
|
-
if (
|
|
253
|
-
let
|
|
254
|
-
if (
|
|
255
|
-
let P = !!((D = j.get(
|
|
252
|
+
if (M !== B) {
|
|
253
|
+
let $ = k.get(M);
|
|
254
|
+
if ($ && k.set(M, --$), !$) {
|
|
255
|
+
let P = !!((D = j.get(M)) != null && D.size);
|
|
256
256
|
if (P) {
|
|
257
|
-
const
|
|
258
|
-
P = !
|
|
257
|
+
const F = c(M), H = g(M);
|
|
258
|
+
P = !F || !isEqualAtomValue(F, H);
|
|
259
259
|
}
|
|
260
|
-
P || j.forEach((
|
|
260
|
+
P || j.forEach((F) => F.delete(M));
|
|
261
261
|
}
|
|
262
|
-
_(
|
|
262
|
+
_(M);
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
};
|
|
266
266
|
_(x);
|
|
267
|
-
},
|
|
268
|
-
let
|
|
269
|
-
const
|
|
267
|
+
}, C = (x, ...j) => {
|
|
268
|
+
let k = !0;
|
|
269
|
+
const S = (L) => returnAtomValue(g(L)), _ = (L, ...M) => {
|
|
270
270
|
let D;
|
|
271
271
|
if (L === x) {
|
|
272
272
|
if (!hasInitialValue(L))
|
|
273
273
|
throw new Error("atom not writable");
|
|
274
|
-
const
|
|
275
|
-
(
|
|
274
|
+
const $ = c(L), P = m(L, M[0]);
|
|
275
|
+
(!$ || !isEqualAtomValue($, P)) && v(L);
|
|
276
276
|
} else
|
|
277
|
-
D =
|
|
278
|
-
if (!
|
|
279
|
-
const
|
|
277
|
+
D = C(L, ...M);
|
|
278
|
+
if (!k) {
|
|
279
|
+
const $ = T();
|
|
280
280
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
281
|
-
(P) => P({ type: "async-write", flushed:
|
|
281
|
+
(P) => P({ type: "async-write", flushed: $ })
|
|
282
282
|
);
|
|
283
283
|
}
|
|
284
284
|
return D;
|
|
285
|
-
}, B = x.write(
|
|
286
|
-
return
|
|
287
|
-
},
|
|
288
|
-
const
|
|
285
|
+
}, B = x.write(S, _, ...j);
|
|
286
|
+
return k = !1, B;
|
|
287
|
+
}, w = (x, ...j) => {
|
|
288
|
+
const k = C(x, ...j), S = T();
|
|
289
289
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
290
|
-
(_) => _({ type: "write", flushed:
|
|
291
|
-
),
|
|
292
|
-
},
|
|
293
|
-
const
|
|
290
|
+
(_) => _({ type: "write", flushed: S })
|
|
291
|
+
), k;
|
|
292
|
+
}, R = (x, j) => {
|
|
293
|
+
const k = {
|
|
294
294
|
t: new Set(j && [j]),
|
|
295
295
|
l: /* @__PURE__ */ new Set()
|
|
296
296
|
};
|
|
297
|
-
if (n.set(x,
|
|
297
|
+
if (n.set(x, k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(x), g(x).d.forEach((S, _) => {
|
|
298
298
|
const B = n.get(_);
|
|
299
|
-
B ? B.t.add(x) : _ !== x &&
|
|
299
|
+
B ? B.t.add(x) : _ !== x && R(_, x);
|
|
300
300
|
}), g(x), isActuallyWritableAtom(x) && x.onMount) {
|
|
301
|
-
const
|
|
302
|
-
|
|
301
|
+
const S = x.onMount((..._) => w(x, ..._));
|
|
302
|
+
S && (k.u = S);
|
|
303
303
|
}
|
|
304
|
-
return
|
|
304
|
+
return k;
|
|
305
305
|
}, A = (x) => {
|
|
306
306
|
var j;
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
307
|
+
const k = (j = n.get(x)) == null ? void 0 : j.u;
|
|
308
|
+
k && k(), n.delete(x), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(x);
|
|
309
|
+
const S = c(x);
|
|
310
|
+
S ? (hasPromiseAtomValue(S) && cancelPromise(S.v), S.d.forEach((_, B) => {
|
|
311
311
|
if (B !== x) {
|
|
312
312
|
const L = n.get(B);
|
|
313
|
-
L && (L.t.delete(x),
|
|
313
|
+
L && (L.t.delete(x), f(B, L) && A(B));
|
|
314
314
|
}
|
|
315
315
|
})) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", x);
|
|
316
|
-
}, I = (x, j,
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
if (
|
|
320
|
-
|
|
316
|
+
}, I = (x, j, k) => {
|
|
317
|
+
const S = new Set(j.d.keys());
|
|
318
|
+
k == null || k.forEach((_, B) => {
|
|
319
|
+
if (S.has(B)) {
|
|
320
|
+
S.delete(B);
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
323
|
const L = n.get(B);
|
|
324
|
-
L && (L.t.delete(x),
|
|
325
|
-
}),
|
|
324
|
+
L && (L.t.delete(x), f(B, L) && A(B));
|
|
325
|
+
}), S.forEach((_) => {
|
|
326
326
|
const B = n.get(_);
|
|
327
|
-
B ? B.t.add(x) : n.has(x) &&
|
|
327
|
+
B ? B.t.add(x) : n.has(x) && R(_, x);
|
|
328
328
|
});
|
|
329
329
|
}, T = () => {
|
|
330
330
|
let x;
|
|
331
331
|
for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (x = /* @__PURE__ */ new Set()); r.size; ) {
|
|
332
332
|
const j = Array.from(r);
|
|
333
|
-
r.clear(), j.forEach(([
|
|
334
|
-
const _ = c(
|
|
333
|
+
r.clear(), j.forEach(([k, S]) => {
|
|
334
|
+
const _ = c(k);
|
|
335
335
|
if (_) {
|
|
336
|
-
_.d !== (
|
|
337
|
-
const B = n.get(
|
|
336
|
+
_.d !== (S == null ? void 0 : S.d) && I(k, _, S == null ? void 0 : S.d);
|
|
337
|
+
const B = n.get(k);
|
|
338
338
|
B && !// TODO This seems pretty hacky. Hope to fix it.
|
|
339
339
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
340
|
-
(
|
|
340
|
+
(S && !hasPromiseAtomValue(S) && (isEqualAtomValue(S, _) || isEqualAtomError(S, _))) && (B.l.forEach((L) => L()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && x.add(k));
|
|
341
341
|
} else
|
|
342
342
|
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
343
343
|
});
|
|
@@ -345,16 +345,16 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
345
345
|
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
346
346
|
return a.forEach((j) => j("state")), x;
|
|
347
347
|
}, N = (x, j) => {
|
|
348
|
-
const
|
|
348
|
+
const k = y(x), S = T(), _ = k.l;
|
|
349
349
|
return _.add(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((B) => B("sub")), l.forEach(
|
|
350
|
-
(B) => B({ type: "sub", flushed:
|
|
350
|
+
(B) => B({ type: "sub", flushed: S })
|
|
351
351
|
)), () => {
|
|
352
|
-
_.delete(j),
|
|
352
|
+
_.delete(j), b(x), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((B) => B("unsub")), l.forEach((B) => B({ type: "unsub" })));
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
355
|
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
|
|
356
|
-
get:
|
|
357
|
-
set:
|
|
356
|
+
get: E,
|
|
357
|
+
set: w,
|
|
358
358
|
sub: N,
|
|
359
359
|
// store dev methods (these are tentative and subject to change without notice)
|
|
360
360
|
dev_subscribe_store: (x, j) => j !== 2 ? (console.warn(
|
|
@@ -368,16 +368,16 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
368
368
|
dev_get_atom_state: (x) => o.get(x),
|
|
369
369
|
dev_get_mounted: (x) => n.get(x),
|
|
370
370
|
dev_restore_atoms: (x) => {
|
|
371
|
-
for (const [
|
|
372
|
-
hasInitialValue(
|
|
371
|
+
for (const [k, S] of x)
|
|
372
|
+
hasInitialValue(k) && (m(k, S), v(k));
|
|
373
373
|
const j = T();
|
|
374
374
|
l.forEach(
|
|
375
|
-
(
|
|
375
|
+
(k) => k({ type: "restore", flushed: j })
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
378
|
} : {
|
|
379
|
-
get:
|
|
380
|
-
set:
|
|
379
|
+
get: E,
|
|
380
|
+
set: w,
|
|
381
381
|
sub: N
|
|
382
382
|
};
|
|
383
383
|
};
|
|
@@ -396,36 +396,36 @@ function splitAtom(o, n) {
|
|
|
396
396
|
if (u)
|
|
397
397
|
return u;
|
|
398
398
|
const p = d && r.get(d), m = [], h = [];
|
|
399
|
-
return c.forEach((g,
|
|
400
|
-
const
|
|
401
|
-
h[
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
m[
|
|
399
|
+
return c.forEach((g, E) => {
|
|
400
|
+
const y = n ? n(g) : E;
|
|
401
|
+
h[E] = y;
|
|
402
|
+
const f = p && p.atomList[p.keyList.indexOf(y)];
|
|
403
|
+
if (f) {
|
|
404
|
+
m[E] = f;
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
if (I < 0 || I >=
|
|
410
|
-
const T = c[a(c).keyList.indexOf(
|
|
407
|
+
const b = (C) => {
|
|
408
|
+
const w = C(l), R = C(o), I = a(R, w == null ? void 0 : w.arr).keyList.indexOf(y);
|
|
409
|
+
if (I < 0 || I >= R.length) {
|
|
410
|
+
const T = c[a(c).keyList.indexOf(y)];
|
|
411
411
|
if (T)
|
|
412
412
|
return T;
|
|
413
413
|
throw new Error("splitAtom: index out of bounds for read");
|
|
414
414
|
}
|
|
415
|
-
return
|
|
416
|
-
},
|
|
417
|
-
const A =
|
|
415
|
+
return R[I];
|
|
416
|
+
}, v = (C, w, R) => {
|
|
417
|
+
const A = C(l), I = C(o), N = a(I, A == null ? void 0 : A.arr).keyList.indexOf(y);
|
|
418
418
|
if (N < 0 || N >= I.length)
|
|
419
419
|
throw new Error("splitAtom: index out of bounds for write");
|
|
420
|
-
const x = isFunction(
|
|
421
|
-
|
|
420
|
+
const x = isFunction(R) ? R(I[N]) : R;
|
|
421
|
+
w(o, [
|
|
422
422
|
...I.slice(0, N),
|
|
423
423
|
x,
|
|
424
424
|
...I.slice(N + 1)
|
|
425
425
|
]);
|
|
426
426
|
};
|
|
427
|
-
m[
|
|
428
|
-
}), p && p.keyList.length === h.length && p.keyList.every((g,
|
|
427
|
+
m[E] = isWritable(o) ? atom(b, v) : atom(b);
|
|
428
|
+
}), p && p.keyList.length === h.length && p.keyList.every((g, E) => g === h[E]) ? u = p : u = { arr: c, atomList: m, keyList: h }, r.set(c, u), u;
|
|
429
429
|
}, l = atom((c) => {
|
|
430
430
|
const d = c(l), u = c(o);
|
|
431
431
|
return a(u, d == null ? void 0 : d.arr);
|
|
@@ -734,111 +734,6 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
734
734
|
[n]
|
|
735
735
|
);
|
|
736
736
|
return [o, n, r];
|
|
737
|
-
}, titleWithLang = (o, n, r) => endsWith(o, `(${n})`) || isEmpty(n) || !r ? o : `${o} (${n})`, getBlockJSONFromUISchemas = (o) => {
|
|
738
|
-
switch (o.type) {
|
|
739
|
-
case "singular":
|
|
740
|
-
return o.uiSchema;
|
|
741
|
-
case "model":
|
|
742
|
-
const { properties: n } = o, r = {};
|
|
743
|
-
return Object.keys(n).forEach((i) => {
|
|
744
|
-
const c = n[i];
|
|
745
|
-
if (includes(["slot", "styles"], c.type))
|
|
746
|
-
return;
|
|
747
|
-
const d = i;
|
|
748
|
-
r[d] = getBlockJSONFromUISchemas(c);
|
|
749
|
-
}), r;
|
|
750
|
-
case "list":
|
|
751
|
-
const { itemProperties: a } = o, l = {
|
|
752
|
-
items: {}
|
|
753
|
-
};
|
|
754
|
-
return Object.keys(a).forEach((i) => {
|
|
755
|
-
const c = a[i];
|
|
756
|
-
if (includes(["slot", "styles"], c.type))
|
|
757
|
-
return;
|
|
758
|
-
const d = i;
|
|
759
|
-
l.items[d] = getBlockJSONFromUISchemas(c);
|
|
760
|
-
}), l;
|
|
761
|
-
default:
|
|
762
|
-
return {};
|
|
763
|
-
}
|
|
764
|
-
}, getBlockJSONFromSchemas = (o, n, r) => {
|
|
765
|
-
switch (o.type) {
|
|
766
|
-
case "singular": {
|
|
767
|
-
const p = o.schema;
|
|
768
|
-
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;
|
|
769
|
-
}
|
|
770
|
-
case "model":
|
|
771
|
-
const { properties: a, title: l } = o, i = {
|
|
772
|
-
title: titleWithLang(n(l), r, get(o, "i18n")),
|
|
773
|
-
type: "object",
|
|
774
|
-
properties: {}
|
|
775
|
-
};
|
|
776
|
-
return Object.keys(a).forEach((p) => {
|
|
777
|
-
const m = a[p];
|
|
778
|
-
if (includes(["slot", "styles"], m.type))
|
|
779
|
-
return;
|
|
780
|
-
const h = p;
|
|
781
|
-
i.properties[h] = getBlockJSONFromSchemas(m, n, r);
|
|
782
|
-
}), i;
|
|
783
|
-
case "list":
|
|
784
|
-
const { itemProperties: c, title: d } = o, u = {
|
|
785
|
-
title: titleWithLang(n(d), r, get(o, "i18n")),
|
|
786
|
-
type: "array",
|
|
787
|
-
items: {
|
|
788
|
-
type: "object",
|
|
789
|
-
properties: {}
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
return Object.keys(c).forEach((p) => {
|
|
793
|
-
const m = c[p];
|
|
794
|
-
if (includes(["slot", "styles"], m.type))
|
|
795
|
-
return;
|
|
796
|
-
const h = p;
|
|
797
|
-
u.items.properties[h] = getBlockJSONFromSchemas(m, n, r), set(
|
|
798
|
-
u.items,
|
|
799
|
-
"title",
|
|
800
|
-
titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
|
|
801
|
-
);
|
|
802
|
-
}), u;
|
|
803
|
-
default:
|
|
804
|
-
return {};
|
|
805
|
-
}
|
|
806
|
-
}, getBlockDefaultProps = (o) => {
|
|
807
|
-
if (!o)
|
|
808
|
-
return {};
|
|
809
|
-
const n = {};
|
|
810
|
-
return Object.keys(o).forEach((r) => {
|
|
811
|
-
n[r] = getBlockDefaultProp(o[r]);
|
|
812
|
-
}), n;
|
|
813
|
-
}, getListDefaults = (o) => {
|
|
814
|
-
if (isEmpty(o.default))
|
|
815
|
-
return [];
|
|
816
|
-
const { itemProperties: n } = o;
|
|
817
|
-
return map(o.default, (r) => {
|
|
818
|
-
const a = { ...r };
|
|
819
|
-
return forIn(r, (l, i) => {
|
|
820
|
-
has(n, i) && get(n[i], "i18n", !1) && (a[i] = I18N_KEY);
|
|
821
|
-
}), a;
|
|
822
|
-
});
|
|
823
|
-
}, getBlockDefaultProp = (o) => {
|
|
824
|
-
switch (o.type) {
|
|
825
|
-
case "styles":
|
|
826
|
-
return o.default;
|
|
827
|
-
case "slot":
|
|
828
|
-
return `${SLOT_KEY}${generateUUID()}`;
|
|
829
|
-
case "singular":
|
|
830
|
-
const { schema: n } = o;
|
|
831
|
-
return get(n, "default", "");
|
|
832
|
-
case "model":
|
|
833
|
-
return getBlockDefaultProps(o.properties);
|
|
834
|
-
case "list":
|
|
835
|
-
return getListDefaults(o);
|
|
836
|
-
default:
|
|
837
|
-
return "";
|
|
838
|
-
}
|
|
839
|
-
}, convertDotNotationToObject = (o, n) => {
|
|
840
|
-
const r = {};
|
|
841
|
-
return set(r, o, n), r;
|
|
842
737
|
};
|
|
843
738
|
var undomanager = { exports: {} };
|
|
844
739
|
(function(o) {
|
|
@@ -1167,7 +1062,7 @@ const useBuilderProp = (o, n = void 0) => {
|
|
|
1167
1062
|
}, chaiThemeValuesAtom = atom$1({}), useTheme = () => {
|
|
1168
1063
|
const o = useThemeOptions(), n = useMemo(() => getDefaultThemeValues(o), [o]), r = useBuilderProp("theme", {}), [a, l] = useAtom$1(chaiThemeValuesAtom);
|
|
1169
1064
|
return [
|
|
1170
|
-
{ ...n, ...!isEmpty
|
|
1065
|
+
{ ...n, ...!isEmpty(r) && r, ...!isEmpty(a) && a },
|
|
1171
1066
|
l
|
|
1172
1067
|
];
|
|
1173
1068
|
}, useThemeOptions = () => {
|
|
@@ -1212,7 +1107,7 @@ const useUndoManager = () => {
|
|
|
1212
1107
|
};
|
|
1213
1108
|
}, removeNestedBlocks = (o, n) => {
|
|
1214
1109
|
const r = [], a = filter(o, (l) => includes(n, l._id) || includes(n, l._parent) ? (r.push(l._id), !1) : !0);
|
|
1215
|
-
return isEmpty(r) ? a : removeNestedBlocks(a, r);
|
|
1110
|
+
return isEmpty$1(r) ? a : removeNestedBlocks(a, r);
|
|
1216
1111
|
}, useRemoveBlocks = () => {
|
|
1217
1112
|
const [o] = useBlocksStore(), [n, r] = useSelectedBlockIds(), { setNewBlocks: a } = useBlocksStoreUndoableActions();
|
|
1218
1113
|
return useCallback(
|
|
@@ -1312,65 +1207,65 @@ const useBlocksStoreManager = () => {
|
|
|
1312
1207
|
updateBlocksProps: c
|
|
1313
1208
|
} = useBlocksStoreManager();
|
|
1314
1209
|
return {
|
|
1315
|
-
moveBlocks: (
|
|
1316
|
-
const
|
|
1317
|
-
const A = n.find((N) => N._id ===
|
|
1318
|
-
return { _id:
|
|
1319
|
-
}),
|
|
1320
|
-
|
|
1321
|
-
undo: () => each(
|
|
1322
|
-
i([
|
|
1210
|
+
moveBlocks: (y, f, b) => {
|
|
1211
|
+
const v = map(y, (w) => {
|
|
1212
|
+
const A = n.find((N) => N._id === w)._parent || null, T = n.filter((N) => A ? N._parent === A : !N._parent).map((N) => N._id).indexOf(w);
|
|
1213
|
+
return { _id: w, oldParent: A, oldPosition: T };
|
|
1214
|
+
}), C = v.find(({ _id: w }) => w === y[0]);
|
|
1215
|
+
C && C.oldParent === f && C.oldPosition === b || (i(y, f, b), o({
|
|
1216
|
+
undo: () => each(v, ({ _id: w, oldParent: R, oldPosition: A }) => {
|
|
1217
|
+
i([w], R, A);
|
|
1323
1218
|
}),
|
|
1324
|
-
redo: () => i(
|
|
1219
|
+
redo: () => i(y, f, b)
|
|
1325
1220
|
}));
|
|
1326
1221
|
},
|
|
1327
|
-
addBlocks: (
|
|
1328
|
-
a(
|
|
1329
|
-
undo: () => l(map(
|
|
1330
|
-
redo: () => a(
|
|
1222
|
+
addBlocks: (y, f, b) => {
|
|
1223
|
+
a(y, f, b), o({
|
|
1224
|
+
undo: () => l(map(y, "_id")),
|
|
1225
|
+
redo: () => a(y, f, b)
|
|
1331
1226
|
});
|
|
1332
1227
|
},
|
|
1333
|
-
removeBlocks: (
|
|
1334
|
-
var
|
|
1335
|
-
const
|
|
1336
|
-
l(map(
|
|
1337
|
-
undo: () => a(
|
|
1338
|
-
redo: () => l(map(
|
|
1228
|
+
removeBlocks: (y) => {
|
|
1229
|
+
var C;
|
|
1230
|
+
const f = (C = first(y)) == null ? void 0 : C._parent, v = n.filter((w) => f ? w._parent === f : !w._parent).indexOf(first(y));
|
|
1231
|
+
l(map(y, "_id")), o({
|
|
1232
|
+
undo: () => a(y, f, v),
|
|
1233
|
+
redo: () => l(map(y, "_id"))
|
|
1339
1234
|
});
|
|
1340
1235
|
},
|
|
1341
|
-
updateBlocks: (
|
|
1342
|
-
let
|
|
1343
|
-
if (
|
|
1344
|
-
|
|
1236
|
+
updateBlocks: (y, f, b) => {
|
|
1237
|
+
let v = [];
|
|
1238
|
+
if (b)
|
|
1239
|
+
v = map(y, (C) => ({ _id: C, ...b }));
|
|
1345
1240
|
else {
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
return each(
|
|
1241
|
+
const C = keys(f);
|
|
1242
|
+
v = map(y, (w) => {
|
|
1243
|
+
const R = n.find((I) => I._id === w), A = { _id: w };
|
|
1244
|
+
return each(C, (I) => A[I] = R[I]), A;
|
|
1350
1245
|
});
|
|
1351
1246
|
}
|
|
1352
|
-
c(map(
|
|
1353
|
-
undo: () => c(
|
|
1354
|
-
redo: () => c(map(
|
|
1247
|
+
c(map(y, (C) => ({ _id: C, ...f }))), o({
|
|
1248
|
+
undo: () => c(v),
|
|
1249
|
+
redo: () => c(map(y, (C) => ({ _id: C, ...f })))
|
|
1355
1250
|
});
|
|
1356
1251
|
},
|
|
1357
|
-
updateBlocksRuntime: (
|
|
1358
|
-
c(map(
|
|
1252
|
+
updateBlocksRuntime: (y, f) => {
|
|
1253
|
+
c(map(y, (b) => ({ _id: b, ...f })));
|
|
1359
1254
|
},
|
|
1360
|
-
setNewBlocks: (
|
|
1361
|
-
r(
|
|
1255
|
+
setNewBlocks: (y) => {
|
|
1256
|
+
r(y), o({
|
|
1362
1257
|
undo: () => r(n),
|
|
1363
|
-
redo: () => r(
|
|
1258
|
+
redo: () => r(y)
|
|
1364
1259
|
});
|
|
1365
1260
|
},
|
|
1366
|
-
updateMultipleBlocksProps: (
|
|
1367
|
-
let
|
|
1368
|
-
|
|
1369
|
-
const
|
|
1370
|
-
return each(
|
|
1371
|
-
}), c(
|
|
1372
|
-
undo: () => c(
|
|
1373
|
-
redo: () => c(
|
|
1261
|
+
updateMultipleBlocksProps: (y) => {
|
|
1262
|
+
let f = [];
|
|
1263
|
+
f = map(y, (b) => {
|
|
1264
|
+
const v = keys(b), C = n.find((R) => R._id === b._id), w = {};
|
|
1265
|
+
return each(v, (R) => w[R] = C[R]), w;
|
|
1266
|
+
}), c(y), o({
|
|
1267
|
+
undo: () => c(f),
|
|
1268
|
+
redo: () => c(y)
|
|
1374
1269
|
});
|
|
1375
1270
|
}
|
|
1376
1271
|
};
|
|
@@ -1378,18 +1273,18 @@ const useBlocksStoreManager = () => {
|
|
|
1378
1273
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1379
1274
|
(i, c, d) => {
|
|
1380
1275
|
var g;
|
|
1381
|
-
for (let
|
|
1382
|
-
const { _id:
|
|
1383
|
-
i[
|
|
1384
|
-
const
|
|
1385
|
-
for (let
|
|
1386
|
-
b
|
|
1276
|
+
for (let E = 0; E < i.length; E++) {
|
|
1277
|
+
const { _id: y } = i[E];
|
|
1278
|
+
i[E]._id = generateUUID();
|
|
1279
|
+
const f = filter(i, { _parent: y });
|
|
1280
|
+
for (let b = 0; b < f.length; b++)
|
|
1281
|
+
f[b]._parent = i[E]._id;
|
|
1387
1282
|
}
|
|
1388
1283
|
const u = first(i);
|
|
1389
1284
|
let p, m;
|
|
1390
1285
|
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([(g = first(i)) == null ? void 0 : g._id]), first(i);
|
|
1391
1286
|
},
|
|
1392
|
-
[o, n]
|
|
1287
|
+
[r, o, n]
|
|
1393
1288
|
);
|
|
1394
1289
|
return { addCoreBlock: useCallback(
|
|
1395
1290
|
(i, c, d) => {
|
|
@@ -1397,31 +1292,17 @@ const useBlocksStoreManager = () => {
|
|
|
1397
1292
|
const f = i.blocks;
|
|
1398
1293
|
return a(f, c, d);
|
|
1399
1294
|
}
|
|
1400
|
-
const u = generateUUID(), p =
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
const S = f.replace(SLOT_KEY, "");
|
|
1404
|
-
m.push({
|
|
1405
|
-
_id: S,
|
|
1406
|
-
_type: "Slot",
|
|
1407
|
-
_parent: u,
|
|
1408
|
-
_name: i.props[k].name,
|
|
1409
|
-
_styles: i.props[k].styles,
|
|
1410
|
-
_emptyStyles: i.props[k].emptyStyles
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
});
|
|
1414
|
-
const h = {
|
|
1295
|
+
const u = generateUUID(), p = getDefaultBlockProps(i.type);
|
|
1296
|
+
console.log("props", i);
|
|
1297
|
+
const m = {
|
|
1415
1298
|
_type: i.type,
|
|
1416
1299
|
_id: u,
|
|
1417
1300
|
...p
|
|
1418
1301
|
};
|
|
1419
|
-
let
|
|
1420
|
-
c && (
|
|
1421
|
-
const b = [h, ...m];
|
|
1422
|
-
return r(b, y, d), n([h._id]), h;
|
|
1302
|
+
let h, g;
|
|
1303
|
+
return c && (h = find(o, { _id: c }), m._parent = c, g = c), !canAcceptChildBlock(h == null ? void 0 : h._type, m._type) && h && (m._parent = h._parent, g = h._parent), r([m], g, d), n([m._id]), m;
|
|
1423
1304
|
},
|
|
1424
|
-
[a, o, n]
|
|
1305
|
+
[r, a, o, n]
|
|
1425
1306
|
), addPredefinedBlock: a };
|
|
1426
1307
|
}, STANDARD = [
|
|
1427
1308
|
0,
|
|
@@ -2478,7 +2359,7 @@ const useBlocksStoreManager = () => {
|
|
|
2478
2359
|
return { match: r, getClasses: a };
|
|
2479
2360
|
};
|
|
2480
2361
|
function getMqForCls(o) {
|
|
2481
|
-
if (isEmpty(o.trim()))
|
|
2362
|
+
if (isEmpty$1(o.trim()))
|
|
2482
2363
|
return "";
|
|
2483
2364
|
const n = o.match(/sm:|md:|lg:|xl:|2xl:/g);
|
|
2484
2365
|
return get(n, 0, "xs").replace(":", "");
|
|
@@ -2492,7 +2373,7 @@ function getPureClsName(o) {
|
|
|
2492
2373
|
}
|
|
2493
2374
|
const memoizedProps = {};
|
|
2494
2375
|
function getPropertyForClass(o) {
|
|
2495
|
-
if (isEmpty(o))
|
|
2376
|
+
if (isEmpty$1(o))
|
|
2496
2377
|
return "";
|
|
2497
2378
|
if (memoizedProps[o])
|
|
2498
2379
|
return memoizedProps[o];
|
|
@@ -2507,7 +2388,7 @@ function getPropertyForClass(o) {
|
|
|
2507
2388
|
return n;
|
|
2508
2389
|
}
|
|
2509
2390
|
function constructClassObject(o) {
|
|
2510
|
-
return isEmpty(o) ? null : {
|
|
2391
|
+
return isEmpty$1(o) ? null : {
|
|
2511
2392
|
dark: startsWith(o, "dark:"),
|
|
2512
2393
|
mq: getMqForCls(o),
|
|
2513
2394
|
mod: getModForCls(o),
|
|
@@ -2569,7 +2450,7 @@ function getNewClasses(o = "", n = "", r = []) {
|
|
|
2569
2450
|
const g = find(l, pick(m, ["property"]));
|
|
2570
2451
|
h && (l = filter(
|
|
2571
2452
|
l,
|
|
2572
|
-
(
|
|
2453
|
+
(E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
|
|
2573
2454
|
)), c.push({
|
|
2574
2455
|
...m,
|
|
2575
2456
|
fullCls: m.cls,
|
|
@@ -2700,7 +2581,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2700
2581
|
pasteBlocks: useCallback(
|
|
2701
2582
|
(d) => {
|
|
2702
2583
|
const u = Array.isArray(d) ? d[0] : d;
|
|
2703
|
-
isEmpty(o) ? l(n, d) : a(o, u), r([]);
|
|
2584
|
+
isEmpty$1(o) ? l(n, d) : a(o, u), r([]);
|
|
2704
2585
|
},
|
|
2705
2586
|
[n, o, a, l, r]
|
|
2706
2587
|
)
|
|
@@ -2723,10 +2604,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2723
2604
|
const d = o(c), u = a;
|
|
2724
2605
|
let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2725
2606
|
return each(u, (h) => {
|
|
2726
|
-
const g = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"),
|
|
2727
|
-
p = p.replace(
|
|
2728
|
-
const
|
|
2729
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2607
|
+
const g = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
|
|
2608
|
+
p = p.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2609
|
+
const y = first(h.split(":"));
|
|
2610
|
+
includes(["2xl", "xl", "lg", "md", "sm"], y) && u.push(h.split(":").pop().trim());
|
|
2730
2611
|
}), each(u, (h) => {
|
|
2731
2612
|
const g = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2732
2613
|
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
@@ -2795,12 +2676,12 @@ const useLanguages = () => {
|
|
|
2795
2676
|
setSelectedLang: l
|
|
2796
2677
|
};
|
|
2797
2678
|
}, updatePropsForLanguage = memoize((o, n, r) => {
|
|
2798
|
-
const a =
|
|
2679
|
+
const a = getRegisteredChaiBlock(get(r, "_type"));
|
|
2799
2680
|
if (!a)
|
|
2800
2681
|
return o;
|
|
2801
2682
|
const l = { ...o };
|
|
2802
2683
|
return forEach(keys(o), (i) => {
|
|
2803
|
-
if (get(a, ["props", i, "i18n"]) && !isEmpty(n)) {
|
|
2684
|
+
if (get(a, ["props", i, "i18n"]) && !isEmpty$1(n)) {
|
|
2804
2685
|
const c = `${i}-${n}`;
|
|
2805
2686
|
set(l, c, o[i]), unset(l, i);
|
|
2806
2687
|
}
|
|
@@ -3169,45 +3050,45 @@ const getBlockWithChildren = (o, n) => {
|
|
|
3169
3050
|
return r = flattenDeep([...r, ...getChildBlocks(n, o, r)]), r;
|
|
3170
3051
|
}, pickOnlyAIProps = (o, n) => compact(
|
|
3171
3052
|
o.map((r) => {
|
|
3172
|
-
const a = ["_id", "_type", "_parent"], l = pick(r, a), i =
|
|
3173
|
-
for (const
|
|
3174
|
-
a.includes(
|
|
3175
|
-
return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
|
|
3053
|
+
const a = ["_id", "_type", "_parent"], l = pick(r, a), i = getRegisteredChaiBlock(r._type), c = {}, d = get(i, "aiProps", []);
|
|
3054
|
+
for (const u in r)
|
|
3055
|
+
a.includes(u) || d.includes(u) && (c[u] = get(r, `${u}-${n}`, r[u]));
|
|
3056
|
+
return isEmpty$1(c) ? !1 : (has(l, "_parent") && isEmpty$1(l._parent) && delete l._parent, { ...l, ...c });
|
|
3176
3057
|
})
|
|
3177
3058
|
), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
3178
|
-
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, h = (g,
|
|
3179
|
-
const
|
|
3180
|
-
for (const
|
|
3181
|
-
const
|
|
3182
|
-
typeof
|
|
3059
|
+
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, h = (g, E) => {
|
|
3060
|
+
const y = cloneDeep(E.find((f) => f._id === g));
|
|
3061
|
+
for (const f in y) {
|
|
3062
|
+
const b = y[f];
|
|
3063
|
+
typeof b == "string" && startsWith(b, STYLES_KEY) ? y[f] = compact(flattenDeep(b.replace(STYLES_KEY, "").split(","))).join(" ") : f !== "_id" && delete y[f];
|
|
3183
3064
|
}
|
|
3184
|
-
return
|
|
3065
|
+
return y;
|
|
3185
3066
|
};
|
|
3186
3067
|
return {
|
|
3187
3068
|
askAi: useCallback(
|
|
3188
|
-
async (g,
|
|
3069
|
+
async (g, E, y, f) => {
|
|
3189
3070
|
if (l) {
|
|
3190
3071
|
n(!0), a(null);
|
|
3191
3072
|
try {
|
|
3192
|
-
const
|
|
3193
|
-
if (
|
|
3194
|
-
a(
|
|
3073
|
+
const b = u === p ? "" : u, v = g === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(E, d)), u) : [h(E, d)], C = await l(g, addLangToPrompt(y, m, g), v, b), { blocks: w, error: R } = C;
|
|
3074
|
+
if (R) {
|
|
3075
|
+
a(R);
|
|
3195
3076
|
return;
|
|
3196
3077
|
}
|
|
3197
3078
|
if (g === "styles") {
|
|
3198
|
-
const A =
|
|
3079
|
+
const A = w.map((I) => {
|
|
3199
3080
|
for (const T in I)
|
|
3200
3081
|
T !== "_id" && (I[T] = `${STYLES_KEY},${I[T]}`);
|
|
3201
3082
|
return I;
|
|
3202
3083
|
});
|
|
3203
3084
|
c(A);
|
|
3204
3085
|
} else
|
|
3205
|
-
i(
|
|
3206
|
-
|
|
3207
|
-
} catch (
|
|
3208
|
-
a(
|
|
3086
|
+
i(w);
|
|
3087
|
+
f && f(C);
|
|
3088
|
+
} catch (b) {
|
|
3089
|
+
a(b);
|
|
3209
3090
|
} finally {
|
|
3210
|
-
n(!1),
|
|
3091
|
+
n(!1), f && f();
|
|
3211
3092
|
}
|
|
3212
3093
|
}
|
|
3213
3094
|
},
|
|
@@ -3334,7 +3215,7 @@ class Content extends Component {
|
|
|
3334
3215
|
return Children.only(this.props.children);
|
|
3335
3216
|
}
|
|
3336
3217
|
}
|
|
3337
|
-
|
|
3218
|
+
O(Content, "propTypes", {
|
|
3338
3219
|
children: PropTypes.element.isRequired,
|
|
3339
3220
|
contentDidMount: PropTypes.func.isRequired,
|
|
3340
3221
|
contentDidUpdate: PropTypes.func.isRequired
|
|
@@ -3342,17 +3223,17 @@ F(Content, "propTypes", {
|
|
|
3342
3223
|
class Frame extends Component {
|
|
3343
3224
|
constructor(r, a) {
|
|
3344
3225
|
super(r, a);
|
|
3345
|
-
|
|
3226
|
+
O(this, "setRef", (r) => {
|
|
3346
3227
|
this.nodeRef.current = r;
|
|
3347
3228
|
const { forwardedRef: a } = this.props;
|
|
3348
3229
|
typeof a == "function" ? a(r) : a && (a.current = r);
|
|
3349
3230
|
});
|
|
3350
|
-
|
|
3231
|
+
O(this, "handleLoad", () => {
|
|
3351
3232
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
3352
3233
|
});
|
|
3353
3234
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
3354
3235
|
// fallback to an interval to check if that's the case
|
|
3355
|
-
|
|
3236
|
+
O(this, "loadCheck", () => setInterval(() => {
|
|
3356
3237
|
this.handleLoad();
|
|
3357
3238
|
}, 500));
|
|
3358
3239
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -3393,7 +3274,7 @@ class Frame extends Component {
|
|
|
3393
3274
|
// also inject into the body and can mess up React. For this reason
|
|
3394
3275
|
// initialContent is expected to have a div inside of the body
|
|
3395
3276
|
// element that we render react into.
|
|
3396
|
-
|
|
3277
|
+
O(Frame, "propTypes", {
|
|
3397
3278
|
style: PropTypes.object,
|
|
3398
3279
|
// eslint-disable-line
|
|
3399
3280
|
head: PropTypes.node,
|
|
@@ -3403,7 +3284,7 @@ F(Frame, "propTypes", {
|
|
|
3403
3284
|
contentDidMount: PropTypes.func,
|
|
3404
3285
|
contentDidUpdate: PropTypes.func,
|
|
3405
3286
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
|
|
3406
|
-
}),
|
|
3287
|
+
}), O(Frame, "defaultProps", {
|
|
3407
3288
|
style: {},
|
|
3408
3289
|
head: null,
|
|
3409
3290
|
children: void 0,
|
|
@@ -3490,26 +3371,26 @@ const useDnd = () => {
|
|
|
3490
3371
|
g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
|
|
3491
3372
|
},
|
|
3492
3373
|
onDrop: (g) => {
|
|
3493
|
-
var
|
|
3494
|
-
const
|
|
3495
|
-
dropIndex = calculateDropIndex(
|
|
3496
|
-
const
|
|
3497
|
-
if ((
|
|
3374
|
+
var R;
|
|
3375
|
+
const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : g.clientX;
|
|
3376
|
+
dropIndex = calculateDropIndex(f, possiblePositions);
|
|
3377
|
+
const b = d, v = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3378
|
+
if ((b == null ? void 0 : b._id) === v || !C) {
|
|
3498
3379
|
h();
|
|
3499
3380
|
return;
|
|
3500
3381
|
}
|
|
3501
|
-
if (!has(
|
|
3502
|
-
a(
|
|
3382
|
+
if (!has(b, "_id")) {
|
|
3383
|
+
a(b, v === "canvas" ? null : v, dropIndex), setTimeout(h, 300);
|
|
3503
3384
|
return;
|
|
3504
3385
|
}
|
|
3505
|
-
let
|
|
3506
|
-
|
|
3386
|
+
let w = E.getAttribute("data-block-id");
|
|
3387
|
+
w === null && (w = g.target.parentElement.getAttribute("data-block-id")), c([b._id], w === "canvas" ? null : w, dropIndex), h(), setTimeout(removePlaceholder, 300);
|
|
3507
3388
|
},
|
|
3508
3389
|
onDragEnter: (g) => {
|
|
3509
|
-
const
|
|
3510
|
-
dropTarget =
|
|
3511
|
-
const
|
|
3512
|
-
p(
|
|
3390
|
+
const E = g, y = E.target;
|
|
3391
|
+
dropTarget = y;
|
|
3392
|
+
const f = y.getAttribute("data-block-id"), b = y.getAttribute("data-dnd-dragged") !== "yes";
|
|
3393
|
+
p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], b && calculatePossiblePositions(y), r(!0), l(""), i([]);
|
|
3513
3394
|
},
|
|
3514
3395
|
onDragLeave: (g) => {
|
|
3515
3396
|
g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
|
|
@@ -3588,14 +3469,14 @@ const useHandleCanvasDblClick = () => {
|
|
|
3588
3469
|
const { document: n } = useFrame(), [r] = useSelectedBlockIds(), [a, l] = useSelectedStylingBlocks(), { clearHighlight: i } = useBlockHighlight();
|
|
3589
3470
|
useEffect(() => i, [i]), useEffect(() => {
|
|
3590
3471
|
setTimeout(() => {
|
|
3591
|
-
if (!isEmpty(a))
|
|
3472
|
+
if (!isEmpty$1(a))
|
|
3592
3473
|
return;
|
|
3593
3474
|
const h = getElementByDataBlockId(n, first(r));
|
|
3594
3475
|
if (h) {
|
|
3595
3476
|
const g = h.getAttribute("data-style-prop");
|
|
3596
3477
|
if (g) {
|
|
3597
|
-
const
|
|
3598
|
-
l([{ id:
|
|
3478
|
+
const E = h.getAttribute("data-style-id"), y = h.getAttribute("data-block-parent");
|
|
3479
|
+
l([{ id: E, prop: g, blockId: y }]);
|
|
3599
3480
|
}
|
|
3600
3481
|
}
|
|
3601
3482
|
}, 100);
|
|
@@ -3647,7 +3528,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3647
3528
|
};
|
|
3648
3529
|
class PubSub {
|
|
3649
3530
|
constructor() {
|
|
3650
|
-
|
|
3531
|
+
O(this, "subscribers", /* @__PURE__ */ new Map());
|
|
3651
3532
|
}
|
|
3652
3533
|
subscribe(n, r) {
|
|
3653
3534
|
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
@@ -3687,7 +3568,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: n }) => {
|
|
|
3687
3568
|
}
|
|
3688
3569
|
});
|
|
3689
3570
|
useResizeObserver(o, () => m(), o !== null);
|
|
3690
|
-
const h = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3571
|
+
const h = get(n, "_parent", null), g = isEmpty$1(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
|
|
3691
3572
|
return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3692
3573
|
"div",
|
|
3693
3574
|
{
|
|
@@ -3695,13 +3576,13 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: n }) => {
|
|
|
3695
3576
|
tabIndex: 0,
|
|
3696
3577
|
ref: p.setFloating,
|
|
3697
3578
|
style: u,
|
|
3698
|
-
onClick: (
|
|
3699
|
-
|
|
3579
|
+
onClick: (E) => {
|
|
3580
|
+
E.stopPropagation(), E.preventDefault();
|
|
3700
3581
|
},
|
|
3701
|
-
onMouseEnter: (
|
|
3702
|
-
|
|
3582
|
+
onMouseEnter: (E) => {
|
|
3583
|
+
E.stopPropagation(), i(null);
|
|
3703
3584
|
},
|
|
3704
|
-
onKeyDown: (
|
|
3585
|
+
onKeyDown: (E) => E.stopPropagation(),
|
|
3705
3586
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3706
3587
|
children: [
|
|
3707
3588
|
h && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3787,9 +3668,9 @@ const getChaiThemeVariables = (o) => `:root {
|
|
|
3787
3668
|
`)}
|
|
3788
3669
|
}
|
|
3789
3670
|
.dark {
|
|
3790
|
-
${o.colors && Object.entries(o.colors).map(([n, r]) => `--${n}: ${r[1]};`).join(`
|
|
3671
|
+
${o.colors && Object.entries(o.colors).map(([n, r]) => `--${n}: ${hexToHSL(r[1])};`).join(`
|
|
3791
3672
|
`)}
|
|
3792
|
-
}`, getThemeFonts = (o) => isEmpty(o.fontFamily) ? "" : uniq(Object.entries(o.fontFamily).map(([, r]) => r)).map((r) => `<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${r.replace(/\s+/g, "+")}&display=swap`}">`).join(`
|
|
3673
|
+
}`, getThemeFonts = (o) => isEmpty$1(o.fontFamily) ? "" : uniq(Object.entries(o.fontFamily).map(([, r]) => r)).map((r) => `<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${r.replace(/\s+/g, "+")}&display=swap`}">`).join(`
|
|
3793
3674
|
`), HeadTags = () => {
|
|
3794
3675
|
const [o] = useTheme(), n = useThemeOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: u } = useFrame(), [p] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [m] = useState(
|
|
3795
3676
|
d == null ? void 0 : d.getElementById("selected-block")
|
|
@@ -3819,22 +3700,22 @@ const getChaiThemeVariables = (o) => `:root {
|
|
|
3819
3700
|
typography,
|
|
3820
3701
|
forms,
|
|
3821
3702
|
aspectRatio,
|
|
3822
|
-
plugin(function({ addBase:
|
|
3823
|
-
|
|
3703
|
+
plugin(function({ addBase: f, theme: b }) {
|
|
3704
|
+
f({
|
|
3824
3705
|
"h1,h2,h3,h4,h5,h6": {
|
|
3825
|
-
fontFamily:
|
|
3706
|
+
fontFamily: b("fontFamily.heading")
|
|
3826
3707
|
},
|
|
3827
3708
|
body: {
|
|
3828
|
-
fontFamily:
|
|
3829
|
-
color:
|
|
3830
|
-
backgroundColor:
|
|
3709
|
+
fontFamily: b("fontFamily.body"),
|
|
3710
|
+
color: b("colors.foreground"),
|
|
3711
|
+
backgroundColor: b("colors.background")
|
|
3831
3712
|
}
|
|
3832
3713
|
});
|
|
3833
3714
|
})
|
|
3834
3715
|
]
|
|
3835
3716
|
});
|
|
3836
3717
|
}, [o, n, u]), useEffect(() => {
|
|
3837
|
-
m && (m.textContent = `${map(r, (
|
|
3718
|
+
m && (m.textContent = `${map(r, (f) => `[data-block-id="${f}"]`).join(",")}{
|
|
3838
3719
|
outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
3839
3720
|
}`);
|
|
3840
3721
|
}, [r, m]), useEffect(() => {
|
|
@@ -3842,19 +3723,19 @@ const getChaiThemeVariables = (o) => `:root {
|
|
|
3842
3723
|
}, [i, g]), useEffect(() => {
|
|
3843
3724
|
p && (p.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
|
|
3844
3725
|
}, [p]), useEffect(() => {
|
|
3845
|
-
h && (h.textContent = `${map(l, ({ id:
|
|
3726
|
+
h && (h.textContent = `${map(l, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
|
|
3846
3727
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
3847
3728
|
}`);
|
|
3848
3729
|
}, [l, h]), useEffect(() => {
|
|
3849
3730
|
d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3850
3731
|
}, [c, d]);
|
|
3851
|
-
const
|
|
3732
|
+
const E = useMemo(
|
|
3852
3733
|
() => getChaiThemeVariables(o),
|
|
3853
3734
|
[o]
|
|
3854
|
-
),
|
|
3735
|
+
), y = useMemo(() => getThemeFonts(pick(o, ["fontFamily"])), [o]);
|
|
3855
3736
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3856
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children:
|
|
3857
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html:
|
|
3737
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children: E }),
|
|
3738
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: y } })
|
|
3858
3739
|
] });
|
|
3859
3740
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
|
|
3860
3741
|
const r = ["xs", "sm", "md", "lg", "xl", "2xl"], a = r.indexOf(n), l = o.split(" ");
|
|
@@ -3889,7 +3770,7 @@ const getChaiThemeVariables = (o) => `:root {
|
|
|
3889
3770
|
);
|
|
3890
3771
|
return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
|
|
3891
3772
|
}, useWatchRSCBlocks = () => {
|
|
3892
|
-
const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i =
|
|
3773
|
+
const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useRegisteredChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
|
|
3893
3774
|
var h;
|
|
3894
3775
|
return (h = get(i, p._type)) == null ? void 0 : h.server;
|
|
3895
3776
|
}).map((p) => p._id), [i, o]);
|
|
@@ -3951,7 +3832,7 @@ function getStyleAttrs(o, n) {
|
|
|
3951
3832
|
}
|
|
3952
3833
|
function applyBindings(o, n) {
|
|
3953
3834
|
const r = get(o, "_bindings", {});
|
|
3954
|
-
return isEmpty(r) ? { ...o } : (each(r, (a, l) => {
|
|
3835
|
+
return isEmpty$1(r) ? { ...o } : (each(r, (a, l) => {
|
|
3955
3836
|
isString(a) && get(n, a, null) && (o[l] = get(n, a, null));
|
|
3956
3837
|
}), o);
|
|
3957
3838
|
}
|
|
@@ -3963,56 +3844,56 @@ function isDescendant(o, n, r) {
|
|
|
3963
3844
|
}
|
|
3964
3845
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
|
|
3965
3846
|
function applyLanguage(o, n, r) {
|
|
3966
|
-
if (isEmpty(n))
|
|
3847
|
+
if (isEmpty$1(n))
|
|
3967
3848
|
return o;
|
|
3968
3849
|
const a = cloneDeep(o);
|
|
3969
3850
|
return forEach(keys(a), (l) => {
|
|
3970
|
-
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(a, `${l}-${n}`, a[l]));
|
|
3851
|
+
get(r, ["props", l, "i18n"]) && !isEmpty$1(n) && (a[l] = get(a, `${l}-${n}`, a[l]));
|
|
3971
3852
|
}), a;
|
|
3972
3853
|
}
|
|
3973
3854
|
function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
3974
|
-
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(), h = useCallback((
|
|
3975
|
-
(
|
|
3976
|
-
const
|
|
3977
|
-
return { ...
|
|
3855
|
+
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(), h = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), y = useCallback(
|
|
3856
|
+
(f) => f.reduce((b, v) => {
|
|
3857
|
+
const C = get(u, v, {});
|
|
3858
|
+
return { ...b, ...C };
|
|
3978
3859
|
}, {}),
|
|
3979
3860
|
[u]
|
|
3980
3861
|
);
|
|
3981
3862
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3982
|
-
o.map((
|
|
3983
|
-
if (
|
|
3863
|
+
o.map((f, b) => {
|
|
3864
|
+
if (E === f._id || p.includes(f._id))
|
|
3984
3865
|
return null;
|
|
3985
|
-
const
|
|
3986
|
-
if (
|
|
3987
|
-
const
|
|
3988
|
-
|
|
3866
|
+
const v = {}, C = filter(n, { _parent: f._id });
|
|
3867
|
+
if (v.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, f._type === "GlobalBlock") {
|
|
3868
|
+
const k = m(f);
|
|
3869
|
+
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(k, (S) => !S._parent), allBlocks: k });
|
|
3989
3870
|
}
|
|
3990
|
-
const
|
|
3871
|
+
const w = getRegisteredChaiBlock(f._type), R = get(w, "server", !1), A = R ? RSCBlock : get(w, "builderComponent", get(w, "component", null));
|
|
3991
3872
|
if (isNull(A))
|
|
3992
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${
|
|
3993
|
-
const I = has(
|
|
3994
|
-
if (get(N, "__isHidden", !1) && !includes(a,
|
|
3873
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
|
|
3874
|
+
const I = has(w, "getBlockStateFrom") ? w == null ? void 0 : w.getBlockStateFrom(f, n) : [], T = y(I), N = h(f);
|
|
3875
|
+
if (get(N, "__isHidden", !1) && !includes(a, f._id))
|
|
3995
3876
|
return null;
|
|
3996
|
-
const x = i && isDescendant(i._id,
|
|
3997
|
-
...includes(a,
|
|
3998
|
-
"data-block-id":
|
|
3999
|
-
"data-block-type":
|
|
3877
|
+
const x = i && isDescendant(i._id, f._id, n), j = {
|
|
3878
|
+
...includes(a, f._id) ? { "force-show": "" } : {},
|
|
3879
|
+
"data-block-id": f._id,
|
|
3880
|
+
"data-block-type": f._type,
|
|
4000
3881
|
...i ? (
|
|
4001
3882
|
// @ts-ignore
|
|
4002
3883
|
{
|
|
4003
|
-
"data-dnd": canAcceptChildBlock(
|
|
4004
|
-
"data-dnd-dragged": i._id ===
|
|
3884
|
+
"data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3885
|
+
"data-dnd-dragged": i._id === f._id || x ? "yes" : "no"
|
|
4005
3886
|
}
|
|
4006
3887
|
) : {},
|
|
4007
|
-
...c ===
|
|
4008
|
-
...includes(l,
|
|
3888
|
+
...c === f._id && !x ? { "data-drop": "yes" } : {},
|
|
3889
|
+
...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
|
|
4009
3890
|
};
|
|
4010
|
-
return
|
|
3891
|
+
return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: j }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
|
|
4011
3892
|
blockProps: j,
|
|
4012
|
-
index:
|
|
4013
|
-
...applyBindings(applyLanguage(
|
|
3893
|
+
index: b,
|
|
3894
|
+
...applyBindings(applyLanguage(f, r, w), g),
|
|
4014
3895
|
...omit(N, ["__isHidden"]),
|
|
4015
|
-
...
|
|
3896
|
+
...v,
|
|
4016
3897
|
inBuilder: !0,
|
|
4017
3898
|
blockState: T
|
|
4018
3899
|
}) });
|
|
@@ -4021,7 +3902,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
|
|
|
4021
3902
|
}
|
|
4022
3903
|
const dataProvidersAtom = atom$1([]);
|
|
4023
3904
|
dataProvidersAtom.debugLabel = "dataProvidersAtom";
|
|
4024
|
-
const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProviders = () => useMemo(() =>
|
|
3905
|
+
const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProviders = () => useMemo(() => [], []), BlocksExternalDataProvider = ({ children: o }) => {
|
|
4025
3906
|
const [, n] = useChaiExternalData(), [r] = usePageDataProviders(), a = useAllDataProviders();
|
|
4026
3907
|
return useEffect(() => (n({}), each(r, (l) => {
|
|
4027
3908
|
const i = find(a, { providerKey: l.providerKey });
|
|
@@ -4037,7 +3918,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4037
3918
|
});
|
|
4038
3919
|
}), [a, r, n]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: o });
|
|
4039
3920
|
}, StaticBlocksRenderer = () => {
|
|
4040
|
-
const [o] = useBlocksStore(), n = isEmpty(o) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksExternalDataProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: o, blocks: filter(o, (r) => isEmpty(r._parent)) }) });
|
|
3921
|
+
const [o] = useBlocksStore(), n = isEmpty$1(o) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksExternalDataProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: o, blocks: filter(o, (r) => isEmpty$1(r._parent)) }) });
|
|
4041
3922
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: n });
|
|
4042
3923
|
}, AddBlockAtBottom = () => {
|
|
4043
3924
|
const { t: o } = useTranslation();
|
|
@@ -4070,7 +3951,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4070
3951
|
};
|
|
4071
3952
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
4072
3953
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
|
|
4073
|
-
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, h] = useState([]), [, g] = useState([]), [,
|
|
3954
|
+
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, h] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [y, f] = useSelectedStylingBlocks(), b = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (A) => {
|
|
4074
3955
|
u((I) => ({ ...I, width: A }));
|
|
4075
3956
|
};
|
|
4076
3957
|
useEffect(() => {
|
|
@@ -4079,7 +3960,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4079
3960
|
const { clientWidth: A, clientHeight: I } = c.current;
|
|
4080
3961
|
u({ width: A, height: I });
|
|
4081
3962
|
}, [c, n]);
|
|
4082
|
-
const
|
|
3963
|
+
const w = (A, I = 0) => {
|
|
4083
3964
|
const { top: T } = A.getBoundingClientRect();
|
|
4084
3965
|
return T + I >= 0 && T - I <= window.innerHeight;
|
|
4085
3966
|
};
|
|
@@ -4087,30 +3968,30 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4087
3968
|
var A, I;
|
|
4088
3969
|
if (a && a.type !== "Multiple" && i.current) {
|
|
4089
3970
|
const T = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
4090
|
-
T && (
|
|
3971
|
+
T && (w(T) || (I = (A = i.current) == null ? void 0 : A.contentWindow) == null || I.scrollTo({ top: T.offsetTop, behavior: "smooth" }), h([T]));
|
|
4091
3972
|
}
|
|
4092
3973
|
}, [a]), useEffect(() => {
|
|
4093
|
-
if (!isEmpty(
|
|
3974
|
+
if (!isEmpty$1(y) && i.current) {
|
|
4094
3975
|
const A = getElementByStyleId(
|
|
4095
3976
|
i.current.contentDocument,
|
|
4096
|
-
first(
|
|
3977
|
+
first(y).id
|
|
4097
3978
|
);
|
|
4098
3979
|
g(A ? [A] : [null]);
|
|
4099
3980
|
} else
|
|
4100
3981
|
g([null]);
|
|
4101
|
-
}, [
|
|
4102
|
-
const
|
|
3982
|
+
}, [y]);
|
|
3983
|
+
const R = useMemo(() => {
|
|
4103
3984
|
let A = IframeInitialContent;
|
|
4104
|
-
return A = A.replace("__HTML_DIR__",
|
|
3985
|
+
return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
|
|
4105
3986
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
4106
3987
|
"/offline/tailwind.cdn.js"
|
|
4107
3988
|
), 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;
|
|
4108
|
-
}, [o,
|
|
4109
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3989
|
+
}, [o, v]);
|
|
3990
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4110
3991
|
"div",
|
|
4111
3992
|
{
|
|
4112
3993
|
onClick: () => {
|
|
4113
|
-
r([]),
|
|
3994
|
+
r([]), f([]);
|
|
4114
3995
|
},
|
|
4115
3996
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
4116
3997
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -4118,12 +3999,12 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4118
3999
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4119
4000
|
ChaiFrame,
|
|
4120
4001
|
{
|
|
4121
|
-
contentDidMount: () =>
|
|
4002
|
+
contentDidMount: () => E(i.current),
|
|
4122
4003
|
ref: i,
|
|
4123
4004
|
id: "canvas-iframe",
|
|
4124
|
-
style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
|
|
4005
|
+
style: { ...p, ...isEmpty$1(p) ? { width: `${n}px` } : {} },
|
|
4125
4006
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
4126
|
-
initialContent:
|
|
4007
|
+
initialContent: R,
|
|
4127
4008
|
children: [
|
|
4128
4009
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
4129
4010
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4135,7 +4016,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4135
4016
|
),
|
|
4136
4017
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
|
|
4137
4018
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
4138
|
-
|
|
4019
|
+
b ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
4139
4020
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
4140
4021
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
4141
4022
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -4246,7 +4127,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4246
4127
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
4247
4128
|
] }, l))
|
|
4248
4129
|
] }) });
|
|
4249
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
4130
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-CqMwiE7m.js")), CanvasArea = () => {
|
|
4250
4131
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
4251
4132
|
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: [
|
|
4252
4133
|
/* @__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, {}) }) }),
|
|
@@ -4309,12 +4190,12 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4309
4190
|
label: o,
|
|
4310
4191
|
value: n,
|
|
4311
4192
|
onChange: r
|
|
4312
|
-
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
4313
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm
|
|
4193
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5", children: [
|
|
4194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: startCase(o) }),
|
|
4314
4195
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4315
4196
|
"select",
|
|
4316
4197
|
{
|
|
4317
|
-
className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
4198
|
+
className: "mt-1 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
4318
4199
|
value: n,
|
|
4319
4200
|
onChange: (a) => r(a.target.value),
|
|
4320
4201
|
children: FONTS.map((a) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: a.value, children: a.title }, a.value))
|
|
@@ -4341,8 +4222,8 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4341
4222
|
)
|
|
4342
4223
|
}
|
|
4343
4224
|
);
|
|
4344
|
-
}, ColorPickerInput$1 = ColorPickerInput, BorderRadiusInput = ({
|
|
4345
|
-
const
|
|
4225
|
+
}, ColorPickerInput$1 = ColorPickerInput, BorderRadiusInput = ({ value: o, onChange: n, disabled: r }) => {
|
|
4226
|
+
const a = debounce((l) => n(l), 200);
|
|
4346
4227
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4347
4228
|
"input",
|
|
4348
4229
|
{
|
|
@@ -4350,125 +4231,110 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4350
4231
|
min: "0",
|
|
4351
4232
|
step: "1",
|
|
4352
4233
|
max: "30",
|
|
4353
|
-
disabled:
|
|
4354
|
-
defaultValue: "
|
|
4355
|
-
onChange: (
|
|
4356
|
-
className: "flex-1"
|
|
4234
|
+
disabled: r,
|
|
4235
|
+
defaultValue: o.replace("px", ""),
|
|
4236
|
+
onChange: (l) => a(l.target.value),
|
|
4237
|
+
className: "flex-1 cursor-pointer"
|
|
4357
4238
|
}
|
|
4358
4239
|
);
|
|
4359
4240
|
}, BorderRadiusInput$1 = BorderRadiusInput, ThemeConfigPanel$1 = React.memo(({ className: o = "" }) => {
|
|
4360
|
-
const [n
|
|
4361
|
-
|
|
4362
|
-
},
|
|
4363
|
-
const f =
|
|
4241
|
+
const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: u } = useTranslation(), p = (f) => {
|
|
4242
|
+
a(f);
|
|
4243
|
+
}, m = () => {
|
|
4244
|
+
const f = l.find((b) => Object.keys(b)[0] === r);
|
|
4364
4245
|
if (f) {
|
|
4365
|
-
const
|
|
4366
|
-
|
|
4246
|
+
const b = Object.values(f)[0];
|
|
4247
|
+
b && typeof b == "object" && "fontFamily" in b && "borderRadius" in b && "colors" in b ? c(b) : console.error("Invalid preset structure:", b);
|
|
4367
4248
|
} else
|
|
4368
|
-
console.error("Preset not found:",
|
|
4369
|
-
},
|
|
4370
|
-
(f,
|
|
4371
|
-
|
|
4372
|
-
...
|
|
4249
|
+
console.error("Preset not found:", r);
|
|
4250
|
+
}, h = useDebouncedCallback(
|
|
4251
|
+
(f, b) => {
|
|
4252
|
+
c(() => ({
|
|
4253
|
+
...i,
|
|
4373
4254
|
fontFamily: {
|
|
4374
|
-
...
|
|
4375
|
-
[f.replace(/font-/g, "")]:
|
|
4255
|
+
...i.fontFamily,
|
|
4256
|
+
[f.replace(/font-/g, "")]: b
|
|
4376
4257
|
}
|
|
4377
4258
|
}));
|
|
4378
4259
|
},
|
|
4379
|
-
[
|
|
4260
|
+
[i],
|
|
4380
4261
|
200
|
|
4381
|
-
),
|
|
4262
|
+
), g = useDebouncedCallback(
|
|
4382
4263
|
(f) => {
|
|
4383
|
-
|
|
4384
|
-
...
|
|
4264
|
+
c(() => ({
|
|
4265
|
+
...i,
|
|
4385
4266
|
borderRadius: `${f}px`
|
|
4386
4267
|
}));
|
|
4387
4268
|
},
|
|
4388
|
-
[
|
|
4269
|
+
[i],
|
|
4389
4270
|
200
|
|
4390
4271
|
), E = useDebouncedCallback(
|
|
4391
|
-
(f,
|
|
4392
|
-
|
|
4393
|
-
const
|
|
4394
|
-
return n
|
|
4395
|
-
...
|
|
4272
|
+
(f, b) => {
|
|
4273
|
+
c(() => {
|
|
4274
|
+
const v = get(i, `colors.${f}`);
|
|
4275
|
+
return n ? set(v, 1, b) : set(v, 0, b), {
|
|
4276
|
+
...i,
|
|
4396
4277
|
colors: {
|
|
4397
|
-
...
|
|
4398
|
-
[f]:
|
|
4278
|
+
...i.colors,
|
|
4279
|
+
[f]: v
|
|
4399
4280
|
}
|
|
4400
4281
|
};
|
|
4401
4282
|
});
|
|
4402
4283
|
},
|
|
4403
|
-
[
|
|
4284
|
+
[i],
|
|
4404
4285
|
200
|
|
4405
|
-
),
|
|
4406
|
-
const
|
|
4407
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center", children: [
|
|
4286
|
+
), y = (f) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(f.items).map(([b]) => {
|
|
4287
|
+
const v = get(i, `colors.${b}.${n ? 1 : 0}`);
|
|
4288
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
4408
4289
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4409
4290
|
ColorPickerInput$1,
|
|
4410
4291
|
{
|
|
4411
|
-
value:
|
|
4412
|
-
onChange: (
|
|
4292
|
+
value: v,
|
|
4293
|
+
onChange: (C) => E(b, C)
|
|
4413
4294
|
}
|
|
4414
4295
|
),
|
|
4415
|
-
"
|
|
4416
|
-
|
|
4417
|
-
] }, k);
|
|
4296
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: b.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((C) => C.charAt(0).toUpperCase() + C.slice(1)).join(" ") + (!b.toLowerCase().includes("foreground") && !b.toLowerCase().includes("border") && !b.toLowerCase().includes("input") && !b.toLowerCase().includes("ring") && !b.toLowerCase().includes("background") ? " Background" : "") })
|
|
4297
|
+
] }, b);
|
|
4418
4298
|
}) });
|
|
4419
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4420
|
-
|
|
4421
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-
|
|
4422
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4299
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
4300
|
+
l.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 py-2", children: [
|
|
4301
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
4302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: u("Presets") }),
|
|
4423
4303
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4424
4304
|
"select",
|
|
4425
4305
|
{
|
|
4426
|
-
value:
|
|
4427
|
-
onChange: (f) =>
|
|
4428
|
-
className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
4306
|
+
value: r,
|
|
4307
|
+
onChange: (f) => p(f.target.value),
|
|
4308
|
+
className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
4429
4309
|
children: [
|
|
4430
4310
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Select preset" }),
|
|
4431
|
-
Array.isArray(
|
|
4311
|
+
Array.isArray(l) && l.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: Object.keys(f)[0], children: capitalize(Object.keys(f)[0]) }, Object.keys(f)[0]))
|
|
4432
4312
|
]
|
|
4433
4313
|
}
|
|
4434
4314
|
)
|
|
4435
4315
|
] }),
|
|
4436
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "w-full text-sm", disabled:
|
|
4316
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "w-full text-sm", disabled: r === "", variant: "default", onClick: m, children: u("Apply") }) })
|
|
4437
4317
|
] }),
|
|
4438
4318
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("space-y-2", o), children: [
|
|
4439
|
-
(
|
|
4319
|
+
(d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([f, b]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4440
4320
|
FontSelector$1,
|
|
4441
4321
|
{
|
|
4442
4322
|
label: f,
|
|
4443
|
-
value:
|
|
4444
|
-
onChange: (
|
|
4323
|
+
value: i.fontFamily[f.replace(/font-/g, "")] || b[Object.keys(b)[0]],
|
|
4324
|
+
onChange: (v) => h(f, v)
|
|
4445
4325
|
},
|
|
4446
4326
|
f
|
|
4447
4327
|
)) }),
|
|
4448
|
-
(
|
|
4449
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4450
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
4451
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput$1, {
|
|
4452
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-12 text-sm", children:
|
|
4328
|
+
(d == null ? void 0 : d.borderRadius) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5 py-3", children: [
|
|
4329
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: u("Border Radius") }),
|
|
4330
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 py-2", children: [
|
|
4331
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput$1, { value: i.borderRadius, onChange: g }),
|
|
4332
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-12 text-sm", children: i.borderRadius })
|
|
4453
4333
|
] })
|
|
4454
4334
|
] }),
|
|
4455
|
-
(
|
|
4456
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
4457
|
-
|
|
4458
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4459
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Sun, { className: "size-2 transition-all" }),
|
|
4460
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4461
|
-
Switch,
|
|
4462
|
-
{
|
|
4463
|
-
checked: n === "dark",
|
|
4464
|
-
onCheckedChange: (f) => r(f ? "dark" : "light"),
|
|
4465
|
-
className: "data-[state=checked]:bg-slate-800 data-[state=unchecked]:bg-slate-200"
|
|
4466
|
-
}
|
|
4467
|
-
),
|
|
4468
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Moon, { className: "size-2" })
|
|
4469
|
-
] })
|
|
4470
|
-
] }),
|
|
4471
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4", children: u.colors.map((f) => b(f)) }, n)
|
|
4335
|
+
(d == null ? void 0 : d.colors) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-0.5", children: [
|
|
4336
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: u("Colors") }),
|
|
4337
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((f) => y(f)) }, n ? "dark" : "light")
|
|
4472
4338
|
] })
|
|
4473
4339
|
] }),
|
|
4474
4340
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -4655,34 +4521,34 @@ function BiExpandVertical(o) {
|
|
|
4655
4521
|
const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
4656
4522
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4657
4523
|
let u = null;
|
|
4658
|
-
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: h } = useBlockHighlight(), { id: g, data:
|
|
4524
|
+
const p = o.children.length > 0, { highlightBlock: m, clearHighlight: h } = useBlockHighlight(), { id: g, data: E, isSelected: y, willReceiveDrop: f, isDragging: b, isEditing: v, handleClick: C } = o, w = (x) => {
|
|
4659
4525
|
x.stopPropagation(), !i.includes(g) && o.toggle();
|
|
4660
|
-
},
|
|
4526
|
+
}, R = (x) => {
|
|
4661
4527
|
x.isInternal && (u = x.isOpen, x.isOpen && x.close());
|
|
4662
4528
|
}, A = (x) => {
|
|
4663
4529
|
x.isInternal && u !== null && (u ? x.open() : x.close(), u = null);
|
|
4664
4530
|
}, I = (x) => {
|
|
4665
|
-
x.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(),
|
|
4531
|
+
x.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), C(x);
|
|
4666
4532
|
};
|
|
4667
4533
|
useEffect(() => {
|
|
4668
4534
|
const x = setTimeout(() => {
|
|
4669
|
-
|
|
4535
|
+
f && !o.isOpen && !b && !i.includes(g) && o.toggle();
|
|
4670
4536
|
}, 500);
|
|
4671
4537
|
return () => clearTimeout(x);
|
|
4672
|
-
}, [
|
|
4538
|
+
}, [f, o, b]);
|
|
4673
4539
|
const T = useMemo(() => {
|
|
4674
|
-
const x = Object.keys(
|
|
4675
|
-
for (let
|
|
4676
|
-
if (x[
|
|
4677
|
-
const
|
|
4540
|
+
const x = Object.keys(E), j = [];
|
|
4541
|
+
for (let k = 0; k < x.length; k++)
|
|
4542
|
+
if (x[k].endsWith("_attrs")) {
|
|
4543
|
+
const S = E[x[k]], _ = Object.keys(S).join("|");
|
|
4678
4544
|
_.match(/x-data/) && j.push("data"), _.match(/x-on/) && j.push("event"), _.match(/x-show|x-if/) && j.push("show");
|
|
4679
4545
|
}
|
|
4680
4546
|
return j;
|
|
4681
|
-
}, [
|
|
4682
|
-
const
|
|
4683
|
-
|
|
4684
|
-
const _ =
|
|
4685
|
-
_.top >= B.top && _.left >= B.left && _.bottom <= B.bottom && _.right <= B.right || (
|
|
4547
|
+
}, [E]), N = (x, j) => {
|
|
4548
|
+
const k = d.contentDocument || d.contentWindow.document, S = k.querySelector(`[data-block-id=${x}]`);
|
|
4549
|
+
S && S.setAttribute("data-drop", j);
|
|
4550
|
+
const _ = S.getBoundingClientRect(), B = d.getBoundingClientRect();
|
|
4551
|
+
_.top >= B.top && _.left >= B.left && _.bottom <= B.bottom && _.right <= B.right || (k.documentElement.scrollTop = S.offsetTop - B.top);
|
|
4686
4552
|
};
|
|
4687
4553
|
return g === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4688
4554
|
"button",
|
|
@@ -4703,7 +4569,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4703
4569
|
style: n,
|
|
4704
4570
|
"data-node-id": g,
|
|
4705
4571
|
ref: i.includes(g) ? null : r,
|
|
4706
|
-
onDragStart: () =>
|
|
4572
|
+
onDragStart: () => R(o),
|
|
4707
4573
|
onDragEnd: () => A(o),
|
|
4708
4574
|
onDragOver: (x) => {
|
|
4709
4575
|
x.preventDefault(), N(g, "yes");
|
|
@@ -4716,9 +4582,9 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4716
4582
|
},
|
|
4717
4583
|
className: cn(
|
|
4718
4584
|
"group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4585
|
+
y ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
4586
|
+
f && canAcceptChildBlock(E._type, "Icon") ? "bg-green-200" : "",
|
|
4587
|
+
b && "opacity-20",
|
|
4722
4588
|
i.includes(g) ? "opacity-50" : ""
|
|
4723
4589
|
),
|
|
4724
4590
|
children: [
|
|
@@ -4727,12 +4593,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4727
4593
|
"div",
|
|
4728
4594
|
{
|
|
4729
4595
|
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" : ""}`,
|
|
4730
|
-
children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4596
|
+
children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
|
|
4731
4597
|
}
|
|
4732
4598
|
),
|
|
4733
4599
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
4734
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4735
|
-
|
|
4600
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: E == null ? void 0 : E._type }) }),
|
|
4601
|
+
v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4736
4602
|
"div",
|
|
4737
4603
|
{
|
|
4738
4604
|
className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
|
|
@@ -4740,7 +4606,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4740
4606
|
x.stopPropagation(), o.edit(), o.deselect();
|
|
4741
4607
|
},
|
|
4742
4608
|
children: [
|
|
4743
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4609
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (E == null ? void 0 : E._name) || (E == null ? void 0 : E._type.split("/").pop()) }),
|
|
4744
4610
|
T.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4745
4611
|
T.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4746
4612
|
T.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
@@ -4761,7 +4627,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4761
4627
|
),
|
|
4762
4628
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: x.tooltip })
|
|
4763
4629
|
] })),
|
|
4764
|
-
canAddChildBlock(
|
|
4630
|
+
canAddChildBlock(E == null ? void 0 : E._type) && !i.includes(g) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4765
4631
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4766
4632
|
TooltipTrigger,
|
|
4767
4633
|
{
|
|
@@ -4884,7 +4750,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4884
4750
|
break;
|
|
4885
4751
|
}
|
|
4886
4752
|
};
|
|
4887
|
-
return isEmpty(treeData) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-10 flex h-full w-full items-center justify-center p-8 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 text-sm text-gray-400", children: [
|
|
4753
|
+
return isEmpty$1(treeData) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-10 flex h-full w-full items-center justify-center p-8 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 text-sm text-gray-400", children: [
|
|
4888
4754
|
t("This page is empty"),
|
|
4889
4755
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
4890
4756
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -4961,7 +4827,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
4961
4827
|
const n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, r = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
4962
4828
|
return n.test(o) || r.test(o);
|
|
4963
4829
|
}, getVideoURLFromHTML = (o) => {
|
|
4964
|
-
if (isEmpty(o))
|
|
4830
|
+
if (isEmpty$1(o))
|
|
4965
4831
|
return o;
|
|
4966
4832
|
const n = /<video[^>]+src=['"]([^'">]+)['"]/, r = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = o.match(n), l = o.match(r), i = a ? a[1] : l ? l[1] : null, c = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, d = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
4967
4833
|
return i && (c.test(i) || d.test(i)) ? i : o;
|
|
@@ -5001,7 +4867,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
5001
4867
|
}, shouldAddText = (o, n) => o.children.length === 1 && includes(
|
|
5002
4868
|
["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
|
|
5003
4869
|
n._type
|
|
5004
|
-
), getTextContent = (o) => o.map((n) => n.type === "text" ? get(n, "content", "") : isEmpty(n.children) ? "" : getTextContent(n.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
|
|
4870
|
+
), getTextContent = (o) => o.map((n) => n.type === "text" ? get(n, "content", "") : isEmpty$1(n.children) ? "" : getTextContent(n.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
|
|
5005
4871
|
if (o.tagName === "svg")
|
|
5006
4872
|
return {};
|
|
5007
4873
|
const n = {}, r = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
|
|
@@ -5112,16 +4978,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
5112
4978
|
}
|
|
5113
4979
|
}
|
|
5114
4980
|
}, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
|
|
5115
|
-
var u, p, m, h, g,
|
|
4981
|
+
var u, p, m, h, g, E, y, f;
|
|
5116
4982
|
if (r.type === "comment")
|
|
5117
4983
|
return [];
|
|
5118
4984
|
let a = { _id: generateUUID() };
|
|
5119
4985
|
if (n && (a._parent = n.block._id), r.type === "text")
|
|
5120
|
-
return isEmpty(get(r, "content", "")) ? [] : n && shouldAddText(n.node, n.block) ? (set(n, "block.content", get(r, "content", "")), []) : { ...a, _type: "Text", content: get(r, "content", "") };
|
|
4986
|
+
return isEmpty$1(get(r, "content", "")) ? [] : n && shouldAddText(n.node, n.block) ? (set(n, "block.content", get(r, "content", "")), []) : { ...a, _type: "Text", content: get(r, "content", "") };
|
|
5121
4987
|
const l = get(r, "attributes", []), i = l.find(
|
|
5122
|
-
(
|
|
4988
|
+
(b) => b.key === "data-chai-richtext" || b.key === "chai-richtext"
|
|
5123
4989
|
), c = l.find(
|
|
5124
|
-
(
|
|
4990
|
+
(b) => b.key === "data-chai-lightbox" || b.key === "chai-lightbox"
|
|
5125
4991
|
);
|
|
5126
4992
|
if (a = {
|
|
5127
4993
|
...a,
|
|
@@ -5129,13 +4995,13 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
5129
4995
|
...getAttrs(r),
|
|
5130
4996
|
...getStyles(r)
|
|
5131
4997
|
}, r.attributes) {
|
|
5132
|
-
const
|
|
5133
|
-
|
|
4998
|
+
const b = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
|
|
4999
|
+
b && (a._name = b.value);
|
|
5134
5000
|
}
|
|
5135
5001
|
if (i)
|
|
5136
5002
|
return a.content = stringify(r.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
|
|
5137
5003
|
if (c) {
|
|
5138
|
-
const
|
|
5004
|
+
const b = [
|
|
5139
5005
|
"data-chai-lightbox",
|
|
5140
5006
|
"chai-lightbox",
|
|
5141
5007
|
"data-vbtype",
|
|
@@ -5147,26 +5013,26 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
5147
5013
|
];
|
|
5148
5014
|
a = {
|
|
5149
5015
|
...a,
|
|
5150
|
-
href: ((u = l.find((
|
|
5151
|
-
hrefType: ((p = l.find((
|
|
5152
|
-
autoplay: ((m = l.find((
|
|
5153
|
-
maxWidth: ((g = (h = l.find((
|
|
5154
|
-
backdropColor: ((
|
|
5155
|
-
galleryName: ((
|
|
5156
|
-
}, forEach(
|
|
5157
|
-
has(a, `styles_attrs.${
|
|
5016
|
+
href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
|
|
5017
|
+
hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
|
|
5018
|
+
autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true" ? "true" : "false",
|
|
5019
|
+
maxWidth: ((g = (h = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : h.value) == null ? void 0 : g.replace("px", "")) || "",
|
|
5020
|
+
backdropColor: ((E = l.find((v) => v.key === "data-overlay")) == null ? void 0 : E.value) || "",
|
|
5021
|
+
galleryName: ((y = l.find((v) => v.key === "data-gall")) == null ? void 0 : y.value) || ""
|
|
5022
|
+
}, forEach(b, (v) => {
|
|
5023
|
+
has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
|
|
5158
5024
|
});
|
|
5159
5025
|
}
|
|
5160
5026
|
if (a._type === "Input") {
|
|
5161
|
-
const
|
|
5162
|
-
|
|
5027
|
+
const b = a.inputType || "text";
|
|
5028
|
+
b === "checkbox" ? set(a, "_type", "Checkbox") : b === "radio" && set(a, "_type", "Radio");
|
|
5163
5029
|
} else if (r.tagName === "video" || r.tagName === "iframe") {
|
|
5164
|
-
const
|
|
5165
|
-
return hasVideoEmbed(
|
|
5030
|
+
const b = stringify([r]);
|
|
5031
|
+
return hasVideoEmbed(b) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(b)), 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 = b, [a];
|
|
5166
5032
|
} else if (r.tagName === "svg") {
|
|
5167
|
-
const
|
|
5168
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${
|
|
5169
|
-
} else if (r.tagName == "option" && n && ((
|
|
5033
|
+
const b = find(r.attributes, { key: "height" }), v = find(r.attributes, { key: "width" }), C = get(b, "value") ? `[${get(b, "value")}px]` : "24px", w = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
5034
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${w} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
|
|
5035
|
+
} else if (r.tagName == "option" && n && ((f = n.block) == null ? void 0 : f._type) === "Select")
|
|
5170
5036
|
return n.block.options.push({
|
|
5171
5037
|
label: getTextContent(r.children),
|
|
5172
5038
|
...getAttrs(r)
|
|
@@ -5178,7 +5044,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
|
|
|
5178
5044
|
return (n && n.length > 0 ? n[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : o).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
|
|
5179
5045
|
}, getBlocksFromHTML = (o) => {
|
|
5180
5046
|
const n = parse(getSanitizedHTML(o));
|
|
5181
|
-
return isEmpty(o) ? [] : flatten(traverseNodes(n));
|
|
5047
|
+
return isEmpty$1(o) ? [] : flatten(traverseNodes(n));
|
|
5182
5048
|
}, ImportHTML = ({ parentId: o }) => {
|
|
5183
5049
|
const { t: n } = useTranslation(), [r, a] = useState(""), { addPredefinedBlock: l } = useAddBlock(), i = () => {
|
|
5184
5050
|
const c = getBlocksFromHTML(r);
|
|
@@ -5291,7 +5157,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5291
5157
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
5292
5158
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
5293
5159
|
c && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5294
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? i("Replace image") : i("Choose image") }) }),
|
|
5160
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty$1(o) ? i("Replace image") : i("Choose image") }) }),
|
|
5295
5161
|
/* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
|
|
5296
5162
|
] }),
|
|
5297
5163
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5352,43 +5218,43 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5352
5218
|
onChange: r
|
|
5353
5219
|
}) => {
|
|
5354
5220
|
var N;
|
|
5355
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (x, j) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, m] = useState("page"), [h, g] = useState(""), [
|
|
5221
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (x, j) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, m] = useState("page"), [h, g] = useState(""), [E, y] = useState([]), [f, b] = useState(-1), v = useRef(null), C = (N = n == null ? void 0 : n.find((x) => x.key === p)) == null ? void 0 : N.name;
|
|
5356
5222
|
useEffect(() => {
|
|
5357
|
-
if (g(""),
|
|
5223
|
+
if (g(""), y([]), b(-1), u(!1), !o || i || !startsWith(o, "collection:"))
|
|
5358
5224
|
return;
|
|
5359
5225
|
const x = split(o, ":"), j = get(x, 1, "page") || "page";
|
|
5360
5226
|
m(j), (async () => {
|
|
5361
|
-
const
|
|
5362
|
-
|
|
5227
|
+
const k = await l(j, [get(x, 2, "page")]);
|
|
5228
|
+
k && Array.isArray(k) && g(get(k, [0, "name"], ""));
|
|
5363
5229
|
})();
|
|
5364
5230
|
}, [o]);
|
|
5365
|
-
const
|
|
5231
|
+
const w = useDebouncedCallback(
|
|
5366
5232
|
async (x) => {
|
|
5367
|
-
if (isEmpty(x))
|
|
5368
|
-
|
|
5233
|
+
if (isEmpty$1(x))
|
|
5234
|
+
y([]);
|
|
5369
5235
|
else {
|
|
5370
5236
|
const j = await l(p, x);
|
|
5371
|
-
|
|
5237
|
+
y(j);
|
|
5372
5238
|
}
|
|
5373
|
-
c(!1),
|
|
5239
|
+
c(!1), b(-1);
|
|
5374
5240
|
},
|
|
5375
5241
|
[p],
|
|
5376
5242
|
300
|
|
5377
|
-
),
|
|
5243
|
+
), R = (x) => {
|
|
5378
5244
|
const j = ["collection", p, x.id];
|
|
5379
|
-
j[1] && (r(j.join(":")), g(x.name), u(!1),
|
|
5245
|
+
j[1] && (r(j.join(":")), g(x.name), u(!1), y([]), b(-1));
|
|
5380
5246
|
}, A = (x) => {
|
|
5381
5247
|
switch (x.key) {
|
|
5382
5248
|
case "ArrowDown":
|
|
5383
|
-
x.preventDefault(),
|
|
5249
|
+
x.preventDefault(), b((j) => j < E.length - 1 ? j + 1 : j);
|
|
5384
5250
|
break;
|
|
5385
5251
|
case "ArrowUp":
|
|
5386
|
-
x.preventDefault(),
|
|
5252
|
+
x.preventDefault(), b((j) => j > 0 ? j - 1 : j);
|
|
5387
5253
|
break;
|
|
5388
5254
|
case "Enter":
|
|
5389
|
-
if (x.preventDefault(),
|
|
5255
|
+
if (x.preventDefault(), E.length === 0)
|
|
5390
5256
|
return;
|
|
5391
|
-
|
|
5257
|
+
f >= 0 && R(E[f]);
|
|
5392
5258
|
break;
|
|
5393
5259
|
case "Escape":
|
|
5394
5260
|
x.preventDefault(), I();
|
|
@@ -5396,15 +5262,15 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5396
5262
|
}
|
|
5397
5263
|
};
|
|
5398
5264
|
useEffect(() => {
|
|
5399
|
-
if (
|
|
5400
|
-
const x =
|
|
5265
|
+
if (f >= 0 && v.current) {
|
|
5266
|
+
const x = v.current.children[f];
|
|
5401
5267
|
x == null || x.scrollIntoView({ block: "nearest" });
|
|
5402
5268
|
}
|
|
5403
|
-
}, [
|
|
5269
|
+
}, [f]);
|
|
5404
5270
|
const I = () => {
|
|
5405
|
-
g(""),
|
|
5271
|
+
g(""), y([]), b(-1), u(!1), r("");
|
|
5406
5272
|
}, T = (x) => {
|
|
5407
|
-
g(x), u(!isEmpty(x)), c(!0),
|
|
5273
|
+
g(x), u(!isEmpty$1(x)), c(!0), w(x);
|
|
5408
5274
|
};
|
|
5409
5275
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5410
5276
|
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: p, onChange: (x) => m(x.target.value), children: map(n, (x) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: x.key, children: x.name }, x.key)) }),
|
|
@@ -5416,25 +5282,25 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5416
5282
|
value: h,
|
|
5417
5283
|
onChange: (x) => T(x.target.value),
|
|
5418
5284
|
onKeyDown: A,
|
|
5419
|
-
placeholder: a(`Search ${
|
|
5285
|
+
placeholder: a(`Search ${C}`),
|
|
5420
5286
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
5421
5287
|
}
|
|
5422
5288
|
),
|
|
5423
5289
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: I, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
5424
5290
|
] }),
|
|
5425
|
-
(i || !isEmpty(
|
|
5291
|
+
(i || !isEmpty$1(E) || d && isEmpty$1(E)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
|
|
5426
5292
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
5427
5293
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
5428
|
-
] }) : d && isEmpty(
|
|
5294
|
+
] }) : d && isEmpty$1(E) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
5429
5295
|
a("No results found for"),
|
|
5430
5296
|
' "',
|
|
5431
5297
|
h,
|
|
5432
5298
|
'"'
|
|
5433
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref:
|
|
5299
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: v, children: map(E == null ? void 0 : E.slice(0, 20), (x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5434
5300
|
"li",
|
|
5435
5301
|
{
|
|
5436
|
-
onClick: () =>
|
|
5437
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(x.id) ? "bg-blue-200" : j ===
|
|
5302
|
+
onClick: () => R(x),
|
|
5303
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(x.id) ? "bg-blue-200" : j === f ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
5438
5304
|
children: [
|
|
5439
5305
|
x.name,
|
|
5440
5306
|
" ",
|
|
@@ -5449,13 +5315,13 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5449
5315
|
)) }) })
|
|
5450
5316
|
] });
|
|
5451
5317
|
}, LinkField = ({ schema: o, formData: n, onChange: r }) => {
|
|
5452
|
-
const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty(d) ? "url" : l;
|
|
5318
|
+
const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty$1(d) ? "url" : l;
|
|
5453
5319
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5454
5320
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
|
|
5455
5321
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
5456
5322
|
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (p) => r({ ...n, type: p.target.value }), children: map(
|
|
5457
5323
|
[
|
|
5458
|
-
...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
|
|
5324
|
+
...isEmpty$1(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
|
|
5459
5325
|
{ const: "url", title: a("Open URL") },
|
|
5460
5326
|
{ const: "email", title: a("Compose Email") },
|
|
5461
5327
|
{ const: "telephone", title: a("Call Phone") },
|
|
@@ -5463,7 +5329,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5463
5329
|
],
|
|
5464
5330
|
(p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)
|
|
5465
5331
|
) }),
|
|
5466
|
-
u === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5332
|
+
u === "collection" && !isEmpty$1(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5467
5333
|
CollectionField,
|
|
5468
5334
|
{
|
|
5469
5335
|
href: i,
|
|
@@ -5519,22 +5385,16 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5519
5385
|
),
|
|
5520
5386
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
|
|
5521
5387
|
] });
|
|
5522
|
-
}, JSONForm = memo(({ id: o,
|
|
5523
|
-
const [
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
}), useEffect(() => {
|
|
5531
|
-
i(r);
|
|
5532
|
-
}, [o, p]);
|
|
5533
|
-
const y = useThrottledCallback(
|
|
5534
|
-
async ({ formData: E }, b) => {
|
|
5535
|
-
a({ formData: E }, b);
|
|
5388
|
+
}, JSONForm = memo(({ id: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
|
|
5389
|
+
const [i, c] = useState(a), { selectedLang: d } = useLanguages();
|
|
5390
|
+
useEffect(() => {
|
|
5391
|
+
c(a);
|
|
5392
|
+
}, [o, d]);
|
|
5393
|
+
const u = useThrottledCallback(
|
|
5394
|
+
async ({ formData: p }, m) => {
|
|
5395
|
+
l({ formData: p }, m);
|
|
5536
5396
|
},
|
|
5537
|
-
[
|
|
5397
|
+
[l],
|
|
5538
5398
|
1e3
|
|
5539
5399
|
// save only every 5 seconds
|
|
5540
5400
|
);
|
|
@@ -5548,18 +5408,20 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5548
5408
|
image: ImagePickerField,
|
|
5549
5409
|
code: CodeEditor
|
|
5550
5410
|
},
|
|
5551
|
-
fields: {
|
|
5411
|
+
fields: {
|
|
5412
|
+
link: LinkField
|
|
5413
|
+
},
|
|
5552
5414
|
idSeparator: ".",
|
|
5553
5415
|
autoComplete: "off",
|
|
5554
5416
|
omitExtraData: !1,
|
|
5555
5417
|
liveOmit: !1,
|
|
5556
5418
|
liveValidate: !1,
|
|
5557
5419
|
validator,
|
|
5558
|
-
uiSchema:
|
|
5559
|
-
schema:
|
|
5560
|
-
formData:
|
|
5561
|
-
onChange: ({ formData:
|
|
5562
|
-
|
|
5420
|
+
uiSchema: r,
|
|
5421
|
+
schema: n,
|
|
5422
|
+
formData: i,
|
|
5423
|
+
onChange: ({ formData: p }, m) => {
|
|
5424
|
+
m && (c(p), u({ formData: p }, m));
|
|
5563
5425
|
}
|
|
5564
5426
|
}
|
|
5565
5427
|
);
|
|
@@ -5625,42 +5487,46 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5625
5487
|
}, formDataWithSelectedLang = (o, n, r) => {
|
|
5626
5488
|
const a = cloneDeep(o);
|
|
5627
5489
|
return forEach(keys(o), (l) => {
|
|
5628
|
-
get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
|
|
5490
|
+
get(r, ["props", l, "i18n"]) && !isEmpty$1(n) && (a[l] = get(o, `${l}-${n}`));
|
|
5629
5491
|
}), a;
|
|
5492
|
+
}, convertDotNotationToObject = (o, n) => {
|
|
5493
|
+
const r = {};
|
|
5494
|
+
return set(r, o, n), r;
|
|
5630
5495
|
};
|
|
5631
5496
|
function BlockSettings() {
|
|
5632
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l =
|
|
5497
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = ({ formData: y }, f, b) => {
|
|
5633
5498
|
if (f && (c == null ? void 0 : c._id) === n._id) {
|
|
5634
|
-
const
|
|
5635
|
-
a([n._id], { [
|
|
5499
|
+
const v = f.replace("root.", "");
|
|
5500
|
+
a([n._id], { [v]: get(y, v) }, b);
|
|
5636
5501
|
}
|
|
5637
|
-
},
|
|
5638
|
-
debounce(({ formData:
|
|
5639
|
-
|
|
5502
|
+
}, p = useCallback(
|
|
5503
|
+
debounce(({ formData: y }, f, b) => {
|
|
5504
|
+
u({ formData: y }, f, b), d(y);
|
|
5640
5505
|
}, 1500),
|
|
5641
5506
|
[n == null ? void 0 : n._id, o]
|
|
5642
|
-
),
|
|
5507
|
+
), m = ({ formData: y }, f) => {
|
|
5643
5508
|
if (f) {
|
|
5644
|
-
const
|
|
5509
|
+
const b = f.replace("root.", "");
|
|
5645
5510
|
r(
|
|
5646
5511
|
[n._id],
|
|
5647
|
-
convertDotNotationToObject(
|
|
5648
|
-
),
|
|
5512
|
+
convertDotNotationToObject(b, get(y, b.split(".")))
|
|
5513
|
+
), p({ formData: y }, f, { [b]: get(c, b) });
|
|
5649
5514
|
}
|
|
5650
|
-
}
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
}
|
|
5655
|
-
}, [
|
|
5515
|
+
};
|
|
5516
|
+
keys(get(i, "_bindings", {}));
|
|
5517
|
+
const { schema: h, uiSchema: g } = useMemo(() => {
|
|
5518
|
+
const y = n == null ? void 0 : n._type;
|
|
5519
|
+
return y ? getBlockFormSchemas(y) : { schema: {}, uiSchema: {} };
|
|
5520
|
+
}, [n]), E = get(l, "server", !1);
|
|
5656
5521
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
|
|
5657
|
-
isEmpty(
|
|
5522
|
+
isEmpty$1(h) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5658
5523
|
JSONForm,
|
|
5659
5524
|
{
|
|
5660
5525
|
id: n == null ? void 0 : n._id,
|
|
5661
|
-
onChange:
|
|
5526
|
+
onChange: m,
|
|
5662
5527
|
formData: i,
|
|
5663
|
-
|
|
5528
|
+
schema: h,
|
|
5529
|
+
uiSchema: g
|
|
5664
5530
|
}
|
|
5665
5531
|
),
|
|
5666
5532
|
(n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
@@ -5739,8 +5605,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5739
5605
|
(g = d.current) == null || g.focus();
|
|
5740
5606
|
}, []);
|
|
5741
5607
|
const h = (g) => {
|
|
5742
|
-
const { usage:
|
|
5743
|
-
!l &&
|
|
5608
|
+
const { usage: E } = g || {};
|
|
5609
|
+
!l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
5744
5610
|
};
|
|
5745
5611
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5746
5612
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
|
|
@@ -5751,8 +5617,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5751
5617
|
value: i,
|
|
5752
5618
|
onChange: (g) => c(g.target.value),
|
|
5753
5619
|
placeholder: n("Ask AI to edit styles"),
|
|
5754
|
-
className: "w-full border border-border
|
|
5755
|
-
rows:
|
|
5620
|
+
className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
|
|
5621
|
+
rows: 4,
|
|
5756
5622
|
onKeyDown: (g) => {
|
|
5757
5623
|
g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, h));
|
|
5758
5624
|
}
|
|
@@ -5796,24 +5662,24 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5796
5662
|
};
|
|
5797
5663
|
function ManualClasses() {
|
|
5798
5664
|
var I;
|
|
5799
|
-
const o = useFuseSearch(), { t: n } = useTranslation(), [r] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [u, p] = useState(""), { toast: m } = useToast(), h = (I = first(r)) == null ? void 0 : I.prop, g = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty),
|
|
5665
|
+
const o = useFuseSearch(), { t: n } = useTranslation(), [r] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [u, p] = useState(""), { toast: m } = useToast(), h = (I = first(r)) == null ? void 0 : I.prop, g = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty$1), E = () => {
|
|
5800
5666
|
const T = u.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5801
5667
|
l(c, T, !0), p("");
|
|
5802
|
-
}, [
|
|
5668
|
+
}, [y, f] = useState([]), b = ({ value: T }) => {
|
|
5803
5669
|
const N = T.trim().toLowerCase(), x = N.match(/.+:/g);
|
|
5804
5670
|
let j = [];
|
|
5805
5671
|
if (x && x.length > 0) {
|
|
5806
|
-
const [
|
|
5807
|
-
j = o.search(
|
|
5672
|
+
const [k] = x, S = N.replace(k, "");
|
|
5673
|
+
j = o.search(S).map((B) => ({
|
|
5808
5674
|
...B,
|
|
5809
|
-
item: { ...B.item, name:
|
|
5675
|
+
item: { ...B.item, name: k + B.item.name }
|
|
5810
5676
|
}));
|
|
5811
5677
|
} else
|
|
5812
5678
|
j = o.search(N);
|
|
5813
|
-
return
|
|
5814
|
-
},
|
|
5815
|
-
|
|
5816
|
-
},
|
|
5679
|
+
return f(map(j, "item"));
|
|
5680
|
+
}, v = () => {
|
|
5681
|
+
f([]);
|
|
5682
|
+
}, C = (T) => T.name, w = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), R = {
|
|
5817
5683
|
autoComplete: "off",
|
|
5818
5684
|
autoCorrect: "off",
|
|
5819
5685
|
autoCapitalize: "off",
|
|
@@ -5821,7 +5687,7 @@ function ManualClasses() {
|
|
|
5821
5687
|
placeholder: n("Enter classes separated by space"),
|
|
5822
5688
|
value: u,
|
|
5823
5689
|
onKeyDown: (T) => {
|
|
5824
|
-
T.key === "Enter" && u.trim() !== "" &&
|
|
5690
|
+
T.key === "Enter" && u.trim() !== "" && E();
|
|
5825
5691
|
},
|
|
5826
5692
|
onChange: (T, { newValue: N }) => p(N),
|
|
5827
5693
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -5842,7 +5708,7 @@ function ManualClasses() {
|
|
|
5842
5708
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5843
5709
|
"div",
|
|
5844
5710
|
{
|
|
5845
|
-
className: `flex ${
|
|
5711
|
+
className: `flex ${y.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
|
|
5846
5712
|
children: [
|
|
5847
5713
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
5848
5714
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
@@ -5864,12 +5730,12 @@ function ManualClasses() {
|
|
|
5864
5730
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5865
5731
|
Autosuggest,
|
|
5866
5732
|
{
|
|
5867
|
-
suggestions:
|
|
5868
|
-
onSuggestionsFetchRequested:
|
|
5869
|
-
onSuggestionsClearRequested:
|
|
5870
|
-
getSuggestionValue:
|
|
5871
|
-
renderSuggestion:
|
|
5872
|
-
inputProps:
|
|
5733
|
+
suggestions: y,
|
|
5734
|
+
onSuggestionsFetchRequested: b,
|
|
5735
|
+
onSuggestionsClearRequested: v,
|
|
5736
|
+
getSuggestionValue: C,
|
|
5737
|
+
renderSuggestion: w,
|
|
5738
|
+
inputProps: R,
|
|
5873
5739
|
containerProps: {
|
|
5874
5740
|
className: "relative h-8 w-full gap-y-1 py-1 border-border"
|
|
5875
5741
|
},
|
|
@@ -5885,7 +5751,7 @@ function ManualClasses() {
|
|
|
5885
5751
|
{
|
|
5886
5752
|
variant: "outline",
|
|
5887
5753
|
className: "h-6 border-border",
|
|
5888
|
-
onClick:
|
|
5754
|
+
onClick: E,
|
|
5889
5755
|
disabled: u.trim() === "",
|
|
5890
5756
|
size: "sm",
|
|
5891
5757
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -6301,8 +6167,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6301
6167
|
}, ColorChoice = ({ property: o, onChange: n }) => {
|
|
6302
6168
|
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", ""), h = get(p, "2", ""), g = useCallback(
|
|
6303
6169
|
// eslint-disable-next-line no-shadow
|
|
6304
|
-
(
|
|
6305
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6170
|
+
(f) => {
|
|
6171
|
+
["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: f, shade: b.shade ? b.shade : "500" })));
|
|
6306
6172
|
},
|
|
6307
6173
|
[c, u]
|
|
6308
6174
|
);
|
|
@@ -6311,21 +6177,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6311
6177
|
return c([]);
|
|
6312
6178
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6313
6179
|
}, [m]);
|
|
6314
|
-
const
|
|
6180
|
+
const E = useCallback(
|
|
6315
6181
|
// eslint-disable-next-line no-shadow
|
|
6316
|
-
(
|
|
6317
|
-
u({ color: m, shade:
|
|
6182
|
+
(f) => {
|
|
6183
|
+
u({ color: m, shade: f });
|
|
6318
6184
|
},
|
|
6319
6185
|
[m]
|
|
6320
6186
|
);
|
|
6321
6187
|
useEffect(() => {
|
|
6322
6188
|
u({ color: "", shade: "" });
|
|
6323
6189
|
}, [r]);
|
|
6324
|
-
const { match:
|
|
6190
|
+
const { match: y } = useTailwindClassList();
|
|
6325
6191
|
return useEffect(() => {
|
|
6326
|
-
const
|
|
6327
|
-
|
|
6328
|
-
}, [
|
|
6192
|
+
const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6193
|
+
y(o, b) && n(b, o);
|
|
6194
|
+
}, [y, 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: [
|
|
6329
6195
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6330
6196
|
DropDown,
|
|
6331
6197
|
{
|
|
@@ -6365,7 +6231,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6365
6231
|
]
|
|
6366
6232
|
}
|
|
6367
6233
|
) }),
|
|
6368
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !m || !l, onChange:
|
|
6234
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !m || !l, onChange: E, options: i }) })
|
|
6369
6235
|
] });
|
|
6370
6236
|
}, getUserInputValues = (o, n) => {
|
|
6371
6237
|
o = o.toLowerCase();
|
|
@@ -6374,7 +6240,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6374
6240
|
return { value: "", unit: r };
|
|
6375
6241
|
const a = n.length ? new RegExp(n.join("|"), "g") : /XXXXXX/g;
|
|
6376
6242
|
r = r.replace(a, "");
|
|
6377
|
-
const l = o.match(a), i = l && l.length > 1, c = !isEmpty(r) && Number.isNaN(Number(r));
|
|
6243
|
+
const l = o.match(a), i = l && l.length > 1, c = !isEmpty$1(r) && Number.isNaN(Number(r));
|
|
6378
6244
|
return i || c ? { error: "Invalid value" } : l && (l[0] === "auto" || l[0] === "none") ? { value: l[0], unit: "" } : { value: r, unit: l ? l[0] : "" };
|
|
6379
6245
|
}, getTwClassValue = (o) => {
|
|
6380
6246
|
const n = o.startsWith("-") ? "-" : "", r = o.split("-").pop();
|
|
@@ -6505,14 +6371,14 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6505
6371
|
}
|
|
6506
6372
|
return isNumber(parseFloat(r)) ? { value: `${n + parseFloat(r) * 4}`, unit: "px" } : { value: r, unit: "class" };
|
|
6507
6373
|
}, getClassValueAndUnit = (o) => {
|
|
6508
|
-
if (isEmpty(o))
|
|
6374
|
+
if (isEmpty$1(o))
|
|
6509
6375
|
return { value: "", unit: "" };
|
|
6510
6376
|
const n = o.match(/\[.*\]/g);
|
|
6511
6377
|
if (n === null)
|
|
6512
6378
|
return getValueAndUnitForTWClass(o);
|
|
6513
6379
|
const r = get(n, "0", "").replace(/\[|\]/g, ""), a = o.startsWith("-") ? "-" : "", l = first(r.match(/\d+.\d+|\d+/g));
|
|
6514
6380
|
return { value: `${a}${l}`, unit: r.replace(l, "") };
|
|
6515
|
-
}, getValueAndUnitForTWClass = (o) => isEmpty(o) ? { value: "", unit: "" } : getTwClassValue(o), BlockSettingsContext = React__default.createContext({
|
|
6381
|
+
}, getValueAndUnitForTWClass = (o) => isEmpty$1(o) ? { value: "", unit: "" } : getTwClassValue(o), BlockSettingsContext = React__default.createContext({
|
|
6516
6382
|
setDragData: () => {
|
|
6517
6383
|
}
|
|
6518
6384
|
}), DragStyleButton = ({
|
|
@@ -6560,30 +6426,30 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6560
6426
|
},
|
|
6561
6427
|
a
|
|
6562
6428
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6563
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [h, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [
|
|
6429
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [h, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, y] = useState(!1), [f, b] = useState(""), [v, C] = useState(!1), [w, R] = useState(!1);
|
|
6564
6430
|
useEffect(() => {
|
|
6565
6431
|
const { value: x, unit: j } = getClassValueAndUnit(i);
|
|
6566
6432
|
if (j === "") {
|
|
6567
6433
|
l(x), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
|
|
6568
6434
|
return;
|
|
6569
6435
|
}
|
|
6570
|
-
g(j), l(j === "class" || isEmpty(x) ? "" : x);
|
|
6436
|
+
g(j), l(j === "class" || isEmpty$1(x) ? "" : x);
|
|
6571
6437
|
}, [i, u, p]);
|
|
6572
6438
|
const A = useThrottledCallback((x) => c(x), [c], THROTTLE_TIME), I = useThrottledCallback((x) => c(x, !1), [c], THROTTLE_TIME), T = useCallback(
|
|
6573
6439
|
(x = !1) => {
|
|
6574
6440
|
const j = getUserInputValues(`${a}`, p);
|
|
6575
6441
|
if (get(j, "error", !1)) {
|
|
6576
|
-
|
|
6442
|
+
y(!0);
|
|
6577
6443
|
return;
|
|
6578
6444
|
}
|
|
6579
|
-
const
|
|
6580
|
-
if (
|
|
6581
|
-
A(`${d}${
|
|
6445
|
+
const k = get(j, "unit") !== "" ? get(j, "unit") : h;
|
|
6446
|
+
if (k === "auto" || k === "none") {
|
|
6447
|
+
A(`${d}${k}`);
|
|
6582
6448
|
return;
|
|
6583
6449
|
}
|
|
6584
6450
|
if (get(j, "value") === "")
|
|
6585
6451
|
return;
|
|
6586
|
-
const _ = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${
|
|
6452
|
+
const _ = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${k === "-" ? "" : k}]`;
|
|
6587
6453
|
x ? I(_) : A(_);
|
|
6588
6454
|
},
|
|
6589
6455
|
[A, I, a, h, d, p]
|
|
@@ -6591,7 +6457,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6591
6457
|
(x) => {
|
|
6592
6458
|
const j = getUserInputValues(`${a}`, p);
|
|
6593
6459
|
if (get(j, "error", !1)) {
|
|
6594
|
-
|
|
6460
|
+
y(!0);
|
|
6595
6461
|
return;
|
|
6596
6462
|
}
|
|
6597
6463
|
if (x === "auto" || x === "none") {
|
|
@@ -6600,7 +6466,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6600
6466
|
}
|
|
6601
6467
|
if (get(j, "value") === "")
|
|
6602
6468
|
return;
|
|
6603
|
-
const
|
|
6469
|
+
const k = get(j, "unit") !== "" ? get(j, "unit") : x, _ = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${k === "-" ? "" : k}]`;
|
|
6604
6470
|
A(_);
|
|
6605
6471
|
},
|
|
6606
6472
|
[A, a, d, p]
|
|
@@ -6611,7 +6477,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6611
6477
|
/* @__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, {}) }) }),
|
|
6612
6478
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6613
6479
|
] })
|
|
6614
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6480
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
|
|
6615
6481
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6616
6482
|
["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6617
6483
|
"input",
|
|
@@ -6623,28 +6489,28 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6623
6489
|
onKeyDown: (x) => {
|
|
6624
6490
|
if (x.keyCode !== 38 && x.keyCode !== 40)
|
|
6625
6491
|
return;
|
|
6626
|
-
x.preventDefault(),
|
|
6492
|
+
x.preventDefault(), R(!0);
|
|
6627
6493
|
const j = parseInt$1(x.target.value);
|
|
6628
|
-
let
|
|
6629
|
-
x.keyCode === 38 && (
|
|
6630
|
-
const
|
|
6494
|
+
let k = isNaN$1(j) ? 0 : j;
|
|
6495
|
+
x.keyCode === 38 && (k += 1), x.keyCode === 40 && (k -= 1);
|
|
6496
|
+
const S = `${k}`, B = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6631
6497
|
I(B);
|
|
6632
6498
|
},
|
|
6633
6499
|
onKeyUp: (x) => {
|
|
6634
|
-
|
|
6500
|
+
w && (x.preventDefault(), R(!1));
|
|
6635
6501
|
},
|
|
6636
6502
|
onBlur: () => T(),
|
|
6637
6503
|
onChange: (x) => {
|
|
6638
|
-
|
|
6504
|
+
y(!1), l(x.target.value);
|
|
6639
6505
|
},
|
|
6640
6506
|
onClick: (x) => {
|
|
6641
6507
|
var j;
|
|
6642
6508
|
(j = x == null ? void 0 : x.target) == null || j.select(), r(!1);
|
|
6643
6509
|
},
|
|
6644
|
-
value:
|
|
6510
|
+
value: v ? f : a,
|
|
6645
6511
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6646
6512
|
" ",
|
|
6647
|
-
|
|
6513
|
+
E ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
6648
6514
|
)
|
|
6649
6515
|
}
|
|
6650
6516
|
),
|
|
@@ -6673,22 +6539,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6673
6539
|
) }) })
|
|
6674
6540
|
] })
|
|
6675
6541
|
] }),
|
|
6676
|
-
["none", "auto"].indexOf(h) !== -1 ||
|
|
6542
|
+
["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6677
6543
|
DragStyleButton,
|
|
6678
6544
|
{
|
|
6679
|
-
onDragStart: () =>
|
|
6545
|
+
onDragStart: () => C(!0),
|
|
6680
6546
|
onDragEnd: (x) => {
|
|
6681
|
-
if (
|
|
6547
|
+
if (b(() => ""), C(!1), isEmpty$1(x))
|
|
6682
6548
|
return;
|
|
6683
|
-
const j = `${x}`,
|
|
6684
|
-
A(
|
|
6549
|
+
const j = `${x}`, S = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6550
|
+
A(S);
|
|
6685
6551
|
},
|
|
6686
6552
|
onDrag: (x) => {
|
|
6687
|
-
if (isEmpty(x))
|
|
6553
|
+
if (isEmpty$1(x))
|
|
6688
6554
|
return;
|
|
6689
|
-
|
|
6690
|
-
const j = `${x}`,
|
|
6691
|
-
I(
|
|
6555
|
+
b(x);
|
|
6556
|
+
const j = `${x}`, S = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6557
|
+
I(S);
|
|
6692
6558
|
},
|
|
6693
6559
|
currentValue: a,
|
|
6694
6560
|
unit: h,
|
|
@@ -6785,23 +6651,23 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6785
6651
|
"2xl": "1536px"
|
|
6786
6652
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6787
6653
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6788
|
-
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), h = useCurrentClassByProperty(l), g = useAddClassesToBlocks(),
|
|
6654
|
+
}, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), h = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [y] = useSelectedBlockIds(), f = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
|
|
6789
6655
|
(I, T = !0) => {
|
|
6790
6656
|
const N = { dark: u, mq: m, mod: p, cls: I, property: l, fullCls: "" };
|
|
6791
6657
|
(u || p !== "") && (N.mq = "xs");
|
|
6792
6658
|
const x = generateFullClsName(N);
|
|
6793
|
-
g(
|
|
6659
|
+
g(y, [x], T);
|
|
6794
6660
|
},
|
|
6795
|
-
[
|
|
6796
|
-
),
|
|
6797
|
-
y
|
|
6798
|
-
}, [
|
|
6661
|
+
[y, u, m, p, l, g]
|
|
6662
|
+
), v = useCallback(() => {
|
|
6663
|
+
E(y, [f]);
|
|
6664
|
+
}, [y, f, E]), C = useMemo(() => canChangeClass(h, m), [h, m]);
|
|
6799
6665
|
useEffect(() => {
|
|
6800
|
-
i(
|
|
6801
|
-
}, [
|
|
6802
|
-
const [, ,
|
|
6666
|
+
i(C, h);
|
|
6667
|
+
}, [C, i, h]);
|
|
6668
|
+
const [, , w] = useCanvasWidth(), R = useCallback(
|
|
6803
6669
|
(I) => {
|
|
6804
|
-
|
|
6670
|
+
w({
|
|
6805
6671
|
xs: 400,
|
|
6806
6672
|
sm: 640,
|
|
6807
6673
|
md: 800,
|
|
@@ -6810,9 +6676,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6810
6676
|
"2xl": 1920
|
|
6811
6677
|
}[I]);
|
|
6812
6678
|
},
|
|
6813
|
-
[
|
|
6679
|
+
[w]
|
|
6814
6680
|
), A = get(h, "dark", null) === u && get(h, "mod", null) === p && get(h, "mq", null) === m;
|
|
6815
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6681
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: h && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6816
6682
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !A ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6817
6683
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6818
6684
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6822,17 +6688,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6822
6688
|
currentClass: get(h, "cls", ""),
|
|
6823
6689
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6824
6690
|
units: c || [],
|
|
6825
|
-
onChange:
|
|
6691
|
+
onChange: b,
|
|
6826
6692
|
negative: d,
|
|
6827
6693
|
cssProperty: l
|
|
6828
6694
|
}
|
|
6829
6695
|
) : null,
|
|
6830
|
-
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6831
|
-
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6832
|
-
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6833
|
-
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6696
|
+
r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: b }),
|
|
6697
|
+
r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: b }),
|
|
6698
|
+
r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: b }),
|
|
6699
|
+
r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6834
6700
|
] }),
|
|
6835
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6701
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && h ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6836
6702
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6837
6703
|
"button",
|
|
6838
6704
|
{
|
|
@@ -6852,7 +6718,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6852
6718
|
"button",
|
|
6853
6719
|
{
|
|
6854
6720
|
type: "button",
|
|
6855
|
-
onClick: () =>
|
|
6721
|
+
onClick: () => R(get(h, "mq")),
|
|
6856
6722
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6857
6723
|
children: [
|
|
6858
6724
|
"Switch to ",
|
|
@@ -6882,18 +6748,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6882
6748
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6883
6749
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6884
6750
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6885
|
-
n.map(({ label: g, key:
|
|
6751
|
+
n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6886
6752
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6887
6753
|
"button",
|
|
6888
6754
|
{
|
|
6889
6755
|
type: "button",
|
|
6890
|
-
onClick: () => p(
|
|
6891
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6756
|
+
onClick: () => p(E),
|
|
6757
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6892
6758
|
children: [
|
|
6893
6759
|
React__default.createElement("div", {
|
|
6894
|
-
className: h(
|
|
6760
|
+
className: h(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6895
6761
|
}),
|
|
6896
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6762
|
+
React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6897
6763
|
]
|
|
6898
6764
|
}
|
|
6899
6765
|
) }),
|
|
@@ -6935,63 +6801,55 @@ const RangeChoices = ({ property: o, onChange: n }) => {
|
|
|
6935
6801
|
] }) }),
|
|
6936
6802
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2", children: n.map((i) => i.styleType === "multiple" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultipleChoices, { ...i }, i.label) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyle, { ...i }, i.label)) })
|
|
6937
6803
|
] });
|
|
6938
|
-
}, SectionContext = createContext({}), StylingGroup = ({ section: o }) => {
|
|
6939
|
-
const { t:
|
|
6940
|
-
(
|
|
6941
|
-
const
|
|
6942
|
-
for (let
|
|
6943
|
-
|
|
6944
|
-
let
|
|
6945
|
-
for (const
|
|
6946
|
-
if (!has(
|
|
6947
|
-
|
|
6804
|
+
}, SectionContext = createContext({}), StylingGroup = ({ section: o, showAccordian: n }) => {
|
|
6805
|
+
const { t: r } = useTranslation(), a = useSelectedBlockCurrentClasses(), l = useCallback(
|
|
6806
|
+
(c = []) => {
|
|
6807
|
+
const d = {};
|
|
6808
|
+
for (let p = 0; p < a.length; p++)
|
|
6809
|
+
d[a[p].property] = a[p].cls;
|
|
6810
|
+
let u = !0;
|
|
6811
|
+
for (const p in c)
|
|
6812
|
+
if (!has(d, p) || d[p] !== c[p]) {
|
|
6813
|
+
u = !1;
|
|
6948
6814
|
break;
|
|
6949
6815
|
}
|
|
6950
|
-
return
|
|
6816
|
+
return u;
|
|
6951
6817
|
},
|
|
6952
|
-
[
|
|
6953
|
-
),
|
|
6954
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SectionContext.Provider, { value:
|
|
6955
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "border-
|
|
6818
|
+
[a]
|
|
6819
|
+
), i = useMemo(() => ({}), []);
|
|
6820
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SectionContext.Provider, { value: i, children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: o.heading, className: "border-none", children: [
|
|
6821
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "border-slate-150 border-t py-2 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-x-2 text-xs font-medium", children: startCase$1(r(o.heading)) }) }) }),
|
|
6956
6822
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "py-2", children: React__default.Children.toArray(
|
|
6957
|
-
o.items.map((
|
|
6823
|
+
o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsxRuntimeExports.jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyle, { ...c }, c.label))
|
|
6958
6824
|
) })
|
|
6959
|
-
] })
|
|
6825
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-2", children: React__default.Children.toArray(
|
|
6826
|
+
o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultipleChoices, { ...c }, c.label) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsxRuntimeExports.jsx(NestedOptions, { ...c }, c.label) : null : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyle, { ...c }, c.label))
|
|
6827
|
+
) }) });
|
|
6960
6828
|
}, StylingHelpers = () => {
|
|
6961
|
-
const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a =
|
|
6962
|
-
if (
|
|
6829
|
+
const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a = useAddClassesToBlocks(), l = getRegisteredChaiBlock(o._type), i = get(first(n), "prop"), c = get(l.props, `${i}.presets`, {});
|
|
6830
|
+
if (!has(l, "props") || isEmpty$1(c))
|
|
6963
6831
|
return null;
|
|
6964
|
-
const
|
|
6965
|
-
const
|
|
6966
|
-
|
|
6832
|
+
const d = (u) => {
|
|
6833
|
+
const p = u.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6834
|
+
a([o._id], p, !0);
|
|
6967
6835
|
};
|
|
6968
6836
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
6969
6837
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
|
|
6970
6838
|
r("Apply Presets"),
|
|
6971
6839
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretDownIcon, {})
|
|
6972
6840
|
] }) }) }),
|
|
6973
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { className: "max-h-80 w-56", children: /* @__PURE__ */ jsxRuntimeExports.
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
r("presets")
|
|
6979
|
-
] }),
|
|
6980
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
6981
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(d[p]), children: [
|
|
6982
|
-
capitalize(startCase$1(r(p))),
|
|
6983
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
|
|
6984
|
-
] })) })
|
|
6841
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { className: "max-h-80 w-56", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "no-scrollbar h-full", children: isEmpty$1(c) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6842
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuLabel, { children: [
|
|
6843
|
+
l.type,
|
|
6844
|
+
" ",
|
|
6845
|
+
r("presets")
|
|
6985
6846
|
] }),
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
] })) })
|
|
6993
|
-
] })
|
|
6994
|
-
] }) })
|
|
6847
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
|
|
6848
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(c).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => d(c[u]), children: [
|
|
6849
|
+
capitalize(startCase$1(r(u))),
|
|
6850
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
|
|
6851
|
+
] })) })
|
|
6852
|
+
] }) }) })
|
|
6995
6853
|
] }) });
|
|
6996
6854
|
}, MAPPER = {
|
|
6997
6855
|
px: 1,
|
|
@@ -7020,10 +6878,10 @@ function BlockStyling() {
|
|
|
7020
6878
|
const m = !get(i, "negative", !1), h = get(i, "cssProperty", "");
|
|
7021
6879
|
let g = parseFloat(i.dragStartValue);
|
|
7022
6880
|
g = isNaN(g) ? 0 : g;
|
|
7023
|
-
let
|
|
7024
|
-
(startsWith(h, "scale") || h === "opacity") && (
|
|
7025
|
-
let
|
|
7026
|
-
m &&
|
|
6881
|
+
let E = MAPPER[i.dragUnit];
|
|
6882
|
+
(startsWith(h, "scale") || h === "opacity") && (E = 10);
|
|
6883
|
+
let f = (i.dragStartY - p.pageY) / E + g;
|
|
6884
|
+
m && f < 0 && (f = 0), h === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
|
|
7027
6885
|
},
|
|
7028
6886
|
[i],
|
|
7029
6887
|
50
|
|
@@ -7039,7 +6897,7 @@ function BlockStyling() {
|
|
|
7039
6897
|
cssProperty: ""
|
|
7040
6898
|
});
|
|
7041
6899
|
}, [i, a, c]);
|
|
7042
|
-
return isEmpty(r) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(BlockSettingsContext.Provider, { value: { setDragData: c }, children: [
|
|
6900
|
+
return isEmpty$1(r) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(BlockSettingsContext.Provider, { value: { setDragData: c }, children: [
|
|
7043
6901
|
i.dragging ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7044
6902
|
"div",
|
|
7045
6903
|
{
|
|
@@ -7051,9 +6909,9 @@ function BlockStyling() {
|
|
|
7051
6909
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
|
|
7052
6910
|
/* @__PURE__ */ jsxRuntimeExports.jsx(StylingHelpers, {}),
|
|
7053
6911
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
|
|
7054
|
-
o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION }),
|
|
7055
|
-
n
|
|
7056
|
-
SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p }, p.heading))
|
|
6912
|
+
o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION, showAccordian: o || n }),
|
|
6913
|
+
n && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: GRID_CHILD_SECTION, showAccordian: o || n }),
|
|
6914
|
+
SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p, showAccordian: o || n }, p.heading))
|
|
7057
6915
|
] })
|
|
7058
6916
|
] })
|
|
7059
6917
|
] });
|
|
@@ -7109,33 +6967,33 @@ const BlockCard = ({
|
|
|
7109
6967
|
library: n,
|
|
7110
6968
|
parentId: r = void 0
|
|
7111
6969
|
}) => {
|
|
7112
|
-
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")), h = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom),
|
|
7113
|
-
const
|
|
7114
|
-
return
|
|
7115
|
-
},
|
|
7116
|
-
async (
|
|
7117
|
-
if (
|
|
6970
|
+
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")), h = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (b) => {
|
|
6971
|
+
const v = has(b, "styles_attrs.data-page-section");
|
|
6972
|
+
return b._type === "Box" && v;
|
|
6973
|
+
}, y = useCallback(
|
|
6974
|
+
async (b) => {
|
|
6975
|
+
if (b.stopPropagation(), has(o, "component")) {
|
|
7118
6976
|
c(o, r), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7119
6977
|
return;
|
|
7120
6978
|
}
|
|
7121
6979
|
l(!0);
|
|
7122
|
-
const
|
|
7123
|
-
isEmpty(
|
|
6980
|
+
const v = await i(n, o);
|
|
6981
|
+
isEmpty$1(v) || d(syncBlocksWithDefaults(v), r), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7124
6982
|
},
|
|
7125
|
-
[o]
|
|
7126
|
-
),
|
|
7127
|
-
const
|
|
7128
|
-
let
|
|
7129
|
-
if (
|
|
7130
|
-
const
|
|
7131
|
-
if (
|
|
7132
|
-
const
|
|
7133
|
-
|
|
7134
|
-
|
|
6983
|
+
[c, d, o, i, n, r]
|
|
6984
|
+
), f = async (b) => {
|
|
6985
|
+
const v = await i(n, o);
|
|
6986
|
+
let C = r;
|
|
6987
|
+
if (E(first(v)) && (C = null), !isEmpty$1(v)) {
|
|
6988
|
+
const w = { blocks: v, uiLibrary: !0, parent: C };
|
|
6989
|
+
if (b.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
6990
|
+
const R = new Image();
|
|
6991
|
+
R.src = o.preview, R.onload = () => {
|
|
6992
|
+
b.dataTransfer.setDragImage(R, 0, 0);
|
|
7135
6993
|
};
|
|
7136
6994
|
} else
|
|
7137
|
-
|
|
7138
|
-
g(
|
|
6995
|
+
b.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6996
|
+
g(w), setTimeout(() => {
|
|
7139
6997
|
u([]), p(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7140
6998
|
}, 200);
|
|
7141
6999
|
}
|
|
@@ -7145,9 +7003,9 @@ const BlockCard = ({
|
|
|
7145
7003
|
"div",
|
|
7146
7004
|
{
|
|
7147
7005
|
onClick: a ? () => {
|
|
7148
|
-
} :
|
|
7006
|
+
} : y,
|
|
7149
7007
|
draggable: h ? "true" : "false",
|
|
7150
|
-
onDragStart:
|
|
7008
|
+
onDragStart: f,
|
|
7151
7009
|
className: clsx(
|
|
7152
7010
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
7153
7011
|
),
|
|
@@ -7174,11 +7032,11 @@ const BlockCard = ({
|
|
|
7174
7032
|
const d = await a(o);
|
|
7175
7033
|
c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
|
|
7176
7034
|
})();
|
|
7177
|
-
}, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
|
|
7035
|
+
}, [o, l, i, c, r, a]), { data: l || [], isLoading: i === "loading" };
|
|
7178
7036
|
}, UILibrarySection = ({ parentId: o }) => {
|
|
7179
|
-
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l =
|
|
7180
|
-
|
|
7181
|
-
|
|
7037
|
+
const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useRegisteredChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, h] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: y } = useTranslation(), f = (C) => {
|
|
7038
|
+
E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
|
|
7039
|
+
E.current && h(C);
|
|
7182
7040
|
}, 300);
|
|
7183
7041
|
};
|
|
7184
7042
|
if (u)
|
|
@@ -7186,30 +7044,30 @@ const BlockCard = ({
|
|
|
7186
7044
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7187
7045
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7188
7046
|
] });
|
|
7189
|
-
const
|
|
7047
|
+
const b = filter(g, (C, w) => w % 2 === 0), v = filter(g, (C, w) => w % 2 === 1);
|
|
7190
7048
|
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: [
|
|
7191
7049
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7192
7050
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
|
|
7193
7051
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7194
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7052
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: y("Groups") }),
|
|
7195
7053
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7196
7054
|
/* @__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(
|
|
7197
|
-
map(p, (
|
|
7055
|
+
map(p, (C, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7198
7056
|
"div",
|
|
7199
7057
|
{
|
|
7200
|
-
onMouseEnter: () =>
|
|
7201
|
-
onMouseLeave: () => clearTimeout(
|
|
7202
|
-
onClick: () => h(
|
|
7058
|
+
onMouseEnter: () => f(w),
|
|
7059
|
+
onMouseLeave: () => clearTimeout(E.current),
|
|
7060
|
+
onClick: () => h(w),
|
|
7203
7061
|
className: cn(
|
|
7204
7062
|
"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",
|
|
7205
|
-
|
|
7063
|
+
w === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7206
7064
|
),
|
|
7207
7065
|
children: [
|
|
7208
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7066
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(y(w.toLowerCase())) }),
|
|
7209
7067
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7210
7068
|
]
|
|
7211
7069
|
},
|
|
7212
|
-
|
|
7070
|
+
w
|
|
7213
7071
|
))
|
|
7214
7072
|
) })
|
|
7215
7073
|
] })
|
|
@@ -7217,15 +7075,15 @@ const BlockCard = ({
|
|
|
7217
7075
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7218
7076
|
ScrollArea,
|
|
7219
7077
|
{
|
|
7220
|
-
onMouseEnter: () =>
|
|
7078
|
+
onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
|
|
7221
7079
|
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",
|
|
7222
7080
|
children: [
|
|
7223
7081
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7224
7082
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7225
|
-
|
|
7083
|
+
b.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
|
|
7226
7084
|
) }),
|
|
7227
7085
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7228
|
-
|
|
7086
|
+
v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
|
|
7229
7087
|
) })
|
|
7230
7088
|
] }),
|
|
7231
7089
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7731,12 +7589,12 @@ i18n.use(initReactI18next).init({
|
|
|
7731
7589
|
const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
7732
7590
|
const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), h = () => {
|
|
7733
7591
|
if (has(o, "blocks")) {
|
|
7734
|
-
const
|
|
7735
|
-
u(syncBlocksWithDefaults(
|
|
7592
|
+
const y = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7593
|
+
u(syncBlocksWithDefaults(y), r || null);
|
|
7736
7594
|
} else
|
|
7737
7595
|
d(o, r || null);
|
|
7738
7596
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7739
|
-
}, g = useFeature("dnd"), { t:
|
|
7597
|
+
}, g = useFeature("dnd"), { t: E } = useTranslation();
|
|
7740
7598
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7741
7599
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7742
7600
|
"button",
|
|
@@ -7744,8 +7602,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7744
7602
|
disabled: n,
|
|
7745
7603
|
onClick: h,
|
|
7746
7604
|
type: "button",
|
|
7747
|
-
onDragStart: (
|
|
7748
|
-
|
|
7605
|
+
onDragStart: (y) => {
|
|
7606
|
+
y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7749
7607
|
p([]), m();
|
|
7750
7608
|
}, 200);
|
|
7751
7609
|
},
|
|
@@ -7753,14 +7611,14 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
|
|
|
7753
7611
|
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",
|
|
7754
7612
|
children: [
|
|
7755
7613
|
createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
7756
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
7614
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
|
|
7757
7615
|
]
|
|
7758
7616
|
}
|
|
7759
7617
|
) }),
|
|
7760
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7618
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
|
|
7761
7619
|
] }) });
|
|
7762
7620
|
}, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
|
|
7763
|
-
const r =
|
|
7621
|
+
const r = useRegisteredChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
|
|
7764
7622
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: o, groups: c, blocks: i.core });
|
|
7765
7623
|
}, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, gridCols: a = "grid-cols-4" }) => {
|
|
7766
7624
|
var d;
|
|
@@ -7925,19 +7783,19 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7925
7783
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7926
7784
|
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), h = useRef(null), g = useRef(null);
|
|
7927
7785
|
useEffect(() => {
|
|
7928
|
-
var
|
|
7929
|
-
(
|
|
7786
|
+
var y;
|
|
7787
|
+
(y = h.current) == null || y.focus();
|
|
7930
7788
|
}, []);
|
|
7931
|
-
const
|
|
7932
|
-
const { usage:
|
|
7933
|
-
!l &&
|
|
7789
|
+
const E = (y) => {
|
|
7790
|
+
const { usage: f } = y || {};
|
|
7791
|
+
!l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
|
|
7934
7792
|
};
|
|
7935
7793
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7936
7794
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7937
7795
|
"div",
|
|
7938
7796
|
{
|
|
7939
7797
|
onClick: () => u(!d),
|
|
7940
|
-
className: "flex cursor-pointer items-center justify-between border-
|
|
7798
|
+
className: "flex cursor-pointer items-center justify-between border-t border-border py-2 text-sm font-medium hover:underline",
|
|
7941
7799
|
children: [
|
|
7942
7800
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Ask AI") }),
|
|
7943
7801
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4 text-gray-500 " + (d ? "rotate-180" : "") }) })
|
|
@@ -7950,12 +7808,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7950
7808
|
{
|
|
7951
7809
|
ref: h,
|
|
7952
7810
|
value: i,
|
|
7953
|
-
onChange: (
|
|
7811
|
+
onChange: (y) => c(y.target.value),
|
|
7954
7812
|
placeholder: n("Ask AI to edit content"),
|
|
7955
7813
|
className: "w-full",
|
|
7956
7814
|
rows: 3,
|
|
7957
|
-
onKeyDown: (
|
|
7958
|
-
|
|
7815
|
+
onKeyDown: (y) => {
|
|
7816
|
+
y.key === "Enter" && (y.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
|
|
7959
7817
|
}
|
|
7960
7818
|
}
|
|
7961
7819
|
),
|
|
@@ -7965,7 +7823,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7965
7823
|
{
|
|
7966
7824
|
disabled: i.trim().length < 5 || a,
|
|
7967
7825
|
onClick: () => {
|
|
7968
|
-
g.current && clearTimeout(g.current), m(void 0), r("content", o, i,
|
|
7826
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
|
|
7969
7827
|
},
|
|
7970
7828
|
variant: "default",
|
|
7971
7829
|
className: "w-fit",
|
|
@@ -7997,8 +7855,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7997
7855
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7998
7856
|
QuickPrompts,
|
|
7999
7857
|
{
|
|
8000
|
-
onClick: (
|
|
8001
|
-
g.current && clearTimeout(g.current), m(void 0), r("content", o,
|
|
7858
|
+
onClick: (y) => {
|
|
7859
|
+
g.current && clearTimeout(g.current), m(void 0), r("content", o, y, E);
|
|
8002
7860
|
}
|
|
8003
7861
|
}
|
|
8004
7862
|
)
|
|
@@ -8012,15 +7870,15 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8012
7870
|
useEffect(() => {
|
|
8013
7871
|
n && a(n);
|
|
8014
7872
|
}, [n]);
|
|
8015
|
-
const
|
|
7873
|
+
const E = async () => {
|
|
8016
7874
|
try {
|
|
8017
7875
|
d(!0), p(null), await i(r), h({
|
|
8018
7876
|
title: o("Updated AI Context"),
|
|
8019
7877
|
description: o("You can now Ask AI to edit your content"),
|
|
8020
7878
|
variant: "default"
|
|
8021
7879
|
}), g.current.click();
|
|
8022
|
-
} catch (
|
|
8023
|
-
p(
|
|
7880
|
+
} catch (y) {
|
|
7881
|
+
p(y);
|
|
8024
7882
|
} finally {
|
|
8025
7883
|
d(!1);
|
|
8026
7884
|
}
|
|
@@ -8028,25 +7886,25 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8028
7886
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8029
7887
|
Accordion,
|
|
8030
7888
|
{
|
|
8031
|
-
onValueChange: (
|
|
8032
|
-
m(
|
|
7889
|
+
onValueChange: (y) => {
|
|
7890
|
+
m(y !== "");
|
|
8033
7891
|
},
|
|
8034
7892
|
type: "single",
|
|
8035
7893
|
collapsible: !0,
|
|
8036
7894
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
8037
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-
|
|
7895
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
|
|
8038
7896
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
8039
7897
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8040
7898
|
Textarea,
|
|
8041
7899
|
{
|
|
8042
7900
|
ref: l,
|
|
8043
7901
|
value: r,
|
|
8044
|
-
onChange: (
|
|
7902
|
+
onChange: (y) => a(y.target.value),
|
|
8045
7903
|
placeholder: o("Tell about this page eg this page is about"),
|
|
8046
7904
|
className: "mt-1 w-full",
|
|
8047
7905
|
rows: 10,
|
|
8048
|
-
onKeyDown: (
|
|
8049
|
-
|
|
7906
|
+
onKeyDown: (y) => {
|
|
7907
|
+
y.key === "Enter" && (y.preventDefault(), E());
|
|
8050
7908
|
}
|
|
8051
7909
|
}
|
|
8052
7910
|
),
|
|
@@ -8058,7 +7916,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8058
7916
|
Button,
|
|
8059
7917
|
{
|
|
8060
7918
|
disabled: r.trim().length < 5,
|
|
8061
|
-
onClick: () =>
|
|
7919
|
+
onClick: () => E(),
|
|
8062
7920
|
variant: "default",
|
|
8063
7921
|
className: "w-fit",
|
|
8064
7922
|
size: "sm",
|
|
@@ -8087,7 +7945,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8087
7945
|
AlertDialogAction,
|
|
8088
7946
|
{
|
|
8089
7947
|
onClick: () => {
|
|
8090
|
-
a(""),
|
|
7948
|
+
a(""), E();
|
|
8091
7949
|
},
|
|
8092
7950
|
children: o("Yes, Delete")
|
|
8093
7951
|
}
|
|
@@ -8103,53 +7961,53 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8103
7961
|
);
|
|
8104
7962
|
}, AskAI = () => {
|
|
8105
7963
|
const [o] = useSelectedBlockIds();
|
|
8106
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
|
|
7964
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar mt-2 flex-1 overflow-y-auto", children: [
|
|
8107
7965
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AISetContext, {}),
|
|
8108
7966
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
8109
7967
|
] });
|
|
8110
7968
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
|
|
8111
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [h, g] = useState(""),
|
|
7969
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [h, g] = useState(""), E = useRef(null), y = useRef(null);
|
|
8112
7970
|
useEffect(() => {
|
|
8113
7971
|
l(n);
|
|
8114
7972
|
}, [n]);
|
|
8115
|
-
const
|
|
7973
|
+
const f = () => {
|
|
8116
7974
|
if (i.startsWith("@")) {
|
|
8117
7975
|
g("Attribute keys cannot start with '@'");
|
|
8118
7976
|
return;
|
|
8119
7977
|
}
|
|
8120
7978
|
if (i) {
|
|
8121
|
-
const
|
|
8122
|
-
r(
|
|
7979
|
+
const R = [...a, { key: i, value: d }];
|
|
7980
|
+
r(R), l(a), c(""), u(""), g("");
|
|
8123
7981
|
}
|
|
8124
|
-
},
|
|
8125
|
-
const A = a.filter((I, T) => T !==
|
|
7982
|
+
}, b = (R) => {
|
|
7983
|
+
const A = a.filter((I, T) => T !== R);
|
|
8126
7984
|
r(A), l(A);
|
|
8127
|
-
},
|
|
8128
|
-
m(
|
|
8129
|
-
},
|
|
7985
|
+
}, v = (R) => {
|
|
7986
|
+
m(R), c(a[R].key), u(a[R].value);
|
|
7987
|
+
}, C = () => {
|
|
8130
7988
|
if (i.startsWith("@")) {
|
|
8131
7989
|
g("Attribute keys cannot start with '@'");
|
|
8132
7990
|
return;
|
|
8133
7991
|
}
|
|
8134
7992
|
if (p !== null && i) {
|
|
8135
|
-
const
|
|
8136
|
-
|
|
7993
|
+
const R = [...a];
|
|
7994
|
+
R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), g("");
|
|
8137
7995
|
}
|
|
8138
|
-
},
|
|
8139
|
-
|
|
7996
|
+
}, w = (R) => {
|
|
7997
|
+
R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? C() : f());
|
|
8140
7998
|
};
|
|
8141
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-
|
|
7999
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
8142
8000
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8143
8001
|
"form",
|
|
8144
8002
|
{
|
|
8145
|
-
onSubmit: (
|
|
8146
|
-
|
|
8003
|
+
onSubmit: (R) => {
|
|
8004
|
+
R.preventDefault(), p !== null ? C() : f();
|
|
8147
8005
|
},
|
|
8148
8006
|
className: "space-y-3",
|
|
8149
8007
|
children: [
|
|
8150
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
|
|
8008
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1", children: [
|
|
8151
8009
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
8152
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "attrKey", className: "text-
|
|
8010
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "attrKey", className: "text-[11px] font-normal leading-tight text-slate-600", children: "Key" }),
|
|
8153
8011
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8154
8012
|
Input$1,
|
|
8155
8013
|
{
|
|
@@ -8157,16 +8015,16 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8157
8015
|
autoCorrect: "off",
|
|
8158
8016
|
spellCheck: "false",
|
|
8159
8017
|
id: "attrKey",
|
|
8160
|
-
ref:
|
|
8018
|
+
ref: E,
|
|
8161
8019
|
value: i,
|
|
8162
|
-
onChange: (
|
|
8163
|
-
placeholder: "Key",
|
|
8164
|
-
className: "
|
|
8020
|
+
onChange: (R) => c(R.target.value),
|
|
8021
|
+
placeholder: "Enter Key",
|
|
8022
|
+
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
8165
8023
|
}
|
|
8166
8024
|
)
|
|
8167
8025
|
] }),
|
|
8168
8026
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
8169
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "attrValue", className: "text-
|
|
8027
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
8170
8028
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8171
8029
|
Textarea,
|
|
8172
8030
|
{
|
|
@@ -8175,35 +8033,39 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8175
8033
|
spellCheck: "false",
|
|
8176
8034
|
id: "attrValue",
|
|
8177
8035
|
rows: 2,
|
|
8178
|
-
ref:
|
|
8036
|
+
ref: y,
|
|
8179
8037
|
value: d,
|
|
8180
|
-
onChange: (
|
|
8181
|
-
onKeyDown:
|
|
8182
|
-
placeholder: "Value",
|
|
8183
|
-
className: "
|
|
8038
|
+
onChange: (R) => u(R.target.value),
|
|
8039
|
+
onKeyDown: w,
|
|
8040
|
+
placeholder: "Enter Value",
|
|
8041
|
+
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
8184
8042
|
}
|
|
8185
8043
|
)
|
|
8186
8044
|
] })
|
|
8187
8045
|
] }),
|
|
8188
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8046
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8047
|
+
Button,
|
|
8048
|
+
{
|
|
8049
|
+
type: "submit",
|
|
8050
|
+
disabled: !i.length || !d.length,
|
|
8051
|
+
variant: "default",
|
|
8052
|
+
size: "sm",
|
|
8053
|
+
className: "h-8 w-24 text-xs",
|
|
8054
|
+
children: p !== null ? "Save" : "Add"
|
|
8055
|
+
}
|
|
8056
|
+
) }),
|
|
8189
8057
|
h && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: h })
|
|
8190
8058
|
]
|
|
8191
8059
|
}
|
|
8192
8060
|
),
|
|
8193
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "
|
|
8194
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
8195
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-
|
|
8196
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px]
|
|
8061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((R, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
8062
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
8063
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: R.key }),
|
|
8064
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: R.value.toString() })
|
|
8197
8065
|
] }),
|
|
8198
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
|
|
8199
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8200
|
-
|
|
8201
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
|
|
8202
|
-
] }),
|
|
8203
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => f(A), children: [
|
|
8204
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
|
|
8205
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
|
|
8206
|
-
] })
|
|
8066
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
8067
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
8068
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => b(A), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })
|
|
8207
8069
|
] })
|
|
8208
8070
|
] }, A)) })
|
|
8209
8071
|
] });
|
|
@@ -8211,13 +8073,13 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8211
8073
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
8212
8074
|
React.useEffect(() => {
|
|
8213
8075
|
const d = map(get(o, i), (u, p) => ({ key: p, value: u }));
|
|
8214
|
-
isEmpty(d) ? r([]) : r(d);
|
|
8076
|
+
isEmpty$1(d) ? r([]) : r(d);
|
|
8215
8077
|
}, [get(o, i)]);
|
|
8216
8078
|
const c = React.useCallback(
|
|
8217
8079
|
(d = []) => {
|
|
8218
8080
|
const u = {};
|
|
8219
8081
|
forEach(d, (p) => {
|
|
8220
|
-
isEmpty(p.key) || set(u, p.key, p.value);
|
|
8082
|
+
isEmpty$1(p.key) || set(u, p.key, p.value);
|
|
8221
8083
|
}), l([get(o, "_id")], { [i]: u });
|
|
8222
8084
|
},
|
|
8223
8085
|
[o, l, i]
|
|
@@ -8438,12 +8300,12 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
8438
8300
|
};
|
|
8439
8301
|
function BlockAttributesToggle() {
|
|
8440
8302
|
const { t: o } = useTranslation(), [n, r] = useState(!0), [a] = useSelectedStylingBlocks();
|
|
8441
|
-
return isEmpty(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
8303
|
+
return isEmpty$1(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
8442
8304
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8443
8305
|
"div",
|
|
8444
8306
|
{
|
|
8445
8307
|
onClick: () => r(!n),
|
|
8446
|
-
className: "flex cursor-pointer items-center justify-between border-
|
|
8308
|
+
className: "flex cursor-pointer items-center justify-between border-t border-border py-3 text-xs font-medium hover:underline",
|
|
8447
8309
|
children: [
|
|
8448
8310
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("Attributes") }),
|
|
8449
8311
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4 text-gray-500 " + (n ? "rotate-180" : "") }) })
|
|
@@ -8458,14 +8320,30 @@ const SettingsPanel = () => {
|
|
|
8458
8320
|
return isNull(o) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 rounded-xl p-4 text-muted-foreground", children: [
|
|
8459
8321
|
/* @__PURE__ */ jsxRuntimeExports.jsx(MixerHorizontalIcon, { className: "mx-auto text-3xl" }),
|
|
8460
8322
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { children: n("Please select a block to edit settings or styles") })
|
|
8461
|
-
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("
|
|
8462
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
8467
|
-
|
|
8468
|
-
|
|
8323
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "settings", className: "flex flex-1 flex-col", children: [
|
|
8324
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "grid h-auto w-full grid-cols-2 p-1 py-1", children: [
|
|
8325
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "settings", className: "text-xs", children: "Settings" }),
|
|
8326
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "styles", className: "text-xs", children: "Styles" })
|
|
8327
|
+
] }),
|
|
8328
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "settings", className: "no-scrollbar h-full max-h-min overflow-y-auto", children: [
|
|
8329
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockSettings, {}),
|
|
8330
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8331
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
8332
|
+
] }),
|
|
8333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8334
|
+
TabsContent,
|
|
8335
|
+
{
|
|
8336
|
+
value: "styles",
|
|
8337
|
+
className: "no-scrollbar h-full max-h-min max-w-full overflow-y-auto overflow-x-hidden",
|
|
8338
|
+
children: [
|
|
8339
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyling, {}),
|
|
8340
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockAttributesToggle, {}),
|
|
8341
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
8343
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
8344
|
+
]
|
|
8345
|
+
}
|
|
8346
|
+
)
|
|
8469
8347
|
] }) });
|
|
8470
8348
|
}, SettingsPanel$1 = SettingsPanel;
|
|
8471
8349
|
function LayoutCard({ disabled: o = !1, description: n, title: r, selected: a, onSelect: l, children: i }) {
|
|
@@ -8559,7 +8437,7 @@ const ChooseLayout = ({ open: o, close: n }) => {
|
|
|
8559
8437
|
)
|
|
8560
8438
|
] }) })
|
|
8561
8439
|
] }) });
|
|
8562
|
-
}, TopBar = lazy(() => import("./Topbar-
|
|
8440
|
+
}, TopBar = lazy(() => import("./Topbar-700eX1kn.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
|
|
8563
8441
|
function useSidebarMenuItems() {
|
|
8564
8442
|
return useMemo(() => compact([
|
|
8565
8443
|
{
|
|
@@ -8574,10 +8452,10 @@ const RootLayout = () => {
|
|
|
8574
8452
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
8575
8453
|
n(1);
|
|
8576
8454
|
});
|
|
8577
|
-
const c = useBuilderProp("sideBarComponents.top", []), d = (
|
|
8578
|
-
|
|
8579
|
-
}, u = (
|
|
8580
|
-
n(o ===
|
|
8455
|
+
const c = useBuilderProp("sideBarComponents.top", []), d = (E) => {
|
|
8456
|
+
E.preventDefault();
|
|
8457
|
+
}, u = (E) => {
|
|
8458
|
+
n(o === E ? null : E);
|
|
8581
8459
|
}, p = useSidebarMenuItems(), { t: m } = useTranslation(), h = [...p, ...c], g = useBuilderProp("htmlDir", "ltr");
|
|
8582
8460
|
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: [
|
|
8583
8461
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -8589,19 +8467,19 @@ const RootLayout = () => {
|
|
|
8589
8467
|
/* @__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, {}) }) }),
|
|
8590
8468
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8591
8469
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8592
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: h.map((
|
|
8470
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: h.map((E, y) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8593
8471
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8594
8472
|
Button,
|
|
8595
8473
|
{
|
|
8596
|
-
variant: o ===
|
|
8474
|
+
variant: o === y ? "default" : "ghost",
|
|
8597
8475
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8598
|
-
onClick: () => u(
|
|
8599
|
-
children: get(
|
|
8476
|
+
onClick: () => u(y),
|
|
8477
|
+
children: get(E, "icon", null)
|
|
8600
8478
|
},
|
|
8601
|
-
|
|
8479
|
+
y
|
|
8602
8480
|
) }),
|
|
8603
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m(
|
|
8604
|
-
] }, "button" +
|
|
8481
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m(E.label) }) })
|
|
8482
|
+
] }, "button" + y)) }),
|
|
8605
8483
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" })
|
|
8606
8484
|
] }),
|
|
8607
8485
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -8631,14 +8509,14 @@ const RootLayout = () => {
|
|
|
8631
8509
|
initial: { width: 280 },
|
|
8632
8510
|
animate: { width: 280 },
|
|
8633
8511
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8634
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-
|
|
8635
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "-mt-1 flex
|
|
8512
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full flex-col overflow-hidden p-3", children: [
|
|
8513
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between gap-2", children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8636
8514
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
8637
8515
|
" ",
|
|
8638
8516
|
m("AI Assistant")
|
|
8639
|
-
] }) }) : /* @__PURE__ */ jsxRuntimeExports.
|
|
8517
|
+
] }) }) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
8640
8518
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8641
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8519
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
|
|
8642
8520
|
m("Theme Settings")
|
|
8643
8521
|
] }),
|
|
8644
8522
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -8651,11 +8529,8 @@ const RootLayout = () => {
|
|
|
8651
8529
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4 rtl:ml-2" })
|
|
8652
8530
|
}
|
|
8653
8531
|
)
|
|
8654
|
-
] }) :
|
|
8655
|
-
|
|
8656
|
-
m("Block Settings")
|
|
8657
|
-
] }) }) }) }) }),
|
|
8658
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AskAI, {}) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
|
|
8532
|
+
] }) : null }) }) }),
|
|
8533
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex max-h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AskAI, {}) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
|
|
8659
8534
|
] }) })
|
|
8660
8535
|
}
|
|
8661
8536
|
)
|
|
@@ -8691,7 +8566,7 @@ const RootLayout = () => {
|
|
|
8691
8566
|
}, getParentNodeIds = (o, n) => {
|
|
8692
8567
|
const r = [];
|
|
8693
8568
|
let a = find(o, { _id: n }), l = get(a, "_parent", "");
|
|
8694
|
-
for (; isString(l) && !isEmpty(l); )
|
|
8569
|
+
for (; isString(l) && !isEmpty$1(l); )
|
|
8695
8570
|
r.push(a == null ? void 0 : a._parent), a = find(o, { _id: l }), l = a == null ? void 0 : a._parent;
|
|
8696
8571
|
return flatten(r);
|
|
8697
8572
|
}, expandedIdsAtom = atom$1([]), useExpandTree = () => {
|
|
@@ -8758,9 +8633,9 @@ export {
|
|
|
8758
8633
|
generateUUID as generateBlockId,
|
|
8759
8634
|
getBlocksFromHTML,
|
|
8760
8635
|
getClassValueAndUnit,
|
|
8761
|
-
|
|
8636
|
+
Je as i18n,
|
|
8762
8637
|
cn as mergeClasses,
|
|
8763
|
-
|
|
8638
|
+
Ze as registerChaiBlock,
|
|
8764
8639
|
useAddBlock,
|
|
8765
8640
|
useAddClassesToBlocks,
|
|
8766
8641
|
useAskAi,
|
|
@@ -8802,7 +8677,7 @@ export {
|
|
|
8802
8677
|
useStylingState,
|
|
8803
8678
|
useTheme,
|
|
8804
8679
|
useThemeOptions,
|
|
8805
|
-
|
|
8680
|
+
Xe as useTranslation,
|
|
8806
8681
|
useUILibraryBlocks,
|
|
8807
8682
|
useUndoManager,
|
|
8808
8683
|
useUpdateBlocksProps,
|