camox 0.1.2-alpha.2 → 0.3.0
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/bin/camox.mjs +2 -0
- package/dist/components/AuthGate.js +9 -0
- package/dist/core/components/lexical/InlineContentEditable.d.ts.map +1 -1
- package/dist/core/components/lexical/InlineContentEditable.js +2 -11
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts +4 -6
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts.map +1 -1
- package/dist/core/components/lexical/InlineLexicalEditor.js +3 -16
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts +2 -2
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts.map +1 -1
- package/dist/core/components/lexical/SidebarLexicalEditor.js +91 -0
- package/dist/core/components/lexical/editorConfig.d.ts +2 -2
- package/dist/core/components/lexical/editorConfig.d.ts.map +1 -1
- package/dist/core/components/lexical/editorConfig.js +6 -2
- package/dist/core/createApp.d.ts +130 -0
- package/dist/core/createApp.d.ts.map +1 -1
- package/dist/core/createApp.js +20 -0
- package/dist/core/createBlock.d.ts +45 -4
- package/dist/core/createBlock.d.ts.map +1 -1
- package/dist/core/createBlock.js +231 -183
- package/dist/core/createLayout.d.ts +39 -2
- package/dist/core/createLayout.d.ts.map +1 -1
- package/dist/core/createLayout.js +29 -11
- package/dist/core/hooks/useFieldSelection.d.ts +2 -5
- package/dist/core/hooks/useFieldSelection.d.ts.map +1 -1
- package/dist/core/hooks/useFieldSelection.js +12 -12
- package/dist/core/hooks/useIsEditable.js +3 -3
- package/dist/core/lib/contentType.d.ts +4 -5
- package/dist/core/lib/contentType.d.ts.map +1 -1
- package/dist/core/lib/contentType.js +18 -17
- package/dist/core/lib/fieldTypes.d.ts +10 -3
- package/dist/core/lib/fieldTypes.d.ts.map +1 -1
- package/dist/core/lib/fieldTypes.js +187 -0
- package/dist/core/lib/lexicalReact.d.ts +5 -1
- package/dist/core/lib/lexicalReact.d.ts.map +1 -1
- package/dist/core/lib/lexicalReact.js +26 -20
- package/dist/core/lib/lexicalState.d.ts +4 -4
- package/dist/core/lib/lexicalState.d.ts.map +1 -1
- package/dist/core/lib/lexicalState.js +73 -15
- package/dist/core/lib/modifierFormats.js +14 -1
- package/dist/core/lib/modifiers.js +1 -6
- package/dist/features/content/CamoxContent.d.ts.map +1 -1
- package/dist/features/content/CamoxContent.js +46 -14
- package/dist/features/content/components/AssetCard.d.ts +2 -2
- package/dist/features/content/components/AssetCard.d.ts.map +1 -1
- package/dist/features/content/components/AssetCard.js +2 -2
- package/dist/features/content/components/UploadDropZone.js +1 -1
- package/dist/features/content/components/UploadProgressDrawer.d.ts.map +1 -1
- package/dist/features/content/components/UploadProgressDrawer.js +2 -3
- package/dist/features/metadata/sitemap.d.ts +6 -0
- package/dist/features/metadata/sitemap.d.ts.map +1 -0
- package/dist/features/preview/CamoxPreview.d.ts +17 -110
- package/dist/features/preview/CamoxPreview.d.ts.map +1 -1
- package/dist/features/preview/CamoxPreview.js +144 -68
- package/dist/features/preview/components/AddBlockSheet.d.ts.map +1 -1
- package/dist/features/preview/components/AddBlockSheet.js +102 -17
- package/dist/features/preview/components/AssetFieldEditor.d.ts.map +1 -1
- package/dist/features/preview/components/AssetFieldEditor.js +18 -27
- package/dist/features/preview/components/AssetLightbox.d.ts +1 -2
- package/dist/features/preview/components/AssetLightbox.d.ts.map +1 -1
- package/dist/features/preview/components/AssetLightbox.js +38 -58
- package/dist/features/preview/components/AssetPickerGrid.d.ts +3 -3
- package/dist/features/preview/components/AssetPickerGrid.d.ts.map +1 -1
- package/dist/features/preview/components/AssetPickerGrid.js +15 -9
- package/dist/features/preview/components/BlockActionsPopover.d.ts +2 -2
- package/dist/features/preview/components/BlockActionsPopover.d.ts.map +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +97 -120
- package/dist/features/preview/components/CreatePageSheet.d.ts.map +1 -1
- package/dist/features/preview/components/CreatePageSheet.js +24 -16
- package/dist/features/preview/components/EditPageSheet.d.ts.map +1 -1
- package/dist/features/preview/components/EditPageSheet.js +76 -64
- package/dist/features/preview/components/ItemFieldsEditor.d.ts +7 -8
- package/dist/features/preview/components/ItemFieldsEditor.d.ts.map +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +57 -45
- package/dist/features/preview/components/LinkFieldEditor.d.ts.map +1 -1
- package/dist/features/preview/components/LinkFieldEditor.js +14 -8
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts +2 -3
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts.map +1 -1
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +57 -137
- package/dist/features/preview/components/OverlayTracker.js +1 -1
- package/dist/features/preview/components/Overlays.d.ts.map +1 -1
- package/dist/features/preview/components/Overlays.js +13 -12
- package/dist/features/preview/components/PageContentSheet.d.ts.map +1 -1
- package/dist/features/preview/components/PageContentSheet.js +193 -264
- package/dist/features/preview/components/PageLocationFieldset.d.ts +5 -5
- package/dist/features/preview/components/PageLocationFieldset.d.ts.map +1 -1
- package/dist/features/preview/components/PageLocationFieldset.js +7 -7
- package/dist/features/preview/components/PagePicker.d.ts.map +1 -1
- package/dist/features/preview/components/PagePicker.js +17 -11
- package/dist/features/preview/components/PageTree.d.ts.map +1 -1
- package/dist/features/preview/components/PageTree.js +96 -82
- package/dist/features/preview/components/PeekedBlock.d.ts.map +1 -1
- package/dist/features/preview/components/PeekedBlock.js +17 -23
- package/dist/features/preview/components/PreviewPanel.d.ts.map +1 -1
- package/dist/features/preview/components/PreviewPanel.js +7 -11
- package/dist/features/preview/components/PreviewSideSheet.js +1 -1
- package/dist/features/preview/components/PreviewToolbar.js +3 -3
- package/dist/features/preview/components/RepeatableItemsList.d.ts +9 -6
- package/dist/features/preview/components/RepeatableItemsList.d.ts.map +1 -1
- package/dist/features/preview/components/RepeatableItemsList.js +72 -229
- package/dist/features/preview/components/TextFormatToolbar.d.ts.map +1 -1
- package/dist/features/preview/components/TextFormatToolbar.js +11 -8
- package/dist/features/preview/components/UnlinkAssetButton.d.ts +1 -2
- package/dist/features/preview/components/UnlinkAssetButton.d.ts.map +1 -1
- package/dist/features/preview/components/UnlinkAssetButton.js +10 -7
- package/dist/features/preview/components/useUpdateBlockPosition.d.ts +67 -0
- package/dist/features/preview/components/useUpdateBlockPosition.d.ts.map +1 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +63 -0
- package/dist/features/preview/previewStore.d.ts +43 -36
- package/dist/features/preview/previewStore.d.ts.map +1 -1
- package/dist/features/preview/previewStore.js +184 -241
- package/dist/features/provider/CamoxProvider.d.ts +5 -3
- package/dist/features/provider/CamoxProvider.d.ts.map +1 -1
- package/dist/features/provider/CamoxProvider.js +32 -22
- package/dist/features/provider/actionsStore.d.ts +0 -4
- package/dist/features/provider/actionsStore.d.ts.map +1 -1
- package/dist/features/provider/components/CamoxAppContext.d.ts +130 -0
- package/dist/features/provider/components/CamoxAppContext.d.ts.map +1 -1
- package/dist/features/provider/components/CommandPalette.d.ts.map +1 -1
- package/dist/features/provider/components/CommandPalette.js +2 -10
- package/dist/features/provider/useAdminShortcuts.js +1 -1
- package/dist/features/routes/pageRoute.d.ts +23 -105
- package/dist/features/routes/pageRoute.d.ts.map +1 -1
- package/dist/features/routes/pageRoute.js +51 -18
- package/dist/features/studio/CamoxStudio.d.ts +1 -1
- package/dist/features/studio/CamoxStudio.d.ts.map +1 -1
- package/dist/features/studio/CamoxStudio.js +8 -11
- package/dist/features/studio/components/EnvironmentMenu.d.ts +2 -0
- package/dist/features/studio/components/EnvironmentMenu.d.ts.map +1 -0
- package/dist/features/studio/components/EnvironmentMenu.js +49 -0
- package/dist/features/studio/components/Navbar.d.ts.map +1 -1
- package/dist/features/studio/components/Navbar.js +17 -7
- package/dist/features/studio/components/ProjectMenu.d.ts.map +1 -1
- package/dist/features/studio/components/ProjectMenu.js +47 -72
- package/dist/features/studio/components/UserButton.d.ts.map +1 -1
- package/dist/features/studio/components/UserButton.js +5 -6
- package/dist/features/studio/useTheme.d.ts.map +1 -1
- package/dist/features/studio/useTheme.js +4 -15
- package/dist/features/vite/definitionsSync.d.ts +16 -3
- package/dist/features/vite/definitionsSync.d.ts.map +1 -1
- package/dist/features/vite/definitionsSync.js +110 -57
- package/dist/features/vite/routeGeneration.d.ts +12 -2
- package/dist/features/vite/routeGeneration.d.ts.map +1 -1
- package/dist/features/vite/routeGeneration.js +19 -19
- package/dist/features/vite/vite.d.ts +11 -6
- package/dist/features/vite/vite.d.ts.map +1 -1
- package/dist/features/vite/vite.js +78 -23
- package/dist/hooks/use-file-upload.d.ts +2 -1
- package/dist/hooks/use-file-upload.d.ts.map +1 -1
- package/dist/hooks/use-file-upload.js +88 -0
- package/dist/hooks/use-marquee-selection.js +89 -0
- package/dist/lib/analytics-client.js +30 -0
- package/dist/lib/api-client-server.d.ts +5 -0
- package/dist/lib/api-client-server.d.ts.map +1 -0
- package/dist/lib/api-client-server.js +13 -0
- package/dist/lib/api-client.d.ts +1198 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +45 -0
- package/dist/lib/auth.d.ts +85 -1638
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +249 -0
- package/dist/lib/normalized-data.d.ts +96 -0
- package/dist/lib/normalized-data.d.ts.map +1 -0
- package/dist/lib/normalized-data.js +114 -0
- package/dist/lib/queries.d.ts +793 -0
- package/dist/lib/queries.d.ts.map +1 -0
- package/dist/lib/queries.js +127 -0
- package/dist/lib/use-project-room.d.ts +2 -0
- package/dist/lib/use-project-room.d.ts.map +1 -0
- package/dist/lib/use-project-room.js +34 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +72 -0
- package/dist/studio.css +1 -1
- package/package.json +20 -13
- package/skills/camox-block/SKILL.md +11 -11
- package/skills/camox-layout/SKILL.md +22 -0
- package/dist/features/vite/convexSync.d.ts +0 -6
- package/dist/features/vite/convexSync.d.ts.map +0 -1
- package/dist/features/vite/convexSync.js +0 -98
- package/dist/lib/convex-site.d.ts +0 -3
- package/dist/lib/convex-site.d.ts.map +0 -1
- package/server/api.d.ts +0 -1
- package/server/api.js +0 -1
- package/server/dataModel.d.ts +0 -1
- package/server/dataModel.js +0 -1
package/bin/camox.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useAuthState } from "../lib/auth.js";
|
|
2
|
+
//#region src/components/AuthGate.tsx
|
|
3
|
+
function AuthGate({ authenticated, unauthenticated }) {
|
|
4
|
+
const { isAuthenticated, isLoading } = useAuthState();
|
|
5
|
+
if (isLoading) return unauthenticated;
|
|
6
|
+
return isAuthenticated ? authenticated : unauthenticated;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { AuthGate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineContentEditable.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,+
|
|
1
|
+
{"version":3,"file":"InlineContentEditable.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,+GAyBhC,CAAC"}
|
|
@@ -8,7 +8,6 @@ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
|
8
8
|
*/
|
|
9
9
|
var InlineContentEditable = React.forwardRef(function InlineContentEditable(props, ref) {
|
|
10
10
|
const [editor] = useLexicalComposerContext();
|
|
11
|
-
const [isEditable, setEditable] = React.useState(false);
|
|
12
11
|
const handleRef = React.useCallback((el) => {
|
|
13
12
|
if (el?.ownerDocument?.defaultView) editor.setRootElement(el);
|
|
14
13
|
else editor.setRootElement(null);
|
|
@@ -20,20 +19,12 @@ var InlineContentEditable = React.forwardRef(function InlineContentEditable(prop
|
|
|
20
19
|
else if (ref) ref.current = el;
|
|
21
20
|
};
|
|
22
21
|
}, [handleRef, ref]);
|
|
23
|
-
React.useLayoutEffect(() => {
|
|
24
|
-
editor.setEditable(false);
|
|
25
|
-
return editor.registerEditableListener(setEditable);
|
|
26
|
-
}, [editor]);
|
|
27
|
-
const handleBlur = React.useCallback(() => {
|
|
28
|
-
editor.setEditable(false);
|
|
29
|
-
}, [editor]);
|
|
30
22
|
return /* @__PURE__ */ jsx("span", {
|
|
31
23
|
...props,
|
|
32
|
-
contentEditable:
|
|
24
|
+
contentEditable: true,
|
|
33
25
|
ref: mergedRef,
|
|
34
26
|
role: "textbox",
|
|
35
|
-
spellCheck: true
|
|
36
|
-
onBlur: handleBlur
|
|
27
|
+
spellCheck: true
|
|
37
28
|
});
|
|
38
29
|
});
|
|
39
30
|
//#endregion
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
interface InlineLexicalEditorProps {
|
|
3
|
-
initialState: string
|
|
4
|
-
externalState: string
|
|
5
|
-
onChange: (
|
|
2
|
+
initialState: string | Record<string, unknown>;
|
|
3
|
+
externalState: string | Record<string, unknown>;
|
|
4
|
+
onChange: (markdown: string) => void;
|
|
6
5
|
onFocus: () => void;
|
|
7
6
|
onBlur: () => void;
|
|
8
|
-
activateRef?: React.RefObject<(() => void) | null>;
|
|
9
7
|
}
|
|
10
|
-
export declare function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur,
|
|
8
|
+
export declare function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur, }: InlineLexicalEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
9
|
export {};
|
|
12
10
|
//# sourceMappingURL=InlineLexicalEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineLexicalEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InlineLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineLexicalEditor.tsx"],"names":[],"mappings":"AAcA,UAAU,wBAAwB;IAChC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AA0ED,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,GACP,EAAE,wBAAwB,2CAsD1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
|
|
1
2
|
import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
|
|
2
3
|
import { InlineContentEditable } from "./InlineContentEditable.js";
|
|
3
4
|
import { SelectionBroadcaster } from "./SelectionBroadcaster.js";
|
|
@@ -50,19 +51,6 @@ function EscapeHandler() {
|
|
|
50
51
|
}, [editor]);
|
|
51
52
|
return null;
|
|
52
53
|
}
|
|
53
|
-
function ActivateHandler({ activateRef }) {
|
|
54
|
-
const [editor] = useLexicalComposerContext();
|
|
55
|
-
React.useEffect(() => {
|
|
56
|
-
activateRef.current = () => {
|
|
57
|
-
editor.setEditable(true);
|
|
58
|
-
editor.focus();
|
|
59
|
-
};
|
|
60
|
-
return () => {
|
|
61
|
-
activateRef.current = null;
|
|
62
|
-
};
|
|
63
|
-
}, [editor, activateRef]);
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
54
|
function FocusBlurHandler({ onFocus, onBlur }) {
|
|
67
55
|
const [editor] = useLexicalComposerContext();
|
|
68
56
|
React.useEffect(() => {
|
|
@@ -82,7 +70,7 @@ function FocusBlurHandler({ onFocus, onBlur }) {
|
|
|
82
70
|
]);
|
|
83
71
|
return null;
|
|
84
72
|
}
|
|
85
|
-
function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur
|
|
73
|
+
function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur }) {
|
|
86
74
|
const { window: iframeWindow } = useFrame();
|
|
87
75
|
const timerRef = React.useRef(null);
|
|
88
76
|
const isDirtyRef = React.useRef(false);
|
|
@@ -91,7 +79,7 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
|
|
|
91
79
|
if (!isDirtyRef.current) return;
|
|
92
80
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
93
81
|
timerRef.current = window.setTimeout(() => {
|
|
94
|
-
onChange(
|
|
82
|
+
onChange(lexicalStateToMarkdown(editorState.toJSON()));
|
|
95
83
|
}, 300);
|
|
96
84
|
}, [onChange]);
|
|
97
85
|
const handleFocus = React.useCallback(() => {
|
|
@@ -117,7 +105,6 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
|
|
|
117
105
|
/* @__PURE__ */ jsx(OnChangePlugin, { onChange: handleChange }),
|
|
118
106
|
/* @__PURE__ */ jsx(ExternalStateSync, { externalState }),
|
|
119
107
|
/* @__PURE__ */ jsx(EscapeHandler, {}),
|
|
120
|
-
activateRef && /* @__PURE__ */ jsx(ActivateHandler, { activateRef }),
|
|
121
108
|
/* @__PURE__ */ jsx(FocusBlurHandler, {
|
|
122
109
|
onFocus: handleFocus,
|
|
123
110
|
onBlur: handleBlur
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/SidebarLexicalEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SidebarLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/SidebarLexicalEditor.tsx"],"names":[],"mappings":"AAaA,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AA6CD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,GACP,EAAE,yBAAyB,2CAoD3B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
|
|
2
|
+
import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
|
|
3
|
+
import { INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, cn } from "../../../lib/utils.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
7
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
9
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
10
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
11
|
+
//#region src/core/components/lexical/SidebarLexicalEditor.tsx
|
|
12
|
+
function ExternalStateSync({ value, isSyncingRef }) {
|
|
13
|
+
const [editor] = useLexicalComposerContext();
|
|
14
|
+
const isFocusedRef = React.useRef(false);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
return editor.registerRootListener((root) => {
|
|
17
|
+
if (!root) return;
|
|
18
|
+
const handleFocus = () => {
|
|
19
|
+
isFocusedRef.current = true;
|
|
20
|
+
};
|
|
21
|
+
const handleBlur = () => {
|
|
22
|
+
isFocusedRef.current = false;
|
|
23
|
+
};
|
|
24
|
+
root.addEventListener("focus", handleFocus);
|
|
25
|
+
root.addEventListener("blur", handleBlur);
|
|
26
|
+
return () => {
|
|
27
|
+
root.removeEventListener("focus", handleFocus);
|
|
28
|
+
root.removeEventListener("blur", handleBlur);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}, [editor]);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (isFocusedRef.current) return;
|
|
34
|
+
try {
|
|
35
|
+
const normalized = normalizeLexicalState(value);
|
|
36
|
+
const newState = editor.parseEditorState(normalized);
|
|
37
|
+
isSyncingRef.current = true;
|
|
38
|
+
editor.setEditorState(newState);
|
|
39
|
+
} catch {}
|
|
40
|
+
}, [
|
|
41
|
+
editor,
|
|
42
|
+
value,
|
|
43
|
+
isSyncingRef
|
|
44
|
+
]);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function SidebarLexicalEditor({ value, onChange, onFocus, onBlur }) {
|
|
48
|
+
const timerRef = React.useRef(null);
|
|
49
|
+
const onChangeRef = React.useRef(onChange);
|
|
50
|
+
onChangeRef.current = onChange;
|
|
51
|
+
const isSyncingRef = React.useRef(false);
|
|
52
|
+
const config = React.useMemo(() => createEditorConfig(value), []);
|
|
53
|
+
const handleChange = React.useCallback((editorState) => {
|
|
54
|
+
if (isSyncingRef.current) {
|
|
55
|
+
isSyncingRef.current = false;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
59
|
+
timerRef.current = window.setTimeout(() => {
|
|
60
|
+
onChangeRef.current(lexicalStateToMarkdown(editorState.toJSON()));
|
|
61
|
+
}, 300);
|
|
62
|
+
}, []);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
return () => {
|
|
65
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
66
|
+
};
|
|
67
|
+
}, []);
|
|
68
|
+
return /* @__PURE__ */ jsxs(LexicalComposer, {
|
|
69
|
+
initialConfig: config,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(RichTextPlugin, {
|
|
72
|
+
contentEditable: /* @__PURE__ */ jsx(ContentEditable, {
|
|
73
|
+
className: cn(INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, "flex min-h-[80px] w-full px-3 py-2"),
|
|
74
|
+
onFocus,
|
|
75
|
+
onBlur
|
|
76
|
+
}),
|
|
77
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx(OnChangePlugin, { onChange: handleChange }),
|
|
80
|
+
/* @__PURE__ */ jsx(ExternalStateSync, {
|
|
81
|
+
value,
|
|
82
|
+
isSyncingRef
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function LexicalErrorBoundary({ children }) {
|
|
88
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { SidebarLexicalEditor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
2
|
-
export declare function normalizeLexicalState(value: string): string;
|
|
3
|
-
export declare function createEditorConfig(initialState: string | undefined): InitialConfigType;
|
|
2
|
+
export declare function normalizeLexicalState(value: string | Record<string, unknown>): string;
|
|
3
|
+
export declare function createEditorConfig(initialState: string | Record<string, unknown> | undefined): InitialConfigType;
|
|
4
4
|
//# sourceMappingURL=editorConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/editorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"editorConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/editorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CASrF;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzD,iBAAiB,CAgBnB"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { isLexicalState,
|
|
1
|
+
import { isLexicalState, markdownToLexicalState } from "../../lib/lexicalState.js";
|
|
2
2
|
import { InlineParagraphNode } from "./InlineParagraphNode.js";
|
|
3
3
|
import { ParagraphNode } from "lexical";
|
|
4
4
|
//#region src/core/components/lexical/editorConfig.ts
|
|
5
5
|
function normalizeLexicalState(value) {
|
|
6
|
+
if (typeof value === "object") {
|
|
7
|
+
if (isLexicalState(value)) return JSON.stringify(value);
|
|
8
|
+
return JSON.stringify(markdownToLexicalState(""));
|
|
9
|
+
}
|
|
6
10
|
if (isLexicalState(value)) return value;
|
|
7
|
-
return
|
|
11
|
+
return JSON.stringify(markdownToLexicalState(value));
|
|
8
12
|
}
|
|
9
13
|
function createEditorConfig(initialState) {
|
|
10
14
|
return {
|
package/dist/core/createApp.d.ts
CHANGED
|
@@ -131,12 +131,36 @@ export declare function createApp({ blocks, layouts }: CreateAppOptions): {
|
|
|
131
131
|
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
132
132
|
required: string[];
|
|
133
133
|
} | undefined;
|
|
134
|
+
getInitialBundle: () => {
|
|
135
|
+
content: Record<string, unknown>;
|
|
136
|
+
settings: {
|
|
137
|
+
[x: string]: unknown;
|
|
138
|
+
};
|
|
139
|
+
repeatableItems: import('./createBlock').RepeatableItemSeed[];
|
|
140
|
+
};
|
|
134
141
|
getInitialContent: () => {
|
|
135
142
|
[x: string]: unknown;
|
|
136
143
|
};
|
|
137
144
|
getInitialSettings: () => {
|
|
138
145
|
[x: string]: unknown;
|
|
139
146
|
};
|
|
147
|
+
getPeekBundle: () => {
|
|
148
|
+
block: {
|
|
149
|
+
id: number;
|
|
150
|
+
pageId: null;
|
|
151
|
+
layoutId: null;
|
|
152
|
+
type: string;
|
|
153
|
+
content: Record<string, unknown>;
|
|
154
|
+
settings: Record<string, unknown>;
|
|
155
|
+
placement: null;
|
|
156
|
+
summary: string;
|
|
157
|
+
position: string;
|
|
158
|
+
createdAt: number;
|
|
159
|
+
updatedAt: number;
|
|
160
|
+
};
|
|
161
|
+
repeatableItems: import('./createBlock').PeekItem[];
|
|
162
|
+
files: never[];
|
|
163
|
+
};
|
|
140
164
|
layoutOnly: boolean;
|
|
141
165
|
}[];
|
|
142
166
|
getBlockById(id: string): {
|
|
@@ -265,12 +289,36 @@ export declare function createApp({ blocks, layouts }: CreateAppOptions): {
|
|
|
265
289
|
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
266
290
|
required: string[];
|
|
267
291
|
} | undefined;
|
|
292
|
+
getInitialBundle: () => {
|
|
293
|
+
content: Record<string, unknown>;
|
|
294
|
+
settings: {
|
|
295
|
+
[x: string]: unknown;
|
|
296
|
+
};
|
|
297
|
+
repeatableItems: import('./createBlock').RepeatableItemSeed[];
|
|
298
|
+
};
|
|
268
299
|
getInitialContent: () => {
|
|
269
300
|
[x: string]: unknown;
|
|
270
301
|
};
|
|
271
302
|
getInitialSettings: () => {
|
|
272
303
|
[x: string]: unknown;
|
|
273
304
|
};
|
|
305
|
+
getPeekBundle: () => {
|
|
306
|
+
block: {
|
|
307
|
+
id: number;
|
|
308
|
+
pageId: null;
|
|
309
|
+
layoutId: null;
|
|
310
|
+
type: string;
|
|
311
|
+
content: Record<string, unknown>;
|
|
312
|
+
settings: Record<string, unknown>;
|
|
313
|
+
placement: null;
|
|
314
|
+
summary: string;
|
|
315
|
+
position: string;
|
|
316
|
+
createdAt: number;
|
|
317
|
+
updatedAt: number;
|
|
318
|
+
};
|
|
319
|
+
repeatableItems: import('./createBlock').PeekItem[];
|
|
320
|
+
files: never[];
|
|
321
|
+
};
|
|
274
322
|
layoutOnly: boolean;
|
|
275
323
|
} | undefined;
|
|
276
324
|
getLayouts(): {
|
|
@@ -287,13 +335,39 @@ export declare function createApp({ blocks, layouts }: CreateAppOptions): {
|
|
|
287
335
|
type: string;
|
|
288
336
|
content: Record<string, unknown>;
|
|
289
337
|
settings: Record<string, unknown>;
|
|
338
|
+
repeatableItems: {
|
|
339
|
+
tempId: string;
|
|
340
|
+
parentTempId: string | null;
|
|
341
|
+
fieldName: string;
|
|
342
|
+
content: Record<string, unknown>;
|
|
343
|
+
position: string;
|
|
344
|
+
}[];
|
|
290
345
|
placement: "before";
|
|
291
346
|
} | {
|
|
292
347
|
type: string;
|
|
293
348
|
content: Record<string, unknown>;
|
|
294
349
|
settings: Record<string, unknown>;
|
|
350
|
+
repeatableItems: {
|
|
351
|
+
tempId: string;
|
|
352
|
+
parentTempId: string | null;
|
|
353
|
+
fieldName: string;
|
|
354
|
+
content: Record<string, unknown>;
|
|
355
|
+
position: string;
|
|
356
|
+
}[];
|
|
295
357
|
placement: "after";
|
|
296
358
|
})[];
|
|
359
|
+
initialBlockBundles: {
|
|
360
|
+
type: string;
|
|
361
|
+
content: Record<string, unknown>;
|
|
362
|
+
settings: Record<string, unknown>;
|
|
363
|
+
repeatableItems: {
|
|
364
|
+
tempId: string;
|
|
365
|
+
parentTempId: string | null;
|
|
366
|
+
fieldName: string;
|
|
367
|
+
content: Record<string, unknown>;
|
|
368
|
+
position: string;
|
|
369
|
+
}[];
|
|
370
|
+
}[] | undefined;
|
|
297
371
|
component: import('react').ComponentType<{
|
|
298
372
|
children: React.ReactNode;
|
|
299
373
|
}>;
|
|
@@ -317,13 +391,39 @@ export declare function createApp({ blocks, layouts }: CreateAppOptions): {
|
|
|
317
391
|
type: string;
|
|
318
392
|
content: Record<string, unknown>;
|
|
319
393
|
settings: Record<string, unknown>;
|
|
394
|
+
repeatableItems: {
|
|
395
|
+
tempId: string;
|
|
396
|
+
parentTempId: string | null;
|
|
397
|
+
fieldName: string;
|
|
398
|
+
content: Record<string, unknown>;
|
|
399
|
+
position: string;
|
|
400
|
+
}[];
|
|
320
401
|
placement: "before";
|
|
321
402
|
} | {
|
|
322
403
|
type: string;
|
|
323
404
|
content: Record<string, unknown>;
|
|
324
405
|
settings: Record<string, unknown>;
|
|
406
|
+
repeatableItems: {
|
|
407
|
+
tempId: string;
|
|
408
|
+
parentTempId: string | null;
|
|
409
|
+
fieldName: string;
|
|
410
|
+
content: Record<string, unknown>;
|
|
411
|
+
position: string;
|
|
412
|
+
}[];
|
|
325
413
|
placement: "after";
|
|
326
414
|
})[];
|
|
415
|
+
initialBlockBundles: {
|
|
416
|
+
type: string;
|
|
417
|
+
content: Record<string, unknown>;
|
|
418
|
+
settings: Record<string, unknown>;
|
|
419
|
+
repeatableItems: {
|
|
420
|
+
tempId: string;
|
|
421
|
+
parentTempId: string | null;
|
|
422
|
+
fieldName: string;
|
|
423
|
+
content: Record<string, unknown>;
|
|
424
|
+
position: string;
|
|
425
|
+
}[];
|
|
426
|
+
}[] | undefined;
|
|
327
427
|
component: import('react').ComponentType<{
|
|
328
428
|
children: React.ReactNode;
|
|
329
429
|
}>;
|
|
@@ -359,14 +459,44 @@ export declare function createApp({ blocks, layouts }: CreateAppOptions): {
|
|
|
359
459
|
type: string;
|
|
360
460
|
content: Record<string, unknown>;
|
|
361
461
|
settings: Record<string, unknown>;
|
|
462
|
+
repeatableItems: {
|
|
463
|
+
tempId: string;
|
|
464
|
+
parentTempId: string | null;
|
|
465
|
+
fieldName: string;
|
|
466
|
+
content: Record<string, unknown>;
|
|
467
|
+
position: string;
|
|
468
|
+
}[];
|
|
362
469
|
placement: "before";
|
|
363
470
|
} | {
|
|
364
471
|
type: string;
|
|
365
472
|
content: Record<string, unknown>;
|
|
366
473
|
settings: Record<string, unknown>;
|
|
474
|
+
repeatableItems: {
|
|
475
|
+
tempId: string;
|
|
476
|
+
parentTempId: string | null;
|
|
477
|
+
fieldName: string;
|
|
478
|
+
content: Record<string, unknown>;
|
|
479
|
+
position: string;
|
|
480
|
+
}[];
|
|
367
481
|
placement: "after";
|
|
368
482
|
})[];
|
|
369
483
|
}[];
|
|
484
|
+
getInitialPageBundles(): {
|
|
485
|
+
layoutId: string;
|
|
486
|
+
blocks: {
|
|
487
|
+
type: string;
|
|
488
|
+
content: Record<string, unknown>;
|
|
489
|
+
settings: Record<string, unknown>;
|
|
490
|
+
repeatableItems: {
|
|
491
|
+
tempId: string;
|
|
492
|
+
parentTempId: string | null;
|
|
493
|
+
fieldName: string;
|
|
494
|
+
content: Record<string, unknown>;
|
|
495
|
+
position: string;
|
|
496
|
+
}[];
|
|
497
|
+
}[];
|
|
498
|
+
hasInitialBlocks: boolean;
|
|
499
|
+
} | null;
|
|
370
500
|
};
|
|
371
501
|
export type CamoxApp = ReturnType<typeof createApp>;
|
|
372
502
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../../src/core/createApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAY,EAAE,EAAE,gBAAgB
|
|
1
|
+
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../../src/core/createApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAY,EAAE,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAyB/C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAML,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B3B;AAED,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
package/dist/core/createApp.js
CHANGED
|
@@ -4,6 +4,11 @@ function createApp({ blocks, layouts = [] }) {
|
|
|
4
4
|
const layoutsMap = /* @__PURE__ */ new Map();
|
|
5
5
|
for (const block of blocks) blocksMap.set(block.id, block);
|
|
6
6
|
for (const layout of layouts) layoutsMap.set(layout.id, layout);
|
|
7
|
+
const layoutsWithInitialBlocks = layouts.filter((l) => l.initialBlockBundles);
|
|
8
|
+
if (layoutsWithInitialBlocks.length > 1) {
|
|
9
|
+
const ids = layoutsWithInitialBlocks.map((l) => `"${l.id}"`).join(", ");
|
|
10
|
+
throw new Error(`[camox] Only one layout can define initialBlocks, but found ${layoutsWithInitialBlocks.length}: ${ids}`);
|
|
11
|
+
}
|
|
7
12
|
return {
|
|
8
13
|
getBlocks() {
|
|
9
14
|
return Array.from(blocksMap.values());
|
|
@@ -33,6 +38,21 @@ function createApp({ blocks, layouts = [] }) {
|
|
|
33
38
|
description: layout.description,
|
|
34
39
|
blocks: layout.blockDefinitions
|
|
35
40
|
}));
|
|
41
|
+
},
|
|
42
|
+
getInitialPageBundles() {
|
|
43
|
+
const layout = layoutsWithInitialBlocks[0];
|
|
44
|
+
if (layout) return {
|
|
45
|
+
layoutId: layout.id,
|
|
46
|
+
blocks: layout.initialBlockBundles,
|
|
47
|
+
hasInitialBlocks: true
|
|
48
|
+
};
|
|
49
|
+
const fallback = layouts[0];
|
|
50
|
+
if (!fallback) return null;
|
|
51
|
+
return {
|
|
52
|
+
layoutId: fallback.id,
|
|
53
|
+
blocks: [],
|
|
54
|
+
hasInitialBlocks: false
|
|
55
|
+
};
|
|
36
56
|
}
|
|
37
57
|
};
|
|
38
58
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Type as TypeBoxType, TSchema, Static } from '@sinclair/typebox';
|
|
2
|
-
import { Id } from 'camox/server/dataModel';
|
|
3
2
|
import { Type, EmbedURL, LinkValue, ImageValue, FileValue, ExtractAllPlaceholders } from './lib/contentType.ts';
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
export { Type };
|
|
@@ -18,12 +17,12 @@ interface CreateBlockOptions<TSchemaShape extends Record<string, TSchema> = Reco
|
|
|
18
17
|
/**
|
|
19
18
|
* Schema defining the structure of the block's editable content.
|
|
20
19
|
* All fields must have default values.
|
|
21
|
-
* Use Type.String() and Type.
|
|
20
|
+
* Use Type.String() and Type.RepeatableItem() to define the schema.
|
|
22
21
|
*
|
|
23
22
|
* @example
|
|
24
23
|
* content: {
|
|
25
24
|
* title: Type.String({ default: 'Hello' }),
|
|
26
|
-
* items: Type.
|
|
25
|
+
* items: Type.RepeatableItem({
|
|
27
26
|
* name: Type.String({ default: 'Item' })
|
|
28
27
|
* }, { minItems: 1, maxItems: 10 })
|
|
29
28
|
* }
|
|
@@ -66,7 +65,7 @@ interface CreateBlockOptions<TSchemaShape extends Record<string, TSchema> = Reco
|
|
|
66
65
|
}>;
|
|
67
66
|
}
|
|
68
67
|
interface BlockData<TContent> {
|
|
69
|
-
_id:
|
|
68
|
+
_id: string;
|
|
70
69
|
type: string;
|
|
71
70
|
content: TContent;
|
|
72
71
|
settings?: Record<string, unknown>;
|
|
@@ -80,6 +79,24 @@ export interface BlockComponentProps<TContent> {
|
|
|
80
79
|
showAddBlockBottom?: boolean;
|
|
81
80
|
addBlockAfterPosition?: string | null;
|
|
82
81
|
}
|
|
82
|
+
export interface PeekItem {
|
|
83
|
+
id: number;
|
|
84
|
+
blockId: number;
|
|
85
|
+
parentItemId: number | null;
|
|
86
|
+
fieldName: string;
|
|
87
|
+
content: unknown;
|
|
88
|
+
summary: string;
|
|
89
|
+
position: string;
|
|
90
|
+
createdAt: number;
|
|
91
|
+
updatedAt: number;
|
|
92
|
+
}
|
|
93
|
+
export interface RepeatableItemSeed {
|
|
94
|
+
tempId: string;
|
|
95
|
+
parentTempId: string | null;
|
|
96
|
+
fieldName: string;
|
|
97
|
+
content: Record<string, unknown>;
|
|
98
|
+
position: string;
|
|
99
|
+
}
|
|
83
100
|
export declare function createBlock<TSchemaShape extends Record<string, TSchema>, TSettingsShape extends Record<string, TSchema> = Record<string, never>, const TMarkdown extends readonly string[] = readonly string[]>(options: CreateBlockOptions<TSchemaShape, TSettingsShape, TMarkdown>): {
|
|
84
101
|
/**
|
|
85
102
|
* The react component to be used at the page level when mapping on blocks content.
|
|
@@ -929,6 +946,13 @@ export declare function createBlock<TSchemaShape extends Record<string, TSchema>
|
|
|
929
946
|
properties: TSettingsShape;
|
|
930
947
|
required: string[];
|
|
931
948
|
} | undefined;
|
|
949
|
+
getInitialBundle: () => {
|
|
950
|
+
content: Record<string, unknown>;
|
|
951
|
+
settings: {
|
|
952
|
+
[x: string]: unknown;
|
|
953
|
+
};
|
|
954
|
+
repeatableItems: RepeatableItemSeed[];
|
|
955
|
+
};
|
|
932
956
|
getInitialContent: () => import('@sinclair/typebox').Evaluate<Readonly<Partial<Pick<{ [K in keyof TSchemaShape]: (TSchemaShape[K] & {
|
|
933
957
|
params: unknown[] & [];
|
|
934
958
|
})["static"]; }, { [K_1 in keyof TSchemaShape]: TSchemaShape[K_1] extends import('@sinclair/typebox').TReadonly<TSchema> ? TSchemaShape[K_1] extends import('@sinclair/typebox').TOptional<TSchemaShape[K_1]> ? K_1 : never : never; }[keyof TSchemaShape]>>> & Readonly<Pick<{ [K in keyof TSchemaShape]: (TSchemaShape[K] & {
|
|
@@ -941,6 +965,23 @@ export declare function createBlock<TSchemaShape extends Record<string, TSchema>
|
|
|
941
965
|
getInitialSettings: () => {
|
|
942
966
|
[x: string]: unknown;
|
|
943
967
|
};
|
|
968
|
+
getPeekBundle: () => {
|
|
969
|
+
block: {
|
|
970
|
+
id: number;
|
|
971
|
+
pageId: null;
|
|
972
|
+
layoutId: null;
|
|
973
|
+
type: string;
|
|
974
|
+
content: Record<string, unknown>;
|
|
975
|
+
settings: Record<string, unknown>;
|
|
976
|
+
placement: null;
|
|
977
|
+
summary: string;
|
|
978
|
+
position: string;
|
|
979
|
+
createdAt: number;
|
|
980
|
+
updatedAt: number;
|
|
981
|
+
};
|
|
982
|
+
repeatableItems: PeekItem[];
|
|
983
|
+
files: never[];
|
|
984
|
+
};
|
|
944
985
|
layoutOnly: boolean;
|
|
945
986
|
};
|
|
946
987
|
export type Block = ReturnType<typeof createBlock>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBlock.d.ts","sourceRoot":"","sources":["../../src/core/createBlock.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|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