types.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { ExcalidrawElement } from "../element/types";
  2. import {
  3. AppState,
  4. BinaryFiles,
  5. LibraryItems,
  6. LibraryItems_anyVersion,
  7. } from "../types";
  8. import type { cleanAppStateForExport } from "../appState";
  9. import { VERSIONS } from "../constants";
  10. export interface ExportedDataState {
  11. type: string;
  12. version: number;
  13. source: string;
  14. elements: readonly ExcalidrawElement[];
  15. appState: ReturnType<typeof cleanAppStateForExport>;
  16. files: BinaryFiles | undefined;
  17. }
  18. export interface ImportedDataState {
  19. type?: string;
  20. version?: number;
  21. source?: string;
  22. elements?: readonly ExcalidrawElement[] | null;
  23. appState?: Readonly<Partial<AppState>> | null;
  24. scrollToContent?: boolean;
  25. libraryItems?: LibraryItems_anyVersion;
  26. files?: BinaryFiles;
  27. }
  28. export interface ExportedLibraryData {
  29. type: string;
  30. version: typeof VERSIONS.excalidrawLibrary;
  31. source: string;
  32. libraryItems: LibraryItems;
  33. }
  34. export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
  35. /** @deprecated v1 */
  36. library?: LibraryItems;
  37. }