@chaibuilder/sdk 3.0.7 → 3.0.9
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/core.cjs +4 -4
- package/dist/core.d.ts +1 -1
- package/dist/core.js +627 -630
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +1 -15
- package/dist/render.js +104 -79
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ var $ = (o, n, r) => U(o, typeof n != "symbol" ? n + "" : n, r);
|
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
|
|
6
6
|
import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, sortBy, round } from "lodash-es";
|
|
7
|
-
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, MagicWandIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon,
|
|
7
|
+
import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, ExclamationTriangleIcon, Cross1Icon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, LetterCaseCapitalizeIcon, ValueIcon, LinkBreak1Icon, EnterFullScreenIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, MagicWandIcon, CircleIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, LinkBreak2Icon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, ImageIcon, PaperPlaneIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
|
|
10
10
|
import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
|
|
@@ -23,6 +23,8 @@ import { useTranslation, initReactI18next } from "react-i18next";
|
|
|
23
23
|
import { useTranslation as $e } from "react-i18next";
|
|
24
24
|
import Fuse from "fuse.js";
|
|
25
25
|
import UndoManager from "undo-manager";
|
|
26
|
+
import i18n, { t } from "i18next";
|
|
27
|
+
import { default as Ve } from "i18next";
|
|
26
28
|
import Link from "@tiptap/extension-link";
|
|
27
29
|
import TextAlign from "@tiptap/extension-text-align";
|
|
28
30
|
import Underline from "@tiptap/extension-underline";
|
|
@@ -34,8 +36,6 @@ import validator from "@rjsf/validator-ajv8";
|
|
|
34
36
|
import Autosuggest from "react-autosuggest";
|
|
35
37
|
import { useFeature } from "flagged";
|
|
36
38
|
import { Tree } from "react-arborist";
|
|
37
|
-
import i18n from "i18next";
|
|
38
|
-
import { default as Ve } from "i18next";
|
|
39
39
|
import "himalaya";
|
|
40
40
|
import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
|
|
41
41
|
import tailwindForms from "@tailwindcss/forms";
|
|
@@ -341,16 +341,16 @@ function insertBlocksAtPosition(o, n, r, a) {
|
|
|
341
341
|
_type: "Text",
|
|
342
342
|
content: u.content
|
|
343
343
|
};
|
|
344
|
-
Object.keys(u).forEach((
|
|
345
|
-
|
|
346
|
-
}), l.unshift(h), i = i.map((
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
349
|
-
return Object.keys(
|
|
350
|
-
y.startsWith("content-") && (
|
|
351
|
-
}),
|
|
344
|
+
Object.keys(u).forEach((x) => {
|
|
345
|
+
x.startsWith("content-") && (h[x] = u[x]);
|
|
346
|
+
}), l.unshift(h), i = i.map((x) => {
|
|
347
|
+
if (x._id === r) {
|
|
348
|
+
const f = { ...x, content: "" };
|
|
349
|
+
return Object.keys(f).forEach((y) => {
|
|
350
|
+
y.startsWith("content-") && (f[y] = "");
|
|
351
|
+
}), f;
|
|
352
352
|
}
|
|
353
|
-
return
|
|
353
|
+
return x;
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
}
|
|
@@ -478,15 +478,15 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
|
|
|
478
478
|
if (g.length === 2) {
|
|
479
479
|
const m = g.find((h) => h._id !== d);
|
|
480
480
|
if (m && m._type === "Text") {
|
|
481
|
-
const h = r.find((
|
|
482
|
-
h && "content" in h && (r = r.map((
|
|
483
|
-
if (
|
|
484
|
-
const
|
|
481
|
+
const h = r.find((x) => x._id === u);
|
|
482
|
+
h && "content" in h && (r = r.map((x) => {
|
|
483
|
+
if (x._id === u) {
|
|
484
|
+
const f = { ...x, content: m.content };
|
|
485
485
|
return Object.keys(m).forEach((y) => {
|
|
486
|
-
y.startsWith("content-") && (
|
|
487
|
-
}),
|
|
486
|
+
y.startsWith("content-") && (f[y] = m[y]);
|
|
487
|
+
}), f;
|
|
488
488
|
}
|
|
489
|
-
return
|
|
489
|
+
return x;
|
|
490
490
|
}), a.push(m._id));
|
|
491
491
|
}
|
|
492
492
|
}
|
|
@@ -569,32 +569,32 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
|
|
|
569
569
|
status: "idle",
|
|
570
570
|
props: {},
|
|
571
571
|
error: void 0
|
|
572
|
-
}), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (
|
|
572
|
+
}), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
|
|
573
573
|
return useEffect(() => {
|
|
574
574
|
if (n === "mock") {
|
|
575
575
|
if (isFunction(a)) {
|
|
576
|
-
i((
|
|
577
|
-
const
|
|
578
|
-
if (!isObject(
|
|
576
|
+
i((f) => ({ ...f, status: "loading", props: {} }));
|
|
577
|
+
const x = a({ block: o });
|
|
578
|
+
if (!isObject(x))
|
|
579
579
|
throw new Error("mockDataProvider should return an object");
|
|
580
|
-
i((
|
|
580
|
+
i((f) => ({ ...f, status: "loaded", props: x }));
|
|
581
581
|
}
|
|
582
582
|
return;
|
|
583
583
|
}
|
|
584
|
-
n === "live" && (!g && !m || (i((
|
|
585
|
-
g ? (p((
|
|
586
|
-
...
|
|
584
|
+
n === "live" && (!g && !m || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
|
|
585
|
+
g ? (p((f) => ({
|
|
586
|
+
...f,
|
|
587
587
|
[o._id]: {
|
|
588
588
|
status: "loaded",
|
|
589
|
-
props: get(
|
|
589
|
+
props: get(x, "items", []),
|
|
590
590
|
repeaterItems: o.repeaterItems
|
|
591
591
|
}
|
|
592
|
-
})), i((
|
|
593
|
-
}).catch((
|
|
594
|
-
g ? (p((
|
|
595
|
-
...
|
|
596
|
-
[o._id]: { status: "error", error:
|
|
597
|
-
})), i((
|
|
592
|
+
})), i((f) => ({ ...f, status: "loaded", props: { totalItems: get(x, "totalItems") } })), c([o._id], { totalItems: get(x, "totalItems") })) : i((f) => ({ ...f, status: "loaded", props: isObject(x) ? x : {} }));
|
|
593
|
+
}).catch((x) => {
|
|
594
|
+
g ? (p((f) => ({
|
|
595
|
+
...f,
|
|
596
|
+
[o._id]: { status: "error", error: x, props: [] }
|
|
597
|
+
})), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
|
|
598
598
|
})));
|
|
599
599
|
}, [o == null ? void 0 : o._id, u, g, m, a, n]), {
|
|
600
600
|
$loading: get(l, "status") === "loading",
|
|
@@ -749,20 +749,20 @@ const checkMissingTranslations = (o, n) => n ? o.some((r) => {
|
|
|
749
749
|
return console.warn(`Failed to get block definition for type: ${r._type}`, a), !1;
|
|
750
750
|
}
|
|
751
751
|
}) : !1, useSavePage = () => {
|
|
752
|
-
const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (
|
|
752
|
+
const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (x) => {
|
|
753
753
|
}), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = useTheme(), { hasPermission: c } = usePermissions(), { selectedLang: d, fallbackLang: p } = useLanguages(), [u] = useIsPageLoaded(), g = () => {
|
|
754
|
-
const
|
|
755
|
-
return !d || d === p ? !1 : checkMissingTranslations(
|
|
754
|
+
const x = l();
|
|
755
|
+
return !d || d === p ? !1 : checkMissingTranslations(x.blocks || [], d);
|
|
756
756
|
};
|
|
757
757
|
return { savePage: useThrottledCallback(
|
|
758
|
-
async (
|
|
758
|
+
async (x = !1) => {
|
|
759
759
|
if (!c("save_page") || !u)
|
|
760
760
|
return;
|
|
761
761
|
n("SAVING"), a("SAVING");
|
|
762
|
-
const
|
|
762
|
+
const f = l();
|
|
763
763
|
return await r({
|
|
764
|
-
autoSave:
|
|
765
|
-
blocks:
|
|
764
|
+
autoSave: x,
|
|
765
|
+
blocks: f.blocks,
|
|
766
766
|
theme: i,
|
|
767
767
|
needTranslations: g()
|
|
768
768
|
}), setTimeout(() => {
|
|
@@ -776,10 +776,10 @@ const checkMissingTranslations = (o, n) => n ? o.some((r) => {
|
|
|
776
776
|
if (!c("save_page") || !u)
|
|
777
777
|
return;
|
|
778
778
|
n("SAVING"), a("SAVING");
|
|
779
|
-
const
|
|
779
|
+
const x = l();
|
|
780
780
|
return await r({
|
|
781
781
|
autoSave: !0,
|
|
782
|
-
blocks:
|
|
782
|
+
blocks: x.blocks,
|
|
783
783
|
theme: i,
|
|
784
784
|
needTranslations: g()
|
|
785
785
|
}), setTimeout(() => {
|
|
@@ -837,65 +837,65 @@ const undoRedoStateAtom = atom({
|
|
|
837
837
|
updateBlocksProps: c
|
|
838
838
|
} = useBlocksStoreManager();
|
|
839
839
|
return {
|
|
840
|
-
moveBlocks: (
|
|
841
|
-
const C = map(
|
|
842
|
-
const
|
|
843
|
-
return { _id: j, oldParent:
|
|
844
|
-
}), B = C.find(({ _id: j }) => j ===
|
|
845
|
-
B && B.oldParent === y && B.oldPosition === b || (i(
|
|
846
|
-
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition:
|
|
847
|
-
i([j], _,
|
|
840
|
+
moveBlocks: (f, y, b) => {
|
|
841
|
+
const C = map(f, (j) => {
|
|
842
|
+
const w = n.find((E) => E._id === j)._parent || null, A = n.filter((E) => w ? E._parent === w : !E._parent).map((E) => E._id).indexOf(j);
|
|
843
|
+
return { _id: j, oldParent: w, oldPosition: A };
|
|
844
|
+
}), B = C.find(({ _id: j }) => j === f[0]);
|
|
845
|
+
B && B.oldParent === y && B.oldPosition === b || (i(f, y, b), o({
|
|
846
|
+
undo: () => each(C, ({ _id: j, oldParent: _, oldPosition: w }) => {
|
|
847
|
+
i([j], _, w);
|
|
848
848
|
}),
|
|
849
|
-
redo: () => i(
|
|
849
|
+
redo: () => i(f, y, b)
|
|
850
850
|
}));
|
|
851
851
|
},
|
|
852
|
-
addBlocks: (
|
|
853
|
-
a(
|
|
854
|
-
undo: () => l(map(
|
|
855
|
-
redo: () => a(
|
|
852
|
+
addBlocks: (f, y, b) => {
|
|
853
|
+
a(f, y, b), o({
|
|
854
|
+
undo: () => l(map(f, "_id")),
|
|
855
|
+
redo: () => a(f, y, b)
|
|
856
856
|
});
|
|
857
857
|
},
|
|
858
|
-
removeBlocks: (
|
|
858
|
+
removeBlocks: (f) => {
|
|
859
859
|
var B;
|
|
860
|
-
const y = (B = first(
|
|
861
|
-
l(map(
|
|
862
|
-
undo: () => a(
|
|
863
|
-
redo: () => l(map(
|
|
860
|
+
const y = (B = first(f)) == null ? void 0 : B._parent, C = n.filter((j) => y ? j._parent === y : !j._parent).indexOf(first(f));
|
|
861
|
+
l(map(f, "_id")), o({
|
|
862
|
+
undo: () => a(f, y, C),
|
|
863
|
+
redo: () => l(map(f, "_id"))
|
|
864
864
|
});
|
|
865
865
|
},
|
|
866
|
-
updateBlocks: (
|
|
866
|
+
updateBlocks: (f, y, b) => {
|
|
867
867
|
let C = [];
|
|
868
868
|
if (b)
|
|
869
|
-
C = map(
|
|
869
|
+
C = map(f, (B) => ({ _id: B, ...b }));
|
|
870
870
|
else {
|
|
871
871
|
const B = keys(y);
|
|
872
|
-
C = map(
|
|
873
|
-
const _ = n.find((k) => k._id === j),
|
|
874
|
-
return each(B, (k) =>
|
|
872
|
+
C = map(f, (j) => {
|
|
873
|
+
const _ = n.find((k) => k._id === j), w = { _id: j };
|
|
874
|
+
return each(B, (k) => w[k] = _[k]), w;
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
|
-
c(map(
|
|
877
|
+
c(map(f, (B) => ({ _id: B, ...y }))), o({
|
|
878
878
|
undo: () => c(C),
|
|
879
|
-
redo: () => c(map(
|
|
879
|
+
redo: () => c(map(f, (B) => ({ _id: B, ...y })))
|
|
880
880
|
});
|
|
881
881
|
},
|
|
882
|
-
updateBlocksRuntime: (
|
|
883
|
-
c(map(
|
|
882
|
+
updateBlocksRuntime: (f, y) => {
|
|
883
|
+
c(map(f, (b) => ({ _id: b, ...y })));
|
|
884
884
|
},
|
|
885
|
-
setNewBlocks: (
|
|
886
|
-
r(
|
|
885
|
+
setNewBlocks: (f) => {
|
|
886
|
+
r(f), o({
|
|
887
887
|
undo: () => r(n),
|
|
888
|
-
redo: () => r(
|
|
888
|
+
redo: () => r(f)
|
|
889
889
|
});
|
|
890
890
|
},
|
|
891
|
-
updateMultipleBlocksProps: (
|
|
891
|
+
updateMultipleBlocksProps: (f) => {
|
|
892
892
|
let y = [];
|
|
893
|
-
y = map(
|
|
893
|
+
y = map(f, (b) => {
|
|
894
894
|
const C = keys(b), B = n.find((_) => _._id === b._id), j = {};
|
|
895
895
|
return each(C, (_) => j[_] = B[_]), j;
|
|
896
|
-
}), c(
|
|
896
|
+
}), c(f), o({
|
|
897
897
|
undo: () => c(y),
|
|
898
|
-
redo: () => c(
|
|
898
|
+
redo: () => c(f)
|
|
899
899
|
});
|
|
900
900
|
}
|
|
901
901
|
};
|
|
@@ -903,12 +903,12 @@ const undoRedoStateAtom = atom({
|
|
|
903
903
|
const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
|
|
904
904
|
(i, c, d) => {
|
|
905
905
|
var h;
|
|
906
|
-
for (let
|
|
907
|
-
const { _id:
|
|
908
|
-
i[
|
|
909
|
-
const y = filter(i, { _parent:
|
|
906
|
+
for (let x = 0; x < i.length; x++) {
|
|
907
|
+
const { _id: f } = i[x];
|
|
908
|
+
i[x]._id = generateUUID();
|
|
909
|
+
const y = filter(i, { _parent: f });
|
|
910
910
|
for (let b = 0; b < y.length; b++)
|
|
911
|
-
y[b]._parent = i[
|
|
911
|
+
y[b]._parent = i[x]._id;
|
|
912
912
|
}
|
|
913
913
|
const p = first(i);
|
|
914
914
|
let u, g;
|
|
@@ -2361,36 +2361,36 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2361
2361
|
return isEmpty(d) ? !1 : (has(i, "_parent") && isEmpty(i._parent) && delete i._parent, { ...i, ...d });
|
|
2362
2362
|
})
|
|
2363
2363
|
), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
|
|
2364
|
-
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, m = (h,
|
|
2365
|
-
const
|
|
2366
|
-
for (const y in
|
|
2367
|
-
const b =
|
|
2364
|
+
const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, m = (h, x) => {
|
|
2365
|
+
const f = cloneDeep(x.find((y) => y._id === h));
|
|
2366
|
+
for (const y in f) {
|
|
2367
|
+
const b = f[y];
|
|
2368
2368
|
if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
|
|
2369
2369
|
const { baseClasses: C, classes: B } = getSplitChaiClasses(b);
|
|
2370
|
-
|
|
2370
|
+
f[y] = compact(flattenDeep([C, B])).join(" ");
|
|
2371
2371
|
} else
|
|
2372
|
-
y !== "_id" && delete
|
|
2372
|
+
y !== "_id" && delete f[y];
|
|
2373
2373
|
}
|
|
2374
|
-
return
|
|
2374
|
+
return f;
|
|
2375
2375
|
};
|
|
2376
2376
|
return {
|
|
2377
2377
|
askAi: useCallback(
|
|
2378
|
-
async (h,
|
|
2378
|
+
async (h, x, f, y) => {
|
|
2379
2379
|
if (l) {
|
|
2380
2380
|
n(!0), a(null);
|
|
2381
2381
|
try {
|
|
2382
2382
|
const b = p === u ? "" : p;
|
|
2383
|
-
console.log("prompt",
|
|
2384
|
-
const C =
|
|
2385
|
-
if (
|
|
2386
|
-
a(
|
|
2383
|
+
console.log("prompt", f);
|
|
2384
|
+
const C = f.toLowerCase().includes("translate the content"), B = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p, C) : [m(x, d)], j = await l(h, addLangToPrompt(f, g, h), B, b), { blocks: _, error: w } = j;
|
|
2385
|
+
if (w) {
|
|
2386
|
+
a(w);
|
|
2387
2387
|
return;
|
|
2388
2388
|
}
|
|
2389
2389
|
if (h === "styles") {
|
|
2390
|
-
const k = _.map((
|
|
2391
|
-
for (const E in
|
|
2392
|
-
E !== "_id" && (
|
|
2393
|
-
return
|
|
2390
|
+
const k = _.map((A) => {
|
|
2391
|
+
for (const E in A)
|
|
2392
|
+
E !== "_id" && (A[E] = `${STYLES_KEY},${A[E]}`);
|
|
2393
|
+
return A;
|
|
2394
2394
|
});
|
|
2395
2395
|
c(k);
|
|
2396
2396
|
} else
|
|
@@ -2493,12 +2493,12 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2493
2493
|
if (!p)
|
|
2494
2494
|
return m;
|
|
2495
2495
|
let h = [];
|
|
2496
|
-
for (const
|
|
2497
|
-
if (
|
|
2498
|
-
let
|
|
2499
|
-
|
|
2496
|
+
for (const x of m)
|
|
2497
|
+
if (x._type === "PartialBlock" || x._type === "GlobalBlock") {
|
|
2498
|
+
let f = l(x.partialBlockId);
|
|
2499
|
+
x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((y) => (isEmpty(y._parent) && set(y, "_parent", x._parent), y))), h = [...h, ...f];
|
|
2500
2500
|
} else
|
|
2501
|
-
h.push(
|
|
2501
|
+
h.push(x);
|
|
2502
2502
|
return h;
|
|
2503
2503
|
})
|
|
2504
2504
|
};
|
|
@@ -2673,13 +2673,13 @@ const getBlockWithChildren = (o, n) => {
|
|
|
2673
2673
|
const d = o(c), p = a;
|
|
2674
2674
|
let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
|
|
2675
2675
|
return each(p, (m) => {
|
|
2676
|
-
const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2677
|
-
u = u.replace(
|
|
2678
|
-
const
|
|
2679
|
-
includes(["2xl", "xl", "lg", "md", "sm"],
|
|
2676
|
+
const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
|
|
2677
|
+
u = u.replace(x, " ").replace(/\s+/g, " ").trim();
|
|
2678
|
+
const f = first(m.split(":"));
|
|
2679
|
+
includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(m.split(":").pop().trim());
|
|
2680
2680
|
}), each(p, (m) => {
|
|
2681
|
-
const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
2682
|
-
g = g.replace(
|
|
2681
|
+
const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
|
|
2682
|
+
g = g.replace(x, " ").replace(/\s+/g, " ").trim();
|
|
2683
2683
|
}), {
|
|
2684
2684
|
ids: [d._id],
|
|
2685
2685
|
props: {
|
|
@@ -2828,21 +2828,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
|
|
|
2828
2828
|
return "VERTICAL";
|
|
2829
2829
|
}
|
|
2830
2830
|
}, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
|
|
2831
|
-
const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (
|
|
2832
|
-
(
|
|
2833
|
-
isDisabledControl(g, m,
|
|
2831
|
+
const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (f) => c ? get(f, "_parent") === c : !get(f, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, m = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), x = useCallback(
|
|
2832
|
+
(f) => {
|
|
2833
|
+
isDisabledControl(g, m, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), n());
|
|
2834
2834
|
},
|
|
2835
2835
|
[g, m, p, u, i, c, n]
|
|
2836
2836
|
);
|
|
2837
2837
|
return useHotkeys(
|
|
2838
2838
|
"shift+up, shift+down, shift+left, shift+right",
|
|
2839
|
-
({ key:
|
|
2839
|
+
({ key: f }) => {
|
|
2840
2840
|
var y;
|
|
2841
|
-
|
|
2841
|
+
x((y = f == null ? void 0 : f.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
|
|
2842
2842
|
},
|
|
2843
2843
|
{ document: a == null ? void 0 : a.contentDocument },
|
|
2844
|
-
[
|
|
2845
|
-
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock:
|
|
2844
|
+
[x]
|
|
2845
|
+
), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: x, orientation: h };
|
|
2846
2846
|
}, BlockController = ({ block: o, updateFloatingBar: n }) => {
|
|
2847
2847
|
const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
|
|
2848
2848
|
o,
|
|
@@ -3010,7 +3010,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3010
3010
|
elements: { reference: n }
|
|
3011
3011
|
});
|
|
3012
3012
|
useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
|
|
3013
|
-
const
|
|
3013
|
+
const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
|
|
3014
3014
|
return useEffect(() => {
|
|
3015
3015
|
if (n) {
|
|
3016
3016
|
const y = setTimeout(() => h(), 500);
|
|
@@ -3033,16 +3033,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
|
|
|
3033
3033
|
onKeyDown: (y) => y.stopPropagation(),
|
|
3034
3034
|
className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
|
|
3035
3035
|
children: [
|
|
3036
|
-
|
|
3036
|
+
x && /* @__PURE__ */ jsx(
|
|
3037
3037
|
ArrowUpIcon,
|
|
3038
3038
|
{
|
|
3039
3039
|
className: "hover:scale-105",
|
|
3040
3040
|
onClick: () => {
|
|
3041
|
-
c([]), l([
|
|
3041
|
+
c([]), l([x]);
|
|
3042
3042
|
}
|
|
3043
3043
|
}
|
|
3044
3044
|
),
|
|
3045
|
-
/* @__PURE__ */ jsx(BlockActionLabel, { label:
|
|
3045
|
+
/* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
|
|
3046
3046
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
|
|
3047
3047
|
/* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
|
|
3048
3048
|
canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
|
|
@@ -3200,8 +3200,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3200
3200
|
i
|
|
3201
3201
|
]), useHotkeys(
|
|
3202
3202
|
"del, backspace",
|
|
3203
|
-
(
|
|
3204
|
-
|
|
3203
|
+
(x) => {
|
|
3204
|
+
x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
|
|
3205
3205
|
},
|
|
3206
3206
|
h,
|
|
3207
3207
|
[n, l]
|
|
@@ -3503,8 +3503,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3503
3503
|
],
|
|
3504
3504
|
onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
|
|
3505
3505
|
onBlur: ({ editor: u, event: g }) => {
|
|
3506
|
-
const m = g.relatedTarget, h = i.querySelector(".ProseMirror"),
|
|
3507
|
-
if (!
|
|
3506
|
+
const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = h == null ? void 0 : h.contains(m), y = x == null ? void 0 : x.contains(m);
|
|
3507
|
+
if (!f && !y) {
|
|
3508
3508
|
const b = (u == null ? void 0 : u.getHTML()) || "";
|
|
3509
3509
|
r(b);
|
|
3510
3510
|
}
|
|
@@ -3559,14 +3559,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3559
3559
|
useEffect(() => {
|
|
3560
3560
|
if (a.current) {
|
|
3561
3561
|
a.current.innerText = n, a.current.focus();
|
|
3562
|
-
const h = c.createRange(),
|
|
3563
|
-
h.selectNodeContents(a.current), h.collapse(!1),
|
|
3562
|
+
const h = c.createRange(), x = d.getSelection();
|
|
3563
|
+
h.selectNodeContents(a.current), h.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(h), a.current.focus();
|
|
3564
3564
|
} else
|
|
3565
3565
|
r();
|
|
3566
3566
|
}, [c, d]);
|
|
3567
3567
|
const p = useMemo(() => {
|
|
3568
|
-
var
|
|
3569
|
-
const h = ((
|
|
3568
|
+
var x;
|
|
3569
|
+
const h = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
|
|
3570
3570
|
return h === "button" ? "div" : h;
|
|
3571
3571
|
}, [o]), u = useCallback(
|
|
3572
3572
|
(h) => {
|
|
@@ -3582,12 +3582,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3582
3582
|
contentEditable: !0,
|
|
3583
3583
|
className: `${((h = o == null ? void 0 : o.className) == null ? void 0 : h.replace("sr-only", "")) || ""} outline outline-[2px] outline-green-500 shadow-none empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 empty:before:absolute empty:before:pointer-events-none empty:before:select-none empty:before:inset-0 empty:before:z-0 relative min-h-[1em]`,
|
|
3584
3584
|
style: cloneDeep(o == null ? void 0 : o.style) || {},
|
|
3585
|
-
onInput: (
|
|
3586
|
-
const
|
|
3587
|
-
|
|
3585
|
+
onInput: (x) => {
|
|
3586
|
+
const f = x.target;
|
|
3587
|
+
f && (f.innerText.trim() === "" ? (f.setAttribute("data-placeholder", "Enter text here"), f.children.length > 0 && f.children[0].remove()) : x.target.removeAttribute("data-placeholder"), l(x.target.innerText));
|
|
3588
3588
|
},
|
|
3589
|
-
onClick: (
|
|
3590
|
-
|
|
3589
|
+
onClick: (x) => {
|
|
3590
|
+
x.stopPropagation(), x.preventDefault();
|
|
3591
3591
|
}
|
|
3592
3592
|
};
|
|
3593
3593
|
}, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
|
|
@@ -3600,38 +3600,38 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3600
3600
|
}
|
|
3601
3601
|
), WithBlockTextEditor = memo(
|
|
3602
3602
|
({ block: o, children: n }) => {
|
|
3603
|
-
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang:
|
|
3603
|
+
const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: C, blockType: B } = useMemo(() => {
|
|
3604
3604
|
var I;
|
|
3605
|
-
const
|
|
3605
|
+
const A = o._type;
|
|
3606
3606
|
let E = o[r];
|
|
3607
3607
|
const S = getRegisteredChaiBlock(o._type);
|
|
3608
|
-
return
|
|
3609
|
-
}, [o,
|
|
3610
|
-
(
|
|
3608
|
+
return x && ((I = S == null ? void 0 : S.i18nProps) == null ? void 0 : I.includes(r)) && has(o, `${r}-${x}`) && (E = get(o, `${r}-${x}`)), { blockContent: E, blockType: A };
|
|
3609
|
+
}, [o, x]), j = useCallback(
|
|
3610
|
+
(A) => {
|
|
3611
3611
|
var S;
|
|
3612
|
-
const E =
|
|
3613
|
-
h([b], { [r]: E }), u(null), c(null), d(-1),
|
|
3612
|
+
const E = A || ((S = g.current) == null ? void 0 : S.innerText);
|
|
3613
|
+
h([b], { [r]: E }), u(null), c(null), d(-1), f(b ? [b] : []);
|
|
3614
3614
|
},
|
|
3615
|
-
[b, h, c,
|
|
3615
|
+
[b, h, c, f, x]
|
|
3616
3616
|
), _ = useDebouncedCallback(
|
|
3617
|
-
(
|
|
3618
|
-
h([b], { [r]:
|
|
3617
|
+
(A) => {
|
|
3618
|
+
h([b], { [r]: A });
|
|
3619
3619
|
},
|
|
3620
|
-
[b, o, h,
|
|
3620
|
+
[b, o, h, x],
|
|
3621
3621
|
1e3
|
|
3622
|
-
),
|
|
3623
|
-
(
|
|
3624
|
-
|
|
3622
|
+
), w = useCallback(
|
|
3623
|
+
(A) => {
|
|
3624
|
+
A.preventDefault(), b && (y.current = b), j(), setTimeout(() => {
|
|
3625
3625
|
const E = y.current;
|
|
3626
|
-
y.current = null,
|
|
3626
|
+
y.current = null, f([E]);
|
|
3627
3627
|
}, 100);
|
|
3628
3628
|
},
|
|
3629
|
-
[
|
|
3629
|
+
[f, b, x]
|
|
3630
3630
|
);
|
|
3631
3631
|
useEffect(() => {
|
|
3632
3632
|
var v;
|
|
3633
3633
|
if (!b) return;
|
|
3634
|
-
const
|
|
3634
|
+
const A = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${A}${E}`);
|
|
3635
3635
|
S && ((v = S == null ? void 0 : S.classList) == null || v.add("sr-only"), u(S));
|
|
3636
3636
|
}, [b, B, a, i]);
|
|
3637
3637
|
const k = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
|
|
@@ -3641,7 +3641,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3641
3641
|
editingElement: p,
|
|
3642
3642
|
onChange: _,
|
|
3643
3643
|
onClose: j,
|
|
3644
|
-
onEscape:
|
|
3644
|
+
onEscape: w
|
|
3645
3645
|
}
|
|
3646
3646
|
) : /* @__PURE__ */ jsx(
|
|
3647
3647
|
MemoizedEditor,
|
|
@@ -3651,9 +3651,9 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3651
3651
|
editingElement: p,
|
|
3652
3652
|
onClose: j,
|
|
3653
3653
|
onChange: _,
|
|
3654
|
-
onEscape:
|
|
3654
|
+
onEscape: w
|
|
3655
3655
|
}
|
|
3656
|
-
)) : null, [p, b, B, C, j,
|
|
3656
|
+
)) : null, [p, b, B, C, j, x]);
|
|
3657
3657
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3658
3658
|
k,
|
|
3659
3659
|
n
|
|
@@ -3688,18 +3688,18 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3688
3688
|
blockAtom: n,
|
|
3689
3689
|
children: r
|
|
3690
3690
|
}) => {
|
|
3691
|
-
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), h = get(c, "component", null), { index:
|
|
3691
|
+
const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), h = get(c, "component", null), { index: x, key: f } = useContext(RepeaterContext), y = useMemo(
|
|
3692
3692
|
() => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
|
|
3693
|
-
index:
|
|
3694
|
-
key:
|
|
3693
|
+
index: x,
|
|
3694
|
+
key: f
|
|
3695
3695
|
}) : applyLanguage(i, d, c),
|
|
3696
|
-
[i, d, c, g, m,
|
|
3696
|
+
[i, d, c, g, m, x, f]
|
|
3697
3697
|
), b = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), C = useMemo(
|
|
3698
3698
|
() => u(i._id, getBlockRuntimeProps(i._type)),
|
|
3699
3699
|
[i._id, i._type, u, getBlockRuntimeProps]
|
|
3700
3700
|
), B = useMemo(
|
|
3701
3701
|
() => ({
|
|
3702
|
-
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index":
|
|
3702
|
+
blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
|
|
3703
3703
|
inBuilder: !0,
|
|
3704
3704
|
lang: d || p,
|
|
3705
3705
|
...y,
|
|
@@ -3719,7 +3719,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3719
3719
|
]
|
|
3720
3720
|
), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), _ = useMemo(() => get(i, "_show", !0), [i]);
|
|
3721
3721
|
if (isNull(h) || !_) return null;
|
|
3722
|
-
let
|
|
3722
|
+
let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
|
|
3723
3723
|
...B,
|
|
3724
3724
|
children: r({
|
|
3725
3725
|
_id: i._id,
|
|
@@ -3732,7 +3732,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3732
3732
|
...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
|
|
3733
3733
|
})
|
|
3734
3734
|
}) });
|
|
3735
|
-
const k = a === i._id && (l ===
|
|
3735
|
+
const k = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
|
|
3736
3736
|
return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: k }) : k;
|
|
3737
3737
|
}, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
|
|
3738
3738
|
const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
|
|
@@ -3773,7 +3773,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
|
|
|
3773
3773
|
);
|
|
3774
3774
|
return map(l, (c) => {
|
|
3775
3775
|
const d = a(c._id);
|
|
3776
|
-
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: m, repeaterItems: h, $repeaterItemsKey:
|
|
3776
|
+
return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: m, repeaterItems: h, $repeaterItemsKey: x }) => g === "Repeater" ? isArray(h) && h.map((f, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: m }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
|
|
3777
3777
|
});
|
|
3778
3778
|
}, PageBlocksRenderer = () => {
|
|
3779
3779
|
const [o] = useBlocksStore();
|
|
@@ -3841,14 +3841,14 @@ const CanvasEventsWatcher = () => {
|
|
|
3841
3841
|
}, StaticCanvas = () => {
|
|
3842
3842
|
const [o] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), r = useRef(null), a = useRef(null), [l, i] = useState({ width: 0, height: 0 }), c = useCanvasScale(l), [, d] = useAtom$1(canvasIframeAtom), p = useBuilderProp("loading", !1), u = useBuilderProp("htmlDir", "ltr"), g = useCallback(
|
|
3843
3843
|
(h) => {
|
|
3844
|
-
i((
|
|
3844
|
+
i((x) => ({ ...x, width: h }));
|
|
3845
3845
|
},
|
|
3846
3846
|
[i]
|
|
3847
3847
|
);
|
|
3848
3848
|
useEffect(() => {
|
|
3849
3849
|
if (!a.current) return;
|
|
3850
|
-
const { clientWidth: h, clientHeight:
|
|
3851
|
-
i({ width: h, height:
|
|
3850
|
+
const { clientWidth: h, clientHeight: x } = a.current;
|
|
3851
|
+
i({ width: h, height: x });
|
|
3852
3852
|
}, [a, o]);
|
|
3853
3853
|
const m = useMemo(() => {
|
|
3854
3854
|
let h = IframeInitialContent;
|
|
@@ -3895,10 +3895,13 @@ const CanvasEventsWatcher = () => {
|
|
|
3895
3895
|
)
|
|
3896
3896
|
}
|
|
3897
3897
|
) });
|
|
3898
|
-
}, FallbackError = () =>
|
|
3899
|
-
|
|
3900
|
-
/* @__PURE__ */ jsx("
|
|
3901
|
-
|
|
3898
|
+
}, FallbackError = () => {
|
|
3899
|
+
const { t: o } = useTranslation();
|
|
3900
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3901
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
|
|
3902
|
+
/* @__PURE__ */ jsx("p", { children: o("Please try again.") })
|
|
3903
|
+
] }) });
|
|
3904
|
+
}, CodeEditor$1 = React__default.lazy(() => import("./code-editor-GydqqBXp.js")), CanvasArea = () => {
|
|
3902
3905
|
const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
|
|
3903
3906
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
|
|
3904
3907
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
|
|
@@ -3963,8 +3966,8 @@ const CanvasEventsWatcher = () => {
|
|
|
3963
3966
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
|
|
3964
3967
|
] });
|
|
3965
3968
|
}, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
|
|
3966
|
-
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (
|
|
3967
|
-
if (!
|
|
3969
|
+
const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (x) => {
|
|
3970
|
+
if (!x.trim()) {
|
|
3968
3971
|
p(!1), g("Please enter a URL");
|
|
3969
3972
|
return;
|
|
3970
3973
|
}
|
|
@@ -3988,7 +3991,7 @@ const CanvasEventsWatcher = () => {
|
|
|
3988
3991
|
{
|
|
3989
3992
|
placeholder: h(`Enter ${r} URL`),
|
|
3990
3993
|
value: a,
|
|
3991
|
-
onChange: (
|
|
3994
|
+
onChange: (x) => l(x.target.value),
|
|
3992
3995
|
onKeyUp: () => m(a)
|
|
3993
3996
|
}
|
|
3994
3997
|
),
|
|
@@ -4028,7 +4031,7 @@ const CanvasEventsWatcher = () => {
|
|
|
4028
4031
|
};
|
|
4029
4032
|
MediaManagerModal.displayName = "MediaManagerModal";
|
|
4030
4033
|
const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==", ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
|
|
4031
|
-
const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = r.split(".").pop() || "", u = i ? `_${p}Id-${i}` : `_${p}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), m = get(c, u, g ? c == null ? void 0 : c.assetId : ""), h = !!m,
|
|
4034
|
+
const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = r.split(".").pop() || "", u = i ? `_${p}Id-${i}` : `_${p}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), m = get(c, u, g ? c == null ? void 0 : c.assetId : ""), h = !!m, x = (y) => {
|
|
4032
4035
|
const b = isArray(y) ? first(y) : y;
|
|
4033
4036
|
if (b) {
|
|
4034
4037
|
n(b == null ? void 0 : b.url);
|
|
@@ -4043,7 +4046,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4043
4046
|
d([c._id], j);
|
|
4044
4047
|
}
|
|
4045
4048
|
}
|
|
4046
|
-
},
|
|
4049
|
+
}, f = useCallback(() => {
|
|
4047
4050
|
n(PLACEHOLDER_IMAGE), c != null && c._id && d([c._id], { assetId: "" });
|
|
4048
4051
|
}, [n, c == null ? void 0 : c._id, d]);
|
|
4049
4052
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
|
|
@@ -4060,12 +4063,12 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4060
4063
|
"button",
|
|
4061
4064
|
{
|
|
4062
4065
|
type: "button",
|
|
4063
|
-
onClick:
|
|
4066
|
+
onClick: f,
|
|
4064
4067
|
className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
|
|
4065
4068
|
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" })
|
|
4066
4069
|
}
|
|
4067
4070
|
),
|
|
4068
|
-
m && m !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
4071
|
+
m && m !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, assetId: m, children: /* @__PURE__ */ jsx(
|
|
4069
4072
|
"button",
|
|
4070
4073
|
{
|
|
4071
4074
|
type: "button",
|
|
@@ -4073,10 +4076,10 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4073
4076
|
children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-4 w-4 text-white" })
|
|
4074
4077
|
}
|
|
4075
4078
|
) })
|
|
4076
|
-
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
4079
|
+
] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, mode: "image", assetId: m, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
|
|
4077
4080
|
/* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
|
|
4078
4081
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4079
|
-
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect:
|
|
4082
|
+
/* @__PURE__ */ jsx(MediaManagerModal, { onSelect: x, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 cursor-pointer rounded-md bg-secondary px-2 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: o || !isEmpty(o) ? l("Replace image") : l("Choose image") }) }),
|
|
4080
4083
|
/* @__PURE__ */ jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-secondary-foreground", children: "OR" })
|
|
4081
4084
|
] }),
|
|
4082
4085
|
/* @__PURE__ */ jsx(
|
|
@@ -4099,24 +4102,24 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4099
4102
|
}, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
|
|
4100
4103
|
const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (m) => Array.isArray(m) ? "array" : typeof m == "object" && m !== null ? "object" : "value", p = React__default.useCallback(
|
|
4101
4104
|
(m) => {
|
|
4102
|
-
const h = (
|
|
4103
|
-
m.type === "object" ? (l((
|
|
4105
|
+
const h = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
|
|
4106
|
+
m.type === "object" ? (l((x) => [...x, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
|
|
4104
4107
|
},
|
|
4105
4108
|
[a, n, r]
|
|
4106
4109
|
), u = React__default.useCallback(() => {
|
|
4107
4110
|
if (a.length > 0) {
|
|
4108
4111
|
const m = a.slice(0, -1);
|
|
4109
|
-
l(m), c(m.reduce((h,
|
|
4112
|
+
l(m), c(m.reduce((h, x) => h[x], o));
|
|
4110
4113
|
}
|
|
4111
4114
|
}, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([m, h]) => ({ key: m, value: h, type: d(h) })).filter((m) => !startsWith(m.key, REPEATER_PREFIX) && m.key.includes("/") ? !1 : r === "value" ? m.type === "value" || m.type === "object" : r === "array" ? m.type === "array" || m.type === "object" : r === "object" ? m.type === "object" : !0) : [], [i, r]);
|
|
4112
4115
|
return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
|
|
4113
4116
|
/* @__PURE__ */ jsx(CommandInput, { className: "border-none", placeholder: "Search..." }),
|
|
4114
4117
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
4115
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: "No option found." }),
|
|
4118
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: t("No option found.") }),
|
|
4116
4119
|
/* @__PURE__ */ jsxs(CommandGroup, { children: [
|
|
4117
4120
|
a.length > 0 && /* @__PURE__ */ jsxs(CommandItem, { onSelect: u, className: "flex items-center text-sm", children: [
|
|
4118
4121
|
/* @__PURE__ */ jsx(ChevronLeftIcon, { className: "mr-2 h-4 w-4" }),
|
|
4119
|
-
"Back"
|
|
4122
|
+
t("Back")
|
|
4120
4123
|
] }),
|
|
4121
4124
|
g.map((m) => /* @__PURE__ */ jsxs(
|
|
4122
4125
|
CommandItem,
|
|
@@ -4128,7 +4131,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4128
4131
|
children: [
|
|
4129
4132
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
|
|
4130
4133
|
startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(IdCardIcon, {}) : null,
|
|
4131
|
-
startsWith(m.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
|
|
4134
|
+
startsWith(m.key, REPEATER_PREFIX) ? t("Repeater Data") : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
|
|
4132
4135
|
] }),
|
|
4133
4136
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4134
4137
|
r === "object" && m.type === "object" && /* @__PURE__ */ jsx(
|
|
@@ -4140,7 +4143,7 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
|
|
|
4140
4143
|
onClick: (h) => {
|
|
4141
4144
|
h.stopPropagation(), n([...a, m.key].join("."), r);
|
|
4142
4145
|
},
|
|
4143
|
-
children: "Select"
|
|
4146
|
+
children: t("Select")
|
|
4144
4147
|
}
|
|
4145
4148
|
),
|
|
4146
4149
|
m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
@@ -4177,7 +4180,7 @@ function NestedPathSelector({ data: o, onSelect: n, dataType: r = "value" }) {
|
|
|
4177
4180
|
) })
|
|
4178
4181
|
}
|
|
4179
4182
|
) }) }),
|
|
4180
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: "Add field" })
|
|
4183
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: t("Add field") })
|
|
4181
4184
|
] }),
|
|
4182
4185
|
/* @__PURE__ */ jsx(PopoverContent, { className: "z-[1000]! relative mr-3 w-[300px] p-0", children: /* @__PURE__ */ jsx(
|
|
4183
4186
|
PathDropdown,
|
|
@@ -4199,7 +4202,7 @@ const DataBindingSelector = ({
|
|
|
4199
4202
|
}) => {
|
|
4200
4203
|
const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
|
|
4201
4204
|
if (i.length === 1) return "";
|
|
4202
|
-
const g = i.find((
|
|
4205
|
+
const g = i.find((x) => x._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
|
|
4203
4206
|
return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
|
|
4204
4207
|
}, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
|
|
4205
4208
|
(g, m) => {
|
|
@@ -4207,16 +4210,16 @@ const DataBindingSelector = ({
|
|
|
4207
4210
|
n(`{{${g}}}`, {}, r);
|
|
4208
4211
|
return;
|
|
4209
4212
|
}
|
|
4210
|
-
const h = (b) => /[.,!?;:]/.test(b),
|
|
4213
|
+
const h = (b) => /[.,!?;:]/.test(b), x = (b, C, B) => {
|
|
4211
4214
|
let j = "", _ = "";
|
|
4212
|
-
const
|
|
4213
|
-
return C > 0 && (
|
|
4215
|
+
const w = C > 0 ? b[C - 1] : "", k = C < b.length ? b[C] : "";
|
|
4216
|
+
return C > 0 && (w === "." || !h(w) && w !== " ") && (j = " "), C < b.length && !h(k) && k !== " " && (_ = " "), {
|
|
4214
4217
|
text: j + B + _,
|
|
4215
4218
|
prefixLength: j.length,
|
|
4216
4219
|
suffixLength: _.length
|
|
4217
4220
|
};
|
|
4218
|
-
},
|
|
4219
|
-
if (!
|
|
4221
|
+
}, f = document.getElementById(r);
|
|
4222
|
+
if (!f) return;
|
|
4220
4223
|
const y = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
|
|
4221
4224
|
if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
|
|
4222
4225
|
const b = y.__chaiRTE;
|
|
@@ -4227,9 +4230,9 @@ const DataBindingSelector = ({
|
|
|
4227
4230
|
if (B !== j)
|
|
4228
4231
|
b.chain().deleteSelection().insertContent(C).run();
|
|
4229
4232
|
else {
|
|
4230
|
-
const { state:
|
|
4233
|
+
const { state: w } = b, k = w.selection.from, A = w.doc.textBetween(Math.max(0, k - 1), k), E = w.doc.textBetween(k, Math.min(k + 1, w.doc.content.size));
|
|
4231
4234
|
let S = "";
|
|
4232
|
-
k > 0 &&
|
|
4235
|
+
k > 0 && A !== " " && !h(A) && (S = " ");
|
|
4233
4236
|
let v = "";
|
|
4234
4237
|
E && E !== " " && !h(E) && (v = " "), b.chain().insertContent(S + C + v).run();
|
|
4235
4238
|
}
|
|
@@ -4237,14 +4240,14 @@ const DataBindingSelector = ({
|
|
|
4237
4240
|
return;
|
|
4238
4241
|
}
|
|
4239
4242
|
} else {
|
|
4240
|
-
const b =
|
|
4243
|
+
const b = f, C = b.selectionStart || 0, B = b.value || "", j = b.selectionEnd || C;
|
|
4241
4244
|
if (j > C) {
|
|
4242
|
-
const E = `{{${g}}}`, { text: S } =
|
|
4245
|
+
const E = `{{${g}}}`, { text: S } = x(B, C, E), v = B.slice(0, C) + S + B.slice(j);
|
|
4243
4246
|
n(v, {}, r);
|
|
4244
4247
|
return;
|
|
4245
4248
|
}
|
|
4246
|
-
const
|
|
4247
|
-
n(
|
|
4249
|
+
const w = `{{${g}}}`, { text: k } = x(B, C, w), A = B.slice(0, C) + k + B.slice(C);
|
|
4250
|
+
n(A, {}, r);
|
|
4248
4251
|
}
|
|
4249
4252
|
},
|
|
4250
4253
|
[r, n, a, c == null ? void 0 : c._id, d]
|
|
@@ -4266,9 +4269,9 @@ const DataBindingSelector = ({
|
|
|
4266
4269
|
onChange: r
|
|
4267
4270
|
}) => {
|
|
4268
4271
|
var E;
|
|
4269
|
-
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, v) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [
|
|
4272
|
+
const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, v) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), C = useRef(null), B = (E = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : E.name;
|
|
4270
4273
|
useEffect(() => {
|
|
4271
|
-
if (h(""),
|
|
4274
|
+
if (h(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
|
|
4272
4275
|
const S = split(o, ":"), v = get(S, 1, "page") || "page";
|
|
4273
4276
|
g(v), (async () => {
|
|
4274
4277
|
const I = await l(v, [get(S, 2, "page")]);
|
|
@@ -4278,10 +4281,10 @@ const DataBindingSelector = ({
|
|
|
4278
4281
|
const j = useDebouncedCallback(
|
|
4279
4282
|
async (S) => {
|
|
4280
4283
|
if (isEmpty(S))
|
|
4281
|
-
|
|
4284
|
+
f([]);
|
|
4282
4285
|
else {
|
|
4283
4286
|
const v = await l(u, S);
|
|
4284
|
-
|
|
4287
|
+
f(v);
|
|
4285
4288
|
}
|
|
4286
4289
|
c(!1), b(-1);
|
|
4287
4290
|
},
|
|
@@ -4289,18 +4292,18 @@ const DataBindingSelector = ({
|
|
|
4289
4292
|
300
|
|
4290
4293
|
), _ = (S) => {
|
|
4291
4294
|
const v = ["pageType", u, S.id];
|
|
4292
|
-
v[1] && (r(v.join(":")), h(S.name), p(!1),
|
|
4293
|
-
},
|
|
4295
|
+
v[1] && (r(v.join(":")), h(S.name), p(!1), f([]), b(-1));
|
|
4296
|
+
}, w = (S) => {
|
|
4294
4297
|
switch (S.key) {
|
|
4295
4298
|
case "ArrowDown":
|
|
4296
|
-
S.preventDefault(), b((v) => v <
|
|
4299
|
+
S.preventDefault(), b((v) => v < x.length - 1 ? v + 1 : v);
|
|
4297
4300
|
break;
|
|
4298
4301
|
case "ArrowUp":
|
|
4299
4302
|
S.preventDefault(), b((v) => v > 0 ? v - 1 : v);
|
|
4300
4303
|
break;
|
|
4301
4304
|
case "Enter":
|
|
4302
|
-
if (S.preventDefault(),
|
|
4303
|
-
y >= 0 && _(
|
|
4305
|
+
if (S.preventDefault(), x.length === 0) return;
|
|
4306
|
+
y >= 0 && _(x[y]);
|
|
4304
4307
|
break;
|
|
4305
4308
|
case "Escape":
|
|
4306
4309
|
S.preventDefault(), k();
|
|
@@ -4314,8 +4317,8 @@ const DataBindingSelector = ({
|
|
|
4314
4317
|
}
|
|
4315
4318
|
}, [y]);
|
|
4316
4319
|
const k = () => {
|
|
4317
|
-
h(""),
|
|
4318
|
-
},
|
|
4320
|
+
h(""), f([]), b(-1), p(!1), r("");
|
|
4321
|
+
}, A = (S) => {
|
|
4319
4322
|
h(S), p(!isEmpty(S)), c(!0), j(S);
|
|
4320
4323
|
};
|
|
4321
4324
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4326,23 +4329,23 @@ const DataBindingSelector = ({
|
|
|
4326
4329
|
{
|
|
4327
4330
|
type: "text",
|
|
4328
4331
|
value: m,
|
|
4329
|
-
onChange: (S) =>
|
|
4330
|
-
onKeyDown:
|
|
4332
|
+
onChange: (S) => A(S.target.value),
|
|
4333
|
+
onKeyDown: w,
|
|
4331
4334
|
placeholder: a(`Search ${B ?? ""}`),
|
|
4332
4335
|
className: "w-full rounded-md border border-gray-300 p-2 pr-16"
|
|
4333
4336
|
}
|
|
4334
4337
|
),
|
|
4335
4338
|
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: k, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
|
|
4336
4339
|
] }),
|
|
4337
|
-
(i || !isEmpty(
|
|
4340
|
+
(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
4341
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
4339
4342
|
/* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
4340
|
-
] }) : d && isEmpty(
|
|
4343
|
+
] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
|
|
4341
4344
|
a("No results found for"),
|
|
4342
4345
|
' "',
|
|
4343
4346
|
m,
|
|
4344
4347
|
'"'
|
|
4345
|
-
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(
|
|
4348
|
+
] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(x == null ? void 0 : x.slice(0, 20), (S, v) => /* @__PURE__ */ jsxs(
|
|
4346
4349
|
"li",
|
|
4347
4350
|
{
|
|
4348
4351
|
onClick: () => _(S),
|
|
@@ -4657,15 +4660,15 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4657
4660
|
if (!u) return;
|
|
4658
4661
|
const h = `{{${m}}}`;
|
|
4659
4662
|
u.commands.focus();
|
|
4660
|
-
const { from:
|
|
4661
|
-
if (
|
|
4663
|
+
const { from: x, to: f } = u.state.selection;
|
|
4664
|
+
if (x !== f)
|
|
4662
4665
|
u.chain().deleteSelection().insertContent(h).run();
|
|
4663
4666
|
else {
|
|
4664
4667
|
const { state: b } = u, C = b.selection.from, B = b.doc.textBetween(Math.max(0, C - 1), C), j = b.doc.textBetween(C, Math.min(C + 1, b.doc.content.size));
|
|
4665
4668
|
let _ = "";
|
|
4666
4669
|
C > 0 && B !== " " && !/[.,!?;:]/.test(B) && (_ = " ");
|
|
4667
|
-
let
|
|
4668
|
-
j && j !== " " && !/[.,!?;:]/.test(j) && (
|
|
4670
|
+
let w = "";
|
|
4671
|
+
j && j !== " " && !/[.,!?;:]/.test(j) && (w = " "), u.chain().insertContent(_ + h + w).run();
|
|
4669
4672
|
}
|
|
4670
4673
|
};
|
|
4671
4674
|
return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
|
|
@@ -4704,13 +4707,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4704
4707
|
})
|
|
4705
4708
|
],
|
|
4706
4709
|
content: r || "",
|
|
4707
|
-
onUpdate: ({ editor:
|
|
4708
|
-
const
|
|
4709
|
-
a(
|
|
4710
|
+
onUpdate: ({ editor: x }) => {
|
|
4711
|
+
const f = x.getHTML();
|
|
4712
|
+
a(f), c || u(f);
|
|
4710
4713
|
},
|
|
4711
|
-
onBlur: ({ editor:
|
|
4712
|
-
const
|
|
4713
|
-
l(o,
|
|
4714
|
+
onBlur: ({ editor: x }) => {
|
|
4715
|
+
const f = x.getHTML();
|
|
4716
|
+
l(o, f);
|
|
4714
4717
|
},
|
|
4715
4718
|
editorProps: {
|
|
4716
4719
|
attributes: {
|
|
@@ -4723,8 +4726,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4723
4726
|
}, [g]), useEffect(() => {
|
|
4724
4727
|
u(r || "");
|
|
4725
4728
|
}, [r]);
|
|
4726
|
-
const m = (
|
|
4727
|
-
a(
|
|
4729
|
+
const m = (x) => {
|
|
4730
|
+
a(x);
|
|
4728
4731
|
}, h = () => {
|
|
4729
4732
|
d(!1), g && g.commands.setContent(p);
|
|
4730
4733
|
};
|
|
@@ -4757,24 +4760,24 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4757
4760
|
u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
|
|
4758
4761
|
}, [o, u]);
|
|
4759
4762
|
const m = () => {
|
|
4760
|
-
const
|
|
4761
|
-
if (
|
|
4762
|
-
const y = (
|
|
4763
|
+
const f = findIndex(u, { _id: g });
|
|
4764
|
+
if (f > -1) {
|
|
4765
|
+
const y = (f + 1) % u.length, b = get(u, [y, "_id"]);
|
|
4763
4766
|
if (!b) return;
|
|
4764
4767
|
n({ ...o, currentSlide: b }), c([b]);
|
|
4765
4768
|
}
|
|
4766
4769
|
}, h = () => {
|
|
4767
|
-
const
|
|
4768
|
-
if (
|
|
4769
|
-
const y = (
|
|
4770
|
+
const f = findIndex(u, { _id: g });
|
|
4771
|
+
if (f > -1) {
|
|
4772
|
+
const y = (f - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
|
|
4770
4773
|
if (!b) return;
|
|
4771
4774
|
n({ ...o, currentSlide: b }), c([b]);
|
|
4772
4775
|
}
|
|
4773
|
-
},
|
|
4774
|
-
const
|
|
4776
|
+
}, x = () => {
|
|
4777
|
+
const f = i(
|
|
4775
4778
|
{ styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
|
|
4776
4779
|
p == null ? void 0 : p._id
|
|
4777
|
-
), y =
|
|
4780
|
+
), y = f == null ? void 0 : f._id;
|
|
4778
4781
|
y && (n({ ...o, currentSlide: y }), c([y]));
|
|
4779
4782
|
};
|
|
4780
4783
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
|
|
@@ -4792,7 +4795,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4792
4795
|
/* @__PURE__ */ jsxs(
|
|
4793
4796
|
"button",
|
|
4794
4797
|
{
|
|
4795
|
-
onClick:
|
|
4798
|
+
onClick: x,
|
|
4796
4799
|
className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
|
|
4797
4800
|
children: [
|
|
4798
4801
|
/* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-3 w-3" }),
|
|
@@ -4853,8 +4856,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4853
4856
|
value: o == null ? void 0 : o.autoplayInterval,
|
|
4854
4857
|
className: "text-xs",
|
|
4855
4858
|
pattern: "[0-9]*",
|
|
4856
|
-
onChange: (
|
|
4857
|
-
let y =
|
|
4859
|
+
onChange: (f) => {
|
|
4860
|
+
let y = f.target.value;
|
|
4858
4861
|
y.length && (y = y.replace("-", "")), n({ ...o, autoplayInterval: y });
|
|
4859
4862
|
}
|
|
4860
4863
|
}
|
|
@@ -4962,17 +4965,17 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4962
4965
|
formData: u,
|
|
4963
4966
|
onChange: g
|
|
4964
4967
|
}) => {
|
|
4965
|
-
const { selectedLang: m, fallbackLang: h, languages:
|
|
4966
|
-
() => isEmpty(
|
|
4967
|
-
[
|
|
4968
|
-
), y = useMemo(() => get(LANGUAGES,
|
|
4968
|
+
const { selectedLang: m, fallbackLang: h, languages: x } = useLanguages(), f = useMemo(
|
|
4969
|
+
() => isEmpty(x) ? "" : isEmpty(m) ? h : m,
|
|
4970
|
+
[x, m, h]
|
|
4971
|
+
), y = useMemo(() => get(LANGUAGES, f, f), [f]), b = usePageExternalData(), C = useSelectedBlock(), B = useRegisteredChaiBlocks(), j = useMemo(
|
|
4969
4972
|
() => get(B, [C == null ? void 0 : C._type, "i18nProps"], []),
|
|
4970
4973
|
[B, C == null ? void 0 : C._type]
|
|
4971
|
-
), [_,
|
|
4974
|
+
), [_, w] = useState(null);
|
|
4972
4975
|
if (c)
|
|
4973
4976
|
return null;
|
|
4974
4977
|
if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: n, children: a });
|
|
4975
|
-
const
|
|
4978
|
+
const A = j == null ? void 0 : j.includes(o.replace("root.", ""));
|
|
4976
4979
|
if (p.type === "array") {
|
|
4977
4980
|
const E = _ === o;
|
|
4978
4981
|
return /* @__PURE__ */ jsxs("div", { className: `${n} relative`, children: [
|
|
@@ -4980,7 +4983,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
4980
4983
|
"label",
|
|
4981
4984
|
{
|
|
4982
4985
|
htmlFor: o,
|
|
4983
|
-
onClick: () =>
|
|
4986
|
+
onClick: () => w(E ? null : o),
|
|
4984
4987
|
className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
|
|
4985
4988
|
children: [
|
|
4986
4989
|
E ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
|
|
@@ -5015,7 +5018,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5015
5018
|
/* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
|
|
5016
5019
|
r,
|
|
5017
5020
|
" ",
|
|
5018
|
-
|
|
5021
|
+
A && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
|
|
5019
5022
|
" ",
|
|
5020
5023
|
y
|
|
5021
5024
|
] }),
|
|
@@ -5137,43 +5140,43 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
|
|
|
5137
5140
|
}), a;
|
|
5138
5141
|
};
|
|
5139
5142
|
function BlockSettings() {
|
|
5140
|
-
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m),
|
|
5141
|
-
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(
|
|
5142
|
-
},
|
|
5143
|
-
debounce(({ formData:
|
|
5144
|
-
|
|
5143
|
+
const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData: w }, k, A) => {
|
|
5144
|
+
k && (c == null ? void 0 : c._id) === n._id && a([n._id], { [k]: get(w, k) }, A);
|
|
5145
|
+
}, f = useCallback(
|
|
5146
|
+
debounce(({ formData: w }, k, A) => {
|
|
5147
|
+
x({ formData: w }, k, A), d(w);
|
|
5145
5148
|
}, 1500),
|
|
5146
5149
|
[n == null ? void 0 : n._id, o]
|
|
5147
|
-
), y = ({ formData:
|
|
5148
|
-
k && (r([n._id], { [k]: get(
|
|
5149
|
-
}, b = ({ formData:
|
|
5150
|
-
k && (r([g._id], { [k]: get(
|
|
5150
|
+
), y = ({ formData: w }, k) => {
|
|
5151
|
+
k && (r([n._id], { [k]: get(w, k) }), f({ formData: w }, k, { [k]: get(c, k) }));
|
|
5152
|
+
}, b = ({ formData: w }, k) => {
|
|
5153
|
+
k && (r([g._id], { [k]: get(w, k) }), f({ formData: w }, k, { [k]: get(c, k) }));
|
|
5151
5154
|
}, { schema: C, uiSchema: B } = useMemo(() => {
|
|
5152
|
-
const
|
|
5153
|
-
if (!
|
|
5155
|
+
const w = n == null ? void 0 : n._type;
|
|
5156
|
+
if (!w)
|
|
5154
5157
|
return { schema: {}, uiSchema: {} };
|
|
5155
5158
|
try {
|
|
5156
|
-
const { schema: k, uiSchema:
|
|
5157
|
-
if (
|
|
5159
|
+
const { schema: k, uiSchema: A } = getBlockFormSchemas(w);
|
|
5160
|
+
if (w === "Repeater") {
|
|
5158
5161
|
const E = get(n, "repeaterItems", "");
|
|
5159
|
-
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(
|
|
5162
|
+
startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(A, "filter", { "ui:widget": "collectionSelect" }), set(A, "sort", { "ui:widget": "collectionSelect" })) : (set(A, "filter", { "ui:widget": "hidden" }), set(A, "sort", { "ui:widget": "hidden" }));
|
|
5160
5163
|
}
|
|
5161
|
-
return { schema: k, uiSchema:
|
|
5164
|
+
return { schema: k, uiSchema: A };
|
|
5162
5165
|
} catch {
|
|
5163
5166
|
return { schema: {}, uiSchema: {} };
|
|
5164
5167
|
}
|
|
5165
5168
|
}, [n]), { wrapperSchema: j, wrapperUiSchema: _ } = useMemo(() => {
|
|
5166
5169
|
if (!g || !(g != null && g._type))
|
|
5167
5170
|
return { wrapperSchema: {}, wrapperUiSchema: {} };
|
|
5168
|
-
const
|
|
5169
|
-
return { wrapperSchema: k, wrapperUiSchema:
|
|
5171
|
+
const w = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: A = {} } = getBlockFormSchemas(w);
|
|
5172
|
+
return { wrapperSchema: k, wrapperUiSchema: A };
|
|
5170
5173
|
}, [g]);
|
|
5171
5174
|
return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
|
|
5172
5175
|
!isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
|
|
5173
5176
|
/* @__PURE__ */ jsxs(
|
|
5174
5177
|
"div",
|
|
5175
5178
|
{
|
|
5176
|
-
onClick: () => u((
|
|
5179
|
+
onClick: () => u((w) => !w),
|
|
5177
5180
|
className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
|
|
5178
5181
|
children: [
|
|
5179
5182
|
p ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 text-slate-400" }),
|
|
@@ -5212,27 +5215,27 @@ function BlockSettings() {
|
|
|
5212
5215
|
] });
|
|
5213
5216
|
}
|
|
5214
5217
|
const BlockStylingProps = () => {
|
|
5215
|
-
var
|
|
5218
|
+
var x;
|
|
5216
5219
|
const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), a = useRemoveClassesFromBlocks(), [l] = useSelectedBlockIds(), { t: i } = useTranslation();
|
|
5217
5220
|
if (!o) return null;
|
|
5218
5221
|
const c = Object.keys(o).filter(
|
|
5219
|
-
(
|
|
5220
|
-
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (
|
|
5222
|
+
(f) => typeof o[f] == "string" && o[f].startsWith("#styles:")
|
|
5223
|
+
), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (x = n[0]) == null ? void 0 : x.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, m = g ? g.split(" ").filter((f) => !isEmpty(f)) : [], h = (f) => find(n, (y) => y.prop === f);
|
|
5221
5224
|
return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
5222
5225
|
/* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
|
|
5223
5226
|
i("Style element"),
|
|
5224
5227
|
":"
|
|
5225
5228
|
] }),
|
|
5226
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (
|
|
5229
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (f) => /* @__PURE__ */ jsxs(
|
|
5227
5230
|
Badge,
|
|
5228
5231
|
{
|
|
5229
5232
|
className: "flex cursor-pointer items-center gap-1 pr-1",
|
|
5230
|
-
variant: h(
|
|
5233
|
+
variant: h(f) ? "default" : "secondary",
|
|
5231
5234
|
onClick: () => {
|
|
5232
|
-
r([{ id: `${
|
|
5235
|
+
r([{ id: `${f}-${o._id}`, blockId: o._id, prop: f }]);
|
|
5233
5236
|
},
|
|
5234
5237
|
children: [
|
|
5235
|
-
startCase(
|
|
5238
|
+
startCase(f),
|
|
5236
5239
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5237
5240
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
5238
5241
|
"button",
|
|
@@ -5249,7 +5252,7 @@ const BlockStylingProps = () => {
|
|
|
5249
5252
|
{
|
|
5250
5253
|
className: "text-xs",
|
|
5251
5254
|
onClick: () => {
|
|
5252
|
-
d(
|
|
5255
|
+
d(f);
|
|
5253
5256
|
},
|
|
5254
5257
|
children: i("Reset style")
|
|
5255
5258
|
}
|
|
@@ -5268,7 +5271,7 @@ const BlockStylingProps = () => {
|
|
|
5268
5271
|
] })
|
|
5269
5272
|
]
|
|
5270
5273
|
},
|
|
5271
|
-
|
|
5274
|
+
f
|
|
5272
5275
|
)) }),
|
|
5273
5276
|
/* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
|
|
5274
5277
|
] }) });
|
|
@@ -5417,7 +5420,7 @@ const BlockStylingProps = () => {
|
|
|
5417
5420
|
},
|
|
5418
5421
|
a
|
|
5419
5422
|
)) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
|
|
5420
|
-
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [
|
|
5423
|
+
const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [C, B] = useState(!1), [j, _] = useState(!1);
|
|
5421
5424
|
useEffect(() => {
|
|
5422
5425
|
const { value: S, unit: v } = getClassValueAndUnit(i);
|
|
5423
5426
|
if (v === "") {
|
|
@@ -5426,41 +5429,41 @@ const BlockStylingProps = () => {
|
|
|
5426
5429
|
}
|
|
5427
5430
|
h(v), l(v === "class" || isEmpty(S) ? "" : S);
|
|
5428
5431
|
}, [i, p, u]);
|
|
5429
|
-
const
|
|
5432
|
+
const w = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), k = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), A = useCallback(
|
|
5430
5433
|
(S = !1) => {
|
|
5431
5434
|
const v = getUserInputValues(`${a}`, u);
|
|
5432
5435
|
if (get(v, "error", !1)) {
|
|
5433
|
-
|
|
5436
|
+
f(!0);
|
|
5434
5437
|
return;
|
|
5435
5438
|
}
|
|
5436
5439
|
const I = get(v, "unit") !== "" ? get(v, "unit") : m;
|
|
5437
5440
|
if (I === "auto" || I === "none") {
|
|
5438
|
-
|
|
5441
|
+
w(`${d}${I}`);
|
|
5439
5442
|
return;
|
|
5440
5443
|
}
|
|
5441
5444
|
if (get(v, "value") === "")
|
|
5442
5445
|
return;
|
|
5443
5446
|
const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5444
|
-
S ? k(T) :
|
|
5447
|
+
S ? k(T) : w(T);
|
|
5445
5448
|
},
|
|
5446
|
-
[
|
|
5449
|
+
[w, k, a, m, d, u]
|
|
5447
5450
|
), E = useCallback(
|
|
5448
5451
|
(S) => {
|
|
5449
5452
|
const v = getUserInputValues(`${a}`, u);
|
|
5450
5453
|
if (get(v, "error", !1)) {
|
|
5451
|
-
|
|
5454
|
+
f(!0);
|
|
5452
5455
|
return;
|
|
5453
5456
|
}
|
|
5454
5457
|
if (S === "auto" || S === "none") {
|
|
5455
|
-
|
|
5458
|
+
w(`${d}${S}`);
|
|
5456
5459
|
return;
|
|
5457
5460
|
}
|
|
5458
5461
|
if (get(v, "value") === "")
|
|
5459
5462
|
return;
|
|
5460
5463
|
const I = get(v, "unit") !== "" ? get(v, "unit") : S, T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${I === "-" ? "" : I}]`;
|
|
5461
|
-
|
|
5464
|
+
w(T);
|
|
5462
5465
|
},
|
|
5463
|
-
[
|
|
5466
|
+
[w, a, d, u]
|
|
5464
5467
|
);
|
|
5465
5468
|
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5466
5469
|
/* @__PURE__ */ jsx(
|
|
@@ -5482,7 +5485,7 @@ const BlockStylingProps = () => {
|
|
|
5482
5485
|
{
|
|
5483
5486
|
readOnly: m === "class",
|
|
5484
5487
|
onKeyPress: (S) => {
|
|
5485
|
-
S.key === "Enter" &&
|
|
5488
|
+
S.key === "Enter" && A();
|
|
5486
5489
|
},
|
|
5487
5490
|
onKeyDown: (S) => {
|
|
5488
5491
|
if (S.keyCode !== 38 && S.keyCode !== 40)
|
|
@@ -5497,9 +5500,9 @@ const BlockStylingProps = () => {
|
|
|
5497
5500
|
onKeyUp: (S) => {
|
|
5498
5501
|
j && (S.preventDefault(), _(!1));
|
|
5499
5502
|
},
|
|
5500
|
-
onBlur: () =>
|
|
5503
|
+
onBlur: () => A(),
|
|
5501
5504
|
onChange: (S) => {
|
|
5502
|
-
|
|
5505
|
+
f(!1), l(S.target.value);
|
|
5503
5506
|
},
|
|
5504
5507
|
onClick: (S) => {
|
|
5505
5508
|
var v;
|
|
@@ -5508,7 +5511,7 @@ const BlockStylingProps = () => {
|
|
|
5508
5511
|
value: C ? y : a,
|
|
5509
5512
|
className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
|
|
5510
5513
|
" ",
|
|
5511
|
-
|
|
5514
|
+
x ? "border-red-500 text-red-500" : "border-foreground/20"
|
|
5512
5515
|
)
|
|
5513
5516
|
}
|
|
5514
5517
|
),
|
|
@@ -5545,7 +5548,7 @@ const BlockStylingProps = () => {
|
|
|
5545
5548
|
if (b(() => ""), B(!1), isEmpty(S))
|
|
5546
5549
|
return;
|
|
5547
5550
|
const v = `${S}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${m === "-" ? "" : m}]`;
|
|
5548
|
-
|
|
5551
|
+
w(L);
|
|
5549
5552
|
},
|
|
5550
5553
|
onDrag: (S) => {
|
|
5551
5554
|
if (isEmpty(S))
|
|
@@ -5627,7 +5630,7 @@ const COLOR_PROP = {
|
|
|
5627
5630
|
return c([]);
|
|
5628
5631
|
c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
|
|
5629
5632
|
}, [g]);
|
|
5630
|
-
const
|
|
5633
|
+
const x = useCallback(
|
|
5631
5634
|
// eslint-disable-next-line no-shadow
|
|
5632
5635
|
(y) => {
|
|
5633
5636
|
p({ color: g, shade: y });
|
|
@@ -5637,11 +5640,11 @@ const COLOR_PROP = {
|
|
|
5637
5640
|
useEffect(() => {
|
|
5638
5641
|
p({ color: "", shade: "" });
|
|
5639
5642
|
}, [r]);
|
|
5640
|
-
const { match:
|
|
5643
|
+
const { match: f } = useTailwindClassList();
|
|
5641
5644
|
return useEffect(() => {
|
|
5642
5645
|
const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
|
|
5643
|
-
|
|
5644
|
-
}, [
|
|
5646
|
+
f(o, b) && n(b, o);
|
|
5647
|
+
}, [f, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
|
|
5645
5648
|
/* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
|
|
5646
5649
|
DropDown,
|
|
5647
5650
|
{
|
|
@@ -5681,7 +5684,7 @@ const COLOR_PROP = {
|
|
|
5681
5684
|
]
|
|
5682
5685
|
}
|
|
5683
5686
|
) }),
|
|
5684
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange:
|
|
5687
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: x, options: i }) })
|
|
5685
5688
|
] });
|
|
5686
5689
|
}, EDITOR_ICONS = {
|
|
5687
5690
|
"not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
|
|
@@ -6015,17 +6018,17 @@ const COLOR_PROP = {
|
|
|
6015
6018
|
"2xl": "1536px"
|
|
6016
6019
|
}, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
|
|
6017
6020
|
const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
|
|
6018
|
-
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(),
|
|
6019
|
-
(k,
|
|
6021
|
+
}, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
|
|
6022
|
+
(k, A = !0) => {
|
|
6020
6023
|
const E = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
|
|
6021
6024
|
(p || u !== "") && (E.mq = "xs");
|
|
6022
6025
|
const S = generateFullClsName(E);
|
|
6023
|
-
h(
|
|
6026
|
+
h(f, [S], A);
|
|
6024
6027
|
},
|
|
6025
|
-
[
|
|
6028
|
+
[f, p, g, u, l, h]
|
|
6026
6029
|
), C = useCallback(() => {
|
|
6027
|
-
f
|
|
6028
|
-
}, [
|
|
6030
|
+
x(f, [y], !0);
|
|
6031
|
+
}, [f, y, x]), B = useMemo(() => canChangeClass(m, g), [m, g]);
|
|
6029
6032
|
useEffect(() => {
|
|
6030
6033
|
i(B, m);
|
|
6031
6034
|
}, [B, i, m]);
|
|
@@ -6041,9 +6044,9 @@ const COLOR_PROP = {
|
|
|
6041
6044
|
}[k]);
|
|
6042
6045
|
},
|
|
6043
6046
|
[j]
|
|
6044
|
-
),
|
|
6045
|
-
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m &&
|
|
6046
|
-
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !
|
|
6047
|
+
), w = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
|
|
6048
|
+
return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
|
|
6049
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !w ? "text-foreground" : ""}`, children: n(a) }) }),
|
|
6047
6050
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
|
|
6048
6051
|
/* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
|
|
6049
6052
|
r === "arbitrary" ? /* @__PURE__ */ jsx(
|
|
@@ -6062,7 +6065,7 @@ const COLOR_PROP = {
|
|
|
6062
6065
|
r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
|
|
6063
6066
|
r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
|
|
6064
6067
|
] }),
|
|
6065
|
-
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children:
|
|
6068
|
+
/* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => C(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
|
|
6066
6069
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
6067
6070
|
"button",
|
|
6068
6071
|
{
|
|
@@ -6111,23 +6114,23 @@ const COLOR_PROP = {
|
|
|
6111
6114
|
children: [
|
|
6112
6115
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
|
|
6113
6116
|
o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
|
|
6114
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key:
|
|
6117
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6115
6118
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6116
6119
|
"button",
|
|
6117
6120
|
{
|
|
6118
6121
|
type: "button",
|
|
6119
|
-
onClick: () => u(
|
|
6120
|
-
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${
|
|
6122
|
+
onClick: () => u(x),
|
|
6123
|
+
className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
|
|
6121
6124
|
children: [
|
|
6122
6125
|
React__default.createElement("div", {
|
|
6123
|
-
className: m(
|
|
6126
|
+
className: m(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
|
|
6124
6127
|
}),
|
|
6125
|
-
React__default.createElement(get(EDITOR_ICONS,
|
|
6128
|
+
React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
|
|
6126
6129
|
]
|
|
6127
6130
|
}
|
|
6128
6131
|
) }),
|
|
6129
6132
|
/* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
|
|
6130
|
-
] }) }, `option-${
|
|
6133
|
+
] }) }, `option-${f}`)) })
|
|
6131
6134
|
] }),
|
|
6132
6135
|
/* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
|
|
6133
6136
|
BlockStyle,
|
|
@@ -6282,9 +6285,9 @@ const COLOR_PROP = {
|
|
|
6282
6285
|
canvas: n = !1,
|
|
6283
6286
|
tooltip: r = !0
|
|
6284
6287
|
}) => {
|
|
6285
|
-
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS),
|
|
6288
|
+
const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
|
|
6286
6289
|
u.includes(b) ? u.length > 2 && g(u.filter((C) => C !== b)) : g((C) => [...C, b]);
|
|
6287
|
-
},
|
|
6290
|
+
}, f = (b) => {
|
|
6288
6291
|
n || l(b), c(b);
|
|
6289
6292
|
}, y = getBreakpointValue(n ? i : a).toLowerCase();
|
|
6290
6293
|
return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (b) => /* @__PURE__ */ createElement(
|
|
@@ -6292,7 +6295,7 @@ const COLOR_PROP = {
|
|
|
6292
6295
|
{
|
|
6293
6296
|
canvas: n,
|
|
6294
6297
|
...b,
|
|
6295
|
-
onClick:
|
|
6298
|
+
onClick: f,
|
|
6296
6299
|
key: b.breakpoint,
|
|
6297
6300
|
currentBreakpoint: y
|
|
6298
6301
|
}
|
|
@@ -6306,7 +6309,7 @@ const COLOR_PROP = {
|
|
|
6306
6309
|
openDelay: o,
|
|
6307
6310
|
tooltip: r,
|
|
6308
6311
|
...b,
|
|
6309
|
-
onClick:
|
|
6312
|
+
onClick: f,
|
|
6310
6313
|
key: b.breakpoint,
|
|
6311
6314
|
currentBreakpoint: y
|
|
6312
6315
|
}
|
|
@@ -6321,7 +6324,7 @@ const COLOR_PROP = {
|
|
|
6321
6324
|
DropdownMenuCheckboxItem,
|
|
6322
6325
|
{
|
|
6323
6326
|
disabled: b.breakpoint === "xs",
|
|
6324
|
-
onCheckedChange: () =>
|
|
6327
|
+
onCheckedChange: () => x(toUpper(b.breakpoint)),
|
|
6325
6328
|
checked: includes(u, toUpper(b.breakpoint)),
|
|
6326
6329
|
children: m(b.title)
|
|
6327
6330
|
},
|
|
@@ -6406,8 +6409,8 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6406
6409
|
(h = d.current) == null || h.focus();
|
|
6407
6410
|
}, []);
|
|
6408
6411
|
const m = (h) => {
|
|
6409
|
-
const { usage:
|
|
6410
|
-
!l &&
|
|
6412
|
+
const { usage: x } = h || {};
|
|
6413
|
+
!l && x && g(x), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
|
|
6411
6414
|
};
|
|
6412
6415
|
return /* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
6413
6416
|
/* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
|
|
@@ -6463,10 +6466,10 @@ const AskAIStyles = ({ blockId: o }) => {
|
|
|
6463
6466
|
};
|
|
6464
6467
|
function ManualClasses() {
|
|
6465
6468
|
var L;
|
|
6466
|
-
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [
|
|
6467
|
-
const T =
|
|
6468
|
-
u(m, T, !0),
|
|
6469
|
-
}, [j, _] = useState([]),
|
|
6469
|
+
const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), C = b.split(" ").filter((T) => !isEmpty(T)), B = () => {
|
|
6470
|
+
const T = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
6471
|
+
u(m, T, !0), f("");
|
|
6472
|
+
}, [j, _] = useState([]), w = ({ value: T }) => {
|
|
6470
6473
|
const P = T.trim().toLowerCase(), R = P.match(/.+:/g);
|
|
6471
6474
|
let N = [];
|
|
6472
6475
|
if (R && R.length > 0) {
|
|
@@ -6480,7 +6483,7 @@ function ManualClasses() {
|
|
|
6480
6483
|
return _(map(N, "item"));
|
|
6481
6484
|
}, k = () => {
|
|
6482
6485
|
_([]);
|
|
6483
|
-
},
|
|
6486
|
+
}, A = (T) => T.name, E = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), S = useMemo(
|
|
6484
6487
|
() => ({
|
|
6485
6488
|
ref: o,
|
|
6486
6489
|
autoComplete: "off",
|
|
@@ -6488,19 +6491,19 @@ function ManualClasses() {
|
|
|
6488
6491
|
autoCapitalize: "off",
|
|
6489
6492
|
spellCheck: !1,
|
|
6490
6493
|
placeholder: c("Enter classes separated by space"),
|
|
6491
|
-
value:
|
|
6494
|
+
value: x,
|
|
6492
6495
|
onFocus: (T) => {
|
|
6493
6496
|
setTimeout(() => {
|
|
6494
6497
|
T.target && T.target.select();
|
|
6495
6498
|
}, 0);
|
|
6496
6499
|
},
|
|
6497
6500
|
onKeyDown: (T) => {
|
|
6498
|
-
T.key === "Enter" &&
|
|
6501
|
+
T.key === "Enter" && x.trim() !== "" && B();
|
|
6499
6502
|
},
|
|
6500
|
-
onChange: (T, { newValue: P }) =>
|
|
6503
|
+
onChange: (T, { newValue: P }) => f(P),
|
|
6501
6504
|
className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
|
|
6502
6505
|
}),
|
|
6503
|
-
[
|
|
6506
|
+
[x, c, o]
|
|
6504
6507
|
), v = (T) => {
|
|
6505
6508
|
debugger;
|
|
6506
6509
|
const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
|
|
@@ -6534,9 +6537,9 @@ function ManualClasses() {
|
|
|
6534
6537
|
Autosuggest,
|
|
6535
6538
|
{
|
|
6536
6539
|
suggestions: j,
|
|
6537
|
-
onSuggestionsFetchRequested:
|
|
6540
|
+
onSuggestionsFetchRequested: w,
|
|
6538
6541
|
onSuggestionsClearRequested: k,
|
|
6539
|
-
getSuggestionValue:
|
|
6542
|
+
getSuggestionValue: A,
|
|
6540
6543
|
renderSuggestion: E,
|
|
6541
6544
|
inputProps: S,
|
|
6542
6545
|
containerProps: {
|
|
@@ -6555,7 +6558,7 @@ function ManualClasses() {
|
|
|
6555
6558
|
variant: "outline",
|
|
6556
6559
|
className: "h-6 border-border",
|
|
6557
6560
|
onClick: B,
|
|
6558
|
-
disabled:
|
|
6561
|
+
disabled: x.trim() === "",
|
|
6559
6562
|
size: "sm",
|
|
6560
6563
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
6561
6564
|
}
|
|
@@ -6586,7 +6589,7 @@ function ManualClasses() {
|
|
|
6586
6589
|
"button",
|
|
6587
6590
|
{
|
|
6588
6591
|
onDoubleClick: () => {
|
|
6589
|
-
|
|
6592
|
+
f(T), g(m, [T]), setTimeout(() => {
|
|
6590
6593
|
o.current && o.current.focus();
|
|
6591
6594
|
}, 10);
|
|
6592
6595
|
},
|
|
@@ -6742,9 +6745,9 @@ function BlockStyling() {
|
|
|
6742
6745
|
const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
|
|
6743
6746
|
let h = parseFloat(i.dragStartValue);
|
|
6744
6747
|
h = isNaN(h) ? 0 : h;
|
|
6745
|
-
let
|
|
6746
|
-
(startsWith(m, "scale") || m === "opacity") && (
|
|
6747
|
-
let y = (i.dragStartY - u.pageY) /
|
|
6748
|
+
let x = MAPPER[i.dragUnit];
|
|
6749
|
+
(startsWith(m, "scale") || m === "opacity") && (x = 10);
|
|
6750
|
+
let y = (i.dragStartY - u.pageY) / x + h;
|
|
6748
6751
|
g && y < 0 && (y = 0), m === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
|
|
6749
6752
|
},
|
|
6750
6753
|
[i],
|
|
@@ -6793,7 +6796,7 @@ const CoreBlock = ({
|
|
|
6793
6796
|
} else
|
|
6794
6797
|
p(o, r || null, a);
|
|
6795
6798
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6796
|
-
},
|
|
6799
|
+
}, x = useFeature("dnd"), { t: f } = useTranslation();
|
|
6797
6800
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
6798
6801
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
6799
6802
|
"button",
|
|
@@ -6806,15 +6809,15 @@ const CoreBlock = ({
|
|
|
6806
6809
|
g([]), m();
|
|
6807
6810
|
}, 200);
|
|
6808
6811
|
},
|
|
6809
|
-
draggable:
|
|
6812
|
+
draggable: x ? "true" : "false",
|
|
6810
6813
|
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
|
|
6811
6814
|
children: [
|
|
6812
6815
|
createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
|
|
6813
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(
|
|
6816
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(f(d || i)) })
|
|
6814
6817
|
]
|
|
6815
6818
|
}
|
|
6816
6819
|
) }),
|
|
6817
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children:
|
|
6820
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: f(d || i) }) })
|
|
6818
6821
|
] }) });
|
|
6819
6822
|
}, DefaultChaiBlocks = ({
|
|
6820
6823
|
parentId: o,
|
|
@@ -6833,13 +6836,14 @@ const CoreBlock = ({
|
|
|
6833
6836
|
}
|
|
6834
6837
|
);
|
|
6835
6838
|
};
|
|
6836
|
-
let PRE_IMPORT_HTML_HOOK = (o) => o;
|
|
6839
|
+
let PRE_IMPORT_HTML_HOOK = async (o) => o;
|
|
6837
6840
|
const registerChaiPreImportHTMLHook = (o) => {
|
|
6838
6841
|
PRE_IMPORT_HTML_HOOK = o;
|
|
6839
|
-
}, getPreImportHTML = (o) => PRE_IMPORT_HTML_HOOK(o), ImportHTML = ({ parentId: o, position: n }) => {
|
|
6840
|
-
const { t: r } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), c = () => {
|
|
6841
|
-
|
|
6842
|
-
|
|
6842
|
+
}, getPreImportHTML = async (o) => await PRE_IMPORT_HTML_HOOK(o), ImportHTML = ({ parentId: o, position: n }) => {
|
|
6843
|
+
const { t: r } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), [c, d] = useState(!1), p = async () => {
|
|
6844
|
+
d(!0);
|
|
6845
|
+
const u = await getPreImportHTML(a), g = getBlocksFromHTML(u);
|
|
6846
|
+
i([...g], o, n), l(""), d(!1), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6843
6847
|
};
|
|
6844
6848
|
return /* @__PURE__ */ jsxs(Card, { className: "border-border/0 p-0 shadow-none", children: [
|
|
6845
6849
|
/* @__PURE__ */ jsx(CardHeader, { className: "p-3", children: /* @__PURE__ */ jsx(CardDescription, { children: r("Use HTML snippets from Tailwind CSS component libraries") }) }),
|
|
@@ -6850,8 +6854,8 @@ const registerChaiPreImportHTMLHook = (o) => {
|
|
|
6850
6854
|
{
|
|
6851
6855
|
autoFocus: !0,
|
|
6852
6856
|
tabIndex: 1,
|
|
6853
|
-
ref: (
|
|
6854
|
-
onChange: (
|
|
6857
|
+
ref: (u) => u && u.focus(),
|
|
6858
|
+
onChange: (u) => l(u.target.value),
|
|
6855
6859
|
rows: 12,
|
|
6856
6860
|
value: a,
|
|
6857
6861
|
placeholder: r("Enter your code snippet here"),
|
|
@@ -6859,7 +6863,11 @@ const registerChaiPreImportHTMLHook = (o) => {
|
|
|
6859
6863
|
}
|
|
6860
6864
|
)
|
|
6861
6865
|
] }) }),
|
|
6862
|
-
/* @__PURE__ */ jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsx(Button, { disabled: a.trim() === "", onClick: () =>
|
|
6866
|
+
/* @__PURE__ */ jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsx(Button, { disabled: a.trim() === "" || c, onClick: () => p(), size: "sm", className: "w-fit", children: c ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6867
|
+
/* @__PURE__ */ jsx(CircleIcon, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
6868
|
+
" ",
|
|
6869
|
+
r("Importing...")
|
|
6870
|
+
] }) : r("Import HTML") }) })
|
|
6863
6871
|
] });
|
|
6864
6872
|
}, ChaiSelect = ({
|
|
6865
6873
|
defaultValue: o = "",
|
|
@@ -6920,7 +6928,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6920
6928
|
parentId: r = void 0,
|
|
6921
6929
|
position: a = -1
|
|
6922
6930
|
}) => {
|
|
6923
|
-
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""),
|
|
6931
|
+
const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (B) => {
|
|
6924
6932
|
const j = has(B, "styles_attrs.data-page-section");
|
|
6925
6933
|
return B._type === "Box" && j;
|
|
6926
6934
|
}, b = useCallback(
|
|
@@ -6941,20 +6949,20 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6941
6949
|
{
|
|
6942
6950
|
onClick: l ? () => {
|
|
6943
6951
|
} : b,
|
|
6944
|
-
draggable:
|
|
6952
|
+
draggable: x ? "true" : "false",
|
|
6945
6953
|
onDragStart: async (B) => {
|
|
6946
6954
|
const j = await c({ library: n, block: o });
|
|
6947
6955
|
let _ = r;
|
|
6948
6956
|
if (y(first(j)) && (_ = null), !isEmpty(j)) {
|
|
6949
|
-
const
|
|
6950
|
-
if (B.dataTransfer.setData("text/plain", JSON.stringify(
|
|
6957
|
+
const w = { blocks: j, uiLibrary: !0, parent: _ };
|
|
6958
|
+
if (B.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
|
|
6951
6959
|
const k = new Image();
|
|
6952
6960
|
k.src = o.preview, k.onload = () => {
|
|
6953
6961
|
B.dataTransfer.setDragImage(k, 0, 0);
|
|
6954
6962
|
};
|
|
6955
6963
|
} else
|
|
6956
6964
|
B.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
6957
|
-
|
|
6965
|
+
f(w), setTimeout(() => {
|
|
6958
6966
|
u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
6959
6967
|
}, 200);
|
|
6960
6968
|
}
|
|
@@ -6980,22 +6988,22 @@ const registerChaiLibrary = (o, n) => {
|
|
|
6980
6988
|
] }) })
|
|
6981
6989
|
] });
|
|
6982
6990
|
}, UILibrarySection = ({ parentId: o, position: n }) => {
|
|
6983
|
-
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((v) => v.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]),
|
|
6991
|
+
const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((v) => v.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), x = useRef(null);
|
|
6984
6992
|
useEffect(() => {
|
|
6985
|
-
c && c.length > 0 && (
|
|
6993
|
+
c && c.length > 0 && (x.current = new Fuse(c, {
|
|
6986
6994
|
keys: ["name", "label", "description", "group"],
|
|
6987
6995
|
threshold: 0.4,
|
|
6988
6996
|
ignoreLocation: !0
|
|
6989
6997
|
}));
|
|
6990
6998
|
}, [c]), useEffect(() => {
|
|
6991
|
-
if (!u.trim() || !
|
|
6999
|
+
if (!u.trim() || !x.current) {
|
|
6992
7000
|
h([]);
|
|
6993
7001
|
return;
|
|
6994
7002
|
}
|
|
6995
|
-
const v =
|
|
7003
|
+
const v = x.current.search(u).map((I) => I.item);
|
|
6996
7004
|
h(v);
|
|
6997
7005
|
}, [u]);
|
|
6998
|
-
const
|
|
7006
|
+
const f = u.trim() && !isEmpty(m) ? m : c, y = groupBy(f, "group"), [b, C] = useState(null);
|
|
6999
7007
|
useEffect(() => {
|
|
7000
7008
|
if (isEmpty(keys(y))) {
|
|
7001
7009
|
C(null);
|
|
@@ -7006,13 +7014,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7006
7014
|
return;
|
|
7007
7015
|
}
|
|
7008
7016
|
}, [y, b]);
|
|
7009
|
-
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(),
|
|
7017
|
+
const B = get(y, b, []), j = useRef(null), { t: _ } = useTranslation(), w = (v) => {
|
|
7010
7018
|
j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
|
|
7011
7019
|
j.current && C(v);
|
|
7012
7020
|
}, 400);
|
|
7013
7021
|
}, k = () => {
|
|
7014
7022
|
i != null && i.id && p(i.id);
|
|
7015
|
-
},
|
|
7023
|
+
}, A = () => {
|
|
7016
7024
|
g("");
|
|
7017
7025
|
};
|
|
7018
7026
|
if (d)
|
|
@@ -7036,7 +7044,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7036
7044
|
u && /* @__PURE__ */ jsx(
|
|
7037
7045
|
"button",
|
|
7038
7046
|
{
|
|
7039
|
-
onClick:
|
|
7047
|
+
onClick: A,
|
|
7040
7048
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
7041
7049
|
children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" })
|
|
7042
7050
|
}
|
|
@@ -7057,7 +7065,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7057
7065
|
] }) }) : map(y, (v, I) => /* @__PURE__ */ jsxs(
|
|
7058
7066
|
"div",
|
|
7059
7067
|
{
|
|
7060
|
-
onMouseEnter: () =>
|
|
7068
|
+
onMouseEnter: () => w(I),
|
|
7061
7069
|
onMouseLeave: () => clearTimeout(j.current),
|
|
7062
7070
|
role: "button",
|
|
7063
7071
|
onClick: () => C(I),
|
|
@@ -7135,25 +7143,25 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7135
7143
|
error: c
|
|
7136
7144
|
}), g(!0);
|
|
7137
7145
|
else if (!l && Object.keys(a || {}).length > 0) {
|
|
7138
|
-
const h = Object.entries(a).map(([
|
|
7146
|
+
const h = Object.entries(a).map(([f, y]) => {
|
|
7139
7147
|
const b = y, C = b.type || "partial", B = formatReadableName(C);
|
|
7140
7148
|
return {
|
|
7141
7149
|
type: "PartialBlock",
|
|
7142
7150
|
// Set the type to PartialBlock
|
|
7143
|
-
label: formatReadableName(b.name ||
|
|
7151
|
+
label: formatReadableName(b.name || f),
|
|
7144
7152
|
description: b.description || "",
|
|
7145
7153
|
icon: FrameIcon,
|
|
7146
7154
|
group: B,
|
|
7147
7155
|
// Use formatted type as group
|
|
7148
7156
|
category: "partial",
|
|
7149
|
-
partialBlockId:
|
|
7157
|
+
partialBlockId: f,
|
|
7150
7158
|
// Store the original ID as partialBlockId
|
|
7151
7159
|
_name: b.name
|
|
7152
7160
|
};
|
|
7153
|
-
}),
|
|
7161
|
+
}), x = uniq(map(h, "group"));
|
|
7154
7162
|
p({
|
|
7155
7163
|
blocks: h,
|
|
7156
|
-
groups:
|
|
7164
|
+
groups: x,
|
|
7157
7165
|
isLoading: !1,
|
|
7158
7166
|
error: null
|
|
7159
7167
|
}), g(!0);
|
|
@@ -7199,7 +7207,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7199
7207
|
has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
|
|
7200
7208
|
}, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
|
|
7201
7209
|
var S;
|
|
7202
|
-
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (v) => v._id === r)) == null ? void 0 : S._type, [h,
|
|
7210
|
+
const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (v) => v._id === r)) == null ? void 0 : S._type, [h, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
|
|
7203
7211
|
useEffect(() => {
|
|
7204
7212
|
const v = setTimeout(() => {
|
|
7205
7213
|
var I;
|
|
@@ -7207,9 +7215,9 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7207
7215
|
}, 0);
|
|
7208
7216
|
return () => clearTimeout(v);
|
|
7209
7217
|
}, [g]), useEffect(() => {
|
|
7210
|
-
d && (
|
|
7218
|
+
d && (x("all"), y(null));
|
|
7211
7219
|
}, [d]), useEffect(() => (b.current = debounce((v) => {
|
|
7212
|
-
|
|
7220
|
+
x(v);
|
|
7213
7221
|
}, 500), () => {
|
|
7214
7222
|
b.current && b.current.cancel();
|
|
7215
7223
|
}), []);
|
|
@@ -7218,7 +7226,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7218
7226
|
}, []), B = useCallback(() => {
|
|
7219
7227
|
y(null), b.current && b.current.cancel();
|
|
7220
7228
|
}, []), j = useCallback((v) => {
|
|
7221
|
-
b.current && b.current.cancel(),
|
|
7229
|
+
b.current && b.current.cancel(), x(v), y(null);
|
|
7222
7230
|
}, []), _ = useMemo(
|
|
7223
7231
|
() => d ? values(n).filter(
|
|
7224
7232
|
(v) => {
|
|
@@ -7227,15 +7235,15 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7227
7235
|
}
|
|
7228
7236
|
) : n,
|
|
7229
7237
|
[n, d]
|
|
7230
|
-
),
|
|
7238
|
+
), w = useMemo(
|
|
7231
7239
|
() => d ? o.filter(
|
|
7232
7240
|
(v) => reject(filter(values(_), { group: v }), { hidden: !0 }).length > 0
|
|
7233
7241
|
) : o.filter((v) => reject(filter(values(n), { group: v }), { hidden: !0 }).length > 0),
|
|
7234
7242
|
[n, _, o, d]
|
|
7235
7243
|
), k = useMemo(
|
|
7236
|
-
() => sortBy(
|
|
7237
|
-
[
|
|
7238
|
-
),
|
|
7244
|
+
() => sortBy(w, (v) => CORE_GROUPS.indexOf(v) === -1 ? 99 : CORE_GROUPS.indexOf(v)),
|
|
7245
|
+
[w]
|
|
7246
|
+
), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), E = useMemo(() => h === "all" ? k : [h], [k, h]);
|
|
7239
7247
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
|
|
7240
7248
|
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
|
|
7241
7249
|
Input$1,
|
|
@@ -7256,7 +7264,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7256
7264
|
onClick: () => j("all"),
|
|
7257
7265
|
onMouseEnter: () => C("all"),
|
|
7258
7266
|
onMouseLeave: B,
|
|
7259
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" ||
|
|
7267
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7260
7268
|
children: i("All")
|
|
7261
7269
|
},
|
|
7262
7270
|
"sidebar-all"
|
|
@@ -7267,13 +7275,13 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7267
7275
|
onClick: () => j(v),
|
|
7268
7276
|
onMouseEnter: () => C(v),
|
|
7269
7277
|
onMouseLeave: B,
|
|
7270
|
-
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === v ||
|
|
7278
|
+
className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === v || f === v ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
|
|
7271
7279
|
children: capitalize(i(v.toLowerCase()))
|
|
7272
7280
|
},
|
|
7273
7281
|
`sidebar-${v}`
|
|
7274
7282
|
))
|
|
7275
7283
|
] }) }) }),
|
|
7276
|
-
/* @__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:
|
|
7284
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: w.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
|
|
7277
7285
|
i("No blocks found matching"),
|
|
7278
7286
|
' "',
|
|
7279
7287
|
d,
|
|
@@ -7281,7 +7289,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7281
7289
|
] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((v) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7282
7290
|
/* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(v.toLowerCase())) }),
|
|
7283
7291
|
/* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
|
|
7284
|
-
h === "all" ? filter(values(
|
|
7292
|
+
h === "all" ? filter(values(A), { group: v }) : values(A),
|
|
7285
7293
|
{ hidden: !0 }
|
|
7286
7294
|
).map((I) => /* @__PURE__ */ jsx(
|
|
7287
7295
|
CoreBlock,
|
|
@@ -7308,7 +7316,7 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7308
7316
|
}, [i, g, c]);
|
|
7309
7317
|
const h = useCallback(() => {
|
|
7310
7318
|
pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
|
|
7311
|
-
}, []),
|
|
7319
|
+
}, []), x = useChaiAddBlockTabs(), f = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
|
|
7312
7320
|
return useEffect(() => {
|
|
7313
7321
|
i === "library" && !b && c("core");
|
|
7314
7322
|
}, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
|
|
@@ -7329,14 +7337,14 @@ const registerChaiLibrary = (o, n) => {
|
|
|
7329
7337
|
b && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
|
|
7330
7338
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
|
|
7331
7339
|
g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
|
|
7332
|
-
|
|
7333
|
-
map(
|
|
7340
|
+
f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
|
|
7341
|
+
map(x, (C) => /* @__PURE__ */ jsx(TabsTrigger, { value: C.id, children: React__default.createElement(C.tab) }, `tab-add-block-${C.id}`))
|
|
7334
7342
|
] }),
|
|
7335
7343
|
/* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7336
7344
|
b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
|
|
7337
7345
|
g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
|
|
7338
|
-
|
|
7339
|
-
map(
|
|
7346
|
+
f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
|
|
7347
|
+
map(x, (C) => /* @__PURE__ */ jsx(TabsContent, { value: C.id, children: React__default.createElement(C.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${C.id}`))
|
|
7340
7348
|
]
|
|
7341
7349
|
}
|
|
7342
7350
|
)
|
|
@@ -7646,26 +7654,26 @@ const Input = ({ node: o }) => {
|
|
|
7646
7654
|
var R;
|
|
7647
7655
|
const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
|
|
7648
7656
|
let d = null;
|
|
7649
|
-
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected:
|
|
7657
|
+
const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: y, isEditing: b, handleClick: C } = o, B = get(h, "_show", !0), j = (N) => {
|
|
7650
7658
|
N.stopPropagation(), B && o.toggle();
|
|
7651
7659
|
}, _ = (N) => {
|
|
7652
7660
|
N.isInternal && (d = N.isOpen, N.isOpen && N.close());
|
|
7653
|
-
},
|
|
7661
|
+
}, w = (N) => {
|
|
7654
7662
|
N.isInternal && d !== null && (d ? N.open() : N.close(), d = null);
|
|
7655
|
-
}, [k,
|
|
7663
|
+
}, [k, A] = useAtom$1(currentAddSelection), E = () => {
|
|
7656
7664
|
var N;
|
|
7657
|
-
S(), o.parent.isSelected ||
|
|
7665
|
+
S(), o.parent.isSelected || A((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
|
|
7658
7666
|
}, S = () => {
|
|
7659
|
-
|
|
7667
|
+
A(null);
|
|
7660
7668
|
}, v = (N) => {
|
|
7661
7669
|
S(), N.stopPropagation(), !o.isOpen && B && o.toggle(), C(N);
|
|
7662
7670
|
};
|
|
7663
7671
|
useEffect(() => {
|
|
7664
7672
|
const N = setTimeout(() => {
|
|
7665
|
-
|
|
7673
|
+
f && !o.isOpen && !y && B && o.toggle();
|
|
7666
7674
|
}, 500);
|
|
7667
7675
|
return () => clearTimeout(N);
|
|
7668
|
-
}, [
|
|
7676
|
+
}, [f, o, y]);
|
|
7669
7677
|
const I = (N, D) => {
|
|
7670
7678
|
const F = i.contentDocument || i.contentWindow.document, O = F.querySelector(`[data-block-id=${N}]`);
|
|
7671
7679
|
O && O.setAttribute("data-drop", D);
|
|
@@ -7705,7 +7713,7 @@ const Input = ({ node: o }) => {
|
|
|
7705
7713
|
"data-node-id": m,
|
|
7706
7714
|
ref: r,
|
|
7707
7715
|
onDragStart: () => _(o),
|
|
7708
|
-
onDragEnd: () =>
|
|
7716
|
+
onDragEnd: () => w(o),
|
|
7709
7717
|
onDragOver: (N) => {
|
|
7710
7718
|
N.preventDefault(), I(m, "yes");
|
|
7711
7719
|
},
|
|
@@ -7733,12 +7741,12 @@ const Input = ({ node: o }) => {
|
|
|
7733
7741
|
{
|
|
7734
7742
|
className: cn(
|
|
7735
7743
|
"group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
|
|
7736
|
-
|
|
7737
|
-
|
|
7744
|
+
x ? "bg-primary/20" : "hover:bg-primary/10",
|
|
7745
|
+
f && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
|
|
7738
7746
|
(o == null ? void 0 : o.id) === k ? "bg-primary/10" : "",
|
|
7739
7747
|
y && "opacity-20",
|
|
7740
7748
|
B ? "" : "line-through opacity-50",
|
|
7741
|
-
T &&
|
|
7749
|
+
T && x && "bg-primary/20 text-primary"
|
|
7742
7750
|
),
|
|
7743
7751
|
children: [
|
|
7744
7752
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -7755,9 +7763,9 @@ const Input = ({ node: o }) => {
|
|
|
7755
7763
|
className: cn(
|
|
7756
7764
|
"leading-1 flex items-center",
|
|
7757
7765
|
T && "text-orange-600/90",
|
|
7758
|
-
T &&
|
|
7766
|
+
T && x && "text-orange-800",
|
|
7759
7767
|
P && "text-purple-600/90",
|
|
7760
|
-
P &&
|
|
7768
|
+
P && x && "text-purple-800"
|
|
7761
7769
|
),
|
|
7762
7770
|
children: [
|
|
7763
7771
|
/* @__PURE__ */ jsx(TypeIcon, { type: h == null ? void 0 : h._type }),
|
|
@@ -8220,16 +8228,16 @@ const Input = ({ node: o }) => {
|
|
|
8220
8228
|
}, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
|
|
8221
8229
|
const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
|
|
8222
8230
|
if (d) {
|
|
8223
|
-
const
|
|
8231
|
+
const w = d.map((k) => Object.keys(k)[0]);
|
|
8224
8232
|
DEFAULT_THEME_PRESET.forEach((k) => {
|
|
8225
|
-
const
|
|
8226
|
-
|
|
8233
|
+
const A = Object.keys(k)[0];
|
|
8234
|
+
w.includes(A) || d.push(k);
|
|
8227
8235
|
});
|
|
8228
8236
|
}
|
|
8229
|
-
const [g, m] = useTheme(), h = useThemeOptions(), { t:
|
|
8230
|
-
(
|
|
8237
|
+
const [g, m] = useTheme(), h = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
|
|
8238
|
+
(w) => {
|
|
8231
8239
|
const k = { ...g };
|
|
8232
|
-
setPreviousTheme(k), m(
|
|
8240
|
+
setPreviousTheme(k), m(w), toast.success("Theme updated", {
|
|
8233
8241
|
action: {
|
|
8234
8242
|
label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8235
8243
|
/* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
|
|
@@ -8245,56 +8253,56 @@ const Input = ({ node: o }) => {
|
|
|
8245
8253
|
},
|
|
8246
8254
|
[g, m]
|
|
8247
8255
|
), y = () => {
|
|
8248
|
-
const
|
|
8249
|
-
if (
|
|
8250
|
-
const k = Object.values(
|
|
8251
|
-
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (
|
|
8256
|
+
const w = d.find((k) => Object.keys(k)[0] === a);
|
|
8257
|
+
if (w) {
|
|
8258
|
+
const k = Object.values(w)[0];
|
|
8259
|
+
k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (f(k), l("")) : console.error("Invalid preset structure:", k);
|
|
8252
8260
|
} else
|
|
8253
8261
|
console.error("Preset not found:", a);
|
|
8254
|
-
}, b = (
|
|
8255
|
-
|
|
8262
|
+
}, b = (w) => {
|
|
8263
|
+
f(w), l("");
|
|
8256
8264
|
}, C = useDebouncedCallback(
|
|
8257
|
-
(
|
|
8265
|
+
(w, k) => {
|
|
8258
8266
|
m(() => ({
|
|
8259
8267
|
...g,
|
|
8260
8268
|
fontFamily: {
|
|
8261
8269
|
...g.fontFamily,
|
|
8262
|
-
[
|
|
8270
|
+
[w.replace(/font-/g, "")]: k
|
|
8263
8271
|
}
|
|
8264
8272
|
}));
|
|
8265
8273
|
},
|
|
8266
8274
|
[g],
|
|
8267
8275
|
200
|
|
8268
8276
|
), B = React.useCallback(
|
|
8269
|
-
(
|
|
8277
|
+
(w) => {
|
|
8270
8278
|
m(() => ({
|
|
8271
8279
|
...g,
|
|
8272
|
-
borderRadius: `${
|
|
8280
|
+
borderRadius: `${w}px`
|
|
8273
8281
|
}));
|
|
8274
8282
|
},
|
|
8275
8283
|
[g]
|
|
8276
8284
|
), j = useDebouncedCallback(
|
|
8277
|
-
(
|
|
8285
|
+
(w, k) => {
|
|
8278
8286
|
m(() => {
|
|
8279
|
-
const
|
|
8280
|
-
return n ? set(
|
|
8287
|
+
const A = get(g, `colors.${w}`);
|
|
8288
|
+
return n ? set(A, 1, k) : set(A, 0, k), {
|
|
8281
8289
|
...g,
|
|
8282
8290
|
colors: {
|
|
8283
8291
|
...g.colors,
|
|
8284
|
-
[
|
|
8292
|
+
[w]: A
|
|
8285
8293
|
}
|
|
8286
8294
|
};
|
|
8287
8295
|
});
|
|
8288
8296
|
},
|
|
8289
8297
|
[g],
|
|
8290
8298
|
200
|
|
8291
|
-
), _ = (
|
|
8292
|
-
const
|
|
8293
|
-
return
|
|
8299
|
+
), _ = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([k]) => {
|
|
8300
|
+
const A = get(g, `colors.${k}.${n ? 1 : 0}`);
|
|
8301
|
+
return A ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
|
|
8294
8302
|
/* @__PURE__ */ jsx(
|
|
8295
8303
|
ColorPickerInput,
|
|
8296
8304
|
{
|
|
8297
|
-
value:
|
|
8305
|
+
value: A,
|
|
8298
8306
|
onChange: (E) => j(k, E)
|
|
8299
8307
|
}
|
|
8300
8308
|
),
|
|
@@ -8305,21 +8313,21 @@ const Input = ({ node: o }) => {
|
|
|
8305
8313
|
/* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
|
|
8306
8314
|
d.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mx-0 my-2 flex flex-col gap-1 py-2", children: [
|
|
8307
8315
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
8308
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm", children:
|
|
8316
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm", children: x("Presets") }),
|
|
8309
8317
|
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs(Button, { className: "px-1", variant: "link", size: "sm", onClick: () => c(!0), children: [
|
|
8310
8318
|
/* @__PURE__ */ jsx(UploadIcon, { className: "h-4 w-4" }),
|
|
8311
|
-
|
|
8319
|
+
x("Import theme")
|
|
8312
8320
|
] }) })
|
|
8313
8321
|
] }),
|
|
8314
8322
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
|
|
8315
8323
|
/* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
|
|
8316
8324
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
|
|
8317
|
-
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((
|
|
8318
|
-
const k = Object.keys(
|
|
8319
|
-
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(
|
|
8325
|
+
/* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
|
|
8326
|
+
const k = Object.keys(w)[0], A = k.replaceAll("_", " ");
|
|
8327
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(A) }, k);
|
|
8320
8328
|
}) })
|
|
8321
8329
|
] }) }),
|
|
8322
|
-
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children:
|
|
8330
|
+
/* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: x("Apply") }) })
|
|
8323
8331
|
] })
|
|
8324
8332
|
] }),
|
|
8325
8333
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
@@ -8328,14 +8336,14 @@ const Input = ({ node: o }) => {
|
|
|
8328
8336
|
/* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
|
|
8329
8337
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
|
|
8330
8338
|
] }),
|
|
8331
|
-
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([
|
|
8339
|
+
(h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([w, k]) => /* @__PURE__ */ jsx(
|
|
8332
8340
|
FontSelector,
|
|
8333
8341
|
{
|
|
8334
|
-
label:
|
|
8335
|
-
value: g.fontFamily[
|
|
8336
|
-
onChange: (
|
|
8342
|
+
label: w,
|
|
8343
|
+
value: g.fontFamily[w.replace(/font-/g, "")] || k[Object.keys(k)[0]],
|
|
8344
|
+
onChange: (A) => C(w, A)
|
|
8337
8345
|
},
|
|
8338
|
-
|
|
8346
|
+
w
|
|
8339
8347
|
)) }),
|
|
8340
8348
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
8341
8349
|
(h == null ? void 0 : h.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
@@ -8361,7 +8369,7 @@ const Input = ({ node: o }) => {
|
|
|
8361
8369
|
Switch,
|
|
8362
8370
|
{
|
|
8363
8371
|
checked: n,
|
|
8364
|
-
onCheckedChange: (
|
|
8372
|
+
onCheckedChange: (w) => r(w),
|
|
8365
8373
|
"aria-label": "Toggle dark mode",
|
|
8366
8374
|
className: "mx-1"
|
|
8367
8375
|
}
|
|
@@ -8369,7 +8377,7 @@ const Input = ({ node: o }) => {
|
|
|
8369
8377
|
/* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
|
|
8370
8378
|
] }) })
|
|
8371
8379
|
] }),
|
|
8372
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((
|
|
8380
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((w) => _(w)) })
|
|
8373
8381
|
] }),
|
|
8374
8382
|
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
|
|
8375
8383
|
LazyCssImportModal,
|
|
@@ -8790,106 +8798,103 @@ const CHAI_FEATURE_FLAGS = {}, registerChaiFeatureFlag = (o, n) => {
|
|
|
8790
8798
|
registerChaiFeatureFlag("enable-ai-chat-left", {
|
|
8791
8799
|
description: "Enable AI chat on the left side"
|
|
8792
8800
|
});
|
|
8793
|
-
}
|
|
8794
|
-
{
|
|
8795
|
-
name: "Improve writing",
|
|
8796
|
-
icon: Pencil2Icon,
|
|
8797
|
-
prompt: "Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."
|
|
8798
|
-
},
|
|
8799
|
-
{
|
|
8800
|
-
name: "Replace placeholder content",
|
|
8801
|
-
icon: LoopIcon,
|
|
8802
|
-
prompt: "Discard current placeholder content and replace with meaningful relevant content."
|
|
8803
|
-
},
|
|
8804
|
-
//TODO: Add tone options
|
|
8805
|
-
// {
|
|
8806
|
-
// name: "Change tone",
|
|
8807
|
-
// icon: MegaphoneIcon,
|
|
8808
|
-
// subMenus: ["joyful", "serious", "angry", "sad", "excited", "relaxed", "confident", "assertive", "polite"],
|
|
8809
|
-
// prompt: "Change tone in all text elements. Rewrite all text elements in a more _TONE_ tone.",
|
|
8810
|
-
// },
|
|
8811
|
-
{
|
|
8812
|
-
name: "Fix grammar",
|
|
8813
|
-
icon: CheckIcon,
|
|
8814
|
-
prompt: "Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."
|
|
8815
|
-
},
|
|
8816
|
-
{
|
|
8817
|
-
name: "Make longer",
|
|
8818
|
-
icon: ArrowUpIcon,
|
|
8819
|
-
prompt: "Make all text elements longer."
|
|
8820
|
-
},
|
|
8821
|
-
{
|
|
8822
|
-
name: "Make shorter",
|
|
8823
|
-
icon: ArrowDownIcon,
|
|
8824
|
-
prompt: "Make all text elements shorter."
|
|
8825
|
-
},
|
|
8826
|
-
{
|
|
8827
|
-
name: "Add emojis",
|
|
8828
|
-
icon: FaceIcon,
|
|
8829
|
-
prompt: "Add emojis to text elements if relevant."
|
|
8830
|
-
},
|
|
8831
|
-
{
|
|
8832
|
-
name: "Randomize",
|
|
8833
|
-
icon: ShuffleIcon,
|
|
8834
|
-
prompt: "Randomize all text elements."
|
|
8835
|
-
}
|
|
8836
|
-
];
|
|
8801
|
+
};
|
|
8837
8802
|
function QuickPrompts({ onClick: o }) {
|
|
8838
|
-
const { loading: n } = useAskAi(), { t: r } = useTranslation(), { selectedLang: a, fallbackLang: l } = useLanguages(),
|
|
8839
|
-
|
|
8840
|
-
|
|
8803
|
+
const { loading: n } = useAskAi(), { t: r } = useTranslation(), { selectedLang: a, fallbackLang: l } = useLanguages(), c = [...[
|
|
8804
|
+
{
|
|
8805
|
+
name: r("Improve writing"),
|
|
8806
|
+
icon: Pencil2Icon,
|
|
8807
|
+
prompt: r(
|
|
8808
|
+
"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."
|
|
8809
|
+
)
|
|
8810
|
+
},
|
|
8811
|
+
{
|
|
8812
|
+
name: r("Replace placeholder content"),
|
|
8813
|
+
icon: LoopIcon,
|
|
8814
|
+
prompt: r("Discard current placeholder content and replace with meaningful relevant content.")
|
|
8815
|
+
},
|
|
8816
|
+
{
|
|
8817
|
+
name: r("Fix grammar"),
|
|
8818
|
+
icon: CheckIcon,
|
|
8819
|
+
prompt: r("Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors.")
|
|
8820
|
+
},
|
|
8821
|
+
{
|
|
8822
|
+
name: r("Make longer"),
|
|
8823
|
+
icon: ArrowUpIcon,
|
|
8824
|
+
prompt: r("Make all text elements longer.")
|
|
8825
|
+
},
|
|
8826
|
+
{
|
|
8827
|
+
name: r("Make shorter"),
|
|
8828
|
+
icon: ArrowDownIcon,
|
|
8829
|
+
prompt: r("Make all text elements shorter.")
|
|
8830
|
+
},
|
|
8831
|
+
{
|
|
8832
|
+
name: r("Add emojis"),
|
|
8833
|
+
icon: FaceIcon,
|
|
8834
|
+
prompt: r("Add emojis to text elements if relevant.")
|
|
8835
|
+
},
|
|
8836
|
+
{
|
|
8837
|
+
name: r("Randomize"),
|
|
8838
|
+
icon: ShuffleIcon,
|
|
8839
|
+
prompt: r("Randomize all text elements.")
|
|
8840
|
+
}
|
|
8841
|
+
]];
|
|
8842
|
+
return a && a !== l && c.splice(0, 0, {
|
|
8843
|
+
name: r("Translate to %s", get(LANGUAGES, a, a)),
|
|
8841
8844
|
icon: ChatBubbleIcon,
|
|
8842
|
-
prompt:
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
+
prompt: r(
|
|
8846
|
+
"Translate the content to %s. Maintain same tone, style and length.",
|
|
8847
|
+
get(LANGUAGES, a, a)
|
|
8848
|
+
)
|
|
8849
|
+
}), /* @__PURE__ */ jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: c.map(
|
|
8850
|
+
({ name: d, icon: p, subMenus: u, prompt: g }) => u ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
8845
8851
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
|
|
8846
8852
|
"li",
|
|
8847
8853
|
{
|
|
8848
8854
|
className: "flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
8849
8855
|
children: [
|
|
8850
|
-
/* @__PURE__ */ jsx(
|
|
8851
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
8856
|
+
/* @__PURE__ */ jsx(p, { className: "h-4 w-4" }),
|
|
8857
|
+
/* @__PURE__ */ jsx("span", { children: d })
|
|
8852
8858
|
]
|
|
8853
8859
|
},
|
|
8854
|
-
|
|
8860
|
+
d
|
|
8855
8861
|
) }),
|
|
8856
|
-
/* @__PURE__ */ jsx(PopoverContent, { side: "right", children: /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx("li", { children: "Happy" }) }) })
|
|
8862
|
+
/* @__PURE__ */ jsx(PopoverContent, { side: "right", children: /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx("li", { children: r("Happy") }) }) })
|
|
8857
8863
|
] }) : /* @__PURE__ */ jsxs(
|
|
8858
8864
|
"li",
|
|
8859
8865
|
{
|
|
8860
|
-
onClick: () => o(
|
|
8866
|
+
onClick: () => o(g),
|
|
8861
8867
|
className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
8862
8868
|
children: [
|
|
8863
|
-
/* @__PURE__ */ jsx(
|
|
8864
|
-
/* @__PURE__ */ jsx("span", { children: r(
|
|
8869
|
+
/* @__PURE__ */ jsx(p, { className: "h-4 w-4" }),
|
|
8870
|
+
/* @__PURE__ */ jsx("span", { children: r(d) })
|
|
8865
8871
|
]
|
|
8866
8872
|
},
|
|
8867
|
-
|
|
8873
|
+
d
|
|
8868
8874
|
)
|
|
8869
8875
|
) }) });
|
|
8870
8876
|
}
|
|
8871
8877
|
const AIUserPrompt = ({ blockId: o }) => {
|
|
8872
|
-
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""),
|
|
8878
|
+
const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null);
|
|
8873
8879
|
useEffect(() => {
|
|
8874
|
-
var
|
|
8875
|
-
(
|
|
8880
|
+
var g;
|
|
8881
|
+
(g = d.current) == null || g.focus();
|
|
8876
8882
|
}, []);
|
|
8877
|
-
const
|
|
8878
|
-
|
|
8879
|
-
!l && f && p(f), g.current = setTimeout(() => p(void 0), 1e4), l || c("");
|
|
8883
|
+
const u = () => {
|
|
8884
|
+
l || c("");
|
|
8880
8885
|
};
|
|
8881
8886
|
return /* @__PURE__ */ jsx("div", { className: "", children: o ? /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
8882
8887
|
/* @__PURE__ */ jsx(
|
|
8883
8888
|
Textarea,
|
|
8884
8889
|
{
|
|
8885
|
-
ref:
|
|
8890
|
+
ref: d,
|
|
8886
8891
|
value: i,
|
|
8887
|
-
onChange: (
|
|
8892
|
+
onChange: (g) => c(g.target.value),
|
|
8888
8893
|
placeholder: n("Ask AI to edit content"),
|
|
8889
8894
|
className: "w-full",
|
|
8890
8895
|
rows: 3,
|
|
8891
|
-
onKeyDown: (
|
|
8892
|
-
|
|
8896
|
+
onKeyDown: (g) => {
|
|
8897
|
+
g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), r("content", o, i, u));
|
|
8893
8898
|
}
|
|
8894
8899
|
}
|
|
8895
8900
|
),
|
|
@@ -8899,7 +8904,7 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8899
8904
|
{
|
|
8900
8905
|
disabled: i.trim().length < 5 || a,
|
|
8901
8906
|
onClick: () => {
|
|
8902
|
-
|
|
8907
|
+
p.current && clearTimeout(p.current), r("content", o, i, u);
|
|
8903
8908
|
},
|
|
8904
8909
|
variant: "default",
|
|
8905
8910
|
className: "w-fit",
|
|
@@ -8918,21 +8923,13 @@ const AIUserPrompt = ({ blockId: o }) => {
|
|
|
8918
8923
|
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
|
|
8919
8924
|
] }) : null
|
|
8920
8925
|
] }),
|
|
8921
|
-
d ? /* @__PURE__ */ jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
|
|
8922
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
8923
|
-
n("Total tokens used"),
|
|
8924
|
-
": ",
|
|
8925
|
-
d.totalTokens
|
|
8926
|
-
] }),
|
|
8927
|
-
/* @__PURE__ */ jsx(Countdown, {})
|
|
8928
|
-
] }) }) : null,
|
|
8929
8926
|
/* @__PURE__ */ jsx("div", { className: "max-w-full", children: l && /* @__PURE__ */ jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: l.message }) }),
|
|
8930
8927
|
/* @__PURE__ */ jsx("br", {}),
|
|
8931
8928
|
/* @__PURE__ */ jsx(
|
|
8932
8929
|
QuickPrompts,
|
|
8933
8930
|
{
|
|
8934
|
-
onClick: (
|
|
8935
|
-
|
|
8931
|
+
onClick: (g) => {
|
|
8932
|
+
p.current && clearTimeout(p.current), r("content", o, g, u);
|
|
8936
8933
|
}
|
|
8937
8934
|
}
|
|
8938
8935
|
)
|
|
@@ -9003,17 +9000,17 @@ function AIChatPanel() {
|
|
|
9003
9000
|
}, 1500);
|
|
9004
9001
|
}, h = (b) => {
|
|
9005
9002
|
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
|
|
9006
|
-
},
|
|
9003
|
+
}, x = (b) => {
|
|
9007
9004
|
var B;
|
|
9008
9005
|
const C = (B = b.target.files) == null ? void 0 : B[0];
|
|
9009
9006
|
if (C) {
|
|
9010
9007
|
const j = new FileReader();
|
|
9011
9008
|
j.onload = (_) => {
|
|
9012
|
-
var
|
|
9013
|
-
d((
|
|
9009
|
+
var w;
|
|
9010
|
+
d((w = _.target) == null ? void 0 : w.result);
|
|
9014
9011
|
}, j.readAsDataURL(C);
|
|
9015
9012
|
}
|
|
9016
|
-
},
|
|
9013
|
+
}, f = () => {
|
|
9017
9014
|
var b;
|
|
9018
9015
|
(b = p.current) == null || b.click();
|
|
9019
9016
|
}, y = () => {
|
|
@@ -9080,14 +9077,14 @@ function AIChatPanel() {
|
|
|
9080
9077
|
className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
|
|
9081
9078
|
}
|
|
9082
9079
|
),
|
|
9083
|
-
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange:
|
|
9080
|
+
/* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: x, accept: "image/*", className: "hidden" }),
|
|
9084
9081
|
/* @__PURE__ */ jsx(
|
|
9085
9082
|
Button,
|
|
9086
9083
|
{
|
|
9087
9084
|
size: "icon",
|
|
9088
9085
|
variant: "ghost",
|
|
9089
9086
|
className: "absolute bottom-2 right-2 h-6 w-6",
|
|
9090
|
-
onClick:
|
|
9087
|
+
onClick: f,
|
|
9091
9088
|
children: /* @__PURE__ */ jsx(ImageIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
9092
9089
|
}
|
|
9093
9090
|
)
|
|
@@ -9205,7 +9202,7 @@ const AiAssistant = () => {
|
|
|
9205
9202
|
preloadedAttributes: n = [],
|
|
9206
9203
|
onAttributesChange: r
|
|
9207
9204
|
}) {
|
|
9208
|
-
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""),
|
|
9205
|
+
const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData();
|
|
9209
9206
|
useEffect(() => {
|
|
9210
9207
|
l(n);
|
|
9211
9208
|
}, [n]);
|
|
@@ -9219,8 +9216,8 @@ const AiAssistant = () => {
|
|
|
9219
9216
|
r(k), l(a), c(""), p(""), h("");
|
|
9220
9217
|
}
|
|
9221
9218
|
}, C = (k) => {
|
|
9222
|
-
const
|
|
9223
|
-
r(
|
|
9219
|
+
const A = a.filter((E, S) => S !== k);
|
|
9220
|
+
r(A), l(A);
|
|
9224
9221
|
}, B = (k) => {
|
|
9225
9222
|
g(k), c(a[k].key), p(a[k].value);
|
|
9226
9223
|
}, j = () => {
|
|
@@ -9234,16 +9231,16 @@ const AiAssistant = () => {
|
|
|
9234
9231
|
}
|
|
9235
9232
|
}, _ = (k) => {
|
|
9236
9233
|
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? j() : b());
|
|
9237
|
-
},
|
|
9238
|
-
const
|
|
9234
|
+
}, w = useCallback((k) => {
|
|
9235
|
+
const A = (v) => /[.,!?;:]/.test(v), E = (v, I, L) => {
|
|
9239
9236
|
let T = "", P = "";
|
|
9240
9237
|
const R = I > 0 ? v[I - 1] : "", N = I < v.length ? v[I] : "";
|
|
9241
|
-
return I > 0 && (R === "." || !
|
|
9238
|
+
return I > 0 && (R === "." || !A(R) && R !== " ") && (T = " "), I < v.length && !A(N) && N !== " " && (P = " "), {
|
|
9242
9239
|
text: T + L + P,
|
|
9243
9240
|
prefixLength: T.length,
|
|
9244
9241
|
suffixLength: P.length
|
|
9245
9242
|
};
|
|
9246
|
-
}, S =
|
|
9243
|
+
}, S = f.current;
|
|
9247
9244
|
if (S) {
|
|
9248
9245
|
const v = S.selectionStart || 0, I = S.value || "", L = S.selectionEnd || v;
|
|
9249
9246
|
if (L > v) {
|
|
@@ -9274,7 +9271,7 @@ const AiAssistant = () => {
|
|
|
9274
9271
|
autoCorrect: "off",
|
|
9275
9272
|
spellCheck: "false",
|
|
9276
9273
|
id: "attrKey",
|
|
9277
|
-
ref:
|
|
9274
|
+
ref: x,
|
|
9278
9275
|
value: i,
|
|
9279
9276
|
onChange: (k) => c(k.target.value),
|
|
9280
9277
|
placeholder: "Enter Key",
|
|
@@ -9285,7 +9282,7 @@ const AiAssistant = () => {
|
|
|
9285
9282
|
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
9286
9283
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9287
9284
|
/* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
|
|
9288
|
-
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect:
|
|
9285
|
+
!isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: w })
|
|
9289
9286
|
] }),
|
|
9290
9287
|
/* @__PURE__ */ jsx(
|
|
9291
9288
|
Textarea,
|
|
@@ -9295,7 +9292,7 @@ const AiAssistant = () => {
|
|
|
9295
9292
|
spellCheck: "false",
|
|
9296
9293
|
id: "attrValue",
|
|
9297
9294
|
rows: 2,
|
|
9298
|
-
ref:
|
|
9295
|
+
ref: f,
|
|
9299
9296
|
value: d,
|
|
9300
9297
|
onChange: (k) => p(k.target.value),
|
|
9301
9298
|
onKeyDown: _,
|
|
@@ -9310,16 +9307,16 @@ const AiAssistant = () => {
|
|
|
9310
9307
|
]
|
|
9311
9308
|
}
|
|
9312
9309
|
),
|
|
9313
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k,
|
|
9310
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
|
|
9314
9311
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
|
|
9315
9312
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: k.key }),
|
|
9316
9313
|
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
|
|
9317
9314
|
] }),
|
|
9318
9315
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
|
|
9319
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(
|
|
9320
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(
|
|
9316
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
|
|
9317
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(A), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
|
|
9321
9318
|
] })
|
|
9322
|
-
] },
|
|
9319
|
+
] }, A)) })
|
|
9323
9320
|
] });
|
|
9324
9321
|
}), BlockAttributesEditor = React.memo(() => {
|
|
9325
9322
|
const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
|
|
@@ -9489,40 +9486,40 @@ function useSidebarDefaultPanels() {
|
|
|
9489
9486
|
}, [o, n, r]);
|
|
9490
9487
|
}
|
|
9491
9488
|
const RootLayout = () => {
|
|
9492
|
-
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((
|
|
9493
|
-
|
|
9494
|
-
}, []),
|
|
9495
|
-
(
|
|
9496
|
-
console.log("handleMenuItemClick",
|
|
9489
|
+
const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = reverse([...g ?? []]), h = useCallback((A) => {
|
|
9490
|
+
A.preventDefault();
|
|
9491
|
+
}, []), x = useCallback(
|
|
9492
|
+
(A) => {
|
|
9493
|
+
console.log("handleMenuItemClick", A, n), r(n === A ? null : A);
|
|
9497
9494
|
},
|
|
9498
9495
|
[n, r]
|
|
9499
|
-
), { t:
|
|
9496
|
+
), { t: f } = useTranslation(), y = useMemo(
|
|
9500
9497
|
() => [...p, ...u, ...g],
|
|
9501
9498
|
[p, u, g]
|
|
9502
9499
|
), b = useBuilderProp("htmlDir", "ltr"), C = find(y, { id: n }) ?? first(y), B = get(C, "width", DEFAULT_PANEL_WIDTH);
|
|
9503
9500
|
useEffect(() => {
|
|
9504
9501
|
if (n !== null) {
|
|
9505
|
-
const
|
|
9506
|
-
|
|
9502
|
+
const A = find(y, { id: n });
|
|
9503
|
+
A && get(A, "view", "standard") === "standard" && (a.current = n, i(get(A, "width", DEFAULT_PANEL_WIDTH)));
|
|
9507
9504
|
}
|
|
9508
9505
|
}, [n, y]);
|
|
9509
9506
|
const j = useMemo(() => {
|
|
9510
9507
|
if (n === null) return 0;
|
|
9511
|
-
const
|
|
9512
|
-
return get(
|
|
9508
|
+
const A = find(y, { id: n });
|
|
9509
|
+
return get(A, "view", "standard") === "standard" ? B : l;
|
|
9513
9510
|
}, [n, B, l, y]), _ = useCallback(() => {
|
|
9514
9511
|
r(a.current);
|
|
9515
|
-
}, [r, n]),
|
|
9512
|
+
}, [r, n]), w = useCallback(() => {
|
|
9516
9513
|
r("outline");
|
|
9517
9514
|
}, [r]);
|
|
9518
9515
|
useEffect(() => {
|
|
9519
9516
|
n !== null && !find(y, { id: n }) && r("outline");
|
|
9520
9517
|
}, [n, y]);
|
|
9521
9518
|
const k = useCallback(
|
|
9522
|
-
(
|
|
9523
|
-
|
|
9519
|
+
(A) => {
|
|
9520
|
+
x(A);
|
|
9524
9521
|
},
|
|
9525
|
-
[
|
|
9522
|
+
[x]
|
|
9526
9523
|
);
|
|
9527
9524
|
return /* @__PURE__ */ jsx("div", { dir: b, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
|
|
9528
9525
|
/* @__PURE__ */ jsxs(
|
|
@@ -9534,24 +9531,24 @@ const RootLayout = () => {
|
|
|
9534
9531
|
/* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
|
|
9535
9532
|
/* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
|
|
9536
9533
|
/* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
|
|
9537
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((
|
|
9538
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9534
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((A, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9535
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
|
|
9539
9536
|
position: "top",
|
|
9540
|
-
panelId:
|
|
9541
|
-
isActive: n ===
|
|
9542
|
-
show: () => k(
|
|
9537
|
+
panelId: A.id,
|
|
9538
|
+
isActive: n === A.id,
|
|
9539
|
+
show: () => k(A.id)
|
|
9543
9540
|
}) }),
|
|
9544
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9541
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(A.label) }) })
|
|
9545
9542
|
] }, "button-top-" + E)) }),
|
|
9546
9543
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
|
|
9547
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((
|
|
9548
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(
|
|
9544
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((A, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
9545
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
|
|
9549
9546
|
position: "bottom",
|
|
9550
|
-
panelId:
|
|
9551
|
-
isActive: n ===
|
|
9552
|
-
show: () => k(
|
|
9547
|
+
panelId: A.id,
|
|
9548
|
+
isActive: n === A.id,
|
|
9549
|
+
show: () => k(A.id)
|
|
9553
9550
|
}) }),
|
|
9554
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children:
|
|
9551
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(A.label) }) })
|
|
9555
9552
|
] }, "button-bottom-" + E)) })
|
|
9556
9553
|
] }),
|
|
9557
9554
|
/* @__PURE__ */ jsx(
|
|
@@ -9567,7 +9564,7 @@ const RootLayout = () => {
|
|
|
9567
9564
|
"div",
|
|
9568
9565
|
{
|
|
9569
9566
|
className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(C, "isInternal", !1) ? "" : "w-64"}`,
|
|
9570
|
-
children: /* @__PURE__ */ jsx("span", { children:
|
|
9567
|
+
children: /* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
|
|
9571
9568
|
}
|
|
9572
9569
|
),
|
|
9573
9570
|
/* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
|
|
@@ -9590,11 +9587,11 @@ const RootLayout = () => {
|
|
|
9590
9587
|
/* @__PURE__ */ jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-2", children: c === "ai" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9591
9588
|
/* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
|
|
9592
9589
|
" ",
|
|
9593
|
-
|
|
9590
|
+
f("AI Assistant")
|
|
9594
9591
|
] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
9595
9592
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9596
9593
|
/* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-4 w-4 text-gray-600" }),
|
|
9597
|
-
|
|
9594
|
+
f("Theme Settings")
|
|
9598
9595
|
] }),
|
|
9599
9596
|
/* @__PURE__ */ jsx(
|
|
9600
9597
|
Button,
|
|
@@ -9625,10 +9622,10 @@ const RootLayout = () => {
|
|
|
9625
9622
|
children: [
|
|
9626
9623
|
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
|
|
9627
9624
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9628
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9625
|
+
/* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
|
|
9629
9626
|
] }) }),
|
|
9630
9627
|
/* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9631
|
-
close:
|
|
9628
|
+
close: w
|
|
9632
9629
|
}) }) })
|
|
9633
9630
|
]
|
|
9634
9631
|
}
|
|
@@ -9637,10 +9634,10 @@ const RootLayout = () => {
|
|
|
9637
9634
|
n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${B}px` }, children: [
|
|
9638
9635
|
/* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
9639
9636
|
/* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
|
|
9640
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9637
|
+
/* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
|
|
9641
9638
|
] }) }),
|
|
9642
9639
|
/* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9643
|
-
close:
|
|
9640
|
+
close: w
|
|
9644
9641
|
}) }) })
|
|
9645
9642
|
] }) }),
|
|
9646
9643
|
n !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
|
|
@@ -9663,12 +9660,12 @@ const RootLayout = () => {
|
|
|
9663
9660
|
/* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
|
|
9664
9661
|
/* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
|
|
9665
9662
|
/* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
|
|
9666
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9663
|
+
/* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
|
|
9667
9664
|
] }),
|
|
9668
9665
|
/* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
|
|
9669
9666
|
] }),
|
|
9670
9667
|
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
|
|
9671
|
-
close:
|
|
9668
|
+
close: w
|
|
9672
9669
|
}) }) })
|
|
9673
9670
|
]
|
|
9674
9671
|
}
|
|
@@ -9707,36 +9704,36 @@ const RootLayout = () => {
|
|
|
9707
9704
|
}) => {
|
|
9708
9705
|
const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), g = useMemo(() => {
|
|
9709
9706
|
if (!l.trim()) return a;
|
|
9710
|
-
const
|
|
9707
|
+
const f = l.toLowerCase();
|
|
9711
9708
|
return Object.fromEntries(
|
|
9712
9709
|
Object.entries(a).filter(([y, b]) => {
|
|
9713
9710
|
var C;
|
|
9714
|
-
return (y == null ? void 0 : y.toLowerCase().includes(
|
|
9711
|
+
return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((C = b == null ? void 0 : b.description) == null ? void 0 : C.toLowerCase().includes(f));
|
|
9715
9712
|
})
|
|
9716
9713
|
);
|
|
9717
|
-
}, [a, l]), m = (
|
|
9714
|
+
}, [a, l]), m = (f) => {
|
|
9718
9715
|
d(!0), u({
|
|
9719
|
-
x:
|
|
9720
|
-
y:
|
|
9716
|
+
x: f.clientX - n.x,
|
|
9717
|
+
y: f.clientY - n.y
|
|
9721
9718
|
});
|
|
9722
|
-
}, h = (
|
|
9719
|
+
}, h = (f) => {
|
|
9723
9720
|
if (!c) return;
|
|
9724
|
-
const y =
|
|
9725
|
-
r(k,
|
|
9726
|
-
},
|
|
9721
|
+
const y = f.clientX - p.x, b = f.clientY - p.y, C = f.currentTarget, B = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - B, w = window.innerHeight - j, k = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, w));
|
|
9722
|
+
r(k, A);
|
|
9723
|
+
}, x = () => {
|
|
9727
9724
|
d(!1);
|
|
9728
9725
|
};
|
|
9729
9726
|
return useEffect(() => {
|
|
9730
|
-
const
|
|
9727
|
+
const f = () => {
|
|
9731
9728
|
c && d(!1);
|
|
9732
9729
|
};
|
|
9733
|
-
return window.addEventListener("mouseup",
|
|
9730
|
+
return window.addEventListener("mouseup", f), () => window.removeEventListener("mouseup", f);
|
|
9734
9731
|
}, [c]), !n || n.x < 0 || n.y < 0 ? null : /* @__PURE__ */ jsxs(
|
|
9735
9732
|
"div",
|
|
9736
9733
|
{
|
|
9737
9734
|
onMouseDown: m,
|
|
9738
9735
|
onMouseMove: h,
|
|
9739
|
-
onMouseUp:
|
|
9736
|
+
onMouseUp: x,
|
|
9740
9737
|
className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
|
|
9741
9738
|
style: {
|
|
9742
9739
|
left: n.x,
|
|
@@ -9778,13 +9775,13 @@ const RootLayout = () => {
|
|
|
9778
9775
|
placeholder: "Search features...",
|
|
9779
9776
|
className: "w-full pl-8",
|
|
9780
9777
|
value: l,
|
|
9781
|
-
onChange: (
|
|
9778
|
+
onChange: (f) => i(f.target.value),
|
|
9782
9779
|
autoFocus: !0
|
|
9783
9780
|
}
|
|
9784
9781
|
)
|
|
9785
9782
|
] })
|
|
9786
9783
|
] }),
|
|
9787
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([
|
|
9784
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([f, y]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: f, options: y }, f)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
9788
9785
|
'No features found matching "',
|
|
9789
9786
|
l,
|
|
9790
9787
|
'"'
|
|
@@ -9928,8 +9925,8 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9928
9925
|
c.f && u(c.f);
|
|
9929
9926
|
const g = /* @__PURE__ */ new Set(), m = g.add.bind(g);
|
|
9930
9927
|
a.forEach((h) => {
|
|
9931
|
-
var
|
|
9932
|
-
return (
|
|
9928
|
+
var x;
|
|
9929
|
+
return (x = r.get(h)) == null ? void 0 : x.l.forEach(m);
|
|
9933
9930
|
}), a.clear(), i.forEach(m), i.clear(), l.forEach(m), l.clear(), g.forEach(u), a.size && d(o);
|
|
9934
9931
|
} while (a.size || i.size || l.size);
|
|
9935
9932
|
if (p.length)
|
|
@@ -9937,73 +9934,73 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
9937
9934
|
}, recomputeInvalidatedAtoms = (o) => {
|
|
9938
9935
|
const n = getBuildingBlocks(o), r = n[1], a = n[2], l = n[3], i = n[11], c = n[14], d = n[17], p = [], u = /* @__PURE__ */ new WeakSet(), g = /* @__PURE__ */ new WeakSet(), m = Array.from(l);
|
|
9939
9936
|
for (; m.length; ) {
|
|
9940
|
-
const h = m[m.length - 1],
|
|
9937
|
+
const h = m[m.length - 1], x = i(o, h);
|
|
9941
9938
|
if (g.has(h)) {
|
|
9942
9939
|
m.pop();
|
|
9943
9940
|
continue;
|
|
9944
9941
|
}
|
|
9945
9942
|
if (u.has(h)) {
|
|
9946
|
-
a.get(h) ===
|
|
9943
|
+
a.get(h) === x.n && p.push([h, x]), g.add(h), m.pop();
|
|
9947
9944
|
continue;
|
|
9948
9945
|
}
|
|
9949
9946
|
u.add(h);
|
|
9950
|
-
for (const
|
|
9951
|
-
u.has(
|
|
9947
|
+
for (const f of getMountedOrPendingDependents(h, x, r))
|
|
9948
|
+
u.has(f) || m.push(f);
|
|
9952
9949
|
}
|
|
9953
9950
|
for (let h = p.length - 1; h >= 0; --h) {
|
|
9954
|
-
const [
|
|
9951
|
+
const [x, f] = p[h];
|
|
9955
9952
|
let y = !1;
|
|
9956
|
-
for (const b of
|
|
9957
|
-
if (b !==
|
|
9953
|
+
for (const b of f.d.keys())
|
|
9954
|
+
if (b !== x && l.has(b)) {
|
|
9958
9955
|
y = !0;
|
|
9959
9956
|
break;
|
|
9960
9957
|
}
|
|
9961
|
-
y && (c(o,
|
|
9958
|
+
y && (c(o, x), d(o, x)), a.delete(x);
|
|
9962
9959
|
}
|
|
9963
9960
|
}, readAtomState = (o, n) => {
|
|
9964
9961
|
var r;
|
|
9965
|
-
const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14],
|
|
9962
|
+
const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14], x = a[16], f = a[17], y = u(o, n);
|
|
9966
9963
|
if (isAtomStateInitialized(y) && (l.has(n) && i.get(n) !== y.n || Array.from(y.d).every(
|
|
9967
|
-
([
|
|
9964
|
+
([A, E]) => (
|
|
9968
9965
|
// Recursively, read the atom state of the dependency, and
|
|
9969
9966
|
// check if the atom epoch number is unchanged
|
|
9970
|
-
h(o,
|
|
9967
|
+
h(o, A).n === E
|
|
9971
9968
|
)
|
|
9972
9969
|
)))
|
|
9973
9970
|
return y;
|
|
9974
9971
|
y.d.clear();
|
|
9975
9972
|
let b = !0;
|
|
9976
9973
|
function C() {
|
|
9977
|
-
l.has(n) && (
|
|
9974
|
+
l.has(n) && (f(o, n), m(o), g(o));
|
|
9978
9975
|
}
|
|
9979
|
-
function B(
|
|
9976
|
+
function B(A) {
|
|
9980
9977
|
var E;
|
|
9981
|
-
if (isSelfAtom(n,
|
|
9982
|
-
const v = u(o,
|
|
9978
|
+
if (isSelfAtom(n, A)) {
|
|
9979
|
+
const v = u(o, A);
|
|
9983
9980
|
if (!isAtomStateInitialized(v))
|
|
9984
|
-
if (hasInitialValue(
|
|
9985
|
-
setAtomStateValueOrPromise(o,
|
|
9981
|
+
if (hasInitialValue(A))
|
|
9982
|
+
setAtomStateValueOrPromise(o, A, A.init);
|
|
9986
9983
|
else
|
|
9987
9984
|
throw new Error("no atom init");
|
|
9988
9985
|
return returnAtomValue(v);
|
|
9989
9986
|
}
|
|
9990
|
-
const S = h(o,
|
|
9987
|
+
const S = h(o, A);
|
|
9991
9988
|
try {
|
|
9992
9989
|
return returnAtomValue(S);
|
|
9993
9990
|
} finally {
|
|
9994
|
-
y.d.set(
|
|
9991
|
+
y.d.set(A, S.n), isPendingPromise(y.v) && addPendingPromiseToDependency(n, y.v, S), (E = l.get(A)) == null || E.t.add(n), b || C();
|
|
9995
9992
|
}
|
|
9996
9993
|
}
|
|
9997
9994
|
let j, _;
|
|
9998
|
-
const
|
|
9995
|
+
const w = {
|
|
9999
9996
|
get signal() {
|
|
10000
9997
|
return j || (j = new AbortController()), j.signal;
|
|
10001
9998
|
},
|
|
10002
9999
|
get setSelf() {
|
|
10003
|
-
return !_ && isActuallyWritableAtom(n) && (_ = (...
|
|
10000
|
+
return !_ && isActuallyWritableAtom(n) && (_ = (...A) => {
|
|
10004
10001
|
if (!b)
|
|
10005
10002
|
try {
|
|
10006
|
-
return
|
|
10003
|
+
return x(o, n, ...A);
|
|
10007
10004
|
} finally {
|
|
10008
10005
|
m(o), g(o);
|
|
10009
10006
|
}
|
|
@@ -10011,10 +10008,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10011
10008
|
}
|
|
10012
10009
|
}, k = y.n;
|
|
10013
10010
|
try {
|
|
10014
|
-
const
|
|
10015
|
-
return setAtomStateValueOrPromise(o, n,
|
|
10016
|
-
} catch (
|
|
10017
|
-
return delete y.v, y.e =
|
|
10011
|
+
const A = p(o, n, B, w);
|
|
10012
|
+
return setAtomStateValueOrPromise(o, n, A), isPromiseLike$1(A) && (registerAbortHandler(A, () => j == null ? void 0 : j.abort()), A.then(C, C)), y;
|
|
10013
|
+
} catch (A) {
|
|
10014
|
+
return delete y.v, y.e = A, ++y.n, y;
|
|
10018
10015
|
} finally {
|
|
10019
10016
|
b = !1, k !== y.n && i.get(n) === k && (i.set(n, y.n), c.add(n), (r = d.c) == null || r.call(d, n));
|
|
10020
10017
|
}
|
|
@@ -10029,57 +10026,57 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10029
10026
|
}
|
|
10030
10027
|
}, writeAtomState = (o, n, ...r) => {
|
|
10031
10028
|
const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], d = a[11], p = a[12], u = a[13], g = a[14], m = a[15], h = a[17];
|
|
10032
|
-
let
|
|
10033
|
-
const
|
|
10029
|
+
let x = !0;
|
|
10030
|
+
const f = (b) => returnAtomValue(g(o, b)), y = (b, ...C) => {
|
|
10034
10031
|
var B;
|
|
10035
10032
|
const j = d(o, b);
|
|
10036
10033
|
try {
|
|
10037
10034
|
if (isSelfAtom(n, b)) {
|
|
10038
10035
|
if (!hasInitialValue(b))
|
|
10039
10036
|
throw new Error("atom not writable");
|
|
10040
|
-
const _ = j.n,
|
|
10041
|
-
setAtomStateValueOrPromise(o, b,
|
|
10037
|
+
const _ = j.n, w = C[0];
|
|
10038
|
+
setAtomStateValueOrPromise(o, b, w), h(o, b), _ !== j.n && (l.add(b), (B = i.c) == null || B.call(i, b), m(o, b));
|
|
10042
10039
|
return;
|
|
10043
10040
|
} else
|
|
10044
10041
|
return writeAtomState(o, b, ...C);
|
|
10045
10042
|
} finally {
|
|
10046
|
-
|
|
10043
|
+
x || (u(o), p(o));
|
|
10047
10044
|
}
|
|
10048
10045
|
};
|
|
10049
10046
|
try {
|
|
10050
|
-
return c(o, n,
|
|
10047
|
+
return c(o, n, f, y, ...r);
|
|
10051
10048
|
} finally {
|
|
10052
|
-
|
|
10049
|
+
x = !1;
|
|
10053
10050
|
}
|
|
10054
10051
|
}, mountDependencies = (o, n) => {
|
|
10055
10052
|
var r;
|
|
10056
10053
|
const a = getBuildingBlocks(o), l = a[1], i = a[3], c = a[6], d = a[11], p = a[15], u = a[18], g = a[19], m = d(o, n), h = l.get(n);
|
|
10057
10054
|
if (h && !isPendingPromise(m.v)) {
|
|
10058
|
-
for (const [
|
|
10059
|
-
if (!h.d.has(
|
|
10060
|
-
const y = d(o,
|
|
10061
|
-
u(o,
|
|
10055
|
+
for (const [x, f] of m.d)
|
|
10056
|
+
if (!h.d.has(x)) {
|
|
10057
|
+
const y = d(o, x);
|
|
10058
|
+
u(o, x).t.add(n), h.d.add(x), f !== y.n && (i.add(x), (r = c.c) == null || r.call(c, x), p(o, x));
|
|
10062
10059
|
}
|
|
10063
|
-
for (const
|
|
10064
|
-
if (!m.d.has(
|
|
10065
|
-
h.d.delete(
|
|
10066
|
-
const
|
|
10067
|
-
|
|
10060
|
+
for (const x of h.d || [])
|
|
10061
|
+
if (!m.d.has(x)) {
|
|
10062
|
+
h.d.delete(x);
|
|
10063
|
+
const f = g(o, x);
|
|
10064
|
+
f == null || f.t.delete(n);
|
|
10068
10065
|
}
|
|
10069
10066
|
}
|
|
10070
10067
|
}, mountAtom = (o, n) => {
|
|
10071
10068
|
var r;
|
|
10072
|
-
const a = getBuildingBlocks(o), l = a[1], i = a[4], c = a[6], d = a[10], p = a[11], u = a[12], g = a[13], m = a[14], h = a[16],
|
|
10073
|
-
let
|
|
10074
|
-
if (!
|
|
10069
|
+
const a = getBuildingBlocks(o), l = a[1], i = a[4], c = a[6], d = a[10], p = a[11], u = a[12], g = a[13], m = a[14], h = a[16], x = p(o, n);
|
|
10070
|
+
let f = l.get(n);
|
|
10071
|
+
if (!f) {
|
|
10075
10072
|
m(o, n);
|
|
10076
|
-
for (const y of
|
|
10073
|
+
for (const y of x.d.keys())
|
|
10077
10074
|
mountAtom(o, y).t.add(n);
|
|
10078
|
-
if (
|
|
10075
|
+
if (f = {
|
|
10079
10076
|
l: /* @__PURE__ */ new Set(),
|
|
10080
|
-
d: new Set(
|
|
10077
|
+
d: new Set(x.d.keys()),
|
|
10081
10078
|
t: /* @__PURE__ */ new Set()
|
|
10082
|
-
}, l.set(n,
|
|
10079
|
+
}, l.set(n, f), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
|
|
10083
10080
|
const y = () => {
|
|
10084
10081
|
let b = !0;
|
|
10085
10082
|
const C = (...B) => {
|
|
@@ -10091,7 +10088,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10091
10088
|
};
|
|
10092
10089
|
try {
|
|
10093
10090
|
const B = d(o, n, C);
|
|
10094
|
-
B && (
|
|
10091
|
+
B && (f.u = () => {
|
|
10095
10092
|
b = !0;
|
|
10096
10093
|
try {
|
|
10097
10094
|
B();
|
|
@@ -10106,7 +10103,7 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
|
|
|
10106
10103
|
i.add(y);
|
|
10107
10104
|
}
|
|
10108
10105
|
}
|
|
10109
|
-
return
|
|
10106
|
+
return f;
|
|
10110
10107
|
}, unmountAtom = (o, n) => {
|
|
10111
10108
|
var r;
|
|
10112
10109
|
const a = getBuildingBlocks(o), l = a[1], i = a[5], c = a[6], d = a[11], p = a[19], u = d(o, n);
|