@tldraw/tlschema 5.3.0-next.fc37bd96825b → 5.4.0-canary.b41840d4f0e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +265 -1
- package/dist-cjs/index.js +15 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/misc/TLCursor.js +1 -0
- package/dist-cjs/misc/TLCursor.js.map +2 -2
- package/dist-cjs/records/TLComment.js +232 -0
- package/dist-cjs/records/TLComment.js.map +7 -0
- package/dist-cjs/shapes/TLGeoShape.js +15 -1
- package/dist-cjs/shapes/TLGeoShape.js.map +2 -2
- package/dist-esm/index.d.mts +265 -1
- package/dist-esm/index.mjs +29 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/misc/TLCursor.mjs +1 -0
- package/dist-esm/misc/TLCursor.mjs.map +2 -2
- package/dist-esm/records/TLComment.mjs +212 -0
- package/dist-esm/records/TLComment.mjs.map +7 -0
- package/dist-esm/shapes/TLGeoShape.mjs +15 -1
- package/dist-esm/shapes/TLGeoShape.mjs.map +2 -2
- package/package.json +5 -5
- package/src/index.ts +22 -0
- package/src/migrations.test.ts +12 -0
- package/src/misc/TLCursor.ts +1 -0
- package/src/records/TLComment.test.ts +255 -0
- package/src/records/TLComment.ts +446 -0
- package/src/shapes/TLGeoShape.ts +21 -1
package/dist-cjs/index.d.ts
CHANGED
|
@@ -529,6 +529,43 @@ export declare const CameraRecordType: RecordType<TLCamera, never>;
|
|
|
529
529
|
*/
|
|
530
530
|
export declare const canvasUiColorTypeValidator: T.Validator<"accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white">;
|
|
531
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Config for registering the `comment-reaction` record type in a tldraw schema. Pass via
|
|
534
|
+
* `commentSchemaRecords`; see `TLCommentReaction`.
|
|
535
|
+
*
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
538
|
+
export declare const commentReactionRecordConfig: CustomRecordInfo;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Config for registering the `comment` record type in a tldraw schema. Pass via
|
|
542
|
+
* `commentSchemaRecords`; see `TLComment`.
|
|
543
|
+
*
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
export declare const commentRecordConfig: CustomRecordInfo;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* The `records` map to pass to `createTLSchema` / the client `records` option so comment
|
|
550
|
+
* threads, comments, and reactions sync. Register the types together — one without the others
|
|
551
|
+
* will fail schema validation on one side of the connection.
|
|
552
|
+
*
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
export declare const commentSchemaRecords: {
|
|
556
|
+
'comment-reaction': CustomRecordInfo;
|
|
557
|
+
'comment-thread': CustomRecordInfo;
|
|
558
|
+
comment: CustomRecordInfo;
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Config for registering the `comment-thread` record type in a tldraw schema. Pass via
|
|
563
|
+
* `commentSchemaRecords`; see `TLCommentThread`.
|
|
564
|
+
*
|
|
565
|
+
* @public
|
|
566
|
+
*/
|
|
567
|
+
export declare const commentThreadRecordConfig: CustomRecordInfo;
|
|
568
|
+
|
|
532
569
|
/**
|
|
533
570
|
* Compress legacy draw shape segments by converting VecModel[] points to delta-encoded base64 format.
|
|
534
571
|
* This function is useful for converting old draw shape data to the new compressed format.
|
|
@@ -810,6 +847,66 @@ export declare function createBindingValidator<Type extends string, Props extend
|
|
|
810
847
|
*/
|
|
811
848
|
export declare function createCachedUserResolve(resolveFn: (userId: string) => null | TLUser): (userId: string) => Signal<null | TLUser>;
|
|
812
849
|
|
|
850
|
+
/**
|
|
851
|
+
* Create a new comment record within a thread.
|
|
852
|
+
*
|
|
853
|
+
* @public
|
|
854
|
+
*/
|
|
855
|
+
export declare function createComment(props: {
|
|
856
|
+
authorId: string;
|
|
857
|
+
body: TLRichText;
|
|
858
|
+
meta?: JsonObject;
|
|
859
|
+
now?: number;
|
|
860
|
+
pageId: TLPageId;
|
|
861
|
+
threadId: TLCommentThreadId;
|
|
862
|
+
}): TLComment;
|
|
863
|
+
|
|
864
|
+
/** @public */
|
|
865
|
+
export declare function createCommentId(id?: string): TLCommentId;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Create a reaction record for one user's reaction to one comment. The id is derived from the
|
|
869
|
+
* comment and user (see `createCommentReactionId`), so re-reacting overwrites rather than adding.
|
|
870
|
+
*
|
|
871
|
+
* @public
|
|
872
|
+
*/
|
|
873
|
+
export declare function createCommentReaction(props: {
|
|
874
|
+
commentId: TLCommentId;
|
|
875
|
+
emoji: string;
|
|
876
|
+
meta?: JsonObject;
|
|
877
|
+
now?: number;
|
|
878
|
+
pageId: TLPageId;
|
|
879
|
+
threadId: TLCommentThreadId;
|
|
880
|
+
userId: string;
|
|
881
|
+
}): TLCommentReaction;
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* The id of one user's reaction to one comment, derived from the (comment, user, emoji) triple
|
|
885
|
+
* rather than random, so the same triple always addresses the same record and two tabs converge
|
|
886
|
+
* instead of racing to create duplicates. The sync authorizer leans on this, so it must be
|
|
887
|
+
* injective: all three parts are URI-encoded before joining, so a `:` in any of them can't shift
|
|
888
|
+
* the boundary and collapse two triples onto one id.
|
|
889
|
+
*
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
export declare function createCommentReactionId(commentId: TLCommentId, userId: string, emoji: string): TLCommentReactionId;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Create a new comment thread record. Pair with `createComment` for the thread's first message.
|
|
896
|
+
*
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
export declare function createCommentThread(props: {
|
|
900
|
+
anchor: TLCommentAnchor;
|
|
901
|
+
createdBy: string;
|
|
902
|
+
meta?: JsonObject;
|
|
903
|
+
now?: number;
|
|
904
|
+
pageId: TLPageId;
|
|
905
|
+
}): TLCommentThread;
|
|
906
|
+
|
|
907
|
+
/** @public */
|
|
908
|
+
export declare function createCommentThreadId(id?: string): TLCommentThreadId;
|
|
909
|
+
|
|
813
910
|
/**
|
|
814
911
|
* Creates a unique ID for a custom record type.
|
|
815
912
|
*
|
|
@@ -2226,6 +2323,28 @@ export declare function isBinding(record?: UnknownRecord): record is TLBinding;
|
|
|
2226
2323
|
*/
|
|
2227
2324
|
export declare function isBindingId(id?: string): id is TLBindingId;
|
|
2228
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* Type guard for `TLCommentId`. See `isCommentThreadId`.
|
|
2328
|
+
*
|
|
2329
|
+
* @public
|
|
2330
|
+
*/
|
|
2331
|
+
export declare function isCommentId(id: string): id is TLCommentId;
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* Type guard for `TLCommentReactionId`. See `isCommentThreadId`.
|
|
2335
|
+
*
|
|
2336
|
+
* @public
|
|
2337
|
+
*/
|
|
2338
|
+
export declare function isCommentReactionId(id: string): id is TLCommentReactionId;
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Type guard for `TLCommentThreadId`. `isCommentId` rejects these — `comment-thread:` and
|
|
2342
|
+
* `comment:` differ in the character after `comment`, so the prefixes never overlap.
|
|
2343
|
+
*
|
|
2344
|
+
* @public
|
|
2345
|
+
*/
|
|
2346
|
+
export declare function isCommentThreadId(id: string): id is TLCommentThreadId;
|
|
2347
|
+
|
|
2229
2348
|
/**
|
|
2230
2349
|
* Type guard to check if a record is of a specific custom type.
|
|
2231
2350
|
*
|
|
@@ -4005,6 +4124,145 @@ export declare type TLCameraId = RecordId<TLCamera>;
|
|
|
4005
4124
|
*/
|
|
4006
4125
|
export declare type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>;
|
|
4007
4126
|
|
|
4127
|
+
/**
|
|
4128
|
+
* A single comment message within a thread. See `TLCommentThread` for the overall model and
|
|
4129
|
+
* sync/registration notes.
|
|
4130
|
+
*
|
|
4131
|
+
* Comment mutations are deliberately not undoable — create/edit them with
|
|
4132
|
+
* `{ history: 'ignore' }` to avoid multiplayer surprises like a comment reappearing after
|
|
4133
|
+
* someone else deleted it.
|
|
4134
|
+
*
|
|
4135
|
+
* @public
|
|
4136
|
+
*/
|
|
4137
|
+
export declare interface TLComment extends BaseRecord<'comment', TLCommentId> {
|
|
4138
|
+
/** The thread this comment belongs to. */
|
|
4139
|
+
threadId: TLCommentThreadId;
|
|
4140
|
+
/** Denormalized from the thread so per-page queries don't need a join. */
|
|
4141
|
+
pageId: TLPageId;
|
|
4142
|
+
/** See `TLCommentThread.createdBy` — same server-stamping caveat applies. */
|
|
4143
|
+
authorId: string;
|
|
4144
|
+
createdAt: number;
|
|
4145
|
+
/** Null until the comment is first edited. */
|
|
4146
|
+
editedAt: null | number;
|
|
4147
|
+
/** Rich text body. Use `toRichText(...)` for plaintext input. */
|
|
4148
|
+
body: TLRichText;
|
|
4149
|
+
/** Whether the comment is soft-deleted. Same model as `TLCommentThread.isDeleted`. */
|
|
4150
|
+
isDeleted: boolean;
|
|
4151
|
+
meta: JsonObject;
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4154
|
+
/**
|
|
4155
|
+
* Where a comment thread is anchored on the canvas. Modeled as a discriminated union so new
|
|
4156
|
+
* anchor kinds can be added without breaking existing threads:
|
|
4157
|
+
*
|
|
4158
|
+
* - `shape` — pinned to a shape. `x`/`y` are normalized (0–1) within the shape's bounds, so the pin
|
|
4159
|
+
* keeps its spot as the shape moves, resizes, and rotates. `isPrecise` mirrors arrow bindings:
|
|
4160
|
+
* when false (the default) the pin sits at a consumer-defined spot instead, top-right out of the
|
|
4161
|
+
* box, and `x`/`y` are the remembered precise position
|
|
4162
|
+
* - `point` — pinned to a fixed point on the page, in page coordinates
|
|
4163
|
+
* - `region` — pinned to a rectangular area of the page, in page coordinates
|
|
4164
|
+
* - `page` — a page-level thread with no spatial anchor
|
|
4165
|
+
*
|
|
4166
|
+
* @public
|
|
4167
|
+
*/
|
|
4168
|
+
export declare type TLCommentAnchor = {
|
|
4169
|
+
/** The normalized (0–1) corner the pin sits on — where the creating drag was released.
|
|
4170
|
+
* Absent on older records; consumers fall back to a corner of their own choosing. */
|
|
4171
|
+
pinX?: number;
|
|
4172
|
+
h: number;
|
|
4173
|
+
pinY?: number;
|
|
4174
|
+
type: 'region';
|
|
4175
|
+
w: number;
|
|
4176
|
+
x: number;
|
|
4177
|
+
y: number;
|
|
4178
|
+
} | {
|
|
4179
|
+
isPrecise: boolean;
|
|
4180
|
+
shapeId: TLShapeId;
|
|
4181
|
+
type: 'shape';
|
|
4182
|
+
x: number;
|
|
4183
|
+
y: number;
|
|
4184
|
+
} | {
|
|
4185
|
+
type: 'page';
|
|
4186
|
+
} | {
|
|
4187
|
+
type: 'point';
|
|
4188
|
+
x: number;
|
|
4189
|
+
y: number;
|
|
4190
|
+
};
|
|
4191
|
+
|
|
4192
|
+
/** @public */
|
|
4193
|
+
export declare type TLCommentId = RecordId<TLComment>;
|
|
4194
|
+
|
|
4195
|
+
/**
|
|
4196
|
+
* One person's emoji reaction to one comment.
|
|
4197
|
+
*
|
|
4198
|
+
* A reaction is its own record rather than a field on the comment: comment records are owner-only
|
|
4199
|
+
* for updates, and a shared field would make concurrent reactions race to overwrite each other.
|
|
4200
|
+
*
|
|
4201
|
+
* A user holds at most one record per (comment, emoji) pair, enforced by the derived id — see
|
|
4202
|
+
* `createCommentReactionId`. Limiting a user to one reaction overall is client-side policy (the
|
|
4203
|
+
* commenting package's `reactionMode`), not a property of this record.
|
|
4204
|
+
*
|
|
4205
|
+
* @public
|
|
4206
|
+
*/
|
|
4207
|
+
export declare interface TLCommentReaction extends BaseRecord<'comment-reaction', TLCommentReactionId> {
|
|
4208
|
+
/** The comment being reacted to. */
|
|
4209
|
+
commentId: TLCommentId;
|
|
4210
|
+
/** Denormalized from the comment, so a thread's reactions can be found without a join. */
|
|
4211
|
+
threadId: TLCommentThreadId;
|
|
4212
|
+
/** Denormalized from the comment — see `TLComment.pageId`. */
|
|
4213
|
+
pageId: TLPageId;
|
|
4214
|
+
/** Who reacted. See `TLCommentThread.createdBy` — same server-stamping caveat applies. */
|
|
4215
|
+
userId: string;
|
|
4216
|
+
/** The emoji itself, as a string (e.g. `'👍'`), not a shortcode. */
|
|
4217
|
+
emoji: string;
|
|
4218
|
+
createdAt: number;
|
|
4219
|
+
meta: JsonObject;
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
/** @public */
|
|
4223
|
+
export declare type TLCommentReactionId = RecordId<TLCommentReaction>;
|
|
4224
|
+
|
|
4225
|
+
/**
|
|
4226
|
+
* A comment thread. The thread owns the anchor (where the conversation lives on the canvas) and
|
|
4227
|
+
* the resolution state; the messages themselves are `TLComment` records pointing at the thread
|
|
4228
|
+
* via `threadId`, ordered by `createdAt`. v1 threads are flat — no nested replies.
|
|
4229
|
+
*
|
|
4230
|
+
* Threads and comments are document records, but they're intended to be served through the sync
|
|
4231
|
+
* server's object-store lane: gated by the session's `objectAccess` rather than `isReadonly`
|
|
4232
|
+
* (so "can comment but not edit" is expressible), excluded from document snapshots and `.tldr`
|
|
4233
|
+
* exports server-side, and persisted in a separate lane from the main document.
|
|
4234
|
+
*
|
|
4235
|
+
* Opt-in: register with `createTLSchema({ records: commentSchemaRecords })` on the server and
|
|
4236
|
+
* the matching `records` option on the client — neither type is part of the default schema, and
|
|
4237
|
+
* both sides must register them identically.
|
|
4238
|
+
*
|
|
4239
|
+
* @public
|
|
4240
|
+
*/
|
|
4241
|
+
export declare interface TLCommentThread extends BaseRecord<'comment-thread', TLCommentThreadId> {
|
|
4242
|
+
/** The page the thread lives on. */
|
|
4243
|
+
pageId: TLPageId;
|
|
4244
|
+
/** Where the thread is anchored on that page. */
|
|
4245
|
+
anchor: TLCommentAnchor;
|
|
4246
|
+
/** Who started the thread. Client-supplied; sync servers are expected to stamp/verify it. */
|
|
4247
|
+
createdBy: string;
|
|
4248
|
+
createdAt: number;
|
|
4249
|
+
/** Resolution state: when and by whom the thread was resolved, or null while open. */
|
|
4250
|
+
resolved: {
|
|
4251
|
+
at: number;
|
|
4252
|
+
by: string;
|
|
4253
|
+
} | null;
|
|
4254
|
+
/**
|
|
4255
|
+
* Whether the thread is soft-deleted. Clients set the flag and leave the record in place. Sync
|
|
4256
|
+
* servers are expected to enforce it as write-once and creator-only, reject client hard
|
|
4257
|
+
* deletes, and drop flagged threads from future room loads.
|
|
4258
|
+
*/
|
|
4259
|
+
isDeleted: boolean;
|
|
4260
|
+
meta: JsonObject;
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
/** @public */
|
|
4264
|
+
export declare type TLCommentThreadId = RecordId<TLCommentThread>;
|
|
4265
|
+
|
|
4008
4266
|
/**
|
|
4009
4267
|
* A partial version of a shape, useful for creating shapes.
|
|
4010
4268
|
*
|
|
@@ -4730,7 +4988,9 @@ export declare interface TLFrameShapeProps {
|
|
|
4730
4988
|
* labelColor: 'black',
|
|
4731
4989
|
* url: '',
|
|
4732
4990
|
* growY: 0,
|
|
4733
|
-
* scale: 1
|
|
4991
|
+
* scale: 1,
|
|
4992
|
+
* flipX: false,
|
|
4993
|
+
* flipY: false
|
|
4734
4994
|
* },
|
|
4735
4995
|
* meta: {}
|
|
4736
4996
|
* }
|
|
@@ -4765,6 +5025,10 @@ export declare interface TLGeoShapeProps {
|
|
|
4765
5025
|
growY: number;
|
|
4766
5026
|
/** Scale factor applied to the shape */
|
|
4767
5027
|
scale: number;
|
|
5028
|
+
/** Whether to mirror the shape horizontally */
|
|
5029
|
+
flipX: boolean;
|
|
5030
|
+
/** Whether to mirror the shape vertically */
|
|
5031
|
+
flipY: boolean;
|
|
4768
5032
|
/** Color style for text label */
|
|
4769
5033
|
labelColor: TLDefaultColorStyle;
|
|
4770
5034
|
/** Color style for the shape outline */
|
package/dist-cjs/index.js
CHANGED
|
@@ -70,6 +70,10 @@ __export(index_exports, {
|
|
|
70
70
|
bookmarkShapeProps: () => import_TLBookmarkShape.bookmarkShapeProps,
|
|
71
71
|
boxModelValidator: () => import_geometry_types.boxModelValidator,
|
|
72
72
|
canvasUiColorTypeValidator: () => import_TLColor.canvasUiColorTypeValidator,
|
|
73
|
+
commentReactionRecordConfig: () => import_TLComment.commentReactionRecordConfig,
|
|
74
|
+
commentRecordConfig: () => import_TLComment.commentRecordConfig,
|
|
75
|
+
commentSchemaRecords: () => import_TLComment.commentSchemaRecords,
|
|
76
|
+
commentThreadRecordConfig: () => import_TLComment.commentThreadRecordConfig,
|
|
73
77
|
compressLegacySegments: () => import_TLDrawShape.compressLegacySegments,
|
|
74
78
|
createAssetPropsMigrationIds: () => import_TLAsset.createAssetPropsMigrationIds,
|
|
75
79
|
createAssetPropsMigrationSequence: () => import_TLAsset.createAssetPropsMigrationSequence,
|
|
@@ -80,6 +84,12 @@ __export(index_exports, {
|
|
|
80
84
|
createBindingPropsMigrationSequence: () => import_TLBinding.createBindingPropsMigrationSequence,
|
|
81
85
|
createBindingValidator: () => import_TLBaseBinding.createBindingValidator,
|
|
82
86
|
createCachedUserResolve: () => import_TLStore.createCachedUserResolve,
|
|
87
|
+
createComment: () => import_TLComment.createComment,
|
|
88
|
+
createCommentId: () => import_TLComment.createCommentId,
|
|
89
|
+
createCommentReaction: () => import_TLComment.createCommentReaction,
|
|
90
|
+
createCommentReactionId: () => import_TLComment.createCommentReactionId,
|
|
91
|
+
createCommentThread: () => import_TLComment.createCommentThread,
|
|
92
|
+
createCommentThreadId: () => import_TLComment.createCommentThreadId,
|
|
83
93
|
createCustomRecordId: () => import_TLCustomRecord.createCustomRecordId,
|
|
84
94
|
createCustomRecordMigrationIds: () => import_TLCustomRecord.createCustomRecordMigrationIds,
|
|
85
95
|
createCustomRecordMigrationSequence: () => import_TLCustomRecord.createCustomRecordMigrationSequence,
|
|
@@ -116,6 +126,9 @@ __export(index_exports, {
|
|
|
116
126
|
imageShapeProps: () => import_TLImageShape.imageShapeProps,
|
|
117
127
|
isBinding: () => import_TLBinding.isBinding,
|
|
118
128
|
isBindingId: () => import_TLBinding.isBindingId,
|
|
129
|
+
isCommentId: () => import_TLComment.isCommentId,
|
|
130
|
+
isCommentReactionId: () => import_TLComment.isCommentReactionId,
|
|
131
|
+
isCommentThreadId: () => import_TLComment.isCommentThreadId,
|
|
119
132
|
isCustomRecord: () => import_TLCustomRecord.isCustomRecord,
|
|
120
133
|
isCustomRecordId: () => import_TLCustomRecord.isCustomRecordId,
|
|
121
134
|
isDocument: () => import_TLDocument.isDocument,
|
|
@@ -170,6 +183,7 @@ var import_TLScribble = require("./misc/TLScribble");
|
|
|
170
183
|
var import_TLAsset = require("./records/TLAsset");
|
|
171
184
|
var import_TLBinding = require("./records/TLBinding");
|
|
172
185
|
var import_TLCamera = require("./records/TLCamera");
|
|
186
|
+
var import_TLComment = require("./records/TLComment");
|
|
173
187
|
var import_TLCustomRecord = require("./records/TLCustomRecord");
|
|
174
188
|
var import_TLDocument = require("./records/TLDocument");
|
|
175
189
|
var import_TLInstance = require("./records/TLInstance");
|
|
@@ -207,7 +221,7 @@ var import_translations = require("./translations/translations");
|
|
|
207
221
|
var import_b64Vecs = require("./misc/b64Vecs");
|
|
208
222
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
209
223
|
"@tldraw/tlschema",
|
|
210
|
-
"5.
|
|
224
|
+
"5.4.0-canary.b41840d4f0e4",
|
|
211
225
|
"cjs"
|
|
212
226
|
);
|
|
213
227
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview\n * Main entry point for the tldraw schema package. Exports the complete type system,\n * data structures, validation, and migrations for tldraw's persisted data.\n *\n * This package provides:\n * - Schema creation utilities (createTLSchema, defaultShapeSchemas, defaultBindingSchemas)\n * - All built-in shape types (TLGeoShape, TLTextShape, TLArrowShape, etc.)\n * - Asset management types and validators (TLImageAsset, TLVideoAsset, TLBookmarkAsset)\n * - Binding system for shape relationships (TLArrowBinding)\n * - Store integration types (TLStore, TLStoreProps, TLStoreSnapshot)\n * - Style properties for consistent styling (DefaultColorStyle, DefaultSizeStyle, etc.)\n * - Validation utilities and type guards\n * - Migration systems for schema evolution\n * - Geometry and utility types\n *\n * @example\n * ```ts\n * import { createTLSchema, defaultShapeSchemas, TLStore } from '@tldraw/tlschema'\n *\n * // Create a schema with default shapes\n * const schema = createTLSchema({\n * shapes: defaultShapeSchemas\n * })\n *\n * // Use with a store\n * const store = new Store({ schema })\n * ```\n *\n * @public\n */\n\nimport { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport {\n\tbookmarkAssetMigrations,\n\tbookmarkAssetProps,\n\ttype TLBookmarkAsset,\n} from './assets/TLBookmarkAsset'\nexport { imageAssetMigrations, imageAssetProps, type TLImageAsset } from './assets/TLImageAsset'\nexport { videoAssetMigrations, videoAssetProps, type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype CreatePresenceStateDerivationOpts,\n\ttype TLPresenceStateInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultAssetSchemas,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n\ttype UserSchemaInfo,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tcreateAssetPropsMigrationIds,\n\tcreateAssetPropsMigrationSequence,\n\tcreateAssetRecordType,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n\ttype TLDefaultAsset,\n\ttype TLGlobalAssetPropsMap,\n\ttype TLIndexedAssets,\n\ttype TLUnknownAsset,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLGlobalBindingPropsMap,\n\ttype TLIndexedBindings,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tcreateCustomRecordId,\n\tcreateCustomRecordMigrationIds,\n\tcreateCustomRecordMigrationSequence,\n\tisCustomRecord,\n\tisCustomRecordId,\n\ttype CustomRecordInfo,\n} from './records/TLCustomRecord'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport {\n\ttype TLCustomRecord,\n\ttype TLDefaultRecord,\n\ttype TLGlobalRecordPropsMap,\n\ttype TLIndexedRecords,\n\ttype TLRecord,\n} from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype ExtractShapeByProps,\n\ttype TLCreateShapePartial,\n\ttype TLDefaultShape,\n\ttype TLGlobalShapePropsMap,\n\ttype TLIndexedShapes,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\tcreateUserId,\n\tcreateUserRecordType,\n\tisUserId,\n\tuserIdValidator,\n\tUserRecordType,\n\ttype TLUser,\n\ttype TLUserId,\n} from './records/TLUser'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tcompressLegacySegments,\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tregisterColorsFromThemes,\n\ttype TLDefaultColorStyle,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport { type TLFontFace, type TLFontFaceSource } from './styles/TLFontFace'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\tisFontEntry,\n\tregisterFontsFromThemes,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\ttype TLDefaultColor,\n\ttype TLRemovedDefaultThemeColors,\n\ttype TLTheme,\n\ttype TLThemeColors,\n\ttype TLThemeDefaultColors,\n\ttype TLThemeFont,\n\ttype TLThemeFonts,\n\ttype TLThemeId,\n\ttype TLThemes,\n\ttype TLThemeUiColorKeys,\n} from './styles/TLTheme'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tcreateCachedUserResolve,\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n\ttype TLUserStore,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { DIM_2D, DIM_3D, b64Vecs } from './misc/b64Vecs'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCA,mBAA6C;AAC7C,yBAAyE;AACzE,6BAIO;AACP,0BAAyE;AACzE,0BAAyE;AACzE,4BAOO;AACP,2BAIO;AACP,2CAKO;AACP,4BAQO;AACP,4BAKO;AACP,0BAA4B;AAC5B,qBAIO;AACP,sBAAkE;AAClE,sBAAkE;AAClE,uBAAqD;AACrD,wBAA+D;AAC/D,wBAAuE;AACvE,qBAcO;AACP,uBAeO;AACP,sBAAiE;AACjE,4BAOO;AACP,wBAKO;AACP,wBAKO;AACP,oBAMO;AACP,yBAIO;AACP,uBAKO;AACP,wBAIO;AAQP,qBAkBO;AACP,oBAQO;AAQP,0BAWO;AACP,yBAKO;AACP,6BAKO;AACP,yBAOO;AACP,0BAKO;AACP,0BAKO;AACP,wBAOO;AACP,0BAKO;AACP,8BAKO;AACP,0BAMO;AACP,yBAQO;AACP,yBAKO;AACP,yBAKO;AACP,0BAKO;AACP,uBAA8D;AAC9D,0BAIO;AACP,yBAA0D;AAC1D,yBAA0D;AAE1D,yBAMO;AACP,oCAGO;AACP,yBAA0D;AAC1D,8BAAoE;AAapE,kCAGO;AACP,qBAUO;AACP,0BAIO;AASP,qBAAwC;AAAA,IANxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview\n * Main entry point for the tldraw schema package. Exports the complete type system,\n * data structures, validation, and migrations for tldraw's persisted data.\n *\n * This package provides:\n * - Schema creation utilities (createTLSchema, defaultShapeSchemas, defaultBindingSchemas)\n * - All built-in shape types (TLGeoShape, TLTextShape, TLArrowShape, etc.)\n * - Asset management types and validators (TLImageAsset, TLVideoAsset, TLBookmarkAsset)\n * - Binding system for shape relationships (TLArrowBinding)\n * - Store integration types (TLStore, TLStoreProps, TLStoreSnapshot)\n * - Style properties for consistent styling (DefaultColorStyle, DefaultSizeStyle, etc.)\n * - Validation utilities and type guards\n * - Migration systems for schema evolution\n * - Geometry and utility types\n *\n * @example\n * ```ts\n * import { createTLSchema, defaultShapeSchemas, TLStore } from '@tldraw/tlschema'\n *\n * // Create a schema with default shapes\n * const schema = createTLSchema({\n * shapes: defaultShapeSchemas\n * })\n *\n * // Use with a store\n * const store = new Store({ schema })\n * ```\n *\n * @public\n */\n\nimport { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport {\n\tbookmarkAssetMigrations,\n\tbookmarkAssetProps,\n\ttype TLBookmarkAsset,\n} from './assets/TLBookmarkAsset'\nexport { imageAssetMigrations, imageAssetProps, type TLImageAsset } from './assets/TLImageAsset'\nexport { videoAssetMigrations, videoAssetProps, type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype CreatePresenceStateDerivationOpts,\n\ttype TLPresenceStateInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultAssetSchemas,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n\ttype UserSchemaInfo,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tcreateAssetPropsMigrationIds,\n\tcreateAssetPropsMigrationSequence,\n\tcreateAssetRecordType,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n\ttype TLDefaultAsset,\n\ttype TLGlobalAssetPropsMap,\n\ttype TLIndexedAssets,\n\ttype TLUnknownAsset,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLGlobalBindingPropsMap,\n\ttype TLIndexedBindings,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tcommentReactionRecordConfig,\n\tcommentRecordConfig,\n\tcommentSchemaRecords,\n\tcommentThreadRecordConfig,\n\tcreateComment,\n\tcreateCommentId,\n\tcreateCommentReaction,\n\tcreateCommentReactionId,\n\tcreateCommentThread,\n\tcreateCommentThreadId,\n\tisCommentId,\n\tisCommentReactionId,\n\tisCommentThreadId,\n\ttype TLComment,\n\ttype TLCommentAnchor,\n\ttype TLCommentId,\n\ttype TLCommentReaction,\n\ttype TLCommentReactionId,\n\ttype TLCommentThread,\n\ttype TLCommentThreadId,\n} from './records/TLComment'\nexport {\n\tcreateCustomRecordId,\n\tcreateCustomRecordMigrationIds,\n\tcreateCustomRecordMigrationSequence,\n\tisCustomRecord,\n\tisCustomRecordId,\n\ttype CustomRecordInfo,\n} from './records/TLCustomRecord'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport {\n\ttype TLCustomRecord,\n\ttype TLDefaultRecord,\n\ttype TLGlobalRecordPropsMap,\n\ttype TLIndexedRecords,\n\ttype TLRecord,\n} from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype ExtractShapeByProps,\n\ttype TLCreateShapePartial,\n\ttype TLDefaultShape,\n\ttype TLGlobalShapePropsMap,\n\ttype TLIndexedShapes,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\tcreateUserId,\n\tcreateUserRecordType,\n\tisUserId,\n\tuserIdValidator,\n\tUserRecordType,\n\ttype TLUser,\n\ttype TLUserId,\n} from './records/TLUser'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tcompressLegacySegments,\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tregisterColorsFromThemes,\n\ttype TLDefaultColorStyle,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport { type TLFontFace, type TLFontFaceSource } from './styles/TLFontFace'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\tisFontEntry,\n\tregisterFontsFromThemes,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\ttype TLDefaultColor,\n\ttype TLRemovedDefaultThemeColors,\n\ttype TLTheme,\n\ttype TLThemeColors,\n\ttype TLThemeDefaultColors,\n\ttype TLThemeFont,\n\ttype TLThemeFonts,\n\ttype TLThemeId,\n\ttype TLThemes,\n\ttype TLThemeUiColorKeys,\n} from './styles/TLTheme'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tcreateCachedUserResolve,\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n\ttype TLUserStore,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { DIM_2D, DIM_3D, b64Vecs } from './misc/b64Vecs'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCA,mBAA6C;AAC7C,yBAAyE;AACzE,6BAIO;AACP,0BAAyE;AACzE,0BAAyE;AACzE,4BAOO;AACP,2BAIO;AACP,2CAKO;AACP,4BAQO;AACP,4BAKO;AACP,0BAA4B;AAC5B,qBAIO;AACP,sBAAkE;AAClE,sBAAkE;AAClE,uBAAqD;AACrD,wBAA+D;AAC/D,wBAAuE;AACvE,qBAcO;AACP,uBAeO;AACP,sBAAiE;AACjE,uBAqBO;AACP,4BAOO;AACP,wBAKO;AACP,wBAKO;AACP,oBAMO;AACP,yBAIO;AACP,uBAKO;AACP,wBAIO;AAQP,qBAkBO;AACP,oBAQO;AAQP,0BAWO;AACP,yBAKO;AACP,6BAKO;AACP,yBAOO;AACP,0BAKO;AACP,0BAKO;AACP,wBAOO;AACP,0BAKO;AACP,8BAKO;AACP,0BAMO;AACP,yBAQO;AACP,yBAKO;AACP,yBAKO;AACP,0BAKO;AACP,uBAA8D;AAC9D,0BAIO;AACP,yBAA0D;AAC1D,yBAA0D;AAE1D,yBAMO;AACP,oCAGO;AACP,yBAA0D;AAC1D,8BAAoE;AAapE,kCAGO;AACP,qBAUO;AACP,0BAIO;AASP,qBAAwC;AAAA,IANxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/TLCursor.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * All available cursor types used throughout the tldraw editor.\n *\n * These cursor types correspond to CSS cursor values and are used to indicate\n * different interaction modes and states within the editor. The cursor types\n * cover selection, resizing, rotation, text editing, and various other editor\n * interactions.\n *\n * @example\n * ```ts\n * // Check if a cursor type is valid\n * if (TL_CURSOR_TYPES.has('resize-corner')) {\n * console.log('Valid cursor type')\n * }\n *\n * // Get all available cursor types\n * const allCursors = Array.from(TL_CURSOR_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_CURSOR_TYPES = new Set([\n\t'none',\n\t'default',\n\t'pointer',\n\t'cross',\n\t'grab',\n\t'rotate',\n\t'grabbing',\n\t'resize-edge',\n\t'resize-corner',\n\t'text',\n\t'move',\n\t'ew-resize',\n\t'ns-resize',\n\t'nesw-resize',\n\t'nwse-resize',\n\t'nesw-rotate',\n\t'nwse-rotate',\n\t'swne-rotate',\n\t'senw-rotate',\n\t'zoom-in',\n\t'zoom-out',\n])\n\n/**\n * A union type representing all available cursor types in the tldraw editor.\n *\n * Each cursor type corresponds to a different interaction mode or state,\n * helping users understand what action they can perform at any given moment.\n *\n * @example\n * ```ts\n * const defaultCursor: TLCursorType = 'default'\n * const textCursor: TLCursorType = 'text'\n * const resizeCursor: TLCursorType = 'resize-corner'\n * const rotateCursor: TLCursorType = 'nesw-rotate'\n * ```\n *\n * @public\n */\nexport type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>\n\n/**\n * A validator for cursor types.\n *\n * This validator ensures that cursor type values are one of the valid types\n * defined in {@link TL_CURSOR_TYPES}. It provides runtime type checking for\n * cursor properties throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorTypeValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor type\n * try {\n * const validCursor = cursorTypeValidator.validate('pointer')\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES)\n\n/**\n * A cursor object used throughout the tldraw editor.\n *\n * Represents both the cursor type (which determines the visual appearance)\n * and its rotation angle. The rotation is particularly useful for resize\n * and rotation cursors that need to align with the current interaction angle.\n *\n * @example\n * ```ts\n * // Default cursor\n * const defaultCursor: TLCursor = {\n * type: 'default',\n * rotation: 0\n * }\n *\n * // Rotated resize cursor\n * const rotatedResizeCursor: TLCursor = {\n * type: 'resize-corner',\n * rotation: Math.PI / 4 // 45 degrees\n * }\n *\n * // Text editing cursor\n * const textCursor: TLCursor = {\n * type: 'text',\n * rotation: 0\n * }\n * ```\n *\n * @public\n */\nexport interface TLCursor {\n\t/** The cursor type, determining the visual appearance and interaction mode */\n\ttype: TLCursorType\n\t/** The rotation angle in radians, used for rotated cursors like resize handles */\n\trotation: number\n}\n\n/**\n * A validator for TLCursor objects.\n *\n * This validator ensures that cursor objects have valid cursor types and\n * numeric rotation values. It provides runtime validation for cursor\n * properties used throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor object\n * try {\n * const validCursor = cursorValidator.validate({\n * type: 'pointer',\n * rotation: 0.5\n * })\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorValidator: T.ObjectValidator<TLCursor> = T.object<TLCursor>({\n\ttype: cursorTypeValidator,\n\trotation: T.number,\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAwBX,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AA0CM,MAAM,sBAAsB,kBAAE,QAAQ,eAAe;AAgErD,MAAM,kBAA+C,kBAAE,OAAiB;AAAA,EAC9E,MAAM;AAAA,EACN,UAAU,kBAAE;AACb,CAAC;",
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\n\n/**\n * All available cursor types used throughout the tldraw editor.\n *\n * These cursor types correspond to CSS cursor values and are used to indicate\n * different interaction modes and states within the editor. The cursor types\n * cover selection, resizing, rotation, text editing, and various other editor\n * interactions.\n *\n * @example\n * ```ts\n * // Check if a cursor type is valid\n * if (TL_CURSOR_TYPES.has('resize-corner')) {\n * console.log('Valid cursor type')\n * }\n *\n * // Get all available cursor types\n * const allCursors = Array.from(TL_CURSOR_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_CURSOR_TYPES = new Set([\n\t'none',\n\t'default',\n\t'pointer',\n\t'cross',\n\t'comment',\n\t'grab',\n\t'rotate',\n\t'grabbing',\n\t'resize-edge',\n\t'resize-corner',\n\t'text',\n\t'move',\n\t'ew-resize',\n\t'ns-resize',\n\t'nesw-resize',\n\t'nwse-resize',\n\t'nesw-rotate',\n\t'nwse-rotate',\n\t'swne-rotate',\n\t'senw-rotate',\n\t'zoom-in',\n\t'zoom-out',\n])\n\n/**\n * A union type representing all available cursor types in the tldraw editor.\n *\n * Each cursor type corresponds to a different interaction mode or state,\n * helping users understand what action they can perform at any given moment.\n *\n * @example\n * ```ts\n * const defaultCursor: TLCursorType = 'default'\n * const textCursor: TLCursorType = 'text'\n * const resizeCursor: TLCursorType = 'resize-corner'\n * const rotateCursor: TLCursorType = 'nesw-rotate'\n * ```\n *\n * @public\n */\nexport type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>\n\n/**\n * A validator for cursor types.\n *\n * This validator ensures that cursor type values are one of the valid types\n * defined in {@link TL_CURSOR_TYPES}. It provides runtime type checking for\n * cursor properties throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorTypeValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor type\n * try {\n * const validCursor = cursorTypeValidator.validate('pointer')\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorTypeValidator = T.setEnum(TL_CURSOR_TYPES)\n\n/**\n * A cursor object used throughout the tldraw editor.\n *\n * Represents both the cursor type (which determines the visual appearance)\n * and its rotation angle. The rotation is particularly useful for resize\n * and rotation cursors that need to align with the current interaction angle.\n *\n * @example\n * ```ts\n * // Default cursor\n * const defaultCursor: TLCursor = {\n * type: 'default',\n * rotation: 0\n * }\n *\n * // Rotated resize cursor\n * const rotatedResizeCursor: TLCursor = {\n * type: 'resize-corner',\n * rotation: Math.PI / 4 // 45 degrees\n * }\n *\n * // Text editing cursor\n * const textCursor: TLCursor = {\n * type: 'text',\n * rotation: 0\n * }\n * ```\n *\n * @public\n */\nexport interface TLCursor {\n\t/** The cursor type, determining the visual appearance and interaction mode */\n\ttype: TLCursorType\n\t/** The rotation angle in radians, used for rotated cursors like resize handles */\n\trotation: number\n}\n\n/**\n * A validator for TLCursor objects.\n *\n * This validator ensures that cursor objects have valid cursor types and\n * numeric rotation values. It provides runtime validation for cursor\n * properties used throughout the editor.\n *\n * @example\n * ```ts\n * import { cursorValidator } from '@tldraw/tlschema'\n *\n * // Validate a cursor object\n * try {\n * const validCursor = cursorValidator.validate({\n * type: 'pointer',\n * rotation: 0.5\n * })\n * console.log('Valid cursor:', validCursor)\n * } catch (error) {\n * console.error('Invalid cursor:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const cursorValidator: T.ObjectValidator<TLCursor> = T.object<TLCursor>({\n\ttype: cursorTypeValidator,\n\trotation: T.number,\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAwBX,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AA0CM,MAAM,sBAAsB,kBAAE,QAAQ,eAAe;AAgErD,MAAM,kBAA+C,kBAAE,OAAiB;AAAA,EAC9E,MAAM;AAAA,EACN,UAAU,kBAAE;AACb,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|