@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
|
@@ -35,7 +35,7 @@ import { StyleProp } from './StyleProp'
|
|
|
35
35
|
*/
|
|
36
36
|
export const DefaultDashStyle = StyleProp.defineEnum('tldraw:dash', {
|
|
37
37
|
defaultValue: 'draw',
|
|
38
|
-
values: ['draw', 'solid', 'dashed', 'dotted'],
|
|
38
|
+
values: ['draw', 'solid', 'dashed', 'dotted', 'none'],
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the `src` property of a {@link TLFontFace}.
|
|
3
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`} for details of the properties here.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface TLFontFaceSource {
|
|
7
|
+
/**
|
|
8
|
+
* A URL from which to load the font. If the value here is a key in
|
|
9
|
+
* {@link tldraw#TLEditorAssetUrls.fonts}, the value from there will be used instead.
|
|
10
|
+
*/
|
|
11
|
+
url: string
|
|
12
|
+
format?: string
|
|
13
|
+
tech?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A font face that can be used in the editor. The properties of this are largely the same as the
|
|
18
|
+
* ones in the
|
|
19
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face | css `@font-face` rule}.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface TLFontFace {
|
|
23
|
+
/**
|
|
24
|
+
* How this font can be referred to in CSS.
|
|
25
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family | `font-family`}.
|
|
26
|
+
*/
|
|
27
|
+
readonly family: string
|
|
28
|
+
/**
|
|
29
|
+
* The source of the font. This
|
|
30
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`}.
|
|
31
|
+
*/
|
|
32
|
+
readonly src: TLFontFaceSource
|
|
33
|
+
/**
|
|
34
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override | `ascent-override`}.
|
|
35
|
+
*/
|
|
36
|
+
readonly ascentOverride?: string
|
|
37
|
+
/**
|
|
38
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/descent-override | `descent-override`}.
|
|
39
|
+
*/
|
|
40
|
+
readonly descentOverride?: string
|
|
41
|
+
/**
|
|
42
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch | `font-stretch`}.
|
|
43
|
+
*/
|
|
44
|
+
readonly stretch?: string
|
|
45
|
+
/**
|
|
46
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style | `font-style`}.
|
|
47
|
+
*/
|
|
48
|
+
readonly style?: string
|
|
49
|
+
/**
|
|
50
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight | `font-weight`}.
|
|
51
|
+
*/
|
|
52
|
+
readonly weight?: string
|
|
53
|
+
/**
|
|
54
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings | `font-feature-settings`}.
|
|
55
|
+
*/
|
|
56
|
+
readonly featureSettings?: string
|
|
57
|
+
/**
|
|
58
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/line-gap-override | `line-gap-override`}.
|
|
59
|
+
*/
|
|
60
|
+
readonly lineGapOverride?: string
|
|
61
|
+
/**
|
|
62
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range | `unicode-range`}.
|
|
63
|
+
*/
|
|
64
|
+
readonly unicodeRange?: string
|
|
65
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T } from '@tldraw/validate'
|
|
2
1
|
import { StyleProp } from './StyleProp'
|
|
2
|
+
import { TLThemeFont, TLThemeFonts, TLThemes } from './TLTheme'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Default font style property used by tldraw shapes for text styling.
|
|
@@ -39,8 +39,8 @@ export const DefaultFontStyle = StyleProp.defineEnum('tldraw:font', {
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* The names of all available font styles, derived from {@link TLThemeFonts}.
|
|
43
|
+
* Extend {@link TLThemeFonts} to add custom font names.
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
@@ -60,7 +60,7 @@ export const DefaultFontStyle = StyleProp.defineEnum('tldraw:font', {
|
|
|
60
60
|
*
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
|
-
export type TLDefaultFontStyle =
|
|
63
|
+
export type TLDefaultFontStyle = keyof TLThemeFonts & string
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Mapping of font style names to their corresponding CSS font-family declarations.
|
|
@@ -86,3 +86,52 @@ export const DefaultFontFamilies = {
|
|
|
86
86
|
serif: "'tldraw_serif', serif",
|
|
87
87
|
mono: "'tldraw_mono', monospace",
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
export function isFontEntry(value: unknown): value is TLThemeFont {
|
|
92
|
+
return typeof value === 'object' && value !== null && 'fontFamily' in value
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Scan theme definitions and sync font registrations to match.
|
|
97
|
+
* A font entry is any key in `TLThemeFonts` whose value is a {@link TLThemeFont}
|
|
98
|
+
* object (i.e. has a `fontFamily` property).
|
|
99
|
+
*
|
|
100
|
+
* Fonts present in themes but not yet registered will be added.
|
|
101
|
+
* Fonts currently registered but absent from all themes will be removed.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export function registerFontsFromThemes(definitions: TLThemes): void {
|
|
106
|
+
const fontNames = new Set<string>()
|
|
107
|
+
for (const def of Object.values(definitions)) {
|
|
108
|
+
if (!def.fonts) continue
|
|
109
|
+
for (const [key, value] of Object.entries(def.fonts)) {
|
|
110
|
+
if (isFontEntry(value)) {
|
|
111
|
+
fontNames.add(key)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const toAdd = [...fontNames].filter((v) => !DefaultFontStyle.values.includes(v as any))
|
|
117
|
+
if (toAdd.length > 0) {
|
|
118
|
+
DefaultFontStyle.addValues(...(toAdd as any))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const toRemove = DefaultFontStyle.values.filter((v) => !fontNames.has(v as string))
|
|
122
|
+
if (toRemove.length > 0) {
|
|
123
|
+
DefaultFontStyle.removeValues(...toRemove)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
127
|
+
for (const def of Object.values(definitions)) {
|
|
128
|
+
for (const font of fontNames) {
|
|
129
|
+
if (!def.fonts || !(font in def.fonts)) {
|
|
130
|
+
console.warn(
|
|
131
|
+
`Theme '${def.id}' is missing font '${font}'. Shapes using this font won't render correctly in this theme.`
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { TLFontFace } from './TLFontFace'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Defines the color variants available for each color in the default theme.
|
|
5
|
+
* Each color has multiple variants for different use cases like fills, strokes,
|
|
6
|
+
* patterns, and UI elements like frames and notes.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { TLDefaultColor } from '@tldraw/tlschema'
|
|
11
|
+
*
|
|
12
|
+
* const blueColor: TLDefaultColor = {
|
|
13
|
+
* solid: '#4465e9',
|
|
14
|
+
* semi: '#dce1f8',
|
|
15
|
+
* pattern: '#6681ee',
|
|
16
|
+
* fill: '#4465e9',
|
|
17
|
+
* // ... other variants
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface TLDefaultColor {
|
|
24
|
+
solid: string
|
|
25
|
+
semi: string
|
|
26
|
+
pattern: string
|
|
27
|
+
fill: string // usually same as solid
|
|
28
|
+
linedFill: string // usually slightly lighter than fill
|
|
29
|
+
frameHeadingStroke: string
|
|
30
|
+
frameHeadingFill: string
|
|
31
|
+
frameStroke: string
|
|
32
|
+
frameFill: string
|
|
33
|
+
frameText: string
|
|
34
|
+
noteFill: string
|
|
35
|
+
noteText: string
|
|
36
|
+
highlightSrgb: string
|
|
37
|
+
highlightP3: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The color palette for a theme. Contains base UI colors (as strings) and
|
|
42
|
+
* named shape colors (as {@link TLDefaultColor} objects).
|
|
43
|
+
*
|
|
44
|
+
* Extend this interface via module augmentation to add custom colors:
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* declare module '@tldraw/tlschema' {
|
|
49
|
+
* interface TLThemeColors {
|
|
50
|
+
* pink: TLDefaultColor
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export interface TLThemeDefaultColors {
|
|
58
|
+
text: string
|
|
59
|
+
background: string
|
|
60
|
+
negativeSpace: string
|
|
61
|
+
solid: string
|
|
62
|
+
cursor: string
|
|
63
|
+
noteBorder: string
|
|
64
|
+
black: TLDefaultColor
|
|
65
|
+
grey: TLDefaultColor
|
|
66
|
+
'light-violet': TLDefaultColor
|
|
67
|
+
violet: TLDefaultColor
|
|
68
|
+
blue: TLDefaultColor
|
|
69
|
+
'light-blue': TLDefaultColor
|
|
70
|
+
yellow: TLDefaultColor
|
|
71
|
+
orange: TLDefaultColor
|
|
72
|
+
green: TLDefaultColor
|
|
73
|
+
'light-green': TLDefaultColor
|
|
74
|
+
'light-red': TLDefaultColor
|
|
75
|
+
red: TLDefaultColor
|
|
76
|
+
white: TLDefaultColor
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A font definition within a theme. Maps a font style name to a CSS font-family
|
|
81
|
+
* declaration and optional font face descriptors for loading.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { TLThemeFont } from '@tldraw/tlschema'
|
|
86
|
+
*
|
|
87
|
+
* const customSans: TLThemeFont = {
|
|
88
|
+
* fontFamily: "'Inter', sans-serif",
|
|
89
|
+
* faces: [
|
|
90
|
+
* { family: 'Inter', src: { url: 'https://example.com/Inter-Regular.woff2', format: 'woff2' }, weight: 'normal' },
|
|
91
|
+
* { family: 'Inter', src: { url: 'https://example.com/Inter-Bold.woff2', format: 'woff2' }, weight: 'bold' },
|
|
92
|
+
* ]
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export interface TLThemeFont {
|
|
99
|
+
/** CSS font-family declaration, e.g. `"'Inter', sans-serif"` */
|
|
100
|
+
fontFamily: string
|
|
101
|
+
/** Font face definitions for loading. Omit for system fonts that don't need loading. */
|
|
102
|
+
faces?: TLFontFace[]
|
|
103
|
+
/**
|
|
104
|
+
* Icon for the style panel. Accepts a string icon ID (resolved via `assetUrls.icons`)
|
|
105
|
+
* or a React element (`TLUiIconJsx`). Defaults to the built-in icon for known fonts,
|
|
106
|
+
* or `'font-draw'` for custom fonts.
|
|
107
|
+
*/
|
|
108
|
+
icon?: unknown
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The font palette for a theme. Contains named font definitions mapping font style
|
|
113
|
+
* names to their CSS font-family strings and font face descriptors.
|
|
114
|
+
*
|
|
115
|
+
* Extend this interface via module augmentation to add custom fonts:
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* declare module '@tldraw/tlschema' {
|
|
120
|
+
* interface TLThemeFonts {
|
|
121
|
+
* cursive: TLThemeFont
|
|
122
|
+
* }
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export interface TLThemeFonts {
|
|
129
|
+
draw: TLThemeFont
|
|
130
|
+
sans: TLThemeFont
|
|
131
|
+
serif: TLThemeFont
|
|
132
|
+
mono: TLThemeFont
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Augment this interface to remove built-in palette colors from themes.
|
|
137
|
+
* Each key you add will be omitted from {@link TLThemeColors}.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* declare module '@tldraw/tlschema' {
|
|
142
|
+
* interface TLRemovedDefaultThemeColors {
|
|
143
|
+
* 'light-violet': true
|
|
144
|
+
* 'light-blue': true
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
// oxlint-disable-next-line typescript/no-empty-object-type
|
|
152
|
+
export interface TLRemovedDefaultThemeColors {}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Keys in {@link TLThemeDefaultColors} that are required UI infrastructure colors
|
|
156
|
+
* and cannot be removed via {@link TLRemovedDefaultThemeColors}.
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export type TLThemeUiColorKeys =
|
|
161
|
+
| 'text'
|
|
162
|
+
| 'background'
|
|
163
|
+
| 'negativeSpace'
|
|
164
|
+
| 'solid'
|
|
165
|
+
| 'cursor'
|
|
166
|
+
| 'noteBorder'
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A color palette for one color mode. UI colors are always required.
|
|
170
|
+
* Palette colors removed via {@link TLRemovedDefaultThemeColors} are omitted.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
export type TLThemeColors = Pick<TLThemeDefaultColors, TLThemeUiColorKeys> &
|
|
175
|
+
Omit<TLThemeDefaultColors, TLThemeUiColorKeys | keyof TLRemovedDefaultThemeColors>
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A theme definition containing shared properties and color/font palettes for
|
|
179
|
+
* both light and dark modes.
|
|
180
|
+
*
|
|
181
|
+
* To remove palette colors from themes, augment {@link TLRemovedDefaultThemeColors}.
|
|
182
|
+
* UI colors (`text`, `background`, `negativeSpace`, `solid`, `cursor`, `noteBorder`)
|
|
183
|
+
* are always required.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const myTheme: TLTheme = {
|
|
188
|
+
* id: 'custom',
|
|
189
|
+
* fontSize: 16,
|
|
190
|
+
* lineHeight: 1.35,
|
|
191
|
+
* strokeWidth: 2,
|
|
192
|
+
* fonts: DEFAULT_THEME.fonts,
|
|
193
|
+
* colors: {
|
|
194
|
+
* light: { ... },
|
|
195
|
+
* dark: { ... },
|
|
196
|
+
* },
|
|
197
|
+
* }
|
|
198
|
+
* editor.updateTheme(myTheme)
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
export interface TLTheme {
|
|
204
|
+
/** Unique identifier for this theme. Used as the key in the theme registry. */
|
|
205
|
+
id: TLThemeId
|
|
206
|
+
/** Base font size in pixels. Shape font sizes are derived by multiplying this value. */
|
|
207
|
+
fontSize: number
|
|
208
|
+
/** Base line height multiplier. */
|
|
209
|
+
lineHeight: number
|
|
210
|
+
/** Base stroke width in pixels. Shape stroke widths are derived by multiplying this value. */
|
|
211
|
+
strokeWidth: number
|
|
212
|
+
/** Font definitions. Individual fonts may be absent if removed by a custom theme. */
|
|
213
|
+
fonts: TLThemeFonts
|
|
214
|
+
colors: {
|
|
215
|
+
light: TLThemeColors
|
|
216
|
+
dark: TLThemeColors
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A registry of available themes. Extend this interface via module
|
|
222
|
+
* augmentation to register custom themes for type-safe theme IDs.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* declare module '@tldraw/tlschema' {
|
|
227
|
+
* interface TLThemes {
|
|
228
|
+
* corporate: TLTheme
|
|
229
|
+
* }
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export interface TLThemes {
|
|
236
|
+
default: TLTheme
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** @public */
|
|
240
|
+
export type TLThemeId = keyof TLThemes & string
|