camox 0.0.0 → 0.1.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +110 -0
- package/dist/components/AuthGate.d.ts +7 -0
- package/dist/components/AuthGate.d.ts.map +1 -0
- package/dist/core/components/AddBlockControlBar.d.ts +9 -0
- package/dist/core/components/AddBlockControlBar.d.ts.map +1 -0
- package/dist/core/components/AddBlockControlBar.js +65 -0
- package/dist/core/components/lexical/InlineContentEditable.d.ts +7 -0
- package/dist/core/components/lexical/InlineContentEditable.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineContentEditable.js +40 -0
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts +12 -0
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +133 -0
- package/dist/core/components/lexical/InlineParagraphNode.d.ts +10 -0
- package/dist/core/components/lexical/InlineParagraphNode.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineParagraphNode.js +34 -0
- package/dist/core/components/lexical/SelectionBroadcaster.d.ts +6 -0
- package/dist/core/components/lexical/SelectionBroadcaster.d.ts.map +1 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +62 -0
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts +9 -0
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts.map +1 -0
- package/dist/core/components/lexical/editorConfig.d.ts +4 -0
- package/dist/core/components/lexical/editorConfig.d.ts.map +1 -0
- package/dist/core/components/lexical/editorConfig.js +24 -0
- package/dist/core/createApp.d.ts +373 -0
- package/dist/core/createApp.d.ts.map +1 -0
- package/dist/core/createApp.js +40 -0
- package/dist/core/createBlock.d.ts +947 -0
- package/dist/core/createBlock.d.ts.map +1 -0
- package/dist/core/createBlock.js +873 -0
- package/dist/core/createLayout.d.ts +78 -0
- package/dist/core/createLayout.d.ts.map +1 -0
- package/dist/core/createLayout.js +73 -0
- package/dist/core/hooks/useFieldSelection.d.ts +11 -0
- package/dist/core/hooks/useFieldSelection.d.ts.map +1 -0
- package/dist/core/hooks/useFieldSelection.js +25 -0
- package/dist/core/hooks/useIsEditable.d.ts +2 -0
- package/dist/core/hooks/useIsEditable.d.ts.map +1 -0
- package/dist/core/hooks/useIsEditable.js +12 -0
- package/dist/core/hooks/useOverlayMessage.d.ts +10 -0
- package/dist/core/hooks/useOverlayMessage.d.ts.map +1 -0
- package/dist/core/hooks/useOverlayMessage.js +37 -0
- package/dist/core/lib/contentType.d.ts +165 -0
- package/dist/core/lib/contentType.d.ts.map +1 -0
- package/dist/core/lib/contentType.js +148 -0
- package/dist/core/lib/fieldTypes.d.ts +85 -0
- package/dist/core/lib/fieldTypes.d.ts.map +1 -0
- package/dist/core/lib/lexicalReact.d.ts +3 -0
- package/dist/core/lib/lexicalReact.d.ts.map +1 -0
- package/dist/core/lib/lexicalReact.js +24 -0
- package/dist/core/lib/lexicalState.d.ts +10 -0
- package/dist/core/lib/lexicalState.d.ts.map +1 -0
- package/dist/core/lib/lexicalState.js +38 -0
- package/dist/core/lib/modifierFormats.d.ts +9 -0
- package/dist/core/lib/modifierFormats.d.ts.map +1 -0
- package/dist/core/lib/modifierFormats.js +8 -0
- package/dist/core/lib/modifiers.d.ts +12 -0
- package/dist/core/lib/modifiers.d.ts.map +1 -0
- package/dist/core/lib/modifiers.js +27 -0
- package/dist/features/content/CamoxContent.d.ts +2 -0
- package/dist/features/content/CamoxContent.d.ts.map +1 -0
- package/dist/features/content/CamoxContent.js +100 -0
- package/dist/features/content/components/AssetCard.d.ts +10 -0
- package/dist/features/content/components/AssetCard.d.ts.map +1 -0
- package/dist/features/content/components/AssetCard.js +41 -0
- package/dist/features/content/components/AssetCardSkeleton.d.ts +2 -0
- package/dist/features/content/components/AssetCardSkeleton.d.ts.map +1 -0
- package/dist/features/content/components/AssetCardSkeleton.js +11 -0
- package/dist/features/content/components/ContentSidebar.d.ts +2 -0
- package/dist/features/content/components/ContentSidebar.d.ts.map +1 -0
- package/dist/features/content/components/ContentSidebar.js +15 -0
- package/dist/features/content/components/UploadDropZone.d.ts +9 -0
- package/dist/features/content/components/UploadDropZone.d.ts.map +1 -0
- package/dist/features/content/components/UploadDropZone.js +51 -0
- package/dist/features/content/components/UploadProgressDrawer.d.ts +11 -0
- package/dist/features/content/components/UploadProgressDrawer.d.ts.map +1 -0
- package/dist/features/content/components/UploadProgressDrawer.js +72 -0
- package/dist/features/preview/CamoxPreview.d.ts +124 -0
- package/dist/features/preview/CamoxPreview.d.ts.map +1 -0
- package/dist/features/preview/CamoxPreview.js +253 -0
- package/dist/features/preview/components/AddBlockSheet.d.ts +3 -0
- package/dist/features/preview/components/AddBlockSheet.d.ts.map +1 -0
- package/dist/features/preview/components/AddBlockSheet.js +121 -0
- package/dist/features/preview/components/AgentChatSheet.d.ts +3 -0
- package/dist/features/preview/components/AgentChatSheet.d.ts.map +1 -0
- package/dist/features/preview/components/AgentChatSheet.js +24 -0
- package/dist/features/preview/components/AssetFieldEditor.d.ts +18 -0
- package/dist/features/preview/components/AssetFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/AssetFieldEditor.js +139 -0
- package/dist/features/preview/components/AssetLightbox.d.ts +9 -0
- package/dist/features/preview/components/AssetLightbox.d.ts.map +1 -0
- package/dist/features/preview/components/AssetLightbox.js +421 -0
- package/dist/features/preview/components/AssetPickerGrid.d.ts +11 -0
- package/dist/features/preview/components/AssetPickerGrid.d.ts.map +1 -0
- package/dist/features/preview/components/AssetPickerGrid.js +92 -0
- package/dist/features/preview/components/BlockActionsPopover.d.ts +15 -0
- package/dist/features/preview/components/BlockActionsPopover.d.ts.map +1 -0
- package/dist/features/preview/components/BlockActionsPopover.js +506 -0
- package/dist/features/preview/components/CreatePageSheet.d.ts +3 -0
- package/dist/features/preview/components/CreatePageSheet.d.ts.map +1 -0
- package/dist/features/preview/components/CreatePageSheet.js +159 -0
- package/dist/features/preview/components/DebouncedFieldEditor.d.ts +10 -0
- package/dist/features/preview/components/DebouncedFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/DebouncedFieldEditor.js +51 -0
- package/dist/features/preview/components/EditPageSheet.d.ts +3 -0
- package/dist/features/preview/components/EditPageSheet.d.ts.map +1 -0
- package/dist/features/preview/components/EditPageSheet.js +352 -0
- package/dist/features/preview/components/ItemFieldsEditor.d.ts +29 -0
- package/dist/features/preview/components/ItemFieldsEditor.d.ts.map +1 -0
- package/dist/features/preview/components/ItemFieldsEditor.js +308 -0
- package/dist/features/preview/components/LinkFieldEditor.d.ts +8 -0
- package/dist/features/preview/components/LinkFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/LinkFieldEditor.js +190 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts +10 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +232 -0
- package/dist/features/preview/components/OverlayTracker.d.ts +6 -0
- package/dist/features/preview/components/OverlayTracker.d.ts.map +1 -0
- package/dist/features/preview/components/OverlayTracker.js +41 -0
- package/dist/features/preview/components/Overlays.d.ts +6 -0
- package/dist/features/preview/components/Overlays.d.ts.map +1 -0
- package/dist/features/preview/components/Overlays.js +58 -0
- package/dist/features/preview/components/PageContentSheet.d.ts +3 -0
- package/dist/features/preview/components/PageContentSheet.d.ts.map +1 -0
- package/dist/features/preview/components/PageContentSheet.js +492 -0
- package/dist/features/preview/components/PageLocationFieldset.d.ts +14 -0
- package/dist/features/preview/components/PageLocationFieldset.d.ts.map +1 -0
- package/dist/features/preview/components/PageLocationFieldset.js +77 -0
- package/dist/features/preview/components/PagePicker.d.ts +3 -0
- package/dist/features/preview/components/PagePicker.d.ts.map +1 -0
- package/dist/features/preview/components/PagePicker.js +185 -0
- package/dist/features/preview/components/PageTree.d.ts +3 -0
- package/dist/features/preview/components/PageTree.d.ts.map +1 -0
- package/dist/features/preview/components/PageTree.js +410 -0
- package/dist/features/preview/components/PeekedBlock.d.ts +6 -0
- package/dist/features/preview/components/PeekedBlock.d.ts.map +1 -0
- package/dist/features/preview/components/PeekedBlock.js +95 -0
- package/dist/features/preview/components/PreviewPanel.d.ts +12 -0
- package/dist/features/preview/components/PreviewPanel.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewPanel.js +192 -0
- package/dist/features/preview/components/PreviewSideSheet.d.ts +13 -0
- package/dist/features/preview/components/PreviewSideSheet.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewSideSheet.js +28 -0
- package/dist/features/preview/components/PreviewToolbar.d.ts +2 -0
- package/dist/features/preview/components/PreviewToolbar.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewToolbar.js +79 -0
- package/dist/features/preview/components/RepeatableItemsList.d.ts +14 -0
- package/dist/features/preview/components/RepeatableItemsList.d.ts.map +1 -0
- package/dist/features/preview/components/RepeatableItemsList.js +366 -0
- package/dist/features/preview/components/ShikiMarkdown.d.ts +4 -0
- package/dist/features/preview/components/ShikiMarkdown.d.ts.map +1 -0
- package/dist/features/preview/components/ShikiMarkdown.js +37 -0
- package/dist/features/preview/components/TextFormatToolbar.d.ts +2 -0
- package/dist/features/preview/components/TextFormatToolbar.d.ts.map +1 -0
- package/dist/features/preview/components/TextFormatToolbar.js +73 -0
- package/dist/features/preview/components/UnlinkAssetButton.d.ts +9 -0
- package/dist/features/preview/components/UnlinkAssetButton.d.ts.map +1 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +55 -0
- package/dist/features/preview/overlayConstants.d.ts +19 -0
- package/dist/features/preview/overlayConstants.d.ts.map +1 -0
- package/dist/features/preview/overlayConstants.js +21 -0
- package/dist/features/preview/overlayMessages.d.ts +62 -0
- package/dist/features/preview/overlayMessages.d.ts.map +1 -0
- package/dist/features/preview/overlayMessages.js +9 -0
- package/dist/features/preview/previewConstants.d.ts +2 -0
- package/dist/features/preview/previewConstants.d.ts.map +1 -0
- package/dist/features/preview/previewStore.d.ts +116 -0
- package/dist/features/preview/previewStore.d.ts.map +1 -0
- package/dist/features/preview/previewStore.js +321 -0
- package/dist/features/provider/CamoxProvider.d.ts +11 -0
- package/dist/features/provider/CamoxProvider.d.ts.map +1 -0
- package/dist/features/provider/CamoxProvider.js +73 -0
- package/dist/features/provider/actionsStore.d.ts +39 -0
- package/dist/features/provider/actionsStore.d.ts.map +1 -0
- package/dist/features/provider/actionsStore.js +35 -0
- package/dist/features/provider/components/CamoxAppContext.d.ts +371 -0
- package/dist/features/provider/components/CamoxAppContext.d.ts.map +1 -0
- package/dist/features/provider/components/CamoxAppContext.js +17 -0
- package/dist/features/provider/components/CommandPalette.d.ts +3 -0
- package/dist/features/provider/components/CommandPalette.d.ts.map +1 -0
- package/dist/features/provider/components/CommandPalette.js +127 -0
- package/dist/features/provider/useAdminShortcuts.d.ts +5 -0
- package/dist/features/provider/useAdminShortcuts.d.ts.map +1 -0
- package/dist/features/provider/useAdminShortcuts.js +83 -0
- package/dist/features/routes/ogRoute.d.ts +7 -0
- package/dist/features/routes/ogRoute.d.ts.map +1 -0
- package/dist/features/routes/ogRoute.js +19 -0
- package/dist/features/routes/pageRoute.d.ts +135 -0
- package/dist/features/routes/pageRoute.d.ts.map +1 -0
- package/dist/features/routes/pageRoute.js +112 -0
- package/dist/features/studio/CamoxStudio.d.ts +7 -0
- package/dist/features/studio/CamoxStudio.d.ts.map +1 -0
- package/dist/features/studio/CamoxStudio.js +24 -0
- package/dist/features/studio/components/Navbar.d.ts +4 -0
- package/dist/features/studio/components/Navbar.d.ts.map +1 -0
- package/dist/features/studio/components/Navbar.js +95 -0
- package/dist/features/studio/components/ProjectMenu.d.ts +2 -0
- package/dist/features/studio/components/ProjectMenu.d.ts.map +1 -0
- package/dist/features/studio/components/ProjectMenu.js +132 -0
- package/dist/features/studio/components/UserButton.d.ts +2 -0
- package/dist/features/studio/components/UserButton.d.ts.map +1 -0
- package/dist/features/studio/components/UserButton.js +96 -0
- package/dist/features/studio/studioStore.d.ts +17 -0
- package/dist/features/studio/studioStore.d.ts.map +1 -0
- package/dist/features/studio/studioStore.js +44 -0
- package/dist/features/studio/useTheme.d.ts +9 -0
- package/dist/features/studio/useTheme.d.ts.map +1 -0
- package/dist/features/studio/useTheme.js +98 -0
- package/dist/features/vite/appGeneration.d.ts +4 -0
- package/dist/features/vite/appGeneration.d.ts.map +1 -0
- package/dist/features/vite/appGeneration.js +67 -0
- package/dist/features/vite/blockBoilerplate.d.ts +3 -0
- package/dist/features/vite/blockBoilerplate.d.ts.map +1 -0
- package/dist/features/vite/blockBoilerplate.js +59 -0
- package/dist/features/vite/convexSync.d.ts +6 -0
- package/dist/features/vite/convexSync.d.ts.map +1 -0
- package/dist/features/vite/convexSync.js +98 -0
- package/dist/features/vite/definitionsSync.d.ts +11 -0
- package/dist/features/vite/definitionsSync.d.ts.map +1 -0
- package/dist/features/vite/definitionsSync.js +157 -0
- package/dist/features/vite/routeGeneration.d.ts +4 -0
- package/dist/features/vite/routeGeneration.d.ts.map +1 -0
- package/dist/features/vite/routeGeneration.js +194 -0
- package/dist/features/vite/skillGeneration.d.ts +4 -0
- package/dist/features/vite/skillGeneration.d.ts.map +1 -0
- package/dist/features/vite/skillGeneration.js +69 -0
- package/dist/features/vite/utils.d.ts +2 -0
- package/dist/features/vite/utils.d.ts.map +1 -0
- package/dist/features/vite/utils.js +10 -0
- package/dist/features/vite/vite.d.ts +18 -0
- package/dist/features/vite/vite.d.ts.map +1 -0
- package/dist/features/vite/vite.js +77 -0
- package/dist/hooks/use-file-upload.d.ts +22 -0
- package/dist/hooks/use-file-upload.d.ts.map +1 -0
- package/dist/hooks/use-marquee-selection.d.ts +17 -0
- package/dist/hooks/use-marquee-selection.d.ts.map +1 -0
- package/dist/lib/analytics-client.d.ts +3 -0
- package/dist/lib/analytics-client.d.ts.map +1 -0
- package/dist/lib/analytics.d.ts +3 -0
- package/dist/lib/analytics.d.ts.map +1 -0
- package/dist/lib/analytics.js +24 -0
- package/dist/lib/auth.d.ts +3683 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/convex-site.d.ts +3 -0
- package/dist/lib/convex-site.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +40 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/studio.css +2 -0
- package/package.json +123 -10
- package/server/api.d.ts +1 -0
- package/server/api.js +1 -0
- package/server/dataModel.d.ts +1 -0
- package/server/dataModel.js +1 -0
- package/skills/camox-block/SKILL.md +357 -0
- package/skills/camox-layout/SKILL.md +181 -0
- package/index.js +0 -3
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { CamoxApp } from '../../../core/createApp';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare const CamoxAppProvider: ({ app, children, }: {
|
|
4
|
+
app: CamoxApp;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function useCamoxApp(): {
|
|
8
|
+
getBlocks(): {
|
|
9
|
+
Component: ({ blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition, }: import('../../../core/createBlock').BlockComponentProps<{
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Detached: ({ children }: {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
Field: <K extends never>({ name, children, }: {
|
|
16
|
+
name: K;
|
|
17
|
+
children: (content: React.ReactNode) => React.ReactNode;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
Embed: <K extends never>({ name, children, }: {
|
|
20
|
+
name: K;
|
|
21
|
+
children: (url: string) => React.ReactNode;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
Link: <K extends never>({ name, children, }: {
|
|
24
|
+
name: K;
|
|
25
|
+
children: (link: {
|
|
26
|
+
text: string;
|
|
27
|
+
href: string;
|
|
28
|
+
newTab: boolean;
|
|
29
|
+
}) => React.ReactNode;
|
|
30
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
Image: <K extends never>({ name, children, }: {
|
|
32
|
+
name: K;
|
|
33
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
34
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
File: <K extends never>({ name, children, }: {
|
|
36
|
+
name: K;
|
|
37
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
38
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
Repeater: <K extends never>({ name, children, }: {
|
|
40
|
+
name: K;
|
|
41
|
+
children: (item: {
|
|
42
|
+
Field: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends string ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
43
|
+
name: F;
|
|
44
|
+
children: (content: React.ReactNode) => React.ReactNode;
|
|
45
|
+
}) => React.ReactNode;
|
|
46
|
+
Link: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends import('../../../core/lib/contentType').LinkValue ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
47
|
+
name: F;
|
|
48
|
+
children: (link: {
|
|
49
|
+
text: string;
|
|
50
|
+
href: string;
|
|
51
|
+
newTab: boolean;
|
|
52
|
+
}) => React.ReactNode;
|
|
53
|
+
}) => React.ReactNode;
|
|
54
|
+
Embed: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends import('../../../core/lib/contentType').EmbedURL ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
55
|
+
name: F;
|
|
56
|
+
children: (url: string) => React.ReactNode;
|
|
57
|
+
}) => React.ReactNode;
|
|
58
|
+
Image: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as import('../../../core/lib/contentType').ImageValue extends ({}[K] extends (infer U)[] ? U : never)[F_1] ? ({}[K] extends (infer U)[] ? U : never)[F_1] extends ({}[K] extends (infer U)[] ? U : never)[F_1] & {
|
|
59
|
+
url: string;
|
|
60
|
+
alt: string;
|
|
61
|
+
filename: string;
|
|
62
|
+
mimeType: string;
|
|
63
|
+
_fileId?: string;
|
|
64
|
+
} & {
|
|
65
|
+
readonly __brand: "ImageValue";
|
|
66
|
+
} ? F_1 : never : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
67
|
+
name: F;
|
|
68
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
69
|
+
}) => React.ReactNode;
|
|
70
|
+
File: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as import('../../../core/lib/contentType').FileValue extends ({}[K] extends (infer U)[] ? U : never)[F_1] ? ({}[K] extends (infer U)[] ? U : never)[F_1] extends ({}[K] extends (infer U)[] ? U : never)[F_1] & {
|
|
71
|
+
url: string;
|
|
72
|
+
alt: string;
|
|
73
|
+
filename: string;
|
|
74
|
+
mimeType: string;
|
|
75
|
+
_fileId?: string;
|
|
76
|
+
} & {
|
|
77
|
+
readonly __brand: "FileValue";
|
|
78
|
+
} ? F_1 : never : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
79
|
+
name: F;
|
|
80
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
81
|
+
}) => React.ReactNode;
|
|
82
|
+
Repeater: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends any[] ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
83
|
+
name: F;
|
|
84
|
+
children: (item: {
|
|
85
|
+
Field: (props: {
|
|
86
|
+
name: string;
|
|
87
|
+
children: (content: any) => React.ReactNode;
|
|
88
|
+
}) => React.ReactNode;
|
|
89
|
+
Link: (props: {
|
|
90
|
+
name: string;
|
|
91
|
+
children: (link: {
|
|
92
|
+
text: string;
|
|
93
|
+
href: string;
|
|
94
|
+
newTab: boolean;
|
|
95
|
+
}) => React.ReactNode;
|
|
96
|
+
}) => React.ReactNode;
|
|
97
|
+
Embed: (props: {
|
|
98
|
+
name: string;
|
|
99
|
+
children: (url: string) => React.ReactNode;
|
|
100
|
+
}) => React.ReactNode;
|
|
101
|
+
Image: (props: {
|
|
102
|
+
name: string;
|
|
103
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
104
|
+
}) => React.ReactNode;
|
|
105
|
+
File: (props: {
|
|
106
|
+
name: string;
|
|
107
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
108
|
+
}) => React.ReactNode;
|
|
109
|
+
Repeater: (props: {
|
|
110
|
+
name: string;
|
|
111
|
+
children: (item: any, index: number) => React.ReactNode;
|
|
112
|
+
}) => React.ReactNode;
|
|
113
|
+
}, index: number) => React.ReactNode;
|
|
114
|
+
}) => React.ReactNode;
|
|
115
|
+
}, index: number) => React.ReactNode;
|
|
116
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
117
|
+
useSetting: <K extends string>(name: K) => unknown;
|
|
118
|
+
id: string;
|
|
119
|
+
title: string;
|
|
120
|
+
description: string;
|
|
121
|
+
contentSchema: {
|
|
122
|
+
type: "object";
|
|
123
|
+
title: string;
|
|
124
|
+
description: string;
|
|
125
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
126
|
+
required: string[];
|
|
127
|
+
toMarkdown: readonly string[];
|
|
128
|
+
};
|
|
129
|
+
settingsSchema: {
|
|
130
|
+
type: "object";
|
|
131
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
132
|
+
required: string[];
|
|
133
|
+
} | undefined;
|
|
134
|
+
getInitialContent: () => {
|
|
135
|
+
[x: string]: unknown;
|
|
136
|
+
};
|
|
137
|
+
getInitialSettings: () => {
|
|
138
|
+
[x: string]: unknown;
|
|
139
|
+
};
|
|
140
|
+
layoutOnly: boolean;
|
|
141
|
+
}[];
|
|
142
|
+
getBlockById(id: string): {
|
|
143
|
+
Component: ({ blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition, }: import('../../../core/createBlock').BlockComponentProps<{
|
|
144
|
+
[x: string]: unknown;
|
|
145
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
146
|
+
Detached: ({ children }: {
|
|
147
|
+
children: React.ReactNode;
|
|
148
|
+
}) => React.JSX.Element;
|
|
149
|
+
Field: <K extends never>({ name, children, }: {
|
|
150
|
+
name: K;
|
|
151
|
+
children: (content: React.ReactNode) => React.ReactNode;
|
|
152
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
153
|
+
Embed: <K extends never>({ name, children, }: {
|
|
154
|
+
name: K;
|
|
155
|
+
children: (url: string) => React.ReactNode;
|
|
156
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
157
|
+
Link: <K extends never>({ name, children, }: {
|
|
158
|
+
name: K;
|
|
159
|
+
children: (link: {
|
|
160
|
+
text: string;
|
|
161
|
+
href: string;
|
|
162
|
+
newTab: boolean;
|
|
163
|
+
}) => React.ReactNode;
|
|
164
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
165
|
+
Image: <K extends never>({ name, children, }: {
|
|
166
|
+
name: K;
|
|
167
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
168
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
169
|
+
File: <K extends never>({ name, children, }: {
|
|
170
|
+
name: K;
|
|
171
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
172
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
173
|
+
Repeater: <K extends never>({ name, children, }: {
|
|
174
|
+
name: K;
|
|
175
|
+
children: (item: {
|
|
176
|
+
Field: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends string ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
177
|
+
name: F;
|
|
178
|
+
children: (content: React.ReactNode) => React.ReactNode;
|
|
179
|
+
}) => React.ReactNode;
|
|
180
|
+
Link: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends import('../../../core/lib/contentType').LinkValue ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
181
|
+
name: F;
|
|
182
|
+
children: (link: {
|
|
183
|
+
text: string;
|
|
184
|
+
href: string;
|
|
185
|
+
newTab: boolean;
|
|
186
|
+
}) => React.ReactNode;
|
|
187
|
+
}) => React.ReactNode;
|
|
188
|
+
Embed: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends import('../../../core/lib/contentType').EmbedURL ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
189
|
+
name: F;
|
|
190
|
+
children: (url: string) => React.ReactNode;
|
|
191
|
+
}) => React.ReactNode;
|
|
192
|
+
Image: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as import('../../../core/lib/contentType').ImageValue extends ({}[K] extends (infer U)[] ? U : never)[F_1] ? ({}[K] extends (infer U)[] ? U : never)[F_1] extends ({}[K] extends (infer U)[] ? U : never)[F_1] & {
|
|
193
|
+
url: string;
|
|
194
|
+
alt: string;
|
|
195
|
+
filename: string;
|
|
196
|
+
mimeType: string;
|
|
197
|
+
_fileId?: string;
|
|
198
|
+
} & {
|
|
199
|
+
readonly __brand: "ImageValue";
|
|
200
|
+
} ? F_1 : never : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
201
|
+
name: F;
|
|
202
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
203
|
+
}) => React.ReactNode;
|
|
204
|
+
File: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as import('../../../core/lib/contentType').FileValue extends ({}[K] extends (infer U)[] ? U : never)[F_1] ? ({}[K] extends (infer U)[] ? U : never)[F_1] extends ({}[K] extends (infer U)[] ? U : never)[F_1] & {
|
|
205
|
+
url: string;
|
|
206
|
+
alt: string;
|
|
207
|
+
filename: string;
|
|
208
|
+
mimeType: string;
|
|
209
|
+
_fileId?: string;
|
|
210
|
+
} & {
|
|
211
|
+
readonly __brand: "FileValue";
|
|
212
|
+
} ? F_1 : never : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
213
|
+
name: F;
|
|
214
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
215
|
+
}) => React.ReactNode;
|
|
216
|
+
Repeater: <F extends keyof { [F_1 in keyof ({}[K] extends (infer U)[] ? U : never) as ({}[K] extends (infer U)[] ? U : never)[F_1] extends any[] ? F_1 : never]: ({}[K] extends (infer U)[] ? U : never)[F_1]; }>(props: {
|
|
217
|
+
name: F;
|
|
218
|
+
children: (item: {
|
|
219
|
+
Field: (props: {
|
|
220
|
+
name: string;
|
|
221
|
+
children: (content: any) => React.ReactNode;
|
|
222
|
+
}) => React.ReactNode;
|
|
223
|
+
Link: (props: {
|
|
224
|
+
name: string;
|
|
225
|
+
children: (link: {
|
|
226
|
+
text: string;
|
|
227
|
+
href: string;
|
|
228
|
+
newTab: boolean;
|
|
229
|
+
}) => React.ReactNode;
|
|
230
|
+
}) => React.ReactNode;
|
|
231
|
+
Embed: (props: {
|
|
232
|
+
name: string;
|
|
233
|
+
children: (url: string) => React.ReactNode;
|
|
234
|
+
}) => React.ReactNode;
|
|
235
|
+
Image: (props: {
|
|
236
|
+
name: string;
|
|
237
|
+
children: (image: import('../../../core/lib/contentType').ImageValue) => React.ReactNode;
|
|
238
|
+
}) => React.ReactNode;
|
|
239
|
+
File: (props: {
|
|
240
|
+
name: string;
|
|
241
|
+
children: (file: import('../../../core/lib/contentType').FileValue) => React.ReactNode;
|
|
242
|
+
}) => React.ReactNode;
|
|
243
|
+
Repeater: (props: {
|
|
244
|
+
name: string;
|
|
245
|
+
children: (item: any, index: number) => React.ReactNode;
|
|
246
|
+
}) => React.ReactNode;
|
|
247
|
+
}, index: number) => React.ReactNode;
|
|
248
|
+
}) => React.ReactNode;
|
|
249
|
+
}, index: number) => React.ReactNode;
|
|
250
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
251
|
+
useSetting: <K extends string>(name: K) => unknown;
|
|
252
|
+
id: string;
|
|
253
|
+
title: string;
|
|
254
|
+
description: string;
|
|
255
|
+
contentSchema: {
|
|
256
|
+
type: "object";
|
|
257
|
+
title: string;
|
|
258
|
+
description: string;
|
|
259
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
260
|
+
required: string[];
|
|
261
|
+
toMarkdown: readonly string[];
|
|
262
|
+
};
|
|
263
|
+
settingsSchema: {
|
|
264
|
+
type: "object";
|
|
265
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
266
|
+
required: string[];
|
|
267
|
+
} | undefined;
|
|
268
|
+
getInitialContent: () => {
|
|
269
|
+
[x: string]: unknown;
|
|
270
|
+
};
|
|
271
|
+
getInitialSettings: () => {
|
|
272
|
+
[x: string]: unknown;
|
|
273
|
+
};
|
|
274
|
+
layoutOnly: boolean;
|
|
275
|
+
} | undefined;
|
|
276
|
+
getLayouts(): {
|
|
277
|
+
id: string;
|
|
278
|
+
title: string;
|
|
279
|
+
description: string;
|
|
280
|
+
buildMetaTitle: (params: {
|
|
281
|
+
pageMetaTitle: string;
|
|
282
|
+
projectName: string;
|
|
283
|
+
pageFullPath: string;
|
|
284
|
+
}) => string;
|
|
285
|
+
buildOgImage: ((params: import('../../../core/createLayout').OgImageParams) => Promise<Response>) | undefined;
|
|
286
|
+
blockDefinitions: ({
|
|
287
|
+
type: string;
|
|
288
|
+
content: Record<string, unknown>;
|
|
289
|
+
settings: Record<string, unknown>;
|
|
290
|
+
placement: "before";
|
|
291
|
+
} | {
|
|
292
|
+
type: string;
|
|
293
|
+
content: Record<string, unknown>;
|
|
294
|
+
settings: Record<string, unknown>;
|
|
295
|
+
placement: "after";
|
|
296
|
+
})[];
|
|
297
|
+
component: React.ComponentType<{
|
|
298
|
+
children: React.ReactNode;
|
|
299
|
+
}>;
|
|
300
|
+
Provider: ({ layoutBlocks, children, }: {
|
|
301
|
+
layoutBlocks: Record<string, import('../../../core/createLayout').LayoutBlockData>;
|
|
302
|
+
children: React.ReactNode;
|
|
303
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
304
|
+
blocks: Record<string, React.ComponentType>;
|
|
305
|
+
}[];
|
|
306
|
+
getLayoutById(id: string): {
|
|
307
|
+
id: string;
|
|
308
|
+
title: string;
|
|
309
|
+
description: string;
|
|
310
|
+
buildMetaTitle: (params: {
|
|
311
|
+
pageMetaTitle: string;
|
|
312
|
+
projectName: string;
|
|
313
|
+
pageFullPath: string;
|
|
314
|
+
}) => string;
|
|
315
|
+
buildOgImage: ((params: import('../../../core/createLayout').OgImageParams) => Promise<Response>) | undefined;
|
|
316
|
+
blockDefinitions: ({
|
|
317
|
+
type: string;
|
|
318
|
+
content: Record<string, unknown>;
|
|
319
|
+
settings: Record<string, unknown>;
|
|
320
|
+
placement: "before";
|
|
321
|
+
} | {
|
|
322
|
+
type: string;
|
|
323
|
+
content: Record<string, unknown>;
|
|
324
|
+
settings: Record<string, unknown>;
|
|
325
|
+
placement: "after";
|
|
326
|
+
})[];
|
|
327
|
+
component: React.ComponentType<{
|
|
328
|
+
children: React.ReactNode;
|
|
329
|
+
}>;
|
|
330
|
+
Provider: ({ layoutBlocks, children, }: {
|
|
331
|
+
layoutBlocks: Record<string, import('../../../core/createLayout').LayoutBlockData>;
|
|
332
|
+
children: React.ReactNode;
|
|
333
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
334
|
+
blocks: Record<string, React.ComponentType>;
|
|
335
|
+
} | undefined;
|
|
336
|
+
getSerializableDefinitions(): {
|
|
337
|
+
blockId: string;
|
|
338
|
+
title: string;
|
|
339
|
+
description: string;
|
|
340
|
+
contentSchema: {
|
|
341
|
+
type: "object";
|
|
342
|
+
title: string;
|
|
343
|
+
description: string;
|
|
344
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
345
|
+
required: string[];
|
|
346
|
+
toMarkdown: readonly string[];
|
|
347
|
+
};
|
|
348
|
+
settingsSchema: {
|
|
349
|
+
type: "object";
|
|
350
|
+
properties: Record<string, import('@sinclair/typebox').TSchema>;
|
|
351
|
+
required: string[];
|
|
352
|
+
} | undefined;
|
|
353
|
+
layoutOnly: true | undefined;
|
|
354
|
+
}[];
|
|
355
|
+
getSerializableLayoutDefinitions(): {
|
|
356
|
+
layoutId: string;
|
|
357
|
+
description: string;
|
|
358
|
+
blocks: ({
|
|
359
|
+
type: string;
|
|
360
|
+
content: Record<string, unknown>;
|
|
361
|
+
settings: Record<string, unknown>;
|
|
362
|
+
placement: "before";
|
|
363
|
+
} | {
|
|
364
|
+
type: string;
|
|
365
|
+
content: Record<string, unknown>;
|
|
366
|
+
settings: Record<string, unknown>;
|
|
367
|
+
placement: "after";
|
|
368
|
+
})[];
|
|
369
|
+
}[];
|
|
370
|
+
};
|
|
371
|
+
//# sourceMappingURL=CamoxAppContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CamoxAppContext.d.ts","sourceRoot":"","sources":["../../../../src/features/provider/components/CamoxAppContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,eAAO,MAAM,gBAAgB,GAAI,oBAG9B;IACD,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,4CAEA,CAAC;AAEF,wBAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/features/provider/components/CamoxAppContext.tsx
|
|
4
|
+
var CamoxAppContext = React.createContext(void 0);
|
|
5
|
+
var CamoxAppProvider = ({ app, children }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(CamoxAppContext.Provider, {
|
|
7
|
+
value: app,
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
function useCamoxApp() {
|
|
12
|
+
const context = React.use(CamoxAppContext);
|
|
13
|
+
if (!context) throw new Error("useCamoxApp must be used within a CamoxAppProvider");
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CamoxAppProvider, useCamoxApp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../../src/features/provider/components/CommandPalette.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,4CA4H7B;AAED,wBAAgB,wBAAwB,SAwBvC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { actionsStore } from "../actionsStore.js";
|
|
2
|
+
import { studioStore } from "../../studio/studioStore.js";
|
|
3
|
+
import { useSelector } from "@xstate/store/react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cn, formatShortcut } from "@/lib/utils";
|
|
7
|
+
import * as icons from "lucide-react";
|
|
8
|
+
import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
|
|
9
|
+
//#region src/features/provider/components/CommandPalette.tsx
|
|
10
|
+
function CommandPalette() {
|
|
11
|
+
const isOpen = useSelector(studioStore, (state) => state.context.isCommandPaletteOpen);
|
|
12
|
+
const [search, setSearch] = React.useState("");
|
|
13
|
+
const [value, setValue] = React.useState("");
|
|
14
|
+
const actions = useSelector(actionsStore, (state) => state.context.actions);
|
|
15
|
+
const page = useSelector(studioStore, (state) => state.context.commandPalettePages).at(-1);
|
|
16
|
+
const groupedActions = React.useMemo(() => {
|
|
17
|
+
const availableActions = actions.filter((action) => {
|
|
18
|
+
if (!action.checkIfAvailable()) return false;
|
|
19
|
+
if (action.groupLabel === "Invisible") return false;
|
|
20
|
+
if (page) return action.parentActionId === page;
|
|
21
|
+
if (search.length > 0) return true;
|
|
22
|
+
return !action.parentActionId;
|
|
23
|
+
});
|
|
24
|
+
const groups = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const action of availableActions) {
|
|
26
|
+
const existing = groups.get(action.groupLabel) || [];
|
|
27
|
+
groups.set(action.groupLabel, [...existing, action]);
|
|
28
|
+
}
|
|
29
|
+
const groupOrder = [
|
|
30
|
+
"Preview",
|
|
31
|
+
"Navigation",
|
|
32
|
+
"Studio"
|
|
33
|
+
];
|
|
34
|
+
const sortedGroups = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const groupLabel of groupOrder) if (groups.has(groupLabel)) sortedGroups.set(groupLabel, groups.get(groupLabel));
|
|
36
|
+
return sortedGroups;
|
|
37
|
+
}, [
|
|
38
|
+
actions,
|
|
39
|
+
page,
|
|
40
|
+
search
|
|
41
|
+
]);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (page) {
|
|
44
|
+
const firstChild = actions.find((a) => a.parentActionId === page && a.checkIfAvailable());
|
|
45
|
+
if (firstChild) setValue(firstChild.id);
|
|
46
|
+
}
|
|
47
|
+
}, [page, actions]);
|
|
48
|
+
const handleSelect = (actionId) => {
|
|
49
|
+
const action = actions.find((a) => a.id === actionId);
|
|
50
|
+
if (!action) return;
|
|
51
|
+
action.execute();
|
|
52
|
+
setSearch("");
|
|
53
|
+
if (action.hasChildren) studioStore.send({
|
|
54
|
+
type: "pushCommandPalettePage",
|
|
55
|
+
page: action.id
|
|
56
|
+
});
|
|
57
|
+
else studioStore.send({ type: "closeCommandPalette" });
|
|
58
|
+
};
|
|
59
|
+
const handleOpenChange = (open) => {
|
|
60
|
+
if (open) studioStore.send({ type: "openCommandPalette" });
|
|
61
|
+
else {
|
|
62
|
+
setValue("");
|
|
63
|
+
studioStore.send({ type: "closeCommandPalette" });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ jsxs(CommandDialog, {
|
|
67
|
+
open: isOpen,
|
|
68
|
+
onOpenChange: handleOpenChange,
|
|
69
|
+
value,
|
|
70
|
+
onValueChange: setValue,
|
|
71
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
72
|
+
value: search,
|
|
73
|
+
onValueChange: setSearch,
|
|
74
|
+
placeholder: "Type a command or search...",
|
|
75
|
+
onKeyDown: (e) => {
|
|
76
|
+
if (e.key === "Escape" || e.key === "Backspace" && !search) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
studioStore.send({ type: "popCommandPalettePage" });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }), Array.from(groupedActions.entries()).map(([groupLabel, groupActions]) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
82
|
+
heading: groupLabel,
|
|
83
|
+
children: groupActions.map((action) => {
|
|
84
|
+
const Icon = action.icon ? icons[action.icon] : null;
|
|
85
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
86
|
+
onSelect: () => handleSelect(action.id),
|
|
87
|
+
className: "justify-between",
|
|
88
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
89
|
+
className: "flex items-center gap-2",
|
|
90
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
91
|
+
className: cn(!Icon && "ml-7"),
|
|
92
|
+
children: action.label
|
|
93
|
+
})]
|
|
94
|
+
}), action.shortcut && formatShortcut(action.shortcut)]
|
|
95
|
+
}, action.id);
|
|
96
|
+
})
|
|
97
|
+
}, groupLabel))] })]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function useCommandPaletteActions() {
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
actionsStore.send({
|
|
103
|
+
type: "registerAction",
|
|
104
|
+
action: {
|
|
105
|
+
id: "toggle-command-palette",
|
|
106
|
+
label: "Toggle command palette",
|
|
107
|
+
groupLabel: "Invisible",
|
|
108
|
+
checkIfAvailable: () => true,
|
|
109
|
+
execute: () => {
|
|
110
|
+
studioStore.send({ type: "toggleCommandPalette" });
|
|
111
|
+
},
|
|
112
|
+
shortcut: {
|
|
113
|
+
key: "k",
|
|
114
|
+
withMeta: true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return () => {
|
|
119
|
+
actionsStore.send({
|
|
120
|
+
type: "unregisterAction",
|
|
121
|
+
id: "toggle-command-palette"
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
}, []);
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { CommandPalette, useCommandPaletteActions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAdminShortcuts.d.ts","sourceRoot":"","sources":["../../../src/features/provider/useAdminShortcuts.tsx"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,iBAAiB,SAkHhC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { previewStore } from "../preview/previewStore.js";
|
|
2
|
+
import { actionsStore } from "./actionsStore.js";
|
|
3
|
+
import { useSelector } from "@xstate/store/react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { checkIfInputFocused } from "@/lib/utils";
|
|
6
|
+
//#region src/features/provider/useAdminShortcuts.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Hook that listens for global keyboard shortcuts defined in the actionsStore
|
|
9
|
+
*/
|
|
10
|
+
function useAdminShortcuts() {
|
|
11
|
+
const actions = useSelector(actionsStore, (state) => state.context.actions);
|
|
12
|
+
const previousLockState = React.useRef(null);
|
|
13
|
+
const lockKeyDownTime = React.useRef(null);
|
|
14
|
+
const HOLD_THRESHOLD_MS = 300;
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
const handleKeyDown = (event) => {
|
|
17
|
+
if (event.key.toLowerCase() === "l" && !event.metaKey && !event.altKey && !event.shiftKey) {
|
|
18
|
+
if (event.repeat) return;
|
|
19
|
+
if (checkIfInputFocused()) return;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
if (previousLockState.current === null) {
|
|
22
|
+
lockKeyDownTime.current = Date.now();
|
|
23
|
+
previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
|
|
24
|
+
if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const matchingAction = actions.find((action) => {
|
|
29
|
+
if (!action.shortcut) return false;
|
|
30
|
+
if (!action.checkIfAvailable()) return false;
|
|
31
|
+
const { key, withMeta, withAlt, withShift } = action.shortcut;
|
|
32
|
+
return (withAlt && key.length === 1 && /[a-z]/i.test(key) ? event.code === `Key${key.toUpperCase()}` : key.toLowerCase() === event.key.toLowerCase()) && !!withMeta === (event.metaKey || event.ctrlKey) && !!withAlt === event.altKey && !!withShift === event.shiftKey;
|
|
33
|
+
});
|
|
34
|
+
if (!matchingAction) return;
|
|
35
|
+
const shortcut = matchingAction.shortcut;
|
|
36
|
+
if (checkIfInputFocused()) {
|
|
37
|
+
if (!shortcut.withMeta && !shortcut.withAlt) return;
|
|
38
|
+
if (shortcut.key === "Backspace") return;
|
|
39
|
+
}
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
matchingAction.execute();
|
|
42
|
+
};
|
|
43
|
+
const handleKeyUp = (event) => {
|
|
44
|
+
if (event.key.toLowerCase() === "l") releaseLock();
|
|
45
|
+
};
|
|
46
|
+
const releaseLock = () => {
|
|
47
|
+
if (previousLockState.current === null) return;
|
|
48
|
+
const holdDuration = lockKeyDownTime.current !== null ? Date.now() - lockKeyDownTime.current : Infinity;
|
|
49
|
+
lockKeyDownTime.current = null;
|
|
50
|
+
if ((holdDuration < HOLD_THRESHOLD_MS ? !previousLockState.current : previousLockState.current) !== previewStore.getSnapshot().context.isContentLocked) previewStore.send({ type: "toggleLockContent" });
|
|
51
|
+
previousLockState.current = null;
|
|
52
|
+
};
|
|
53
|
+
const handleMessage = (event) => {
|
|
54
|
+
if (event.data?.type === "holdLockContent") {
|
|
55
|
+
if (previousLockState.current === null) {
|
|
56
|
+
lockKeyDownTime.current = Date.now();
|
|
57
|
+
previousLockState.current = previewStore.getSnapshot().context.isContentLocked;
|
|
58
|
+
if (!previousLockState.current) previewStore.send({ type: "toggleLockContent" });
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (event.data?.type === "releaseLockContent") {
|
|
63
|
+
releaseLock();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (event.data?.type === "executeAction") {
|
|
67
|
+
const { actionId } = event.data;
|
|
68
|
+
const action = actions.find((a) => a.id === actionId);
|
|
69
|
+
if (action) action.execute();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
73
|
+
document.addEventListener("keyup", handleKeyUp);
|
|
74
|
+
window.addEventListener("message", handleMessage);
|
|
75
|
+
return () => {
|
|
76
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
77
|
+
document.removeEventListener("keyup", handleKeyUp);
|
|
78
|
+
window.removeEventListener("message", handleMessage);
|
|
79
|
+
};
|
|
80
|
+
}, [actions]);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { useAdminShortcuts };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ogRoute.d.ts","sourceRoot":"","sources":["../../../src/features/routes/ogRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ;uBAErB;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;EAehD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/features/routes/ogRoute.ts
|
|
2
|
+
function createOgHandler(camoxApp) {
|
|
3
|
+
return { GET: async ({ request }) => {
|
|
4
|
+
const url = new URL(request.url);
|
|
5
|
+
const layoutId = url.searchParams.get("layoutId") || "";
|
|
6
|
+
const title = url.searchParams.get("title") || "";
|
|
7
|
+
const description = url.searchParams.get("description") || "";
|
|
8
|
+
const projectName = url.searchParams.get("projectName") || "";
|
|
9
|
+
const layout = camoxApp.getLayoutById(layoutId);
|
|
10
|
+
if (!layout?.buildOgImage) return new Response("Not found", { status: 404 });
|
|
11
|
+
return layout.buildOgImage({
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
projectName
|
|
15
|
+
});
|
|
16
|
+
} };
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createOgHandler };
|