diff options
| author | kj_sh604 | 2026-03-15 16:19:35 -0400 |
|---|---|---|
| committer | kj_sh604 | 2026-03-15 16:19:35 -0400 |
| commit | 6ec259a0e71174651bae95d4628138bf6fd68742 (patch) | |
| tree | 5e33c6a5ec091ecabfcb257fdc7b6a88ed8754ac /packages/excalidraw/data/types.ts | |
| parent | 16c8578b15c727f22921f8a80a56ee4d4e7f2272 (diff) | |
refactor: packages/
Diffstat (limited to 'packages/excalidraw/data/types.ts')
| -rw-r--r-- | packages/excalidraw/data/types.ts | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/packages/excalidraw/data/types.ts b/packages/excalidraw/data/types.ts new file mode 100644 index 0000000..f5f5535 --- /dev/null +++ b/packages/excalidraw/data/types.ts @@ -0,0 +1,59 @@ +import type { ExcalidrawElement } from "../element/types"; +import type { + AppState, + BinaryFiles, + LibraryItems, + LibraryItems_anyVersion, +} from "../types"; +import type { cleanAppStateForExport } from "../appState"; +import type { VERSIONS } from "../constants"; + +export interface ExportedDataState { + type: string; + version: number; + source: string; + elements: readonly ExcalidrawElement[]; + appState: ReturnType<typeof cleanAppStateForExport>; + files: BinaryFiles | undefined; +} + +/** + * Map of legacy AppState keys, with values of: + * [<legacy type>, <new AppState proeprty>] + * + * This is a helper type used in downstream abstractions. + * Don't consume on its own. + */ +export type LegacyAppState = { + /** @deprecated #6213 TODO remove 23-06-01 */ + isSidebarDocked: [boolean, "defaultSidebarDockedPreference"]; +}; + +export interface ImportedDataState { + type?: string; + version?: number; + source?: string; + elements?: readonly ExcalidrawElement[] | null; + appState?: Readonly< + Partial< + AppState & { + [T in keyof LegacyAppState]: LegacyAppState[T][0]; + } + > + > | null; + scrollToContent?: boolean; + libraryItems?: LibraryItems_anyVersion; + files?: BinaryFiles; +} + +export interface ExportedLibraryData { + type: string; + version: typeof VERSIONS.excalidrawLibrary; + source: string; + libraryItems: LibraryItems; +} + +export interface ImportedLibraryData extends Partial<ExportedLibraryData> { + /** @deprecated v1 */ + library?: LibraryItems; +} |
