types.ts 1.0 KB

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