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,124 @@
|
|
|
1
|
+
import { api } from 'camox/server/api';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the current page being previewed, with live updates if the user is signed in.
|
|
5
|
+
* Also will switch to peeked page data if there is one.
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePreviewedPage(): {
|
|
8
|
+
page: {
|
|
9
|
+
_id: import('convex/values').GenericId<"pages">;
|
|
10
|
+
_creationTime: number;
|
|
11
|
+
parentPageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
12
|
+
metaTitle?: string | undefined;
|
|
13
|
+
metaDescription?: string | undefined;
|
|
14
|
+
aiSeoEnabled?: boolean | undefined;
|
|
15
|
+
createdAt: number;
|
|
16
|
+
updatedAt: number;
|
|
17
|
+
projectId: import('convex/values').GenericId<"projects">;
|
|
18
|
+
pathSegment: string;
|
|
19
|
+
fullPath: string;
|
|
20
|
+
layoutId: import('convex/values').GenericId<"layouts">;
|
|
21
|
+
};
|
|
22
|
+
projectName: string;
|
|
23
|
+
blocks: {
|
|
24
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
25
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
26
|
+
_creationTime: number;
|
|
27
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
28
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
29
|
+
settings?: any;
|
|
30
|
+
placement?: "before" | "after" | undefined;
|
|
31
|
+
summary: string;
|
|
32
|
+
type: string;
|
|
33
|
+
position: string;
|
|
34
|
+
createdAt: number;
|
|
35
|
+
updatedAt: number;
|
|
36
|
+
}[];
|
|
37
|
+
layout: {
|
|
38
|
+
_id: import('convex/values').GenericId<"layouts">;
|
|
39
|
+
layoutId: string;
|
|
40
|
+
blocks: {
|
|
41
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
42
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
43
|
+
_creationTime: number;
|
|
44
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
45
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
46
|
+
settings?: any;
|
|
47
|
+
placement?: "before" | "after" | undefined;
|
|
48
|
+
summary: string;
|
|
49
|
+
type: string;
|
|
50
|
+
position: string;
|
|
51
|
+
createdAt: number;
|
|
52
|
+
updatedAt: number;
|
|
53
|
+
}[];
|
|
54
|
+
beforeBlocks: {
|
|
55
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
56
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
57
|
+
_creationTime: number;
|
|
58
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
59
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
60
|
+
settings?: any;
|
|
61
|
+
placement?: "before" | "after" | undefined;
|
|
62
|
+
summary: string;
|
|
63
|
+
type: string;
|
|
64
|
+
position: string;
|
|
65
|
+
createdAt: number;
|
|
66
|
+
updatedAt: number;
|
|
67
|
+
}[];
|
|
68
|
+
afterBlocks: {
|
|
69
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
70
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
71
|
+
_creationTime: number;
|
|
72
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
73
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
74
|
+
settings?: any;
|
|
75
|
+
placement?: "before" | "after" | undefined;
|
|
76
|
+
summary: string;
|
|
77
|
+
type: string;
|
|
78
|
+
position: string;
|
|
79
|
+
createdAt: number;
|
|
80
|
+
updatedAt: number;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
page: {
|
|
85
|
+
_id: import('convex/values').GenericId<"pages">;
|
|
86
|
+
_creationTime: number;
|
|
87
|
+
parentPageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
88
|
+
metaTitle?: string | undefined;
|
|
89
|
+
metaDescription?: string | undefined;
|
|
90
|
+
aiSeoEnabled?: boolean | undefined;
|
|
91
|
+
createdAt: number;
|
|
92
|
+
updatedAt: number;
|
|
93
|
+
projectId: import('convex/values').GenericId<"projects">;
|
|
94
|
+
pathSegment: string;
|
|
95
|
+
fullPath: string;
|
|
96
|
+
layoutId: import('convex/values').GenericId<"layouts">;
|
|
97
|
+
};
|
|
98
|
+
projectName: string;
|
|
99
|
+
blocks: {
|
|
100
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
101
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
102
|
+
_creationTime: number;
|
|
103
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
104
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
105
|
+
settings?: any;
|
|
106
|
+
placement?: "before" | "after" | undefined;
|
|
107
|
+
summary: string;
|
|
108
|
+
type: string;
|
|
109
|
+
position: string;
|
|
110
|
+
createdAt: number;
|
|
111
|
+
updatedAt: number;
|
|
112
|
+
}[];
|
|
113
|
+
layout?: undefined;
|
|
114
|
+
} | null | undefined;
|
|
115
|
+
interface PageContentProps {
|
|
116
|
+
page: NonNullable<typeof api.pages.getPage._returnType>;
|
|
117
|
+
}
|
|
118
|
+
export declare const PageContent: ({ page: initialPageData }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
export declare const CamoxPreview: ({ children }: {
|
|
120
|
+
children: React.ReactNode;
|
|
121
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
export declare function usePreviewPagesActions(): void;
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=CamoxPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CamoxPreview.d.ts","sourceRoot":"","sources":["../../../src/features/preview/CamoxPreview.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B;;;GAGG;AACH,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA2C/B;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,WAAW,GAAI,2BAA2B,gBAAgB,4CA8HtE,CAAC;AAMF,eAAO,MAAM,YAAY,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CA4EvE,CAAC;AAEF,wBAAgB,sBAAsB,SAsErC"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { previewStore } from "./previewStore.js";
|
|
2
|
+
import { actionsStore } from "../provider/actionsStore.js";
|
|
3
|
+
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
4
|
+
import { Navbar } from "../studio/components/Navbar.js";
|
|
5
|
+
import { AddBlockSheet } from "./components/AddBlockSheet.js";
|
|
6
|
+
import { AgentChatSheet } from "./components/AgentChatSheet.js";
|
|
7
|
+
import { CreatePageSheet } from "./components/CreatePageSheet.js";
|
|
8
|
+
import { EditPageSheet } from "./components/EditPageSheet.js";
|
|
9
|
+
import { PageContentSheet } from "./components/PageContentSheet.js";
|
|
10
|
+
import { PagePicker } from "./components/PagePicker.js";
|
|
11
|
+
import { PageTree } from "./components/PageTree.js";
|
|
12
|
+
import { PeekedBlock } from "./components/PeekedBlock.js";
|
|
13
|
+
import { PreviewFrame, PreviewPanel } from "./components/PreviewPanel.js";
|
|
14
|
+
import { useSelector } from "@xstate/store/react";
|
|
15
|
+
import { api } from "camox/server/api";
|
|
16
|
+
import { useConvexAuth, useQuery } from "convex/react";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { PanelContent, PanelHeader } from "@camox/ui/panel";
|
|
20
|
+
import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
21
|
+
import { formatPathSegment } from "@/lib/utils";
|
|
22
|
+
//#region src/features/preview/CamoxPreview.tsx
|
|
23
|
+
/**
|
|
24
|
+
* Fetches the current page being previewed, with live updates if the user is signed in.
|
|
25
|
+
* Also will switch to peeked page data if there is one.
|
|
26
|
+
*/
|
|
27
|
+
function usePreviewedPage() {
|
|
28
|
+
const { pathname } = useLocation();
|
|
29
|
+
const pagePathnameToFetch = useSelector(previewStore, (state) => state.context.peekedPagePathname) ?? pathname;
|
|
30
|
+
const prevPathnameRef = React.useRef(pathname);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (prevPathnameRef.current !== pathname) {
|
|
33
|
+
prevPathnameRef.current = pathname;
|
|
34
|
+
previewStore.send({ type: "clearPeekedPage" });
|
|
35
|
+
}
|
|
36
|
+
}, [pathname]);
|
|
37
|
+
/**
|
|
38
|
+
* Only live update the page data if the user is signed in (i.e. an admin)
|
|
39
|
+
* to avoid unnecessary load on the backend and layout shifts for regular visitors.
|
|
40
|
+
*/
|
|
41
|
+
const { isAuthenticated } = useConvexAuth();
|
|
42
|
+
const currentPage = useQuery(api.pages.getPage, isAuthenticated ? { fullPath: pagePathnameToFetch } : "skip");
|
|
43
|
+
/**
|
|
44
|
+
* Store the previous page data to avoid returning undefined when switching
|
|
45
|
+
* between peeked pages, which would cause a visual glitch.
|
|
46
|
+
*/
|
|
47
|
+
const previousPageRef = React.useRef(currentPage);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (currentPage !== void 0) previousPageRef.current = currentPage;
|
|
50
|
+
}, [currentPage]);
|
|
51
|
+
return currentPage ?? previousPageRef.current;
|
|
52
|
+
}
|
|
53
|
+
var PageContent = ({ page: initialPageData }) => {
|
|
54
|
+
const pageData = usePreviewedPage() ?? initialPageData;
|
|
55
|
+
const peekedBlockPosition = useSelector(previewStore, (state) => state.context.peekedBlockPosition);
|
|
56
|
+
const displayedPositionRef = React.useRef(null);
|
|
57
|
+
if (peekedBlockPosition !== null) displayedPositionRef.current = peekedBlockPosition;
|
|
58
|
+
const effectivePosition = peekedBlockPosition ?? displayedPositionRef.current;
|
|
59
|
+
const onExitComplete = React.useCallback(() => {
|
|
60
|
+
displayedPositionRef.current = null;
|
|
61
|
+
}, []);
|
|
62
|
+
const camoxApp = useCamoxApp();
|
|
63
|
+
const peekedBlockIndex = React.useMemo(() => {
|
|
64
|
+
if (effectivePosition === "") return 0;
|
|
65
|
+
if (effectivePosition === null) return pageData.blocks.length;
|
|
66
|
+
const afterBlockIndex = pageData.blocks.findIndex((block) => String(block.position) === effectivePosition);
|
|
67
|
+
if (afterBlockIndex === -1) return pageData.blocks.length;
|
|
68
|
+
return afterBlockIndex + 1;
|
|
69
|
+
}, [pageData.blocks, effectivePosition]);
|
|
70
|
+
const layout = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
|
|
71
|
+
const layoutBlocks = React.useMemo(() => {
|
|
72
|
+
if (!pageData.layout) return null;
|
|
73
|
+
const blocks = {};
|
|
74
|
+
for (const block of pageData.layout.blocks) blocks[block.type] = {
|
|
75
|
+
_id: block._id,
|
|
76
|
+
type: block.type,
|
|
77
|
+
content: block.content,
|
|
78
|
+
settings: block.settings,
|
|
79
|
+
position: String(block.position)
|
|
80
|
+
};
|
|
81
|
+
return blocks;
|
|
82
|
+
}, [pageData.layout]);
|
|
83
|
+
const pageBlocksContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
peekedBlockIndex === 0 && pageData.blocks.length > 0 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete }),
|
|
85
|
+
pageData.blocks.map((blockData, index) => {
|
|
86
|
+
const block = camoxApp.getBlockById(String(blockData.type));
|
|
87
|
+
if (!block) return null;
|
|
88
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(block.Component, {
|
|
89
|
+
blockData: {
|
|
90
|
+
_id: blockData._id,
|
|
91
|
+
type: blockData.type,
|
|
92
|
+
content: blockData.content,
|
|
93
|
+
settings: blockData.settings,
|
|
94
|
+
position: String(blockData.position)
|
|
95
|
+
},
|
|
96
|
+
mode: "site",
|
|
97
|
+
showAddBlockTop: index === 0 ? layout?.blockDefinitions.some((b) => b.placement === "before") ?? false : true,
|
|
98
|
+
showAddBlockBottom: true
|
|
99
|
+
}), index === peekedBlockIndex - 1 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete })] }, blockData._id);
|
|
100
|
+
}),
|
|
101
|
+
pageData.blocks.length === 0 && /* @__PURE__ */ jsx(PeekedBlock, { onExitComplete })
|
|
102
|
+
] });
|
|
103
|
+
if (layout && layoutBlocks) {
|
|
104
|
+
const LayoutComponent = layout.component;
|
|
105
|
+
return /* @__PURE__ */ jsx(layout.Provider, {
|
|
106
|
+
layoutBlocks,
|
|
107
|
+
children: /* @__PURE__ */ jsx(LayoutComponent, { children: pageBlocksContent })
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ jsx("main", {
|
|
111
|
+
className: "flex min-h-screen flex-col",
|
|
112
|
+
children: pageBlocksContent
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
var CamoxPreview = ({ children }) => {
|
|
116
|
+
const { isAuthenticated } = useConvexAuth();
|
|
117
|
+
const isPresentationMode = useSelector(previewStore, (state) => state.context.isPresentationMode);
|
|
118
|
+
const isSidebarOpen = useSelector(previewStore, (state) => state.context.isSidebarOpen);
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
const actions = [{
|
|
121
|
+
id: "enter-presentation-mode",
|
|
122
|
+
label: "Enter presentation mode",
|
|
123
|
+
groupLabel: "Preview",
|
|
124
|
+
checkIfAvailable: () => isAuthenticated && !isPresentationMode,
|
|
125
|
+
execute: () => previewStore.send({ type: "enterPresentationMode" }),
|
|
126
|
+
shortcut: {
|
|
127
|
+
key: "Enter",
|
|
128
|
+
withMeta: true
|
|
129
|
+
},
|
|
130
|
+
icon: "MonitorPlay"
|
|
131
|
+
}, {
|
|
132
|
+
id: "exit-presentation-mode",
|
|
133
|
+
label: "Exit presentation mode",
|
|
134
|
+
groupLabel: "Preview",
|
|
135
|
+
checkIfAvailable: () => isAuthenticated && isPresentationMode,
|
|
136
|
+
execute: () => previewStore.send({ type: "exitPresentationMode" }),
|
|
137
|
+
shortcut: {
|
|
138
|
+
key: "Escape",
|
|
139
|
+
withMeta: true
|
|
140
|
+
},
|
|
141
|
+
icon: "MonitorOff"
|
|
142
|
+
}];
|
|
143
|
+
actionsStore.send({
|
|
144
|
+
type: "registerManyActions",
|
|
145
|
+
actions
|
|
146
|
+
});
|
|
147
|
+
return () => {
|
|
148
|
+
actionsStore.send({
|
|
149
|
+
type: "unregisterManyActions",
|
|
150
|
+
ids: actions.map((a) => a.id)
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
}, [isPresentationMode, isAuthenticated]);
|
|
154
|
+
if (isPresentationMode) return /* @__PURE__ */ jsx(PreviewFrame, {
|
|
155
|
+
className: "h-screen w-full",
|
|
156
|
+
children
|
|
157
|
+
});
|
|
158
|
+
if (!isAuthenticated) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
159
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
className: "bg-background flex h-screen flex-col overflow-hidden",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(Navbar, {}),
|
|
163
|
+
/* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: "flex h-full flex-row items-stretch",
|
|
165
|
+
children: [isSidebarOpen && /* @__PURE__ */ jsxs("div", {
|
|
166
|
+
className: "flex w-[300px] flex-col border-r-2",
|
|
167
|
+
children: [/* @__PURE__ */ jsx(PanelHeader, {
|
|
168
|
+
className: "flew-row flex gap-2 px-2 py-2",
|
|
169
|
+
children: /* @__PURE__ */ jsx(PagePicker, {})
|
|
170
|
+
}), /* @__PURE__ */ jsx(PanelContent, {
|
|
171
|
+
className: "flex grow basis-0 flex-col gap-2 overflow-auto p-2",
|
|
172
|
+
children: /* @__PURE__ */ jsx(PageTree, {})
|
|
173
|
+
})]
|
|
174
|
+
}), /* @__PURE__ */ jsxs(PreviewPanel, { children: [children, !isPresentationMode && isAuthenticated && /* @__PURE__ */ jsx("div", { style: {
|
|
175
|
+
height: "80px",
|
|
176
|
+
background: "transparent"
|
|
177
|
+
} })] })]
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsx(PageContentSheet, {}),
|
|
180
|
+
/* @__PURE__ */ jsx(AddBlockSheet, {}),
|
|
181
|
+
/* @__PURE__ */ jsx(AgentChatSheet, {}),
|
|
182
|
+
/* @__PURE__ */ jsx(CreatePageSheet, {}),
|
|
183
|
+
/* @__PURE__ */ jsx(EditPageSheet, {})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
function usePreviewPagesActions() {
|
|
188
|
+
const navigate = useNavigate();
|
|
189
|
+
const { pathname } = useLocation();
|
|
190
|
+
const pages = useQuery(api.pages.listPages);
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
const GO_TO_PAGE_ID = "go-to-page";
|
|
193
|
+
const currentPage = pages?.find((p) => p.fullPath === pathname);
|
|
194
|
+
const actions = [
|
|
195
|
+
{
|
|
196
|
+
id: "create-page",
|
|
197
|
+
label: "Create page",
|
|
198
|
+
groupLabel: "Preview",
|
|
199
|
+
icon: "FilePlus",
|
|
200
|
+
checkIfAvailable: () => true,
|
|
201
|
+
execute: () => previewStore.send({ type: "openCreatePageSheet" })
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: "edit-current-page",
|
|
205
|
+
label: "Edit current page",
|
|
206
|
+
groupLabel: "Preview",
|
|
207
|
+
icon: "Pencil",
|
|
208
|
+
checkIfAvailable: () => !!currentPage,
|
|
209
|
+
execute: () => {
|
|
210
|
+
if (!currentPage) return;
|
|
211
|
+
previewStore.send({
|
|
212
|
+
type: "openEditPageSheet",
|
|
213
|
+
page: currentPage
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: GO_TO_PAGE_ID,
|
|
219
|
+
label: "Go to page",
|
|
220
|
+
groupLabel: "Preview",
|
|
221
|
+
checkIfAvailable: () => !!pages,
|
|
222
|
+
hasChildren: true,
|
|
223
|
+
execute: () => {},
|
|
224
|
+
icon: "File"
|
|
225
|
+
},
|
|
226
|
+
...pages ? pages.map((page) => ({
|
|
227
|
+
id: `go-to-page-${page._id}`,
|
|
228
|
+
parentActionId: GO_TO_PAGE_ID,
|
|
229
|
+
label: `Go to "${page.metaTitle ?? formatPathSegment(page.pathSegment)}"`,
|
|
230
|
+
groupLabel: "Preview",
|
|
231
|
+
checkIfAvailable: () => true,
|
|
232
|
+
execute: () => navigate({ to: page.fullPath }),
|
|
233
|
+
icon: "File"
|
|
234
|
+
})) : []
|
|
235
|
+
];
|
|
236
|
+
actionsStore.send({
|
|
237
|
+
type: "registerManyActions",
|
|
238
|
+
actions
|
|
239
|
+
});
|
|
240
|
+
return () => {
|
|
241
|
+
actionsStore.send({
|
|
242
|
+
type: "unregisterManyActions",
|
|
243
|
+
ids: actions.map((a) => a.id)
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
}, [
|
|
247
|
+
navigate,
|
|
248
|
+
pages,
|
|
249
|
+
pathname
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { CamoxPreview, PageContent, usePreviewPagesActions, usePreviewedPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddBlockSheet.d.ts","sourceRoot":"","sources":["../../../../src/features/preview/components/AddBlockSheet.tsx"],"names":[],"mappings":"AAuBA,QAAA,MAAM,aAAa,+CAgJlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
3
|
+
import { PreviewSideSheet, Sheet } from "./PreviewSideSheet.js";
|
|
4
|
+
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
5
|
+
import { useSelector } from "@xstate/store/react";
|
|
6
|
+
import { api } from "camox/server/api";
|
|
7
|
+
import { useMutation, useQuery } from "convex/react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { InfoIcon } from "lucide-react";
|
|
11
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
|
|
12
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
13
|
+
import { trackClientEvent } from "@/lib/analytics-client";
|
|
14
|
+
//#region src/features/preview/components/AddBlockSheet.tsx
|
|
15
|
+
var AddBlockSheet = () => {
|
|
16
|
+
const [highlightedValue, setHighlightedValue] = React.useState("");
|
|
17
|
+
const createBlockMutation = useMutation(api.blocks.createBlock);
|
|
18
|
+
const availableBlocks = useCamoxApp().getBlocks().filter((b) => !b.layoutOnly);
|
|
19
|
+
const page = usePreviewedPage();
|
|
20
|
+
const totalCounts = useQuery(api.blocks.getBlockUsageCounts) ?? {};
|
|
21
|
+
const pageCounts = React.useMemo(() => {
|
|
22
|
+
const counts = {};
|
|
23
|
+
if (!page) return counts;
|
|
24
|
+
for (const block of page.blocks) counts[block.type] = (counts[block.type] ?? 0) + 1;
|
|
25
|
+
return counts;
|
|
26
|
+
}, [page]);
|
|
27
|
+
const isOpen = useSelector(previewStore, (state) => state.context.isAddBlockSheetOpen);
|
|
28
|
+
const peekedBlockPosition = useSelector(previewStore, (state) => state.context.peekedBlockPosition);
|
|
29
|
+
const handleAddBlock = async (block) => {
|
|
30
|
+
if (!page) return;
|
|
31
|
+
const afterPosition = peekedBlockPosition === "" ? "" : peekedBlockPosition ?? page.blocks[page.blocks.length - 1]?.position;
|
|
32
|
+
const blockId = await createBlockMutation({
|
|
33
|
+
pageId: page.page._id,
|
|
34
|
+
type: block.id,
|
|
35
|
+
content: block.getInitialContent(),
|
|
36
|
+
settings: block.getInitialSettings(),
|
|
37
|
+
afterPosition
|
|
38
|
+
});
|
|
39
|
+
trackClientEvent("block_added", {
|
|
40
|
+
projectId: page.page.projectId,
|
|
41
|
+
blockType: block.id
|
|
42
|
+
});
|
|
43
|
+
previewStore.send({
|
|
44
|
+
type: "focusCreatedBlock",
|
|
45
|
+
blockId
|
|
46
|
+
});
|
|
47
|
+
previewStore.send({ type: "exitPeekedBlock" });
|
|
48
|
+
};
|
|
49
|
+
const handlePreviewBlock = (block) => {
|
|
50
|
+
const afterPosition = peekedBlockPosition === "" ? "" : peekedBlockPosition ?? page?.blocks[page.blocks.length - 1]?.position;
|
|
51
|
+
previewStore.send({
|
|
52
|
+
type: "setPeekedBlock",
|
|
53
|
+
block,
|
|
54
|
+
afterPosition
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const handleValueChange = (value) => {
|
|
58
|
+
setHighlightedValue(value);
|
|
59
|
+
const block = availableBlocks.find((b) => b.title === value);
|
|
60
|
+
if (block) handlePreviewBlock(block);
|
|
61
|
+
else previewStore.send({ type: "clearPeekedBlock" });
|
|
62
|
+
};
|
|
63
|
+
const handleOpenChange = (open) => {
|
|
64
|
+
if (!open) previewStore.send({ type: "closeAddBlockSheet" });
|
|
65
|
+
};
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
if (isOpen) setHighlightedValue("");
|
|
68
|
+
}, [isOpen]);
|
|
69
|
+
const displayCount = (blockId) => {
|
|
70
|
+
const total = totalCounts[blockId] ?? 0;
|
|
71
|
+
if (total === 0) return "Never used";
|
|
72
|
+
const page = pageCounts[blockId] ?? "none";
|
|
73
|
+
return `${total} use${total > 1 ? "s" : ""} (${page} here)`;
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ jsxs(PreviewSideSheet, {
|
|
76
|
+
open: isOpen,
|
|
77
|
+
onOpenChange: handleOpenChange,
|
|
78
|
+
className: "flex flex-col gap-0",
|
|
79
|
+
children: [/* @__PURE__ */ jsxs(Sheet.SheetHeader, {
|
|
80
|
+
className: "border-border border-b",
|
|
81
|
+
children: [/* @__PURE__ */ jsx(Sheet.SheetTitle, { children: "Add new block" }), /* @__PURE__ */ jsx(Sheet.SheetDescription, { children: "Search and select a block to add to the page." })]
|
|
82
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: "flex-1 overflow-auto p-2",
|
|
84
|
+
children: /* @__PURE__ */ jsxs(Command, {
|
|
85
|
+
value: highlightedValue,
|
|
86
|
+
onValueChange: handleValueChange,
|
|
87
|
+
className: "bg-background overflow-visible",
|
|
88
|
+
onKeyDown: (e) => {
|
|
89
|
+
if (e.key === "Escape") previewStore.send({ type: "closeAddBlockSheet" });
|
|
90
|
+
},
|
|
91
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
92
|
+
placeholder: "Search blocks...",
|
|
93
|
+
autoFocus: true,
|
|
94
|
+
wrapperClassName: "border border-input rounded-md shadow-xs focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]"
|
|
95
|
+
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
96
|
+
className: "mt-1 max-h-full",
|
|
97
|
+
children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No blocks found." }), /* @__PURE__ */ jsx(CommandGroup, { children: availableBlocks.sort((a, b) => (totalCounts[b.id] ?? 0) - (totalCounts[a.id] ?? 0)).map((block) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
98
|
+
value: block.title,
|
|
99
|
+
onSelect: () => {
|
|
100
|
+
handleAddBlock(block);
|
|
101
|
+
},
|
|
102
|
+
className: "group flex items-center justify-between gap-2",
|
|
103
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: block.title }), /* @__PURE__ */ jsx("span", {
|
|
104
|
+
className: "text-muted-foreground block",
|
|
105
|
+
children: displayCount(block.id)
|
|
106
|
+
})] }), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
107
|
+
className: "hidden group-focus-within:flex group-hover:flex",
|
|
108
|
+
children: /* @__PURE__ */ jsx(InfoIcon, {})
|
|
109
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
110
|
+
className: "max-w-[300px]",
|
|
111
|
+
side: "right",
|
|
112
|
+
children: block.description
|
|
113
|
+
})] })]
|
|
114
|
+
}, block.id)) })]
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
export { AddBlockSheet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentChatSheet.d.ts","sourceRoot":"","sources":["../../../../src/features/preview/components/AgentChatSheet.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,cAAc,+CAsBnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { PreviewSideSheet, Sheet } from "./PreviewSideSheet.js";
|
|
3
|
+
import { useSelector } from "@xstate/store/react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/features/preview/components/AgentChatSheet.tsx
|
|
6
|
+
var AgentChatSheet = () => {
|
|
7
|
+
const isOpen = useSelector(previewStore, (state) => state.context.isAgentChatSheetOpen);
|
|
8
|
+
const handleOpenChange = (open) => {
|
|
9
|
+
if (!open) previewStore.send({ type: "closeAgentChatSheet" });
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ jsxs(PreviewSideSheet, {
|
|
12
|
+
open: isOpen,
|
|
13
|
+
onOpenChange: handleOpenChange,
|
|
14
|
+
children: [/* @__PURE__ */ jsxs(Sheet.SheetHeader, { children: [/* @__PURE__ */ jsx(Sheet.SheetTitle, { children: "Agent Chat" }), /* @__PURE__ */ jsx(Sheet.SheetDescription, { children: "Describe the changes you'd like to make to this page." })] }), /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "flex flex-1 items-center justify-center p-6",
|
|
16
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
17
|
+
className: "text-muted-foreground text-center text-sm",
|
|
18
|
+
children: "Coming soon"
|
|
19
|
+
})
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { AgentChatSheet };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UploadItem } from '../../../hooks/use-file-upload';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const AssetActionButtons: ({ isImage, multiple, fileInputRef, onPickerOpen, onFilesSelected, uploads, }: {
|
|
4
|
+
isImage: boolean;
|
|
5
|
+
multiple: boolean;
|
|
6
|
+
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
7
|
+
onPickerOpen: () => void;
|
|
8
|
+
onFilesSelected: (files: FileList) => void;
|
|
9
|
+
uploads: UploadItem[];
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const SingleAssetFieldEditor: ({ fieldName, assetType, currentData, onFieldChange, }: {
|
|
12
|
+
fieldName: string;
|
|
13
|
+
assetType: "Image" | "File";
|
|
14
|
+
currentData: Record<string, unknown>;
|
|
15
|
+
onFieldChange: (fieldName: string, value: unknown) => void;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { AssetActionButtons, SingleAssetFieldEditor };
|
|
18
|
+
//# sourceMappingURL=AssetFieldEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetFieldEditor.d.ts","sourceRoot":"","sources":["../../../../src/features/preview/components/AssetFieldEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,yBAAyB,CAAC;AAezE,QAAA,MAAM,kBAAkB,GAAI,8EAOzB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB,4CAiCA,CAAC;AAMF,QAAA,MAAM,sBAAsB,GAAI,uDAK7B;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D,4CAuHA,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
|