@chaibuilder/sdk 3.1.0 → 3.1.2
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/{apply-binding-BEdnEDe4.cjs → apply-binding-CExho6DS.cjs} +1 -1
- package/dist/{apply-binding-FoDMumPo.js → apply-binding-w7OMcHcu.js} +142 -142
- package/dist/{code-editor-DHjchara.js → code-editor-BwCdfuDZ.js} +1 -1
- package/dist/{code-editor-BF_Dj7wT.cjs → code-editor-CDL8REEJ.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/{index-0I-fi22L.js → index-DdxrsPQZ.js} +429 -385
- package/dist/index-HYzn6bSR.cjs +128 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-BZJ8UA08.cjs → rte-widget-modal-DZyjkwMa.cjs} +1 -1
- package/dist/{rte-widget-modal-DxyV3u6C.js → rte-widget-modal-DrMYNEN2.js} +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +28 -28
- package/package.json +1 -1
- package/dist/index-kJFsIwFo.cjs +0 -128
|
@@ -3,8 +3,8 @@ var W = (o, n, r) => n in o ? U(o, n, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var F = (o, n, r) => W(o, typeof n != "symbol" ? n + "" : n, r);
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, syncBlocksWithDefaults, useRegisteredFonts, getBlockFormSchemas } from "@chaibuilder/runtime";
|
|
6
|
-
import { get, find, filter, flatten, has, map, includes, without, compact,
|
|
7
|
-
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon,
|
|
6
|
+
import { get, find, filter, flatten, has, map, includes, without, compact, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, kebabCase, round, reverse, findIndex, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy } from "lodash-es";
|
|
7
|
+
import { SquareIcon, ZoomInIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, 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, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, CheckIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, EraserIcon, DotsHorizontalIcon, LightningBoltIcon, StackIcon, DragHandleDots2Icon } 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";
|
|
@@ -14,14 +14,13 @@ import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as Dropd
|
|
|
14
14
|
import clsx$1, { clsx } from "clsx";
|
|
15
15
|
import { twMerge } from "tailwind-merge";
|
|
16
16
|
import TreeModel from "tree-model";
|
|
17
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY, i as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, j as ROOT_TEMP_KEY } from "./apply-binding-
|
|
17
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, i as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, j as ROOT_TEMP_KEY } from "./apply-binding-w7OMcHcu.js";
|
|
18
18
|
import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
|
|
19
19
|
import { isObject } from "@rjsf/utils";
|
|
20
20
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebouncedState, useIntervalEffect } from "@react-hookz/web";
|
|
21
21
|
import { toast, Toaster } from "sonner";
|
|
22
22
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
23
23
|
import Fuse from "fuse.js";
|
|
24
|
-
import UndoManager from "undo-manager";
|
|
25
24
|
import i18n, { t } from "i18next";
|
|
26
25
|
import ReactDOM, { createPortal } from "react-dom";
|
|
27
26
|
import { HexAlphaColorPicker } from "react-colorful";
|
|
@@ -38,6 +37,7 @@ import validator from "@rjsf/validator-ajv8";
|
|
|
38
37
|
import Autosuggest from "react-autosuggest";
|
|
39
38
|
import { useFeature } from "flagged";
|
|
40
39
|
import { Tree } from "react-arborist";
|
|
40
|
+
import { compact as compact$1, pick as pick$1, noop as noop$1 } from "lodash";
|
|
41
41
|
import { parse, stringify } from "himalaya";
|
|
42
42
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
43
43
|
import tailwindForms from "@tailwindcss/forms";
|
|
@@ -48,7 +48,7 @@ import twContainer from "@tailwindcss/container-queries";
|
|
|
48
48
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
49
49
|
import { ErrorBoundary } from "react-error-boundary";
|
|
50
50
|
import { motion } from "framer-motion";
|
|
51
|
-
import
|
|
51
|
+
import UndoManager from "undo-manager";
|
|
52
52
|
import { limitShift, flip, size } from "@floating-ui/dom";
|
|
53
53
|
import { useFloating, shift } from "@floating-ui/react-dom";
|
|
54
54
|
import { Provider as Provider$1 } from "react-wrap-balancer";
|
|
@@ -217,120 +217,7 @@ const useSelectedBlocksDisplayChild = () => ({
|
|
|
217
217
|
[n]
|
|
218
218
|
);
|
|
219
219
|
return [o, n, r];
|
|
220
|
-
}, Breadcrumb = () => {
|
|
221
|
-
const o = useSelectedBlockHierarchy(), [, n] = useSelectedBlockIds(), { highlightBlock: r } = useBlockHighlight();
|
|
222
|
-
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: [
|
|
223
|
-
/* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
224
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
|
|
225
|
-
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "rtl:rotate-180 h-4 w-4" })
|
|
226
|
-
] }),
|
|
227
|
-
reverse(o).map((a, l) => /* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
228
|
-
/* @__PURE__ */ jsxs(
|
|
229
|
-
Button,
|
|
230
|
-
{
|
|
231
|
-
onMouseEnter: () => {
|
|
232
|
-
r(a == null ? void 0 : a._id);
|
|
233
|
-
},
|
|
234
|
-
onClick: () => n([a == null ? void 0 : a._id]),
|
|
235
|
-
variant: "ghost",
|
|
236
|
-
className: "h-fit gap-x-1 p-1 text-xs font-normal",
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ jsx(TypeIcon, { type: a == null ? void 0 : a._type }),
|
|
239
|
-
a._name || a._type
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
l !== o.length - 1 && /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rtl:rotate-180 h-4 w-4" })
|
|
244
|
-
] }, l))
|
|
245
|
-
] }) });
|
|
246
|
-
}, CHAI_BUILDER_EVENTS = {
|
|
247
|
-
OPEN_ADD_BLOCK: "OPEN_ADD_BLOCK",
|
|
248
|
-
CLOSE_ADD_BLOCK: "CLOSE_ADD_BLOCK",
|
|
249
|
-
SHOW_BLOCK_SETTINGS: "SHOW_BLOCK_SETTINGS",
|
|
250
|
-
//CANVAS Events
|
|
251
|
-
CLEAR_CANVAS_SELECTION: "CLEAR_CANVAS_SELECTION",
|
|
252
|
-
CANVAS_BLOCK_SELECTED: "CANVAS_BLOCK_SELECTED",
|
|
253
|
-
CANVAS_BLOCK_STYLE_SELECTED: "CANVAS_BLOCK_STYLE_SELECTED"
|
|
254
|
-
}, canAcceptChildBlock = (o, n) => {
|
|
255
|
-
if (!o) return !0;
|
|
256
|
-
const r = getRegisteredChaiBlock(o);
|
|
257
|
-
return r && has(r, "canAcceptBlock") ? r.canAcceptBlock(n) : !1;
|
|
258
|
-
}, canAddChildBlock = (o) => {
|
|
259
|
-
const n = getRegisteredChaiBlock(o);
|
|
260
|
-
return n ? has(n, "canAcceptBlock") : !1;
|
|
261
|
-
}, canBeNestedInside = (o, n) => {
|
|
262
|
-
const r = getRegisteredChaiBlock(n);
|
|
263
|
-
return r && has(r, "canBeNested") ? r.canBeNested(o) : !0;
|
|
264
|
-
}, canDuplicateBlock = (o) => {
|
|
265
|
-
const n = getRegisteredChaiBlock(o);
|
|
266
|
-
return n && has(n, "canDuplicate") ? n.canDuplicate() : !0;
|
|
267
|
-
}, canDeleteBlock = (o) => {
|
|
268
|
-
const n = getRegisteredChaiBlock(o);
|
|
269
|
-
return n && has(n, "canDelete") ? n.canDelete() : !0;
|
|
270
|
-
}, canDropBlock = (o, { dragSource: n, dropTarget: r }) => {
|
|
271
|
-
const a = get(n, "data._type", ""), l = get(r, "data._type", "");
|
|
272
|
-
return canAcceptChildBlock(l, a);
|
|
273
220
|
};
|
|
274
|
-
import.meta.vitest && describe("canDropBlock Function", () => {
|
|
275
|
-
it('should return false if dragSourceType is "Slot"', () => {
|
|
276
|
-
const o = { data: { _type: "Slot" } }, n = { data: {} };
|
|
277
|
-
expect(canDropBlock({}, { dragSource: o, dropTarget: n })).toBe(!0);
|
|
278
|
-
}), it("should return true if dropTargetType is empty", () => {
|
|
279
|
-
const o = { data: { _type: "Box" } }, n = { data: {} };
|
|
280
|
-
expect(canDropBlock({}, { dragSource: o, dropTarget: n })).toBe(!0);
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
class PubSub {
|
|
284
|
-
constructor() {
|
|
285
|
-
F(this, "subscribers", /* @__PURE__ */ new Map());
|
|
286
|
-
}
|
|
287
|
-
subscribe(n, r) {
|
|
288
|
-
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
289
|
-
const a = this.subscribers.get(n);
|
|
290
|
-
a && (a.delete(r), a.size === 0 && this.subscribers.delete(n));
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
publish(n, r) {
|
|
294
|
-
const a = this.subscribers.get(n);
|
|
295
|
-
a && a.forEach((l) => l(r));
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
const pubsub = new PubSub(), AddBlockDropdown = ({ block: o, children: n }) => {
|
|
299
|
-
const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (m) => c ? get(m, "_parent") === c : !get(m, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (m) => {
|
|
300
|
-
if (m === "CHILD")
|
|
301
|
-
pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
|
|
302
|
-
else {
|
|
303
|
-
const h = { _id: c || "", position: d == null ? void 0 : d.length };
|
|
304
|
-
m === "BEFORE" ? h.position = Math.max(u, 0) : m === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
return l(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
308
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { children: n }),
|
|
309
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "border border-blue-500 bg-primary text-white shadow-2xl", children: [
|
|
310
|
-
p && /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("CHILD"), children: r("Add inside") }),
|
|
311
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("BEFORE"), children: r("Add before") }),
|
|
312
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("AFTER"), children: r("Add after") })
|
|
313
|
-
] })
|
|
314
|
-
] }) : null;
|
|
315
|
-
}, draggedBlockAtom = atom(null);
|
|
316
|
-
atom(null);
|
|
317
|
-
function getOrientation(o, n = null) {
|
|
318
|
-
const r = window.getComputedStyle(o), a = n ? window.getComputedStyle(n) : null, l = r.display, i = a ? a.display : null;
|
|
319
|
-
if (l === "flex" || l === "inline-flex") {
|
|
320
|
-
const c = r.flexDirection;
|
|
321
|
-
return c === "column" || c === "column-reverse" ? "vertical" : "horizontal";
|
|
322
|
-
} else if (l === "grid") {
|
|
323
|
-
const c = r.gridAutoFlow, d = r.gridTemplateColumns;
|
|
324
|
-
return c.includes("column") || d && d !== "none" && d !== "" && !d.includes("calc") && // Handle calc expressions
|
|
325
|
-
d.split(" ").length <= 1 ? "vertical" : "horizontal";
|
|
326
|
-
} else if (i === "inline-block" || i === "inline")
|
|
327
|
-
return "horizontal";
|
|
328
|
-
return "vertical";
|
|
329
|
-
}
|
|
330
|
-
let doc, win;
|
|
331
|
-
typeof document < "u" && (doc = document);
|
|
332
|
-
typeof window < "u" && (win = window);
|
|
333
|
-
const FrameContext = React__default.createContext({ document: doc, window: win }), useFrame = () => React__default.useContext(FrameContext), { Provider: FrameContextProvider, Consumer: FrameContextConsumer } = FrameContext;
|
|
334
221
|
function insertBlocksAtPosition(o, n, r, a) {
|
|
335
222
|
const l = [...n];
|
|
336
223
|
let i = [...o];
|
|
@@ -843,8 +730,8 @@ const undoRedoStateAtom = atom({
|
|
|
843
730
|
const C = map(f, (j) => {
|
|
844
731
|
const B = n.find((I) => I._id === j)._parent || null, k = n.filter((I) => B ? I._parent === B : !I._parent).map((I) => I._id).indexOf(j);
|
|
845
732
|
return { _id: j, oldParent: B, oldPosition: k };
|
|
846
|
-
}),
|
|
847
|
-
|
|
733
|
+
}), S = C.find(({ _id: j }) => j === f[0]);
|
|
734
|
+
S && S.oldParent === b && S.oldPosition === y || (i(f, b, y), o({
|
|
848
735
|
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition: B }) => {
|
|
849
736
|
i([j], _, B);
|
|
850
737
|
}),
|
|
@@ -858,8 +745,8 @@ const undoRedoStateAtom = atom({
|
|
|
858
745
|
});
|
|
859
746
|
},
|
|
860
747
|
removeBlocks: (f) => {
|
|
861
|
-
var
|
|
862
|
-
const b = (
|
|
748
|
+
var S;
|
|
749
|
+
const b = (S = first(f)) == null ? void 0 : S._parent, C = n.filter((j) => b ? j._parent === b : !j._parent).indexOf(first(f));
|
|
863
750
|
l(map(f, "_id")), o({
|
|
864
751
|
undo: () => a(f, b, C),
|
|
865
752
|
redo: () => l(map(f, "_id"))
|
|
@@ -868,17 +755,17 @@ const undoRedoStateAtom = atom({
|
|
|
868
755
|
updateBlocks: (f, b, y) => {
|
|
869
756
|
let C = [];
|
|
870
757
|
if (y)
|
|
871
|
-
C = map(f, (
|
|
758
|
+
C = map(f, (S) => ({ _id: S, ...y }));
|
|
872
759
|
else {
|
|
873
|
-
const
|
|
760
|
+
const S = keys(b);
|
|
874
761
|
C = map(f, (j) => {
|
|
875
|
-
const _ = n.find((
|
|
876
|
-
return each(
|
|
762
|
+
const _ = n.find((v) => v._id === j), B = { _id: j };
|
|
763
|
+
return each(S, (v) => B[v] = _[v]), B;
|
|
877
764
|
});
|
|
878
765
|
}
|
|
879
|
-
c(map(f, (
|
|
766
|
+
c(map(f, (S) => ({ _id: S, ...b }))), o({
|
|
880
767
|
undo: () => c(C),
|
|
881
|
-
redo: () => c(map(f, (
|
|
768
|
+
redo: () => c(map(f, (S) => ({ _id: S, ...b })))
|
|
882
769
|
});
|
|
883
770
|
},
|
|
884
771
|
updateBlocksRuntime: (f, b) => {
|
|
@@ -893,15 +780,44 @@ const undoRedoStateAtom = atom({
|
|
|
893
780
|
updateMultipleBlocksProps: (f) => {
|
|
894
781
|
let b = [];
|
|
895
782
|
b = map(f, (y) => {
|
|
896
|
-
const C = keys(y),
|
|
897
|
-
return each(C, (_) => j[_] =
|
|
783
|
+
const C = keys(y), S = n.find((_) => _._id === y._id), j = {};
|
|
784
|
+
return each(C, (_) => j[_] = S[_]), j;
|
|
898
785
|
}), c(f), o({
|
|
899
786
|
undo: () => c(b),
|
|
900
787
|
redo: () => c(f)
|
|
901
788
|
});
|
|
902
789
|
}
|
|
903
790
|
};
|
|
904
|
-
},
|
|
791
|
+
}, canAcceptChildBlock = (o, n) => {
|
|
792
|
+
if (!o) return !0;
|
|
793
|
+
const r = getRegisteredChaiBlock(o);
|
|
794
|
+
return r && has(r, "canAcceptBlock") ? r.canAcceptBlock(n) : !1;
|
|
795
|
+
}, canAddChildBlock = (o) => {
|
|
796
|
+
const n = getRegisteredChaiBlock(o);
|
|
797
|
+
return n ? has(n, "canAcceptBlock") : !1;
|
|
798
|
+
}, canBeNestedInside = (o, n) => {
|
|
799
|
+
const r = getRegisteredChaiBlock(n);
|
|
800
|
+
return r && has(r, "canBeNested") ? r.canBeNested(o) : !0;
|
|
801
|
+
}, canDuplicateBlock = (o) => {
|
|
802
|
+
const n = getRegisteredChaiBlock(o);
|
|
803
|
+
return n && has(n, "canDuplicate") ? n.canDuplicate() : !0;
|
|
804
|
+
}, canDeleteBlock = (o) => {
|
|
805
|
+
const n = getRegisteredChaiBlock(o);
|
|
806
|
+
return n && has(n, "canDelete") ? n.canDelete() : !0;
|
|
807
|
+
}, canDropBlock = (o, { dragSource: n, dropTarget: r }) => {
|
|
808
|
+
const a = get(n, "data._type", ""), l = get(r, "data._type", "");
|
|
809
|
+
return canAcceptChildBlock(l, a);
|
|
810
|
+
};
|
|
811
|
+
import.meta.vitest && describe("canDropBlock Function", () => {
|
|
812
|
+
it('should return false if dragSourceType is "Slot"', () => {
|
|
813
|
+
const o = { data: { _type: "Slot" } }, n = { data: {} };
|
|
814
|
+
expect(canDropBlock({}, { dragSource: o, dropTarget: n })).toBe(!0);
|
|
815
|
+
}), it("should return true if dropTargetType is empty", () => {
|
|
816
|
+
const o = { data: { _type: "Box" } }, n = { data: {} };
|
|
817
|
+
expect(canDropBlock({}, { dragSource: o, dropTarget: n })).toBe(!0);
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
const useAddBlock = () => {
|
|
905
821
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
906
822
|
(i, c, d) => {
|
|
907
823
|
var h;
|
|
@@ -2368,8 +2284,8 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2368
2284
|
for (const b in f) {
|
|
2369
2285
|
const y = f[b];
|
|
2370
2286
|
if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
|
|
2371
|
-
const { baseClasses: C, classes:
|
|
2372
|
-
f[b] = compact(flattenDeep([C,
|
|
2287
|
+
const { baseClasses: C, classes: S } = getSplitChaiClasses(y);
|
|
2288
|
+
f[b] = compact(flattenDeep([C, S])).join(" ");
|
|
2373
2289
|
} else
|
|
2374
2290
|
b !== "_id" && delete f[b];
|
|
2375
2291
|
}
|
|
@@ -2381,18 +2297,18 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2381
2297
|
if (l) {
|
|
2382
2298
|
n(!0), a(null);
|
|
2383
2299
|
try {
|
|
2384
|
-
const y = p === u ? "" : p, C = f.toLowerCase().includes("translate the content"),
|
|
2300
|
+
const y = p === u ? "" : p, C = f.toLowerCase().includes("translate the content"), S = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p, C) : [m(x, d)], j = await l(h, addLangToPrompt(f, g, h), S, y), { blocks: _, error: B } = j;
|
|
2385
2301
|
if (B) {
|
|
2386
2302
|
a(B);
|
|
2387
2303
|
return;
|
|
2388
2304
|
}
|
|
2389
2305
|
if (h === "styles") {
|
|
2390
|
-
const
|
|
2306
|
+
const v = _.map((k) => {
|
|
2391
2307
|
for (const I in k)
|
|
2392
2308
|
I !== "_id" && (k[I] = `${STYLES_KEY},${k[I]}`);
|
|
2393
2309
|
return k;
|
|
2394
2310
|
});
|
|
2395
|
-
c(
|
|
2311
|
+
c(v);
|
|
2396
2312
|
} else
|
|
2397
2313
|
i(_);
|
|
2398
2314
|
b && b(j);
|
|
@@ -2957,7 +2873,105 @@ const useInlineEditing = () => {
|
|
|
2957
2873
|
);
|
|
2958
2874
|
}, useSelectedLibrary = () => useAtom$1(selectedLibraryAtom), sidebarActivePanelAtom = atom("outline");
|
|
2959
2875
|
sidebarActivePanelAtom.debugLabel = "sidebarActivePanelAtom";
|
|
2960
|
-
const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom),
|
|
2876
|
+
const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), ScalePercent = () => {
|
|
2877
|
+
const [o] = useCanvasZoom();
|
|
2878
|
+
return /* @__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: [
|
|
2879
|
+
/* @__PURE__ */ jsx(ZoomInIcon, { className: "h-3.5 w-3.5 flex-shrink-0" }),
|
|
2880
|
+
" ",
|
|
2881
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs leading-3", children: [
|
|
2882
|
+
round(o, 0),
|
|
2883
|
+
"%"
|
|
2884
|
+
] })
|
|
2885
|
+
] });
|
|
2886
|
+
}, Breadcrumb = () => {
|
|
2887
|
+
const o = useSelectedBlockHierarchy(), [, n] = useSelectedBlockIds(), { highlightBlock: r } = useBlockHighlight();
|
|
2888
|
+
return /* @__PURE__ */ jsxs("div", { className: "-mx-2 flex items-center justify-between border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: [
|
|
2889
|
+
/* @__PURE__ */ jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
|
|
2890
|
+
/* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
2891
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
|
|
2892
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 rtl:rotate-180" })
|
|
2893
|
+
] }),
|
|
2894
|
+
reverse(o).map((a, l) => /* @__PURE__ */ jsxs("li", { className: "inline-flex items-center", children: [
|
|
2895
|
+
/* @__PURE__ */ jsxs(
|
|
2896
|
+
Button,
|
|
2897
|
+
{
|
|
2898
|
+
onMouseEnter: () => {
|
|
2899
|
+
r(a == null ? void 0 : a._id);
|
|
2900
|
+
},
|
|
2901
|
+
onClick: () => n([a == null ? void 0 : a._id]),
|
|
2902
|
+
variant: "ghost",
|
|
2903
|
+
className: "h-fit gap-x-1 p-1 text-xs font-normal",
|
|
2904
|
+
children: [
|
|
2905
|
+
/* @__PURE__ */ jsx(TypeIcon, { type: a == null ? void 0 : a._type }),
|
|
2906
|
+
a._name || a._type
|
|
2907
|
+
]
|
|
2908
|
+
}
|
|
2909
|
+
),
|
|
2910
|
+
l !== o.length - 1 && /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 rtl:rotate-180" })
|
|
2911
|
+
] }, l))
|
|
2912
|
+
] }),
|
|
2913
|
+
/* @__PURE__ */ jsx("div", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx(ScalePercent, {}) })
|
|
2914
|
+
] });
|
|
2915
|
+
}, CHAI_BUILDER_EVENTS = {
|
|
2916
|
+
OPEN_ADD_BLOCK: "OPEN_ADD_BLOCK",
|
|
2917
|
+
CLOSE_ADD_BLOCK: "CLOSE_ADD_BLOCK",
|
|
2918
|
+
SHOW_BLOCK_SETTINGS: "SHOW_BLOCK_SETTINGS",
|
|
2919
|
+
//CANVAS Events
|
|
2920
|
+
CLEAR_CANVAS_SELECTION: "CLEAR_CANVAS_SELECTION",
|
|
2921
|
+
CANVAS_BLOCK_SELECTED: "CANVAS_BLOCK_SELECTED",
|
|
2922
|
+
CANVAS_BLOCK_STYLE_SELECTED: "CANVAS_BLOCK_STYLE_SELECTED"
|
|
2923
|
+
};
|
|
2924
|
+
class PubSub {
|
|
2925
|
+
constructor() {
|
|
2926
|
+
F(this, "subscribers", /* @__PURE__ */ new Map());
|
|
2927
|
+
}
|
|
2928
|
+
subscribe(n, r) {
|
|
2929
|
+
return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(r), () => {
|
|
2930
|
+
const a = this.subscribers.get(n);
|
|
2931
|
+
a && (a.delete(r), a.size === 0 && this.subscribers.delete(n));
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
publish(n, r) {
|
|
2935
|
+
const a = this.subscribers.get(n);
|
|
2936
|
+
a && a.forEach((l) => l(r));
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
const pubsub = new PubSub(), AddBlockDropdown = ({ block: o, children: n }) => {
|
|
2940
|
+
const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (m) => c ? get(m, "_parent") === c : !get(m, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (m) => {
|
|
2941
|
+
if (m === "CHILD")
|
|
2942
|
+
pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
|
|
2943
|
+
else {
|
|
2944
|
+
const h = { _id: c || "", position: d == null ? void 0 : d.length };
|
|
2945
|
+
m === "BEFORE" ? h.position = Math.max(u, 0) : m === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
|
|
2946
|
+
}
|
|
2947
|
+
};
|
|
2948
|
+
return l(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2949
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { children: n }),
|
|
2950
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "border border-blue-500 bg-primary text-white shadow-2xl", children: [
|
|
2951
|
+
p && /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("CHILD"), children: r("Add inside") }),
|
|
2952
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("BEFORE"), children: r("Add before") }),
|
|
2953
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("AFTER"), children: r("Add after") })
|
|
2954
|
+
] })
|
|
2955
|
+
] }) : null;
|
|
2956
|
+
}, draggedBlockAtom = atom(null);
|
|
2957
|
+
atom(null);
|
|
2958
|
+
function getOrientation(o, n = null) {
|
|
2959
|
+
const r = window.getComputedStyle(o), a = n ? window.getComputedStyle(n) : null, l = r.display, i = a ? a.display : null;
|
|
2960
|
+
if (l === "flex" || l === "inline-flex") {
|
|
2961
|
+
const c = r.flexDirection;
|
|
2962
|
+
return c === "column" || c === "column-reverse" ? "vertical" : "horizontal";
|
|
2963
|
+
} else if (l === "grid") {
|
|
2964
|
+
const c = r.gridAutoFlow, d = r.gridTemplateColumns;
|
|
2965
|
+
return c.includes("column") || d && d !== "none" && d !== "" && !d.includes("calc") && // Handle calc expressions
|
|
2966
|
+
d.split(" ").length <= 1 ? "vertical" : "horizontal";
|
|
2967
|
+
} else if (i === "inline-block" || i === "inline")
|
|
2968
|
+
return "horizontal";
|
|
2969
|
+
return "vertical";
|
|
2970
|
+
}
|
|
2971
|
+
let doc, win;
|
|
2972
|
+
typeof document < "u" && (doc = document);
|
|
2973
|
+
typeof window < "u" && (win = window);
|
|
2974
|
+
const FrameContext = React__default.createContext({ document: doc, window: win }), useFrame = () => React__default.useContext(FrameContext), { Provider: FrameContextProvider, Consumer: FrameContextConsumer } = FrameContext, CONTROLS = [
|
|
2961
2975
|
{ ControlIcon: PinTopIcon, dir: "VERTICAL", key: "UP" },
|
|
2962
2976
|
{ ControlIcon: PinBottomIcon, dir: "VERTICAL", key: "DOWN" },
|
|
2963
2977
|
{ ControlIcon: PinLeftIcon, dir: "HORIZONTAL", key: "LEFT" },
|
|
@@ -2995,19 +3009,18 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
|
|
|
2995
3009
|
o,
|
|
2996
3010
|
n
|
|
2997
3011
|
);
|
|
2998
|
-
return r ? null : /* @__PURE__ */ jsx(Fragment, { children: CONTROLS.map(({ ControlIcon: d, dir: p, key: u }) =>
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
};
|
|
3012
|
+
return r ? null : /* @__PURE__ */ jsx(Fragment, { children: CONTROLS.map(({ ControlIcon: d, dir: p, key: u }) => c !== p || isDisabledControl(a, l, u) ? null : /* @__PURE__ */ jsx(
|
|
3013
|
+
d,
|
|
3014
|
+
{
|
|
3015
|
+
onClick: () => i(u),
|
|
3016
|
+
className: "rounded p-px hover:bg-white hover:text-blue-500"
|
|
3017
|
+
},
|
|
3018
|
+
u
|
|
3019
|
+
)) });
|
|
3020
|
+
}, AiIcon = ({
|
|
3021
|
+
className: o = "h-full w-full",
|
|
3022
|
+
onClick: n = noop$1
|
|
3023
|
+
}) => /* @__PURE__ */ jsx("svg", { className: o, viewBox: "0 0 256 256", fill: "currentColor", onClick: n, children: /* @__PURE__ */ jsx("path", { d: "m198.39 128.986-52.16-19.216-19.216-52.16a16 16 0 0 0-30.028 0L77.77 109.77l-52.16 19.216a16 16 0 0 0 0 30.028l52.16 19.216 19.216 52.16a16 16 0 0 0 30.028 0l19.216-52.16 52.16-19.216a16 16 0 0 0 0-30.028m-57.69 34.23a15.97 15.97 0 0 0-9.483 9.483l-19.22 52.152-19.214-52.15a15.97 15.97 0 0 0-9.482-9.484l-52.152-19.22 52.15-19.214a15.97 15.97 0 0 0 9.484-9.482l19.22-52.152 19.214 52.15a15.97 15.97 0 0 0 9.482 9.484l52.152 19.22ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8" }) });
|
|
3011
3024
|
function getTargetedBlock(o) {
|
|
3012
3025
|
if (o.getAttribute("data-block-id") === "canvas")
|
|
3013
3026
|
return null;
|
|
@@ -3093,21 +3106,18 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3093
3106
|
}
|
|
3094
3107
|
);
|
|
3095
3108
|
}, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), BlockActionLabel = ({ block: o, label: n }) => {
|
|
3096
|
-
const [, r] = useSelectedBlockIds(), [, a] = useHighlightBlockId(), [, l] = useAtom$1(draggedBlockAtom)
|
|
3097
|
-
return /* @__PURE__ */
|
|
3109
|
+
const [, r] = useSelectedBlockIds(), [, a] = useHighlightBlockId(), [, l] = useAtom$1(draggedBlockAtom);
|
|
3110
|
+
return /* @__PURE__ */ jsx(
|
|
3098
3111
|
"div",
|
|
3099
3112
|
{
|
|
3100
3113
|
className: "mr-10 flex cursor-default items-center space-x-1 px-1",
|
|
3101
|
-
draggable:
|
|
3102
|
-
onDragStart: (
|
|
3103
|
-
|
|
3114
|
+
draggable: "false",
|
|
3115
|
+
onDragStart: (i) => {
|
|
3116
|
+
i.dataTransfer.setData("text/plain", JSON.stringify(pick(o, ["_id", "_type", "_name"]))), l(o), setTimeout(() => {
|
|
3104
3117
|
r([]), a(null);
|
|
3105
3118
|
}, 200);
|
|
3106
3119
|
},
|
|
3107
|
-
children:
|
|
3108
|
-
/* @__PURE__ */ jsx(DragHandleDots2Icon, {}),
|
|
3109
|
-
n
|
|
3110
|
-
]
|
|
3120
|
+
children: n
|
|
3111
3121
|
}
|
|
3112
3122
|
);
|
|
3113
3123
|
}, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), BlockSelectionHighlighter = () => {
|
|
@@ -3146,10 +3156,10 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3146
3156
|
}),
|
|
3147
3157
|
size({
|
|
3148
3158
|
boundary: u == null ? void 0 : u.body,
|
|
3149
|
-
apply({ availableWidth:
|
|
3150
|
-
Object.assign(
|
|
3151
|
-
maxWidth: `${Math.max(200,
|
|
3152
|
-
maxHeight: `${Math.max(100,
|
|
3159
|
+
apply({ availableWidth: y, availableHeight: C, elements: S }) {
|
|
3160
|
+
Object.assign(S.floating.style, {
|
|
3161
|
+
maxWidth: `${Math.max(200, y)}px`,
|
|
3162
|
+
maxHeight: `${Math.max(100, C)}px`
|
|
3153
3163
|
});
|
|
3154
3164
|
}
|
|
3155
3165
|
})
|
|
@@ -3158,42 +3168,63 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
|
|
|
3158
3168
|
});
|
|
3159
3169
|
useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
|
|
3160
3170
|
const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
3161
|
-
|
|
3171
|
+
useEffect(() => {
|
|
3162
3172
|
if (n) {
|
|
3163
|
-
const
|
|
3164
|
-
return () => clearTimeout(
|
|
3173
|
+
const y = setTimeout(() => h(), 500);
|
|
3174
|
+
return () => clearTimeout(y);
|
|
3165
3175
|
} else
|
|
3166
3176
|
h();
|
|
3167
|
-
}, [n])
|
|
3177
|
+
}, [n]);
|
|
3178
|
+
const [, b] = useSidebarActivePanel();
|
|
3179
|
+
return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
3168
3180
|
"div",
|
|
3169
3181
|
{
|
|
3170
3182
|
role: "button",
|
|
3171
3183
|
tabIndex: 0,
|
|
3172
3184
|
ref: m.setFloating,
|
|
3173
3185
|
style: g,
|
|
3174
|
-
onClick: (
|
|
3175
|
-
|
|
3186
|
+
onClick: (y) => {
|
|
3187
|
+
y.stopPropagation(), y.preventDefault();
|
|
3176
3188
|
},
|
|
3177
|
-
onMouseEnter: (
|
|
3178
|
-
|
|
3189
|
+
onMouseEnter: (y) => {
|
|
3190
|
+
y.stopPropagation(), i(null);
|
|
3179
3191
|
},
|
|
3180
|
-
onKeyDown: (
|
|
3192
|
+
onKeyDown: (y) => y.stopPropagation(),
|
|
3181
3193
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3182
3194
|
children: [
|
|
3183
3195
|
x && /* @__PURE__ */ jsx(
|
|
3184
3196
|
ArrowUpIcon,
|
|
3185
3197
|
{
|
|
3186
|
-
className: "hover:
|
|
3198
|
+
className: "rounded p-0.5 hover:bg-white/20",
|
|
3187
3199
|
onClick: () => {
|
|
3188
3200
|
c([]), l([x]);
|
|
3189
3201
|
}
|
|
3190
3202
|
}
|
|
3191
3203
|
),
|
|
3192
3204
|
/* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
|
|
3193
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3205
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pl-1 pr-1.5", children: [
|
|
3206
|
+
d(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
|
|
3207
|
+
AiIcon,
|
|
3208
|
+
{
|
|
3209
|
+
className: "h-4 w-4 rounded hover:bg-white hover:text-blue-500",
|
|
3210
|
+
onClick: () => b("chai-chat-panel")
|
|
3211
|
+
}
|
|
3212
|
+
),
|
|
3213
|
+
/* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4 rounded p-px hover:bg-white hover:text-blue-500" }) }),
|
|
3214
|
+
canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(
|
|
3215
|
+
CopyIcon,
|
|
3216
|
+
{
|
|
3217
|
+
className: "h-4 w-4 rounded p-px hover:bg-white hover:text-blue-500",
|
|
3218
|
+
onClick: () => a([o == null ? void 0 : o._id])
|
|
3219
|
+
}
|
|
3220
|
+
) : null,
|
|
3221
|
+
canDeleteBlock(get(o, "_type", "")) && d(PERMISSIONS.DELETE_BLOCK) ? /* @__PURE__ */ jsx(
|
|
3222
|
+
TrashIcon,
|
|
3223
|
+
{
|
|
3224
|
+
className: "h-4 w-4 rounded p-px hover:bg-white hover:text-blue-500",
|
|
3225
|
+
onClick: () => r([o == null ? void 0 : o._id])
|
|
3226
|
+
}
|
|
3227
|
+
) : null,
|
|
3197
3228
|
d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: h })
|
|
3198
3229
|
] })
|
|
3199
3230
|
]
|
|
@@ -3433,7 +3464,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3433
3464
|
role: "button",
|
|
3434
3465
|
onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK),
|
|
3435
3466
|
className: "block h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
|
|
3436
|
-
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2
|
|
3467
|
+
children: /* @__PURE__ */ jsxs("div", { className: "absolute left-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: [
|
|
3437
3468
|
/* @__PURE__ */ jsx(PlusIcon, { className: "size-2.5 stroke-[3]" }),
|
|
3438
3469
|
" ",
|
|
3439
3470
|
o("Add block")
|
|
@@ -3621,12 +3652,12 @@ const RteDropdownMenu = ({
|
|
|
3621
3652
|
}) => {
|
|
3622
3653
|
const { document: i } = useFrame(), [c, d] = useState({ left: void 0, right: void 0, top: void 0, bottom: void 0 }), [p, u] = useState(!1), g = useRef(null);
|
|
3623
3654
|
if (useEffect(() => {
|
|
3624
|
-
var C,
|
|
3655
|
+
var C, S;
|
|
3625
3656
|
if (!p) {
|
|
3626
3657
|
d({ left: void 0, right: void 0, top: void 0, bottom: void 0 });
|
|
3627
3658
|
return;
|
|
3628
3659
|
}
|
|
3629
|
-
const m = (C = g.current) == null ? void 0 : C.getBoundingClientRect(), h = (
|
|
3660
|
+
const m = (C = g.current) == null ? void 0 : C.getBoundingClientRect(), h = (S = l.current) == null ? void 0 : S.getBoundingClientRect();
|
|
3630
3661
|
let x = m == null ? void 0 : m.left, f = (m == null ? void 0 : m.bottom) + 4, b, y;
|
|
3631
3662
|
(h == null ? void 0 : h.left) + (h == null ? void 0 : h.width) + 50 >= i.body.offsetWidth && (x = void 0, b = i.body.offsetWidth - (m == null ? void 0 : m.right)), f + 202 >= i.body.clientHeight && (f = null, y = i.body.clientHeight - (m == null ? void 0 : m.bottom) + (h == null ? void 0 : h.height)), d({ left: x, top: f, right: b, bottom: y });
|
|
3632
3663
|
}, [p]), a === "canvas") {
|
|
@@ -3776,8 +3807,8 @@ const getActiveClasses$1 = (o, n, r) => {
|
|
|
3776
3807
|
)
|
|
3777
3808
|
] });
|
|
3778
3809
|
}, RteColorPicker = ({ editor: o, from: n, menuRef: r }) => {
|
|
3779
|
-
var
|
|
3780
|
-
const a = (
|
|
3810
|
+
var S, j;
|
|
3811
|
+
const a = (S = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : S.color, l = (j = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : j.color, [i, c] = useState(a || "#000000F2"), [d, p] = useState(l || "#00000057"), [u, g] = useDebouncedState(i, 150), [m, h] = useDebouncedState(d, 150), x = (_, B) => {
|
|
3781
3812
|
B ? (c(_), g(_)) : (o == null || o.chain().setColor(_).run(), c(_));
|
|
3782
3813
|
}, f = (_, B) => {
|
|
3783
3814
|
B ? (p(_), h(_)) : (o == null || o.chain().setHighlight({ color: _ }).run(), p(_));
|
|
@@ -4088,8 +4119,8 @@ const RichTextEditor = memo(
|
|
|
4088
4119
|
placeholder: "Enter text here",
|
|
4089
4120
|
onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
|
|
4090
4121
|
onBlur: ({ editor: u, event: g }) => {
|
|
4091
|
-
const m = g == null ? void 0 : g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(m), y = x == null ? void 0 : x.contains(m), C = f == null ? void 0 : f.contains(m),
|
|
4092
|
-
if (!b && !y && !C && !
|
|
4122
|
+
const m = g == null ? void 0 : g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(m), y = x == null ? void 0 : x.contains(m), C = f == null ? void 0 : f.contains(m), S = window.document.getElementById("rte-widget-color-picker");
|
|
4123
|
+
if (!b && !y && !C && !S) {
|
|
4093
4124
|
const j = (u == null ? void 0 : u.getHTML()) || "";
|
|
4094
4125
|
r(j);
|
|
4095
4126
|
}
|
|
@@ -4182,7 +4213,7 @@ const RichTextEditor = memo(
|
|
|
4182
4213
|
}
|
|
4183
4214
|
), WithBlockTextEditor = memo(
|
|
4184
4215
|
({ block: o, children: n }) => {
|
|
4185
|
-
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: x } = useLanguages(), [, f] = useSelectedBlockIds(), b = useRef(null), y = l, { blockContent: C, blockType:
|
|
4216
|
+
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: x } = useLanguages(), [, f] = useSelectedBlockIds(), b = useRef(null), y = l, { blockContent: C, blockType: S } = useMemo(() => {
|
|
4186
4217
|
var E;
|
|
4187
4218
|
const k = o._type;
|
|
4188
4219
|
let I = o[r];
|
|
@@ -4215,8 +4246,8 @@ const RichTextEditor = memo(
|
|
|
4215
4246
|
if (!y) return;
|
|
4216
4247
|
const k = `[data-block-id="${y}"]`, I = i >= 0 ? `[data-block-index="${i}"]` : "", A = a.querySelector(`${k}${I}`);
|
|
4217
4248
|
A && ((w = A == null ? void 0 : A.classList) == null || w.add("sr-only"), u(A));
|
|
4218
|
-
}, [y,
|
|
4219
|
-
const
|
|
4249
|
+
}, [y, S, a, i]);
|
|
4250
|
+
const v = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(S) ? /* @__PURE__ */ jsx(
|
|
4220
4251
|
RichTextEditor,
|
|
4221
4252
|
{
|
|
4222
4253
|
blockContent: C,
|
|
@@ -4235,9 +4266,9 @@ const RichTextEditor = memo(
|
|
|
4235
4266
|
onChange: _,
|
|
4236
4267
|
onEscape: B
|
|
4237
4268
|
}
|
|
4238
|
-
)) : null, [p, y,
|
|
4269
|
+
)) : null, [p, y, S, C, j, x]);
|
|
4239
4270
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4240
|
-
|
|
4271
|
+
v,
|
|
4241
4272
|
n
|
|
4242
4273
|
] });
|
|
4243
4274
|
},
|
|
@@ -4279,7 +4310,7 @@ const RichTextEditor = memo(
|
|
|
4279
4310
|
), y = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), C = useMemo(
|
|
4280
4311
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
4281
4312
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
4282
|
-
),
|
|
4313
|
+
), S = useMemo(
|
|
4283
4314
|
() => ({
|
|
4284
4315
|
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
|
|
4285
4316
|
inBuilder: !0,
|
|
@@ -4302,7 +4333,7 @@ const RichTextEditor = memo(
|
|
|
4302
4333
|
), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), _ = useMemo(() => get(i, "_show", !0), [i]);
|
|
4303
4334
|
if (isNull(h) || !_) return null;
|
|
4304
4335
|
let B = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
|
|
4305
|
-
...
|
|
4336
|
+
...S,
|
|
4306
4337
|
children: r({
|
|
4307
4338
|
_id: i._id,
|
|
4308
4339
|
_type: i._type,
|
|
@@ -4314,8 +4345,8 @@ const RichTextEditor = memo(
|
|
|
4314
4345
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
4315
4346
|
})
|
|
4316
4347
|
}) });
|
|
4317
|
-
const
|
|
4318
|
-
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children:
|
|
4348
|
+
const v = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: B }) : B;
|
|
4349
|
+
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: v }) : v;
|
|
4319
4350
|
}, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
|
|
4320
4351
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
4321
4352
|
(d) => {
|
|
@@ -4483,7 +4514,7 @@ const CanvasEventsWatcher = () => {
|
|
|
4483
4514
|
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
4484
4515
|
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
4485
4516
|
] }) });
|
|
4486
|
-
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-
|
|
4517
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-BwCdfuDZ.js")), CanvasArea = () => {
|
|
4487
4518
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
4488
4519
|
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: [
|
|
4489
4520
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -4626,15 +4657,15 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4626
4657
|
if (!o || !c || !/\{\{.*?\}\}/.test(o)) return o;
|
|
4627
4658
|
const j = { ...c, [u]: o }, _ = applyBindingToBlockProps(j, p, { index: -1, key: "" });
|
|
4628
4659
|
return get(_, u, o);
|
|
4629
|
-
}, [o, c, p, u]), f = !!h || x !== PLACEHOLDER_IMAGE, b = (
|
|
4630
|
-
const j = isArray(
|
|
4660
|
+
}, [o, c, p, u]), f = !!h || x !== PLACEHOLDER_IMAGE, b = (S) => {
|
|
4661
|
+
const j = isArray(S) ? first(S) : S;
|
|
4631
4662
|
if (j) {
|
|
4632
4663
|
n(j == null ? void 0 : j.url);
|
|
4633
|
-
const _ = j == null ? void 0 : j.width, B = j == null ? void 0 : j.height,
|
|
4664
|
+
const _ = j == null ? void 0 : j.width, B = j == null ? void 0 : j.height, v = g.includes("mobile");
|
|
4634
4665
|
if (c != null && c._id) {
|
|
4635
4666
|
const k = {
|
|
4636
|
-
..._ && { [
|
|
4637
|
-
...B && { [
|
|
4667
|
+
..._ && { [v ? "mobileWidth" : "width"]: _ },
|
|
4668
|
+
...B && { [v ? "mobileHeight" : "height"]: B },
|
|
4638
4669
|
...j.description && { alt: j.description }
|
|
4639
4670
|
};
|
|
4640
4671
|
if (set(k, g, j.id), isEmpty(k)) return;
|
|
@@ -4643,8 +4674,8 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4643
4674
|
}
|
|
4644
4675
|
}, y = useCallback(() => {
|
|
4645
4676
|
if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
|
|
4646
|
-
const
|
|
4647
|
-
set(
|
|
4677
|
+
const S = {}, j = g.includes("mobile");
|
|
4678
|
+
set(S, g, ""), set(S, j ? "mobileWidth" : "width", ""), set(S, j ? "mobileHeight" : "height", ""), d([c._id], S);
|
|
4648
4679
|
}
|
|
4649
4680
|
}, [n, c == null ? void 0 : c._id, d, g]), C = getFileName(x);
|
|
4650
4681
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
|
|
@@ -4692,8 +4723,8 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4692
4723
|
className: "h-6 text-xs",
|
|
4693
4724
|
placeholder: l("Enter image URL"),
|
|
4694
4725
|
value: o === PLACEHOLDER_IMAGE ? "" : o,
|
|
4695
|
-
onBlur: ({ target: { value:
|
|
4696
|
-
onChange: (
|
|
4726
|
+
onBlur: ({ target: { value: S } }) => a(r, S),
|
|
4727
|
+
onChange: (S) => n(S.target.value)
|
|
4697
4728
|
}
|
|
4698
4729
|
)
|
|
4699
4730
|
] })
|
|
@@ -4809,11 +4840,11 @@ const DataBindingSelector = ({
|
|
|
4809
4840
|
n(`{{${g}}}`, {}, r);
|
|
4810
4841
|
return;
|
|
4811
4842
|
}
|
|
4812
|
-
const h = (y) => /[.,!?;:]/.test(y), x = (y, C,
|
|
4843
|
+
const h = (y) => /[.,!?;:]/.test(y), x = (y, C, S) => {
|
|
4813
4844
|
let j = "", _ = "";
|
|
4814
|
-
const B = C > 0 ? y[C - 1] : "",
|
|
4815
|
-
return C > 0 && (B === "." || !h(B) && B !== " ") && (j = " "), C < y.length && !h(
|
|
4816
|
-
text: j +
|
|
4845
|
+
const B = C > 0 ? y[C - 1] : "", v = C < y.length ? y[C] : "";
|
|
4846
|
+
return C > 0 && (B === "." || !h(B) && B !== " ") && (j = " "), C < y.length && !h(v) && v !== " " && (_ = " "), {
|
|
4847
|
+
text: j + S + _,
|
|
4817
4848
|
prefixLength: j.length,
|
|
4818
4849
|
suffixLength: _.length
|
|
4819
4850
|
};
|
|
@@ -4825,13 +4856,13 @@ const DataBindingSelector = ({
|
|
|
4825
4856
|
if (y) {
|
|
4826
4857
|
const C = `{{${g}}}`;
|
|
4827
4858
|
y.commands.focus();
|
|
4828
|
-
const { from:
|
|
4829
|
-
if (
|
|
4859
|
+
const { from: S, to: j } = y.state.selection;
|
|
4860
|
+
if (S !== j)
|
|
4830
4861
|
y.chain().deleteSelection().insertContent(C).run();
|
|
4831
4862
|
else {
|
|
4832
|
-
const { state: B } = y,
|
|
4863
|
+
const { state: B } = y, v = B.selection.from, k = B.doc.textBetween(Math.max(0, v - 1), v), I = B.doc.textBetween(v, Math.min(v + 1, B.doc.content.size));
|
|
4833
4864
|
let A = "";
|
|
4834
|
-
|
|
4865
|
+
v > 0 && k !== " " && !h(k) && (A = " ");
|
|
4835
4866
|
let w = "";
|
|
4836
4867
|
I && I !== " " && !h(I) && (w = " "), y.chain().insertContent(A + C + w).run();
|
|
4837
4868
|
}
|
|
@@ -4839,13 +4870,13 @@ const DataBindingSelector = ({
|
|
|
4839
4870
|
return;
|
|
4840
4871
|
}
|
|
4841
4872
|
} else {
|
|
4842
|
-
const y = f, C = y.selectionStart || 0,
|
|
4873
|
+
const y = f, C = y.selectionStart || 0, S = y.value || "", j = y.selectionEnd || C;
|
|
4843
4874
|
if (j > C) {
|
|
4844
|
-
const I = `{{${g}}}`, { text: A } = x(
|
|
4875
|
+
const I = `{{${g}}}`, { text: A } = x(S, C, I), w = S.slice(0, C) + A + S.slice(j);
|
|
4845
4876
|
n(w, {}, r);
|
|
4846
4877
|
return;
|
|
4847
4878
|
}
|
|
4848
|
-
const B = `{{${g}}}`, { text:
|
|
4879
|
+
const B = `{{${g}}}`, { text: v } = x(S, C, B), k = S.slice(0, C) + v + S.slice(C);
|
|
4849
4880
|
n(k, {}, r);
|
|
4850
4881
|
}
|
|
4851
4882
|
},
|
|
@@ -4868,7 +4899,7 @@ const DataBindingSelector = ({
|
|
|
4868
4899
|
onChange: r
|
|
4869
4900
|
}) => {
|
|
4870
4901
|
var I;
|
|
4871
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (A, w) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [b, y] = useState(-1), C = useRef(null),
|
|
4902
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (A, w) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [b, y] = useState(-1), C = useRef(null), S = (I = n == null ? void 0 : n.find((A) => A.key === u)) == null ? void 0 : I.name;
|
|
4872
4903
|
useEffect(() => {
|
|
4873
4904
|
if (h(""), f([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4874
4905
|
const A = split(o, ":"), w = get(A, 1, "page") || "page";
|
|
@@ -4905,7 +4936,7 @@ const DataBindingSelector = ({
|
|
|
4905
4936
|
b >= 0 && _(x[b]);
|
|
4906
4937
|
break;
|
|
4907
4938
|
case "Escape":
|
|
4908
|
-
A.preventDefault(),
|
|
4939
|
+
A.preventDefault(), v();
|
|
4909
4940
|
break;
|
|
4910
4941
|
}
|
|
4911
4942
|
};
|
|
@@ -4915,7 +4946,7 @@ const DataBindingSelector = ({
|
|
|
4915
4946
|
A == null || A.scrollIntoView({ block: "nearest" });
|
|
4916
4947
|
}
|
|
4917
4948
|
}, [b]);
|
|
4918
|
-
const
|
|
4949
|
+
const v = () => {
|
|
4919
4950
|
h(""), f([]), y(-1), p(!1), r("");
|
|
4920
4951
|
}, k = (A) => {
|
|
4921
4952
|
h(A), p(!isEmpty(A)), c(!0), j(A);
|
|
@@ -4930,11 +4961,11 @@ const DataBindingSelector = ({
|
|
|
4930
4961
|
value: m,
|
|
4931
4962
|
onChange: (A) => k(A.target.value),
|
|
4932
4963
|
onKeyDown: B,
|
|
4933
|
-
placeholder: a(`Search ${
|
|
4964
|
+
placeholder: a(`Search ${S ?? ""}`),
|
|
4934
4965
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4935
4966
|
}
|
|
4936
4967
|
),
|
|
4937
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick:
|
|
4968
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: v, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
|
|
4938
4969
|
] }),
|
|
4939
4970
|
(i || !isEmpty(x) || d && isEmpty(x)) && /* @__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: [
|
|
4940
4971
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -5053,7 +5084,7 @@ const DataBindingSelector = ({
|
|
|
5053
5084
|
]
|
|
5054
5085
|
}
|
|
5055
5086
|
) });
|
|
5056
|
-
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-
|
|
5087
|
+
}, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DrMYNEN2.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
|
|
5057
5088
|
const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
|
|
5058
5089
|
blockId: o,
|
|
5059
5090
|
value: a,
|
|
@@ -5302,10 +5333,10 @@ const DataBindingSelector = ({
|
|
|
5302
5333
|
const { id: n, classNames: r, label: a, children: l, errors: i, help: c, hidden: d, required: p, schema: u, formData: g, onChange: m } = o, { selectedLang: h, fallbackLang: x, languages: f } = useLanguages(), b = useMemo(
|
|
5303
5334
|
() => isEmpty(f) ? "" : isEmpty(h) ? x : h,
|
|
5304
5335
|
[f, h, x]
|
|
5305
|
-
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(),
|
|
5306
|
-
() => get(j, [
|
|
5307
|
-
[j,
|
|
5308
|
-
), [B,
|
|
5336
|
+
), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), S = useSelectedBlock(), j = useRegisteredChaiBlocks(), _ = useMemo(
|
|
5337
|
+
() => get(j, [S == null ? void 0 : S._type, "i18nProps"], []),
|
|
5338
|
+
[j, S == null ? void 0 : S._type]
|
|
5339
|
+
), [B, v] = useState(null);
|
|
5309
5340
|
if (d)
|
|
5310
5341
|
return null;
|
|
5311
5342
|
if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: l });
|
|
@@ -5317,7 +5348,7 @@ const DataBindingSelector = ({
|
|
|
5317
5348
|
"label",
|
|
5318
5349
|
{
|
|
5319
5350
|
htmlFor: n,
|
|
5320
|
-
onClick: () =>
|
|
5351
|
+
onClick: () => v(E ? null : n),
|
|
5321
5352
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
5322
5353
|
children: [
|
|
5323
5354
|
E ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
@@ -5504,36 +5535,36 @@ const DataBindingSelector = ({
|
|
|
5504
5535
|
}), a;
|
|
5505
5536
|
};
|
|
5506
5537
|
function BlockSettings() {
|
|
5507
|
-
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), x = ({ formData: B },
|
|
5508
|
-
|
|
5538
|
+
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), x = ({ formData: B }, v, k) => {
|
|
5539
|
+
v && (c == null ? void 0 : c._id) === n._id && a([n._id], { [v]: get(B, v) }, k);
|
|
5509
5540
|
}, f = useCallback(
|
|
5510
|
-
debounce(({ formData: B },
|
|
5511
|
-
x({ formData: B },
|
|
5541
|
+
debounce(({ formData: B }, v, k) => {
|
|
5542
|
+
x({ formData: B }, v, k), d(B);
|
|
5512
5543
|
}, 1500),
|
|
5513
5544
|
[n == null ? void 0 : n._id, o]
|
|
5514
|
-
), b = ({ formData: B },
|
|
5515
|
-
|
|
5516
|
-
}, y = ({ formData: B },
|
|
5517
|
-
|
|
5518
|
-
}, { schema: C, uiSchema:
|
|
5545
|
+
), b = ({ formData: B }, v) => {
|
|
5546
|
+
v && (r([n._id], { [v]: get(B, v) }), f({ formData: B }, v, { [v]: get(c, v) }));
|
|
5547
|
+
}, y = ({ formData: B }, v) => {
|
|
5548
|
+
v && (r([g._id], { [v]: get(B, v) }), f({ formData: B }, v, { [v]: get(c, v) }));
|
|
5549
|
+
}, { schema: C, uiSchema: S } = useMemo(() => {
|
|
5519
5550
|
const B = n == null ? void 0 : n._type;
|
|
5520
5551
|
if (!B)
|
|
5521
5552
|
return { schema: {}, uiSchema: {} };
|
|
5522
5553
|
try {
|
|
5523
|
-
const { schema:
|
|
5554
|
+
const { schema: v, uiSchema: k } = getBlockFormSchemas(B);
|
|
5524
5555
|
if (B === "Repeater") {
|
|
5525
5556
|
const I = get(n, "repeaterItems", "");
|
|
5526
5557
|
startsWith(I, `{{${COLLECTION_PREFIX}`) ? (set(k, "filter", { "ui:widget": "collectionSelect" }), set(k, "sort", { "ui:widget": "collectionSelect" })) : (set(k, "filter", { "ui:widget": "hidden" }), set(k, "sort", { "ui:widget": "hidden" }));
|
|
5527
5558
|
}
|
|
5528
|
-
return { schema:
|
|
5559
|
+
return { schema: v, uiSchema: k };
|
|
5529
5560
|
} catch {
|
|
5530
5561
|
return { schema: {}, uiSchema: {} };
|
|
5531
5562
|
}
|
|
5532
5563
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: _ } = useMemo(() => {
|
|
5533
5564
|
if (!g || !(g != null && g._type))
|
|
5534
5565
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5535
|
-
const B = g == null ? void 0 : g._type, { schema:
|
|
5536
|
-
return { wrapperSchema:
|
|
5566
|
+
const B = g == null ? void 0 : g._type, { schema: v = {}, uiSchema: k = {} } = getBlockFormSchemas(B);
|
|
5567
|
+
return { wrapperSchema: v, wrapperUiSchema: k };
|
|
5537
5568
|
}, [g]);
|
|
5538
5569
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5539
5570
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
@@ -5573,7 +5604,7 @@ function BlockSettings() {
|
|
|
5573
5604
|
onChange: b,
|
|
5574
5605
|
formData: i,
|
|
5575
5606
|
schema: C,
|
|
5576
|
-
uiSchema:
|
|
5607
|
+
uiSchema: S
|
|
5577
5608
|
}
|
|
5578
5609
|
)
|
|
5579
5610
|
] });
|
|
@@ -5784,7 +5815,7 @@ const BlockStylingProps = () => {
|
|
|
5784
5815
|
},
|
|
5785
5816
|
a
|
|
5786
5817
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5787
|
-
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]), [x, f] = useState(!1), [b, y] = useState(""), [C,
|
|
5818
|
+
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]), [x, f] = useState(!1), [b, y] = useState(""), [C, S] = useState(!1), [j, _] = useState(!1);
|
|
5788
5819
|
useEffect(() => {
|
|
5789
5820
|
const { value: A, unit: w } = getClassValueAndUnit(i);
|
|
5790
5821
|
if (w === "") {
|
|
@@ -5793,7 +5824,7 @@ const BlockStylingProps = () => {
|
|
|
5793
5824
|
}
|
|
5794
5825
|
h(w), l(w === "class" || isEmpty(A) ? "" : A);
|
|
5795
5826
|
}, [i, p, u]);
|
|
5796
|
-
const B = useThrottledCallback((A) => c(A), [c], THROTTLE_TIME),
|
|
5827
|
+
const B = useThrottledCallback((A) => c(A), [c], THROTTLE_TIME), v = useThrottledCallback((A) => c(A, !1), [c], THROTTLE_TIME), k = useCallback(
|
|
5797
5828
|
(A = !1) => {
|
|
5798
5829
|
const w = getUserInputValues(`${a}`, u);
|
|
5799
5830
|
if (get(w, "error", !1)) {
|
|
@@ -5808,9 +5839,9 @@ const BlockStylingProps = () => {
|
|
|
5808
5839
|
if (get(w, "value") === "")
|
|
5809
5840
|
return;
|
|
5810
5841
|
const T = `${get(w, "value", "").startsWith("-") ? "-" : ""}${d}[${get(w, "value", "").replace("-", "")}${E === "-" ? "" : E}]`;
|
|
5811
|
-
A ?
|
|
5842
|
+
A ? v(T) : B(T);
|
|
5812
5843
|
},
|
|
5813
|
-
[B,
|
|
5844
|
+
[B, v, a, m, d, u]
|
|
5814
5845
|
), I = useCallback(
|
|
5815
5846
|
(A) => {
|
|
5816
5847
|
const w = getUserInputValues(`${a}`, u);
|
|
@@ -5859,7 +5890,7 @@ const BlockStylingProps = () => {
|
|
|
5859
5890
|
let E = isNaN$1(w) ? 0 : w;
|
|
5860
5891
|
A.keyCode === 38 && (E += 1), A.keyCode === 40 && (E -= 1);
|
|
5861
5892
|
const L = `${E}`, P = `${L.startsWith("-") ? "-" : ""}${d}[${L.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5862
|
-
|
|
5893
|
+
v(P);
|
|
5863
5894
|
},
|
|
5864
5895
|
onKeyUp: (A) => {
|
|
5865
5896
|
j && (A.preventDefault(), _(!1));
|
|
@@ -5907,9 +5938,9 @@ const BlockStylingProps = () => {
|
|
|
5907
5938
|
["none", "auto"].indexOf(m) !== -1 || C ? null : /* @__PURE__ */ jsx(
|
|
5908
5939
|
DragStyleButton,
|
|
5909
5940
|
{
|
|
5910
|
-
onDragStart: () =>
|
|
5941
|
+
onDragStart: () => S(!0),
|
|
5911
5942
|
onDragEnd: (A) => {
|
|
5912
|
-
if (y(() => ""),
|
|
5943
|
+
if (y(() => ""), S(!1), isEmpty(A))
|
|
5913
5944
|
return;
|
|
5914
5945
|
const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5915
5946
|
B(L);
|
|
@@ -5919,7 +5950,7 @@ const BlockStylingProps = () => {
|
|
|
5919
5950
|
return;
|
|
5920
5951
|
y(A);
|
|
5921
5952
|
const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5922
|
-
|
|
5953
|
+
v(L);
|
|
5923
5954
|
},
|
|
5924
5955
|
currentValue: a,
|
|
5925
5956
|
unit: m,
|
|
@@ -6383,8 +6414,8 @@ const COLOR_PROP = {
|
|
|
6383
6414
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6384
6415
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6385
6416
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), b = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
|
|
6386
|
-
(
|
|
6387
|
-
const I = { dark: p, mq: g, mod: u, cls:
|
|
6417
|
+
(v, k = !0) => {
|
|
6418
|
+
const I = { dark: p, mq: g, mod: u, cls: v, property: l, fullCls: "" };
|
|
6388
6419
|
(p || u !== "") && (I.mq = "xs");
|
|
6389
6420
|
const A = generateFullClsName(I);
|
|
6390
6421
|
h(f, [A], k);
|
|
@@ -6392,12 +6423,12 @@ const COLOR_PROP = {
|
|
|
6392
6423
|
[f, p, g, u, l, h]
|
|
6393
6424
|
), C = useCallback(() => {
|
|
6394
6425
|
x(f, [b], !0);
|
|
6395
|
-
}, [f, b, x]),
|
|
6426
|
+
}, [f, b, x]), S = useMemo(() => canChangeClass(m, g), [m, g]);
|
|
6396
6427
|
useEffect(() => {
|
|
6397
|
-
i(
|
|
6398
|
-
}, [
|
|
6428
|
+
i(S, m);
|
|
6429
|
+
}, [S, i, m]);
|
|
6399
6430
|
const [, , j] = useScreenSizeWidth(), _ = useCallback(
|
|
6400
|
-
(
|
|
6431
|
+
(v) => {
|
|
6401
6432
|
j({
|
|
6402
6433
|
xs: 400,
|
|
6403
6434
|
sm: 640,
|
|
@@ -6405,11 +6436,11 @@ const COLOR_PROP = {
|
|
|
6405
6436
|
lg: 1024,
|
|
6406
6437
|
xl: 1420,
|
|
6407
6438
|
"2xl": 1920
|
|
6408
|
-
}[
|
|
6439
|
+
}[v]);
|
|
6409
6440
|
},
|
|
6410
6441
|
[j]
|
|
6411
6442
|
), B = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
6412
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6443
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: S, canReset: m && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6413
6444
|
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !B ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6414
6445
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6415
6446
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
@@ -6429,7 +6460,7 @@ const COLOR_PROP = {
|
|
|
6429
6460
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: y }),
|
|
6430
6461
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: y })
|
|
6431
6462
|
] }),
|
|
6432
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__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" }) }) :
|
|
6463
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__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" }) }) : S && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6433
6464
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6434
6465
|
"button",
|
|
6435
6466
|
{
|
|
@@ -6550,16 +6581,14 @@ const COLOR_PROP = {
|
|
|
6550
6581
|
/* @__PURE__ */ jsx(AccordionTrigger, { className: "border-slate-150 border-t py-2 text-xs", children: /* @__PURE__ */ jsx("div", { className: "flex items-center py-2", children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 text-xs font-medium", children: startCase(r(o.heading)) }) }) }),
|
|
6551
6582
|
/* @__PURE__ */ jsx(AccordionContent, { className: "py-2", children: o.items.map((c) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label + "multiple-choices") : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label + "nested-options") : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label + "block-style")) })
|
|
6552
6583
|
] }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: o.items.map((c, d) => has(c, "component") ? React__default.createElement(c.component, { key: c.label }) : has(c, "styleType") ? c.styleType === "multiple" ? /* @__PURE__ */ jsx(MultipleChoices, { ...c }, c.label + "multiple-choices" + d) : c.styleType === "accordion" && l(c == null ? void 0 : c.conditions) ? /* @__PURE__ */ jsx(NestedOptions, { ...c }, c.label + "nested-options" + d) : null : /* @__PURE__ */ jsx(BlockStyle, { ...c }, c.label + "block-style" + d)) }) });
|
|
6553
|
-
}, TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsx(
|
|
6584
|
+
}, TabletIcon = ({ landscape: o = !1, className: n = "" }) => /* @__PURE__ */ jsx(
|
|
6554
6585
|
"svg",
|
|
6555
6586
|
{
|
|
6556
|
-
className: o ? "rotate-90" : "",
|
|
6587
|
+
className: cn$1("h-3 w-3", o ? "rotate-90" : "", n),
|
|
6557
6588
|
stroke: "currentColor",
|
|
6558
6589
|
fill: "currentColor",
|
|
6559
6590
|
strokeWidth: "0",
|
|
6560
6591
|
viewBox: "0 0 448 512",
|
|
6561
|
-
height: "14px",
|
|
6562
|
-
width: "14px",
|
|
6563
6592
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6564
6593
|
children: /* @__PURE__ */ jsx("path", { d: "M400 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM224 480c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm176-108c0 6.6-5.4 12-12 12H60c-6.6 0-12-5.4-12-12V60c0-6.6 5.4-12 12-12h328c6.6 0 12 5.4 12 12v312z" })
|
|
6565
6594
|
}
|
|
@@ -6568,14 +6597,14 @@ const COLOR_PROP = {
|
|
|
6568
6597
|
title: "Mobile (Base)",
|
|
6569
6598
|
content: "Styles set here are applied to all screen unless edited at higher breakpoint",
|
|
6570
6599
|
breakpoint: "xs",
|
|
6571
|
-
icon: /* @__PURE__ */ jsx(MobileIcon, {}),
|
|
6600
|
+
icon: /* @__PURE__ */ jsx(MobileIcon, { className: "h-4 w-4" }),
|
|
6572
6601
|
width: 400
|
|
6573
6602
|
},
|
|
6574
6603
|
{
|
|
6575
6604
|
title: "Mobile landscape (SM)",
|
|
6576
6605
|
content: "Styles set here are applied at 640px and up unless edited at higher breakpoint",
|
|
6577
6606
|
breakpoint: "sm",
|
|
6578
|
-
icon: /* @__PURE__ */ jsx(MobileIcon, { className: "rotate-90" }),
|
|
6607
|
+
icon: /* @__PURE__ */ jsx(MobileIcon, { className: "h-4 w-4 rotate-90" }),
|
|
6579
6608
|
width: 640
|
|
6580
6609
|
},
|
|
6581
6610
|
{
|
|
@@ -6596,14 +6625,14 @@ const COLOR_PROP = {
|
|
|
6596
6625
|
title: "Desktop (XL)",
|
|
6597
6626
|
content: "Styles set here are applied at 1280px and up unless edited at higher breakpoint",
|
|
6598
6627
|
breakpoint: "xl",
|
|
6599
|
-
icon: /* @__PURE__ */ jsx(LaptopIcon, {}),
|
|
6628
|
+
icon: /* @__PURE__ */ jsx(LaptopIcon, { className: "h-4 w-4" }),
|
|
6600
6629
|
width: 1420
|
|
6601
6630
|
},
|
|
6602
6631
|
{
|
|
6603
6632
|
title: "Large Desktop (2XL)",
|
|
6604
6633
|
content: "Styles set here are applied at 1536px and up",
|
|
6605
6634
|
breakpoint: "2xl",
|
|
6606
|
-
icon: /* @__PURE__ */ jsx(DesktopIcon, {}),
|
|
6635
|
+
icon: /* @__PURE__ */ jsx(DesktopIcon, { className: "h-4 w-4" }),
|
|
6607
6636
|
width: 1920
|
|
6608
6637
|
}
|
|
6609
6638
|
], BreakpointCard = ({
|
|
@@ -6680,7 +6709,7 @@ const COLOR_PROP = {
|
|
|
6680
6709
|
)
|
|
6681
6710
|
) }),
|
|
6682
6711
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
6683
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("span", { className: "cursor-pointer
|
|
6712
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("span", { className: "cursor-pointer rounded-md p-1 hover:bg-background", children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "scale-90 transform" }) }) }),
|
|
6684
6713
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
|
|
6685
6714
|
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: m("Screen sizes") }),
|
|
6686
6715
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
@@ -6690,6 +6719,7 @@ const COLOR_PROP = {
|
|
|
6690
6719
|
disabled: y.breakpoint === "xs",
|
|
6691
6720
|
onCheckedChange: () => x(toUpper(y.breakpoint)),
|
|
6692
6721
|
checked: includes(u, toUpper(y.breakpoint)),
|
|
6722
|
+
onSelect: (C) => C.preventDefault(),
|
|
6693
6723
|
children: m(y.title)
|
|
6694
6724
|
},
|
|
6695
6725
|
y.breakpoint
|
|
@@ -6717,7 +6747,7 @@ function BreakpointSelector() {
|
|
|
6717
6747
|
}
|
|
6718
6748
|
function ManualClasses() {
|
|
6719
6749
|
var L;
|
|
6720
|
-
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, x] = useState(""), f = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, f, "")), y = b.split(" ").filter((T) => !isEmpty(T)), C = useBuilderProp("flags.useClipboard", !1),
|
|
6750
|
+
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, x] = useState(""), f = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, f, "")), y = b.split(" ").filter((T) => !isEmpty(T)), C = useBuilderProp("flags.useClipboard", !1), S = () => {
|
|
6721
6751
|
const T = h.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6722
6752
|
u(m, T, !0), x("");
|
|
6723
6753
|
}, [j, _] = useState([]), B = ({ value: T }) => {
|
|
@@ -6732,7 +6762,7 @@ function ManualClasses() {
|
|
|
6732
6762
|
} else
|
|
6733
6763
|
D = i.search(P);
|
|
6734
6764
|
return _(map(D, "item"));
|
|
6735
|
-
},
|
|
6765
|
+
}, v = () => {
|
|
6736
6766
|
_([]);
|
|
6737
6767
|
}, k = (T) => T.name, I = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), A = useMemo(
|
|
6738
6768
|
() => ({
|
|
@@ -6749,7 +6779,7 @@ function ManualClasses() {
|
|
|
6749
6779
|
}, 0);
|
|
6750
6780
|
},
|
|
6751
6781
|
onKeyDown: (T) => {
|
|
6752
|
-
T.key === "Enter" && h.trim() !== "" &&
|
|
6782
|
+
T.key === "Enter" && h.trim() !== "" && S();
|
|
6753
6783
|
},
|
|
6754
6784
|
onChange: (T, { newValue: P }) => x(P),
|
|
6755
6785
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
@@ -6780,7 +6810,7 @@ function ManualClasses() {
|
|
|
6780
6810
|
{
|
|
6781
6811
|
suggestions: j,
|
|
6782
6812
|
onSuggestionsFetchRequested: B,
|
|
6783
|
-
onSuggestionsClearRequested:
|
|
6813
|
+
onSuggestionsClearRequested: v,
|
|
6784
6814
|
getSuggestionValue: k,
|
|
6785
6815
|
renderSuggestion: I,
|
|
6786
6816
|
inputProps: A,
|
|
@@ -6799,7 +6829,7 @@ function ManualClasses() {
|
|
|
6799
6829
|
{
|
|
6800
6830
|
variant: "outline",
|
|
6801
6831
|
className: "h-6 border-border",
|
|
6802
|
-
onClick:
|
|
6832
|
+
onClick: S,
|
|
6803
6833
|
disabled: h.trim() === "",
|
|
6804
6834
|
size: "sm",
|
|
6805
6835
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
@@ -7170,12 +7200,12 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7170
7200
|
parentId: r = void 0,
|
|
7171
7201
|
position: a = -1
|
|
7172
7202
|
}) => {
|
|
7173
|
-
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), b = (
|
|
7174
|
-
const j = has(
|
|
7175
|
-
return
|
|
7203
|
+
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), b = (S) => {
|
|
7204
|
+
const j = has(S, "styles_attrs.data-page-section");
|
|
7205
|
+
return S._type === "Box" && j;
|
|
7176
7206
|
}, y = useCallback(
|
|
7177
|
-
async (
|
|
7178
|
-
if (
|
|
7207
|
+
async (S) => {
|
|
7208
|
+
if (S.stopPropagation(), has(o, "component")) {
|
|
7179
7209
|
d(o, r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7180
7210
|
return;
|
|
7181
7211
|
}
|
|
@@ -7192,18 +7222,18 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7192
7222
|
onClick: l ? () => {
|
|
7193
7223
|
} : y,
|
|
7194
7224
|
draggable: x ? "true" : "false",
|
|
7195
|
-
onDragStart: async (
|
|
7225
|
+
onDragStart: async (S) => {
|
|
7196
7226
|
const j = await c({ library: n, block: o });
|
|
7197
7227
|
let _ = r;
|
|
7198
7228
|
if (b(first(j)) && (_ = null), !isEmpty(j)) {
|
|
7199
7229
|
const B = { blocks: j, uiLibrary: !0, parent: _ };
|
|
7200
|
-
if (
|
|
7201
|
-
const
|
|
7202
|
-
|
|
7203
|
-
|
|
7230
|
+
if (S.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
|
|
7231
|
+
const v = new Image();
|
|
7232
|
+
v.src = o.preview, v.onload = () => {
|
|
7233
|
+
S.dataTransfer.setDragImage(v, 0, 0);
|
|
7204
7234
|
};
|
|
7205
7235
|
} else
|
|
7206
|
-
|
|
7236
|
+
S.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
7207
7237
|
f(B), setTimeout(() => {
|
|
7208
7238
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7209
7239
|
}, 200);
|
|
@@ -7253,11 +7283,11 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7253
7283
|
return;
|
|
7254
7284
|
}
|
|
7255
7285
|
}, [b, y]);
|
|
7256
|
-
const
|
|
7286
|
+
const S = get(b, y, []), j = useRef(null), { t: _ } = useTranslation(), B = (w) => {
|
|
7257
7287
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7258
7288
|
j.current && C(w);
|
|
7259
7289
|
}, 400);
|
|
7260
|
-
},
|
|
7290
|
+
}, v = () => {
|
|
7261
7291
|
i != null && i.id && p(i.id);
|
|
7262
7292
|
}, k = () => {
|
|
7263
7293
|
g("");
|
|
@@ -7267,7 +7297,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7267
7297
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7268
7298
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7269
7299
|
] });
|
|
7270
|
-
const I = filter(
|
|
7300
|
+
const I = filter(S, (w, E) => E % 2 === 0), A = filter(S, (w, E) => E % 2 === 1);
|
|
7271
7301
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7272
7302
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7273
7303
|
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7297,7 +7327,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7297
7327
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7298
7328
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(b) ? /* @__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: [
|
|
7299
7329
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: _("Failed to load the UI library. Try again") }),
|
|
7300
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
7330
|
+
/* @__PURE__ */ jsxs(Button, { onClick: v, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7301
7331
|
/* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
|
|
7302
7332
|
_("Retry")
|
|
7303
7333
|
] })
|
|
@@ -7327,7 +7357,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7327
7357
|
onMouseEnter: () => j.current ? clearTimeout(j.current) : null,
|
|
7328
7358
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7329
7359
|
children: [
|
|
7330
|
-
isEmpty(
|
|
7360
|
+
isEmpty(S) && !isEmpty(b) ? /* @__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: [
|
|
7331
7361
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: I.map((w, E) => /* @__PURE__ */ jsx(
|
|
7332
7362
|
BlockCard,
|
|
7333
7363
|
{
|
|
@@ -7383,14 +7413,14 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7383
7413
|
}), g(!0);
|
|
7384
7414
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7385
7415
|
const h = Object.entries(a).map(([f, b]) => {
|
|
7386
|
-
const y = b, C = y.type || "partial",
|
|
7416
|
+
const y = b, C = y.type || "partial", S = formatReadableName(C);
|
|
7387
7417
|
return {
|
|
7388
7418
|
type: "PartialBlock",
|
|
7389
7419
|
// Set the type to PartialBlock
|
|
7390
7420
|
label: formatReadableName(y.name || f),
|
|
7391
7421
|
description: y.description || "",
|
|
7392
7422
|
icon: FrameIcon,
|
|
7393
|
-
group:
|
|
7423
|
+
group: S,
|
|
7394
7424
|
// Use formatted type as group
|
|
7395
7425
|
category: "partial",
|
|
7396
7426
|
partialBlockId: f,
|
|
@@ -7462,7 +7492,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7462
7492
|
}), []);
|
|
7463
7493
|
const C = useCallback((w) => {
|
|
7464
7494
|
b(w), y.current && y.current(w);
|
|
7465
|
-
}, []),
|
|
7495
|
+
}, []), S = useCallback(() => {
|
|
7466
7496
|
b(null), y.current && y.current.cancel();
|
|
7467
7497
|
}, []), j = useCallback((w) => {
|
|
7468
7498
|
y.current && y.current.cancel(), x(w), b(null);
|
|
@@ -7479,10 +7509,10 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7479
7509
|
(w) => reject(filter(values(_), { group: w }), { hidden: !0 }).length > 0
|
|
7480
7510
|
) : o.filter((w) => reject(filter(values(n), { group: w }), { hidden: !0 }).length > 0),
|
|
7481
7511
|
[n, _, o, d]
|
|
7482
|
-
),
|
|
7512
|
+
), v = useMemo(
|
|
7483
7513
|
() => sortBy(B, (w) => CORE_GROUPS.indexOf(w) === -1 ? 99 : CORE_GROUPS.indexOf(w)),
|
|
7484
7514
|
[B]
|
|
7485
|
-
), k = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), I = useMemo(() => h === "all" ?
|
|
7515
|
+
), k = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), I = useMemo(() => h === "all" ? v : [h], [v, h]);
|
|
7486
7516
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7487
7517
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7488
7518
|
Input$1,
|
|
@@ -7496,24 +7526,24 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7496
7526
|
}
|
|
7497
7527
|
) }),
|
|
7498
7528
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
|
|
7499
|
-
|
|
7529
|
+
v.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
|
|
7500
7530
|
/* @__PURE__ */ jsx(
|
|
7501
7531
|
"button",
|
|
7502
7532
|
{
|
|
7503
7533
|
onClick: () => j("all"),
|
|
7504
7534
|
onMouseEnter: () => C("all"),
|
|
7505
|
-
onMouseLeave:
|
|
7535
|
+
onMouseLeave: S,
|
|
7506
7536
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7507
7537
|
children: i("All")
|
|
7508
7538
|
},
|
|
7509
7539
|
"sidebar-all"
|
|
7510
7540
|
),
|
|
7511
|
-
|
|
7541
|
+
v.map((w) => /* @__PURE__ */ jsx(
|
|
7512
7542
|
"button",
|
|
7513
7543
|
{
|
|
7514
7544
|
onClick: () => j(w),
|
|
7515
7545
|
onMouseEnter: () => C(w),
|
|
7516
|
-
onMouseLeave:
|
|
7546
|
+
onMouseLeave: S,
|
|
7517
7547
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === w || f === w ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7518
7548
|
children: capitalize(i(w.toLowerCase()))
|
|
7519
7549
|
},
|
|
@@ -7893,23 +7923,23 @@ const Input = ({ node: o }) => {
|
|
|
7893
7923
|
var D;
|
|
7894
7924
|
const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
7895
7925
|
let d = null;
|
|
7896
|
-
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: b, isEditing: y, handleClick: C } = o,
|
|
7897
|
-
N.stopPropagation(),
|
|
7926
|
+
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: b, isEditing: y, handleClick: C } = o, S = get(h, "_show", !0), j = (N) => {
|
|
7927
|
+
N.stopPropagation(), S && o.toggle();
|
|
7898
7928
|
}, _ = (N) => {
|
|
7899
7929
|
N.isInternal && (d = N.isOpen, N.isOpen && N.close());
|
|
7900
7930
|
}, B = (N) => {
|
|
7901
7931
|
N.isInternal && d !== null && (d ? N.open() : N.close(), d = null);
|
|
7902
|
-
}, [
|
|
7932
|
+
}, [v, k] = useAtom$1(currentAddSelection), I = () => {
|
|
7903
7933
|
var N;
|
|
7904
7934
|
A(), o.parent.isSelected || k((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
|
|
7905
7935
|
}, A = () => {
|
|
7906
7936
|
k(null);
|
|
7907
7937
|
}, w = (N) => {
|
|
7908
|
-
A(), N.stopPropagation(), !o.isOpen &&
|
|
7938
|
+
A(), N.stopPropagation(), !o.isOpen && S && o.toggle(), C(N);
|
|
7909
7939
|
};
|
|
7910
7940
|
useEffect(() => {
|
|
7911
7941
|
const N = setTimeout(() => {
|
|
7912
|
-
f && !o.isOpen && !b &&
|
|
7942
|
+
f && !o.isOpen && !b && S && o.toggle();
|
|
7913
7943
|
}, 500);
|
|
7914
7944
|
return () => clearTimeout(N);
|
|
7915
7945
|
}, [f, o, b]);
|
|
@@ -7982,9 +8012,9 @@ const Input = ({ node: o }) => {
|
|
|
7982
8012
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
7983
8013
|
x ? "bg-primary/20" : "hover:bg-primary/10",
|
|
7984
8014
|
f && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
7985
|
-
(o == null ? void 0 : o.id) ===
|
|
8015
|
+
(o == null ? void 0 : o.id) === v ? "bg-primary/10" : "",
|
|
7986
8016
|
b && "opacity-20",
|
|
7987
|
-
|
|
8017
|
+
S ? "" : "line-through opacity-50",
|
|
7988
8018
|
P && x && "bg-primary/20 text-primary"
|
|
7989
8019
|
),
|
|
7990
8020
|
children: [
|
|
@@ -8023,7 +8053,7 @@ const Input = ({ node: o }) => {
|
|
|
8023
8053
|
)
|
|
8024
8054
|
] }),
|
|
8025
8055
|
/* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-px group-hover:visible", children: [
|
|
8026
|
-
canAddChildBlock(h == null ? void 0 : h._type) &&
|
|
8056
|
+
canAddChildBlock(h == null ? void 0 : h._type) && S && c(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
8027
8057
|
/* @__PURE__ */ jsx(
|
|
8028
8058
|
TooltipTrigger,
|
|
8029
8059
|
{
|
|
@@ -8040,14 +8070,14 @@ const Input = ({ node: o }) => {
|
|
|
8040
8070
|
TooltipTrigger,
|
|
8041
8071
|
{
|
|
8042
8072
|
onClick: (N) => {
|
|
8043
|
-
N.stopPropagation(), l([m], { _show: !
|
|
8073
|
+
N.stopPropagation(), l([m], { _show: !S }), o.isOpen && o.toggle();
|
|
8044
8074
|
},
|
|
8045
8075
|
className: "cursor-pointer rounded bg-transparent p-0.5 hover:bg-primary/10",
|
|
8046
8076
|
asChild: !0,
|
|
8047
|
-
children:
|
|
8077
|
+
children: S ? /* @__PURE__ */ jsx(EyeClosedIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-4 w-4" })
|
|
8048
8078
|
}
|
|
8049
8079
|
),
|
|
8050
|
-
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(
|
|
8080
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(S ? "Hide the block from page" : "Show the block on page") })
|
|
8051
8081
|
] }),
|
|
8052
8082
|
/* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" }) }) })
|
|
8053
8083
|
] })
|
|
@@ -8216,6 +8246,30 @@ const Input = ({ node: o }) => {
|
|
|
8216
8246
|
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" }) })
|
|
8217
8247
|
}
|
|
8218
8248
|
) }),
|
|
8249
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
8250
|
+
"div",
|
|
8251
|
+
{
|
|
8252
|
+
role: "treeitem",
|
|
8253
|
+
"aria-level": 0,
|
|
8254
|
+
"aria-selected": !0,
|
|
8255
|
+
"aria-expanded": !1,
|
|
8256
|
+
onClick: () => setIds([]),
|
|
8257
|
+
className: "flex h-full items-center border-b border-transparent",
|
|
8258
|
+
children: /* @__PURE__ */ jsx(
|
|
8259
|
+
"div",
|
|
8260
|
+
{
|
|
8261
|
+
className: cn$1(
|
|
8262
|
+
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
8263
|
+
ids.length === 0 ? "bg-primary/20" : ""
|
|
8264
|
+
),
|
|
8265
|
+
children: /* @__PURE__ */ jsxs("div", { className: "leading-1 flex items-center", children: [
|
|
8266
|
+
/* @__PURE__ */ jsx(CardStackIcon, { className: "h-3 w-3 flex-shrink-0 rotate-180" }),
|
|
8267
|
+
/* @__PURE__ */ jsx("div", { className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]", children: "Body" })
|
|
8268
|
+
] })
|
|
8269
|
+
}
|
|
8270
|
+
)
|
|
8271
|
+
}
|
|
8272
|
+
) }),
|
|
8219
8273
|
/* @__PURE__ */ jsx(
|
|
8220
8274
|
Tree,
|
|
8221
8275
|
{
|
|
@@ -8467,23 +8521,23 @@ const Input = ({ node: o }) => {
|
|
|
8467
8521
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8468
8522
|
const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8469
8523
|
if (d) {
|
|
8470
|
-
const B = d.map((
|
|
8471
|
-
DEFAULT_THEME_PRESET.forEach((
|
|
8472
|
-
const k = Object.keys(
|
|
8473
|
-
B.includes(k) || d.push(
|
|
8524
|
+
const B = d.map((v) => Object.keys(v)[0]);
|
|
8525
|
+
DEFAULT_THEME_PRESET.forEach((v) => {
|
|
8526
|
+
const k = Object.keys(v)[0];
|
|
8527
|
+
B.includes(k) || d.push(v);
|
|
8474
8528
|
});
|
|
8475
8529
|
}
|
|
8476
8530
|
const [g, m] = useTheme(), h = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
|
|
8477
8531
|
(B) => {
|
|
8478
|
-
const
|
|
8479
|
-
setPreviousTheme(
|
|
8532
|
+
const v = { ...g };
|
|
8533
|
+
setPreviousTheme(v), m(B), toast.success("Theme updated", {
|
|
8480
8534
|
action: {
|
|
8481
8535
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8482
8536
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
8483
8537
|
" Undo"
|
|
8484
8538
|
] }),
|
|
8485
8539
|
onClick: () => {
|
|
8486
|
-
m(
|
|
8540
|
+
m(v), clearPreviousTheme(), toast.dismiss();
|
|
8487
8541
|
}
|
|
8488
8542
|
},
|
|
8489
8543
|
closeButton: !0,
|
|
@@ -8492,27 +8546,27 @@ const Input = ({ node: o }) => {
|
|
|
8492
8546
|
},
|
|
8493
8547
|
[g, m]
|
|
8494
8548
|
), b = () => {
|
|
8495
|
-
const B = d.find((
|
|
8549
|
+
const B = d.find((v) => Object.keys(v)[0] === a);
|
|
8496
8550
|
if (B) {
|
|
8497
|
-
const
|
|
8498
|
-
|
|
8551
|
+
const v = Object.values(B)[0];
|
|
8552
|
+
v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (f(v), l("")) : console.error("Invalid preset structure:", v);
|
|
8499
8553
|
} else
|
|
8500
8554
|
console.error("Preset not found:", a);
|
|
8501
8555
|
}, y = (B) => {
|
|
8502
8556
|
f(B), l("");
|
|
8503
8557
|
}, C = useDebouncedCallback(
|
|
8504
|
-
(B,
|
|
8558
|
+
(B, v) => {
|
|
8505
8559
|
m(() => ({
|
|
8506
8560
|
...g,
|
|
8507
8561
|
fontFamily: {
|
|
8508
8562
|
...g.fontFamily,
|
|
8509
|
-
[B.replace(/font-/g, "")]:
|
|
8563
|
+
[B.replace(/font-/g, "")]: v
|
|
8510
8564
|
}
|
|
8511
8565
|
}));
|
|
8512
8566
|
},
|
|
8513
8567
|
[g],
|
|
8514
8568
|
200
|
|
8515
|
-
),
|
|
8569
|
+
), S = React.useCallback(
|
|
8516
8570
|
(B) => {
|
|
8517
8571
|
m(() => ({
|
|
8518
8572
|
...g,
|
|
@@ -8521,10 +8575,10 @@ const Input = ({ node: o }) => {
|
|
|
8521
8575
|
},
|
|
8522
8576
|
[g]
|
|
8523
8577
|
), j = useDebouncedCallback(
|
|
8524
|
-
(B,
|
|
8578
|
+
(B, v) => {
|
|
8525
8579
|
m(() => {
|
|
8526
8580
|
const k = get(g, `colors.${B}`);
|
|
8527
|
-
return n ? set(k, 1,
|
|
8581
|
+
return n ? set(k, 1, v) : set(k, 0, v), {
|
|
8528
8582
|
...g,
|
|
8529
8583
|
colors: {
|
|
8530
8584
|
...g.colors,
|
|
@@ -8535,18 +8589,18 @@ const Input = ({ node: o }) => {
|
|
|
8535
8589
|
},
|
|
8536
8590
|
[g],
|
|
8537
8591
|
200
|
|
8538
|
-
), _ = (B) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(B.items).map(([
|
|
8539
|
-
const k = get(g, `colors.${
|
|
8592
|
+
), _ = (B) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(B.items).map(([v]) => {
|
|
8593
|
+
const k = get(g, `colors.${v}.${n ? 1 : 0}`);
|
|
8540
8594
|
return k ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8541
8595
|
/* @__PURE__ */ jsx(
|
|
8542
8596
|
ColorPickerInput,
|
|
8543
8597
|
{
|
|
8544
8598
|
value: k,
|
|
8545
|
-
onChange: (I) => j(
|
|
8599
|
+
onChange: (I) => j(v, I)
|
|
8546
8600
|
}
|
|
8547
8601
|
),
|
|
8548
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
8549
|
-
] },
|
|
8602
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
|
|
8603
|
+
] }, v) : null;
|
|
8550
8604
|
}) });
|
|
8551
8605
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8552
8606
|
/* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -8562,8 +8616,8 @@ const Input = ({ node: o }) => {
|
|
|
8562
8616
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8563
8617
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8564
8618
|
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((B) => {
|
|
8565
|
-
const
|
|
8566
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
8619
|
+
const v = Object.keys(B)[0], k = v.replaceAll("_", " ");
|
|
8620
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(k) }, v);
|
|
8567
8621
|
}) })
|
|
8568
8622
|
] }) }),
|
|
8569
8623
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: b, children: x("Apply") }) })
|
|
@@ -8575,11 +8629,11 @@ const Input = ({ node: o }) => {
|
|
|
8575
8629
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8576
8630
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8577
8631
|
] }),
|
|
8578
|
-
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([B,
|
|
8632
|
+
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([B, v]) => /* @__PURE__ */ jsx(
|
|
8579
8633
|
FontSelector,
|
|
8580
8634
|
{
|
|
8581
8635
|
label: B,
|
|
8582
|
-
value: g.fontFamily[B.replace(/font-/g, "")] ||
|
|
8636
|
+
value: g.fontFamily[B.replace(/font-/g, "")] || v[Object.keys(v)[0]],
|
|
8583
8637
|
onChange: (k) => C(B, k)
|
|
8584
8638
|
},
|
|
8585
8639
|
B
|
|
@@ -8593,7 +8647,7 @@ const Input = ({ node: o }) => {
|
|
|
8593
8647
|
] }),
|
|
8594
8648
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
8595
8649
|
] }),
|
|
8596
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange:
|
|
8650
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: S }) })
|
|
8597
8651
|
] }),
|
|
8598
8652
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8599
8653
|
(h == null ? void 0 : h.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
@@ -9157,7 +9211,7 @@ function QuickPrompts({ onClick: o }) {
|
|
|
9157
9211
|
)
|
|
9158
9212
|
) }) });
|
|
9159
9213
|
}
|
|
9160
|
-
const
|
|
9214
|
+
const AIUserPrompt = ({ blockId: o }) => {
|
|
9161
9215
|
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), u = useSelectedBlock();
|
|
9162
9216
|
useEffect(() => {
|
|
9163
9217
|
var m;
|
|
@@ -9229,7 +9283,7 @@ const AiIcon = ({ className: o = "h-full w-full" }) => /* @__PURE__ */ jsx("svg"
|
|
|
9229
9283
|
function DarkMode() {
|
|
9230
9284
|
const [o, n] = useDarkMode();
|
|
9231
9285
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
9232
|
-
/* @__PURE__ */ jsx(SunIcon, { className: "size-4 shrink-0" }),
|
|
9286
|
+
o ? /* @__PURE__ */ jsx(MoonIcon, { className: "size-4 shrink-0" }) : /* @__PURE__ */ jsx(SunIcon, { className: "size-4 shrink-0" }),
|
|
9233
9287
|
/* @__PURE__ */ jsx(
|
|
9234
9288
|
Switch,
|
|
9235
9289
|
{
|
|
@@ -9247,8 +9301,7 @@ function DarkMode() {
|
|
|
9247
9301
|
}
|
|
9248
9302
|
)
|
|
9249
9303
|
}
|
|
9250
|
-
)
|
|
9251
|
-
/* @__PURE__ */ jsx(MoonIcon, { className: "ml-3 size-4 shrink-0" })
|
|
9304
|
+
)
|
|
9252
9305
|
] });
|
|
9253
9306
|
}
|
|
9254
9307
|
const UndoRedo = () => {
|
|
@@ -9262,7 +9315,7 @@ const UndoRedo = () => {
|
|
|
9262
9315
|
n([]), r([]), a([]);
|
|
9263
9316
|
}, [n]);
|
|
9264
9317
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs(AlertDialog, { children: [
|
|
9265
|
-
/* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", className: "flex items-center
|
|
9318
|
+
/* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", className: "flex items-center", children: [
|
|
9266
9319
|
/* @__PURE__ */ jsx(EraserIcon, {}),
|
|
9267
9320
|
" ",
|
|
9268
9321
|
o("Clear")
|
|
@@ -9278,35 +9331,26 @@ const UndoRedo = () => {
|
|
|
9278
9331
|
] })
|
|
9279
9332
|
] })
|
|
9280
9333
|
] }) });
|
|
9281
|
-
}, DataBinding = () => {
|
|
9282
|
-
const o = usePageExternalData(), [n, r] = useAtom$1(dataBindingActiveAtom), { t: a } = useTranslation();
|
|
9283
|
-
return isEmpty(o) ? null : /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9284
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "rounded-full", variant: "ghost", onClick: () => r(!n), children: /* @__PURE__ */ jsx(LightningBoltIcon, { className: cn$1("h-4 w-4", n ? "text-green-500" : "text-gray-500") }) }) }),
|
|
9285
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: a("Toggle Data Binding") }) })
|
|
9286
|
-
] }) });
|
|
9287
9334
|
}, CanvasTopBar = () => {
|
|
9288
|
-
const o = useBuilderProp("darkMode", !0), [n] =
|
|
9335
|
+
const o = useBuilderProp("darkMode", !0), [n, r] = useAtom$1(dataBindingActiveAtom), { t: a } = useTranslation();
|
|
9289
9336
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2 shadow-xl", children: [
|
|
9290
|
-
/* @__PURE__ */
|
|
9337
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full space-x-2", children: o ? /* @__PURE__ */ jsx(DarkMode, {}) : null }),
|
|
9338
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full items-center space-x-2", children: [
|
|
9291
9339
|
/* @__PURE__ */ jsx(Breakpoints$1, { canvas: !0, openDelay: 400 }),
|
|
9292
9340
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
|
|
9293
|
-
/* @__PURE__ */
|
|
9294
|
-
/* @__PURE__ */ jsx(ZoomInIcon, { className: "h-3.5 w-3.5 flex-shrink-0" }),
|
|
9295
|
-
" ",
|
|
9296
|
-
/* @__PURE__ */ jsxs("div", { className: "text-xs leading-3", children: [
|
|
9297
|
-
round(n, 0),
|
|
9298
|
-
"%"
|
|
9299
|
-
] })
|
|
9300
|
-
] }),
|
|
9301
|
-
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
|
|
9302
|
-
o ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9303
|
-
/* @__PURE__ */ jsx(DarkMode, {}),
|
|
9304
|
-
/* @__PURE__ */ jsx(Separator, { orientation: "vertical" })
|
|
9305
|
-
] }) : null,
|
|
9306
|
-
/* @__PURE__ */ jsx(UndoRedo, {}),
|
|
9307
|
-
/* @__PURE__ */ jsx(DataBinding, {})
|
|
9341
|
+
/* @__PURE__ */ jsx(UndoRedo, {})
|
|
9308
9342
|
] }),
|
|
9309
|
-
/* @__PURE__ */
|
|
9343
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full items-center", children: [
|
|
9344
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
9345
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", className: "h-7 w-7 rounded-md p-1", children: /* @__PURE__ */ jsx(DotsHorizontalIcon, { className: "h-4 w-4" }) }) }),
|
|
9346
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { className: "w-56 border-border text-xs", children: /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "flex items-center gap-2", onSelect: (l) => l.preventDefault(), children: [
|
|
9347
|
+
/* @__PURE__ */ jsx(LightningBoltIcon, { className: "h-4 w-4 text-gray-500" }),
|
|
9348
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: a("Data Binding") }),
|
|
9349
|
+
/* @__PURE__ */ jsx(Switch, { checked: n, onCheckedChange: () => r(!n) })
|
|
9350
|
+
] }) })
|
|
9351
|
+
] }),
|
|
9352
|
+
/* @__PURE__ */ jsx(ClearCanvas, {})
|
|
9353
|
+
] })
|
|
9310
9354
|
] });
|
|
9311
9355
|
}, AddBlocksDialog = () => {
|
|
9312
9356
|
const { t: o } = useTranslation(), [n, r] = useState(""), [a, l] = useState(-1), [i, c] = useState(!1);
|
|
@@ -9345,7 +9389,7 @@ const UndoRedo = () => {
|
|
|
9345
9389
|
const k = [...a, { key: i, value: d }];
|
|
9346
9390
|
r(k), l(a), c(""), p(""), h("");
|
|
9347
9391
|
}
|
|
9348
|
-
},
|
|
9392
|
+
}, S = (k) => {
|
|
9349
9393
|
const I = a.filter((A, w) => w !== k);
|
|
9350
9394
|
r(I), l(I);
|
|
9351
9395
|
}, j = (k) => {
|
|
@@ -9361,7 +9405,7 @@ const UndoRedo = () => {
|
|
|
9361
9405
|
}
|
|
9362
9406
|
}, B = (k) => {
|
|
9363
9407
|
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? _() : C());
|
|
9364
|
-
},
|
|
9408
|
+
}, v = useCallback((k) => {
|
|
9365
9409
|
const I = (E) => /[.,!?;:]/.test(E), A = (E, L, T) => {
|
|
9366
9410
|
let P = "", R = "";
|
|
9367
9411
|
const D = L > 0 ? E[L - 1] : "", N = L < E.length ? E[L] : "";
|
|
@@ -9412,7 +9456,7 @@ const UndoRedo = () => {
|
|
|
9412
9456
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9413
9457
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9414
9458
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9415
|
-
!isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect:
|
|
9459
|
+
!isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect: v })
|
|
9416
9460
|
] }),
|
|
9417
9461
|
/* @__PURE__ */ jsx(
|
|
9418
9462
|
Textarea,
|
|
@@ -9444,7 +9488,7 @@ const UndoRedo = () => {
|
|
|
9444
9488
|
] }),
|
|
9445
9489
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9446
9490
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => j(I), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9447
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9491
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(I), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9448
9492
|
] })
|
|
9449
9493
|
] }, I)) })
|
|
9450
9494
|
] });
|
|
@@ -9614,7 +9658,7 @@ const RootLayout = () => {
|
|
|
9614
9658
|
console.log("handleMenuItemClick", k, n), r(n === k ? null : k);
|
|
9615
9659
|
},
|
|
9616
9660
|
[n, r]
|
|
9617
|
-
), { t: f } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b),
|
|
9661
|
+
), { t: f } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b), S = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
9618
9662
|
useEffect(() => {
|
|
9619
9663
|
if (n !== null) {
|
|
9620
9664
|
const k = find(b, { id: n });
|
|
@@ -9624,8 +9668,8 @@ const RootLayout = () => {
|
|
|
9624
9668
|
const j = useMemo(() => {
|
|
9625
9669
|
if (n === null) return 0;
|
|
9626
9670
|
const k = find(b, { id: n });
|
|
9627
|
-
return get(k, "view", "standard") === "standard" ?
|
|
9628
|
-
}, [n,
|
|
9671
|
+
return get(k, "view", "standard") === "standard" ? S : l;
|
|
9672
|
+
}, [n, S, l, b]), _ = useCallback(() => {
|
|
9629
9673
|
r(a.current);
|
|
9630
9674
|
}, [r, n]), B = useCallback(() => {
|
|
9631
9675
|
r("outline");
|
|
@@ -9633,7 +9677,7 @@ const RootLayout = () => {
|
|
|
9633
9677
|
useEffect(() => {
|
|
9634
9678
|
n !== null && !find(b, { id: n }) && r("outline");
|
|
9635
9679
|
}, [n, b]);
|
|
9636
|
-
const
|
|
9680
|
+
const v = useCallback(
|
|
9637
9681
|
(k) => {
|
|
9638
9682
|
x(k);
|
|
9639
9683
|
},
|
|
@@ -9654,7 +9698,7 @@ const RootLayout = () => {
|
|
|
9654
9698
|
position: "top",
|
|
9655
9699
|
panelId: k.id,
|
|
9656
9700
|
isActive: n === k.id,
|
|
9657
|
-
show: () =>
|
|
9701
|
+
show: () => v(k.id)
|
|
9658
9702
|
}) }),
|
|
9659
9703
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
|
|
9660
9704
|
] }, "button-top-" + I)) }),
|
|
@@ -9664,7 +9708,7 @@ const RootLayout = () => {
|
|
|
9664
9708
|
position: "bottom",
|
|
9665
9709
|
panelId: k.id,
|
|
9666
9710
|
isActive: n === k.id,
|
|
9667
|
-
show: () =>
|
|
9711
|
+
show: () => v(k.id)
|
|
9668
9712
|
}) }),
|
|
9669
9713
|
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
|
|
9670
9714
|
] }, "button-bottom-" + I)) })
|
|
@@ -9736,7 +9780,7 @@ const RootLayout = () => {
|
|
|
9736
9780
|
{
|
|
9737
9781
|
side: "left",
|
|
9738
9782
|
className: "flex flex-col gap-0 p-0 sm:max-w-full",
|
|
9739
|
-
style: { width: `${
|
|
9783
|
+
style: { width: `${S}px` },
|
|
9740
9784
|
children: [
|
|
9741
9785
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9742
9786
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
@@ -9749,7 +9793,7 @@ const RootLayout = () => {
|
|
|
9749
9793
|
}
|
|
9750
9794
|
) }),
|
|
9751
9795
|
" ",
|
|
9752
|
-
n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${
|
|
9796
|
+
n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${S}px` }, children: [
|
|
9753
9797
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9754
9798
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9755
9799
|
/* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
|
|
@@ -9854,8 +9898,8 @@ const RootLayout = () => {
|
|
|
9854
9898
|
});
|
|
9855
9899
|
}, h = (f) => {
|
|
9856
9900
|
if (!c) return;
|
|
9857
|
-
const b = f.clientX - p.x, y = f.clientY - p.y, C = f.currentTarget,
|
|
9858
|
-
r(
|
|
9901
|
+
const b = f.clientX - p.x, y = f.clientY - p.y, C = f.currentTarget, S = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - S, B = window.innerHeight - j, v = Math.max(0, Math.min(b, _)), k = Math.max(0, Math.min(y, B));
|
|
9902
|
+
r(v, k);
|
|
9859
9903
|
}, x = () => {
|
|
9860
9904
|
d(!1);
|
|
9861
9905
|
};
|
|
@@ -10109,7 +10153,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10109
10153
|
function C() {
|
|
10110
10154
|
l.has(n) && (f(o, n), m(o), g(o));
|
|
10111
10155
|
}
|
|
10112
|
-
function
|
|
10156
|
+
function S(k) {
|
|
10113
10157
|
var I;
|
|
10114
10158
|
if (isSelfAtom(n, k)) {
|
|
10115
10159
|
const w = u(o, k);
|
|
@@ -10142,14 +10186,14 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10142
10186
|
}
|
|
10143
10187
|
}), _;
|
|
10144
10188
|
}
|
|
10145
|
-
},
|
|
10189
|
+
}, v = b.n;
|
|
10146
10190
|
try {
|
|
10147
|
-
const k = p(o, n,
|
|
10191
|
+
const k = p(o, n, S, B);
|
|
10148
10192
|
return setAtomStateValueOrPromise(o, n, k), isPromiseLike$1(k) && (registerAbortHandler(k, () => j == null ? void 0 : j.abort()), k.then(C, C)), b;
|
|
10149
10193
|
} catch (k) {
|
|
10150
10194
|
return delete b.v, b.e = k, ++b.n, b;
|
|
10151
10195
|
} finally {
|
|
10152
|
-
y = !1,
|
|
10196
|
+
y = !1, v !== b.n && i.get(n) === v && (i.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
10153
10197
|
}
|
|
10154
10198
|
}, invalidateDependents = (o, n) => {
|
|
10155
10199
|
const r = getBuildingBlocks(o), a = r[1], l = r[2], i = r[11], c = [n];
|
|
@@ -10164,14 +10208,14 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10164
10208
|
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];
|
|
10165
10209
|
let x = !0;
|
|
10166
10210
|
const f = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
|
|
10167
|
-
var
|
|
10211
|
+
var S;
|
|
10168
10212
|
const j = d(o, y);
|
|
10169
10213
|
try {
|
|
10170
10214
|
if (isSelfAtom(n, y)) {
|
|
10171
10215
|
if (!hasInitialValue(y))
|
|
10172
10216
|
throw new Error("atom not writable");
|
|
10173
10217
|
const _ = j.n, B = C[0];
|
|
10174
|
-
setAtomStateValueOrPromise(o, y, B), h(o, y), _ !== j.n && (l.add(y), (
|
|
10218
|
+
setAtomStateValueOrPromise(o, y, B), h(o, y), _ !== j.n && (l.add(y), (S = i.c) == null || S.call(i, y), m(o, y));
|
|
10175
10219
|
return;
|
|
10176
10220
|
} else
|
|
10177
10221
|
return writeAtomState(o, y, ...C);
|
|
@@ -10215,19 +10259,19 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10215
10259
|
}, l.set(n, f), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
|
|
10216
10260
|
const b = () => {
|
|
10217
10261
|
let y = !0;
|
|
10218
|
-
const C = (...
|
|
10262
|
+
const C = (...S) => {
|
|
10219
10263
|
try {
|
|
10220
|
-
return h(o, n, ...
|
|
10264
|
+
return h(o, n, ...S);
|
|
10221
10265
|
} finally {
|
|
10222
10266
|
y || (g(o), u(o));
|
|
10223
10267
|
}
|
|
10224
10268
|
};
|
|
10225
10269
|
try {
|
|
10226
|
-
const
|
|
10227
|
-
|
|
10270
|
+
const S = d(o, n, C);
|
|
10271
|
+
S && (f.u = () => {
|
|
10228
10272
|
y = !0;
|
|
10229
10273
|
try {
|
|
10230
|
-
|
|
10274
|
+
S();
|
|
10231
10275
|
} finally {
|
|
10232
10276
|
y = !1;
|
|
10233
10277
|
}
|