tldraw/packages/file-format/api-report.md
alex 1927f88041
mini defineShape API (#1563)
Based on #1549, but with a lot of code-structure related changes backed
out. Shape schemas are still defined in tlschemas with this diff.

Couple differences between this and #1549:
- This tightens up the relationship between store schemas and editor
schemas a bit
- Reduces the number of places we need to remember to include core
shapes
- Only `<TLdrawEditor />` sets default shapes by default. If you're
doing something funky with lower-level APIs, you need to specify
`defaultShapes` manually
- Replaces `validator` with `props` for shapes

### Change Type

- [x] `major` — Breaking Change

### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [x] Unit Tests
- [ ] Webdriver tests

### Release Notes

[dev-facing, notes to come]
2023-06-12 14:04:14 +00:00

90 lines
2.5 KiB
Markdown

## 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
import { Editor } from '@tldraw/editor';
import { MigrationFailureReason } from '@tldraw/store';
import { Result } from '@tldraw/utils';
import { SerializedSchema } from '@tldraw/store';
import { TLSchema } from '@tldraw/editor';
import { TLStore } from '@tldraw/editor';
import { TLUiToastsContextType } from '@tldraw/ui';
import { TLUiTranslationKey } from '@tldraw/ui';
import { UnknownRecord } from '@tldraw/store';
// @internal (undocumented)
export function buildFromV1Document(editor: Editor, document: LegacyTldrawDocument): void;
// @public (undocumented)
export function isV1File(data: any): boolean;
// @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;
}
// @internal (undocumented)
export function parseAndLoadDocument(editor: Editor, document: string, msg: (id: TLUiTranslationKey) => string, addToast: TLUiToastsContextType['addToast'], onV1FileLoad?: () => void, forceDarkMode?: boolean): Promise<void>;
// @public (undocumented)
export function parseTldrawJsonFile({ json, schema, }: {
schema: TLSchema;
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)
records: UnknownRecord[];
// (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)
```