@tldraw/editor 4.6.0-canary.7effedd9627e → 4.6.0-canary.7f4e14d54aaa
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 +886 -161
- package/dist-cjs/index.js +18 -21
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +10 -0
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- 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/CanvasOverlays.js +180 -0
- package/dist-cjs/lib/components/default-components/CanvasOverlays.js.map +7 -0
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +33 -236
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
- package/dist-cjs/lib/config/createTLStore.js +2 -0
- package/dist-cjs/lib/config/createTLStore.js.map +2 -2
- package/dist-cjs/lib/{components/default-components/DefaultShapeIndicatorErrorFallback.js → config/defaultAssets.js} +17 -9
- package/dist-cjs/lib/config/defaultAssets.js.map +7 -0
- package/dist-cjs/lib/editor/Editor.js +226 -32
- 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/CollaboratorsManager/CollaboratorsManager.js +98 -0
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +7 -0
- 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 +1 -1
- 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/{components/default-components/DefaultHandles.js → editor/managers/PerformanceManager/perf-types.js} +3 -14
- 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 +2 -1
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
- 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 +1 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/ThemeManager.js.map +1 -1
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js +14 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +2 -2
- 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 +2 -0
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +1 -1
- package/dist-cjs/lib/editor/overlays/OverlayManager.js +154 -0
- package/dist-cjs/lib/editor/overlays/OverlayManager.js.map +7 -0
- package/dist-cjs/lib/editor/overlays/OverlayUtil.js +92 -0
- package/dist-cjs/lib/editor/overlays/OverlayUtil.js.map +7 -0
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js +161 -0
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +76 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +25 -20
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +33 -3
- 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/event-types.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/fetchCache.js +1 -1
- package/dist-cjs/lib/exports/fetchCache.js.map +2 -2
- package/dist-cjs/lib/exports/getSvgJsx.js +2 -1
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/hooks/EditorComponentsContext.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/useEditorComponents.js +0 -28
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePeerIds.js +1 -36
- package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
- package/dist-cjs/lib/hooks/useShapeCulling.js +2 -1
- package/dist-cjs/lib/hooks/useShapeCulling.js.map +2 -2
- 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/runtime.js +2 -1
- package/dist-cjs/lib/utils/runtime.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +5 -0
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
- 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 +886 -161
- package/dist-esm/index.mjs +23 -39
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +10 -0
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- 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/CanvasOverlays.mjs +160 -0
- package/dist-esm/lib/components/default-components/CanvasOverlays.mjs.map +7 -0
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +34 -237
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +3 -3
- package/dist-esm/lib/config/createTLStore.mjs +2 -0
- 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 +227 -34
- 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/CollaboratorsManager/CollaboratorsManager.mjs +83 -0
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +7 -0
- 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 +1 -1
- 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 +2 -1
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
- 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 +1 -0
- package/dist-esm/lib/editor/managers/ThemeManager/ThemeManager.mjs.map +1 -1
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs +14 -0
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +2 -2
- 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 +2 -0
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +1 -1
- package/dist-esm/lib/editor/overlays/OverlayManager.mjs +136 -0
- package/dist-esm/lib/editor/overlays/OverlayManager.mjs.map +7 -0
- package/dist-esm/lib/editor/overlays/OverlayUtil.mjs +72 -0
- package/dist-esm/lib/editor/overlays/OverlayUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs +141 -0
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +56 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +25 -20
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +33 -3
- 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/event-types.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/fetchCache.mjs +2 -2
- package/dist-esm/lib/exports/fetchCache.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs +2 -1
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/hooks/EditorComponentsContext.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/useEditorComponents.mjs +0 -28
- package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs +2 -40
- package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
- package/dist-esm/lib/hooks/useShapeCulling.mjs +2 -1
- package/dist-esm/lib/hooks/useShapeCulling.mjs.map +2 -2
- 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/runtime.mjs +2 -1
- package/dist-esm/lib/utils/runtime.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +5 -0
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
- 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 +3 -223
- package/package.json +7 -7
- package/src/index.ts +31 -38
- package/src/lib/TldrawEditor.tsx +25 -3
- package/src/lib/components/MenuClickCapture.tsx +129 -49
- package/src/lib/components/default-components/CanvasOverlays.tsx +208 -0
- package/src/lib/components/default-components/DefaultCanvas.tsx +38 -310
- package/src/lib/config/createTLStore.ts +7 -1
- package/src/lib/config/defaultAssets.ts +19 -0
- package/src/lib/editor/Editor.test.ts +3 -1
- package/src/lib/editor/Editor.ts +276 -37
- package/src/lib/editor/assets/AssetUtil.ts +85 -0
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +98 -0
- 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/SnapManager/SnapManager.test.ts +13 -2
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
- package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +14 -0
- package/src/lib/editor/overlays/OverlayManager.ts +183 -0
- package/src/lib/editor/overlays/OverlayUtil.ts +143 -0
- package/src/lib/editor/overlays/ShapeIndicatorOverlayUtil.ts +216 -0
- package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +123 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +53 -27
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +41 -4
- package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +7 -0
- package/src/lib/editor/tools/StateNode.ts +16 -18
- package/src/lib/editor/types/event-types.ts +2 -0
- package/src/lib/editor/types/external-content.ts +1 -0
- package/src/lib/exports/fetchCache.ts +2 -4
- package/src/lib/exports/getSvgJsx.test.ts +3 -1
- package/src/lib/exports/getSvgJsx.tsx +2 -1
- package/src/lib/hooks/EditorComponentsContext.tsx +0 -27
- package/src/lib/hooks/useCanvasEvents.ts +40 -3
- package/src/lib/hooks/useEditorComponents.tsx +0 -28
- package/src/lib/hooks/usePeerIds.ts +6 -55
- package/src/lib/hooks/useShapeCulling.tsx +3 -1
- package/src/lib/options.ts +7 -0
- package/src/lib/utils/reparenting.ts +6 -2
- package/src/lib/utils/runtime.ts +3 -1
- package/src/lib/utils/sync/TLLocalSyncClient.ts +3 -0
- package/src/lib/utils/sync/hardReset.ts +0 -8
- package/src/version.ts +3 -3
- package/dist-cjs/lib/components/LiveCollaborators.js +0 -151
- package/dist-cjs/lib/components/LiveCollaborators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +0 -227
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultBrush.js +0 -38
- package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +0 -71
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultHandle.js +0 -56
- package/dist-cjs/lib/components/default-components/DefaultHandle.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultHandles.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultScribble.js +0 -51
- package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js +0 -69
- package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +0 -107
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +0 -101
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js +0 -170
- package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js.map +0 -7
- package/dist-esm/lib/components/LiveCollaborators.mjs +0 -134
- package/dist-esm/lib/components/LiveCollaborators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +0 -207
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultBrush.mjs +0 -18
- package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +0 -41
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultHandle.mjs +0 -26
- package/dist-esm/lib/components/default-components/DefaultHandle.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultHandles.mjs +0 -8
- package/dist-esm/lib/components/default-components/DefaultHandles.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs +0 -21
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs +0 -39
- package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +0 -77
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs +0 -8
- package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +0 -81
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs +0 -142
- package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs.map +0 -7
- package/src/lib/components/LiveCollaborators.tsx +0 -174
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +0 -289
- package/src/lib/components/default-components/DefaultBrush.tsx +0 -35
- package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +0 -52
- package/src/lib/components/default-components/DefaultHandle.tsx +0 -42
- package/src/lib/components/default-components/DefaultHandles.tsx +0 -15
- package/src/lib/components/default-components/DefaultScribble.tsx +0 -31
- package/src/lib/components/default-components/DefaultSelectionForeground.tsx +0 -50
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +0 -104
- package/src/lib/components/default-components/DefaultShapeIndicatorErrorFallback.tsx +0 -9
- package/src/lib/components/default-components/DefaultShapeIndicators.tsx +0 -116
- package/src/lib/components/default-components/DefaultSnapIndictor.tsx +0 -174
package/dist-cjs/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { JsonObject } from '@tldraw/utils';
|
|
|
19
19
|
import { JSX } from 'react/jsx-runtime';
|
|
20
20
|
import { LegacyMigrations } from '@tldraw/store';
|
|
21
21
|
import { MigrationSequence } from '@tldraw/store';
|
|
22
|
-
import { NamedExoticComponent } from 'react';
|
|
23
22
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
24
23
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
25
24
|
import { PointerEvent as PointerEvent_2 } from 'react';
|
|
@@ -88,6 +87,7 @@ import { TLTheme } from '@tldraw/tlschema';
|
|
|
88
87
|
import { TLThemeColors } from '@tldraw/tlschema';
|
|
89
88
|
import { TLThemeId } from '@tldraw/tlschema';
|
|
90
89
|
import { TLThemes } from '@tldraw/tlschema';
|
|
90
|
+
import { TLUnknownAsset } from '@tldraw/tlschema';
|
|
91
91
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
92
92
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
93
93
|
import { TLUser } from '@tldraw/tlschema';
|
|
@@ -154,6 +154,51 @@ export declare class Arc2d extends Geometry2d {
|
|
|
154
154
|
*/
|
|
155
155
|
export declare function areAnglesCompatible(a: number, b: number): boolean;
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Abstract base class for defining asset-type-specific behavior.
|
|
159
|
+
*
|
|
160
|
+
* Each asset type (image, video, bookmark, etc.) has a corresponding AssetUtil that handles
|
|
161
|
+
* type-specific operations like determining supported MIME types and creating assets from files.
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
export declare abstract class AssetUtil<Asset extends TLAsset = TLAsset> {
|
|
166
|
+
editor: Editor;
|
|
167
|
+
/** Configure this asset util's {@link AssetUtil.options | `options`}. */
|
|
168
|
+
static configure<T extends TLAssetUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
169
|
+
options: infer Options;
|
|
170
|
+
} ? Partial<Options> : never): T;
|
|
171
|
+
constructor(editor: Editor);
|
|
172
|
+
/**
|
|
173
|
+
* Options for this asset util. Override this to provide customization options for your asset.
|
|
174
|
+
* Use {@link AssetUtil.configure} to customize existing asset utils.
|
|
175
|
+
*/
|
|
176
|
+
options: {};
|
|
177
|
+
static props?: RecordProps<TLUnknownAsset>;
|
|
178
|
+
static migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
179
|
+
/**
|
|
180
|
+
* The type of the asset util, which should match the asset's type.
|
|
181
|
+
*/
|
|
182
|
+
static type: string;
|
|
183
|
+
/**
|
|
184
|
+
* Get the default props for an asset of this type.
|
|
185
|
+
*/
|
|
186
|
+
abstract getDefaultProps(): Asset['props'];
|
|
187
|
+
/**
|
|
188
|
+
* Get the MIME types that this asset type supports.
|
|
189
|
+
* Return an empty array if this asset type doesn't support files (e.g. bookmarks).
|
|
190
|
+
*/
|
|
191
|
+
getSupportedMimeTypes(): readonly string[];
|
|
192
|
+
/**
|
|
193
|
+
* Check whether this asset type accepts a given MIME type.
|
|
194
|
+
*/
|
|
195
|
+
acceptsMimeType(mimeType: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Create an asset from a file. Return null if this asset type can't handle the file.
|
|
198
|
+
*/
|
|
199
|
+
getAssetFromFile(_file: File, _assetId: TLAssetId): Promise<Asset | null>;
|
|
200
|
+
}
|
|
201
|
+
|
|
157
202
|
/** @public */
|
|
158
203
|
export declare function average(A: VecLike, B: VecLike): string;
|
|
159
204
|
|
|
@@ -174,6 +219,56 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
|
|
|
174
219
|
getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
|
|
175
220
|
}
|
|
176
221
|
|
|
222
|
+
/**
|
|
223
|
+
* A base class for frame-like shapes — containers that clip their children,
|
|
224
|
+
* require full-brush selection, block erasure from inside, and support
|
|
225
|
+
* drag-and-drop reparenting.
|
|
226
|
+
*
|
|
227
|
+
* Extending this class is the easiest way to create a custom frame-like shape.
|
|
228
|
+
* It provides sensible defaults for all frame-like behaviors:
|
|
229
|
+
*
|
|
230
|
+
* - `isFrameLike()` returns `true`
|
|
231
|
+
* - `providesBackgroundForChildren()` returns `true`
|
|
232
|
+
* - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
|
|
233
|
+
* - `getClipPath()` returns the shape geometry's vertices
|
|
234
|
+
* - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
|
|
235
|
+
* - `onDragShapesOut()` reparents shapes back to the page
|
|
236
|
+
*
|
|
237
|
+
* All methods can be overridden for custom behavior.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
|
|
242
|
+
* static override type = 'my-container' as const
|
|
243
|
+
* static override props = myContainerShapeProps
|
|
244
|
+
*
|
|
245
|
+
* override getDefaultProps() {
|
|
246
|
+
* return { w: 300, h: 200 }
|
|
247
|
+
* }
|
|
248
|
+
*
|
|
249
|
+
* override component(shape: MyContainerShape) {
|
|
250
|
+
* return <SVGContainer>...</SVGContainer>
|
|
251
|
+
* }
|
|
252
|
+
*
|
|
253
|
+
* override getIndicatorPath(shape: MyContainerShape) {
|
|
254
|
+
* const path = new Path2D()
|
|
255
|
+
* path.rect(0, 0, shape.props.w, shape.props.h)
|
|
256
|
+
* return path
|
|
257
|
+
* }
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
|
|
264
|
+
isFrameLike(_shape: Shape): boolean;
|
|
265
|
+
providesBackgroundForChildren(): boolean;
|
|
266
|
+
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
267
|
+
getClipPath(shape: Shape): undefined | Vec[];
|
|
268
|
+
onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
|
|
269
|
+
onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
|
|
270
|
+
}
|
|
271
|
+
|
|
177
272
|
/** @public */
|
|
178
273
|
export declare interface BatchMeasurementRequest {
|
|
179
274
|
html: string;
|
|
@@ -673,6 +768,49 @@ export declare class ClickManager {
|
|
|
673
768
|
*/
|
|
674
769
|
export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
675
770
|
|
|
771
|
+
/**
|
|
772
|
+
* Tracks remote peers and exposes the collaborator-related queries used by the
|
|
773
|
+
* editor and its overlays. Encapsulates the visibility clock that periodically
|
|
774
|
+
* re-evaluates which collaborators should be visible based on activity.
|
|
775
|
+
*
|
|
776
|
+
* Accessed via {@link Editor.collaborators}.
|
|
777
|
+
*
|
|
778
|
+
* @public
|
|
779
|
+
*/
|
|
780
|
+
export declare class CollaboratorsManager {
|
|
781
|
+
private readonly editor;
|
|
782
|
+
constructor(editor: Editor);
|
|
783
|
+
/**
|
|
784
|
+
* Drives reactive re-evaluation of {@link CollaboratorsManager.getVisibleCollaborators}.
|
|
785
|
+
* Ticked on a fixed interval so callers don't need to manage their own activity timers.
|
|
786
|
+
*/
|
|
787
|
+
private readonly _visibilityClock;
|
|
788
|
+
private _getCollaboratorsQuery;
|
|
789
|
+
/**
|
|
790
|
+
* Returns a list of presence records for all peer collaborators.
|
|
791
|
+
* This will return the latest presence record for each connected user.
|
|
792
|
+
*/
|
|
793
|
+
getCollaborators(): TLInstancePresence[];
|
|
794
|
+
/**
|
|
795
|
+
* Returns a list of presence records for all peer collaborators on the current page.
|
|
796
|
+
* This will return the latest presence record for each connected user.
|
|
797
|
+
*/
|
|
798
|
+
getCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
799
|
+
/**
|
|
800
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
801
|
+
* shown in the UI. Filters {@link CollaboratorsManager.getCollaborators} by activity
|
|
802
|
+
* state (active / idle / inactive) and visibility rules such as following and
|
|
803
|
+
* highlighted users. Re-evaluates on the visibility clock, so callers don't need to
|
|
804
|
+
* drive their own activity timer.
|
|
805
|
+
*/
|
|
806
|
+
getVisibleCollaborators(): TLInstancePresence[];
|
|
807
|
+
/**
|
|
808
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
809
|
+
* shown in the UI, filtered to those on the current page.
|
|
810
|
+
*/
|
|
811
|
+
getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
812
|
+
}
|
|
813
|
+
|
|
676
814
|
/**
|
|
677
815
|
* @public
|
|
678
816
|
* @react
|
|
@@ -835,51 +973,21 @@ export declare const DEFAULT_THEME: TLTheme;
|
|
|
835
973
|
/** @public @react */
|
|
836
974
|
export declare function DefaultBackground(): JSX.Element;
|
|
837
975
|
|
|
838
|
-
/** @public @react */
|
|
839
|
-
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
|
|
840
|
-
|
|
841
976
|
/** @public @react */
|
|
842
977
|
export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
843
978
|
|
|
844
|
-
/** @public @react */
|
|
845
|
-
export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
|
|
846
|
-
|
|
847
|
-
/** @public @react */
|
|
848
|
-
export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
849
|
-
|
|
850
979
|
/** @public @react */
|
|
851
980
|
export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
852
981
|
|
|
853
982
|
/** @public @react */
|
|
854
983
|
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
855
984
|
|
|
856
|
-
/** @public @react */
|
|
857
|
-
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
|
|
858
|
-
|
|
859
|
-
/** @public @react */
|
|
860
|
-
export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
|
|
861
|
-
|
|
862
|
-
/** @public @react */
|
|
863
|
-
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
|
|
864
|
-
|
|
865
985
|
/** @public @react */
|
|
866
986
|
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
867
987
|
|
|
868
|
-
/** @public @react */
|
|
869
|
-
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
|
|
870
|
-
|
|
871
|
-
/** @public @react */
|
|
872
|
-
export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
|
|
873
|
-
|
|
874
|
-
/** @public @react */
|
|
875
|
-
export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
|
|
876
|
-
|
|
877
988
|
/** @public @react */
|
|
878
989
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
879
990
|
|
|
880
|
-
/** @public @react */
|
|
881
|
-
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
|
|
882
|
-
|
|
883
991
|
/** @public @react */
|
|
884
992
|
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
885
993
|
|
|
@@ -950,6 +1058,7 @@ export declare const defaultTldrawOptions: {
|
|
|
950
1058
|
readonly onBeforePasteFromClipboard: undefined;
|
|
951
1059
|
readonly onClipboardPasteRaw: undefined;
|
|
952
1060
|
readonly quickZoomPreservesScreenBounds: true;
|
|
1061
|
+
readonly rightClickPanning: true;
|
|
953
1062
|
readonly snapThreshold: 8;
|
|
954
1063
|
readonly spacebarPanning: true;
|
|
955
1064
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
@@ -1057,7 +1166,7 @@ export declare class EdgeScrollManager {
|
|
|
1057
1166
|
/** @public */
|
|
1058
1167
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1059
1168
|
readonly id: string;
|
|
1060
|
-
constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
|
|
1169
|
+
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
|
|
1061
1170
|
private readonly _getShapeVisibility?;
|
|
1062
1171
|
private getIsShapeHiddenCache;
|
|
1063
1172
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1120,6 +1229,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1120
1229
|
* @public
|
|
1121
1230
|
*/
|
|
1122
1231
|
readonly snaps: SnapManager;
|
|
1232
|
+
/**
|
|
1233
|
+
* A manager for performance measurement hooks.
|
|
1234
|
+
*
|
|
1235
|
+
* @public
|
|
1236
|
+
*/
|
|
1237
|
+
readonly performance: PerformanceManager;
|
|
1123
1238
|
/* Excluded from this release type: _spatialIndex */
|
|
1124
1239
|
/**
|
|
1125
1240
|
* A manager for the any asynchronous events and making sure they're
|
|
@@ -1133,6 +1248,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1133
1248
|
setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1134
1249
|
setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1135
1250
|
};
|
|
1251
|
+
/**
|
|
1252
|
+
* A manager for remote peer collaborators connected to this editor.
|
|
1253
|
+
*
|
|
1254
|
+
* @public
|
|
1255
|
+
*/
|
|
1256
|
+
readonly collaborators: CollaboratorsManager;
|
|
1136
1257
|
/**
|
|
1137
1258
|
* A manager for the user and their preferences.
|
|
1138
1259
|
*
|
|
@@ -1158,6 +1279,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1158
1279
|
* @public
|
|
1159
1280
|
*/
|
|
1160
1281
|
readonly scribbles: ScribbleManager;
|
|
1282
|
+
/**
|
|
1283
|
+
* A manager for canvas overlay UI elements (selection handles, shape handles, etc.).
|
|
1284
|
+
*
|
|
1285
|
+
* @public
|
|
1286
|
+
*/
|
|
1287
|
+
readonly overlays: OverlayManager;
|
|
1161
1288
|
/**
|
|
1162
1289
|
* A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
|
|
1163
1290
|
*
|
|
@@ -1275,6 +1402,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1275
1402
|
shapeUtils: {
|
|
1276
1403
|
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
1277
1404
|
};
|
|
1405
|
+
/* Excluded from this release type: _shapeUtilsByAssetType */
|
|
1278
1406
|
styleProps: {
|
|
1279
1407
|
[key: string]: Map<StyleProp<any>, string>;
|
|
1280
1408
|
};
|
|
@@ -1306,6 +1434,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1306
1434
|
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
1307
1435
|
hasShapeUtil(type: TLShape['type']): boolean;
|
|
1308
1436
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
1437
|
+
/**
|
|
1438
|
+
* Get the shape util that handles the given asset type.
|
|
1439
|
+
* Returns the shape util whose {@link ShapeUtil.handledAssetTypes} includes
|
|
1440
|
+
* the given asset type, or undefined if none matches.
|
|
1441
|
+
*
|
|
1442
|
+
* @param assetType - The asset type string.
|
|
1443
|
+
* @public
|
|
1444
|
+
*/
|
|
1445
|
+
getShapeUtilForAssetType(assetType: string): ShapeUtil | undefined;
|
|
1309
1446
|
/**
|
|
1310
1447
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
1311
1448
|
*
|
|
@@ -1336,6 +1473,40 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1336
1473
|
type: S['type'];
|
|
1337
1474
|
} | S): BindingUtil<S>;
|
|
1338
1475
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
1476
|
+
/**
|
|
1477
|
+
* A map of asset utility classes by asset type.
|
|
1478
|
+
*
|
|
1479
|
+
* @public
|
|
1480
|
+
*/
|
|
1481
|
+
assetUtils: {
|
|
1482
|
+
readonly [K in string]?: AssetUtil<TLAsset>;
|
|
1483
|
+
};
|
|
1484
|
+
/**
|
|
1485
|
+
* Get an asset util from an asset or asset type.
|
|
1486
|
+
*
|
|
1487
|
+
* @param arg - An asset, asset type string, or object with type.
|
|
1488
|
+
*
|
|
1489
|
+
* @public
|
|
1490
|
+
*/
|
|
1491
|
+
getAssetUtil<S extends TLAsset>(asset: {
|
|
1492
|
+
type: S['type'];
|
|
1493
|
+
} | S): AssetUtil<S>;
|
|
1494
|
+
getAssetUtil(type: string): AssetUtil;
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns true if the editor has an asset util for the given asset type.
|
|
1497
|
+
*
|
|
1498
|
+
* @public
|
|
1499
|
+
*/
|
|
1500
|
+
hasAssetUtil(arg: {
|
|
1501
|
+
type: string;
|
|
1502
|
+
} | string): boolean;
|
|
1503
|
+
/**
|
|
1504
|
+
* Get the asset util that accepts the given MIME type.
|
|
1505
|
+
* Returns null if no registered asset util accepts the MIME type.
|
|
1506
|
+
*
|
|
1507
|
+
* @public
|
|
1508
|
+
*/
|
|
1509
|
+
getAssetUtilForMimeType(mimeType: string): AssetUtil | null;
|
|
1339
1510
|
/**
|
|
1340
1511
|
* A manager for the editor's history.
|
|
1341
1512
|
*
|
|
@@ -1592,6 +1763,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1592
1763
|
/**
|
|
1593
1764
|
* Set the cursor.
|
|
1594
1765
|
*
|
|
1766
|
+
* No-op when the partial wouldn't change the current cursor — `setCursor`
|
|
1767
|
+
* is called from pointer-move hot paths (see `updateHoveredOverlayId`,
|
|
1768
|
+
* various tool states) and skipping redundant writes avoids needlessly
|
|
1769
|
+
* dirtying instance state.
|
|
1770
|
+
*
|
|
1595
1771
|
* @param cursor - The cursor to set.
|
|
1596
1772
|
* @public
|
|
1597
1773
|
*/
|
|
@@ -2351,11 +2527,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2351
2527
|
* @public
|
|
2352
2528
|
*/
|
|
2353
2529
|
pageToViewport(point: VecLike): Vec;
|
|
2354
|
-
private _getCollaboratorsQuery;
|
|
2355
2530
|
/**
|
|
2356
2531
|
* Returns a list of presence records for all peer collaborators.
|
|
2357
2532
|
* This will return the latest presence record for each connected user.
|
|
2358
2533
|
*
|
|
2534
|
+
* Convenience wrapper for {@link CollaboratorsManager.getCollaborators}.
|
|
2535
|
+
*
|
|
2359
2536
|
* @public
|
|
2360
2537
|
*/
|
|
2361
2538
|
getCollaborators(): TLInstancePresence[];
|
|
@@ -2363,9 +2540,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2363
2540
|
* Returns a list of presence records for all peer collaborators on the current page.
|
|
2364
2541
|
* This will return the latest presence record for each connected user.
|
|
2365
2542
|
*
|
|
2543
|
+
* Convenience wrapper for {@link CollaboratorsManager.getCollaboratorsOnCurrentPage}.
|
|
2544
|
+
*
|
|
2366
2545
|
* @public
|
|
2367
2546
|
*/
|
|
2368
2547
|
getCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
2548
|
+
/**
|
|
2549
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
2550
|
+
* shown in the UI. Filters {@link Editor.getCollaborators} by activity state
|
|
2551
|
+
* (active / idle / inactive) and visibility rules such as following and highlighted
|
|
2552
|
+
* users. Re-evaluates on the collaborator visibility clock, so callers don't need to
|
|
2553
|
+
* drive their own activity timer.
|
|
2554
|
+
*
|
|
2555
|
+
* Convenience wrapper for {@link CollaboratorsManager.getVisibleCollaborators}.
|
|
2556
|
+
*
|
|
2557
|
+
* @public
|
|
2558
|
+
*/
|
|
2559
|
+
getVisibleCollaborators(): TLInstancePresence[];
|
|
2560
|
+
/**
|
|
2561
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
2562
|
+
* shown in the UI, filtered to those on the current page.
|
|
2563
|
+
*
|
|
2564
|
+
* Convenience wrapper for {@link CollaboratorsManager.getVisibleCollaboratorsOnCurrentPage}.
|
|
2565
|
+
*
|
|
2566
|
+
* @public
|
|
2567
|
+
*/
|
|
2568
|
+
getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
2369
2569
|
/**
|
|
2370
2570
|
* Get the current user's ID for attribution purposes.
|
|
2371
2571
|
* Also ensures a `user:` record exists in the store for the current user.
|
|
@@ -3026,6 +3226,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3026
3226
|
type: T['type'];
|
|
3027
3227
|
}>;
|
|
3028
3228
|
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
3229
|
+
/**
|
|
3230
|
+
* Get whether a shape behaves like a frame — a container that has child
|
|
3231
|
+
* shapes, requires full-brush selection, blocks erasure from inside, etc.
|
|
3232
|
+
*
|
|
3233
|
+
* @example
|
|
3234
|
+
* ```ts
|
|
3235
|
+
* const isFrameLike = editor.isShapeFrameLike(someShape)
|
|
3236
|
+
* ```
|
|
3237
|
+
*
|
|
3238
|
+
* @param shape - The shape (or shape id) to test.
|
|
3239
|
+
*
|
|
3240
|
+
* @public
|
|
3241
|
+
*/
|
|
3242
|
+
isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
|
|
3029
3243
|
/**
|
|
3030
3244
|
* Get a shape by its id.
|
|
3031
3245
|
*
|
|
@@ -4685,14 +4899,14 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4685
4899
|
static type: "group";
|
|
4686
4900
|
static props: RecordProps<TLGroupShape>;
|
|
4687
4901
|
static migrations: TLPropsMigrations;
|
|
4688
|
-
hideSelectionBoundsFg(): boolean;
|
|
4902
|
+
hideSelectionBoundsFg(shape: TLGroupShape): boolean;
|
|
4689
4903
|
canBind(): boolean;
|
|
4690
4904
|
canResize(): boolean;
|
|
4691
4905
|
canResizeChildren(): boolean;
|
|
4692
4906
|
getDefaultProps(): TLGroupShape['props'];
|
|
4693
4907
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
4694
4908
|
component(shape: TLGroupShape): JSX.Element | null;
|
|
4695
|
-
|
|
4909
|
+
getIndicatorPath(shape: TLGroupShape): Path2D;
|
|
4696
4910
|
onChildrenChange(group: TLGroupShape): void;
|
|
4697
4911
|
}
|
|
4698
4912
|
|
|
@@ -4971,6 +5185,12 @@ export declare class InputsManager {
|
|
|
4971
5185
|
get isPointing(): boolean;
|
|
4972
5186
|
set isPointing(isPointing: boolean);
|
|
4973
5187
|
/* Excluded from this release type: setIsPointing */
|
|
5188
|
+
private _isRightPointing;
|
|
5189
|
+
/**
|
|
5190
|
+
* Whether the user is right-click pointing (before drag threshold).
|
|
5191
|
+
*/
|
|
5192
|
+
getIsRightPointing(): boolean;
|
|
5193
|
+
/* Excluded from this release type: setIsRightPointing */
|
|
4974
5194
|
private _isPinching;
|
|
4975
5195
|
/**
|
|
4976
5196
|
* Whether the user is pinching.
|
|
@@ -5314,6 +5534,179 @@ export declare function openWindow(url: string, target?: string, allowReferrer?:
|
|
|
5314
5534
|
/** @public */
|
|
5315
5535
|
export declare type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5316
5536
|
|
|
5537
|
+
/** @public */
|
|
5538
|
+
export declare class OverlayManager {
|
|
5539
|
+
readonly editor: Editor;
|
|
5540
|
+
constructor(editor: Editor);
|
|
5541
|
+
/* Excluded from this release type: _overlayUtils */
|
|
5542
|
+
/* Excluded from this release type: registerUtil */
|
|
5543
|
+
/**
|
|
5544
|
+
* Get an overlay util by type string, overlay instance, or by passing
|
|
5545
|
+
* a util class as a generic parameter for type-safe lookup.
|
|
5546
|
+
*
|
|
5547
|
+
* @example
|
|
5548
|
+
* ```ts
|
|
5549
|
+
* const util = editor.overlays.getOverlayUtil('brush')
|
|
5550
|
+
* const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>('brush')
|
|
5551
|
+
* const util = editor.overlays.getOverlayUtil(myOverlay)
|
|
5552
|
+
* ```
|
|
5553
|
+
*
|
|
5554
|
+
* @public
|
|
5555
|
+
*/
|
|
5556
|
+
getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
|
|
5557
|
+
getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
|
|
5558
|
+
/**
|
|
5559
|
+
* Returns all registered overlay utils in paint order (ascending zIndex).
|
|
5560
|
+
* Utils with the same zIndex preserve their registration order.
|
|
5561
|
+
*
|
|
5562
|
+
* @public
|
|
5563
|
+
*/
|
|
5564
|
+
getOverlayUtilsInZOrder(): OverlayUtil[];
|
|
5565
|
+
/**
|
|
5566
|
+
* Reactive list of active overlay utils paired with the overlays they
|
|
5567
|
+
* produced for the current editor state, in paint order (ascending
|
|
5568
|
+
* zIndex). Both the hit-test and render paths read from this single
|
|
5569
|
+
* cached scan instead of each re-deriving the active set. Active utils
|
|
5570
|
+
* are included even when their `getOverlays()` returns an empty array,
|
|
5571
|
+
* since `render()` may still draw non-interactive UI (e.g. the selection
|
|
5572
|
+
* bounding box during brushing).
|
|
5573
|
+
*
|
|
5574
|
+
* @public
|
|
5575
|
+
*/
|
|
5576
|
+
getActiveOverlayEntries(): TLOverlayEntry[];
|
|
5577
|
+
/**
|
|
5578
|
+
* Reactively computed list of all currently active overlays, in paint order.
|
|
5579
|
+
* @public
|
|
5580
|
+
*/
|
|
5581
|
+
getCurrentOverlays(): TLOverlay[];
|
|
5582
|
+
private _geometryCache;
|
|
5583
|
+
/**
|
|
5584
|
+
* Get hit-test geometry for an overlay, cached by overlay identity. Lets
|
|
5585
|
+
* hit-testing on a pointermove storm skip the per-overlay geometry
|
|
5586
|
+
* allocation that {@link OverlayUtil.getGeometry} would otherwise do on
|
|
5587
|
+
* every call.
|
|
5588
|
+
*
|
|
5589
|
+
* @public
|
|
5590
|
+
*/
|
|
5591
|
+
getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
|
|
5592
|
+
/**
|
|
5593
|
+
* The currently hovered overlay id.
|
|
5594
|
+
* @public
|
|
5595
|
+
*/
|
|
5596
|
+
private _hoveredOverlayId;
|
|
5597
|
+
getHoveredOverlayId(): null | string;
|
|
5598
|
+
getHoveredOverlay(): null | TLOverlay;
|
|
5599
|
+
setHoveredOverlay(id: null | string): void;
|
|
5600
|
+
/**
|
|
5601
|
+
* Hit test all active overlays at a given page point.
|
|
5602
|
+
* Returns the topmost overlay whose geometry contains the point, or null.
|
|
5603
|
+
* Utils are walked from highest zIndex to lowest so the overlay painted on
|
|
5604
|
+
* top also wins the hit test. Within a util, overlays are walked in
|
|
5605
|
+
* array order: the first overlay whose geometry contains the point wins,
|
|
5606
|
+
* so utils should place highest-priority overlays first in `getOverlays`.
|
|
5607
|
+
* Interactive overlays (those with geometry) are checked; non-interactive are skipped.
|
|
5608
|
+
*
|
|
5609
|
+
* @param point - Point in page coordinates
|
|
5610
|
+
* @param margin - Hit test margin
|
|
5611
|
+
* @public
|
|
5612
|
+
*/
|
|
5613
|
+
getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5616
|
+
/**
|
|
5617
|
+
* Base class for overlay utilities. Overlays are ephemeral UI elements rendered
|
|
5618
|
+
* on top of the canvas (selection handles, rotation corners, shape handles, etc.).
|
|
5619
|
+
*
|
|
5620
|
+
* Each OverlayUtil defines a type of overlay and knows how to:
|
|
5621
|
+
* - Determine when its overlays should be active (predicate)
|
|
5622
|
+
* - Produce overlay instances from current editor state
|
|
5623
|
+
* - Provide hit-test geometry for interactive overlays
|
|
5624
|
+
* - Provide cursor style on hover
|
|
5625
|
+
* - Render into a canvas 2D context
|
|
5626
|
+
*
|
|
5627
|
+
* @public
|
|
5628
|
+
*/
|
|
5629
|
+
export declare abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
|
|
5630
|
+
editor: Editor;
|
|
5631
|
+
constructor(editor: Editor);
|
|
5632
|
+
static type: string;
|
|
5633
|
+
/**
|
|
5634
|
+
* Options for this overlay util. Override this to provide customization options.
|
|
5635
|
+
* Use {@link OverlayUtil.configure} to customize existing overlay utils.
|
|
5636
|
+
*
|
|
5637
|
+
* `zIndex` controls paint and hit-test order across utils — higher numbers
|
|
5638
|
+
* paint on top and are hit-tested first. Ties resolve by registration order.
|
|
5639
|
+
* Defaults to `0`; built-in utils use larger integers (100, 200, …) with
|
|
5640
|
+
* gaps so custom utils can slot between.
|
|
5641
|
+
*
|
|
5642
|
+
* @public
|
|
5643
|
+
*/
|
|
5644
|
+
options: {
|
|
5645
|
+
zIndex?: number;
|
|
5646
|
+
};
|
|
5647
|
+
/**
|
|
5648
|
+
* Create a new overlay util class with the given options merged in.
|
|
5649
|
+
*
|
|
5650
|
+
* @example
|
|
5651
|
+
* ```ts
|
|
5652
|
+
* const MyBrush = BrushOverlayUtil.configure({ fill: 'rgba(0,0,255,0.1)' })
|
|
5653
|
+
* ```
|
|
5654
|
+
*
|
|
5655
|
+
* @public
|
|
5656
|
+
*/
|
|
5657
|
+
static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
5658
|
+
options: infer Options;
|
|
5659
|
+
} ? Partial<Options> : never): T;
|
|
5660
|
+
/**
|
|
5661
|
+
* Whether this overlay util's overlays should currently be active.
|
|
5662
|
+
* Checked reactively to determine which overlays exist at any given time.
|
|
5663
|
+
*/
|
|
5664
|
+
abstract isActive(): boolean;
|
|
5665
|
+
/**
|
|
5666
|
+
* Returns the overlay instances that currently exist.
|
|
5667
|
+
* Called only when `isActive()` returns true.
|
|
5668
|
+
*/
|
|
5669
|
+
abstract getOverlays(): T[];
|
|
5670
|
+
/**
|
|
5671
|
+
* Returns hit-test geometry for an overlay instance, in page coordinates.
|
|
5672
|
+
* Return null for non-interactive overlays (e.g. snap indicators, scribbles).
|
|
5673
|
+
*/
|
|
5674
|
+
getGeometry(_overlay: T): Geometry2d | null;
|
|
5675
|
+
/**
|
|
5676
|
+
* Returns the cursor type to show when hovering this overlay.
|
|
5677
|
+
*/
|
|
5678
|
+
getCursor(_overlay: T): TLCursorType | undefined;
|
|
5679
|
+
/**
|
|
5680
|
+
* Called when the user points down on this overlay, before the default
|
|
5681
|
+
* routing runs. Acts as an interrupt: define it to take over the event.
|
|
5682
|
+
*
|
|
5683
|
+
* Return `false` to continue with the default behavior (e.g. the
|
|
5684
|
+
* built-in rotate/resize handle transitions or shape-handle dispatch).
|
|
5685
|
+
* Return `true` — or nothing at all — to skip the default. In other
|
|
5686
|
+
* words, once you override this method you own the event unless you
|
|
5687
|
+
* explicitly opt back in by returning `false`.
|
|
5688
|
+
*/
|
|
5689
|
+
onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
|
|
5690
|
+
/**
|
|
5691
|
+
* Render all active overlays into the canvas context.
|
|
5692
|
+
* The context is already transformed to page space (camera transform applied).
|
|
5693
|
+
* Called reactively when overlays or editor state changes.
|
|
5694
|
+
*/
|
|
5695
|
+
render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
|
|
5696
|
+
/**
|
|
5697
|
+
* Optional: render all active overlays into the minimap canvas.
|
|
5698
|
+
* The context is already transformed to page space (minimap camera applied),
|
|
5699
|
+
* so overlays can use the same page-space coordinates as in {@link OverlayUtil.render}.
|
|
5700
|
+
*
|
|
5701
|
+
* `zoom` is the minimap's screen-pixels-per-page-unit, analogous to
|
|
5702
|
+
* `editor.getCamera().z`; use `1 / zoom` for one-minimap-pixel line widths.
|
|
5703
|
+
*
|
|
5704
|
+
* Most overlays should leave this blank — only overlays that are meaningful
|
|
5705
|
+
* at minimap scale (e.g. brushes, collaborator cursors) should opt in.
|
|
5706
|
+
*/
|
|
5707
|
+
renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
|
|
5708
|
+
}
|
|
5709
|
+
|
|
5317
5710
|
/**
|
|
5318
5711
|
* Parses a string created by {@link createDeepLinkString} back into a deep link descriptor.
|
|
5319
5712
|
*
|
|
@@ -5327,6 +5720,94 @@ export declare function parseDeepLinkString(deepLinkString: string): TLDeepLink;
|
|
|
5327
5720
|
/** @public */
|
|
5328
5721
|
export declare type PerfectDashTerminal = 'none' | 'outset' | 'skip';
|
|
5329
5722
|
|
|
5723
|
+
/**
|
|
5724
|
+
* Optional adapter that pipes PerformanceManager events into browser
|
|
5725
|
+
* `performance.mark()` / `performance.measure()` for DevTools integration.
|
|
5726
|
+
*
|
|
5727
|
+
* Tree-shakeable — only included if imported.
|
|
5728
|
+
*
|
|
5729
|
+
* @example
|
|
5730
|
+
* ```ts
|
|
5731
|
+
* const adapter = new PerformanceApiAdapter(editor.performance)
|
|
5732
|
+
* // ... later
|
|
5733
|
+
* adapter.dispose()
|
|
5734
|
+
* ```
|
|
5735
|
+
*
|
|
5736
|
+
* @public
|
|
5737
|
+
*/
|
|
5738
|
+
export declare class PerformanceApiAdapter {
|
|
5739
|
+
private cleanups;
|
|
5740
|
+
constructor(perfManager: PerformanceManager);
|
|
5741
|
+
/** Remove all listeners and stop piping events. @public */
|
|
5742
|
+
dispose(): void;
|
|
5743
|
+
}
|
|
5744
|
+
|
|
5745
|
+
/**
|
|
5746
|
+
* Manages performance event subscriptions for the editor. Available as `editor.performance`.
|
|
5747
|
+
*
|
|
5748
|
+
* Listeners are lazy — internal editor hooks (frame, shape events) are only attached while
|
|
5749
|
+
* at least one subscriber exists, so there is zero overhead when unused.
|
|
5750
|
+
*
|
|
5751
|
+
* @example
|
|
5752
|
+
* ```ts
|
|
5753
|
+
* const unsub = editor.performance.on('interaction-end', (event) => {
|
|
5754
|
+
* console.log(`${event.name}: ${event.fps.toFixed(1)} fps, p95=${event.p95FrameTime.toFixed(1)}ms`)
|
|
5755
|
+
* })
|
|
5756
|
+
* ```
|
|
5757
|
+
*
|
|
5758
|
+
* @public
|
|
5759
|
+
*/
|
|
5760
|
+
export declare class PerformanceManager {
|
|
5761
|
+
/* Excluded from this release type: emitter */
|
|
5762
|
+
private editor;
|
|
5763
|
+
private activeInteraction;
|
|
5764
|
+
private activeCamera;
|
|
5765
|
+
private frameCleanup;
|
|
5766
|
+
private shapeCreatedCleanup;
|
|
5767
|
+
private shapeEditedCleanup;
|
|
5768
|
+
private shapeDeletedCleanup;
|
|
5769
|
+
private loafObserver;
|
|
5770
|
+
constructor(editor: Editor);
|
|
5771
|
+
/**
|
|
5772
|
+
* Subscribe to a performance event. Returns an unsubscribe function.
|
|
5773
|
+
*
|
|
5774
|
+
* @example
|
|
5775
|
+
* ```ts
|
|
5776
|
+
* const unsub = editor.performance.on('interaction-end', (event) => {
|
|
5777
|
+
* sendToAnalytics({ name: event.name, fps: event.fps, p95: event.p95FrameTime })
|
|
5778
|
+
* })
|
|
5779
|
+
* // later: unsub()
|
|
5780
|
+
* ```
|
|
5781
|
+
*
|
|
5782
|
+
* @public
|
|
5783
|
+
*/
|
|
5784
|
+
on<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
5785
|
+
/**
|
|
5786
|
+
* Subscribe to a performance event once. The listener is removed after the first invocation.
|
|
5787
|
+
* Returns an unsubscribe function for early removal.
|
|
5788
|
+
*
|
|
5789
|
+
* @public
|
|
5790
|
+
*/
|
|
5791
|
+
once<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
5792
|
+
/* Excluded from this release type: dispose */
|
|
5793
|
+
/* Excluded from this release type: _notifyInteractionStart */
|
|
5794
|
+
/* Excluded from this release type: _notifyInteractionEnd */
|
|
5795
|
+
/* Excluded from this release type: _notifyCameraOperation */
|
|
5796
|
+
/* Excluded from this release type: _notifyUndoRedo */
|
|
5797
|
+
private _startCameraSession;
|
|
5798
|
+
private _endCameraSession;
|
|
5799
|
+
private _onFrame;
|
|
5800
|
+
private _onShapesCreated;
|
|
5801
|
+
private _onShapesEdited;
|
|
5802
|
+
private _onShapesDeleted;
|
|
5803
|
+
private _startLoafObserver;
|
|
5804
|
+
private _stopLoafObserver;
|
|
5805
|
+
private _needsFrameListener;
|
|
5806
|
+
private _needsLoafObserver;
|
|
5807
|
+
private _maybeAttachLazyListeners;
|
|
5808
|
+
private _maybeDetachLazyListeners;
|
|
5809
|
+
}
|
|
5810
|
+
|
|
5330
5811
|
/**
|
|
5331
5812
|
* Find the approximate perimeter of an ellipse.
|
|
5332
5813
|
*
|
|
@@ -5758,6 +6239,32 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5758
6239
|
/** @public */
|
|
5759
6240
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5760
6241
|
|
|
6242
|
+
/**
|
|
6243
|
+
* Overlay util for shape indicators — the selection / hover / hint outlines drawn
|
|
6244
|
+
* under the selection foreground. Paints local indicators in the theme's
|
|
6245
|
+
* selection color.
|
|
6246
|
+
*
|
|
6247
|
+
* Remote collaborator selection indicators are drawn by a separate overlay util
|
|
6248
|
+
* (e.g. `CollaboratorShapeIndicatorOverlayUtil` from `tldraw`) that runs at a
|
|
6249
|
+
* lower z-index so peer selections appear under the local indicators.
|
|
6250
|
+
*
|
|
6251
|
+
* Non-interactive: contributes no hit-test geometry.
|
|
6252
|
+
*
|
|
6253
|
+
* @public
|
|
6254
|
+
*/
|
|
6255
|
+
export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
|
|
6256
|
+
static type: string;
|
|
6257
|
+
options: {
|
|
6258
|
+
hintedLineWidth: number;
|
|
6259
|
+
lineWidth: number;
|
|
6260
|
+
zIndex: number;
|
|
6261
|
+
};
|
|
6262
|
+
private _instanceFlags$;
|
|
6263
|
+
isActive(): boolean;
|
|
6264
|
+
getOverlays(): TLShapeIndicatorOverlay[];
|
|
6265
|
+
render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
|
|
6266
|
+
}
|
|
6267
|
+
|
|
5761
6268
|
/** @public */
|
|
5762
6269
|
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5763
6270
|
editor: Editor;
|
|
@@ -5812,12 +6319,32 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5812
6319
|
* @public
|
|
5813
6320
|
*/
|
|
5814
6321
|
static type: string;
|
|
6322
|
+
/**
|
|
6323
|
+
* The asset types that this shape can be created from.
|
|
6324
|
+
* When a file is dropped on the canvas, the editor finds the shape util
|
|
6325
|
+
* whose `handledAssetTypes` includes the asset's type and calls
|
|
6326
|
+
* {@link ShapeUtil.createShapeForAsset} to produce the shape.
|
|
6327
|
+
*
|
|
6328
|
+
* @public
|
|
6329
|
+
*/
|
|
6330
|
+
static handledAssetTypes?: readonly string[];
|
|
5815
6331
|
/**
|
|
5816
6332
|
* Get the default props for a shape.
|
|
5817
6333
|
*
|
|
5818
6334
|
* @public
|
|
5819
6335
|
*/
|
|
5820
6336
|
abstract getDefaultProps(): Shape['props'];
|
|
6337
|
+
/**
|
|
6338
|
+
* Create a shape partial for placing an asset on the canvas.
|
|
6339
|
+
* Only called for shapes whose constructor declares matching
|
|
6340
|
+
* {@link ShapeUtil.handledAssetTypes | `handledAssetTypes`}.
|
|
6341
|
+
*
|
|
6342
|
+
* @param asset - The asset to create a shape for.
|
|
6343
|
+
* @param position - Where to place the shape.
|
|
6344
|
+
* @returns A shape partial, or null if this shape can't be created for the asset.
|
|
6345
|
+
* @public
|
|
6346
|
+
*/
|
|
6347
|
+
createShapeForAsset?(asset: TLAsset, position: VecModel): null | TLShapePartial;
|
|
5821
6348
|
/**
|
|
5822
6349
|
* Get the shape's geometry.
|
|
5823
6350
|
*
|
|
@@ -5834,37 +6361,30 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5834
6361
|
*/
|
|
5835
6362
|
abstract component(shape: Shape): any;
|
|
5836
6363
|
/**
|
|
5837
|
-
* Get
|
|
5838
|
-
*
|
|
5839
|
-
*
|
|
5840
|
-
* @public
|
|
5841
|
-
*/
|
|
5842
|
-
abstract indicator(shape: Shape): any;
|
|
5843
|
-
/**
|
|
5844
|
-
* Whether to use the legacy React-based indicator rendering.
|
|
6364
|
+
* Get a Path2D (or a richer object with clip/additional paths) for rendering the
|
|
6365
|
+
* shape's indicator on the canvas. Shapes that return `undefined` will not render
|
|
6366
|
+
* an indicator.
|
|
5845
6367
|
*
|
|
5846
|
-
*
|
|
5847
|
-
*
|
|
6368
|
+
* For complex indicators that need clipping (e.g., arrows with labels), return an
|
|
6369
|
+
* object with `path`, `clipPath`, and `additionalPaths` properties.
|
|
5848
6370
|
*
|
|
5849
|
-
* @
|
|
6371
|
+
* @param shape - The shape.
|
|
6372
|
+
* @returns A Path2D to stroke, or an object with clipping info, or undefined to skip.
|
|
5850
6373
|
* @public
|
|
5851
6374
|
*/
|
|
5852
|
-
|
|
6375
|
+
abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
5853
6376
|
/**
|
|
5854
|
-
* Get
|
|
5855
|
-
*
|
|
5856
|
-
* When implemented, this is used instead of {@link ShapeUtil.indicator} for more
|
|
5857
|
-
* efficient canvas-based indicator rendering. Shapes that return `undefined` will
|
|
5858
|
-
* fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
|
|
6377
|
+
* Get JSX describing the shape's indicator (as an SVG element).
|
|
5859
6378
|
*
|
|
5860
|
-
*
|
|
5861
|
-
*
|
|
6379
|
+
* @deprecated SVG indicators are no longer rendered. Override
|
|
6380
|
+
* {@link ShapeUtil.getIndicatorPath} instead. This stub is retained so legacy
|
|
6381
|
+
* subclasses that still call `super.indicator()` keep type-checking; new shapes
|
|
6382
|
+
* should not implement it.
|
|
5862
6383
|
*
|
|
5863
6384
|
* @param shape - The shape.
|
|
5864
|
-
* @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
|
|
5865
6385
|
* @public
|
|
5866
6386
|
*/
|
|
5867
|
-
|
|
6387
|
+
indicator(_shape: Shape): any;
|
|
5868
6388
|
/**
|
|
5869
6389
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
5870
6390
|
* correctly.
|
|
@@ -5898,7 +6418,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5898
6418
|
*
|
|
5899
6419
|
* @public
|
|
5900
6420
|
*/
|
|
5901
|
-
canBind(
|
|
6421
|
+
canBind(opts: TLShapeUtilCanBindOpts): boolean;
|
|
5902
6422
|
/**
|
|
5903
6423
|
* Whether the shape can be double clicked to edit.
|
|
5904
6424
|
*
|
|
@@ -6032,6 +6552,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6032
6552
|
* @public
|
|
6033
6553
|
*/
|
|
6034
6554
|
isAspectRatioLocked(shape: Shape): boolean;
|
|
6555
|
+
/**
|
|
6556
|
+
* Whether the shape behaves like a frame — a container that has child shapes,
|
|
6557
|
+
* requires full-brush selection, blocks erasure from inside, etc.
|
|
6558
|
+
*
|
|
6559
|
+
* @param shape - The shape.
|
|
6560
|
+
* @public
|
|
6561
|
+
*/
|
|
6562
|
+
isFrameLike(_shape: Shape): boolean;
|
|
6035
6563
|
/**
|
|
6036
6564
|
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
6037
6565
|
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
@@ -6079,7 +6607,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6079
6607
|
* @param type - The shape type.
|
|
6080
6608
|
* @public
|
|
6081
6609
|
*/
|
|
6082
|
-
canReceiveNewChildrenOfType(shape: Shape,
|
|
6610
|
+
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
6083
6611
|
/**
|
|
6084
6612
|
* Get the shape as an SVG object.
|
|
6085
6613
|
*
|
|
@@ -6522,6 +7050,8 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
6522
7050
|
static children?: () => TLStateNodeConstructor[];
|
|
6523
7051
|
static isLockable: boolean;
|
|
6524
7052
|
static useCoalescedEvents: boolean;
|
|
7053
|
+
/** Set to `true` in subclasses to emit interaction-start/end performance events when this state is entered/exited. */
|
|
7054
|
+
static trackPerformance: boolean;
|
|
6525
7055
|
id: string;
|
|
6526
7056
|
type: 'branch' | 'leaf' | 'root';
|
|
6527
7057
|
shapeType?: string;
|
|
@@ -6621,6 +7151,19 @@ export declare const stopEventPropagation: (e: any) => any;
|
|
|
6621
7151
|
|
|
6622
7152
|
/* Excluded from this release type: StoreName */
|
|
6623
7153
|
|
|
7154
|
+
/**
|
|
7155
|
+
* Combine every batchable shape indicator into a single page-space `Path2D` and
|
|
7156
|
+
* emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
|
|
7157
|
+
* arrows with labels or complex arrowheads) can't be batched — they still
|
|
7158
|
+
* stroke individually inside a save/restore with `ctx.clip` applied.
|
|
7159
|
+
*
|
|
7160
|
+
* Shared by {@link ShapeIndicatorOverlayUtil} and any overlay util that paints
|
|
7161
|
+
* shape indicators (e.g. collaborator selections).
|
|
7162
|
+
*
|
|
7163
|
+
* @public
|
|
7164
|
+
*/
|
|
7165
|
+
export declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: TLShapeId[]): void;
|
|
7166
|
+
|
|
6624
7167
|
/** @public */
|
|
6625
7168
|
export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
6626
7169
|
|
|
@@ -6789,12 +7332,26 @@ export declare type TiptapNode = Node_2;
|
|
|
6789
7332
|
/** @public */
|
|
6790
7333
|
export declare type TLAdjacentDirection = 'down' | 'left' | 'next' | 'prev' | 'right' | 'up';
|
|
6791
7334
|
|
|
7335
|
+
/** @public */
|
|
7336
|
+
export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
|
|
7337
|
+
|
|
6792
7338
|
/** @public */
|
|
6793
7339
|
export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
6794
7340
|
|
|
7341
|
+
/** @public */
|
|
7342
|
+
export declare type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
|
|
7343
|
+
|
|
6795
7344
|
/** @public */
|
|
6796
7345
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
6797
7346
|
|
|
7347
|
+
/** @public */
|
|
7348
|
+
export declare interface TLAssetUtilConstructor<T extends TLAsset = TLAsset, U extends AssetUtil<T> = AssetUtil<T>> {
|
|
7349
|
+
new (editor: Editor): U;
|
|
7350
|
+
type: T['type'];
|
|
7351
|
+
props?: RecordProps<T>;
|
|
7352
|
+
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
7353
|
+
}
|
|
7354
|
+
|
|
6798
7355
|
/** @public */
|
|
6799
7356
|
export declare type TLBaseBoxShape = ExtractShapeByProps<{
|
|
6800
7357
|
h: number;
|
|
@@ -6827,15 +7384,6 @@ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends
|
|
|
6827
7384
|
migrations?: TLPropsMigrations;
|
|
6828
7385
|
}
|
|
6829
7386
|
|
|
6830
|
-
/** @public */
|
|
6831
|
-
export declare interface TLBrushProps {
|
|
6832
|
-
userId?: string;
|
|
6833
|
-
brush: BoxModel;
|
|
6834
|
-
color?: string;
|
|
6835
|
-
opacity?: number;
|
|
6836
|
-
className?: string;
|
|
6837
|
-
}
|
|
6838
|
-
|
|
6839
7387
|
/** @public */
|
|
6840
7388
|
export declare interface TLCameraConstraints {
|
|
6841
7389
|
/** The bounds (in page space) of the constrained space */
|
|
@@ -6884,6 +7432,29 @@ export declare interface TLCameraConstraints {
|
|
|
6884
7432
|
};
|
|
6885
7433
|
}
|
|
6886
7434
|
|
|
7435
|
+
/**
|
|
7436
|
+
* Emitted when a camera operation ends (after a 50ms debounce), with aggregated frame time stats.
|
|
7437
|
+
* @public
|
|
7438
|
+
*/
|
|
7439
|
+
export declare interface TLCameraEndPerfEvent extends TLPerfFrameTimeStats {
|
|
7440
|
+
/** Whether this was a pan or zoom operation. */
|
|
7441
|
+
type: 'panning' | 'zooming';
|
|
7442
|
+
/** Total shapes on the current page. */
|
|
7443
|
+
shapeCount: number;
|
|
7444
|
+
/** Number of shapes visible (not culled) in the viewport. */
|
|
7445
|
+
visibleShapeCount: number;
|
|
7446
|
+
/** Number of shapes culled (off-screen) from rendering. */
|
|
7447
|
+
culledShapeCount: number;
|
|
7448
|
+
/** Viewport width in screen pixels. */
|
|
7449
|
+
viewportWidth: number;
|
|
7450
|
+
/** Viewport height in screen pixels. */
|
|
7451
|
+
viewportHeight: number;
|
|
7452
|
+
/** Camera zoom level (`camera.z`) at session end. */
|
|
7453
|
+
zoomLevel: number;
|
|
7454
|
+
/** `performance.now()` when the camera session ended. */
|
|
7455
|
+
timestamp: number;
|
|
7456
|
+
}
|
|
7457
|
+
|
|
6887
7458
|
/** @public */
|
|
6888
7459
|
export declare interface TLCameraMoveOptions {
|
|
6889
7460
|
/** Whether to move the camera immediately, rather than on the next tick. */
|
|
@@ -6922,6 +7493,17 @@ export declare interface TLCameraOptions {
|
|
|
6922
7493
|
constraints?: TLCameraConstraints;
|
|
6923
7494
|
}
|
|
6924
7495
|
|
|
7496
|
+
/**
|
|
7497
|
+
* Emitted when a camera operation (pan or zoom) begins.
|
|
7498
|
+
* @public
|
|
7499
|
+
*/
|
|
7500
|
+
export declare interface TLCameraStartPerfEvent {
|
|
7501
|
+
/** Whether this is a pan or zoom operation. */
|
|
7502
|
+
type: 'panning' | 'zooming';
|
|
7503
|
+
/** `performance.now()` when the camera session started. */
|
|
7504
|
+
timestamp: number;
|
|
7505
|
+
}
|
|
7506
|
+
|
|
6925
7507
|
/** @public */
|
|
6926
7508
|
export declare type TLCancelEvent = (info: TLCancelEventInfo) => void;
|
|
6927
7509
|
|
|
@@ -6989,17 +7571,6 @@ export declare interface TLClipboardWriteInfo {
|
|
|
6989
7571
|
readonly source: 'menu' | 'native';
|
|
6990
7572
|
}
|
|
6991
7573
|
|
|
6992
|
-
/** @public */
|
|
6993
|
-
export declare interface TLCollaboratorHintProps {
|
|
6994
|
-
userId: string;
|
|
6995
|
-
className?: string;
|
|
6996
|
-
point: VecModel;
|
|
6997
|
-
viewport: Box;
|
|
6998
|
-
zoom: number;
|
|
6999
|
-
opacity?: number;
|
|
7000
|
-
color: string;
|
|
7001
|
-
}
|
|
7002
|
-
|
|
7003
7574
|
/** @public */
|
|
7004
7575
|
export declare type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
|
|
7005
7576
|
|
|
@@ -7044,17 +7615,6 @@ export declare interface TLCurrentUser {
|
|
|
7044
7615
|
readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
|
|
7045
7616
|
}
|
|
7046
7617
|
|
|
7047
|
-
/** @public */
|
|
7048
|
-
export declare interface TLCursorProps {
|
|
7049
|
-
userId: string;
|
|
7050
|
-
className?: string;
|
|
7051
|
-
point: null | VecModel;
|
|
7052
|
-
zoom: number;
|
|
7053
|
-
color?: string;
|
|
7054
|
-
name: null | string;
|
|
7055
|
-
chatMessage: string;
|
|
7056
|
-
}
|
|
7057
|
-
|
|
7058
7618
|
/** @public */
|
|
7059
7619
|
export declare type TLDeepLink = {
|
|
7060
7620
|
bounds: BoxModel;
|
|
@@ -7144,6 +7704,14 @@ export declare interface TldrawEditorBaseProps {
|
|
|
7144
7704
|
* An array of binding utils to use in the editor.
|
|
7145
7705
|
*/
|
|
7146
7706
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
7707
|
+
/**
|
|
7708
|
+
* An array of asset utils to use in the editor.
|
|
7709
|
+
*/
|
|
7710
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
7711
|
+
/**
|
|
7712
|
+
* An array of overlay utils to use in the editor for canvas overlay UI elements.
|
|
7713
|
+
*/
|
|
7714
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7147
7715
|
/**
|
|
7148
7716
|
* An array of tools to add to the editor's state chart.
|
|
7149
7717
|
*/
|
|
@@ -7405,6 +7973,12 @@ export declare interface TldrawOptions {
|
|
|
7405
7973
|
* When false, the spacebar will not pan the camera.
|
|
7406
7974
|
*/
|
|
7407
7975
|
readonly spacebarPanning: boolean;
|
|
7976
|
+
/**
|
|
7977
|
+
* Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
|
|
7978
|
+
* camera and a static right-click opens the context menu at the release position. When false,
|
|
7979
|
+
* right-click opens the context menu on press (no drag-to-pan).
|
|
7980
|
+
*/
|
|
7981
|
+
readonly rightClickPanning: boolean;
|
|
7408
7982
|
/**
|
|
7409
7983
|
* The default padding (in pixels) used when zooming to fit content in the viewport.
|
|
7410
7984
|
* This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
|
|
@@ -7534,34 +8108,17 @@ export declare interface TLDropShapesOverInfo {
|
|
|
7534
8108
|
/** @public */
|
|
7535
8109
|
export declare interface TLEditorComponents {
|
|
7536
8110
|
Background?: ComponentType | null;
|
|
7537
|
-
Brush?: ComponentType<TLBrushProps> | null;
|
|
7538
8111
|
Canvas?: ComponentType<TLCanvasComponentProps> | null;
|
|
7539
|
-
CollaboratorBrush?: ComponentType<TLBrushProps> | null;
|
|
7540
|
-
CollaboratorCursor?: ComponentType<TLCursorProps> | null;
|
|
7541
|
-
CollaboratorHint?: ComponentType<TLCollaboratorHintProps> | null;
|
|
7542
|
-
CollaboratorScribble?: ComponentType<TLScribbleProps> | null;
|
|
7543
|
-
CollaboratorShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7544
|
-
Cursor?: ComponentType<TLCursorProps> | null;
|
|
7545
8112
|
Grid?: ComponentType<TLGridProps> | null;
|
|
7546
|
-
Handle?: ComponentType<TLHandleProps> | null;
|
|
7547
|
-
Handles?: ComponentType<TLHandlesProps> | null;
|
|
7548
8113
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
7549
8114
|
LoadingScreen?: ComponentType | null;
|
|
7550
8115
|
OnTheCanvas?: ComponentType | null;
|
|
7551
|
-
Overlays?: ComponentType | null;
|
|
7552
|
-
Scribble?: ComponentType<TLScribbleProps> | null;
|
|
7553
8116
|
SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
|
|
7554
|
-
SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
|
|
7555
|
-
ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7556
|
-
ShapeIndicators?: ComponentType | null;
|
|
7557
8117
|
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
7558
|
-
SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
|
|
7559
8118
|
Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
|
|
7560
8119
|
SvgDefs?: ComponentType | null;
|
|
7561
|
-
ZoomBrush?: ComponentType<TLBrushProps> | null;
|
|
7562
8120
|
ErrorFallback?: TLErrorFallbackComponent;
|
|
7563
8121
|
ShapeErrorFallback?: TLShapeErrorFallbackComponent;
|
|
7564
|
-
ShapeIndicatorErrorFallback?: TLShapeIndicatorErrorFallbackComponent;
|
|
7565
8122
|
}
|
|
7566
8123
|
|
|
7567
8124
|
/** @public */
|
|
@@ -7579,6 +8136,15 @@ export declare interface TLEditorOptions {
|
|
|
7579
8136
|
* An array of bindings to use in the editor. These will be used to create and manage bindings in the editor.
|
|
7580
8137
|
*/
|
|
7581
8138
|
bindingUtils: readonly TLAnyBindingUtilConstructor[];
|
|
8139
|
+
/**
|
|
8140
|
+
* An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
|
|
8141
|
+
*/
|
|
8142
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
8143
|
+
/**
|
|
8144
|
+
* An array of overlay utils to use in the editor. These define canvas overlay UI elements
|
|
8145
|
+
* like selection handles, rotation corners, shape handles, etc.
|
|
8146
|
+
*/
|
|
8147
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7582
8148
|
/**
|
|
7583
8149
|
* An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
|
|
7584
8150
|
*/
|
|
@@ -7841,6 +8407,7 @@ export declare interface TLFileReplaceExternalContent extends TLBaseExternalCont
|
|
|
7841
8407
|
type: 'file-replace';
|
|
7842
8408
|
file: File;
|
|
7843
8409
|
shapeId: TLShapeId;
|
|
8410
|
+
/** @deprecated This field is no longer used by the default handler. It may be removed in a future version. */
|
|
7844
8411
|
isImage: boolean;
|
|
7845
8412
|
}
|
|
7846
8413
|
|
|
@@ -7851,6 +8418,21 @@ export declare interface TLFilesExternalContent extends TLBaseExternalContent {
|
|
|
7851
8418
|
ignoreParent?: boolean;
|
|
7852
8419
|
}
|
|
7853
8420
|
|
|
8421
|
+
/**
|
|
8422
|
+
* Emitted every animation frame when at least one `'frame'` listener is registered.
|
|
8423
|
+
* @public
|
|
8424
|
+
*/
|
|
8425
|
+
export declare interface TLFramePerfEvent {
|
|
8426
|
+
/** Time since the last frame in ms. */
|
|
8427
|
+
elapsed: number;
|
|
8428
|
+
/** Total shapes on the current page. */
|
|
8429
|
+
shapeCount: number;
|
|
8430
|
+
/** Number of shapes culled (off-screen) from rendering. */
|
|
8431
|
+
culledShapeCount: number;
|
|
8432
|
+
/** Number of shapes visible (not culled) in the viewport. */
|
|
8433
|
+
visibleShapeCount: number;
|
|
8434
|
+
}
|
|
8435
|
+
|
|
7854
8436
|
/** Additional options for the {@link ShapeUtil.getGeometry} method.
|
|
7855
8437
|
*
|
|
7856
8438
|
* @public
|
|
@@ -7929,20 +8511,6 @@ export declare interface TLHandleDragInfo<T extends TLShape> {
|
|
|
7929
8511
|
initial?: T | undefined;
|
|
7930
8512
|
}
|
|
7931
8513
|
|
|
7932
|
-
/** @public */
|
|
7933
|
-
export declare interface TLHandleProps {
|
|
7934
|
-
shapeId: TLShapeId;
|
|
7935
|
-
handle: TLHandle;
|
|
7936
|
-
zoom: number;
|
|
7937
|
-
isCoarse: boolean;
|
|
7938
|
-
className?: string;
|
|
7939
|
-
}
|
|
7940
|
-
|
|
7941
|
-
/** @public */
|
|
7942
|
-
export declare interface TLHandlesProps {
|
|
7943
|
-
children: ReactNode;
|
|
7944
|
-
}
|
|
7945
|
-
|
|
7946
8514
|
/** @public */
|
|
7947
8515
|
export declare interface TLHistoryBatchOptions {
|
|
7948
8516
|
/**
|
|
@@ -7993,6 +8561,38 @@ export declare type TLIndicatorPath = {
|
|
|
7993
8561
|
path: Path2D;
|
|
7994
8562
|
} | Path2D;
|
|
7995
8563
|
|
|
8564
|
+
/**
|
|
8565
|
+
* Emitted when an interaction state is exited, with aggregated frame time stats.
|
|
8566
|
+
* @public
|
|
8567
|
+
*/
|
|
8568
|
+
export declare interface TLInteractionEndPerfEvent extends TLPerfFrameTimeStats {
|
|
8569
|
+
/** The state node id (e.g. `'translating'`). */
|
|
8570
|
+
name: string;
|
|
8571
|
+
/** Full tool path (e.g. `'select.translating'`). */
|
|
8572
|
+
path: string;
|
|
8573
|
+
/** Total shapes on the current page. */
|
|
8574
|
+
shapeCount: number;
|
|
8575
|
+
/** Breakdown of selected shape types at interaction start (e.g. `{ geo: 2, draw: 1 }`). */
|
|
8576
|
+
selectedShapeTypes: Record<string, number>;
|
|
8577
|
+
/** Camera zoom level (`camera.z`) at interaction end. */
|
|
8578
|
+
zoomLevel: number;
|
|
8579
|
+
/** `performance.now()` when the interaction ended. */
|
|
8580
|
+
timestamp: number;
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
/**
|
|
8584
|
+
* Emitted when an interaction state (e.g. translating, resizing) is entered.
|
|
8585
|
+
* @public
|
|
8586
|
+
*/
|
|
8587
|
+
export declare interface TLInteractionStartPerfEvent {
|
|
8588
|
+
/** The state node id (e.g. `'translating'`). */
|
|
8589
|
+
name: string;
|
|
8590
|
+
/** Full tool path (e.g. `'select.translating'`). */
|
|
8591
|
+
path: string;
|
|
8592
|
+
/** `performance.now()` when the interaction started. */
|
|
8593
|
+
timestamp: number;
|
|
8594
|
+
}
|
|
8595
|
+
|
|
7996
8596
|
/** @public */
|
|
7997
8597
|
export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
7998
8598
|
|
|
@@ -8240,6 +8840,130 @@ export declare const tlmenus: {
|
|
|
8240
8840
|
*/
|
|
8241
8841
|
export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
|
|
8242
8842
|
|
|
8843
|
+
/** @public */
|
|
8844
|
+
export declare interface TLOverlay<Props = Record<string, unknown>> {
|
|
8845
|
+
/**
|
|
8846
|
+
* Globally unique id for this overlay instance across all overlay utils.
|
|
8847
|
+
* Hit-test and hover lookup key on `id` alone, so utils must namespace their
|
|
8848
|
+
* ids (e.g. `'selection_fg:top_left'`, `'handle:<shapeId>:<handleId>'`) to
|
|
8849
|
+
* avoid colliding with overlays from other utils.
|
|
8850
|
+
*/
|
|
8851
|
+
id: string;
|
|
8852
|
+
/** The overlay util type that owns this instance */
|
|
8853
|
+
type: string;
|
|
8854
|
+
/** Arbitrary props for the overlay (handle id, corner name, etc.) */
|
|
8855
|
+
props: Props;
|
|
8856
|
+
}
|
|
8857
|
+
|
|
8858
|
+
/**
|
|
8859
|
+
* An active overlay util paired with the overlays it produced for the current
|
|
8860
|
+
* editor state. Returned by {@link OverlayManager.getActiveOverlayEntries} so
|
|
8861
|
+
* hit-test, render, and debug paths share a single scan per reactive tick.
|
|
8862
|
+
*
|
|
8863
|
+
* @public
|
|
8864
|
+
*/
|
|
8865
|
+
export declare interface TLOverlayEntry {
|
|
8866
|
+
util: OverlayUtil;
|
|
8867
|
+
overlays: TLOverlay[];
|
|
8868
|
+
}
|
|
8869
|
+
|
|
8870
|
+
/** @public */
|
|
8871
|
+
export declare interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
|
|
8872
|
+
new (editor: Editor): U;
|
|
8873
|
+
type: string;
|
|
8874
|
+
configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
8875
|
+
options: infer Options;
|
|
8876
|
+
} ? Partial<Options> : never): T;
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8879
|
+
/**
|
|
8880
|
+
* Map of all performance event names to their payload types.
|
|
8881
|
+
* Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
|
|
8882
|
+
* @public
|
|
8883
|
+
*/
|
|
8884
|
+
export declare interface TLPerfEventMap {
|
|
8885
|
+
/** An interaction state was entered. */
|
|
8886
|
+
'interaction-start': [TLInteractionStartPerfEvent];
|
|
8887
|
+
/** An interaction state was exited, with aggregated frame time stats. */
|
|
8888
|
+
'interaction-end': [TLInteractionEndPerfEvent];
|
|
8889
|
+
/** A camera operation (pan/zoom) began. */
|
|
8890
|
+
'camera-start': [TLCameraStartPerfEvent];
|
|
8891
|
+
/** A camera operation ended (after debounce), with aggregated frame time stats. */
|
|
8892
|
+
'camera-end': [TLCameraEndPerfEvent];
|
|
8893
|
+
/** Shapes were created. */
|
|
8894
|
+
'shapes-created': [TLShapeOperationPerfEvent];
|
|
8895
|
+
/** Shapes were updated. */
|
|
8896
|
+
'shapes-updated': [TLShapeOperationPerfEvent];
|
|
8897
|
+
/** Shapes were deleted. */
|
|
8898
|
+
'shapes-deleted': [TLShapeOperationPerfEvent];
|
|
8899
|
+
/** An animation frame was rendered. Only fires when listeners are registered. */
|
|
8900
|
+
frame: [TLFramePerfEvent];
|
|
8901
|
+
/** An undo operation was performed. */
|
|
8902
|
+
undo: [TLUndoRedoPerfEvent];
|
|
8903
|
+
/** A redo operation was performed. */
|
|
8904
|
+
redo: [TLUndoRedoPerfEvent];
|
|
8905
|
+
}
|
|
8906
|
+
|
|
8907
|
+
/**
|
|
8908
|
+
* Common frame time statistics shared by interaction and camera end events.
|
|
8909
|
+
* @public
|
|
8910
|
+
*/
|
|
8911
|
+
export declare interface TLPerfFrameTimeStats {
|
|
8912
|
+
/** Total duration of the session in ms. */
|
|
8913
|
+
duration: number;
|
|
8914
|
+
/** Average frames per second during the session. */
|
|
8915
|
+
fps: number;
|
|
8916
|
+
/** Total number of frames recorded. */
|
|
8917
|
+
frameCount: number;
|
|
8918
|
+
/** Mean frame duration in ms. */
|
|
8919
|
+
avgFrameTime: number;
|
|
8920
|
+
/** Median (p50) frame duration in ms. */
|
|
8921
|
+
medianFrameTime: number;
|
|
8922
|
+
/** 95th percentile frame duration in ms. */
|
|
8923
|
+
p95FrameTime: number;
|
|
8924
|
+
/** 99th percentile frame duration in ms. */
|
|
8925
|
+
p99FrameTime: number;
|
|
8926
|
+
/** Shortest frame duration in ms. */
|
|
8927
|
+
minFrameTime: number;
|
|
8928
|
+
/** Longest frame duration in ms. */
|
|
8929
|
+
maxFrameTime: number;
|
|
8930
|
+
/** Raw frame durations for local analysis. Exclude when sending to analytics. */
|
|
8931
|
+
frameTimes: number[];
|
|
8932
|
+
/**
|
|
8933
|
+
* Long animation frames observed during this period (Chromium 123+).
|
|
8934
|
+
* Only present when the browser supports the Long Animation Frames API and
|
|
8935
|
+
* at least one long frame was observed.
|
|
8936
|
+
* Exclude when sending to analytics — entries are large and contain script URLs.
|
|
8937
|
+
*/
|
|
8938
|
+
longAnimationFrames?: TLPerfLongAnimationFrame[];
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8941
|
+
/**
|
|
8942
|
+
* A long animation frame observed by the browser during an interaction.
|
|
8943
|
+
* Available only in browsers that support the Long Animation Frames API (Chromium 123+).
|
|
8944
|
+
* @public
|
|
8945
|
+
*/
|
|
8946
|
+
export declare interface TLPerfLongAnimationFrame {
|
|
8947
|
+
/** Frame start time (relative to timeOrigin). */
|
|
8948
|
+
startTime: number;
|
|
8949
|
+
/** Total frame duration in ms. */
|
|
8950
|
+
duration: number;
|
|
8951
|
+
/** Time the main thread was blocked in ms. */
|
|
8952
|
+
blockingDuration: number;
|
|
8953
|
+
/** Scripts that contributed to the long frame. */
|
|
8954
|
+
scripts: TLPerfLongAnimationFrameScript[];
|
|
8955
|
+
}
|
|
8956
|
+
|
|
8957
|
+
/** A script attribution entry from a long animation frame. @public */
|
|
8958
|
+
export declare interface TLPerfLongAnimationFrameScript {
|
|
8959
|
+
/** The script source URL (may be empty for inline scripts). */
|
|
8960
|
+
sourceURL: string;
|
|
8961
|
+
/** The function name or invoker description. */
|
|
8962
|
+
invoker: string;
|
|
8963
|
+
/** Time spent in this script in ms. */
|
|
8964
|
+
duration: number;
|
|
8965
|
+
}
|
|
8966
|
+
|
|
8243
8967
|
/** @public */
|
|
8244
8968
|
export declare type TLPinchEvent = (info: TLPinchEventInfo) => void;
|
|
8245
8969
|
|
|
@@ -8279,6 +9003,10 @@ export declare type TLPointerEventTarget = {
|
|
|
8279
9003
|
handle?: TLSelectionHandle;
|
|
8280
9004
|
shape?: undefined;
|
|
8281
9005
|
target: 'selection';
|
|
9006
|
+
} | {
|
|
9007
|
+
overlay: TLOverlay;
|
|
9008
|
+
shape?: undefined;
|
|
9009
|
+
target: 'overlay';
|
|
8282
9010
|
} | {
|
|
8283
9011
|
shape: TLShape;
|
|
8284
9012
|
target: 'shape';
|
|
@@ -8349,28 +9077,12 @@ export declare type TLResizeShapeOptions = Partial<{
|
|
|
8349
9077
|
|
|
8350
9078
|
/* Excluded from this release type: TLRotationSnapshot */
|
|
8351
9079
|
|
|
8352
|
-
/** @public */
|
|
8353
|
-
export declare interface TLScribbleProps {
|
|
8354
|
-
userId?: string;
|
|
8355
|
-
scribble: TLScribble;
|
|
8356
|
-
zoom: number;
|
|
8357
|
-
color?: string;
|
|
8358
|
-
opacity?: number;
|
|
8359
|
-
className?: string;
|
|
8360
|
-
}
|
|
8361
|
-
|
|
8362
9080
|
/** @public */
|
|
8363
9081
|
export declare interface TLSelectionBackgroundProps {
|
|
8364
9082
|
bounds: Box;
|
|
8365
9083
|
rotation: number;
|
|
8366
9084
|
}
|
|
8367
9085
|
|
|
8368
|
-
/** @public */
|
|
8369
|
-
export declare interface TLSelectionForegroundProps {
|
|
8370
|
-
bounds: Box;
|
|
8371
|
-
rotation: number;
|
|
8372
|
-
}
|
|
8373
|
-
|
|
8374
9086
|
/** @public */
|
|
8375
9087
|
export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
|
|
8376
9088
|
|
|
@@ -8405,26 +9117,26 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
|
|
|
8405
9117
|
}>;
|
|
8406
9118
|
|
|
8407
9119
|
/** @public */
|
|
8408
|
-
export declare
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
export declare interface TLShapeIndicatorProps {
|
|
8414
|
-
userId?: string;
|
|
8415
|
-
shapeId: TLShapeId;
|
|
8416
|
-
color?: string | undefined;
|
|
8417
|
-
opacity?: number;
|
|
8418
|
-
className?: string;
|
|
8419
|
-
hidden?: boolean;
|
|
9120
|
+
export declare interface TLShapeIndicatorOverlay extends TLOverlay {
|
|
9121
|
+
props: {
|
|
9122
|
+
hintingShapeIds: TLShapeId[];
|
|
9123
|
+
idsToDisplay: TLShapeId[];
|
|
9124
|
+
};
|
|
8420
9125
|
}
|
|
8421
9126
|
|
|
8422
|
-
/**
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
9127
|
+
/**
|
|
9128
|
+
* Emitted when shapes are created, updated, or deleted.
|
|
9129
|
+
* @public
|
|
9130
|
+
*/
|
|
9131
|
+
export declare interface TLShapeOperationPerfEvent {
|
|
9132
|
+
/** The operation type. */
|
|
9133
|
+
operation: 'create' | 'delete' | 'update';
|
|
9134
|
+
/** Number of shapes affected. */
|
|
9135
|
+
count: number;
|
|
9136
|
+
/** Breakdown by shape type (e.g. `{ geo: 2, draw: 1 }`). */
|
|
9137
|
+
shapeTypes: Record<string, number>;
|
|
9138
|
+
/** `performance.now()` when the operation occurred. */
|
|
9139
|
+
timestamp: number;
|
|
8428
9140
|
}
|
|
8429
9141
|
|
|
8430
9142
|
/**
|
|
@@ -8484,6 +9196,7 @@ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends Sha
|
|
|
8484
9196
|
type: T['type'];
|
|
8485
9197
|
props?: RecordProps<T>;
|
|
8486
9198
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
9199
|
+
handledAssetTypes?: readonly string[];
|
|
8487
9200
|
}
|
|
8488
9201
|
|
|
8489
9202
|
/** @public */
|
|
@@ -8496,13 +9209,6 @@ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDi
|
|
|
8496
9209
|
children: ReactNode;
|
|
8497
9210
|
}
|
|
8498
9211
|
|
|
8499
|
-
/** @public */
|
|
8500
|
-
export declare interface TLSnapIndicatorProps {
|
|
8501
|
-
className?: string;
|
|
8502
|
-
line: SnapIndicator;
|
|
8503
|
-
zoom: number;
|
|
8504
|
-
}
|
|
8505
|
-
|
|
8506
9212
|
/** @public */
|
|
8507
9213
|
export declare interface TLStateNodeConstructor {
|
|
8508
9214
|
new (editor: Editor, parent?: StateNode): StateNode;
|
|
@@ -8511,6 +9217,7 @@ export declare interface TLStateNodeConstructor {
|
|
|
8511
9217
|
children?(): TLStateNodeConstructor[];
|
|
8512
9218
|
isLockable: boolean;
|
|
8513
9219
|
useCoalescedEvents: boolean;
|
|
9220
|
+
trackPerformance: boolean;
|
|
8514
9221
|
}
|
|
8515
9222
|
|
|
8516
9223
|
/** @public */
|
|
@@ -8550,6 +9257,7 @@ export declare type TLStoreOptions = TLStoreBaseOptions & {
|
|
|
8550
9257
|
|
|
8551
9258
|
/** @public */
|
|
8552
9259
|
export declare type TLStoreSchemaOptions = {
|
|
9260
|
+
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
8553
9261
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
8554
9262
|
migrations?: readonly MigrationSequence[];
|
|
8555
9263
|
records?: Record<string, CustomRecordInfo>;
|
|
@@ -8687,6 +9395,19 @@ export declare interface TLTldrawExternalContentSource {
|
|
|
8687
9395
|
data: TLContent;
|
|
8688
9396
|
}
|
|
8689
9397
|
|
|
9398
|
+
/**
|
|
9399
|
+
* Emitted after an undo or redo operation.
|
|
9400
|
+
* @public
|
|
9401
|
+
*/
|
|
9402
|
+
export declare interface TLUndoRedoPerfEvent {
|
|
9403
|
+
/** Whether this was an undo or redo. */
|
|
9404
|
+
type: 'redo' | 'undo';
|
|
9405
|
+
/** Number of undo steps remaining. */
|
|
9406
|
+
undoDepth: number;
|
|
9407
|
+
/** Number of redo steps remaining. */
|
|
9408
|
+
redoDepth: number;
|
|
9409
|
+
}
|
|
9410
|
+
|
|
8690
9411
|
/** @public */
|
|
8691
9412
|
export declare interface TLUpdatePointerOptions {
|
|
8692
9413
|
/** Whether to update the pointer immediately, rather than on the next tick. */
|
|
@@ -8876,6 +9597,10 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
|
|
|
8876
9597
|
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
8877
9598
|
|
|
8878
9599
|
/**
|
|
9600
|
+
* Reactive list of peer user IDs for collaborators currently shown in the UI.
|
|
9601
|
+
* Mirrors {@link Editor.getVisibleCollaborators} — peers fade out as they
|
|
9602
|
+
* transition to idle/inactive, without requiring a manual re-render.
|
|
9603
|
+
*
|
|
8879
9604
|
* @returns The list of peer UserIDs
|
|
8880
9605
|
* @public
|
|
8881
9606
|
*/
|