tldraw/packages/tlschema/src/index.ts

264 lines
6.1 KiB
TypeScript
Raw Normal View History

2023-04-25 11:01:25 +00:00
export { type TLRecord } from './TLRecord'
export {
USER_COLORS,
createIntegrityChecker,
2023-04-25 11:01:25 +00:00
onValidationFailure,
type TLStore,
type TLStoreProps,
type TLStoreSchema,
type TLStoreSnapshot,
} from './TLStore'
export {
bookmarkAssetMigrations,
bookmarkAssetTypeValidator,
type TLBookmarkAsset,
} from './assets/TLBookmarkAsset'
export {
imageAssetMigrations,
imageAssetTypeValidator,
type TLImageAsset,
} from './assets/TLImageAsset'
export {
videoAssetMigrations,
videoAssetTypeValidator,
type TLVideoAsset,
} from './assets/TLVideoAsset'
export { createAssetValidator, type TLBaseAsset } from './assets/asset-validation'
export {
createTLSchema,
type MigrationsForShapes,
type ValidatorsForShapes,
} from './createTLSchema'
export { defaultDerivePresenceState } from './defaultDerivePresenceState'
2023-04-25 11:01:25 +00:00
export { CLIENT_FIXUP_SCRIPT, fixupRecord } from './fixup'
export { type Box2dModel, type Vec2dModel } from './geometry-types'
export {
TLAsset,
assetTypeMigrations,
assetTypeValidator,
type TLAssetId,
type TLAssetPartial,
type TLAssetShape,
} from './records/TLAsset'
export { TLCamera, cameraTypeValidator, type TLCameraId } from './records/TLCamera'
export { TLDOCUMENT_ID, TLDocument, documentTypeValidator } from './records/TLDocument'
2023-04-25 11:01:25 +00:00
export {
TLInstance,
instanceTypeMigrations,
instanceTypeValidator,
type TLInstanceId,
type TLInstancePropsForNextShape,
} from './records/TLInstance'
export {
TLInstancePageState,
instancePageStateMigrations,
instancePageStateTypeValidator,
type TLInstancePageStateId,
} from './records/TLInstancePageState'
derived presence state (#1204) This PR adds - A new `TLInstancePresence` record type, to collect info about the presence state in a particular instance of the editor. This will eventually be used to sync presence data instead of sending instance-only state across the wire. - **Record Scopes** `RecordType` now has a `scope` property which can be one of three things: - `document`: the record belongs to the document and should be synced and persisted freely. Currently: `TLDocument`, `TLPage`, `TLShape`, and `TLAsset` - `instance`: the record belongs to a single instance of the store and should not be synced at all. It should not be persisted directly in most cases, but rather compiled into a kind of 'instance configuration' to store alongside the local document data so that when reopening the associated document it can remember some of the previous instance state. Currently: `TLInstance`, `TLInstancePageState`, `TLCamera`, `TLUser`, `TLUserDocument`, `TLUserPresence` - `presence`: the record belongs to a single instance of the store and should not be persisted, but may be synced using the special presence sync protocol. Currently just `TLInstancePresence` This sets us up for the following changes, which are gonna be pretty high-impact in terms of integrating tldraw into existing systems: - Removing `instanceId` as a config option. Each instance gets a randomly generated ID. - We'd replace it with an `instanceConfig` option that has stuff like selectedIds, camera positions, and so on. Then it's up to library users to get and reinstate the instance config at persistence boundaries. - Removing `userId` as config option, and removing the `TLUser` type altogether. - We might need to revisit when doing auth-enabled features like locking shapes, but I suspect that will be separate.
2023-04-27 18:03:19 +00:00
export { TLInstancePresence } from './records/TLInstancePresence'
export { TLPage, pageTypeValidator, type TLPageId } from './records/TLPage'
2023-04-25 11:01:25 +00:00
export {
createCustomShapeId,
createShapeId,
isShape,
isShapeId,
rootShapeTypeMigrations,
type TLNullableShapeProps,
type TLParentId,
type TLShape,
type TLShapeId,
type TLShapePartial,
type TLShapeProp,
type TLShapeProps,
type TLShapeType,
type TLUnknownShape,
} from './records/TLShape'
export { TLUser, userTypeValidator, type TLUserId } from './records/TLUser'
2023-04-25 11:01:25 +00:00
export {
TLUserDocument,
userDocumentTypeMigrations,
userDocumentTypeValidator,
type TLUserDocumentId,
} from './records/TLUserDocument'
export {
TLUserPresence,
userPresenceTypeMigrations,
userPresenceTypeValidator,
type TLUserPresenceId,
} from './records/TLUserPresence'
export { storeMigrations } from './schema'
export {
TL_ARROW_TERMINAL_TYPE,
arrowShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
arrowShapeTypeValidator,
arrowTerminalTypeValidator,
type TLArrowHeadModel,
type TLArrowShape,
type TLArrowShapeProps,
type TLArrowTerminal,
type TLArrowTerminalType,
} from './shapes/TLArrowShape'
export {
bookmarkShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
bookmarkShapeTypeValidator,
type TLBookmarkShape,
type TLBookmarkShapeProps,
} from './shapes/TLBookmarkShape'
export {
TL_DRAW_SHAPE_SEGMENT_TYPE,
drawShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
drawShapeTypeValidator,
type TLDrawShape,
type TLDrawShapeProps,
type TLDrawShapeSegment,
} from './shapes/TLDrawShape'
export {
EMBED_DEFINITIONS,
embedShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
embedShapeTypeValidator,
tlEmbedShapePermissionDefaults,
type EmbedDefinition,
type TLEmbedShape,
type TLEmbedShapePermissionName,
type TLEmbedShapePermissions,
type TLEmbedShapeProps,
} from './shapes/TLEmbedShape'
export {
frameShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
frameShapeTypeValidator,
type TLFrameShape,
type TLFrameShapeProps,
} from './shapes/TLFrameShape'
export {
geoShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
geoShapeTypeValidator,
type TLGeoShape,
type TLGeoShapeProps,
} from './shapes/TLGeoShape'
export {
groupShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
groupShapeTypeValidator,
type TLGroupShape,
type TLGroupShapeProps,
} from './shapes/TLGroupShape'
export {
iconShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
iconShapeTypeValidator,
type TLIconShape,
type TLIconShapeProps,
} from './shapes/TLIconShape'
export {
imageShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
imageShapeTypeValidator,
type TLImageCrop,
type TLImageShape,
type TLImageShapeProps,
} from './shapes/TLImageShape'
export {
lineShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
lineShapeTypeValidator,
type TLLineShape,
type TLLineShapeProps,
} from './shapes/TLLineShape'
export {
noteShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
noteShapeTypeValidator,
type TLNoteShape,
type TLNoteShapeProps,
} from './shapes/TLNoteShape'
export {
textShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
textShapeTypeValidator,
type TLTextShape,
type TLTextShapeProps,
} from './shapes/TLTextShape'
export {
videoShapeTypeMigrations,
2023-04-25 11:01:25 +00:00
videoShapeTypeValidator,
type TLVideoShape,
type TLVideoShapeProps,
} from './shapes/TLVideoShape'
export { createShapeValidator, type TLBaseShape } from './shapes/shape-validation'
export {
TL_ALIGN_TYPES,
TL_ARROWHEAD_TYPES,
TL_COLOR_TYPES,
TL_DASH_TYPES,
TL_FILL_TYPES,
TL_FONT_TYPES,
TL_GEO_TYPES,
TL_ICON_TYPES,
TL_OPACITY_TYPES,
TL_SIZE_TYPES,
TL_SPLINE_TYPES,
TL_STYLE_TYPES,
type TLAlignStyle,
type TLAlignType,
type TLArrowheadEndStyle,
type TLArrowheadStartStyle,
type TLArrowheadType,
type TLBaseStyle,
type TLColorStyle,
type TLColorType,
type TLDashStyle,
type TLDashType,
type TLFillStyle,
type TLFillType,
type TLFontStyle,
type TLFontType,
type TLGeoStyle,
type TLGeoType,
type TLIconStyle,
type TLIconType,
type TLOpacityStyle,
type TLOpacityType,
type TLSizeStyle,
type TLSizeType,
type TLSplineType,
type TLSplineTypeStyle,
type TLStyleCollections,
type TLStyleItem,
type TLStyleProps,
type TLStyleType,
type TLVerticalAlignType,
2023-04-25 11:01:25 +00:00
} from './style-types'
export {
TL_CURSOR_TYPES,
TL_HANDLE_TYPES,
TL_SCRIBBLE_STATES,
TL_UI_COLOR_TYPES,
cursorTypeValidator,
cursorValidator,
handleTypeValidator,
scribbleTypeValidator,
uiColorTypeValidator,
type TLCursor,
type TLCursorType,
type TLHandle,
type TLHandlePartial,
type TLHandleType,
type TLScribble,
type TLUiColorType,
} from './ui-types'
export { type SetValue, type SmooshedUnionObject } from './util-types'
export {
alignValidator,
arrowheadValidator,
assetIdValidator,
colorValidator,
dashValidator,
fillValidator,
fontValidator,
geoValidator,
iconValidator,
idValidator,
instanceIdValidator,
opacityValidator,
pageIdValidator,
parentIdValidator,
shapeIdValidator,
sizeValidator,
splineValidator,
userIdValidator,
} from './validation'