@powerhousedao/codegen 5.0.0-staging.19 → 5.0.0-staging.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/codegen",
3
- "version": "5.0.0-staging.19",
3
+ "version": "5.0.0-staging.20",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "type": "module",
@@ -34,11 +34,11 @@
34
34
  "kysely-pglite": "^0.6.1",
35
35
  "prettier": "^3.4.2",
36
36
  "ts-morph": "^26.0.0",
37
- "@powerhousedao/common": "5.0.0-staging.19",
38
- "@powerhousedao/config": "5.0.0-staging.19",
39
- "@powerhousedao/reactor-browser": "5.0.0-staging.19",
40
- "document-model": "5.0.0-staging.19",
41
- "@powerhousedao/design-system": "5.0.0-staging.19"
37
+ "@powerhousedao/common": "5.0.0-staging.20",
38
+ "@powerhousedao/config": "5.0.0-staging.20",
39
+ "@powerhousedao/design-system": "5.0.0-staging.20",
40
+ "@powerhousedao/reactor-browser": "5.0.0-staging.20",
41
+ "document-model": "5.0.0-staging.20"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@graphql-codegen/core": "^4.0.2",
@@ -52,7 +52,7 @@
52
52
  "react-dom": "^18.3.1",
53
53
  "vitest": "^3.1.2",
54
54
  "zod": "^3.24.3",
55
- "document-drive": "5.0.0-staging.19"
55
+ "document-drive": "5.0.0-staging.20"
56
56
  },
57
57
  "scripts": {
58
58
  "build:tsc": "tsc --build",
@@ -1,103 +0,0 @@
1
- ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/components/EditorContainer.tsx"
3
- unless_exists: true
4
- ---
5
- import { getRevisionFromDate, useTimelineItems } from "@powerhousedao/common";
6
- import {
7
- DefaultEditorLoader,
8
- DocumentToolbar,
9
- RevisionHistory,
10
- type TimelineItem,
11
- } from "@powerhousedao/design-system";
12
- import {
13
- exportFile,
14
- useEditorModuleById,
15
- useSelectedDocument,
16
- useSelectedDrive,
17
- } from "@powerhousedao/reactor-browser";
18
- import { Suspense, useCallback, useState } from "react";
19
-
20
- /**
21
- * Document editor container that wraps individual document editors.
22
- * Handles document loading, toolbar, revision history, and dynamic editor loading.
23
- * Customize toolbar actions and editor context here.
24
- */
25
- export const EditorContainer = (props: { handleClose: () => void }) => {
26
- const { handleClose } = props;
27
- // UI state for revision history and timeline
28
- const [selectedTimelineItem, setSelectedTimelineItem] =
29
- useState<TimelineItem | null>(null);
30
- const [showRevisionHistory, setShowRevisionHistory] = useState(false);
31
- const [selectedDocument, dispatch] = useSelectedDocument();
32
- const [selectedDrive] = useSelectedDrive();
33
- // Timeline data for revision history
34
- const timelineItems = useTimelineItems(
35
- selectedDocument?.header.id,
36
- selectedDocument?.header.createdAtUtcIso,
37
- selectedDrive?.header.id,
38
- );
39
- const editorModule = useEditorModuleById(
40
- selectedDocument?.header.meta?.preferredEditor,
41
- );
42
-
43
- // Document export functionality - customize export behavior here
44
- const onExport = useCallback(async () => {
45
- if (selectedDocument) {
46
- await exportFile(selectedDocument);
47
- }
48
- }, [selectedDocument]);
49
-
50
- // Loading state component
51
- const loadingContent = (
52
- <div className="flex h-full flex-1 items-center justify-center">
53
- <DefaultEditorLoader />
54
- </div>
55
- );
56
-
57
- if (!selectedDocument) return loadingContent;
58
-
59
- // Dynamically load the appropriate editor component for this document type
60
- const EditorComponent = editorModule?.Component;
61
- if (!EditorComponent) return loadingContent;
62
-
63
- return showRevisionHistory ? (
64
- // Revision history view
65
- <RevisionHistory
66
- documentId={selectedDocument.header.id}
67
- documentTitle={selectedDocument.header.name}
68
- globalOperations={selectedDocument.operations.global}
69
- key={selectedDocument.header.id}
70
- localOperations={selectedDocument.operations.local}
71
- onClose={() => setShowRevisionHistory(false)}
72
- />
73
- ) : (
74
- // Main editor view
75
- <Suspense fallback={loadingContent}>
76
- {/* Document toolbar - customize available actions here */}
77
- <DocumentToolbar
78
- onClose={handleClose}
79
- onExport={onExport}
80
- onShowRevisionHistory={() => setShowRevisionHistory(true)}
81
- onSwitchboardLinkClick={() => {}} // Customize switchboard integration
82
- title={selectedDocument.header.name}
83
- timelineButtonVisible={editorModule.config.timelineEnabled}
84
- timelineItems={timelineItems.data}
85
- onTimelineItemClick={setSelectedTimelineItem}
86
- />
87
- {/* Dynamic editor component based on document type */}
88
- <EditorComponent
89
- context={{
90
- readMode: !!selectedTimelineItem,
91
- selectedTimelineRevision: getRevisionFromDate(
92
- selectedTimelineItem?.startDate,
93
- selectedTimelineItem?.endDate,
94
- selectedDocument.operations.global,
95
- ),
96
- }}
97
- dispatch={dispatch}
98
- document={document}
99
- error={console.error}
100
- />
101
- </Suspense>
102
- );
103
- };
@@ -1,8 +0,0 @@
1
- ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/types/css.d.ts"
3
- unless_exists: true
4
- ---
5
- declare module '*.css' {
6
- const content: { [className: string]: string };
7
- export default content;
8
- }
@@ -1,51 +0,0 @@
1
- ---
2
- to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/utils/withDropZone.tsx"
3
- unless_exists: true
4
- ---
5
- import { DropZone } from "@powerhousedao/design-system";
6
- import type {
7
- ConflictResolution,
8
- DriveEditorProps,
9
- FileUploadProgressCallback,
10
- } from "@powerhousedao/reactor-browser";
11
- import { setSelectedNode, useOnDropFile } from "@powerhousedao/reactor-browser";
12
- import type { ComponentType } from "react";
13
-
14
- export function withDropZone<T extends DriveEditorProps>(
15
- WrappedComponent: ComponentType<T>,
16
- ): ComponentType<T> {
17
- const WithDropZoneComponent = (props: T) => {
18
- const onDropFile = useOnDropFile(props.editorConfig?.documentTypes);
19
-
20
- const onAddFile = async (
21
- file: File,
22
- parent: any,
23
- onProgress?: FileUploadProgressCallback,
24
- resolveConflict?: ConflictResolution,
25
- ) => {
26
- return await onDropFile(file, onProgress, resolveConflict);
27
- };
28
-
29
- if (props.editorConfig?.dragAndDrop?.enabled) {
30
- return (
31
- <DropZone
32
- onAddFile={onAddFile}
33
- setSelectedNode={setSelectedNode}
34
- driveId={props.document.header.id}
35
- useLocalStorage={true}
36
- style={{ height: "100%" }}
37
- >
38
- <WrappedComponent {...props} />
39
- </DropZone>
40
- );
41
- }
42
-
43
- return <WrappedComponent {...props} />;
44
- };
45
-
46
- WithDropZoneComponent.displayName = `withDropZone(${
47
- WrappedComponent.displayName || WrappedComponent.name || "Component"
48
- })`;
49
-
50
- return WithDropZoneComponent;
51
- }