@flowscape-ui/core-sdk 1.0.6 → 1.0.7

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
@@ -346,6 +346,7 @@ interface BaseNodeOptions {
346
346
  y?: number;
347
347
  width?: number;
348
348
  height?: number;
349
+ rotation?: number;
349
350
  }
350
351
  declare abstract class BaseNode<T extends Konva.Node = Konva.Node> implements NodeHandle<T> {
351
352
  protected konvaNode: T;
@@ -445,6 +446,12 @@ interface CoreEvents {
445
446
  'plugin:added': [pluginName: string];
446
447
  /** Plugin was removed */
447
448
  'plugin:removed': [pluginName: string];
449
+ /** Persistence restore failed */
450
+ 'persistence:restore:error': [{
451
+ error: string;
452
+ }];
453
+ /** Persistence restore completed */
454
+ 'persistence:restore:done': [];
448
455
  /** Stage was resized */
449
456
  'stage:resized': [{
450
457
  width: number;
@@ -1307,6 +1314,10 @@ declare class CoreEngine {
1307
1314
  * Enable or disable auto-resize
1308
1315
  */
1309
1316
  setAutoResize(enabled: boolean): void;
1317
+ /**
1318
+ * Show the canvas container after persistence restore completes
1319
+ */
1320
+ showContainer(): void;
1310
1321
  }
1311
1322
 
1312
1323
  /**
@@ -1781,6 +1792,198 @@ declare class NodeHotkeysPlugin extends Plugin {
1781
1792
  private _syncGroupZIndex;
1782
1793
  }
1783
1794
 
1795
+ /**
1796
+ * IndexedDB storage service for canvas persistence.
1797
+ * Handles storage of canvas state and blob files (images, videos, etc.)
1798
+ */
1799
+ interface StoredCanvasState {
1800
+ id: string;
1801
+ state: string;
1802
+ updatedAt: number;
1803
+ }
1804
+ interface StoredBlob {
1805
+ id: string;
1806
+ blob: Blob;
1807
+ mimeType: string;
1808
+ originalUrl?: string | undefined;
1809
+ }
1810
+ declare class PersistenceStorage {
1811
+ private _dbName;
1812
+ private _db;
1813
+ private _dbPromise;
1814
+ constructor(_dbName?: string);
1815
+ /**
1816
+ * Initialize IndexedDB connection
1817
+ */
1818
+ init(): Promise<void>;
1819
+ private _openDatabase;
1820
+ private _getDb;
1821
+ /**
1822
+ * Save canvas state to IndexedDB
1823
+ */
1824
+ saveCanvasState(id: string, state: string): Promise<void>;
1825
+ /**
1826
+ * Load canvas state from IndexedDB
1827
+ */
1828
+ loadCanvasState(id: string): Promise<StoredCanvasState | null>;
1829
+ /**
1830
+ * Delete canvas state from IndexedDB
1831
+ */
1832
+ deleteCanvasState(id: string): Promise<void>;
1833
+ /**
1834
+ * List all canvas states
1835
+ */
1836
+ listCanvasStates(): Promise<StoredCanvasState[]>;
1837
+ /**
1838
+ * Save blob to IndexedDB
1839
+ */
1840
+ saveBlob(id: string, blob: Blob, originalUrl?: string): Promise<void>;
1841
+ /**
1842
+ * Load blob from IndexedDB
1843
+ */
1844
+ loadBlob(id: string): Promise<StoredBlob | null>;
1845
+ /**
1846
+ * Delete blob from IndexedDB
1847
+ */
1848
+ deleteBlob(id: string): Promise<void>;
1849
+ /**
1850
+ * Load multiple blobs by IDs
1851
+ */
1852
+ loadBlobs(ids: string[]): Promise<Map<string, StoredBlob>>;
1853
+ /**
1854
+ * Save multiple blobs
1855
+ */
1856
+ saveBlobs(blobs: Map<string, {
1857
+ blob: Blob;
1858
+ originalUrl?: string;
1859
+ }>): Promise<void>;
1860
+ /**
1861
+ * List all blob IDs
1862
+ */
1863
+ listBlobIds(): Promise<string[]>;
1864
+ /**
1865
+ * Clear all blobs not referenced in the given set
1866
+ */
1867
+ cleanupUnusedBlobs(usedBlobIds: Set<string>): Promise<number>;
1868
+ /**
1869
+ * Clear all data (canvas states and blobs)
1870
+ */
1871
+ clearAll(): Promise<void>;
1872
+ /**
1873
+ * Close database connection
1874
+ */
1875
+ close(): void;
1876
+ /**
1877
+ * Delete the entire database
1878
+ */
1879
+ deleteDatabase(): Promise<void>;
1880
+ }
1881
+
1882
+ /**
1883
+ * PersistencePlugin - Auto-saves canvas state to IndexedDB on any change.
1884
+ * Restores state on page reload. Supports export/import to JSON with embedded blobs.
1885
+ */
1886
+
1887
+ interface PersistencePluginOptions {
1888
+ /** Unique ID for this canvas (default: 'default') */
1889
+ canvasId?: string;
1890
+ /** Debounce delay in ms before saving (default: 300) */
1891
+ debounceMs?: number;
1892
+ /** Auto-restore on attach (default: true) */
1893
+ autoRestore?: boolean;
1894
+ /** Custom IndexedDB database name */
1895
+ dbName?: string;
1896
+ /** Enable debug logging */
1897
+ debug?: boolean;
1898
+ }
1899
+ declare class PersistencePlugin extends Plugin {
1900
+ private _core;
1901
+ private _storage;
1902
+ private _canvasId;
1903
+ private _debounceMs;
1904
+ private _autoRestore;
1905
+ private _debug;
1906
+ private _saveTimer;
1907
+ private _isRestoring;
1908
+ private _blobUrls;
1909
+ private _initialized;
1910
+ /** Maps original blob URLs to stored blob IDs */
1911
+ private _blobUrlToId;
1912
+ constructor(options?: PersistencePluginOptions);
1913
+ protected onAttach(core: CoreEngine): void;
1914
+ protected onDetach(core: CoreEngine): void;
1915
+ private _initialize;
1916
+ private _subscribeToEvents;
1917
+ private _unsubscribeFromEvents;
1918
+ private _onNodeCreated;
1919
+ private _onNodeChange;
1920
+ private _onClipboardPaste;
1921
+ /**
1922
+ * Capture blob data from a media node if it has a blob URL
1923
+ */
1924
+ private _captureBlobFromNode;
1925
+ private _onNodeTransformed;
1926
+ private _onCameraChange;
1927
+ private _onKonvaDragEnd;
1928
+ private _onKonvaTransformEnd;
1929
+ private _onTextChange;
1930
+ /**
1931
+ * Subscribe to textChange events for all existing TextNodes
1932
+ */
1933
+ private _subscribeToTextNodes;
1934
+ private _scheduleSave;
1935
+ private _cancelPendingSave;
1936
+ /**
1937
+ * Save current canvas state to IndexedDB
1938
+ */
1939
+ save(): Promise<void>;
1940
+ /**
1941
+ * Restore canvas state from IndexedDB
1942
+ */
1943
+ restore(): Promise<boolean>;
1944
+ /**
1945
+ * Clear saved state from IndexedDB
1946
+ */
1947
+ clear(): Promise<void>;
1948
+ /**
1949
+ * Export canvas to JSON string with embedded blobs
1950
+ */
1951
+ exportToJSON(): Promise<string>;
1952
+ /**
1953
+ * Import canvas from JSON string with embedded blobs
1954
+ */
1955
+ importFromJSON(json: string): void;
1956
+ /**
1957
+ * Download canvas as JSON file
1958
+ */
1959
+ downloadJSON(filename?: string): Promise<void>;
1960
+ /**
1961
+ * Upload and import canvas from JSON file
1962
+ */
1963
+ uploadJSON(): Promise<void>;
1964
+ /**
1965
+ * Check if there is saved state
1966
+ */
1967
+ hasSavedState(): Promise<boolean>;
1968
+ /**
1969
+ * Get storage instance for advanced usage
1970
+ */
1971
+ getStorage(): PersistenceStorage;
1972
+ /**
1973
+ * Get canvas ID
1974
+ */
1975
+ getCanvasId(): string;
1976
+ /**
1977
+ * Set canvas ID (will trigger restore if autoRestore is enabled)
1978
+ */
1979
+ setCanvasId(id: string): Promise<void>;
1980
+ private _log;
1981
+ /**
1982
+ * Capture blob URLs from all nodes that haven't been captured yet
1983
+ */
1984
+ private _captureAllBlobUrls;
1985
+ }
1986
+
1784
1987
  interface RulerGuidesPluginOptions {
1785
1988
  guideColor?: string;
1786
1989
  activeColor?: string;
@@ -2465,6 +2668,53 @@ declare class TextAutoTrimAddon extends NodeAddon<TextNode> {
2465
2668
  private normalize;
2466
2669
  }
2467
2670
 
2671
+ /**
2672
+ * Canvas serialization/deserialization utility.
2673
+ * Handles conversion of canvas state to/from JSON format with blob extraction.
2674
+ */
2675
+
2676
+ interface SerializedNode {
2677
+ id: string;
2678
+ type: string;
2679
+ attrs: Record<string, unknown>;
2680
+ zIndex: number;
2681
+ blobId?: string;
2682
+ children?: SerializedNode[];
2683
+ parentFrameId?: string;
2684
+ }
2685
+ interface SerializedCamera {
2686
+ x: number;
2687
+ y: number;
2688
+ scale: number;
2689
+ }
2690
+ interface SerializedCanvas {
2691
+ version: number;
2692
+ timestamp: number;
2693
+ nodes: SerializedNode[];
2694
+ camera: SerializedCamera;
2695
+ blobIds: string[];
2696
+ }
2697
+ interface ExtractedBlob {
2698
+ id: string;
2699
+ blob: Blob;
2700
+ originalUrl: string;
2701
+ }
2702
+ interface DeserializeOptions {
2703
+ blobUrls?: Map<string, string>;
2704
+ clearExisting?: boolean;
2705
+ }
2706
+ interface SerializeOptions {
2707
+ /** Pre-existing mapping of blob URLs to blob IDs (from captured blobs) */
2708
+ blobUrlToId?: Map<string, string>;
2709
+ }
2710
+ declare function serializeCanvas(core: CoreEngine, options?: SerializeOptions): SerializedCanvas;
2711
+ declare function extractBlobs(core: CoreEngine): Promise<Map<string, ExtractedBlob>>;
2712
+ declare function deserializeCanvas(core: CoreEngine, state: SerializedCanvas, options?: DeserializeOptions): void;
2713
+ declare function exportCanvasToJSON(core: CoreEngine): Promise<string>;
2714
+ declare function importCanvasFromJSON(core: CoreEngine, json: string, options?: Omit<DeserializeOptions, 'blobUrls'>): void;
2715
+ declare function createBlobUrlMap(state: SerializedCanvas, storedBlobs: Map<string, Blob>): Map<string, string>;
2716
+ declare function revokeBlobUrls(blobUrls: Map<string, string>): void;
2717
+
2468
2718
  /**
2469
2719
  * DebounceHelper - utility for debouncing (delayed execution)
2470
2720
  *
@@ -2555,4 +2805,4 @@ declare const frameTemplates: {
2555
2805
  };
2556
2806
  };
2557
2807
 
2558
- export { type ArcNodeHandle, type ArcNodeOptions, AreaSelectionPlugin, type AreaSelectionPluginOptions, type ArrowNodeHandle, type ArrowNodeOptions, type BaseNodeOptions, type CameraHotkeysOptions, CameraHotkeysPlugin, CameraManager, type CircleNodeHandle, type CircleNodeOptions, ContentFromClipboardPlugin, type ContentFromClipboardPluginOptions, CoreEngine, type CoreEngineOptions, type CoreEvents, DebounceHelper, type EllipseNodeHandle, type EllipseNodeOptions, EventBus, FrameNode, type FrameNodeOptions, type FrameOptions, type GifNodeHandle, type GifNodeOptions, GridPlugin, type GridPluginOptions, type GroupNodeHandle, type GroupNodeOptions, type HistoryAction, HistoryManager, HistoryPlugin, type HistoryPluginOptions, ImageHoverFilterAddon, type ImageNodeHandle, type ImageNodeOptions, type ImageSource, type KonvaArc, type KonvaArrow, type KonvaCircle, type KonvaEllipse, type KonvaGroup, type KonvaGroupConfig, type KonvaImage, type KonvaLayer, type KonvaNode, type KonvaNodeConfig, type KonvaRegularPolygon, type KonvaRing, type KonvaShape, type KonvaStage, type KonvaStar, type KonvaText, type LogoOptions, LogoPlugin, MediaPlaceholder, type MediaPlaceholderOptions, NodeAddon, NodeAddons, type NodeAddonsHandle, type NodeHandle, type NodeHotkeysOptions, NodeHotkeysPlugin, NodeManager, PluginAddon, Plugins, type RegularPolygonNodeHandle, type RegularPolygonNodeOptions, type RingNodeHandle, type RingNodeOptions, RulerGuidesAddon, RulerGuidesPlugin, type RulerGuidesPluginOptions, RulerHighlightAddon, RulerHighlightPlugin, type RulerHighlightPluginOptions, RulerManagerAddon, RulerManagerPlugin, type RulerManagerPluginOptions, RulerPlugin, type RulerPluginOptions, SelectionPlugin, type SelectionPluginOptions, ShapeHoverHighlightAddon, type ShapeNodeHandle, type ShapeNodeOptions, type StarNodeHandle, type StarNodeOptions, type SvgNodeHandle, type SvgNodeOptions, TextAutoTrimAddon, type TextNodeHandle, type TextNodeOptions, ThrottleHelper, type VideoNodeHandle, type VideoNodeOptions, VideoOverlayAddon, type VideoOverlayAddonOptions, VisualGuidesPlugin, type VisualGuidesPluginOptions, frameTemplates };
2808
+ export { type ArcNodeHandle, type ArcNodeOptions, AreaSelectionPlugin, type AreaSelectionPluginOptions, type ArrowNodeHandle, type ArrowNodeOptions, type BaseNodeOptions, type CameraHotkeysOptions, CameraHotkeysPlugin, CameraManager, type CircleNodeHandle, type CircleNodeOptions, ContentFromClipboardPlugin, type ContentFromClipboardPluginOptions, CoreEngine, type CoreEngineOptions, type CoreEvents, DebounceHelper, type DeserializeOptions, type EllipseNodeHandle, type EllipseNodeOptions, EventBus, type ExtractedBlob, FrameNode, type FrameNodeOptions, type FrameOptions, type GifNodeHandle, type GifNodeOptions, GridPlugin, type GridPluginOptions, type GroupNodeHandle, type GroupNodeOptions, type HistoryAction, HistoryManager, HistoryPlugin, type HistoryPluginOptions, ImageHoverFilterAddon, type ImageNodeHandle, type ImageNodeOptions, type ImageSource, type KonvaArc, type KonvaArrow, type KonvaCircle, type KonvaEllipse, type KonvaGroup, type KonvaGroupConfig, type KonvaImage, type KonvaLayer, type KonvaNode, type KonvaNodeConfig, type KonvaRegularPolygon, type KonvaRing, type KonvaShape, type KonvaStage, type KonvaStar, type KonvaText, type LogoOptions, LogoPlugin, MediaPlaceholder, type MediaPlaceholderOptions, NodeAddon, NodeAddons, type NodeAddonsHandle, type NodeHandle, type NodeHotkeysOptions, NodeHotkeysPlugin, NodeManager, PersistencePlugin, type PersistencePluginOptions, PersistenceStorage, PluginAddon, Plugins, type RegularPolygonNodeHandle, type RegularPolygonNodeOptions, type RingNodeHandle, type RingNodeOptions, RulerGuidesAddon, RulerGuidesPlugin, type RulerGuidesPluginOptions, RulerHighlightAddon, RulerHighlightPlugin, type RulerHighlightPluginOptions, RulerManagerAddon, RulerManagerPlugin, type RulerManagerPluginOptions, RulerPlugin, type RulerPluginOptions, SelectionPlugin, type SelectionPluginOptions, type SerializeOptions, type SerializedCamera, type SerializedCanvas, type SerializedNode, ShapeHoverHighlightAddon, type ShapeNodeHandle, type ShapeNodeOptions, type StarNodeHandle, type StarNodeOptions, type StoredBlob, type StoredCanvasState, type SvgNodeHandle, type SvgNodeOptions, TextAutoTrimAddon, type TextNodeHandle, type TextNodeOptions, ThrottleHelper, type VideoNodeHandle, type VideoNodeOptions, VideoOverlayAddon, type VideoOverlayAddonOptions, VisualGuidesPlugin, type VisualGuidesPluginOptions, createBlobUrlMap, deserializeCanvas, exportCanvasToJSON, extractBlobs, frameTemplates, importCanvasFromJSON, revokeBlobUrls, serializeCanvas };
package/dist/index.d.ts CHANGED
@@ -346,6 +346,7 @@ interface BaseNodeOptions {
346
346
  y?: number;
347
347
  width?: number;
348
348
  height?: number;
349
+ rotation?: number;
349
350
  }
350
351
  declare abstract class BaseNode<T extends Konva.Node = Konva.Node> implements NodeHandle<T> {
351
352
  protected konvaNode: T;
@@ -445,6 +446,12 @@ interface CoreEvents {
445
446
  'plugin:added': [pluginName: string];
446
447
  /** Plugin was removed */
447
448
  'plugin:removed': [pluginName: string];
449
+ /** Persistence restore failed */
450
+ 'persistence:restore:error': [{
451
+ error: string;
452
+ }];
453
+ /** Persistence restore completed */
454
+ 'persistence:restore:done': [];
448
455
  /** Stage was resized */
449
456
  'stage:resized': [{
450
457
  width: number;
@@ -1307,6 +1314,10 @@ declare class CoreEngine {
1307
1314
  * Enable or disable auto-resize
1308
1315
  */
1309
1316
  setAutoResize(enabled: boolean): void;
1317
+ /**
1318
+ * Show the canvas container after persistence restore completes
1319
+ */
1320
+ showContainer(): void;
1310
1321
  }
1311
1322
 
1312
1323
  /**
@@ -1781,6 +1792,198 @@ declare class NodeHotkeysPlugin extends Plugin {
1781
1792
  private _syncGroupZIndex;
1782
1793
  }
1783
1794
 
1795
+ /**
1796
+ * IndexedDB storage service for canvas persistence.
1797
+ * Handles storage of canvas state and blob files (images, videos, etc.)
1798
+ */
1799
+ interface StoredCanvasState {
1800
+ id: string;
1801
+ state: string;
1802
+ updatedAt: number;
1803
+ }
1804
+ interface StoredBlob {
1805
+ id: string;
1806
+ blob: Blob;
1807
+ mimeType: string;
1808
+ originalUrl?: string | undefined;
1809
+ }
1810
+ declare class PersistenceStorage {
1811
+ private _dbName;
1812
+ private _db;
1813
+ private _dbPromise;
1814
+ constructor(_dbName?: string);
1815
+ /**
1816
+ * Initialize IndexedDB connection
1817
+ */
1818
+ init(): Promise<void>;
1819
+ private _openDatabase;
1820
+ private _getDb;
1821
+ /**
1822
+ * Save canvas state to IndexedDB
1823
+ */
1824
+ saveCanvasState(id: string, state: string): Promise<void>;
1825
+ /**
1826
+ * Load canvas state from IndexedDB
1827
+ */
1828
+ loadCanvasState(id: string): Promise<StoredCanvasState | null>;
1829
+ /**
1830
+ * Delete canvas state from IndexedDB
1831
+ */
1832
+ deleteCanvasState(id: string): Promise<void>;
1833
+ /**
1834
+ * List all canvas states
1835
+ */
1836
+ listCanvasStates(): Promise<StoredCanvasState[]>;
1837
+ /**
1838
+ * Save blob to IndexedDB
1839
+ */
1840
+ saveBlob(id: string, blob: Blob, originalUrl?: string): Promise<void>;
1841
+ /**
1842
+ * Load blob from IndexedDB
1843
+ */
1844
+ loadBlob(id: string): Promise<StoredBlob | null>;
1845
+ /**
1846
+ * Delete blob from IndexedDB
1847
+ */
1848
+ deleteBlob(id: string): Promise<void>;
1849
+ /**
1850
+ * Load multiple blobs by IDs
1851
+ */
1852
+ loadBlobs(ids: string[]): Promise<Map<string, StoredBlob>>;
1853
+ /**
1854
+ * Save multiple blobs
1855
+ */
1856
+ saveBlobs(blobs: Map<string, {
1857
+ blob: Blob;
1858
+ originalUrl?: string;
1859
+ }>): Promise<void>;
1860
+ /**
1861
+ * List all blob IDs
1862
+ */
1863
+ listBlobIds(): Promise<string[]>;
1864
+ /**
1865
+ * Clear all blobs not referenced in the given set
1866
+ */
1867
+ cleanupUnusedBlobs(usedBlobIds: Set<string>): Promise<number>;
1868
+ /**
1869
+ * Clear all data (canvas states and blobs)
1870
+ */
1871
+ clearAll(): Promise<void>;
1872
+ /**
1873
+ * Close database connection
1874
+ */
1875
+ close(): void;
1876
+ /**
1877
+ * Delete the entire database
1878
+ */
1879
+ deleteDatabase(): Promise<void>;
1880
+ }
1881
+
1882
+ /**
1883
+ * PersistencePlugin - Auto-saves canvas state to IndexedDB on any change.
1884
+ * Restores state on page reload. Supports export/import to JSON with embedded blobs.
1885
+ */
1886
+
1887
+ interface PersistencePluginOptions {
1888
+ /** Unique ID for this canvas (default: 'default') */
1889
+ canvasId?: string;
1890
+ /** Debounce delay in ms before saving (default: 300) */
1891
+ debounceMs?: number;
1892
+ /** Auto-restore on attach (default: true) */
1893
+ autoRestore?: boolean;
1894
+ /** Custom IndexedDB database name */
1895
+ dbName?: string;
1896
+ /** Enable debug logging */
1897
+ debug?: boolean;
1898
+ }
1899
+ declare class PersistencePlugin extends Plugin {
1900
+ private _core;
1901
+ private _storage;
1902
+ private _canvasId;
1903
+ private _debounceMs;
1904
+ private _autoRestore;
1905
+ private _debug;
1906
+ private _saveTimer;
1907
+ private _isRestoring;
1908
+ private _blobUrls;
1909
+ private _initialized;
1910
+ /** Maps original blob URLs to stored blob IDs */
1911
+ private _blobUrlToId;
1912
+ constructor(options?: PersistencePluginOptions);
1913
+ protected onAttach(core: CoreEngine): void;
1914
+ protected onDetach(core: CoreEngine): void;
1915
+ private _initialize;
1916
+ private _subscribeToEvents;
1917
+ private _unsubscribeFromEvents;
1918
+ private _onNodeCreated;
1919
+ private _onNodeChange;
1920
+ private _onClipboardPaste;
1921
+ /**
1922
+ * Capture blob data from a media node if it has a blob URL
1923
+ */
1924
+ private _captureBlobFromNode;
1925
+ private _onNodeTransformed;
1926
+ private _onCameraChange;
1927
+ private _onKonvaDragEnd;
1928
+ private _onKonvaTransformEnd;
1929
+ private _onTextChange;
1930
+ /**
1931
+ * Subscribe to textChange events for all existing TextNodes
1932
+ */
1933
+ private _subscribeToTextNodes;
1934
+ private _scheduleSave;
1935
+ private _cancelPendingSave;
1936
+ /**
1937
+ * Save current canvas state to IndexedDB
1938
+ */
1939
+ save(): Promise<void>;
1940
+ /**
1941
+ * Restore canvas state from IndexedDB
1942
+ */
1943
+ restore(): Promise<boolean>;
1944
+ /**
1945
+ * Clear saved state from IndexedDB
1946
+ */
1947
+ clear(): Promise<void>;
1948
+ /**
1949
+ * Export canvas to JSON string with embedded blobs
1950
+ */
1951
+ exportToJSON(): Promise<string>;
1952
+ /**
1953
+ * Import canvas from JSON string with embedded blobs
1954
+ */
1955
+ importFromJSON(json: string): void;
1956
+ /**
1957
+ * Download canvas as JSON file
1958
+ */
1959
+ downloadJSON(filename?: string): Promise<void>;
1960
+ /**
1961
+ * Upload and import canvas from JSON file
1962
+ */
1963
+ uploadJSON(): Promise<void>;
1964
+ /**
1965
+ * Check if there is saved state
1966
+ */
1967
+ hasSavedState(): Promise<boolean>;
1968
+ /**
1969
+ * Get storage instance for advanced usage
1970
+ */
1971
+ getStorage(): PersistenceStorage;
1972
+ /**
1973
+ * Get canvas ID
1974
+ */
1975
+ getCanvasId(): string;
1976
+ /**
1977
+ * Set canvas ID (will trigger restore if autoRestore is enabled)
1978
+ */
1979
+ setCanvasId(id: string): Promise<void>;
1980
+ private _log;
1981
+ /**
1982
+ * Capture blob URLs from all nodes that haven't been captured yet
1983
+ */
1984
+ private _captureAllBlobUrls;
1985
+ }
1986
+
1784
1987
  interface RulerGuidesPluginOptions {
1785
1988
  guideColor?: string;
1786
1989
  activeColor?: string;
@@ -2465,6 +2668,53 @@ declare class TextAutoTrimAddon extends NodeAddon<TextNode> {
2465
2668
  private normalize;
2466
2669
  }
2467
2670
 
2671
+ /**
2672
+ * Canvas serialization/deserialization utility.
2673
+ * Handles conversion of canvas state to/from JSON format with blob extraction.
2674
+ */
2675
+
2676
+ interface SerializedNode {
2677
+ id: string;
2678
+ type: string;
2679
+ attrs: Record<string, unknown>;
2680
+ zIndex: number;
2681
+ blobId?: string;
2682
+ children?: SerializedNode[];
2683
+ parentFrameId?: string;
2684
+ }
2685
+ interface SerializedCamera {
2686
+ x: number;
2687
+ y: number;
2688
+ scale: number;
2689
+ }
2690
+ interface SerializedCanvas {
2691
+ version: number;
2692
+ timestamp: number;
2693
+ nodes: SerializedNode[];
2694
+ camera: SerializedCamera;
2695
+ blobIds: string[];
2696
+ }
2697
+ interface ExtractedBlob {
2698
+ id: string;
2699
+ blob: Blob;
2700
+ originalUrl: string;
2701
+ }
2702
+ interface DeserializeOptions {
2703
+ blobUrls?: Map<string, string>;
2704
+ clearExisting?: boolean;
2705
+ }
2706
+ interface SerializeOptions {
2707
+ /** Pre-existing mapping of blob URLs to blob IDs (from captured blobs) */
2708
+ blobUrlToId?: Map<string, string>;
2709
+ }
2710
+ declare function serializeCanvas(core: CoreEngine, options?: SerializeOptions): SerializedCanvas;
2711
+ declare function extractBlobs(core: CoreEngine): Promise<Map<string, ExtractedBlob>>;
2712
+ declare function deserializeCanvas(core: CoreEngine, state: SerializedCanvas, options?: DeserializeOptions): void;
2713
+ declare function exportCanvasToJSON(core: CoreEngine): Promise<string>;
2714
+ declare function importCanvasFromJSON(core: CoreEngine, json: string, options?: Omit<DeserializeOptions, 'blobUrls'>): void;
2715
+ declare function createBlobUrlMap(state: SerializedCanvas, storedBlobs: Map<string, Blob>): Map<string, string>;
2716
+ declare function revokeBlobUrls(blobUrls: Map<string, string>): void;
2717
+
2468
2718
  /**
2469
2719
  * DebounceHelper - utility for debouncing (delayed execution)
2470
2720
  *
@@ -2555,4 +2805,4 @@ declare const frameTemplates: {
2555
2805
  };
2556
2806
  };
2557
2807
 
2558
- export { type ArcNodeHandle, type ArcNodeOptions, AreaSelectionPlugin, type AreaSelectionPluginOptions, type ArrowNodeHandle, type ArrowNodeOptions, type BaseNodeOptions, type CameraHotkeysOptions, CameraHotkeysPlugin, CameraManager, type CircleNodeHandle, type CircleNodeOptions, ContentFromClipboardPlugin, type ContentFromClipboardPluginOptions, CoreEngine, type CoreEngineOptions, type CoreEvents, DebounceHelper, type EllipseNodeHandle, type EllipseNodeOptions, EventBus, FrameNode, type FrameNodeOptions, type FrameOptions, type GifNodeHandle, type GifNodeOptions, GridPlugin, type GridPluginOptions, type GroupNodeHandle, type GroupNodeOptions, type HistoryAction, HistoryManager, HistoryPlugin, type HistoryPluginOptions, ImageHoverFilterAddon, type ImageNodeHandle, type ImageNodeOptions, type ImageSource, type KonvaArc, type KonvaArrow, type KonvaCircle, type KonvaEllipse, type KonvaGroup, type KonvaGroupConfig, type KonvaImage, type KonvaLayer, type KonvaNode, type KonvaNodeConfig, type KonvaRegularPolygon, type KonvaRing, type KonvaShape, type KonvaStage, type KonvaStar, type KonvaText, type LogoOptions, LogoPlugin, MediaPlaceholder, type MediaPlaceholderOptions, NodeAddon, NodeAddons, type NodeAddonsHandle, type NodeHandle, type NodeHotkeysOptions, NodeHotkeysPlugin, NodeManager, PluginAddon, Plugins, type RegularPolygonNodeHandle, type RegularPolygonNodeOptions, type RingNodeHandle, type RingNodeOptions, RulerGuidesAddon, RulerGuidesPlugin, type RulerGuidesPluginOptions, RulerHighlightAddon, RulerHighlightPlugin, type RulerHighlightPluginOptions, RulerManagerAddon, RulerManagerPlugin, type RulerManagerPluginOptions, RulerPlugin, type RulerPluginOptions, SelectionPlugin, type SelectionPluginOptions, ShapeHoverHighlightAddon, type ShapeNodeHandle, type ShapeNodeOptions, type StarNodeHandle, type StarNodeOptions, type SvgNodeHandle, type SvgNodeOptions, TextAutoTrimAddon, type TextNodeHandle, type TextNodeOptions, ThrottleHelper, type VideoNodeHandle, type VideoNodeOptions, VideoOverlayAddon, type VideoOverlayAddonOptions, VisualGuidesPlugin, type VisualGuidesPluginOptions, frameTemplates };
2808
+ export { type ArcNodeHandle, type ArcNodeOptions, AreaSelectionPlugin, type AreaSelectionPluginOptions, type ArrowNodeHandle, type ArrowNodeOptions, type BaseNodeOptions, type CameraHotkeysOptions, CameraHotkeysPlugin, CameraManager, type CircleNodeHandle, type CircleNodeOptions, ContentFromClipboardPlugin, type ContentFromClipboardPluginOptions, CoreEngine, type CoreEngineOptions, type CoreEvents, DebounceHelper, type DeserializeOptions, type EllipseNodeHandle, type EllipseNodeOptions, EventBus, type ExtractedBlob, FrameNode, type FrameNodeOptions, type FrameOptions, type GifNodeHandle, type GifNodeOptions, GridPlugin, type GridPluginOptions, type GroupNodeHandle, type GroupNodeOptions, type HistoryAction, HistoryManager, HistoryPlugin, type HistoryPluginOptions, ImageHoverFilterAddon, type ImageNodeHandle, type ImageNodeOptions, type ImageSource, type KonvaArc, type KonvaArrow, type KonvaCircle, type KonvaEllipse, type KonvaGroup, type KonvaGroupConfig, type KonvaImage, type KonvaLayer, type KonvaNode, type KonvaNodeConfig, type KonvaRegularPolygon, type KonvaRing, type KonvaShape, type KonvaStage, type KonvaStar, type KonvaText, type LogoOptions, LogoPlugin, MediaPlaceholder, type MediaPlaceholderOptions, NodeAddon, NodeAddons, type NodeAddonsHandle, type NodeHandle, type NodeHotkeysOptions, NodeHotkeysPlugin, NodeManager, PersistencePlugin, type PersistencePluginOptions, PersistenceStorage, PluginAddon, Plugins, type RegularPolygonNodeHandle, type RegularPolygonNodeOptions, type RingNodeHandle, type RingNodeOptions, RulerGuidesAddon, RulerGuidesPlugin, type RulerGuidesPluginOptions, RulerHighlightAddon, RulerHighlightPlugin, type RulerHighlightPluginOptions, RulerManagerAddon, RulerManagerPlugin, type RulerManagerPluginOptions, RulerPlugin, type RulerPluginOptions, SelectionPlugin, type SelectionPluginOptions, type SerializeOptions, type SerializedCamera, type SerializedCanvas, type SerializedNode, ShapeHoverHighlightAddon, type ShapeNodeHandle, type ShapeNodeOptions, type StarNodeHandle, type StarNodeOptions, type StoredBlob, type StoredCanvasState, type SvgNodeHandle, type SvgNodeOptions, TextAutoTrimAddon, type TextNodeHandle, type TextNodeOptions, ThrottleHelper, type VideoNodeHandle, type VideoNodeOptions, VideoOverlayAddon, type VideoOverlayAddonOptions, VisualGuidesPlugin, type VisualGuidesPluginOptions, createBlobUrlMap, deserializeCanvas, exportCanvasToJSON, extractBlobs, frameTemplates, importCanvasFromJSON, revokeBlobUrls, serializeCanvas };