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,9 @@
|
|
|
1
|
+
//#region src/features/preview/overlayMessages.ts
|
|
2
|
+
function isOverlayMessage(data) {
|
|
3
|
+
return typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && data.type.startsWith("CAMOX_");
|
|
4
|
+
}
|
|
5
|
+
function postOverlayMessage(message) {
|
|
6
|
+
window.parent?.postMessage(message, "*");
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isOverlayMessage, postOverlayMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewConstants.d.ts","sourceRoot":"","sources":["../../../src/features/preview/previewConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,MAAM,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Doc, Id } from 'camox/server/dataModel';
|
|
2
|
+
import { Block } from '../../core/createBlock';
|
|
3
|
+
import { FieldType } from '../../core/lib/fieldTypes';
|
|
4
|
+
export type SelectionBreadcrumb = {
|
|
5
|
+
type: FieldType | "Block";
|
|
6
|
+
id: string;
|
|
7
|
+
fieldName?: string;
|
|
8
|
+
};
|
|
9
|
+
interface PreviewContext {
|
|
10
|
+
isPresentationMode: boolean;
|
|
11
|
+
isSidebarOpen: boolean;
|
|
12
|
+
isPageContentSheetOpen: boolean;
|
|
13
|
+
isAddBlockSheetOpen: boolean;
|
|
14
|
+
isAgentChatSheetOpen: boolean;
|
|
15
|
+
isCreatePageSheetOpen: boolean;
|
|
16
|
+
editingPage: Doc<"pages"> | null;
|
|
17
|
+
isContentLocked: boolean;
|
|
18
|
+
isMobileMode: boolean;
|
|
19
|
+
peekedBlock: Block | null;
|
|
20
|
+
peekedBlockPosition: string | null;
|
|
21
|
+
peekedPagePathname: string | null;
|
|
22
|
+
skipPeekedBlockExitAnimation: boolean;
|
|
23
|
+
selectionBreadcrumbs: SelectionBreadcrumb[];
|
|
24
|
+
iframeElement: HTMLIFrameElement | null;
|
|
25
|
+
}
|
|
26
|
+
export declare const previewStore: import('@xstate/store').Store<PreviewContext, import('@xstate/store').ExtractEvents<{
|
|
27
|
+
enterPresentationMode: {
|
|
28
|
+
type: "enterPresentationMode";
|
|
29
|
+
};
|
|
30
|
+
exitPresentationMode: {
|
|
31
|
+
type: "exitPresentationMode";
|
|
32
|
+
};
|
|
33
|
+
toggleSidebar: unknown;
|
|
34
|
+
toggleLockContent: {
|
|
35
|
+
type: "toggleLockContent";
|
|
36
|
+
};
|
|
37
|
+
toggleMobileMode: {
|
|
38
|
+
type: "toggleMobileMode";
|
|
39
|
+
};
|
|
40
|
+
setPeekedBlock: {
|
|
41
|
+
block: Block;
|
|
42
|
+
afterPosition?: string | null;
|
|
43
|
+
};
|
|
44
|
+
exitPeekedBlock: unknown;
|
|
45
|
+
clearPeekedBlock: unknown;
|
|
46
|
+
setSelection: {
|
|
47
|
+
breadcrumbs: SelectionBreadcrumb[];
|
|
48
|
+
};
|
|
49
|
+
setFocusedBlock: {
|
|
50
|
+
blockId: Id<"blocks">;
|
|
51
|
+
};
|
|
52
|
+
setSelectedRepeatableItem: {
|
|
53
|
+
blockId: Id<"blocks">;
|
|
54
|
+
itemId: Id<"repeatableItems">;
|
|
55
|
+
fieldName?: string;
|
|
56
|
+
};
|
|
57
|
+
drillIntoRepeatableItem: {
|
|
58
|
+
itemId: string;
|
|
59
|
+
fieldName: string;
|
|
60
|
+
};
|
|
61
|
+
drillIntoLink: {
|
|
62
|
+
fieldName: string;
|
|
63
|
+
};
|
|
64
|
+
drillIntoImage: {
|
|
65
|
+
fieldName: string;
|
|
66
|
+
};
|
|
67
|
+
drillIntoFile: {
|
|
68
|
+
fieldName: string;
|
|
69
|
+
};
|
|
70
|
+
navigateBreadcrumb: {
|
|
71
|
+
depth: number;
|
|
72
|
+
};
|
|
73
|
+
setSelectedField: {
|
|
74
|
+
blockId: Id<"blocks">;
|
|
75
|
+
fieldName: string;
|
|
76
|
+
fieldType: FieldType;
|
|
77
|
+
};
|
|
78
|
+
clearSelection: unknown;
|
|
79
|
+
clearFocusedBlock: unknown;
|
|
80
|
+
selectParentBreadcrumb: unknown;
|
|
81
|
+
setPeekedPage: {
|
|
82
|
+
pathname: string;
|
|
83
|
+
};
|
|
84
|
+
clearPeekedPage: unknown;
|
|
85
|
+
openAddBlockSheet: {
|
|
86
|
+
afterPosition?: string | null;
|
|
87
|
+
};
|
|
88
|
+
closeAddBlockSheet: unknown;
|
|
89
|
+
focusCreatedBlock: {
|
|
90
|
+
blockId: Id<"blocks">;
|
|
91
|
+
};
|
|
92
|
+
clearSkipPeekedBlockExitAnimation: unknown;
|
|
93
|
+
toggleContentSheet: unknown;
|
|
94
|
+
openBlockContentSheet: {
|
|
95
|
+
blockId: Id<"blocks">;
|
|
96
|
+
};
|
|
97
|
+
setSelectionBreadcrumbs: {
|
|
98
|
+
breadcrumbs: SelectionBreadcrumb[];
|
|
99
|
+
};
|
|
100
|
+
closeBlockContentSheet: unknown;
|
|
101
|
+
openAgentChatSheet: unknown;
|
|
102
|
+
closeAgentChatSheet: unknown;
|
|
103
|
+
openCreatePageSheet: unknown;
|
|
104
|
+
closeCreatePageSheet: unknown;
|
|
105
|
+
openEditPageSheet: {
|
|
106
|
+
page: Doc<"pages">;
|
|
107
|
+
};
|
|
108
|
+
closeEditPageSheet: unknown;
|
|
109
|
+
setIframeElement: {
|
|
110
|
+
element: HTMLIFrameElement | null;
|
|
111
|
+
};
|
|
112
|
+
}>, {
|
|
113
|
+
type: string;
|
|
114
|
+
}>;
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=previewStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewStore.d.ts","sourceRoot":"","sources":["../../../src/features/preview/previewStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,UAAU,cAAc;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;IAChC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,KAAK,GAAG,IAAI,CAAC;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,4BAA4B,EAAE,OAAO,CAAC;IACtC,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IAC5C,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;eAgFqB,KAAK;wBAAkB,MAAM,GAAG,IAAI;;;;;qBA0BhC,mBAAmB,EAAE;;;iBAMtB,EAAE,CAAC,QAAQ,CAAC;;;iBAY5C,EAAE,CAAC,QAAQ,CAAC;gBACb,EAAE,CAAC,iBAAiB,CAAC;oBACjB,MAAM;;;gBAe8B,MAAM;mBAAa,MAAM;;;mBAahC,MAAM;;;mBAaL,MAAM;;;mBAaP,MAAM;;;eAaL,MAAM;;;iBAQhC,EAAE,CAAC,QAAQ,CAAC;mBAAa,MAAM;mBAAa,SAAS;;;;;;kBAiC7B,MAAM;;;;wBAaI,MAAM,GAAG,IAAI;;;;iBAgBpB,EAAE,CAAC,QAAQ,CAAC;;;;;iBAsBR,EAAE,CAAC,QAAQ,CAAC;;;qBAUN,mBAAmB,EAAE;;;;;;;;cAoClC,GAAG,CAAC,OAAO,CAAC;;;;iBAYV,iBAAiB,GAAG,IAAI;;;;EAOxE,CAAC"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { toast } from "@camox/ui/toaster";
|
|
2
|
+
import { createStore } from "@xstate/store";
|
|
3
|
+
//#region src/features/preview/previewStore.ts
|
|
4
|
+
var previewStore = createStore({
|
|
5
|
+
context: {
|
|
6
|
+
isPresentationMode: false,
|
|
7
|
+
isSidebarOpen: true,
|
|
8
|
+
isPageContentSheetOpen: false,
|
|
9
|
+
isAddBlockSheetOpen: false,
|
|
10
|
+
isAgentChatSheetOpen: false,
|
|
11
|
+
isCreatePageSheetOpen: false,
|
|
12
|
+
editingPage: null,
|
|
13
|
+
isContentLocked: false,
|
|
14
|
+
isMobileMode: false,
|
|
15
|
+
peekedBlock: null,
|
|
16
|
+
peekedBlockPosition: null,
|
|
17
|
+
peekedPagePathname: null,
|
|
18
|
+
skipPeekedBlockExitAnimation: false,
|
|
19
|
+
selectionBreadcrumbs: [],
|
|
20
|
+
iframeElement: null
|
|
21
|
+
},
|
|
22
|
+
on: {
|
|
23
|
+
enterPresentationMode: (context, _, enqueue) => {
|
|
24
|
+
if (context.isPresentationMode) return context;
|
|
25
|
+
enqueue.effect(() => {
|
|
26
|
+
toast("Entering presentation mode. Press ⌘ + Escape to restore admin interface", { duration: 4e3 });
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
...context,
|
|
30
|
+
isPresentationMode: true
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
exitPresentationMode: (context, _, enqueue) => {
|
|
34
|
+
if (!context.isPresentationMode) return context;
|
|
35
|
+
enqueue.effect(() => {
|
|
36
|
+
toast("Leaving presentation mode");
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
...context,
|
|
40
|
+
isPresentationMode: false
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
toggleSidebar: (context) => {
|
|
44
|
+
if (context.isPresentationMode) return context;
|
|
45
|
+
return {
|
|
46
|
+
...context,
|
|
47
|
+
isSidebarOpen: !context.isSidebarOpen
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
toggleLockContent: (context, _, enqueue) => {
|
|
51
|
+
enqueue.effect(() => {
|
|
52
|
+
toast(context.isContentLocked ? "Enabling edits" : "Preventing edits");
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
...context,
|
|
56
|
+
isContentLocked: !context.isContentLocked
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
toggleMobileMode: (context, _, enqueue) => {
|
|
60
|
+
enqueue.effect(() => {
|
|
61
|
+
toast(context.isMobileMode ? "Leaving mobile mode" : "Entering mobile mode");
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
...context,
|
|
65
|
+
isMobileMode: !context.isMobileMode
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
setPeekedBlock: (context, event) => {
|
|
69
|
+
if (!event.block) return context;
|
|
70
|
+
return {
|
|
71
|
+
...context,
|
|
72
|
+
peekedBlock: event.block,
|
|
73
|
+
peekedBlockPosition: event.afterPosition ?? null
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
exitPeekedBlock: (context) => {
|
|
77
|
+
return {
|
|
78
|
+
...context,
|
|
79
|
+
peekedBlock: null,
|
|
80
|
+
peekedBlockPosition: null,
|
|
81
|
+
isAddBlockSheetOpen: false
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
clearPeekedBlock: (context) => {
|
|
85
|
+
return {
|
|
86
|
+
...context,
|
|
87
|
+
peekedBlock: null,
|
|
88
|
+
peekedBlockPosition: null
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
setSelection: (context, event) => {
|
|
92
|
+
return {
|
|
93
|
+
...context,
|
|
94
|
+
selectionBreadcrumbs: event.breadcrumbs
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
setFocusedBlock: (context, event) => {
|
|
98
|
+
return {
|
|
99
|
+
...context,
|
|
100
|
+
selectionBreadcrumbs: [{
|
|
101
|
+
type: "Block",
|
|
102
|
+
id: event.blockId
|
|
103
|
+
}],
|
|
104
|
+
peekedBlock: null,
|
|
105
|
+
peekedBlockPosition: null,
|
|
106
|
+
isAddBlockSheetOpen: false
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
setSelectedRepeatableItem: (context, event) => {
|
|
110
|
+
return {
|
|
111
|
+
...context,
|
|
112
|
+
selectionBreadcrumbs: [{
|
|
113
|
+
type: "Block",
|
|
114
|
+
id: event.blockId
|
|
115
|
+
}, {
|
|
116
|
+
type: "RepeatableObject",
|
|
117
|
+
id: event.itemId,
|
|
118
|
+
fieldName: event.fieldName
|
|
119
|
+
}]
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
drillIntoRepeatableItem: (context, event) => {
|
|
123
|
+
return {
|
|
124
|
+
...context,
|
|
125
|
+
selectionBreadcrumbs: [...context.selectionBreadcrumbs, {
|
|
126
|
+
type: "RepeatableObject",
|
|
127
|
+
id: event.itemId,
|
|
128
|
+
fieldName: event.fieldName
|
|
129
|
+
}]
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
drillIntoLink: (context, event) => {
|
|
133
|
+
return {
|
|
134
|
+
...context,
|
|
135
|
+
selectionBreadcrumbs: [...context.selectionBreadcrumbs, {
|
|
136
|
+
type: "Link",
|
|
137
|
+
id: event.fieldName,
|
|
138
|
+
fieldName: event.fieldName
|
|
139
|
+
}]
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
drillIntoImage: (context, event) => {
|
|
143
|
+
return {
|
|
144
|
+
...context,
|
|
145
|
+
selectionBreadcrumbs: [...context.selectionBreadcrumbs, {
|
|
146
|
+
type: "Image",
|
|
147
|
+
id: event.fieldName,
|
|
148
|
+
fieldName: event.fieldName
|
|
149
|
+
}]
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
drillIntoFile: (context, event) => {
|
|
153
|
+
return {
|
|
154
|
+
...context,
|
|
155
|
+
selectionBreadcrumbs: [...context.selectionBreadcrumbs, {
|
|
156
|
+
type: "File",
|
|
157
|
+
id: event.fieldName,
|
|
158
|
+
fieldName: event.fieldName
|
|
159
|
+
}]
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
navigateBreadcrumb: (context, event) => {
|
|
163
|
+
return {
|
|
164
|
+
...context,
|
|
165
|
+
selectionBreadcrumbs: context.selectionBreadcrumbs.slice(0, event.depth + 1)
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
setSelectedField: (context, event) => {
|
|
169
|
+
return {
|
|
170
|
+
...context,
|
|
171
|
+
selectionBreadcrumbs: [{
|
|
172
|
+
type: "Block",
|
|
173
|
+
id: event.blockId
|
|
174
|
+
}, {
|
|
175
|
+
type: event.fieldType,
|
|
176
|
+
id: event.fieldName
|
|
177
|
+
}]
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
clearSelection: (context) => {
|
|
181
|
+
return {
|
|
182
|
+
...context,
|
|
183
|
+
selectionBreadcrumbs: []
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
clearFocusedBlock: (context) => {
|
|
187
|
+
return {
|
|
188
|
+
...context,
|
|
189
|
+
selectionBreadcrumbs: []
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
selectParentBreadcrumb: (context) => {
|
|
193
|
+
if (context.selectionBreadcrumbs.length === 0) return context;
|
|
194
|
+
return {
|
|
195
|
+
...context,
|
|
196
|
+
selectionBreadcrumbs: context.selectionBreadcrumbs.slice(0, -1)
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
setPeekedPage: (context, event) => {
|
|
200
|
+
return {
|
|
201
|
+
...context,
|
|
202
|
+
selectionBreadcrumbs: [],
|
|
203
|
+
peekedPagePathname: event.pathname
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
clearPeekedPage: (context) => {
|
|
207
|
+
return {
|
|
208
|
+
...context,
|
|
209
|
+
peekedPagePathname: null
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
openAddBlockSheet: (context, event) => {
|
|
213
|
+
return {
|
|
214
|
+
...context,
|
|
215
|
+
isAddBlockSheetOpen: true,
|
|
216
|
+
peekedBlock: null,
|
|
217
|
+
peekedBlockPosition: event.afterPosition ?? null
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
closeAddBlockSheet: (context) => {
|
|
221
|
+
return {
|
|
222
|
+
...context,
|
|
223
|
+
isAddBlockSheetOpen: false,
|
|
224
|
+
peekedBlock: null,
|
|
225
|
+
peekedBlockPosition: null
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
focusCreatedBlock: (context, event) => {
|
|
229
|
+
return {
|
|
230
|
+
...context,
|
|
231
|
+
selectionBreadcrumbs: [{
|
|
232
|
+
type: "Block",
|
|
233
|
+
id: event.blockId
|
|
234
|
+
}],
|
|
235
|
+
isAddBlockSheetOpen: false,
|
|
236
|
+
peekedBlock: null,
|
|
237
|
+
peekedBlockPosition: null,
|
|
238
|
+
skipPeekedBlockExitAnimation: true
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
clearSkipPeekedBlockExitAnimation: (context) => {
|
|
242
|
+
return {
|
|
243
|
+
...context,
|
|
244
|
+
skipPeekedBlockExitAnimation: false
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
toggleContentSheet: (context) => {
|
|
248
|
+
return {
|
|
249
|
+
...context,
|
|
250
|
+
isPageContentSheetOpen: !context.isPageContentSheetOpen
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
openBlockContentSheet: (context, event) => {
|
|
254
|
+
const currentBlockMatches = context.selectionBreadcrumbs[0]?.id === event.blockId;
|
|
255
|
+
return {
|
|
256
|
+
...context,
|
|
257
|
+
isPageContentSheetOpen: true,
|
|
258
|
+
selectionBreadcrumbs: currentBlockMatches ? context.selectionBreadcrumbs : [{
|
|
259
|
+
type: "Block",
|
|
260
|
+
id: event.blockId
|
|
261
|
+
}]
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
setSelectionBreadcrumbs: (context, event) => {
|
|
265
|
+
return {
|
|
266
|
+
...context,
|
|
267
|
+
selectionBreadcrumbs: event.breadcrumbs
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
closeBlockContentSheet: (context) => {
|
|
271
|
+
return {
|
|
272
|
+
...context,
|
|
273
|
+
isPageContentSheetOpen: false
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
openAgentChatSheet: (context) => {
|
|
277
|
+
return {
|
|
278
|
+
...context,
|
|
279
|
+
isAgentChatSheetOpen: true
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
closeAgentChatSheet: (context) => {
|
|
283
|
+
return {
|
|
284
|
+
...context,
|
|
285
|
+
isAgentChatSheetOpen: false
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
openCreatePageSheet: (context) => {
|
|
289
|
+
return {
|
|
290
|
+
...context,
|
|
291
|
+
isCreatePageSheetOpen: true
|
|
292
|
+
};
|
|
293
|
+
},
|
|
294
|
+
closeCreatePageSheet: (context) => {
|
|
295
|
+
return {
|
|
296
|
+
...context,
|
|
297
|
+
isCreatePageSheetOpen: false
|
|
298
|
+
};
|
|
299
|
+
},
|
|
300
|
+
openEditPageSheet: (context, event) => {
|
|
301
|
+
return {
|
|
302
|
+
...context,
|
|
303
|
+
editingPage: event.page
|
|
304
|
+
};
|
|
305
|
+
},
|
|
306
|
+
closeEditPageSheet: (context) => {
|
|
307
|
+
return {
|
|
308
|
+
...context,
|
|
309
|
+
editingPage: null
|
|
310
|
+
};
|
|
311
|
+
},
|
|
312
|
+
setIframeElement: (context, event) => {
|
|
313
|
+
return {
|
|
314
|
+
...context,
|
|
315
|
+
iframeElement: event.element
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
//#endregion
|
|
321
|
+
export { previewStore };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CamoxApp } from '../../core/createApp';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface CamoxProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
camoxApp: CamoxApp;
|
|
6
|
+
convexUrl: string;
|
|
7
|
+
managementUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CamoxProvider({ children, camoxApp, convexUrl, managementUrl, }: CamoxProviderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=CamoxProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CamoxProvider.d.ts","sourceRoot":"","sources":["../../../src/features/provider/CamoxProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiEjD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,aAAa,GACd,EAAE,kBAAkB,kDA4BpB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CamoxAppProvider } from "./components/CamoxAppContext.js";
|
|
2
|
+
import { useTheme, useThemeActions } from "../studio/useTheme.js";
|
|
3
|
+
import { useNavbarActions } from "../studio/components/Navbar.js";
|
|
4
|
+
import { usePreviewPagesActions } from "../preview/CamoxPreview.js";
|
|
5
|
+
import { CommandPalette, useCommandPaletteActions } from "./components/CommandPalette.js";
|
|
6
|
+
import { useAdminShortcuts } from "./useAdminShortcuts.js";
|
|
7
|
+
import { Toaster } from "@camox/ui/toaster";
|
|
8
|
+
import { ConvexReactClient } from "convex/react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { AuthContext, createCamoxAuthClient, useAuthActions, useProcessOtt, useSignInRedirect } from "@/lib/auth";
|
|
12
|
+
import { ConvexBetterAuthProvider } from "@convex-dev/better-auth/react";
|
|
13
|
+
import studioCssUrl from "virtual:camox-studio-css";
|
|
14
|
+
import { AuthGate } from "@/components/AuthGate";
|
|
15
|
+
//#region src/features/provider/CamoxProvider.tsx
|
|
16
|
+
var AuthenticatedCamoxProvider = ({ children }) => {
|
|
17
|
+
useAdminShortcuts();
|
|
18
|
+
useCommandPaletteActions();
|
|
19
|
+
useThemeActions();
|
|
20
|
+
useAuthActions();
|
|
21
|
+
useNavbarActions();
|
|
22
|
+
usePreviewPagesActions();
|
|
23
|
+
const { theme } = useTheme();
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
children,
|
|
26
|
+
/* @__PURE__ */ jsx(Toaster, { theme }),
|
|
27
|
+
/* @__PURE__ */ jsx(CommandPalette, {})
|
|
28
|
+
] });
|
|
29
|
+
};
|
|
30
|
+
var UnauthenticatedCamoxProvider = ({ children }) => {
|
|
31
|
+
const signInRedirect = useSignInRedirect();
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
const handleKeyDown = (event) => {
|
|
34
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Escape") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
signInRedirect();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
40
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
41
|
+
}, [signInRedirect]);
|
|
42
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
43
|
+
className: "bg-background min-h-screen",
|
|
44
|
+
children
|
|
45
|
+
}) });
|
|
46
|
+
};
|
|
47
|
+
function CamoxProvider({ children, camoxApp, convexUrl, managementUrl }) {
|
|
48
|
+
const convexReactClient = React.useMemo(() => new ConvexReactClient(convexUrl), [convexUrl]);
|
|
49
|
+
const authClient = React.useMemo(() => createCamoxAuthClient(managementUrl), [managementUrl]);
|
|
50
|
+
if (!useProcessOtt(authClient)) return null;
|
|
51
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, {
|
|
52
|
+
value: {
|
|
53
|
+
authClient,
|
|
54
|
+
managementUrl
|
|
55
|
+
},
|
|
56
|
+
children: /* @__PURE__ */ jsx(ConvexBetterAuthProvider, {
|
|
57
|
+
client: convexReactClient,
|
|
58
|
+
authClient,
|
|
59
|
+
children: /* @__PURE__ */ jsx(CamoxAppProvider, {
|
|
60
|
+
app: camoxApp,
|
|
61
|
+
children: /* @__PURE__ */ jsx(AuthGate, {
|
|
62
|
+
authenticated: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("link", {
|
|
63
|
+
rel: "stylesheet",
|
|
64
|
+
href: studioCssUrl
|
|
65
|
+
}), /* @__PURE__ */ jsx(AuthenticatedCamoxProvider, { children })] }),
|
|
66
|
+
unauthenticated: /* @__PURE__ */ jsx(UnauthenticatedCamoxProvider, { children })
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { CamoxProvider };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as icons from "lucide-react";
|
|
2
|
+
type IconKey = keyof typeof icons;
|
|
3
|
+
export type ActionGroupLabel = "Preview" | "Studio" | "Navigation" | "Invisible";
|
|
4
|
+
export interface Action {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
groupLabel: ActionGroupLabel;
|
|
8
|
+
shortcut?: {
|
|
9
|
+
key: string;
|
|
10
|
+
withMeta?: boolean;
|
|
11
|
+
withAlt?: boolean;
|
|
12
|
+
withShift?: boolean;
|
|
13
|
+
};
|
|
14
|
+
icon?: IconKey;
|
|
15
|
+
parentActionId?: string;
|
|
16
|
+
hasChildren?: boolean;
|
|
17
|
+
execute: () => void;
|
|
18
|
+
checkIfAvailable: () => boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const actionsStore: import('@xstate/store').Store<{
|
|
21
|
+
actions: Action[];
|
|
22
|
+
}, import('@xstate/store').ExtractEvents<{
|
|
23
|
+
registerAction: {
|
|
24
|
+
action: Action;
|
|
25
|
+
};
|
|
26
|
+
unregisterAction: {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
registerManyActions: {
|
|
30
|
+
actions: Action[];
|
|
31
|
+
};
|
|
32
|
+
unregisterManyActions: {
|
|
33
|
+
ids: string[];
|
|
34
|
+
};
|
|
35
|
+
}>, {
|
|
36
|
+
type: string;
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=actionsStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionsStore.d.ts","sourceRoot":"","sources":["../../../src/features/provider/actionsStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,KAAK,OAAO,GAAG,MAAM,OAAO,KAAK,CAAC;AAClC,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAEjF,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACvF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,YAAY;aACgB,MAAM,EAAE;;;gBAEF,MAAM;;;YAMR,MAAM;;;iBAME,MAAM,EAAE;;;aAMV,MAAM,EAAE;;;;EAOzD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createStore } from "@xstate/store";
|
|
2
|
+
//#region src/features/provider/actionsStore.ts
|
|
3
|
+
var actionsStore = createStore({
|
|
4
|
+
context: { actions: [] },
|
|
5
|
+
on: {
|
|
6
|
+
registerAction: (context, event) => {
|
|
7
|
+
if (context.actions.find((action) => action.id === event.action.id)) return context;
|
|
8
|
+
return {
|
|
9
|
+
...context,
|
|
10
|
+
actions: [...context.actions, event.action]
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
unregisterAction: (context, event) => {
|
|
14
|
+
return {
|
|
15
|
+
...context,
|
|
16
|
+
actions: context.actions.filter((action) => action.id !== event.id)
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
registerManyActions: (context, event) => {
|
|
20
|
+
const newActions = event.actions.filter((newAction) => !context.actions.find((action) => action.id === newAction.id));
|
|
21
|
+
return {
|
|
22
|
+
...context,
|
|
23
|
+
actions: [...context.actions, ...newActions]
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
unregisterManyActions: (context, event) => {
|
|
27
|
+
return {
|
|
28
|
+
...context,
|
|
29
|
+
actions: context.actions.filter((action) => !event.ids.includes(action.id))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { actionsStore };
|