2023-04-25 11:01:25 +00:00
|
|
|
## API Report File for "@tldraw/file-format"
|
|
|
|
|
|
|
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
2023-06-02 15:21:45 +00:00
|
|
|
import { Editor } from '@tldraw/editor';
|
2023-06-03 08:59:04 +00:00
|
|
|
import { MigrationFailureReason } from '@tldraw/store';
|
2023-04-25 11:01:25 +00:00
|
|
|
import { Result } from '@tldraw/utils';
|
2023-06-03 08:59:04 +00:00
|
|
|
import { SerializedSchema } from '@tldraw/store';
|
2023-06-12 14:04:14 +00:00
|
|
|
import { TLSchema } from '@tldraw/editor';
|
2023-04-25 11:01:25 +00:00
|
|
|
import { TLStore } from '@tldraw/editor';
|
2023-06-02 21:16:09 +00:00
|
|
|
import { TLUiToastsContextType } from '@tldraw/ui';
|
|
|
|
import { TLUiTranslationKey } from '@tldraw/ui';
|
2023-06-03 08:59:04 +00:00
|
|
|
import { UnknownRecord } from '@tldraw/store';
|
2023-04-25 11:01:25 +00:00
|
|
|
|
2023-06-02 09:38:13 +00:00
|
|
|
// @internal (undocumented)
|
2023-06-02 15:21:45 +00:00
|
|
|
export function buildFromV1Document(editor: Editor, document: LegacyTldrawDocument): void;
|
2023-06-02 09:38:13 +00:00
|
|
|
|
2023-04-25 11:01:25 +00:00
|
|
|
// @public (undocumented)
|
|
|
|
export function isV1File(data: any): boolean;
|
|
|
|
|
2023-06-02 09:38:13 +00:00
|
|
|
// @internal (undocumented)
|
|
|
|
export interface LegacyTldrawDocument {
|
|
|
|
// (undocumented)
|
|
|
|
assets: TDAssets;
|
|
|
|
// (undocumented)
|
|
|
|
id: string;
|
|
|
|
// (undocumented)
|
|
|
|
name: string;
|
|
|
|
// (undocumented)
|
|
|
|
pages: Record<string, TDPage>;
|
|
|
|
// (undocumented)
|
|
|
|
pageStates: Record<string, TLV1PageState>;
|
|
|
|
// (undocumented)
|
|
|
|
version: number;
|
|
|
|
}
|
|
|
|
|
2023-04-25 11:01:25 +00:00
|
|
|
// @internal (undocumented)
|
2023-06-02 21:16:09 +00:00
|
|
|
export function parseAndLoadDocument(editor: Editor, document: string, msg: (id: TLUiTranslationKey) => string, addToast: TLUiToastsContextType['addToast'], onV1FileLoad?: () => void, forceDarkMode?: boolean): Promise<void>;
|
2023-04-25 11:01:25 +00:00
|
|
|
|
|
|
|
// @public (undocumented)
|
2023-06-12 14:04:14 +00:00
|
|
|
export function parseTldrawJsonFile({ json, schema, }: {
|
|
|
|
schema: TLSchema;
|
2023-04-25 11:01:25 +00:00
|
|
|
json: string;
|
|
|
|
}): Result<TLStore, TldrawFileParseError>;
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export function serializeTldrawJson(store: TLStore): Promise<string>;
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export function serializeTldrawJsonBlob(store: TLStore): Promise<Blob>;
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export const TLDRAW_FILE_EXTENSION: ".tldr";
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export const TLDRAW_FILE_MIMETYPE: "application/vnd.tldraw+json";
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export interface TldrawFile {
|
|
|
|
// (undocumented)
|
2023-05-24 11:25:41 +00:00
|
|
|
records: UnknownRecord[];
|
2023-04-25 11:01:25 +00:00
|
|
|
// (undocumented)
|
|
|
|
schema: SerializedSchema;
|
|
|
|
// (undocumented)
|
|
|
|
tldrawFileFormatVersion: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
// @public (undocumented)
|
|
|
|
export type TldrawFileParseError = {
|
|
|
|
type: 'fileFormatVersionTooNew';
|
|
|
|
version: number;
|
|
|
|
} | {
|
|
|
|
type: 'invalidRecords';
|
|
|
|
cause: unknown;
|
|
|
|
} | {
|
|
|
|
type: 'migrationFailed';
|
|
|
|
reason: MigrationFailureReason;
|
|
|
|
} | {
|
|
|
|
type: 'notATldrawFile';
|
|
|
|
cause: unknown;
|
|
|
|
} | {
|
|
|
|
type: 'v1File';
|
|
|
|
data: any;
|
|
|
|
};
|
|
|
|
|
|
|
|
// (No @packageDocumentation comment for this package)
|
|
|
|
|
|
|
|
```
|