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