@chaibuilder/sdk 2.0.0-beta.35 → 2.0.0-beta.36
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/{ChaiThemeFn--DgGggh_.js → ChaiThemeFn-BUgkaTMi.js} +1 -1
- package/dist/{ChaiThemeFn-bugxb1Cl.cjs → ChaiThemeFn-B_ATMTMa.cjs} +3 -3
- package/dist/CodeEditor-DCZWTNZX.cjs +1 -0
- package/dist/CodeEditor-iLT-zqjH.js +77 -0
- package/dist/Topbar-Bk4vqKpP.cjs +1 -0
- package/dist/Topbar-DMCtQiUj.js +22 -0
- package/dist/{context-menu-EDKTnqIV.js → context-menu-CxioWiWD.js} +1 -1
- package/dist/{context-menu-0lRey9QY.cjs → context-menu-t34dYg4a.cjs} +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.d.ts +13 -13
- package/dist/core.js +1243 -1327
- package/dist/{iconBase-Ief2hJUZ.js → iconBase-DHfFLkem.js} +6 -12
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-DGlMoOmv.js} +241 -242
- package/dist/mockServiceWorker.js +39 -24
- package/dist/{plugin-GuIj4Ul0.js → plugin-OOaLfdkf.js} +1 -1
- package/dist/{plugin-4xaTkTNB.cjs → plugin-fWX0IMr4.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.js +8 -11
- package/dist/style.css +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +5 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +2 -47
- package/dist/ui.js +199 -356
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +78 -81
- package/package.json +4 -1
- package/dist/CodeEditor-50B_qMvG.cjs +0 -1
- package/dist/CodeEditor-f8Ud0q2D.js +0 -126
- package/dist/Topbar-9IbTAO2f.js +0 -73
- package/dist/Topbar-eQjJCLWI.cjs +0 -1
- package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
- /package/dist/{STRINGS-BnWT5XcX.js → STRINGS-DtEft2kY.js} +0 -0
- /package/dist/{STRINGS-26RPxXyi.cjs → STRINGS-n7COZtKr.cjs} +0 -0
- /package/dist/{iconBase-aZzpqff_.cjs → iconBase-Cn2BsTrq.cjs} +0 -0
package/dist/core.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as jsxRuntimeExports } from "./jsx-runtime-
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var U = (o, r, n) => r in o ? V(o, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[r] = n;
|
|
3
|
+
var O = (o, r, n) => U(o, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-DGlMoOmv.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 { ag as useToast, S as Skeleton, B as Button, L as Label, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, T as Textarea, y as CardFooter, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, b as Switch, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, j as AlertDialog, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, k as AlertDialogTrigger, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-
|
|
8
|
-
import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, pick, sortBy, memoize, forEach, unset, chunk, cloneDeep, throttle, reverse, startCase, debounce, capitalize, flatMapDeep, split, reject, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
|
|
7
|
+
import { ag as useToast, S as Skeleton, B as Button, L as Label, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, T as Textarea, y as CardFooter, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, b as Switch, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, j as AlertDialog, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, k as AlertDialogTrigger, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-CxioWiWD.js";
|
|
8
|
+
import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, pick, sortBy, memoize, forEach, unset, chunk, cloneDeep, throttle, reverse, startCase, debounce, capitalize, flatMapDeep, some, split, reject, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, 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
|
-
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-
|
|
10
|
+
import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-DHfFLkem.js";
|
|
11
11
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
12
|
-
import { useTranslation as
|
|
13
|
-
import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn
|
|
12
|
+
import { useTranslation as Ie } from "react-i18next";
|
|
13
|
+
import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn-BUgkaTMi.js";
|
|
14
14
|
import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
|
|
15
15
|
import TreeModel from "tree-model";
|
|
16
16
|
import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
17
|
-
import { registerChaiBlock as
|
|
17
|
+
import { registerChaiBlock as De } from "@chaibuilder/runtime";
|
|
18
18
|
import ReactQuill, { Quill } from "react-quill";
|
|
19
19
|
import { useFeature, FlagsProvider } from "flagged";
|
|
20
20
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
21
21
|
import { flip } from "@floating-ui/dom";
|
|
22
22
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
23
|
-
import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, ReaderIcon, DropdownMenuIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, TextIcon, RowsIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon,
|
|
23
|
+
import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, ReaderIcon, DropdownMenuIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, TextIcon, RowsIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
24
24
|
import typography from "@tailwindcss/typography";
|
|
25
25
|
import forms from "@tailwindcss/forms";
|
|
26
26
|
import aspectRatio from "@tailwindcss/aspect-ratio";
|
|
27
27
|
import containerQueries from "@tailwindcss/container-queries";
|
|
28
28
|
import { twMerge } from "tailwind-merge";
|
|
29
|
-
import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-
|
|
29
|
+
import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-DtEft2kY.js";
|
|
30
30
|
import { Provider } from "react-wrap-balancer";
|
|
31
31
|
import { PlusIcon as PlusIcon$1, DatabaseIcon, Columns, Rows, GlobeIcon, ChevronRight, EyeOff, Eye, X, Plus, ChevronDown, List, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
|
|
32
32
|
import ReactDOM from "react-dom";
|
|
@@ -42,27 +42,10 @@ 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 Me } from "i18next";
|
|
46
46
|
import { motion } from "framer-motion";
|
|
47
|
-
import "@radix-ui/react-switch";
|
|
48
|
-
import "@radix-ui/react-accordion";
|
|
49
|
-
import "class-variance-authority";
|
|
50
|
-
import "@radix-ui/react-alert-dialog";
|
|
51
|
-
import "@radix-ui/react-slot";
|
|
52
|
-
import "@radix-ui/react-dialog";
|
|
53
|
-
import "@radix-ui/react-label";
|
|
54
|
-
import "@radix-ui/react-scroll-area";
|
|
55
|
-
import "@radix-ui/react-tabs";
|
|
56
|
-
import "@radix-ui/react-tooltip";
|
|
57
|
-
import "@radix-ui/react-popover";
|
|
58
|
-
import "@radix-ui/react-hover-card";
|
|
59
|
-
import "@radix-ui/react-dropdown-menu";
|
|
60
|
-
import "@radix-ui/react-separator";
|
|
61
|
-
import "@radix-ui/react-toast";
|
|
62
|
-
import "@radix-ui/react-context-menu";
|
|
63
47
|
const canAcceptChildBlock = (o, r) => {
|
|
64
|
-
if (!o)
|
|
65
|
-
return !0;
|
|
48
|
+
if (!o) return !0;
|
|
66
49
|
const n = getRegisteredChaiBlock(o);
|
|
67
50
|
return n && has(n, "canAcceptBlock") ? n.canAcceptBlock(r) : !1;
|
|
68
51
|
}, canAddChildBlock = (o) => {
|
|
@@ -78,7 +61,6 @@ const canAcceptChildBlock = (o, r) => {
|
|
|
78
61
|
const r = getRegisteredChaiBlock(o);
|
|
79
62
|
return r && has(r, "canDelete") ? r.canDelete() : !0;
|
|
80
63
|
};
|
|
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 };
|
|
82
64
|
let keyCount = 0;
|
|
83
65
|
function atom(o, r) {
|
|
84
66
|
const n = `atom${++keyCount}`, a = {
|
|
@@ -104,287 +86,246 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
|
|
|
104
86
|
throw o.e;
|
|
105
87
|
return o.v;
|
|
106
88
|
}, createStore = () => {
|
|
107
|
-
const o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const R = o.get(m);
|
|
113
|
-
if (o.set(m, E), n.has(m) || n.set(m, R), R && hasPromiseAtomValue(R)) {
|
|
114
|
-
const C = "v" in E ? E.v instanceof Promise ? E.v : Promise.resolve(E.v) : Promise.reject(E.e);
|
|
115
|
-
cancelPromise(R.v, C);
|
|
89
|
+
const o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(), a = (f) => o.get(f), l = (f, j) => {
|
|
90
|
+
const w = o.get(f);
|
|
91
|
+
if (o.set(f, j), n.has(f) || n.set(f, w), w && hasPromiseAtomValue(w)) {
|
|
92
|
+
const b = "v" in j ? j.v instanceof Promise ? j.v : Promise.resolve(j.v) : Promise.reject(j.e);
|
|
93
|
+
cancelPromise(w.v, b);
|
|
116
94
|
}
|
|
117
|
-
},
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
|
|
121
|
-
!
|
|
122
|
-
}), (
|
|
123
|
-
},
|
|
124
|
-
const
|
|
125
|
-
d: (
|
|
126
|
-
v:
|
|
95
|
+
}, i = (f, j, w) => {
|
|
96
|
+
const b = /* @__PURE__ */ new Map();
|
|
97
|
+
let C = !1;
|
|
98
|
+
w.forEach((B, N) => {
|
|
99
|
+
!B && N === f && (B = j), B && (b.set(N, B), j.d.get(N) !== B && (C = !0));
|
|
100
|
+
}), (C || j.d.size !== b.size) && (j.d = b);
|
|
101
|
+
}, c = (f, j, w) => {
|
|
102
|
+
const b = a(f), C = {
|
|
103
|
+
d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
|
|
104
|
+
v: j
|
|
127
105
|
};
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
130
|
-
if (
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
|
|
106
|
+
if (w && i(f, C, w), b && isEqualAtomValue(b, C) && b.d === C.d)
|
|
107
|
+
return b;
|
|
108
|
+
if (b && hasPromiseAtomValue(b) && hasPromiseAtomValue(C) && isEqualPromiseAtomValue(b, C)) {
|
|
109
|
+
if (b.d === C.d)
|
|
110
|
+
return b;
|
|
111
|
+
C.v = b.v;
|
|
134
112
|
}
|
|
135
|
-
return
|
|
136
|
-
},
|
|
137
|
-
if (isPromiseLike$2(
|
|
138
|
-
let
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
(
|
|
143
|
-
if (!
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
113
|
+
return l(f, C), C;
|
|
114
|
+
}, d = (f, j, w, b) => {
|
|
115
|
+
if (isPromiseLike$2(j)) {
|
|
116
|
+
let C;
|
|
117
|
+
const B = new Promise((N, D) => {
|
|
118
|
+
let I = !1;
|
|
119
|
+
j.then(
|
|
120
|
+
(T) => {
|
|
121
|
+
if (!I) {
|
|
122
|
+
I = !0;
|
|
123
|
+
const L = a(f), P = c(
|
|
124
|
+
f,
|
|
125
|
+
B,
|
|
126
|
+
w
|
|
149
127
|
);
|
|
150
|
-
resolvePromise(
|
|
128
|
+
resolvePromise(B, T), N(T), (L == null ? void 0 : L.d) !== P.d && S(f, P, L == null ? void 0 : L.d);
|
|
151
129
|
}
|
|
152
130
|
},
|
|
153
|
-
(
|
|
154
|
-
if (!
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
131
|
+
(T) => {
|
|
132
|
+
if (!I) {
|
|
133
|
+
I = !0;
|
|
134
|
+
const L = a(f), P = c(
|
|
135
|
+
f,
|
|
136
|
+
B,
|
|
137
|
+
w
|
|
160
138
|
);
|
|
161
|
-
rejectPromise(
|
|
139
|
+
rejectPromise(B, T), D(T), (L == null ? void 0 : L.d) !== P.d && S(f, P, L == null ? void 0 : L.d);
|
|
162
140
|
}
|
|
163
141
|
}
|
|
164
|
-
),
|
|
165
|
-
|
|
166
|
-
(
|
|
167
|
-
(
|
|
168
|
-
),
|
|
142
|
+
), C = (T) => {
|
|
143
|
+
I || (I = !0, T.then(
|
|
144
|
+
(L) => resolvePromise(B, L),
|
|
145
|
+
(L) => rejectPromise(B, L)
|
|
146
|
+
), N(T));
|
|
169
147
|
};
|
|
170
148
|
});
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
}),
|
|
149
|
+
return B.orig = j, B.status = "pending", registerCancelPromise(B, (N) => {
|
|
150
|
+
N && C(N), b == null || b();
|
|
151
|
+
}), c(f, B, w);
|
|
174
152
|
}
|
|
175
|
-
return
|
|
176
|
-
},
|
|
177
|
-
const
|
|
178
|
-
d: (
|
|
179
|
-
e:
|
|
153
|
+
return c(f, j, w);
|
|
154
|
+
}, p = (f, j, w) => {
|
|
155
|
+
const b = a(f), C = {
|
|
156
|
+
d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
|
|
157
|
+
e: j
|
|
180
158
|
};
|
|
181
|
-
return
|
|
182
|
-
},
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
}), Array.from(
|
|
187
|
-
const
|
|
188
|
-
return
|
|
189
|
-
|
|
159
|
+
return w && i(f, C, w), b && isEqualAtomError(b, C) && b.d === C.d ? b : (l(f, C), C);
|
|
160
|
+
}, u = (f) => {
|
|
161
|
+
const j = a(f);
|
|
162
|
+
if (j && (j.d.forEach((I, T) => {
|
|
163
|
+
T !== f && !r.has(T) && u(T);
|
|
164
|
+
}), Array.from(j.d).every(([I, T]) => {
|
|
165
|
+
const L = a(I);
|
|
166
|
+
return I === f || L === T || // TODO This is a hack, we should find a better solution.
|
|
167
|
+
L && !hasPromiseAtomValue(L) && isEqualAtomValue(L, T);
|
|
190
168
|
})))
|
|
191
|
-
return
|
|
192
|
-
const
|
|
193
|
-
let
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
if (hasInitialValue(
|
|
200
|
-
return
|
|
169
|
+
return j;
|
|
170
|
+
const w = /* @__PURE__ */ new Map();
|
|
171
|
+
let b = !0;
|
|
172
|
+
const C = (I) => {
|
|
173
|
+
if (I === f) {
|
|
174
|
+
const L = a(I);
|
|
175
|
+
if (L)
|
|
176
|
+
return w.set(I, L), returnAtomValue(L);
|
|
177
|
+
if (hasInitialValue(I))
|
|
178
|
+
return w.set(I, void 0), I.init;
|
|
201
179
|
throw new Error("no atom init");
|
|
202
180
|
}
|
|
203
|
-
const
|
|
204
|
-
return
|
|
181
|
+
const T = u(I);
|
|
182
|
+
return w.set(I, T), returnAtomValue(T);
|
|
205
183
|
};
|
|
206
|
-
let
|
|
207
|
-
const
|
|
184
|
+
let B, N;
|
|
185
|
+
const D = {
|
|
208
186
|
get signal() {
|
|
209
|
-
return
|
|
187
|
+
return B || (B = new AbortController()), B.signal;
|
|
210
188
|
},
|
|
211
189
|
get setSelf() {
|
|
212
|
-
return
|
|
213
|
-
if (
|
|
214
|
-
return
|
|
215
|
-
}),
|
|
190
|
+
return !N && isActuallyWritableAtom(f) && (N = (...I) => {
|
|
191
|
+
if (!b)
|
|
192
|
+
return k(f, ...I);
|
|
193
|
+
}), N;
|
|
216
194
|
}
|
|
217
195
|
};
|
|
218
196
|
try {
|
|
219
|
-
const
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
() =>
|
|
197
|
+
const I = f.read(C, D);
|
|
198
|
+
return d(
|
|
199
|
+
f,
|
|
200
|
+
I,
|
|
201
|
+
w,
|
|
202
|
+
() => B == null ? void 0 : B.abort()
|
|
225
203
|
);
|
|
226
|
-
} catch (
|
|
227
|
-
return
|
|
204
|
+
} catch (I) {
|
|
205
|
+
return p(f, I, w);
|
|
228
206
|
} finally {
|
|
229
|
-
|
|
207
|
+
b = !1;
|
|
230
208
|
}
|
|
231
|
-
},
|
|
232
|
-
let
|
|
233
|
-
return
|
|
234
|
-
},
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
},
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
(
|
|
244
|
-
),
|
|
209
|
+
}, x = (f) => returnAtomValue(u(f)), h = (f) => {
|
|
210
|
+
let j = r.get(f);
|
|
211
|
+
return j || (j = _(f)), j;
|
|
212
|
+
}, m = (f, j) => !j.l.size && (!j.t.size || j.t.size === 1 && j.t.has(f)), E = (f) => {
|
|
213
|
+
const j = r.get(f);
|
|
214
|
+
j && m(f, j) && A(f);
|
|
215
|
+
}, y = (f) => {
|
|
216
|
+
const j = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), b = (B) => {
|
|
217
|
+
const N = r.get(B);
|
|
218
|
+
N == null || N.t.forEach((D) => {
|
|
219
|
+
D !== B && (j.set(
|
|
220
|
+
D,
|
|
221
|
+
(j.get(D) || /* @__PURE__ */ new Set()).add(B)
|
|
222
|
+
), w.set(D, (w.get(D) || 0) + 1), b(D));
|
|
245
223
|
});
|
|
246
224
|
};
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
if (
|
|
253
|
-
let
|
|
254
|
-
if (
|
|
255
|
-
let
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
|
|
225
|
+
b(f);
|
|
226
|
+
const C = (B) => {
|
|
227
|
+
const N = r.get(B);
|
|
228
|
+
N == null || N.t.forEach((D) => {
|
|
229
|
+
var I;
|
|
230
|
+
if (D !== B) {
|
|
231
|
+
let T = w.get(D);
|
|
232
|
+
if (T && w.set(D, --T), !T) {
|
|
233
|
+
let L = !!((I = j.get(D)) != null && I.size);
|
|
234
|
+
if (L) {
|
|
235
|
+
const P = a(D), M = u(D);
|
|
236
|
+
L = !P || !isEqualAtomValue(P, M);
|
|
259
237
|
}
|
|
260
|
-
|
|
238
|
+
L || j.forEach((P) => P.delete(D));
|
|
261
239
|
}
|
|
262
|
-
|
|
240
|
+
C(D);
|
|
263
241
|
}
|
|
264
242
|
});
|
|
265
243
|
};
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
let
|
|
269
|
-
const
|
|
270
|
-
let
|
|
271
|
-
if (
|
|
272
|
-
if (!hasInitialValue(
|
|
244
|
+
C(f);
|
|
245
|
+
}, g = (f, ...j) => {
|
|
246
|
+
let w = !0;
|
|
247
|
+
const b = (N) => returnAtomValue(u(N)), C = (N, ...D) => {
|
|
248
|
+
let I;
|
|
249
|
+
if (N === f) {
|
|
250
|
+
if (!hasInitialValue(N))
|
|
273
251
|
throw new Error("atom not writable");
|
|
274
|
-
const
|
|
275
|
-
(!
|
|
252
|
+
const T = a(N), L = d(N, D[0]);
|
|
253
|
+
(!T || !isEqualAtomValue(T, L)) && y(N);
|
|
276
254
|
} else
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}, A = (m, ...E) => {
|
|
288
|
-
const R = B(m, ...E), C = _();
|
|
289
|
-
return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
|
|
290
|
-
(N) => N({ type: "write", flushed: C })
|
|
291
|
-
), R;
|
|
292
|
-
}, S = (m, E) => {
|
|
293
|
-
const R = {
|
|
294
|
-
t: new Set(E && [E]),
|
|
255
|
+
I = g(N, ...D);
|
|
256
|
+
return w || v(), I;
|
|
257
|
+
}, B = f.write(b, C, ...j);
|
|
258
|
+
return w = !1, B;
|
|
259
|
+
}, k = (f, ...j) => {
|
|
260
|
+
const w = g(f, ...j);
|
|
261
|
+
return v(), w;
|
|
262
|
+
}, _ = (f, j) => {
|
|
263
|
+
const w = {
|
|
264
|
+
t: new Set(j && [j]),
|
|
295
265
|
l: /* @__PURE__ */ new Set()
|
|
296
266
|
};
|
|
297
|
-
if (r.set(
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
}),
|
|
301
|
-
const
|
|
302
|
-
|
|
267
|
+
if (r.set(f, w), u(f).d.forEach((b, C) => {
|
|
268
|
+
const B = r.get(C);
|
|
269
|
+
B ? B.t.add(f) : C !== f && _(C, f);
|
|
270
|
+
}), u(f), isActuallyWritableAtom(f) && f.onMount) {
|
|
271
|
+
const b = f.onMount((...C) => k(f, ...C));
|
|
272
|
+
b && (w.u = b);
|
|
303
273
|
}
|
|
304
|
-
return
|
|
305
|
-
},
|
|
306
|
-
var
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
|
|
274
|
+
return w;
|
|
275
|
+
}, A = (f) => {
|
|
276
|
+
var j;
|
|
277
|
+
const w = (j = r.get(f)) == null ? void 0 : j.u;
|
|
278
|
+
w && w(), r.delete(f);
|
|
279
|
+
const b = a(f);
|
|
280
|
+
b && (hasPromiseAtomValue(b) && cancelPromise(b.v), b.d.forEach((C, B) => {
|
|
281
|
+
if (B !== f) {
|
|
282
|
+
const N = r.get(B);
|
|
283
|
+
N && (N.t.delete(f), m(B, N) && A(B));
|
|
314
284
|
}
|
|
315
|
-
}))
|
|
316
|
-
},
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
if (
|
|
320
|
-
|
|
285
|
+
}));
|
|
286
|
+
}, S = (f, j, w) => {
|
|
287
|
+
const b = new Set(j.d.keys());
|
|
288
|
+
w == null || w.forEach((C, B) => {
|
|
289
|
+
if (b.has(B)) {
|
|
290
|
+
b.delete(B);
|
|
321
291
|
return;
|
|
322
292
|
}
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
}),
|
|
326
|
-
const
|
|
327
|
-
|
|
293
|
+
const N = r.get(B);
|
|
294
|
+
N && (N.t.delete(f), m(B, N) && A(B));
|
|
295
|
+
}), b.forEach((C) => {
|
|
296
|
+
const B = r.get(C);
|
|
297
|
+
B ? B.t.add(f) : r.has(f) && _(C, f);
|
|
328
298
|
});
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
I && !// TODO This seems pretty hacky. Hope to fix it.
|
|
299
|
+
}, v = () => {
|
|
300
|
+
for (; n.size; ) {
|
|
301
|
+
const f = Array.from(n);
|
|
302
|
+
n.clear(), f.forEach(([j, w]) => {
|
|
303
|
+
const b = a(j);
|
|
304
|
+
if (b) {
|
|
305
|
+
b.d !== (w == null ? void 0 : w.d) && S(j, b, w == null ? void 0 : w.d);
|
|
306
|
+
const C = r.get(j);
|
|
307
|
+
C && !// TODO This seems pretty hacky. Hope to fix it.
|
|
339
308
|
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
340
|
-
(
|
|
341
|
-
}
|
|
342
|
-
(define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
|
|
309
|
+
(w && !hasPromiseAtomValue(w) && (isEqualAtomValue(w, b) || isEqualAtomError(w, b))) && C.l.forEach((B) => B());
|
|
310
|
+
}
|
|
343
311
|
});
|
|
344
312
|
}
|
|
345
|
-
if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
|
|
346
|
-
return a.forEach((E) => E("state")), m;
|
|
347
|
-
}, P = (m, E) => {
|
|
348
|
-
const R = b(m), C = _(), N = R.l;
|
|
349
|
-
return N.add(E), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("sub")), l.forEach(
|
|
350
|
-
(I) => I({ type: "sub", flushed: C })
|
|
351
|
-
)), () => {
|
|
352
|
-
N.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("unsub")), l.forEach((I) => I({ type: "unsub" })));
|
|
353
|
-
};
|
|
354
313
|
};
|
|
355
|
-
return
|
|
356
|
-
get:
|
|
357
|
-
set:
|
|
358
|
-
sub:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
l.delete(m);
|
|
366
|
-
}),
|
|
367
|
-
dev_get_mounted_atoms: () => i.values(),
|
|
368
|
-
dev_get_atom_state: (m) => o.get(m),
|
|
369
|
-
dev_get_mounted: (m) => r.get(m),
|
|
370
|
-
dev_restore_atoms: (m) => {
|
|
371
|
-
for (const [R, C] of m)
|
|
372
|
-
hasInitialValue(R) && (x(R, C), v(R));
|
|
373
|
-
const E = _();
|
|
374
|
-
l.forEach(
|
|
375
|
-
(R) => R({ type: "restore", flushed: E })
|
|
376
|
-
);
|
|
314
|
+
return {
|
|
315
|
+
get: x,
|
|
316
|
+
set: k,
|
|
317
|
+
sub: (f, j) => {
|
|
318
|
+
const w = h(f);
|
|
319
|
+
v();
|
|
320
|
+
const b = w.l;
|
|
321
|
+
return b.add(j), () => {
|
|
322
|
+
b.delete(j), E(f);
|
|
323
|
+
};
|
|
377
324
|
}
|
|
378
|
-
} : {
|
|
379
|
-
get: j,
|
|
380
|
-
set: A,
|
|
381
|
-
sub: P
|
|
382
325
|
};
|
|
383
326
|
};
|
|
384
327
|
let defaultStore;
|
|
385
|
-
const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore)
|
|
386
|
-
var define_import_meta_env_default$1 = { 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 };
|
|
387
|
-
const RESET = Symbol(), getCached$1 = (o, r, n) => (r.has(n) ? r : r.set(n, o())).get(n), cache1$2 = /* @__PURE__ */ new WeakMap(), memo2$1 = (o, r, n) => {
|
|
328
|
+
const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore), RESET = Symbol(), getCached$1 = (o, r, n) => (r.has(n) ? r : r.set(n, o())).get(n), cache1$2 = /* @__PURE__ */ new WeakMap(), memo2$1 = (o, r, n) => {
|
|
388
329
|
const a = getCached$1(() => /* @__PURE__ */ new WeakMap(), cache1$2, r);
|
|
389
330
|
return getCached$1(o, a, n);
|
|
390
331
|
}, cacheKeyForEmptyKeyExtractor = {}, isWritable = (o) => !!o.write, isFunction = (o) => typeof o == "function";
|
|
@@ -396,41 +337,41 @@ function splitAtom(o, r) {
|
|
|
396
337
|
if (p)
|
|
397
338
|
return p;
|
|
398
339
|
const u = d && n.get(d), x = [], h = [];
|
|
399
|
-
return c.forEach((
|
|
400
|
-
const
|
|
401
|
-
h[
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
x[
|
|
340
|
+
return c.forEach((m, E) => {
|
|
341
|
+
const y = E;
|
|
342
|
+
h[E] = y;
|
|
343
|
+
const g = u && u.atomList[u.keyList.indexOf(y)];
|
|
344
|
+
if (g) {
|
|
345
|
+
x[E] = g;
|
|
405
346
|
return;
|
|
406
347
|
}
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
return
|
|
348
|
+
const k = (A) => {
|
|
349
|
+
const S = A(l), v = A(o), f = a(v, S == null ? void 0 : S.arr).keyList.indexOf(y);
|
|
350
|
+
if (f < 0 || f >= v.length) {
|
|
351
|
+
const j = c[a(c).keyList.indexOf(y)];
|
|
352
|
+
if (j)
|
|
353
|
+
return j;
|
|
413
354
|
throw new Error("splitAtom: index out of bounds for read");
|
|
414
355
|
}
|
|
415
|
-
return
|
|
416
|
-
},
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
356
|
+
return v[f];
|
|
357
|
+
}, _ = (A, S, v) => {
|
|
358
|
+
const R = A(l), f = A(o), w = a(f, R == null ? void 0 : R.arr).keyList.indexOf(y);
|
|
359
|
+
if (w < 0 || w >= f.length)
|
|
419
360
|
throw new Error("splitAtom: index out of bounds for write");
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
...
|
|
423
|
-
|
|
424
|
-
...
|
|
361
|
+
const b = isFunction(v) ? v(f[w]) : v;
|
|
362
|
+
S(o, [
|
|
363
|
+
...f.slice(0, w),
|
|
364
|
+
b,
|
|
365
|
+
...f.slice(w + 1)
|
|
425
366
|
]);
|
|
426
367
|
};
|
|
427
|
-
x[
|
|
428
|
-
}), u && u.keyList.length === h.length && u.keyList.every((
|
|
368
|
+
x[E] = isWritable(o) ? atom(k, _) : atom(k);
|
|
369
|
+
}), u && u.keyList.length === h.length && u.keyList.every((m, E) => m === h[E]) ? p = u : p = { arr: c, atomList: x, keyList: h }, n.set(c, p), p;
|
|
429
370
|
}, l = atom((c) => {
|
|
430
371
|
const d = c(l), p = c(o);
|
|
431
372
|
return a(p, d == null ? void 0 : d.arr);
|
|
432
373
|
});
|
|
433
|
-
|
|
374
|
+
l.init = void 0;
|
|
434
375
|
const i = isWritable(o) ? atom(
|
|
435
376
|
(c) => c(l).atomList,
|
|
436
377
|
(c, d, p) => {
|
|
@@ -482,7 +423,7 @@ function splitAtom(o, r) {
|
|
|
482
423
|
return i;
|
|
483
424
|
},
|
|
484
425
|
o,
|
|
485
|
-
|
|
426
|
+
cacheKeyForEmptyKeyExtractor
|
|
486
427
|
);
|
|
487
428
|
}
|
|
488
429
|
const isPromiseLike$1 = (o) => typeof (o == null ? void 0 : o.then) == "function";
|
|
@@ -537,26 +478,22 @@ const defaultStorage = createJSONStorage(
|
|
|
537
478
|
() => typeof window < "u" ? window.localStorage : void 0
|
|
538
479
|
);
|
|
539
480
|
function atomWithStorage(o, r, n = defaultStorage, a) {
|
|
540
|
-
const l =
|
|
541
|
-
|
|
481
|
+
const l = atom(
|
|
482
|
+
r
|
|
542
483
|
);
|
|
543
|
-
return
|
|
544
|
-
|
|
545
|
-
let
|
|
546
|
-
return n.subscribe && (
|
|
484
|
+
return l.onMount = (c) => {
|
|
485
|
+
c(n.getItem(o, r));
|
|
486
|
+
let d;
|
|
487
|
+
return n.subscribe && (d = n.subscribe(o, c, r)), d;
|
|
547
488
|
}, atom(
|
|
548
|
-
(
|
|
549
|
-
(d, p
|
|
550
|
-
const
|
|
551
|
-
return
|
|
489
|
+
(c) => c(l),
|
|
490
|
+
(c, d, p) => {
|
|
491
|
+
const u = typeof p == "function" ? p(c(l)) : p;
|
|
492
|
+
return u === RESET ? (d(l, r), n.removeItem(o)) : u instanceof Promise ? u.then((x) => (d(l, x), n.setItem(o, x))) : (d(l, u), n.setItem(o, u));
|
|
552
493
|
}
|
|
553
494
|
);
|
|
554
495
|
}
|
|
555
|
-
|
|
556
|
-
const StoreContext = createContext(void 0), useStore = (o) => {
|
|
557
|
-
const r = useContext(StoreContext);
|
|
558
|
-
return (o == null ? void 0 : o.store) || r || getDefaultStore();
|
|
559
|
-
}, isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function", use = React__default.use || ((o) => {
|
|
496
|
+
const StoreContext = createContext(void 0), useStore = (o) => useContext(StoreContext) || getDefaultStore(), isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function", use = React__default.use || ((o) => {
|
|
560
497
|
if (o.status === "pending")
|
|
561
498
|
throw o;
|
|
562
499
|
if (o.status === "fulfilled")
|
|
@@ -571,7 +508,7 @@ const StoreContext = createContext(void 0), useStore = (o) => {
|
|
|
571
508
|
), o);
|
|
572
509
|
});
|
|
573
510
|
function useAtomValue(o, r) {
|
|
574
|
-
const n = useStore(
|
|
511
|
+
const n = useStore(), [[a, l, i], c] = useReducer(
|
|
575
512
|
(u) => {
|
|
576
513
|
const x = n.get(o);
|
|
577
514
|
return Object.is(u[0], x) && u[1] === n && u[2] === o ? u : [x, n, o];
|
|
@@ -580,35 +517,25 @@ function useAtomValue(o, r) {
|
|
|
580
517
|
() => [n.get(o), n, o]
|
|
581
518
|
);
|
|
582
519
|
let d = a;
|
|
583
|
-
(l !== n || i !== o) && (c(), d = n.get(o))
|
|
584
|
-
const p = r == null ? void 0 : r.delay;
|
|
585
|
-
return useEffect(() => {
|
|
520
|
+
return (l !== n || i !== o) && (c(), d = n.get(o)), useEffect(() => {
|
|
586
521
|
const u = n.sub(o, () => {
|
|
587
|
-
if (typeof p == "number") {
|
|
588
|
-
setTimeout(c, p);
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
522
|
c();
|
|
592
523
|
});
|
|
593
524
|
return c(), u;
|
|
594
|
-
}, [n, o,
|
|
525
|
+
}, [n, o, void 0]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
|
|
595
526
|
}
|
|
596
527
|
function useSetAtom(o, r) {
|
|
597
|
-
const n = useStore(
|
|
528
|
+
const n = useStore();
|
|
598
529
|
return useCallback(
|
|
599
|
-
(...l) =>
|
|
600
|
-
if ((define_import_meta_env_default ? "production" : void 0) !== "production" && !("write" in o))
|
|
601
|
-
throw new Error("not writable atom");
|
|
602
|
-
return n.set(o, ...l);
|
|
603
|
-
},
|
|
530
|
+
(...l) => n.set(o, ...l),
|
|
604
531
|
[n, o]
|
|
605
532
|
);
|
|
606
533
|
}
|
|
607
534
|
function useAtom(o, r) {
|
|
608
535
|
return [
|
|
609
|
-
useAtomValue(o
|
|
536
|
+
useAtomValue(o),
|
|
610
537
|
// We do wrong type assertion here, which results in throwing an error.
|
|
611
|
-
useSetAtom(o
|
|
538
|
+
useSetAtom(o)
|
|
612
539
|
];
|
|
613
540
|
}
|
|
614
541
|
function duplicateBlocks(o, r, n) {
|
|
@@ -651,7 +578,7 @@ const getSlots = (o) => {
|
|
|
651
578
|
}), r;
|
|
652
579
|
}, getDuplicatedBlocks = (o, r, n = null) => {
|
|
653
580
|
let a = find(o, { _id: r });
|
|
654
|
-
a = { ...a, oldId: a._id, _id: generateUUID() }, n && (a = { ...a, _parent: n });
|
|
581
|
+
a = { ...a, oldId: a._id, _id: generateUUID() }, n !== (a == null ? void 0 : a._parent) && (a = { ...a, _parent: n });
|
|
655
582
|
const l = [a];
|
|
656
583
|
filter(o, { _parent: r }).length > 0 && l.push(flatten(duplicateBlocks(o, r, a._id)));
|
|
657
584
|
const i = flatten(l);
|
|
@@ -940,8 +867,7 @@ function getSingleBlock(o) {
|
|
|
940
867
|
}
|
|
941
868
|
function getPBlocks(o) {
|
|
942
869
|
const r = find(FLAT_ARRAY, { _id: o._id });
|
|
943
|
-
if (!r)
|
|
944
|
-
return [];
|
|
870
|
+
if (!r) return [];
|
|
945
871
|
const n = [r], a = filter(FLAT_ARRAY, { _parent: o._id });
|
|
946
872
|
return a.length ? flatten([...n, ...flatten(map(a, getPBlocks))]) : flatten(n);
|
|
947
873
|
}
|
|
@@ -1083,8 +1009,7 @@ function moveNode(o, r, n, a) {
|
|
|
1083
1009
|
return !1;
|
|
1084
1010
|
}
|
|
1085
1011
|
function moveBlocksWithChildren(o, r, n, a) {
|
|
1086
|
-
if (!r)
|
|
1087
|
-
return o;
|
|
1012
|
+
if (!r) return o;
|
|
1088
1013
|
n = n || "root";
|
|
1089
1014
|
const i = new TreeModel().parse({ _id: "root", children: getBlocksTree(o) });
|
|
1090
1015
|
if (moveNode(i, r, n, a)) {
|
|
@@ -1135,98 +1060,98 @@ const useBlocksStoreManager = () => {
|
|
|
1135
1060
|
updateBlocksProps: c
|
|
1136
1061
|
} = useBlocksStoreManager();
|
|
1137
1062
|
return {
|
|
1138
|
-
moveBlocks: (
|
|
1139
|
-
const
|
|
1140
|
-
const
|
|
1141
|
-
return { _id:
|
|
1142
|
-
}),
|
|
1143
|
-
|
|
1144
|
-
undo: () => each(
|
|
1145
|
-
i([
|
|
1063
|
+
moveBlocks: (y, g, k) => {
|
|
1064
|
+
const _ = map(y, (S) => {
|
|
1065
|
+
const R = r.find((w) => w._id === S)._parent || null, j = r.filter((w) => R ? w._parent === R : !w._parent).map((w) => w._id).indexOf(S);
|
|
1066
|
+
return { _id: S, oldParent: R, oldPosition: j };
|
|
1067
|
+
}), A = _.find(({ _id: S }) => S === y[0]);
|
|
1068
|
+
A && A.oldParent === g && A.oldPosition === k || (i(y, g, k), o({
|
|
1069
|
+
undo: () => each(_, ({ _id: S, oldParent: v, oldPosition: R }) => {
|
|
1070
|
+
i([S], v, R);
|
|
1146
1071
|
}),
|
|
1147
|
-
redo: () => i(
|
|
1072
|
+
redo: () => i(y, g, k)
|
|
1148
1073
|
}));
|
|
1149
1074
|
},
|
|
1150
|
-
addBlocks: (
|
|
1151
|
-
a(
|
|
1152
|
-
undo: () => l(map(
|
|
1153
|
-
redo: () => a(
|
|
1075
|
+
addBlocks: (y, g, k) => {
|
|
1076
|
+
a(y, g, k), o({
|
|
1077
|
+
undo: () => l(map(y, "_id")),
|
|
1078
|
+
redo: () => a(y, g, k)
|
|
1154
1079
|
});
|
|
1155
1080
|
},
|
|
1156
|
-
removeBlocks: (
|
|
1157
|
-
var
|
|
1158
|
-
const
|
|
1159
|
-
l(map(
|
|
1160
|
-
undo: () => a(
|
|
1161
|
-
redo: () => l(map(
|
|
1081
|
+
removeBlocks: (y) => {
|
|
1082
|
+
var A;
|
|
1083
|
+
const g = (A = first(y)) == null ? void 0 : A._parent, _ = r.filter((S) => g ? S._parent === g : !S._parent).indexOf(first(y));
|
|
1084
|
+
l(map(y, "_id")), o({
|
|
1085
|
+
undo: () => a(y, g, _),
|
|
1086
|
+
redo: () => l(map(y, "_id"))
|
|
1162
1087
|
});
|
|
1163
1088
|
},
|
|
1164
|
-
updateBlocks: (
|
|
1165
|
-
let
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
1089
|
+
updateBlocks: (y, g, k) => {
|
|
1090
|
+
let _ = [];
|
|
1091
|
+
if (k)
|
|
1092
|
+
_ = map(y, (A) => ({ _id: A, ...k }));
|
|
1168
1093
|
else {
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
const
|
|
1172
|
-
return each(
|
|
1094
|
+
const A = keys(g);
|
|
1095
|
+
_ = map(y, (S) => {
|
|
1096
|
+
const v = r.find((f) => f._id === S), R = { _id: S };
|
|
1097
|
+
return each(A, (f) => R[f] = v[f]), R;
|
|
1173
1098
|
});
|
|
1174
1099
|
}
|
|
1175
|
-
c(map(
|
|
1176
|
-
undo: () => c(
|
|
1177
|
-
redo: () => c(map(
|
|
1100
|
+
c(map(y, (A) => ({ _id: A, ...g }))), o({
|
|
1101
|
+
undo: () => c(_),
|
|
1102
|
+
redo: () => c(map(y, (A) => ({ _id: A, ...g })))
|
|
1178
1103
|
});
|
|
1179
1104
|
},
|
|
1180
|
-
updateBlocksRuntime: (
|
|
1181
|
-
c(map(
|
|
1105
|
+
updateBlocksRuntime: (y, g) => {
|
|
1106
|
+
c(map(y, (k) => ({ _id: k, ...g })));
|
|
1182
1107
|
},
|
|
1183
|
-
setNewBlocks: (
|
|
1184
|
-
n(
|
|
1108
|
+
setNewBlocks: (y) => {
|
|
1109
|
+
n(y), o({
|
|
1185
1110
|
undo: () => n(r),
|
|
1186
|
-
redo: () => n(
|
|
1111
|
+
redo: () => n(y)
|
|
1187
1112
|
});
|
|
1188
1113
|
},
|
|
1189
|
-
updateMultipleBlocksProps: (
|
|
1190
|
-
let
|
|
1191
|
-
|
|
1192
|
-
const
|
|
1193
|
-
return each(
|
|
1194
|
-
}), c(
|
|
1195
|
-
undo: () => c(
|
|
1196
|
-
redo: () => c(
|
|
1114
|
+
updateMultipleBlocksProps: (y) => {
|
|
1115
|
+
let g = [];
|
|
1116
|
+
g = map(y, (k) => {
|
|
1117
|
+
const _ = keys(k), A = r.find((v) => v._id === k._id), S = {};
|
|
1118
|
+
return each(_, (v) => S[v] = A[v]), S;
|
|
1119
|
+
}), c(y), o({
|
|
1120
|
+
undo: () => c(g),
|
|
1121
|
+
redo: () => c(y)
|
|
1197
1122
|
});
|
|
1198
1123
|
}
|
|
1199
1124
|
};
|
|
1200
1125
|
}, useAddBlock = () => {
|
|
1201
1126
|
const [o] = useBlocksStore(), [, r] = useSelectedBlockIds(), { addBlocks: n } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
1202
1127
|
(i, c, d) => {
|
|
1203
|
-
var
|
|
1204
|
-
for (let
|
|
1205
|
-
const { _id:
|
|
1206
|
-
i[
|
|
1207
|
-
const
|
|
1208
|
-
for (let
|
|
1209
|
-
|
|
1128
|
+
var m;
|
|
1129
|
+
for (let E = 0; E < i.length; E++) {
|
|
1130
|
+
const { _id: y } = i[E];
|
|
1131
|
+
i[E]._id = generateUUID();
|
|
1132
|
+
const g = filter(i, { _parent: y });
|
|
1133
|
+
for (let k = 0; k < g.length; k++)
|
|
1134
|
+
g[k]._parent = i[E]._id;
|
|
1210
1135
|
}
|
|
1211
1136
|
const p = first(i);
|
|
1212
1137
|
let u, x;
|
|
1213
|
-
return c && (u = find(o, { _id: c }), i[0]._parent = c, x = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, x = u._parent), n(i, x, d), r([(
|
|
1138
|
+
return c && (u = find(o, { _id: c }), i[0]._parent = c, x = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, x = u._parent), n(i, x, d), r([(m = first(i)) == null ? void 0 : m._id]), first(i);
|
|
1214
1139
|
},
|
|
1215
1140
|
[n, o, r]
|
|
1216
1141
|
);
|
|
1217
1142
|
return { addCoreBlock: useCallback(
|
|
1218
1143
|
(i, c, d) => {
|
|
1219
1144
|
if (has(i, "blocks")) {
|
|
1220
|
-
const
|
|
1221
|
-
return a(
|
|
1145
|
+
const g = i.blocks;
|
|
1146
|
+
return a(g, c, d);
|
|
1222
1147
|
}
|
|
1223
1148
|
const p = generateUUID(), u = getDefaultBlockProps(i.type), x = {
|
|
1224
1149
|
_type: i.type,
|
|
1225
1150
|
_id: p,
|
|
1226
1151
|
...u
|
|
1227
1152
|
};
|
|
1228
|
-
let h,
|
|
1229
|
-
return c && (h = find(o, { _id: c }), x._parent = c,
|
|
1153
|
+
let h, m;
|
|
1154
|
+
return c && (h = find(o, { _id: c }), x._parent = c, m = c), !canAcceptChildBlock(h == null ? void 0 : h._type, x._type) && h && (x._parent = h._parent, m = h._parent), n([x], m, d), r([x._id]), x;
|
|
1230
1155
|
},
|
|
1231
1156
|
[n, a, o, r]
|
|
1232
1157
|
), addPredefinedBlock: a };
|
|
@@ -2285,8 +2210,7 @@ const useBlocksStoreManager = () => {
|
|
|
2285
2210
|
return { match: n, getClasses: a };
|
|
2286
2211
|
};
|
|
2287
2212
|
function getMqForCls(o) {
|
|
2288
|
-
if (isEmpty(o.trim()))
|
|
2289
|
-
return "";
|
|
2213
|
+
if (isEmpty(o.trim())) return "";
|
|
2290
2214
|
const r = o.match(/sm:|md:|lg:|xl:|2xl:/g);
|
|
2291
2215
|
return get(r, 0, "xs").replace(":", "");
|
|
2292
2216
|
}
|
|
@@ -2299,8 +2223,7 @@ function getPureClsName(o) {
|
|
|
2299
2223
|
}
|
|
2300
2224
|
const memoizedProps = {};
|
|
2301
2225
|
function getPropertyForClass(o) {
|
|
2302
|
-
if (isEmpty(o))
|
|
2303
|
-
return "";
|
|
2226
|
+
if (isEmpty(o)) return "";
|
|
2304
2227
|
if (memoizedProps[o])
|
|
2305
2228
|
return memoizedProps[o];
|
|
2306
2229
|
let r = "";
|
|
@@ -2371,12 +2294,12 @@ function getNewClasses(o = "", r = "", n = []) {
|
|
|
2371
2294
|
const x = constructClassObject(u), h = find(a, pick(x, ["dark", "mq", "mod", "property"]));
|
|
2372
2295
|
if (h && (a = filter(
|
|
2373
2296
|
a,
|
|
2374
|
-
(
|
|
2375
|
-
)), i.push(x), x.mq === "xs" && !x.dark && x.mod === "" && (l = filter(l, (
|
|
2376
|
-
const
|
|
2297
|
+
(m) => m.fullCls !== (h == null ? void 0 : h.fullCls)
|
|
2298
|
+
)), i.push(x), x.mq === "xs" && !x.dark && x.mod === "" && (l = filter(l, (m) => m.property !== x.property)), getBelongsToForClass(a, x) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, x.property)) {
|
|
2299
|
+
const m = find(l, pick(x, ["property"]));
|
|
2377
2300
|
h && (l = filter(
|
|
2378
2301
|
l,
|
|
2379
|
-
(
|
|
2302
|
+
(E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
|
|
2380
2303
|
)), c.push({
|
|
2381
2304
|
...x,
|
|
2382
2305
|
fullCls: x.cls,
|
|
@@ -2467,11 +2390,11 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2467
2390
|
(a, l = null) => {
|
|
2468
2391
|
const i = [];
|
|
2469
2392
|
each(a, (c) => {
|
|
2470
|
-
const d = o.find((
|
|
2471
|
-
l
|
|
2393
|
+
const d = o.find((m) => m._id === c);
|
|
2394
|
+
l ? l === "root" && (l = null) : l = d._parent;
|
|
2472
2395
|
const x = filter(
|
|
2473
2396
|
o,
|
|
2474
|
-
(
|
|
2397
|
+
(m) => isString(l) ? m._parent === l : !m._parent
|
|
2475
2398
|
).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
|
|
2476
2399
|
n(h, l, x), i.push(get(h, "0._id", ""));
|
|
2477
2400
|
}), r(i);
|
|
@@ -2490,7 +2413,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2490
2413
|
const [o] = useBlocksStore();
|
|
2491
2414
|
return (r, n) => {
|
|
2492
2415
|
var i;
|
|
2493
|
-
const a = (i = find(o, { _id: n })) == null ? void 0 : i._type, l = first(r.map((c) => {
|
|
2416
|
+
const a = ((i = find(o, { _id: n })) == null ? void 0 : i._type) || null, l = first(r.map((c) => {
|
|
2494
2417
|
var d;
|
|
2495
2418
|
return (d = find(o, { _id: c })) == null ? void 0 : d._type;
|
|
2496
2419
|
}));
|
|
@@ -2500,9 +2423,14 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2500
2423
|
const o = useAtomValue$1(presentBlocksAtom), { moveBlocks: r } = useBlocksStoreUndoableActions();
|
|
2501
2424
|
return useCallback(
|
|
2502
2425
|
(n, a) => {
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2426
|
+
const l = Array.isArray(a) ? a[0] : a;
|
|
2427
|
+
if (a === "root") {
|
|
2428
|
+
const i = o == null ? void 0 : o.filter((c) => !c._parent);
|
|
2429
|
+
r(n, null, (i == null ? void 0 : i.length) || 0);
|
|
2430
|
+
} else {
|
|
2431
|
+
const i = o == null ? void 0 : o.filter((c) => c._parent === l);
|
|
2432
|
+
r(n, l, (i == null ? void 0 : i.length) || 0);
|
|
2433
|
+
}
|
|
2506
2434
|
},
|
|
2507
2435
|
[r, o]
|
|
2508
2436
|
);
|
|
@@ -2537,7 +2465,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2537
2465
|
const u = await navigator.clipboard.readText();
|
|
2538
2466
|
if (u) {
|
|
2539
2467
|
const x = JSON.parse(u);
|
|
2540
|
-
has(x, "_chai_copied_blocks") ? i(x._chai_copied_blocks, p) : l({ title: "Error", description: "Nothing to paste" });
|
|
2468
|
+
has(x, "_chai_copied_blocks") ? i(x._chai_copied_blocks, p === "root" ? null : p) : l({ title: "Error", description: "Nothing to paste" });
|
|
2541
2469
|
} else
|
|
2542
2470
|
l({ title: "Error", description: "Nothing to paste" });
|
|
2543
2471
|
} catch {
|
|
@@ -2565,13 +2493,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2565
2493
|
const d = o(c), p = a;
|
|
2566
2494
|
let { classes: u, baseClasses: x } = getSplitClasses(get(d, l.prop, "styles:,"));
|
|
2567
2495
|
return each(p, (h) => {
|
|
2568
|
-
const
|
|
2569
|
-
u = u.replace(
|
|
2570
|
-
const
|
|
2571
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2496
|
+
const m = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
|
|
2497
|
+
u = u.replace(E, " ").replace(/ +/g, " ").trim();
|
|
2498
|
+
const y = first(h.split(":"));
|
|
2499
|
+
includes(["2xl", "xl", "lg", "md", "sm"], y) && p.push(h.split(":").pop().trim());
|
|
2572
2500
|
}), each(p, (h) => {
|
|
2573
|
-
const
|
|
2574
|
-
x = x.replace(
|
|
2501
|
+
const m = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
2502
|
+
x = x.replace(m, " ").replace(/ +/g, " ").trim();
|
|
2575
2503
|
}), {
|
|
2576
2504
|
ids: [d._id],
|
|
2577
2505
|
props: {
|
|
@@ -2590,8 +2518,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
|
|
|
2590
2518
|
);
|
|
2591
2519
|
}, selectedBlockAllClassesAtom = atom$1((o) => {
|
|
2592
2520
|
const r = first(o(selectedStylingBlocksAtom)), n = o(selectedBlockAtom);
|
|
2593
|
-
if (!r || r.blockId !== get(n, "_id", null))
|
|
2594
|
-
return [];
|
|
2521
|
+
if (!r || r.blockId !== get(n, "_id", null)) return [];
|
|
2595
2522
|
const l = get(n, r.prop, `${STYLES_KEY},`).replace(STYLES_KEY, "").split(",").join(" ");
|
|
2596
2523
|
return filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
|
|
2597
2524
|
}), useSelectedBlockAllClasses = () => useAtomValue$1(selectedBlockAllClassesAtom), MQ = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, selectedBlockCurrentClassesAtom = atom$1((o) => {
|
|
@@ -2638,8 +2565,7 @@ const useLanguages = () => {
|
|
|
2638
2565
|
};
|
|
2639
2566
|
}, updatePropsForLanguage = memoize((o, r, n) => {
|
|
2640
2567
|
const a = getRegisteredChaiBlock(get(n, "_type"));
|
|
2641
|
-
if (!a)
|
|
2642
|
-
return o;
|
|
2568
|
+
if (!a) return o;
|
|
2643
2569
|
const l = { ...o };
|
|
2644
2570
|
return forEach(keys(o), (i) => {
|
|
2645
2571
|
if (includes(get(a, "i18nProps", []), i) && !isEmpty(r)) {
|
|
@@ -3022,39 +2948,39 @@ const getBlockWithChildren = (o, r) => {
|
|
|
3022
2948
|
return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
|
|
3023
2949
|
})
|
|
3024
2950
|
), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
|
|
3025
|
-
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u, h = (
|
|
3026
|
-
const
|
|
3027
|
-
for (const
|
|
3028
|
-
const
|
|
3029
|
-
typeof
|
|
2951
|
+
const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u, h = (m, E) => {
|
|
2952
|
+
const y = cloneDeep(E.find((g) => g._id === m));
|
|
2953
|
+
for (const g in y) {
|
|
2954
|
+
const k = y[g];
|
|
2955
|
+
typeof k == "string" && startsWith(k, STYLES_KEY) ? y[g] = compact(flattenDeep(k.replace(STYLES_KEY, "").split(","))).join(" ") : g !== "_id" && delete y[g];
|
|
3030
2956
|
}
|
|
3031
|
-
return
|
|
2957
|
+
return y;
|
|
3032
2958
|
};
|
|
3033
2959
|
return {
|
|
3034
2960
|
askAi: useCallback(
|
|
3035
|
-
async (
|
|
2961
|
+
async (m, E, y, g) => {
|
|
3036
2962
|
if (l) {
|
|
3037
2963
|
r(!0), a(null);
|
|
3038
2964
|
try {
|
|
3039
|
-
const
|
|
3040
|
-
if (
|
|
3041
|
-
a(
|
|
2965
|
+
const k = p === u ? "" : p, _ = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(E, d)), p) : [h(E, d)], A = await l(m, addLangToPrompt(y, x, m), _, k), { blocks: S, error: v } = A;
|
|
2966
|
+
if (v) {
|
|
2967
|
+
a(v);
|
|
3042
2968
|
return;
|
|
3043
2969
|
}
|
|
3044
|
-
if (
|
|
3045
|
-
const
|
|
3046
|
-
for (const
|
|
3047
|
-
|
|
3048
|
-
return
|
|
2970
|
+
if (m === "styles") {
|
|
2971
|
+
const R = S.map((f) => {
|
|
2972
|
+
for (const j in f)
|
|
2973
|
+
j !== "_id" && (f[j] = `${STYLES_KEY},${f[j]}`);
|
|
2974
|
+
return f;
|
|
3049
2975
|
});
|
|
3050
|
-
c(
|
|
2976
|
+
c(R);
|
|
3051
2977
|
} else
|
|
3052
|
-
i(
|
|
3053
|
-
|
|
3054
|
-
} catch (
|
|
3055
|
-
a(
|
|
2978
|
+
i(S);
|
|
2979
|
+
g && g(A);
|
|
2980
|
+
} catch (k) {
|
|
2981
|
+
a(k);
|
|
3056
2982
|
} finally {
|
|
3057
|
-
r(!1),
|
|
2983
|
+
r(!1), g && g();
|
|
3058
2984
|
}
|
|
3059
2985
|
}
|
|
3060
2986
|
},
|
|
@@ -3083,16 +3009,13 @@ const getBlockWithChildren = (o, r) => {
|
|
|
3083
3009
|
}, wrapperBlockAtom = atom$1((o) => {
|
|
3084
3010
|
var c;
|
|
3085
3011
|
const r = o(presentBlocksAtom), n = o(selectedBlockIdsAtom), a = n.length === 1 ? n[0] : null;
|
|
3086
|
-
if (!a)
|
|
3087
|
-
return null;
|
|
3012
|
+
if (!a) return null;
|
|
3088
3013
|
const l = find(r, { _id: a });
|
|
3089
|
-
if (!l)
|
|
3090
|
-
return null;
|
|
3014
|
+
if (!l) return null;
|
|
3091
3015
|
let i = l._parent;
|
|
3092
3016
|
for (; i; ) {
|
|
3093
3017
|
const d = find(r, { _id: i });
|
|
3094
|
-
if (!d)
|
|
3095
|
-
return null;
|
|
3018
|
+
if (!d) return null;
|
|
3096
3019
|
if ((c = getRegisteredChaiBlock(d._type)) != null && c.wrapper)
|
|
3097
3020
|
return d;
|
|
3098
3021
|
i = d._parent;
|
|
@@ -3165,11 +3088,11 @@ const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), layoutVariantAto
|
|
|
3165
3088
|
if (d < r) {
|
|
3166
3089
|
const u = parseFloat((d / r).toFixed(2).toString());
|
|
3167
3090
|
let x = {};
|
|
3168
|
-
const h = p * u,
|
|
3091
|
+
const h = p * u, m = d * u;
|
|
3169
3092
|
p && (x = {
|
|
3170
3093
|
// Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
|
|
3171
3094
|
height: 100 + (p - h) / h * 100 + "%",
|
|
3172
|
-
width: 100 + (d -
|
|
3095
|
+
width: 100 + (d - m) / m * 100 + "%"
|
|
3173
3096
|
}), i({
|
|
3174
3097
|
position: "relative",
|
|
3175
3098
|
top: 0,
|
|
@@ -3201,7 +3124,7 @@ class Content extends Component {
|
|
|
3201
3124
|
return Children.only(this.props.children);
|
|
3202
3125
|
}
|
|
3203
3126
|
}
|
|
3204
|
-
|
|
3127
|
+
O(Content, "propTypes", {
|
|
3205
3128
|
children: PropTypes.element.isRequired,
|
|
3206
3129
|
contentDidMount: PropTypes.func.isRequired,
|
|
3207
3130
|
contentDidUpdate: PropTypes.func.isRequired
|
|
@@ -3209,17 +3132,17 @@ H(Content, "propTypes", {
|
|
|
3209
3132
|
class Frame extends Component {
|
|
3210
3133
|
constructor(n, a) {
|
|
3211
3134
|
super(n, a);
|
|
3212
|
-
|
|
3135
|
+
O(this, "setRef", (n) => {
|
|
3213
3136
|
this.nodeRef.current = n;
|
|
3214
3137
|
const { forwardedRef: a } = this.props;
|
|
3215
3138
|
typeof a == "function" ? a(n) : a && (a.current = n);
|
|
3216
3139
|
});
|
|
3217
|
-
|
|
3140
|
+
O(this, "handleLoad", () => {
|
|
3218
3141
|
clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
|
|
3219
3142
|
});
|
|
3220
3143
|
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
3221
3144
|
// fallback to an interval to check if that's the case
|
|
3222
|
-
|
|
3145
|
+
O(this, "loadCheck", () => setInterval(() => {
|
|
3223
3146
|
this.handleLoad();
|
|
3224
3147
|
}, 500));
|
|
3225
3148
|
this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
|
|
@@ -3260,7 +3183,7 @@ class Frame extends Component {
|
|
|
3260
3183
|
// also inject into the body and can mess up React. For this reason
|
|
3261
3184
|
// initialContent is expected to have a div inside of the body
|
|
3262
3185
|
// element that we render react into.
|
|
3263
|
-
|
|
3186
|
+
O(Frame, "propTypes", {
|
|
3264
3187
|
style: PropTypes.object,
|
|
3265
3188
|
// eslint-disable-line
|
|
3266
3189
|
head: PropTypes.node,
|
|
@@ -3270,7 +3193,7 @@ H(Frame, "propTypes", {
|
|
|
3270
3193
|
contentDidMount: PropTypes.func,
|
|
3271
3194
|
contentDidUpdate: PropTypes.func,
|
|
3272
3195
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
|
|
3273
|
-
}),
|
|
3196
|
+
}), O(Frame, "defaultProps", {
|
|
3274
3197
|
style: {},
|
|
3275
3198
|
head: null,
|
|
3276
3199
|
children: void 0,
|
|
@@ -3297,14 +3220,12 @@ function getOrientation(o) {
|
|
|
3297
3220
|
const draggedBlockAtom = atom$1(null), dropTargetBlockIdAtom = atom$1(null);
|
|
3298
3221
|
let iframeDocument = null, possiblePositions = [], dropTarget = null, dropIndex = null;
|
|
3299
3222
|
const positionPlaceholder = (o, r, n) => {
|
|
3300
|
-
if (!iframeDocument || !o)
|
|
3301
|
-
return;
|
|
3223
|
+
if (!iframeDocument || !o) return;
|
|
3302
3224
|
const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([p]) => p), i = l.reduce(
|
|
3303
3225
|
(p, u) => Math.abs(u - n) < Math.abs(p - n) ? u : p,
|
|
3304
3226
|
0
|
|
3305
3227
|
), c = l.indexOf(i);
|
|
3306
|
-
if (!possiblePositions[c])
|
|
3307
|
-
return;
|
|
3228
|
+
if (!possiblePositions[c]) return;
|
|
3308
3229
|
const d = possiblePositions[c];
|
|
3309
3230
|
a.style.width = r === "vertical" ? d[2] + "px" : "2px", a.style.height = r === "vertical" ? "2px" : d[2] + "px", a.style.display = "block", r === "vertical" ? (a.style.top = d[0] + "px", a.style.left = d[1] + "px") : (a.style.top = d[1] + "px", a.style.left = d[0] + "px");
|
|
3310
3231
|
};
|
|
@@ -3318,8 +3239,7 @@ function calculateDropIndex(o, r) {
|
|
|
3318
3239
|
const calculatePossiblePositions = (o) => {
|
|
3319
3240
|
const n = getOrientation(o) === "horizontal";
|
|
3320
3241
|
possiblePositions = [], Array.from(o.children).forEach((a, l) => {
|
|
3321
|
-
if (a.classList.contains("pointer-events-none"))
|
|
3322
|
-
return;
|
|
3242
|
+
if (a.classList.contains("pointer-events-none")) return;
|
|
3323
3243
|
const i = n ? a.offsetLeft : a.offsetTop, c = n ? [a.offsetTop, a.clientHeight] : [a.offsetLeft, a.clientWidth];
|
|
3324
3244
|
if (possiblePositions.push([i, c[0], c[1]]), l === o.children.length - 1) {
|
|
3325
3245
|
const d = n ? a.offsetLeft + a.clientWidth : a.offsetTop + a.clientHeight;
|
|
@@ -3346,40 +3266,39 @@ function removeDataDrop() {
|
|
|
3346
3266
|
}
|
|
3347
3267
|
const useDnd = () => {
|
|
3348
3268
|
const { document: o } = useFrame(), [r, n] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, p] = useAtom$1(draggedBlockAtom), [, u] = useAtom$1(dropTargetBlockIdAtom);
|
|
3349
|
-
if (!useFeature("dnd"))
|
|
3350
|
-
return {};
|
|
3269
|
+
if (!useFeature("dnd")) return {};
|
|
3351
3270
|
const h = () => {
|
|
3352
3271
|
removePlaceholder(), n(!1), p(null), u(null), possiblePositions = [];
|
|
3353
3272
|
};
|
|
3354
3273
|
return iframeDocument = o, {
|
|
3355
3274
|
isDragging: r,
|
|
3356
|
-
onDragOver: (
|
|
3357
|
-
|
|
3275
|
+
onDragOver: (m) => {
|
|
3276
|
+
m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
|
|
3358
3277
|
},
|
|
3359
|
-
onDrop: (
|
|
3360
|
-
var
|
|
3361
|
-
const
|
|
3362
|
-
dropIndex = calculateDropIndex(
|
|
3363
|
-
const
|
|
3364
|
-
if ((
|
|
3278
|
+
onDrop: (m) => {
|
|
3279
|
+
var v;
|
|
3280
|
+
const E = dropTarget, g = getOrientation(E) === "vertical" ? m.clientY + ((v = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : v.scrollY) : m.clientX;
|
|
3281
|
+
dropIndex = calculateDropIndex(g, possiblePositions);
|
|
3282
|
+
const k = d, _ = E.getAttribute("data-block-id"), A = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
|
|
3283
|
+
if ((k == null ? void 0 : k._id) === _ || !A) {
|
|
3365
3284
|
h();
|
|
3366
3285
|
return;
|
|
3367
3286
|
}
|
|
3368
|
-
if (!has(
|
|
3369
|
-
a(
|
|
3287
|
+
if (!has(k, "_id")) {
|
|
3288
|
+
a(k, _ === "canvas" ? null : _, dropIndex), setTimeout(h, 300);
|
|
3370
3289
|
return;
|
|
3371
3290
|
}
|
|
3372
|
-
let
|
|
3373
|
-
|
|
3291
|
+
let S = E.getAttribute("data-block-id");
|
|
3292
|
+
S === null && (S = m.target.parentElement.getAttribute("data-block-id")), c([k._id], S === "canvas" ? null : S, dropIndex), h(), setTimeout(removePlaceholder, 300);
|
|
3374
3293
|
},
|
|
3375
|
-
onDragEnter: (
|
|
3376
|
-
const
|
|
3377
|
-
dropTarget =
|
|
3378
|
-
const
|
|
3379
|
-
u(
|
|
3294
|
+
onDragEnter: (m) => {
|
|
3295
|
+
const E = m, y = E.target;
|
|
3296
|
+
dropTarget = y;
|
|
3297
|
+
const g = y.getAttribute("data-block-id"), k = y.getAttribute("data-dnd-dragged") !== "yes";
|
|
3298
|
+
u(g), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(y), n(!0), l(""), i([]);
|
|
3380
3299
|
},
|
|
3381
|
-
onDragLeave: (
|
|
3382
|
-
|
|
3300
|
+
onDragLeave: (m) => {
|
|
3301
|
+
m.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), removePlaceholder(), possiblePositions = []);
|
|
3383
3302
|
}
|
|
3384
3303
|
};
|
|
3385
3304
|
};
|
|
@@ -3400,31 +3319,29 @@ const useHandleCanvasDblClick = () => {
|
|
|
3400
3319
|
const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], r = useUpdateBlocksProps(), [n, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
|
|
3401
3320
|
return (i) => {
|
|
3402
3321
|
var h;
|
|
3403
|
-
if (n)
|
|
3404
|
-
return;
|
|
3322
|
+
if (n) return;
|
|
3405
3323
|
const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
|
|
3406
3324
|
if (!d || !o.includes(d))
|
|
3407
3325
|
return;
|
|
3408
3326
|
const p = c.cloneNode(!0);
|
|
3409
|
-
c.style.display = "none", Array.from(p.attributes).forEach((
|
|
3410
|
-
|
|
3327
|
+
c.style.display = "none", Array.from(p.attributes).forEach((m) => {
|
|
3328
|
+
m.name !== "class" && p.removeAttribute(m.name);
|
|
3411
3329
|
}), d === "Text" && (p.style.display = "inline-block"), c.parentNode.insertBefore(p, c.nextSibling);
|
|
3412
3330
|
const u = new Quill(p, { placeholder: "Type here..." });
|
|
3413
3331
|
function x() {
|
|
3414
|
-
const
|
|
3415
|
-
r([c.getAttribute("data-block-id")], { content:
|
|
3332
|
+
const m = u.getText(0, u.getLength());
|
|
3333
|
+
r([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), p.removeEventListener("blur", x, !0), destroyQuill(u), a(""), l(), p.remove();
|
|
3416
3334
|
}
|
|
3417
|
-
p.addEventListener("blur", x, !0), p.addEventListener("click", (
|
|
3418
|
-
|
|
3419
|
-
}), p.addEventListener("keydown", (
|
|
3420
|
-
(
|
|
3335
|
+
p.addEventListener("blur", x, !0), p.addEventListener("click", (m) => {
|
|
3336
|
+
m.stopPropagation();
|
|
3337
|
+
}), p.addEventListener("keydown", (m) => {
|
|
3338
|
+
(m.key === "Enter" || m.key === "Escape") && x();
|
|
3421
3339
|
}), u.focus(), (h = p.querySelector(".ql-clipboard")) == null || h.remove(), a(c.getAttribute("data-block-id"));
|
|
3422
3340
|
};
|
|
3423
3341
|
}, useHandleCanvasClick = () => {
|
|
3424
3342
|
const [, o] = useSelectedStylingBlocks(), [r, n] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
|
|
3425
3343
|
return (c) => {
|
|
3426
|
-
if (a)
|
|
3427
|
-
return;
|
|
3344
|
+
if (a) return;
|
|
3428
3345
|
c.stopPropagation();
|
|
3429
3346
|
const d = getTargetedBlock(c.target);
|
|
3430
3347
|
if (d != null && d.getAttribute("data-block-id") && (d == null ? void 0 : d.getAttribute("data-block-id")) === "container") {
|
|
@@ -3443,8 +3360,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3443
3360
|
}, useHandleMouseMove = () => {
|
|
3444
3361
|
const [o] = useAtom$1(inlineEditingActiveAtom), { highlightBlock: r } = useBlockHighlight();
|
|
3445
3362
|
return throttle((n) => {
|
|
3446
|
-
if (o)
|
|
3447
|
-
return;
|
|
3363
|
+
if (o) return;
|
|
3448
3364
|
const a = getTargetedBlock(n.target);
|
|
3449
3365
|
a && r(a);
|
|
3450
3366
|
}, 20);
|
|
@@ -3459,10 +3375,10 @@ const useHandleCanvasDblClick = () => {
|
|
|
3459
3375
|
return;
|
|
3460
3376
|
const h = getElementByDataBlockId(r, first(n));
|
|
3461
3377
|
if (h) {
|
|
3462
|
-
const
|
|
3463
|
-
if (
|
|
3464
|
-
const
|
|
3465
|
-
l([{ id:
|
|
3378
|
+
const m = h.getAttribute("data-style-prop");
|
|
3379
|
+
if (m) {
|
|
3380
|
+
const E = h.getAttribute("data-style-id"), y = h.getAttribute("data-block-parent");
|
|
3381
|
+
l([{ id: E, prop: m, blockId: y }]);
|
|
3466
3382
|
}
|
|
3467
3383
|
}
|
|
3468
3384
|
}, 100);
|
|
@@ -3483,23 +3399,23 @@ const useHandleCanvasDblClick = () => {
|
|
|
3483
3399
|
}
|
|
3484
3400
|
);
|
|
3485
3401
|
}, getElementByDataBlockId = (o, r) => o.querySelector(`[data-block-id="${r}"]`), useKeyEventWatcher = (o) => {
|
|
3486
|
-
const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(),
|
|
3402
|
+
const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(), m = o ? { document: o } : {};
|
|
3487
3403
|
useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(r), {}, [r, p]), useHotkeys("ctrl+c,command+c", () => u(r), {}, [r, u]), useHotkeys(
|
|
3488
3404
|
"ctrl+v,command+v",
|
|
3489
3405
|
() => {
|
|
3490
3406
|
x(r[0]) && h(r);
|
|
3491
3407
|
},
|
|
3492
|
-
{ ...
|
|
3408
|
+
{ ...m, preventDefault: !0 },
|
|
3493
3409
|
[r, x, h]
|
|
3494
|
-
), useHotkeys("esc", () => n([]),
|
|
3410
|
+
), useHotkeys("esc", () => n([]), m, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...m, preventDefault: !0 }, [
|
|
3495
3411
|
r,
|
|
3496
3412
|
i
|
|
3497
3413
|
]), useHotkeys(
|
|
3498
3414
|
"del, backspace",
|
|
3499
|
-
(
|
|
3500
|
-
|
|
3415
|
+
(E) => {
|
|
3416
|
+
E.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(r);
|
|
3501
3417
|
},
|
|
3502
|
-
|
|
3418
|
+
m,
|
|
3503
3419
|
[r, l]
|
|
3504
3420
|
);
|
|
3505
3421
|
}, KeyboardHandler = () => {
|
|
@@ -3512,7 +3428,7 @@ const useHandleCanvasDblClick = () => {
|
|
|
3512
3428
|
};
|
|
3513
3429
|
class PubSub {
|
|
3514
3430
|
constructor() {
|
|
3515
|
-
|
|
3431
|
+
O(this, "subscribers", /* @__PURE__ */ new Map());
|
|
3516
3432
|
}
|
|
3517
3433
|
subscribe(r, n) {
|
|
3518
3434
|
return this.subscribers.has(r) || this.subscribers.set(r, /* @__PURE__ */ new Set()), this.subscribers.get(r).add(n), () => {
|
|
@@ -3552,7 +3468,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3552
3468
|
}
|
|
3553
3469
|
});
|
|
3554
3470
|
useResizeObserver(o, () => x(), o !== null);
|
|
3555
|
-
const h = get(r, "_parent", null),
|
|
3471
|
+
const h = get(r, "_parent", null), m = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
|
|
3556
3472
|
return !o || !r || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3557
3473
|
"div",
|
|
3558
3474
|
{
|
|
@@ -3560,13 +3476,13 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3560
3476
|
tabIndex: 0,
|
|
3561
3477
|
ref: u.setFloating,
|
|
3562
3478
|
style: p,
|
|
3563
|
-
onClick: (
|
|
3564
|
-
|
|
3479
|
+
onClick: (E) => {
|
|
3480
|
+
E.stopPropagation(), E.preventDefault();
|
|
3565
3481
|
},
|
|
3566
|
-
onMouseEnter: (
|
|
3567
|
-
|
|
3482
|
+
onMouseEnter: (E) => {
|
|
3483
|
+
E.stopPropagation(), i(null);
|
|
3568
3484
|
},
|
|
3569
|
-
onKeyDown: (
|
|
3485
|
+
onKeyDown: (E) => E.stopPropagation(),
|
|
3570
3486
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3571
3487
|
children: [
|
|
3572
3488
|
h && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3578,7 +3494,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3578
3494
|
}
|
|
3579
3495
|
}
|
|
3580
3496
|
),
|
|
3581
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label:
|
|
3497
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: r }),
|
|
3582
3498
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
|
|
3583
3499
|
canAddChildBlock(get(r, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3584
3500
|
PlusIcon,
|
|
@@ -3598,7 +3514,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3598
3514
|
d == null ? void 0 : d.getElementById("selected-block")
|
|
3599
3515
|
), [h] = useState(
|
|
3600
3516
|
d == null ? void 0 : d.getElementById("selected-styling-block")
|
|
3601
|
-
), [
|
|
3517
|
+
), [m] = useState(
|
|
3602
3518
|
d == null ? void 0 : d.getElementById("dragged-block")
|
|
3603
3519
|
);
|
|
3604
3520
|
useEffect(() => {
|
|
@@ -3623,42 +3539,42 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3623
3539
|
forms,
|
|
3624
3540
|
aspectRatio,
|
|
3625
3541
|
containerQueries,
|
|
3626
|
-
plugin(function({ addBase:
|
|
3627
|
-
|
|
3542
|
+
plugin(function({ addBase: g, theme: k }) {
|
|
3543
|
+
g({
|
|
3628
3544
|
"h1,h2,h3,h4,h5,h6": {
|
|
3629
|
-
fontFamily:
|
|
3545
|
+
fontFamily: k("fontFamily.heading")
|
|
3630
3546
|
},
|
|
3631
3547
|
body: {
|
|
3632
|
-
fontFamily:
|
|
3633
|
-
color:
|
|
3634
|
-
backgroundColor:
|
|
3548
|
+
fontFamily: k("fontFamily.body"),
|
|
3549
|
+
color: k("colors.foreground"),
|
|
3550
|
+
backgroundColor: k("colors.background")
|
|
3635
3551
|
}
|
|
3636
3552
|
});
|
|
3637
3553
|
})
|
|
3638
3554
|
]
|
|
3639
3555
|
});
|
|
3640
3556
|
}, [o, r, p]), useEffect(() => {
|
|
3641
|
-
x && (x.textContent = `${map(n, (
|
|
3557
|
+
x && (x.textContent = `${map(n, (g) => `[data-block-id="${g}"]`).join(",")}{
|
|
3642
3558
|
outline: 1px solid ${n.length === 1 ? "#42a1fc !important" : "orange !important"}; outline-offset: -1px;
|
|
3643
3559
|
}`);
|
|
3644
3560
|
}, [n, x]), useEffect(() => {
|
|
3645
|
-
|
|
3646
|
-
}, [i,
|
|
3561
|
+
m.textContent = i ? `[data-block-id="${i._id}"], [data-block-id="${i._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
|
|
3562
|
+
}, [i, m]), useEffect(() => {
|
|
3647
3563
|
u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
|
|
3648
3564
|
}, [u]), useEffect(() => {
|
|
3649
|
-
h && (h.textContent = `${map(l, ({ id:
|
|
3565
|
+
h && (h.textContent = `${map(l, ({ id: g }) => `[data-style-id="${g}"]`).join(",")}{
|
|
3650
3566
|
outline: 1px solid orange !important; outline-offset: -1px;
|
|
3651
3567
|
}`);
|
|
3652
3568
|
}, [l, h]), useEffect(() => {
|
|
3653
3569
|
d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
|
|
3654
3570
|
}, [c, d]);
|
|
3655
|
-
const
|
|
3571
|
+
const E = useMemo(
|
|
3656
3572
|
() => getChaiThemeCssVariables(o),
|
|
3657
3573
|
[o]
|
|
3658
|
-
),
|
|
3574
|
+
), y = useMemo(() => getThemeFontsLinkMarkup(pick(o, ["fontFamily"])), [o]);
|
|
3659
3575
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3660
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children:
|
|
3661
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html:
|
|
3576
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children: E }),
|
|
3577
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: y } })
|
|
3662
3578
|
] });
|
|
3663
3579
|
}, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, r) => {
|
|
3664
3580
|
const n = ["xs", "sm", "md", "lg", "xl", "2xl"], a = n.indexOf(r), l = o.split(" ");
|
|
@@ -3670,11 +3586,11 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
|
|
|
3670
3586
|
if (u <= a) {
|
|
3671
3587
|
const x = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], h = ["hidden"];
|
|
3672
3588
|
if (x.includes(p))
|
|
3673
|
-
for (let
|
|
3674
|
-
i[
|
|
3589
|
+
for (let m = u; m < n.length; m++)
|
|
3590
|
+
i[m] = !0;
|
|
3675
3591
|
else if (h.includes(p))
|
|
3676
|
-
for (let
|
|
3677
|
-
i[
|
|
3592
|
+
for (let m = u; m < n.length; m++)
|
|
3593
|
+
i[m] = !1;
|
|
3678
3594
|
}
|
|
3679
3595
|
}
|
|
3680
3596
|
return i[a];
|
|
@@ -3725,79 +3641,75 @@ const getRuntimeProps = memoize((o) => {
|
|
|
3725
3641
|
return Object.fromEntries(Object.entries(n).filter(([, a]) => get(a, "runtime", !1)));
|
|
3726
3642
|
});
|
|
3727
3643
|
function isDescendant(o, r, n) {
|
|
3728
|
-
if (!find(n, { _id: o }))
|
|
3729
|
-
return !1;
|
|
3644
|
+
if (!find(n, { _id: o })) return !1;
|
|
3730
3645
|
const l = filter(n, { _parent: o });
|
|
3731
3646
|
return l.some((i) => i._id === r) ? !0 : l.some((i) => isDescendant(i._id, r, n));
|
|
3732
3647
|
}
|
|
3733
3648
|
const RenderGlobalBlock = ({ blocks: o, allBlocks: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: o });
|
|
3734
3649
|
function applyLanguage(o, r, n) {
|
|
3735
|
-
if (isEmpty(r))
|
|
3736
|
-
return o;
|
|
3650
|
+
if (isEmpty(r)) return o;
|
|
3737
3651
|
const a = cloneDeep(o);
|
|
3738
3652
|
return forEach(keys(a), (l) => {
|
|
3739
3653
|
includes(get(n, "i18nProps", []), l) && !isEmpty(r) && (a[l] = get(a, `${l}-${r}`, a[l]));
|
|
3740
3654
|
}), a;
|
|
3741
3655
|
}
|
|
3742
3656
|
function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
|
|
3743
|
-
const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), h = useCallback((
|
|
3744
|
-
(
|
|
3745
|
-
const
|
|
3746
|
-
return { ...
|
|
3657
|
+
const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), h = useCallback((g) => getStyleAttrs(g, d), [d]), [m] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), y = useCallback(
|
|
3658
|
+
(g) => g.reduce((k, _) => {
|
|
3659
|
+
const A = get(p, _, {});
|
|
3660
|
+
return { ...k, ...A };
|
|
3747
3661
|
}, {}),
|
|
3748
3662
|
[p]
|
|
3749
3663
|
);
|
|
3750
3664
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
|
|
3751
|
-
o.map((
|
|
3752
|
-
if (
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (N) => !N._parent), allBlocks: C });
|
|
3665
|
+
o.map((g, k) => {
|
|
3666
|
+
if (E === g._id || u.includes(g._id)) return null;
|
|
3667
|
+
const _ = {}, A = filter(r, { _parent: g._id });
|
|
3668
|
+
if (_.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: A }) : null, g._type === "GlobalBlock") {
|
|
3669
|
+
const N = x(g);
|
|
3670
|
+
_.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(N, (D) => !D._parent), allBlocks: N });
|
|
3758
3671
|
}
|
|
3759
|
-
const
|
|
3760
|
-
if (isNull(
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
if (get(_, "__isHidden", !1) && !includes(a, f._id))
|
|
3672
|
+
const S = getRegisteredChaiBlock(g._type), v = get(S, "component", null);
|
|
3673
|
+
if (isNull(v)) return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${g == null ? void 0 : g._type} not registered -->` });
|
|
3674
|
+
const R = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(g, r) : [], f = y(R), j = h(g);
|
|
3675
|
+
if (get(j, "__isHidden", !1) && !includes(a, g._id))
|
|
3764
3676
|
return null;
|
|
3765
|
-
const
|
|
3677
|
+
const w = i && isDescendant(i._id, g._id, r), C = {
|
|
3766
3678
|
blockProps: {
|
|
3767
|
-
...includes(a,
|
|
3768
|
-
"data-block-id":
|
|
3769
|
-
"data-block-type":
|
|
3679
|
+
...includes(a, g._id) ? { "force-show": "" } : {},
|
|
3680
|
+
"data-block-id": g._id,
|
|
3681
|
+
"data-block-type": g._type,
|
|
3770
3682
|
...i ? (
|
|
3771
3683
|
// @ts-ignore
|
|
3772
3684
|
{
|
|
3773
|
-
"data-dnd": canAcceptChildBlock(
|
|
3774
|
-
"data-dnd-dragged": i._id ===
|
|
3685
|
+
"data-dnd": canAcceptChildBlock(g._type, i == null ? void 0 : i._type) ? "yes" : "no",
|
|
3686
|
+
"data-dnd-dragged": i._id === g._id || w ? "yes" : "no"
|
|
3775
3687
|
}
|
|
3776
3688
|
) : {},
|
|
3777
|
-
...c ===
|
|
3778
|
-
...includes(l,
|
|
3689
|
+
...c === g._id && !w ? { "data-drop": "yes" } : {},
|
|
3690
|
+
...includes(l, g._id) ? { "data-cut-block": "yes" } : {}
|
|
3779
3691
|
},
|
|
3780
|
-
index:
|
|
3781
|
-
...applyBindings(applyLanguage(
|
|
3782
|
-
...omit(
|
|
3783
|
-
...
|
|
3692
|
+
index: k,
|
|
3693
|
+
...applyBindings(applyLanguage(g, n, S), m),
|
|
3694
|
+
...omit(j, ["__isHidden"]),
|
|
3695
|
+
..._,
|
|
3784
3696
|
inBuilder: !0,
|
|
3785
|
-
blockState:
|
|
3697
|
+
blockState: f,
|
|
3786
3698
|
lang: n
|
|
3787
3699
|
};
|
|
3788
|
-
if (has(
|
|
3700
|
+
if (has(S, "dataProvider"))
|
|
3789
3701
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3790
3702
|
AsyncPropsBlock,
|
|
3791
3703
|
{
|
|
3792
3704
|
lang: n,
|
|
3793
|
-
dataProvider:
|
|
3794
|
-
block:
|
|
3795
|
-
component:
|
|
3796
|
-
props:
|
|
3705
|
+
dataProvider: S.dataProvider,
|
|
3706
|
+
block: g,
|
|
3707
|
+
component: v,
|
|
3708
|
+
props: C
|
|
3797
3709
|
}
|
|
3798
3710
|
) });
|
|
3799
|
-
const
|
|
3800
|
-
return
|
|
3711
|
+
const B = getRuntimeProps(g._type);
|
|
3712
|
+
return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuntimePropsBlock, { runtimeProps: B, block: g, component: v, props: C }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(v, C) });
|
|
3801
3713
|
})
|
|
3802
3714
|
) });
|
|
3803
3715
|
}
|
|
@@ -3857,47 +3769,46 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3857
3769
|
};
|
|
3858
3770
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
|
|
3859
3771
|
}, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
|
|
3860
|
-
const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, h] = useState([]), [,
|
|
3861
|
-
p((
|
|
3772
|
+
const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, h] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [y, g] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), A = (R) => {
|
|
3773
|
+
p((f) => ({ ...f, width: R }));
|
|
3862
3774
|
};
|
|
3863
3775
|
useEffect(() => {
|
|
3864
|
-
if (!c.current)
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
p({ width: k, height: T });
|
|
3776
|
+
if (!c.current) return;
|
|
3777
|
+
const { clientWidth: R, clientHeight: f } = c.current;
|
|
3778
|
+
p({ width: R, height: f });
|
|
3868
3779
|
}, [c, r]);
|
|
3869
|
-
const
|
|
3870
|
-
const { top:
|
|
3871
|
-
return
|
|
3780
|
+
const S = (R, f = 0) => {
|
|
3781
|
+
const { top: j } = R.getBoundingClientRect();
|
|
3782
|
+
return j + f >= 0 && j - f <= window.innerHeight;
|
|
3872
3783
|
};
|
|
3873
3784
|
useEffect(() => {
|
|
3874
|
-
var
|
|
3785
|
+
var R, f;
|
|
3875
3786
|
if (a && a.type !== "Multiple" && i.current) {
|
|
3876
|
-
const
|
|
3877
|
-
|
|
3787
|
+
const j = getElementByDataBlockId(i.current.contentDocument, a._id);
|
|
3788
|
+
j && (S(j) || (f = (R = i.current) == null ? void 0 : R.contentWindow) == null || f.scrollTo({ top: j.offsetTop, behavior: "smooth" }), h([j]));
|
|
3878
3789
|
}
|
|
3879
3790
|
}, [a]), useEffect(() => {
|
|
3880
|
-
if (!isEmpty(
|
|
3881
|
-
const
|
|
3791
|
+
if (!isEmpty(y) && i.current) {
|
|
3792
|
+
const R = getElementByStyleId(
|
|
3882
3793
|
i.current.contentDocument,
|
|
3883
|
-
first(
|
|
3794
|
+
first(y).id
|
|
3884
3795
|
);
|
|
3885
|
-
|
|
3796
|
+
m(R ? [R] : [null]);
|
|
3886
3797
|
} else
|
|
3887
|
-
|
|
3888
|
-
}, [
|
|
3889
|
-
const
|
|
3890
|
-
let
|
|
3891
|
-
return
|
|
3798
|
+
m([null]);
|
|
3799
|
+
}, [y]);
|
|
3800
|
+
const v = useMemo(() => {
|
|
3801
|
+
let R = IframeInitialContent;
|
|
3802
|
+
return R = R.replace("__HTML_DIR__", _), o === "offline" && (R = R.replace(
|
|
3892
3803
|
"https://old.chaibuilder.com/offline/tailwind.cdn.js",
|
|
3893
3804
|
"/offline/tailwind.cdn.js"
|
|
3894
|
-
),
|
|
3895
|
-
}, [o,
|
|
3896
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount:
|
|
3805
|
+
), R = R.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), R = R.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), R;
|
|
3806
|
+
}, [o, _]);
|
|
3807
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: A, onResize: A, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3897
3808
|
"div",
|
|
3898
3809
|
{
|
|
3899
3810
|
onClick: () => {
|
|
3900
|
-
n([]),
|
|
3811
|
+
n([]), g([]);
|
|
3901
3812
|
},
|
|
3902
3813
|
onMouseLeave: () => setTimeout(() => l(""), 300),
|
|
3903
3814
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -3905,12 +3816,12 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3905
3816
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3906
3817
|
ChaiFrame,
|
|
3907
3818
|
{
|
|
3908
|
-
contentDidMount: () =>
|
|
3819
|
+
contentDidMount: () => E(i.current),
|
|
3909
3820
|
ref: i,
|
|
3910
3821
|
id: "canvas-iframe",
|
|
3911
3822
|
style: { ...u, ...isEmpty(u) ? { width: `${r}px` } : {} },
|
|
3912
3823
|
className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
|
|
3913
|
-
initialContent:
|
|
3824
|
+
initialContent: v,
|
|
3914
3825
|
children: [
|
|
3915
3826
|
/* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
|
|
3916
3827
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -3922,7 +3833,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3922
3833
|
),
|
|
3923
3834
|
/* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
|
|
3924
3835
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
|
|
3925
|
-
|
|
3836
|
+
k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
|
|
3926
3837
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
|
|
3927
3838
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
3928
3839
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -3940,7 +3851,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
3940
3851
|
)
|
|
3941
3852
|
}
|
|
3942
3853
|
) });
|
|
3943
|
-
},
|
|
3854
|
+
}, FallbackError = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3944
3855
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3945
3856
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please try again." })
|
|
3946
3857
|
] }) }), TypeIcon = (o) => {
|
|
@@ -4040,14 +3951,14 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4040
3951
|
l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
|
|
4041
3952
|
] }, l))
|
|
4042
3953
|
] }) });
|
|
4043
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-
|
|
3954
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-iLT-zqjH.js")), CanvasArea = () => {
|
|
4044
3955
|
const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
|
|
4045
3956
|
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: [
|
|
4046
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas
|
|
3957
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
|
|
4047
3958
|
o ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Resizable, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CodeEditor$1, {}) }) }) : null,
|
|
4048
3959
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, {})
|
|
4049
3960
|
] }) });
|
|
4050
|
-
},
|
|
3961
|
+
}, FONTS = [
|
|
4051
3962
|
{ title: "Roboto", value: "Roboto" },
|
|
4052
3963
|
{ title: "Open Sans", value: "Open Sans" },
|
|
4053
3964
|
{ title: "Montserrat", value: "Montserrat" },
|
|
@@ -4114,7 +4025,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4114
4025
|
children: FONTS.map((a) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: a.value, children: a.title }, a.value))
|
|
4115
4026
|
}
|
|
4116
4027
|
)
|
|
4117
|
-
] }),
|
|
4028
|
+
] }), ColorPickerInput = ({ value: o, onChange: r }) => {
|
|
4118
4029
|
const n = debounce((a) => r(a), 200);
|
|
4119
4030
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4120
4031
|
"div",
|
|
@@ -4135,7 +4046,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4135
4046
|
)
|
|
4136
4047
|
}
|
|
4137
4048
|
);
|
|
4138
|
-
},
|
|
4049
|
+
}, BorderRadiusInput = ({ value: o, onChange: r, disabled: n }) => {
|
|
4139
4050
|
const a = debounce((l) => r(l), 200);
|
|
4140
4051
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4141
4052
|
"input",
|
|
@@ -4150,64 +4061,64 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4150
4061
|
className: "flex-1 cursor-pointer"
|
|
4151
4062
|
}
|
|
4152
4063
|
);
|
|
4153
|
-
},
|
|
4154
|
-
const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (
|
|
4155
|
-
a(
|
|
4064
|
+
}, ThemeConfigPanel$1 = React.memo(({ className: o = "" }) => {
|
|
4065
|
+
const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (g) => {
|
|
4066
|
+
a(g);
|
|
4156
4067
|
}, x = () => {
|
|
4157
|
-
const
|
|
4158
|
-
if (
|
|
4159
|
-
const
|
|
4160
|
-
|
|
4068
|
+
const g = l.find((k) => Object.keys(k)[0] === n);
|
|
4069
|
+
if (g) {
|
|
4070
|
+
const k = Object.values(g)[0];
|
|
4071
|
+
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? c(k) : console.error("Invalid preset structure:", k);
|
|
4161
4072
|
} else
|
|
4162
4073
|
console.error("Preset not found:", n);
|
|
4163
4074
|
}, h = useDebouncedCallback(
|
|
4164
|
-
(
|
|
4075
|
+
(g, k) => {
|
|
4165
4076
|
c(() => ({
|
|
4166
4077
|
...i,
|
|
4167
4078
|
fontFamily: {
|
|
4168
4079
|
...i.fontFamily,
|
|
4169
|
-
[
|
|
4080
|
+
[g.replace(/font-/g, "")]: k
|
|
4170
4081
|
}
|
|
4171
4082
|
}));
|
|
4172
4083
|
},
|
|
4173
4084
|
[i],
|
|
4174
4085
|
200
|
|
4175
|
-
),
|
|
4176
|
-
(
|
|
4086
|
+
), m = useDebouncedCallback(
|
|
4087
|
+
(g) => {
|
|
4177
4088
|
c(() => ({
|
|
4178
4089
|
...i,
|
|
4179
|
-
borderRadius: `${
|
|
4090
|
+
borderRadius: `${g}px`
|
|
4180
4091
|
}));
|
|
4181
4092
|
},
|
|
4182
4093
|
[i],
|
|
4183
4094
|
200
|
|
4184
|
-
),
|
|
4185
|
-
(
|
|
4095
|
+
), E = useDebouncedCallback(
|
|
4096
|
+
(g, k) => {
|
|
4186
4097
|
c(() => {
|
|
4187
|
-
const
|
|
4188
|
-
return r ? set(
|
|
4098
|
+
const _ = get(i, `colors.${g}`);
|
|
4099
|
+
return r ? set(_, 1, k) : set(_, 0, k), {
|
|
4189
4100
|
...i,
|
|
4190
4101
|
colors: {
|
|
4191
4102
|
...i.colors,
|
|
4192
|
-
[
|
|
4103
|
+
[g]: _
|
|
4193
4104
|
}
|
|
4194
4105
|
};
|
|
4195
4106
|
});
|
|
4196
4107
|
},
|
|
4197
4108
|
[i],
|
|
4198
4109
|
200
|
|
4199
|
-
),
|
|
4200
|
-
const
|
|
4110
|
+
), y = (g) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(g.items).map(([k]) => {
|
|
4111
|
+
const _ = get(i, `colors.${k}.${r ? 1 : 0}`);
|
|
4201
4112
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
4202
4113
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4203
|
-
ColorPickerInput
|
|
4114
|
+
ColorPickerInput,
|
|
4204
4115
|
{
|
|
4205
|
-
value:
|
|
4206
|
-
onChange: (
|
|
4116
|
+
value: _,
|
|
4117
|
+
onChange: (A) => E(k, A)
|
|
4207
4118
|
}
|
|
4208
4119
|
),
|
|
4209
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children:
|
|
4210
|
-
] },
|
|
4120
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((A) => A.charAt(0).toUpperCase() + A.slice(1)).join(" ") + (!k.toLowerCase().includes("foreground") && !k.toLowerCase().includes("border") && !k.toLowerCase().includes("input") && !k.toLowerCase().includes("ring") && !k.toLowerCase().includes("background") ? " Background" : "") })
|
|
4121
|
+
] }, k);
|
|
4211
4122
|
}) });
|
|
4212
4123
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
4213
4124
|
l.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 py-2", children: [
|
|
@@ -4217,11 +4128,11 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4217
4128
|
"select",
|
|
4218
4129
|
{
|
|
4219
4130
|
value: n,
|
|
4220
|
-
onChange: (
|
|
4131
|
+
onChange: (g) => u(g.target.value),
|
|
4221
4132
|
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",
|
|
4222
4133
|
children: [
|
|
4223
4134
|
/* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Select preset" }),
|
|
4224
|
-
Array.isArray(l) && l.map((
|
|
4135
|
+
Array.isArray(l) && l.map((g) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: Object.keys(g)[0], children: capitalize(Object.keys(g)[0]) }, Object.keys(g)[0]))
|
|
4225
4136
|
]
|
|
4226
4137
|
}
|
|
4227
4138
|
)
|
|
@@ -4229,25 +4140,25 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4229
4140
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "w-full text-sm", disabled: n === "", variant: "default", onClick: x, children: p("Apply") }) })
|
|
4230
4141
|
] }),
|
|
4231
4142
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("space-y-2", o), children: [
|
|
4232
|
-
(d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([
|
|
4233
|
-
FontSelector
|
|
4143
|
+
(d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([g, k]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4144
|
+
FontSelector,
|
|
4234
4145
|
{
|
|
4235
|
-
label:
|
|
4236
|
-
value: i.fontFamily[
|
|
4237
|
-
onChange: (
|
|
4146
|
+
label: g,
|
|
4147
|
+
value: i.fontFamily[g.replace(/font-/g, "")] || k[Object.keys(k)[0]],
|
|
4148
|
+
onChange: (_) => h(g, _)
|
|
4238
4149
|
},
|
|
4239
|
-
|
|
4150
|
+
g
|
|
4240
4151
|
)) }),
|
|
4241
4152
|
(d == null ? void 0 : d.borderRadius) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5 py-3", children: [
|
|
4242
4153
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Border Radius") }),
|
|
4243
4154
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 py-2", children: [
|
|
4244
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput
|
|
4155
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput, { value: i.borderRadius, onChange: m }),
|
|
4245
4156
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-12 text-sm", children: i.borderRadius })
|
|
4246
4157
|
] })
|
|
4247
4158
|
] }),
|
|
4248
4159
|
(d == null ? void 0 : d.colors) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-0.5", children: [
|
|
4249
4160
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Colors") }),
|
|
4250
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((
|
|
4161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((g) => y(g)) }, r ? "dark" : "light")
|
|
4251
4162
|
] })
|
|
4252
4163
|
] }),
|
|
4253
4164
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -4255,9 +4166,9 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4255
4166
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
4256
4167
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
4257
4168
|
] });
|
|
4258
|
-
}), ThemeConfigPanel$2 =
|
|
4169
|
+
}), ThemeConfigPanel$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4259
4170
|
__proto__: null,
|
|
4260
|
-
default: ThemeConfigPanel$
|
|
4171
|
+
default: ThemeConfigPanel$1
|
|
4261
4172
|
}, Symbol.toStringTag, { value: "Module" })), placeholderStyle = {
|
|
4262
4173
|
display: "flex",
|
|
4263
4174
|
alignItems: "center",
|
|
@@ -4291,7 +4202,33 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
|
|
|
4291
4202
|
] })
|
|
4292
4203
|
}
|
|
4293
4204
|
) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden" });
|
|
4294
|
-
}),
|
|
4205
|
+
}), PasteAtRootContextMenu = ({ parentContext: o, setParentContext: r }) => {
|
|
4206
|
+
const { t: n } = useTranslation(), { canPaste: a, pasteBlocks: l } = usePasteBlocks();
|
|
4207
|
+
return useEffect(() => {
|
|
4208
|
+
a("root") || r(null);
|
|
4209
|
+
}, [a("root")]), o && a("root") && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4210
|
+
"div",
|
|
4211
|
+
{
|
|
4212
|
+
style: { position: "absolute", top: o.y - 75, left: o.x - 56 },
|
|
4213
|
+
onMouseLeave: () => r(null),
|
|
4214
|
+
className: "w-28 rounded-md border bg-white p-1 shadow-xl",
|
|
4215
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4216
|
+
"div",
|
|
4217
|
+
{
|
|
4218
|
+
className: "flex cursor-pointer items-center gap-x-4 rounded px-2 py-1 text-xs hover:bg-blue-50",
|
|
4219
|
+
onClick: () => {
|
|
4220
|
+
l("root"), r(null);
|
|
4221
|
+
},
|
|
4222
|
+
children: [
|
|
4223
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CardStackIcon, {}),
|
|
4224
|
+
" ",
|
|
4225
|
+
n("Paste")
|
|
4226
|
+
]
|
|
4227
|
+
}
|
|
4228
|
+
)
|
|
4229
|
+
}
|
|
4230
|
+
);
|
|
4231
|
+
}, CopyPasteBlocks = () => {
|
|
4295
4232
|
const [o] = useBlocksStore(), [r] = useSelectedBlockIds(), { pasteBlocks: n } = usePasteBlocks(), [, a] = useCopyBlockIds(), { t: l } = useTranslation(), i = useSelectedBlock(), c = useCallback(() => {
|
|
4296
4233
|
const d = r.map((p) => {
|
|
4297
4234
|
const u = o.find((x) => x._id === p);
|
|
@@ -4445,50 +4382,50 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4445
4382
|
var I;
|
|
4446
4383
|
const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
|
|
4447
4384
|
let p = null;
|
|
4448
|
-
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id:
|
|
4449
|
-
|
|
4450
|
-
},
|
|
4451
|
-
|
|
4452
|
-
},
|
|
4453
|
-
|
|
4454
|
-
}, [
|
|
4455
|
-
var
|
|
4456
|
-
|
|
4457
|
-
},
|
|
4458
|
-
|
|
4459
|
-
},
|
|
4460
|
-
|
|
4385
|
+
const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id: m, data: E, isSelected: y, willReceiveDrop: g, isDragging: k, isEditing: _, handleClick: A } = o, S = (T) => {
|
|
4386
|
+
T.stopPropagation(), !i.includes(m) && o.toggle();
|
|
4387
|
+
}, v = (T) => {
|
|
4388
|
+
T.isInternal && (p = T.isOpen, T.isOpen && T.close());
|
|
4389
|
+
}, R = (T) => {
|
|
4390
|
+
T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
|
|
4391
|
+
}, [f, j] = useAtom$1(currentAddSelection), w = () => {
|
|
4392
|
+
var T;
|
|
4393
|
+
b(), o.parent.isSelected || j((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
|
|
4394
|
+
}, b = () => {
|
|
4395
|
+
j(null);
|
|
4396
|
+
}, C = (T) => {
|
|
4397
|
+
b(), T.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), A(T);
|
|
4461
4398
|
};
|
|
4462
4399
|
useEffect(() => {
|
|
4463
|
-
const
|
|
4464
|
-
|
|
4400
|
+
const T = setTimeout(() => {
|
|
4401
|
+
g && !o.isOpen && !k && !i.includes(m) && o.toggle();
|
|
4465
4402
|
}, 500);
|
|
4466
|
-
return () => clearTimeout(
|
|
4467
|
-
}, [
|
|
4468
|
-
const
|
|
4469
|
-
const
|
|
4470
|
-
for (let
|
|
4471
|
-
if (
|
|
4472
|
-
const M =
|
|
4473
|
-
|
|
4403
|
+
return () => clearTimeout(T);
|
|
4404
|
+
}, [g, o, k]);
|
|
4405
|
+
const B = useMemo(() => {
|
|
4406
|
+
const T = Object.keys(E), L = [];
|
|
4407
|
+
for (let P = 0; P < T.length; P++)
|
|
4408
|
+
if (T[P].endsWith("_attrs")) {
|
|
4409
|
+
const M = E[T[P]], $ = Object.keys(M).join("|");
|
|
4410
|
+
$.match(/x-data/) && L.push("data"), $.match(/x-on/) && L.push("event"), $.match(/x-show|x-if/) && L.push("show");
|
|
4474
4411
|
}
|
|
4475
|
-
return
|
|
4476
|
-
}, [
|
|
4477
|
-
const
|
|
4478
|
-
M && M.setAttribute("data-drop",
|
|
4479
|
-
const
|
|
4480
|
-
|
|
4481
|
-
},
|
|
4482
|
-
|
|
4483
|
-
const
|
|
4484
|
-
|
|
4412
|
+
return L;
|
|
4413
|
+
}, [E]), N = (T, L) => {
|
|
4414
|
+
const P = d.contentDocument || d.contentWindow.document, M = P.querySelector(`[data-block-id=${T}]`);
|
|
4415
|
+
M && M.setAttribute("data-drop", L);
|
|
4416
|
+
const $ = M.getBoundingClientRect(), H = d.getBoundingClientRect();
|
|
4417
|
+
$.top >= H.top && $.left >= H.left && $.bottom <= H.bottom && $.right <= H.right || (P.documentElement.scrollTop = M.offsetTop - H.top);
|
|
4418
|
+
}, D = (T) => {
|
|
4419
|
+
b();
|
|
4420
|
+
const L = get(o, "parent.id");
|
|
4421
|
+
L !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: L, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
|
|
4485
4422
|
};
|
|
4486
|
-
return
|
|
4423
|
+
return m === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
4487
4424
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
4488
4425
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4489
4426
|
"div",
|
|
4490
4427
|
{
|
|
4491
|
-
onClick: () =>
|
|
4428
|
+
onClick: () => D(-1),
|
|
4492
4429
|
className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
|
|
4493
4430
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-purple-500 px-3 py-1 text-[9px] leading-tight text-white hover:bg-purple-500", children: [
|
|
4494
4431
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
|
|
@@ -4498,35 +4435,35 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4498
4435
|
}
|
|
4499
4436
|
),
|
|
4500
4437
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
4501
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id:
|
|
4438
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: m, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4502
4439
|
"div",
|
|
4503
4440
|
{
|
|
4504
|
-
onMouseEnter: () => x(
|
|
4441
|
+
onMouseEnter: () => x(m),
|
|
4505
4442
|
onMouseLeave: () => h(),
|
|
4506
|
-
onClick:
|
|
4443
|
+
onClick: C,
|
|
4507
4444
|
style: r,
|
|
4508
|
-
"data-node-id":
|
|
4509
|
-
ref: i.includes(
|
|
4510
|
-
onDragStart: () =>
|
|
4511
|
-
onDragEnd: () =>
|
|
4512
|
-
onDragOver: (
|
|
4513
|
-
|
|
4445
|
+
"data-node-id": m,
|
|
4446
|
+
ref: i.includes(m) ? null : n,
|
|
4447
|
+
onDragStart: () => v(o),
|
|
4448
|
+
onDragEnd: () => R(o),
|
|
4449
|
+
onDragOver: (T) => {
|
|
4450
|
+
T.preventDefault(), N(m, "yes");
|
|
4514
4451
|
},
|
|
4515
|
-
onDragLeave: (
|
|
4516
|
-
|
|
4452
|
+
onDragLeave: (T) => {
|
|
4453
|
+
T.preventDefault(), N(m, "no");
|
|
4517
4454
|
},
|
|
4518
|
-
onDrop: (
|
|
4519
|
-
|
|
4455
|
+
onDrop: (T) => {
|
|
4456
|
+
T.preventDefault(), N(m, "no");
|
|
4520
4457
|
},
|
|
4521
4458
|
children: [
|
|
4522
4459
|
(o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4523
4460
|
"div",
|
|
4524
4461
|
{
|
|
4525
|
-
onClick: (
|
|
4526
|
-
|
|
4462
|
+
onClick: (T) => {
|
|
4463
|
+
T.stopPropagation(), D(o.childIndex);
|
|
4527
4464
|
},
|
|
4528
|
-
onMouseEnter:
|
|
4529
|
-
onMouseLeave:
|
|
4465
|
+
onMouseEnter: w,
|
|
4466
|
+
onMouseLeave: b,
|
|
4530
4467
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-purple-500 opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
4531
4468
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[4] text-white" }) })
|
|
4532
4469
|
}
|
|
@@ -4536,11 +4473,11 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4536
4473
|
{
|
|
4537
4474
|
className: cn(
|
|
4538
4475
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
(o == null ? void 0 : o.id) ===
|
|
4542
|
-
|
|
4543
|
-
i.includes(
|
|
4476
|
+
y ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
|
|
4477
|
+
g && canAcceptChildBlock(E._type, "Icon") ? "bg-green-200" : "",
|
|
4478
|
+
(o == null ? void 0 : o.id) === f ? "bg-purple-100" : "",
|
|
4479
|
+
k && "opacity-20",
|
|
4480
|
+
i.includes(m) ? "opacity-50" : ""
|
|
4544
4481
|
),
|
|
4545
4482
|
children: [
|
|
4546
4483
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
|
@@ -4548,50 +4485,50 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4548
4485
|
"div",
|
|
4549
4486
|
{
|
|
4550
4487
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
4551
|
-
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick:
|
|
4488
|
+
children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4552
4489
|
ChevronRight,
|
|
4553
4490
|
{
|
|
4554
|
-
className: `h-3 w-3 stroke-[3] ${
|
|
4491
|
+
className: `h-3 w-3 stroke-[3] ${y ? "text-slate-200" : "text-slate-400"}`
|
|
4555
4492
|
}
|
|
4556
4493
|
) })
|
|
4557
4494
|
}
|
|
4558
4495
|
),
|
|
4559
4496
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "leading-1 flex items-center", children: [
|
|
4560
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type:
|
|
4561
|
-
|
|
4497
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: E == null ? void 0 : E._type }),
|
|
4498
|
+
_ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4562
4499
|
"div",
|
|
4563
4500
|
{
|
|
4564
4501
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
4565
|
-
onDoubleClick: (
|
|
4566
|
-
|
|
4502
|
+
onDoubleClick: (T) => {
|
|
4503
|
+
T.stopPropagation(), o.edit(), o.deselect();
|
|
4567
4504
|
},
|
|
4568
4505
|
children: [
|
|
4569
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4506
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (E == null ? void 0 : E._name) || (E == null ? void 0 : E._type.split("/").pop()) }),
|
|
4507
|
+
B.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
|
|
4508
|
+
B.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
|
|
4509
|
+
B.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
|
|
4573
4510
|
]
|
|
4574
4511
|
}
|
|
4575
4512
|
)
|
|
4576
4513
|
] })
|
|
4577
4514
|
] }),
|
|
4578
4515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
|
|
4579
|
-
!i.includes(
|
|
4516
|
+
!i.includes(m) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4580
4517
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4581
4518
|
TooltipTrigger,
|
|
4582
4519
|
{
|
|
4583
4520
|
className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
|
|
4584
4521
|
asChild: !0,
|
|
4585
|
-
children: React__default.createElement(
|
|
4522
|
+
children: React__default.createElement(T.item, { blockId: m })
|
|
4586
4523
|
}
|
|
4587
4524
|
),
|
|
4588
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children:
|
|
4525
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
|
|
4589
4526
|
] })),
|
|
4590
|
-
canAddChildBlock(
|
|
4527
|
+
canAddChildBlock(E == null ? void 0 : E._type) && !i.includes(m) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4591
4528
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4592
4529
|
TooltipTrigger,
|
|
4593
4530
|
{
|
|
4594
|
-
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id:
|
|
4531
|
+
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
|
|
4595
4532
|
className: "cursor-pointer rounded bg-transparent hover:text-black",
|
|
4596
4533
|
asChild: !0,
|
|
4597
4534
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { size: "15" })
|
|
@@ -4603,8 +4540,8 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4603
4540
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4604
4541
|
TooltipTrigger,
|
|
4605
4542
|
{
|
|
4606
|
-
onClick: (
|
|
4607
|
-
|
|
4543
|
+
onClick: (T) => {
|
|
4544
|
+
T.stopPropagation(), c(m), o.isOpen && o.toggle();
|
|
4608
4545
|
},
|
|
4609
4546
|
className: "cursor-pointer rounded bg-transparent hover:text-black",
|
|
4610
4547
|
asChild: !0,
|
|
@@ -4650,7 +4587,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4650
4587
|
return canAcceptChildBlock(a, l);
|
|
4651
4588
|
};
|
|
4652
4589
|
}, ListTree = () => {
|
|
4653
|
-
const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(), [, setHiddenBlocks] = useHiddenBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom$1(treeRefAtom), { t } = useTranslation(), clearSelection = () => {
|
|
4590
|
+
const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(), [, setHiddenBlocks] = useHiddenBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom$1(treeRefAtom), { t } = useTranslation(), [parentContext, setParentContext] = useState(null), clearSelection = () => {
|
|
4654
4591
|
setIds([]), setStyleBlocks([]);
|
|
4655
4592
|
}, filteredTreeData = useMemo(() => {
|
|
4656
4593
|
const o = (n, a) => n.filter((l) => !a.includes(l._id)).map((l) => ({
|
|
@@ -4663,15 +4600,14 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4663
4600
|
}, onMove = ({ dragIds: o, parentId: r, index: n }) => {
|
|
4664
4601
|
canMove(o, r) && moveBlocks(o, r, n);
|
|
4665
4602
|
}, onSelect = (o) => {
|
|
4666
|
-
if (o.length === 0)
|
|
4667
|
-
return;
|
|
4603
|
+
if (o.length === 0) return;
|
|
4668
4604
|
const r = o[0] ? o[0].id : "";
|
|
4669
4605
|
setStyleBlocks([]), setIds([r]);
|
|
4670
4606
|
}, onContextMenu = (o) => {
|
|
4671
4607
|
var a;
|
|
4672
|
-
o.preventDefault();
|
|
4608
|
+
o.preventDefault(), parentContext && setParentContext(null);
|
|
4673
4609
|
const r = o.target, n = r.getAttribute("data-node-id") || ((a = r.closest("[data-node-id]")) == null ? void 0 : a.getAttribute("data-node-id"));
|
|
4674
|
-
n
|
|
4610
|
+
n ? (setStyleBlocks([]), setIds([n])) : (setStyleBlocks([]), setIds([]), setParentContext({ x: o.clientX, y: o.clientY }));
|
|
4675
4611
|
}, debouncedDisableDrop = useDebouncedCallback(
|
|
4676
4612
|
({ parentNode: o, dragNodes: r }) => {
|
|
4677
4613
|
var n;
|
|
@@ -4680,11 +4616,9 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4680
4616
|
[],
|
|
4681
4617
|
300
|
|
4682
4618
|
), handleKeyDown = (e) => {
|
|
4683
|
-
if (!treeRef.current)
|
|
4684
|
-
return;
|
|
4619
|
+
if (!treeRef.current) return;
|
|
4685
4620
|
const tree = treeRef.current, selectedNode = tree.selectedNodes[0];
|
|
4686
|
-
if (!selectedNode)
|
|
4687
|
-
return;
|
|
4621
|
+
if (!selectedNode) return;
|
|
4688
4622
|
setIds[selectedNode.id], setStyleBlocks([]);
|
|
4689
4623
|
const isLeaf = !selectedNode.isInternal, isClosed = !selectedNode.isOpen, isOpen = selectedNode.isOpen, shortcut = defaultShortcuts.find((s) => s.key === e.key && (!s.when || eval(s.when)));
|
|
4690
4624
|
if (shortcut)
|
|
@@ -4727,86 +4661,88 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4727
4661
|
"+ ",
|
|
4728
4662
|
t("Add Block")
|
|
4729
4663
|
] })
|
|
4730
|
-
] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.
|
|
4731
|
-
"div",
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4741
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4664
|
+
] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4665
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex h-full select-none flex-col space-y-1"), onClick: () => clearSelection(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4666
|
+
"div",
|
|
4667
|
+
{
|
|
4668
|
+
id: "outline-view",
|
|
4669
|
+
className: "no-scrollbar h-full overflow-y-auto text-sm",
|
|
4670
|
+
onKeyDown: (o) => {
|
|
4671
|
+
treeRef.current.isEditing || handleKeyDown(o);
|
|
4672
|
+
},
|
|
4673
|
+
children: [
|
|
4674
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex items-center justify-end gap-x-2 pb-2 text-sm text-muted-foreground", children: [
|
|
4675
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4676
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4677
|
+
Button,
|
|
4678
|
+
{
|
|
4679
|
+
onClick: () => setHiddenBlocks([]),
|
|
4680
|
+
variant: "outline",
|
|
4681
|
+
className: "h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
4682
|
+
size: "sm",
|
|
4683
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" })
|
|
4684
|
+
}
|
|
4685
|
+
) }),
|
|
4686
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Show hidden blocks") })
|
|
4687
|
+
] }),
|
|
4688
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4689
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
4690
|
+
var o;
|
|
4691
|
+
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
|
|
4692
|
+
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiExpandVertical, { size: "14" }) }) }),
|
|
4693
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
|
|
4694
|
+
] }),
|
|
4695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
4696
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
4697
|
+
var o;
|
|
4698
|
+
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
|
|
4699
|
+
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiCollapseVertical, { size: "14" }) }) }),
|
|
4700
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
|
|
4701
|
+
] })
|
|
4759
4702
|
] }),
|
|
4760
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
}
|
|
4800
|
-
)
|
|
4801
|
-
]
|
|
4802
|
-
}
|
|
4803
|
-
) });
|
|
4804
|
-
}, Outline$1 = ListTree, hasVideoEmbed = (o) => {
|
|
4703
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative z-[9999] ml-5 w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4704
|
+
"div",
|
|
4705
|
+
{
|
|
4706
|
+
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: 0 }),
|
|
4707
|
+
className: "h-1 w-[90%] rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
|
|
4708
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-[45%] top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[3] text-white" }) })
|
|
4709
|
+
}
|
|
4710
|
+
) }),
|
|
4711
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4712
|
+
Tree,
|
|
4713
|
+
{
|
|
4714
|
+
ref: treeRef,
|
|
4715
|
+
height: window.innerHeight - 160,
|
|
4716
|
+
className: "no-scrollbar !h-full max-w-full space-y-1 !overflow-y-auto !overflow-x-hidden",
|
|
4717
|
+
rowClassName: "flex items-center h-full border-b border-transparent",
|
|
4718
|
+
selection: ids[0] || "",
|
|
4719
|
+
onRename,
|
|
4720
|
+
openByDefault: !1,
|
|
4721
|
+
onMove,
|
|
4722
|
+
data: [...filteredTreeData],
|
|
4723
|
+
renderCursor: DefaultCursor,
|
|
4724
|
+
onSelect,
|
|
4725
|
+
childrenAccessor: (o) => o.children,
|
|
4726
|
+
width: "100%",
|
|
4727
|
+
rowHeight: 28,
|
|
4728
|
+
renderDragPreview: DefaultDragPreview,
|
|
4729
|
+
indent: 10,
|
|
4730
|
+
onContextMenu,
|
|
4731
|
+
disableDrop: debouncedDisableDrop,
|
|
4732
|
+
idAccessor: "_id",
|
|
4733
|
+
children: Node
|
|
4734
|
+
}
|
|
4735
|
+
)
|
|
4736
|
+
]
|
|
4737
|
+
}
|
|
4738
|
+
) }),
|
|
4739
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
|
|
4740
|
+
] });
|
|
4741
|
+
}, hasVideoEmbed = (o) => {
|
|
4805
4742
|
const r = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, n = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
4806
4743
|
return r.test(o) || n.test(o);
|
|
4807
4744
|
}, getVideoURLFromHTML = (o) => {
|
|
4808
|
-
if (isEmpty(o))
|
|
4809
|
-
return o;
|
|
4745
|
+
if (isEmpty(o)) return o;
|
|
4810
4746
|
const r = /<video[^>]+src=['"]([^'">]+)['"]/, n = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = o.match(r), l = o.match(n), 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/;
|
|
4811
4747
|
return i && (c.test(i) || d.test(i)) ? i : o;
|
|
4812
4748
|
}, NAME_ATTRIBUTES = ["chai-name", "data-chai-name"], ATTRIBUTE_MAP = {
|
|
@@ -4846,8 +4782,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4846
4782
|
["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
|
|
4847
4783
|
r._type
|
|
4848
4784
|
), getTextContent = (o) => o.map((r) => r.type === "text" ? get(r, "content", "") : isEmpty(r.children) ? "" : getTextContent(r.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
|
|
4849
|
-
if (o.tagName === "svg")
|
|
4850
|
-
return {};
|
|
4785
|
+
if (o.tagName === "svg") return {};
|
|
4851
4786
|
const r = {}, n = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
|
|
4852
4787
|
return forEach(a, ({ key: l, value: i }) => {
|
|
4853
4788
|
if (!includes(NAME_ATTRIBUTES, l))
|
|
@@ -4857,12 +4792,10 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4857
4792
|
c && d ? i = `https://via.placeholder.com/${c == null ? void 0 : c.value}x${d == null ? void 0 : d.value}` : i = "https://via.placeholder.com/150x150";
|
|
4858
4793
|
}
|
|
4859
4794
|
set(r, n[l], getSanitizedValue(i));
|
|
4860
|
-
} else
|
|
4861
|
-
includes(["style", "class", "srcset"], l) || (has(r, "styles_attrs") || (r.styles_attrs = {}), startsWith(l, "@") && (l = l.replace("@", "x-on:")), r.styles_attrs[`${l}`] = getSanitizedValue(i));
|
|
4795
|
+
} else includes(["style", "class", "srcset"], l) || (has(r, "styles_attrs") || (r.styles_attrs = {}), startsWith(l, "@") && (l = l.replace("@", "x-on:")), r.styles_attrs[`${l}`] = getSanitizedValue(i));
|
|
4862
4796
|
}), delete r.class, r;
|
|
4863
4797
|
}, getStyles = (o, r = "styles") => {
|
|
4864
|
-
if (!o.attributes)
|
|
4865
|
-
return { [r]: `${STYLES_KEY},` };
|
|
4798
|
+
if (!o.attributes) return { [r]: `${STYLES_KEY},` };
|
|
4866
4799
|
const n = find(o.attributes, { key: "class" });
|
|
4867
4800
|
if (n) {
|
|
4868
4801
|
const a = n.value;
|
|
@@ -4870,7 +4803,17 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4870
4803
|
}
|
|
4871
4804
|
return { [r]: `${STYLES_KEY},` };
|
|
4872
4805
|
}, getBlockProps = (o) => {
|
|
4873
|
-
const r = get(o, "attributes", []), n = r.find((
|
|
4806
|
+
const r = get(o, "attributes", []), n = r.find((d) => d.key === "data-chai-richtext" || d.key === "chai-richtext"), a = r.find((d) => d.key === "data-chai-lightbox" || d.key === "chai-lightbox"), l = r.find((d) => d.key === "data-chai-dropdown" || d.key === "chai-dropdown"), i = r.find(
|
|
4807
|
+
(d) => d.key === "data-chai-dropdown-button" || d.key === "chai-dropdown-button"
|
|
4808
|
+
), c = r.find(
|
|
4809
|
+
(d) => d.key === "data-chai-dropdown-content" || d.key === "chai-dropdown-content"
|
|
4810
|
+
);
|
|
4811
|
+
if (l)
|
|
4812
|
+
return { _type: "Dropdown" };
|
|
4813
|
+
if (i)
|
|
4814
|
+
return { _type: "DropdownButton" };
|
|
4815
|
+
if (c)
|
|
4816
|
+
return { _type: "DropdownContent" };
|
|
4874
4817
|
if (n)
|
|
4875
4818
|
return { _type: "RichText" };
|
|
4876
4819
|
if (a)
|
|
@@ -4947,25 +4890,31 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4947
4890
|
case "tfoot":
|
|
4948
4891
|
return { _type: "TableFooter" };
|
|
4949
4892
|
default: {
|
|
4950
|
-
const
|
|
4893
|
+
const d = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
4951
4894
|
return {
|
|
4952
|
-
_type:
|
|
4895
|
+
_type: d,
|
|
4953
4896
|
tag: o.tagName,
|
|
4954
|
-
_name:
|
|
4897
|
+
_name: d == "EmptyBox" || o.tagName === "div" ? d : capitalize(o.tagName)
|
|
4955
4898
|
};
|
|
4956
4899
|
}
|
|
4957
4900
|
}
|
|
4958
4901
|
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
4959
|
-
var
|
|
4960
|
-
if (n.type === "comment")
|
|
4961
|
-
|
|
4902
|
+
var h, m, E, y, g, k, _, A;
|
|
4903
|
+
if (n.type === "comment") return [];
|
|
4904
|
+
console.log("node ===>", n);
|
|
4962
4905
|
let a = { _id: generateUUID() };
|
|
4963
4906
|
if (r && (a._parent = r.block._id), n.type === "text")
|
|
4964
4907
|
return isEmpty(get(n, "content", "")) ? [] : r && shouldAddText(r.node, r.block) ? (set(r, "block.content", get(n, "content", "")), []) : { ...a, _type: "Text", content: get(n, "content", "") };
|
|
4965
4908
|
const l = get(n, "attributes", []), i = l.find(
|
|
4966
|
-
(
|
|
4909
|
+
(S) => S.key === "data-chai-richtext" || S.key === "chai-richtext"
|
|
4967
4910
|
), c = l.find(
|
|
4968
|
-
(
|
|
4911
|
+
(S) => S.key === "data-chai-lightbox" || S.key === "chai-lightbox"
|
|
4912
|
+
), d = l.find(
|
|
4913
|
+
(S) => S.key === "data-chai-dropdown" || S.key === "chai-dropdown"
|
|
4914
|
+
), p = l.find(
|
|
4915
|
+
(S) => S.key === "data-chai-dropdown-button" || S.key === "chai-dropdown-button"
|
|
4916
|
+
), u = l.find(
|
|
4917
|
+
(S) => S.key === "data-chai-dropdown-content" || S.key === "chai-dropdown-content"
|
|
4969
4918
|
);
|
|
4970
4919
|
if (a = {
|
|
4971
4920
|
...a,
|
|
@@ -4973,13 +4922,13 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4973
4922
|
...getAttrs(n),
|
|
4974
4923
|
...getStyles(n)
|
|
4975
4924
|
}, n.attributes) {
|
|
4976
|
-
const
|
|
4977
|
-
|
|
4925
|
+
const S = n.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
|
|
4926
|
+
S && (a._name = S.value);
|
|
4978
4927
|
}
|
|
4979
4928
|
if (i)
|
|
4980
4929
|
return a.content = stringify(n.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];
|
|
4981
4930
|
if (c) {
|
|
4982
|
-
const
|
|
4931
|
+
const S = [
|
|
4983
4932
|
"data-chai-lightbox",
|
|
4984
4933
|
"chai-lightbox",
|
|
4985
4934
|
"data-vbtype",
|
|
@@ -4991,33 +4940,57 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
4991
4940
|
];
|
|
4992
4941
|
a = {
|
|
4993
4942
|
...a,
|
|
4994
|
-
href: ((
|
|
4995
|
-
hrefType: ((
|
|
4996
|
-
autoplay: ((
|
|
4997
|
-
maxWidth: ((g = (
|
|
4998
|
-
backdropColor: ((
|
|
4999
|
-
galleryName: ((
|
|
5000
|
-
}, forEach(
|
|
4943
|
+
href: ((h = l.find((v) => v.key === "href")) == null ? void 0 : h.value) || "",
|
|
4944
|
+
hrefType: ((m = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
4945
|
+
autoplay: ((E = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : E.value) === "true" ? "true" : "false",
|
|
4946
|
+
maxWidth: ((g = (y = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : y.value) == null ? void 0 : g.replace("px", "")) || "",
|
|
4947
|
+
backdropColor: ((k = l.find((v) => v.key === "data-overlay")) == null ? void 0 : k.value) || "",
|
|
4948
|
+
galleryName: ((_ = l.find((v) => v.key === "data-gall")) == null ? void 0 : _.value) || ""
|
|
4949
|
+
}, forEach(S, (v) => {
|
|
5001
4950
|
has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
|
|
5002
4951
|
});
|
|
5003
4952
|
}
|
|
4953
|
+
if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
|
|
4954
|
+
delete a.styles_attrs;
|
|
4955
|
+
const S = filter(n.children || [], (R) => (R == null ? void 0 : R.tagName) !== "span");
|
|
4956
|
+
a.content = getTextContent(S);
|
|
4957
|
+
const v = find(
|
|
4958
|
+
n.children || [],
|
|
4959
|
+
(R) => (R == null ? void 0 : R.tagName) === "span" && some(R.children || [], (f) => (f == null ? void 0 : f.tagName) === "svg")
|
|
4960
|
+
);
|
|
4961
|
+
if (v) {
|
|
4962
|
+
const R = find(v.children || [], (f) => (f == null ? void 0 : f.tagName) === "svg");
|
|
4963
|
+
if (R) {
|
|
4964
|
+
a.icon = stringify([R]);
|
|
4965
|
+
const { height: f, width: j } = getSvgDimensions(R, "16px", "16px");
|
|
4966
|
+
a.iconHeight = f, a.iconWidth = j;
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
return [a];
|
|
4970
|
+
}
|
|
5004
4971
|
if (a._type === "Input") {
|
|
5005
|
-
const
|
|
5006
|
-
|
|
4972
|
+
const S = a.inputType || "text";
|
|
4973
|
+
S === "checkbox" ? set(a, "_type", "Checkbox") : S === "radio" && set(a, "_type", "Radio");
|
|
5007
4974
|
} else if (n.tagName === "video" || n.tagName === "iframe") {
|
|
5008
|
-
const
|
|
5009
|
-
return hasVideoEmbed(
|
|
4975
|
+
const S = stringify([n]);
|
|
4976
|
+
return hasVideoEmbed(S) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(S)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = S, [a];
|
|
5010
4977
|
} else if (n.tagName === "svg") {
|
|
5011
|
-
const
|
|
5012
|
-
return a.styles = `${STYLES_KEY}, ${cn(`w-${
|
|
5013
|
-
} else if (n.tagName == "option" && r && ((
|
|
4978
|
+
const S = find(n.attributes, { key: "height" }), v = find(n.attributes, { key: "width" }), R = get(S, "value") ? `[${get(S, "value")}px]` : "24px", f = get(v, "value") ? `[${get(v, "value")}px]` : "24px", j = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
|
|
4979
|
+
return a.styles = `${STYLES_KEY}, ${cn(`w-${f} h-${R}`, j)}`.trim(), n.attributes = filter(n.attributes, (w) => !includes(["style", "width", "height", "class"], w.key)), a.icon = stringify([n]), [a];
|
|
4980
|
+
} else if (n.tagName == "option" && r && ((A = r.block) == null ? void 0 : A._type) === "Select")
|
|
5014
4981
|
return r.block.options.push({
|
|
5015
4982
|
label: getTextContent(n.children),
|
|
5016
4983
|
...getAttrs(n)
|
|
5017
4984
|
}), [];
|
|
5018
|
-
const
|
|
5019
|
-
return [a, ...
|
|
5020
|
-
}),
|
|
4985
|
+
const x = traverseNodes(n.children, { block: a, node: n });
|
|
4986
|
+
return [a, ...x];
|
|
4987
|
+
}), getSvgDimensions = (o, r, n) => {
|
|
4988
|
+
const a = get(o, "attributes", []), l = find(a, { key: "height" }), i = find(a, { key: "width" });
|
|
4989
|
+
return {
|
|
4990
|
+
height: get(l, "value") ? `[${get(l, "value")}px]` : n,
|
|
4991
|
+
width: get(i, "value") ? `[${get(i, "value")}px]` : r
|
|
4992
|
+
};
|
|
4993
|
+
}, getSanitizedHTML = (o) => {
|
|
5021
4994
|
o = o.replace(/(\w+)=\\?"(.*?)\\?"/g, (a, l, i) => {
|
|
5022
4995
|
let c = i.replace(/\\"/g, '"');
|
|
5023
4996
|
return c = c.replace(/{([^}]+)}/g, (d) => d.replace(/"/g, '\\"')), `${l}="${c.replace(/\\"/g, '"')}"`;
|
|
@@ -5052,7 +5025,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
5052
5025
|
] }) }),
|
|
5053
5026
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { disabled: a.trim() === "", onClick: () => c(), size: "sm", className: "w-fit", children: n("Import HTML") }) })
|
|
5054
5027
|
] });
|
|
5055
|
-
},
|
|
5028
|
+
}, BindingWidget = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), getSvgMarkup = (o) => {
|
|
5056
5029
|
try {
|
|
5057
5030
|
const r = document.getElementById("icon-picker-field"), n = document.createElement("div");
|
|
5058
5031
|
ReactDOM.render(/* @__PURE__ */ jsxRuntimeExports.jsx(IconPickerItem, { value: o }), n), r.appendChild(n), n.hidden = !0;
|
|
@@ -5133,13 +5106,13 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
|
|
|
5133
5106
|
] });
|
|
5134
5107
|
};
|
|
5135
5108
|
MediaManagerModal.displayName = "MediaManagerModal";
|
|
5136
|
-
const
|
|
5109
|
+
const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
|
|
5137
5110
|
const l = useBuilderProp("mediaManagerComponent", null), { t: i } = useTranslation(), c = l !== null;
|
|
5138
5111
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
5139
|
-
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
|
|
5112
|
+
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, { onSelect: r, 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]" }) }),
|
|
5140
5113
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
5141
5114
|
c && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5142
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal
|
|
5115
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal, { onSelect: r, 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") }) }),
|
|
5143
5116
|
/* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
|
|
5144
5117
|
] }),
|
|
5145
5118
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5199,101 +5172,99 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5199
5172
|
pageTypes: r,
|
|
5200
5173
|
onChange: n
|
|
5201
5174
|
}) => {
|
|
5202
|
-
var
|
|
5203
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (
|
|
5175
|
+
var w;
|
|
5176
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (b, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [h, m] = useState(""), [E, y] = useState([]), [g, k] = useState(-1), _ = useRef(null), A = (w = r == null ? void 0 : r.find((b) => b.key === u)) == null ? void 0 : w.name;
|
|
5204
5177
|
useEffect(() => {
|
|
5205
|
-
if (
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
R && Array.isArray(R) && g(get(R, [0, "name"], ""));
|
|
5178
|
+
if (m(""), y([]), k(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
5179
|
+
const b = split(o, ":"), C = get(b, 1, "page") || "page";
|
|
5180
|
+
x(C), (async () => {
|
|
5181
|
+
const B = await l(C, [get(b, 2, "page")]);
|
|
5182
|
+
B && Array.isArray(B) && m(get(B, [0, "name"], ""));
|
|
5211
5183
|
})();
|
|
5212
5184
|
}, [o]);
|
|
5213
|
-
const
|
|
5214
|
-
async (
|
|
5215
|
-
if (isEmpty(
|
|
5216
|
-
|
|
5185
|
+
const S = useDebouncedCallback(
|
|
5186
|
+
async (b) => {
|
|
5187
|
+
if (isEmpty(b))
|
|
5188
|
+
y([]);
|
|
5217
5189
|
else {
|
|
5218
|
-
const
|
|
5219
|
-
|
|
5190
|
+
const C = await l(u, b);
|
|
5191
|
+
y(C);
|
|
5220
5192
|
}
|
|
5221
|
-
c(!1),
|
|
5193
|
+
c(!1), k(-1);
|
|
5222
5194
|
},
|
|
5223
5195
|
[u],
|
|
5224
5196
|
300
|
|
5225
|
-
),
|
|
5226
|
-
const
|
|
5227
|
-
|
|
5228
|
-
},
|
|
5229
|
-
switch (
|
|
5197
|
+
), v = (b) => {
|
|
5198
|
+
const C = ["pageType", u, b.id];
|
|
5199
|
+
C[1] && (n(C.join(":")), m(b.name), p(!1), y([]), k(-1));
|
|
5200
|
+
}, R = (b) => {
|
|
5201
|
+
switch (b.key) {
|
|
5230
5202
|
case "ArrowDown":
|
|
5231
|
-
|
|
5203
|
+
b.preventDefault(), k((C) => C < E.length - 1 ? C + 1 : C);
|
|
5232
5204
|
break;
|
|
5233
5205
|
case "ArrowUp":
|
|
5234
|
-
|
|
5206
|
+
b.preventDefault(), k((C) => C > 0 ? C - 1 : C);
|
|
5235
5207
|
break;
|
|
5236
5208
|
case "Enter":
|
|
5237
|
-
if (
|
|
5238
|
-
|
|
5239
|
-
f >= 0 && S(j[f]);
|
|
5209
|
+
if (b.preventDefault(), E.length === 0) return;
|
|
5210
|
+
g >= 0 && v(E[g]);
|
|
5240
5211
|
break;
|
|
5241
5212
|
case "Escape":
|
|
5242
|
-
|
|
5213
|
+
b.preventDefault(), f();
|
|
5243
5214
|
break;
|
|
5244
5215
|
}
|
|
5245
5216
|
};
|
|
5246
5217
|
useEffect(() => {
|
|
5247
|
-
if (
|
|
5248
|
-
const
|
|
5249
|
-
|
|
5218
|
+
if (g >= 0 && _.current) {
|
|
5219
|
+
const b = _.current.children[g];
|
|
5220
|
+
b == null || b.scrollIntoView({ block: "nearest" });
|
|
5250
5221
|
}
|
|
5251
|
-
}, [
|
|
5252
|
-
const
|
|
5253
|
-
|
|
5254
|
-
},
|
|
5255
|
-
|
|
5222
|
+
}, [g]);
|
|
5223
|
+
const f = () => {
|
|
5224
|
+
m(""), y([]), k(-1), p(!1), n("");
|
|
5225
|
+
}, j = (b) => {
|
|
5226
|
+
m(b), p(!isEmpty(b)), c(!0), S(b);
|
|
5256
5227
|
};
|
|
5257
5228
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
5258
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "pageType", value: u, onChange: (
|
|
5229
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "pageType", value: u, onChange: (b) => x(b.target.value), children: map(r, (b) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: b.key, children: b.name }, b.key)) }),
|
|
5259
5230
|
u && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
5260
5231
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5261
5232
|
"input",
|
|
5262
5233
|
{
|
|
5263
5234
|
type: "text",
|
|
5264
5235
|
value: h,
|
|
5265
|
-
onChange: (
|
|
5266
|
-
onKeyDown:
|
|
5267
|
-
placeholder: a(`Search ${
|
|
5236
|
+
onChange: (b) => j(b.target.value),
|
|
5237
|
+
onKeyDown: R,
|
|
5238
|
+
placeholder: a(`Search ${A ?? ""}`),
|
|
5268
5239
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
5269
5240
|
}
|
|
5270
5241
|
),
|
|
5271
|
-
/* @__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:
|
|
5242
|
+
/* @__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: f, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
|
|
5272
5243
|
] }),
|
|
5273
|
-
(i || !isEmpty(
|
|
5244
|
+
(i || !isEmpty(E) || d && isEmpty(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: [
|
|
5274
5245
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
5275
5246
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
5276
|
-
] }) : d && isEmpty(
|
|
5247
|
+
] }) : d && isEmpty(E) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
5277
5248
|
a("No results found for"),
|
|
5278
5249
|
' "',
|
|
5279
5250
|
h,
|
|
5280
5251
|
'"'
|
|
5281
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref:
|
|
5252
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: _, children: map(E == null ? void 0 : E.slice(0, 20), (b, C) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5282
5253
|
"li",
|
|
5283
5254
|
{
|
|
5284
|
-
onClick: () =>
|
|
5285
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
5255
|
+
onClick: () => v(b),
|
|
5256
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(b.id) ? "bg-blue-200" : C === g ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
5286
5257
|
children: [
|
|
5287
|
-
|
|
5258
|
+
b.name,
|
|
5288
5259
|
" ",
|
|
5289
|
-
|
|
5260
|
+
b.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
|
|
5290
5261
|
"( ",
|
|
5291
|
-
|
|
5262
|
+
b.slug,
|
|
5292
5263
|
" )"
|
|
5293
5264
|
] })
|
|
5294
5265
|
]
|
|
5295
5266
|
},
|
|
5296
|
-
|
|
5267
|
+
b.id
|
|
5297
5268
|
)) }) })
|
|
5298
5269
|
] });
|
|
5299
5270
|
}, LinkField = ({ schema: o, formData: r, onChange: n }) => {
|
|
@@ -5350,8 +5321,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5350
5321
|
] });
|
|
5351
5322
|
}, RowColField = () => {
|
|
5352
5323
|
const o = useSelectedBlock(), r = useWrapperBlock(), { addCoreBlock: n } = useAddBlock();
|
|
5353
|
-
if (!o && !r)
|
|
5354
|
-
return null;
|
|
5324
|
+
if (!o && !r) return null;
|
|
5355
5325
|
const a = (o == null ? void 0 : o._type) === "Row" ? o : r;
|
|
5356
5326
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5357
5327
|
"button",
|
|
@@ -5367,8 +5337,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5367
5337
|
) });
|
|
5368
5338
|
}, CodeEditor = ({ id: o, placeholder: r }) => {
|
|
5369
5339
|
const { t: n } = useTranslation(), [, a] = useCodeEditor(), l = useSelectedBlock();
|
|
5370
|
-
if (typeof window > "u")
|
|
5371
|
-
return null;
|
|
5340
|
+
if (typeof window > "u") return null;
|
|
5372
5341
|
const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
|
|
5373
5342
|
const p = l == null ? void 0 : l._id;
|
|
5374
5343
|
a({ blockId: p, blockProp: i, placeholder: r, initialCode: get(l, i, c) });
|
|
@@ -5397,23 +5366,22 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5397
5366
|
schema: u,
|
|
5398
5367
|
formData: x
|
|
5399
5368
|
}) => {
|
|
5400
|
-
const { selectedLang: h, fallbackLang:
|
|
5369
|
+
const { selectedLang: h, fallbackLang: m, languages: E } = useLanguages(), y = isEmpty(E) ? "" : isEmpty(h) ? m : h, g = get(LANGUAGES, y, y), k = useSelectedBlock(), _ = useRegisteredChaiBlocks(), A = get(_, [k == null ? void 0 : k._type, "i18nProps"], []) || [], [S, v] = useState(null);
|
|
5401
5370
|
if (d)
|
|
5402
5371
|
return null;
|
|
5403
|
-
if (u.type === "boolean")
|
|
5404
|
-
|
|
5405
|
-
const T = B == null ? void 0 : B.includes(o.replace("root.", ""));
|
|
5372
|
+
if (u.type === "boolean") return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: r, children: a });
|
|
5373
|
+
const f = A == null ? void 0 : A.includes(o.replace("root.", ""));
|
|
5406
5374
|
if (u.type === "array") {
|
|
5407
|
-
const
|
|
5375
|
+
const j = S === o;
|
|
5408
5376
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${r} relative`, children: [
|
|
5409
5377
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5410
5378
|
"label",
|
|
5411
5379
|
{
|
|
5412
5380
|
htmlFor: o,
|
|
5413
|
-
onClick: () =>
|
|
5381
|
+
onClick: () => v(j ? null : o),
|
|
5414
5382
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
5415
5383
|
children: [
|
|
5416
|
-
|
|
5384
|
+
j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
5417
5385
|
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-3 w-3" }),
|
|
5418
5386
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-tight", children: n }),
|
|
5419
5387
|
" ",
|
|
@@ -5421,7 +5389,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5421
5389
|
]
|
|
5422
5390
|
}
|
|
5423
5391
|
),
|
|
5424
|
-
(x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${
|
|
5392
|
+
(x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${j ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
5425
5393
|
c,
|
|
5426
5394
|
a,
|
|
5427
5395
|
l,
|
|
@@ -5433,9 +5401,9 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5433
5401
|
u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
|
|
5434
5402
|
n,
|
|
5435
5403
|
" ",
|
|
5436
|
-
|
|
5404
|
+
f && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5437
5405
|
" ",
|
|
5438
|
-
|
|
5406
|
+
g
|
|
5439
5407
|
] }),
|
|
5440
5408
|
p && u.type !== "object" ? " *" : null
|
|
5441
5409
|
] }),
|
|
@@ -5498,8 +5466,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5498
5466
|
);
|
|
5499
5467
|
}), CanvasSettings = () => {
|
|
5500
5468
|
const [o, r] = useAtom$1(xShowBlocksAtom), n = useSelectedBlock(), [, a] = useSelectedBlockIds(), { t: l } = useTranslation(), i = useMemo(() => (n ? JSON.stringify(n) : "").includes('"x-show"'), [n]);
|
|
5501
|
-
if (!n || !i)
|
|
5502
|
-
return null;
|
|
5469
|
+
if (!n || !i) return null;
|
|
5503
5470
|
const c = o.includes(n._id);
|
|
5504
5471
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-2 text-xs hover:no-underline", children: [
|
|
5505
5472
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 border-b border-border bg-background py-2 font-normal text-muted-foreground", children: [
|
|
@@ -5562,50 +5529,50 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
|
|
|
5562
5529
|
return set(n, o, r), n;
|
|
5563
5530
|
};
|
|
5564
5531
|
function BlockSettings() {
|
|
5565
|
-
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type),
|
|
5566
|
-
if (
|
|
5567
|
-
const
|
|
5568
|
-
a([r._id], { [
|
|
5532
|
+
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), m = formDataWithSelectedLang(x, o, h), E = ({ formData: R }, f, j) => {
|
|
5533
|
+
if (f && (c == null ? void 0 : c._id) === r._id) {
|
|
5534
|
+
const w = f.replace("root.", "");
|
|
5535
|
+
a([r._id], { [w]: get(R, w) }, j);
|
|
5569
5536
|
}
|
|
5570
|
-
},
|
|
5571
|
-
debounce(({ formData:
|
|
5572
|
-
|
|
5537
|
+
}, y = useCallback(
|
|
5538
|
+
debounce(({ formData: R }, f, j) => {
|
|
5539
|
+
E({ formData: R }, f, j), d(R);
|
|
5573
5540
|
}, 1500),
|
|
5574
5541
|
[r == null ? void 0 : r._id, o]
|
|
5575
|
-
),
|
|
5576
|
-
if (
|
|
5577
|
-
const
|
|
5542
|
+
), g = ({ formData: R }, f) => {
|
|
5543
|
+
if (f) {
|
|
5544
|
+
const j = f.replace("root.", "");
|
|
5578
5545
|
n(
|
|
5579
5546
|
[r._id],
|
|
5580
|
-
convertDotNotationToObject(
|
|
5581
|
-
),
|
|
5547
|
+
convertDotNotationToObject(j, get(R, j.split(".")))
|
|
5548
|
+
), y({ formData: R }, f, { [j]: get(c, j) });
|
|
5582
5549
|
}
|
|
5583
|
-
},
|
|
5584
|
-
if (
|
|
5585
|
-
const
|
|
5550
|
+
}, k = ({ formData: R }, f) => {
|
|
5551
|
+
if (f) {
|
|
5552
|
+
const j = f.replace("root.", "");
|
|
5586
5553
|
n(
|
|
5587
5554
|
[x._id],
|
|
5588
|
-
convertDotNotationToObject(
|
|
5589
|
-
),
|
|
5555
|
+
convertDotNotationToObject(j, get(R, j.split(".")))
|
|
5556
|
+
), y({ formData: R }, f, { [j]: get(c, j) });
|
|
5590
5557
|
}
|
|
5591
5558
|
};
|
|
5592
5559
|
keys(get(i, "_bindings", {}));
|
|
5593
|
-
const { schema:
|
|
5594
|
-
const
|
|
5595
|
-
if (
|
|
5596
|
-
return getBlockFormSchemas(
|
|
5597
|
-
}, [r]), { wrapperSchema:
|
|
5560
|
+
const { schema: _, uiSchema: A } = useMemo(() => {
|
|
5561
|
+
const R = r == null ? void 0 : r._type;
|
|
5562
|
+
if (R)
|
|
5563
|
+
return getBlockFormSchemas(R);
|
|
5564
|
+
}, [r]), { wrapperSchema: S, wrapperUiSchema: v } = useMemo(() => {
|
|
5598
5565
|
if (!x || !(x != null && x._type))
|
|
5599
5566
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5600
|
-
const
|
|
5601
|
-
return { wrapperSchema:
|
|
5567
|
+
const R = x == null ? void 0 : x._type, { schema: f = {}, uiSchema: j = {} } = getBlockFormSchemas(R);
|
|
5568
|
+
return { wrapperSchema: f, wrapperUiSchema: j };
|
|
5602
5569
|
}, [x]);
|
|
5603
5570
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5604
5571
|
!isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5605
5572
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5606
5573
|
"div",
|
|
5607
5574
|
{
|
|
5608
|
-
onClick: () => u((
|
|
5575
|
+
onClick: () => u((R) => !R),
|
|
5609
5576
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5610
5577
|
children: [
|
|
5611
5578
|
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4 stroke-[3] text-slate-400" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-4 w-4 stroke-[3] text-slate-400" }),
|
|
@@ -5624,21 +5591,21 @@ function BlockSettings() {
|
|
|
5624
5591
|
JSONForm,
|
|
5625
5592
|
{
|
|
5626
5593
|
id: x == null ? void 0 : x._id,
|
|
5627
|
-
onChange:
|
|
5628
|
-
formData:
|
|
5629
|
-
schema:
|
|
5630
|
-
uiSchema:
|
|
5594
|
+
onChange: k,
|
|
5595
|
+
formData: m,
|
|
5596
|
+
schema: S,
|
|
5597
|
+
uiSchema: v
|
|
5631
5598
|
}
|
|
5632
5599
|
)
|
|
5633
5600
|
] }),
|
|
5634
|
-
isEmpty(
|
|
5601
|
+
isEmpty(_) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5635
5602
|
JSONForm,
|
|
5636
5603
|
{
|
|
5637
5604
|
id: r == null ? void 0 : r._id,
|
|
5638
|
-
onChange:
|
|
5605
|
+
onChange: g,
|
|
5639
5606
|
formData: i,
|
|
5640
|
-
schema:
|
|
5641
|
-
uiSchema:
|
|
5607
|
+
schema: _,
|
|
5608
|
+
uiSchema: A
|
|
5642
5609
|
}
|
|
5643
5610
|
),
|
|
5644
5611
|
(r == null ? void 0 : r._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
|
|
@@ -5666,8 +5633,7 @@ function Countdown() {
|
|
|
5666
5633
|
r(o - 0.1);
|
|
5667
5634
|
}, 100);
|
|
5668
5635
|
return () => clearTimeout(p);
|
|
5669
|
-
} else
|
|
5670
|
-
o <= 0 && (a(!1), r(SECONDS));
|
|
5636
|
+
} else o <= 0 && (a(!1), r(SECONDS));
|
|
5671
5637
|
}, [n, o]);
|
|
5672
5638
|
const l = () => {
|
|
5673
5639
|
a(!0), r(SECONDS);
|
|
@@ -5712,12 +5678,12 @@ function Countdown() {
|
|
|
5712
5678
|
const AskAIStyles = ({ blockId: o }) => {
|
|
5713
5679
|
const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, x] = useState();
|
|
5714
5680
|
useEffect(() => {
|
|
5715
|
-
var
|
|
5716
|
-
(
|
|
5681
|
+
var m;
|
|
5682
|
+
(m = d.current) == null || m.focus();
|
|
5717
5683
|
}, []);
|
|
5718
|
-
const h = (
|
|
5719
|
-
const { usage:
|
|
5720
|
-
!l &&
|
|
5684
|
+
const h = (m) => {
|
|
5685
|
+
const { usage: E } = m || {};
|
|
5686
|
+
!l && E && x(E), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
|
|
5721
5687
|
};
|
|
5722
5688
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5723
5689
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: r("Ask AI") }),
|
|
@@ -5726,12 +5692,12 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5726
5692
|
{
|
|
5727
5693
|
ref: d,
|
|
5728
5694
|
value: i,
|
|
5729
|
-
onChange: (
|
|
5695
|
+
onChange: (m) => c(m.target.value),
|
|
5730
5696
|
placeholder: r("Ask AI to edit styles"),
|
|
5731
5697
|
className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
|
|
5732
5698
|
rows: 4,
|
|
5733
|
-
onKeyDown: (
|
|
5734
|
-
|
|
5699
|
+
onKeyDown: (m) => {
|
|
5700
|
+
m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, h));
|
|
5735
5701
|
}
|
|
5736
5702
|
}
|
|
5737
5703
|
),
|
|
@@ -5772,37 +5738,37 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
5772
5738
|
] });
|
|
5773
5739
|
};
|
|
5774
5740
|
function ManualClasses() {
|
|
5775
|
-
var
|
|
5776
|
-
const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (
|
|
5777
|
-
const
|
|
5778
|
-
l(c,
|
|
5779
|
-
}, [
|
|
5780
|
-
const
|
|
5781
|
-
let
|
|
5782
|
-
if (
|
|
5783
|
-
const [
|
|
5784
|
-
|
|
5741
|
+
var f;
|
|
5742
|
+
const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (f = first(n)) == null ? void 0 : f.prop, m = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), E = () => {
|
|
5743
|
+
const j = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
5744
|
+
l(c, j, !0), u("");
|
|
5745
|
+
}, [y, g] = useState([]), k = ({ value: j }) => {
|
|
5746
|
+
const w = j.trim().toLowerCase(), b = w.match(/.+:/g);
|
|
5747
|
+
let C = [];
|
|
5748
|
+
if (b && b.length > 0) {
|
|
5749
|
+
const [B] = b, N = w.replace(B, "");
|
|
5750
|
+
C = o.search(N).map((I) => ({
|
|
5785
5751
|
...I,
|
|
5786
|
-
item: { ...I.item, name:
|
|
5752
|
+
item: { ...I.item, name: B + I.item.name }
|
|
5787
5753
|
}));
|
|
5788
5754
|
} else
|
|
5789
|
-
|
|
5790
|
-
return
|
|
5791
|
-
},
|
|
5792
|
-
|
|
5793
|
-
},
|
|
5755
|
+
C = o.search(w);
|
|
5756
|
+
return g(map(C, "item"));
|
|
5757
|
+
}, _ = () => {
|
|
5758
|
+
g([]);
|
|
5759
|
+
}, A = (j) => j.name, S = (j) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: j.name }), v = {
|
|
5794
5760
|
autoComplete: "off",
|
|
5795
5761
|
autoCorrect: "off",
|
|
5796
5762
|
autoCapitalize: "off",
|
|
5797
5763
|
spellCheck: !1,
|
|
5798
5764
|
placeholder: r("Enter classes separated by space"),
|
|
5799
5765
|
value: p,
|
|
5800
|
-
onKeyDown: (
|
|
5801
|
-
|
|
5766
|
+
onKeyDown: (j) => {
|
|
5767
|
+
j.key === "Enter" && p.trim() !== "" && E();
|
|
5802
5768
|
},
|
|
5803
|
-
onChange: (
|
|
5769
|
+
onChange: (j, { newValue: w }) => u(w),
|
|
5804
5770
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
5805
|
-
},
|
|
5771
|
+
}, R = () => {
|
|
5806
5772
|
if (navigator.clipboard === void 0) {
|
|
5807
5773
|
x({
|
|
5808
5774
|
title: r("Clipboard not supported"),
|
|
@@ -5811,7 +5777,7 @@ function ManualClasses() {
|
|
|
5811
5777
|
});
|
|
5812
5778
|
return;
|
|
5813
5779
|
}
|
|
5814
|
-
navigator.clipboard.writeText(
|
|
5780
|
+
navigator.clipboard.writeText(m.join(" ")), x({
|
|
5815
5781
|
title: r("Copied"),
|
|
5816
5782
|
description: r("Classes copied to clipboard")
|
|
5817
5783
|
});
|
|
@@ -5819,13 +5785,13 @@ function ManualClasses() {
|
|
|
5819
5785
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5820
5786
|
"div",
|
|
5821
5787
|
{
|
|
5822
|
-
className: `flex ${
|
|
5788
|
+
className: `flex ${y.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
|
|
5823
5789
|
children: [
|
|
5824
5790
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
5825
5791
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
5826
5792
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: r("Classes") }),
|
|
5827
5793
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
5828
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick:
|
|
5794
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
|
|
5829
5795
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: r("Copy classes to clipboard") }) })
|
|
5830
5796
|
] })
|
|
5831
5797
|
] }),
|
|
@@ -5841,12 +5807,12 @@ function ManualClasses() {
|
|
|
5841
5807
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5842
5808
|
Autosuggest,
|
|
5843
5809
|
{
|
|
5844
|
-
suggestions:
|
|
5845
|
-
onSuggestionsFetchRequested:
|
|
5846
|
-
onSuggestionsClearRequested:
|
|
5847
|
-
getSuggestionValue:
|
|
5848
|
-
renderSuggestion:
|
|
5849
|
-
inputProps:
|
|
5810
|
+
suggestions: y,
|
|
5811
|
+
onSuggestionsFetchRequested: k,
|
|
5812
|
+
onSuggestionsClearRequested: _,
|
|
5813
|
+
getSuggestionValue: A,
|
|
5814
|
+
renderSuggestion: S,
|
|
5815
|
+
inputProps: v,
|
|
5850
5816
|
containerProps: {
|
|
5851
5817
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
5852
5818
|
},
|
|
@@ -5862,7 +5828,7 @@ function ManualClasses() {
|
|
|
5862
5828
|
{
|
|
5863
5829
|
variant: "outline",
|
|
5864
5830
|
className: "h-6 border-border",
|
|
5865
|
-
onClick:
|
|
5831
|
+
onClick: E,
|
|
5866
5832
|
disabled: p.trim() === "",
|
|
5867
5833
|
size: "sm",
|
|
5868
5834
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
|
|
@@ -5870,22 +5836,22 @@ function ManualClasses() {
|
|
|
5870
5836
|
)
|
|
5871
5837
|
] }),
|
|
5872
5838
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
|
|
5873
|
-
|
|
5839
|
+
m.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5874
5840
|
"div",
|
|
5875
5841
|
{
|
|
5876
5842
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
5877
5843
|
children: [
|
|
5878
|
-
|
|
5844
|
+
j,
|
|
5879
5845
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5880
5846
|
Cross2Icon,
|
|
5881
5847
|
{
|
|
5882
|
-
onClick: () => i(c, [
|
|
5848
|
+
onClick: () => i(c, [j]),
|
|
5883
5849
|
className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
|
|
5884
5850
|
}
|
|
5885
5851
|
)
|
|
5886
5852
|
]
|
|
5887
5853
|
},
|
|
5888
|
-
|
|
5854
|
+
j
|
|
5889
5855
|
))
|
|
5890
5856
|
) })
|
|
5891
5857
|
]
|
|
@@ -6276,10 +6242,10 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6276
6242
|
ringColor: "ring",
|
|
6277
6243
|
ringOffsetColor: "ring-offset"
|
|
6278
6244
|
}, ColorChoice = ({ property: o, onChange: r }) => {
|
|
6279
|
-
const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""), h = get(u, "2", ""),
|
|
6245
|
+
const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
|
|
6280
6246
|
// eslint-disable-next-line no-shadow
|
|
6281
|
-
(
|
|
6282
|
-
["current", "inherit", "transparent", "black", "white"].includes(
|
|
6247
|
+
(g) => {
|
|
6248
|
+
["current", "inherit", "transparent", "black", "white"].includes(g) ? (c([]), p({ color: g })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((k) => ({ ...k, color: g, shade: k.shade ? k.shade : "500" })));
|
|
6283
6249
|
},
|
|
6284
6250
|
[c, p]
|
|
6285
6251
|
);
|
|
@@ -6288,28 +6254,28 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6288
6254
|
return c([]);
|
|
6289
6255
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
6290
6256
|
}, [x]);
|
|
6291
|
-
const
|
|
6257
|
+
const E = useCallback(
|
|
6292
6258
|
// eslint-disable-next-line no-shadow
|
|
6293
|
-
(
|
|
6294
|
-
p({ color: x, shade:
|
|
6259
|
+
(g) => {
|
|
6260
|
+
p({ color: x, shade: g });
|
|
6295
6261
|
},
|
|
6296
6262
|
[x]
|
|
6297
6263
|
);
|
|
6298
6264
|
useEffect(() => {
|
|
6299
6265
|
p({ color: "", shade: "" });
|
|
6300
6266
|
}, [n]);
|
|
6301
|
-
const { match:
|
|
6267
|
+
const { match: y } = useTailwindClassList();
|
|
6302
6268
|
return useEffect(() => {
|
|
6303
|
-
const
|
|
6304
|
-
|
|
6305
|
-
}, [
|
|
6269
|
+
const k = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
6270
|
+
y(o, k) && r(k, o);
|
|
6271
|
+
}, [y, d, r, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
6306
6272
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6307
6273
|
DropDown,
|
|
6308
6274
|
{
|
|
6309
6275
|
disabled: !l,
|
|
6310
6276
|
rounded: !0,
|
|
6311
6277
|
selected: x,
|
|
6312
|
-
onChange:
|
|
6278
|
+
onChange: m,
|
|
6313
6279
|
options: [
|
|
6314
6280
|
"current",
|
|
6315
6281
|
"transparent",
|
|
@@ -6342,7 +6308,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6342
6308
|
]
|
|
6343
6309
|
}
|
|
6344
6310
|
) }),
|
|
6345
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !x || !l, onChange:
|
|
6311
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !x || !l, onChange: E, options: i }) })
|
|
6346
6312
|
] });
|
|
6347
6313
|
}, getUserInputValues = (o, r) => {
|
|
6348
6314
|
o = o.toLowerCase();
|
|
@@ -6357,12 +6323,9 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6357
6323
|
const r = o.startsWith("-") ? "-" : "", n = o.split("-").pop();
|
|
6358
6324
|
if (["auto", "none"].includes(n))
|
|
6359
6325
|
return { value: "", unit: n };
|
|
6360
|
-
if (n === "px")
|
|
6361
|
-
|
|
6362
|
-
if (n === "
|
|
6363
|
-
return { value: "100", unit: o.indexOf("w-") !== -1 ? "vw" : "vh" };
|
|
6364
|
-
if (n === "full")
|
|
6365
|
-
return { value: "100", unit: "%" };
|
|
6326
|
+
if (n === "px") return { value: "1", unit: "px" };
|
|
6327
|
+
if (n === "screen") return { value: "100", unit: o.indexOf("w-") !== -1 ? "vw" : "vh" };
|
|
6328
|
+
if (n === "full") return { value: "100", unit: "%" };
|
|
6366
6329
|
if (includes(o, "skew-"))
|
|
6367
6330
|
return { value: `${r}${n}`, unit: "deg" };
|
|
6368
6331
|
if (includes(o, "rotate-"))
|
|
@@ -6377,105 +6340,60 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6377
6340
|
return { value: `${r}${`${n / 100}`}`, unit: "-" };
|
|
6378
6341
|
if (startsWith(o, "border")) {
|
|
6379
6342
|
const a = o.match(/border-?(x|y|t|r|b|l)?\d+/g);
|
|
6380
|
-
if (a)
|
|
6381
|
-
|
|
6382
|
-
if (o.match(/border-?(x|y|t|r|b|l)?/g))
|
|
6383
|
-
return { value: "1", unit: "px" };
|
|
6343
|
+
if (a) return { value: a[0].split("-").pop(), unit: "px" };
|
|
6344
|
+
if (o.match(/border-?(x|y|t|r|b|l)?/g)) return { value: "1", unit: "px" };
|
|
6384
6345
|
}
|
|
6385
6346
|
if (startsWith(o, "max-w-")) {
|
|
6386
|
-
if (o === "max-w-screen-sm")
|
|
6387
|
-
|
|
6388
|
-
if (o === "max-w-screen-
|
|
6389
|
-
|
|
6390
|
-
if (o === "max-w-screen-
|
|
6391
|
-
|
|
6392
|
-
if (
|
|
6393
|
-
|
|
6394
|
-
if (
|
|
6395
|
-
|
|
6396
|
-
if (n === "
|
|
6397
|
-
|
|
6398
|
-
if (n === "
|
|
6399
|
-
|
|
6400
|
-
if (n === "
|
|
6401
|
-
|
|
6402
|
-
if (n === "
|
|
6403
|
-
return { value: "512", unit: "px" };
|
|
6404
|
-
if (n === "xl")
|
|
6405
|
-
return { value: "576", unit: "px" };
|
|
6406
|
-
if (n === "2xl")
|
|
6407
|
-
return { value: "672", unit: "px" };
|
|
6408
|
-
if (n === "3xl")
|
|
6409
|
-
return { value: "768", unit: "px" };
|
|
6410
|
-
if (n === "4xl")
|
|
6411
|
-
return { value: "896", unit: "px" };
|
|
6412
|
-
if (n === "5xl")
|
|
6413
|
-
return { value: "1024", unit: "px" };
|
|
6414
|
-
if (n === "6xl")
|
|
6415
|
-
return { value: "1152", unit: "px" };
|
|
6416
|
-
if (n === "7xl")
|
|
6417
|
-
return { value: "1280", unit: "px" };
|
|
6418
|
-
if (n === "prose")
|
|
6419
|
-
return { value: "65", unit: "ch" };
|
|
6347
|
+
if (o === "max-w-screen-sm") return { value: "640", unit: "px" };
|
|
6348
|
+
if (o === "max-w-screen-md") return { value: "768", unit: "px" };
|
|
6349
|
+
if (o === "max-w-screen-lg") return { value: "1024", unit: "px" };
|
|
6350
|
+
if (o === "max-w-screen-xl") return { value: "1280", unit: "px" };
|
|
6351
|
+
if (o === "max-w-screen-2xl") return { value: "1536", unit: "px" };
|
|
6352
|
+
if (n === "xs") return { value: "320", unit: "px" };
|
|
6353
|
+
if (n === "sm") return { value: "384", unit: "px" };
|
|
6354
|
+
if (n === "md") return { value: "448", unit: "px" };
|
|
6355
|
+
if (n === "lg") return { value: "512", unit: "px" };
|
|
6356
|
+
if (n === "xl") return { value: "576", unit: "px" };
|
|
6357
|
+
if (n === "2xl") return { value: "672", unit: "px" };
|
|
6358
|
+
if (n === "3xl") return { value: "768", unit: "px" };
|
|
6359
|
+
if (n === "4xl") return { value: "896", unit: "px" };
|
|
6360
|
+
if (n === "5xl") return { value: "1024", unit: "px" };
|
|
6361
|
+
if (n === "6xl") return { value: "1152", unit: "px" };
|
|
6362
|
+
if (n === "7xl") return { value: "1280", unit: "px" };
|
|
6363
|
+
if (n === "prose") return { value: "65", unit: "ch" };
|
|
6420
6364
|
}
|
|
6421
6365
|
if (startsWith(o, "text-")) {
|
|
6422
|
-
if (n === "xs")
|
|
6423
|
-
|
|
6424
|
-
if (n === "
|
|
6425
|
-
|
|
6426
|
-
if (n === "
|
|
6427
|
-
|
|
6428
|
-
if (n === "
|
|
6429
|
-
|
|
6430
|
-
if (n === "
|
|
6431
|
-
|
|
6432
|
-
if (n === "
|
|
6433
|
-
|
|
6434
|
-
if (n === "
|
|
6435
|
-
return { value: "30", unit: "px" };
|
|
6436
|
-
if (n === "4xl")
|
|
6437
|
-
return { value: "36", unit: "px" };
|
|
6438
|
-
if (n === "5xl")
|
|
6439
|
-
return { value: "48", unit: "px" };
|
|
6440
|
-
if (n === "6xl")
|
|
6441
|
-
return { value: "60", unit: "px" };
|
|
6442
|
-
if (n === "7xl")
|
|
6443
|
-
return { value: "72", unit: "px" };
|
|
6444
|
-
if (n === "8xl")
|
|
6445
|
-
return { value: "96", unit: "px" };
|
|
6446
|
-
if (n === "9xl")
|
|
6447
|
-
return { value: "128", unit: "px" };
|
|
6366
|
+
if (n === "xs") return { value: "12", unit: "px" };
|
|
6367
|
+
if (n === "sm") return { value: "14", unit: "px" };
|
|
6368
|
+
if (n === "base") return { value: "16", unit: "px" };
|
|
6369
|
+
if (n === "lg") return { value: "18", unit: "px" };
|
|
6370
|
+
if (n === "xl") return { value: "20", unit: "px" };
|
|
6371
|
+
if (n === "2xl") return { value: "24", unit: "px" };
|
|
6372
|
+
if (n === "3xl") return { value: "30", unit: "px" };
|
|
6373
|
+
if (n === "4xl") return { value: "36", unit: "px" };
|
|
6374
|
+
if (n === "5xl") return { value: "48", unit: "px" };
|
|
6375
|
+
if (n === "6xl") return { value: "60", unit: "px" };
|
|
6376
|
+
if (n === "7xl") return { value: "72", unit: "px" };
|
|
6377
|
+
if (n === "8xl") return { value: "96", unit: "px" };
|
|
6378
|
+
if (n === "9xl") return { value: "128", unit: "px" };
|
|
6448
6379
|
}
|
|
6449
6380
|
if (startsWith(o, "leading-")) {
|
|
6450
|
-
if (n === "none")
|
|
6451
|
-
|
|
6452
|
-
if (n === "
|
|
6453
|
-
|
|
6454
|
-
if (n === "
|
|
6455
|
-
|
|
6456
|
-
if (n === "normal")
|
|
6457
|
-
return { value: "1.5", unit: "-" };
|
|
6458
|
-
if (n === "relaxed")
|
|
6459
|
-
return { value: "1.625", unit: "-" };
|
|
6460
|
-
if (n === "loose")
|
|
6461
|
-
return { value: "2", unit: "-" };
|
|
6381
|
+
if (n === "none") return { value: "1", unit: "-" };
|
|
6382
|
+
if (n === "tight") return { value: "1.25", unit: "-" };
|
|
6383
|
+
if (n === "snug") return { value: "1.375", unit: "-" };
|
|
6384
|
+
if (n === "normal") return { value: "1.5", unit: "-" };
|
|
6385
|
+
if (n === "relaxed") return { value: "1.625", unit: "-" };
|
|
6386
|
+
if (n === "loose") return { value: "2", unit: "-" };
|
|
6462
6387
|
}
|
|
6463
6388
|
if (startsWith(o, "tracking-")) {
|
|
6464
|
-
if (n === "tighter")
|
|
6465
|
-
|
|
6466
|
-
if (n === "
|
|
6467
|
-
|
|
6468
|
-
if (n === "
|
|
6469
|
-
|
|
6470
|
-
if (n === "wide")
|
|
6471
|
-
return { value: "0.025", unit: "em" };
|
|
6472
|
-
if (n === "wider")
|
|
6473
|
-
return { value: "0.05", unit: "em" };
|
|
6474
|
-
if (n === "widest")
|
|
6475
|
-
return { value: "0.1", unit: "em" };
|
|
6389
|
+
if (n === "tighter") return { value: "-0.05", unit: "em" };
|
|
6390
|
+
if (n === "tight") return { value: "-0.025", unit: "em" };
|
|
6391
|
+
if (n === "normal") return { value: "0", unit: "em" };
|
|
6392
|
+
if (n === "wide") return { value: "0.025", unit: "em" };
|
|
6393
|
+
if (n === "wider") return { value: "0.05", unit: "em" };
|
|
6394
|
+
if (n === "widest") return { value: "0.1", unit: "em" };
|
|
6476
6395
|
}
|
|
6477
|
-
if (["max", "min", "fit"].includes(n))
|
|
6478
|
-
return { value: o, unit: "class" };
|
|
6396
|
+
if (["max", "min", "fit"].includes(n)) return { value: o, unit: "class" };
|
|
6479
6397
|
if (n.includes("/")) {
|
|
6480
6398
|
const [a, l] = map(n.split("/"), (i) => parseInt(i, 10));
|
|
6481
6399
|
return { value: r + (a / l * 100).toFixed(2).replace(".00", ""), unit: "%" };
|
|
@@ -6537,50 +6455,50 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6537
6455
|
},
|
|
6538
6456
|
a
|
|
6539
6457
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
6540
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [h,
|
|
6458
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, y] = useState(!1), [g, k] = useState(""), [_, A] = useState(!1), [S, v] = useState(!1);
|
|
6541
6459
|
useEffect(() => {
|
|
6542
|
-
const { value:
|
|
6543
|
-
if (
|
|
6544
|
-
l(
|
|
6460
|
+
const { value: b, unit: C } = getClassValueAndUnit(i);
|
|
6461
|
+
if (C === "") {
|
|
6462
|
+
l(b), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
6545
6463
|
return;
|
|
6546
6464
|
}
|
|
6547
|
-
|
|
6465
|
+
m(C), l(C === "class" || isEmpty(b) ? "" : b);
|
|
6548
6466
|
}, [i, p, u]);
|
|
6549
|
-
const
|
|
6550
|
-
(
|
|
6551
|
-
const
|
|
6552
|
-
if (get(
|
|
6553
|
-
|
|
6467
|
+
const R = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), f = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), j = useCallback(
|
|
6468
|
+
(b = !1) => {
|
|
6469
|
+
const C = getUserInputValues(`${a}`, u);
|
|
6470
|
+
if (get(C, "error", !1)) {
|
|
6471
|
+
y(!0);
|
|
6554
6472
|
return;
|
|
6555
6473
|
}
|
|
6556
|
-
const
|
|
6557
|
-
if (
|
|
6558
|
-
|
|
6474
|
+
const B = get(C, "unit") !== "" ? get(C, "unit") : h;
|
|
6475
|
+
if (B === "auto" || B === "none") {
|
|
6476
|
+
R(`${d}${B}`);
|
|
6559
6477
|
return;
|
|
6560
6478
|
}
|
|
6561
|
-
if (get(
|
|
6479
|
+
if (get(C, "value") === "")
|
|
6562
6480
|
return;
|
|
6563
|
-
const
|
|
6564
|
-
|
|
6481
|
+
const D = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
|
|
6482
|
+
b ? f(D) : R(D);
|
|
6565
6483
|
},
|
|
6566
|
-
[
|
|
6567
|
-
),
|
|
6568
|
-
(
|
|
6569
|
-
const
|
|
6570
|
-
if (get(
|
|
6571
|
-
|
|
6484
|
+
[R, f, a, h, d, u]
|
|
6485
|
+
), w = useCallback(
|
|
6486
|
+
(b) => {
|
|
6487
|
+
const C = getUserInputValues(`${a}`, u);
|
|
6488
|
+
if (get(C, "error", !1)) {
|
|
6489
|
+
y(!0);
|
|
6572
6490
|
return;
|
|
6573
6491
|
}
|
|
6574
|
-
if (
|
|
6575
|
-
|
|
6492
|
+
if (b === "auto" || b === "none") {
|
|
6493
|
+
R(`${d}${b}`);
|
|
6576
6494
|
return;
|
|
6577
6495
|
}
|
|
6578
|
-
if (get(
|
|
6496
|
+
if (get(C, "value") === "")
|
|
6579
6497
|
return;
|
|
6580
|
-
const
|
|
6581
|
-
|
|
6498
|
+
const B = get(C, "unit") !== "" ? get(C, "unit") : b, D = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
|
|
6499
|
+
R(D);
|
|
6582
6500
|
},
|
|
6583
|
-
[
|
|
6501
|
+
[R, a, d, u]
|
|
6584
6502
|
);
|
|
6585
6503
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6586
6504
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6595,40 +6513,40 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6595
6513
|
/* @__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, {}) }) }),
|
|
6596
6514
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
6597
6515
|
] })
|
|
6598
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${
|
|
6516
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${_ ? "z-auto" : ""}`, children: [
|
|
6599
6517
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
6600
6518
|
["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6601
6519
|
"input",
|
|
6602
6520
|
{
|
|
6603
6521
|
readOnly: h === "class",
|
|
6604
|
-
onKeyPress: (
|
|
6605
|
-
|
|
6522
|
+
onKeyPress: (b) => {
|
|
6523
|
+
b.key === "Enter" && j();
|
|
6606
6524
|
},
|
|
6607
|
-
onKeyDown: (
|
|
6608
|
-
if (
|
|
6525
|
+
onKeyDown: (b) => {
|
|
6526
|
+
if (b.keyCode !== 38 && b.keyCode !== 40)
|
|
6609
6527
|
return;
|
|
6610
|
-
|
|
6611
|
-
const
|
|
6612
|
-
let
|
|
6613
|
-
|
|
6614
|
-
const
|
|
6615
|
-
|
|
6528
|
+
b.preventDefault(), v(!0);
|
|
6529
|
+
const C = parseInt$1(b.target.value);
|
|
6530
|
+
let B = isNaN$1(C) ? 0 : C;
|
|
6531
|
+
b.keyCode === 38 && (B += 1), b.keyCode === 40 && (B -= 1);
|
|
6532
|
+
const N = `${B}`, I = `${N.startsWith("-") ? "-" : ""}${d}[${N.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6533
|
+
f(I);
|
|
6616
6534
|
},
|
|
6617
|
-
onKeyUp: (
|
|
6618
|
-
|
|
6535
|
+
onKeyUp: (b) => {
|
|
6536
|
+
S && (b.preventDefault(), v(!1));
|
|
6619
6537
|
},
|
|
6620
|
-
onBlur: () =>
|
|
6621
|
-
onChange: (
|
|
6622
|
-
|
|
6538
|
+
onBlur: () => j(),
|
|
6539
|
+
onChange: (b) => {
|
|
6540
|
+
y(!1), l(b.target.value);
|
|
6623
6541
|
},
|
|
6624
|
-
onClick: (
|
|
6625
|
-
var
|
|
6626
|
-
(
|
|
6542
|
+
onClick: (b) => {
|
|
6543
|
+
var C;
|
|
6544
|
+
(C = b == null ? void 0 : b.target) == null || C.select(), n(!1);
|
|
6627
6545
|
},
|
|
6628
|
-
value:
|
|
6546
|
+
value: _ ? g : a,
|
|
6629
6547
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
6630
6548
|
" ",
|
|
6631
|
-
|
|
6549
|
+
E ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
6632
6550
|
)
|
|
6633
6551
|
}
|
|
6634
6552
|
),
|
|
@@ -6650,29 +6568,29 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6650
6568
|
{
|
|
6651
6569
|
units: u,
|
|
6652
6570
|
current: h,
|
|
6653
|
-
onSelect: (
|
|
6654
|
-
n(!1),
|
|
6571
|
+
onSelect: (b) => {
|
|
6572
|
+
n(!1), m(b), w(b);
|
|
6655
6573
|
}
|
|
6656
6574
|
}
|
|
6657
6575
|
) }) })
|
|
6658
6576
|
] })
|
|
6659
6577
|
] }),
|
|
6660
|
-
["none", "auto"].indexOf(h) !== -1 ||
|
|
6578
|
+
["none", "auto"].indexOf(h) !== -1 || _ ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6661
6579
|
DragStyleButton,
|
|
6662
6580
|
{
|
|
6663
|
-
onDragStart: () =>
|
|
6664
|
-
onDragEnd: (
|
|
6665
|
-
if (
|
|
6581
|
+
onDragStart: () => A(!0),
|
|
6582
|
+
onDragEnd: (b) => {
|
|
6583
|
+
if (k(() => ""), A(!1), isEmpty(b))
|
|
6666
6584
|
return;
|
|
6667
|
-
const
|
|
6668
|
-
|
|
6585
|
+
const C = `${b}`, N = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6586
|
+
R(N);
|
|
6669
6587
|
},
|
|
6670
|
-
onDrag: (
|
|
6671
|
-
if (isEmpty(
|
|
6588
|
+
onDrag: (b) => {
|
|
6589
|
+
if (isEmpty(b))
|
|
6672
6590
|
return;
|
|
6673
|
-
|
|
6674
|
-
const
|
|
6675
|
-
|
|
6591
|
+
k(b);
|
|
6592
|
+
const C = `${b}`, N = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
6593
|
+
f(N);
|
|
6676
6594
|
},
|
|
6677
6595
|
currentValue: a,
|
|
6678
6596
|
unit: h,
|
|
@@ -6769,35 +6687,35 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6769
6687
|
"2xl": "1536px"
|
|
6770
6688
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6771
6689
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6772
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l),
|
|
6773
|
-
(
|
|
6774
|
-
const
|
|
6775
|
-
(p || u !== "") && (
|
|
6776
|
-
const
|
|
6777
|
-
|
|
6690
|
+
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [y] = useSelectedBlockIds(), g = useMemo(() => get(h, "fullCls", ""), [h]), k = useCallback(
|
|
6691
|
+
(f, j = !0) => {
|
|
6692
|
+
const w = { dark: p, mq: x, mod: u, cls: f, property: l, fullCls: "" };
|
|
6693
|
+
(p || u !== "") && (w.mq = "xs");
|
|
6694
|
+
const b = generateFullClsName(w);
|
|
6695
|
+
m(y, [b], j);
|
|
6778
6696
|
},
|
|
6779
|
-
[
|
|
6780
|
-
),
|
|
6781
|
-
|
|
6782
|
-
}, [
|
|
6697
|
+
[y, p, x, u, l, m]
|
|
6698
|
+
), _ = useCallback(() => {
|
|
6699
|
+
E(y, [g]);
|
|
6700
|
+
}, [y, g, E]), A = useMemo(() => canChangeClass(h, x), [h, x]);
|
|
6783
6701
|
useEffect(() => {
|
|
6784
|
-
i(
|
|
6785
|
-
}, [
|
|
6786
|
-
const [, ,
|
|
6787
|
-
(
|
|
6788
|
-
|
|
6702
|
+
i(A, h);
|
|
6703
|
+
}, [A, i, h]);
|
|
6704
|
+
const [, , S] = useCanvasWidth(), v = useCallback(
|
|
6705
|
+
(f) => {
|
|
6706
|
+
S({
|
|
6789
6707
|
xs: 400,
|
|
6790
6708
|
sm: 640,
|
|
6791
6709
|
md: 800,
|
|
6792
6710
|
lg: 1024,
|
|
6793
6711
|
xl: 1420,
|
|
6794
6712
|
"2xl": 1920
|
|
6795
|
-
}[
|
|
6713
|
+
}[f]);
|
|
6796
6714
|
},
|
|
6797
|
-
[
|
|
6798
|
-
),
|
|
6799
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange:
|
|
6800
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !
|
|
6715
|
+
[S]
|
|
6716
|
+
), R = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
|
|
6717
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: A, canReset: h && R, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6718
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !R ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
6801
6719
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6802
6720
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
|
|
6803
6721
|
n === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -6806,17 +6724,17 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6806
6724
|
currentClass: get(h, "cls", ""),
|
|
6807
6725
|
classPrefix: get(CLASS_PREFIXES, l, ""),
|
|
6808
6726
|
units: c || [],
|
|
6809
|
-
onChange:
|
|
6727
|
+
onChange: k,
|
|
6810
6728
|
negative: d,
|
|
6811
6729
|
cssProperty: l
|
|
6812
6730
|
}
|
|
6813
6731
|
) : null,
|
|
6814
|
-
n === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange:
|
|
6815
|
-
n === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange:
|
|
6816
|
-
n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange:
|
|
6817
|
-
n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange:
|
|
6732
|
+
n === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
|
|
6733
|
+
n === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
|
|
6734
|
+
n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
|
|
6735
|
+
n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
|
|
6818
6736
|
] }),
|
|
6819
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${
|
|
6737
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${g ? "visible" : "invisible"}`, children: R ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => _(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : A && h ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6820
6738
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6821
6739
|
"button",
|
|
6822
6740
|
{
|
|
@@ -6836,7 +6754,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6836
6754
|
"button",
|
|
6837
6755
|
{
|
|
6838
6756
|
type: "button",
|
|
6839
|
-
onClick: () =>
|
|
6757
|
+
onClick: () => v(get(h, "mq")),
|
|
6840
6758
|
className: "block w-full cursor-default text-right font-semibold text-blue-500",
|
|
6841
6759
|
children: [
|
|
6842
6760
|
"Switch to ",
|
|
@@ -6857,7 +6775,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6857
6775
|
units: i = basicUnits,
|
|
6858
6776
|
negative: c = !1
|
|
6859
6777
|
}) => {
|
|
6860
|
-
const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((
|
|
6778
|
+
const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(x, "property").includes(m), [x]);
|
|
6861
6779
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6862
6780
|
"div",
|
|
6863
6781
|
{
|
|
@@ -6866,22 +6784,22 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6866
6784
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6867
6785
|
o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6868
6786
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
|
|
6869
|
-
r.map(({ label:
|
|
6787
|
+
r.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
6870
6788
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
6871
6789
|
"button",
|
|
6872
6790
|
{
|
|
6873
6791
|
type: "button",
|
|
6874
|
-
onClick: () => u(
|
|
6875
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6792
|
+
onClick: () => u(E),
|
|
6793
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6876
6794
|
children: [
|
|
6877
6795
|
React__default.createElement("div", {
|
|
6878
|
-
className: h(
|
|
6796
|
+
className: h(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6879
6797
|
}),
|
|
6880
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6798
|
+
React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6881
6799
|
]
|
|
6882
6800
|
}
|
|
6883
6801
|
) }),
|
|
6884
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(
|
|
6802
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
|
|
6885
6803
|
] }) }))
|
|
6886
6804
|
) })
|
|
6887
6805
|
] }),
|
|
@@ -6971,13 +6889,11 @@ const RangeChoices = ({ property: o, onChange: r }) => {
|
|
|
6971
6889
|
] }) });
|
|
6972
6890
|
}, BlockStylingProps = () => {
|
|
6973
6891
|
const o = useSelectedBlock(), [r, n] = useSelectedStylingBlocks(), { t: a } = useTranslation();
|
|
6974
|
-
if (!o)
|
|
6975
|
-
return null;
|
|
6892
|
+
if (!o) return null;
|
|
6976
6893
|
const l = Object.keys(o).filter(
|
|
6977
6894
|
(c) => typeof o[c] == "string" && o[c].startsWith("#styles:")
|
|
6978
6895
|
);
|
|
6979
|
-
if (isEmpty(l) || l.length <= 1)
|
|
6980
|
-
return null;
|
|
6896
|
+
if (isEmpty(l) || l.length <= 1) return null;
|
|
6981
6897
|
const i = (c) => find(r, (d) => d.prop === c);
|
|
6982
6898
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
6983
6899
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
|
|
@@ -7023,12 +6939,12 @@ function BlockStyling() {
|
|
|
7023
6939
|
}), d = useThrottledCallback(
|
|
7024
6940
|
(u) => {
|
|
7025
6941
|
const x = !get(i, "negative", !1), h = get(i, "cssProperty", "");
|
|
7026
|
-
let
|
|
7027
|
-
|
|
7028
|
-
let
|
|
7029
|
-
(startsWith(h, "scale") || h === "opacity") && (
|
|
7030
|
-
let
|
|
7031
|
-
x &&
|
|
6942
|
+
let m = parseFloat(i.dragStartValue);
|
|
6943
|
+
m = isNaN(m) ? 0 : m;
|
|
6944
|
+
let E = MAPPER[i.dragUnit];
|
|
6945
|
+
(startsWith(h, "scale") || h === "opacity") && (E = 10);
|
|
6946
|
+
let g = (i.dragStartY - u.pageY) / E + m;
|
|
6947
|
+
x && g < 0 && (g = 0), h === "opacity" && g > 1 && (g = 1), i.onDrag(`${g}`), l(`${g}`);
|
|
7032
6948
|
},
|
|
7033
6949
|
[i],
|
|
7034
6950
|
50
|
|
@@ -7087,7 +7003,7 @@ const ChaiSelect = ({
|
|
|
7087
7003
|
]
|
|
7088
7004
|
}
|
|
7089
7005
|
) });
|
|
7090
|
-
}
|
|
7006
|
+
};
|
|
7091
7007
|
function UILibrariesSelect({
|
|
7092
7008
|
uiLibraries: o,
|
|
7093
7009
|
library: r,
|
|
@@ -7097,7 +7013,7 @@ function UILibrariesSelect({
|
|
|
7097
7013
|
return r ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-12", children: [
|
|
7098
7014
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-bold text-gray-500", children: a("Choose library") }),
|
|
7099
7015
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7100
|
-
ChaiSelect
|
|
7016
|
+
ChaiSelect,
|
|
7101
7017
|
{
|
|
7102
7018
|
className: "mt-1",
|
|
7103
7019
|
options: o.map((l) => ({
|
|
@@ -7116,33 +7032,33 @@ const BlockCard = ({
|
|
|
7116
7032
|
parentId: n = void 0,
|
|
7117
7033
|
position: a = -1
|
|
7118
7034
|
}) => {
|
|
7119
|
-
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), h = get(o, "name", get(o, "label")),
|
|
7120
|
-
const
|
|
7121
|
-
return
|
|
7122
|
-
},
|
|
7123
|
-
async (
|
|
7124
|
-
if (
|
|
7035
|
+
const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, E] = useAtom$1(draggedBlockAtom), y = (_) => {
|
|
7036
|
+
const A = has(_, "styles_attrs.data-page-section");
|
|
7037
|
+
return _._type === "Box" && A;
|
|
7038
|
+
}, g = useCallback(
|
|
7039
|
+
async (_) => {
|
|
7040
|
+
if (_.stopPropagation(), has(o, "component")) {
|
|
7125
7041
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7126
7042
|
return;
|
|
7127
7043
|
}
|
|
7128
7044
|
i(!0);
|
|
7129
|
-
const
|
|
7130
|
-
isEmpty(
|
|
7045
|
+
const A = await c(r, o);
|
|
7046
|
+
isEmpty(A) || p(syncBlocksWithDefaults(A), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7131
7047
|
},
|
|
7132
7048
|
[d, p, o, c, r, n, a]
|
|
7133
|
-
),
|
|
7134
|
-
const
|
|
7135
|
-
let
|
|
7136
|
-
if (
|
|
7137
|
-
const
|
|
7138
|
-
if (
|
|
7139
|
-
const
|
|
7140
|
-
|
|
7141
|
-
|
|
7049
|
+
), k = async (_) => {
|
|
7050
|
+
const A = await c(r, o);
|
|
7051
|
+
let S = n;
|
|
7052
|
+
if (y(first(A)) && (S = null), !isEmpty(A)) {
|
|
7053
|
+
const v = { blocks: A, uiLibrary: !0, parent: S };
|
|
7054
|
+
if (_.dataTransfer.setData("text/plain", JSON.stringify(v)), o.preview) {
|
|
7055
|
+
const R = new Image();
|
|
7056
|
+
R.src = o.preview, R.onload = () => {
|
|
7057
|
+
_.dataTransfer.setDragImage(R, 0, 0);
|
|
7142
7058
|
};
|
|
7143
7059
|
} else
|
|
7144
|
-
|
|
7145
|
-
|
|
7060
|
+
_.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7061
|
+
E(v), setTimeout(() => {
|
|
7146
7062
|
u([]), x(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7147
7063
|
}, 200);
|
|
7148
7064
|
}
|
|
@@ -7152,9 +7068,9 @@ const BlockCard = ({
|
|
|
7152
7068
|
"div",
|
|
7153
7069
|
{
|
|
7154
7070
|
onClick: l ? () => {
|
|
7155
|
-
} :
|
|
7156
|
-
draggable:
|
|
7157
|
-
onDragStart:
|
|
7071
|
+
} : g,
|
|
7072
|
+
draggable: m ? "true" : "false",
|
|
7073
|
+
onDragStart: k,
|
|
7158
7074
|
className: clsx(
|
|
7159
7075
|
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
|
|
7160
7076
|
),
|
|
@@ -7175,17 +7091,16 @@ const BlockCard = ({
|
|
|
7175
7091
|
const [r, n] = useAtom$1(libraryBlocksAtom), a = useBuilderProp("getUILibraryBlocks", noop), l = get(r, `${o == null ? void 0 : o.uuid}.blocks`, null), i = get(r, `${o == null ? void 0 : o.uuid}.loading`, "idle"), c = useRef("idle");
|
|
7176
7092
|
return useEffect(() => {
|
|
7177
7093
|
(async () => {
|
|
7178
|
-
if (i === "complete" || c.current === "loading")
|
|
7179
|
-
return;
|
|
7094
|
+
if (i === "complete" || c.current === "loading") return;
|
|
7180
7095
|
c.current = "loading", n((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
|
|
7181
7096
|
const d = await a(o);
|
|
7182
7097
|
c.current = "idle", n((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
|
|
7183
7098
|
})();
|
|
7184
7099
|
}, [o, l, i, c, n, a]), { data: l || [], isLoading: i === "loading" };
|
|
7185
7100
|
}, UILibrarySection = ({ parentId: o, position: r }) => {
|
|
7186
|
-
const [n, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((
|
|
7187
|
-
|
|
7188
|
-
|
|
7101
|
+
const [n, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((S) => S.category === "custom"), d = l.find((S) => S.uuid === n) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), x = groupBy([...p, ...c], "group"), [h, m] = useState("Hero"), E = get(x, h, []), y = useRef(null), { t: g } = useTranslation(), k = (S) => {
|
|
7102
|
+
y.current && (clearTimeout(y.current), y.current = null), y.current = setTimeout(() => {
|
|
7103
|
+
y.current && m(S);
|
|
7189
7104
|
}, 300);
|
|
7190
7105
|
};
|
|
7191
7106
|
if (u)
|
|
@@ -7193,30 +7108,30 @@ const BlockCard = ({
|
|
|
7193
7108
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7194
7109
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7195
7110
|
] });
|
|
7196
|
-
const
|
|
7111
|
+
const _ = filter(E, (S, v) => v % 2 === 0), A = filter(E, (S, v) => v % 2 === 1);
|
|
7197
7112
|
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: [
|
|
7198
7113
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
|
|
7199
7114
|
/* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
|
|
7200
7115
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
|
|
7201
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children:
|
|
7116
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: g("Groups") }),
|
|
7202
7117
|
/* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
|
|
7203
7118
|
/* @__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(
|
|
7204
|
-
map(x, (
|
|
7119
|
+
map(x, (S, v) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7205
7120
|
"div",
|
|
7206
7121
|
{
|
|
7207
|
-
onMouseEnter: () =>
|
|
7208
|
-
onMouseLeave: () => clearTimeout(
|
|
7209
|
-
onClick: () =>
|
|
7122
|
+
onMouseEnter: () => k(v),
|
|
7123
|
+
onMouseLeave: () => clearTimeout(y.current),
|
|
7124
|
+
onClick: () => m(v),
|
|
7210
7125
|
className: cn(
|
|
7211
7126
|
"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",
|
|
7212
|
-
|
|
7127
|
+
v === h ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
7213
7128
|
),
|
|
7214
7129
|
children: [
|
|
7215
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(
|
|
7130
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(g(v.toLowerCase())) }),
|
|
7216
7131
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7217
7132
|
]
|
|
7218
7133
|
},
|
|
7219
|
-
|
|
7134
|
+
v
|
|
7220
7135
|
))
|
|
7221
7136
|
) })
|
|
7222
7137
|
] })
|
|
@@ -7224,15 +7139,15 @@ const BlockCard = ({
|
|
|
7224
7139
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7225
7140
|
ScrollArea,
|
|
7226
7141
|
{
|
|
7227
|
-
onMouseEnter: () =>
|
|
7142
|
+
onMouseEnter: () => y.current ? clearTimeout(y.current) : null,
|
|
7228
7143
|
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",
|
|
7229
7144
|
children: [
|
|
7230
7145
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
|
|
7231
7146
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7232
|
-
|
|
7147
|
+
_.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: S, library: d }))
|
|
7233
7148
|
) }),
|
|
7234
7149
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
|
|
7235
|
-
|
|
7150
|
+
A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: S, library: d }))
|
|
7236
7151
|
) })
|
|
7237
7152
|
] }),
|
|
7238
7153
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
@@ -7242,7 +7157,7 @@ const BlockCard = ({
|
|
|
7242
7157
|
}
|
|
7243
7158
|
)
|
|
7244
7159
|
] }) }) });
|
|
7245
|
-
}, UILibrariesPanel = ({ parentId: o, position: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrarySection, { parentId: o, position: r }),
|
|
7160
|
+
}, UILibrariesPanel = ({ parentId: o, position: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrarySection, { parentId: o, position: r }), Core = "Core", Import = "Import", Breakpoints$1 = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = {
|
|
7246
7161
|
heading_font: "Heading Font",
|
|
7247
7162
|
body_font: "Body Font",
|
|
7248
7163
|
rounded_corner: "Rounded Corners",
|
|
@@ -7741,35 +7656,35 @@ const CoreBlock = ({
|
|
|
7741
7656
|
parentId: n,
|
|
7742
7657
|
position: a
|
|
7743
7658
|
}) => {
|
|
7744
|
-
const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(),
|
|
7659
|
+
const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
|
|
7745
7660
|
if (has(o, "blocks")) {
|
|
7746
|
-
const
|
|
7747
|
-
u(syncBlocksWithDefaults(
|
|
7661
|
+
const g = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
|
|
7662
|
+
u(syncBlocksWithDefaults(g), n || null, a);
|
|
7748
7663
|
} else
|
|
7749
7664
|
p(o, n || null, a);
|
|
7750
7665
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7751
|
-
},
|
|
7666
|
+
}, E = useFeature("dnd"), { t: y } = useTranslation();
|
|
7752
7667
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
7753
7668
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7754
7669
|
"button",
|
|
7755
7670
|
{
|
|
7756
7671
|
disabled: r,
|
|
7757
|
-
onClick:
|
|
7672
|
+
onClick: m,
|
|
7758
7673
|
type: "button",
|
|
7759
|
-
onDragStart: (
|
|
7760
|
-
|
|
7674
|
+
onDragStart: (g) => {
|
|
7675
|
+
g.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), g.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
|
|
7761
7676
|
x([]), h();
|
|
7762
7677
|
}, 200);
|
|
7763
7678
|
},
|
|
7764
|
-
draggable:
|
|
7679
|
+
draggable: E ? "true" : "false",
|
|
7765
7680
|
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",
|
|
7766
7681
|
children: [
|
|
7767
7682
|
createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
7768
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
7683
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(y(d || i)) })
|
|
7769
7684
|
]
|
|
7770
7685
|
}
|
|
7771
7686
|
) }),
|
|
7772
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
7687
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: y(d || i) }) })
|
|
7773
7688
|
] }) });
|
|
7774
7689
|
}, DefaultChaiBlocks = ({
|
|
7775
7690
|
parentId: o,
|
|
@@ -7839,14 +7754,14 @@ const CoreBlock = ({
|
|
|
7839
7754
|
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: h.key, children: React__default.createElement(h.tab) }))
|
|
7840
7755
|
] }),
|
|
7841
7756
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "-mx-1.5 h-full max-h-full overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: n, position: a }) }) }) }),
|
|
7842
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7843
|
-
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML
|
|
7757
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesPanel, { parentId: n, position: a }) }),
|
|
7758
|
+
p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML, { parentId: n, position: a }) }) : null,
|
|
7844
7759
|
map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x, parentId: n, position: a }) }))
|
|
7845
7760
|
]
|
|
7846
7761
|
}
|
|
7847
7762
|
)
|
|
7848
7763
|
] });
|
|
7849
|
-
}
|
|
7764
|
+
};
|
|
7850
7765
|
function usePubSub(o, r) {
|
|
7851
7766
|
useEffect(() => {
|
|
7852
7767
|
const n = pubsub.subscribe(o, r);
|
|
@@ -7871,7 +7786,7 @@ const AddBlocksDialog = () => {
|
|
|
7871
7786
|
}
|
|
7872
7787
|
)
|
|
7873
7788
|
] }),
|
|
7874
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar h-[500px] max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlocksPanel
|
|
7789
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar h-[500px] max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlocksPanel, { parentId: r, position: a, showHeading: !1 }) })
|
|
7875
7790
|
] }) });
|
|
7876
7791
|
};
|
|
7877
7792
|
function FaFilePen(o) {
|
|
@@ -7956,14 +7871,14 @@ function QuickPrompts({ onClick: o }) {
|
|
|
7956
7871
|
) }) });
|
|
7957
7872
|
}
|
|
7958
7873
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
7959
|
-
const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), h = useRef(null),
|
|
7874
|
+
const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), h = useRef(null), m = useRef(null);
|
|
7960
7875
|
useEffect(() => {
|
|
7961
|
-
var
|
|
7962
|
-
(
|
|
7876
|
+
var y;
|
|
7877
|
+
(y = h.current) == null || y.focus();
|
|
7963
7878
|
}, []);
|
|
7964
|
-
const
|
|
7965
|
-
const { usage:
|
|
7966
|
-
!l &&
|
|
7879
|
+
const E = (y) => {
|
|
7880
|
+
const { usage: g } = y || {};
|
|
7881
|
+
!l && g && x(g), m.current = setTimeout(() => x(void 0), 1e4), l || c("");
|
|
7967
7882
|
};
|
|
7968
7883
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7969
7884
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7983,12 +7898,12 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7983
7898
|
{
|
|
7984
7899
|
ref: h,
|
|
7985
7900
|
value: i,
|
|
7986
|
-
onChange: (
|
|
7901
|
+
onChange: (y) => c(y.target.value),
|
|
7987
7902
|
placeholder: r("Ask AI to edit content"),
|
|
7988
7903
|
className: "w-full",
|
|
7989
7904
|
rows: 3,
|
|
7990
|
-
onKeyDown: (
|
|
7991
|
-
|
|
7905
|
+
onKeyDown: (y) => {
|
|
7906
|
+
y.key === "Enter" && (y.preventDefault(), m.current && clearTimeout(m.current), x(void 0), n("content", o, i, E));
|
|
7992
7907
|
}
|
|
7993
7908
|
}
|
|
7994
7909
|
),
|
|
@@ -7998,7 +7913,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
7998
7913
|
{
|
|
7999
7914
|
disabled: i.trim().length < 5 || a,
|
|
8000
7915
|
onClick: () => {
|
|
8001
|
-
|
|
7916
|
+
m.current && clearTimeout(m.current), x(void 0), n("content", o, i, E);
|
|
8002
7917
|
},
|
|
8003
7918
|
variant: "default",
|
|
8004
7919
|
className: "w-fit",
|
|
@@ -8030,8 +7945,8 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8030
7945
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8031
7946
|
QuickPrompts,
|
|
8032
7947
|
{
|
|
8033
|
-
onClick: (
|
|
8034
|
-
|
|
7948
|
+
onClick: (y) => {
|
|
7949
|
+
m.current && clearTimeout(m.current), x(void 0), n("content", o, y, E);
|
|
8035
7950
|
}
|
|
8036
7951
|
}
|
|
8037
7952
|
)
|
|
@@ -8041,19 +7956,19 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8041
7956
|
] }) }) : null
|
|
8042
7957
|
] });
|
|
8043
7958
|
}, AISetContext = () => {
|
|
8044
|
-
const { t: o } = useTranslation(), r = useBuilderProp("aiContext", ""), [n, a] = useState(r), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: h } = useToast(),
|
|
7959
|
+
const { t: o } = useTranslation(), r = useBuilderProp("aiContext", ""), [n, a] = useState(r), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: h } = useToast(), m = useRef(null);
|
|
8045
7960
|
useEffect(() => {
|
|
8046
7961
|
r && a(r);
|
|
8047
7962
|
}, [r]);
|
|
8048
|
-
const
|
|
7963
|
+
const E = async () => {
|
|
8049
7964
|
try {
|
|
8050
7965
|
d(!0), u(null), await i(n), h({
|
|
8051
7966
|
title: o("Updated AI Context"),
|
|
8052
7967
|
description: o("You can now Ask AI to edit your content"),
|
|
8053
7968
|
variant: "default"
|
|
8054
|
-
}),
|
|
8055
|
-
} catch (
|
|
8056
|
-
u(
|
|
7969
|
+
}), m.current.click();
|
|
7970
|
+
} catch (y) {
|
|
7971
|
+
u(y);
|
|
8057
7972
|
} finally {
|
|
8058
7973
|
d(!1);
|
|
8059
7974
|
}
|
|
@@ -8061,25 +7976,25 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8061
7976
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8062
7977
|
Accordion,
|
|
8063
7978
|
{
|
|
8064
|
-
onValueChange: (
|
|
8065
|
-
x(
|
|
7979
|
+
onValueChange: (y) => {
|
|
7980
|
+
x(y !== "");
|
|
8066
7981
|
},
|
|
8067
7982
|
type: "single",
|
|
8068
7983
|
collapsible: !0,
|
|
8069
7984
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
|
|
8070
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref:
|
|
7985
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, 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") }) }) }),
|
|
8071
7986
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
|
|
8072
7987
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8073
7988
|
Textarea,
|
|
8074
7989
|
{
|
|
8075
7990
|
ref: l,
|
|
8076
7991
|
value: n,
|
|
8077
|
-
onChange: (
|
|
7992
|
+
onChange: (y) => a(y.target.value),
|
|
8078
7993
|
placeholder: o("Tell about this page eg this page is about"),
|
|
8079
7994
|
className: "mt-1 w-full",
|
|
8080
7995
|
rows: 10,
|
|
8081
|
-
onKeyDown: (
|
|
8082
|
-
|
|
7996
|
+
onKeyDown: (y) => {
|
|
7997
|
+
y.key === "Enter" && (y.preventDefault(), E());
|
|
8083
7998
|
}
|
|
8084
7999
|
}
|
|
8085
8000
|
),
|
|
@@ -8091,7 +8006,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8091
8006
|
Button,
|
|
8092
8007
|
{
|
|
8093
8008
|
disabled: n.trim().length < 5,
|
|
8094
|
-
onClick: () =>
|
|
8009
|
+
onClick: () => E(),
|
|
8095
8010
|
variant: "default",
|
|
8096
8011
|
className: "w-fit",
|
|
8097
8012
|
size: "sm",
|
|
@@ -8120,7 +8035,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8120
8035
|
AlertDialogAction,
|
|
8121
8036
|
{
|
|
8122
8037
|
onClick: () => {
|
|
8123
|
-
a(""),
|
|
8038
|
+
a(""), E();
|
|
8124
8039
|
},
|
|
8125
8040
|
children: o("Yes, Delete")
|
|
8126
8041
|
}
|
|
@@ -8141,42 +8056,42 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8141
8056
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
|
|
8142
8057
|
] });
|
|
8143
8058
|
}, AttrsEditor = React__default.memo(function o({ preloadedAttributes: r = [], onAttributesChange: n }) {
|
|
8144
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h,
|
|
8059
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h, m] = useState(""), E = useRef(null), y = useRef(null);
|
|
8145
8060
|
useEffect(() => {
|
|
8146
8061
|
l(r);
|
|
8147
8062
|
}, [r]);
|
|
8148
|
-
const
|
|
8063
|
+
const g = () => {
|
|
8149
8064
|
if (i.startsWith("@")) {
|
|
8150
|
-
|
|
8065
|
+
m("Attribute keys cannot start with '@'");
|
|
8151
8066
|
return;
|
|
8152
8067
|
}
|
|
8153
8068
|
if (i) {
|
|
8154
|
-
const
|
|
8155
|
-
n(
|
|
8069
|
+
const v = [...a, { key: i, value: d }];
|
|
8070
|
+
n(v), l(a), c(""), p(""), m("");
|
|
8156
8071
|
}
|
|
8157
|
-
},
|
|
8158
|
-
const
|
|
8159
|
-
n(
|
|
8160
|
-
},
|
|
8161
|
-
x(
|
|
8162
|
-
},
|
|
8072
|
+
}, k = (v) => {
|
|
8073
|
+
const R = a.filter((f, j) => j !== v);
|
|
8074
|
+
n(R), l(R);
|
|
8075
|
+
}, _ = (v) => {
|
|
8076
|
+
x(v), c(a[v].key), p(a[v].value);
|
|
8077
|
+
}, A = () => {
|
|
8163
8078
|
if (i.startsWith("@")) {
|
|
8164
|
-
|
|
8079
|
+
m("Attribute keys cannot start with '@'");
|
|
8165
8080
|
return;
|
|
8166
8081
|
}
|
|
8167
8082
|
if (u !== null && i) {
|
|
8168
|
-
const
|
|
8169
|
-
|
|
8083
|
+
const v = [...a];
|
|
8084
|
+
v[u] = { key: i, value: d }, n(v), l(v), x(null), c(""), p(""), m("");
|
|
8170
8085
|
}
|
|
8171
|
-
},
|
|
8172
|
-
|
|
8086
|
+
}, S = (v) => {
|
|
8087
|
+
v.key === "Enter" && !v.shiftKey && (v.preventDefault(), u !== null ? A() : g());
|
|
8173
8088
|
};
|
|
8174
8089
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
|
|
8175
8090
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8176
8091
|
"form",
|
|
8177
8092
|
{
|
|
8178
|
-
onSubmit: (
|
|
8179
|
-
|
|
8093
|
+
onSubmit: (v) => {
|
|
8094
|
+
v.preventDefault(), u !== null ? A() : g();
|
|
8180
8095
|
},
|
|
8181
8096
|
className: "space-y-3",
|
|
8182
8097
|
children: [
|
|
@@ -8190,9 +8105,9 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8190
8105
|
autoCorrect: "off",
|
|
8191
8106
|
spellCheck: "false",
|
|
8192
8107
|
id: "attrKey",
|
|
8193
|
-
ref:
|
|
8108
|
+
ref: E,
|
|
8194
8109
|
value: i,
|
|
8195
|
-
onChange: (
|
|
8110
|
+
onChange: (v) => c(v.target.value),
|
|
8196
8111
|
placeholder: "Enter Key",
|
|
8197
8112
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
8198
8113
|
}
|
|
@@ -8208,10 +8123,10 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8208
8123
|
spellCheck: "false",
|
|
8209
8124
|
id: "attrValue",
|
|
8210
8125
|
rows: 2,
|
|
8211
|
-
ref:
|
|
8126
|
+
ref: y,
|
|
8212
8127
|
value: d,
|
|
8213
|
-
onChange: (
|
|
8214
|
-
onKeyDown:
|
|
8128
|
+
onChange: (v) => p(v.target.value),
|
|
8129
|
+
onKeyDown: S,
|
|
8215
8130
|
placeholder: "Enter Value",
|
|
8216
8131
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
8217
8132
|
}
|
|
@@ -8223,16 +8138,16 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8223
8138
|
]
|
|
8224
8139
|
}
|
|
8225
8140
|
),
|
|
8226
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
8141
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((v, R) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
8227
8142
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
8228
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
8229
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children:
|
|
8143
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: v.key }),
|
|
8144
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: v.value.toString() })
|
|
8230
8145
|
] }),
|
|
8231
8146
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
8232
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8233
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
8147
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(R), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
8148
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(R), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })
|
|
8234
8149
|
] })
|
|
8235
|
-
] },
|
|
8150
|
+
] }, R)) })
|
|
8236
8151
|
] });
|
|
8237
8152
|
}), BlockAttributesEditor = React.memo(() => {
|
|
8238
8153
|
const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -8510,7 +8425,7 @@ const SettingsPanel = () => {
|
|
|
8510
8425
|
}
|
|
8511
8426
|
)
|
|
8512
8427
|
] }) });
|
|
8513
|
-
}
|
|
8428
|
+
};
|
|
8514
8429
|
function LayoutCard({ disabled: o = !1, description: r, title: n, selected: a, onSelect: l, children: i }) {
|
|
8515
8430
|
const { t: c } = useTranslation();
|
|
8516
8431
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -8602,13 +8517,13 @@ const ChooseLayout = ({ open: o, close: r }) => {
|
|
|
8602
8517
|
)
|
|
8603
8518
|
] }) })
|
|
8604
8519
|
] }) });
|
|
8605
|
-
}, TopBar = lazy(() => import("./Topbar-
|
|
8520
|
+
}, TopBar = lazy(() => import("./Topbar-DMCtQiUj.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$2));
|
|
8606
8521
|
function useSidebarMenuItems() {
|
|
8607
8522
|
return useMemo(() => compact([
|
|
8608
8523
|
{
|
|
8609
8524
|
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { size: 20 }),
|
|
8610
8525
|
label: "Outline",
|
|
8611
|
-
component: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8526
|
+
component: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ListTree, {}) })
|
|
8612
8527
|
}
|
|
8613
8528
|
]), []);
|
|
8614
8529
|
}
|
|
@@ -8617,35 +8532,36 @@ const RootLayout = () => {
|
|
|
8617
8532
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
8618
8533
|
r(1);
|
|
8619
8534
|
});
|
|
8620
|
-
const c = useBuilderProp("sideBarComponents.top", []), d = (
|
|
8621
|
-
|
|
8622
|
-
},
|
|
8623
|
-
r(o ===
|
|
8624
|
-
},
|
|
8625
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir:
|
|
8535
|
+
const c = useBuilderProp("sideBarComponents.top", []), d = useBuilderProp("sideBarComponents.bottom", []), p = (y) => {
|
|
8536
|
+
y.preventDefault();
|
|
8537
|
+
}, u = (y) => {
|
|
8538
|
+
r(o === y ? null : y);
|
|
8539
|
+
}, x = useSidebarMenuItems(), { t: h } = useTranslation(), m = [...x, ...c], E = useBuilderProp("htmlDir", "ltr");
|
|
8540
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: E, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
|
|
8626
8541
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8627
8542
|
"div",
|
|
8628
8543
|
{
|
|
8629
|
-
onContextMenu:
|
|
8544
|
+
onContextMenu: p,
|
|
8630
8545
|
className: "flex h-screen max-h-full flex-col bg-background text-foreground",
|
|
8631
8546
|
children: [
|
|
8632
8547
|
/* @__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, {}) }) }),
|
|
8633
8548
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
8634
8549
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
8635
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children:
|
|
8550
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((y, g) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
8636
8551
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8637
8552
|
Button,
|
|
8638
8553
|
{
|
|
8639
|
-
variant: o ===
|
|
8554
|
+
variant: o === g ? "default" : "ghost",
|
|
8640
8555
|
className: "mb-2 rounded-lg p-2 transition-colors",
|
|
8641
|
-
onClick: () =>
|
|
8642
|
-
children: get(
|
|
8556
|
+
onClick: () => u(g),
|
|
8557
|
+
children: get(y, "icon", null)
|
|
8643
8558
|
},
|
|
8644
|
-
|
|
8559
|
+
g
|
|
8645
8560
|
) }),
|
|
8646
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children:
|
|
8647
|
-
] }, "button" +
|
|
8648
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" })
|
|
8561
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: h(y.label) }) })
|
|
8562
|
+
] }, "button" + g)) }),
|
|
8563
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" }),
|
|
8564
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((y, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}), children: React__default.createElement(y, { key: g }) })) })
|
|
8649
8565
|
] }),
|
|
8650
8566
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8651
8567
|
motion.div,
|
|
@@ -8656,16 +8572,16 @@ const RootLayout = () => {
|
|
|
8656
8572
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
8657
8573
|
children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
|
|
8658
8574
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
|
|
8659
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
8660
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children:
|
|
8575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
|
|
8576
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: h(m[o].label) })
|
|
8661
8577
|
] }),
|
|
8662
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
8578
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
|
|
8663
8579
|
] }) })
|
|
8664
8580
|
}
|
|
8665
8581
|
),
|
|
8666
8582
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full flex-1 flex-col bg-slate-800/20", children: [
|
|
8667
8583
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CanvasTopBar, {}),
|
|
8668
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasArea
|
|
8584
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasArea, {}) })
|
|
8669
8585
|
] }),
|
|
8670
8586
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8671
8587
|
motion.div,
|
|
@@ -8678,11 +8594,11 @@ const RootLayout = () => {
|
|
|
8678
8594
|
/* @__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: [
|
|
8679
8595
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
8680
8596
|
" ",
|
|
8681
|
-
|
|
8597
|
+
h("AI Assistant")
|
|
8682
8598
|
] }) }) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
8683
8599
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8684
8600
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
|
|
8685
|
-
|
|
8601
|
+
h("Theme Settings")
|
|
8686
8602
|
] }),
|
|
8687
8603
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8688
8604
|
Button,
|
|
@@ -8695,7 +8611,7 @@ const RootLayout = () => {
|
|
|
8695
8611
|
}
|
|
8696
8612
|
)
|
|
8697
8613
|
] }) : null }) }) }),
|
|
8698
|
-
/* @__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
|
|
8614
|
+
/* @__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, {}) }) })
|
|
8699
8615
|
] }) })
|
|
8700
8616
|
}
|
|
8701
8617
|
)
|
|
@@ -8780,27 +8696,27 @@ export {
|
|
|
8780
8696
|
AISetContext,
|
|
8781
8697
|
AIUserPrompt,
|
|
8782
8698
|
AddBlocksDialog,
|
|
8783
|
-
AddBlocksPanel
|
|
8699
|
+
AddBlocksPanel,
|
|
8784
8700
|
BlockAttributesEditor,
|
|
8785
8701
|
BlockSettings as BlockPropsEditor,
|
|
8786
8702
|
BlockStyling as BlockStyleEditor,
|
|
8787
8703
|
CHAI_BUILDER_EVENTS,
|
|
8788
|
-
CanvasArea
|
|
8704
|
+
CanvasArea as ChaiBuilderCanvas,
|
|
8789
8705
|
ChaiBuilderEditor,
|
|
8790
8706
|
DarkMode as DarkModeSwitcher,
|
|
8791
8707
|
DefaultChaiBlocks,
|
|
8792
|
-
ImportHTML
|
|
8793
|
-
|
|
8708
|
+
ImportHTML,
|
|
8709
|
+
ListTree as Outline,
|
|
8794
8710
|
Breakpoints as ScreenSizes,
|
|
8795
|
-
ThemeConfigPanel$
|
|
8796
|
-
UILibraries,
|
|
8711
|
+
ThemeConfigPanel$1 as ThemeOptions,
|
|
8712
|
+
UILibrariesPanel as UILibraries,
|
|
8797
8713
|
UndoRedo,
|
|
8798
8714
|
generateUUID as generateBlockId,
|
|
8799
8715
|
getBlocksFromHTML,
|
|
8800
8716
|
getClassValueAndUnit,
|
|
8801
|
-
|
|
8717
|
+
Me as i18n,
|
|
8802
8718
|
cn as mergeClasses,
|
|
8803
|
-
|
|
8719
|
+
De as registerChaiBlock,
|
|
8804
8720
|
useAddBlock,
|
|
8805
8721
|
useAddClassesToBlocks,
|
|
8806
8722
|
useAskAi,
|
|
@@ -8842,7 +8758,7 @@ export {
|
|
|
8842
8758
|
useStylingState,
|
|
8843
8759
|
useTheme,
|
|
8844
8760
|
useThemeOptions,
|
|
8845
|
-
|
|
8761
|
+
Ie as useTranslation,
|
|
8846
8762
|
useUILibraryBlocks,
|
|
8847
8763
|
useUndoManager,
|
|
8848
8764
|
useUpdateBlocksProps,
|