@drawo-app/drawo 2.0.20 → 2.0.22

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.cts CHANGED
@@ -29,6 +29,12 @@ export interface DrawoProps {
29
29
  onDrawingToolChange?: (tool: NewElementType | "laser" | null) => void;
30
30
  onLocaleChange?: (locale: "en_US" | "es_ES") => void;
31
31
  onThemeChange?: (theme: string, colorScheme: "light" | "dark") => void;
32
+ /** Current project name; surfaced in the built-in MenuBar rename dialog. */
33
+ projectName?: string | null;
34
+ /** When provided, the MenuBar shows a "go to home" entry that calls this. */
35
+ onGoHome?: () => void;
36
+ /** When provided, the MenuBar shows a "rename project" entry that calls this. */
37
+ onRenameProject?: (name: string) => void | Promise<void>;
32
38
  children?: ReactNode;
33
39
  }
34
40
 
@@ -203,6 +209,23 @@ export interface DrawoContextValue {
203
209
  }
204
210
 
205
211
  export type ExportImageFormat = "png" | "jpg" | "svg" | "pdf";
212
+ export interface ScenePreviewOptions {
213
+ scene: Scene;
214
+ /** Longest edge of the generated preview, in px. Default 960. */
215
+ maxEdge?: number;
216
+ /** Padding around the drawn content, in scene units. Default 64. */
217
+ padding?: number;
218
+ /** Keep the background transparent? Default true. */
219
+ transparentBackground?: boolean;
220
+ systemPrefersDark?: boolean;
221
+ }
222
+ /**
223
+ * Renders a whole scene with the same canvas engine the editor uses and
224
+ * returns a PNG data URL (or `null` for empty scenes). Ignores selection.
225
+ */
226
+ export function generateScenePreviewDataUrl(
227
+ options: ScenePreviewOptions,
228
+ ): Promise<string | null>;
206
229
  export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;[key: string]: unknown };
207
230
  export type LibraryCategoryId = string;
208
231
 
@@ -233,6 +256,12 @@ export interface MenuBarProps {
233
256
  beforeLinks?: ReactNode;
234
257
  /** Content rendered after Settings (at the very end of the menu). */
235
258
  afterSettings?: ReactNode;
259
+ /** Current project name, shown in the rename dialog. */
260
+ projectName?: string | null;
261
+ /** Called when the user asks to go back to the home/studio screen. */
262
+ onGoHome?: () => void;
263
+ /** Called when the user confirms a new project name. */
264
+ onRenameProject?: (name: string) => void | Promise<void>;
236
265
  }
237
266
 
238
267
  export function useDrawo(): DrawoContextValue;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,12 @@ export interface DrawoProps {
29
29
  onDrawingToolChange?: (tool: NewElementType | "laser" | null) => void;
30
30
  onLocaleChange?: (locale: "en_US" | "es_ES") => void;
31
31
  onThemeChange?: (theme: string, colorScheme: "light" | "dark") => void;
32
+ /** Current project name; surfaced in the built-in MenuBar rename dialog. */
33
+ projectName?: string | null;
34
+ /** When provided, the MenuBar shows a "go to home" entry that calls this. */
35
+ onGoHome?: () => void;
36
+ /** When provided, the MenuBar shows a "rename project" entry that calls this. */
37
+ onRenameProject?: (name: string) => void | Promise<void>;
32
38
  children?: ReactNode;
33
39
  }
34
40
 
@@ -203,6 +209,23 @@ export interface DrawoContextValue {
203
209
  }
204
210
 
205
211
  export type ExportImageFormat = "png" | "jpg" | "svg" | "pdf";
212
+ export interface ScenePreviewOptions {
213
+ scene: Scene;
214
+ /** Longest edge of the generated preview, in px. Default 960. */
215
+ maxEdge?: number;
216
+ /** Padding around the drawn content, in scene units. Default 64. */
217
+ padding?: number;
218
+ /** Keep the background transparent? Default true. */
219
+ transparentBackground?: boolean;
220
+ systemPrefersDark?: boolean;
221
+ }
222
+ /**
223
+ * Renders a whole scene with the same canvas engine the editor uses and
224
+ * returns a PNG data URL (or `null` for empty scenes). Ignores selection.
225
+ */
226
+ export function generateScenePreviewDataUrl(
227
+ options: ScenePreviewOptions,
228
+ ): Promise<string | null>;
206
229
  export type LibrarySvgAsset = { defaultWidth: number; defaultHeight: number;[key: string]: unknown };
207
230
  export type LibraryCategoryId = string;
208
231
 
@@ -233,6 +256,12 @@ export interface MenuBarProps {
233
256
  beforeLinks?: ReactNode;
234
257
  /** Content rendered after Settings (at the very end of the menu). */
235
258
  afterSettings?: ReactNode;
259
+ /** Current project name, shown in the rename dialog. */
260
+ projectName?: string | null;
261
+ /** Called when the user asks to go back to the home/studio screen. */
262
+ onGoHome?: () => void;
263
+ /** Called when the user confirms a new project name. */
264
+ onRenameProject?: (name: string) => void | Promise<void>;
236
265
  }
237
266
 
238
267
  export function useDrawo(): DrawoContextValue;