@chaibuilder/sdk 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply-binding-CxkQxWx3.cjs +1 -0
- package/dist/apply-binding-OTp8TO_7.js +570 -0
- package/dist/core.cjs +4 -4
- package/dist/core.js +659 -959
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +7 -0
- package/dist/render.js +42 -41
- package/package.json +1 -1
- package/dist/apply-binding-BL-JPMms.js +0 -267
- package/dist/apply-binding-T3HdSezj.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ var F = (o, r, n) => V(o, typeof r != "symbol" ? r + "" : r, n);
|
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
6
|
import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
|
|
7
|
-
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq,
|
|
7
|
+
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, sortBy, round } from "lodash-es";
|
|
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";
|
|
@@ -15,7 +15,7 @@ import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, Chevro
|
|
|
15
15
|
import clsx$1, { clsx } from "clsx";
|
|
16
16
|
import { twMerge } from "tailwind-merge";
|
|
17
17
|
import TreeModel from "tree-model";
|
|
18
|
-
import { C as COLLECTION_PREFIX, S as STYLES_KEY,
|
|
18
|
+
import { C as COLLECTION_PREFIX, S as STYLES_KEY, h as getSplitChaiClasses, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, f as getBlocksFromHTML, i as ROOT_TEMP_KEY } from "./apply-binding-OTp8TO_7.js";
|
|
19
19
|
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";
|
|
20
20
|
import { isObject } from "@rjsf/utils";
|
|
21
21
|
import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
|
|
@@ -34,10 +34,10 @@ import RjForm from "@rjsf/core";
|
|
|
34
34
|
import validator from "@rjsf/validator-ajv8";
|
|
35
35
|
import Autosuggest from "react-autosuggest";
|
|
36
36
|
import { useFeature } from "flagged";
|
|
37
|
-
import { parse, stringify } from "himalaya";
|
|
38
37
|
import { Tree } from "react-arborist";
|
|
39
38
|
import i18n from "i18next";
|
|
40
39
|
import { default as Ue } from "i18next";
|
|
40
|
+
import "himalaya";
|
|
41
41
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
42
42
|
import tailwindForms from "@tailwindcss/forms";
|
|
43
43
|
import tailwindTypography from "@tailwindcss/typography";
|
|
@@ -839,13 +839,13 @@ const undoRedoStateAtom = atom({
|
|
|
839
839
|
} = useBlocksStoreManager();
|
|
840
840
|
return {
|
|
841
841
|
moveBlocks: (f, y, b) => {
|
|
842
|
-
const
|
|
843
|
-
const
|
|
844
|
-
return { _id:
|
|
845
|
-
}),
|
|
846
|
-
|
|
847
|
-
undo: () => each(
|
|
848
|
-
i([
|
|
842
|
+
const w = map(f, (_) => {
|
|
843
|
+
const A = r.find((E) => E._id === _)._parent || null, C = r.filter((E) => A ? E._parent === A : !E._parent).map((E) => E._id).indexOf(_);
|
|
844
|
+
return { _id: _, oldParent: A, oldPosition: C };
|
|
845
|
+
}), B = w.find(({ _id: _ }) => _ === f[0]);
|
|
846
|
+
B && B.oldParent === y && B.oldPosition === b || (i(f, y, b), o({
|
|
847
|
+
undo: () => each(w, ({ _id: _, oldParent: N, oldPosition: A }) => {
|
|
848
|
+
i([_], N, A);
|
|
849
849
|
}),
|
|
850
850
|
redo: () => i(f, y, b)
|
|
851
851
|
}));
|
|
@@ -857,27 +857,27 @@ const undoRedoStateAtom = atom({
|
|
|
857
857
|
});
|
|
858
858
|
},
|
|
859
859
|
removeBlocks: (f) => {
|
|
860
|
-
var
|
|
861
|
-
const y = (
|
|
860
|
+
var B;
|
|
861
|
+
const y = (B = first(f)) == null ? void 0 : B._parent, w = r.filter((_) => y ? _._parent === y : !_._parent).indexOf(first(f));
|
|
862
862
|
l(map(f, "_id")), o({
|
|
863
|
-
undo: () => a(f, y,
|
|
863
|
+
undo: () => a(f, y, w),
|
|
864
864
|
redo: () => l(map(f, "_id"))
|
|
865
865
|
});
|
|
866
866
|
},
|
|
867
867
|
updateBlocks: (f, y, b) => {
|
|
868
|
-
let
|
|
868
|
+
let w = [];
|
|
869
869
|
if (b)
|
|
870
|
-
|
|
870
|
+
w = map(f, (B) => ({ _id: B, ...b }));
|
|
871
871
|
else {
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
const N = r.find((
|
|
875
|
-
return each(
|
|
872
|
+
const B = keys(y);
|
|
873
|
+
w = map(f, (_) => {
|
|
874
|
+
const N = r.find((v) => v._id === _), A = { _id: _ };
|
|
875
|
+
return each(B, (v) => A[v] = N[v]), A;
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
|
-
c(map(f, (
|
|
879
|
-
undo: () => c(
|
|
880
|
-
redo: () => c(map(f, (
|
|
878
|
+
c(map(f, (B) => ({ _id: B, ...y }))), o({
|
|
879
|
+
undo: () => c(w),
|
|
880
|
+
redo: () => c(map(f, (B) => ({ _id: B, ...y })))
|
|
881
881
|
});
|
|
882
882
|
},
|
|
883
883
|
updateBlocksRuntime: (f, y) => {
|
|
@@ -892,8 +892,8 @@ const undoRedoStateAtom = atom({
|
|
|
892
892
|
updateMultipleBlocksProps: (f) => {
|
|
893
893
|
let y = [];
|
|
894
894
|
y = map(f, (b) => {
|
|
895
|
-
const
|
|
896
|
-
return each(
|
|
895
|
+
const w = keys(b), B = r.find((N) => N._id === b._id), _ = {};
|
|
896
|
+
return each(w, (N) => _[N] = B[N]), _;
|
|
897
897
|
}), c(f), o({
|
|
898
898
|
undo: () => c(y),
|
|
899
899
|
redo: () => c(f)
|
|
@@ -2367,8 +2367,8 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2367
2367
|
for (const y in f) {
|
|
2368
2368
|
const b = f[y];
|
|
2369
2369
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2370
|
-
const { baseClasses:
|
|
2371
|
-
f[y] = compact(flattenDeep([
|
|
2370
|
+
const { baseClasses: w, classes: B } = getSplitChaiClasses(b);
|
|
2371
|
+
f[y] = compact(flattenDeep([w, B])).join(" ");
|
|
2372
2372
|
} else
|
|
2373
2373
|
y !== "_id" && delete f[y];
|
|
2374
2374
|
}
|
|
@@ -2382,21 +2382,21 @@ const getBlockWithChildren = (o, r) => {
|
|
|
2382
2382
|
try {
|
|
2383
2383
|
const b = p === u ? "" : p;
|
|
2384
2384
|
console.log("prompt", f);
|
|
2385
|
-
const
|
|
2386
|
-
if (
|
|
2387
|
-
a(
|
|
2385
|
+
const w = f.toLowerCase().includes("translate the content"), B = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p, w) : [h(x, d)], _ = await l(m, addLangToPrompt(f, g, m), B, b), { blocks: N, error: A } = _;
|
|
2386
|
+
if (A) {
|
|
2387
|
+
a(A);
|
|
2388
2388
|
return;
|
|
2389
2389
|
}
|
|
2390
2390
|
if (m === "styles") {
|
|
2391
|
-
const
|
|
2392
|
-
for (const
|
|
2393
|
-
|
|
2394
|
-
return
|
|
2391
|
+
const v = N.map((C) => {
|
|
2392
|
+
for (const E in C)
|
|
2393
|
+
E !== "_id" && (C[E] = `${STYLES_KEY},${C[E]}`);
|
|
2394
|
+
return C;
|
|
2395
2395
|
});
|
|
2396
|
-
c(
|
|
2396
|
+
c(v);
|
|
2397
2397
|
} else
|
|
2398
2398
|
i(N);
|
|
2399
|
-
y && y(
|
|
2399
|
+
y && y(_);
|
|
2400
2400
|
} catch (b) {
|
|
2401
2401
|
a(b);
|
|
2402
2402
|
} finally {
|
|
@@ -3008,8 +3008,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3008
3008
|
}),
|
|
3009
3009
|
size({
|
|
3010
3010
|
boundary: u == null ? void 0 : u.body,
|
|
3011
|
-
apply({ availableWidth: y, availableHeight: b, elements:
|
|
3012
|
-
Object.assign(
|
|
3011
|
+
apply({ availableWidth: y, availableHeight: b, elements: w }) {
|
|
3012
|
+
Object.assign(w.floating.style, {
|
|
3013
3013
|
maxWidth: `${Math.max(200, y)}px`,
|
|
3014
3014
|
maxHeight: `${Math.max(100, b)}px`
|
|
3015
3015
|
});
|
|
@@ -3600,62 +3600,62 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3600
3600
|
}
|
|
3601
3601
|
), WithBlockTextEditor = memo(
|
|
3602
3602
|
({ block: o, children: r }) => {
|
|
3603
|
-
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent:
|
|
3604
|
-
var
|
|
3605
|
-
const
|
|
3606
|
-
let
|
|
3607
|
-
const
|
|
3608
|
-
return x && ((
|
|
3609
|
-
}, [o, x]),
|
|
3610
|
-
(
|
|
3611
|
-
var
|
|
3612
|
-
const
|
|
3613
|
-
m([b], { [n]:
|
|
3603
|
+
const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: w, blockType: B } = useMemo(() => {
|
|
3604
|
+
var j;
|
|
3605
|
+
const C = o._type;
|
|
3606
|
+
let E = o[n];
|
|
3607
|
+
const S = getRegisteredChaiBlock(o._type);
|
|
3608
|
+
return x && ((j = S == null ? void 0 : S.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${x}`) && (E = get(o, `${n}-${x}`)), { blockContent: E, blockType: C };
|
|
3609
|
+
}, [o, x]), _ = useCallback(
|
|
3610
|
+
(C) => {
|
|
3611
|
+
var S;
|
|
3612
|
+
const E = C || ((S = g.current) == null ? void 0 : S.innerText);
|
|
3613
|
+
m([b], { [n]: E }), u(null), c(null), d(-1), f(b ? [b] : []);
|
|
3614
3614
|
},
|
|
3615
3615
|
[b, m, c, f, x]
|
|
3616
3616
|
), N = useDebouncedCallback(
|
|
3617
|
-
(
|
|
3618
|
-
m([b], { [n]:
|
|
3617
|
+
(C) => {
|
|
3618
|
+
m([b], { [n]: C });
|
|
3619
3619
|
},
|
|
3620
3620
|
[b, o, m, x],
|
|
3621
3621
|
1e3
|
|
3622
|
-
),
|
|
3623
|
-
(
|
|
3624
|
-
|
|
3625
|
-
const
|
|
3626
|
-
y.current = null, f([
|
|
3622
|
+
), A = useCallback(
|
|
3623
|
+
(C) => {
|
|
3624
|
+
C.preventDefault(), b && (y.current = b), _(), setTimeout(() => {
|
|
3625
|
+
const E = y.current;
|
|
3626
|
+
y.current = null, f([E]);
|
|
3627
3627
|
}, 100);
|
|
3628
3628
|
},
|
|
3629
3629
|
[f, b, x]
|
|
3630
3630
|
);
|
|
3631
3631
|
useEffect(() => {
|
|
3632
|
-
var
|
|
3632
|
+
var k;
|
|
3633
3633
|
if (!b) return;
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
}, [b,
|
|
3637
|
-
const
|
|
3634
|
+
const C = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${C}${E}`);
|
|
3635
|
+
S && ((k = S == null ? void 0 : S.classList) == null || k.add("sr-only"), u(S));
|
|
3636
|
+
}, [b, B, a, i]);
|
|
3637
|
+
const v = useMemo(() => p ? (h(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
3638
3638
|
RichTextEditor,
|
|
3639
3639
|
{
|
|
3640
|
-
blockContent:
|
|
3640
|
+
blockContent: w,
|
|
3641
3641
|
editingElement: p,
|
|
3642
3642
|
onChange: N,
|
|
3643
|
-
onClose:
|
|
3644
|
-
onEscape:
|
|
3643
|
+
onClose: _,
|
|
3644
|
+
onEscape: A
|
|
3645
3645
|
}
|
|
3646
3646
|
) : /* @__PURE__ */ jsx(
|
|
3647
3647
|
MemoizedEditor,
|
|
3648
3648
|
{
|
|
3649
3649
|
editorRef: g,
|
|
3650
|
-
blockContent:
|
|
3650
|
+
blockContent: w,
|
|
3651
3651
|
editingElement: p,
|
|
3652
|
-
onClose:
|
|
3652
|
+
onClose: _,
|
|
3653
3653
|
onChange: N,
|
|
3654
|
-
onEscape:
|
|
3654
|
+
onEscape: A
|
|
3655
3655
|
}
|
|
3656
|
-
)) : null, [p, b,
|
|
3656
|
+
)) : null, [p, b, B, w, _, x]);
|
|
3657
3657
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3658
|
-
|
|
3658
|
+
v,
|
|
3659
3659
|
r
|
|
3660
3660
|
] });
|
|
3661
3661
|
},
|
|
@@ -3694,17 +3694,17 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3694
3694
|
key: y
|
|
3695
3695
|
}) : applyLanguage(i, d, c),
|
|
3696
3696
|
[i, d, c, g, m, f, y]
|
|
3697
|
-
),
|
|
3697
|
+
), w = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
|
|
3698
3698
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3699
3699
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3700
|
-
),
|
|
3700
|
+
), _ = useMemo(
|
|
3701
3701
|
() => ({
|
|
3702
3702
|
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
|
|
3703
3703
|
inBuilder: !0,
|
|
3704
3704
|
lang: d || p,
|
|
3705
3705
|
...b,
|
|
3706
|
-
...
|
|
3707
|
-
...
|
|
3706
|
+
...w,
|
|
3707
|
+
...B,
|
|
3708
3708
|
...o
|
|
3709
3709
|
}),
|
|
3710
3710
|
[
|
|
@@ -3713,14 +3713,14 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3713
3713
|
d,
|
|
3714
3714
|
p,
|
|
3715
3715
|
b,
|
|
3716
|
-
|
|
3717
|
-
|
|
3716
|
+
w,
|
|
3717
|
+
B,
|
|
3718
3718
|
o
|
|
3719
3719
|
]
|
|
3720
3720
|
), N = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
|
|
3721
3721
|
if (isNull(x) || h.includes(i._id)) return null;
|
|
3722
|
-
let
|
|
3723
|
-
...
|
|
3722
|
+
let A = /* @__PURE__ */ jsx(Suspense, { children: createElement(x, {
|
|
3723
|
+
..._,
|
|
3724
3724
|
children: n({
|
|
3725
3725
|
_id: i._id,
|
|
3726
3726
|
_type: i._type,
|
|
@@ -3732,8 +3732,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
|
|
|
3732
3732
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3733
3733
|
})
|
|
3734
3734
|
}) });
|
|
3735
|
-
const
|
|
3736
|
-
return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children:
|
|
3735
|
+
const v = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: A }) : A;
|
|
3736
|
+
return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: v }) : v;
|
|
3737
3737
|
}, PartialWrapper = ({ children: o, partialBlockId: r }) => {
|
|
3738
3738
|
const n = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
3739
3739
|
(d) => {
|
|
@@ -4032,15 +4032,15 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4032
4032
|
const b = isArray(y) ? first(y) : y;
|
|
4033
4033
|
if (b) {
|
|
4034
4034
|
r(b == null ? void 0 : b.url);
|
|
4035
|
-
const
|
|
4035
|
+
const w = b == null ? void 0 : b.width, B = b == null ? void 0 : b.height;
|
|
4036
4036
|
if (c != null && c._id) {
|
|
4037
|
-
const
|
|
4038
|
-
...
|
|
4039
|
-
...
|
|
4037
|
+
const _ = {
|
|
4038
|
+
...w && { width: w },
|
|
4039
|
+
...B && { height: B },
|
|
4040
4040
|
...b.description && { alt: b.description }
|
|
4041
4041
|
};
|
|
4042
|
-
if (set(
|
|
4043
|
-
d([c._id],
|
|
4042
|
+
if (set(_, u, b.id), isEmpty(_)) return;
|
|
4043
|
+
d([c._id], _);
|
|
4044
4044
|
}
|
|
4045
4045
|
}
|
|
4046
4046
|
}, f = useCallback(() => {
|
|
@@ -4207,12 +4207,12 @@ const DataBindingSelector = ({
|
|
|
4207
4207
|
r(`{{${g}}}`, {}, n);
|
|
4208
4208
|
return;
|
|
4209
4209
|
}
|
|
4210
|
-
const m = (b) => /[.,!?;:]/.test(b), x = (b,
|
|
4211
|
-
let
|
|
4212
|
-
const
|
|
4213
|
-
return
|
|
4214
|
-
text:
|
|
4215
|
-
prefixLength:
|
|
4210
|
+
const m = (b) => /[.,!?;:]/.test(b), x = (b, w, B) => {
|
|
4211
|
+
let _ = "", N = "";
|
|
4212
|
+
const A = w > 0 ? b[w - 1] : "", v = w < b.length ? b[w] : "";
|
|
4213
|
+
return w > 0 && (A === "." || !m(A) && A !== " ") && (_ = " "), w < b.length && !m(v) && v !== " " && (N = " "), {
|
|
4214
|
+
text: _ + B + N,
|
|
4215
|
+
prefixLength: _.length,
|
|
4216
4216
|
suffixLength: N.length
|
|
4217
4217
|
};
|
|
4218
4218
|
}, f = document.getElementById(n);
|
|
@@ -4221,30 +4221,30 @@ const DataBindingSelector = ({
|
|
|
4221
4221
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4222
4222
|
const b = y.__chaiRTE;
|
|
4223
4223
|
if (b) {
|
|
4224
|
-
const
|
|
4224
|
+
const w = `{{${g}}}`;
|
|
4225
4225
|
b.commands.focus();
|
|
4226
|
-
const { from:
|
|
4227
|
-
if (
|
|
4228
|
-
b.chain().deleteSelection().insertContent(
|
|
4226
|
+
const { from: B, to: _ } = b.state.selection;
|
|
4227
|
+
if (B !== _)
|
|
4228
|
+
b.chain().deleteSelection().insertContent(w).run();
|
|
4229
4229
|
else {
|
|
4230
|
-
const { state:
|
|
4231
|
-
let
|
|
4232
|
-
|
|
4233
|
-
let
|
|
4234
|
-
|
|
4230
|
+
const { state: A } = b, v = A.selection.from, C = A.doc.textBetween(Math.max(0, v - 1), v), E = A.doc.textBetween(v, Math.min(v + 1, A.doc.content.size));
|
|
4231
|
+
let S = "";
|
|
4232
|
+
v > 0 && C !== " " && !m(C) && (S = " ");
|
|
4233
|
+
let k = "";
|
|
4234
|
+
E && E !== " " && !m(E) && (k = " "), b.chain().insertContent(S + w + k).run();
|
|
4235
4235
|
}
|
|
4236
4236
|
setTimeout(() => r(b.getHTML(), {}, n), 100);
|
|
4237
4237
|
return;
|
|
4238
4238
|
}
|
|
4239
4239
|
} else {
|
|
4240
|
-
const b = f,
|
|
4241
|
-
if (
|
|
4242
|
-
const
|
|
4243
|
-
r(
|
|
4240
|
+
const b = f, w = b.selectionStart || 0, B = b.value || "", _ = b.selectionEnd || w;
|
|
4241
|
+
if (_ > w) {
|
|
4242
|
+
const E = `{{${g}}}`, { text: S } = x(B, w, E), k = B.slice(0, w) + S + B.slice(_);
|
|
4243
|
+
r(k, {}, n);
|
|
4244
4244
|
return;
|
|
4245
4245
|
}
|
|
4246
|
-
const
|
|
4247
|
-
r(
|
|
4246
|
+
const A = `{{${g}}}`, { text: v } = x(B, w, A), C = B.slice(0, w) + v + B.slice(w);
|
|
4247
|
+
r(C, {}, n);
|
|
4248
4248
|
}
|
|
4249
4249
|
},
|
|
4250
4250
|
[n, r, a, c == null ? void 0 : c._id, d]
|
|
@@ -4265,74 +4265,74 @@ const DataBindingSelector = ({
|
|
|
4265
4265
|
pageTypes: r,
|
|
4266
4266
|
onChange: n
|
|
4267
4267
|
}) => {
|
|
4268
|
-
var
|
|
4269
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (
|
|
4268
|
+
var E;
|
|
4269
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), w = useRef(null), B = (E = r == null ? void 0 : r.find((S) => S.key === u)) == null ? void 0 : E.name;
|
|
4270
4270
|
useEffect(() => {
|
|
4271
4271
|
if (m(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4272
|
-
const
|
|
4273
|
-
g(
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4272
|
+
const S = split(o, ":"), k = get(S, 1, "page") || "page";
|
|
4273
|
+
g(k), (async () => {
|
|
4274
|
+
const j = await l(k, [get(S, 2, "page")]);
|
|
4275
|
+
j && Array.isArray(j) && m(get(j, [0, "name"], ""));
|
|
4276
4276
|
})();
|
|
4277
4277
|
}, [o]);
|
|
4278
|
-
const
|
|
4279
|
-
async (
|
|
4280
|
-
if (isEmpty(
|
|
4278
|
+
const _ = useDebouncedCallback(
|
|
4279
|
+
async (S) => {
|
|
4280
|
+
if (isEmpty(S))
|
|
4281
4281
|
f([]);
|
|
4282
4282
|
else {
|
|
4283
|
-
const
|
|
4284
|
-
f(
|
|
4283
|
+
const k = await l(u, S);
|
|
4284
|
+
f(k);
|
|
4285
4285
|
}
|
|
4286
4286
|
c(!1), b(-1);
|
|
4287
4287
|
},
|
|
4288
4288
|
[u],
|
|
4289
4289
|
300
|
|
4290
|
-
), N = (
|
|
4291
|
-
const
|
|
4292
|
-
|
|
4293
|
-
},
|
|
4294
|
-
switch (
|
|
4290
|
+
), N = (S) => {
|
|
4291
|
+
const k = ["pageType", u, S.id];
|
|
4292
|
+
k[1] && (n(k.join(":")), m(S.name), p(!1), f([]), b(-1));
|
|
4293
|
+
}, A = (S) => {
|
|
4294
|
+
switch (S.key) {
|
|
4295
4295
|
case "ArrowDown":
|
|
4296
|
-
|
|
4296
|
+
S.preventDefault(), b((k) => k < x.length - 1 ? k + 1 : k);
|
|
4297
4297
|
break;
|
|
4298
4298
|
case "ArrowUp":
|
|
4299
|
-
|
|
4299
|
+
S.preventDefault(), b((k) => k > 0 ? k - 1 : k);
|
|
4300
4300
|
break;
|
|
4301
4301
|
case "Enter":
|
|
4302
|
-
if (
|
|
4302
|
+
if (S.preventDefault(), x.length === 0) return;
|
|
4303
4303
|
y >= 0 && N(x[y]);
|
|
4304
4304
|
break;
|
|
4305
4305
|
case "Escape":
|
|
4306
|
-
|
|
4306
|
+
S.preventDefault(), v();
|
|
4307
4307
|
break;
|
|
4308
4308
|
}
|
|
4309
4309
|
};
|
|
4310
4310
|
useEffect(() => {
|
|
4311
|
-
if (y >= 0 &&
|
|
4312
|
-
const
|
|
4313
|
-
|
|
4311
|
+
if (y >= 0 && w.current) {
|
|
4312
|
+
const S = w.current.children[y];
|
|
4313
|
+
S == null || S.scrollIntoView({ block: "nearest" });
|
|
4314
4314
|
}
|
|
4315
4315
|
}, [y]);
|
|
4316
|
-
const
|
|
4316
|
+
const v = () => {
|
|
4317
4317
|
m(""), f([]), b(-1), p(!1), n("");
|
|
4318
|
-
},
|
|
4319
|
-
m(
|
|
4318
|
+
}, C = (S) => {
|
|
4319
|
+
m(S), p(!isEmpty(S)), c(!0), _(S);
|
|
4320
4320
|
};
|
|
4321
4321
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4322
|
-
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (
|
|
4322
|
+
/* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(r, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
|
|
4323
4323
|
u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
|
|
4324
4324
|
/* @__PURE__ */ jsx(
|
|
4325
4325
|
"input",
|
|
4326
4326
|
{
|
|
4327
4327
|
type: "text",
|
|
4328
4328
|
value: h,
|
|
4329
|
-
onChange: (
|
|
4330
|
-
onKeyDown:
|
|
4331
|
-
placeholder: a(`Search ${
|
|
4329
|
+
onChange: (S) => C(S.target.value),
|
|
4330
|
+
onKeyDown: A,
|
|
4331
|
+
placeholder: a(`Search ${B ?? ""}`),
|
|
4332
4332
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4333
4333
|
}
|
|
4334
4334
|
),
|
|
4335
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick:
|
|
4335
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: v, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
4336
4336
|
] }),
|
|
4337
4337
|
(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: [
|
|
4338
4338
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
@@ -4342,22 +4342,22 @@ const DataBindingSelector = ({
|
|
|
4342
4342
|
' "',
|
|
4343
4343
|
h,
|
|
4344
4344
|
'"'
|
|
4345
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref:
|
|
4345
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: w, children: map(x == null ? void 0 : x.slice(0, 20), (S, k) => /* @__PURE__ */ jsxs(
|
|
4346
4346
|
"li",
|
|
4347
4347
|
{
|
|
4348
|
-
onClick: () => N(
|
|
4349
|
-
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(
|
|
4348
|
+
onClick: () => N(S),
|
|
4349
|
+
className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : k === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
|
|
4350
4350
|
children: [
|
|
4351
|
-
|
|
4351
|
+
S.name,
|
|
4352
4352
|
" ",
|
|
4353
|
-
|
|
4353
|
+
S.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
|
|
4354
4354
|
"( ",
|
|
4355
|
-
|
|
4355
|
+
S.slug,
|
|
4356
4356
|
" )"
|
|
4357
4357
|
] })
|
|
4358
4358
|
]
|
|
4359
4359
|
},
|
|
4360
|
-
|
|
4360
|
+
S.id
|
|
4361
4361
|
)) }) })
|
|
4362
4362
|
] });
|
|
4363
4363
|
}, LinkField = ({ schema: o, formData: r, onChange: n, name: a }) => {
|
|
@@ -4661,11 +4661,11 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4661
4661
|
if (x !== f)
|
|
4662
4662
|
u.chain().deleteSelection().insertContent(m).run();
|
|
4663
4663
|
else {
|
|
4664
|
-
const { state: b } = u,
|
|
4664
|
+
const { state: b } = u, w = b.selection.from, B = b.doc.textBetween(Math.max(0, w - 1), w), _ = b.doc.textBetween(w, Math.min(w + 1, b.doc.content.size));
|
|
4665
4665
|
let N = "";
|
|
4666
|
-
|
|
4667
|
-
let
|
|
4668
|
-
|
|
4666
|
+
w > 0 && B !== " " && !/[.,!?;:]/.test(B) && (N = " ");
|
|
4667
|
+
let A = "";
|
|
4668
|
+
_ && _ !== " " && !/[.,!?;:]/.test(_) && (A = " "), u.chain().insertContent(N + m + A).run();
|
|
4669
4669
|
}
|
|
4670
4670
|
};
|
|
4671
4671
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && r(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4965,25 +4965,25 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4965
4965
|
const { selectedLang: h, fallbackLang: m, languages: x } = useLanguages(), f = useMemo(
|
|
4966
4966
|
() => isEmpty(x) ? "" : isEmpty(h) ? m : h,
|
|
4967
4967
|
[x, h, m]
|
|
4968
|
-
), y = useMemo(() => get(LANGUAGES, f, f), [f]), b = usePageExternalData(),
|
|
4969
|
-
() => get(
|
|
4970
|
-
[
|
|
4971
|
-
), [N,
|
|
4968
|
+
), y = useMemo(() => get(LANGUAGES, f, f), [f]), b = usePageExternalData(), w = useSelectedBlock(), B = useRegisteredChaiBlocks(), _ = useMemo(
|
|
4969
|
+
() => get(B, [w == null ? void 0 : w._type, "i18nProps"], []),
|
|
4970
|
+
[B, w == null ? void 0 : w._type]
|
|
4971
|
+
), [N, A] = useState(null);
|
|
4972
4972
|
if (c)
|
|
4973
4973
|
return null;
|
|
4974
4974
|
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
|
|
4975
|
-
const
|
|
4975
|
+
const C = _ == null ? void 0 : _.includes(o.replace("root.", ""));
|
|
4976
4976
|
if (p.type === "array") {
|
|
4977
|
-
const
|
|
4977
|
+
const E = N === o;
|
|
4978
4978
|
return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
|
|
4979
4979
|
p.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
|
|
4980
4980
|
"label",
|
|
4981
4981
|
{
|
|
4982
4982
|
htmlFor: o,
|
|
4983
|
-
onClick: () =>
|
|
4983
|
+
onClick: () => A(E ? null : o),
|
|
4984
4984
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4985
4985
|
children: [
|
|
4986
|
-
|
|
4986
|
+
E ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
4987
4987
|
/* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
|
|
4988
4988
|
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: n }),
|
|
4989
4989
|
" ",
|
|
@@ -4993,8 +4993,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
4993
4993
|
Info,
|
|
4994
4994
|
{
|
|
4995
4995
|
className: "h-3 w-3 text-muted-foreground/70",
|
|
4996
|
-
onClick: (
|
|
4997
|
-
onMouseDown: (
|
|
4996
|
+
onClick: (S) => S.stopPropagation(),
|
|
4997
|
+
onMouseDown: (S) => S.stopPropagation()
|
|
4998
4998
|
}
|
|
4999
4999
|
) }),
|
|
5000
5000
|
/* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
|
|
@@ -5002,7 +5002,7 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5002
5002
|
]
|
|
5003
5003
|
}
|
|
5004
5004
|
) }),
|
|
5005
|
-
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${
|
|
5005
|
+
(u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${E ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
|
|
5006
5006
|
a,
|
|
5007
5007
|
l,
|
|
5008
5008
|
i
|
|
@@ -5015,7 +5015,7 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5015
5015
|
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
5016
5016
|
n,
|
|
5017
5017
|
" ",
|
|
5018
|
-
|
|
5018
|
+
C && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5019
5019
|
" ",
|
|
5020
5020
|
y
|
|
5021
5021
|
] }),
|
|
@@ -5030,8 +5030,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5030
5030
|
DataBindingSelector,
|
|
5031
5031
|
{
|
|
5032
5032
|
schema: p,
|
|
5033
|
-
onChange: (
|
|
5034
|
-
g(
|
|
5033
|
+
onChange: (E) => {
|
|
5034
|
+
g(E, u, o);
|
|
5035
5035
|
},
|
|
5036
5036
|
id: o,
|
|
5037
5037
|
formData: u
|
|
@@ -5137,43 +5137,43 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
|
|
|
5137
5137
|
}), a;
|
|
5138
5138
|
};
|
|
5139
5139
|
function BlockSettings() {
|
|
5140
|
-
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), x = ({ formData:
|
|
5141
|
-
|
|
5140
|
+
const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), x = ({ formData: A }, v, C) => {
|
|
5141
|
+
v && (c == null ? void 0 : c._id) === r._id && a([r._id], { [v]: get(A, v) }, C);
|
|
5142
5142
|
}, f = useCallback(
|
|
5143
|
-
debounce(({ formData:
|
|
5144
|
-
x({ formData:
|
|
5143
|
+
debounce(({ formData: A }, v, C) => {
|
|
5144
|
+
x({ formData: A }, v, C), d(A);
|
|
5145
5145
|
}, 1500),
|
|
5146
5146
|
[r == null ? void 0 : r._id, o]
|
|
5147
|
-
), y = ({ formData:
|
|
5148
|
-
|
|
5149
|
-
}, b = ({ formData:
|
|
5150
|
-
|
|
5151
|
-
}, { schema:
|
|
5152
|
-
const
|
|
5153
|
-
if (!
|
|
5147
|
+
), y = ({ formData: A }, v) => {
|
|
5148
|
+
v && (n([r._id], { [v]: get(A, v) }), f({ formData: A }, v, { [v]: get(c, v) }));
|
|
5149
|
+
}, b = ({ formData: A }, v) => {
|
|
5150
|
+
v && (n([g._id], { [v]: get(A, v) }), f({ formData: A }, v, { [v]: get(c, v) }));
|
|
5151
|
+
}, { schema: w, uiSchema: B } = useMemo(() => {
|
|
5152
|
+
const A = r == null ? void 0 : r._type;
|
|
5153
|
+
if (!A)
|
|
5154
5154
|
return { schema: {}, uiSchema: {} };
|
|
5155
5155
|
try {
|
|
5156
|
-
const { schema:
|
|
5157
|
-
if (
|
|
5158
|
-
const
|
|
5159
|
-
startsWith(
|
|
5156
|
+
const { schema: v, uiSchema: C } = getBlockFormSchemas(A);
|
|
5157
|
+
if (A === "Repeater") {
|
|
5158
|
+
const E = get(r, "repeaterItems", "");
|
|
5159
|
+
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(C, "filter", { "ui:widget": "collectionSelect" }), set(C, "sort", { "ui:widget": "collectionSelect" })) : (set(C, "filter", { "ui:widget": "hidden" }), set(C, "sort", { "ui:widget": "hidden" }));
|
|
5160
5160
|
}
|
|
5161
|
-
return { schema:
|
|
5161
|
+
return { schema: v, uiSchema: C };
|
|
5162
5162
|
} catch {
|
|
5163
5163
|
return { schema: {}, uiSchema: {} };
|
|
5164
5164
|
}
|
|
5165
|
-
}, [r]), { wrapperSchema:
|
|
5165
|
+
}, [r]), { wrapperSchema: _, wrapperUiSchema: N } = useMemo(() => {
|
|
5166
5166
|
if (!g || !(g != null && g._type))
|
|
5167
5167
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5168
|
-
const
|
|
5169
|
-
return { wrapperSchema:
|
|
5168
|
+
const A = g == null ? void 0 : g._type, { schema: v = {}, uiSchema: C = {} } = getBlockFormSchemas(A);
|
|
5169
|
+
return { wrapperSchema: v, wrapperUiSchema: C };
|
|
5170
5170
|
}, [g]);
|
|
5171
5171
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5172
5172
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5173
5173
|
/* @__PURE__ */ jsxs(
|
|
5174
5174
|
"div",
|
|
5175
5175
|
{
|
|
5176
|
-
onClick: () => u((
|
|
5176
|
+
onClick: () => u((A) => !A),
|
|
5177
5177
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5178
5178
|
children: [
|
|
5179
5179
|
p ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 stroke-[3] text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 stroke-[3] text-slate-400" }),
|
|
@@ -5194,19 +5194,19 @@ function BlockSettings() {
|
|
|
5194
5194
|
blockId: g == null ? void 0 : g._id,
|
|
5195
5195
|
onChange: b,
|
|
5196
5196
|
formData: m,
|
|
5197
|
-
schema:
|
|
5197
|
+
schema: _,
|
|
5198
5198
|
uiSchema: N
|
|
5199
5199
|
}
|
|
5200
5200
|
) })
|
|
5201
5201
|
] }),
|
|
5202
|
-
isEmpty(
|
|
5202
|
+
isEmpty(w) ? null : /* @__PURE__ */ jsx(
|
|
5203
5203
|
JSONForm,
|
|
5204
5204
|
{
|
|
5205
5205
|
blockId: r == null ? void 0 : r._id,
|
|
5206
5206
|
onChange: y,
|
|
5207
5207
|
formData: i,
|
|
5208
|
-
schema:
|
|
5209
|
-
uiSchema:
|
|
5208
|
+
schema: w,
|
|
5209
|
+
uiSchema: B
|
|
5210
5210
|
}
|
|
5211
5211
|
)
|
|
5212
5212
|
] });
|
|
@@ -5417,50 +5417,50 @@ const BlockStylingProps = () => {
|
|
|
5417
5417
|
},
|
|
5418
5418
|
a
|
|
5419
5419
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5420
|
-
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [
|
|
5420
|
+
const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [w, B] = useState(!1), [_, N] = useState(!1);
|
|
5421
5421
|
useEffect(() => {
|
|
5422
|
-
const { value:
|
|
5423
|
-
if (
|
|
5424
|
-
l(
|
|
5422
|
+
const { value: S, unit: k } = getClassValueAndUnit(i);
|
|
5423
|
+
if (k === "") {
|
|
5424
|
+
l(S), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
|
|
5425
5425
|
return;
|
|
5426
5426
|
}
|
|
5427
|
-
m(
|
|
5427
|
+
m(k), l(k === "class" || isEmpty(S) ? "" : S);
|
|
5428
5428
|
}, [i, p, u]);
|
|
5429
|
-
const
|
|
5430
|
-
(
|
|
5431
|
-
const
|
|
5432
|
-
if (get(
|
|
5429
|
+
const A = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), v = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), C = useCallback(
|
|
5430
|
+
(S = !1) => {
|
|
5431
|
+
const k = getUserInputValues(`${a}`, u);
|
|
5432
|
+
if (get(k, "error", !1)) {
|
|
5433
5433
|
f(!0);
|
|
5434
5434
|
return;
|
|
5435
5435
|
}
|
|
5436
|
-
const
|
|
5437
|
-
if (
|
|
5438
|
-
|
|
5436
|
+
const j = get(k, "unit") !== "" ? get(k, "unit") : h;
|
|
5437
|
+
if (j === "auto" || j === "none") {
|
|
5438
|
+
A(`${d}${j}`);
|
|
5439
5439
|
return;
|
|
5440
5440
|
}
|
|
5441
|
-
if (get(
|
|
5441
|
+
if (get(k, "value") === "")
|
|
5442
5442
|
return;
|
|
5443
|
-
const T = `${get(
|
|
5444
|
-
|
|
5443
|
+
const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5444
|
+
S ? v(T) : A(T);
|
|
5445
5445
|
},
|
|
5446
|
-
[
|
|
5447
|
-
),
|
|
5448
|
-
(
|
|
5449
|
-
const
|
|
5450
|
-
if (get(
|
|
5446
|
+
[A, v, a, h, d, u]
|
|
5447
|
+
), E = useCallback(
|
|
5448
|
+
(S) => {
|
|
5449
|
+
const k = getUserInputValues(`${a}`, u);
|
|
5450
|
+
if (get(k, "error", !1)) {
|
|
5451
5451
|
f(!0);
|
|
5452
5452
|
return;
|
|
5453
5453
|
}
|
|
5454
|
-
if (
|
|
5455
|
-
|
|
5454
|
+
if (S === "auto" || S === "none") {
|
|
5455
|
+
A(`${d}${S}`);
|
|
5456
5456
|
return;
|
|
5457
5457
|
}
|
|
5458
|
-
if (get(
|
|
5458
|
+
if (get(k, "value") === "")
|
|
5459
5459
|
return;
|
|
5460
|
-
const
|
|
5461
|
-
|
|
5460
|
+
const j = get(k, "unit") !== "" ? get(k, "unit") : S, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
|
|
5461
|
+
A(T);
|
|
5462
5462
|
},
|
|
5463
|
-
[
|
|
5463
|
+
[A, a, d, u]
|
|
5464
5464
|
);
|
|
5465
5465
|
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5466
5466
|
/* @__PURE__ */ jsx(
|
|
@@ -5475,37 +5475,37 @@ const BlockStylingProps = () => {
|
|
|
5475
5475
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
|
|
5476
5476
|
/* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
|
|
5477
5477
|
] })
|
|
5478
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${
|
|
5478
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${w ? "z-auto" : ""}`, children: [
|
|
5479
5479
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
|
|
5480
5480
|
["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsx(
|
|
5481
5481
|
"input",
|
|
5482
5482
|
{
|
|
5483
5483
|
readOnly: h === "class",
|
|
5484
|
-
onKeyPress: (
|
|
5485
|
-
|
|
5484
|
+
onKeyPress: (S) => {
|
|
5485
|
+
S.key === "Enter" && C();
|
|
5486
5486
|
},
|
|
5487
|
-
onKeyDown: (
|
|
5488
|
-
if (
|
|
5487
|
+
onKeyDown: (S) => {
|
|
5488
|
+
if (S.keyCode !== 38 && S.keyCode !== 40)
|
|
5489
5489
|
return;
|
|
5490
|
-
|
|
5491
|
-
const
|
|
5492
|
-
let
|
|
5493
|
-
|
|
5494
|
-
const I = `${
|
|
5495
|
-
|
|
5490
|
+
S.preventDefault(), N(!0);
|
|
5491
|
+
const k = parseInt$1(S.target.value);
|
|
5492
|
+
let j = isNaN$1(k) ? 0 : k;
|
|
5493
|
+
S.keyCode === 38 && (j += 1), S.keyCode === 40 && (j -= 1);
|
|
5494
|
+
const I = `${j}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5495
|
+
v(P);
|
|
5496
5496
|
},
|
|
5497
|
-
onKeyUp: (
|
|
5498
|
-
|
|
5497
|
+
onKeyUp: (S) => {
|
|
5498
|
+
_ && (S.preventDefault(), N(!1));
|
|
5499
5499
|
},
|
|
5500
|
-
onBlur: () =>
|
|
5501
|
-
onChange: (
|
|
5502
|
-
f(!1), l(
|
|
5500
|
+
onBlur: () => C(),
|
|
5501
|
+
onChange: (S) => {
|
|
5502
|
+
f(!1), l(S.target.value);
|
|
5503
5503
|
},
|
|
5504
|
-
onClick: (
|
|
5505
|
-
var
|
|
5506
|
-
(
|
|
5504
|
+
onClick: (S) => {
|
|
5505
|
+
var k;
|
|
5506
|
+
(k = S == null ? void 0 : S.target) == null || k.select(), n(!1);
|
|
5507
5507
|
},
|
|
5508
|
-
value:
|
|
5508
|
+
value: w ? y : a,
|
|
5509
5509
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5510
5510
|
" ",
|
|
5511
5511
|
x ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
@@ -5530,29 +5530,29 @@ const BlockStylingProps = () => {
|
|
|
5530
5530
|
{
|
|
5531
5531
|
units: u,
|
|
5532
5532
|
current: h,
|
|
5533
|
-
onSelect: (
|
|
5534
|
-
n(!1), m(
|
|
5533
|
+
onSelect: (S) => {
|
|
5534
|
+
n(!1), m(S), E(S);
|
|
5535
5535
|
}
|
|
5536
5536
|
}
|
|
5537
5537
|
) })
|
|
5538
5538
|
] })
|
|
5539
5539
|
] }),
|
|
5540
|
-
["none", "auto"].indexOf(h) !== -1 ||
|
|
5540
|
+
["none", "auto"].indexOf(h) !== -1 || w ? null : /* @__PURE__ */ jsx(
|
|
5541
5541
|
DragStyleButton,
|
|
5542
5542
|
{
|
|
5543
|
-
onDragStart: () =>
|
|
5544
|
-
onDragEnd: (
|
|
5545
|
-
if (b(() => ""),
|
|
5543
|
+
onDragStart: () => B(!0),
|
|
5544
|
+
onDragEnd: (S) => {
|
|
5545
|
+
if (b(() => ""), B(!1), isEmpty(S))
|
|
5546
5546
|
return;
|
|
5547
|
-
const
|
|
5548
|
-
|
|
5547
|
+
const k = `${S}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5548
|
+
A(I);
|
|
5549
5549
|
},
|
|
5550
|
-
onDrag: (
|
|
5551
|
-
if (isEmpty(
|
|
5550
|
+
onDrag: (S) => {
|
|
5551
|
+
if (isEmpty(S))
|
|
5552
5552
|
return;
|
|
5553
|
-
b(
|
|
5554
|
-
const
|
|
5555
|
-
|
|
5553
|
+
b(S);
|
|
5554
|
+
const k = `${S}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
|
|
5555
|
+
v(I);
|
|
5556
5556
|
},
|
|
5557
5557
|
currentValue: a,
|
|
5558
5558
|
unit: h,
|
|
@@ -6016,34 +6016,34 @@ const COLOR_PROP = {
|
|
|
6016
6016
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6017
6017
|
const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6018
6018
|
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
|
|
6019
|
-
(
|
|
6020
|
-
const
|
|
6021
|
-
(p || u !== "") && (
|
|
6022
|
-
const
|
|
6023
|
-
m(f, [
|
|
6019
|
+
(v, C = !0) => {
|
|
6020
|
+
const E = { dark: p, mq: g, mod: u, cls: v, property: l, fullCls: "" };
|
|
6021
|
+
(p || u !== "") && (E.mq = "xs");
|
|
6022
|
+
const S = generateFullClsName(E);
|
|
6023
|
+
m(f, [S], C);
|
|
6024
6024
|
},
|
|
6025
6025
|
[f, p, g, u, l, m]
|
|
6026
|
-
),
|
|
6026
|
+
), w = useCallback(() => {
|
|
6027
6027
|
x(f, [y], !0);
|
|
6028
|
-
}, [f, y, x]),
|
|
6028
|
+
}, [f, y, x]), B = useMemo(() => canChangeClass(h, g), [h, g]);
|
|
6029
6029
|
useEffect(() => {
|
|
6030
|
-
i(
|
|
6031
|
-
}, [
|
|
6032
|
-
const [, ,
|
|
6033
|
-
(
|
|
6034
|
-
|
|
6030
|
+
i(B, h);
|
|
6031
|
+
}, [B, i, h]);
|
|
6032
|
+
const [, , _] = useScreenSizeWidth(), N = useCallback(
|
|
6033
|
+
(v) => {
|
|
6034
|
+
_({
|
|
6035
6035
|
xs: 400,
|
|
6036
6036
|
sm: 640,
|
|
6037
6037
|
md: 800,
|
|
6038
6038
|
lg: 1024,
|
|
6039
6039
|
xl: 1420,
|
|
6040
6040
|
"2xl": 1920
|
|
6041
|
-
}[
|
|
6041
|
+
}[v]);
|
|
6042
6042
|
},
|
|
6043
|
-
[
|
|
6044
|
-
),
|
|
6045
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange:
|
|
6046
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !
|
|
6043
|
+
[_]
|
|
6044
|
+
), A = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
|
|
6045
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: h && A, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6046
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !A ? "text-foreground" : ""}`, children: r(a) }) }),
|
|
6047
6047
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6048
6048
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
6049
6049
|
n === "arbitrary" ? /* @__PURE__ */ jsx(
|
|
@@ -6062,7 +6062,7 @@ const COLOR_PROP = {
|
|
|
6062
6062
|
n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6063
6063
|
n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6064
6064
|
] }),
|
|
6065
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children:
|
|
6065
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => w(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6066
6066
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6067
6067
|
"button",
|
|
6068
6068
|
{
|
|
@@ -6283,7 +6283,7 @@ const COLOR_PROP = {
|
|
|
6283
6283
|
tooltip: n = !0
|
|
6284
6284
|
}) => {
|
|
6285
6285
|
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
|
|
6286
|
-
u.includes(b) ? u.length > 2 && g(u.filter((
|
|
6286
|
+
u.includes(b) ? u.length > 2 && g(u.filter((w) => w !== b)) : g((w) => [...w, b]);
|
|
6287
6287
|
}, f = (b) => {
|
|
6288
6288
|
r || l(b), c(b);
|
|
6289
6289
|
}, y = getBreakpointValue(r ? i : a).toLowerCase();
|
|
@@ -6463,10 +6463,10 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6463
6463
|
};
|
|
6464
6464
|
function ManualClasses() {
|
|
6465
6465
|
var I;
|
|
6466
|
-
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")),
|
|
6466
|
+
const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), w = b.split(" ").filter((T) => !isEmpty(T)), B = () => {
|
|
6467
6467
|
const T = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6468
6468
|
u(h, T, !0), f("");
|
|
6469
|
-
}, [
|
|
6469
|
+
}, [_, N] = useState([]), A = ({ value: T }) => {
|
|
6470
6470
|
const P = T.trim().toLowerCase(), L = P.match(/.+:/g);
|
|
6471
6471
|
let D = [];
|
|
6472
6472
|
if (L && L.length > 0) {
|
|
@@ -6478,9 +6478,9 @@ function ManualClasses() {
|
|
|
6478
6478
|
} else
|
|
6479
6479
|
D = i.search(P);
|
|
6480
6480
|
return N(map(D, "item"));
|
|
6481
|
-
},
|
|
6481
|
+
}, v = () => {
|
|
6482
6482
|
N([]);
|
|
6483
|
-
},
|
|
6483
|
+
}, C = (T) => T.name, E = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), S = useMemo(
|
|
6484
6484
|
() => ({
|
|
6485
6485
|
ref: o,
|
|
6486
6486
|
autoComplete: "off",
|
|
@@ -6495,29 +6495,29 @@ function ManualClasses() {
|
|
|
6495
6495
|
}, 0);
|
|
6496
6496
|
},
|
|
6497
6497
|
onKeyDown: (T) => {
|
|
6498
|
-
T.key === "Enter" && x.trim() !== "" &&
|
|
6498
|
+
T.key === "Enter" && x.trim() !== "" && B();
|
|
6499
6499
|
},
|
|
6500
6500
|
onChange: (T, { newValue: P }) => f(P),
|
|
6501
6501
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6502
6502
|
}),
|
|
6503
6503
|
[x, c, o]
|
|
6504
|
-
),
|
|
6504
|
+
), k = (T) => {
|
|
6505
6505
|
debugger;
|
|
6506
6506
|
const P = r.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6507
6507
|
g(h, [T]), u(h, P, !0), n(""), l(-1);
|
|
6508
|
-
},
|
|
6508
|
+
}, j = () => {
|
|
6509
6509
|
if (navigator.clipboard === void 0) {
|
|
6510
6510
|
toast.error(c("Clipboard not supported"));
|
|
6511
6511
|
return;
|
|
6512
6512
|
}
|
|
6513
|
-
navigator.clipboard.writeText(
|
|
6513
|
+
navigator.clipboard.writeText(w.join(" ")), toast.success(c("Classes copied to clipboard"));
|
|
6514
6514
|
};
|
|
6515
6515
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
|
|
6516
6516
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
6517
6517
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
|
|
6518
6518
|
/* @__PURE__ */ jsx("span", { children: c("Classes") }),
|
|
6519
6519
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6520
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick:
|
|
6520
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: j, className: "cursor-pointer" }) }),
|
|
6521
6521
|
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
|
|
6522
6522
|
] })
|
|
6523
6523
|
] }),
|
|
@@ -6533,12 +6533,12 @@ function ManualClasses() {
|
|
|
6533
6533
|
/* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
|
|
6534
6534
|
Autosuggest,
|
|
6535
6535
|
{
|
|
6536
|
-
suggestions:
|
|
6537
|
-
onSuggestionsFetchRequested:
|
|
6538
|
-
onSuggestionsClearRequested:
|
|
6539
|
-
getSuggestionValue:
|
|
6540
|
-
renderSuggestion:
|
|
6541
|
-
inputProps:
|
|
6536
|
+
suggestions: _,
|
|
6537
|
+
onSuggestionsFetchRequested: A,
|
|
6538
|
+
onSuggestionsClearRequested: v,
|
|
6539
|
+
getSuggestionValue: C,
|
|
6540
|
+
renderSuggestion: E,
|
|
6541
|
+
inputProps: S,
|
|
6542
6542
|
containerProps: {
|
|
6543
6543
|
className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
|
|
6544
6544
|
},
|
|
@@ -6554,14 +6554,14 @@ function ManualClasses() {
|
|
|
6554
6554
|
{
|
|
6555
6555
|
variant: "outline",
|
|
6556
6556
|
className: "h-6 border-border",
|
|
6557
|
-
onClick:
|
|
6557
|
+
onClick: B,
|
|
6558
6558
|
disabled: x.trim() === "",
|
|
6559
6559
|
size: "sm",
|
|
6560
6560
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
6561
6561
|
}
|
|
6562
6562
|
)
|
|
6563
6563
|
] }),
|
|
6564
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children:
|
|
6564
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: w.map(
|
|
6565
6565
|
(T, P) => a === P ? /* @__PURE__ */ jsx(
|
|
6566
6566
|
"input",
|
|
6567
6567
|
{
|
|
@@ -6569,10 +6569,10 @@ function ManualClasses() {
|
|
|
6569
6569
|
value: r,
|
|
6570
6570
|
onChange: (L) => n(L.target.value),
|
|
6571
6571
|
onBlur: () => {
|
|
6572
|
-
|
|
6572
|
+
k(T);
|
|
6573
6573
|
},
|
|
6574
6574
|
onKeyDown: (L) => {
|
|
6575
|
-
L.key === "Enter" &&
|
|
6575
|
+
L.key === "Enter" && k(T);
|
|
6576
6576
|
},
|
|
6577
6577
|
onFocus: (L) => {
|
|
6578
6578
|
setTimeout(() => {
|
|
@@ -6832,306 +6832,6 @@ const CoreBlock = ({
|
|
|
6832
6832
|
blocks: l.core
|
|
6833
6833
|
}
|
|
6834
6834
|
);
|
|
6835
|
-
}, hasVideoEmbed = (o) => {
|
|
6836
|
-
const r = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, n = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
6837
|
-
return r.test(o) || n.test(o);
|
|
6838
|
-
}, getVideoURLFromHTML = (o) => {
|
|
6839
|
-
if (isEmpty(o)) return o;
|
|
6840
|
-
const r = /<video[^>]+src=['"]([^'">]+)['"]/, n = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = o.match(r), l = o.match(n), i = a ? a[1] : l ? l[1] : null, c = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, d = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
6841
|
-
return i && (c.test(i) || d.test(i)) ? i : o;
|
|
6842
|
-
}, NAME_ATTRIBUTES = ["chai-name", "data-chai-name"], ATTRIBUTE_MAP = {
|
|
6843
|
-
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
6844
|
-
video: {
|
|
6845
|
-
src: "url",
|
|
6846
|
-
autoplay: "controls.autoPlay",
|
|
6847
|
-
muted: "controls.muted",
|
|
6848
|
-
loop: "controls.loop",
|
|
6849
|
-
controls: "controls.widgets"
|
|
6850
|
-
},
|
|
6851
|
-
a: {
|
|
6852
|
-
href: "link.href",
|
|
6853
|
-
target: "link.target",
|
|
6854
|
-
type: ""
|
|
6855
|
-
// @TODO: Detect here what to url, email, phone, elementId
|
|
6856
|
-
},
|
|
6857
|
-
input: {
|
|
6858
|
-
placeholder: "placeholder",
|
|
6859
|
-
required: "required",
|
|
6860
|
-
type: "inputType",
|
|
6861
|
-
name: "fieldName"
|
|
6862
|
-
},
|
|
6863
|
-
textarea: {
|
|
6864
|
-
placeholder: "placeholder",
|
|
6865
|
-
required: "required",
|
|
6866
|
-
type: "inputType",
|
|
6867
|
-
name: "fieldName"
|
|
6868
|
-
},
|
|
6869
|
-
select: {
|
|
6870
|
-
placeholder: "placeholder",
|
|
6871
|
-
required: "required",
|
|
6872
|
-
multiple: "multiple",
|
|
6873
|
-
name: "fieldName"
|
|
6874
|
-
},
|
|
6875
|
-
form: {
|
|
6876
|
-
action: "action"
|
|
6877
|
-
}
|
|
6878
|
-
}, shouldAddText = (o, r) => o.children.length === 1 && includes(
|
|
6879
|
-
["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
|
|
6880
|
-
r._type
|
|
6881
|
-
), getTextContent = (o) => o.map((r) => r.type === "text" ? get(r, "content", "") : isEmpty(r.children) ? "" : getTextContent(r.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getHeightAndWidthFromClass = (o) => {
|
|
6882
|
-
const r = compact(map(o.split(/\s+/), trim)), n = find(r, (d) => /^w-/.test(d)), a = find(r, (d) => /^h-/.test(d));
|
|
6883
|
-
if (!a || !n) return { height: "", width: "" };
|
|
6884
|
-
const l = (d) => {
|
|
6885
|
-
if (!d) return;
|
|
6886
|
-
const p = d.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);
|
|
6887
|
-
if (!p) return;
|
|
6888
|
-
if (p[1]) return p[1];
|
|
6889
|
-
const u = p[2];
|
|
6890
|
-
return /^\d+(\.\d+)?$/.test(u) ? `${Number(u) * 4}px` : u === "auto" || includes(u, "%") ? u : "16px";
|
|
6891
|
-
}, i = l(n), c = l(a);
|
|
6892
|
-
return {
|
|
6893
|
-
width: includes(i, "px") ? i : "16px",
|
|
6894
|
-
height: includes(c, "px") ? c : "16px"
|
|
6895
|
-
};
|
|
6896
|
-
}, getAttrs = (o) => {
|
|
6897
|
-
if (o.tagName === "svg") return {};
|
|
6898
|
-
const r = {}, n = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
|
|
6899
|
-
return forEach(a, ({ key: l, value: i }) => {
|
|
6900
|
-
if (!includes(NAME_ATTRIBUTES, l))
|
|
6901
|
-
if (n[l]) {
|
|
6902
|
-
if (o.tagName === "img" && l === "src" && !i.startsWith("http")) {
|
|
6903
|
-
const c = find(o.attributes, { key: "width" }), d = find(o.attributes, { key: "height" });
|
|
6904
|
-
c && d ? i = `https://via.placeholder.com/${c == null ? void 0 : c.value}x${d == null ? void 0 : d.value}` : i = "https://via.placeholder.com/150x150";
|
|
6905
|
-
}
|
|
6906
|
-
set(r, n[l], getSanitizedValue(i));
|
|
6907
|
-
} else includes(["style", "class", "srcset"], l) || (has(r, "styles_attrs") || (r.styles_attrs = {}), startsWith(l, "@") && (l = l.replace("@", "x-on:")), r.styles_attrs[`${l}`] = getSanitizedValue(i));
|
|
6908
|
-
}), delete r.class, r;
|
|
6909
|
-
}, getStyles = (o, r = "styles") => {
|
|
6910
|
-
if (!o.attributes) return { [r]: `${STYLES_KEY},` };
|
|
6911
|
-
const n = find(o.attributes, { key: "class" });
|
|
6912
|
-
if (n) {
|
|
6913
|
-
const a = n.value;
|
|
6914
|
-
return { [r]: `${STYLES_KEY},${a}` };
|
|
6915
|
-
}
|
|
6916
|
-
return { [r]: `${STYLES_KEY},` };
|
|
6917
|
-
}, getBlockProps = (o) => {
|
|
6918
|
-
const r = get(o, "attributes", []), n = r.find((d) => d.key === "data-chai-richtext" || d.key === "chai-richtext"), a = r.find((d) => d.key === "data-chai-lightbox" || d.key === "chai-lightbox"), l = r.find((d) => d.key === "data-chai-dropdown" || d.key === "chai-dropdown"), i = r.find(
|
|
6919
|
-
(d) => d.key === "data-chai-dropdown-button" || d.key === "chai-dropdown-button"
|
|
6920
|
-
), c = r.find(
|
|
6921
|
-
(d) => d.key === "data-chai-dropdown-content" || d.key === "chai-dropdown-content"
|
|
6922
|
-
);
|
|
6923
|
-
if (l)
|
|
6924
|
-
return { _type: "Dropdown" };
|
|
6925
|
-
if (i)
|
|
6926
|
-
return { _type: "DropdownButton" };
|
|
6927
|
-
if (c)
|
|
6928
|
-
return { _type: "DropdownContent" };
|
|
6929
|
-
if (n)
|
|
6930
|
-
return { _type: "RichText" };
|
|
6931
|
-
if (a)
|
|
6932
|
-
return { _type: "LightBoxLink" };
|
|
6933
|
-
switch (o.tagName) {
|
|
6934
|
-
// self closing tags
|
|
6935
|
-
case "img":
|
|
6936
|
-
return { _type: "Image" };
|
|
6937
|
-
case "input":
|
|
6938
|
-
return { _type: "Input", showLabel: !1 };
|
|
6939
|
-
// showLabel: hiding default block label
|
|
6940
|
-
case "hr":
|
|
6941
|
-
return { _type: "Divider" };
|
|
6942
|
-
case "br":
|
|
6943
|
-
return { _type: "LineBreak" };
|
|
6944
|
-
case "textarea":
|
|
6945
|
-
return { _type: "TextArea", showLabel: !1 };
|
|
6946
|
-
case "audio":
|
|
6947
|
-
return { _type: "Audio" };
|
|
6948
|
-
case "canvas":
|
|
6949
|
-
return { _type: "Canvas" };
|
|
6950
|
-
case "video":
|
|
6951
|
-
case "iframe":
|
|
6952
|
-
return { _type: "CustomHTML" };
|
|
6953
|
-
case "svg":
|
|
6954
|
-
return { _type: "Icon" };
|
|
6955
|
-
// non self closing tags
|
|
6956
|
-
// fixed structure
|
|
6957
|
-
case "select":
|
|
6958
|
-
return { _type: "Select", options: [] };
|
|
6959
|
-
case "option":
|
|
6960
|
-
return { _type: "Option" };
|
|
6961
|
-
case "ul":
|
|
6962
|
-
case "ol":
|
|
6963
|
-
case "dl":
|
|
6964
|
-
return {
|
|
6965
|
-
_type: "List",
|
|
6966
|
-
tag: o.tagName,
|
|
6967
|
-
_listType: o.tagName === "ol" ? "list-decimal" : "list-none"
|
|
6968
|
-
};
|
|
6969
|
-
case "li":
|
|
6970
|
-
case "dt":
|
|
6971
|
-
return { _type: "ListItem", tag: o.tagName };
|
|
6972
|
-
// non self closing tags
|
|
6973
|
-
// free flow structure
|
|
6974
|
-
case "span":
|
|
6975
|
-
case "figcaption":
|
|
6976
|
-
case "legend":
|
|
6977
|
-
return { _type: "Span", tag: o.tagName };
|
|
6978
|
-
case "p":
|
|
6979
|
-
return { _type: "Paragraph", content: "" };
|
|
6980
|
-
case "a":
|
|
6981
|
-
return { _type: "Link" };
|
|
6982
|
-
case "form":
|
|
6983
|
-
return { _type: "Form" };
|
|
6984
|
-
case "label":
|
|
6985
|
-
return { _type: "Label" };
|
|
6986
|
-
case "button":
|
|
6987
|
-
return { _type: "Button" };
|
|
6988
|
-
case "code":
|
|
6989
|
-
return { _type: "Box", _name: "Code" };
|
|
6990
|
-
case "h1":
|
|
6991
|
-
case "h2":
|
|
6992
|
-
case "h3":
|
|
6993
|
-
case "h4":
|
|
6994
|
-
case "h5":
|
|
6995
|
-
case "h6":
|
|
6996
|
-
return { _type: "Heading", tag: o.tagName };
|
|
6997
|
-
case "table":
|
|
6998
|
-
return { _type: "Table" };
|
|
6999
|
-
case "tr":
|
|
7000
|
-
return { _type: "TableRow" };
|
|
7001
|
-
case "td":
|
|
7002
|
-
case "th":
|
|
7003
|
-
return { _type: "TableCell", tag: o.tagName };
|
|
7004
|
-
case "thead":
|
|
7005
|
-
return { _type: "TableHead" };
|
|
7006
|
-
case "tbody":
|
|
7007
|
-
return { _type: "TableBody" };
|
|
7008
|
-
case "tfoot":
|
|
7009
|
-
return { _type: "TableFooter" };
|
|
7010
|
-
default: {
|
|
7011
|
-
const d = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
7012
|
-
return {
|
|
7013
|
-
_type: d,
|
|
7014
|
-
tag: o.tagName,
|
|
7015
|
-
_name: d == "EmptyBox" || o.tagName === "div" ? d : capitalize(o.tagName)
|
|
7016
|
-
};
|
|
7017
|
-
}
|
|
7018
|
-
}
|
|
7019
|
-
}, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
|
|
7020
|
-
var h, m, x, f, y, b, A, _, E, N;
|
|
7021
|
-
if (n.type === "comment") return [];
|
|
7022
|
-
let a = { _id: generateUUID() };
|
|
7023
|
-
if (r && (a._parent = r.block._id), n.type === "text")
|
|
7024
|
-
return isEmpty(get(n, "content", "")) ? [] : r && shouldAddText(r.node, r.block) ? (set(r, "block.content", get(n, "content", "")), []) : { ...a, _type: "Text", content: get(n, "content", "") };
|
|
7025
|
-
const l = get(n, "attributes", []), i = l.find(
|
|
7026
|
-
(w) => w.key === "data-chai-richtext" || w.key === "chai-richtext"
|
|
7027
|
-
), c = l.find(
|
|
7028
|
-
(w) => w.key === "data-chai-lightbox" || w.key === "chai-lightbox"
|
|
7029
|
-
), d = l.find(
|
|
7030
|
-
(w) => w.key === "data-chai-dropdown" || w.key === "chai-dropdown"
|
|
7031
|
-
), p = l.find(
|
|
7032
|
-
(w) => w.key === "data-chai-dropdown-button" || w.key === "chai-dropdown-button"
|
|
7033
|
-
), u = l.find(
|
|
7034
|
-
(w) => w.key === "data-chai-dropdown-content" || w.key === "chai-dropdown-content"
|
|
7035
|
-
);
|
|
7036
|
-
if (a = {
|
|
7037
|
-
...a,
|
|
7038
|
-
...getBlockProps(n),
|
|
7039
|
-
...getAttrs(n),
|
|
7040
|
-
...getStyles(n)
|
|
7041
|
-
}, n.attributes) {
|
|
7042
|
-
const w = n.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
|
|
7043
|
-
w && (a._name = w.value);
|
|
7044
|
-
}
|
|
7045
|
-
if (i)
|
|
7046
|
-
return a.content = stringify(n.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
|
|
7047
|
-
if (c) {
|
|
7048
|
-
const w = [
|
|
7049
|
-
"data-chai-lightbox",
|
|
7050
|
-
"chai-lightbox",
|
|
7051
|
-
"data-vbtype",
|
|
7052
|
-
"data-autoplay",
|
|
7053
|
-
"data-maxwidth",
|
|
7054
|
-
"data-overlay",
|
|
7055
|
-
"data-gall",
|
|
7056
|
-
"href"
|
|
7057
|
-
];
|
|
7058
|
-
a = {
|
|
7059
|
-
...a,
|
|
7060
|
-
href: ((h = l.find((S) => S.key === "href")) == null ? void 0 : h.value) || "",
|
|
7061
|
-
hrefType: ((m = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
|
|
7062
|
-
autoplay: ((x = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
|
|
7063
|
-
maxWidth: ((y = (f = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : y.replace("px", "")) || "",
|
|
7064
|
-
backdropColor: ((b = l.find((S) => S.key === "data-overlay")) == null ? void 0 : b.value) || "",
|
|
7065
|
-
galleryName: ((A = l.find((S) => S.key === "data-gall")) == null ? void 0 : A.value) || ""
|
|
7066
|
-
}, forEach(w, (S) => {
|
|
7067
|
-
has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
|
|
7068
|
-
});
|
|
7069
|
-
}
|
|
7070
|
-
if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
|
|
7071
|
-
delete a.styles_attrs;
|
|
7072
|
-
const w = filter(n.children || [], (k) => (k == null ? void 0 : k.tagName) !== "span");
|
|
7073
|
-
a.content = getTextContent(w);
|
|
7074
|
-
const S = find(
|
|
7075
|
-
n.children || [],
|
|
7076
|
-
(k) => (k == null ? void 0 : k.tagName) === "span" && some(k.children || [], (j) => (j == null ? void 0 : j.tagName) === "svg")
|
|
7077
|
-
);
|
|
7078
|
-
if (S) {
|
|
7079
|
-
const k = find(S.children || [], (j) => (j == null ? void 0 : j.tagName) === "svg");
|
|
7080
|
-
if (k) {
|
|
7081
|
-
a.icon = stringify([k]);
|
|
7082
|
-
const { height: j, width: C } = getSvgDimensions(k, "16px", "16px");
|
|
7083
|
-
a.iconHeight = j, a.iconWidth = C;
|
|
7084
|
-
}
|
|
7085
|
-
}
|
|
7086
|
-
return [a];
|
|
7087
|
-
}
|
|
7088
|
-
if (a._type === "Input") {
|
|
7089
|
-
const w = a.inputType || "text";
|
|
7090
|
-
w === "checkbox" ? set(a, "_type", "Checkbox") : w === "radio" && set(a, "_type", "Radio");
|
|
7091
|
-
} else if (n.tagName === "video" || n.tagName === "iframe") {
|
|
7092
|
-
const w = stringify([n]);
|
|
7093
|
-
return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
|
|
7094
|
-
} else if (n.tagName === "svg") {
|
|
7095
|
-
const w = get(find(n.attributes, { key: "class" }), "value", ""), { height: S, width: k } = getHeightAndWidthFromClass(w);
|
|
7096
|
-
if (S && k)
|
|
7097
|
-
a.styles = `${STYLES_KEY}, ${cn$2(`w-${k} h-${S}`, w)}`.trim(), a.height = S == null ? void 0 : S.replace("px", ""), a.width = k == null ? void 0 : k.replace("px", "");
|
|
7098
|
-
else {
|
|
7099
|
-
const j = (_ = find(n.attributes, { key: "height" })) == null ? void 0 : _.value, C = (E = find(n.attributes, { key: "width" })) == null ? void 0 : E.value;
|
|
7100
|
-
j && C ? (a.styles = `${STYLES_KEY}, ${cn$2(`w-[${C}px] h-[${j}px]`, w)}`.trim(), a.height = j, a.width = C) : a.styles = `${STYLES_KEY}, ${cn$2("w-full h-full", w)}`.trim();
|
|
7101
|
-
}
|
|
7102
|
-
return n.attributes = filter(n.attributes, (j) => !includes(["style", "width", "height", "class"], j.key)), a.icon = stringify([n]), [a];
|
|
7103
|
-
} else if (n.tagName == "option" && r && ((N = r.block) == null ? void 0 : N._type) === "Select")
|
|
7104
|
-
return r.block.options.push({
|
|
7105
|
-
label: getTextContent(n.children),
|
|
7106
|
-
...getAttrs(n)
|
|
7107
|
-
}), [];
|
|
7108
|
-
const g = traverseNodes(n.children, { block: a, node: n });
|
|
7109
|
-
return [a, ...g];
|
|
7110
|
-
}), getSvgDimensions = (o, r, n) => {
|
|
7111
|
-
var p, u;
|
|
7112
|
-
const a = get(o, "attributes", []), { height: l, width: i } = getHeightAndWidthFromClass(
|
|
7113
|
-
get(find(a, { key: "class" }), "value", "")
|
|
7114
|
-
);
|
|
7115
|
-
if (l && i)
|
|
7116
|
-
return {
|
|
7117
|
-
height: `[${l}px]`,
|
|
7118
|
-
width: `[${i}px]`
|
|
7119
|
-
};
|
|
7120
|
-
const c = (p = find(a, { key: "height" })) == null ? void 0 : p.value, d = (u = find(a, { key: "width" })) == null ? void 0 : u.value;
|
|
7121
|
-
return {
|
|
7122
|
-
height: c ? `[${c}px]` : n,
|
|
7123
|
-
width: d ? `[${d}px]` : r
|
|
7124
|
-
};
|
|
7125
|
-
}, getSanitizedHTML = (o) => {
|
|
7126
|
-
o = o.replace(/(\w+)=\\?"(.*?)\\?"/g, (a, l, i) => {
|
|
7127
|
-
let c = i.replace(/\\"/g, '"');
|
|
7128
|
-
return c = c.replace(/{([^}]+)}/g, (d) => d.replace(/"/g, '\\"')), `${l}="${c.replace(/\\"/g, '"')}"`;
|
|
7129
|
-
}), o = o.replace(/\\n/g, "").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, ""), o = o.replace(/\$name="[^"]*"/g, "");
|
|
7130
|
-
const r = o.match(/<body[^>]*>[\s\S]*?<\/body>/);
|
|
7131
|
-
return (r && r.length > 0 ? r[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : o).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
|
|
7132
|
-
}, getBlocksFromHTML = (o) => {
|
|
7133
|
-
const r = parse(getSanitizedHTML(o));
|
|
7134
|
-
return isEmpty(o) ? [] : flatten(traverseNodes(r));
|
|
7135
6835
|
}, ImportHTML = ({ parentId: o, position: r }) => {
|
|
7136
6836
|
const { t: n } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), c = () => {
|
|
7137
6837
|
const d = getBlocksFromHTML(a);
|
|
@@ -7216,18 +6916,18 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7216
6916
|
parentId: n = void 0,
|
|
7217
6917
|
position: a = -1
|
|
7218
6918
|
}) => {
|
|
7219
|
-
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (
|
|
7220
|
-
const
|
|
7221
|
-
return
|
|
6919
|
+
const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (B) => {
|
|
6920
|
+
const _ = has(B, "styles_attrs.data-page-section");
|
|
6921
|
+
return B._type === "Box" && _;
|
|
7222
6922
|
}, b = useCallback(
|
|
7223
|
-
async (
|
|
7224
|
-
if (
|
|
6923
|
+
async (B) => {
|
|
6924
|
+
if (B.stopPropagation(), has(o, "component")) {
|
|
7225
6925
|
d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7226
6926
|
return;
|
|
7227
6927
|
}
|
|
7228
6928
|
i(!0);
|
|
7229
|
-
let
|
|
7230
|
-
typeof
|
|
6929
|
+
let _ = await c({ library: r, block: o });
|
|
6930
|
+
typeof _ == "string" && (_ = getBlocksFromHTML(_)), isEmpty(_) || p(syncBlocksWithDefaults(_), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7231
6931
|
},
|
|
7232
6932
|
[d, p, o, c, r, n, a]
|
|
7233
6933
|
);
|
|
@@ -7238,19 +6938,19 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7238
6938
|
onClick: l ? () => {
|
|
7239
6939
|
} : b,
|
|
7240
6940
|
draggable: x ? "true" : "false",
|
|
7241
|
-
onDragStart: async (
|
|
7242
|
-
const
|
|
6941
|
+
onDragStart: async (B) => {
|
|
6942
|
+
const _ = await c({ library: r, block: o });
|
|
7243
6943
|
let N = n;
|
|
7244
|
-
if (y(first(
|
|
7245
|
-
const
|
|
7246
|
-
if (
|
|
7247
|
-
const
|
|
7248
|
-
|
|
7249
|
-
|
|
6944
|
+
if (y(first(_)) && (N = null), !isEmpty(_)) {
|
|
6945
|
+
const A = { blocks: _, uiLibrary: !0, parent: N };
|
|
6946
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(A)), o.preview) {
|
|
6947
|
+
const v = new Image();
|
|
6948
|
+
v.src = o.preview, v.onload = () => {
|
|
6949
|
+
B.dataTransfer.setDragImage(v, 0, 0);
|
|
7250
6950
|
};
|
|
7251
6951
|
} else
|
|
7252
|
-
|
|
7253
|
-
f(
|
|
6952
|
+
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6953
|
+
f(A), setTimeout(() => {
|
|
7254
6954
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7255
6955
|
}, 200);
|
|
7256
6956
|
}
|
|
@@ -7276,7 +6976,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7276
6976
|
] }) })
|
|
7277
6977
|
] });
|
|
7278
6978
|
}, UILibrarySection = ({ parentId: o, position: r }) => {
|
|
7279
|
-
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((
|
|
6979
|
+
const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), x = useRef(null);
|
|
7280
6980
|
useEffect(() => {
|
|
7281
6981
|
c && c.length > 0 && (x.current = new Fuse(c, {
|
|
7282
6982
|
keys: ["name", "label", "description", "group"],
|
|
@@ -7288,27 +6988,27 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7288
6988
|
m([]);
|
|
7289
6989
|
return;
|
|
7290
6990
|
}
|
|
7291
|
-
const
|
|
7292
|
-
m(
|
|
6991
|
+
const k = x.current.search(u).map((j) => j.item);
|
|
6992
|
+
m(k);
|
|
7293
6993
|
}, [u]);
|
|
7294
|
-
const f = u.trim() && !isEmpty(h) ? h : c, y = groupBy(f, "group"), [b,
|
|
6994
|
+
const f = u.trim() && !isEmpty(h) ? h : c, y = groupBy(f, "group"), [b, w] = useState(null);
|
|
7295
6995
|
useEffect(() => {
|
|
7296
6996
|
if (isEmpty(keys(y))) {
|
|
7297
|
-
|
|
6997
|
+
w(null);
|
|
7298
6998
|
return;
|
|
7299
6999
|
}
|
|
7300
7000
|
if (!b || !y[b]) {
|
|
7301
|
-
|
|
7001
|
+
w(first(keys(y)));
|
|
7302
7002
|
return;
|
|
7303
7003
|
}
|
|
7304
7004
|
}, [y, b]);
|
|
7305
|
-
const
|
|
7306
|
-
|
|
7307
|
-
|
|
7005
|
+
const B = get(y, b, []), _ = useRef(null), { t: N } = useTranslation(), A = (k) => {
|
|
7006
|
+
_.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
|
|
7007
|
+
_.current && w(k);
|
|
7308
7008
|
}, 400);
|
|
7309
|
-
},
|
|
7009
|
+
}, v = () => {
|
|
7310
7010
|
i != null && i.id && p(i.id);
|
|
7311
|
-
},
|
|
7011
|
+
}, C = () => {
|
|
7312
7012
|
g("");
|
|
7313
7013
|
};
|
|
7314
7014
|
if (d)
|
|
@@ -7316,7 +7016,7 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7316
7016
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
|
|
7317
7017
|
/* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
|
|
7318
7018
|
] });
|
|
7319
|
-
const
|
|
7019
|
+
const E = filter(B, (k, j) => j % 2 === 0), S = filter(B, (k, j) => j % 2 === 1);
|
|
7320
7020
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
|
|
7321
7021
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
7322
7022
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
@@ -7325,14 +7025,14 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7325
7025
|
{
|
|
7326
7026
|
placeholder: N("Search blocks..."),
|
|
7327
7027
|
value: u,
|
|
7328
|
-
onChange: (
|
|
7028
|
+
onChange: (k) => g(k.target.value),
|
|
7329
7029
|
className: "w-full pl-8 pr-8"
|
|
7330
7030
|
}
|
|
7331
7031
|
),
|
|
7332
7032
|
u && /* @__PURE__ */ jsx(
|
|
7333
7033
|
"button",
|
|
7334
7034
|
{
|
|
7335
|
-
onClick:
|
|
7035
|
+
onClick: C,
|
|
7336
7036
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7337
7037
|
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
7338
7038
|
}
|
|
@@ -7346,56 +7046,56 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7346
7046
|
/* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
|
|
7347
7047
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7348
7048
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: N("Failed to load the UI library. Try again") }),
|
|
7349
|
-
/* @__PURE__ */ jsxs(Button, { onClick:
|
|
7049
|
+
/* @__PURE__ */ jsxs(Button, { onClick: v, variant: "outline", size: "sm", className: "gap-2", children: [
|
|
7350
7050
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
|
|
7351
7051
|
N("Retry")
|
|
7352
7052
|
] })
|
|
7353
|
-
] }) }) : map(y, (
|
|
7053
|
+
] }) }) : map(y, (k, j) => /* @__PURE__ */ jsxs(
|
|
7354
7054
|
"div",
|
|
7355
7055
|
{
|
|
7356
|
-
onMouseEnter: () =>
|
|
7357
|
-
onMouseLeave: () => clearTimeout(
|
|
7056
|
+
onMouseEnter: () => A(j),
|
|
7057
|
+
onMouseLeave: () => clearTimeout(_.current),
|
|
7358
7058
|
role: "button",
|
|
7359
|
-
onClick: () =>
|
|
7059
|
+
onClick: () => w(j),
|
|
7360
7060
|
className: cn$2(
|
|
7361
7061
|
"flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
|
|
7362
|
-
|
|
7062
|
+
j === b ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
|
|
7363
7063
|
),
|
|
7364
7064
|
children: [
|
|
7365
|
-
/* @__PURE__ */ jsx("span", { children: capitalize(N(
|
|
7065
|
+
/* @__PURE__ */ jsx("span", { children: capitalize(N(j.toLowerCase())) }),
|
|
7366
7066
|
/* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
|
|
7367
7067
|
]
|
|
7368
7068
|
},
|
|
7369
|
-
|
|
7069
|
+
j
|
|
7370
7070
|
)) })
|
|
7371
7071
|
] })
|
|
7372
7072
|
] }),
|
|
7373
7073
|
/* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
|
|
7374
7074
|
ScrollArea,
|
|
7375
7075
|
{
|
|
7376
|
-
onMouseEnter: () =>
|
|
7076
|
+
onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
|
|
7377
7077
|
className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
|
|
7378
7078
|
children: [
|
|
7379
|
-
isEmpty(
|
|
7380
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7079
|
+
isEmpty(B) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
|
|
7080
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((k, j) => /* @__PURE__ */ jsx(
|
|
7381
7081
|
BlockCard,
|
|
7382
7082
|
{
|
|
7383
7083
|
parentId: o,
|
|
7384
7084
|
position: r,
|
|
7385
|
-
block:
|
|
7085
|
+
block: k,
|
|
7386
7086
|
library: i
|
|
7387
7087
|
},
|
|
7388
|
-
`block-${
|
|
7088
|
+
`block-${j}`
|
|
7389
7089
|
)) }),
|
|
7390
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children:
|
|
7090
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: S.map((k, j) => /* @__PURE__ */ jsx(
|
|
7391
7091
|
BlockCard,
|
|
7392
7092
|
{
|
|
7393
7093
|
parentId: o,
|
|
7394
7094
|
position: r,
|
|
7395
|
-
block:
|
|
7095
|
+
block: k,
|
|
7396
7096
|
library: i
|
|
7397
7097
|
},
|
|
7398
|
-
`block-second-${
|
|
7098
|
+
`block-second-${j}`
|
|
7399
7099
|
)) })
|
|
7400
7100
|
] }),
|
|
7401
7101
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -7432,14 +7132,14 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7432
7132
|
}), g(!0);
|
|
7433
7133
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7434
7134
|
const m = Object.entries(a).map(([f, y]) => {
|
|
7435
|
-
const b = y,
|
|
7135
|
+
const b = y, w = b.type || "partial", B = formatReadableName(w);
|
|
7436
7136
|
return {
|
|
7437
7137
|
type: "PartialBlock",
|
|
7438
7138
|
// Set the type to PartialBlock
|
|
7439
7139
|
label: formatReadableName(b.name || f),
|
|
7440
7140
|
description: b.description || "",
|
|
7441
7141
|
icon: Globe,
|
|
7442
|
-
group:
|
|
7142
|
+
group: B,
|
|
7443
7143
|
// Use formatted type as group
|
|
7444
7144
|
category: "partial",
|
|
7445
7145
|
partialBlockId: f,
|
|
@@ -7494,44 +7194,44 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7494
7194
|
}, ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (o, r) => {
|
|
7495
7195
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...r });
|
|
7496
7196
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: r, parentId: n, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7497
|
-
var
|
|
7498
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (
|
|
7197
|
+
var S;
|
|
7198
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (S = find(c, (k) => k._id === n)) == null ? void 0 : S._type, [m, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
|
|
7499
7199
|
useEffect(() => {
|
|
7500
|
-
const
|
|
7501
|
-
var
|
|
7502
|
-
(
|
|
7200
|
+
const k = setTimeout(() => {
|
|
7201
|
+
var j;
|
|
7202
|
+
(j = u.current) == null || j.focus();
|
|
7503
7203
|
}, 0);
|
|
7504
|
-
return () => clearTimeout(
|
|
7204
|
+
return () => clearTimeout(k);
|
|
7505
7205
|
}, [g]), useEffect(() => {
|
|
7506
7206
|
d && (x("all"), y(null));
|
|
7507
|
-
}, [d]), useEffect(() => (b.current = debounce((
|
|
7508
|
-
x(
|
|
7207
|
+
}, [d]), useEffect(() => (b.current = debounce((k) => {
|
|
7208
|
+
x(k);
|
|
7509
7209
|
}, 500), () => {
|
|
7510
7210
|
b.current && b.current.cancel();
|
|
7511
7211
|
}), []);
|
|
7512
|
-
const
|
|
7513
|
-
y(
|
|
7514
|
-
}, []),
|
|
7212
|
+
const w = useCallback((k) => {
|
|
7213
|
+
y(k), b.current && b.current(k);
|
|
7214
|
+
}, []), B = useCallback(() => {
|
|
7515
7215
|
y(null), b.current && b.current.cancel();
|
|
7516
|
-
}, []),
|
|
7517
|
-
b.current && b.current.cancel(), x(
|
|
7216
|
+
}, []), _ = useCallback((k) => {
|
|
7217
|
+
b.current && b.current.cancel(), x(k), y(null);
|
|
7518
7218
|
}, []), N = useMemo(
|
|
7519
7219
|
() => d ? values(r).filter(
|
|
7520
|
-
(
|
|
7521
|
-
var
|
|
7522
|
-
return (((
|
|
7220
|
+
(k) => {
|
|
7221
|
+
var j, I;
|
|
7222
|
+
return (((j = k.label) == null ? void 0 : j.toLowerCase()) + " " + ((I = k.type) == null ? void 0 : I.toLowerCase())).includes(d.toLowerCase());
|
|
7523
7223
|
}
|
|
7524
7224
|
) : r,
|
|
7525
7225
|
[r, d]
|
|
7526
|
-
),
|
|
7226
|
+
), A = useMemo(
|
|
7527
7227
|
() => d ? o.filter(
|
|
7528
|
-
(
|
|
7529
|
-
) : o.filter((
|
|
7228
|
+
(k) => reject(filter(values(N), { group: k }), { hidden: !0 }).length > 0
|
|
7229
|
+
) : o.filter((k) => reject(filter(values(r), { group: k }), { hidden: !0 }).length > 0),
|
|
7530
7230
|
[r, N, o, d]
|
|
7531
|
-
),
|
|
7532
|
-
() => sortBy(
|
|
7533
|
-
[
|
|
7534
|
-
),
|
|
7231
|
+
), v = useMemo(
|
|
7232
|
+
() => sortBy(A, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
|
|
7233
|
+
[A]
|
|
7234
|
+
), C = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), E = useMemo(() => m === "all" ? v : [m], [v, m]);
|
|
7535
7235
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7536
7236
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7537
7237
|
Input$1,
|
|
@@ -7541,55 +7241,55 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7541
7241
|
placeholder: i("Search blocks..."),
|
|
7542
7242
|
value: d,
|
|
7543
7243
|
className: "-ml-2",
|
|
7544
|
-
onChange: (
|
|
7244
|
+
onChange: (k) => p(k.target.value)
|
|
7545
7245
|
}
|
|
7546
7246
|
) }),
|
|
7547
7247
|
/* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
|
|
7548
|
-
|
|
7248
|
+
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: [
|
|
7549
7249
|
/* @__PURE__ */ jsx(
|
|
7550
7250
|
"button",
|
|
7551
7251
|
{
|
|
7552
|
-
onClick: () =>
|
|
7553
|
-
onMouseEnter: () =>
|
|
7554
|
-
onMouseLeave:
|
|
7252
|
+
onClick: () => _("all"),
|
|
7253
|
+
onMouseEnter: () => w("all"),
|
|
7254
|
+
onMouseLeave: B,
|
|
7555
7255
|
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7556
7256
|
children: i("All")
|
|
7557
7257
|
},
|
|
7558
7258
|
"sidebar-all"
|
|
7559
7259
|
),
|
|
7560
|
-
|
|
7260
|
+
v.map((k) => /* @__PURE__ */ jsx(
|
|
7561
7261
|
"button",
|
|
7562
7262
|
{
|
|
7563
|
-
onClick: () =>
|
|
7564
|
-
onMouseEnter: () =>
|
|
7565
|
-
onMouseLeave:
|
|
7566
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m ===
|
|
7567
|
-
children: capitalize(i(
|
|
7263
|
+
onClick: () => _(k),
|
|
7264
|
+
onMouseEnter: () => w(k),
|
|
7265
|
+
onMouseLeave: B,
|
|
7266
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || f === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7267
|
+
children: capitalize(i(k.toLowerCase()))
|
|
7568
7268
|
},
|
|
7569
|
-
`sidebar-${
|
|
7269
|
+
`sidebar-${k}`
|
|
7570
7270
|
))
|
|
7571
7271
|
] }) }) }),
|
|
7572
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children:
|
|
7272
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: A.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
7573
7273
|
i("No blocks found matching"),
|
|
7574
7274
|
' "',
|
|
7575
7275
|
d,
|
|
7576
7276
|
'"'
|
|
7577
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children:
|
|
7578
|
-
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(
|
|
7277
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7278
|
+
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
|
|
7579
7279
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7580
|
-
m === "all" ? filter(values(
|
|
7280
|
+
m === "all" ? filter(values(C), { group: k }) : values(C),
|
|
7581
7281
|
{ hidden: !0 }
|
|
7582
|
-
).map((
|
|
7282
|
+
).map((j) => /* @__PURE__ */ jsx(
|
|
7583
7283
|
CoreBlock,
|
|
7584
7284
|
{
|
|
7585
7285
|
parentId: n,
|
|
7586
7286
|
position: a,
|
|
7587
|
-
block:
|
|
7588
|
-
disabled: !canAcceptChildBlock(h,
|
|
7287
|
+
block: j,
|
|
7288
|
+
disabled: !canAcceptChildBlock(h, j.type) || !canBeNestedInside(h, j.type)
|
|
7589
7289
|
},
|
|
7590
|
-
|
|
7290
|
+
j.type
|
|
7591
7291
|
)) })
|
|
7592
|
-
] },
|
|
7292
|
+
] }, k)) }) }) })
|
|
7593
7293
|
] })
|
|
7594
7294
|
] });
|
|
7595
7295
|
}, addBlockTabAtom = atomWithStorage("__add_block_tab", "library"), AddBlocksPanel = ({
|
|
@@ -7615,8 +7315,8 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7615
7315
|
/* @__PURE__ */ jsxs(
|
|
7616
7316
|
Tabs,
|
|
7617
7317
|
{
|
|
7618
|
-
onValueChange: (
|
|
7619
|
-
d(""), c(
|
|
7318
|
+
onValueChange: (w) => {
|
|
7319
|
+
d(""), c(w);
|
|
7620
7320
|
},
|
|
7621
7321
|
value: i,
|
|
7622
7322
|
className: "flex h-full max-h-full flex-col overflow-hidden",
|
|
@@ -7626,13 +7326,13 @@ const registerChaiLibrary = (o, r) => {
|
|
|
7626
7326
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7627
7327
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7628
7328
|
f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7629
|
-
map(x, (
|
|
7329
|
+
map(x, (w) => /* @__PURE__ */ jsx(TabsTrigger, { value: w.id, children: React__default.createElement(w.tab) }, `tab-add-block-${w.id}`))
|
|
7630
7330
|
] }),
|
|
7631
7331
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: n, position: a }) }) }) }),
|
|
7632
7332
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: n, position: a }) }),
|
|
7633
7333
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: n, position: a }) }) }) }),
|
|
7634
7334
|
f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: n, position: a }) }) : null,
|
|
7635
|
-
map(x, (
|
|
7335
|
+
map(x, (w) => /* @__PURE__ */ jsx(TabsContent, { value: w.id, children: React__default.createElement(w.tabContent, { close: m, parentId: n, position: a }) }, `panel-add-block-${w.id}`))
|
|
7636
7336
|
]
|
|
7637
7337
|
}
|
|
7638
7338
|
)
|
|
@@ -7942,19 +7642,19 @@ const Input = ({ node: o }) => {
|
|
|
7942
7642
|
var P;
|
|
7943
7643
|
const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
|
|
7944
7644
|
let p = null;
|
|
7945
|
-
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: x, isSelected: f, willReceiveDrop: y, isDragging: b, isEditing:
|
|
7645
|
+
const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: x, isSelected: f, willReceiveDrop: y, isDragging: b, isEditing: w, handleClick: B } = o, _ = (L) => {
|
|
7946
7646
|
L.stopPropagation(), !l.includes(m) && o.toggle();
|
|
7947
7647
|
}, N = (L) => {
|
|
7948
7648
|
L.isInternal && (p = L.isOpen, L.isOpen && L.close());
|
|
7949
|
-
},
|
|
7649
|
+
}, A = (L) => {
|
|
7950
7650
|
L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
|
|
7951
|
-
}, [
|
|
7651
|
+
}, [v, C] = useAtom$1(currentAddSelection), E = () => {
|
|
7952
7652
|
var L;
|
|
7953
|
-
|
|
7954
|
-
},
|
|
7955
|
-
|
|
7956
|
-
},
|
|
7957
|
-
|
|
7653
|
+
S(), o.parent.isSelected || C((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
|
|
7654
|
+
}, S = () => {
|
|
7655
|
+
C(null);
|
|
7656
|
+
}, k = (L) => {
|
|
7657
|
+
S(), L.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(L);
|
|
7958
7658
|
};
|
|
7959
7659
|
useEffect(() => {
|
|
7960
7660
|
const L = setTimeout(() => {
|
|
@@ -7962,13 +7662,13 @@ const Input = ({ node: o }) => {
|
|
|
7962
7662
|
}, 500);
|
|
7963
7663
|
return () => clearTimeout(L);
|
|
7964
7664
|
}, [y, o, b]);
|
|
7965
|
-
const
|
|
7665
|
+
const j = (L, D) => {
|
|
7966
7666
|
const R = c.contentDocument || c.contentWindow.document, M = R.querySelector(`[data-block-id=${L}]`);
|
|
7967
7667
|
M && M.setAttribute("data-drop", D);
|
|
7968
7668
|
const $ = M.getBoundingClientRect(), O = c.getBoundingClientRect();
|
|
7969
7669
|
$.top >= O.top && $.left >= O.left && $.bottom <= O.bottom && $.right <= O.right || (R.documentElement.scrollTop = M.offsetTop - O.top);
|
|
7970
7670
|
}, I = (L) => {
|
|
7971
|
-
|
|
7671
|
+
S();
|
|
7972
7672
|
const D = get(o, "parent.id");
|
|
7973
7673
|
D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: L }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: L });
|
|
7974
7674
|
};
|
|
@@ -7996,20 +7696,20 @@ const Input = ({ node: o }) => {
|
|
|
7996
7696
|
{
|
|
7997
7697
|
onMouseEnter: () => g(m),
|
|
7998
7698
|
onMouseLeave: () => h(),
|
|
7999
|
-
onClick:
|
|
7699
|
+
onClick: k,
|
|
8000
7700
|
style: r,
|
|
8001
7701
|
"data-node-id": m,
|
|
8002
7702
|
ref: l.includes(m) ? null : n,
|
|
8003
7703
|
onDragStart: () => N(o),
|
|
8004
|
-
onDragEnd: () =>
|
|
7704
|
+
onDragEnd: () => A(o),
|
|
8005
7705
|
onDragOver: (L) => {
|
|
8006
|
-
L.preventDefault(),
|
|
7706
|
+
L.preventDefault(), j(m, "yes");
|
|
8007
7707
|
},
|
|
8008
7708
|
onDragLeave: (L) => {
|
|
8009
|
-
L.preventDefault(),
|
|
7709
|
+
L.preventDefault(), j(m, "no");
|
|
8010
7710
|
},
|
|
8011
7711
|
onDrop: (L) => {
|
|
8012
|
-
L.preventDefault(),
|
|
7712
|
+
L.preventDefault(), j(m, "no");
|
|
8013
7713
|
},
|
|
8014
7714
|
children: [
|
|
8015
7715
|
d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((P = o == null ? void 0 : o.parent) == null ? void 0 : P.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
@@ -8018,8 +7718,8 @@ const Input = ({ node: o }) => {
|
|
|
8018
7718
|
onClick: (L) => {
|
|
8019
7719
|
L.stopPropagation(), I(o.childIndex);
|
|
8020
7720
|
},
|
|
8021
|
-
onMouseEnter:
|
|
8022
|
-
onMouseLeave:
|
|
7721
|
+
onMouseEnter: E,
|
|
7722
|
+
onMouseLeave: S,
|
|
8023
7723
|
className: "absolute -top-0.5 h-1 w-[90%] rounded bg-primary opacity-0 delay-200 duration-200 group-hover:opacity-100",
|
|
8024
7724
|
children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-primary p-1 outline outline-2 outline-white hover:bg-primary", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[4] text-white" }) })
|
|
8025
7725
|
}
|
|
@@ -8031,7 +7731,7 @@ const Input = ({ node: o }) => {
|
|
|
8031
7731
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
|
|
8032
7732
|
f ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
|
|
8033
7733
|
y && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
|
|
8034
|
-
(o == null ? void 0 : o.id) ===
|
|
7734
|
+
(o == null ? void 0 : o.id) === v ? "bg-primary/10" : "",
|
|
8035
7735
|
b && "opacity-20",
|
|
8036
7736
|
l.includes(m) ? "opacity-50" : "",
|
|
8037
7737
|
T && f && "bg-primary/20 text-primary"
|
|
@@ -8042,7 +7742,7 @@ const Input = ({ node: o }) => {
|
|
|
8042
7742
|
"div",
|
|
8043
7743
|
{
|
|
8044
7744
|
className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
|
|
8045
|
-
children: u && /* @__PURE__ */ jsx("button", { onClick:
|
|
7745
|
+
children: u && /* @__PURE__ */ jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${f ? "text-white" : "text-slate-400"}` }) })
|
|
8046
7746
|
}
|
|
8047
7747
|
),
|
|
8048
7748
|
/* @__PURE__ */ jsxs(
|
|
@@ -8055,7 +7755,7 @@ const Input = ({ node: o }) => {
|
|
|
8055
7755
|
),
|
|
8056
7756
|
children: [
|
|
8057
7757
|
/* @__PURE__ */ jsx(TypeIcon, { type: x == null ? void 0 : x._type }),
|
|
8058
|
-
|
|
7758
|
+
w ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
|
|
8059
7759
|
"div",
|
|
8060
7760
|
{
|
|
8061
7761
|
className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
|
|
@@ -8526,23 +8226,23 @@ const Input = ({ node: o }) => {
|
|
|
8526
8226
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8527
8227
|
const [r, n] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8528
8228
|
if (d) {
|
|
8529
|
-
const
|
|
8530
|
-
DEFAULT_THEME_PRESET.forEach((
|
|
8531
|
-
const
|
|
8532
|
-
|
|
8229
|
+
const A = d.map((v) => Object.keys(v)[0]);
|
|
8230
|
+
DEFAULT_THEME_PRESET.forEach((v) => {
|
|
8231
|
+
const C = Object.keys(v)[0];
|
|
8232
|
+
A.includes(C) || d.push(v);
|
|
8533
8233
|
});
|
|
8534
8234
|
}
|
|
8535
8235
|
const [g, h] = useTheme(), m = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
|
|
8536
|
-
(
|
|
8537
|
-
const
|
|
8538
|
-
setPreviousTheme(
|
|
8236
|
+
(A) => {
|
|
8237
|
+
const v = { ...g };
|
|
8238
|
+
setPreviousTheme(v), h(A), toast.success("Theme updated", {
|
|
8539
8239
|
action: {
|
|
8540
8240
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8541
8241
|
/* @__PURE__ */ jsx(Undo$1, { className: "h-4 w-4" }),
|
|
8542
8242
|
" Undo"
|
|
8543
8243
|
] }),
|
|
8544
8244
|
onClick: () => {
|
|
8545
|
-
h(
|
|
8245
|
+
h(v), clearPreviousTheme(), toast.dismiss();
|
|
8546
8246
|
}
|
|
8547
8247
|
},
|
|
8548
8248
|
closeButton: !0,
|
|
@@ -8551,61 +8251,61 @@ const Input = ({ node: o }) => {
|
|
|
8551
8251
|
},
|
|
8552
8252
|
[g, h]
|
|
8553
8253
|
), y = () => {
|
|
8554
|
-
const
|
|
8555
|
-
if (
|
|
8556
|
-
const
|
|
8557
|
-
|
|
8254
|
+
const A = d.find((v) => Object.keys(v)[0] === a);
|
|
8255
|
+
if (A) {
|
|
8256
|
+
const v = Object.values(A)[0];
|
|
8257
|
+
v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (f(v), l("")) : console.error("Invalid preset structure:", v);
|
|
8558
8258
|
} else
|
|
8559
8259
|
console.error("Preset not found:", a);
|
|
8560
|
-
}, b = (
|
|
8561
|
-
f(
|
|
8562
|
-
},
|
|
8563
|
-
(
|
|
8260
|
+
}, b = (A) => {
|
|
8261
|
+
f(A), l("");
|
|
8262
|
+
}, w = useDebouncedCallback(
|
|
8263
|
+
(A, v) => {
|
|
8564
8264
|
h(() => ({
|
|
8565
8265
|
...g,
|
|
8566
8266
|
fontFamily: {
|
|
8567
8267
|
...g.fontFamily,
|
|
8568
|
-
[
|
|
8268
|
+
[A.replace(/font-/g, "")]: v
|
|
8569
8269
|
}
|
|
8570
8270
|
}));
|
|
8571
8271
|
},
|
|
8572
8272
|
[g],
|
|
8573
8273
|
200
|
|
8574
|
-
),
|
|
8575
|
-
(
|
|
8274
|
+
), B = React.useCallback(
|
|
8275
|
+
(A) => {
|
|
8576
8276
|
h(() => ({
|
|
8577
8277
|
...g,
|
|
8578
|
-
borderRadius: `${
|
|
8278
|
+
borderRadius: `${A}px`
|
|
8579
8279
|
}));
|
|
8580
8280
|
},
|
|
8581
8281
|
[g]
|
|
8582
|
-
),
|
|
8583
|
-
(
|
|
8282
|
+
), _ = useDebouncedCallback(
|
|
8283
|
+
(A, v) => {
|
|
8584
8284
|
h(() => {
|
|
8585
|
-
const
|
|
8586
|
-
return r ? set(
|
|
8285
|
+
const C = get(g, `colors.${A}`);
|
|
8286
|
+
return r ? set(C, 1, v) : set(C, 0, v), {
|
|
8587
8287
|
...g,
|
|
8588
8288
|
colors: {
|
|
8589
8289
|
...g.colors,
|
|
8590
|
-
[
|
|
8290
|
+
[A]: C
|
|
8591
8291
|
}
|
|
8592
8292
|
};
|
|
8593
8293
|
});
|
|
8594
8294
|
},
|
|
8595
8295
|
[g],
|
|
8596
8296
|
200
|
|
8597
|
-
), N = (
|
|
8598
|
-
const
|
|
8599
|
-
return
|
|
8297
|
+
), N = (A) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(A.items).map(([v]) => {
|
|
8298
|
+
const C = get(g, `colors.${v}.${r ? 1 : 0}`);
|
|
8299
|
+
return C ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8600
8300
|
/* @__PURE__ */ jsx(
|
|
8601
8301
|
ColorPickerInput,
|
|
8602
8302
|
{
|
|
8603
|
-
value:
|
|
8604
|
-
onChange: (
|
|
8303
|
+
value: C,
|
|
8304
|
+
onChange: (E) => _(v, E)
|
|
8605
8305
|
}
|
|
8606
8306
|
),
|
|
8607
|
-
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children:
|
|
8608
|
-
] },
|
|
8307
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
|
|
8308
|
+
] }, v) : null;
|
|
8609
8309
|
}) });
|
|
8610
8310
|
return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
8611
8311
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
@@ -8620,9 +8320,9 @@ const Input = ({ node: o }) => {
|
|
|
8620
8320
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8621
8321
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8622
8322
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8623
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
8624
|
-
const
|
|
8625
|
-
return /* @__PURE__ */ jsx(SelectItem, { value:
|
|
8323
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((A) => {
|
|
8324
|
+
const v = Object.keys(A)[0], C = v.replaceAll("_", " ");
|
|
8325
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(C) }, v);
|
|
8626
8326
|
}) })
|
|
8627
8327
|
] }) }),
|
|
8628
8328
|
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: x("Apply") }) })
|
|
@@ -8634,14 +8334,14 @@ const Input = ({ node: o }) => {
|
|
|
8634
8334
|
/* @__PURE__ */ jsx(Type, { className: "h-3 w-3 text-gray-600" }),
|
|
8635
8335
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8636
8336
|
] }),
|
|
8637
|
-
(m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([
|
|
8337
|
+
(m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([A, v]) => /* @__PURE__ */ jsx(
|
|
8638
8338
|
FontSelector,
|
|
8639
8339
|
{
|
|
8640
|
-
label:
|
|
8641
|
-
value: g.fontFamily[
|
|
8642
|
-
onChange: (
|
|
8340
|
+
label: A,
|
|
8341
|
+
value: g.fontFamily[A.replace(/font-/g, "")] || v[Object.keys(v)[0]],
|
|
8342
|
+
onChange: (C) => w(A, C)
|
|
8643
8343
|
},
|
|
8644
|
-
|
|
8344
|
+
A
|
|
8645
8345
|
)) }),
|
|
8646
8346
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8647
8347
|
(m == null ? void 0 : m.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -8652,7 +8352,7 @@ const Input = ({ node: o }) => {
|
|
|
8652
8352
|
] }),
|
|
8653
8353
|
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
|
|
8654
8354
|
] }),
|
|
8655
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange:
|
|
8355
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: B }) })
|
|
8656
8356
|
] }),
|
|
8657
8357
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8658
8358
|
(m == null ? void 0 : m.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
@@ -8667,7 +8367,7 @@ const Input = ({ node: o }) => {
|
|
|
8667
8367
|
Switch,
|
|
8668
8368
|
{
|
|
8669
8369
|
checked: r,
|
|
8670
|
-
onCheckedChange: (
|
|
8370
|
+
onCheckedChange: (A) => n(A),
|
|
8671
8371
|
"aria-label": "Toggle dark mode",
|
|
8672
8372
|
className: "mx-1"
|
|
8673
8373
|
}
|
|
@@ -8675,7 +8375,7 @@ const Input = ({ node: o }) => {
|
|
|
8675
8375
|
/* @__PURE__ */ jsx(Moon, { className: "h-4 w-4" })
|
|
8676
8376
|
] }) })
|
|
8677
8377
|
] }),
|
|
8678
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: m.colors.map((
|
|
8378
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: m.colors.map((A) => N(A)) })
|
|
8679
8379
|
] }),
|
|
8680
8380
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8681
8381
|
LazyCssImportModal,
|
|
@@ -9298,26 +8998,26 @@ function AIChatPanel() {
|
|
|
9298
8998
|
content: n,
|
|
9299
8999
|
timestamp: /* @__PURE__ */ new Date()
|
|
9300
9000
|
};
|
|
9301
|
-
r((
|
|
9302
|
-
const
|
|
9001
|
+
r((w) => [...w, b]), a(""), i(!0), setTimeout(() => {
|
|
9002
|
+
const w = {
|
|
9303
9003
|
id: (Date.now() + 1).toString(),
|
|
9304
9004
|
role: "assistant",
|
|
9305
9005
|
content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
|
|
9306
9006
|
timestamp: /* @__PURE__ */ new Date()
|
|
9307
9007
|
};
|
|
9308
|
-
r((
|
|
9008
|
+
r((B) => [...B, w]), i(!1), d(null);
|
|
9309
9009
|
}, 1500);
|
|
9310
9010
|
}, m = (b) => {
|
|
9311
9011
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
|
|
9312
9012
|
}, x = (b) => {
|
|
9313
|
-
var
|
|
9314
|
-
const
|
|
9315
|
-
if (
|
|
9316
|
-
const
|
|
9317
|
-
|
|
9318
|
-
var
|
|
9319
|
-
d((
|
|
9320
|
-
},
|
|
9013
|
+
var B;
|
|
9014
|
+
const w = (B = b.target.files) == null ? void 0 : B[0];
|
|
9015
|
+
if (w) {
|
|
9016
|
+
const _ = new FileReader();
|
|
9017
|
+
_.onload = (N) => {
|
|
9018
|
+
var A;
|
|
9019
|
+
d((A = N.target) == null ? void 0 : A.result);
|
|
9020
|
+
}, _.readAsDataURL(w);
|
|
9321
9021
|
}
|
|
9322
9022
|
}, f = () => {
|
|
9323
9023
|
var b;
|
|
@@ -9521,43 +9221,43 @@ const AiAssistant = () => {
|
|
|
9521
9221
|
return;
|
|
9522
9222
|
}
|
|
9523
9223
|
if (i) {
|
|
9524
|
-
const
|
|
9525
|
-
n(
|
|
9224
|
+
const v = [...a, { key: i, value: d }];
|
|
9225
|
+
n(v), l(a), c(""), p(""), m("");
|
|
9526
9226
|
}
|
|
9527
|
-
},
|
|
9528
|
-
const
|
|
9529
|
-
n(
|
|
9530
|
-
},
|
|
9531
|
-
g(
|
|
9532
|
-
},
|
|
9227
|
+
}, w = (v) => {
|
|
9228
|
+
const C = a.filter((E, S) => S !== v);
|
|
9229
|
+
n(C), l(C);
|
|
9230
|
+
}, B = (v) => {
|
|
9231
|
+
g(v), c(a[v].key), p(a[v].value);
|
|
9232
|
+
}, _ = () => {
|
|
9533
9233
|
if (i.startsWith("@")) {
|
|
9534
9234
|
m("Attribute keys cannot start with '@'");
|
|
9535
9235
|
return;
|
|
9536
9236
|
}
|
|
9537
9237
|
if (u !== null && i) {
|
|
9538
|
-
const
|
|
9539
|
-
|
|
9238
|
+
const v = [...a];
|
|
9239
|
+
v[u] = { key: i, value: d }, n(v), l(v), g(null), c(""), p(""), m("");
|
|
9540
9240
|
}
|
|
9541
|
-
}, N = (
|
|
9542
|
-
|
|
9543
|
-
},
|
|
9544
|
-
const
|
|
9241
|
+
}, N = (v) => {
|
|
9242
|
+
v.key === "Enter" && !v.shiftKey && (v.preventDefault(), u !== null ? _() : b());
|
|
9243
|
+
}, A = useCallback((v) => {
|
|
9244
|
+
const C = (k) => /[.,!?;:]/.test(k), E = (k, j, I) => {
|
|
9545
9245
|
let T = "", P = "";
|
|
9546
|
-
const L =
|
|
9547
|
-
return
|
|
9246
|
+
const L = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
|
|
9247
|
+
return j > 0 && (L === "." || !C(L) && L !== " ") && (T = " "), j < k.length && !C(D) && D !== " " && (P = " "), {
|
|
9548
9248
|
text: T + I + P,
|
|
9549
9249
|
prefixLength: T.length,
|
|
9550
9250
|
suffixLength: P.length
|
|
9551
9251
|
};
|
|
9552
|
-
},
|
|
9553
|
-
if (
|
|
9554
|
-
const
|
|
9555
|
-
if (I >
|
|
9556
|
-
const R = `{{${
|
|
9252
|
+
}, S = f.current;
|
|
9253
|
+
if (S) {
|
|
9254
|
+
const k = S.selectionStart || 0, j = S.value || "", I = S.selectionEnd || k;
|
|
9255
|
+
if (I > k) {
|
|
9256
|
+
const R = `{{${v}}}`, { text: M } = E(j, k, R), $ = j.slice(0, k) + M + j.slice(I);
|
|
9557
9257
|
p($);
|
|
9558
9258
|
return;
|
|
9559
9259
|
}
|
|
9560
|
-
const P = `{{${
|
|
9260
|
+
const P = `{{${v}}}`, { text: L } = E(j, k, P), D = j.slice(0, k) + L + j.slice(k);
|
|
9561
9261
|
p(D);
|
|
9562
9262
|
}
|
|
9563
9263
|
}, []);
|
|
@@ -9565,8 +9265,8 @@ const AiAssistant = () => {
|
|
|
9565
9265
|
/* @__PURE__ */ jsxs(
|
|
9566
9266
|
"form",
|
|
9567
9267
|
{
|
|
9568
|
-
onSubmit: (
|
|
9569
|
-
|
|
9268
|
+
onSubmit: (v) => {
|
|
9269
|
+
v.preventDefault(), u !== null ? _() : b();
|
|
9570
9270
|
},
|
|
9571
9271
|
className: "space-y-3",
|
|
9572
9272
|
children: [
|
|
@@ -9582,7 +9282,7 @@ const AiAssistant = () => {
|
|
|
9582
9282
|
id: "attrKey",
|
|
9583
9283
|
ref: x,
|
|
9584
9284
|
value: i,
|
|
9585
|
-
onChange: (
|
|
9285
|
+
onChange: (v) => c(v.target.value),
|
|
9586
9286
|
placeholder: "Enter Key",
|
|
9587
9287
|
className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
9588
9288
|
}
|
|
@@ -9591,7 +9291,7 @@ const AiAssistant = () => {
|
|
|
9591
9291
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9592
9292
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9593
9293
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9594
|
-
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect:
|
|
9294
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: A })
|
|
9595
9295
|
] }),
|
|
9596
9296
|
/* @__PURE__ */ jsx(
|
|
9597
9297
|
Textarea,
|
|
@@ -9603,7 +9303,7 @@ const AiAssistant = () => {
|
|
|
9603
9303
|
rows: 2,
|
|
9604
9304
|
ref: f,
|
|
9605
9305
|
value: d,
|
|
9606
|
-
onChange: (
|
|
9306
|
+
onChange: (v) => p(v.target.value),
|
|
9607
9307
|
onKeyDown: N,
|
|
9608
9308
|
placeholder: "Enter Value",
|
|
9609
9309
|
className: "text-xs font-normal leading-tight placeholder:text-slate-400"
|
|
@@ -9616,16 +9316,16 @@ const AiAssistant = () => {
|
|
|
9616
9316
|
]
|
|
9617
9317
|
}
|
|
9618
9318
|
),
|
|
9619
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((
|
|
9319
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((v, C) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9620
9320
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9621
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children:
|
|
9622
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children:
|
|
9321
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: v.key }),
|
|
9322
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: v.value.toString() })
|
|
9623
9323
|
] }),
|
|
9624
9324
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9625
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9626
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () =>
|
|
9325
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(C), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
|
|
9326
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => w(C), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
|
|
9627
9327
|
] })
|
|
9628
|
-
] },
|
|
9328
|
+
] }, C)) })
|
|
9629
9329
|
] });
|
|
9630
9330
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9631
9331
|
const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9787,38 +9487,38 @@ const RootLayout = () => {
|
|
|
9787
9487
|
usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
|
|
9788
9488
|
n("outline");
|
|
9789
9489
|
});
|
|
9790
|
-
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = reverse([...g ?? []]), m = useCallback((
|
|
9791
|
-
|
|
9490
|
+
const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = reverse([...g ?? []]), m = useCallback((C) => {
|
|
9491
|
+
C.preventDefault();
|
|
9792
9492
|
}, []), x = useCallback(
|
|
9793
|
-
(
|
|
9794
|
-
n(r ===
|
|
9493
|
+
(C) => {
|
|
9494
|
+
n(r === C ? null : C);
|
|
9795
9495
|
},
|
|
9796
9496
|
[r]
|
|
9797
9497
|
), { t: f } = useTranslation(), y = useMemo(
|
|
9798
9498
|
() => [...p, ...u, ...g],
|
|
9799
9499
|
[p, u, g]
|
|
9800
|
-
), b = useBuilderProp("htmlDir", "ltr"),
|
|
9500
|
+
), b = useBuilderProp("htmlDir", "ltr"), w = find(y, { id: r }) ?? first(y), B = get(w, "width", DEFAULT_PANEL_WIDTH);
|
|
9801
9501
|
useEffect(() => {
|
|
9802
9502
|
if (r !== null) {
|
|
9803
|
-
const
|
|
9804
|
-
|
|
9503
|
+
const C = find(y, { id: r });
|
|
9504
|
+
C && get(C, "view", "standard") === "standard" && (a.current = r, i(get(C, "width", DEFAULT_PANEL_WIDTH)));
|
|
9805
9505
|
}
|
|
9806
9506
|
}, [r, y]);
|
|
9807
|
-
const
|
|
9507
|
+
const _ = useMemo(() => {
|
|
9808
9508
|
if (r === null) return 0;
|
|
9809
|
-
const
|
|
9810
|
-
return get(
|
|
9811
|
-
}, [r,
|
|
9509
|
+
const C = find(y, { id: r });
|
|
9510
|
+
return get(C, "view", "standard") === "standard" ? B : l;
|
|
9511
|
+
}, [r, B, l, y]), N = useCallback(() => {
|
|
9812
9512
|
n(a.current);
|
|
9813
|
-
}, [n]),
|
|
9513
|
+
}, [n]), A = useCallback(() => {
|
|
9814
9514
|
n("outline");
|
|
9815
9515
|
}, [n]);
|
|
9816
9516
|
useEffect(() => {
|
|
9817
9517
|
find(y, { id: r }) || n("outline");
|
|
9818
9518
|
}, [r, y]);
|
|
9819
|
-
const
|
|
9820
|
-
(
|
|
9821
|
-
x(
|
|
9519
|
+
const v = useCallback(
|
|
9520
|
+
(C) => {
|
|
9521
|
+
x(C);
|
|
9822
9522
|
},
|
|
9823
9523
|
[x]
|
|
9824
9524
|
);
|
|
@@ -9832,43 +9532,43 @@ const RootLayout = () => {
|
|
|
9832
9532
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9833
9533
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9834
9534
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9835
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9836
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9535
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((C, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9536
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(C, "button", NoopComponent), {
|
|
9837
9537
|
position: "top",
|
|
9838
|
-
panelId:
|
|
9839
|
-
isActive: r ===
|
|
9840
|
-
show: () =>
|
|
9538
|
+
panelId: C.id,
|
|
9539
|
+
isActive: r === C.id,
|
|
9540
|
+
show: () => v(C.id)
|
|
9841
9541
|
}) }),
|
|
9842
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9843
|
-
] }, "button-top-" +
|
|
9542
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(C.label) }) })
|
|
9543
|
+
] }, "button-top-" + E)) }),
|
|
9844
9544
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9845
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: h == null ? void 0 : h.map((
|
|
9846
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9545
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: h == null ? void 0 : h.map((C, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9546
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(C, "button", NoopComponent), {
|
|
9847
9547
|
position: "bottom",
|
|
9848
|
-
panelId:
|
|
9849
|
-
isActive: r ===
|
|
9850
|
-
show: () =>
|
|
9548
|
+
panelId: C.id,
|
|
9549
|
+
isActive: r === C.id,
|
|
9550
|
+
show: () => v(C.id)
|
|
9851
9551
|
}) }),
|
|
9852
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(
|
|
9853
|
-
] }, "button-bottom-" +
|
|
9552
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(C.label) }) })
|
|
9553
|
+
] }, "button-bottom-" + E)) })
|
|
9854
9554
|
] }),
|
|
9855
9555
|
/* @__PURE__ */ jsx(
|
|
9856
9556
|
motion.div,
|
|
9857
9557
|
{
|
|
9858
9558
|
id: "left-panel",
|
|
9859
9559
|
className: "h-full max-h-full border-r border-border",
|
|
9860
|
-
initial: { width:
|
|
9861
|
-
animate: { width:
|
|
9560
|
+
initial: { width: _ },
|
|
9561
|
+
animate: { width: _ },
|
|
9862
9562
|
transition: { duration: 0.3, ease: "easeInOut" },
|
|
9863
|
-
children: r !== null && get(
|
|
9563
|
+
children: r !== null && get(w, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
|
|
9864
9564
|
/* @__PURE__ */ jsx(
|
|
9865
9565
|
"div",
|
|
9866
9566
|
{
|
|
9867
|
-
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(
|
|
9868
|
-
children: /* @__PURE__ */ jsx("span", { children: f(get(
|
|
9567
|
+
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(w, "isInternal", !1) ? "" : "w-64"}`,
|
|
9568
|
+
children: /* @__PURE__ */ jsx("span", { children: f(get(w, "label", "")) })
|
|
9869
9569
|
}
|
|
9870
9570
|
),
|
|
9871
|
-
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9571
|
+
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(w, "panel", NoopComponent), {}) }) })
|
|
9872
9572
|
] })
|
|
9873
9573
|
}
|
|
9874
9574
|
),
|
|
@@ -9914,34 +9614,34 @@ const RootLayout = () => {
|
|
|
9914
9614
|
}
|
|
9915
9615
|
),
|
|
9916
9616
|
/* @__PURE__ */ jsx(AddBlocksDialog, {}),
|
|
9917
|
-
r !== null && get(
|
|
9617
|
+
r !== null && get(w, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => N(), children: /* @__PURE__ */ jsxs(
|
|
9918
9618
|
SheetContent,
|
|
9919
9619
|
{
|
|
9920
9620
|
side: "left",
|
|
9921
9621
|
className: "flex flex-col gap-0 p-0 sm:max-w-full",
|
|
9922
|
-
style: { width: `${
|
|
9622
|
+
style: { width: `${B}px` },
|
|
9923
9623
|
children: [
|
|
9924
9624
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9925
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9926
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9625
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(w, "icon", null) }),
|
|
9626
|
+
/* @__PURE__ */ jsx("span", { children: f(get(w, "label", "")) })
|
|
9927
9627
|
] }) }),
|
|
9928
|
-
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9929
|
-
close:
|
|
9628
|
+
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(w, "panel", NoopComponent), {
|
|
9629
|
+
close: A
|
|
9930
9630
|
}) }) })
|
|
9931
9631
|
]
|
|
9932
9632
|
}
|
|
9933
9633
|
) }),
|
|
9934
9634
|
" ",
|
|
9935
|
-
r !== null && get(
|
|
9635
|
+
r !== null && get(w, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => N(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${B}px` }, children: [
|
|
9936
9636
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9937
|
-
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(
|
|
9938
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9637
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(w, "icon", null) }),
|
|
9638
|
+
/* @__PURE__ */ jsx("span", { children: f(get(w, "label", "")) })
|
|
9939
9639
|
] }) }),
|
|
9940
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9941
|
-
close:
|
|
9640
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(w, "panel", NoopComponent), {
|
|
9641
|
+
close: A
|
|
9942
9642
|
}) }) })
|
|
9943
9643
|
] }) }),
|
|
9944
|
-
r !== null && get(
|
|
9644
|
+
r !== null && get(w, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
9945
9645
|
motion.div,
|
|
9946
9646
|
{
|
|
9947
9647
|
className: "absolute bottom-0 left-12 right-0 top-0 z-50",
|
|
@@ -9960,13 +9660,13 @@ const RootLayout = () => {
|
|
|
9960
9660
|
children: [
|
|
9961
9661
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9962
9662
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9963
|
-
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(
|
|
9964
|
-
/* @__PURE__ */ jsx("span", { children: f(get(
|
|
9663
|
+
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(w, "icon", null) }),
|
|
9664
|
+
/* @__PURE__ */ jsx("span", { children: f(get(w, "label", "")) })
|
|
9965
9665
|
] }),
|
|
9966
9666
|
/* @__PURE__ */ jsx(Button, { onClick: () => N(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
|
|
9967
9667
|
] }),
|
|
9968
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(
|
|
9969
|
-
close:
|
|
9668
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(w, "panel", NoopComponent), {
|
|
9669
|
+
close: A
|
|
9970
9670
|
}) }) })
|
|
9971
9671
|
]
|
|
9972
9672
|
}
|
|
@@ -10008,8 +9708,8 @@ const RootLayout = () => {
|
|
|
10008
9708
|
const f = l.toLowerCase();
|
|
10009
9709
|
return Object.fromEntries(
|
|
10010
9710
|
Object.entries(a).filter(([y, b]) => {
|
|
10011
|
-
var
|
|
10012
|
-
return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((
|
|
9711
|
+
var w;
|
|
9712
|
+
return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((w = b == null ? void 0 : b.description) == null ? void 0 : w.toLowerCase().includes(f));
|
|
10013
9713
|
})
|
|
10014
9714
|
);
|
|
10015
9715
|
}, [a, l]), h = (f) => {
|
|
@@ -10019,8 +9719,8 @@ const RootLayout = () => {
|
|
|
10019
9719
|
});
|
|
10020
9720
|
}, m = (f) => {
|
|
10021
9721
|
if (!c) return;
|
|
10022
|
-
const y = f.clientX - p.x, b = f.clientY - p.y,
|
|
10023
|
-
n(
|
|
9722
|
+
const y = f.clientX - p.x, b = f.clientY - p.y, w = f.currentTarget, B = w.offsetWidth, _ = w.offsetHeight, N = window.innerWidth - B, A = window.innerHeight - _, v = Math.max(0, Math.min(y, N)), C = Math.max(0, Math.min(b, A));
|
|
9723
|
+
n(v, C);
|
|
10024
9724
|
}, x = () => {
|
|
10025
9725
|
d(!1);
|
|
10026
9726
|
};
|
|
@@ -10197,71 +9897,71 @@ const RootLayout = () => {
|
|
|
10197
9897
|
var f;
|
|
10198
9898
|
return (f = m.onMount) == null ? void 0 : f.call(m, x);
|
|
10199
9899
|
}, ...h) => {
|
|
10200
|
-
const m = h[0] || ((
|
|
10201
|
-
let
|
|
10202
|
-
return
|
|
9900
|
+
const m = h[0] || ((C) => {
|
|
9901
|
+
let E = o.get(C);
|
|
9902
|
+
return E || (E = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(C, E), u == null || u(C, v)), E;
|
|
10203
9903
|
}), x = h[1] || (() => {
|
|
10204
|
-
const
|
|
9904
|
+
const C = [], E = (S) => {
|
|
10205
9905
|
try {
|
|
10206
|
-
|
|
10207
|
-
} catch (
|
|
10208
|
-
|
|
9906
|
+
S();
|
|
9907
|
+
} catch (k) {
|
|
9908
|
+
C.push(k);
|
|
10209
9909
|
}
|
|
10210
9910
|
};
|
|
10211
9911
|
do {
|
|
10212
|
-
c.f &&
|
|
10213
|
-
const
|
|
10214
|
-
a.forEach((
|
|
9912
|
+
c.f && E(c.f);
|
|
9913
|
+
const S = /* @__PURE__ */ new Set(), k = S.add.bind(S);
|
|
9914
|
+
a.forEach((j) => {
|
|
10215
9915
|
var I;
|
|
10216
|
-
return (I = r.get(
|
|
10217
|
-
}), a.clear(), i.forEach(
|
|
9916
|
+
return (I = r.get(j)) == null ? void 0 : I.l.forEach(k);
|
|
9917
|
+
}), a.clear(), i.forEach(k), i.clear(), l.forEach(k), l.clear(), S.forEach(E), a.size && f();
|
|
10218
9918
|
} while (a.size || i.size || l.size);
|
|
10219
|
-
if (
|
|
10220
|
-
throw new AggregateError(
|
|
9919
|
+
if (C.length)
|
|
9920
|
+
throw new AggregateError(C);
|
|
10221
9921
|
}), f = h[2] || (() => {
|
|
10222
|
-
const
|
|
10223
|
-
for (;
|
|
10224
|
-
const
|
|
10225
|
-
if (
|
|
10226
|
-
|
|
9922
|
+
const C = [], E = /* @__PURE__ */ new WeakSet(), S = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
|
|
9923
|
+
for (; k.length; ) {
|
|
9924
|
+
const j = k[k.length - 1], I = m(j);
|
|
9925
|
+
if (S.has(j)) {
|
|
9926
|
+
k.pop();
|
|
10227
9927
|
continue;
|
|
10228
9928
|
}
|
|
10229
|
-
if (
|
|
10230
|
-
n.get(
|
|
9929
|
+
if (E.has(j)) {
|
|
9930
|
+
n.get(j) === I.n && C.push([j, I]), S.add(j), k.pop();
|
|
10231
9931
|
continue;
|
|
10232
9932
|
}
|
|
10233
|
-
|
|
10234
|
-
for (const T of getMountedOrPendingDependents(
|
|
10235
|
-
|
|
9933
|
+
E.add(j);
|
|
9934
|
+
for (const T of getMountedOrPendingDependents(j, I, r))
|
|
9935
|
+
E.has(T) || k.push(T);
|
|
10236
9936
|
}
|
|
10237
|
-
for (let
|
|
10238
|
-
const [I, T] =
|
|
9937
|
+
for (let j = C.length - 1; j >= 0; --j) {
|
|
9938
|
+
const [I, T] = C[j];
|
|
10239
9939
|
let P = !1;
|
|
10240
9940
|
for (const L of T.d.keys())
|
|
10241
9941
|
if (L !== I && a.has(L)) {
|
|
10242
9942
|
P = !0;
|
|
10243
9943
|
break;
|
|
10244
9944
|
}
|
|
10245
|
-
P && (y(I),
|
|
9945
|
+
P && (y(I), B(I)), n.delete(I);
|
|
10246
9946
|
}
|
|
10247
|
-
}), y = h[3] || ((
|
|
10248
|
-
var
|
|
10249
|
-
const
|
|
10250
|
-
if (isAtomStateInitialized(
|
|
9947
|
+
}), y = h[3] || ((C) => {
|
|
9948
|
+
var E;
|
|
9949
|
+
const S = m(C);
|
|
9950
|
+
if (isAtomStateInitialized(S) && (r.has(C) && n.get(C) !== S.n || Array.from(S.d).every(
|
|
10251
9951
|
([R, M]) => (
|
|
10252
9952
|
// Recursively, read the atom state of the dependency, and
|
|
10253
9953
|
// check if the atom epoch number is unchanged
|
|
10254
9954
|
y(R).n === M
|
|
10255
9955
|
)
|
|
10256
9956
|
)))
|
|
10257
|
-
return
|
|
10258
|
-
|
|
10259
|
-
let
|
|
10260
|
-
const
|
|
10261
|
-
r.has(
|
|
9957
|
+
return S;
|
|
9958
|
+
S.d.clear();
|
|
9959
|
+
let k = !0;
|
|
9960
|
+
const j = () => {
|
|
9961
|
+
r.has(C) && (B(C), f(), x());
|
|
10262
9962
|
}, I = (R) => {
|
|
10263
9963
|
var M;
|
|
10264
|
-
if (isSelfAtom(
|
|
9964
|
+
if (isSelfAtom(C, R)) {
|
|
10265
9965
|
const O = m(R);
|
|
10266
9966
|
if (!isAtomStateInitialized(O))
|
|
10267
9967
|
if (hasInitialValue(R))
|
|
@@ -10274,7 +9974,7 @@ const RootLayout = () => {
|
|
|
10274
9974
|
try {
|
|
10275
9975
|
return returnAtomValue($);
|
|
10276
9976
|
} finally {
|
|
10277
|
-
|
|
9977
|
+
S.d.set(R, $.n), isPendingPromise(S.v) && addPendingPromiseToDependency(C, S.v, $), (M = r.get(R)) == null || M.t.add(C), k || j();
|
|
10278
9978
|
}
|
|
10279
9979
|
};
|
|
10280
9980
|
let T, P;
|
|
@@ -10283,100 +9983,100 @@ const RootLayout = () => {
|
|
|
10283
9983
|
return T || (T = new AbortController()), T.signal;
|
|
10284
9984
|
},
|
|
10285
9985
|
get setSelf() {
|
|
10286
|
-
return !P && isActuallyWritableAtom(
|
|
10287
|
-
if (!
|
|
9986
|
+
return !P && isActuallyWritableAtom(C) && (P = (...R) => {
|
|
9987
|
+
if (!k)
|
|
10288
9988
|
try {
|
|
10289
|
-
return
|
|
9989
|
+
return w(C, ...R);
|
|
10290
9990
|
} finally {
|
|
10291
9991
|
f(), x();
|
|
10292
9992
|
}
|
|
10293
9993
|
}), P;
|
|
10294
9994
|
}
|
|
10295
|
-
}, D =
|
|
9995
|
+
}, D = S.n;
|
|
10296
9996
|
try {
|
|
10297
|
-
const R = d(
|
|
10298
|
-
return setAtomStateValueOrPromise(
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
)),
|
|
9997
|
+
const R = d(C, I, L);
|
|
9998
|
+
return setAtomStateValueOrPromise(C, R, m), isPromiseLike$1(R) && (registerAbortHandler(R, () => T == null ? void 0 : T.abort()), R.then(
|
|
9999
|
+
j,
|
|
10000
|
+
j
|
|
10001
|
+
)), S;
|
|
10302
10002
|
} catch (R) {
|
|
10303
|
-
return delete
|
|
10003
|
+
return delete S.v, S.e = R, ++S.n, S;
|
|
10304
10004
|
} finally {
|
|
10305
|
-
|
|
10005
|
+
k = !1, D !== S.n && n.get(C) === D && (n.set(C, S.n), a.add(C), (E = c.c) == null || E.call(c, C));
|
|
10306
10006
|
}
|
|
10307
|
-
}), b = h[4] || ((
|
|
10308
|
-
const
|
|
10309
|
-
for (;
|
|
10310
|
-
const
|
|
10311
|
-
for (const
|
|
10312
|
-
const I = m(
|
|
10313
|
-
n.set(
|
|
10007
|
+
}), b = h[4] || ((C) => {
|
|
10008
|
+
const E = [C];
|
|
10009
|
+
for (; E.length; ) {
|
|
10010
|
+
const S = E.pop(), k = m(S);
|
|
10011
|
+
for (const j of getMountedOrPendingDependents(S, k, r)) {
|
|
10012
|
+
const I = m(j);
|
|
10013
|
+
n.set(j, I.n), E.push(j);
|
|
10314
10014
|
}
|
|
10315
10015
|
}
|
|
10316
|
-
}),
|
|
10317
|
-
let
|
|
10318
|
-
const
|
|
10016
|
+
}), w = h[5] || ((C, ...E) => {
|
|
10017
|
+
let S = !0;
|
|
10018
|
+
const k = (I) => returnAtomValue(y(I)), j = (I, ...T) => {
|
|
10319
10019
|
var P;
|
|
10320
10020
|
const L = m(I);
|
|
10321
10021
|
try {
|
|
10322
|
-
if (isSelfAtom(
|
|
10022
|
+
if (isSelfAtom(C, I)) {
|
|
10323
10023
|
if (!hasInitialValue(I))
|
|
10324
10024
|
throw new Error("atom not writable");
|
|
10325
10025
|
const D = L.n, R = T[0];
|
|
10326
|
-
setAtomStateValueOrPromise(I, R, m),
|
|
10026
|
+
setAtomStateValueOrPromise(I, R, m), B(I), D !== L.n && (a.add(I), (P = c.c) == null || P.call(c, I), b(I));
|
|
10327
10027
|
return;
|
|
10328
10028
|
} else
|
|
10329
|
-
return
|
|
10029
|
+
return w(I, ...T);
|
|
10330
10030
|
} finally {
|
|
10331
|
-
|
|
10031
|
+
S || (f(), x());
|
|
10332
10032
|
}
|
|
10333
10033
|
};
|
|
10334
10034
|
try {
|
|
10335
|
-
return p(
|
|
10035
|
+
return p(C, k, j, ...E);
|
|
10336
10036
|
} finally {
|
|
10337
|
-
|
|
10037
|
+
S = !1;
|
|
10338
10038
|
}
|
|
10339
|
-
}),
|
|
10340
|
-
var
|
|
10341
|
-
const
|
|
10342
|
-
if (
|
|
10343
|
-
for (const [
|
|
10344
|
-
if (!
|
|
10345
|
-
const T = m(
|
|
10346
|
-
|
|
10039
|
+
}), B = h[6] || ((C) => {
|
|
10040
|
+
var E;
|
|
10041
|
+
const S = m(C), k = r.get(C);
|
|
10042
|
+
if (k && !isPendingPromise(S.v)) {
|
|
10043
|
+
for (const [j, I] of S.d)
|
|
10044
|
+
if (!k.d.has(j)) {
|
|
10045
|
+
const T = m(j);
|
|
10046
|
+
_(j).t.add(C), k.d.add(j), I !== T.n && (a.add(j), (E = c.c) == null || E.call(c, j), b(j));
|
|
10347
10047
|
}
|
|
10348
|
-
for (const
|
|
10349
|
-
if (!
|
|
10350
|
-
|
|
10351
|
-
const I = N(
|
|
10352
|
-
I == null || I.t.delete(
|
|
10048
|
+
for (const j of k.d || [])
|
|
10049
|
+
if (!S.d.has(j)) {
|
|
10050
|
+
k.d.delete(j);
|
|
10051
|
+
const I = N(j);
|
|
10052
|
+
I == null || I.t.delete(C);
|
|
10353
10053
|
}
|
|
10354
10054
|
}
|
|
10355
|
-
}),
|
|
10356
|
-
var
|
|
10357
|
-
const
|
|
10358
|
-
let
|
|
10359
|
-
if (!
|
|
10360
|
-
y(
|
|
10361
|
-
for (const
|
|
10362
|
-
|
|
10363
|
-
if (
|
|
10055
|
+
}), _ = h[7] || ((C) => {
|
|
10056
|
+
var E;
|
|
10057
|
+
const S = m(C);
|
|
10058
|
+
let k = r.get(C);
|
|
10059
|
+
if (!k) {
|
|
10060
|
+
y(C);
|
|
10061
|
+
for (const j of S.d.keys())
|
|
10062
|
+
_(j).t.add(C);
|
|
10063
|
+
if (k = {
|
|
10364
10064
|
l: /* @__PURE__ */ new Set(),
|
|
10365
|
-
d: new Set(
|
|
10065
|
+
d: new Set(S.d.keys()),
|
|
10366
10066
|
t: /* @__PURE__ */ new Set()
|
|
10367
|
-
}, r.set(
|
|
10368
|
-
const
|
|
10067
|
+
}, r.set(C, k), (E = c.m) == null || E.call(c, C), isActuallyWritableAtom(C)) {
|
|
10068
|
+
const j = () => {
|
|
10369
10069
|
let I = !0;
|
|
10370
10070
|
const T = (...P) => {
|
|
10371
10071
|
try {
|
|
10372
|
-
return
|
|
10072
|
+
return w(C, ...P);
|
|
10373
10073
|
} finally {
|
|
10374
10074
|
I || (f(), x());
|
|
10375
10075
|
}
|
|
10376
10076
|
};
|
|
10377
10077
|
try {
|
|
10378
|
-
const P = g(
|
|
10379
|
-
P && (
|
|
10078
|
+
const P = g(C, T);
|
|
10079
|
+
P && (k.u = () => {
|
|
10380
10080
|
I = !0;
|
|
10381
10081
|
try {
|
|
10382
10082
|
P();
|
|
@@ -10388,27 +10088,27 @@ const RootLayout = () => {
|
|
|
10388
10088
|
I = !1;
|
|
10389
10089
|
}
|
|
10390
10090
|
};
|
|
10391
|
-
l.add(
|
|
10091
|
+
l.add(j);
|
|
10392
10092
|
}
|
|
10393
10093
|
}
|
|
10394
|
-
return
|
|
10395
|
-
}), N = h[8] || ((
|
|
10396
|
-
var
|
|
10397
|
-
const
|
|
10398
|
-
let
|
|
10399
|
-
if (
|
|
10094
|
+
return k;
|
|
10095
|
+
}), N = h[8] || ((C) => {
|
|
10096
|
+
var E;
|
|
10097
|
+
const S = m(C);
|
|
10098
|
+
let k = r.get(C);
|
|
10099
|
+
if (k && !k.l.size && !Array.from(k.t).some((j) => {
|
|
10400
10100
|
var I;
|
|
10401
|
-
return (I = r.get(
|
|
10101
|
+
return (I = r.get(j)) == null ? void 0 : I.d.has(C);
|
|
10402
10102
|
})) {
|
|
10403
|
-
|
|
10404
|
-
for (const
|
|
10405
|
-
const I = N(
|
|
10406
|
-
I == null || I.t.delete(
|
|
10103
|
+
k.u && i.add(k.u), k = void 0, r.delete(C), (E = c.u) == null || E.call(c, C);
|
|
10104
|
+
for (const j of S.d.keys()) {
|
|
10105
|
+
const I = N(j);
|
|
10106
|
+
I == null || I.t.delete(C);
|
|
10407
10107
|
}
|
|
10408
10108
|
return;
|
|
10409
10109
|
}
|
|
10410
|
-
return
|
|
10411
|
-
}),
|
|
10110
|
+
return k;
|
|
10111
|
+
}), A = [
|
|
10412
10112
|
// store state
|
|
10413
10113
|
o,
|
|
10414
10114
|
r,
|
|
@@ -10428,27 +10128,27 @@ const RootLayout = () => {
|
|
|
10428
10128
|
f,
|
|
10429
10129
|
y,
|
|
10430
10130
|
b,
|
|
10431
|
-
|
|
10131
|
+
w,
|
|
10132
|
+
B,
|
|
10432
10133
|
_,
|
|
10433
|
-
E,
|
|
10434
10134
|
N
|
|
10435
|
-
],
|
|
10436
|
-
get: (
|
|
10437
|
-
set: (
|
|
10135
|
+
], v = {
|
|
10136
|
+
get: (C) => returnAtomValue(y(C)),
|
|
10137
|
+
set: (C, ...E) => {
|
|
10438
10138
|
try {
|
|
10439
|
-
return
|
|
10139
|
+
return w(C, ...E);
|
|
10440
10140
|
} finally {
|
|
10441
10141
|
f(), x();
|
|
10442
10142
|
}
|
|
10443
10143
|
},
|
|
10444
|
-
sub: (
|
|
10445
|
-
const
|
|
10446
|
-
return
|
|
10447
|
-
|
|
10144
|
+
sub: (C, E) => {
|
|
10145
|
+
const k = _(C).l;
|
|
10146
|
+
return k.add(E), x(), () => {
|
|
10147
|
+
k.delete(E), N(C), x();
|
|
10448
10148
|
};
|
|
10449
10149
|
}
|
|
10450
10150
|
};
|
|
10451
|
-
return Object.defineProperty(
|
|
10151
|
+
return Object.defineProperty(v, BUILDING_BLOCKS, { value: A }), v;
|
|
10452
10152
|
}, INTERNAL_buildStoreRev1 = buildStore, INTERNAL_registerAbortHandler = registerAbortHandler;
|
|
10453
10153
|
function createStore() {
|
|
10454
10154
|
return INTERNAL_buildStoreRev1();
|