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,135 @@
|
|
|
1
|
+
import { api } from 'camox/server/api';
|
|
2
|
+
import { CamoxApp } from '../../core/createApp';
|
|
3
|
+
export declare function parseQuality(part: string): number;
|
|
4
|
+
export declare function prefersMarkdown(accept: string): boolean;
|
|
5
|
+
export declare const getOrigin: import('@tanstack/react-start').OptionalFetcher<undefined, undefined, Promise<string>>;
|
|
6
|
+
export declare function createMarkdownMiddleware(convexUrl: string): import('@tanstack/react-start').RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
7
|
+
export declare function createPageLoader(convexUrl: string): ({ location }: {
|
|
8
|
+
location: {
|
|
9
|
+
pathname: string;
|
|
10
|
+
};
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
page: {
|
|
13
|
+
page: {
|
|
14
|
+
_id: import('convex/values').GenericId<"pages">;
|
|
15
|
+
_creationTime: number;
|
|
16
|
+
parentPageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
17
|
+
metaTitle?: string | undefined;
|
|
18
|
+
metaDescription?: string | undefined;
|
|
19
|
+
aiSeoEnabled?: boolean | undefined;
|
|
20
|
+
createdAt: number;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
projectId: import('convex/values').GenericId<"projects">;
|
|
23
|
+
pathSegment: string;
|
|
24
|
+
fullPath: string;
|
|
25
|
+
layoutId: import('convex/values').GenericId<"layouts">;
|
|
26
|
+
};
|
|
27
|
+
projectName: string;
|
|
28
|
+
blocks: {
|
|
29
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
30
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
31
|
+
_creationTime: number;
|
|
32
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
33
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
34
|
+
settings?: any;
|
|
35
|
+
placement?: "before" | "after" | undefined;
|
|
36
|
+
summary: string;
|
|
37
|
+
type: string;
|
|
38
|
+
position: string;
|
|
39
|
+
createdAt: number;
|
|
40
|
+
updatedAt: number;
|
|
41
|
+
}[];
|
|
42
|
+
layout: {
|
|
43
|
+
_id: import('convex/values').GenericId<"layouts">;
|
|
44
|
+
layoutId: string;
|
|
45
|
+
blocks: {
|
|
46
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
47
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
48
|
+
_creationTime: number;
|
|
49
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
50
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
51
|
+
settings?: any;
|
|
52
|
+
placement?: "before" | "after" | undefined;
|
|
53
|
+
summary: string;
|
|
54
|
+
type: string;
|
|
55
|
+
position: string;
|
|
56
|
+
createdAt: number;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
}[];
|
|
59
|
+
beforeBlocks: {
|
|
60
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
61
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
62
|
+
_creationTime: number;
|
|
63
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
64
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
65
|
+
settings?: any;
|
|
66
|
+
placement?: "before" | "after" | undefined;
|
|
67
|
+
summary: string;
|
|
68
|
+
type: string;
|
|
69
|
+
position: string;
|
|
70
|
+
createdAt: number;
|
|
71
|
+
updatedAt: number;
|
|
72
|
+
}[];
|
|
73
|
+
afterBlocks: {
|
|
74
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
75
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
76
|
+
_creationTime: number;
|
|
77
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
78
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
79
|
+
settings?: any;
|
|
80
|
+
placement?: "before" | "after" | undefined;
|
|
81
|
+
summary: string;
|
|
82
|
+
type: string;
|
|
83
|
+
position: string;
|
|
84
|
+
createdAt: number;
|
|
85
|
+
updatedAt: number;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
page: {
|
|
90
|
+
_id: import('convex/values').GenericId<"pages">;
|
|
91
|
+
_creationTime: number;
|
|
92
|
+
parentPageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
93
|
+
metaTitle?: string | undefined;
|
|
94
|
+
metaDescription?: string | undefined;
|
|
95
|
+
aiSeoEnabled?: boolean | undefined;
|
|
96
|
+
createdAt: number;
|
|
97
|
+
updatedAt: number;
|
|
98
|
+
projectId: import('convex/values').GenericId<"projects">;
|
|
99
|
+
pathSegment: string;
|
|
100
|
+
fullPath: string;
|
|
101
|
+
layoutId: import('convex/values').GenericId<"layouts">;
|
|
102
|
+
};
|
|
103
|
+
projectName: string;
|
|
104
|
+
blocks: {
|
|
105
|
+
content: import('@camox/backend-content/lib/contentAssembly').ContentRecord;
|
|
106
|
+
_id: import('convex/values').GenericId<"blocks">;
|
|
107
|
+
_creationTime: number;
|
|
108
|
+
layoutId?: import('convex/values').GenericId<"layouts"> | undefined;
|
|
109
|
+
pageId?: import('convex/values').GenericId<"pages"> | undefined;
|
|
110
|
+
settings?: any;
|
|
111
|
+
placement?: "before" | "after" | undefined;
|
|
112
|
+
summary: string;
|
|
113
|
+
type: string;
|
|
114
|
+
position: string;
|
|
115
|
+
createdAt: number;
|
|
116
|
+
updatedAt: number;
|
|
117
|
+
}[];
|
|
118
|
+
layout?: undefined;
|
|
119
|
+
};
|
|
120
|
+
origin: string;
|
|
121
|
+
}>;
|
|
122
|
+
export declare function createPageHead(camoxApp: CamoxApp): ({ loaderData, }: {
|
|
123
|
+
loaderData?: {
|
|
124
|
+
page: NonNullable<typeof api.pages.getPage._returnType>;
|
|
125
|
+
origin: string;
|
|
126
|
+
};
|
|
127
|
+
}) => {
|
|
128
|
+
meta?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
meta: Record<string, string>[];
|
|
131
|
+
};
|
|
132
|
+
export declare const PageRouteComponent: ({ page, }: {
|
|
133
|
+
page: NonNullable<typeof api.pages.getPage._returnType>;
|
|
134
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
135
|
+
//# sourceMappingURL=pageRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageRoute.d.ts","sourceRoot":"","sources":["../../../src/features/routes/pageRoute.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQrD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAYvD;AAMD,eAAO,MAAM,SAAS,wFAIpB,CAAC;AAMH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,0FA2BzD;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,IAElC,cAAc;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAc/D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,IACvC,iBAEL;IACD,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;;;;EAqDF;AAMD,eAAO,MAAM,kBAAkB,GAAI,WAEhC;IACD,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;CACzD,4CAMA,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CamoxPreview, PageContent } from "../preview/CamoxPreview.js";
|
|
2
|
+
import { trackEvent } from "../../lib/analytics.js";
|
|
3
|
+
import { api } from "camox/server/api";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { notFound } from "@tanstack/react-router";
|
|
6
|
+
import { ConvexHttpClient } from "convex/browser";
|
|
7
|
+
import { createMiddleware, createServerFn } from "@tanstack/react-start";
|
|
8
|
+
import { getRequest } from "@tanstack/react-start/server";
|
|
9
|
+
//#region src/features/routes/pageRoute.tsx
|
|
10
|
+
function parseQuality(part) {
|
|
11
|
+
const match = part.match(/;\s*q=([0-9.]+)/);
|
|
12
|
+
return match ? parseFloat(match[1]) : 1;
|
|
13
|
+
}
|
|
14
|
+
function prefersMarkdown(accept) {
|
|
15
|
+
let markdownQ = -1;
|
|
16
|
+
let htmlQ = -1;
|
|
17
|
+
for (const part of accept.split(",")) {
|
|
18
|
+
const trimmed = part.trim();
|
|
19
|
+
if (trimmed.startsWith("text/markdown")) markdownQ = parseQuality(trimmed);
|
|
20
|
+
else if (trimmed.startsWith("text/html")) htmlQ = parseQuality(trimmed);
|
|
21
|
+
}
|
|
22
|
+
return markdownQ > 0 && markdownQ >= htmlQ;
|
|
23
|
+
}
|
|
24
|
+
var getOrigin = createServerFn({ method: "GET" }).handler(async () => {
|
|
25
|
+
const request = getRequest();
|
|
26
|
+
return new URL(request.url).origin;
|
|
27
|
+
});
|
|
28
|
+
function createMarkdownMiddleware(convexUrl) {
|
|
29
|
+
return createMiddleware().server(async ({ next, request }) => {
|
|
30
|
+
if (prefersMarkdown(request.headers.get("Accept") ?? "")) {
|
|
31
|
+
const url = new URL(request.url);
|
|
32
|
+
const client = new ConvexHttpClient(convexUrl);
|
|
33
|
+
const page = await client.query(api.pages.getPage, { fullPath: url.pathname });
|
|
34
|
+
if (page) {
|
|
35
|
+
const markdown = await client.query(api.blocks.getPageMarkdown, { pageId: page.page._id });
|
|
36
|
+
if (markdown) {
|
|
37
|
+
trackEvent("markdown_served", {
|
|
38
|
+
pathname: url.pathname,
|
|
39
|
+
projectId: page.page.projectId,
|
|
40
|
+
projectName: page.projectName
|
|
41
|
+
});
|
|
42
|
+
throw new Response(markdown, { headers: { "Content-Type": "text/markdown; charset=utf-8" } });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return next();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function createPageLoader(convexUrl) {
|
|
50
|
+
const convexHttpClient = new ConvexHttpClient(convexUrl);
|
|
51
|
+
return async ({ location }) => {
|
|
52
|
+
const [page, origin] = await Promise.all([convexHttpClient.query(api.pages.getPage, { fullPath: location.pathname }), getOrigin()]);
|
|
53
|
+
if (!page) throw notFound();
|
|
54
|
+
return {
|
|
55
|
+
page,
|
|
56
|
+
origin
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function createPageHead(camoxApp) {
|
|
61
|
+
return ({ loaderData }) => {
|
|
62
|
+
if (!loaderData) return {};
|
|
63
|
+
const { page, origin } = loaderData;
|
|
64
|
+
const pageMetaTitle = page.page.metaTitle ?? page.page.pathSegment;
|
|
65
|
+
const meta = [];
|
|
66
|
+
let title = pageMetaTitle;
|
|
67
|
+
if (page.layout) {
|
|
68
|
+
const layout = camoxApp.getLayoutById(page.layout.layoutId);
|
|
69
|
+
if (layout) {
|
|
70
|
+
title = layout.buildMetaTitle({
|
|
71
|
+
pageMetaTitle,
|
|
72
|
+
projectName: page.projectName,
|
|
73
|
+
pageFullPath: page.page.fullPath
|
|
74
|
+
});
|
|
75
|
+
meta.push({ title });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (page.page.metaDescription) meta.push({
|
|
79
|
+
name: "description",
|
|
80
|
+
content: page.page.metaDescription
|
|
81
|
+
});
|
|
82
|
+
const ogImageUrl = `${origin}/og?${new URLSearchParams({
|
|
83
|
+
...page.layout && { layoutId: page.layout.layoutId },
|
|
84
|
+
title: pageMetaTitle,
|
|
85
|
+
...page.page.metaDescription && { description: page.page.metaDescription },
|
|
86
|
+
...page.projectName && { projectName: page.projectName }
|
|
87
|
+
}).toString()}`;
|
|
88
|
+
meta.push({
|
|
89
|
+
property: "og:title",
|
|
90
|
+
content: title
|
|
91
|
+
}, {
|
|
92
|
+
property: "og:image",
|
|
93
|
+
content: ogImageUrl
|
|
94
|
+
}, {
|
|
95
|
+
property: "og:image:width",
|
|
96
|
+
content: "1200"
|
|
97
|
+
}, {
|
|
98
|
+
property: "og:image:height",
|
|
99
|
+
content: "630"
|
|
100
|
+
});
|
|
101
|
+
if (page.page.metaDescription) meta.push({
|
|
102
|
+
property: "og:description",
|
|
103
|
+
content: page.page.metaDescription
|
|
104
|
+
});
|
|
105
|
+
return { meta };
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
var PageRouteComponent = ({ page }) => {
|
|
109
|
+
return /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, { page }) });
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { PageRouteComponent, createMarkdownMiddleware, createPageHead, createPageLoader, getOrigin, parseQuality, prefersMarkdown };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface CamoxStudioProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const CamoxStudio: ({ children }: CamoxStudioProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export { CamoxStudio };
|
|
7
|
+
//# sourceMappingURL=CamoxStudio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CamoxStudio.d.ts","sourceRoot":"","sources":["../../../src/features/studio/CamoxStudio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,WAAW,GAAI,cAAc,gBAAgB,mDAsBlD,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Navbar } from "./components/Navbar.js";
|
|
2
|
+
import { useConvexAuth } from "convex/react";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
6
|
+
import { useSignInRedirect } from "@/lib/auth";
|
|
7
|
+
//#region src/features/studio/CamoxStudio.tsx
|
|
8
|
+
var CamoxStudio = ({ children }) => {
|
|
9
|
+
const { isAuthenticated } = useConvexAuth();
|
|
10
|
+
const { pathname } = useLocation();
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const signInRedirect = useSignInRedirect();
|
|
13
|
+
if (!isAuthenticated) {
|
|
14
|
+
signInRedirect();
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (pathname === "cmx-studio") navigate("/");
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "bg-background flex h-screen flex-col overflow-hidden",
|
|
20
|
+
children: [/* @__PURE__ */ jsx(Navbar, {}), children]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { CamoxStudio };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Navbar.d.ts","sourceRoot":"","sources":["../../../../src/features/studio/components/Navbar.tsx"],"names":[],"mappings":"AAiDA,QAAA,MAAM,MAAM,+CAsDX,CAAC;AAEF,iBAAS,gBAAgB,SAyBxB;AAED,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
|
+
import { studioStore } from "../studioStore.js";
|
|
3
|
+
import { ProjectMenu } from "./ProjectMenu.js";
|
|
4
|
+
import { UserButton } from "./UserButton.js";
|
|
5
|
+
import { Kbd } from "@camox/ui/kbd";
|
|
6
|
+
import { api } from "camox/server/api";
|
|
7
|
+
import { useQuery } from "convex/react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
|
11
|
+
import { cn } from "@/lib/utils";
|
|
12
|
+
import { Button } from "@camox/ui/button";
|
|
13
|
+
import { Database, Globe, SearchIcon } from "lucide-react";
|
|
14
|
+
import { useIsPreviewSheetOpen } from "@/features/preview/components/PreviewSideSheet";
|
|
15
|
+
//#region src/features/studio/components/Navbar.tsx
|
|
16
|
+
var links = [{
|
|
17
|
+
to: "/",
|
|
18
|
+
title: "Preview",
|
|
19
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }), "Preview"] }),
|
|
20
|
+
icon: "Globe"
|
|
21
|
+
}, {
|
|
22
|
+
to: "/cmx-studio/content",
|
|
23
|
+
title: "Content",
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Database, { className: "h-4 w-4" }), "Content"] }),
|
|
25
|
+
icon: "FileText"
|
|
26
|
+
}];
|
|
27
|
+
var Navbar = () => {
|
|
28
|
+
const pages = useQuery(api.pages.listPages);
|
|
29
|
+
const isMac = React.useMemo(() => navigator.userAgent.toUpperCase().indexOf("MAC") >= 0, []);
|
|
30
|
+
const { pathname } = useLocation();
|
|
31
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
32
|
+
className: "relative flex items-center justify-between gap-4 border-b-2 bg-transparent px-2 py-2",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("div", { className: cn("absolute top-0 left-0 w-full h-[calc(100%+2px)] bg-black transition-opacity z-10 will-change-auto pointer-events-none", useIsPreviewSheetOpen() ? "opacity-60" : "opacity-0") }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: "flex flex-row gap-2",
|
|
37
|
+
children: [/* @__PURE__ */ jsx(ProjectMenu, {}), /* @__PURE__ */ jsx("ul", {
|
|
38
|
+
className: "flex items-center gap-1",
|
|
39
|
+
children: links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
40
|
+
to: link.to,
|
|
41
|
+
className: cn("flex gap-2 items-center rounded-md px-4 py-2 text-sm font-medium", "hover:bg-accent hover:text-accent-foreground outline-none transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-1", pages?.some((page) => page.fullPath === pathname) && index === 0 ? "bg-accent hover:bg-accent text-accent-foreground" : "text-muted-foreground"),
|
|
42
|
+
activeProps: { className: "bg-accent hover:bg-accent text-accent-foreground!" },
|
|
43
|
+
children: link.children
|
|
44
|
+
}) }, link.to))
|
|
45
|
+
})]
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "flex items-center gap-2",
|
|
49
|
+
children: [/* @__PURE__ */ jsxs(Button, {
|
|
50
|
+
variant: "outline",
|
|
51
|
+
onClick: () => studioStore.send({ type: "openCommandPalette" }),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground size-4" }),
|
|
54
|
+
/* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: "text-muted-foreground",
|
|
56
|
+
children: "Quick find"
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs(Kbd, {
|
|
59
|
+
className: "ml-4",
|
|
60
|
+
children: [isMac ? "⌘" : "Ctrl", " K"]
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}), /* @__PURE__ */ jsx(UserButton, {})]
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
function useNavbarActions() {
|
|
69
|
+
const navigate = useNavigate();
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
const actions = links.map((link, index) => ({
|
|
72
|
+
id: `navigate-to-${link.to}`,
|
|
73
|
+
label: `Go to ${link.title}`,
|
|
74
|
+
groupLabel: "Navigation",
|
|
75
|
+
checkIfAvailable: () => true,
|
|
76
|
+
execute: () => {
|
|
77
|
+
navigate({ to: link.to });
|
|
78
|
+
},
|
|
79
|
+
shortcut: { key: String(index + 1) },
|
|
80
|
+
icon: link.icon
|
|
81
|
+
}));
|
|
82
|
+
actionsStore.send({
|
|
83
|
+
type: "registerManyActions",
|
|
84
|
+
actions
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
actionsStore.send({
|
|
88
|
+
type: "unregisterManyActions",
|
|
89
|
+
ids: actions.map((a) => a.id)
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
}, [navigate]);
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { Navbar, useNavbarActions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectMenu.d.ts","sourceRoot":"","sources":["../../../../src/features/studio/components/ProjectMenu.tsx"],"names":[],"mappings":"AAiEA,eAAO,MAAM,WAAW,+CAiFvB,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
2
|
+
import { api } from "camox/server/api";
|
|
3
|
+
import { useQuery } from "convex/react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Button } from "@camox/ui/button";
|
|
7
|
+
import { ChevronDown, Globe, Settings, Users } from "lucide-react";
|
|
8
|
+
import { Separator } from "@camox/ui/separator";
|
|
9
|
+
import { Skeleton } from "@camox/ui/skeleton";
|
|
10
|
+
import { AuthContext } from "@/lib/auth";
|
|
11
|
+
//#region src/features/studio/components/ProjectMenu.tsx
|
|
12
|
+
var Favicon = ({ size = 16 }) => {
|
|
13
|
+
const [faviconUrl, setFaviconUrl] = React.useState(null);
|
|
14
|
+
const [hasError, setHasError] = React.useState(false);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
const getFaviconUrl = () => {
|
|
17
|
+
for (const selector of [
|
|
18
|
+
"link[rel=\"icon\"]",
|
|
19
|
+
"link[rel=\"shortcut icon\"]",
|
|
20
|
+
"link[rel=\"apple-touch-icon\"]"
|
|
21
|
+
]) {
|
|
22
|
+
const link = document.querySelector(selector);
|
|
23
|
+
if (link?.href) return link.href;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
setFaviconUrl(getFaviconUrl());
|
|
28
|
+
}, []);
|
|
29
|
+
if (!faviconUrl || hasError) return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "bg-muted flex items-center justify-center rounded-full",
|
|
31
|
+
style: {
|
|
32
|
+
height: size,
|
|
33
|
+
width: size
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ jsx(Globe, {
|
|
36
|
+
className: "text-muted-foreground",
|
|
37
|
+
style: {
|
|
38
|
+
height: size * .6,
|
|
39
|
+
width: size * .6
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "bg-muted flex items-center justify-center overflow-hidden rounded-full",
|
|
45
|
+
style: {
|
|
46
|
+
height: size,
|
|
47
|
+
width: size
|
|
48
|
+
},
|
|
49
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
50
|
+
src: faviconUrl,
|
|
51
|
+
alt: "Favicon",
|
|
52
|
+
className: "h-full w-full object-cover",
|
|
53
|
+
onError: () => setHasError(true)
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var ProjectMenu = () => {
|
|
58
|
+
const [open, setOpen] = React.useState(false);
|
|
59
|
+
const authCtx = React.useContext(AuthContext);
|
|
60
|
+
const project = useQuery(api.projects.getFirstProject);
|
|
61
|
+
if (!project) return /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "flex h-9 min-w-[150px] items-center gap-2 px-4",
|
|
63
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4 rounded-full" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 flex-1" })]
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Popover, {
|
|
66
|
+
open,
|
|
67
|
+
onOpenChange: setOpen,
|
|
68
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
69
|
+
asChild: true,
|
|
70
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
71
|
+
variant: "ghost",
|
|
72
|
+
className: "min-w-[150px] justify-between gap-2",
|
|
73
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex items-center gap-2",
|
|
75
|
+
children: [/* @__PURE__ */ jsx(Favicon, { size: 16 }), /* @__PURE__ */ jsx("span", { children: project.name })]
|
|
76
|
+
}), /* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
77
|
+
})
|
|
78
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
79
|
+
className: "w-72 p-0",
|
|
80
|
+
align: "start",
|
|
81
|
+
side: "bottom",
|
|
82
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "flex flex-col",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx("div", {
|
|
86
|
+
className: "flex flex-col gap-2 p-4",
|
|
87
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
88
|
+
className: "font-mono text-sm leading-none",
|
|
89
|
+
children: project.domain
|
|
90
|
+
})
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
93
|
+
/* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: "flex flex-col gap-1 p-2",
|
|
95
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
className: "w-full justify-start",
|
|
98
|
+
onClick: () => {
|
|
99
|
+
if (authCtx) window.open(`${authCtx.managementUrl}/dashboard/${project.slug}`, "_blank");
|
|
100
|
+
setOpen(false);
|
|
101
|
+
},
|
|
102
|
+
children: [/* @__PURE__ */ jsx(Settings, { className: "text-muted-foreground size-4" }), "Project settings"]
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
106
|
+
/* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: "flex flex-col gap-1 p-2",
|
|
108
|
+
children: [/* @__PURE__ */ jsxs(Button, {
|
|
109
|
+
variant: "ghost",
|
|
110
|
+
className: "w-full justify-start",
|
|
111
|
+
onClick: () => {
|
|
112
|
+
if (authCtx) window.open(`${authCtx.managementUrl}/dashboard/team?tab=members`, "_blank");
|
|
113
|
+
setOpen(false);
|
|
114
|
+
},
|
|
115
|
+
children: [/* @__PURE__ */ jsx(Users, { className: "text-muted-foreground size-4" }), "Team members"]
|
|
116
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
117
|
+
variant: "ghost",
|
|
118
|
+
className: "w-full justify-start",
|
|
119
|
+
onClick: () => {
|
|
120
|
+
if (authCtx) window.open(`${authCtx.managementUrl}/dashboard/team?tab=settings`, "_blank");
|
|
121
|
+
setOpen(false);
|
|
122
|
+
},
|
|
123
|
+
children: [/* @__PURE__ */ jsx(Settings, { className: "text-muted-foreground size-4" }), "Team settings"]
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
}) });
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
export { ProjectMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserButton.d.ts","sourceRoot":"","sources":["../../../../src/features/studio/components/UserButton.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU,+CAatB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { useTheme } from "../useTheme.js";
|
|
2
|
+
import { useConvexAuth } from "convex/react";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Button } from "@camox/ui/button";
|
|
6
|
+
import { LogOut, Monitor, Moon, Settings, Sun, User } from "lucide-react";
|
|
7
|
+
import { AuthContext } from "@/lib/auth";
|
|
8
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@camox/ui/avatar";
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "@camox/ui/dropdown-menu";
|
|
10
|
+
//#region src/features/studio/components/UserButton.tsx
|
|
11
|
+
var UserButton = () => {
|
|
12
|
+
const { isAuthenticated, isLoading } = useConvexAuth();
|
|
13
|
+
const { setTheme } = useTheme();
|
|
14
|
+
if (!isAuthenticated || isLoading) return /* @__PURE__ */ jsx(Button, {
|
|
15
|
+
variant: "outline",
|
|
16
|
+
size: "icon",
|
|
17
|
+
children: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" })
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(AuthenticatedUserButton, { setTheme });
|
|
20
|
+
};
|
|
21
|
+
function AuthenticatedUserButton({ setTheme }) {
|
|
22
|
+
const authCtx = useContext(AuthContext);
|
|
23
|
+
const { data: session } = authCtx.authClient.useSession();
|
|
24
|
+
const managementUrl = authCtx.managementUrl;
|
|
25
|
+
const userName = session?.user?.name || "User";
|
|
26
|
+
const userEmail = session?.user?.email;
|
|
27
|
+
const userImage = session?.user?.image;
|
|
28
|
+
const userInitials = userName.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
29
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
30
|
+
asChild: true,
|
|
31
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
32
|
+
variant: "outline",
|
|
33
|
+
size: "icon",
|
|
34
|
+
children: /* @__PURE__ */ jsx(User, { className: "text-muted-foreground h-4 w-4" })
|
|
35
|
+
})
|
|
36
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
37
|
+
className: "w-72",
|
|
38
|
+
align: "end",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
41
|
+
className: "font-normal",
|
|
42
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "flex items-center gap-3",
|
|
44
|
+
children: [/* @__PURE__ */ jsxs(Avatar, {
|
|
45
|
+
size: "lg",
|
|
46
|
+
children: [userImage && /* @__PURE__ */ jsx(AvatarImage, {
|
|
47
|
+
src: userImage,
|
|
48
|
+
alt: userName
|
|
49
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, { children: userInitials })]
|
|
50
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "flex-1 space-y-0.5",
|
|
52
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
53
|
+
className: "text-sm leading-none font-medium",
|
|
54
|
+
children: userName
|
|
55
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
56
|
+
className: "text-muted-foreground text-sm",
|
|
57
|
+
children: userEmail
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
63
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
64
|
+
onClick: () => window.open(`${managementUrl}/dashboard/profile`, "_blank"),
|
|
65
|
+
children: [/* @__PURE__ */ jsx(Settings, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Manage account" })]
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ jsxs(DropdownMenuSub, { children: [/* @__PURE__ */ jsxs(DropdownMenuSubTrigger, {
|
|
68
|
+
className: "gap-2",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Sun, { className: "text-muted-foreground h-4 w-4 dark:hidden" }),
|
|
71
|
+
/* @__PURE__ */ jsx(Moon, { className: "text-muted-foreground hidden h-4 w-4 dark:block" }),
|
|
72
|
+
/* @__PURE__ */ jsx("span", { children: "Theme" })
|
|
73
|
+
]
|
|
74
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuSubContent, { children: [
|
|
75
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
76
|
+
onClick: () => setTheme("light"),
|
|
77
|
+
children: [/* @__PURE__ */ jsx(Sun, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Light" })]
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
80
|
+
onClick: () => setTheme("dark"),
|
|
81
|
+
children: [/* @__PURE__ */ jsx(Moon, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Dark" })]
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
84
|
+
onClick: () => setTheme("system"),
|
|
85
|
+
children: [/* @__PURE__ */ jsx(Monitor, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "System" })]
|
|
86
|
+
})
|
|
87
|
+
] })] }),
|
|
88
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
89
|
+
onClick: () => authCtx.authClient.signOut(),
|
|
90
|
+
children: [/* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Sign out" })]
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
})] });
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { UserButton };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface StudioContext {
|
|
2
|
+
isCommandPaletteOpen: boolean;
|
|
3
|
+
commandPalettePages: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare const studioStore: import('@xstate/store').Store<StudioContext, import('@xstate/store').ExtractEvents<{
|
|
6
|
+
openCommandPalette: unknown;
|
|
7
|
+
closeCommandPalette: unknown;
|
|
8
|
+
toggleCommandPalette: unknown;
|
|
9
|
+
pushCommandPalettePage: {
|
|
10
|
+
page: string;
|
|
11
|
+
};
|
|
12
|
+
popCommandPalettePage: unknown;
|
|
13
|
+
}>, {
|
|
14
|
+
type: string;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=studioStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studioStore.d.ts","sourceRoot":"","sources":["../../../src/features/studio/studioStore.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,WAAW;;;;;cA0B6B,MAAM;;;;;EAazD,CAAC"}
|