@drawo-app/drawo 2.0.11 → 2.0.12
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.cjs +112 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -3
- package/dist/index.d.ts +80 -3
- package/dist/index.js +9648 -9595
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -44,9 +44,35 @@ export interface DrawoEmptyStateConfig {
|
|
|
44
44
|
|
|
45
45
|
export interface DrawoTopBarProps {
|
|
46
46
|
children?: ReactNode;
|
|
47
|
+
/** Content to render before MenuBar (left side) */
|
|
47
48
|
left?: ReactNode;
|
|
49
|
+
/** Fully replace the right section content. When set, rightBefore/rightAfter are ignored. */
|
|
48
50
|
right?: ReactNode;
|
|
51
|
+
/** Content inserted before the default right items (Timer, MusicBar, Sidebar). */
|
|
52
|
+
rightBefore?: ReactNode;
|
|
53
|
+
/** Content inserted after the default right items (Timer, MusicBar, Sidebar). */
|
|
54
|
+
rightAfter?: ReactNode;
|
|
55
|
+
/** Show/hide the default MenuBar. Default: true */
|
|
49
56
|
showMenuBar?: boolean;
|
|
57
|
+
/** Show/hide the default Timer in the right section. Default: true */
|
|
58
|
+
showTimer?: boolean;
|
|
59
|
+
/** Show/hide the default MusicBar in the right section. Default: true */
|
|
60
|
+
showMusicBar?: boolean;
|
|
61
|
+
/** Show/hide the default Sidebar launcher in the right section. Default: true */
|
|
62
|
+
showSidebarLauncher?: boolean;
|
|
63
|
+
/** Extra props forwarded to the built-in MenuBar (only when showMenuBar=true) */
|
|
64
|
+
menuBarProps?: Omit<
|
|
65
|
+
MenuBarProps,
|
|
66
|
+
| "scene"
|
|
67
|
+
| "locale"
|
|
68
|
+
| "messages"
|
|
69
|
+
| "setLocale"
|
|
70
|
+
| "setScene"
|
|
71
|
+
| "setSceneWithoutHistory"
|
|
72
|
+
| "onExportProject"
|
|
73
|
+
| "onExportImage"
|
|
74
|
+
| "onOpenProject"
|
|
75
|
+
>;
|
|
50
76
|
}
|
|
51
77
|
|
|
52
78
|
export interface DrawoCanvasProps {
|
|
@@ -145,7 +171,7 @@ export interface DrawoContextValue {
|
|
|
145
171
|
setScene: (updater: React.SetStateAction<Scene>) => void;
|
|
146
172
|
setSceneWithoutHistory: (updater: React.SetStateAction<Scene>) => void;
|
|
147
173
|
commitInteractionHistory: (before: Scene) => void;
|
|
148
|
-
dispatch: (action: { type: string;
|
|
174
|
+
dispatch: (action: { type: string;[key: string]: unknown }) => void;
|
|
149
175
|
setInteractionMode: (mode: "select" | "pan") => void;
|
|
150
176
|
setDrawingTool: (tool: NewElementType | "laser" | null) => void;
|
|
151
177
|
setOpenTopbarPanel: (panel: "music" | "timer" | "sidebar" | null | ((prev: "music" | "timer" | "sidebar" | null) => "music" | "timer" | "sidebar" | null)) => void;
|
|
@@ -156,9 +182,38 @@ export interface DrawoContextValue {
|
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
export type ExportImageFormat = "png" | "jpg" | "svg" | "pdf";
|
|
159
|
-
export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;
|
|
185
|
+
export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;[key: string]: unknown };
|
|
160
186
|
export type LibraryCategoryId = string;
|
|
161
187
|
|
|
188
|
+
export interface MenuBarProps {
|
|
189
|
+
scene: Scene;
|
|
190
|
+
locale: "en_US" | "es_ES";
|
|
191
|
+
messages: LocaleMessages;
|
|
192
|
+
setLocale: (locale: "en_US" | "es_ES") => void;
|
|
193
|
+
setScene: (updater: React.SetStateAction<Scene>) => void;
|
|
194
|
+
setSceneWithoutHistory: (updater: React.SetStateAction<Scene>) => void;
|
|
195
|
+
onExportProject: () => void;
|
|
196
|
+
onExportImage: (options: {
|
|
197
|
+
format: ExportImageFormat;
|
|
198
|
+
qualityScale: number;
|
|
199
|
+
transparentBackground: boolean;
|
|
200
|
+
padding: number;
|
|
201
|
+
}) => Promise<void>;
|
|
202
|
+
onOpenProject: (file: File) => Promise<void>;
|
|
203
|
+
/** Extra items appended inside the File submenu (before the separator + Clear). */
|
|
204
|
+
extraFileItems?: ReactNode;
|
|
205
|
+
/** Extra items appended inside the View submenu. */
|
|
206
|
+
extraViewItems?: ReactNode;
|
|
207
|
+
/** Extra items appended inside the Settings submenu. */
|
|
208
|
+
extraSettingsItems?: ReactNode;
|
|
209
|
+
/** Custom top-level submenus inserted between Organize and the links section. */
|
|
210
|
+
extraMenuSections?: ReactNode;
|
|
211
|
+
/** Content rendered right before the links section (Github, Discord, Donate). */
|
|
212
|
+
beforeLinks?: ReactNode;
|
|
213
|
+
/** Content rendered after Settings (at the very end of the menu). */
|
|
214
|
+
afterSettings?: ReactNode;
|
|
215
|
+
}
|
|
216
|
+
|
|
162
217
|
export function useDrawo(): DrawoContextValue;
|
|
163
218
|
export function DrawoProvider(props: DrawoProps & { children: ReactNode }): JSX.Element;
|
|
164
219
|
|
|
@@ -178,10 +233,32 @@ export function DrawoUndoBar(): JSX.Element;
|
|
|
178
233
|
export function DrawoZoomBar(): JSX.Element;
|
|
179
234
|
export function DrawoEmptyState(props: DrawoEmptyStateProps): JSX.Element;
|
|
180
235
|
|
|
236
|
+
/** Default right-side content: Timer + MusicBar + SidebarLauncher. */
|
|
237
|
+
export function DefaultTopBarRight(): JSX.Element;
|
|
238
|
+
/** Default MenuBar wired to Drawo context. Accepts MenuBar slot props. */
|
|
239
|
+
export function DefaultMenuBar(props?: Omit<
|
|
240
|
+
MenuBarProps,
|
|
241
|
+
| "scene"
|
|
242
|
+
| "locale"
|
|
243
|
+
| "messages"
|
|
244
|
+
| "setLocale"
|
|
245
|
+
| "setScene"
|
|
246
|
+
| "setSceneWithoutHistory"
|
|
247
|
+
| "onExportProject"
|
|
248
|
+
| "onExportImage"
|
|
249
|
+
| "onOpenProject"
|
|
250
|
+
>): JSX.Element;
|
|
251
|
+
/** Default Timer wired to Drawo context. */
|
|
252
|
+
export function DefaultTimer(): JSX.Element;
|
|
253
|
+
/** Default MusicBar wired to Drawo context. */
|
|
254
|
+
export function DefaultMusicBar(): JSX.Element;
|
|
255
|
+
/** Default Sidebar launcher button wired to Drawo context. */
|
|
256
|
+
export function DefaultSidebarLauncher(): JSX.Element;
|
|
257
|
+
|
|
181
258
|
export function Timer(props: { isOpen: boolean; onOpenChange: (next: boolean) => void; messages: LocaleMessages }): JSX.Element;
|
|
182
259
|
export function MusicBar(props: { isOpen: boolean; onOpenChange: (next: boolean) => void; messages: LocaleMessages }): JSX.Element;
|
|
183
260
|
|
|
184
|
-
export function MenuBar(props:
|
|
261
|
+
export function MenuBar(props: MenuBarProps): JSX.Element;
|
|
185
262
|
export function ToolBar(props: Record<string, unknown>): JSX.Element;
|
|
186
263
|
export function UndoBar(props: { canUndo: boolean; canRedo: boolean; onUndo: () => void; onRedo: () => void }): JSX.Element;
|
|
187
264
|
export function ZoomBar(props: { zoomPercent: number; canZoomOut: boolean; canZoomIn: boolean; onZoomOut: () => void; onZoomIn: () => void; onZoomReset: () => void }): JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -44,9 +44,35 @@ export interface DrawoEmptyStateConfig {
|
|
|
44
44
|
|
|
45
45
|
export interface DrawoTopBarProps {
|
|
46
46
|
children?: ReactNode;
|
|
47
|
+
/** Content to render before MenuBar (left side) */
|
|
47
48
|
left?: ReactNode;
|
|
49
|
+
/** Fully replace the right section content. When set, rightBefore/rightAfter are ignored. */
|
|
48
50
|
right?: ReactNode;
|
|
51
|
+
/** Content inserted before the default right items (Timer, MusicBar, Sidebar). */
|
|
52
|
+
rightBefore?: ReactNode;
|
|
53
|
+
/** Content inserted after the default right items (Timer, MusicBar, Sidebar). */
|
|
54
|
+
rightAfter?: ReactNode;
|
|
55
|
+
/** Show/hide the default MenuBar. Default: true */
|
|
49
56
|
showMenuBar?: boolean;
|
|
57
|
+
/** Show/hide the default Timer in the right section. Default: true */
|
|
58
|
+
showTimer?: boolean;
|
|
59
|
+
/** Show/hide the default MusicBar in the right section. Default: true */
|
|
60
|
+
showMusicBar?: boolean;
|
|
61
|
+
/** Show/hide the default Sidebar launcher in the right section. Default: true */
|
|
62
|
+
showSidebarLauncher?: boolean;
|
|
63
|
+
/** Extra props forwarded to the built-in MenuBar (only when showMenuBar=true) */
|
|
64
|
+
menuBarProps?: Omit<
|
|
65
|
+
MenuBarProps,
|
|
66
|
+
| "scene"
|
|
67
|
+
| "locale"
|
|
68
|
+
| "messages"
|
|
69
|
+
| "setLocale"
|
|
70
|
+
| "setScene"
|
|
71
|
+
| "setSceneWithoutHistory"
|
|
72
|
+
| "onExportProject"
|
|
73
|
+
| "onExportImage"
|
|
74
|
+
| "onOpenProject"
|
|
75
|
+
>;
|
|
50
76
|
}
|
|
51
77
|
|
|
52
78
|
export interface DrawoCanvasProps {
|
|
@@ -145,7 +171,7 @@ export interface DrawoContextValue {
|
|
|
145
171
|
setScene: (updater: React.SetStateAction<Scene>) => void;
|
|
146
172
|
setSceneWithoutHistory: (updater: React.SetStateAction<Scene>) => void;
|
|
147
173
|
commitInteractionHistory: (before: Scene) => void;
|
|
148
|
-
dispatch: (action: { type: string;
|
|
174
|
+
dispatch: (action: { type: string;[key: string]: unknown }) => void;
|
|
149
175
|
setInteractionMode: (mode: "select" | "pan") => void;
|
|
150
176
|
setDrawingTool: (tool: NewElementType | "laser" | null) => void;
|
|
151
177
|
setOpenTopbarPanel: (panel: "music" | "timer" | "sidebar" | null | ((prev: "music" | "timer" | "sidebar" | null) => "music" | "timer" | "sidebar" | null)) => void;
|
|
@@ -156,9 +182,38 @@ export interface DrawoContextValue {
|
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
export type ExportImageFormat = "png" | "jpg" | "svg" | "pdf";
|
|
159
|
-
export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;
|
|
185
|
+
export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;[key: string]: unknown };
|
|
160
186
|
export type LibraryCategoryId = string;
|
|
161
187
|
|
|
188
|
+
export interface MenuBarProps {
|
|
189
|
+
scene: Scene;
|
|
190
|
+
locale: "en_US" | "es_ES";
|
|
191
|
+
messages: LocaleMessages;
|
|
192
|
+
setLocale: (locale: "en_US" | "es_ES") => void;
|
|
193
|
+
setScene: (updater: React.SetStateAction<Scene>) => void;
|
|
194
|
+
setSceneWithoutHistory: (updater: React.SetStateAction<Scene>) => void;
|
|
195
|
+
onExportProject: () => void;
|
|
196
|
+
onExportImage: (options: {
|
|
197
|
+
format: ExportImageFormat;
|
|
198
|
+
qualityScale: number;
|
|
199
|
+
transparentBackground: boolean;
|
|
200
|
+
padding: number;
|
|
201
|
+
}) => Promise<void>;
|
|
202
|
+
onOpenProject: (file: File) => Promise<void>;
|
|
203
|
+
/** Extra items appended inside the File submenu (before the separator + Clear). */
|
|
204
|
+
extraFileItems?: ReactNode;
|
|
205
|
+
/** Extra items appended inside the View submenu. */
|
|
206
|
+
extraViewItems?: ReactNode;
|
|
207
|
+
/** Extra items appended inside the Settings submenu. */
|
|
208
|
+
extraSettingsItems?: ReactNode;
|
|
209
|
+
/** Custom top-level submenus inserted between Organize and the links section. */
|
|
210
|
+
extraMenuSections?: ReactNode;
|
|
211
|
+
/** Content rendered right before the links section (Github, Discord, Donate). */
|
|
212
|
+
beforeLinks?: ReactNode;
|
|
213
|
+
/** Content rendered after Settings (at the very end of the menu). */
|
|
214
|
+
afterSettings?: ReactNode;
|
|
215
|
+
}
|
|
216
|
+
|
|
162
217
|
export function useDrawo(): DrawoContextValue;
|
|
163
218
|
export function DrawoProvider(props: DrawoProps & { children: ReactNode }): JSX.Element;
|
|
164
219
|
|
|
@@ -178,10 +233,32 @@ export function DrawoUndoBar(): JSX.Element;
|
|
|
178
233
|
export function DrawoZoomBar(): JSX.Element;
|
|
179
234
|
export function DrawoEmptyState(props: DrawoEmptyStateProps): JSX.Element;
|
|
180
235
|
|
|
236
|
+
/** Default right-side content: Timer + MusicBar + SidebarLauncher. */
|
|
237
|
+
export function DefaultTopBarRight(): JSX.Element;
|
|
238
|
+
/** Default MenuBar wired to Drawo context. Accepts MenuBar slot props. */
|
|
239
|
+
export function DefaultMenuBar(props?: Omit<
|
|
240
|
+
MenuBarProps,
|
|
241
|
+
| "scene"
|
|
242
|
+
| "locale"
|
|
243
|
+
| "messages"
|
|
244
|
+
| "setLocale"
|
|
245
|
+
| "setScene"
|
|
246
|
+
| "setSceneWithoutHistory"
|
|
247
|
+
| "onExportProject"
|
|
248
|
+
| "onExportImage"
|
|
249
|
+
| "onOpenProject"
|
|
250
|
+
>): JSX.Element;
|
|
251
|
+
/** Default Timer wired to Drawo context. */
|
|
252
|
+
export function DefaultTimer(): JSX.Element;
|
|
253
|
+
/** Default MusicBar wired to Drawo context. */
|
|
254
|
+
export function DefaultMusicBar(): JSX.Element;
|
|
255
|
+
/** Default Sidebar launcher button wired to Drawo context. */
|
|
256
|
+
export function DefaultSidebarLauncher(): JSX.Element;
|
|
257
|
+
|
|
181
258
|
export function Timer(props: { isOpen: boolean; onOpenChange: (next: boolean) => void; messages: LocaleMessages }): JSX.Element;
|
|
182
259
|
export function MusicBar(props: { isOpen: boolean; onOpenChange: (next: boolean) => void; messages: LocaleMessages }): JSX.Element;
|
|
183
260
|
|
|
184
|
-
export function MenuBar(props:
|
|
261
|
+
export function MenuBar(props: MenuBarProps): JSX.Element;
|
|
185
262
|
export function ToolBar(props: Record<string, unknown>): JSX.Element;
|
|
186
263
|
export function UndoBar(props: { canUndo: boolean; canRedo: boolean; onUndo: () => void; onRedo: () => void }): JSX.Element;
|
|
187
264
|
export function ZoomBar(props: { zoomPercent: number; canZoomOut: boolean; canZoomIn: boolean; onZoomOut: () => void; onZoomIn: () => void; onZoomReset: () => void }): JSX.Element;
|