Expose migrations, validators, and versions from tlschema (#3613)

Previously, we weren't exporting migrations & validators for our default
shapes. This meant that it wasn't possible to make your own tlschema
with both our default shapes and some of your own (e.g. for custom
multiplayer). This fixes that by exposing all the migrations,
validators, and versions from tlschema.

### Change Type
- [x] `sdk` — Changes the tldraw SDK
- [x] `bugfix` — Bug fix
This commit is contained in:
alex 2024-04-25 15:31:26 +01:00 committed by GitHub
parent 15dd56a75e
commit f78719b054
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 87 additions and 157 deletions

View file

@ -27,7 +27,7 @@ export const ArrowShapeArrowheadEndStyle: EnumStyleProp<"arrow" | "bar" | "diamo
// @public (undocumented) // @public (undocumented)
export const ArrowShapeArrowheadStartStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">; export const ArrowShapeArrowheadStartStyle: EnumStyleProp<"arrow" | "bar" | "diamond" | "dot" | "inverted" | "none" | "pipe" | "square" | "triangle">;
// @internal (undocumented) // @public (undocumented)
export const arrowShapeMigrations: TLShapePropsMigrations; export const arrowShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -76,16 +76,16 @@ export const arrowShapeProps: {
// @public // @public
export const assetIdValidator: T.Validator<TLAssetId>; export const assetIdValidator: T.Validator<TLAssetId>;
// @internal (undocumented) // @public (undocumented)
export const assetMigrations: MigrationSequence; export const assetMigrations: MigrationSequence;
// @public (undocumented) // @public (undocumented)
export const AssetRecordType: RecordType<TLAsset, "props" | "type">; export const AssetRecordType: RecordType<TLAsset, "props" | "type">;
// @internal (undocumented) // @public (undocumented)
export const assetValidator: T.Validator<TLAsset>; export const assetValidator: T.Validator<TLAsset>;
// @internal (undocumented) // @public (undocumented)
export const bookmarkShapeMigrations: TLShapePropsMigrations; export const bookmarkShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -192,6 +192,11 @@ export const DefaultFontStyle: EnumStyleProp<"draw" | "mono" | "sans" | "serif">
// @public (undocumented) // @public (undocumented)
export const DefaultHorizontalAlignStyle: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">; export const DefaultHorizontalAlignStyle: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
// @public (undocumented)
export const defaultShapeSchemas: {
[T in TLDefaultShape['type']]: SchemaShapeInfo;
};
// @public (undocumented) // @public (undocumented)
export const DefaultSizeStyle: EnumStyleProp<"l" | "m" | "s" | "xl">; export const DefaultSizeStyle: EnumStyleProp<"l" | "m" | "s" | "xl">;
@ -201,7 +206,7 @@ export const DefaultVerticalAlignStyle: EnumStyleProp<"end" | "middle" | "start"
// @public (undocumented) // @public (undocumented)
export const DocumentRecordType: RecordType<TLDocument, never>; export const DocumentRecordType: RecordType<TLDocument, never>;
// @internal (undocumented) // @public (undocumented)
export const drawShapeMigrations: TLShapePropsMigrations; export const drawShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -420,7 +425,7 @@ export type EmbedDefinition = {
readonly width: number; readonly width: number;
}; };
// @internal (undocumented) // @public (undocumented)
export const embedShapeMigrations: TLShapePropsMigrations; export const embedShapeMigrations: TLShapePropsMigrations;
// @public // @public
@ -456,7 +461,7 @@ export class EnumStyleProp<T> extends StyleProp<T> {
readonly values: readonly T[]; readonly values: readonly T[];
} }
// @internal (undocumented) // @public (undocumented)
export const frameShapeMigrations: TLShapePropsMigrations; export const frameShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -469,7 +474,7 @@ export const frameShapeProps: {
// @public (undocumented) // @public (undocumented)
export const GeoShapeGeoStyle: EnumStyleProp<"arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "check-box" | "cloud" | "diamond" | "ellipse" | "hexagon" | "octagon" | "oval" | "pentagon" | "rectangle" | "rhombus-2" | "rhombus" | "star" | "trapezoid" | "triangle" | "x-box">; export const GeoShapeGeoStyle: EnumStyleProp<"arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "check-box" | "cloud" | "diamond" | "ellipse" | "hexagon" | "octagon" | "oval" | "pentagon" | "rectangle" | "rhombus-2" | "rhombus" | "star" | "trapezoid" | "triangle" | "x-box">;
// @internal (undocumented) // @public (undocumented)
export const geoShapeMigrations: TLShapePropsMigrations; export const geoShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -501,13 +506,13 @@ export function getDefaultTranslationLocale(): TLLanguage['locale'];
// @internal (undocumented) // @internal (undocumented)
export function getShapePropKeysByStyle(props: Record<string, T.Validatable<any>>): Map<StyleProp<unknown>, string>; export function getShapePropKeysByStyle(props: Record<string, T.Validatable<any>>): Map<StyleProp<unknown>, string>;
// @internal (undocumented) // @public (undocumented)
export const groupShapeMigrations: TLShapePropsMigrations; export const groupShapeMigrations: TLShapePropsMigrations;
// @internal (undocumented) // @public (undocumented)
export const groupShapeProps: ShapeProps<TLGroupShape>; export const groupShapeProps: ShapeProps<TLGroupShape>;
// @internal (undocumented) // @public (undocumented)
export const highlightShapeMigrations: TLShapePropsMigrations; export const highlightShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -522,10 +527,10 @@ export const highlightShapeProps: {
size: EnumStyleProp<"l" | "m" | "s" | "xl">; size: EnumStyleProp<"l" | "m" | "s" | "xl">;
}; };
// @internal (undocumented) // @public (undocumented)
export function idValidator<Id extends RecordId<UnknownRecord>>(prefix: Id['__type__']['typeName']): T.Validator<Id>; export function idValidator<Id extends RecordId<UnknownRecord>>(prefix: Id['__type__']['typeName']): T.Validator<Id>;
// @internal (undocumented) // @public (undocumented)
export const imageShapeMigrations: TLShapePropsMigrations; export const imageShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -667,7 +672,7 @@ export const LANGUAGES: readonly [{
readonly locale: "zh-tw"; readonly locale: "zh-tw";
}]; }];
// @internal (undocumented) // @public (undocumented)
export const lineShapeMigrations: TLShapePropsMigrations; export const lineShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -687,7 +692,7 @@ export const lineShapeProps: {
// @public (undocumented) // @public (undocumented)
export const LineShapeSplineStyle: EnumStyleProp<"cubic" | "line">; export const LineShapeSplineStyle: EnumStyleProp<"cubic" | "line">;
// @internal (undocumented) // @public (undocumented)
export const noteShapeMigrations: TLShapePropsMigrations; export const noteShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -703,10 +708,10 @@ export const noteShapeProps: {
verticalAlign: EnumStyleProp<"end" | "middle" | "start">; verticalAlign: EnumStyleProp<"end" | "middle" | "start">;
}; };
// @internal (undocumented) // @public (undocumented)
export const opacityValidator: T.Validator<number>; export const opacityValidator: T.Validator<number>;
// @internal (undocumented) // @public (undocumented)
export const pageIdValidator: T.Validator<TLPageId>; export const pageIdValidator: T.Validator<TLPageId>;
// @public (undocumented) // @public (undocumented)
@ -718,7 +723,7 @@ export const parentIdValidator: T.Validator<TLParentId>;
// @public (undocumented) // @public (undocumented)
export const PointerRecordType: RecordType<TLPointer, never>; export const PointerRecordType: RecordType<TLPointer, never>;
// @internal (undocumented) // @public (undocumented)
export const rootShapeMigrations: MigrationSequence; export const rootShapeMigrations: MigrationSequence;
// @public (undocumented) // @public (undocumented)
@ -728,7 +733,7 @@ export type SchemaShapeInfo = {
props?: Record<string, AnyValidator>; props?: Record<string, AnyValidator>;
}; };
// @internal (undocumented) // @public (undocumented)
export const scribbleValidator: T.Validator<TLScribble>; export const scribbleValidator: T.Validator<TLScribble>;
// @public (undocumented) // @public (undocumented)
@ -771,7 +776,7 @@ export class StyleProp<Type> implements T.Validatable<Type> {
// @public (undocumented) // @public (undocumented)
export type StylePropValue<T extends StyleProp<any>> = T extends StyleProp<infer U> ? U : never; export type StylePropValue<T extends StyleProp<any>> = T extends StyleProp<infer U> ? U : never;
// @internal (undocumented) // @public (undocumented)
export const textShapeMigrations: TLShapePropsMigrations; export const textShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)
@ -1290,7 +1295,7 @@ export interface VecModel {
// @public (undocumented) // @public (undocumented)
export const vecModelValidator: T.Validator<VecModel>; export const vecModelValidator: T.Validator<VecModel>;
// @internal (undocumented) // @public (undocumented)
export const videoShapeMigrations: TLShapePropsMigrations; export const videoShapeMigrations: TLShapePropsMigrations;
// @public (undocumented) // @public (undocumented)

View file

@ -17,7 +17,7 @@ export type TLBookmarkAsset = TLBaseAsset<
} }
> >
/** @internal */ /** @public */
export const bookmarkAssetValidator: T.Validator<TLBookmarkAsset> = createAssetValidator( export const bookmarkAssetValidator: T.Validator<TLBookmarkAsset> = createAssetValidator(
'bookmark', 'bookmark',
T.object({ T.object({
@ -34,7 +34,7 @@ const Versions = createMigrationIds('com.tldraw.asset.bookmark', {
export { Versions as bookmarkAssetVersions } export { Versions as bookmarkAssetVersions }
/** @internal */ /** @public */
export const bookmarkAssetMigrations = createRecordMigrationSequence({ export const bookmarkAssetMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.asset.bookmark', sequenceId: 'com.tldraw.asset.bookmark',
recordType: 'asset', recordType: 'asset',

View file

@ -19,7 +19,7 @@ export type TLImageAsset = TLBaseAsset<
} }
> >
/** @internal */ /** @public */
export const imageAssetValidator: T.Validator<TLImageAsset> = createAssetValidator( export const imageAssetValidator: T.Validator<TLImageAsset> = createAssetValidator(
'image', 'image',
T.object({ T.object({
@ -40,7 +40,7 @@ const Versions = createMigrationIds('com.tldraw.asset.image', {
export { Versions as imageAssetVersions } export { Versions as imageAssetVersions }
/** @internal */ /** @public */
export const imageAssetMigrations = createRecordMigrationSequence({ export const imageAssetMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.asset.image', sequenceId: 'com.tldraw.asset.image',
recordType: 'asset', recordType: 'asset',

View file

@ -19,7 +19,7 @@ export type TLVideoAsset = TLBaseAsset<
} }
> >
/** @internal */ /** @public */
export const videoAssetValidator: T.Validator<TLVideoAsset> = createAssetValidator( export const videoAssetValidator: T.Validator<TLVideoAsset> = createAssetValidator(
'video', 'video',
T.object({ T.object({
@ -40,7 +40,7 @@ const Versions = createMigrationIds('com.tldraw.asset.video', {
export { Versions as videoAssetVersions } export { Versions as videoAssetVersions }
/** @internal */ /** @public */
export const videoAssetMigrations = createRecordMigrationSequence({ export const videoAssetMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.asset.video', sequenceId: 'com.tldraw.asset.video',
recordType: 'asset', recordType: 'asset',

View file

@ -52,7 +52,8 @@ export type SchemaShapeInfo = {
/** @public */ /** @public */
export type TLSchema = StoreSchema<TLRecord, TLStoreProps> export type TLSchema = StoreSchema<TLRecord, TLStoreProps>
const defaultShapes: { [T in TLDefaultShape['type']]: SchemaShapeInfo } = { /** @public */
export const defaultShapeSchemas: { [T in TLDefaultShape['type']]: SchemaShapeInfo } = {
arrow: { migrations: arrowShapeMigrations, props: arrowShapeProps }, arrow: { migrations: arrowShapeMigrations, props: arrowShapeProps },
bookmark: { migrations: bookmarkShapeMigrations, props: bookmarkShapeProps }, bookmark: { migrations: bookmarkShapeMigrations, props: bookmarkShapeProps },
draw: { migrations: drawShapeMigrations, props: drawShapeProps }, draw: { migrations: drawShapeMigrations, props: drawShapeProps },
@ -75,7 +76,7 @@ const defaultShapes: { [T in TLDefaultShape['type']]: SchemaShapeInfo } = {
* *
* @public */ * @public */
export function createTLSchema({ export function createTLSchema({
shapes = defaultShapes, shapes = defaultShapeSchemas,
migrations, migrations,
}: { }: {
shapes?: Record<string, SchemaShapeInfo> shapes?: Record<string, SchemaShapeInfo>

View file

@ -10,7 +10,12 @@ export { type TLBookmarkAsset } from './assets/TLBookmarkAsset'
export { type TLImageAsset } from './assets/TLImageAsset' export { type TLImageAsset } from './assets/TLImageAsset'
export { type TLVideoAsset } from './assets/TLVideoAsset' export { type TLVideoAsset } from './assets/TLVideoAsset'
export { createPresenceStateDerivation } from './createPresenceStateDerivation' export { createPresenceStateDerivation } from './createPresenceStateDerivation'
export { createTLSchema, type SchemaShapeInfo, type TLSchema } from './createTLSchema' export {
createTLSchema,
defaultShapeSchemas,
type SchemaShapeInfo,
type TLSchema,
} from './createTLSchema'
export { export {
TL_CANVAS_UI_COLOR_TYPES, TL_CANVAS_UI_COLOR_TYPES,
canvasUiColorTypeValidator, canvasUiColorTypeValidator,

View file

@ -35,7 +35,7 @@ export const TL_CURSOR_TYPES = new Set([
* @public */ * @public */
export type TLCursorType = SetValue<typeof TL_CURSOR_TYPES> export type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>
/** @internal */ /** @public */
export const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES) export const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES)
/** /**
@ -47,7 +47,7 @@ export interface TLCursor {
rotation: number rotation: number
} }
/** @internal */ /** @public */
export const cursorValidator: T.Validator<TLCursor> = T.object<TLCursor>({ export const cursorValidator: T.Validator<TLCursor> = T.object<TLCursor>({
type: cursorTypeValidator, type: cursorTypeValidator,
rotation: T.number, rotation: T.number,

View file

@ -3,7 +3,7 @@ import { T } from '@tldraw/validate'
/** @public */ /** @public */
export type TLOpacityType = number export type TLOpacityType = number
/** @internal */ /** @public */
export const opacityValidator = T.number.check((n) => { export const opacityValidator = T.number.check((n) => {
if (n < 0 || n > 1) { if (n < 0 || n > 1) {
throw new T.ValidationError('Opacity must be between 0 and 1') throw new T.ValidationError('Opacity must be between 0 and 1')

View file

@ -25,7 +25,7 @@ export type TLScribble = {
taper: boolean taper: boolean
} }
/** @internal */ /** @public */
export const scribbleValidator: T.Validator<TLScribble> = T.object({ export const scribbleValidator: T.Validator<TLScribble> = T.object({
id: T.string, id: T.string,
points: T.arrayOf(vecModelValidator), points: T.arrayOf(vecModelValidator),

View file

@ -1,7 +1,7 @@
import type { RecordId, UnknownRecord } from '@tldraw/store' import type { RecordId, UnknownRecord } from '@tldraw/store'
import { T } from '@tldraw/validate' import { T } from '@tldraw/validate'
/** @internal */ /** @public */
export function idValidator<Id extends RecordId<UnknownRecord>>( export function idValidator<Id extends RecordId<UnknownRecord>>(
prefix: Id['__type__']['typeName'] prefix: Id['__type__']['typeName']
): T.Validator<Id> { ): T.Validator<Id> {

View file

@ -14,7 +14,7 @@ import { TLShape } from './TLShape'
/** @public */ /** @public */
export type TLAsset = TLImageAsset | TLVideoAsset | TLBookmarkAsset export type TLAsset = TLImageAsset | TLVideoAsset | TLBookmarkAsset
/** @internal */ /** @public */
export const assetValidator: T.Validator<TLAsset> = T.model( export const assetValidator: T.Validator<TLAsset> = T.model(
'asset', 'asset',
T.union('type', { T.union('type', {
@ -24,12 +24,12 @@ export const assetValidator: T.Validator<TLAsset> = T.model(
}) })
) )
/** @internal */ /** @public */
export const assetVersions = createMigrationIds('com.tldraw.asset', { export const assetVersions = createMigrationIds('com.tldraw.asset', {
AddMeta: 1, AddMeta: 1,
} as const) } as const)
/** @internal */ /** @public */
export const assetMigrations = createRecordMigrationSequence({ export const assetMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.asset', sequenceId: 'com.tldraw.asset',
recordType: 'asset', recordType: 'asset',

View file

@ -27,7 +27,7 @@ export interface TLCamera extends BaseRecord<'camera', TLCameraId> {
* @public */ * @public */
export type TLCameraId = RecordId<TLCamera> export type TLCameraId = RecordId<TLCamera>
/** @internal */ /** @public */
export const cameraValidator: T.Validator<TLCamera> = T.model( export const cameraValidator: T.Validator<TLCamera> = T.model(
'camera', 'camera',
T.object({ T.object({
@ -40,12 +40,12 @@ export const cameraValidator: T.Validator<TLCamera> = T.model(
}) })
) )
/** @internal */ /** @public */
export const cameraVersions = createMigrationIds('com.tldraw.camera', { export const cameraVersions = createMigrationIds('com.tldraw.camera', {
AddMeta: 1, AddMeta: 1,
}) })
/** @internal */ /** @public */
export const cameraMigrations = createRecordMigrationSequence({ export const cameraMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.camera', sequenceId: 'com.tldraw.camera',
recordType: 'camera', recordType: 'camera',

View file

@ -19,7 +19,7 @@ export interface TLDocument extends BaseRecord<'document', RecordId<TLDocument>>
meta: JsonObject meta: JsonObject
} }
/** @internal */ /** @public */
export const documentValidator: T.Validator<TLDocument> = T.model( export const documentValidator: T.Validator<TLDocument> = T.model(
'document', 'document',
T.object({ T.object({
@ -31,13 +31,13 @@ export const documentValidator: T.Validator<TLDocument> = T.model(
}) })
) )
/** @internal */ /** @public */
export const documentVersions = createMigrationIds('com.tldraw.document', { export const documentVersions = createMigrationIds('com.tldraw.document', {
AddName: 1, AddName: 1,
AddMeta: 2, AddMeta: 2,
} as const) } as const)
/** @internal */ /** @public */
export const documentMigrations = createRecordMigrationSequence({ export const documentMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.document', sequenceId: 'com.tldraw.document',
recordType: 'document', recordType: 'document',

View file

@ -73,7 +73,7 @@ export interface TLInstance extends BaseRecord<'instance', TLInstanceId> {
/** @public */ /** @public */
export type TLInstanceId = RecordId<TLInstance> export type TLInstanceId = RecordId<TLInstance>
/** @internal */ /** @public */
export const instanceIdValidator = idValidator<TLInstanceId>('instance') export const instanceIdValidator = idValidator<TLInstanceId>('instance')
export function createInstanceRecordType(stylesById: Map<string, StyleProp<unknown>>) { export function createInstanceRecordType(stylesById: Map<string, StyleProp<unknown>>) {
@ -197,7 +197,7 @@ export function createInstanceRecordType(stylesById: Map<string, StyleProp<unkno
) )
} }
/** @internal */ /** @public */
export const instanceVersions = createMigrationIds('com.tldraw.instance', { export const instanceVersions = createMigrationIds('com.tldraw.instance', {
AddTransparentExportBgs: 1, AddTransparentExportBgs: 1,
RemoveDialog: 2, RemoveDialog: 2,

View file

@ -23,10 +23,10 @@ export interface TLPage extends BaseRecord<'page', TLPageId> {
/** @public */ /** @public */
export type TLPageId = RecordId<TLPage> export type TLPageId = RecordId<TLPage>
/** @internal */ /** @public */
export const pageIdValidator = idValidator<TLPageId>('page') export const pageIdValidator = idValidator<TLPageId>('page')
/** @internal */ /** @public */
export const pageValidator: T.Validator<TLPage> = T.model( export const pageValidator: T.Validator<TLPage> = T.model(
'page', 'page',
T.object({ T.object({
@ -38,12 +38,12 @@ export const pageValidator: T.Validator<TLPage> = T.model(
}) })
) )
/** @internal */ /** @public */
export const pageVersions = createMigrationIds('com.tldraw.page', { export const pageVersions = createMigrationIds('com.tldraw.page', {
AddMeta: 1, AddMeta: 1,
}) })
/** @internal */ /** @public */
export const pageMigrations = createRecordMigrationSequence({ export const pageMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.page', sequenceId: 'com.tldraw.page',
recordType: 'page', recordType: 'page',

View file

@ -32,7 +32,7 @@ export interface TLInstancePageState
meta: JsonObject meta: JsonObject
} }
/** @internal */ /** @public */
export const instancePageStateValidator: T.Validator<TLInstancePageState> = T.model( export const instancePageStateValidator: T.Validator<TLInstancePageState> = T.model(
'instance_page_state', 'instance_page_state',
T.object({ T.object({
@ -50,7 +50,7 @@ export const instancePageStateValidator: T.Validator<TLInstancePageState> = T.mo
}) })
) )
/** @internal */ /** @public */
export const instancePageStateVersions = createMigrationIds('com.tldraw.instance_page_state', { export const instancePageStateVersions = createMigrationIds('com.tldraw.instance_page_state', {
AddCroppingId: 1, AddCroppingId: 1,
RemoveInstanceIdAndCameraId: 2, RemoveInstanceIdAndCameraId: 2,

View file

@ -24,7 +24,7 @@ export interface TLPointer extends BaseRecord<'pointer', TLPointerId> {
/** @public */ /** @public */
export type TLPointerId = RecordId<TLPointer> export type TLPointerId = RecordId<TLPointer>
/** @internal */ /** @public */
export const pointerValidator: T.Validator<TLPointer> = T.model( export const pointerValidator: T.Validator<TLPointer> = T.model(
'pointer', 'pointer',
T.object({ T.object({
@ -37,12 +37,12 @@ export const pointerValidator: T.Validator<TLPointer> = T.model(
}) })
) )
/** @internal */ /** @public */
export const pointerVersions = createMigrationIds('com.tldraw.pointer', { export const pointerVersions = createMigrationIds('com.tldraw.pointer', {
AddMeta: 1, AddMeta: 1,
}) })
/** @internal */ /** @public */
export const pointerMigrations = createRecordMigrationSequence({ export const pointerMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.pointer', sequenceId: 'com.tldraw.pointer',
recordType: 'pointer', recordType: 'pointer',

View file

@ -40,7 +40,7 @@ export interface TLInstancePresence extends BaseRecord<'instance_presence', TLIn
/** @public */ /** @public */
export type TLInstancePresenceID = RecordId<TLInstancePresence> export type TLInstancePresenceID = RecordId<TLInstancePresence>
/** @internal */ /** @public */
export const instancePresenceValidator: T.Validator<TLInstancePresence> = T.model( export const instancePresenceValidator: T.Validator<TLInstancePresence> = T.model(
'instance_presence', 'instance_presence',
T.object({ T.object({
@ -72,7 +72,7 @@ export const instancePresenceValidator: T.Validator<TLInstancePresence> = T.mode
}) })
) )
/** @internal */ /** @public */
export const instancePresenceVersions = createMigrationIds('com.tldraw.instance_presence', { export const instancePresenceVersions = createMigrationIds('com.tldraw.instance_presence', {
AddScribbleDelay: 1, AddScribbleDelay: 1,
RemoveInstanceId: 2, RemoveInstanceId: 2,

View file

@ -92,7 +92,7 @@ export type TLShapeProp = keyof TLShapeProps
/** @public */ /** @public */
export type TLParentId = TLPageId | TLShapeId export type TLParentId = TLPageId | TLShapeId
/** @internal */ /** @public */
export const rootShapeVersions = createMigrationIds('com.tldraw.shape', { export const rootShapeVersions = createMigrationIds('com.tldraw.shape', {
AddIsLocked: 1, AddIsLocked: 1,
HoistOpacity: 2, HoistOpacity: 2,
@ -100,7 +100,7 @@ export const rootShapeVersions = createMigrationIds('com.tldraw.shape', {
AddWhite: 4, AddWhite: 4,
} as const) } as const)
/** @internal */ /** @public */
export const rootShapeMigrations = createRecordMigrationSequence({ export const rootShapeMigrations = createRecordMigrationSequence({
sequenceId: 'com.tldraw.shape', sequenceId: 'com.tldraw.shape',
recordType: 'shape', recordType: 'shape',

View file

@ -88,7 +88,7 @@ export const arrowShapeVersions = createShapePropsMigrationIds('arrow', {
AddLabelPosition: 3, AddLabelPosition: 3,
}) })
/** @internal */ /** @public */
export const arrowShapeMigrations = createShapePropsMigrationSequence({ export const arrowShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -28,7 +28,7 @@ const Versions = createShapePropsMigrationIds('bookmark', {
export { Versions as bookmarkShapeVersions } export { Versions as bookmarkShapeVersions }
/** @internal */ /** @public */
export const bookmarkShapeMigrations = createShapePropsMigrationSequence({ export const bookmarkShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -43,7 +43,7 @@ const Versions = createShapePropsMigrationIds('draw', {
export { Versions as drawShapeVersions } export { Versions as drawShapeVersions }
/** @internal */ /** @public */
export const drawShapeMigrations = createShapePropsMigrationSequence({ export const drawShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -625,7 +625,7 @@ const Versions = createShapePropsMigrationIds('embed', {
export { Versions as embedShapeVersions } export { Versions as embedShapeVersions }
/** @internal */ /** @public */
export const embedShapeMigrations = createShapePropsMigrationSequence({ export const embedShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -14,7 +14,7 @@ type TLFrameShapeProps = ShapePropsType<typeof frameShapeProps>
/** @public */ /** @public */
export type TLFrameShape = TLBaseShape<'frame', TLFrameShapeProps> export type TLFrameShape = TLBaseShape<'frame', TLFrameShapeProps>
/** @internal */ /** @public */
export const frameShapeMigrations = createShapePropsMigrationSequence({ export const frameShapeMigrations = createShapePropsMigrationSequence({
sequence: [], sequence: [],
}) })

View file

@ -83,7 +83,7 @@ const geoShapeVersions = createShapePropsMigrationIds('geo', {
export { geoShapeVersions as geoShapeVersions } export { geoShapeVersions as geoShapeVersions }
/** @internal */ /** @public */
export const geoShapeMigrations = createShapePropsMigrationSequence({ export const geoShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -7,8 +7,8 @@ export type TLGroupShapeProps = { [key in never]: undefined }
/** @public */ /** @public */
export type TLGroupShape = TLBaseShape<'group', TLGroupShapeProps> export type TLGroupShape = TLBaseShape<'group', TLGroupShapeProps>
/** @internal */ /** @public */
export const groupShapeProps: ShapeProps<TLGroupShape> = {} export const groupShapeProps: ShapeProps<TLGroupShape> = {}
/** @internal */ /** @public */
export const groupShapeMigrations = createShapePropsMigrationSequence({ sequence: [] }) export const groupShapeMigrations = createShapePropsMigrationSequence({ sequence: [] })

View file

@ -20,5 +20,5 @@ export type TLHighlightShapeProps = ShapePropsType<typeof highlightShapeProps>
/** @public */ /** @public */
export type TLHighlightShape = TLBaseShape<'highlight', TLHighlightShapeProps> export type TLHighlightShape = TLBaseShape<'highlight', TLHighlightShapeProps>
/** @internal */ /** @public */
export const highlightShapeMigrations = createShapePropsMigrationSequence({ sequence: [] }) export const highlightShapeMigrations = createShapePropsMigrationSequence({ sequence: [] })

View file

@ -40,7 +40,7 @@ const Versions = createShapePropsMigrationIds('image', {
export { Versions as imageShapeVersions } export { Versions as imageShapeVersions }
/** @internal */ /** @public */
export const imageShapeMigrations = createShapePropsMigrationSequence({ export const imageShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -42,7 +42,7 @@ export type TLLineShapeProps = ShapePropsType<typeof lineShapeProps>
/** @public */ /** @public */
export type TLLineShape = TLBaseShape<'line', TLLineShapeProps> export type TLLineShape = TLBaseShape<'line', TLLineShapeProps>
/** @internal */ /** @public */
export const lineShapeVersions = createShapePropsMigrationIds('line', { export const lineShapeVersions = createShapePropsMigrationIds('line', {
AddSnapHandles: 1, AddSnapHandles: 1,
RemoveExtraHandleProps: 2, RemoveExtraHandleProps: 2,
@ -50,7 +50,7 @@ export const lineShapeVersions = createShapePropsMigrationIds('line', {
PointIndexIds: 4, PointIndexIds: 4,
}) })
/** @internal */ /** @public */
export const lineShapeMigrations = createShapePropsMigrationSequence({ export const lineShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -41,7 +41,7 @@ const Versions = createShapePropsMigrationIds('note', {
export { Versions as noteShapeVersions } export { Versions as noteShapeVersions }
/** @internal */ /** @public */
export const noteShapeMigrations = createShapePropsMigrationSequence({ export const noteShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -34,7 +34,7 @@ const Versions = createShapePropsMigrationIds('text', {
export { Versions as textShapeVersions } export { Versions as textShapeVersions }
/** @internal */ /** @public */
export const textShapeMigrations = createShapePropsMigrationSequence({ export const textShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -30,7 +30,7 @@ const Versions = createShapePropsMigrationIds('video', {
export { Versions as videoShapeVersions } export { Versions as videoShapeVersions }
/** @internal */ /** @public */
export const videoShapeMigrations = createShapePropsMigrationSequence({ export const videoShapeMigrations = createShapePropsMigrationSequence({
sequence: [ sequence: [
{ {

View file

@ -1,86 +1,5 @@
import { import { createTLSchema, defaultShapeSchemas } from '@tldraw/tlschema'
arrowShapeMigrations,
arrowShapeProps,
bookmarkShapeMigrations,
bookmarkShapeProps,
createTLSchema,
drawShapeMigrations,
drawShapeProps,
embedShapeMigrations,
embedShapeProps,
frameShapeMigrations,
frameShapeProps,
geoShapeMigrations,
geoShapeProps,
groupShapeMigrations,
groupShapeProps,
highlightShapeMigrations,
highlightShapeProps,
imageShapeMigrations,
imageShapeProps,
lineShapeMigrations,
lineShapeProps,
noteShapeMigrations,
noteShapeProps,
textShapeMigrations,
textShapeProps,
videoShapeMigrations,
videoShapeProps,
} from '@tldraw/tlschema'
export const schema = createTLSchema({ export const schema = createTLSchema({
shapes: { shapes: defaultShapeSchemas,
group: {
props: groupShapeProps,
migrations: groupShapeMigrations,
},
text: {
props: textShapeProps,
migrations: textShapeMigrations,
},
bookmark: {
props: bookmarkShapeProps,
migrations: bookmarkShapeMigrations,
},
draw: {
props: drawShapeProps,
migrations: drawShapeMigrations,
},
geo: {
props: geoShapeProps,
migrations: geoShapeMigrations,
},
note: {
props: noteShapeProps,
migrations: noteShapeMigrations,
},
line: {
props: lineShapeProps,
migrations: lineShapeMigrations,
},
frame: {
props: frameShapeProps,
migrations: frameShapeMigrations,
},
arrow: {
props: arrowShapeProps,
migrations: arrowShapeMigrations,
},
highlight: {
props: highlightShapeProps,
migrations: highlightShapeMigrations,
},
embed: {
props: embedShapeProps,
migrations: embedShapeMigrations,
},
image: {
props: imageShapeProps,
migrations: imageShapeMigrations,
},
video: {
props: videoShapeProps,
migrations: videoShapeMigrations,
},
},
}) })