rita-workspace 0.5.0 → 0.5.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/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +720 -198
- package/dist/index.mjs +715 -199
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,12 +5,19 @@ import React, { ReactNode } from 'react';
|
|
|
5
5
|
interface Drawing {
|
|
6
6
|
id: string;
|
|
7
7
|
name: string;
|
|
8
|
+
folderId?: string | null;
|
|
8
9
|
elements: unknown[];
|
|
9
10
|
appState: Record<string, unknown>;
|
|
10
11
|
files: Record<string, unknown>;
|
|
11
12
|
createdAt: number;
|
|
12
13
|
updatedAt: number;
|
|
13
14
|
}
|
|
15
|
+
interface Folder {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
}
|
|
14
21
|
interface Workspace {
|
|
15
22
|
id: string;
|
|
16
23
|
name: string;
|
|
@@ -34,16 +41,30 @@ interface RitaWorkspaceDB extends DBSchema {
|
|
|
34
41
|
'by-updated': number;
|
|
35
42
|
};
|
|
36
43
|
};
|
|
44
|
+
folders: {
|
|
45
|
+
key: string;
|
|
46
|
+
value: Folder;
|
|
47
|
+
indexes: {
|
|
48
|
+
'by-name': string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
37
51
|
}
|
|
38
52
|
declare function getDB(): Promise<IDBPDatabase<RitaWorkspaceDB>>;
|
|
39
53
|
declare function closeDB(): Promise<void>;
|
|
40
54
|
|
|
41
|
-
declare function createDrawing(name?: string, elements?: unknown[], appState?: Record<string, unknown
|
|
55
|
+
declare function createDrawing(name?: string, elements?: unknown[], appState?: Record<string, unknown>, folderId?: string | null): Promise<Drawing>;
|
|
42
56
|
declare function getDrawing(id: string): Promise<Drawing | undefined>;
|
|
43
57
|
declare function getAllDrawings(): Promise<Drawing[]>;
|
|
44
58
|
declare function updateDrawing(id: string, updates: Partial<Omit<Drawing, 'id' | 'createdAt'>>): Promise<Drawing | undefined>;
|
|
45
59
|
declare function deleteDrawing(id: string): Promise<boolean>;
|
|
46
60
|
declare function duplicateDrawing(id: string, newName?: string): Promise<Drawing | undefined>;
|
|
61
|
+
declare function moveDrawingToFolder(drawingId: string, folderId: string | null): Promise<Drawing | undefined>;
|
|
62
|
+
|
|
63
|
+
declare function createFolder(name: string): Promise<Folder>;
|
|
64
|
+
declare function getFolder(id: string): Promise<Folder | undefined>;
|
|
65
|
+
declare function getAllFolders(): Promise<Folder[]>;
|
|
66
|
+
declare function renameFolder(id: string, name: string): Promise<Folder | undefined>;
|
|
67
|
+
declare function deleteFolder(id: string): Promise<void>;
|
|
47
68
|
|
|
48
69
|
declare function getOrCreateDefaultWorkspace(): Promise<Workspace>;
|
|
49
70
|
declare function getWorkspace(id: string): Promise<Workspace | undefined>;
|
|
@@ -88,6 +109,13 @@ interface Translations {
|
|
|
88
109
|
importWorkspace: string;
|
|
89
110
|
exportDrawing: string;
|
|
90
111
|
importDrawing: string;
|
|
112
|
+
createFolder: string;
|
|
113
|
+
renameFolder: string;
|
|
114
|
+
deleteFolder: string;
|
|
115
|
+
deleteFolderConfirm: string;
|
|
116
|
+
moveToFolder: string;
|
|
117
|
+
moveToRoot: string;
|
|
118
|
+
newFolderName: string;
|
|
91
119
|
shortcutNewDrawing: string;
|
|
92
120
|
}
|
|
93
121
|
declare function getTranslations(langCode?: string): Translations;
|
|
@@ -96,17 +124,22 @@ declare function isLanguageSupported(langCode?: string): boolean;
|
|
|
96
124
|
interface WorkspaceContextValue {
|
|
97
125
|
workspace: Workspace | null;
|
|
98
126
|
drawings: Drawing[];
|
|
127
|
+
folders: Folder[];
|
|
99
128
|
activeDrawing: Drawing | null;
|
|
100
129
|
isLoading: boolean;
|
|
101
130
|
error: string | null;
|
|
102
131
|
isDrawingConflict: boolean;
|
|
103
132
|
lang: string;
|
|
104
133
|
t: Translations;
|
|
105
|
-
createNewDrawing: (name?: string) => Promise<Drawing | null>;
|
|
134
|
+
createNewDrawing: (name?: string, folderId?: string | null) => Promise<Drawing | null>;
|
|
106
135
|
switchDrawing: (id: string) => Promise<void>;
|
|
107
136
|
renameDrawing: (id: string, name: string) => Promise<void>;
|
|
108
137
|
removeDrawing: (id: string) => Promise<void>;
|
|
109
138
|
duplicateCurrentDrawing: () => Promise<Drawing | null>;
|
|
139
|
+
createFolder: (name: string) => Promise<Folder | null>;
|
|
140
|
+
renameFolder: (id: string, name: string) => Promise<void>;
|
|
141
|
+
deleteFolder: (id: string) => Promise<void>;
|
|
142
|
+
moveDrawingToFolder: (drawingId: string, folderId: string | null) => Promise<void>;
|
|
110
143
|
saveCurrentDrawing: (elements: unknown[], appState: Record<string, unknown>, files?: Record<string, unknown>) => Promise<void>;
|
|
111
144
|
saveDrawingById: (id: string, elements: unknown[], appState: Record<string, unknown>, files?: Record<string, unknown>) => Promise<void>;
|
|
112
145
|
refreshDrawings: () => Promise<void>;
|
|
@@ -342,4 +375,4 @@ interface WorkspacePluginProps {
|
|
|
342
375
|
*/
|
|
343
376
|
declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
|
|
344
377
|
|
|
345
|
-
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
|
378
|
+
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,19 @@ import React, { ReactNode } from 'react';
|
|
|
5
5
|
interface Drawing {
|
|
6
6
|
id: string;
|
|
7
7
|
name: string;
|
|
8
|
+
folderId?: string | null;
|
|
8
9
|
elements: unknown[];
|
|
9
10
|
appState: Record<string, unknown>;
|
|
10
11
|
files: Record<string, unknown>;
|
|
11
12
|
createdAt: number;
|
|
12
13
|
updatedAt: number;
|
|
13
14
|
}
|
|
15
|
+
interface Folder {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
}
|
|
14
21
|
interface Workspace {
|
|
15
22
|
id: string;
|
|
16
23
|
name: string;
|
|
@@ -34,16 +41,30 @@ interface RitaWorkspaceDB extends DBSchema {
|
|
|
34
41
|
'by-updated': number;
|
|
35
42
|
};
|
|
36
43
|
};
|
|
44
|
+
folders: {
|
|
45
|
+
key: string;
|
|
46
|
+
value: Folder;
|
|
47
|
+
indexes: {
|
|
48
|
+
'by-name': string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
37
51
|
}
|
|
38
52
|
declare function getDB(): Promise<IDBPDatabase<RitaWorkspaceDB>>;
|
|
39
53
|
declare function closeDB(): Promise<void>;
|
|
40
54
|
|
|
41
|
-
declare function createDrawing(name?: string, elements?: unknown[], appState?: Record<string, unknown
|
|
55
|
+
declare function createDrawing(name?: string, elements?: unknown[], appState?: Record<string, unknown>, folderId?: string | null): Promise<Drawing>;
|
|
42
56
|
declare function getDrawing(id: string): Promise<Drawing | undefined>;
|
|
43
57
|
declare function getAllDrawings(): Promise<Drawing[]>;
|
|
44
58
|
declare function updateDrawing(id: string, updates: Partial<Omit<Drawing, 'id' | 'createdAt'>>): Promise<Drawing | undefined>;
|
|
45
59
|
declare function deleteDrawing(id: string): Promise<boolean>;
|
|
46
60
|
declare function duplicateDrawing(id: string, newName?: string): Promise<Drawing | undefined>;
|
|
61
|
+
declare function moveDrawingToFolder(drawingId: string, folderId: string | null): Promise<Drawing | undefined>;
|
|
62
|
+
|
|
63
|
+
declare function createFolder(name: string): Promise<Folder>;
|
|
64
|
+
declare function getFolder(id: string): Promise<Folder | undefined>;
|
|
65
|
+
declare function getAllFolders(): Promise<Folder[]>;
|
|
66
|
+
declare function renameFolder(id: string, name: string): Promise<Folder | undefined>;
|
|
67
|
+
declare function deleteFolder(id: string): Promise<void>;
|
|
47
68
|
|
|
48
69
|
declare function getOrCreateDefaultWorkspace(): Promise<Workspace>;
|
|
49
70
|
declare function getWorkspace(id: string): Promise<Workspace | undefined>;
|
|
@@ -88,6 +109,13 @@ interface Translations {
|
|
|
88
109
|
importWorkspace: string;
|
|
89
110
|
exportDrawing: string;
|
|
90
111
|
importDrawing: string;
|
|
112
|
+
createFolder: string;
|
|
113
|
+
renameFolder: string;
|
|
114
|
+
deleteFolder: string;
|
|
115
|
+
deleteFolderConfirm: string;
|
|
116
|
+
moveToFolder: string;
|
|
117
|
+
moveToRoot: string;
|
|
118
|
+
newFolderName: string;
|
|
91
119
|
shortcutNewDrawing: string;
|
|
92
120
|
}
|
|
93
121
|
declare function getTranslations(langCode?: string): Translations;
|
|
@@ -96,17 +124,22 @@ declare function isLanguageSupported(langCode?: string): boolean;
|
|
|
96
124
|
interface WorkspaceContextValue {
|
|
97
125
|
workspace: Workspace | null;
|
|
98
126
|
drawings: Drawing[];
|
|
127
|
+
folders: Folder[];
|
|
99
128
|
activeDrawing: Drawing | null;
|
|
100
129
|
isLoading: boolean;
|
|
101
130
|
error: string | null;
|
|
102
131
|
isDrawingConflict: boolean;
|
|
103
132
|
lang: string;
|
|
104
133
|
t: Translations;
|
|
105
|
-
createNewDrawing: (name?: string) => Promise<Drawing | null>;
|
|
134
|
+
createNewDrawing: (name?: string, folderId?: string | null) => Promise<Drawing | null>;
|
|
106
135
|
switchDrawing: (id: string) => Promise<void>;
|
|
107
136
|
renameDrawing: (id: string, name: string) => Promise<void>;
|
|
108
137
|
removeDrawing: (id: string) => Promise<void>;
|
|
109
138
|
duplicateCurrentDrawing: () => Promise<Drawing | null>;
|
|
139
|
+
createFolder: (name: string) => Promise<Folder | null>;
|
|
140
|
+
renameFolder: (id: string, name: string) => Promise<void>;
|
|
141
|
+
deleteFolder: (id: string) => Promise<void>;
|
|
142
|
+
moveDrawingToFolder: (drawingId: string, folderId: string | null) => Promise<void>;
|
|
110
143
|
saveCurrentDrawing: (elements: unknown[], appState: Record<string, unknown>, files?: Record<string, unknown>) => Promise<void>;
|
|
111
144
|
saveDrawingById: (id: string, elements: unknown[], appState: Record<string, unknown>, files?: Record<string, unknown>) => Promise<void>;
|
|
112
145
|
refreshDrawings: () => Promise<void>;
|
|
@@ -342,4 +375,4 @@ interface WorkspacePluginProps {
|
|
|
342
375
|
*/
|
|
343
376
|
declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
|
|
344
377
|
|
|
345
|
-
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, deleteDrawing, duplicateDrawing, getAllDrawings, getDB, getDrawing, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, removeDrawingFromWorkspace, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
|
378
|
+
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|