@tldraw/tlschema 4.2.2 → 4.2.3
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/bindings/TLBaseBinding.js.map +2 -2
- package/dist-cjs/createTLSchema.js.map +2 -2
- package/dist-cjs/index.d.ts +71 -242
- package/dist-cjs/index.js +1 -4
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/misc/TLOpacity.js +5 -1
- package/dist-cjs/misc/TLOpacity.js.map +2 -2
- package/dist-cjs/misc/TLRichText.js +1 -5
- package/dist-cjs/misc/TLRichText.js.map +2 -2
- package/dist-cjs/records/TLAsset.js.map +1 -1
- package/dist-cjs/records/TLBinding.js.map +2 -2
- package/dist-cjs/records/TLShape.js.map +2 -2
- package/dist-cjs/shapes/ShapeWithCrop.js.map +1 -1
- package/dist-cjs/shapes/TLArrowShape.js +13 -26
- package/dist-cjs/shapes/TLArrowShape.js.map +2 -2
- package/dist-cjs/shapes/TLBaseShape.js.map +2 -2
- package/dist-cjs/shapes/TLDrawShape.js +4 -37
- package/dist-cjs/shapes/TLDrawShape.js.map +2 -2
- package/dist-cjs/shapes/TLEmbedShape.js +0 -17
- package/dist-cjs/shapes/TLEmbedShape.js.map +2 -2
- package/dist-cjs/shapes/TLGeoShape.js +1 -12
- package/dist-cjs/shapes/TLGeoShape.js.map +2 -2
- package/dist-cjs/shapes/TLHighlightShape.js +2 -29
- package/dist-cjs/shapes/TLHighlightShape.js.map +2 -2
- package/dist-cjs/shapes/TLNoteShape.js +1 -12
- package/dist-cjs/shapes/TLNoteShape.js.map +2 -2
- package/dist-cjs/shapes/TLTextShape.js +1 -12
- package/dist-cjs/shapes/TLTextShape.js.map +2 -2
- package/dist-cjs/store-migrations.js +15 -15
- package/dist-cjs/store-migrations.js.map +2 -2
- package/dist-esm/bindings/TLBaseBinding.mjs.map +2 -2
- package/dist-esm/createTLSchema.mjs.map +2 -2
- package/dist-esm/index.d.mts +71 -242
- package/dist-esm/index.mjs +1 -5
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/misc/TLOpacity.mjs +5 -1
- package/dist-esm/misc/TLOpacity.mjs.map +2 -2
- package/dist-esm/misc/TLRichText.mjs +1 -5
- package/dist-esm/misc/TLRichText.mjs.map +2 -2
- package/dist-esm/records/TLAsset.mjs.map +1 -1
- package/dist-esm/records/TLBinding.mjs.map +2 -2
- package/dist-esm/records/TLShape.mjs.map +2 -2
- package/dist-esm/shapes/TLArrowShape.mjs +13 -26
- package/dist-esm/shapes/TLArrowShape.mjs.map +2 -2
- package/dist-esm/shapes/TLBaseShape.mjs.map +2 -2
- package/dist-esm/shapes/TLDrawShape.mjs +4 -37
- package/dist-esm/shapes/TLDrawShape.mjs.map +2 -2
- package/dist-esm/shapes/TLEmbedShape.mjs +0 -17
- package/dist-esm/shapes/TLEmbedShape.mjs.map +2 -2
- package/dist-esm/shapes/TLGeoShape.mjs +1 -12
- package/dist-esm/shapes/TLGeoShape.mjs.map +2 -2
- package/dist-esm/shapes/TLHighlightShape.mjs +2 -29
- package/dist-esm/shapes/TLHighlightShape.mjs.map +2 -2
- package/dist-esm/shapes/TLNoteShape.mjs +1 -12
- package/dist-esm/shapes/TLNoteShape.mjs.map +2 -2
- package/dist-esm/shapes/TLTextShape.mjs +1 -12
- package/dist-esm/shapes/TLTextShape.mjs.map +2 -2
- package/dist-esm/store-migrations.mjs +15 -15
- package/dist-esm/store-migrations.mjs.map +2 -2
- package/package.json +8 -8
- package/src/__tests__/migrationTestUtils.ts +3 -9
- package/src/assets/TLBookmarkAsset.test.ts +96 -0
- package/src/assets/TLImageAsset.test.ts +213 -0
- package/src/assets/TLVideoAsset.test.ts +105 -0
- package/src/bindings/TLArrowBinding.test.ts +55 -0
- package/src/bindings/TLBaseBinding.ts +14 -25
- package/src/createTLSchema.ts +2 -8
- package/src/index.ts +0 -9
- package/src/migrations.test.ts +1 -149
- package/src/misc/TLOpacity.ts +5 -1
- package/src/misc/TLRichText.ts +1 -6
- package/src/misc/id-validator.test.ts +50 -0
- package/src/records/TLAsset.test.ts +234 -0
- package/src/records/TLAsset.ts +2 -2
- package/src/records/TLBinding.test.ts +22 -0
- package/src/records/TLBinding.ts +23 -65
- package/src/records/TLCamera.test.ts +19 -0
- package/src/records/TLDocument.test.ts +35 -0
- package/src/records/TLInstance.test.ts +201 -0
- package/src/records/TLPage.test.ts +110 -0
- package/src/records/TLPageState.test.ts +228 -0
- package/src/records/TLPointer.test.ts +63 -0
- package/src/records/TLPresence.test.ts +190 -0
- package/src/records/TLRecord.test.ts +70 -0
- package/src/records/TLShape.test.ts +232 -0
- package/src/records/TLShape.ts +5 -100
- package/src/shapes/ShapeWithCrop.test.ts +18 -0
- package/src/shapes/ShapeWithCrop.ts +2 -2
- package/src/shapes/TLArrowShape.test.ts +505 -0
- package/src/shapes/TLArrowShape.ts +14 -28
- package/src/shapes/TLBaseShape.test.ts +142 -0
- package/src/shapes/TLBaseShape.ts +10 -34
- package/src/shapes/TLBookmarkShape.test.ts +122 -0
- package/src/shapes/TLDrawShape.test.ts +177 -0
- package/src/shapes/TLDrawShape.ts +12 -59
- package/src/shapes/TLEmbedShape.test.ts +286 -0
- package/src/shapes/TLEmbedShape.ts +0 -17
- package/src/shapes/TLFrameShape.test.ts +71 -0
- package/src/shapes/TLGeoShape.test.ts +247 -0
- package/src/shapes/TLGeoShape.ts +1 -14
- package/src/shapes/TLGroupShape.test.ts +59 -0
- package/src/shapes/TLHighlightShape.test.ts +325 -0
- package/src/shapes/TLHighlightShape.ts +0 -37
- package/src/shapes/TLImageShape.test.ts +534 -0
- package/src/shapes/TLLineShape.test.ts +269 -0
- package/src/shapes/TLNoteShape.test.ts +1568 -0
- package/src/shapes/TLNoteShape.ts +1 -15
- package/src/shapes/TLTextShape.test.ts +407 -0
- package/src/shapes/TLTextShape.ts +2 -16
- package/src/shapes/TLVideoShape.test.ts +112 -0
- package/src/store-migrations.ts +16 -17
- package/src/styles/TLColorStyle.test.ts +439 -0
- package/dist-cjs/misc/b64Vecs.js +0 -224
- package/dist-cjs/misc/b64Vecs.js.map +0 -7
- package/dist-esm/misc/b64Vecs.mjs +0 -204
- package/dist-esm/misc/b64Vecs.mjs.map +0 -7
- package/src/misc/b64Vecs.ts +0 -308
package/dist-cjs/index.d.ts
CHANGED
|
@@ -210,7 +210,6 @@ export declare const arrowShapeVersions: {
|
|
|
210
210
|
readonly AddLabelColor: "com.tldraw.shape.arrow/1";
|
|
211
211
|
readonly AddLabelPosition: "com.tldraw.shape.arrow/3";
|
|
212
212
|
readonly AddRichText: "com.tldraw.shape.arrow/7";
|
|
213
|
-
readonly AddRichTextAttrs: "com.tldraw.shape.arrow/8";
|
|
214
213
|
readonly AddScale: "com.tldraw.shape.arrow/5";
|
|
215
214
|
readonly ExtractBindings: "com.tldraw.shape.arrow/4";
|
|
216
215
|
};
|
|
@@ -300,59 +299,6 @@ export declare const AssetRecordType: RecordType<TLAsset, "props" | "type">;
|
|
|
300
299
|
*/
|
|
301
300
|
export declare const assetValidator: T.Validator<TLAsset>;
|
|
302
301
|
|
|
303
|
-
/**
|
|
304
|
-
* Utilities for encoding and decoding points using base64 and Float16 encoding.
|
|
305
|
-
* Provides functions for converting between VecModel arrays and compact base64 strings,
|
|
306
|
-
* as well as individual point encoding/decoding operations.
|
|
307
|
-
*
|
|
308
|
-
* @public
|
|
309
|
-
*/
|
|
310
|
-
export declare class b64Vecs {
|
|
311
|
-
/**
|
|
312
|
-
* Encode a single point (x, y, z) to 8 base64 characters.
|
|
313
|
-
* Each coordinate is encoded as a Float16 value, resulting in 6 bytes total.
|
|
314
|
-
*
|
|
315
|
-
* @param x - The x coordinate
|
|
316
|
-
* @param y - The y coordinate
|
|
317
|
-
* @param z - The z coordinate
|
|
318
|
-
* @returns An 8-character base64 string representing the point
|
|
319
|
-
*/
|
|
320
|
-
static encodePoint(x: number, y: number, z: number): string;
|
|
321
|
-
/**
|
|
322
|
-
* Convert an array of VecModels to a base64 string for compact storage.
|
|
323
|
-
* Uses Float16 encoding for each coordinate (x, y, z). If a point's z value is
|
|
324
|
-
* undefined, it defaults to 0.5.
|
|
325
|
-
*
|
|
326
|
-
* @param points - An array of VecModel objects to encode
|
|
327
|
-
* @returns A base64-encoded string containing all points
|
|
328
|
-
*/
|
|
329
|
-
static encodePoints(points: VecModel[]): string;
|
|
330
|
-
/**
|
|
331
|
-
* Convert a base64 string back to an array of VecModels.
|
|
332
|
-
* Decodes Float16-encoded coordinates (x, y, z) from the base64 string.
|
|
333
|
-
*
|
|
334
|
-
* @param base64 - The base64-encoded string containing point data
|
|
335
|
-
* @returns An array of VecModel objects decoded from the string
|
|
336
|
-
*/
|
|
337
|
-
static decodePoints(base64: string): VecModel[];
|
|
338
|
-
/* Excluded from this release type: decodePointAt */
|
|
339
|
-
/**
|
|
340
|
-
* Get the first point from a base64-encoded string of points.
|
|
341
|
-
*
|
|
342
|
-
* @param b64Points - The base64-encoded string containing point data
|
|
343
|
-
* @returns The first point as a VecModel, or null if the string is too short
|
|
344
|
-
* @public
|
|
345
|
-
*/
|
|
346
|
-
static decodeFirstPoint(b64Points: string): null | VecModel;
|
|
347
|
-
/**
|
|
348
|
-
* Get the last point from a base64-encoded string of points.
|
|
349
|
-
*
|
|
350
|
-
* @param b64Points - The base64-encoded string containing point data
|
|
351
|
-
* @returns The last point as a VecModel, or null if the string is too short
|
|
352
|
-
*/
|
|
353
|
-
static decodeLastPoint(b64Points: string): null | VecModel;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
302
|
/**
|
|
357
303
|
* Validator for binding IDs. Ensures that binding identifiers follow the correct
|
|
358
304
|
* format and type constraints required by the tldraw schema system.
|
|
@@ -480,17 +426,6 @@ export declare const CameraRecordType: RecordType<TLCamera, never>;
|
|
|
480
426
|
*/
|
|
481
427
|
export declare const canvasUiColorTypeValidator: T.Validator<"accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white">;
|
|
482
428
|
|
|
483
|
-
/**
|
|
484
|
-
* Compress legacy draw shape segments by converting VecModel[] points to base64 format.
|
|
485
|
-
* This function is useful for converting old draw shape data to the new compressed format.
|
|
486
|
-
*
|
|
487
|
-
* @public
|
|
488
|
-
*/
|
|
489
|
-
export declare function compressLegacySegments(segments: {
|
|
490
|
-
points: VecModel[];
|
|
491
|
-
type: 'free' | 'straight';
|
|
492
|
-
}[]): TLDrawShapeSegment[];
|
|
493
|
-
|
|
494
429
|
/**
|
|
495
430
|
* Creates a validator for a specific asset record type. This factory function generates
|
|
496
431
|
* a complete validator that validates the entire asset record structure including the
|
|
@@ -1463,7 +1398,22 @@ export declare const DocumentRecordType: RecordType<TLDocument, never>;
|
|
|
1463
1398
|
*/
|
|
1464
1399
|
export declare const drawShapeMigrations: TLPropsMigrations;
|
|
1465
1400
|
|
|
1466
|
-
/**
|
|
1401
|
+
/**
|
|
1402
|
+
* Validation schema for draw shape properties.
|
|
1403
|
+
*
|
|
1404
|
+
* @public
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```ts
|
|
1407
|
+
* // Validate draw shape properties
|
|
1408
|
+
* const props = {
|
|
1409
|
+
* color: 'red',
|
|
1410
|
+
* fill: 'solid',
|
|
1411
|
+
* segments: [{ type: 'free', points: [] }],
|
|
1412
|
+
* isComplete: true
|
|
1413
|
+
* }
|
|
1414
|
+
* const isValid = drawShapeProps.color.isValid(props.color)
|
|
1415
|
+
* ```
|
|
1416
|
+
*/
|
|
1467
1417
|
export declare const drawShapeProps: RecordProps<TLDrawShape>;
|
|
1468
1418
|
|
|
1469
1419
|
/**
|
|
@@ -1528,24 +1478,6 @@ export declare class EnumStyleProp<T> extends StyleProp<T> {
|
|
|
1528
1478
|
/* Excluded from this release type: __constructor */
|
|
1529
1479
|
}
|
|
1530
1480
|
|
|
1531
|
-
/**
|
|
1532
|
-
* Extract a shape type by its props.
|
|
1533
|
-
*
|
|
1534
|
-
* This utility type takes a props object type and returns the corresponding shape type
|
|
1535
|
-
* from the TLShape union whose props match the given type.
|
|
1536
|
-
*
|
|
1537
|
-
* @example
|
|
1538
|
-
* ```ts
|
|
1539
|
-
* type MyShape = ExtractShapeByProps<{ w: number; h: number }>
|
|
1540
|
-
* // MyShape is now the type of shape(s) that have props with w and h as numbers
|
|
1541
|
-
* ```
|
|
1542
|
-
*
|
|
1543
|
-
* @public
|
|
1544
|
-
*/
|
|
1545
|
-
export declare type ExtractShapeByProps<P> = Extract<TLShape, {
|
|
1546
|
-
props: P;
|
|
1547
|
-
}>;
|
|
1548
|
-
|
|
1549
1481
|
/**
|
|
1550
1482
|
* Migration sequence for frame shape properties across different schema versions.
|
|
1551
1483
|
* Handles adding color properties to existing frame shapes.
|
|
@@ -1587,7 +1519,7 @@ export declare const GeoShapeGeoStyle: EnumStyleProp<"arrow-down" | "arrow-left"
|
|
|
1587
1519
|
/**
|
|
1588
1520
|
* Migration sequence for geo shape properties across different schema versions.
|
|
1589
1521
|
* Handles evolution of geo shapes including URL support, label colors, alignment changes,
|
|
1590
|
-
* the transition from plain text to rich text
|
|
1522
|
+
* and the transition from plain text to rich text.
|
|
1591
1523
|
*
|
|
1592
1524
|
* @public
|
|
1593
1525
|
*/
|
|
@@ -1803,7 +1735,20 @@ export declare const groupShapeProps: RecordProps<TLGroupShape>;
|
|
|
1803
1735
|
*/
|
|
1804
1736
|
export declare const highlightShapeMigrations: TLPropsMigrations;
|
|
1805
1737
|
|
|
1806
|
-
/**
|
|
1738
|
+
/**
|
|
1739
|
+
* Validation schema for highlight shape properties. Defines the runtime validation rules
|
|
1740
|
+
* for all properties of highlight shapes.
|
|
1741
|
+
*
|
|
1742
|
+
* @public
|
|
1743
|
+
* @example
|
|
1744
|
+
* ```ts
|
|
1745
|
+
* import { highlightShapeProps } from '@tldraw/tlschema'
|
|
1746
|
+
*
|
|
1747
|
+
* // Used internally by the validation system
|
|
1748
|
+
* const validator = T.object(highlightShapeProps)
|
|
1749
|
+
* const validatedProps = validator.validate(someHighlightProps)
|
|
1750
|
+
* ```
|
|
1751
|
+
*/
|
|
1807
1752
|
export declare const highlightShapeProps: RecordProps<TLHighlightShape>;
|
|
1808
1753
|
|
|
1809
1754
|
/**
|
|
@@ -2252,8 +2197,7 @@ export declare const LineShapeSplineStyle: EnumStyleProp<"cubic" | "line">;
|
|
|
2252
2197
|
* Migration sequence for note shapes. Handles schema evolution over time by defining
|
|
2253
2198
|
* how to upgrade and downgrade note shape data between different versions. Includes
|
|
2254
2199
|
* migrations for URL properties, text alignment changes, vertical alignment addition,
|
|
2255
|
-
* font size adjustments, scaling support, label color, the transition from plain text to rich text
|
|
2256
|
-
* and support for attrs property on richText.
|
|
2200
|
+
* font size adjustments, scaling support, label color, and the transition from plain text to rich text.
|
|
2257
2201
|
*
|
|
2258
2202
|
* @public
|
|
2259
2203
|
*/
|
|
@@ -2450,7 +2394,6 @@ export declare type RecordPropsType<Config extends Record<string, T.Validatable<
|
|
|
2450
2394
|
* ```
|
|
2451
2395
|
*/
|
|
2452
2396
|
export declare const richTextValidator: T.ObjectValidator<{
|
|
2453
|
-
attrs?: any;
|
|
2454
2397
|
content: unknown[];
|
|
2455
2398
|
type: string;
|
|
2456
2399
|
}>;
|
|
@@ -2656,7 +2599,7 @@ export declare const shapeIdValidator: T.Validator<TLShapeId>;
|
|
|
2656
2599
|
*
|
|
2657
2600
|
* @public
|
|
2658
2601
|
*/
|
|
2659
|
-
export declare type ShapeWithCrop =
|
|
2602
|
+
export declare type ShapeWithCrop = TLBaseShape<string, {
|
|
2660
2603
|
crop: null | TLShapeCrop;
|
|
2661
2604
|
h: number;
|
|
2662
2605
|
w: number;
|
|
@@ -2756,7 +2699,6 @@ export declare type StylePropValue<T extends StyleProp<any>> = T extends StylePr
|
|
|
2756
2699
|
* - RemoveJustify: Replaced 'justify' alignment with 'start'
|
|
2757
2700
|
* - AddTextAlign: Migrated from 'align' to 'textAlign' property
|
|
2758
2701
|
* - AddRichText: Converted plain text to rich text format
|
|
2759
|
-
* - AddRichTextAttrs: Added support for attrs property on richText
|
|
2760
2702
|
*
|
|
2761
2703
|
* @public
|
|
2762
2704
|
*/
|
|
@@ -3198,8 +3140,10 @@ export declare type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T ?
|
|
|
3198
3140
|
*
|
|
3199
3141
|
* @public
|
|
3200
3142
|
*/
|
|
3201
|
-
export declare type TLAssetShape =
|
|
3202
|
-
|
|
3143
|
+
export declare type TLAssetShape = Extract<TLShape, {
|
|
3144
|
+
props: {
|
|
3145
|
+
assetId: TLAssetId;
|
|
3146
|
+
};
|
|
3203
3147
|
}>;
|
|
3204
3148
|
|
|
3205
3149
|
/**
|
|
@@ -3309,41 +3253,33 @@ export declare interface TLBaseAsset<Type extends string, Props> extends BaseRec
|
|
|
3309
3253
|
* Base interface for all binding types in tldraw. Bindings represent relationships
|
|
3310
3254
|
* between shapes, such as arrows connecting to other shapes or organizational connections.
|
|
3311
3255
|
*
|
|
3312
|
-
* All
|
|
3256
|
+
* All bindings extend this base interface with specific type and property definitions.
|
|
3313
3257
|
* The binding system enables shapes to maintain relationships that persist through
|
|
3314
3258
|
* transformations, movements, and other operations.
|
|
3315
3259
|
*
|
|
3316
|
-
* Custom bindings should be defined by augmenting the TLGlobalBindingPropsMap type and getting the binding type from the TLBinding type.
|
|
3317
|
-
*
|
|
3318
3260
|
* @param Type - String literal type identifying the specific binding type (e.g., 'arrow')
|
|
3319
3261
|
* @param Props - Object containing binding-specific properties and configuration
|
|
3320
3262
|
*
|
|
3321
3263
|
* @example
|
|
3322
3264
|
* ```ts
|
|
3323
|
-
* // Define a
|
|
3324
|
-
* interface
|
|
3265
|
+
* // Define a custom binding type
|
|
3266
|
+
* interface MyCustomBinding extends TLBaseBinding<'custom', MyCustomProps> {}
|
|
3325
3267
|
*
|
|
3326
|
-
* interface
|
|
3327
|
-
*
|
|
3328
|
-
*
|
|
3329
|
-
* isExact: boolean
|
|
3330
|
-
* isPrecise: boolean
|
|
3331
|
-
* snap: ElbowArrowSnap
|
|
3268
|
+
* interface MyCustomProps {
|
|
3269
|
+
* strength: number
|
|
3270
|
+
* color: string
|
|
3332
3271
|
* }
|
|
3333
3272
|
*
|
|
3334
3273
|
* // Create a binding instance
|
|
3335
|
-
* const
|
|
3274
|
+
* const binding: MyCustomBinding = {
|
|
3336
3275
|
* id: 'binding:abc123',
|
|
3337
3276
|
* typeName: 'binding',
|
|
3338
|
-
* type: '
|
|
3277
|
+
* type: 'custom',
|
|
3339
3278
|
* fromId: 'shape:source1',
|
|
3340
3279
|
* toId: 'shape:target1',
|
|
3341
3280
|
* props: {
|
|
3342
|
-
*
|
|
3343
|
-
*
|
|
3344
|
-
* isExact: false,
|
|
3345
|
-
* isPrecise: true,
|
|
3346
|
-
* snap: 'edge'
|
|
3281
|
+
* strength: 0.8,
|
|
3282
|
+
* color: 'red'
|
|
3347
3283
|
* },
|
|
3348
3284
|
* meta: {}
|
|
3349
3285
|
* }
|
|
@@ -3351,9 +3287,7 @@ export declare interface TLBaseAsset<Type extends string, Props> extends BaseRec
|
|
|
3351
3287
|
*
|
|
3352
3288
|
* @public
|
|
3353
3289
|
*/
|
|
3354
|
-
export declare interface TLBaseBinding<Type extends string, Props extends object> {
|
|
3355
|
-
readonly id: TLBindingId;
|
|
3356
|
-
readonly typeName: 'binding';
|
|
3290
|
+
export declare interface TLBaseBinding<Type extends string, Props extends object> extends BaseRecord<'binding', TLBindingId> {
|
|
3357
3291
|
/** The specific type of this binding (e.g., 'arrow', 'custom') */
|
|
3358
3292
|
type: Type;
|
|
3359
3293
|
/** ID of the source shape in this binding relationship */
|
|
@@ -3370,37 +3304,18 @@ export declare interface TLBaseBinding<Type extends string, Props extends object
|
|
|
3370
3304
|
* Base interface for all shapes in tldraw.
|
|
3371
3305
|
*
|
|
3372
3306
|
* This interface defines the common properties that all shapes share, regardless of their
|
|
3373
|
-
* specific type. Every
|
|
3374
|
-
*
|
|
3375
|
-
*
|
|
3376
|
-
*
|
|
3377
|
-
*
|
|
3378
|
-
*
|
|
3379
|
-
* // Define a default shape type
|
|
3380
|
-
* interface TLArrowShape extends TLBaseShape<'arrow', {
|
|
3381
|
-
* kind: TLArrowShapeKind
|
|
3382
|
-
* labelColor: TLDefaultColorStyle
|
|
3383
|
-
* color: TLDefaultColorStyle
|
|
3384
|
-
* fill: TLDefaultFillStyle
|
|
3385
|
-
* dash: TLDefaultDashStyle
|
|
3386
|
-
* size: TLDefaultSizeStyle
|
|
3387
|
-
* arrowheadStart: TLArrowShapeArrowheadStyle
|
|
3388
|
-
* arrowheadEnd: TLArrowShapeArrowheadStyle
|
|
3389
|
-
* font: TLDefaultFontStyle
|
|
3390
|
-
* start: VecModel
|
|
3391
|
-
* end: VecModel
|
|
3392
|
-
* bend: number
|
|
3393
|
-
* richText: TLRichText
|
|
3394
|
-
* labelPosition: number
|
|
3395
|
-
* scale: number
|
|
3396
|
-
* elbowMidPoint: number
|
|
3397
|
-
* }> {}
|
|
3307
|
+
* specific type. Every shape extends this base with additional type-specific properties.
|
|
3308
|
+
*
|
|
3309
|
+
* @example
|
|
3310
|
+
* ```ts
|
|
3311
|
+
* // Define a custom shape type
|
|
3312
|
+
* interface MyCustomShape extends TLBaseShape<'custom', { size: number; color: string }> {}
|
|
3398
3313
|
*
|
|
3399
3314
|
* // Create a shape instance
|
|
3400
|
-
* const
|
|
3315
|
+
* const myShape: MyCustomShape = {
|
|
3401
3316
|
* id: 'shape:abc123',
|
|
3402
3317
|
* typeName: 'shape',
|
|
3403
|
-
* type: '
|
|
3318
|
+
* type: 'custom',
|
|
3404
3319
|
* x: 100,
|
|
3405
3320
|
* y: 200,
|
|
3406
3321
|
* rotation: 0,
|
|
@@ -3409,10 +3324,8 @@ export declare interface TLBaseBinding<Type extends string, Props extends object
|
|
|
3409
3324
|
* isLocked: false,
|
|
3410
3325
|
* opacity: 1,
|
|
3411
3326
|
* props: {
|
|
3412
|
-
*
|
|
3413
|
-
*
|
|
3414
|
-
* end: { x: 100, y: 100 },
|
|
3415
|
-
* // ... other props
|
|
3327
|
+
* size: 50,
|
|
3328
|
+
* color: 'blue'
|
|
3416
3329
|
* },
|
|
3417
3330
|
* meta: {}
|
|
3418
3331
|
* }
|
|
@@ -3420,9 +3333,7 @@ export declare interface TLBaseBinding<Type extends string, Props extends object
|
|
|
3420
3333
|
*
|
|
3421
3334
|
* @public
|
|
3422
3335
|
*/
|
|
3423
|
-
export declare interface TLBaseShape<Type extends string, Props extends object> {
|
|
3424
|
-
readonly id: TLShapeId;
|
|
3425
|
-
readonly typeName: 'shape';
|
|
3336
|
+
export declare interface TLBaseShape<Type extends string, Props extends object> extends BaseRecord<'shape', TLShapeId> {
|
|
3426
3337
|
type: Type;
|
|
3427
3338
|
x: number;
|
|
3428
3339
|
y: number;
|
|
@@ -3436,12 +3347,9 @@ export declare interface TLBaseShape<Type extends string, Props extends object>
|
|
|
3436
3347
|
}
|
|
3437
3348
|
|
|
3438
3349
|
/**
|
|
3439
|
-
* The set of all bindings that are available in the editor.
|
|
3350
|
+
* The set of all bindings that are available in the editor, including unknown bindings.
|
|
3440
3351
|
* Bindings represent relationships between shapes, such as arrows connecting to other shapes.
|
|
3441
3352
|
*
|
|
3442
|
-
* You can use this type without a type argument to work with any binding, or pass
|
|
3443
|
-
* a specific binding type string (e.g., `'arrow'`) to narrow down to that specific binding type.
|
|
3444
|
-
*
|
|
3445
3353
|
* @example
|
|
3446
3354
|
* ```ts
|
|
3447
3355
|
* // Check binding type and handle accordingly
|
|
@@ -3455,16 +3363,11 @@ export declare interface TLBaseShape<Type extends string, Props extends object>
|
|
|
3455
3363
|
* break
|
|
3456
3364
|
* }
|
|
3457
3365
|
* }
|
|
3458
|
-
*
|
|
3459
|
-
* // Narrow to a specific binding type by passing the type as a generic argument
|
|
3460
|
-
* function getArrowSourceId(binding: TLBinding<'arrow'>) {
|
|
3461
|
-
* return binding.fromId // TypeScript knows this is a TLArrowBinding
|
|
3462
|
-
* }
|
|
3463
3366
|
* ```
|
|
3464
3367
|
*
|
|
3465
3368
|
* @public
|
|
3466
3369
|
*/
|
|
3467
|
-
export declare type TLBinding
|
|
3370
|
+
export declare type TLBinding = TLDefaultBinding | TLUnknownBinding;
|
|
3468
3371
|
|
|
3469
3372
|
/**
|
|
3470
3373
|
* Type for creating new bindings with required fromId and toId.
|
|
@@ -3490,7 +3393,7 @@ export declare type TLBinding<K extends keyof TLIndexedBindings = keyof TLIndexe
|
|
|
3490
3393
|
*
|
|
3491
3394
|
* @public
|
|
3492
3395
|
*/
|
|
3493
|
-
export declare type TLBindingCreate<T extends TLBinding = TLBinding> =
|
|
3396
|
+
export declare type TLBindingCreate<T extends TLBinding = TLBinding> = Expand<{
|
|
3494
3397
|
fromId: T['fromId'];
|
|
3495
3398
|
id?: TLBindingId;
|
|
3496
3399
|
meta?: Partial<T['meta']>;
|
|
@@ -3498,7 +3401,7 @@ export declare type TLBindingCreate<T extends TLBinding = TLBinding> = T extends
|
|
|
3498
3401
|
toId: T['toId'];
|
|
3499
3402
|
type: T['type'];
|
|
3500
3403
|
typeName?: T['typeName'];
|
|
3501
|
-
}
|
|
3404
|
+
}>;
|
|
3502
3405
|
|
|
3503
3406
|
/**
|
|
3504
3407
|
* Branded string type for binding record identifiers.
|
|
@@ -3523,7 +3426,7 @@ export declare type TLBindingCreate<T extends TLBinding = TLBinding> = T extends
|
|
|
3523
3426
|
*
|
|
3524
3427
|
* @public
|
|
3525
3428
|
*/
|
|
3526
|
-
export declare type TLBindingId = RecordId<
|
|
3429
|
+
export declare type TLBindingId = RecordId<TLUnknownBinding>;
|
|
3527
3430
|
|
|
3528
3431
|
/**
|
|
3529
3432
|
* Type for updating existing bindings with partial properties.
|
|
@@ -3545,7 +3448,7 @@ export declare type TLBindingId = RecordId<TLBinding>;
|
|
|
3545
3448
|
*
|
|
3546
3449
|
* @public
|
|
3547
3450
|
*/
|
|
3548
|
-
export declare type TLBindingUpdate<T extends TLBinding = TLBinding> =
|
|
3451
|
+
export declare type TLBindingUpdate<T extends TLBinding = TLBinding> = Expand<{
|
|
3549
3452
|
fromId?: T['fromId'];
|
|
3550
3453
|
id: TLBindingId;
|
|
3551
3454
|
meta?: Partial<T['meta']>;
|
|
@@ -3553,7 +3456,7 @@ export declare type TLBindingUpdate<T extends TLBinding = TLBinding> = T extends
|
|
|
3553
3456
|
toId?: T['toId'];
|
|
3554
3457
|
type: T['type'];
|
|
3555
3458
|
typeName?: T['typeName'];
|
|
3556
|
-
}
|
|
3459
|
+
}>;
|
|
3557
3460
|
|
|
3558
3461
|
/**
|
|
3559
3462
|
* An asset used for URL bookmarks, used by the TLBookmarkShape.
|
|
@@ -3693,39 +3596,6 @@ export declare type TLCameraId = RecordId<TLCamera>;
|
|
|
3693
3596
|
*/
|
|
3694
3597
|
export declare type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>;
|
|
3695
3598
|
|
|
3696
|
-
/**
|
|
3697
|
-
* A partial version of a shape, useful for creating shapes.
|
|
3698
|
-
*
|
|
3699
|
-
* This type represents a shape where all properties except `type` are optional.
|
|
3700
|
-
* It's commonly used when creating shapes.
|
|
3701
|
-
*
|
|
3702
|
-
* @example
|
|
3703
|
-
* ```ts
|
|
3704
|
-
* // Create a shape
|
|
3705
|
-
* const shapeCreate: TLCreateShapePartial = {
|
|
3706
|
-
* type: 'geo',
|
|
3707
|
-
* x: 100,
|
|
3708
|
-
* y: 200
|
|
3709
|
-
* }
|
|
3710
|
-
*
|
|
3711
|
-
* // Create shape properties
|
|
3712
|
-
* const propsCreate: TLCreateShapePartial<TLGeoShape> = {
|
|
3713
|
-
* type: 'geo',
|
|
3714
|
-
* props: {
|
|
3715
|
-
* w: 150,
|
|
3716
|
-
* h: 100
|
|
3717
|
-
* }
|
|
3718
|
-
* }
|
|
3719
|
-
* ```
|
|
3720
|
-
*
|
|
3721
|
-
* @public
|
|
3722
|
-
*/
|
|
3723
|
-
export declare type TLCreateShapePartial<T extends TLShape = TLShape> = T extends T ? {
|
|
3724
|
-
meta?: Partial<T['meta']>;
|
|
3725
|
-
props?: Partial<T['props']>;
|
|
3726
|
-
type: T['type'];
|
|
3727
|
-
} & Partial<Omit<T, 'meta' | 'props' | 'type'>> : never;
|
|
3728
|
-
|
|
3729
3599
|
/**
|
|
3730
3600
|
* A cursor object used throughout the tldraw editor.
|
|
3731
3601
|
*
|
|
@@ -4201,10 +4071,6 @@ export declare interface TLDrawShapeProps {
|
|
|
4201
4071
|
isPen: boolean;
|
|
4202
4072
|
/** Scale factor applied to the drawing */
|
|
4203
4073
|
scale: number;
|
|
4204
|
-
/** Horizontal scale factor for lazy resize */
|
|
4205
|
-
scaleX: number;
|
|
4206
|
-
/** Vertical scale factor for lazy resize */
|
|
4207
|
-
scaleY: number;
|
|
4208
4074
|
}
|
|
4209
4075
|
|
|
4210
4076
|
/**
|
|
@@ -4215,8 +4081,8 @@ export declare interface TLDrawShapeProps {
|
|
|
4215
4081
|
export declare interface TLDrawShapeSegment {
|
|
4216
4082
|
/** Type of drawing segment - 'free' for freehand curves, 'straight' for line segments */
|
|
4217
4083
|
type: 'free' | 'straight';
|
|
4218
|
-
/**
|
|
4219
|
-
points:
|
|
4084
|
+
/** Array of points defining the segment path with x, y coordinates and pressure (z) */
|
|
4085
|
+
points: VecModel[];
|
|
4220
4086
|
}
|
|
4221
4087
|
|
|
4222
4088
|
/**
|
|
@@ -4394,14 +4260,6 @@ export declare interface TLGeoShapeProps {
|
|
|
4394
4260
|
richText: TLRichText;
|
|
4395
4261
|
}
|
|
4396
4262
|
|
|
4397
|
-
/** @public */
|
|
4398
|
-
export declare interface TLGlobalBindingPropsMap {
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
/** @public */
|
|
4402
|
-
export declare interface TLGlobalShapePropsMap {
|
|
4403
|
-
}
|
|
4404
|
-
|
|
4405
4263
|
/**
|
|
4406
4264
|
* A group shape that acts as a container for organizing multiple shapes into a single logical unit.
|
|
4407
4265
|
* Groups enable users to move, transform, and manage collections of shapes together while maintaining
|
|
@@ -4587,10 +4445,6 @@ export declare interface TLHighlightShapeProps {
|
|
|
4587
4445
|
isPen: boolean;
|
|
4588
4446
|
/** Scale factor applied to the highlight shape for display */
|
|
4589
4447
|
scale: number;
|
|
4590
|
-
/** Horizontal scale factor for lazy resize */
|
|
4591
|
-
scaleX: number;
|
|
4592
|
-
/** Vertical scale factor for lazy resize */
|
|
4593
|
-
scaleY: number;
|
|
4594
4448
|
}
|
|
4595
4449
|
|
|
4596
4450
|
/**
|
|
@@ -4683,22 +4537,6 @@ export declare interface TLImageShapeProps {
|
|
|
4683
4537
|
altText: string;
|
|
4684
4538
|
}
|
|
4685
4539
|
|
|
4686
|
-
/** @public */
|
|
4687
|
-
export declare type TLIndexedBindings = {
|
|
4688
|
-
[K in keyof TLGlobalBindingPropsMap | TLDefaultBinding['type'] as K extends TLDefaultBinding['type'] ? K extends keyof TLGlobalBindingPropsMap ? TLGlobalBindingPropsMap[K] extends null | undefined ? never : K : K : K]: K extends TLDefaultBinding['type'] ? K extends keyof TLGlobalBindingPropsMap ? TLBaseBinding<K, TLGlobalBindingPropsMap[K]> : Extract<TLDefaultBinding, {
|
|
4689
|
-
type: K;
|
|
4690
|
-
}> : TLBaseBinding<K, TLGlobalBindingPropsMap[K & keyof TLGlobalBindingPropsMap]>;
|
|
4691
|
-
};
|
|
4692
|
-
|
|
4693
|
-
/** @public */
|
|
4694
|
-
export declare type TLIndexedShapes = {
|
|
4695
|
-
[K in keyof TLGlobalShapePropsMap | TLDefaultShape['type'] as K extends TLDefaultShape['type'] ? K extends 'group' ? K : K extends keyof TLGlobalShapePropsMap ? TLGlobalShapePropsMap[K] extends null | undefined ? never : K : K : K]: K extends 'group' ? Extract<TLDefaultShape, {
|
|
4696
|
-
type: K;
|
|
4697
|
-
}> : K extends TLDefaultShape['type'] ? K extends keyof TLGlobalShapePropsMap ? TLBaseShape<K, TLGlobalShapePropsMap[K]> : Extract<TLDefaultShape, {
|
|
4698
|
-
type: K;
|
|
4699
|
-
}> : TLBaseShape<K, TLGlobalShapePropsMap[K & keyof TLGlobalShapePropsMap]>;
|
|
4700
|
-
};
|
|
4701
|
-
|
|
4702
4540
|
/**
|
|
4703
4541
|
* State that is particular to a single browser tab. The TLInstance record stores
|
|
4704
4542
|
* all session-specific state including cursor position, selected tools, UI preferences,
|
|
@@ -5534,15 +5372,11 @@ export declare interface TLScribble {
|
|
|
5534
5372
|
export declare type TLSerializedStore = SerializedStore<TLRecord>;
|
|
5535
5373
|
|
|
5536
5374
|
/**
|
|
5537
|
-
* The set of all shapes that are available in the editor.
|
|
5375
|
+
* The set of all shapes that are available in the editor, including unknown shapes.
|
|
5538
5376
|
*
|
|
5539
5377
|
* This is the primary shape type used throughout tldraw. It includes both the
|
|
5540
5378
|
* built-in default shapes and any custom shapes that might be added.
|
|
5541
5379
|
*
|
|
5542
|
-
* You can use this type without a type argument to work with any shape, or pass
|
|
5543
|
-
* a specific shape type string (e.g., `'geo'`, `'arrow'`, `'text'`) to narrow
|
|
5544
|
-
* down to that specific shape type.
|
|
5545
|
-
*
|
|
5546
5380
|
* @example
|
|
5547
5381
|
* ```ts
|
|
5548
5382
|
* // Work with any shape in the editor
|
|
@@ -5553,16 +5387,11 @@ export declare type TLSerializedStore = SerializedStore<TLRecord>;
|
|
|
5553
5387
|
* y: shape.y + deltaY
|
|
5554
5388
|
* }
|
|
5555
5389
|
* }
|
|
5556
|
-
*
|
|
5557
|
-
* // Narrow to a specific shape type by passing the type as a generic argument
|
|
5558
|
-
* function getArrowLabel(shape: TLShape<'arrow'>): string {
|
|
5559
|
-
* return shape.props.text // TypeScript knows this is a TLArrowShape
|
|
5560
|
-
* }
|
|
5561
5390
|
* ```
|
|
5562
5391
|
*
|
|
5563
5392
|
* @public
|
|
5564
5393
|
*/
|
|
5565
|
-
export declare type TLShape
|
|
5394
|
+
export declare type TLShape = TLDefaultShape | TLUnknownShape;
|
|
5566
5395
|
|
|
5567
5396
|
/**
|
|
5568
5397
|
* Defines cropping parameters for shapes that support cropping.
|
|
@@ -5609,7 +5438,7 @@ export declare interface TLShapeCrop {
|
|
|
5609
5438
|
*
|
|
5610
5439
|
* @public
|
|
5611
5440
|
*/
|
|
5612
|
-
export declare type TLShapeId = RecordId<
|
|
5441
|
+
export declare type TLShapeId = RecordId<TLUnknownShape>;
|
|
5613
5442
|
|
|
5614
5443
|
/**
|
|
5615
5444
|
* A partial version of a shape, useful for updates and patches.
|
package/dist-cjs/index.js
CHANGED
|
@@ -62,13 +62,11 @@ __export(index_exports, {
|
|
|
62
62
|
assetIdValidator: () => import_TLBaseAsset.assetIdValidator,
|
|
63
63
|
assetMigrations: () => import_TLAsset.assetMigrations,
|
|
64
64
|
assetValidator: () => import_TLAsset.assetValidator,
|
|
65
|
-
b64Vecs: () => import_b64Vecs.b64Vecs,
|
|
66
65
|
bindingIdValidator: () => import_TLBaseBinding.bindingIdValidator,
|
|
67
66
|
bookmarkShapeMigrations: () => import_TLBookmarkShape.bookmarkShapeMigrations,
|
|
68
67
|
bookmarkShapeProps: () => import_TLBookmarkShape.bookmarkShapeProps,
|
|
69
68
|
boxModelValidator: () => import_geometry_types.boxModelValidator,
|
|
70
69
|
canvasUiColorTypeValidator: () => import_TLColor.canvasUiColorTypeValidator,
|
|
71
|
-
compressLegacySegments: () => import_TLDrawShape.compressLegacySegments,
|
|
72
70
|
createAssetValidator: () => import_TLBaseAsset.createAssetValidator,
|
|
73
71
|
createBindingId: () => import_TLBinding.createBindingId,
|
|
74
72
|
createBindingPropsMigrationIds: () => import_TLBinding.createBindingPropsMigrationIds,
|
|
@@ -178,10 +176,9 @@ var import_TLSizeStyle = require("./styles/TLSizeStyle");
|
|
|
178
176
|
var import_TLTextAlignStyle = require("./styles/TLTextAlignStyle");
|
|
179
177
|
var import_TLVerticalAlignStyle = require("./styles/TLVerticalAlignStyle");
|
|
180
178
|
var import_translations = require("./translations/translations");
|
|
181
|
-
var import_b64Vecs = require("./misc/b64Vecs");
|
|
182
179
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
183
180
|
"@tldraw/tlschema",
|
|
184
|
-
"4.2.
|
|
181
|
+
"4.2.3",
|
|
185
182
|
"cjs"
|
|
186
183
|
);
|
|
187
184
|
//# 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 { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { 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 TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\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\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\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
|
|
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;
|
|
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 { type TLBookmarkAsset } from './assets/TLBookmarkAsset'\nexport { type TLImageAsset } from './assets/TLImageAsset'\nexport { 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 TLPresenceStateInfo,\n\ttype TLPresenceUserInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\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\tassetValidator,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\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 TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\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 { type TLRecord } from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype TLDefaultShape,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\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\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\tdefaultColorNames,\n\tDefaultColorStyle,\n\tDefaultColorThemePalette,\n\tDefaultLabelColorStyle,\n\tgetColorValue,\n\tgetDefaultColorTheme,\n\ttype TLDefaultColorStyle,\n\ttype TLDefaultColorTheme,\n\ttype TLDefaultColorThemeColor,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\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\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\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"],
|
|
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;AAgCA,mBAA6C;AAC7C,yBAAyE;AAIzE,4BAOO;AACP,2BAIO;AACP,2CAKO;AACP,4BAMO;AACP,4BAKO;AACP,0BAA4B;AAC5B,qBAIO;AACP,sBAAkE;AAClE,sBAAkE;AAClE,uBAAqD;AACrD,wBAA+D;AAC/D,wBAAuE;AACvE,qBAQO;AACP,uBAaO;AACP,sBAAiE;AACjE,wBAKO;AACP,wBAKO;AACP,oBAMO;AACP,yBAIO;AACP,uBAKO;AACP,wBAIO;AAEP,qBAcO;AAQP,0BAWO;AACP,yBAKO;AACP,6BAKO;AACP,yBAMO;AACP,0BAKO;AACP,0BAKO;AACP,wBAOO;AACP,0BAKO;AACP,8BAKO;AACP,0BAMO;AACP,yBAQO;AACP,yBAKO;AACP,yBAKO;AACP,0BAKO;AACP,uBAA8D;AAC9D,0BAUO;AACP,yBAA0D;AAC1D,yBAA0D;AAC1D,yBAIO;AACP,oCAGO;AACP,yBAA0D;AAC1D,8BAAoE;AACpE,kCAGO;AAUP,0BAIO;AAAA,IAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,5 +22,9 @@ __export(TLOpacity_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(TLOpacity_exports);
|
|
24
24
|
var import_validate = require("@tldraw/validate");
|
|
25
|
-
const opacityValidator = import_validate.T.
|
|
25
|
+
const opacityValidator = import_validate.T.number.check((n) => {
|
|
26
|
+
if (n < 0 || n > 1) {
|
|
27
|
+
throw new import_validate.T.ValidationError("Opacity must be between 0 and 1");
|
|
28
|
+
}
|
|
29
|
+
});
|
|
26
30
|
//# sourceMappingURL=TLOpacity.js.map
|