@tldraw/tlschema 4.6.0-next.20de11b7e238 → 4.6.0-next.241e87d4700a
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/assets/TLBaseAsset.js +4 -3
- package/dist-cjs/assets/TLBaseAsset.js.map +2 -2
- package/dist-cjs/assets/TLBookmarkAsset.js +9 -7
- package/dist-cjs/assets/TLBookmarkAsset.js.map +2 -2
- package/dist-cjs/assets/TLImageAsset.js +12 -10
- package/dist-cjs/assets/TLImageAsset.js.map +2 -2
- package/dist-cjs/assets/TLVideoAsset.js +11 -9
- package/dist-cjs/assets/TLVideoAsset.js.map +2 -2
- package/dist-cjs/createTLSchema.js +10 -4
- package/dist-cjs/createTLSchema.js.map +2 -2
- package/dist-cjs/index.d.ts +601 -343
- package/dist-cjs/index.js +17 -7
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/records/TLAsset.js +29 -14
- package/dist-cjs/records/TLAsset.js.map +2 -2
- package/dist-cjs/shapes/TLFrameShape.js +3 -1
- package/dist-cjs/shapes/TLFrameShape.js.map +2 -2
- package/dist-cjs/shapes/TLNoteShape.js +12 -2
- package/dist-cjs/shapes/TLNoteShape.js.map +2 -2
- package/dist-cjs/styles/StyleProp.js +38 -1
- package/dist-cjs/styles/StyleProp.js.map +2 -2
- package/dist-cjs/styles/TLColorStyle.js +36 -487
- package/dist-cjs/styles/TLColorStyle.js.map +2 -2
- package/dist-cjs/styles/TLDashStyle.js +1 -1
- package/dist-cjs/styles/TLDashStyle.js.map +2 -2
- package/dist-cjs/styles/TLFontFace.js +17 -0
- package/dist-cjs/styles/TLFontFace.js.map +7 -0
- package/dist-cjs/styles/TLFontStyle.js +36 -1
- package/dist-cjs/styles/TLFontStyle.js.map +2 -2
- package/dist-cjs/styles/TLTheme.js +17 -0
- package/dist-cjs/styles/TLTheme.js.map +7 -0
- package/dist-esm/assets/TLBaseAsset.mjs +4 -3
- package/dist-esm/assets/TLBaseAsset.mjs.map +2 -2
- package/dist-esm/assets/TLBookmarkAsset.mjs +9 -7
- package/dist-esm/assets/TLBookmarkAsset.mjs.map +2 -2
- package/dist-esm/assets/TLImageAsset.mjs +12 -10
- package/dist-esm/assets/TLImageAsset.mjs.map +2 -2
- package/dist-esm/assets/TLVideoAsset.mjs +11 -9
- package/dist-esm/assets/TLVideoAsset.mjs.map +2 -2
- package/dist-esm/createTLSchema.mjs +17 -8
- package/dist-esm/createTLSchema.mjs.map +2 -2
- package/dist-esm/index.d.mts +601 -343
- package/dist-esm/index.mjs +28 -14
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/records/TLAsset.mjs +29 -14
- package/dist-esm/records/TLAsset.mjs.map +2 -2
- package/dist-esm/shapes/TLFrameShape.mjs +3 -1
- package/dist-esm/shapes/TLFrameShape.mjs.map +2 -2
- package/dist-esm/shapes/TLNoteShape.mjs +12 -2
- package/dist-esm/shapes/TLNoteShape.mjs.map +2 -2
- package/dist-esm/styles/StyleProp.mjs +38 -1
- package/dist-esm/styles/StyleProp.mjs.map +2 -2
- package/dist-esm/styles/TLColorStyle.mjs +36 -487
- package/dist-esm/styles/TLColorStyle.mjs.map +2 -2
- package/dist-esm/styles/TLDashStyle.mjs +1 -1
- package/dist-esm/styles/TLDashStyle.mjs.map +2 -2
- package/dist-esm/styles/TLFontFace.mjs +1 -0
- package/dist-esm/styles/TLFontFace.mjs.map +7 -0
- package/dist-esm/styles/TLFontStyle.mjs +36 -1
- package/dist-esm/styles/TLFontStyle.mjs.map +2 -2
- package/dist-esm/styles/TLTheme.mjs +1 -0
- package/dist-esm/styles/TLTheme.mjs.map +7 -0
- package/package.json +5 -5
- package/src/assets/TLBaseAsset.ts +25 -28
- package/src/assets/TLBookmarkAsset.ts +13 -33
- package/src/assets/TLImageAsset.ts +16 -42
- package/src/assets/TLVideoAsset.ts +15 -40
- package/src/createTLSchema.ts +54 -15
- package/src/index.ts +31 -11
- package/src/migrations.test.ts +22 -0
- package/src/records/TLAsset.ts +139 -74
- package/src/shapes/TLFrameShape.ts +3 -1
- package/src/shapes/TLNoteShape.ts +19 -5
- package/src/styles/StyleProp.ts +42 -5
- package/src/styles/TLColorStyle.ts +55 -698
- package/src/styles/TLDashStyle.ts +1 -1
- package/src/styles/TLFontFace.ts +65 -0
- package/src/styles/TLFontStyle.ts +53 -4
- package/src/styles/TLTheme.ts +240 -0
package/dist-cjs/index.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ export declare const assetIdValidator: T.Validator<TLAssetId>;
|
|
|
247
247
|
* // Migration is applied automatically when loading old documents
|
|
248
248
|
* const migratedStore = migrator.migrateStoreSnapshot({
|
|
249
249
|
* schema: oldSchema,
|
|
250
|
-
* store: oldStoreSnapshot
|
|
250
|
+
* store: oldStoreSnapshot,
|
|
251
251
|
* })
|
|
252
252
|
* ```
|
|
253
253
|
*
|
|
@@ -256,50 +256,11 @@ export declare const assetIdValidator: T.Validator<TLAssetId>;
|
|
|
256
256
|
export declare const assetMigrations: MigrationSequence;
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
|
-
* Record type definition for TLAsset with
|
|
260
|
-
* Configures assets as document-scoped records that persist across sessions.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* ```ts
|
|
264
|
-
* // Create a new asset record
|
|
265
|
-
* const assetRecord = AssetRecordType.create({
|
|
266
|
-
* id: 'asset:image123',
|
|
267
|
-
* type: 'image',
|
|
268
|
-
* props: {
|
|
269
|
-
* src: 'https://example.com/image.jpg',
|
|
270
|
-
* w: 800,
|
|
271
|
-
* h: 600,
|
|
272
|
-
* mimeType: 'image/jpeg',
|
|
273
|
-
* isAnimated: false
|
|
274
|
-
* }
|
|
275
|
-
* })
|
|
276
|
-
*
|
|
277
|
-
* // Store the asset
|
|
278
|
-
* store.put([assetRecord])
|
|
279
|
-
* ```
|
|
259
|
+
* Record type definition for default TLAsset records with document scope and default metadata.
|
|
280
260
|
*
|
|
281
261
|
* @public
|
|
282
262
|
*/
|
|
283
|
-
export declare const AssetRecordType: RecordType<TLAsset
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Validator for TLAsset records that ensures runtime type safety.
|
|
287
|
-
* Uses a discriminated union based on the 'type' field to validate different asset types.
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
* ```ts
|
|
291
|
-
* // Validation happens automatically when assets are stored
|
|
292
|
-
* try {
|
|
293
|
-
* const validatedAsset = assetValidator.validate(assetData)
|
|
294
|
-
* store.put([validatedAsset])
|
|
295
|
-
* } catch (error) {
|
|
296
|
-
* console.error('Asset validation failed:', error.message)
|
|
297
|
-
* }
|
|
298
|
-
* ```
|
|
299
|
-
*
|
|
300
|
-
* @public
|
|
301
|
-
*/
|
|
302
|
-
export declare const assetValidator: T.Validator<TLAsset>;
|
|
263
|
+
export declare const AssetRecordType: RecordType<TLAsset<"bookmark" | "image" | "video">, "props" | "type">;
|
|
303
264
|
|
|
304
265
|
/**
|
|
305
266
|
* Utilities for encoding and decoding points using base64 and Float16 encoding.
|
|
@@ -384,6 +345,27 @@ export declare class b64Vecs {
|
|
|
384
345
|
*/
|
|
385
346
|
export declare const bindingIdValidator: T.Validator<TLBindingId>;
|
|
386
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Migration sequence for bookmark assets. Handles the evolution of bookmark asset
|
|
350
|
+
* data structure over time, ensuring backward and forward compatibility.
|
|
351
|
+
*
|
|
352
|
+
* The migration sequence includes:
|
|
353
|
+
* 1. **MakeUrlsValid** (v1): Validates and cleans up src URLs, setting invalid URLs to empty string
|
|
354
|
+
* 2. **AddFavicon** (v2): Adds the favicon property and validates it, setting invalid favicons to empty string
|
|
355
|
+
*
|
|
356
|
+
* @public
|
|
357
|
+
*/
|
|
358
|
+
export declare const bookmarkAssetMigrations: MigrationSequence;
|
|
359
|
+
|
|
360
|
+
/** @public */
|
|
361
|
+
export declare const bookmarkAssetProps: {
|
|
362
|
+
description: T.Validator<string>;
|
|
363
|
+
favicon: T.Validator<string>;
|
|
364
|
+
image: T.Validator<string>;
|
|
365
|
+
src: T.Validator<null | string>;
|
|
366
|
+
title: T.Validator<string>;
|
|
367
|
+
};
|
|
368
|
+
|
|
387
369
|
/**
|
|
388
370
|
* Migration sequence for bookmark shape properties across different schema versions.
|
|
389
371
|
* Handles backwards compatibility when bookmark shape structure changes.
|
|
@@ -497,13 +479,50 @@ export declare function compressLegacySegments(segments: {
|
|
|
497
479
|
type: 'free' | 'straight';
|
|
498
480
|
}[]): TLDrawShapeSegment[];
|
|
499
481
|
|
|
482
|
+
/**
|
|
483
|
+
* Creates properly formatted migration IDs for asset properties.
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* const assetPropsVersions = createAssetPropsMigrationIds('file', {
|
|
488
|
+
* AddFoo: 1,
|
|
489
|
+
* RenameBar: 2,
|
|
490
|
+
* })
|
|
491
|
+
* // => { AddFoo: 'com.tldraw.asset.file/1', RenameBar: 'com.tldraw.asset.file/2' }
|
|
492
|
+
* ```
|
|
493
|
+
*
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
496
|
+
export declare function createAssetPropsMigrationIds<S extends string, T extends Record<string, number>>(assetType: S, ids: T): {
|
|
497
|
+
[k in keyof T]: `com.tldraw.asset.${S}/${T[k]}`;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Creates a migration sequence for asset properties.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* const migrations = createAssetPropsMigrationSequence({
|
|
506
|
+
* sequence: [
|
|
507
|
+
* { id: 'com.myapp.asset.custom/1', up: (props) => { props.newField = '' } },
|
|
508
|
+
* ],
|
|
509
|
+
* })
|
|
510
|
+
* ```
|
|
511
|
+
*
|
|
512
|
+
* @public
|
|
513
|
+
*/
|
|
514
|
+
export declare function createAssetPropsMigrationSequence(migrations: TLPropsMigrations): TLPropsMigrations;
|
|
515
|
+
|
|
516
|
+
/* Excluded from this release type: createAssetRecordType */
|
|
517
|
+
|
|
500
518
|
/**
|
|
501
519
|
* Creates a validator for a specific asset record type. This factory function generates
|
|
502
520
|
* a complete validator that validates the entire asset record structure including the
|
|
503
521
|
* base properties (id, typeName, type, meta) and the type-specific props.
|
|
504
522
|
*
|
|
505
523
|
* @param type - The asset type identifier (e.g., 'image', 'video', 'bookmark')
|
|
506
|
-
* @param props -
|
|
524
|
+
* @param props - A validator or per-key validator record for the asset's type-specific properties
|
|
525
|
+
* @param meta - An optional per-key validator record for the asset's meta properties
|
|
507
526
|
* @returns A complete validator for the asset record type
|
|
508
527
|
*
|
|
509
528
|
* @example
|
|
@@ -518,43 +537,28 @@ export declare function compressLegacySegments(segments: {
|
|
|
518
537
|
* description?: string
|
|
519
538
|
* }>
|
|
520
539
|
*
|
|
521
|
-
* // Create validator
|
|
522
|
-
* const customAssetValidator = createAssetValidator('custom',
|
|
540
|
+
* // Create validator using a per-key record (recommended)
|
|
541
|
+
* const customAssetValidator = createAssetValidator('custom', {
|
|
523
542
|
* url: T.string,
|
|
524
543
|
* title: T.string,
|
|
525
544
|
* description: T.string.optional()
|
|
526
|
-
* })
|
|
527
|
-
*
|
|
528
|
-
* // Use the validator
|
|
529
|
-
* const assetData = {
|
|
530
|
-
* id: 'asset:custom123',
|
|
531
|
-
* typeName: 'asset' as const,
|
|
532
|
-
* type: 'custom' as const,
|
|
533
|
-
* props: {
|
|
534
|
-
* url: 'https://example.com',
|
|
535
|
-
* title: 'My Custom Asset'
|
|
536
|
-
* },
|
|
537
|
-
* meta: {}
|
|
538
|
-
* }
|
|
545
|
+
* })
|
|
539
546
|
*
|
|
540
|
-
*
|
|
547
|
+
* // Or using a T.object validator
|
|
548
|
+
* const customAssetValidator2 = createAssetValidator('custom', T.object({
|
|
549
|
+
* url: T.string,
|
|
550
|
+
* title: T.string,
|
|
551
|
+
* description: T.string.optional()
|
|
552
|
+
* }))
|
|
541
553
|
* ```
|
|
542
554
|
*
|
|
543
555
|
* @public
|
|
544
556
|
*/
|
|
545
|
-
export declare function createAssetValidator<Type extends string, Props extends JsonObject
|
|
546
|
-
|
|
547
|
-
meta
|
|
548
|
-
|
|
549
|
-
type: Type;
|
|
550
|
-
typeName: "asset";
|
|
551
|
-
}[P]; } & { [P in (undefined extends Props ? "props" : never) | (undefined extends Type ? "type" : never)]?: {
|
|
552
|
-
id: TLAssetId;
|
|
553
|
-
meta: JsonObject;
|
|
554
|
-
props: Props;
|
|
555
|
-
type: Type;
|
|
556
|
-
typeName: "asset";
|
|
557
|
-
}[P] | undefined; }>>;
|
|
557
|
+
export declare function createAssetValidator<Type extends string, Props extends JsonObject, Meta extends JsonObject = JsonObject>(type: Type, props?: {
|
|
558
|
+
[K in keyof Props]: T.Validatable<Props[K]>;
|
|
559
|
+
} | T.Validator<Props>, meta?: {
|
|
560
|
+
[K in keyof Meta]: T.Validatable<Meta[K]>;
|
|
561
|
+
}): T.ObjectValidator<Expand< { [P in "id" | "meta" | "typeName" | (undefined extends Props ? never : "props") | (undefined extends Type ? never : "type")]: TLBaseAsset<Type, Props>[P]; } & { [P in (undefined extends Props ? "props" : never) | (undefined extends Type ? "type" : never)]?: TLBaseAsset<Type, Props>[P] | undefined; }>>;
|
|
558
562
|
|
|
559
563
|
/**
|
|
560
564
|
* Creates a new TLBindingId with proper formatting.
|
|
@@ -996,12 +1000,13 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
996
1000
|
* validation, and migration sequences for all record types in a tldraw application.
|
|
997
1001
|
*
|
|
998
1002
|
* The schema includes all core record types (pages, cameras, instances, etc.) plus the
|
|
999
|
-
* shape, binding, and custom record types you specify. Style properties are
|
|
1000
|
-
* collected from all shapes to ensure consistency across the application.
|
|
1003
|
+
* shape, binding, asset, and custom record types you specify. Style properties are
|
|
1004
|
+
* automatically collected from all shapes to ensure consistency across the application.
|
|
1001
1005
|
*
|
|
1002
1006
|
* @param options - Configuration options for the schema
|
|
1003
1007
|
* - shapes - Shape schema configurations. Defaults to defaultShapeSchemas if not provided
|
|
1004
1008
|
* - bindings - Binding schema configurations. Defaults to defaultBindingSchemas if not provided
|
|
1009
|
+
* - assets - Asset schema configurations. Defaults to defaultAssetSchemas if not provided
|
|
1005
1010
|
* - user - Custom user record configuration with meta validators and migrations
|
|
1006
1011
|
* - records - Custom record type configurations. These are additional record types beyond
|
|
1007
1012
|
* the built-in shapes, bindings, assets, etc.
|
|
@@ -1011,10 +1016,15 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
1011
1016
|
* @public
|
|
1012
1017
|
* @example
|
|
1013
1018
|
* ```ts
|
|
1014
|
-
* import {
|
|
1019
|
+
* import {
|
|
1020
|
+
* createTLSchema,
|
|
1021
|
+
* defaultShapeSchemas,
|
|
1022
|
+
* defaultBindingSchemas,
|
|
1023
|
+
* defaultAssetSchemas,
|
|
1024
|
+
* } from '@tldraw/tlschema'
|
|
1015
1025
|
* import { Store } from '@tldraw/store'
|
|
1016
1026
|
*
|
|
1017
|
-
* // Create schema with all default shapes and
|
|
1027
|
+
* // Create schema with all default shapes, bindings, and assets
|
|
1018
1028
|
* const schema = createTLSchema()
|
|
1019
1029
|
*
|
|
1020
1030
|
* // Create schema with custom shapes added
|
|
@@ -1026,6 +1036,8 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
1026
1036
|
* migrations: myCustomShapeMigrations,
|
|
1027
1037
|
* },
|
|
1028
1038
|
* },
|
|
1039
|
+
* bindings: defaultBindingSchemas,
|
|
1040
|
+
* assets: defaultAssetSchemas,
|
|
1029
1041
|
* })
|
|
1030
1042
|
*
|
|
1031
1043
|
* // Create schema with custom user metadata
|
|
@@ -1062,7 +1074,8 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
1062
1074
|
* })
|
|
1063
1075
|
* ```
|
|
1064
1076
|
*/
|
|
1065
|
-
export declare function createTLSchema({ shapes, bindings, user, records, migrations }?: {
|
|
1077
|
+
export declare function createTLSchema({ shapes, bindings, assets, user, records, migrations }?: {
|
|
1078
|
+
assets?: Record<string, SchemaPropsInfo>;
|
|
1066
1079
|
bindings?: Record<string, SchemaPropsInfo>;
|
|
1067
1080
|
migrations?: readonly MigrationSequence[];
|
|
1068
1081
|
records?: Record<string, CustomRecordInfo>;
|
|
@@ -1164,6 +1177,57 @@ export declare interface CustomRecordInfo {
|
|
|
1164
1177
|
createDefaultProperties?: () => Record<string, unknown>;
|
|
1165
1178
|
}
|
|
1166
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* Default asset schema configurations for all built-in tldraw asset types.
|
|
1182
|
+
*
|
|
1183
|
+
* @public
|
|
1184
|
+
* @example
|
|
1185
|
+
* ```ts
|
|
1186
|
+
* import { createTLSchema, defaultAssetSchemas } from '@tldraw/tlschema'
|
|
1187
|
+
*
|
|
1188
|
+
* const schema = createTLSchema({
|
|
1189
|
+
* assets: defaultAssetSchemas,
|
|
1190
|
+
* })
|
|
1191
|
+
* ```
|
|
1192
|
+
*/
|
|
1193
|
+
export declare const defaultAssetSchemas: {
|
|
1194
|
+
bookmark: {
|
|
1195
|
+
migrations: MigrationSequence;
|
|
1196
|
+
props: {
|
|
1197
|
+
description: T.Validator<string>;
|
|
1198
|
+
favicon: T.Validator<string>;
|
|
1199
|
+
image: T.Validator<string>;
|
|
1200
|
+
src: T.Validator<null | string>;
|
|
1201
|
+
title: T.Validator<string>;
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
image: {
|
|
1205
|
+
migrations: MigrationSequence;
|
|
1206
|
+
props: {
|
|
1207
|
+
fileSize: T.Validator<number | undefined>;
|
|
1208
|
+
h: T.Validator<number>;
|
|
1209
|
+
isAnimated: T.Validator<boolean>;
|
|
1210
|
+
mimeType: T.Validator<null | string>;
|
|
1211
|
+
name: T.Validator<string>;
|
|
1212
|
+
pixelRatio: T.Validator<number | undefined>;
|
|
1213
|
+
src: T.Validator<null | string>;
|
|
1214
|
+
w: T.Validator<number>;
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
video: {
|
|
1218
|
+
migrations: MigrationSequence;
|
|
1219
|
+
props: {
|
|
1220
|
+
fileSize: T.Validator<number | undefined>;
|
|
1221
|
+
h: T.Validator<number>;
|
|
1222
|
+
isAnimated: T.Validator<boolean>;
|
|
1223
|
+
mimeType: T.Validator<null | string>;
|
|
1224
|
+
name: T.Validator<string>;
|
|
1225
|
+
src: T.Validator<null | string>;
|
|
1226
|
+
w: T.Validator<number>;
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1167
1231
|
/**
|
|
1168
1232
|
* Default binding schema configurations for all built-in tldraw binding types.
|
|
1169
1233
|
* Bindings represent relationships between shapes, such as arrows connected to shapes.
|
|
@@ -1201,78 +1265,9 @@ export declare const defaultBindingSchemas: {
|
|
|
1201
1265
|
};
|
|
1202
1266
|
|
|
1203
1267
|
/**
|
|
1204
|
-
* Array of default color names available in tldraw's color palette.
|
|
1205
|
-
* These colors form the basis for the default color style system and are available
|
|
1206
|
-
* in both light and dark theme variants.
|
|
1207
|
-
*
|
|
1208
|
-
* @example
|
|
1209
|
-
* ```ts
|
|
1210
|
-
* import { defaultColorNames } from '@tldraw/tlschema'
|
|
1211
|
-
*
|
|
1212
|
-
* // Create a color picker with all default colors
|
|
1213
|
-
* const colorOptions = defaultColorNames.map(color => ({
|
|
1214
|
-
* name: color,
|
|
1215
|
-
* value: color
|
|
1216
|
-
* }))
|
|
1217
|
-
* ```
|
|
1218
|
-
*
|
|
1219
1268
|
* @public
|
|
1220
1269
|
*/
|
|
1221
|
-
export declare const
|
|
1222
|
-
|
|
1223
|
-
/**
|
|
1224
|
-
* Default color style property used by tldraw shapes for their primary color.
|
|
1225
|
-
* This style prop allows shapes to use any of the default color names and
|
|
1226
|
-
* automatically saves the last used value for new shapes.
|
|
1227
|
-
*
|
|
1228
|
-
* @example
|
|
1229
|
-
* ```ts
|
|
1230
|
-
* import { DefaultColorStyle } from '@tldraw/tlschema'
|
|
1231
|
-
*
|
|
1232
|
-
* // Use in shape props definition
|
|
1233
|
-
* interface MyShapeProps {
|
|
1234
|
-
* color: typeof DefaultColorStyle
|
|
1235
|
-
* // other props...
|
|
1236
|
-
* }
|
|
1237
|
-
*
|
|
1238
|
-
* // Set color on a shape
|
|
1239
|
-
* const shape = {
|
|
1240
|
-
* // ... other properties
|
|
1241
|
-
* props: {
|
|
1242
|
-
* color: 'red' as const,
|
|
1243
|
-
* // ... other props
|
|
1244
|
-
* }
|
|
1245
|
-
* }
|
|
1246
|
-
* ```
|
|
1247
|
-
*
|
|
1248
|
-
* @public
|
|
1249
|
-
*/
|
|
1250
|
-
export declare const DefaultColorStyle: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "white" | "yellow">;
|
|
1251
|
-
|
|
1252
|
-
/**
|
|
1253
|
-
* Complete color palette containing both light and dark theme definitions.
|
|
1254
|
-
* This object provides the full color system used by tldraw's default themes,
|
|
1255
|
-
* including all color variants and theme-specific adjustments.
|
|
1256
|
-
*
|
|
1257
|
-
* @example
|
|
1258
|
-
* ```ts
|
|
1259
|
-
* import { DefaultColorThemePalette } from '@tldraw/tlschema'
|
|
1260
|
-
*
|
|
1261
|
-
* // Get the dark theme colors
|
|
1262
|
-
* const darkTheme = DefaultColorThemePalette.darkMode
|
|
1263
|
-
* const redColor = darkTheme.red.solid // '#e03131'
|
|
1264
|
-
*
|
|
1265
|
-
* // Access light theme colors
|
|
1266
|
-
* const lightTheme = DefaultColorThemePalette.lightMode
|
|
1267
|
-
* const blueColor = lightTheme.blue.fill // '#4465e9'
|
|
1268
|
-
* ```
|
|
1269
|
-
*
|
|
1270
|
-
* @public
|
|
1271
|
-
*/
|
|
1272
|
-
export declare const DefaultColorThemePalette: {
|
|
1273
|
-
darkMode: TLDefaultColorTheme;
|
|
1274
|
-
lightMode: TLDefaultColorTheme;
|
|
1275
|
-
};
|
|
1270
|
+
export declare const DefaultColorStyle: EnumStyleProp<TLDefaultColorStyle>;
|
|
1276
1271
|
|
|
1277
1272
|
/**
|
|
1278
1273
|
* Default dash style property used by tldraw shapes for line styling.
|
|
@@ -1306,7 +1301,7 @@ export declare const DefaultColorThemePalette: {
|
|
|
1306
1301
|
*
|
|
1307
1302
|
* @public
|
|
1308
1303
|
*/
|
|
1309
|
-
export declare const DefaultDashStyle: EnumStyleProp<"dashed" | "dotted" | "draw" | "solid">;
|
|
1304
|
+
export declare const DefaultDashStyle: EnumStyleProp<"dashed" | "dotted" | "draw" | "none" | "solid">;
|
|
1310
1305
|
|
|
1311
1306
|
/**
|
|
1312
1307
|
* Default fill style property used by tldraw shapes for interior styling.
|
|
@@ -1438,36 +1433,6 @@ export declare const DefaultFontStyle: EnumStyleProp<"draw" | "mono" | "sans" |
|
|
|
1438
1433
|
*/
|
|
1439
1434
|
export declare const DefaultHorizontalAlignStyle: EnumStyleProp<"end-legacy" | "end" | "middle-legacy" | "middle" | "start-legacy" | "start">;
|
|
1440
1435
|
|
|
1441
|
-
/**
|
|
1442
|
-
* Default label color style property used for text labels on shapes.
|
|
1443
|
-
* This is separate from the main color style to allow different colors
|
|
1444
|
-
* for shape fills/strokes versus their text labels.
|
|
1445
|
-
*
|
|
1446
|
-
* @example
|
|
1447
|
-
* ```ts
|
|
1448
|
-
* import { DefaultLabelColorStyle } from '@tldraw/tlschema'
|
|
1449
|
-
*
|
|
1450
|
-
* // Use in shape props definition
|
|
1451
|
-
* interface MyShapeProps {
|
|
1452
|
-
* labelColor: typeof DefaultLabelColorStyle
|
|
1453
|
-
* // other props...
|
|
1454
|
-
* }
|
|
1455
|
-
*
|
|
1456
|
-
* // Create a shape with different fill and label colors
|
|
1457
|
-
* const shape = {
|
|
1458
|
-
* // ... other properties
|
|
1459
|
-
* props: {
|
|
1460
|
-
* color: 'blue' as const,
|
|
1461
|
-
* labelColor: 'white' as const,
|
|
1462
|
-
* // ... other props
|
|
1463
|
-
* }
|
|
1464
|
-
* }
|
|
1465
|
-
* ```
|
|
1466
|
-
*
|
|
1467
|
-
* @public
|
|
1468
|
-
*/
|
|
1469
|
-
export declare const DefaultLabelColorStyle: EnumStyleProp<"black" | "blue" | "green" | "grey" | "light-blue" | "light-green" | "light-red" | "light-violet" | "orange" | "red" | "violet" | "white" | "yellow">;
|
|
1470
|
-
|
|
1471
1436
|
/**
|
|
1472
1437
|
* Default shape schema configurations for all built-in tldraw shape types.
|
|
1473
1438
|
* Each shape type includes its validation props and migration sequences.
|
|
@@ -1758,8 +1723,28 @@ export declare const embedShapeProps: RecordProps<TLEmbedShape>;
|
|
|
1758
1723
|
* @public
|
|
1759
1724
|
*/
|
|
1760
1725
|
export declare class EnumStyleProp<T> extends StyleProp<T> {
|
|
1761
|
-
readonly values: readonly T[];
|
|
1762
1726
|
/* Excluded from this release type: __constructor */
|
|
1727
|
+
readonly values: T[];
|
|
1728
|
+
/**
|
|
1729
|
+
* Add new values to this enum style prop at runtime. This is useful for extending
|
|
1730
|
+
* the built-in styles with custom values (e.g. adding custom colors). Be sure to
|
|
1731
|
+
* also modify the associated types.
|
|
1732
|
+
*
|
|
1733
|
+
* @param newValues - The new values to add.
|
|
1734
|
+
*
|
|
1735
|
+
* @public
|
|
1736
|
+
*/
|
|
1737
|
+
addValues(...newValues: T[]): void;
|
|
1738
|
+
/**
|
|
1739
|
+
* Remove values from this enum style prop at runtime. This is useful for narrowing
|
|
1740
|
+
* the built-in styles with custom values (e.g. adding custom colors). Be sure to
|
|
1741
|
+
* also modify the associated types.
|
|
1742
|
+
*
|
|
1743
|
+
* @param valuesToRemove - The values to remove.
|
|
1744
|
+
*
|
|
1745
|
+
* @public
|
|
1746
|
+
*/
|
|
1747
|
+
removeValues(...valuesToRemove: T[]): void;
|
|
1763
1748
|
}
|
|
1764
1749
|
|
|
1765
1750
|
/**
|
|
@@ -1841,62 +1826,6 @@ export declare const geoShapeMigrations: TLPropsMigrations;
|
|
|
1841
1826
|
*/
|
|
1842
1827
|
export declare const geoShapeProps: RecordProps<TLGeoShape>;
|
|
1843
1828
|
|
|
1844
|
-
/**
|
|
1845
|
-
* Resolves a color style value to its actual CSS color string for a given theme and variant.
|
|
1846
|
-
* If the color is not a default theme color, returns the color value as-is.
|
|
1847
|
-
*
|
|
1848
|
-
* @param theme - The color theme to use for resolution
|
|
1849
|
-
* @param color - The color style value to resolve
|
|
1850
|
-
* @param variant - Which variant of the color to return (solid, fill, pattern, etc.)
|
|
1851
|
-
* @returns The CSS color string for the specified color and variant
|
|
1852
|
-
*
|
|
1853
|
-
* @example
|
|
1854
|
-
* ```ts
|
|
1855
|
-
* import { getColorValue, getDefaultColorTheme } from '@tldraw/tlschema'
|
|
1856
|
-
*
|
|
1857
|
-
* const theme = getDefaultColorTheme({ isDarkMode: false })
|
|
1858
|
-
*
|
|
1859
|
-
* // Get the solid variant of red
|
|
1860
|
-
* const redSolid = getColorValue(theme, 'red', 'solid') // '#e03131'
|
|
1861
|
-
*
|
|
1862
|
-
* // Get the fill variant of blue
|
|
1863
|
-
* const blueFill = getColorValue(theme, 'blue', 'fill') // '#4465e9'
|
|
1864
|
-
*
|
|
1865
|
-
* // Custom color passes through unchanged
|
|
1866
|
-
* const customColor = getColorValue(theme, '#ff0000', 'solid') // '#ff0000'
|
|
1867
|
-
* ```
|
|
1868
|
-
*
|
|
1869
|
-
* @public
|
|
1870
|
-
*/
|
|
1871
|
-
export declare function getColorValue(theme: TLDefaultColorTheme, color: TLDefaultColorStyle, variant: keyof TLDefaultColorThemeColor): string;
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* Returns the appropriate default color theme based on the dark mode preference.
|
|
1875
|
-
*
|
|
1876
|
-
* @param opts - Configuration options
|
|
1877
|
-
* - isDarkMode - Whether to return the dark theme (true) or light theme (false)
|
|
1878
|
-
* @returns The corresponding TLDefaultColorTheme (light or dark)
|
|
1879
|
-
*
|
|
1880
|
-
* @example
|
|
1881
|
-
* ```ts
|
|
1882
|
-
* import { getDefaultColorTheme } from '@tldraw/tlschema'
|
|
1883
|
-
*
|
|
1884
|
-
* // Get light theme
|
|
1885
|
-
* const lightTheme = getDefaultColorTheme({ isDarkMode: false })
|
|
1886
|
-
*
|
|
1887
|
-
* // Get dark theme
|
|
1888
|
-
* const darkTheme = getDefaultColorTheme({ isDarkMode: true })
|
|
1889
|
-
*
|
|
1890
|
-
* // Use with editor
|
|
1891
|
-
* const theme = getDefaultColorTheme({ isDarkMode: window.matchMedia('(prefers-color-scheme: dark)').matches })
|
|
1892
|
-
* ```
|
|
1893
|
-
*
|
|
1894
|
-
* @public
|
|
1895
|
-
*/
|
|
1896
|
-
export declare function getDefaultColorTheme(opts: {
|
|
1897
|
-
isDarkMode: boolean;
|
|
1898
|
-
}): TLDefaultColorTheme;
|
|
1899
|
-
|
|
1900
1829
|
/**
|
|
1901
1830
|
* Gets the default translation locale based on the user's browser language preferences.
|
|
1902
1831
|
*
|
|
@@ -2062,6 +1991,35 @@ export declare const highlightShapeProps: RecordProps<TLHighlightShape>;
|
|
|
2062
1991
|
*/
|
|
2063
1992
|
export declare function idValidator<Id extends RecordId<UnknownRecord>>(prefix: Id['__type__']['typeName']): T.Validator<Id>;
|
|
2064
1993
|
|
|
1994
|
+
/**
|
|
1995
|
+
* Migration sequence for image assets. Handles the evolution of the image asset schema
|
|
1996
|
+
* over time, providing both forward (up) and backward (down) migration functions to
|
|
1997
|
+
* maintain compatibility across different versions of the tldraw data model.
|
|
1998
|
+
*
|
|
1999
|
+
* The sequence includes migrations for:
|
|
2000
|
+
* - Adding the `isAnimated` property to track animated images
|
|
2001
|
+
* - Renaming `width`/`height` properties to shorter `w`/`h` names
|
|
2002
|
+
* - Ensuring URLs are valid format
|
|
2003
|
+
* - Adding file size tracking
|
|
2004
|
+
* - Making file size optional
|
|
2005
|
+
*
|
|
2006
|
+
*
|
|
2007
|
+
* @public
|
|
2008
|
+
*/
|
|
2009
|
+
export declare const imageAssetMigrations: MigrationSequence;
|
|
2010
|
+
|
|
2011
|
+
/** @public */
|
|
2012
|
+
export declare const imageAssetProps: {
|
|
2013
|
+
fileSize: T.Validator<number | undefined>;
|
|
2014
|
+
h: T.Validator<number>;
|
|
2015
|
+
isAnimated: T.Validator<boolean>;
|
|
2016
|
+
mimeType: T.Validator<null | string>;
|
|
2017
|
+
name: T.Validator<string>;
|
|
2018
|
+
pixelRatio: T.Validator<number | undefined>;
|
|
2019
|
+
src: T.Validator<null | string>;
|
|
2020
|
+
w: T.Validator<number>;
|
|
2021
|
+
};
|
|
2022
|
+
|
|
2065
2023
|
/**
|
|
2066
2024
|
* Validator for image shape crop data. Defines the structure for cropping an image,
|
|
2067
2025
|
* specifying the visible region within the original image bounds.
|
|
@@ -2267,6 +2225,8 @@ export declare function isCustomRecordId(typeName: string, id?: string): boolean
|
|
|
2267
2225
|
*/
|
|
2268
2226
|
export declare function isDocument(record?: UnknownRecord): record is TLDocument;
|
|
2269
2227
|
|
|
2228
|
+
/* Excluded from this release type: isFontEntry */
|
|
2229
|
+
|
|
2270
2230
|
/**
|
|
2271
2231
|
* Type guard to check if a string is a valid TLPageId.
|
|
2272
2232
|
*
|
|
@@ -2715,6 +2675,31 @@ export declare type RecordPropsType<Config extends Record<string, T.Validatable<
|
|
|
2715
2675
|
[K in keyof Config]: T.TypeOf<Config[K]>;
|
|
2716
2676
|
}>;
|
|
2717
2677
|
|
|
2678
|
+
/**
|
|
2679
|
+
* Scan theme definitions and sync color registrations to match.
|
|
2680
|
+
* A color entry is any key in `TLThemeColors` whose value is an object
|
|
2681
|
+
* (i.e. a {@link TLDefaultColor}), as opposed to utility strings like
|
|
2682
|
+
* `background` or `text`.
|
|
2683
|
+
*
|
|
2684
|
+
* Colors present in themes but not yet registered will be added.
|
|
2685
|
+
* Colors currently registered but absent from all themes will be removed.
|
|
2686
|
+
*
|
|
2687
|
+
* @public
|
|
2688
|
+
*/
|
|
2689
|
+
export declare function registerColorsFromThemes(definitions: TLThemes): void;
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* Scan theme definitions and sync font registrations to match.
|
|
2693
|
+
* A font entry is any key in `TLThemeFonts` whose value is a {@link TLThemeFont}
|
|
2694
|
+
* object (i.e. has a `fontFamily` property).
|
|
2695
|
+
*
|
|
2696
|
+
* Fonts present in themes but not yet registered will be added.
|
|
2697
|
+
* Fonts currently registered but absent from all themes will be removed.
|
|
2698
|
+
*
|
|
2699
|
+
* @public
|
|
2700
|
+
*/
|
|
2701
|
+
export declare function registerFontsFromThemes(definitions: TLThemes): void;
|
|
2702
|
+
|
|
2718
2703
|
/**
|
|
2719
2704
|
* Validator for TLRichText objects that ensures they have the correct structure
|
|
2720
2705
|
* for document-based rich text content. Validates a document with a type field
|
|
@@ -2762,7 +2747,7 @@ export declare const rootBindingMigrations: MigrationSequence;
|
|
|
2762
2747
|
export declare const rootShapeMigrations: MigrationSequence;
|
|
2763
2748
|
|
|
2764
2749
|
/**
|
|
2765
|
-
* Configuration information for a schema type (shape or
|
|
2750
|
+
* Configuration information for a schema type (shape, binding, or asset), including its properties,
|
|
2766
2751
|
* metadata, and migration sequences for data evolution over time.
|
|
2767
2752
|
*
|
|
2768
2753
|
* @public
|
|
@@ -2786,11 +2771,11 @@ export declare interface SchemaPropsInfo {
|
|
|
2786
2771
|
*/
|
|
2787
2772
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
2788
2773
|
/**
|
|
2789
|
-
* Validation schema for the shape or
|
|
2774
|
+
* Validation schema for the shape, binding, or asset properties.
|
|
2790
2775
|
*/
|
|
2791
2776
|
props?: Record<string, StoreValidator<any>>;
|
|
2792
2777
|
/**
|
|
2793
|
-
* Validation schema for metadata fields.
|
|
2778
|
+
* Validation schema for metadata fields.
|
|
2794
2779
|
*/
|
|
2795
2780
|
meta?: Record<string, StoreValidator<any>>;
|
|
2796
2781
|
}
|
|
@@ -3321,29 +3306,29 @@ export declare interface TLArrowShapeProps {
|
|
|
3321
3306
|
}
|
|
3322
3307
|
|
|
3323
3308
|
/**
|
|
3324
|
-
*
|
|
3325
|
-
*
|
|
3309
|
+
* The set of all assets that are available in the editor.
|
|
3310
|
+
*
|
|
3311
|
+
* This is the primary asset type used throughout tldraw. It includes both the
|
|
3312
|
+
* built-in default assets and any custom assets registered via
|
|
3313
|
+
* {@link TLGlobalAssetPropsMap} augmentation.
|
|
3314
|
+
*
|
|
3315
|
+
* You can use this type without a type argument to work with any asset, or pass
|
|
3316
|
+
* a specific asset type string (e.g., `'image'`, `'video'`, `'bookmark'`) to
|
|
3317
|
+
* narrow down to that specific asset type.
|
|
3326
3318
|
*
|
|
3327
3319
|
* @example
|
|
3328
3320
|
* ```ts
|
|
3329
|
-
*
|
|
3330
|
-
*
|
|
3331
|
-
*
|
|
3332
|
-
*
|
|
3333
|
-
*
|
|
3334
|
-
* src: 'https://example.com/image.jpg',
|
|
3335
|
-
* w: 800,
|
|
3336
|
-
* h: 600,
|
|
3337
|
-
* mimeType: 'image/jpeg',
|
|
3338
|
-
* isAnimated: false
|
|
3339
|
-
* },
|
|
3340
|
-
* meta: {}
|
|
3321
|
+
* // Register a custom asset type
|
|
3322
|
+
* declare module '@tldraw/tlschema' {
|
|
3323
|
+
* interface TLGlobalAssetPropsMap {
|
|
3324
|
+
* file: { name: string; size: number; mimeType: string; src: string | null }
|
|
3325
|
+
* }
|
|
3341
3326
|
* }
|
|
3342
3327
|
* ```
|
|
3343
3328
|
*
|
|
3344
3329
|
* @public
|
|
3345
3330
|
*/
|
|
3346
|
-
export declare type TLAsset =
|
|
3331
|
+
export declare type TLAsset<K extends keyof TLIndexedAssets = keyof TLIndexedAssets> = TLIndexedAssets[K];
|
|
3347
3332
|
|
|
3348
3333
|
/**
|
|
3349
3334
|
* Context information provided when resolving asset URLs, containing details about
|
|
@@ -3397,27 +3382,15 @@ export declare interface TLAssetContext {
|
|
|
3397
3382
|
|
|
3398
3383
|
/**
|
|
3399
3384
|
* Branded string type for asset record identifiers.
|
|
3400
|
-
* Prevents mixing asset IDs with other
|
|
3385
|
+
* Prevents mixing asset IDs with other record IDs at compile time.
|
|
3401
3386
|
*
|
|
3402
3387
|
* @example
|
|
3403
3388
|
* ```ts
|
|
3404
|
-
*
|
|
3405
|
-
*
|
|
3406
|
-
* // Create a new asset ID
|
|
3407
|
-
* const assetId: TLAssetId = createAssetId()
|
|
3408
|
-
*
|
|
3409
|
-
* // Use in asset records
|
|
3410
|
-
* const asset: TLAsset = {
|
|
3411
|
-
* id: assetId,
|
|
3412
|
-
* // ... other properties
|
|
3413
|
-
* }
|
|
3414
|
-
*
|
|
3415
|
-
* // Reference in shapes
|
|
3416
|
-
* const imageShape: TLImageShape = {
|
|
3389
|
+
* const imageShape = {
|
|
3390
|
+
* type: 'image',
|
|
3417
3391
|
* props: {
|
|
3418
|
-
* assetId:
|
|
3419
|
-
*
|
|
3420
|
-
* }
|
|
3392
|
+
* assetId: 'asset:image123' as TLAssetId,
|
|
3393
|
+
* },
|
|
3421
3394
|
* }
|
|
3422
3395
|
* ```
|
|
3423
3396
|
*
|
|
@@ -3436,8 +3409,8 @@ export declare type TLAssetId = RecordId<TLBaseAsset<any, any>>;
|
|
|
3436
3409
|
* id: 'asset:image123',
|
|
3437
3410
|
* type: 'image',
|
|
3438
3411
|
* props: {
|
|
3439
|
-
* w: 800 // Only updating width
|
|
3440
|
-
* }
|
|
3412
|
+
* w: 800, // Only updating width
|
|
3413
|
+
* },
|
|
3441
3414
|
* }
|
|
3442
3415
|
*
|
|
3443
3416
|
* // Use in asset updates
|
|
@@ -3459,20 +3432,12 @@ export declare type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T ?
|
|
|
3459
3432
|
*
|
|
3460
3433
|
* @example
|
|
3461
3434
|
* ```ts
|
|
3462
|
-
* // Function that works with any asset-based shape
|
|
3463
3435
|
* function handleAssetShape(shape: TLAssetShape) {
|
|
3464
3436
|
* const assetId = shape.props.assetId
|
|
3465
|
-
* if (assetId)
|
|
3466
|
-
*
|
|
3467
|
-
*
|
|
3468
|
-
* }
|
|
3437
|
+
* if (!assetId) return
|
|
3438
|
+
* const asset = editor.getAsset(assetId)
|
|
3439
|
+
* // Handle the asset...
|
|
3469
3440
|
* }
|
|
3470
|
-
*
|
|
3471
|
-
* // Use with image or video shapes
|
|
3472
|
-
* const imageShape: TLImageShape = { props: { assetId: 'asset:img1' } }
|
|
3473
|
-
* const videoShape: TLVideoShape = { props: { assetId: 'asset:vid1' } }
|
|
3474
|
-
* handleAssetShape(imageShape) // Works
|
|
3475
|
-
* handleAssetShape(videoShape) // Works
|
|
3476
3441
|
* ```
|
|
3477
3442
|
*
|
|
3478
3443
|
* @public
|
|
@@ -4067,6 +4032,31 @@ export declare type TLCursorType = SetValue<typeof TL_CURSOR_TYPES>;
|
|
|
4067
4032
|
*/
|
|
4068
4033
|
export declare type TLCustomRecord = TLIndexedRecords[keyof TLIndexedRecords];
|
|
4069
4034
|
|
|
4035
|
+
/**
|
|
4036
|
+
* The default set of asset types that are available in the editor.
|
|
4037
|
+
*
|
|
4038
|
+
* @example
|
|
4039
|
+
* ```ts
|
|
4040
|
+
* const imageAsset: TLDefaultAsset = {
|
|
4041
|
+
* id: 'asset:image123',
|
|
4042
|
+
* typeName: 'asset',
|
|
4043
|
+
* type: 'image',
|
|
4044
|
+
* props: {
|
|
4045
|
+
* src: 'https://example.com/image.jpg',
|
|
4046
|
+
* w: 800,
|
|
4047
|
+
* h: 600,
|
|
4048
|
+
* mimeType: 'image/jpeg',
|
|
4049
|
+
* isAnimated: false,
|
|
4050
|
+
* name: 'image.jpg',
|
|
4051
|
+
* },
|
|
4052
|
+
* meta: {},
|
|
4053
|
+
* }
|
|
4054
|
+
* ```
|
|
4055
|
+
*
|
|
4056
|
+
* @public
|
|
4057
|
+
*/
|
|
4058
|
+
export declare type TLDefaultAsset = TLBookmarkAsset | TLImageAsset | TLVideoAsset;
|
|
4059
|
+
|
|
4070
4060
|
/**
|
|
4071
4061
|
* The default set of bindings that are available in the editor.
|
|
4072
4062
|
* Currently includes only arrow bindings, but can be extended with custom bindings.
|
|
@@ -4093,56 +4083,6 @@ export declare type TLCustomRecord = TLIndexedRecords[keyof TLIndexedRecords];
|
|
|
4093
4083
|
*/
|
|
4094
4084
|
export declare type TLDefaultBinding = TLArrowBinding;
|
|
4095
4085
|
|
|
4096
|
-
/**
|
|
4097
|
-
* Type representing a default color style value.
|
|
4098
|
-
* This is a union type of all available default color names.
|
|
4099
|
-
*
|
|
4100
|
-
* @example
|
|
4101
|
-
* ```ts
|
|
4102
|
-
* import { TLDefaultColorStyle } from '@tldraw/tlschema'
|
|
4103
|
-
*
|
|
4104
|
-
* // Valid color values
|
|
4105
|
-
* const redColor: TLDefaultColorStyle = 'red'
|
|
4106
|
-
* const blueColor: TLDefaultColorStyle = 'blue'
|
|
4107
|
-
*
|
|
4108
|
-
* // Type guard usage
|
|
4109
|
-
* function isValidColor(color: string): color is TLDefaultColorStyle {
|
|
4110
|
-
* return ['black', 'red', 'blue'].includes(color as TLDefaultColorStyle)
|
|
4111
|
-
* }
|
|
4112
|
-
* ```
|
|
4113
|
-
*
|
|
4114
|
-
* @public
|
|
4115
|
-
*/
|
|
4116
|
-
export declare type TLDefaultColorStyle = T.TypeOf<typeof DefaultColorStyle>;
|
|
4117
|
-
|
|
4118
|
-
/**
|
|
4119
|
-
* Complete color theme definition containing all colors and their variants
|
|
4120
|
-
* for either light or dark mode. Includes base theme properties and all
|
|
4121
|
-
* default colors with their respective color variants.
|
|
4122
|
-
*
|
|
4123
|
-
* @example
|
|
4124
|
-
* ```ts
|
|
4125
|
-
* import { TLDefaultColorTheme } from '@tldraw/tlschema'
|
|
4126
|
-
*
|
|
4127
|
-
* const customTheme: TLDefaultColorTheme = {
|
|
4128
|
-
* id: 'light',
|
|
4129
|
-
* text: '#000000',
|
|
4130
|
-
* background: '#ffffff',
|
|
4131
|
-
* solid: '#fcfffe',
|
|
4132
|
-
* black: { solid: '#000000', semi: '#cccccc', ... },
|
|
4133
|
-
* // ... other colors
|
|
4134
|
-
* }
|
|
4135
|
-
* ```
|
|
4136
|
-
*
|
|
4137
|
-
* @public
|
|
4138
|
-
*/
|
|
4139
|
-
export declare type TLDefaultColorTheme = Expand<{
|
|
4140
|
-
background: string;
|
|
4141
|
-
id: 'dark' | 'light';
|
|
4142
|
-
solid: string;
|
|
4143
|
-
text: string;
|
|
4144
|
-
} & Record<(typeof defaultColorNames)[number], TLDefaultColorThemeColor>>;
|
|
4145
|
-
|
|
4146
4086
|
/**
|
|
4147
4087
|
* Defines the color variants available for each color in the default theme.
|
|
4148
4088
|
* Each color has multiple variants for different use cases like fills, strokes,
|
|
@@ -4150,9 +4090,9 @@ export declare type TLDefaultColorTheme = Expand<{
|
|
|
4150
4090
|
*
|
|
4151
4091
|
* @example
|
|
4152
4092
|
* ```ts
|
|
4153
|
-
* import {
|
|
4093
|
+
* import { TLDefaultColor } from '@tldraw/tlschema'
|
|
4154
4094
|
*
|
|
4155
|
-
* const blueColor:
|
|
4095
|
+
* const blueColor: TLDefaultColor = {
|
|
4156
4096
|
* solid: '#4465e9',
|
|
4157
4097
|
* semi: '#dce1f8',
|
|
4158
4098
|
* pattern: '#6681ee',
|
|
@@ -4163,7 +4103,7 @@ export declare type TLDefaultColorTheme = Expand<{
|
|
|
4163
4103
|
*
|
|
4164
4104
|
* @public
|
|
4165
4105
|
*/
|
|
4166
|
-
export declare interface
|
|
4106
|
+
export declare interface TLDefaultColor {
|
|
4167
4107
|
solid: string;
|
|
4168
4108
|
semi: string;
|
|
4169
4109
|
pattern: string;
|
|
@@ -4180,6 +4120,16 @@ export declare interface TLDefaultColorThemeColor {
|
|
|
4180
4120
|
highlightP3: string;
|
|
4181
4121
|
}
|
|
4182
4122
|
|
|
4123
|
+
/**
|
|
4124
|
+
* The names of all available shape colors, derived from {@link TLThemeDefaultColors}.
|
|
4125
|
+
* Extend {@link TLThemeDefaultColors} to add custom color names.
|
|
4126
|
+
*
|
|
4127
|
+
* @public
|
|
4128
|
+
*/
|
|
4129
|
+
export declare type TLDefaultColorStyle = {
|
|
4130
|
+
[K in keyof TLThemeDefaultColors]: TLThemeDefaultColors[K] extends TLDefaultColor ? K : never;
|
|
4131
|
+
}[keyof TLThemeDefaultColors] & string;
|
|
4132
|
+
|
|
4183
4133
|
/**
|
|
4184
4134
|
* Type representing a default dash style value.
|
|
4185
4135
|
* This is a union type of all available dash style options.
|
|
@@ -4228,8 +4178,8 @@ export declare type TLDefaultDashStyle = T.TypeOf<typeof DefaultDashStyle>;
|
|
|
4228
4178
|
export declare type TLDefaultFillStyle = T.TypeOf<typeof DefaultFillStyle>;
|
|
4229
4179
|
|
|
4230
4180
|
/**
|
|
4231
|
-
*
|
|
4232
|
-
*
|
|
4181
|
+
* The names of all available font styles, derived from {@link TLThemeFonts}.
|
|
4182
|
+
* Extend {@link TLThemeFonts} to add custom font names.
|
|
4233
4183
|
*
|
|
4234
4184
|
* @example
|
|
4235
4185
|
* ```ts
|
|
@@ -4249,7 +4199,7 @@ export declare type TLDefaultFillStyle = T.TypeOf<typeof DefaultFillStyle>;
|
|
|
4249
4199
|
*
|
|
4250
4200
|
* @public
|
|
4251
4201
|
*/
|
|
4252
|
-
export declare type TLDefaultFontStyle =
|
|
4202
|
+
export declare type TLDefaultFontStyle = keyof TLThemeFonts & string;
|
|
4253
4203
|
|
|
4254
4204
|
/**
|
|
4255
4205
|
* Type representing a default horizontal alignment style value.
|
|
@@ -4561,6 +4511,72 @@ export declare interface TLEmbedShapeProps {
|
|
|
4561
4511
|
url: string;
|
|
4562
4512
|
}
|
|
4563
4513
|
|
|
4514
|
+
/**
|
|
4515
|
+
* A font face that can be used in the editor. The properties of this are largely the same as the
|
|
4516
|
+
* ones in the
|
|
4517
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face | css `@font-face` rule}.
|
|
4518
|
+
* @public
|
|
4519
|
+
*/
|
|
4520
|
+
export declare interface TLFontFace {
|
|
4521
|
+
/**
|
|
4522
|
+
* How this font can be referred to in CSS.
|
|
4523
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family | `font-family`}.
|
|
4524
|
+
*/
|
|
4525
|
+
readonly family: string;
|
|
4526
|
+
/**
|
|
4527
|
+
* The source of the font. This
|
|
4528
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`}.
|
|
4529
|
+
*/
|
|
4530
|
+
readonly src: TLFontFaceSource;
|
|
4531
|
+
/**
|
|
4532
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override | `ascent-override`}.
|
|
4533
|
+
*/
|
|
4534
|
+
readonly ascentOverride?: string;
|
|
4535
|
+
/**
|
|
4536
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/descent-override | `descent-override`}.
|
|
4537
|
+
*/
|
|
4538
|
+
readonly descentOverride?: string;
|
|
4539
|
+
/**
|
|
4540
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch | `font-stretch`}.
|
|
4541
|
+
*/
|
|
4542
|
+
readonly stretch?: string;
|
|
4543
|
+
/**
|
|
4544
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style | `font-style`}.
|
|
4545
|
+
*/
|
|
4546
|
+
readonly style?: string;
|
|
4547
|
+
/**
|
|
4548
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight | `font-weight`}.
|
|
4549
|
+
*/
|
|
4550
|
+
readonly weight?: string;
|
|
4551
|
+
/**
|
|
4552
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings | `font-feature-settings`}.
|
|
4553
|
+
*/
|
|
4554
|
+
readonly featureSettings?: string;
|
|
4555
|
+
/**
|
|
4556
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/line-gap-override | `line-gap-override`}.
|
|
4557
|
+
*/
|
|
4558
|
+
readonly lineGapOverride?: string;
|
|
4559
|
+
/**
|
|
4560
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range | `unicode-range`}.
|
|
4561
|
+
*/
|
|
4562
|
+
readonly unicodeRange?: string;
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
/**
|
|
4566
|
+
* Represents the `src` property of a {@link TLFontFace}.
|
|
4567
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`} for details of the properties here.
|
|
4568
|
+
* @public
|
|
4569
|
+
*/
|
|
4570
|
+
export declare interface TLFontFaceSource {
|
|
4571
|
+
/**
|
|
4572
|
+
* A URL from which to load the font. If the value here is a key in
|
|
4573
|
+
* {@link tldraw#TLEditorAssetUrls.fonts}, the value from there will be used instead.
|
|
4574
|
+
*/
|
|
4575
|
+
url: string;
|
|
4576
|
+
format?: string;
|
|
4577
|
+
tech?: string;
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4564
4580
|
/**
|
|
4565
4581
|
* A frame shape provides a container for organizing and grouping other shapes.
|
|
4566
4582
|
* Frames can be used to create sections, organize content, or define specific areas.
|
|
@@ -4693,6 +4709,10 @@ export declare interface TLGeoShapeProps {
|
|
|
4693
4709
|
richText: TLRichText;
|
|
4694
4710
|
}
|
|
4695
4711
|
|
|
4712
|
+
/** @public */
|
|
4713
|
+
export declare interface TLGlobalAssetPropsMap {
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4696
4716
|
/** @public */
|
|
4697
4717
|
export declare interface TLGlobalBindingPropsMap {
|
|
4698
4718
|
}
|
|
@@ -5018,6 +5038,13 @@ export declare interface TLImageShapeProps {
|
|
|
5018
5038
|
altText: string;
|
|
5019
5039
|
}
|
|
5020
5040
|
|
|
5041
|
+
/** @public */
|
|
5042
|
+
export declare type TLIndexedAssets = {
|
|
5043
|
+
[K in keyof TLGlobalAssetPropsMap | TLDefaultAsset['type'] as K extends TLDefaultAsset['type'] ? K extends keyof TLGlobalAssetPropsMap ? TLGlobalAssetPropsMap[K] extends null | undefined ? never : K : K : K]: K extends TLDefaultAsset['type'] ? K extends keyof TLGlobalAssetPropsMap ? TLBaseAsset<K, TLGlobalAssetPropsMap[K]> : Extract<TLDefaultAsset, {
|
|
5044
|
+
type: K;
|
|
5045
|
+
}> : TLBaseAsset<K, TLGlobalAssetPropsMap[K & keyof TLGlobalAssetPropsMap]>;
|
|
5046
|
+
};
|
|
5047
|
+
|
|
5021
5048
|
/** @public */
|
|
5022
5049
|
export declare type TLIndexedBindings = {
|
|
5023
5050
|
[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, {
|
|
@@ -5415,7 +5442,7 @@ export declare type TLLineShapeSplineStyle = T.TypeOf<typeof LineShapeSplineStyl
|
|
|
5415
5442
|
* labelColor: 'black',
|
|
5416
5443
|
* size: 's',
|
|
5417
5444
|
* font: 'sans',
|
|
5418
|
-
* fontSizeAdjustment:
|
|
5445
|
+
* fontSizeAdjustment: 0.85,
|
|
5419
5446
|
* align: 'start',
|
|
5420
5447
|
* verticalAlign: 'start',
|
|
5421
5448
|
* growY: 50,
|
|
@@ -5442,7 +5469,7 @@ export declare type TLNoteShape = TLBaseShape<'note', TLNoteShapeProps>;
|
|
|
5442
5469
|
* labelColor: 'black',
|
|
5443
5470
|
* size: 'm',
|
|
5444
5471
|
* font: 'draw',
|
|
5445
|
-
* fontSizeAdjustment:
|
|
5472
|
+
* fontSizeAdjustment: null,
|
|
5446
5473
|
* align: 'middle',
|
|
5447
5474
|
* verticalAlign: 'middle',
|
|
5448
5475
|
* growY: 0,
|
|
@@ -5461,8 +5488,8 @@ export declare interface TLNoteShapeProps {
|
|
|
5461
5488
|
size: TLDefaultSizeStyle;
|
|
5462
5489
|
/** Font family style for the note text */
|
|
5463
5490
|
font: TLDefaultFontStyle;
|
|
5464
|
-
/**
|
|
5465
|
-
fontSizeAdjustment: number;
|
|
5491
|
+
/** Ratio to scale the base font size when text needs to shrink to fit. Null means needs recomputation, 1 means no adjustment, and values less than 1 indicate shrinkage. */
|
|
5492
|
+
fontSizeAdjustment: null | number;
|
|
5466
5493
|
/** Horizontal alignment of text within the note */
|
|
5467
5494
|
align: TLDefaultHorizontalAlignStyle;
|
|
5468
5495
|
/** Vertical alignment of text within the note */
|
|
@@ -5749,6 +5776,25 @@ export declare interface TLPropsMigrations {
|
|
|
5749
5776
|
*/
|
|
5750
5777
|
export declare type TLRecord = TLCustomRecord | TLDefaultRecord;
|
|
5751
5778
|
|
|
5779
|
+
/**
|
|
5780
|
+
* Augment this interface to remove built-in palette colors from themes.
|
|
5781
|
+
* Each key you add will be omitted from {@link TLThemeColors}.
|
|
5782
|
+
*
|
|
5783
|
+
* @example
|
|
5784
|
+
* ```ts
|
|
5785
|
+
* declare module '@tldraw/tlschema' {
|
|
5786
|
+
* interface TLRemovedDefaultThemeColors {
|
|
5787
|
+
* 'light-violet': true
|
|
5788
|
+
* 'light-blue': true
|
|
5789
|
+
* }
|
|
5790
|
+
* }
|
|
5791
|
+
* ```
|
|
5792
|
+
*
|
|
5793
|
+
* @public
|
|
5794
|
+
*/
|
|
5795
|
+
export declare interface TLRemovedDefaultThemeColors {
|
|
5796
|
+
}
|
|
5797
|
+
|
|
5752
5798
|
/**
|
|
5753
5799
|
* Type representing rich text content in tldraw. Rich text follows a document-based
|
|
5754
5800
|
* structure with a root document containing an array of content blocks (paragraphs,
|
|
@@ -6151,6 +6197,190 @@ export declare interface TLTextShapeProps {
|
|
|
6151
6197
|
autoSize: boolean;
|
|
6152
6198
|
}
|
|
6153
6199
|
|
|
6200
|
+
/**
|
|
6201
|
+
* A theme definition containing shared properties and color/font palettes for
|
|
6202
|
+
* both light and dark modes.
|
|
6203
|
+
*
|
|
6204
|
+
* To remove palette colors from themes, augment {@link TLRemovedDefaultThemeColors}.
|
|
6205
|
+
* UI colors (`text`, `background`, `negativeSpace`, `solid`, `cursor`, `noteBorder`)
|
|
6206
|
+
* are always required.
|
|
6207
|
+
*
|
|
6208
|
+
* @example
|
|
6209
|
+
* ```ts
|
|
6210
|
+
* const myTheme: TLTheme = {
|
|
6211
|
+
* id: 'custom',
|
|
6212
|
+
* fontSize: 16,
|
|
6213
|
+
* lineHeight: 1.35,
|
|
6214
|
+
* strokeWidth: 2,
|
|
6215
|
+
* fonts: DEFAULT_THEME.fonts,
|
|
6216
|
+
* colors: {
|
|
6217
|
+
* light: { ... },
|
|
6218
|
+
* dark: { ... },
|
|
6219
|
+
* },
|
|
6220
|
+
* }
|
|
6221
|
+
* editor.updateTheme(myTheme)
|
|
6222
|
+
* ```
|
|
6223
|
+
*
|
|
6224
|
+
* @public
|
|
6225
|
+
*/
|
|
6226
|
+
export declare interface TLTheme {
|
|
6227
|
+
/** Unique identifier for this theme. Used as the key in the theme registry. */
|
|
6228
|
+
id: TLThemeId;
|
|
6229
|
+
/** Base font size in pixels. Shape font sizes are derived by multiplying this value. */
|
|
6230
|
+
fontSize: number;
|
|
6231
|
+
/** Base line height multiplier. */
|
|
6232
|
+
lineHeight: number;
|
|
6233
|
+
/** Base stroke width in pixels. Shape stroke widths are derived by multiplying this value. */
|
|
6234
|
+
strokeWidth: number;
|
|
6235
|
+
/** Font definitions. Individual fonts may be absent if removed by a custom theme. */
|
|
6236
|
+
fonts: TLThemeFonts;
|
|
6237
|
+
colors: {
|
|
6238
|
+
dark: TLThemeColors;
|
|
6239
|
+
light: TLThemeColors;
|
|
6240
|
+
};
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6243
|
+
/**
|
|
6244
|
+
* A color palette for one color mode. UI colors are always required.
|
|
6245
|
+
* Palette colors removed via {@link TLRemovedDefaultThemeColors} are omitted.
|
|
6246
|
+
*
|
|
6247
|
+
* @public
|
|
6248
|
+
*/
|
|
6249
|
+
export declare type TLThemeColors = Pick<TLThemeDefaultColors, TLThemeUiColorKeys> & Omit<TLThemeDefaultColors, keyof TLRemovedDefaultThemeColors | TLThemeUiColorKeys>;
|
|
6250
|
+
|
|
6251
|
+
/**
|
|
6252
|
+
* The color palette for a theme. Contains base UI colors (as strings) and
|
|
6253
|
+
* named shape colors (as {@link TLDefaultColor} objects).
|
|
6254
|
+
*
|
|
6255
|
+
* Extend this interface via module augmentation to add custom colors:
|
|
6256
|
+
*
|
|
6257
|
+
* @example
|
|
6258
|
+
* ```ts
|
|
6259
|
+
* declare module '@tldraw/tlschema' {
|
|
6260
|
+
* interface TLThemeColors {
|
|
6261
|
+
* pink: TLDefaultColor
|
|
6262
|
+
* }
|
|
6263
|
+
* }
|
|
6264
|
+
* ```
|
|
6265
|
+
*
|
|
6266
|
+
* @public
|
|
6267
|
+
*/
|
|
6268
|
+
export declare interface TLThemeDefaultColors {
|
|
6269
|
+
text: string;
|
|
6270
|
+
background: string;
|
|
6271
|
+
negativeSpace: string;
|
|
6272
|
+
solid: string;
|
|
6273
|
+
cursor: string;
|
|
6274
|
+
noteBorder: string;
|
|
6275
|
+
black: TLDefaultColor;
|
|
6276
|
+
grey: TLDefaultColor;
|
|
6277
|
+
'light-violet': TLDefaultColor;
|
|
6278
|
+
violet: TLDefaultColor;
|
|
6279
|
+
blue: TLDefaultColor;
|
|
6280
|
+
'light-blue': TLDefaultColor;
|
|
6281
|
+
yellow: TLDefaultColor;
|
|
6282
|
+
orange: TLDefaultColor;
|
|
6283
|
+
green: TLDefaultColor;
|
|
6284
|
+
'light-green': TLDefaultColor;
|
|
6285
|
+
'light-red': TLDefaultColor;
|
|
6286
|
+
red: TLDefaultColor;
|
|
6287
|
+
white: TLDefaultColor;
|
|
6288
|
+
}
|
|
6289
|
+
|
|
6290
|
+
/**
|
|
6291
|
+
* A font definition within a theme. Maps a font style name to a CSS font-family
|
|
6292
|
+
* declaration and optional font face descriptors for loading.
|
|
6293
|
+
*
|
|
6294
|
+
* @example
|
|
6295
|
+
* ```ts
|
|
6296
|
+
* import { TLThemeFont } from '@tldraw/tlschema'
|
|
6297
|
+
*
|
|
6298
|
+
* const customSans: TLThemeFont = {
|
|
6299
|
+
* fontFamily: "'Inter', sans-serif",
|
|
6300
|
+
* faces: [
|
|
6301
|
+
* { family: 'Inter', src: { url: 'https://example.com/Inter-Regular.woff2', format: 'woff2' }, weight: 'normal' },
|
|
6302
|
+
* { family: 'Inter', src: { url: 'https://example.com/Inter-Bold.woff2', format: 'woff2' }, weight: 'bold' },
|
|
6303
|
+
* ]
|
|
6304
|
+
* }
|
|
6305
|
+
* ```
|
|
6306
|
+
*
|
|
6307
|
+
* @public
|
|
6308
|
+
*/
|
|
6309
|
+
export declare interface TLThemeFont {
|
|
6310
|
+
/** CSS font-family declaration, e.g. `"'Inter', sans-serif"` */
|
|
6311
|
+
fontFamily: string;
|
|
6312
|
+
/** Font face definitions for loading. Omit for system fonts that don't need loading. */
|
|
6313
|
+
faces?: TLFontFace[];
|
|
6314
|
+
/**
|
|
6315
|
+
* Icon for the style panel. Accepts a string icon ID (resolved via `assetUrls.icons`)
|
|
6316
|
+
* or a React element (`TLUiIconJsx`). Defaults to the built-in icon for known fonts,
|
|
6317
|
+
* or `'font-draw'` for custom fonts.
|
|
6318
|
+
*/
|
|
6319
|
+
icon?: unknown;
|
|
6320
|
+
}
|
|
6321
|
+
|
|
6322
|
+
/**
|
|
6323
|
+
* The font palette for a theme. Contains named font definitions mapping font style
|
|
6324
|
+
* names to their CSS font-family strings and font face descriptors.
|
|
6325
|
+
*
|
|
6326
|
+
* Extend this interface via module augmentation to add custom fonts:
|
|
6327
|
+
*
|
|
6328
|
+
* @example
|
|
6329
|
+
* ```ts
|
|
6330
|
+
* declare module '@tldraw/tlschema' {
|
|
6331
|
+
* interface TLThemeFonts {
|
|
6332
|
+
* cursive: TLThemeFont
|
|
6333
|
+
* }
|
|
6334
|
+
* }
|
|
6335
|
+
* ```
|
|
6336
|
+
*
|
|
6337
|
+
* @public
|
|
6338
|
+
*/
|
|
6339
|
+
export declare interface TLThemeFonts {
|
|
6340
|
+
draw: TLThemeFont;
|
|
6341
|
+
sans: TLThemeFont;
|
|
6342
|
+
serif: TLThemeFont;
|
|
6343
|
+
mono: TLThemeFont;
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6346
|
+
/** @public */
|
|
6347
|
+
export declare type TLThemeId = keyof TLThemes & string;
|
|
6348
|
+
|
|
6349
|
+
/**
|
|
6350
|
+
* A registry of available themes. Extend this interface via module
|
|
6351
|
+
* augmentation to register custom themes for type-safe theme IDs.
|
|
6352
|
+
*
|
|
6353
|
+
* @example
|
|
6354
|
+
* ```ts
|
|
6355
|
+
* declare module '@tldraw/tlschema' {
|
|
6356
|
+
* interface TLThemes {
|
|
6357
|
+
* corporate: TLTheme
|
|
6358
|
+
* }
|
|
6359
|
+
* }
|
|
6360
|
+
* ```
|
|
6361
|
+
*
|
|
6362
|
+
* @public
|
|
6363
|
+
*/
|
|
6364
|
+
export declare interface TLThemes {
|
|
6365
|
+
default: TLTheme;
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
/**
|
|
6369
|
+
* Keys in {@link TLThemeDefaultColors} that are required UI infrastructure colors
|
|
6370
|
+
* and cannot be removed via {@link TLRemovedDefaultThemeColors}.
|
|
6371
|
+
*
|
|
6372
|
+
* @public
|
|
6373
|
+
*/
|
|
6374
|
+
export declare type TLThemeUiColorKeys = 'background' | 'cursor' | 'negativeSpace' | 'noteBorder' | 'solid' | 'text';
|
|
6375
|
+
|
|
6376
|
+
/**
|
|
6377
|
+
* A type for an asset that is available in the editor but whose type is
|
|
6378
|
+
* unknown—either one of the editor's default assets or else a custom asset.
|
|
6379
|
+
*
|
|
6380
|
+
* @public
|
|
6381
|
+
*/
|
|
6382
|
+
export declare type TLUnknownAsset = TLBaseAsset<string, object>;
|
|
6383
|
+
|
|
6154
6384
|
/**
|
|
6155
6385
|
* A type for a binding that is available in the editor but whose type is
|
|
6156
6386
|
* unknown—either one of the editor's default bindings or else a custom binding.
|
|
@@ -6467,6 +6697,34 @@ export declare interface VecModel {
|
|
|
6467
6697
|
*/
|
|
6468
6698
|
export declare const vecModelValidator: T.ObjectValidator<VecModel>;
|
|
6469
6699
|
|
|
6700
|
+
/**
|
|
6701
|
+
* Migration sequence for video assets that handles schema evolution over time.
|
|
6702
|
+
* This sequence defines how video asset data should be transformed when upgrading
|
|
6703
|
+
* or downgrading between different schema versions. Each migration step handles
|
|
6704
|
+
* specific changes like adding properties, renaming fields, or changing data formats.
|
|
6705
|
+
*
|
|
6706
|
+
* The migrations handle:
|
|
6707
|
+
* - Adding animation detection (isAnimated property)
|
|
6708
|
+
* - Renaming width/height properties to w/h for consistency
|
|
6709
|
+
* - Ensuring URL validity for src properties
|
|
6710
|
+
* - Adding file size tracking
|
|
6711
|
+
* - Making file size optional for backward compatibility
|
|
6712
|
+
*
|
|
6713
|
+
* @public
|
|
6714
|
+
*/
|
|
6715
|
+
export declare const videoAssetMigrations: MigrationSequence;
|
|
6716
|
+
|
|
6717
|
+
/** @public */
|
|
6718
|
+
export declare const videoAssetProps: {
|
|
6719
|
+
fileSize: T.Validator<number | undefined>;
|
|
6720
|
+
h: T.Validator<number>;
|
|
6721
|
+
isAnimated: T.Validator<boolean>;
|
|
6722
|
+
mimeType: T.Validator<null | string>;
|
|
6723
|
+
name: T.Validator<string>;
|
|
6724
|
+
src: T.Validator<null | string>;
|
|
6725
|
+
w: T.Validator<number>;
|
|
6726
|
+
};
|
|
6727
|
+
|
|
6470
6728
|
/**
|
|
6471
6729
|
* Migration sequence for video shape schema evolution. This handles transforming
|
|
6472
6730
|
* video shape data between different versions as the schema evolves over time.
|