@chaibuilder/sdk 2.6.4 → 3.0.3
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/{code-editor-ChUC9WsA.cjs → code-editor-BL_76o6w.cjs} +1 -1
- package/dist/{code-editor-RwOkFe_0.js → code-editor-tDa4T69w.js} +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.d.ts +1 -6
- package/dist/core.js +541 -534
- package/dist/{css-import-modal-w1WZrKpm.cjs → css-import-modal-BRFVZ9j3.cjs} +1 -1
- package/dist/{css-import-modal-Ds-qmte_.js → css-import-modal-CgSqJi_w.js} +1 -1
- package/dist/toggle-C5f1IJ1G.cjs +1 -0
- package/dist/{toggle-DXTcRcvD.js → toggle-C6VUu_7m.js} +62 -62
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +147 -148
- package/package.json +14 -15
- package/dist/toggle-CCqv4Cah.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -3,15 +3,14 @@ var V = (o, n, r) => n in o ? H(o, n, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var F = (o, n, r) => V(o, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
|
-
import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
7
6
|
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, sortBy, round } from "lodash-es";
|
|
7
|
+
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, MagicWandIcon, MagnifyingGlassIcon, CaretRightIcon, GlobeIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, EyeNoneIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, ChatBubbleIcon, FaceIcon, ShuffleIcon, ImageIcon, PaperPlaneIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
|
|
10
10
|
import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
|
|
11
11
|
import { atomWithStorage, splitAtom, useAtomCallback } from "jotai/utils";
|
|
12
12
|
import { g as generateUUID, a as getBreakpointValue, c as cn$2 } from "./common-functions-BGzDsf1z.js";
|
|
13
|
-
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, r as Avatar, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-
|
|
14
|
-
import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
|
|
13
|
+
import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, r as Avatar, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-C6VUu_7m.js";
|
|
15
14
|
import clsx$1, { clsx } from "clsx";
|
|
16
15
|
import { twMerge } from "tailwind-merge";
|
|
17
16
|
import TreeModel from "tree-model";
|
|
@@ -21,7 +20,7 @@ import { isObject } from "@rjsf/utils";
|
|
|
21
20
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
22
21
|
import { toast, Toaster } from "sonner";
|
|
23
22
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
24
|
-
import { useTranslation as
|
|
23
|
+
import { useTranslation as $e } from "react-i18next";
|
|
25
24
|
import Fuse from "fuse.js";
|
|
26
25
|
import UndoManager from "undo-manager";
|
|
27
26
|
import Link from "@tiptap/extension-link";
|
|
@@ -36,7 +35,7 @@ import Autosuggest from "react-autosuggest";
|
|
|
36
35
|
import { useFeature } from "flagged";
|
|
37
36
|
import { Tree } from "react-arborist";
|
|
38
37
|
import i18n from "i18next";
|
|
39
|
-
import { default as
|
|
38
|
+
import { default as He } from "i18next";
|
|
40
39
|
import "himalaya";
|
|
41
40
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
42
41
|
import tailwindForms from "@tailwindcss/forms";
|
|
@@ -51,9 +50,9 @@ import { limitShift, flip, size } from "@floating-ui/dom";
|
|
|
51
50
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
52
51
|
import ReactDOM from "react-dom";
|
|
53
52
|
import { Provider as Provider$1 } from "react-wrap-balancer";
|
|
54
|
-
const ICON_CLASS = "h-3 w-3
|
|
53
|
+
const ICON_CLASS = "h-3 w-3", TypeIcon = (o) => {
|
|
55
54
|
const n = useRegisteredChaiBlocks(), r = get(n, [o == null ? void 0 : o.type, "icon"]);
|
|
56
|
-
return r ? React__default.createElement(r, { className: ICON_CLASS }) : /* @__PURE__ */ jsx(
|
|
55
|
+
return r ? React__default.createElement(r, { className: ICON_CLASS }) : /* @__PURE__ */ jsx(SquareIcon, { className: ICON_CLASS });
|
|
57
56
|
}, readOnlyModeAtom = atom(!1);
|
|
58
57
|
readOnlyModeAtom.debugLabel = "readOnlyModeAtom";
|
|
59
58
|
const networkModeAtom = atom("online");
|
|
@@ -221,7 +220,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
221
220
|
return /* @__PURE__ */ jsx("div", { className: "-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
|
|
222
221
|
/* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
223
222
|
/* @__PURE__ */ jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
|
|
224
|
-
/* @__PURE__ */ jsx(
|
|
223
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "rtl:rotate-180 h-4 w-4" })
|
|
225
224
|
] }),
|
|
226
225
|
reverse(o).map((a, l) => /* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
227
226
|
/* @__PURE__ */ jsxs(
|
|
@@ -239,7 +238,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
239
238
|
]
|
|
240
239
|
}
|
|
241
240
|
),
|
|
242
|
-
l !== o.length - 1 && /* @__PURE__ */ jsx(
|
|
241
|
+
l !== o.length - 1 && /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rtl:rotate-180 h-4 w-4" })
|
|
243
242
|
] }, l))
|
|
244
243
|
] }) });
|
|
245
244
|
}, CHAI_BUILDER_EVENTS = {
|
|
@@ -839,13 +838,13 @@ const undoRedoStateAtom = atom({
|
|
|
839
838
|
} = useBlocksStoreManager();
|
|
840
839
|
return {
|
|
841
840
|
moveBlocks: (x, y, b) => {
|
|
842
|
-
const
|
|
843
|
-
const
|
|
844
|
-
return { _id: j, oldParent:
|
|
845
|
-
}), B =
|
|
841
|
+
const C = map(x, (j) => {
|
|
842
|
+
const w = n.find((E) => E._id === j)._parent || null, A = n.filter((E) => w ? E._parent === w : !E._parent).map((E) => E._id).indexOf(j);
|
|
843
|
+
return { _id: j, oldParent: w, oldPosition: A };
|
|
844
|
+
}), B = C.find(({ _id: j }) => j === x[0]);
|
|
846
845
|
B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
|
|
847
|
-
undo: () => each(
|
|
848
|
-
i([j], _,
|
|
846
|
+
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition: w }) => {
|
|
847
|
+
i([j], _, w);
|
|
849
848
|
}),
|
|
850
849
|
redo: () => i(x, y, b)
|
|
851
850
|
}));
|
|
@@ -858,25 +857,25 @@ const undoRedoStateAtom = atom({
|
|
|
858
857
|
},
|
|
859
858
|
removeBlocks: (x) => {
|
|
860
859
|
var B;
|
|
861
|
-
const y = (B = first(x)) == null ? void 0 : B._parent,
|
|
860
|
+
const y = (B = first(x)) == null ? void 0 : B._parent, C = n.filter((j) => y ? j._parent === y : !j._parent).indexOf(first(x));
|
|
862
861
|
l(map(x, "_id")), o({
|
|
863
|
-
undo: () => a(x, y,
|
|
862
|
+
undo: () => a(x, y, C),
|
|
864
863
|
redo: () => l(map(x, "_id"))
|
|
865
864
|
});
|
|
866
865
|
},
|
|
867
866
|
updateBlocks: (x, y, b) => {
|
|
868
|
-
let
|
|
867
|
+
let C = [];
|
|
869
868
|
if (b)
|
|
870
|
-
|
|
869
|
+
C = map(x, (B) => ({ _id: B, ...b }));
|
|
871
870
|
else {
|
|
872
871
|
const B = keys(y);
|
|
873
|
-
|
|
874
|
-
const _ = n.find((k) => k._id === j),
|
|
875
|
-
return each(B, (k) =>
|
|
872
|
+
C = map(x, (j) => {
|
|
873
|
+
const _ = n.find((k) => k._id === j), w = { _id: j };
|
|
874
|
+
return each(B, (k) => w[k] = _[k]), w;
|
|
876
875
|
});
|
|
877
876
|
}
|
|
878
877
|
c(map(x, (B) => ({ _id: B, ...y }))), o({
|
|
879
|
-
undo: () => c(
|
|
878
|
+
undo: () => c(C),
|
|
880
879
|
redo: () => c(map(x, (B) => ({ _id: B, ...y })))
|
|
881
880
|
});
|
|
882
881
|
},
|
|
@@ -892,8 +891,8 @@ const undoRedoStateAtom = atom({
|
|
|
892
891
|
updateMultipleBlocksProps: (x) => {
|
|
893
892
|
let y = [];
|
|
894
893
|
y = map(x, (b) => {
|
|
895
|
-
const
|
|
896
|
-
return each(
|
|
894
|
+
const C = keys(b), B = n.find((_) => _._id === b._id), j = {};
|
|
895
|
+
return each(C, (_) => j[_] = B[_]), j;
|
|
897
896
|
}), c(x), o({
|
|
898
897
|
undo: () => c(y),
|
|
899
898
|
redo: () => c(x)
|
|
@@ -2367,8 +2366,8 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2367
2366
|
for (const y in x) {
|
|
2368
2367
|
const b = x[y];
|
|
2369
2368
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2370
|
-
const { baseClasses:
|
|
2371
|
-
x[y] = compact(flattenDeep([
|
|
2369
|
+
const { baseClasses: C, classes: B } = getSplitChaiClasses(b);
|
|
2370
|
+
x[y] = compact(flattenDeep([C, B])).join(" ");
|
|
2372
2371
|
} else
|
|
2373
2372
|
y !== "_id" && delete x[y];
|
|
2374
2373
|
}
|
|
@@ -2382,16 +2381,16 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2382
2381
|
try {
|
|
2383
2382
|
const b = p === u ? "" : p;
|
|
2384
2383
|
console.log("prompt", x);
|
|
2385
|
-
const
|
|
2386
|
-
if (
|
|
2387
|
-
a(
|
|
2384
|
+
const C = x.toLowerCase().includes("translate the content"), B = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, C) : [m(f, d)], j = await l(h, addLangToPrompt(x, g, h), B, b), { blocks: _, error: w } = j;
|
|
2385
|
+
if (w) {
|
|
2386
|
+
a(w);
|
|
2388
2387
|
return;
|
|
2389
2388
|
}
|
|
2390
2389
|
if (h === "styles") {
|
|
2391
|
-
const k = _.map((
|
|
2392
|
-
for (const E in
|
|
2393
|
-
E !== "_id" && (
|
|
2394
|
-
return
|
|
2390
|
+
const k = _.map((A) => {
|
|
2391
|
+
for (const E in A)
|
|
2392
|
+
E !== "_id" && (A[E] = `${STYLES_KEY},${A[E]}`);
|
|
2393
|
+
return A;
|
|
2395
2394
|
});
|
|
2396
2395
|
c(k);
|
|
2397
2396
|
} else
|
|
@@ -3008,8 +3007,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3008
3007
|
}),
|
|
3009
3008
|
size({
|
|
3010
3009
|
boundary: u == null ? void 0 : u.body,
|
|
3011
|
-
apply({ availableWidth: y, availableHeight: b, elements:
|
|
3012
|
-
Object.assign(
|
|
3010
|
+
apply({ availableWidth: y, availableHeight: b, elements: C }) {
|
|
3011
|
+
Object.assign(C.floating.style, {
|
|
3013
3012
|
maxWidth: `${Math.max(200, y)}px`,
|
|
3014
3013
|
maxHeight: `${Math.max(100, b)}px`
|
|
3015
3014
|
});
|
|
@@ -3229,7 +3228,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3229
3228
|
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK),
|
|
3230
3229
|
className: "block h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
3231
3230
|
children: /* @__PURE__ */ 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-primary px-3 py-1 text-xs leading-tight text-white hover:bg-primary", children: [
|
|
3232
|
-
/* @__PURE__ */ jsx(PlusIcon
|
|
3231
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "size-2.5 stroke-[3]" }),
|
|
3233
3232
|
" ",
|
|
3234
3233
|
o("Add block")
|
|
3235
3234
|
] })
|
|
@@ -3325,7 +3324,16 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3325
3324
|
const d = useCallback(() => {
|
|
3326
3325
|
a([]), l([]);
|
|
3327
3326
|
}, [a, l]);
|
|
3328
|
-
return /* @__PURE__ */ jsx(
|
|
3327
|
+
return /* @__PURE__ */ jsx(
|
|
3328
|
+
"div",
|
|
3329
|
+
{
|
|
3330
|
+
id: "main-content",
|
|
3331
|
+
onClick: d,
|
|
3332
|
+
className: "h-full w-full border-l-4 border-r-4 pb-0",
|
|
3333
|
+
ref: i,
|
|
3334
|
+
children: o
|
|
3335
|
+
}
|
|
3336
|
+
);
|
|
3329
3337
|
}, MayBeAsyncPropsWrapper = ({ children: o, block: n }) => {
|
|
3330
3338
|
const r = useMemo(() => getRegisteredChaiBlock(n._type), [n._type]), a = get(r, "dataProviderDependencies"), l = get(r, "dataProvider"), i = get(r, "dataProviderMode", "mock"), c = useAsyncProps(n, i, a, l);
|
|
3331
3339
|
return o(c);
|
|
@@ -3600,28 +3608,28 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3600
3608
|
}
|
|
3601
3609
|
), WithBlockTextEditor = memo(
|
|
3602
3610
|
({ block: o, children: n }) => {
|
|
3603
|
-
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent:
|
|
3604
|
-
var
|
|
3605
|
-
const
|
|
3611
|
+
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: C, blockType: B } = useMemo(() => {
|
|
3612
|
+
var I;
|
|
3613
|
+
const A = o._type;
|
|
3606
3614
|
let E = o[r];
|
|
3607
|
-
const
|
|
3608
|
-
return f && ((
|
|
3615
|
+
const S = getRegisteredChaiBlock(o._type);
|
|
3616
|
+
return f && ((I = S == null ? void 0 : S.i18nProps) == null ? void 0 : I.includes(r)) && has(o, `${r}-${f}`) && (E = get(o, `${r}-${f}`)), { blockContent: E, blockType: A };
|
|
3609
3617
|
}, [o, f]), j = useCallback(
|
|
3610
|
-
(
|
|
3611
|
-
var
|
|
3612
|
-
const E =
|
|
3618
|
+
(A) => {
|
|
3619
|
+
var S;
|
|
3620
|
+
const E = A || ((S = g.current) == null ? void 0 : S.innerText);
|
|
3613
3621
|
h([b], { [r]: E }), u(null), c(null), d(-1), x(b ? [b] : []);
|
|
3614
3622
|
},
|
|
3615
3623
|
[b, h, c, x, f]
|
|
3616
3624
|
), _ = useDebouncedCallback(
|
|
3617
|
-
(
|
|
3618
|
-
h([b], { [r]:
|
|
3625
|
+
(A) => {
|
|
3626
|
+
h([b], { [r]: A });
|
|
3619
3627
|
},
|
|
3620
3628
|
[b, o, h, f],
|
|
3621
3629
|
1e3
|
|
3622
|
-
),
|
|
3623
|
-
(
|
|
3624
|
-
|
|
3630
|
+
), w = useCallback(
|
|
3631
|
+
(A) => {
|
|
3632
|
+
A.preventDefault(), b && (y.current = b), j(), setTimeout(() => {
|
|
3625
3633
|
const E = y.current;
|
|
3626
3634
|
y.current = null, x([E]);
|
|
3627
3635
|
}, 100);
|
|
@@ -3631,29 +3639,29 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3631
3639
|
useEffect(() => {
|
|
3632
3640
|
var v;
|
|
3633
3641
|
if (!b) return;
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3642
|
+
const A = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${A}${E}`);
|
|
3643
|
+
S && ((v = S == null ? void 0 : S.classList) == null || v.add("sr-only"), u(S));
|
|
3636
3644
|
}, [b, B, a, i]);
|
|
3637
3645
|
const k = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
3638
3646
|
RichTextEditor,
|
|
3639
3647
|
{
|
|
3640
|
-
blockContent:
|
|
3648
|
+
blockContent: C,
|
|
3641
3649
|
editingElement: p,
|
|
3642
3650
|
onChange: _,
|
|
3643
3651
|
onClose: j,
|
|
3644
|
-
onEscape:
|
|
3652
|
+
onEscape: w
|
|
3645
3653
|
}
|
|
3646
3654
|
) : /* @__PURE__ */ jsx(
|
|
3647
3655
|
MemoizedEditor,
|
|
3648
3656
|
{
|
|
3649
3657
|
editorRef: g,
|
|
3650
|
-
blockContent:
|
|
3658
|
+
blockContent: C,
|
|
3651
3659
|
editingElement: p,
|
|
3652
3660
|
onClose: j,
|
|
3653
3661
|
onChange: _,
|
|
3654
|
-
onEscape:
|
|
3662
|
+
onEscape: w
|
|
3655
3663
|
}
|
|
3656
|
-
)) : null, [p, b, B,
|
|
3664
|
+
)) : null, [p, b, B, C, j, f]);
|
|
3657
3665
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3658
3666
|
k,
|
|
3659
3667
|
n
|
|
@@ -3694,7 +3702,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3694
3702
|
key: y
|
|
3695
3703
|
}) : applyLanguage(i, d, c),
|
|
3696
3704
|
[i, d, c, g, h, x, y]
|
|
3697
|
-
),
|
|
3705
|
+
), C = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
|
|
3698
3706
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3699
3707
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3700
3708
|
), j = useMemo(
|
|
@@ -3703,7 +3711,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3703
3711
|
inBuilder: !0,
|
|
3704
3712
|
lang: d || p,
|
|
3705
3713
|
...b,
|
|
3706
|
-
...
|
|
3714
|
+
...C,
|
|
3707
3715
|
...B,
|
|
3708
3716
|
...o
|
|
3709
3717
|
}),
|
|
@@ -3713,13 +3721,13 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3713
3721
|
d,
|
|
3714
3722
|
p,
|
|
3715
3723
|
b,
|
|
3716
|
-
|
|
3724
|
+
C,
|
|
3717
3725
|
B,
|
|
3718
3726
|
o
|
|
3719
3727
|
]
|
|
3720
3728
|
), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3721
3729
|
if (isNull(f) || m.includes(i._id)) return null;
|
|
3722
|
-
let
|
|
3730
|
+
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
|
|
3723
3731
|
...j,
|
|
3724
3732
|
children: r({
|
|
3725
3733
|
_id: i._id,
|
|
@@ -3732,7 +3740,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3732
3740
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3733
3741
|
})
|
|
3734
3742
|
}) });
|
|
3735
|
-
const k = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children:
|
|
3743
|
+
const k = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
|
|
3736
3744
|
return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: k }) : k;
|
|
3737
3745
|
}, PartialWrapper = ({ children: o, partialBlockId: n }) => {
|
|
3738
3746
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
@@ -3898,9 +3906,9 @@ const CanvasEventsWatcher = () => {
|
|
|
3898
3906
|
}, FallbackError = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3899
3907
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3900
3908
|
/* @__PURE__ */ jsx("p", { children: "Please try again." })
|
|
3901
|
-
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
3909
|
+
] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-tDa4T69w.js")), CanvasArea = () => {
|
|
3902
3910
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3903
|
-
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40
|
|
3911
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
|
|
3904
3912
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
3905
3913
|
o ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(CodeEditor$1, {}) }) : null,
|
|
3906
3914
|
/* @__PURE__ */ jsx(Breadcrumb, {})
|
|
@@ -3979,7 +3987,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3979
3987
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
|
|
3980
3988
|
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: h(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
|
|
3981
3989
|
u && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
3982
|
-
/* @__PURE__ */ jsx(
|
|
3990
|
+
/* @__PURE__ */ jsx(ExclamationTriangleIcon, { className: "h-4 w-4" }),
|
|
3983
3991
|
/* @__PURE__ */ jsx(AlertDescription, { children: u })
|
|
3984
3992
|
] }),
|
|
3985
3993
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
@@ -4032,10 +4040,10 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4032
4040
|
const b = isArray(y) ? first(y) : y;
|
|
4033
4041
|
if (b) {
|
|
4034
4042
|
n(b == null ? void 0 : b.url);
|
|
4035
|
-
const
|
|
4043
|
+
const C = b == null ? void 0 : b.width, B = b == null ? void 0 : b.height;
|
|
4036
4044
|
if (c != null && c._id) {
|
|
4037
4045
|
const j = {
|
|
4038
|
-
...
|
|
4046
|
+
...C && { width: C },
|
|
4039
4047
|
...B && { height: B },
|
|
4040
4048
|
...b.description && { alt: b.description }
|
|
4041
4049
|
};
|
|
@@ -4062,7 +4070,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4062
4070
|
type: "button",
|
|
4063
4071
|
onClick: x,
|
|
4064
4072
|
className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4065
|
-
children: /* @__PURE__ */ jsx(
|
|
4073
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" })
|
|
4066
4074
|
}
|
|
4067
4075
|
),
|
|
4068
4076
|
m && m !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, assetId: m, children: /* @__PURE__ */ jsx(
|
|
@@ -4070,7 +4078,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4070
4078
|
{
|
|
4071
4079
|
type: "button",
|
|
4072
4080
|
className: "absolute inset-0 z-10 flex cursor-pointer items-center justify-center bg-black/10 opacity-0 transition duration-200 group-hover:bg-black/30 group-hover:opacity-100",
|
|
4073
|
-
children: /* @__PURE__ */ jsx(
|
|
4081
|
+
children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-4 w-4 text-white" })
|
|
4074
4082
|
}
|
|
4075
4083
|
) })
|
|
4076
4084
|
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, mode: "image", assetId: m, children: /* @__PURE__ */ 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]" }) }),
|
|
@@ -4115,7 +4123,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4115
4123
|
/* @__PURE__ */ jsx(CommandEmpty, { children: "No option found." }),
|
|
4116
4124
|
/* @__PURE__ */ jsxs(CommandGroup, { children: [
|
|
4117
4125
|
a.length > 0 && /* @__PURE__ */ jsxs(CommandItem, { onSelect: u, className: "flex items-center text-sm", children: [
|
|
4118
|
-
/* @__PURE__ */ jsx(
|
|
4126
|
+
/* @__PURE__ */ jsx(ChevronLeftIcon, { className: "mr-2 h-4 w-4" }),
|
|
4119
4127
|
"Back"
|
|
4120
4128
|
] }),
|
|
4121
4129
|
g.map((m) => /* @__PURE__ */ jsxs(
|
|
@@ -4127,7 +4135,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4127
4135
|
className: "flex items-center justify-between",
|
|
4128
4136
|
children: [
|
|
4129
4137
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
|
|
4130
|
-
startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(
|
|
4138
|
+
startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(IdCardIcon, {}) : null,
|
|
4131
4139
|
startsWith(m.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
|
|
4132
4140
|
] }),
|
|
4133
4141
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -4143,7 +4151,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4143
4151
|
children: "Select"
|
|
4144
4152
|
}
|
|
4145
4153
|
),
|
|
4146
|
-
m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(
|
|
4154
|
+
m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
4147
4155
|
] })
|
|
4148
4156
|
]
|
|
4149
4157
|
},
|
|
@@ -4207,10 +4215,10 @@ const DataBindingSelector = ({
|
|
|
4207
4215
|
n(`{{${g}}}`, {}, r);
|
|
4208
4216
|
return;
|
|
4209
4217
|
}
|
|
4210
|
-
const h = (b) => /[.,!?;:]/.test(b), f = (b,
|
|
4218
|
+
const h = (b) => /[.,!?;:]/.test(b), f = (b, C, B) => {
|
|
4211
4219
|
let j = "", _ = "";
|
|
4212
|
-
const
|
|
4213
|
-
return
|
|
4220
|
+
const w = C > 0 ? b[C - 1] : "", k = C < b.length ? b[C] : "";
|
|
4221
|
+
return C > 0 && (w === "." || !h(w) && w !== " ") && (j = " "), C < b.length && !h(k) && k !== " " && (_ = " "), {
|
|
4214
4222
|
text: j + B + _,
|
|
4215
4223
|
prefixLength: j.length,
|
|
4216
4224
|
suffixLength: _.length
|
|
@@ -4221,30 +4229,30 @@ const DataBindingSelector = ({
|
|
|
4221
4229
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4222
4230
|
const b = y.__chaiRTE;
|
|
4223
4231
|
if (b) {
|
|
4224
|
-
const
|
|
4232
|
+
const C = `{{${g}}}`;
|
|
4225
4233
|
b.commands.focus();
|
|
4226
4234
|
const { from: B, to: j } = b.state.selection;
|
|
4227
4235
|
if (B !== j)
|
|
4228
|
-
b.chain().deleteSelection().insertContent(
|
|
4236
|
+
b.chain().deleteSelection().insertContent(C).run();
|
|
4229
4237
|
else {
|
|
4230
|
-
const { state:
|
|
4231
|
-
let
|
|
4232
|
-
k > 0 &&
|
|
4238
|
+
const { state: w } = b, k = w.selection.from, A = w.doc.textBetween(Math.max(0, k - 1), k), E = w.doc.textBetween(k, Math.min(k + 1, w.doc.content.size));
|
|
4239
|
+
let S = "";
|
|
4240
|
+
k > 0 && A !== " " && !h(A) && (S = " ");
|
|
4233
4241
|
let v = "";
|
|
4234
|
-
E && E !== " " && !h(E) && (v = " "), b.chain().insertContent(
|
|
4242
|
+
E && E !== " " && !h(E) && (v = " "), b.chain().insertContent(S + C + v).run();
|
|
4235
4243
|
}
|
|
4236
4244
|
setTimeout(() => n(b.getHTML(), {}, r), 100);
|
|
4237
4245
|
return;
|
|
4238
4246
|
}
|
|
4239
4247
|
} else {
|
|
4240
|
-
const b = x,
|
|
4241
|
-
if (j >
|
|
4242
|
-
const E = `{{${g}}}`, { text:
|
|
4248
|
+
const b = x, C = b.selectionStart || 0, B = b.value || "", j = b.selectionEnd || C;
|
|
4249
|
+
if (j > C) {
|
|
4250
|
+
const E = `{{${g}}}`, { text: S } = f(B, C, E), v = B.slice(0, C) + S + B.slice(j);
|
|
4243
4251
|
n(v, {}, r);
|
|
4244
4252
|
return;
|
|
4245
4253
|
}
|
|
4246
|
-
const
|
|
4247
|
-
n(
|
|
4254
|
+
const w = `{{${g}}}`, { text: k } = f(B, C, w), A = B.slice(0, C) + k + B.slice(C);
|
|
4255
|
+
n(A, {}, r);
|
|
4248
4256
|
}
|
|
4249
4257
|
},
|
|
4250
4258
|
[r, n, a, c == null ? void 0 : c._id, d]
|
|
@@ -4266,73 +4274,73 @@ const DataBindingSelector = ({
|
|
|
4266
4274
|
onChange: r
|
|
4267
4275
|
}) => {
|
|
4268
4276
|
var E;
|
|
4269
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (
|
|
4277
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, v) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), C = useRef(null), B = (E = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : E.name;
|
|
4270
4278
|
useEffect(() => {
|
|
4271
4279
|
if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4272
|
-
const
|
|
4280
|
+
const S = split(o, ":"), v = get(S, 1, "page") || "page";
|
|
4273
4281
|
g(v), (async () => {
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4282
|
+
const I = await l(v, [get(S, 2, "page")]);
|
|
4283
|
+
I && Array.isArray(I) && h(get(I, [0, "name"], ""));
|
|
4276
4284
|
})();
|
|
4277
4285
|
}, [o]);
|
|
4278
4286
|
const j = useDebouncedCallback(
|
|
4279
|
-
async (
|
|
4280
|
-
if (isEmpty(
|
|
4287
|
+
async (S) => {
|
|
4288
|
+
if (isEmpty(S))
|
|
4281
4289
|
x([]);
|
|
4282
4290
|
else {
|
|
4283
|
-
const v = await l(u,
|
|
4291
|
+
const v = await l(u, S);
|
|
4284
4292
|
x(v);
|
|
4285
4293
|
}
|
|
4286
4294
|
c(!1), b(-1);
|
|
4287
4295
|
},
|
|
4288
4296
|
[u],
|
|
4289
4297
|
300
|
|
4290
|
-
), _ = (
|
|
4291
|
-
const v = ["pageType", u,
|
|
4292
|
-
v[1] && (r(v.join(":")), h(
|
|
4293
|
-
},
|
|
4294
|
-
switch (
|
|
4298
|
+
), _ = (S) => {
|
|
4299
|
+
const v = ["pageType", u, S.id];
|
|
4300
|
+
v[1] && (r(v.join(":")), h(S.name), p(!1), x([]), b(-1));
|
|
4301
|
+
}, w = (S) => {
|
|
4302
|
+
switch (S.key) {
|
|
4295
4303
|
case "ArrowDown":
|
|
4296
|
-
|
|
4304
|
+
S.preventDefault(), b((v) => v < f.length - 1 ? v + 1 : v);
|
|
4297
4305
|
break;
|
|
4298
4306
|
case "ArrowUp":
|
|
4299
|
-
|
|
4307
|
+
S.preventDefault(), b((v) => v > 0 ? v - 1 : v);
|
|
4300
4308
|
break;
|
|
4301
4309
|
case "Enter":
|
|
4302
|
-
if (
|
|
4310
|
+
if (S.preventDefault(), f.length === 0) return;
|
|
4303
4311
|
y >= 0 && _(f[y]);
|
|
4304
4312
|
break;
|
|
4305
4313
|
case "Escape":
|
|
4306
|
-
|
|
4314
|
+
S.preventDefault(), k();
|
|
4307
4315
|
break;
|
|
4308
4316
|
}
|
|
4309
4317
|
};
|
|
4310
4318
|
useEffect(() => {
|
|
4311
|
-
if (y >= 0 &&
|
|
4312
|
-
const
|
|
4313
|
-
|
|
4319
|
+
if (y >= 0 && C.current) {
|
|
4320
|
+
const S = C.current.children[y];
|
|
4321
|
+
S == null || S.scrollIntoView({ block: "nearest" });
|
|
4314
4322
|
}
|
|
4315
4323
|
}, [y]);
|
|
4316
4324
|
const k = () => {
|
|
4317
4325
|
h(""), x([]), b(-1), p(!1), r("");
|
|
4318
|
-
},
|
|
4319
|
-
h(
|
|
4326
|
+
}, A = (S) => {
|
|
4327
|
+
h(S), p(!isEmpty(S)), c(!0), j(S);
|
|
4320
4328
|
};
|
|
4321
4329
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4322
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (
|
|
4330
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(n, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
|
|
4323
4331
|
u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
4324
4332
|
/* @__PURE__ */ jsx(
|
|
4325
4333
|
"input",
|
|
4326
4334
|
{
|
|
4327
4335
|
type: "text",
|
|
4328
4336
|
value: m,
|
|
4329
|
-
onChange: (
|
|
4330
|
-
onKeyDown:
|
|
4337
|
+
onChange: (S) => A(S.target.value),
|
|
4338
|
+
onKeyDown: w,
|
|
4331
4339
|
placeholder: a(`Search ${B ?? ""}`),
|
|
4332
4340
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4333
4341
|
}
|
|
4334
4342
|
),
|
|
4335
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: k, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(
|
|
4343
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: k, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
|
|
4336
4344
|
] }),
|
|
4337
4345
|
(i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
4338
4346
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4342,22 +4350,22 @@ const DataBindingSelector = ({
|
|
|
4342
4350
|
' "',
|
|
4343
4351
|
m,
|
|
4344
4352
|
'"'
|
|
4345
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref:
|
|
4353
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(f == null ? void 0 : f.slice(0, 20), (S, v) => /* @__PURE__ */ jsxs(
|
|
4346
4354
|
"li",
|
|
4347
4355
|
{
|
|
4348
|
-
onClick: () => _(
|
|
4349
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
4356
|
+
onClick: () => _(S),
|
|
4357
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : v === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4350
4358
|
children: [
|
|
4351
|
-
|
|
4359
|
+
S.name,
|
|
4352
4360
|
" ",
|
|
4353
|
-
|
|
4361
|
+
S.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
4354
4362
|
"( ",
|
|
4355
|
-
|
|
4363
|
+
S.slug,
|
|
4356
4364
|
" )"
|
|
4357
4365
|
] })
|
|
4358
4366
|
]
|
|
4359
4367
|
},
|
|
4360
|
-
|
|
4368
|
+
S.id
|
|
4361
4369
|
)) }) })
|
|
4362
4370
|
] });
|
|
4363
4371
|
}, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
|
|
@@ -4440,7 +4448,7 @@ const DataBindingSelector = ({
|
|
|
4440
4448
|
className: "duratiom-300 flex items-center gap-x-1 rounded border border-gray-400 bg-gray-100 px-4 py-1 text-[11px] font-medium leading-tight hover:bg-slate-200",
|
|
4441
4449
|
onClick: () => r({ type: "Column", styles: "#styles:," }, a == null ? void 0 : a._id),
|
|
4442
4450
|
children: [
|
|
4443
|
-
/* @__PURE__ */ jsx(
|
|
4451
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" }),
|
|
4444
4452
|
" Add Column"
|
|
4445
4453
|
]
|
|
4446
4454
|
}
|
|
@@ -4466,7 +4474,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4466
4474
|
onClick: () => o.chain().focus().toggleBold().run(),
|
|
4467
4475
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("bold") }),
|
|
4468
4476
|
title: "Bold",
|
|
4469
|
-
children: /* @__PURE__ */ jsx(
|
|
4477
|
+
children: /* @__PURE__ */ jsx(LetterCaseCapitalizeIcon, { className: "h-4 w-4" })
|
|
4470
4478
|
}
|
|
4471
4479
|
),
|
|
4472
4480
|
/* @__PURE__ */ jsx(
|
|
@@ -4476,7 +4484,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4476
4484
|
onClick: () => o.chain().focus().toggleItalic().run(),
|
|
4477
4485
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("italic") }),
|
|
4478
4486
|
title: "Italic",
|
|
4479
|
-
children: /* @__PURE__ */ jsx(
|
|
4487
|
+
children: /* @__PURE__ */ jsx(FontItalicIcon, { className: "h-4 w-4" })
|
|
4480
4488
|
}
|
|
4481
4489
|
),
|
|
4482
4490
|
/* @__PURE__ */ jsx(
|
|
@@ -4486,7 +4494,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4486
4494
|
onClick: () => o.chain().focus().toggleUnderline().run(),
|
|
4487
4495
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("underline") }),
|
|
4488
4496
|
title: "Underline",
|
|
4489
|
-
children: /* @__PURE__ */ jsx(
|
|
4497
|
+
children: /* @__PURE__ */ jsx(UnderlineIcon, { className: "h-4 w-4" })
|
|
4490
4498
|
}
|
|
4491
4499
|
),
|
|
4492
4500
|
/* @__PURE__ */ jsx(
|
|
@@ -4496,7 +4504,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4496
4504
|
onClick: () => o.chain().focus().toggleStrike().run(),
|
|
4497
4505
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("strike") }),
|
|
4498
4506
|
title: "Strike",
|
|
4499
|
-
children: /* @__PURE__ */ jsx(
|
|
4507
|
+
children: /* @__PURE__ */ jsx(StrikethroughIcon, { className: "h-4 w-4" })
|
|
4500
4508
|
}
|
|
4501
4509
|
),
|
|
4502
4510
|
/* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px self-center bg-border" }),
|
|
@@ -4507,7 +4515,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4507
4515
|
onClick: () => o.chain().focus().toggleBulletList().run(),
|
|
4508
4516
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("bulletList") }),
|
|
4509
4517
|
title: "Bullet List",
|
|
4510
|
-
children: /* @__PURE__ */ jsx(
|
|
4518
|
+
children: /* @__PURE__ */ jsx(ListBulletIcon, { className: "h-4 w-4" })
|
|
4511
4519
|
}
|
|
4512
4520
|
),
|
|
4513
4521
|
/* @__PURE__ */ jsx(
|
|
@@ -4517,7 +4525,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4517
4525
|
onClick: () => o.chain().focus().toggleOrderedList().run(),
|
|
4518
4526
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("orderedList") }),
|
|
4519
4527
|
title: "Ordered List",
|
|
4520
|
-
children: /* @__PURE__ */ jsx(
|
|
4528
|
+
children: /* @__PURE__ */ jsx(ValueIcon, { className: "h-4 w-4" })
|
|
4521
4529
|
}
|
|
4522
4530
|
),
|
|
4523
4531
|
/* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px self-center bg-border" }),
|
|
@@ -4528,7 +4536,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4528
4536
|
onClick: () => o.chain().focus().setTextAlign("left").run(),
|
|
4529
4537
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive({ textAlign: "left" }) }),
|
|
4530
4538
|
title: "Align Left",
|
|
4531
|
-
children: /* @__PURE__ */ jsx(
|
|
4539
|
+
children: /* @__PURE__ */ jsx(TextAlignLeftIcon, { className: "h-4 w-4" })
|
|
4532
4540
|
}
|
|
4533
4541
|
),
|
|
4534
4542
|
/* @__PURE__ */ jsx(
|
|
@@ -4538,7 +4546,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4538
4546
|
onClick: () => o.chain().focus().setTextAlign("center").run(),
|
|
4539
4547
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive({ textAlign: "center" }) }),
|
|
4540
4548
|
title: "Align Center",
|
|
4541
|
-
children: /* @__PURE__ */ jsx(
|
|
4549
|
+
children: /* @__PURE__ */ jsx(TextAlignCenterIcon, { className: "h-4 w-4" })
|
|
4542
4550
|
}
|
|
4543
4551
|
),
|
|
4544
4552
|
/* @__PURE__ */ jsx(
|
|
@@ -4548,7 +4556,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4548
4556
|
onClick: () => o.chain().focus().setTextAlign("right").run(),
|
|
4549
4557
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive({ textAlign: "right" }) }),
|
|
4550
4558
|
title: "Align Right",
|
|
4551
|
-
children: /* @__PURE__ */ jsx(
|
|
4559
|
+
children: /* @__PURE__ */ jsx(TextAlignRightIcon, { className: "h-4 w-4" })
|
|
4552
4560
|
}
|
|
4553
4561
|
),
|
|
4554
4562
|
/* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px self-center bg-border" }),
|
|
@@ -4559,7 +4567,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4559
4567
|
onClick: r,
|
|
4560
4568
|
className: cn("rounded p-1 hover:bg-muted", { "bg-muted": o.isActive("link") }),
|
|
4561
4569
|
title: "Add Link",
|
|
4562
|
-
children: /* @__PURE__ */ jsx(
|
|
4570
|
+
children: /* @__PURE__ */ jsx(Link1Icon, { className: "h-4 w-4" })
|
|
4563
4571
|
}
|
|
4564
4572
|
),
|
|
4565
4573
|
/* @__PURE__ */ jsx(
|
|
@@ -4570,7 +4578,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4570
4578
|
className: cn("rounded p-1 hover:bg-muted"),
|
|
4571
4579
|
title: "Remove Link",
|
|
4572
4580
|
disabled: !o.isActive("link"),
|
|
4573
|
-
children: /* @__PURE__ */ jsx(
|
|
4581
|
+
children: /* @__PURE__ */ jsx(LinkBreak1Icon, { className: "h-4 w-4" })
|
|
4574
4582
|
}
|
|
4575
4583
|
),
|
|
4576
4584
|
n && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -4582,7 +4590,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4582
4590
|
onClick: n,
|
|
4583
4591
|
className: "rounded p-1 hover:bg-muted",
|
|
4584
4592
|
title: "Open in full screen mode",
|
|
4585
|
-
children: /* @__PURE__ */ jsx(
|
|
4593
|
+
children: /* @__PURE__ */ jsx(EnterFullScreenIcon, { className: "h-4 w-4" })
|
|
4586
4594
|
}
|
|
4587
4595
|
)
|
|
4588
4596
|
] })
|
|
@@ -4661,11 +4669,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4661
4669
|
if (f !== x)
|
|
4662
4670
|
u.chain().deleteSelection().insertContent(h).run();
|
|
4663
4671
|
else {
|
|
4664
|
-
const { state: b } = u,
|
|
4672
|
+
const { state: b } = u, C = b.selection.from, B = b.doc.textBetween(Math.max(0, C - 1), C), j = b.doc.textBetween(C, Math.min(C + 1, b.doc.content.size));
|
|
4665
4673
|
let _ = "";
|
|
4666
|
-
|
|
4667
|
-
let
|
|
4668
|
-
j && j !== " " && !/[.,!?;:]/.test(j) && (
|
|
4674
|
+
C > 0 && B !== " " && !/[.,!?;:]/.test(B) && (_ = " ");
|
|
4675
|
+
let w = "";
|
|
4676
|
+
j && j !== " " && !/[.,!?;:]/.test(j) && (w = " "), u.chain().insertContent(_ + h + w).run();
|
|
4669
4677
|
}
|
|
4670
4678
|
};
|
|
4671
4679
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4779,7 +4787,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4779
4787
|
};
|
|
4780
4788
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
4781
4789
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
|
|
4782
|
-
/* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(
|
|
4790
|
+
/* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "h-3 w-3" }) }),
|
|
4783
4791
|
/* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: g ? /* @__PURE__ */ jsxs("span", { className: "", children: [
|
|
4784
4792
|
/* @__PURE__ */ jsxs("b", { className: "text-[12px]", children: [
|
|
4785
4793
|
" ",
|
|
@@ -4788,14 +4796,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4788
4796
|
"/",
|
|
4789
4797
|
u.length
|
|
4790
4798
|
] }) : "-" }),
|
|
4791
|
-
/* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(
|
|
4799
|
+
/* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) }),
|
|
4792
4800
|
/* @__PURE__ */ jsxs(
|
|
4793
4801
|
"button",
|
|
4794
4802
|
{
|
|
4795
4803
|
onClick: f,
|
|
4796
4804
|
className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
|
|
4797
4805
|
children: [
|
|
4798
|
-
/* @__PURE__ */ jsx(
|
|
4806
|
+
/* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-3 w-3" }),
|
|
4799
4807
|
"Add Slide"
|
|
4800
4808
|
]
|
|
4801
4809
|
}
|
|
@@ -4882,7 +4890,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4882
4890
|
type: "button",
|
|
4883
4891
|
onClick: l,
|
|
4884
4892
|
className: "flex items-center gap-x-1 rounded-md border border-blue-500 bg-blue-100 px-2 py-px text-xs text-blue-600 hover:opacity-80",
|
|
4885
|
-
children: /* @__PURE__ */ jsx(
|
|
4893
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" })
|
|
4886
4894
|
}
|
|
4887
4895
|
)
|
|
4888
4896
|
] }),
|
|
@@ -4893,7 +4901,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4893
4901
|
type: "button",
|
|
4894
4902
|
onClick: () => i(d),
|
|
4895
4903
|
className: "absolute -right-px -top-0 -translate-y-1/2 rounded-full bg-red-100 p-1 opacity-0 hover:bg-red-200 group-hover:opacity-100",
|
|
4896
|
-
children: /* @__PURE__ */ jsx(
|
|
4904
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-2.5 w-2.5 text-red-500" })
|
|
4897
4905
|
}
|
|
4898
4906
|
),
|
|
4899
4907
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 rounded border", children: [
|
|
@@ -4965,14 +4973,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4965
4973
|
const { selectedLang: m, fallbackLang: h, languages: f } = useLanguages(), x = useMemo(
|
|
4966
4974
|
() => isEmpty(f) ? "" : isEmpty(m) ? h : m,
|
|
4967
4975
|
[f, m, h]
|
|
4968
|
-
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(),
|
|
4969
|
-
() => get(B, [
|
|
4970
|
-
[B,
|
|
4971
|
-
), [_,
|
|
4976
|
+
), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), C = useSelectedBlock(), B = useRegisteredChaiBlocks(), j = useMemo(
|
|
4977
|
+
() => get(B, [C == null ? void 0 : C._type, "i18nProps"], []),
|
|
4978
|
+
[B, C == null ? void 0 : C._type]
|
|
4979
|
+
), [_, w] = useState(null);
|
|
4972
4980
|
if (c)
|
|
4973
4981
|
return null;
|
|
4974
4982
|
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: n, children: a });
|
|
4975
|
-
const
|
|
4983
|
+
const A = j == null ? void 0 : j.includes(o.replace("root.", ""));
|
|
4976
4984
|
if (p.type === "array") {
|
|
4977
4985
|
const E = _ === o;
|
|
4978
4986
|
return /* @__PURE__ */ jsxs("div", { className: `${n} relative`, children: [
|
|
@@ -4980,21 +4988,21 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4980
4988
|
"label",
|
|
4981
4989
|
{
|
|
4982
4990
|
htmlFor: o,
|
|
4983
|
-
onClick: () =>
|
|
4991
|
+
onClick: () => w(E ? null : o),
|
|
4984
4992
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4985
4993
|
children: [
|
|
4986
|
-
E ? /* @__PURE__ */ jsx(
|
|
4987
|
-
/* @__PURE__ */ jsx(
|
|
4994
|
+
E ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
4995
|
+
/* @__PURE__ */ jsx(ListBulletIcon, { className: "h-3 w-3" }),
|
|
4988
4996
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: r }),
|
|
4989
4997
|
" ",
|
|
4990
4998
|
/* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: u == null ? void 0 : u.length }) }),
|
|
4991
4999
|
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4992
5000
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
4993
|
-
|
|
5001
|
+
InfoCircledIcon,
|
|
4994
5002
|
{
|
|
4995
5003
|
className: "h-3 w-3 text-muted-foreground/70",
|
|
4996
|
-
onClick: (
|
|
4997
|
-
onMouseDown: (
|
|
5004
|
+
onClick: (S) => S.stopPropagation(),
|
|
5005
|
+
onMouseDown: (S) => S.stopPropagation()
|
|
4998
5006
|
}
|
|
4999
5007
|
) }),
|
|
5000
5008
|
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
@@ -5015,14 +5023,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5015
5023
|
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
5016
5024
|
r,
|
|
5017
5025
|
" ",
|
|
5018
|
-
|
|
5026
|
+
A && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5019
5027
|
" ",
|
|
5020
5028
|
y
|
|
5021
5029
|
] }),
|
|
5022
5030
|
d && p.type !== "object" ? " *" : null
|
|
5023
5031
|
] }),
|
|
5024
5032
|
p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
5025
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
5033
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(InfoCircledIcon, { className: "h-3 w-3 text-muted-foreground/70" }) }),
|
|
5026
5034
|
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
5027
5035
|
] }) })
|
|
5028
5036
|
] }),
|
|
@@ -5046,7 +5054,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5046
5054
|
var i;
|
|
5047
5055
|
if (!o)
|
|
5048
5056
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-2 py-1.5 text-xs text-gray-500 text-gray-600", children: [
|
|
5049
|
-
/* @__PURE__ */ jsx(
|
|
5057
|
+
/* @__PURE__ */ jsx(FileIcon, { className: "h-4 w-4" }),
|
|
5050
5058
|
" Choose a collection"
|
|
5051
5059
|
] });
|
|
5052
5060
|
const r = `{{${COLLECTION_PREFIX}`, a = o == null ? void 0 : o.startsWith(r);
|
|
@@ -5054,7 +5062,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5054
5062
|
return a && (l = (i = o == null ? void 0 : o.replace(r, "")) == null ? void 0 : i.replace("}}", "")), /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-col gap-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 rounded-md border border-blue-200 bg-blue-50 px-2 py-1 text-xs text-blue-600", children: [
|
|
5055
5063
|
/* @__PURE__ */ jsxs("span", { className: "flex max-w-[200px] items-center gap-2", children: [
|
|
5056
5064
|
" ",
|
|
5057
|
-
a ? /* @__PURE__ */ jsx(
|
|
5065
|
+
a ? /* @__PURE__ */ jsx(IdCardIcon, { className: "h-3 min-h-3 w-3 min-w-3" }) : null,
|
|
5058
5066
|
/* @__PURE__ */ jsxs(Tooltip, { delayDuration: 500, children: [
|
|
5059
5067
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("span", { className: "cursor-default truncate", children: l }) }),
|
|
5060
5068
|
/* @__PURE__ */ jsx(TooltipContent, { side: "left", hidden: l.length < 50, children: l })
|
|
@@ -5068,14 +5076,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5068
5076
|
size: "icon",
|
|
5069
5077
|
className: "h-5 w-5 rounded-full bg-gray-200 text-gray-900 hover:bg-gray-300",
|
|
5070
5078
|
onClick: () => n(""),
|
|
5071
|
-
children: /* @__PURE__ */ jsx(
|
|
5079
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
5072
5080
|
}
|
|
5073
5081
|
) }),
|
|
5074
5082
|
/* @__PURE__ */ jsx(TooltipContent, { side: "left", children: "Remove binding" })
|
|
5075
5083
|
] })
|
|
5076
5084
|
] }) });
|
|
5077
5085
|
}, CustomAddButton = (o) => /* @__PURE__ */ jsx("button", { ...o, className: "duration absolute right-2 top-2 cursor-pointer text-blue-400 hover:text-blue-500", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-0.5 text-[11px] leading-tight", children: [
|
|
5078
|
-
/* @__PURE__ */ jsx(
|
|
5086
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" }),
|
|
5079
5087
|
" ",
|
|
5080
5088
|
/* @__PURE__ */ jsx("span", { children: "Add" })
|
|
5081
5089
|
] }) }), JSONForm = memo(({ blockId: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
|
|
@@ -5137,46 +5145,46 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5137
5145
|
}), a;
|
|
5138
5146
|
};
|
|
5139
5147
|
function BlockSettings() {
|
|
5140
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData:
|
|
5141
|
-
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(
|
|
5148
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData: w }, k, A) => {
|
|
5149
|
+
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(w, k) }, A);
|
|
5142
5150
|
}, x = useCallback(
|
|
5143
|
-
debounce(({ formData:
|
|
5144
|
-
f({ formData:
|
|
5151
|
+
debounce(({ formData: w }, k, A) => {
|
|
5152
|
+
f({ formData: w }, k, A), d(w);
|
|
5145
5153
|
}, 1500),
|
|
5146
5154
|
[n == null ? void 0 : n._id, o]
|
|
5147
|
-
), y = ({ formData:
|
|
5148
|
-
k && (r([n._id], { [k]: get(
|
|
5149
|
-
}, b = ({ formData:
|
|
5150
|
-
k && (r([g._id], { [k]: get(
|
|
5151
|
-
}, { schema:
|
|
5152
|
-
const
|
|
5153
|
-
if (!
|
|
5155
|
+
), y = ({ formData: w }, k) => {
|
|
5156
|
+
k && (r([n._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5157
|
+
}, b = ({ formData: w }, k) => {
|
|
5158
|
+
k && (r([g._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
|
|
5159
|
+
}, { schema: C, uiSchema: B } = useMemo(() => {
|
|
5160
|
+
const w = n == null ? void 0 : n._type;
|
|
5161
|
+
if (!w)
|
|
5154
5162
|
return { schema: {}, uiSchema: {} };
|
|
5155
5163
|
try {
|
|
5156
|
-
const { schema: k, uiSchema:
|
|
5157
|
-
if (
|
|
5164
|
+
const { schema: k, uiSchema: A } = getBlockFormSchemas(w);
|
|
5165
|
+
if (w === "Repeater") {
|
|
5158
5166
|
const E = get(n, "repeaterItems", "");
|
|
5159
|
-
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(
|
|
5167
|
+
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(A, "filter", { "ui:widget": "collectionSelect" }), set(A, "sort", { "ui:widget": "collectionSelect" })) : (set(A, "filter", { "ui:widget": "hidden" }), set(A, "sort", { "ui:widget": "hidden" }));
|
|
5160
5168
|
}
|
|
5161
|
-
return { schema: k, uiSchema:
|
|
5169
|
+
return { schema: k, uiSchema: A };
|
|
5162
5170
|
} catch {
|
|
5163
5171
|
return { schema: {}, uiSchema: {} };
|
|
5164
5172
|
}
|
|
5165
5173
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: _ } = useMemo(() => {
|
|
5166
5174
|
if (!g || !(g != null && g._type))
|
|
5167
5175
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5168
|
-
const
|
|
5169
|
-
return { wrapperSchema: k, wrapperUiSchema:
|
|
5176
|
+
const w = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: A = {} } = getBlockFormSchemas(w);
|
|
5177
|
+
return { wrapperSchema: k, wrapperUiSchema: A };
|
|
5170
5178
|
}, [g]);
|
|
5171
5179
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5172
5180
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5173
5181
|
/* @__PURE__ */ jsxs(
|
|
5174
5182
|
"div",
|
|
5175
5183
|
{
|
|
5176
|
-
onClick: () => u((
|
|
5184
|
+
onClick: () => u((w) => !w),
|
|
5177
5185
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5178
5186
|
children: [
|
|
5179
|
-
p ? /* @__PURE__ */ jsx(
|
|
5187
|
+
p ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 text-slate-400" }),
|
|
5180
5188
|
startCase(g._type),
|
|
5181
5189
|
" settings",
|
|
5182
5190
|
" ",
|
|
@@ -5199,13 +5207,13 @@ function BlockSettings() {
|
|
|
5199
5207
|
}
|
|
5200
5208
|
) })
|
|
5201
5209
|
] }),
|
|
5202
|
-
isEmpty(
|
|
5210
|
+
isEmpty(C) ? null : /* @__PURE__ */ jsx(
|
|
5203
5211
|
JSONForm,
|
|
5204
5212
|
{
|
|
5205
5213
|
blockId: n == null ? void 0 : n._id,
|
|
5206
5214
|
onChange: y,
|
|
5207
5215
|
formData: i,
|
|
5208
|
-
schema:
|
|
5216
|
+
schema: C,
|
|
5209
5217
|
uiSchema: B
|
|
5210
5218
|
}
|
|
5211
5219
|
)
|
|
@@ -5240,7 +5248,7 @@ const BlockStylingProps = () => {
|
|
|
5240
5248
|
type: "button",
|
|
5241
5249
|
className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
|
|
5242
5250
|
onClick: (y) => y.stopPropagation(),
|
|
5243
|
-
children: /* @__PURE__ */ jsx(
|
|
5251
|
+
children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" })
|
|
5244
5252
|
}
|
|
5245
5253
|
) }),
|
|
5246
5254
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
|
|
@@ -5417,50 +5425,50 @@ const BlockStylingProps = () => {
|
|
|
5417
5425
|
},
|
|
5418
5426
|
a
|
|
5419
5427
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5420
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [
|
|
5428
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [C, B] = useState(!1), [j, _] = useState(!1);
|
|
5421
5429
|
useEffect(() => {
|
|
5422
|
-
const { value:
|
|
5430
|
+
const { value: S, unit: v } = getClassValueAndUnit(i);
|
|
5423
5431
|
if (v === "") {
|
|
5424
|
-
l(
|
|
5432
|
+
l(S), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5425
5433
|
return;
|
|
5426
5434
|
}
|
|
5427
|
-
h(v), l(v === "class" || isEmpty(
|
|
5435
|
+
h(v), l(v === "class" || isEmpty(S) ? "" : S);
|
|
5428
5436
|
}, [i, p, u]);
|
|
5429
|
-
const
|
|
5430
|
-
(
|
|
5437
|
+
const w = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), k = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), A = useCallback(
|
|
5438
|
+
(S = !1) => {
|
|
5431
5439
|
const v = getUserInputValues(`${a}`, u);
|
|
5432
5440
|
if (get(v, "error", !1)) {
|
|
5433
5441
|
x(!0);
|
|
5434
5442
|
return;
|
|
5435
5443
|
}
|
|
5436
|
-
const
|
|
5437
|
-
if (
|
|
5438
|
-
|
|
5444
|
+
const I = get(v, "unit") !== "" ? get(v, "unit") : m;
|
|
5445
|
+
if (I === "auto" || I === "none") {
|
|
5446
|
+
w(`${d}${I}`);
|
|
5439
5447
|
return;
|
|
5440
5448
|
}
|
|
5441
5449
|
if (get(v, "value") === "")
|
|
5442
5450
|
return;
|
|
5443
|
-
const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${
|
|
5444
|
-
|
|
5451
|
+
const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5452
|
+
S ? k(T) : w(T);
|
|
5445
5453
|
},
|
|
5446
|
-
[
|
|
5454
|
+
[w, k, a, m, d, u]
|
|
5447
5455
|
), E = useCallback(
|
|
5448
|
-
(
|
|
5456
|
+
(S) => {
|
|
5449
5457
|
const v = getUserInputValues(`${a}`, u);
|
|
5450
5458
|
if (get(v, "error", !1)) {
|
|
5451
5459
|
x(!0);
|
|
5452
5460
|
return;
|
|
5453
5461
|
}
|
|
5454
|
-
if (
|
|
5455
|
-
|
|
5462
|
+
if (S === "auto" || S === "none") {
|
|
5463
|
+
w(`${d}${S}`);
|
|
5456
5464
|
return;
|
|
5457
5465
|
}
|
|
5458
5466
|
if (get(v, "value") === "")
|
|
5459
5467
|
return;
|
|
5460
|
-
const
|
|
5461
|
-
|
|
5468
|
+
const I = get(v, "unit") !== "" ? get(v, "unit") : S, T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5469
|
+
w(T);
|
|
5462
5470
|
},
|
|
5463
|
-
[
|
|
5471
|
+
[w, a, d, u]
|
|
5464
5472
|
);
|
|
5465
5473
|
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5466
5474
|
/* @__PURE__ */ jsx(
|
|
@@ -5475,37 +5483,37 @@ const BlockStylingProps = () => {
|
|
|
5475
5483
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
|
|
5476
5484
|
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
5477
5485
|
] })
|
|
5478
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${
|
|
5486
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${C ? "z-auto" : ""}`, children: [
|
|
5479
5487
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
5480
5488
|
["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
|
|
5481
5489
|
"input",
|
|
5482
5490
|
{
|
|
5483
5491
|
readOnly: m === "class",
|
|
5484
|
-
onKeyPress: (
|
|
5485
|
-
|
|
5492
|
+
onKeyPress: (S) => {
|
|
5493
|
+
S.key === "Enter" && A();
|
|
5486
5494
|
},
|
|
5487
|
-
onKeyDown: (
|
|
5488
|
-
if (
|
|
5495
|
+
onKeyDown: (S) => {
|
|
5496
|
+
if (S.keyCode !== 38 && S.keyCode !== 40)
|
|
5489
5497
|
return;
|
|
5490
|
-
|
|
5491
|
-
const v = parseInt$1(
|
|
5492
|
-
let
|
|
5493
|
-
|
|
5494
|
-
const L = `${
|
|
5498
|
+
S.preventDefault(), _(!0);
|
|
5499
|
+
const v = parseInt$1(S.target.value);
|
|
5500
|
+
let I = isNaN$1(v) ? 0 : v;
|
|
5501
|
+
S.keyCode === 38 && (I += 1), S.keyCode === 40 && (I -= 1);
|
|
5502
|
+
const L = `${I}`, P = `${L.startsWith("-") ? "-" : ""}${d}[${L.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5495
5503
|
k(P);
|
|
5496
5504
|
},
|
|
5497
|
-
onKeyUp: (
|
|
5498
|
-
j && (
|
|
5505
|
+
onKeyUp: (S) => {
|
|
5506
|
+
j && (S.preventDefault(), _(!1));
|
|
5499
5507
|
},
|
|
5500
|
-
onBlur: () =>
|
|
5501
|
-
onChange: (
|
|
5502
|
-
x(!1), l(
|
|
5508
|
+
onBlur: () => A(),
|
|
5509
|
+
onChange: (S) => {
|
|
5510
|
+
x(!1), l(S.target.value);
|
|
5503
5511
|
},
|
|
5504
|
-
onClick: (
|
|
5512
|
+
onClick: (S) => {
|
|
5505
5513
|
var v;
|
|
5506
|
-
(v =
|
|
5514
|
+
(v = S == null ? void 0 : S.target) == null || v.select(), r(!1);
|
|
5507
5515
|
},
|
|
5508
|
-
value:
|
|
5516
|
+
value: C ? y : a,
|
|
5509
5517
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5510
5518
|
" ",
|
|
5511
5519
|
f ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -5530,28 +5538,28 @@ const BlockStylingProps = () => {
|
|
|
5530
5538
|
{
|
|
5531
5539
|
units: u,
|
|
5532
5540
|
current: m,
|
|
5533
|
-
onSelect: (
|
|
5534
|
-
r(!1), h(
|
|
5541
|
+
onSelect: (S) => {
|
|
5542
|
+
r(!1), h(S), E(S);
|
|
5535
5543
|
}
|
|
5536
5544
|
}
|
|
5537
5545
|
) })
|
|
5538
5546
|
] })
|
|
5539
5547
|
] }),
|
|
5540
|
-
["none", "auto"].indexOf(m) !== -1 ||
|
|
5548
|
+
["none", "auto"].indexOf(m) !== -1 || C ? null : /* @__PURE__ */ jsx(
|
|
5541
5549
|
DragStyleButton,
|
|
5542
5550
|
{
|
|
5543
5551
|
onDragStart: () => B(!0),
|
|
5544
|
-
onDragEnd: (
|
|
5545
|
-
if (b(() => ""), B(!1), isEmpty(
|
|
5552
|
+
onDragEnd: (S) => {
|
|
5553
|
+
if (b(() => ""), B(!1), isEmpty(S))
|
|
5546
5554
|
return;
|
|
5547
|
-
const v = `${
|
|
5548
|
-
|
|
5555
|
+
const v = `${S}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5556
|
+
w(L);
|
|
5549
5557
|
},
|
|
5550
|
-
onDrag: (
|
|
5551
|
-
if (isEmpty(
|
|
5558
|
+
onDrag: (S) => {
|
|
5559
|
+
if (isEmpty(S))
|
|
5552
5560
|
return;
|
|
5553
|
-
b(
|
|
5554
|
-
const v = `${
|
|
5561
|
+
b(S);
|
|
5562
|
+
const v = `${S}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5555
5563
|
k(L);
|
|
5556
5564
|
},
|
|
5557
5565
|
currentValue: a,
|
|
@@ -6016,14 +6024,14 @@ const COLOR_PROP = {
|
|
|
6016
6024
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6017
6025
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6018
6026
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
|
|
6019
|
-
(k,
|
|
6027
|
+
(k, A = !0) => {
|
|
6020
6028
|
const E = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
|
|
6021
6029
|
(p || u !== "") && (E.mq = "xs");
|
|
6022
|
-
const
|
|
6023
|
-
h(x, [
|
|
6030
|
+
const S = generateFullClsName(E);
|
|
6031
|
+
h(x, [S], A);
|
|
6024
6032
|
},
|
|
6025
6033
|
[x, p, g, u, l, h]
|
|
6026
|
-
),
|
|
6034
|
+
), C = useCallback(() => {
|
|
6027
6035
|
f(x, [y], !0);
|
|
6028
6036
|
}, [x, y, f]), B = useMemo(() => canChangeClass(m, g), [m, g]);
|
|
6029
6037
|
useEffect(() => {
|
|
@@ -6041,9 +6049,9 @@ const COLOR_PROP = {
|
|
|
6041
6049
|
}[k]);
|
|
6042
6050
|
},
|
|
6043
6051
|
[j]
|
|
6044
|
-
),
|
|
6045
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m &&
|
|
6046
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !
|
|
6052
|
+
), w = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
6053
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6054
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !w ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6047
6055
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6048
6056
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
6049
6057
|
r === "arbitrary" ? /* @__PURE__ */ jsx(
|
|
@@ -6062,7 +6070,7 @@ const COLOR_PROP = {
|
|
|
6062
6070
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6063
6071
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6064
6072
|
] }),
|
|
6065
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children:
|
|
6073
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => C(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6066
6074
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6067
6075
|
"button",
|
|
6068
6076
|
{
|
|
@@ -6283,7 +6291,7 @@ const COLOR_PROP = {
|
|
|
6283
6291
|
tooltip: r = !0
|
|
6284
6292
|
}) => {
|
|
6285
6293
|
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
|
|
6286
|
-
u.includes(b) ? u.length > 2 && g(u.filter((
|
|
6294
|
+
u.includes(b) ? u.length > 2 && g(u.filter((C) => C !== b)) : g((C) => [...C, b]);
|
|
6287
6295
|
}, x = (b) => {
|
|
6288
6296
|
n || l(b), c(b);
|
|
6289
6297
|
}, y = getBreakpointValue(n ? i : a).toLowerCase();
|
|
@@ -6437,14 +6445,14 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6437
6445
|
className: "w-fit",
|
|
6438
6446
|
size: "sm",
|
|
6439
6447
|
children: a ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6440
|
-
/* @__PURE__ */ jsx(
|
|
6448
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-5 w-5 animate-spin" }),
|
|
6441
6449
|
n("Generating... Please wait...")
|
|
6442
6450
|
] }) : n("Edit with AI")
|
|
6443
6451
|
}
|
|
6444
6452
|
),
|
|
6445
6453
|
a ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
6446
6454
|
/* @__PURE__ */ jsxs(Skeleton, { className: "flex w-full items-center space-x-1 px-4 py-1 pl-2", children: [
|
|
6447
|
-
/* @__PURE__ */ jsx(
|
|
6455
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4 animate-spin text-gray-500" }),
|
|
6448
6456
|
/* @__PURE__ */ jsx("p", { className: "text-xs", children: n("Generating... Please wait...") })
|
|
6449
6457
|
] }),
|
|
6450
6458
|
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
|
|
@@ -6463,14 +6471,14 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6463
6471
|
};
|
|
6464
6472
|
function ManualClasses() {
|
|
6465
6473
|
var L;
|
|
6466
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")),
|
|
6474
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), C = b.split(" ").filter((T) => !isEmpty(T)), B = () => {
|
|
6467
6475
|
const T = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6468
6476
|
u(m, T, !0), x("");
|
|
6469
|
-
}, [j, _] = useState([]),
|
|
6470
|
-
const P = T.trim().toLowerCase(),
|
|
6477
|
+
}, [j, _] = useState([]), w = ({ value: T }) => {
|
|
6478
|
+
const P = T.trim().toLowerCase(), N = P.match(/.+:/g);
|
|
6471
6479
|
let R = [];
|
|
6472
|
-
if (
|
|
6473
|
-
const [O] =
|
|
6480
|
+
if (N && N.length > 0) {
|
|
6481
|
+
const [O] = N, M = P.replace(O, "");
|
|
6474
6482
|
R = i.search(M).map((D) => ({
|
|
6475
6483
|
...D,
|
|
6476
6484
|
item: { ...D.item, name: O + D.item.name }
|
|
@@ -6480,7 +6488,7 @@ function ManualClasses() {
|
|
|
6480
6488
|
return _(map(R, "item"));
|
|
6481
6489
|
}, k = () => {
|
|
6482
6490
|
_([]);
|
|
6483
|
-
},
|
|
6491
|
+
}, A = (T) => T.name, E = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), S = useMemo(
|
|
6484
6492
|
() => ({
|
|
6485
6493
|
ref: o,
|
|
6486
6494
|
autoComplete: "off",
|
|
@@ -6505,25 +6513,25 @@ function ManualClasses() {
|
|
|
6505
6513
|
debugger;
|
|
6506
6514
|
const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6507
6515
|
g(m, [T]), u(m, P, !0), r(""), l(-1);
|
|
6508
|
-
},
|
|
6516
|
+
}, I = () => {
|
|
6509
6517
|
if (navigator.clipboard === void 0) {
|
|
6510
6518
|
toast.error(c("Clipboard not supported"));
|
|
6511
6519
|
return;
|
|
6512
6520
|
}
|
|
6513
|
-
navigator.clipboard.writeText(
|
|
6521
|
+
navigator.clipboard.writeText(C.join(" ")), toast.success(c("Classes copied to clipboard"));
|
|
6514
6522
|
};
|
|
6515
6523
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
6516
6524
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
6517
6525
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
6518
6526
|
/* @__PURE__ */ jsx("span", { children: c("Classes") }),
|
|
6519
6527
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6520
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick:
|
|
6528
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: I, className: "cursor-pointer" }) }),
|
|
6521
6529
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
|
|
6522
6530
|
] })
|
|
6523
6531
|
] }),
|
|
6524
6532
|
h ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
6525
6533
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
|
|
6526
|
-
/* @__PURE__ */ jsx(
|
|
6534
|
+
/* @__PURE__ */ jsx(MagicWandIcon, { className: "h-4 w-4" }),
|
|
6527
6535
|
/* @__PURE__ */ jsx("span", { className: "ml-2", children: c("Ask AI") })
|
|
6528
6536
|
] }) }),
|
|
6529
6537
|
/* @__PURE__ */ jsx(PopoverContent, { side: "left", className: "p-2", children: /* @__PURE__ */ jsx(AskAIStyles, { blockId: p == null ? void 0 : p._id }) })
|
|
@@ -6534,11 +6542,11 @@ function ManualClasses() {
|
|
|
6534
6542
|
Autosuggest,
|
|
6535
6543
|
{
|
|
6536
6544
|
suggestions: j,
|
|
6537
|
-
onSuggestionsFetchRequested:
|
|
6545
|
+
onSuggestionsFetchRequested: w,
|
|
6538
6546
|
onSuggestionsClearRequested: k,
|
|
6539
|
-
getSuggestionValue:
|
|
6547
|
+
getSuggestionValue: A,
|
|
6540
6548
|
renderSuggestion: E,
|
|
6541
|
-
inputProps:
|
|
6549
|
+
inputProps: S,
|
|
6542
6550
|
containerProps: {
|
|
6543
6551
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
6544
6552
|
},
|
|
@@ -6561,22 +6569,22 @@ function ManualClasses() {
|
|
|
6561
6569
|
}
|
|
6562
6570
|
)
|
|
6563
6571
|
] }),
|
|
6564
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children:
|
|
6572
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: C.map(
|
|
6565
6573
|
(T, P) => a === P ? /* @__PURE__ */ jsx(
|
|
6566
6574
|
"input",
|
|
6567
6575
|
{
|
|
6568
6576
|
ref: o,
|
|
6569
6577
|
value: n,
|
|
6570
|
-
onChange: (
|
|
6578
|
+
onChange: (N) => r(N.target.value),
|
|
6571
6579
|
onBlur: () => {
|
|
6572
6580
|
v(T);
|
|
6573
6581
|
},
|
|
6574
|
-
onKeyDown: (
|
|
6575
|
-
|
|
6582
|
+
onKeyDown: (N) => {
|
|
6583
|
+
N.key === "Enter" && v(T);
|
|
6576
6584
|
},
|
|
6577
|
-
onFocus: (
|
|
6585
|
+
onFocus: (N) => {
|
|
6578
6586
|
setTimeout(() => {
|
|
6579
|
-
|
|
6587
|
+
N.target.select();
|
|
6580
6588
|
}, 0);
|
|
6581
6589
|
},
|
|
6582
6590
|
className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
|
|
@@ -6942,15 +6950,15 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6942
6950
|
const j = await c({ library: n, block: o });
|
|
6943
6951
|
let _ = r;
|
|
6944
6952
|
if (y(first(j)) && (_ = null), !isEmpty(j)) {
|
|
6945
|
-
const
|
|
6946
|
-
if (B.dataTransfer.setData("text/plain", JSON.stringify(
|
|
6953
|
+
const w = { blocks: j, uiLibrary: !0, parent: _ };
|
|
6954
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
6947
6955
|
const k = new Image();
|
|
6948
6956
|
k.src = o.preview, k.onload = () => {
|
|
6949
6957
|
B.dataTransfer.setDragImage(k, 0, 0);
|
|
6950
6958
|
};
|
|
6951
6959
|
} else
|
|
6952
6960
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6953
|
-
x(
|
|
6961
|
+
x(w), setTimeout(() => {
|
|
6954
6962
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6955
6963
|
}, 200);
|
|
6956
6964
|
}
|
|
@@ -6960,7 +6968,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6960
6968
|
),
|
|
6961
6969
|
children: [
|
|
6962
6970
|
l && /* @__PURE__ */ jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
|
|
6963
|
-
/* @__PURE__ */ jsx(
|
|
6971
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "animate-spin h-4 w-4 text-white" }),
|
|
6964
6972
|
/* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
6965
6973
|
] }),
|
|
6966
6974
|
o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxs("div", { className: "flex h-fit w-full flex-col items-center justify-center gap-1 rounded-md border border-border p-6 py-10 text-center", children: [
|
|
@@ -6988,27 +6996,27 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6988
6996
|
h([]);
|
|
6989
6997
|
return;
|
|
6990
6998
|
}
|
|
6991
|
-
const v = f.current.search(u).map((
|
|
6999
|
+
const v = f.current.search(u).map((I) => I.item);
|
|
6992
7000
|
h(v);
|
|
6993
7001
|
}, [u]);
|
|
6994
|
-
const x = u.trim() && !isEmpty(m) ? m : c, y = groupBy(x, "group"), [b,
|
|
7002
|
+
const x = u.trim() && !isEmpty(m) ? m : c, y = groupBy(x, "group"), [b, C] = useState(null);
|
|
6995
7003
|
useEffect(() => {
|
|
6996
7004
|
if (isEmpty(keys(y))) {
|
|
6997
|
-
|
|
7005
|
+
C(null);
|
|
6998
7006
|
return;
|
|
6999
7007
|
}
|
|
7000
7008
|
if (!b || !y[b]) {
|
|
7001
|
-
|
|
7009
|
+
C(first(keys(y)));
|
|
7002
7010
|
return;
|
|
7003
7011
|
}
|
|
7004
7012
|
}, [y, b]);
|
|
7005
|
-
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(),
|
|
7013
|
+
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(), w = (v) => {
|
|
7006
7014
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7007
|
-
j.current &&
|
|
7015
|
+
j.current && C(v);
|
|
7008
7016
|
}, 400);
|
|
7009
7017
|
}, k = () => {
|
|
7010
7018
|
i != null && i.id && p(i.id);
|
|
7011
|
-
},
|
|
7019
|
+
}, A = () => {
|
|
7012
7020
|
g("");
|
|
7013
7021
|
};
|
|
7014
7022
|
if (d)
|
|
@@ -7016,10 +7024,10 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7016
7024
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7017
7025
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7018
7026
|
] });
|
|
7019
|
-
const E = filter(B, (v,
|
|
7027
|
+
const E = filter(B, (v, I) => I % 2 === 0), S = filter(B, (v, I) => I % 2 === 1);
|
|
7020
7028
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7021
7029
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7022
|
-
/* @__PURE__ */ jsx(
|
|
7030
|
+
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
7023
7031
|
/* @__PURE__ */ jsx(
|
|
7024
7032
|
Input$1,
|
|
7025
7033
|
{
|
|
@@ -7032,9 +7040,9 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7032
7040
|
u && /* @__PURE__ */ jsx(
|
|
7033
7041
|
"button",
|
|
7034
7042
|
{
|
|
7035
|
-
onClick:
|
|
7043
|
+
onClick: A,
|
|
7036
7044
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7037
|
-
children: /* @__PURE__ */ jsx(
|
|
7045
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
7038
7046
|
}
|
|
7039
7047
|
)
|
|
7040
7048
|
] }) }),
|
|
@@ -7047,26 +7055,26 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7047
7055
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7048
7056
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: _("Failed to load the UI library. Try again") }),
|
|
7049
7057
|
/* @__PURE__ */ jsxs(Button, { onClick: k, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7050
|
-
/* @__PURE__ */ jsx(
|
|
7058
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
7051
7059
|
_("Retry")
|
|
7052
7060
|
] })
|
|
7053
|
-
] }) }) : map(y, (v,
|
|
7061
|
+
] }) }) : map(y, (v, I) => /* @__PURE__ */ jsxs(
|
|
7054
7062
|
"div",
|
|
7055
7063
|
{
|
|
7056
|
-
onMouseEnter: () =>
|
|
7064
|
+
onMouseEnter: () => w(I),
|
|
7057
7065
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7058
7066
|
role: "button",
|
|
7059
|
-
onClick: () =>
|
|
7067
|
+
onClick: () => C(I),
|
|
7060
7068
|
className: cn$2(
|
|
7061
7069
|
"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",
|
|
7062
|
-
|
|
7070
|
+
I === b ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
|
|
7063
7071
|
),
|
|
7064
7072
|
children: [
|
|
7065
|
-
/* @__PURE__ */ jsx("span", { children: capitalize(_(
|
|
7073
|
+
/* @__PURE__ */ jsx("span", { children: capitalize(_(I.toLowerCase())) }),
|
|
7066
7074
|
/* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7067
7075
|
]
|
|
7068
7076
|
},
|
|
7069
|
-
|
|
7077
|
+
I
|
|
7070
7078
|
)) })
|
|
7071
7079
|
] })
|
|
7072
7080
|
] }),
|
|
@@ -7077,7 +7085,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7077
7085
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7078
7086
|
children: [
|
|
7079
7087
|
isEmpty(B) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7080
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((v,
|
|
7088
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((v, I) => /* @__PURE__ */ jsx(
|
|
7081
7089
|
BlockCard,
|
|
7082
7090
|
{
|
|
7083
7091
|
parentId: o,
|
|
@@ -7085,9 +7093,9 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7085
7093
|
block: v,
|
|
7086
7094
|
library: i
|
|
7087
7095
|
},
|
|
7088
|
-
`block-${
|
|
7096
|
+
`block-${I}`
|
|
7089
7097
|
)) }),
|
|
7090
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7098
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: S.map((v, I) => /* @__PURE__ */ jsx(
|
|
7091
7099
|
BlockCard,
|
|
7092
7100
|
{
|
|
7093
7101
|
parentId: o,
|
|
@@ -7095,7 +7103,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7095
7103
|
block: v,
|
|
7096
7104
|
library: i
|
|
7097
7105
|
},
|
|
7098
|
-
`block-second-${
|
|
7106
|
+
`block-second-${I}`
|
|
7099
7107
|
)) })
|
|
7100
7108
|
] }),
|
|
7101
7109
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -7132,13 +7140,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7132
7140
|
}), g(!0);
|
|
7133
7141
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7134
7142
|
const h = Object.entries(a).map(([x, y]) => {
|
|
7135
|
-
const b = y,
|
|
7143
|
+
const b = y, C = b.type || "partial", B = formatReadableName(C);
|
|
7136
7144
|
return {
|
|
7137
7145
|
type: "PartialBlock",
|
|
7138
7146
|
// Set the type to PartialBlock
|
|
7139
7147
|
label: formatReadableName(b.name || x),
|
|
7140
7148
|
description: b.description || "",
|
|
7141
|
-
icon:
|
|
7149
|
+
icon: GlobeIcon,
|
|
7142
7150
|
group: B,
|
|
7143
7151
|
// Use formatted type as group
|
|
7144
7152
|
category: "partial",
|
|
@@ -7194,12 +7202,12 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7194
7202
|
}, ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (o, n) => {
|
|
7195
7203
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7196
7204
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7197
|
-
var
|
|
7198
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (
|
|
7205
|
+
var S;
|
|
7206
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (v) => v._id === r)) == null ? void 0 : S._type, [h, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
|
|
7199
7207
|
useEffect(() => {
|
|
7200
7208
|
const v = setTimeout(() => {
|
|
7201
|
-
var
|
|
7202
|
-
(
|
|
7209
|
+
var I;
|
|
7210
|
+
(I = u.current) == null || I.focus();
|
|
7203
7211
|
}, 0);
|
|
7204
7212
|
return () => clearTimeout(v);
|
|
7205
7213
|
}, [g]), useEffect(() => {
|
|
@@ -7209,7 +7217,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7209
7217
|
}, 500), () => {
|
|
7210
7218
|
b.current && b.current.cancel();
|
|
7211
7219
|
}), []);
|
|
7212
|
-
const
|
|
7220
|
+
const C = useCallback((v) => {
|
|
7213
7221
|
y(v), b.current && b.current(v);
|
|
7214
7222
|
}, []), B = useCallback(() => {
|
|
7215
7223
|
y(null), b.current && b.current.cancel();
|
|
@@ -7218,20 +7226,20 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7218
7226
|
}, []), _ = useMemo(
|
|
7219
7227
|
() => d ? values(n).filter(
|
|
7220
7228
|
(v) => {
|
|
7221
|
-
var
|
|
7222
|
-
return (((
|
|
7229
|
+
var I, L;
|
|
7230
|
+
return (((I = v.label) == null ? void 0 : I.toLowerCase()) + " " + ((L = v.type) == null ? void 0 : L.toLowerCase())).includes(d.toLowerCase());
|
|
7223
7231
|
}
|
|
7224
7232
|
) : n,
|
|
7225
7233
|
[n, d]
|
|
7226
|
-
),
|
|
7234
|
+
), w = useMemo(
|
|
7227
7235
|
() => d ? o.filter(
|
|
7228
7236
|
(v) => reject(filter(values(_), { group: v }), { hidden: !0 }).length > 0
|
|
7229
7237
|
) : o.filter((v) => reject(filter(values(n), { group: v }), { hidden: !0 }).length > 0),
|
|
7230
7238
|
[n, _, o, d]
|
|
7231
7239
|
), k = useMemo(
|
|
7232
|
-
() => sortBy(
|
|
7233
|
-
[
|
|
7234
|
-
),
|
|
7240
|
+
() => sortBy(w, (v) => CORE_GROUPS.indexOf(v) === -1 ? 99 : CORE_GROUPS.indexOf(v)),
|
|
7241
|
+
[w]
|
|
7242
|
+
), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), E = useMemo(() => h === "all" ? k : [h], [k, h]);
|
|
7235
7243
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7236
7244
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7237
7245
|
Input$1,
|
|
@@ -7250,7 +7258,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7250
7258
|
"button",
|
|
7251
7259
|
{
|
|
7252
7260
|
onClick: () => j("all"),
|
|
7253
|
-
onMouseEnter: () =>
|
|
7261
|
+
onMouseEnter: () => C("all"),
|
|
7254
7262
|
onMouseLeave: B,
|
|
7255
7263
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7256
7264
|
children: i("All")
|
|
@@ -7261,7 +7269,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7261
7269
|
"button",
|
|
7262
7270
|
{
|
|
7263
7271
|
onClick: () => j(v),
|
|
7264
|
-
onMouseEnter: () =>
|
|
7272
|
+
onMouseEnter: () => C(v),
|
|
7265
7273
|
onMouseLeave: B,
|
|
7266
7274
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === v || x === v ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7267
7275
|
children: capitalize(i(v.toLowerCase()))
|
|
@@ -7269,7 +7277,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7269
7277
|
`sidebar-${v}`
|
|
7270
7278
|
))
|
|
7271
7279
|
] }) }) }),
|
|
7272
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children:
|
|
7280
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: w.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
7273
7281
|
i("No blocks found matching"),
|
|
7274
7282
|
' "',
|
|
7275
7283
|
d,
|
|
@@ -7277,17 +7285,17 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7277
7285
|
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((v) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7278
7286
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(v.toLowerCase())) }),
|
|
7279
7287
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7280
|
-
h === "all" ? filter(values(
|
|
7288
|
+
h === "all" ? filter(values(A), { group: v }) : values(A),
|
|
7281
7289
|
{ hidden: !0 }
|
|
7282
|
-
).map((
|
|
7290
|
+
).map((I) => /* @__PURE__ */ jsx(
|
|
7283
7291
|
CoreBlock,
|
|
7284
7292
|
{
|
|
7285
7293
|
parentId: r,
|
|
7286
7294
|
position: a,
|
|
7287
|
-
block:
|
|
7288
|
-
disabled: !canAcceptChildBlock(m,
|
|
7295
|
+
block: I,
|
|
7296
|
+
disabled: !canAcceptChildBlock(m, I.type) || !canBeNestedInside(m, I.type)
|
|
7289
7297
|
},
|
|
7290
|
-
|
|
7298
|
+
I.type
|
|
7291
7299
|
)) })
|
|
7292
7300
|
] }, v)) }) }) })
|
|
7293
7301
|
] })
|
|
@@ -7315,8 +7323,8 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7315
7323
|
/* @__PURE__ */ jsxs(
|
|
7316
7324
|
Tabs,
|
|
7317
7325
|
{
|
|
7318
|
-
onValueChange: (
|
|
7319
|
-
d(""), c(
|
|
7326
|
+
onValueChange: (C) => {
|
|
7327
|
+
d(""), c(C);
|
|
7320
7328
|
},
|
|
7321
7329
|
value: i,
|
|
7322
7330
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
@@ -7326,13 +7334,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7326
7334
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7327
7335
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7328
7336
|
x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7329
|
-
map(f, (
|
|
7337
|
+
map(f, (C) => /* @__PURE__ */ jsx(TabsTrigger, { value: C.id, children: React__default.createElement(C.tab) }, `tab-add-block-${C.id}`))
|
|
7330
7338
|
] }),
|
|
7331
7339
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7332
7340
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
7333
7341
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7334
7342
|
x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
7335
|
-
map(f, (
|
|
7343
|
+
map(f, (C) => /* @__PURE__ */ jsx(TabsContent, { value: C.id, children: React__default.createElement(C.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${C.id}`))
|
|
7336
7344
|
]
|
|
7337
7345
|
}
|
|
7338
7346
|
)
|
|
@@ -7436,7 +7444,7 @@ const registerChaiSaveToLibrary = (o) => {
|
|
|
7436
7444
|
});
|
|
7437
7445
|
};
|
|
7438
7446
|
return a ? /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "flex items-center gap-x-4 text-xs", onClick: l, children: [
|
|
7439
|
-
/* @__PURE__ */ jsx(
|
|
7447
|
+
/* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }),
|
|
7440
7448
|
" ",
|
|
7441
7449
|
n(o != null && o._libBlockId ? "Update library block" : "Save to library")
|
|
7442
7450
|
] }) : null;
|
|
@@ -7447,7 +7455,7 @@ const registerChaiSaveToLibrary = (o) => {
|
|
|
7447
7455
|
_libBlockId: null
|
|
7448
7456
|
});
|
|
7449
7457
|
}, className: "flex items-center gap-x-4 text-xs", children: [
|
|
7450
|
-
/* @__PURE__ */ jsx(
|
|
7458
|
+
/* @__PURE__ */ jsx(LinkBreak2Icon, { className: "h-4 w-4" }),
|
|
7451
7459
|
" ",
|
|
7452
7460
|
o("Unlink from library")
|
|
7453
7461
|
] });
|
|
@@ -7540,7 +7548,7 @@ const registerChaiSaveToLibrary = (o) => {
|
|
|
7540
7548
|
},
|
|
7541
7549
|
className: "flex items-center gap-x-4 text-xs",
|
|
7542
7550
|
children: [
|
|
7543
|
-
/* @__PURE__ */ jsx(
|
|
7551
|
+
/* @__PURE__ */ jsx(Pencil2Icon, { className: "h-4 w-4" }),
|
|
7544
7552
|
" ",
|
|
7545
7553
|
n("Rename")
|
|
7546
7554
|
]
|
|
@@ -7559,7 +7567,7 @@ const registerChaiSaveToLibrary = (o) => {
|
|
|
7559
7567
|
className: "flex items-center gap-x-4 text-xs",
|
|
7560
7568
|
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, l),
|
|
7561
7569
|
children: [
|
|
7562
|
-
/* @__PURE__ */ jsx(PlusIcon
|
|
7570
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "h-3.5 w-3.5" }),
|
|
7563
7571
|
" ",
|
|
7564
7572
|
n("Add block")
|
|
7565
7573
|
]
|
|
@@ -7642,35 +7650,35 @@ const Input = ({ node: o }) => {
|
|
|
7642
7650
|
var P;
|
|
7643
7651
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7644
7652
|
let p = null;
|
|
7645
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing:
|
|
7646
|
-
|
|
7647
|
-
}, _ = (
|
|
7648
|
-
|
|
7649
|
-
},
|
|
7650
|
-
|
|
7651
|
-
}, [k,
|
|
7652
|
-
var
|
|
7653
|
-
|
|
7654
|
-
},
|
|
7655
|
-
|
|
7656
|
-
}, v = (
|
|
7657
|
-
|
|
7653
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: C, handleClick: B } = o, j = (N) => {
|
|
7654
|
+
N.stopPropagation(), !l.includes(h) && o.toggle();
|
|
7655
|
+
}, _ = (N) => {
|
|
7656
|
+
N.isInternal && (p = N.isOpen, N.isOpen && N.close());
|
|
7657
|
+
}, w = (N) => {
|
|
7658
|
+
N.isInternal && p !== null && (p ? N.open() : N.close(), p = null);
|
|
7659
|
+
}, [k, A] = useAtom$1(currentAddSelection), E = () => {
|
|
7660
|
+
var N;
|
|
7661
|
+
S(), o.parent.isSelected || A((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
|
|
7662
|
+
}, S = () => {
|
|
7663
|
+
A(null);
|
|
7664
|
+
}, v = (N) => {
|
|
7665
|
+
S(), N.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(N);
|
|
7658
7666
|
};
|
|
7659
7667
|
useEffect(() => {
|
|
7660
|
-
const
|
|
7668
|
+
const N = setTimeout(() => {
|
|
7661
7669
|
y && !o.isOpen && !b && !l.includes(h) && o.toggle();
|
|
7662
7670
|
}, 500);
|
|
7663
|
-
return () => clearTimeout(
|
|
7671
|
+
return () => clearTimeout(N);
|
|
7664
7672
|
}, [y, o, b]);
|
|
7665
|
-
const
|
|
7666
|
-
const O = c.contentDocument || c.contentWindow.document, M = O.querySelector(`[data-block-id=${
|
|
7673
|
+
const I = (N, R) => {
|
|
7674
|
+
const O = c.contentDocument || c.contentWindow.document, M = O.querySelector(`[data-block-id=${N}]`);
|
|
7667
7675
|
M && M.setAttribute("data-drop", R);
|
|
7668
7676
|
const $ = M.getBoundingClientRect(), D = c.getBoundingClientRect();
|
|
7669
7677
|
$.top >= D.top && $.left >= D.left && $.bottom <= D.bottom && $.right <= D.right || (O.documentElement.scrollTop = M.offsetTop - D.top);
|
|
7670
|
-
}, L = (
|
|
7671
|
-
|
|
7678
|
+
}, L = (N) => {
|
|
7679
|
+
S();
|
|
7672
7680
|
const R = get(o, "parent.id");
|
|
7673
|
-
R !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: R, position:
|
|
7681
|
+
R !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: R, position: N }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: N });
|
|
7674
7682
|
};
|
|
7675
7683
|
if (h === ROOT_TEMP_KEY)
|
|
7676
7684
|
return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
|
|
@@ -7701,25 +7709,25 @@ const Input = ({ node: o }) => {
|
|
|
7701
7709
|
"data-node-id": h,
|
|
7702
7710
|
ref: l.includes(h) ? null : r,
|
|
7703
7711
|
onDragStart: () => _(o),
|
|
7704
|
-
onDragEnd: () =>
|
|
7705
|
-
onDragOver: (
|
|
7706
|
-
|
|
7712
|
+
onDragEnd: () => w(o),
|
|
7713
|
+
onDragOver: (N) => {
|
|
7714
|
+
N.preventDefault(), I(h, "yes");
|
|
7707
7715
|
},
|
|
7708
|
-
onDragLeave: (
|
|
7709
|
-
|
|
7716
|
+
onDragLeave: (N) => {
|
|
7717
|
+
N.preventDefault(), I(h, "no");
|
|
7710
7718
|
},
|
|
7711
|
-
onDrop: (
|
|
7712
|
-
|
|
7719
|
+
onDrop: (N) => {
|
|
7720
|
+
N.preventDefault(), I(h, "no");
|
|
7713
7721
|
},
|
|
7714
7722
|
children: [
|
|
7715
7723
|
d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((P = o == null ? void 0 : o.parent) == null ? void 0 : P.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
7716
7724
|
"div",
|
|
7717
7725
|
{
|
|
7718
|
-
onClick: (
|
|
7719
|
-
|
|
7726
|
+
onClick: (N) => {
|
|
7727
|
+
N.stopPropagation(), L(o.childIndex);
|
|
7720
7728
|
},
|
|
7721
7729
|
onMouseEnter: E,
|
|
7722
|
-
onMouseLeave:
|
|
7730
|
+
onMouseLeave: S,
|
|
7723
7731
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-primary opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
7724
7732
|
children: /* @__PURE__ */ 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-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[4] text-white" }) })
|
|
7725
7733
|
}
|
|
@@ -7742,7 +7750,7 @@ const Input = ({ node: o }) => {
|
|
|
7742
7750
|
"div",
|
|
7743
7751
|
{
|
|
7744
7752
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
7745
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ jsx(
|
|
7753
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: `h-3 w-3 ${x ? "text-white" : "text-slate-400"}` }) })
|
|
7746
7754
|
}
|
|
7747
7755
|
),
|
|
7748
7756
|
/* @__PURE__ */ jsxs(
|
|
@@ -7755,12 +7763,12 @@ const Input = ({ node: o }) => {
|
|
|
7755
7763
|
),
|
|
7756
7764
|
children: [
|
|
7757
7765
|
/* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
|
|
7758
|
-
|
|
7766
|
+
C ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
|
|
7759
7767
|
"div",
|
|
7760
7768
|
{
|
|
7761
7769
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
7762
|
-
onDoubleClick: (
|
|
7763
|
-
|
|
7770
|
+
onDoubleClick: (N) => {
|
|
7771
|
+
N.stopPropagation(), o.edit(), o.deselect();
|
|
7764
7772
|
},
|
|
7765
7773
|
children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(f) })
|
|
7766
7774
|
}
|
|
@@ -7786,17 +7794,17 @@ const Input = ({ node: o }) => {
|
|
|
7786
7794
|
/* @__PURE__ */ jsx(
|
|
7787
7795
|
TooltipTrigger,
|
|
7788
7796
|
{
|
|
7789
|
-
onClick: (
|
|
7790
|
-
|
|
7797
|
+
onClick: (N) => {
|
|
7798
|
+
N.stopPropagation(), i(h), o.isOpen && o.toggle();
|
|
7791
7799
|
},
|
|
7792
7800
|
className: "cursor-pointer rounded bg-transparent",
|
|
7793
7801
|
asChild: !0,
|
|
7794
|
-
children: /* @__PURE__ */ jsx(
|
|
7802
|
+
children: /* @__PURE__ */ jsx(EyeNoneIcon, { className: "h-4 w-4" })
|
|
7795
7803
|
}
|
|
7796
7804
|
),
|
|
7797
7805
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Hide block") })
|
|
7798
7806
|
] }),
|
|
7799
|
-
/* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: h, children: /* @__PURE__ */ jsx(
|
|
7807
|
+
/* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: h, children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-4 w-4" }) })
|
|
7800
7808
|
] })
|
|
7801
7809
|
]
|
|
7802
7810
|
}
|
|
@@ -7947,7 +7955,7 @@ const Input = ({ node: o }) => {
|
|
|
7947
7955
|
variant: "outline",
|
|
7948
7956
|
className: "h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
7949
7957
|
size: "sm",
|
|
7950
|
-
children: /* @__PURE__ */ jsx(
|
|
7958
|
+
children: /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-4 w-4" })
|
|
7951
7959
|
}
|
|
7952
7960
|
) }),
|
|
7953
7961
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Show hidden blocks") })
|
|
@@ -7956,14 +7964,14 @@ const Input = ({ node: o }) => {
|
|
|
7956
7964
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
7957
7965
|
var o;
|
|
7958
7966
|
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
|
|
7959
|
-
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(
|
|
7967
|
+
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(DoubleArrowDownIcon, { className: "h-3.5 w-3.5" }) }) }),
|
|
7960
7968
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
|
|
7961
7969
|
] }),
|
|
7962
7970
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
7963
7971
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
|
|
7964
7972
|
var o;
|
|
7965
7973
|
return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
|
|
7966
|
-
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(
|
|
7974
|
+
}, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(DoubleArrowUpIcon, { className: "h-3.5 w-3.5" }) }) }),
|
|
7967
7975
|
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
|
|
7968
7976
|
] })
|
|
7969
7977
|
] }),
|
|
@@ -7972,7 +7980,7 @@ const Input = ({ node: o }) => {
|
|
|
7972
7980
|
{
|
|
7973
7981
|
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: 0 }),
|
|
7974
7982
|
className: "h-1 w-[90%] rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
7975
|
-
children: /* @__PURE__ */ 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-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon
|
|
7983
|
+
children: /* @__PURE__ */ 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-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[3] text-white" }) })
|
|
7976
7984
|
}
|
|
7977
7985
|
) }),
|
|
7978
7986
|
/* @__PURE__ */ jsx(
|
|
@@ -8202,7 +8210,7 @@ const Input = ({ node: o }) => {
|
|
|
8202
8210
|
"popover-foreground": ["#3d3436", "#f2e9e4"]
|
|
8203
8211
|
}
|
|
8204
8212
|
}, LazyCssImportModal = lazy(
|
|
8205
|
-
() => import("./css-import-modal-
|
|
8213
|
+
() => import("./css-import-modal-CgSqJi_w.js").then((o) => ({ default: o.CssImportModal }))
|
|
8206
8214
|
), PREV_THEME_KEY = "chai-builder-previous-theme", DEFAULT_THEME_PRESET = [
|
|
8207
8215
|
{ shadcn_default: defaultShadcnPreset },
|
|
8208
8216
|
{ twitter_theme: twitter },
|
|
@@ -8226,19 +8234,19 @@ const Input = ({ node: o }) => {
|
|
|
8226
8234
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8227
8235
|
const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8228
8236
|
if (d) {
|
|
8229
|
-
const
|
|
8237
|
+
const w = d.map((k) => Object.keys(k)[0]);
|
|
8230
8238
|
DEFAULT_THEME_PRESET.forEach((k) => {
|
|
8231
|
-
const
|
|
8232
|
-
|
|
8239
|
+
const A = Object.keys(k)[0];
|
|
8240
|
+
w.includes(A) || d.push(k);
|
|
8233
8241
|
});
|
|
8234
8242
|
}
|
|
8235
8243
|
const [g, m] = useTheme(), h = useThemeOptions(), { t: f } = useTranslation(), x = React.useCallback(
|
|
8236
|
-
(
|
|
8244
|
+
(w) => {
|
|
8237
8245
|
const k = { ...g };
|
|
8238
|
-
setPreviousTheme(k), m(
|
|
8246
|
+
setPreviousTheme(k), m(w), toast.success("Theme updated", {
|
|
8239
8247
|
action: {
|
|
8240
8248
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8241
|
-
/* @__PURE__ */ jsx(
|
|
8249
|
+
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
8242
8250
|
" Undo"
|
|
8243
8251
|
] }),
|
|
8244
8252
|
onClick: () => {
|
|
@@ -8251,56 +8259,56 @@ const Input = ({ node: o }) => {
|
|
|
8251
8259
|
},
|
|
8252
8260
|
[g, m]
|
|
8253
8261
|
), y = () => {
|
|
8254
|
-
const
|
|
8255
|
-
if (
|
|
8256
|
-
const k = Object.values(
|
|
8262
|
+
const w = d.find((k) => Object.keys(k)[0] === a);
|
|
8263
|
+
if (w) {
|
|
8264
|
+
const k = Object.values(w)[0];
|
|
8257
8265
|
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (x(k), l("")) : console.error("Invalid preset structure:", k);
|
|
8258
8266
|
} else
|
|
8259
8267
|
console.error("Preset not found:", a);
|
|
8260
|
-
}, b = (
|
|
8261
|
-
x(
|
|
8262
|
-
},
|
|
8263
|
-
(
|
|
8268
|
+
}, b = (w) => {
|
|
8269
|
+
x(w), l("");
|
|
8270
|
+
}, C = useDebouncedCallback(
|
|
8271
|
+
(w, k) => {
|
|
8264
8272
|
m(() => ({
|
|
8265
8273
|
...g,
|
|
8266
8274
|
fontFamily: {
|
|
8267
8275
|
...g.fontFamily,
|
|
8268
|
-
[
|
|
8276
|
+
[w.replace(/font-/g, "")]: k
|
|
8269
8277
|
}
|
|
8270
8278
|
}));
|
|
8271
8279
|
},
|
|
8272
8280
|
[g],
|
|
8273
8281
|
200
|
|
8274
8282
|
), B = React.useCallback(
|
|
8275
|
-
(
|
|
8283
|
+
(w) => {
|
|
8276
8284
|
m(() => ({
|
|
8277
8285
|
...g,
|
|
8278
|
-
borderRadius: `${
|
|
8286
|
+
borderRadius: `${w}px`
|
|
8279
8287
|
}));
|
|
8280
8288
|
},
|
|
8281
8289
|
[g]
|
|
8282
8290
|
), j = useDebouncedCallback(
|
|
8283
|
-
(
|
|
8291
|
+
(w, k) => {
|
|
8284
8292
|
m(() => {
|
|
8285
|
-
const
|
|
8286
|
-
return n ? set(
|
|
8293
|
+
const A = get(g, `colors.${w}`);
|
|
8294
|
+
return n ? set(A, 1, k) : set(A, 0, k), {
|
|
8287
8295
|
...g,
|
|
8288
8296
|
colors: {
|
|
8289
8297
|
...g.colors,
|
|
8290
|
-
[
|
|
8298
|
+
[w]: A
|
|
8291
8299
|
}
|
|
8292
8300
|
};
|
|
8293
8301
|
});
|
|
8294
8302
|
},
|
|
8295
8303
|
[g],
|
|
8296
8304
|
200
|
|
8297
|
-
), _ = (
|
|
8298
|
-
const
|
|
8299
|
-
return
|
|
8305
|
+
), _ = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([k]) => {
|
|
8306
|
+
const A = get(g, `colors.${k}.${n ? 1 : 0}`);
|
|
8307
|
+
return A ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8300
8308
|
/* @__PURE__ */ jsx(
|
|
8301
8309
|
ColorPickerInput,
|
|
8302
8310
|
{
|
|
8303
|
-
value:
|
|
8311
|
+
value: A,
|
|
8304
8312
|
onChange: (E) => j(k, E)
|
|
8305
8313
|
}
|
|
8306
8314
|
),
|
|
@@ -8313,16 +8321,16 @@ const Input = ({ node: o }) => {
|
|
|
8313
8321
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
8314
8322
|
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: f("Presets") }),
|
|
8315
8323
|
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs(Button, { className: "px-1", variant: "link", size: "sm", onClick: () => c(!0), children: [
|
|
8316
|
-
/* @__PURE__ */ jsx(
|
|
8324
|
+
/* @__PURE__ */ jsx(UploadIcon, { className: "h-4 w-4" }),
|
|
8317
8325
|
f("Import theme")
|
|
8318
8326
|
] }) })
|
|
8319
8327
|
] }),
|
|
8320
8328
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8321
8329
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8322
8330
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8323
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
8324
|
-
const k = Object.keys(
|
|
8325
|
-
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(
|
|
8331
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
|
|
8332
|
+
const k = Object.keys(w)[0], A = k.replaceAll("_", " ");
|
|
8333
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(A) }, k);
|
|
8326
8334
|
}) })
|
|
8327
8335
|
] }) }),
|
|
8328
8336
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: f("Apply") }) })
|
|
@@ -8331,23 +8339,23 @@ const Input = ({ node: o }) => {
|
|
|
8331
8339
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8332
8340
|
/* @__PURE__ */ jsxs("div", { className: cn$2("my-2 space-y-3", o), children: [
|
|
8333
8341
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8334
|
-
/* @__PURE__ */ jsx(
|
|
8342
|
+
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8335
8343
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8336
8344
|
] }),
|
|
8337
|
-
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([
|
|
8345
|
+
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([w, k]) => /* @__PURE__ */ jsx(
|
|
8338
8346
|
FontSelector,
|
|
8339
8347
|
{
|
|
8340
|
-
label:
|
|
8341
|
-
value: g.fontFamily[
|
|
8342
|
-
onChange: (
|
|
8348
|
+
label: w,
|
|
8349
|
+
value: g.fontFamily[w.replace(/font-/g, "")] || k[Object.keys(k)[0]],
|
|
8350
|
+
onChange: (A) => C(w, A)
|
|
8343
8351
|
},
|
|
8344
|
-
|
|
8352
|
+
w
|
|
8345
8353
|
)) }),
|
|
8346
8354
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8347
8355
|
(h == null ? void 0 : h.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
8348
8356
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8349
8357
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8350
|
-
/* @__PURE__ */ jsx(
|
|
8358
|
+
/* @__PURE__ */ jsx(CornerTopRightIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8351
8359
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Border Radius" })
|
|
8352
8360
|
] }),
|
|
8353
8361
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
@@ -8358,24 +8366,24 @@ const Input = ({ node: o }) => {
|
|
|
8358
8366
|
(h == null ? void 0 : h.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
8359
8367
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8360
8368
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8361
|
-
/* @__PURE__ */ jsx(
|
|
8369
|
+
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8362
8370
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Colors" })
|
|
8363
8371
|
] }),
|
|
8364
8372
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8365
|
-
/* @__PURE__ */ jsx(
|
|
8373
|
+
/* @__PURE__ */ jsx(SunIcon, { className: "h-4 w-4" }),
|
|
8366
8374
|
/* @__PURE__ */ jsx(
|
|
8367
8375
|
Switch,
|
|
8368
8376
|
{
|
|
8369
8377
|
checked: n,
|
|
8370
|
-
onCheckedChange: (
|
|
8378
|
+
onCheckedChange: (w) => r(w),
|
|
8371
8379
|
"aria-label": "Toggle dark mode",
|
|
8372
8380
|
className: "mx-1"
|
|
8373
8381
|
}
|
|
8374
8382
|
),
|
|
8375
|
-
/* @__PURE__ */ jsx(
|
|
8383
|
+
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
8376
8384
|
] }) })
|
|
8377
8385
|
] }),
|
|
8378
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((
|
|
8386
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((w) => _(w)) })
|
|
8379
8387
|
] }),
|
|
8380
8388
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8381
8389
|
LazyCssImportModal,
|
|
@@ -8799,12 +8807,12 @@ const CHAI_FEATURE_FLAGS = {}, registerChaiFeatureFlag = (o, n) => {
|
|
|
8799
8807
|
}, QUICK_PROMPTS = [
|
|
8800
8808
|
{
|
|
8801
8809
|
name: "Improve writing",
|
|
8802
|
-
icon:
|
|
8810
|
+
icon: Pencil2Icon,
|
|
8803
8811
|
prompt: "Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."
|
|
8804
8812
|
},
|
|
8805
8813
|
{
|
|
8806
8814
|
name: "Replace placeholder content",
|
|
8807
|
-
icon:
|
|
8815
|
+
icon: LoopIcon,
|
|
8808
8816
|
prompt: "Discard current placeholder content and replace with meaningful relevant content."
|
|
8809
8817
|
},
|
|
8810
8818
|
//TODO: Add tone options
|
|
@@ -8831,7 +8839,7 @@ const CHAI_FEATURE_FLAGS = {}, registerChaiFeatureFlag = (o, n) => {
|
|
|
8831
8839
|
},
|
|
8832
8840
|
{
|
|
8833
8841
|
name: "Add emojis",
|
|
8834
|
-
icon:
|
|
8842
|
+
icon: FaceIcon,
|
|
8835
8843
|
prompt: "Add emojis to text elements if relevant."
|
|
8836
8844
|
},
|
|
8837
8845
|
{
|
|
@@ -8844,7 +8852,7 @@ function QuickPrompts({ onClick: o }) {
|
|
|
8844
8852
|
const { loading: n } = useAskAi(), { t: r } = useTranslation(), { selectedLang: a, fallbackLang: l } = useLanguages(), i = [...QUICK_PROMPTS];
|
|
8845
8853
|
return a && a !== l && i.splice(0, 0, {
|
|
8846
8854
|
name: `Translate to ${get(LANGUAGES, a, a)}`,
|
|
8847
|
-
icon:
|
|
8855
|
+
icon: ChatBubbleIcon,
|
|
8848
8856
|
prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
|
|
8849
8857
|
}), /* @__PURE__ */ jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: i.map(
|
|
8850
8858
|
({ name: c, icon: d, subMenus: p, prompt: u }) => p ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
@@ -8911,14 +8919,14 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8911
8919
|
className: "w-fit",
|
|
8912
8920
|
size: "sm",
|
|
8913
8921
|
children: a ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8914
|
-
/* @__PURE__ */ jsx(
|
|
8922
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-5 w-5 animate-spin" }),
|
|
8915
8923
|
n("Generating... Please wait...")
|
|
8916
8924
|
] }) : n("Edit with AI")
|
|
8917
8925
|
}
|
|
8918
8926
|
),
|
|
8919
8927
|
a ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8920
8928
|
/* @__PURE__ */ jsxs(Skeleton, { className: "flex w-full items-center space-x-1 px-4 py-1 pl-2", children: [
|
|
8921
|
-
/* @__PURE__ */ jsx(
|
|
8929
|
+
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4 animate-spin text-gray-500" }),
|
|
8922
8930
|
/* @__PURE__ */ jsx("p", { className: "text-xs", children: n("Generating... Please wait...") })
|
|
8923
8931
|
] }),
|
|
8924
8932
|
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
|
|
@@ -8943,7 +8951,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8943
8951
|
}
|
|
8944
8952
|
)
|
|
8945
8953
|
] }) : /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl p-4 text-muted-foreground", children: [
|
|
8946
|
-
/* @__PURE__ */ jsx(
|
|
8954
|
+
/* @__PURE__ */ jsx(MagicWandIcon, { className: "mx-auto text-3xl text-muted-foreground" }),
|
|
8947
8955
|
/* @__PURE__ */ jsx("h1", { children: n("Please select a block to Ask AI") })
|
|
8948
8956
|
] }) }) });
|
|
8949
8957
|
}, AskAI = () => {
|
|
@@ -8972,7 +8980,7 @@ function DarkMode() {
|
|
|
8972
8980
|
)
|
|
8973
8981
|
}
|
|
8974
8982
|
),
|
|
8975
|
-
/* @__PURE__ */ jsx(
|
|
8983
|
+
/* @__PURE__ */ jsx(MoonIcon, { className: "ml-3 size-4 shrink-0" })
|
|
8976
8984
|
] });
|
|
8977
8985
|
}
|
|
8978
8986
|
const UndoRedo = () => {
|
|
@@ -8998,26 +9006,26 @@ function AIChatPanel() {
|
|
|
8998
9006
|
content: r,
|
|
8999
9007
|
timestamp: /* @__PURE__ */ new Date()
|
|
9000
9008
|
};
|
|
9001
|
-
n((
|
|
9002
|
-
const
|
|
9009
|
+
n((C) => [...C, b]), a(""), i(!0), setTimeout(() => {
|
|
9010
|
+
const C = {
|
|
9003
9011
|
id: (Date.now() + 1).toString(),
|
|
9004
9012
|
role: "assistant",
|
|
9005
9013
|
content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
|
|
9006
9014
|
timestamp: /* @__PURE__ */ new Date()
|
|
9007
9015
|
};
|
|
9008
|
-
n((B) => [...B,
|
|
9016
|
+
n((B) => [...B, C]), i(!1), d(null);
|
|
9009
9017
|
}, 1500);
|
|
9010
9018
|
}, h = (b) => {
|
|
9011
9019
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
|
|
9012
9020
|
}, f = (b) => {
|
|
9013
9021
|
var B;
|
|
9014
|
-
const
|
|
9015
|
-
if (
|
|
9022
|
+
const C = (B = b.target.files) == null ? void 0 : B[0];
|
|
9023
|
+
if (C) {
|
|
9016
9024
|
const j = new FileReader();
|
|
9017
9025
|
j.onload = (_) => {
|
|
9018
|
-
var
|
|
9019
|
-
d((
|
|
9020
|
-
}, j.readAsDataURL(
|
|
9026
|
+
var w;
|
|
9027
|
+
d((w = _.target) == null ? void 0 : w.result);
|
|
9028
|
+
}, j.readAsDataURL(C);
|
|
9021
9029
|
}
|
|
9022
9030
|
}, x = () => {
|
|
9023
9031
|
var b;
|
|
@@ -9027,7 +9035,7 @@ function AIChatPanel() {
|
|
|
9027
9035
|
};
|
|
9028
9036
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col rounded-lg bg-background shadow-sm", children: [
|
|
9029
9037
|
/* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 p-3", children: o.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "mt-10 flex h-full flex-col items-center justify-center p-4 text-center text-muted-foreground", children: [
|
|
9030
|
-
/* @__PURE__ */ jsx(
|
|
9038
|
+
/* @__PURE__ */ jsx(MagicWandIcon, { className: "mb-2 h-8 w-8 text-primary/50" }),
|
|
9031
9039
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "Ask me anything to get started" })
|
|
9032
9040
|
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
9033
9041
|
o.map((b) => /* @__PURE__ */ jsxs(
|
|
@@ -9038,7 +9046,7 @@ function AIChatPanel() {
|
|
|
9038
9046
|
b.role === "assistant" ? "items-start" : "items-start justify-end"
|
|
9039
9047
|
),
|
|
9040
9048
|
children: [
|
|
9041
|
-
b.role === "assistant" && /* @__PURE__ */ jsx(Avatar, { className: "h-6 w-6 bg-primary/10", children: /* @__PURE__ */ jsx(
|
|
9049
|
+
b.role === "assistant" && /* @__PURE__ */ jsx(Avatar, { className: "h-6 w-6 bg-primary/10", children: /* @__PURE__ */ jsx(MagicWandIcon, { className: "h-3 w-3 text-primary" }) }),
|
|
9042
9050
|
/* @__PURE__ */ jsx(
|
|
9043
9051
|
"div",
|
|
9044
9052
|
{
|
|
@@ -9055,8 +9063,8 @@ function AIChatPanel() {
|
|
|
9055
9063
|
b.id
|
|
9056
9064
|
)),
|
|
9057
9065
|
l && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
9058
|
-
/* @__PURE__ */ jsx(Avatar, { className: "h-6 w-6 bg-primary/10", children: /* @__PURE__ */ jsx(
|
|
9059
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted px-3 py-2", children: /* @__PURE__ */ jsx(
|
|
9066
|
+
/* @__PURE__ */ jsx(Avatar, { className: "h-6 w-6 bg-primary/10", children: /* @__PURE__ */ jsx(MagicWandIcon, { className: "h-3 w-3 text-primary" }) }),
|
|
9067
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted px-3 py-2", children: /* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
9060
9068
|
] }),
|
|
9061
9069
|
/* @__PURE__ */ jsx("div", { ref: u })
|
|
9062
9070
|
] }) }),
|
|
@@ -9069,7 +9077,7 @@ function AIChatPanel() {
|
|
|
9069
9077
|
variant: "destructive",
|
|
9070
9078
|
className: "absolute right-0 top-0 h-5 w-5 rounded-full p-0",
|
|
9071
9079
|
onClick: y,
|
|
9072
|
-
children: /* @__PURE__ */ jsx(
|
|
9080
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" })
|
|
9073
9081
|
}
|
|
9074
9082
|
)
|
|
9075
9083
|
] }) }),
|
|
@@ -9094,7 +9102,7 @@ function AIChatPanel() {
|
|
|
9094
9102
|
variant: "ghost",
|
|
9095
9103
|
className: "absolute bottom-2 right-2 h-6 w-6",
|
|
9096
9104
|
onClick: x,
|
|
9097
|
-
children: /* @__PURE__ */ jsx(
|
|
9105
|
+
children: /* @__PURE__ */ jsx(ImageIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
9098
9106
|
}
|
|
9099
9107
|
)
|
|
9100
9108
|
] }),
|
|
@@ -9106,7 +9114,7 @@ function AIChatPanel() {
|
|
|
9106
9114
|
onClick: m,
|
|
9107
9115
|
disabled: l || !r.trim() && !c,
|
|
9108
9116
|
children: [
|
|
9109
|
-
/* @__PURE__ */ jsx(
|
|
9117
|
+
/* @__PURE__ */ jsx(PaperPlaneIcon, { className: "mr-1 h-4 w-4" }),
|
|
9110
9118
|
"Send"
|
|
9111
9119
|
]
|
|
9112
9120
|
}
|
|
@@ -9118,7 +9126,7 @@ const AiAssistant = () => {
|
|
|
9118
9126
|
const o = useAiAssistant(), [n] = useRightPanel(), r = useBuilderProp("askAiCallBack", null), { t: a } = useTranslation(), { hasPermission: l } = usePermissions();
|
|
9119
9127
|
return useChaiFeatureFlag("enable-ai-chat-left") || !r || !l(PERMISSIONS.EDIT_BLOCK) ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
9120
9128
|
/* @__PURE__ */ jsxs(Label, { htmlFor: "ai-assistant", className: "flex items-center gap-x-1 text-sm text-yellow-600", children: [
|
|
9121
|
-
/* @__PURE__ */ jsx(
|
|
9129
|
+
/* @__PURE__ */ jsx(MagicWandIcon, { className: "w-4" }),
|
|
9122
9130
|
a("AI Assistant")
|
|
9123
9131
|
] }),
|
|
9124
9132
|
/* @__PURE__ */ jsx(
|
|
@@ -9157,19 +9165,15 @@ const AiAssistant = () => {
|
|
|
9157
9165
|
}, DataBinding = () => {
|
|
9158
9166
|
const o = usePageExternalData(), [n, r] = useAtom$1(dataBindingActiveAtom), { t: a } = useTranslation();
|
|
9159
9167
|
return isEmpty(o) ? null : /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9160
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "rounded-full", variant: "ghost", onClick: () => r(!n), children: /* @__PURE__ */ jsx(
|
|
9168
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "rounded-full", variant: "ghost", onClick: () => r(!n), children: /* @__PURE__ */ jsx(LightningBoltIcon, { className: cn$2("h-4 w-4", n ? "text-green-500" : "text-gray-500") }) }) }),
|
|
9161
9169
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: a("Toggle Data Binding") }) })
|
|
9162
9170
|
] }) });
|
|
9163
9171
|
}, CanvasTopBar = () => {
|
|
9164
9172
|
const o = useBuilderProp("darkMode", !0), n = useFeature("aiChat"), [r] = useCanvasZoom();
|
|
9165
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2", children: [
|
|
9173
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2 shadow-xl", children: [
|
|
9166
9174
|
/* @__PURE__ */ jsxs("div", { className: "flex h-full space-x-2", children: [
|
|
9167
9175
|
/* @__PURE__ */ jsx(Breakpoints$1, { canvas: !0, openDelay: 400 }),
|
|
9168
9176
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
|
|
9169
|
-
o ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9170
|
-
/* @__PURE__ */ jsx(DarkMode, {}),
|
|
9171
|
-
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" })
|
|
9172
|
-
] }) : null,
|
|
9173
9177
|
/* @__PURE__ */ jsxs("div", { className: "flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400", children: [
|
|
9174
9178
|
/* @__PURE__ */ jsx(ZoomInIcon, { className: "h-3.5 w-3.5 flex-shrink-0" }),
|
|
9175
9179
|
" ",
|
|
@@ -9179,6 +9183,10 @@ const AiAssistant = () => {
|
|
|
9179
9183
|
] })
|
|
9180
9184
|
] }),
|
|
9181
9185
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
|
|
9186
|
+
o ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9187
|
+
/* @__PURE__ */ jsx(DarkMode, {}),
|
|
9188
|
+
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" })
|
|
9189
|
+
] }) : null,
|
|
9182
9190
|
/* @__PURE__ */ jsx(UndoRedo, {}),
|
|
9183
9191
|
/* @__PURE__ */ jsx(DataBinding, {})
|
|
9184
9192
|
] }),
|
|
@@ -9224,9 +9232,9 @@ const AiAssistant = () => {
|
|
|
9224
9232
|
const k = [...a, { key: i, value: d }];
|
|
9225
9233
|
r(k), l(a), c(""), p(""), h("");
|
|
9226
9234
|
}
|
|
9227
|
-
},
|
|
9228
|
-
const
|
|
9229
|
-
r(
|
|
9235
|
+
}, C = (k) => {
|
|
9236
|
+
const A = a.filter((E, S) => S !== k);
|
|
9237
|
+
r(A), l(A);
|
|
9230
9238
|
}, B = (k) => {
|
|
9231
9239
|
g(k), c(a[k].key), p(a[k].value);
|
|
9232
9240
|
}, j = () => {
|
|
@@ -9240,24 +9248,24 @@ const AiAssistant = () => {
|
|
|
9240
9248
|
}
|
|
9241
9249
|
}, _ = (k) => {
|
|
9242
9250
|
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? j() : b());
|
|
9243
|
-
},
|
|
9244
|
-
const
|
|
9251
|
+
}, w = useCallback((k) => {
|
|
9252
|
+
const A = (v) => /[.,!?;:]/.test(v), E = (v, I, L) => {
|
|
9245
9253
|
let T = "", P = "";
|
|
9246
|
-
const
|
|
9247
|
-
return
|
|
9254
|
+
const N = I > 0 ? v[I - 1] : "", R = I < v.length ? v[I] : "";
|
|
9255
|
+
return I > 0 && (N === "." || !A(N) && N !== " ") && (T = " "), I < v.length && !A(R) && R !== " " && (P = " "), {
|
|
9248
9256
|
text: T + L + P,
|
|
9249
9257
|
prefixLength: T.length,
|
|
9250
9258
|
suffixLength: P.length
|
|
9251
9259
|
};
|
|
9252
|
-
},
|
|
9253
|
-
if (
|
|
9254
|
-
const v =
|
|
9260
|
+
}, S = x.current;
|
|
9261
|
+
if (S) {
|
|
9262
|
+
const v = S.selectionStart || 0, I = S.value || "", L = S.selectionEnd || v;
|
|
9255
9263
|
if (L > v) {
|
|
9256
|
-
const O = `{{${k}}}`, { text: M } = E(
|
|
9264
|
+
const O = `{{${k}}}`, { text: M } = E(I, v, O), $ = I.slice(0, v) + M + I.slice(L);
|
|
9257
9265
|
p($);
|
|
9258
9266
|
return;
|
|
9259
9267
|
}
|
|
9260
|
-
const P = `{{${k}}}`, { text:
|
|
9268
|
+
const P = `{{${k}}}`, { text: N } = E(I, v, P), R = I.slice(0, v) + N + I.slice(v);
|
|
9261
9269
|
p(R);
|
|
9262
9270
|
}
|
|
9263
9271
|
}, []);
|
|
@@ -9291,7 +9299,7 @@ const AiAssistant = () => {
|
|
|
9291
9299
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9292
9300
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9293
9301
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9294
|
-
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect:
|
|
9302
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: w })
|
|
9295
9303
|
] }),
|
|
9296
9304
|
/* @__PURE__ */ jsx(
|
|
9297
9305
|
Textarea,
|
|
@@ -9316,16 +9324,16 @@ const AiAssistant = () => {
|
|
|
9316
9324
|
]
|
|
9317
9325
|
}
|
|
9318
9326
|
),
|
|
9319
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k,
|
|
9327
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9320
9328
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9321
9329
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: k.key }),
|
|
9322
9330
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
|
|
9323
9331
|
] }),
|
|
9324
9332
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9325
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(
|
|
9326
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9333
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9334
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(A), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9327
9335
|
] })
|
|
9328
|
-
] },
|
|
9336
|
+
] }, A)) })
|
|
9329
9337
|
] });
|
|
9330
9338
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9331
9339
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9346,7 +9354,7 @@ const AiAssistant = () => {
|
|
|
9346
9354
|
}), NoopComponent = () => null, ResetStylesButton = () => {
|
|
9347
9355
|
const { resetAll: o } = useResetBlockStyles(), n = useSelectedBlock(), [r] = useSelectedStylingBlocks(), a = useRemoveAllClassesForBlock(), { t: l } = useTranslation();
|
|
9348
9356
|
return !n || isEmpty(r) ? null : /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
9349
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-sm p-0.5 hover:bg-gray-300", onClick: (i) => i.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
9357
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-sm p-0.5 hover:bg-gray-300", onClick: (i) => i.stopPropagation(), children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" }) }) }),
|
|
9350
9358
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
|
|
9351
9359
|
/* @__PURE__ */ jsxs(
|
|
9352
9360
|
DropdownMenuItem,
|
|
@@ -9387,7 +9395,7 @@ function BlockAttributesToggle() {
|
|
|
9387
9395
|
className: "flex cursor-pointer items-center justify-between border-t border-border py-3 text-xs font-medium hover:underline",
|
|
9388
9396
|
children: [
|
|
9389
9397
|
/* @__PURE__ */ jsx("span", { children: o("Attributes") }),
|
|
9390
|
-
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
9398
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-gray-500 " + (n ? "rotate-180" : "") }) })
|
|
9391
9399
|
]
|
|
9392
9400
|
}
|
|
9393
9401
|
),
|
|
@@ -9453,7 +9461,7 @@ const SettingsPanel = () => {
|
|
|
9453
9461
|
component: DefaultTopBar
|
|
9454
9462
|
}, registerChaiTopBar = (o) => {
|
|
9455
9463
|
TOP_BAR.component = o;
|
|
9456
|
-
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(
|
|
9464
|
+
}, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(StackIcon, { className: "h-5 w-5" }) }), AiButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }) }), AskAiButton = ({ isActive: o, show: n }) => /* @__PURE__ */ jsx(Button, { variant: o ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(MagicWandIcon, { className: "rtl:ml-2" }) });
|
|
9457
9465
|
function useSidebarDefaultPanels() {
|
|
9458
9466
|
const o = useBuilderProp("askAiCallBack", null), n = useFeature("aiChat"), r = useChaiFeatureFlag("enable-ai-chat-left");
|
|
9459
9467
|
return useMemo(() => {
|
|
@@ -9483,42 +9491,38 @@ function useSidebarDefaultPanels() {
|
|
|
9483
9491
|
}, [o, n, r]);
|
|
9484
9492
|
}
|
|
9485
9493
|
const RootLayout = () => {
|
|
9486
|
-
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel()
|
|
9487
|
-
|
|
9488
|
-
r("outline");
|
|
9489
|
-
});
|
|
9490
|
-
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((w) => {
|
|
9491
|
-
w.preventDefault();
|
|
9494
|
+
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((A) => {
|
|
9495
|
+
A.preventDefault();
|
|
9492
9496
|
}, []), f = useCallback(
|
|
9493
|
-
(
|
|
9494
|
-
r(n ===
|
|
9497
|
+
(A) => {
|
|
9498
|
+
console.log("handleMenuItemClick", A, n), r(n === A ? null : A);
|
|
9495
9499
|
},
|
|
9496
|
-
[n]
|
|
9500
|
+
[n, r]
|
|
9497
9501
|
), { t: x } = useTranslation(), y = useMemo(
|
|
9498
9502
|
() => [...p, ...u, ...g],
|
|
9499
9503
|
[p, u, g]
|
|
9500
|
-
), b = useBuilderProp("htmlDir", "ltr"),
|
|
9504
|
+
), b = useBuilderProp("htmlDir", "ltr"), C = find(y, { id: n }) ?? first(y), B = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
9501
9505
|
useEffect(() => {
|
|
9502
9506
|
if (n !== null) {
|
|
9503
|
-
const
|
|
9504
|
-
|
|
9507
|
+
const A = find(y, { id: n });
|
|
9508
|
+
A && get(A, "view", "standard") === "standard" && (a.current = n, i(get(A, "width", DEFAULT_PANEL_WIDTH)));
|
|
9505
9509
|
}
|
|
9506
9510
|
}, [n, y]);
|
|
9507
9511
|
const j = useMemo(() => {
|
|
9508
9512
|
if (n === null) return 0;
|
|
9509
|
-
const
|
|
9510
|
-
return get(
|
|
9513
|
+
const A = find(y, { id: n });
|
|
9514
|
+
return get(A, "view", "standard") === "standard" ? B : l;
|
|
9511
9515
|
}, [n, B, l, y]), _ = useCallback(() => {
|
|
9512
9516
|
r(a.current);
|
|
9513
|
-
}, [r]),
|
|
9517
|
+
}, [r, n]), w = useCallback(() => {
|
|
9514
9518
|
r("outline");
|
|
9515
9519
|
}, [r]);
|
|
9516
9520
|
useEffect(() => {
|
|
9517
|
-
find(y, { id: n })
|
|
9521
|
+
n !== null && !find(y, { id: n }) && r("outline");
|
|
9518
9522
|
}, [n, y]);
|
|
9519
9523
|
const k = useCallback(
|
|
9520
|
-
(
|
|
9521
|
-
f(
|
|
9524
|
+
(A) => {
|
|
9525
|
+
f(A);
|
|
9522
9526
|
},
|
|
9523
9527
|
[f]
|
|
9524
9528
|
);
|
|
@@ -9527,29 +9531,29 @@ const RootLayout = () => {
|
|
|
9527
9531
|
"div",
|
|
9528
9532
|
{
|
|
9529
9533
|
onContextMenu: h,
|
|
9530
|
-
className: "flex h-
|
|
9534
|
+
className: "flex h-full max-h-full flex-col bg-background text-foreground",
|
|
9531
9535
|
children: [
|
|
9532
9536
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9533
9537
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9534
9538
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9535
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9536
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9539
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((A, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9540
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
|
|
9537
9541
|
position: "top",
|
|
9538
|
-
panelId:
|
|
9539
|
-
isActive: n ===
|
|
9540
|
-
show: () => k(
|
|
9542
|
+
panelId: A.id,
|
|
9543
|
+
isActive: n === A.id,
|
|
9544
|
+
show: () => k(A.id)
|
|
9541
9545
|
}) }),
|
|
9542
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9546
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(A.label) }) })
|
|
9543
9547
|
] }, "button-top-" + E)) }),
|
|
9544
9548
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9545
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((
|
|
9546
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9549
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((A, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9550
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
|
|
9547
9551
|
position: "bottom",
|
|
9548
|
-
panelId:
|
|
9549
|
-
isActive: n ===
|
|
9550
|
-
show: () => k(
|
|
9552
|
+
panelId: A.id,
|
|
9553
|
+
isActive: n === A.id,
|
|
9554
|
+
show: () => k(A.id)
|
|
9551
9555
|
}) }),
|
|
9552
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(
|
|
9556
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(A.label) }) })
|
|
9553
9557
|
] }, "button-bottom-" + E)) })
|
|
9554
9558
|
] }),
|
|
9555
9559
|
/* @__PURE__ */ jsx(
|
|
@@ -9560,15 +9564,15 @@ const RootLayout = () => {
|
|
|
9560
9564
|
initial: { width: j },
|
|
9561
9565
|
animate: { width: j },
|
|
9562
9566
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9563
|
-
children: n !== null && get(
|
|
9567
|
+
children: n !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9564
9568
|
/* @__PURE__ */ jsx(
|
|
9565
9569
|
"div",
|
|
9566
9570
|
{
|
|
9567
|
-
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(
|
|
9568
|
-
children: /* @__PURE__ */ jsx("span", { children: x(get(
|
|
9571
|
+
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(C, "isInternal", !1) ? "" : "w-64"}`,
|
|
9572
|
+
children: /* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9569
9573
|
}
|
|
9570
9574
|
),
|
|
9571
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9575
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
|
|
9572
9576
|
] })
|
|
9573
9577
|
}
|
|
9574
9578
|
),
|
|
@@ -9591,7 +9595,7 @@ const RootLayout = () => {
|
|
|
9591
9595
|
x("AI Assistant")
|
|
9592
9596
|
] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
9593
9597
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9594
|
-
/* @__PURE__ */ jsx(
|
|
9598
|
+
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
9595
9599
|
x("Theme Settings")
|
|
9596
9600
|
] }),
|
|
9597
9601
|
/* @__PURE__ */ jsx(
|
|
@@ -9601,7 +9605,7 @@ const RootLayout = () => {
|
|
|
9601
9605
|
variant: "ghost",
|
|
9602
9606
|
size: "icon",
|
|
9603
9607
|
className: "text-xs",
|
|
9604
|
-
children: /* @__PURE__ */ jsx(
|
|
9608
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4 rtl:ml-2" })
|
|
9605
9609
|
}
|
|
9606
9610
|
)
|
|
9607
9611
|
] }) : null }) }) }),
|
|
@@ -9614,7 +9618,7 @@ const RootLayout = () => {
|
|
|
9614
9618
|
}
|
|
9615
9619
|
),
|
|
9616
9620
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9617
|
-
n !== null && get(
|
|
9621
|
+
n !== null && get(C, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
|
|
9618
9622
|
SheetContent,
|
|
9619
9623
|
{
|
|
9620
9624
|
side: "left",
|
|
@@ -9622,26 +9626,26 @@ const RootLayout = () => {
|
|
|
9622
9626
|
style: { width: `${B}px` },
|
|
9623
9627
|
children: [
|
|
9624
9628
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9625
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9626
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9629
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9630
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9627
9631
|
] }) }),
|
|
9628
|
-
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9629
|
-
close:
|
|
9632
|
+
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9633
|
+
close: w
|
|
9630
9634
|
}) }) })
|
|
9631
9635
|
]
|
|
9632
9636
|
}
|
|
9633
9637
|
) }),
|
|
9634
9638
|
" ",
|
|
9635
|
-
n !== null && get(
|
|
9639
|
+
n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${B}px` }, children: [
|
|
9636
9640
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9637
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9638
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9641
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9642
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9639
9643
|
] }) }),
|
|
9640
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9641
|
-
close:
|
|
9644
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9645
|
+
close: w
|
|
9642
9646
|
}) }) })
|
|
9643
9647
|
] }) }),
|
|
9644
|
-
n !== null && get(
|
|
9648
|
+
n !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9645
9649
|
motion.div,
|
|
9646
9650
|
{
|
|
9647
9651
|
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
@@ -9660,13 +9664,13 @@ const RootLayout = () => {
|
|
|
9660
9664
|
children: [
|
|
9661
9665
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9662
9666
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9663
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
9664
|
-
/* @__PURE__ */ jsx("span", { children: x(get(
|
|
9667
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
|
|
9668
|
+
/* @__PURE__ */ jsx("span", { children: x(get(C, "label", "")) })
|
|
9665
9669
|
] }),
|
|
9666
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(
|
|
9670
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
9667
9671
|
] }),
|
|
9668
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9669
|
-
close:
|
|
9672
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9673
|
+
close: w
|
|
9670
9674
|
}) }) })
|
|
9671
9675
|
]
|
|
9672
9676
|
}
|
|
@@ -9708,8 +9712,8 @@ const RootLayout = () => {
|
|
|
9708
9712
|
const x = l.toLowerCase();
|
|
9709
9713
|
return Object.fromEntries(
|
|
9710
9714
|
Object.entries(a).filter(([y, b]) => {
|
|
9711
|
-
var
|
|
9712
|
-
return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((
|
|
9715
|
+
var C;
|
|
9716
|
+
return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((C = b == null ? void 0 : b.description) == null ? void 0 : C.toLowerCase().includes(x));
|
|
9713
9717
|
})
|
|
9714
9718
|
);
|
|
9715
9719
|
}, [a, l]), m = (x) => {
|
|
@@ -9719,8 +9723,8 @@ const RootLayout = () => {
|
|
|
9719
9723
|
});
|
|
9720
9724
|
}, h = (x) => {
|
|
9721
9725
|
if (!c) return;
|
|
9722
|
-
const y = x.clientX - p.x, b = x.clientY - p.y,
|
|
9723
|
-
r(k,
|
|
9726
|
+
const y = x.clientX - p.x, b = x.clientY - p.y, C = x.currentTarget, B = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - B, w = window.innerHeight - j, k = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, w));
|
|
9727
|
+
r(k, A);
|
|
9724
9728
|
}, f = () => {
|
|
9725
9729
|
d(!1);
|
|
9726
9730
|
};
|
|
@@ -9763,12 +9767,12 @@ const RootLayout = () => {
|
|
|
9763
9767
|
size: "sm",
|
|
9764
9768
|
onClick: o,
|
|
9765
9769
|
className: "absolute -right-2 -top-2 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
|
|
9766
|
-
children: /* @__PURE__ */ jsx(
|
|
9770
|
+
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
9767
9771
|
}
|
|
9768
9772
|
)
|
|
9769
9773
|
] }),
|
|
9770
9774
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(
|
|
9775
|
+
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-gray-400" }),
|
|
9772
9776
|
/* @__PURE__ */ jsx(
|
|
9773
9777
|
Input$1,
|
|
9774
9778
|
{
|
|
@@ -9962,46 +9966,46 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9962
9966
|
var r;
|
|
9963
9967
|
const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14], f = a[16], x = a[17], y = u(o, n);
|
|
9964
9968
|
if (isAtomStateInitialized(y) && (l.has(n) && i.get(n) !== y.n || Array.from(y.d).every(
|
|
9965
|
-
([
|
|
9969
|
+
([A, E]) => (
|
|
9966
9970
|
// Recursively, read the atom state of the dependency, and
|
|
9967
9971
|
// check if the atom epoch number is unchanged
|
|
9968
|
-
h(o,
|
|
9972
|
+
h(o, A).n === E
|
|
9969
9973
|
)
|
|
9970
9974
|
)))
|
|
9971
9975
|
return y;
|
|
9972
9976
|
y.d.clear();
|
|
9973
9977
|
let b = !0;
|
|
9974
|
-
function
|
|
9978
|
+
function C() {
|
|
9975
9979
|
l.has(n) && (x(o, n), m(o), g(o));
|
|
9976
9980
|
}
|
|
9977
|
-
function B(
|
|
9981
|
+
function B(A) {
|
|
9978
9982
|
var E;
|
|
9979
|
-
if (isSelfAtom(n,
|
|
9980
|
-
const v = u(o,
|
|
9983
|
+
if (isSelfAtom(n, A)) {
|
|
9984
|
+
const v = u(o, A);
|
|
9981
9985
|
if (!isAtomStateInitialized(v))
|
|
9982
|
-
if (hasInitialValue(
|
|
9983
|
-
setAtomStateValueOrPromise(o,
|
|
9986
|
+
if (hasInitialValue(A))
|
|
9987
|
+
setAtomStateValueOrPromise(o, A, A.init);
|
|
9984
9988
|
else
|
|
9985
9989
|
throw new Error("no atom init");
|
|
9986
9990
|
return returnAtomValue(v);
|
|
9987
9991
|
}
|
|
9988
|
-
const
|
|
9992
|
+
const S = h(o, A);
|
|
9989
9993
|
try {
|
|
9990
|
-
return returnAtomValue(
|
|
9994
|
+
return returnAtomValue(S);
|
|
9991
9995
|
} finally {
|
|
9992
|
-
y.d.set(
|
|
9996
|
+
y.d.set(A, S.n), isPendingPromise(y.v) && addPendingPromiseToDependency(n, y.v, S), (E = l.get(A)) == null || E.t.add(n), b || C();
|
|
9993
9997
|
}
|
|
9994
9998
|
}
|
|
9995
9999
|
let j, _;
|
|
9996
|
-
const
|
|
10000
|
+
const w = {
|
|
9997
10001
|
get signal() {
|
|
9998
10002
|
return j || (j = new AbortController()), j.signal;
|
|
9999
10003
|
},
|
|
10000
10004
|
get setSelf() {
|
|
10001
|
-
return !_ && isActuallyWritableAtom(n) && (_ = (...
|
|
10005
|
+
return !_ && isActuallyWritableAtom(n) && (_ = (...A) => {
|
|
10002
10006
|
if (!b)
|
|
10003
10007
|
try {
|
|
10004
|
-
return f(o, n, ...
|
|
10008
|
+
return f(o, n, ...A);
|
|
10005
10009
|
} finally {
|
|
10006
10010
|
m(o), g(o);
|
|
10007
10011
|
}
|
|
@@ -10009,10 +10013,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10009
10013
|
}
|
|
10010
10014
|
}, k = y.n;
|
|
10011
10015
|
try {
|
|
10012
|
-
const
|
|
10013
|
-
return setAtomStateValueOrPromise(o, n,
|
|
10014
|
-
} catch (
|
|
10015
|
-
return delete y.v, y.e =
|
|
10016
|
+
const A = p(o, n, B, w);
|
|
10017
|
+
return setAtomStateValueOrPromise(o, n, A), isPromiseLike$1(A) && (registerAbortHandler(A, () => j == null ? void 0 : j.abort()), A.then(C, C)), y;
|
|
10018
|
+
} catch (A) {
|
|
10019
|
+
return delete y.v, y.e = A, ++y.n, y;
|
|
10016
10020
|
} finally {
|
|
10017
10021
|
b = !1, k !== y.n && i.get(n) === k && (i.set(n, y.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
10018
10022
|
}
|
|
@@ -10028,18 +10032,18 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10028
10032
|
}, writeAtomState = (o, n, ...r) => {
|
|
10029
10033
|
const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], d = a[11], p = a[12], u = a[13], g = a[14], m = a[15], h = a[17];
|
|
10030
10034
|
let f = !0;
|
|
10031
|
-
const x = (b) => returnAtomValue(g(o, b)), y = (b, ...
|
|
10035
|
+
const x = (b) => returnAtomValue(g(o, b)), y = (b, ...C) => {
|
|
10032
10036
|
var B;
|
|
10033
10037
|
const j = d(o, b);
|
|
10034
10038
|
try {
|
|
10035
10039
|
if (isSelfAtom(n, b)) {
|
|
10036
10040
|
if (!hasInitialValue(b))
|
|
10037
10041
|
throw new Error("atom not writable");
|
|
10038
|
-
const _ = j.n,
|
|
10039
|
-
setAtomStateValueOrPromise(o, b,
|
|
10042
|
+
const _ = j.n, w = C[0];
|
|
10043
|
+
setAtomStateValueOrPromise(o, b, w), h(o, b), _ !== j.n && (l.add(b), (B = i.c) == null || B.call(i, b), m(o, b));
|
|
10040
10044
|
return;
|
|
10041
10045
|
} else
|
|
10042
|
-
return writeAtomState(o, b, ...
|
|
10046
|
+
return writeAtomState(o, b, ...C);
|
|
10043
10047
|
} finally {
|
|
10044
10048
|
f || (u(o), p(o));
|
|
10045
10049
|
}
|
|
@@ -10080,7 +10084,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10080
10084
|
}, l.set(n, x), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
|
|
10081
10085
|
const y = () => {
|
|
10082
10086
|
let b = !0;
|
|
10083
|
-
const
|
|
10087
|
+
const C = (...B) => {
|
|
10084
10088
|
try {
|
|
10085
10089
|
return h(o, n, ...B);
|
|
10086
10090
|
} finally {
|
|
@@ -10088,7 +10092,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10088
10092
|
}
|
|
10089
10093
|
};
|
|
10090
10094
|
try {
|
|
10091
|
-
const B = d(o, n,
|
|
10095
|
+
const B = d(o, n, C);
|
|
10092
10096
|
B && (x.u = () => {
|
|
10093
10097
|
b = !0;
|
|
10094
10098
|
try {
|
|
@@ -10298,10 +10302,13 @@ function useAtom(o, n) {
|
|
|
10298
10302
|
];
|
|
10299
10303
|
}
|
|
10300
10304
|
const useAutoSave = () => {
|
|
10301
|
-
const { savePage: o } = useSavePage(), n = useBuilderProp("
|
|
10302
|
-
useIntervalEffect(
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
+
const { savePage: o } = useSavePage(), n = useBuilderProp("autoSave", !0), r = useBuilderProp("autoSaveInterval", 60);
|
|
10306
|
+
useIntervalEffect(
|
|
10307
|
+
() => {
|
|
10308
|
+
n && o(!0);
|
|
10309
|
+
},
|
|
10310
|
+
n ? r * 1e3 : void 0
|
|
10311
|
+
);
|
|
10305
10312
|
}, ChaiWatchers = (o) => {
|
|
10306
10313
|
const [, n] = useBlocksStore(), r = useBuilderReset(), [a] = useAtom(builderSaveStateAtom);
|
|
10307
10314
|
useAtom(selectedLibraryAtom), useKeyEventWatcher(), useExpandTree(), useAutoSave(), useWatchPartailBlocks(), useUnmountBroadcastChannel();
|
|
@@ -10372,7 +10379,7 @@ export {
|
|
|
10372
10379
|
getBlocksFromHTML as convertHTMLToChaiBlocks,
|
|
10373
10380
|
generateUUID as generateBlockId,
|
|
10374
10381
|
getBlocksFromHTML,
|
|
10375
|
-
|
|
10382
|
+
He as i18n,
|
|
10376
10383
|
cn$2 as mergeClasses,
|
|
10377
10384
|
registerBlockSettingField,
|
|
10378
10385
|
registerBlockSettingTemplate,
|
|
@@ -10438,7 +10445,7 @@ export {
|
|
|
10438
10445
|
useTheme,
|
|
10439
10446
|
useThemeOptions,
|
|
10440
10447
|
useToggleChaiFeatureFlag,
|
|
10441
|
-
|
|
10448
|
+
$e as useTranslation,
|
|
10442
10449
|
useUndoManager,
|
|
10443
10450
|
useUpdateBlocksProps,
|
|
10444
10451
|
useUpdateBlocksPropsRealtime,
|