rita-workspace 0.1.1 → 0.2.0

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IDBPDatabase, DBSchema } from 'idb';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { ReactNode } from 'react';
3
+ import React, { ReactNode } from 'react';
4
4
 
5
5
  interface Drawing {
6
6
  id: string;
@@ -90,6 +90,88 @@ interface DrawingListItemProps {
90
90
  }
91
91
  declare function DrawingListItem({ drawing, isActive, onSelect, onRename, onDelete, canDelete, }: DrawingListItemProps): react_jsx_runtime.JSX.Element;
92
92
 
93
+ /**
94
+ * Workspace Menu Items
95
+ *
96
+ * These components can be inserted into Excalidraw's main menu
97
+ * to provide workspace/multi-drawing functionality.
98
+ */
99
+
100
+ interface WorkspaceMenuItemsProps {
101
+ /**
102
+ * Called when a drawing is selected from the submenu
103
+ */
104
+ onDrawingSelect?: (drawing: Drawing) => void;
105
+ /**
106
+ * Called when "Manage Drawings" is clicked
107
+ */
108
+ onManageDrawings?: () => void;
109
+ /**
110
+ * Render function for menu item - allows integration with Excalidraw's DropdownMenuItem
111
+ */
112
+ renderMenuItem?: (props: {
113
+ icon: React.ReactNode;
114
+ children: React.ReactNode;
115
+ onSelect: () => void;
116
+ shortcut?: string;
117
+ }) => React.ReactNode;
118
+ /**
119
+ * Render function for submenu - allows integration with Excalidraw's DropdownMenuSub
120
+ */
121
+ renderSubMenu?: (props: {
122
+ trigger: React.ReactNode;
123
+ children: React.ReactNode;
124
+ }) => React.ReactNode;
125
+ /**
126
+ * Render function for separator
127
+ */
128
+ renderSeparator?: () => React.ReactNode;
129
+ }
130
+ /**
131
+ * WorkspaceMenuItems - provides menu items for workspace functionality
132
+ *
133
+ * Usage with Excalidraw's menu system:
134
+ * ```tsx
135
+ * <MainMenu>
136
+ * <MainMenu.DefaultItems.LoadScene />
137
+ * <MainMenu.DefaultItems.SaveToActiveFile />
138
+ * <MainMenu.Separator />
139
+ * <WorkspaceMenuItems
140
+ * renderMenuItem={(props) => <MainMenu.Item {...props} />}
141
+ * renderSubMenu={(props) => <MainMenu.Sub>{props.children}</MainMenu.Sub>}
142
+ * renderSeparator={() => <MainMenu.Separator />}
143
+ * />
144
+ * </MainMenu>
145
+ * ```
146
+ */
147
+ declare const WorkspaceMenuItems: React.FC<WorkspaceMenuItemsProps>;
148
+
149
+ /**
150
+ * Drawings Dialog
151
+ *
152
+ * A modal dialog for managing all drawings in the workspace.
153
+ * Provides full CRUD operations: view, rename, delete, create new.
154
+ */
155
+
156
+ interface DrawingsDialogProps {
157
+ /**
158
+ * Whether the dialog is open
159
+ */
160
+ open: boolean;
161
+ /**
162
+ * Called when the dialog should close
163
+ */
164
+ onClose: () => void;
165
+ /**
166
+ * Called when a drawing is selected
167
+ */
168
+ onDrawingSelect?: (drawing: Drawing) => void;
169
+ }
170
+ /**
171
+ * DrawingsDialog - modal for managing workspace drawings
172
+ */
173
+ declare const DrawingsDialog: React.FC<DrawingsDialogProps>;
174
+
93
175
  interface ExcalidrawAPI {
94
176
  getSceneElements: () => unknown[];
95
177
  getAppState: () => Record<string, unknown>;
@@ -142,4 +224,4 @@ interface WorkspacePluginProps {
142
224
  */
143
225
  declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
144
226
 
145
- export { type Drawing, DrawingList, DrawingListItem, Sidebar, type Workspace, type WorkspaceContextValue, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getWorkspace, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace };
227
+ export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, Sidebar, type Workspace, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getWorkspace, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IDBPDatabase, DBSchema } from 'idb';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { ReactNode } from 'react';
3
+ import React, { ReactNode } from 'react';
4
4
 
5
5
  interface Drawing {
6
6
  id: string;
@@ -90,6 +90,88 @@ interface DrawingListItemProps {
90
90
  }
91
91
  declare function DrawingListItem({ drawing, isActive, onSelect, onRename, onDelete, canDelete, }: DrawingListItemProps): react_jsx_runtime.JSX.Element;
92
92
 
93
+ /**
94
+ * Workspace Menu Items
95
+ *
96
+ * These components can be inserted into Excalidraw's main menu
97
+ * to provide workspace/multi-drawing functionality.
98
+ */
99
+
100
+ interface WorkspaceMenuItemsProps {
101
+ /**
102
+ * Called when a drawing is selected from the submenu
103
+ */
104
+ onDrawingSelect?: (drawing: Drawing) => void;
105
+ /**
106
+ * Called when "Manage Drawings" is clicked
107
+ */
108
+ onManageDrawings?: () => void;
109
+ /**
110
+ * Render function for menu item - allows integration with Excalidraw's DropdownMenuItem
111
+ */
112
+ renderMenuItem?: (props: {
113
+ icon: React.ReactNode;
114
+ children: React.ReactNode;
115
+ onSelect: () => void;
116
+ shortcut?: string;
117
+ }) => React.ReactNode;
118
+ /**
119
+ * Render function for submenu - allows integration with Excalidraw's DropdownMenuSub
120
+ */
121
+ renderSubMenu?: (props: {
122
+ trigger: React.ReactNode;
123
+ children: React.ReactNode;
124
+ }) => React.ReactNode;
125
+ /**
126
+ * Render function for separator
127
+ */
128
+ renderSeparator?: () => React.ReactNode;
129
+ }
130
+ /**
131
+ * WorkspaceMenuItems - provides menu items for workspace functionality
132
+ *
133
+ * Usage with Excalidraw's menu system:
134
+ * ```tsx
135
+ * <MainMenu>
136
+ * <MainMenu.DefaultItems.LoadScene />
137
+ * <MainMenu.DefaultItems.SaveToActiveFile />
138
+ * <MainMenu.Separator />
139
+ * <WorkspaceMenuItems
140
+ * renderMenuItem={(props) => <MainMenu.Item {...props} />}
141
+ * renderSubMenu={(props) => <MainMenu.Sub>{props.children}</MainMenu.Sub>}
142
+ * renderSeparator={() => <MainMenu.Separator />}
143
+ * />
144
+ * </MainMenu>
145
+ * ```
146
+ */
147
+ declare const WorkspaceMenuItems: React.FC<WorkspaceMenuItemsProps>;
148
+
149
+ /**
150
+ * Drawings Dialog
151
+ *
152
+ * A modal dialog for managing all drawings in the workspace.
153
+ * Provides full CRUD operations: view, rename, delete, create new.
154
+ */
155
+
156
+ interface DrawingsDialogProps {
157
+ /**
158
+ * Whether the dialog is open
159
+ */
160
+ open: boolean;
161
+ /**
162
+ * Called when the dialog should close
163
+ */
164
+ onClose: () => void;
165
+ /**
166
+ * Called when a drawing is selected
167
+ */
168
+ onDrawingSelect?: (drawing: Drawing) => void;
169
+ }
170
+ /**
171
+ * DrawingsDialog - modal for managing workspace drawings
172
+ */
173
+ declare const DrawingsDialog: React.FC<DrawingsDialogProps>;
174
+
93
175
  interface ExcalidrawAPI {
94
176
  getSceneElements: () => unknown[];
95
177
  getAppState: () => Record<string, unknown>;
@@ -142,4 +224,4 @@ interface WorkspacePluginProps {
142
224
  */
143
225
  declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
144
226
 
145
- export { type Drawing, DrawingList, DrawingListItem, Sidebar, type Workspace, type WorkspaceContextValue, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getWorkspace, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace };
227
+ export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, Sidebar, type Workspace, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getWorkspace, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace };