@tldraw/editor 4.6.0-canary.b30af3a3ab2b → 4.6.0-canary.b554d8650ef2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +681 -96
- package/dist-cjs/index.js +16 -3
- package/dist-cjs/index.js.map +3 -3
- package/dist-cjs/lib/TldrawEditor.js +55 -12
- package/dist-cjs/lib/TldrawEditor.js.map +3 -3
- package/dist-cjs/lib/components/MenuClickCapture.js +99 -38
- package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +3 -3
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/config/createTLStore.js +7 -0
- package/dist-cjs/lib/config/createTLStore.js.map +2 -2
- package/dist-cjs/lib/config/defaultAssets.js +36 -0
- package/dist-cjs/lib/config/defaultAssets.js.map +7 -0
- package/dist-cjs/lib/editor/Editor.js +259 -6
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/assets/AssetUtil.js +67 -0
- package/dist-cjs/lib/editor/assets/AssetUtil.js.map +7 -0
- package/dist-cjs/lib/editor/bindings/BindingUtil.js +1 -0
- package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -0
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -0
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +1 -0
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +2 -0
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +2 -0
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +12 -0
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js +80 -0
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.js.map +7 -0
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js +466 -0
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js.map +7 -0
- package/dist-cjs/lib/editor/managers/PerformanceManager/perf-types.js +17 -0
- package/dist-cjs/lib/editor/managers/PerformanceManager/perf-types.js.map +7 -0
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +1 -0
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +1 -0
- package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +1 -1
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +1 -0
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -0
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +1 -0
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +1 -0
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js +107 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js.map +7 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js +586 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +7 -0
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -0
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +8 -4
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +12 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +1 -1
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js +6 -0
- package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
- package/dist-cjs/lib/editor/tools/StateNode.js +15 -17
- package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
- package/dist-cjs/lib/editor/types/SvgExportContext.js.map +2 -2
- package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
- package/dist-cjs/lib/exports/ExportDelay.js +1 -0
- package/dist-cjs/lib/exports/ExportDelay.js.map +1 -1
- package/dist-cjs/lib/exports/StyleEmbedder.js +1 -0
- package/dist-cjs/lib/exports/StyleEmbedder.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.js +12 -7
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/globals/environment.js +18 -1
- package/dist-cjs/lib/globals/environment.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +25 -4
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/{useIsDarkMode.js → useColorMode.js} +14 -10
- package/dist-cjs/lib/hooks/useColorMode.js.map +7 -0
- package/dist-cjs/lib/hooks/useCursor.js +3 -7
- package/dist-cjs/lib/hooks/useCursor.js.map +2 -2
- package/dist-cjs/lib/hooks/useDarkMode.js +4 -4
- package/dist-cjs/lib/hooks/useDarkMode.js.map +2 -2
- package/dist-cjs/lib/hooks/useGestureEvents.js +171 -127
- package/dist-cjs/lib/hooks/useGestureEvents.js.map +3 -3
- package/dist-cjs/lib/options.js +1 -0
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +3 -0
- package/dist-cjs/lib/primitives/Vec.js.map +1 -1
- package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -0
- package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +1 -1
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -0
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +1 -1
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +2 -0
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +1 -1
- package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -0
- package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +1 -1
- package/dist-cjs/lib/utils/EditorAtom.js +2 -0
- package/dist-cjs/lib/utils/EditorAtom.js.map +1 -1
- package/dist-cjs/lib/utils/reparenting.js +2 -1
- package/dist-cjs/lib/utils/reparenting.js.map +2 -2
- package/dist-cjs/lib/utils/richText.js.map +2 -2
- package/dist-cjs/lib/utils/runtime.js +2 -1
- package/dist-cjs/lib/utils/runtime.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +2 -0
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +1 -1
- package/dist-cjs/lib/utils/sync/hardReset.js +0 -8
- package/dist-cjs/lib/utils/sync/hardReset.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +681 -96
- package/dist-esm/index.mjs +17 -6
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +58 -12
- package/dist-esm/lib/TldrawEditor.mjs.map +3 -3
- package/dist-esm/lib/components/MenuClickCapture.mjs +100 -39
- package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +3 -3
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/config/createTLStore.mjs +10 -1
- package/dist-esm/lib/config/createTLStore.mjs.map +2 -2
- package/dist-esm/lib/config/defaultAssets.mjs +16 -0
- package/dist-esm/lib/config/defaultAssets.mjs.map +7 -0
- package/dist-esm/lib/editor/Editor.mjs +259 -6
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/assets/AssetUtil.mjs +47 -0
- package/dist-esm/lib/editor/assets/AssetUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs +1 -0
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +2 -0
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +2 -0
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +12 -0
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs +60 -0
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs +438 -0
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs +1 -0
- package/dist-esm/lib/editor/managers/PerformanceManager/perf-types.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +1 -0
- package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +1 -0
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs +89 -0
- package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs +568 -0
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -0
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +8 -4
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +12 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +1 -1
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs +6 -0
- package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/StateNode.mjs +15 -17
- package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
- package/dist-esm/lib/editor/types/SvgExportContext.mjs.map +2 -2
- package/dist-esm/lib/exports/ExportDelay.mjs +1 -0
- package/dist-esm/lib/exports/ExportDelay.mjs.map +1 -1
- package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -0
- package/dist-esm/lib/exports/StyleEmbedder.mjs.map +1 -1
- package/dist-esm/lib/exports/getSvgJsx.mjs +12 -10
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/globals/environment.mjs +18 -1
- package/dist-esm/lib/globals/environment.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +25 -4
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useColorMode.mjs +19 -0
- package/dist-esm/lib/hooks/useColorMode.mjs.map +7 -0
- package/dist-esm/lib/hooks/useCursor.mjs +3 -7
- package/dist-esm/lib/hooks/useCursor.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDarkMode.mjs +4 -4
- package/dist-esm/lib/hooks/useDarkMode.mjs.map +2 -2
- package/dist-esm/lib/hooks/useGestureEvents.mjs +171 -127
- package/dist-esm/lib/hooks/useGestureEvents.mjs.map +3 -3
- package/dist-esm/lib/options.mjs +1 -0
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +3 -0
- package/dist-esm/lib/primitives/Vec.mjs.map +1 -1
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs +1 -0
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +1 -1
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +1 -0
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +1 -1
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +2 -0
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +1 -1
- package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -0
- package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +1 -1
- package/dist-esm/lib/utils/EditorAtom.mjs +2 -0
- package/dist-esm/lib/utils/EditorAtom.mjs.map +1 -1
- package/dist-esm/lib/utils/reparenting.mjs +2 -1
- package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
- package/dist-esm/lib/utils/richText.mjs.map +2 -2
- package/dist-esm/lib/utils/runtime.mjs +2 -1
- package/dist-esm/lib/utils/runtime.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +2 -0
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +1 -1
- package/dist-esm/lib/utils/sync/hardReset.mjs +0 -8
- package/dist-esm/lib/utils/sync/hardReset.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +0 -37
- package/package.json +7 -8
- package/src/index.ts +23 -6
- package/src/lib/TldrawEditor.tsx +90 -13
- package/src/lib/components/MenuClickCapture.tsx +129 -49
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +3 -3
- package/src/lib/config/createTLStore.ts +22 -1
- package/src/lib/config/defaultAssets.ts +19 -0
- package/src/lib/editor/Editor.ts +364 -32
- package/src/lib/editor/assets/AssetUtil.ts +85 -0
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +9 -2
- package/src/lib/editor/managers/FontManager/FontManager.ts +1 -67
- package/src/lib/editor/managers/InputsManager/InputsManager.ts +12 -0
- package/src/lib/editor/managers/PerformanceManager/PerformanceApiAdapter.ts +82 -0
- package/src/lib/editor/managers/PerformanceManager/PerformanceManager.test.ts +522 -0
- package/src/lib/editor/managers/PerformanceManager/PerformanceManager.ts +583 -0
- package/src/lib/editor/managers/PerformanceManager/perf-types.ts +196 -0
- package/src/lib/editor/managers/ThemeManager/ThemeManager.ts +116 -0
- package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +605 -0
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +23 -29
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +5 -3
- package/src/lib/editor/shapes/ShapeUtil.ts +28 -3
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -1
- package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +7 -0
- package/src/lib/editor/tools/StateNode.ts +16 -18
- package/src/lib/editor/types/SvgExportContext.tsx +5 -0
- package/src/lib/editor/types/external-content.ts +1 -0
- package/src/lib/exports/getSvgJsx.tsx +21 -15
- package/src/lib/globals/environment.ts +18 -0
- package/src/lib/hooks/useCanvasEvents.ts +40 -3
- package/src/lib/hooks/{useIsDarkMode.ts → useColorMode.ts} +9 -5
- package/src/lib/hooks/useCursor.ts +3 -7
- package/src/lib/hooks/useDarkMode.ts +4 -4
- package/src/lib/hooks/useGestureEvents.ts +240 -168
- package/src/lib/options.ts +7 -0
- package/src/lib/utils/reparenting.ts +6 -2
- package/src/lib/utils/richText.ts +1 -1
- package/src/lib/utils/runtime.ts +3 -1
- package/src/lib/utils/sync/hardReset.ts +0 -8
- package/src/version.ts +3 -3
- package/dist-cjs/lib/hooks/useIsDarkMode.js.map +0 -7
- package/dist-esm/lib/hooks/useIsDarkMode.mjs +0 -15
- package/dist-esm/lib/hooks/useIsDarkMode.mjs.map +0 -7
package/dist-cjs/index.d.ts
CHANGED
|
@@ -57,9 +57,12 @@ import { TLCamera } from '@tldraw/tlschema';
|
|
|
57
57
|
import { TLCreateShapePartial } from '@tldraw/tlschema';
|
|
58
58
|
import { TLCursor } from '@tldraw/tlschema';
|
|
59
59
|
import { TLCursorType } from '@tldraw/tlschema';
|
|
60
|
+
import { TLDefaultColor } from '@tldraw/tlschema';
|
|
61
|
+
import { TLDefaultColorStyle } from '@tldraw/tlschema';
|
|
60
62
|
import { TLDefaultDashStyle } from '@tldraw/tlschema';
|
|
61
63
|
import { TLDefaultHorizontalAlignStyle } from '@tldraw/tlschema';
|
|
62
64
|
import { TLDocument } from '@tldraw/tlschema';
|
|
65
|
+
import { TLFontFace } from '@tldraw/tlschema';
|
|
63
66
|
import { TLGroupShape } from '@tldraw/tlschema';
|
|
64
67
|
import { TLHandle } from '@tldraw/tlschema';
|
|
65
68
|
import { TLImageAsset } from '@tldraw/tlschema';
|
|
@@ -81,6 +84,11 @@ import { TLStore } from '@tldraw/tlschema';
|
|
|
81
84
|
import { TLStoreProps } from '@tldraw/tlschema';
|
|
82
85
|
import { TLStoreSchema } from '@tldraw/tlschema';
|
|
83
86
|
import { TLStoreSnapshot } from '@tldraw/tlschema';
|
|
87
|
+
import { TLTheme } from '@tldraw/tlschema';
|
|
88
|
+
import { TLThemeColors } from '@tldraw/tlschema';
|
|
89
|
+
import { TLThemeId } from '@tldraw/tlschema';
|
|
90
|
+
import { TLThemes } from '@tldraw/tlschema';
|
|
91
|
+
import { TLUnknownAsset } from '@tldraw/tlschema';
|
|
84
92
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
85
93
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
86
94
|
import { TLUser } from '@tldraw/tlschema';
|
|
@@ -147,6 +155,51 @@ export declare class Arc2d extends Geometry2d {
|
|
|
147
155
|
*/
|
|
148
156
|
export declare function areAnglesCompatible(a: number, b: number): boolean;
|
|
149
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Abstract base class for defining asset-type-specific behavior.
|
|
160
|
+
*
|
|
161
|
+
* Each asset type (image, video, bookmark, etc.) has a corresponding AssetUtil that handles
|
|
162
|
+
* type-specific operations like determining supported MIME types and creating assets from files.
|
|
163
|
+
*
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
export declare abstract class AssetUtil<Asset extends TLAsset = TLAsset> {
|
|
167
|
+
editor: Editor;
|
|
168
|
+
/** Configure this asset util's {@link AssetUtil.options | `options`}. */
|
|
169
|
+
static configure<T extends TLAssetUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
170
|
+
options: infer Options;
|
|
171
|
+
} ? Partial<Options> : never): T;
|
|
172
|
+
constructor(editor: Editor);
|
|
173
|
+
/**
|
|
174
|
+
* Options for this asset util. Override this to provide customization options for your asset.
|
|
175
|
+
* Use {@link AssetUtil.configure} to customize existing asset utils.
|
|
176
|
+
*/
|
|
177
|
+
options: {};
|
|
178
|
+
static props?: RecordProps<TLUnknownAsset>;
|
|
179
|
+
static migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
180
|
+
/**
|
|
181
|
+
* The type of the asset util, which should match the asset's type.
|
|
182
|
+
*/
|
|
183
|
+
static type: string;
|
|
184
|
+
/**
|
|
185
|
+
* Get the default props for an asset of this type.
|
|
186
|
+
*/
|
|
187
|
+
abstract getDefaultProps(): Asset['props'];
|
|
188
|
+
/**
|
|
189
|
+
* Get the MIME types that this asset type supports.
|
|
190
|
+
* Return an empty array if this asset type doesn't support files (e.g. bookmarks).
|
|
191
|
+
*/
|
|
192
|
+
getSupportedMimeTypes(): readonly string[];
|
|
193
|
+
/**
|
|
194
|
+
* Check whether this asset type accepts a given MIME type.
|
|
195
|
+
*/
|
|
196
|
+
acceptsMimeType(mimeType: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Create an asset from a file. Return null if this asset type can't handle the file.
|
|
199
|
+
*/
|
|
200
|
+
getAssetFromFile(_file: File, _assetId: TLAssetId): Promise<Asset | null>;
|
|
201
|
+
}
|
|
202
|
+
|
|
150
203
|
/** @public */
|
|
151
204
|
export declare function average(A: VecLike, B: VecLike): string;
|
|
152
205
|
|
|
@@ -743,7 +796,7 @@ export declare function createTLSchemaFromUtils(opts: TLStoreSchemaOptions): Sto
|
|
|
743
796
|
*
|
|
744
797
|
* @public
|
|
745
798
|
*/
|
|
746
|
-
export declare function createTLStore({ initialData, defaultName, id, assets, users, onMount, collaboration, ...rest }?: TLStoreOptions): TLStore;
|
|
799
|
+
export declare function createTLStore({ initialData, defaultName, id, assets, users, onMount, collaboration, themes, ...rest }?: TLStoreOptions): TLStore;
|
|
747
800
|
|
|
748
801
|
/** @public */
|
|
749
802
|
export declare class CubicBezier2d extends Polyline2d {
|
|
@@ -818,6 +871,13 @@ export declare interface DebugFlagDefaults<T> {
|
|
|
818
871
|
|
|
819
872
|
/* Excluded from this release type: DEFAULT_CAMERA_OPTIONS */
|
|
820
873
|
|
|
874
|
+
/**
|
|
875
|
+
* The default theme definition containing color palettes for both light and dark modes.
|
|
876
|
+
*
|
|
877
|
+
* @public
|
|
878
|
+
*/
|
|
879
|
+
export declare const DEFAULT_THEME: TLTheme;
|
|
880
|
+
|
|
821
881
|
/** @public @react */
|
|
822
882
|
export declare function DefaultBackground(): JSX.Element;
|
|
823
883
|
|
|
@@ -936,6 +996,7 @@ export declare const defaultTldrawOptions: {
|
|
|
936
996
|
readonly onBeforePasteFromClipboard: undefined;
|
|
937
997
|
readonly onClipboardPasteRaw: undefined;
|
|
938
998
|
readonly quickZoomPreservesScreenBounds: true;
|
|
999
|
+
readonly rightClickPanning: true;
|
|
939
1000
|
readonly snapThreshold: 8;
|
|
940
1001
|
readonly spacebarPanning: true;
|
|
941
1002
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
@@ -1043,7 +1104,7 @@ export declare class EdgeScrollManager {
|
|
|
1043
1104
|
/** @public */
|
|
1044
1105
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1045
1106
|
readonly id: string;
|
|
1046
|
-
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus,
|
|
1107
|
+
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
|
|
1047
1108
|
private readonly _getShapeVisibility?;
|
|
1048
1109
|
private getIsShapeHiddenCache;
|
|
1049
1110
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1106,7 +1167,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1106
1167
|
* @public
|
|
1107
1168
|
*/
|
|
1108
1169
|
readonly snaps: SnapManager;
|
|
1109
|
-
|
|
1170
|
+
/**
|
|
1171
|
+
* A manager for performance measurement hooks.
|
|
1172
|
+
*
|
|
1173
|
+
* @public
|
|
1174
|
+
*/
|
|
1175
|
+
readonly performance: PerformanceManager;
|
|
1176
|
+
/* Excluded from this release type: _spatialIndex */
|
|
1110
1177
|
/**
|
|
1111
1178
|
* A manager for the any asynchronous events and making sure they're
|
|
1112
1179
|
* cleaned up upon disposal.
|
|
@@ -1125,6 +1192,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1125
1192
|
* @public
|
|
1126
1193
|
*/
|
|
1127
1194
|
readonly user: UserPreferencesManager;
|
|
1195
|
+
/* Excluded from this release type: _themeManager */
|
|
1128
1196
|
/**
|
|
1129
1197
|
* A helper for measuring text.
|
|
1130
1198
|
*
|
|
@@ -1175,6 +1243,83 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1175
1243
|
* @public
|
|
1176
1244
|
*/
|
|
1177
1245
|
dispose(): void;
|
|
1246
|
+
/**
|
|
1247
|
+
* Get the current color mode (`'light'` or `'dark'`), based on the user's dark mode preference.
|
|
1248
|
+
*
|
|
1249
|
+
* @public
|
|
1250
|
+
*/
|
|
1251
|
+
getColorMode(): 'dark' | 'light';
|
|
1252
|
+
/**
|
|
1253
|
+
* Set the color mode. Note that this is a convenience method that passes the mode to
|
|
1254
|
+
* `user.updateUserPreferences`, which is the source of truth for the user's color mode preference.
|
|
1255
|
+
*
|
|
1256
|
+
* @public
|
|
1257
|
+
*/
|
|
1258
|
+
setColorMode(mode: 'dark' | 'light'): this;
|
|
1259
|
+
/**
|
|
1260
|
+
* Get the id of the current theme.
|
|
1261
|
+
*
|
|
1262
|
+
* @public
|
|
1263
|
+
*/
|
|
1264
|
+
getCurrentThemeId(): TLThemeId;
|
|
1265
|
+
/**
|
|
1266
|
+
* Get the current theme definition.
|
|
1267
|
+
*
|
|
1268
|
+
* @public
|
|
1269
|
+
*/
|
|
1270
|
+
getCurrentTheme(): TLTheme;
|
|
1271
|
+
/**
|
|
1272
|
+
* Set the current theme by id.
|
|
1273
|
+
*
|
|
1274
|
+
* @public
|
|
1275
|
+
*/
|
|
1276
|
+
setCurrentTheme(id: TLThemeId): this;
|
|
1277
|
+
/**
|
|
1278
|
+
* Get all registered theme definitions.
|
|
1279
|
+
*
|
|
1280
|
+
* @public
|
|
1281
|
+
*/
|
|
1282
|
+
getThemes(): TLThemes;
|
|
1283
|
+
/**
|
|
1284
|
+
* Get a single theme definition by id.
|
|
1285
|
+
*
|
|
1286
|
+
* @public
|
|
1287
|
+
*/
|
|
1288
|
+
getTheme(id: TLThemeId): TLTheme | undefined;
|
|
1289
|
+
/**
|
|
1290
|
+
* Replace all theme definitions, or update them via a callback that receives a deep copy.
|
|
1291
|
+
* The `'default'` theme must always be present in the result.
|
|
1292
|
+
*
|
|
1293
|
+
* @example
|
|
1294
|
+
* ```ts
|
|
1295
|
+
* // Replace all themes
|
|
1296
|
+
* editor.updateThemes({ default: myDefaultTheme, ocean: myOceanTheme })
|
|
1297
|
+
*
|
|
1298
|
+
* // Update via callback
|
|
1299
|
+
* editor.updateThemes((themes) => {
|
|
1300
|
+
* delete themes.ocean
|
|
1301
|
+
* return themes
|
|
1302
|
+
* })
|
|
1303
|
+
* ```
|
|
1304
|
+
*
|
|
1305
|
+
* @public
|
|
1306
|
+
*/
|
|
1307
|
+
updateThemes(themes: ((themes: TLThemes) => TLThemes) | TLThemes): this;
|
|
1308
|
+
/**
|
|
1309
|
+
* Register or update a single theme definition. The theme is keyed by its `id` property.
|
|
1310
|
+
*
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```ts
|
|
1313
|
+
* // Override a property on the default theme
|
|
1314
|
+
* editor.updateTheme({ ...editor.getTheme('default')!, fontSize: 24 })
|
|
1315
|
+
*
|
|
1316
|
+
* // Register a new theme
|
|
1317
|
+
* editor.updateTheme({ id: 'ocean', ...myOceanTheme })
|
|
1318
|
+
* ```
|
|
1319
|
+
*
|
|
1320
|
+
* @public
|
|
1321
|
+
*/
|
|
1322
|
+
updateTheme(theme: TLTheme): this;
|
|
1178
1323
|
/**
|
|
1179
1324
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
1180
1325
|
*
|
|
@@ -1183,6 +1328,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1183
1328
|
shapeUtils: {
|
|
1184
1329
|
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
1185
1330
|
};
|
|
1331
|
+
/* Excluded from this release type: _shapeUtilsByAssetType */
|
|
1186
1332
|
styleProps: {
|
|
1187
1333
|
[key: string]: Map<StyleProp<any>, string>;
|
|
1188
1334
|
};
|
|
@@ -1214,6 +1360,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1214
1360
|
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
1215
1361
|
hasShapeUtil(type: TLShape['type']): boolean;
|
|
1216
1362
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
1363
|
+
/**
|
|
1364
|
+
* Get the shape util that handles the given asset type.
|
|
1365
|
+
* Returns the shape util whose {@link ShapeUtil.handledAssetTypes} includes
|
|
1366
|
+
* the given asset type, or undefined if none matches.
|
|
1367
|
+
*
|
|
1368
|
+
* @param assetType - The asset type string.
|
|
1369
|
+
* @public
|
|
1370
|
+
*/
|
|
1371
|
+
getShapeUtilForAssetType(assetType: string): ShapeUtil | undefined;
|
|
1217
1372
|
/**
|
|
1218
1373
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
1219
1374
|
*
|
|
@@ -1244,6 +1399,40 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1244
1399
|
type: S['type'];
|
|
1245
1400
|
} | S): BindingUtil<S>;
|
|
1246
1401
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
1402
|
+
/**
|
|
1403
|
+
* A map of asset utility classes by asset type.
|
|
1404
|
+
*
|
|
1405
|
+
* @public
|
|
1406
|
+
*/
|
|
1407
|
+
assetUtils: {
|
|
1408
|
+
readonly [K in string]?: AssetUtil<TLAsset>;
|
|
1409
|
+
};
|
|
1410
|
+
/**
|
|
1411
|
+
* Get an asset util from an asset or asset type.
|
|
1412
|
+
*
|
|
1413
|
+
* @param arg - An asset, asset type string, or object with type.
|
|
1414
|
+
*
|
|
1415
|
+
* @public
|
|
1416
|
+
*/
|
|
1417
|
+
getAssetUtil<S extends TLAsset>(asset: {
|
|
1418
|
+
type: S['type'];
|
|
1419
|
+
} | S): AssetUtil<S>;
|
|
1420
|
+
getAssetUtil(type: string): AssetUtil;
|
|
1421
|
+
/**
|
|
1422
|
+
* Returns true if the editor has an asset util for the given asset type.
|
|
1423
|
+
*
|
|
1424
|
+
* @public
|
|
1425
|
+
*/
|
|
1426
|
+
hasAssetUtil(arg: {
|
|
1427
|
+
type: string;
|
|
1428
|
+
} | string): boolean;
|
|
1429
|
+
/**
|
|
1430
|
+
* Get the asset util that accepts the given MIME type.
|
|
1431
|
+
* Returns null if no registered asset util accepts the MIME type.
|
|
1432
|
+
*
|
|
1433
|
+
* @public
|
|
1434
|
+
*/
|
|
1435
|
+
getAssetUtilForMimeType(mimeType: string): AssetUtil | null;
|
|
1247
1436
|
/**
|
|
1248
1437
|
* A manager for the editor's history.
|
|
1249
1438
|
*
|
|
@@ -4394,6 +4583,35 @@ export declare interface Geometry2dOptions extends TransformedGeometry2dOptions
|
|
|
4394
4583
|
*/
|
|
4395
4584
|
export declare function getArcMeasure(A: number, B: number, sweepFlag: number, largeArcFlag: number): number;
|
|
4396
4585
|
|
|
4586
|
+
/**
|
|
4587
|
+
* Resolves a color style value to its actual CSS color string for a given theme and variant.
|
|
4588
|
+
* If the color is not a default theme color, returns the color value as-is.
|
|
4589
|
+
*
|
|
4590
|
+
* @param colors - The color palette for the current color mode (e.g. `theme.colors[colorMode]`)
|
|
4591
|
+
* @param color - The color style value to resolve
|
|
4592
|
+
* @param variant - Which variant of the color to return (solid, fill, pattern, etc.)
|
|
4593
|
+
* @returns The CSS color string for the specified color and variant
|
|
4594
|
+
*
|
|
4595
|
+
* @example
|
|
4596
|
+
* ```ts
|
|
4597
|
+
* import { getColorValue } from 'tldraw'
|
|
4598
|
+
*
|
|
4599
|
+
* const colors = editor.getCurrentTheme().colors[editor.getColorMode()]
|
|
4600
|
+
*
|
|
4601
|
+
* // Get the solid variant of red
|
|
4602
|
+
* const redSolid = getColorValue(colors, 'red', 'solid') // '#e03131'
|
|
4603
|
+
*
|
|
4604
|
+
* // Get the fill variant of blue
|
|
4605
|
+
* const blueFill = getColorValue(colors, 'blue', 'fill') // '#4465e9'
|
|
4606
|
+
*
|
|
4607
|
+
* // Custom color passes through unchanged
|
|
4608
|
+
* const customColor = getColorValue(colors, '#ff0000', 'solid') // '#ff0000'
|
|
4609
|
+
* ```
|
|
4610
|
+
*
|
|
4611
|
+
* @public
|
|
4612
|
+
*/
|
|
4613
|
+
export declare function getColorValue(colors: TLThemeColors, color: string | TLDefaultColorStyle, variant: keyof TLDefaultColor): string;
|
|
4614
|
+
|
|
4397
4615
|
/** @public */
|
|
4398
4616
|
export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
4399
4617
|
|
|
@@ -4564,7 +4782,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4564
4782
|
static type: "group";
|
|
4565
4783
|
static props: RecordProps<TLGroupShape>;
|
|
4566
4784
|
static migrations: TLPropsMigrations;
|
|
4567
|
-
hideSelectionBoundsFg(): boolean;
|
|
4785
|
+
hideSelectionBoundsFg(shape: TLGroupShape): boolean;
|
|
4568
4786
|
canBind(): boolean;
|
|
4569
4787
|
canResize(): boolean;
|
|
4570
4788
|
canResizeChildren(): boolean;
|
|
@@ -4850,6 +5068,12 @@ export declare class InputsManager {
|
|
|
4850
5068
|
get isPointing(): boolean;
|
|
4851
5069
|
set isPointing(isPointing: boolean);
|
|
4852
5070
|
/* Excluded from this release type: setIsPointing */
|
|
5071
|
+
private _isRightPointing;
|
|
5072
|
+
/**
|
|
5073
|
+
* Whether the user is right-click pointing (before drag threshold).
|
|
5074
|
+
*/
|
|
5075
|
+
getIsRightPointing(): boolean;
|
|
5076
|
+
/* Excluded from this release type: setIsRightPointing */
|
|
4853
5077
|
private _isPinching;
|
|
4854
5078
|
/**
|
|
4855
5079
|
* Whether the user is pinching.
|
|
@@ -5206,6 +5430,94 @@ export declare function parseDeepLinkString(deepLinkString: string): TLDeepLink;
|
|
|
5206
5430
|
/** @public */
|
|
5207
5431
|
export declare type PerfectDashTerminal = 'none' | 'outset' | 'skip';
|
|
5208
5432
|
|
|
5433
|
+
/**
|
|
5434
|
+
* Optional adapter that pipes PerformanceManager events into browser
|
|
5435
|
+
* `performance.mark()` / `performance.measure()` for DevTools integration.
|
|
5436
|
+
*
|
|
5437
|
+
* Tree-shakeable — only included if imported.
|
|
5438
|
+
*
|
|
5439
|
+
* @example
|
|
5440
|
+
* ```ts
|
|
5441
|
+
* const adapter = new PerformanceApiAdapter(editor.performance)
|
|
5442
|
+
* // ... later
|
|
5443
|
+
* adapter.dispose()
|
|
5444
|
+
* ```
|
|
5445
|
+
*
|
|
5446
|
+
* @public
|
|
5447
|
+
*/
|
|
5448
|
+
export declare class PerformanceApiAdapter {
|
|
5449
|
+
private cleanups;
|
|
5450
|
+
constructor(perfManager: PerformanceManager);
|
|
5451
|
+
/** Remove all listeners and stop piping events. @public */
|
|
5452
|
+
dispose(): void;
|
|
5453
|
+
}
|
|
5454
|
+
|
|
5455
|
+
/**
|
|
5456
|
+
* Manages performance event subscriptions for the editor. Available as `editor.performance`.
|
|
5457
|
+
*
|
|
5458
|
+
* Listeners are lazy — internal editor hooks (frame, shape events) are only attached while
|
|
5459
|
+
* at least one subscriber exists, so there is zero overhead when unused.
|
|
5460
|
+
*
|
|
5461
|
+
* @example
|
|
5462
|
+
* ```ts
|
|
5463
|
+
* const unsub = editor.performance.on('interaction-end', (event) => {
|
|
5464
|
+
* console.log(`${event.name}: ${event.fps.toFixed(1)} fps, p95=${event.p95FrameTime.toFixed(1)}ms`)
|
|
5465
|
+
* })
|
|
5466
|
+
* ```
|
|
5467
|
+
*
|
|
5468
|
+
* @public
|
|
5469
|
+
*/
|
|
5470
|
+
export declare class PerformanceManager {
|
|
5471
|
+
/* Excluded from this release type: emitter */
|
|
5472
|
+
private editor;
|
|
5473
|
+
private activeInteraction;
|
|
5474
|
+
private activeCamera;
|
|
5475
|
+
private frameCleanup;
|
|
5476
|
+
private shapeCreatedCleanup;
|
|
5477
|
+
private shapeEditedCleanup;
|
|
5478
|
+
private shapeDeletedCleanup;
|
|
5479
|
+
private loafObserver;
|
|
5480
|
+
constructor(editor: Editor);
|
|
5481
|
+
/**
|
|
5482
|
+
* Subscribe to a performance event. Returns an unsubscribe function.
|
|
5483
|
+
*
|
|
5484
|
+
* @example
|
|
5485
|
+
* ```ts
|
|
5486
|
+
* const unsub = editor.performance.on('interaction-end', (event) => {
|
|
5487
|
+
* sendToAnalytics({ name: event.name, fps: event.fps, p95: event.p95FrameTime })
|
|
5488
|
+
* })
|
|
5489
|
+
* // later: unsub()
|
|
5490
|
+
* ```
|
|
5491
|
+
*
|
|
5492
|
+
* @public
|
|
5493
|
+
*/
|
|
5494
|
+
on<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
5495
|
+
/**
|
|
5496
|
+
* Subscribe to a performance event once. The listener is removed after the first invocation.
|
|
5497
|
+
* Returns an unsubscribe function for early removal.
|
|
5498
|
+
*
|
|
5499
|
+
* @public
|
|
5500
|
+
*/
|
|
5501
|
+
once<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
5502
|
+
/* Excluded from this release type: dispose */
|
|
5503
|
+
/* Excluded from this release type: _notifyInteractionStart */
|
|
5504
|
+
/* Excluded from this release type: _notifyInteractionEnd */
|
|
5505
|
+
/* Excluded from this release type: _notifyCameraOperation */
|
|
5506
|
+
/* Excluded from this release type: _notifyUndoRedo */
|
|
5507
|
+
private _startCameraSession;
|
|
5508
|
+
private _endCameraSession;
|
|
5509
|
+
private _onFrame;
|
|
5510
|
+
private _onShapesCreated;
|
|
5511
|
+
private _onShapesEdited;
|
|
5512
|
+
private _onShapesDeleted;
|
|
5513
|
+
private _startLoafObserver;
|
|
5514
|
+
private _stopLoafObserver;
|
|
5515
|
+
private _needsFrameListener;
|
|
5516
|
+
private _needsLoafObserver;
|
|
5517
|
+
private _maybeAttachLazyListeners;
|
|
5518
|
+
private _maybeDetachLazyListeners;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5209
5521
|
/**
|
|
5210
5522
|
* Find the approximate perimeter of an ellipse.
|
|
5211
5523
|
*
|
|
@@ -5400,6 +5712,16 @@ export declare function resizeScaled(shape: TLBaseShape<any, {
|
|
|
5400
5712
|
y: number;
|
|
5401
5713
|
};
|
|
5402
5714
|
|
|
5715
|
+
/**
|
|
5716
|
+
* Resolve a partial set of user-provided themes into a complete `TLThemes`
|
|
5717
|
+
* record by merging with `DEFAULT_THEME`. The result is suitable for passing to
|
|
5718
|
+
* `registerColorsFromThemes`, `registerFontsFromThemes`, and the
|
|
5719
|
+
* `ThemeManager` constructor.
|
|
5720
|
+
*
|
|
5721
|
+
* @public
|
|
5722
|
+
*/
|
|
5723
|
+
export declare function resolveThemes(themes?: Partial<TLThemes>): TLThemes;
|
|
5724
|
+
|
|
5403
5725
|
/** @public */
|
|
5404
5726
|
export declare type RichTextFontVisitor = (node: TiptapNode, state: RichTextFontVisitorState, addFont: (font: TLFontFace) => void) => RichTextFontVisitorState;
|
|
5405
5727
|
|
|
@@ -5681,12 +6003,32 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5681
6003
|
* @public
|
|
5682
6004
|
*/
|
|
5683
6005
|
static type: string;
|
|
6006
|
+
/**
|
|
6007
|
+
* The asset types that this shape can be created from.
|
|
6008
|
+
* When a file is dropped on the canvas, the editor finds the shape util
|
|
6009
|
+
* whose `handledAssetTypes` includes the asset's type and calls
|
|
6010
|
+
* {@link ShapeUtil.createShapeForAsset} to produce the shape.
|
|
6011
|
+
*
|
|
6012
|
+
* @public
|
|
6013
|
+
*/
|
|
6014
|
+
static handledAssetTypes?: readonly string[];
|
|
5684
6015
|
/**
|
|
5685
6016
|
* Get the default props for a shape.
|
|
5686
6017
|
*
|
|
5687
6018
|
* @public
|
|
5688
6019
|
*/
|
|
5689
6020
|
abstract getDefaultProps(): Shape['props'];
|
|
6021
|
+
/**
|
|
6022
|
+
* Create a shape partial for placing an asset on the canvas.
|
|
6023
|
+
* Only called for shapes whose constructor declares matching
|
|
6024
|
+
* {@link ShapeUtil.handledAssetTypes | `handledAssetTypes`}.
|
|
6025
|
+
*
|
|
6026
|
+
* @param asset - The asset to create a shape for.
|
|
6027
|
+
* @param position - Where to place the shape.
|
|
6028
|
+
* @returns A shape partial, or null if this shape can't be created for the asset.
|
|
6029
|
+
* @public
|
|
6030
|
+
*/
|
|
6031
|
+
createShapeForAsset?(asset: TLAsset, position: VecModel): null | TLShapePartial;
|
|
5690
6032
|
/**
|
|
5691
6033
|
* Get the shape's geometry.
|
|
5692
6034
|
*
|
|
@@ -5767,7 +6109,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5767
6109
|
*
|
|
5768
6110
|
* @public
|
|
5769
6111
|
*/
|
|
5770
|
-
canBind(
|
|
6112
|
+
canBind(opts: TLShapeUtilCanBindOpts): boolean;
|
|
5771
6113
|
/**
|
|
5772
6114
|
* Whether the shape can be double clicked to edit.
|
|
5773
6115
|
*
|
|
@@ -5948,7 +6290,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5948
6290
|
* @param type - The shape type.
|
|
5949
6291
|
* @public
|
|
5950
6292
|
*/
|
|
5951
|
-
canReceiveNewChildrenOfType(shape: Shape,
|
|
6293
|
+
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
5952
6294
|
/**
|
|
5953
6295
|
* Get the shape as an SVG object.
|
|
5954
6296
|
*
|
|
@@ -6391,6 +6733,8 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
6391
6733
|
static children?: () => TLStateNodeConstructor[];
|
|
6392
6734
|
static isLockable: boolean;
|
|
6393
6735
|
static useCoalescedEvents: boolean;
|
|
6736
|
+
/** Set to `true` in subclasses to emit interaction-start/end performance events when this state is entered/exited. */
|
|
6737
|
+
static trackPerformance: boolean;
|
|
6394
6738
|
id: string;
|
|
6395
6739
|
type: 'branch' | 'leaf' | 'root';
|
|
6396
6740
|
shapeType?: string;
|
|
@@ -6525,6 +6869,10 @@ export declare interface SvgExportContext {
|
|
|
6525
6869
|
* Whether the export should be in dark mode.
|
|
6526
6870
|
*/
|
|
6527
6871
|
readonly isDarkMode: boolean;
|
|
6872
|
+
/**
|
|
6873
|
+
* The color mode to use for this export.
|
|
6874
|
+
*/
|
|
6875
|
+
readonly colorMode: 'dark' | 'light';
|
|
6528
6876
|
/**
|
|
6529
6877
|
* The scale of the export - how much CSS pixels will be scaled up/down by.
|
|
6530
6878
|
*/
|
|
@@ -6595,6 +6943,47 @@ export declare class TextManager {
|
|
|
6595
6943
|
}[];
|
|
6596
6944
|
}
|
|
6597
6945
|
|
|
6946
|
+
/**
|
|
6947
|
+
* Manages the editor's color themes.
|
|
6948
|
+
*
|
|
6949
|
+
* Stores named theme definitions (each containing light and dark color palettes
|
|
6950
|
+
* alongside shared properties like font size). The current theme is resolved by
|
|
6951
|
+
* combining the current theme name with the user's color mode preference.
|
|
6952
|
+
*
|
|
6953
|
+
* **Terminology:**
|
|
6954
|
+
* - **Theme** (`TLTheme`): A named set of colors and typographic values for both light and dark modes.
|
|
6955
|
+
* - **Color mode** (`'light' | 'dark'`): The resolved appearance mode, derived from the user's
|
|
6956
|
+
* `colorScheme` preference (`'light' | 'dark' | 'system'`). Access via `getColorMode()`.
|
|
6957
|
+
*
|
|
6958
|
+
* @public
|
|
6959
|
+
*/
|
|
6960
|
+
export declare class ThemeManager {
|
|
6961
|
+
private readonly editor;
|
|
6962
|
+
private readonly _themes;
|
|
6963
|
+
private readonly _currentThemeId;
|
|
6964
|
+
constructor(editor: Editor, options: {
|
|
6965
|
+
initial: TLThemeId;
|
|
6966
|
+
themes: TLThemes;
|
|
6967
|
+
});
|
|
6968
|
+
/** Get the current color mode based on the user's dark mode preference. */
|
|
6969
|
+
getColorMode(): 'dark' | 'light';
|
|
6970
|
+
/** Get all registered theme definitions. */
|
|
6971
|
+
getThemes(): TLThemes;
|
|
6972
|
+
/** Get a single theme definition by id. */
|
|
6973
|
+
getTheme(id: TLThemeId): TLTheme | undefined;
|
|
6974
|
+
/** Get the id of the current theme. */
|
|
6975
|
+
getCurrentThemeId(): TLThemeId;
|
|
6976
|
+
getCurrentTheme(): TLTheme;
|
|
6977
|
+
/** Set the current theme by id. The theme must have been previously registered. */
|
|
6978
|
+
setCurrentTheme(id: TLThemeId): void;
|
|
6979
|
+
/** Replace all theme definitions, or update them via a callback that receives a deep copy. */
|
|
6980
|
+
updateThemes(themes: ((themes: TLThemes) => TLThemes) | TLThemes): void;
|
|
6981
|
+
/** Register or update a named theme definition. */
|
|
6982
|
+
updateTheme(theme: TLTheme): void;
|
|
6983
|
+
/** Clean up any resources held by the manager. */
|
|
6984
|
+
dispose(): void;
|
|
6985
|
+
}
|
|
6986
|
+
|
|
6598
6987
|
/* Excluded from this release type: TickManager */
|
|
6599
6988
|
|
|
6600
6989
|
/**
|
|
@@ -6613,12 +7002,23 @@ export declare type TiptapNode = Node_2;
|
|
|
6613
7002
|
/** @public */
|
|
6614
7003
|
export declare type TLAdjacentDirection = 'down' | 'left' | 'next' | 'prev' | 'right' | 'up';
|
|
6615
7004
|
|
|
7005
|
+
/** @public */
|
|
7006
|
+
export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
|
|
7007
|
+
|
|
6616
7008
|
/** @public */
|
|
6617
7009
|
export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
6618
7010
|
|
|
6619
7011
|
/** @public */
|
|
6620
7012
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
6621
7013
|
|
|
7014
|
+
/** @public */
|
|
7015
|
+
export declare interface TLAssetUtilConstructor<T extends TLAsset = TLAsset, U extends AssetUtil<T> = AssetUtil<T>> {
|
|
7016
|
+
new (editor: Editor): U;
|
|
7017
|
+
type: T['type'];
|
|
7018
|
+
props?: RecordProps<T>;
|
|
7019
|
+
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
7020
|
+
}
|
|
7021
|
+
|
|
6622
7022
|
/** @public */
|
|
6623
7023
|
export declare type TLBaseBoxShape = ExtractShapeByProps<{
|
|
6624
7024
|
h: number;
|
|
@@ -6708,6 +7108,29 @@ export declare interface TLCameraConstraints {
|
|
|
6708
7108
|
};
|
|
6709
7109
|
}
|
|
6710
7110
|
|
|
7111
|
+
/**
|
|
7112
|
+
* Emitted when a camera operation ends (after a 50ms debounce), with aggregated frame time stats.
|
|
7113
|
+
* @public
|
|
7114
|
+
*/
|
|
7115
|
+
export declare interface TLCameraEndPerfEvent extends TLPerfFrameTimeStats {
|
|
7116
|
+
/** Whether this was a pan or zoom operation. */
|
|
7117
|
+
type: 'panning' | 'zooming';
|
|
7118
|
+
/** Total shapes on the current page. */
|
|
7119
|
+
shapeCount: number;
|
|
7120
|
+
/** Number of shapes visible (not culled) in the viewport. */
|
|
7121
|
+
visibleShapeCount: number;
|
|
7122
|
+
/** Number of shapes culled (off-screen) from rendering. */
|
|
7123
|
+
culledShapeCount: number;
|
|
7124
|
+
/** Viewport width in screen pixels. */
|
|
7125
|
+
viewportWidth: number;
|
|
7126
|
+
/** Viewport height in screen pixels. */
|
|
7127
|
+
viewportHeight: number;
|
|
7128
|
+
/** Camera zoom level (`camera.z`) at session end. */
|
|
7129
|
+
zoomLevel: number;
|
|
7130
|
+
/** `performance.now()` when the camera session ended. */
|
|
7131
|
+
timestamp: number;
|
|
7132
|
+
}
|
|
7133
|
+
|
|
6711
7134
|
/** @public */
|
|
6712
7135
|
export declare interface TLCameraMoveOptions {
|
|
6713
7136
|
/** Whether to move the camera immediately, rather than on the next tick. */
|
|
@@ -6746,6 +7169,17 @@ export declare interface TLCameraOptions {
|
|
|
6746
7169
|
constraints?: TLCameraConstraints;
|
|
6747
7170
|
}
|
|
6748
7171
|
|
|
7172
|
+
/**
|
|
7173
|
+
* Emitted when a camera operation (pan or zoom) begins.
|
|
7174
|
+
* @public
|
|
7175
|
+
*/
|
|
7176
|
+
export declare interface TLCameraStartPerfEvent {
|
|
7177
|
+
/** Whether this is a pan or zoom operation. */
|
|
7178
|
+
type: 'panning' | 'zooming';
|
|
7179
|
+
/** `performance.now()` when the camera session started. */
|
|
7180
|
+
timestamp: number;
|
|
7181
|
+
}
|
|
7182
|
+
|
|
6749
7183
|
/** @public */
|
|
6750
7184
|
export declare type TLCancelEvent = (info: TLCancelEventInfo) => void;
|
|
6751
7185
|
|
|
@@ -6968,6 +7402,10 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6968
7402
|
* An array of binding utils to use in the editor.
|
|
6969
7403
|
*/
|
|
6970
7404
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
7405
|
+
/**
|
|
7406
|
+
* An array of asset utils to use in the editor.
|
|
7407
|
+
*/
|
|
7408
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
6971
7409
|
/**
|
|
6972
7410
|
* An array of tools to add to the editor's state chart.
|
|
6973
7411
|
*/
|
|
@@ -6997,9 +7435,21 @@ export declare interface TldrawEditorBaseProps {
|
|
|
6997
7435
|
*/
|
|
6998
7436
|
user?: TLCurrentUser;
|
|
6999
7437
|
/**
|
|
7000
|
-
*
|
|
7438
|
+
* The editor's color scheme. Defaults to `'light'`.
|
|
7439
|
+
*
|
|
7440
|
+
* - `'light'` - Always use light mode.
|
|
7441
|
+
* - `'dark'` - Always use dark mode.
|
|
7442
|
+
* - `'system'` - Follow the OS color scheme preference.
|
|
7443
|
+
*/
|
|
7444
|
+
colorScheme?: 'dark' | 'light' | 'system';
|
|
7445
|
+
/**
|
|
7446
|
+
* Named themes for the editor.
|
|
7001
7447
|
*/
|
|
7002
|
-
|
|
7448
|
+
themes?: Partial<TLThemes>;
|
|
7449
|
+
/**
|
|
7450
|
+
* The id of the initially active theme. Defaults to `'default'`.
|
|
7451
|
+
*/
|
|
7452
|
+
initialTheme?: TLThemeId;
|
|
7003
7453
|
/**
|
|
7004
7454
|
* Camera options for the editor.
|
|
7005
7455
|
*
|
|
@@ -7217,6 +7667,12 @@ export declare interface TldrawOptions {
|
|
|
7217
7667
|
* When false, the spacebar will not pan the camera.
|
|
7218
7668
|
*/
|
|
7219
7669
|
readonly spacebarPanning: boolean;
|
|
7670
|
+
/**
|
|
7671
|
+
* Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
|
|
7672
|
+
* camera and a static right-click opens the context menu at the release position. When false,
|
|
7673
|
+
* right-click opens the context menu on press (no drag-to-pan).
|
|
7674
|
+
*/
|
|
7675
|
+
readonly rightClickPanning: boolean;
|
|
7220
7676
|
/**
|
|
7221
7677
|
* The default padding (in pixels) used when zooming to fit content in the viewport.
|
|
7222
7678
|
* This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
|
|
@@ -7392,14 +7848,13 @@ export declare interface TLEditorOptions {
|
|
|
7392
7848
|
*/
|
|
7393
7849
|
bindingUtils: readonly TLAnyBindingUtilConstructor[];
|
|
7394
7850
|
/**
|
|
7395
|
-
* An array of
|
|
7851
|
+
* An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
|
|
7396
7852
|
*/
|
|
7397
|
-
|
|
7853
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
7398
7854
|
/**
|
|
7399
|
-
*
|
|
7400
|
-
* given, the body element will be used.
|
|
7855
|
+
* An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
|
|
7401
7856
|
*/
|
|
7402
|
-
|
|
7857
|
+
tools: readonly TLStateNodeConstructor[];
|
|
7403
7858
|
/**
|
|
7404
7859
|
* A user defined externally to replace the default user.
|
|
7405
7860
|
*/
|
|
@@ -7412,27 +7867,15 @@ export declare interface TLEditorOptions {
|
|
|
7412
7867
|
* Whether to automatically focus the editor when it mounts.
|
|
7413
7868
|
*/
|
|
7414
7869
|
autoFocus?: boolean;
|
|
7415
|
-
/**
|
|
7416
|
-
* Whether to infer dark mode from the user's system preferences. Defaults to false.
|
|
7417
|
-
*/
|
|
7418
|
-
inferDarkMode?: boolean;
|
|
7419
|
-
/**
|
|
7420
|
-
* Options for the editor's camera.
|
|
7421
|
-
*
|
|
7422
|
-
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
7423
|
-
*/
|
|
7424
|
-
cameraOptions?: Partial<TLCameraOptions>;
|
|
7425
|
-
options?: Partial<TldrawOptions>;
|
|
7426
|
-
/**
|
|
7427
|
-
* Text options for the editor.
|
|
7428
|
-
*
|
|
7429
|
-
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
7430
|
-
*/
|
|
7431
|
-
textOptions?: TLTextOptions;
|
|
7432
7870
|
licenseKey?: string;
|
|
7433
7871
|
fontAssetUrls?: {
|
|
7434
7872
|
[key: string]: string | undefined;
|
|
7435
7873
|
};
|
|
7874
|
+
/**
|
|
7875
|
+
* Should return a containing html element which has all the styles applied to the editor. If not
|
|
7876
|
+
* given, the body element will be used.
|
|
7877
|
+
*/
|
|
7878
|
+
getContainer(): HTMLElement;
|
|
7436
7879
|
/**
|
|
7437
7880
|
* Provides a way to hide shapes.
|
|
7438
7881
|
*
|
|
@@ -7449,6 +7892,40 @@ export declare interface TLEditorOptions {
|
|
|
7449
7892
|
* @param editor - The editor instance.
|
|
7450
7893
|
*/
|
|
7451
7894
|
getShapeVisibility?(shape: TLShape, editor: Editor): 'hidden' | 'inherit' | 'visible' | null | undefined;
|
|
7895
|
+
/**
|
|
7896
|
+
* Named theme definitions for the editor. Each theme contains shared
|
|
7897
|
+
* properties (font size, line height, stroke width) and color palettes
|
|
7898
|
+
* for both light and dark modes.
|
|
7899
|
+
*/
|
|
7900
|
+
themes?: Partial<TLThemes>;
|
|
7901
|
+
/**
|
|
7902
|
+
* The id of the initially active theme. Defaults to `'default'`.
|
|
7903
|
+
*/
|
|
7904
|
+
initialTheme?: TLThemeId;
|
|
7905
|
+
/**
|
|
7906
|
+
* The editor's color scheme preference, controls the default color mode. Defaults to `'light'`.
|
|
7907
|
+
*
|
|
7908
|
+
* - `'light'` - Always use light mode.
|
|
7909
|
+
* - `'dark'` - Always use dark mode.
|
|
7910
|
+
* - `'system'` - Follow the OS color scheme preference.
|
|
7911
|
+
*/
|
|
7912
|
+
colorScheme?: 'dark' | 'light' | 'system';
|
|
7913
|
+
/**
|
|
7914
|
+
* Additional configuration options for the tldraw editor.
|
|
7915
|
+
*/
|
|
7916
|
+
options?: Partial<TldrawOptions>;
|
|
7917
|
+
/**
|
|
7918
|
+
* Options for the editor's camera.
|
|
7919
|
+
*
|
|
7920
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
7921
|
+
*/
|
|
7922
|
+
cameraOptions?: Partial<TLCameraOptions>;
|
|
7923
|
+
/**
|
|
7924
|
+
* Text options for the editor.
|
|
7925
|
+
*
|
|
7926
|
+
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
7927
|
+
*/
|
|
7928
|
+
textOptions?: TLTextOptions;
|
|
7452
7929
|
}
|
|
7453
7930
|
|
|
7454
7931
|
/**
|
|
@@ -7507,6 +7984,7 @@ export declare const tlenv: {
|
|
|
7507
7984
|
*/
|
|
7508
7985
|
export declare const tlenvReactive: Atom< {
|
|
7509
7986
|
isCoarsePointer: boolean;
|
|
7987
|
+
supportsP3ColorSpace: boolean;
|
|
7510
7988
|
}, unknown>;
|
|
7511
7989
|
|
|
7512
7990
|
/** @public */
|
|
@@ -7635,6 +8113,7 @@ export declare interface TLFileReplaceExternalContent extends TLBaseExternalCont
|
|
|
7635
8113
|
type: 'file-replace';
|
|
7636
8114
|
file: File;
|
|
7637
8115
|
shapeId: TLShapeId;
|
|
8116
|
+
/** @deprecated This field is no longer used by the default handler. It may be removed in a future version. */
|
|
7638
8117
|
isImage: boolean;
|
|
7639
8118
|
}
|
|
7640
8119
|
|
|
@@ -7646,69 +8125,18 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
|
|
|
7646
8125
|
}
|
|
7647
8126
|
|
|
7648
8127
|
/**
|
|
7649
|
-
*
|
|
7650
|
-
* ones in the
|
|
7651
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face | css `@font-face` rule}.
|
|
7652
|
-
* @public
|
|
7653
|
-
*/
|
|
7654
|
-
export declare interface TLFontFace {
|
|
7655
|
-
/**
|
|
7656
|
-
* How this font can be referred to in CSS.
|
|
7657
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family | `font-family`}.
|
|
7658
|
-
*/
|
|
7659
|
-
readonly family: string;
|
|
7660
|
-
/**
|
|
7661
|
-
* The source of the font. This
|
|
7662
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`}.
|
|
7663
|
-
*/
|
|
7664
|
-
readonly src: TLFontFaceSource;
|
|
7665
|
-
/**
|
|
7666
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override | `ascent-override`}.
|
|
7667
|
-
*/
|
|
7668
|
-
readonly ascentOverride?: string;
|
|
7669
|
-
/**
|
|
7670
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/descent-override | `descent-override`}.
|
|
7671
|
-
*/
|
|
7672
|
-
readonly descentOverride?: string;
|
|
7673
|
-
/**
|
|
7674
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-stretch | `font-stretch`}.
|
|
7675
|
-
*/
|
|
7676
|
-
readonly stretch?: string;
|
|
7677
|
-
/**
|
|
7678
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style | `font-style`}.
|
|
7679
|
-
*/
|
|
7680
|
-
readonly style?: string;
|
|
7681
|
-
/**
|
|
7682
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight | `font-weight`}.
|
|
7683
|
-
*/
|
|
7684
|
-
readonly weight?: string;
|
|
7685
|
-
/**
|
|
7686
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-feature-settings | `font-feature-settings`}.
|
|
7687
|
-
*/
|
|
7688
|
-
readonly featureSettings?: string;
|
|
7689
|
-
/**
|
|
7690
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/line-gap-override | `line-gap-override`}.
|
|
7691
|
-
*/
|
|
7692
|
-
readonly lineGapOverride?: string;
|
|
7693
|
-
/**
|
|
7694
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range | `unicode-range`}.
|
|
7695
|
-
*/
|
|
7696
|
-
readonly unicodeRange?: string;
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
/**
|
|
7700
|
-
* Represents the `src` property of a {@link TLFontFace}.
|
|
7701
|
-
* See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src | `src`} for details of the properties here.
|
|
8128
|
+
* Emitted every animation frame when at least one `'frame'` listener is registered.
|
|
7702
8129
|
* @public
|
|
7703
8130
|
*/
|
|
7704
|
-
export declare interface
|
|
7705
|
-
/**
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
8131
|
+
export declare interface TLFramePerfEvent {
|
|
8132
|
+
/** Time since the last frame in ms. */
|
|
8133
|
+
elapsed: number;
|
|
8134
|
+
/** Total shapes on the current page. */
|
|
8135
|
+
shapeCount: number;
|
|
8136
|
+
/** Number of shapes culled (off-screen) from rendering. */
|
|
8137
|
+
culledShapeCount: number;
|
|
8138
|
+
/** Number of shapes visible (not culled) in the viewport. */
|
|
8139
|
+
visibleShapeCount: number;
|
|
7712
8140
|
}
|
|
7713
8141
|
|
|
7714
8142
|
/** Additional options for the {@link ShapeUtil.getGeometry} method.
|
|
@@ -7853,6 +8281,38 @@ export declare type TLIndicatorPath = {
|
|
|
7853
8281
|
path: Path2D;
|
|
7854
8282
|
} | Path2D;
|
|
7855
8283
|
|
|
8284
|
+
/**
|
|
8285
|
+
* Emitted when an interaction state is exited, with aggregated frame time stats.
|
|
8286
|
+
* @public
|
|
8287
|
+
*/
|
|
8288
|
+
export declare interface TLInteractionEndPerfEvent extends TLPerfFrameTimeStats {
|
|
8289
|
+
/** The state node id (e.g. `'translating'`). */
|
|
8290
|
+
name: string;
|
|
8291
|
+
/** Full tool path (e.g. `'select.translating'`). */
|
|
8292
|
+
path: string;
|
|
8293
|
+
/** Total shapes on the current page. */
|
|
8294
|
+
shapeCount: number;
|
|
8295
|
+
/** Breakdown of selected shape types at interaction start (e.g. `{ geo: 2, draw: 1 }`). */
|
|
8296
|
+
selectedShapeTypes: Record<string, number>;
|
|
8297
|
+
/** Camera zoom level (`camera.z`) at interaction end. */
|
|
8298
|
+
zoomLevel: number;
|
|
8299
|
+
/** `performance.now()` when the interaction ended. */
|
|
8300
|
+
timestamp: number;
|
|
8301
|
+
}
|
|
8302
|
+
|
|
8303
|
+
/**
|
|
8304
|
+
* Emitted when an interaction state (e.g. translating, resizing) is entered.
|
|
8305
|
+
* @public
|
|
8306
|
+
*/
|
|
8307
|
+
export declare interface TLInteractionStartPerfEvent {
|
|
8308
|
+
/** The state node id (e.g. `'translating'`). */
|
|
8309
|
+
name: string;
|
|
8310
|
+
/** Full tool path (e.g. `'select.translating'`). */
|
|
8311
|
+
path: string;
|
|
8312
|
+
/** `performance.now()` when the interaction started. */
|
|
8313
|
+
timestamp: number;
|
|
8314
|
+
}
|
|
8315
|
+
|
|
7856
8316
|
/** @public */
|
|
7857
8317
|
export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
7858
8318
|
|
|
@@ -8100,6 +8560,94 @@ export declare const tlmenus: {
|
|
|
8100
8560
|
*/
|
|
8101
8561
|
export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
|
|
8102
8562
|
|
|
8563
|
+
/**
|
|
8564
|
+
* Map of all performance event names to their payload types.
|
|
8565
|
+
* Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
|
|
8566
|
+
* @public
|
|
8567
|
+
*/
|
|
8568
|
+
export declare interface TLPerfEventMap {
|
|
8569
|
+
/** An interaction state was entered. */
|
|
8570
|
+
'interaction-start': [TLInteractionStartPerfEvent];
|
|
8571
|
+
/** An interaction state was exited, with aggregated frame time stats. */
|
|
8572
|
+
'interaction-end': [TLInteractionEndPerfEvent];
|
|
8573
|
+
/** A camera operation (pan/zoom) began. */
|
|
8574
|
+
'camera-start': [TLCameraStartPerfEvent];
|
|
8575
|
+
/** A camera operation ended (after debounce), with aggregated frame time stats. */
|
|
8576
|
+
'camera-end': [TLCameraEndPerfEvent];
|
|
8577
|
+
/** Shapes were created. */
|
|
8578
|
+
'shapes-created': [TLShapeOperationPerfEvent];
|
|
8579
|
+
/** Shapes were updated. */
|
|
8580
|
+
'shapes-updated': [TLShapeOperationPerfEvent];
|
|
8581
|
+
/** Shapes were deleted. */
|
|
8582
|
+
'shapes-deleted': [TLShapeOperationPerfEvent];
|
|
8583
|
+
/** An animation frame was rendered. Only fires when listeners are registered. */
|
|
8584
|
+
frame: [TLFramePerfEvent];
|
|
8585
|
+
/** An undo operation was performed. */
|
|
8586
|
+
undo: [TLUndoRedoPerfEvent];
|
|
8587
|
+
/** A redo operation was performed. */
|
|
8588
|
+
redo: [TLUndoRedoPerfEvent];
|
|
8589
|
+
}
|
|
8590
|
+
|
|
8591
|
+
/**
|
|
8592
|
+
* Common frame time statistics shared by interaction and camera end events.
|
|
8593
|
+
* @public
|
|
8594
|
+
*/
|
|
8595
|
+
export declare interface TLPerfFrameTimeStats {
|
|
8596
|
+
/** Total duration of the session in ms. */
|
|
8597
|
+
duration: number;
|
|
8598
|
+
/** Average frames per second during the session. */
|
|
8599
|
+
fps: number;
|
|
8600
|
+
/** Total number of frames recorded. */
|
|
8601
|
+
frameCount: number;
|
|
8602
|
+
/** Mean frame duration in ms. */
|
|
8603
|
+
avgFrameTime: number;
|
|
8604
|
+
/** Median (p50) frame duration in ms. */
|
|
8605
|
+
medianFrameTime: number;
|
|
8606
|
+
/** 95th percentile frame duration in ms. */
|
|
8607
|
+
p95FrameTime: number;
|
|
8608
|
+
/** 99th percentile frame duration in ms. */
|
|
8609
|
+
p99FrameTime: number;
|
|
8610
|
+
/** Shortest frame duration in ms. */
|
|
8611
|
+
minFrameTime: number;
|
|
8612
|
+
/** Longest frame duration in ms. */
|
|
8613
|
+
maxFrameTime: number;
|
|
8614
|
+
/** Raw frame durations for local analysis. Exclude when sending to analytics. */
|
|
8615
|
+
frameTimes: number[];
|
|
8616
|
+
/**
|
|
8617
|
+
* Long animation frames observed during this period (Chromium 123+).
|
|
8618
|
+
* Only present when the browser supports the Long Animation Frames API and
|
|
8619
|
+
* at least one long frame was observed.
|
|
8620
|
+
* Exclude when sending to analytics — entries are large and contain script URLs.
|
|
8621
|
+
*/
|
|
8622
|
+
longAnimationFrames?: TLPerfLongAnimationFrame[];
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
/**
|
|
8626
|
+
* A long animation frame observed by the browser during an interaction.
|
|
8627
|
+
* Available only in browsers that support the Long Animation Frames API (Chromium 123+).
|
|
8628
|
+
* @public
|
|
8629
|
+
*/
|
|
8630
|
+
export declare interface TLPerfLongAnimationFrame {
|
|
8631
|
+
/** Frame start time (relative to timeOrigin). */
|
|
8632
|
+
startTime: number;
|
|
8633
|
+
/** Total frame duration in ms. */
|
|
8634
|
+
duration: number;
|
|
8635
|
+
/** Time the main thread was blocked in ms. */
|
|
8636
|
+
blockingDuration: number;
|
|
8637
|
+
/** Scripts that contributed to the long frame. */
|
|
8638
|
+
scripts: TLPerfLongAnimationFrameScript[];
|
|
8639
|
+
}
|
|
8640
|
+
|
|
8641
|
+
/** A script attribution entry from a long animation frame. @public */
|
|
8642
|
+
export declare interface TLPerfLongAnimationFrameScript {
|
|
8643
|
+
/** The script source URL (may be empty for inline scripts). */
|
|
8644
|
+
sourceURL: string;
|
|
8645
|
+
/** The function name or invoker description. */
|
|
8646
|
+
invoker: string;
|
|
8647
|
+
/** Time spent in this script in ms. */
|
|
8648
|
+
duration: number;
|
|
8649
|
+
}
|
|
8650
|
+
|
|
8103
8651
|
/** @public */
|
|
8104
8652
|
export declare type TLPinchEvent = (info: TLPinchEventInfo) => void;
|
|
8105
8653
|
|
|
@@ -8287,6 +8835,21 @@ export declare interface TLShapeIndicatorsProps {
|
|
|
8287
8835
|
showAll?: boolean;
|
|
8288
8836
|
}
|
|
8289
8837
|
|
|
8838
|
+
/**
|
|
8839
|
+
* Emitted when shapes are created, updated, or deleted.
|
|
8840
|
+
* @public
|
|
8841
|
+
*/
|
|
8842
|
+
export declare interface TLShapeOperationPerfEvent {
|
|
8843
|
+
/** The operation type. */
|
|
8844
|
+
operation: 'create' | 'delete' | 'update';
|
|
8845
|
+
/** Number of shapes affected. */
|
|
8846
|
+
count: number;
|
|
8847
|
+
/** Breakdown by shape type (e.g. `{ geo: 2, draw: 1 }`). */
|
|
8848
|
+
shapeTypes: Record<string, number>;
|
|
8849
|
+
/** `performance.now()` when the operation occurred. */
|
|
8850
|
+
timestamp: number;
|
|
8851
|
+
}
|
|
8852
|
+
|
|
8290
8853
|
/**
|
|
8291
8854
|
* Options passed to {@link ShapeUtil.canBeLaidOut}.
|
|
8292
8855
|
*
|
|
@@ -8344,6 +8907,7 @@ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends Sha
|
|
|
8344
8907
|
type: T['type'];
|
|
8345
8908
|
props?: RecordProps<T>;
|
|
8346
8909
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
8910
|
+
handledAssetTypes?: readonly string[];
|
|
8347
8911
|
}
|
|
8348
8912
|
|
|
8349
8913
|
/** @public */
|
|
@@ -8371,6 +8935,7 @@ export declare interface TLStateNodeConstructor {
|
|
|
8371
8935
|
children?(): TLStateNodeConstructor[];
|
|
8372
8936
|
isLockable: boolean;
|
|
8373
8937
|
useCoalescedEvents: boolean;
|
|
8938
|
+
trackPerformance: boolean;
|
|
8374
8939
|
}
|
|
8375
8940
|
|
|
8376
8941
|
/** @public */
|
|
@@ -8383,6 +8948,12 @@ export declare interface TLStoreBaseOptions {
|
|
|
8383
8948
|
defaultName?: string;
|
|
8384
8949
|
/** How should this store upload & resolve assets? */
|
|
8385
8950
|
assets?: TLAssetStore;
|
|
8951
|
+
/**
|
|
8952
|
+
* Named theme definitions. When provided, custom color names are automatically
|
|
8953
|
+
* registered before the store is constructed so persisted data with those
|
|
8954
|
+
* colors passes validation on load.
|
|
8955
|
+
*/
|
|
8956
|
+
themes?: Partial<TLThemes>;
|
|
8386
8957
|
/** How should this store resolve users for attribution? */
|
|
8387
8958
|
users?: TLUserStore;
|
|
8388
8959
|
/** Called when the store is connected to an {@link @tldraw/editor#Editor}. */
|
|
@@ -8404,6 +8975,7 @@ export declare type TLStoreOptions = TLStoreBaseOptions & {
|
|
|
8404
8975
|
|
|
8405
8976
|
/** @public */
|
|
8406
8977
|
export declare type TLStoreSchemaOptions = {
|
|
8978
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
8407
8979
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
8408
8980
|
migrations?: readonly MigrationSequence[];
|
|
8409
8981
|
records?: Record<string, CustomRecordInfo>;
|
|
@@ -8541,6 +9113,19 @@ export declare interface TLTldrawExternalContentSource {
|
|
|
8541
9113
|
data: TLContent;
|
|
8542
9114
|
}
|
|
8543
9115
|
|
|
9116
|
+
/**
|
|
9117
|
+
* Emitted after an undo or redo operation.
|
|
9118
|
+
* @public
|
|
9119
|
+
*/
|
|
9120
|
+
export declare interface TLUndoRedoPerfEvent {
|
|
9121
|
+
/** Whether this was an undo or redo. */
|
|
9122
|
+
type: 'redo' | 'undo';
|
|
9123
|
+
/** Number of undo steps remaining. */
|
|
9124
|
+
undoDepth: number;
|
|
9125
|
+
/** Number of redo steps remaining. */
|
|
9126
|
+
redoDepth: number;
|
|
9127
|
+
}
|
|
9128
|
+
|
|
8544
9129
|
/** @public */
|
|
8545
9130
|
export declare interface TLUpdatePointerOptions {
|
|
8546
9131
|
/** Whether to update the pointer immediately, rather than on the next tick. */
|
|
@@ -8672,6 +9257,9 @@ export declare function uniq<T>(array: {
|
|
|
8672
9257
|
readonly length: number;
|
|
8673
9258
|
} | null | undefined): T[];
|
|
8674
9259
|
|
|
9260
|
+
/** @public */
|
|
9261
|
+
export declare function useColorMode(): 'dark' | 'light';
|
|
9262
|
+
|
|
8675
9263
|
/** @public */
|
|
8676
9264
|
export declare function useContainer(): HTMLElement;
|
|
8677
9265
|
|
|
@@ -8710,9 +9298,6 @@ export declare function useGlobalMenuIsOpen(id: string, onChange?: (isOpen: bool
|
|
|
8710
9298
|
/** @public */
|
|
8711
9299
|
export declare function useIsCropping(shapeId: TLShapeId): boolean;
|
|
8712
9300
|
|
|
8713
|
-
/** @public */
|
|
8714
|
-
export declare function useIsDarkMode(): boolean;
|
|
8715
|
-
|
|
8716
9301
|
/** @public */
|
|
8717
9302
|
export declare function useIsEditing(shapeId: TLShapeId): boolean;
|
|
8718
9303
|
|
|
@@ -8750,11 +9335,11 @@ export declare function usePresence(userId: string): null | TLInstancePresence;
|
|
|
8750
9335
|
/** @public */
|
|
8751
9336
|
export declare class UserPreferencesManager {
|
|
8752
9337
|
private readonly user;
|
|
8753
|
-
private readonly
|
|
9338
|
+
private readonly colorScheme;
|
|
8754
9339
|
systemColorScheme: Atom<"dark" | "light", unknown>;
|
|
8755
9340
|
disposables: Set<() => void>;
|
|
8756
9341
|
dispose(): void;
|
|
8757
|
-
constructor(user: TLCurrentUser,
|
|
9342
|
+
constructor(user: TLCurrentUser, colorScheme: 'dark' | 'light' | 'system');
|
|
8758
9343
|
updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;
|
|
8759
9344
|
getUserPreferences(): {
|
|
8760
9345
|
animationSpeed: number;
|