@tldraw/editor 4.6.0-next.fecc64eee134 → 5.1.0-canary.2eb9f83a5993
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 +494 -170
- package/dist-cjs/index.js +14 -23
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +3 -0
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/MenuClickCapture.js +93 -47
- 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 +46 -248
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
- package/dist-cjs/lib/editor/Editor.js +170 -34
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/assets/AssetUtil.js +1 -0
- package/dist-cjs/lib/editor/assets/AssetUtil.js.map +1 -1
- 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/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/overlays/getOverlayDisplayValues.js +39 -0
- package/dist-cjs/lib/editor/overlays/getOverlayDisplayValues.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +79 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +36 -23
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +32 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/StateNode.js +1 -0
- package/dist-cjs/lib/editor/tools/StateNode.js.map +1 -1
- package/dist-cjs/lib/editor/types/event-types.js.map +2 -2
- 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/license/LicenseManager.js +5 -3
- package/dist-cjs/lib/license/LicenseManager.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 +20 -7
- package/dist-cjs/lib/utils/reparenting.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/version.js +4 -4
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +494 -170
- package/dist-esm/index.mjs +21 -41
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +3 -0
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/MenuClickCapture.mjs +94 -48
- 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 +47 -249
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +3 -3
- package/dist-esm/lib/editor/Editor.mjs +171 -36
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/assets/AssetUtil.mjs +1 -0
- package/dist-esm/lib/editor/assets/AssetUtil.mjs.map +1 -1
- 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/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/overlays/getOverlayDisplayValues.mjs +19 -0
- package/dist-esm/lib/editor/overlays/getOverlayDisplayValues.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +59 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +36 -23
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +32 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/StateNode.mjs +1 -0
- package/dist-esm/lib/editor/tools/StateNode.mjs.map +1 -1
- 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/license/LicenseManager.mjs +5 -3
- package/dist-esm/lib/license/LicenseManager.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 +20 -7
- package/dist-esm/lib/utils/reparenting.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/version.mjs +4 -4
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +4 -243
- package/package.json +7 -7
- package/src/index.ts +18 -39
- package/src/lib/TldrawEditor.tsx +9 -0
- package/src/lib/components/MenuClickCapture.tsx +124 -64
- package/src/lib/components/default-components/CanvasOverlays.tsx +208 -0
- package/src/lib/components/default-components/DefaultCanvas.tsx +51 -322
- package/src/lib/editor/Editor.test.ts +3 -1
- package/src/lib/editor/Editor.ts +208 -39
- 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/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/overlays/getOverlayDisplayValues.ts +51 -0
- package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +128 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +45 -26
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +40 -3
- package/src/lib/editor/types/event-types.ts +2 -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 +45 -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/license/LicenseManager.test.ts +14 -0
- package/src/lib/license/LicenseManager.ts +13 -4
- package/src/lib/options.ts +7 -0
- package/src/lib/utils/reparenting.ts +22 -9
- package/src/lib/utils/sync/TLLocalSyncClient.ts +3 -0
- package/src/version.ts +4 -4
- package/dist-cjs/lib/components/GeometryDebuggingView.js +0 -115
- package/dist-cjs/lib/components/GeometryDebuggingView.js.map +0 -7
- 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/DefaultCursor.js +0 -59
- package/dist-cjs/lib/components/default-components/DefaultCursor.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 +0 -28
- 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 +0 -28
- 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-cjs/lib/hooks/useHandleEvents.js +0 -100
- package/dist-cjs/lib/hooks/useHandleEvents.js.map +0 -7
- package/dist-cjs/lib/hooks/useSelectionEvents.js +0 -98
- package/dist-cjs/lib/hooks/useSelectionEvents.js.map +0 -7
- package/dist-esm/lib/components/GeometryDebuggingView.mjs +0 -95
- package/dist-esm/lib/components/GeometryDebuggingView.mjs.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/DefaultCursor.mjs +0 -29
- package/dist-esm/lib/components/default-components/DefaultCursor.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/dist-esm/lib/hooks/useHandleEvents.mjs +0 -70
- package/dist-esm/lib/hooks/useHandleEvents.mjs.map +0 -7
- package/dist-esm/lib/hooks/useSelectionEvents.mjs +0 -78
- package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +0 -7
- package/src/lib/components/GeometryDebuggingView.tsx +0 -108
- 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/DefaultCursor.tsx +0 -59
- 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/src/lib/hooks/useHandleEvents.ts +0 -88
- package/src/lib/hooks/useSelectionEvents.ts +0 -97
package/dist-cjs/index.d.ts
CHANGED
|
@@ -19,11 +19,8 @@ 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
|
-
import { PointerEvent as PointerEvent_2 } from 'react';
|
|
26
|
-
import { PointerEventHandler } from 'react';
|
|
27
24
|
import * as React_2 from 'react';
|
|
28
25
|
import { default as React_3 } from 'react';
|
|
29
26
|
import { ReactElement } from 'react';
|
|
@@ -220,6 +217,58 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
|
|
|
220
217
|
getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
|
|
221
218
|
}
|
|
222
219
|
|
|
220
|
+
/**
|
|
221
|
+
* A base class for frame-like shapes — containers that clip their children,
|
|
222
|
+
* require full-brush selection, block erasure from inside, and support
|
|
223
|
+
* drag-and-drop reparenting.
|
|
224
|
+
*
|
|
225
|
+
* Extending this class is the easiest way to create a custom frame-like shape.
|
|
226
|
+
* It provides sensible defaults for all frame-like behaviors:
|
|
227
|
+
*
|
|
228
|
+
* - `isFrameLike()` returns `true`
|
|
229
|
+
* - `providesBackgroundForChildren()` returns `true`
|
|
230
|
+
* - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
|
|
231
|
+
* - `canRemoveChildrenOfType()` returns `true` unless the container is locked
|
|
232
|
+
* - `getClipPath()` returns the shape geometry's vertices
|
|
233
|
+
* - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
|
|
234
|
+
* - `onDragShapesOut()` reparents shapes back to the page
|
|
235
|
+
*
|
|
236
|
+
* All methods can be overridden for custom behavior.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts
|
|
240
|
+
* class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
|
|
241
|
+
* static override type = 'my-container' as const
|
|
242
|
+
* static override props = myContainerShapeProps
|
|
243
|
+
*
|
|
244
|
+
* override getDefaultProps() {
|
|
245
|
+
* return { w: 300, h: 200 }
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
248
|
+
* override component(shape: MyContainerShape) {
|
|
249
|
+
* return <SVGContainer>...</SVGContainer>
|
|
250
|
+
* }
|
|
251
|
+
*
|
|
252
|
+
* override getIndicatorPath(shape: MyContainerShape) {
|
|
253
|
+
* const path = new Path2D()
|
|
254
|
+
* path.rect(0, 0, shape.props.w, shape.props.h)
|
|
255
|
+
* return path
|
|
256
|
+
* }
|
|
257
|
+
* }
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
|
|
263
|
+
isFrameLike(_shape: Shape): boolean;
|
|
264
|
+
providesBackgroundForChildren(): boolean;
|
|
265
|
+
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
266
|
+
canRemoveChildrenOfType(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
|
+
|
|
223
272
|
/** @public */
|
|
224
273
|
export declare interface BatchMeasurementRequest {
|
|
225
274
|
html: string;
|
|
@@ -719,6 +768,49 @@ export declare class ClickManager {
|
|
|
719
768
|
*/
|
|
720
769
|
export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
721
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
|
+
|
|
722
814
|
/**
|
|
723
815
|
* @public
|
|
724
816
|
* @react
|
|
@@ -881,51 +973,21 @@ export declare const DEFAULT_THEME: TLTheme;
|
|
|
881
973
|
/** @public @react */
|
|
882
974
|
export declare function DefaultBackground(): JSX.Element;
|
|
883
975
|
|
|
884
|
-
/** @public @react */
|
|
885
|
-
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
|
|
886
|
-
|
|
887
976
|
/** @public @react */
|
|
888
977
|
export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
889
978
|
|
|
890
|
-
/** @public @react */
|
|
891
|
-
export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
|
|
892
|
-
|
|
893
|
-
/** @public @react */
|
|
894
|
-
export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
895
|
-
|
|
896
979
|
/** @public @react */
|
|
897
980
|
export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
898
981
|
|
|
899
982
|
/** @public @react */
|
|
900
983
|
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
901
984
|
|
|
902
|
-
/** @public @react */
|
|
903
|
-
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
|
|
904
|
-
|
|
905
|
-
/** @public @react */
|
|
906
|
-
export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
|
|
907
|
-
|
|
908
|
-
/** @public @react */
|
|
909
|
-
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
|
|
910
|
-
|
|
911
985
|
/** @public @react */
|
|
912
986
|
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
913
987
|
|
|
914
|
-
/** @public @react */
|
|
915
|
-
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
|
|
916
|
-
|
|
917
|
-
/** @public @react */
|
|
918
|
-
export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
|
|
919
|
-
|
|
920
|
-
/** @public @react */
|
|
921
|
-
export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
|
|
922
|
-
|
|
923
988
|
/** @public @react */
|
|
924
989
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
925
990
|
|
|
926
|
-
/** @public @react */
|
|
927
|
-
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
|
|
928
|
-
|
|
929
991
|
/** @public @react */
|
|
930
992
|
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
931
993
|
|
|
@@ -996,6 +1058,7 @@ export declare const defaultTldrawOptions: {
|
|
|
996
1058
|
readonly onBeforePasteFromClipboard: undefined;
|
|
997
1059
|
readonly onClipboardPasteRaw: undefined;
|
|
998
1060
|
readonly quickZoomPreservesScreenBounds: true;
|
|
1061
|
+
readonly rightClickPanning: true;
|
|
999
1062
|
readonly snapThreshold: 8;
|
|
1000
1063
|
readonly spacebarPanning: true;
|
|
1001
1064
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
@@ -1103,7 +1166,7 @@ export declare class EdgeScrollManager {
|
|
|
1103
1166
|
/** @public */
|
|
1104
1167
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1105
1168
|
readonly id: string;
|
|
1106
|
-
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, 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);
|
|
1107
1170
|
private readonly _getShapeVisibility?;
|
|
1108
1171
|
private getIsShapeHiddenCache;
|
|
1109
1172
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1185,6 +1248,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1185
1248
|
setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1186
1249
|
setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1187
1250
|
};
|
|
1251
|
+
/**
|
|
1252
|
+
* A manager for remote peer collaborators connected to this editor.
|
|
1253
|
+
*
|
|
1254
|
+
* @public
|
|
1255
|
+
*/
|
|
1256
|
+
readonly collaborators: CollaboratorsManager;
|
|
1188
1257
|
/**
|
|
1189
1258
|
* A manager for the user and their preferences.
|
|
1190
1259
|
*
|
|
@@ -1210,6 +1279,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1210
1279
|
* @public
|
|
1211
1280
|
*/
|
|
1212
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;
|
|
1213
1288
|
/**
|
|
1214
1289
|
* A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
|
|
1215
1290
|
*
|
|
@@ -1688,6 +1763,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1688
1763
|
/**
|
|
1689
1764
|
* Set the cursor.
|
|
1690
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
|
+
*
|
|
1691
1771
|
* @param cursor - The cursor to set.
|
|
1692
1772
|
* @public
|
|
1693
1773
|
*/
|
|
@@ -2447,11 +2527,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2447
2527
|
* @public
|
|
2448
2528
|
*/
|
|
2449
2529
|
pageToViewport(point: VecLike): Vec;
|
|
2450
|
-
private _getCollaboratorsQuery;
|
|
2451
2530
|
/**
|
|
2452
2531
|
* Returns a list of presence records for all peer collaborators.
|
|
2453
2532
|
* This will return the latest presence record for each connected user.
|
|
2454
2533
|
*
|
|
2534
|
+
* Convenience wrapper for {@link CollaboratorsManager.getCollaborators}.
|
|
2535
|
+
*
|
|
2455
2536
|
* @public
|
|
2456
2537
|
*/
|
|
2457
2538
|
getCollaborators(): TLInstancePresence[];
|
|
@@ -2459,9 +2540,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2459
2540
|
* Returns a list of presence records for all peer collaborators on the current page.
|
|
2460
2541
|
* This will return the latest presence record for each connected user.
|
|
2461
2542
|
*
|
|
2543
|
+
* Convenience wrapper for {@link CollaboratorsManager.getCollaboratorsOnCurrentPage}.
|
|
2544
|
+
*
|
|
2462
2545
|
* @public
|
|
2463
2546
|
*/
|
|
2464
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[];
|
|
2465
2569
|
/**
|
|
2466
2570
|
* Get the current user's ID for attribution purposes.
|
|
2467
2571
|
* Also ensures a `user:` record exists in the store for the current user.
|
|
@@ -2539,6 +2643,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2539
2643
|
* @public
|
|
2540
2644
|
*/
|
|
2541
2645
|
getRenderingShapes(): TLRenderingShape[];
|
|
2646
|
+
private _renderingShapesSortCache;
|
|
2542
2647
|
private _getAllPagesQuery;
|
|
2543
2648
|
/**
|
|
2544
2649
|
* Info about the project's current pages.
|
|
@@ -3122,6 +3227,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3122
3227
|
type: T['type'];
|
|
3123
3228
|
}>;
|
|
3124
3229
|
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
3230
|
+
/**
|
|
3231
|
+
* Get whether a shape behaves like a frame — a container that has child
|
|
3232
|
+
* shapes, requires full-brush selection, blocks erasure from inside, etc.
|
|
3233
|
+
*
|
|
3234
|
+
* @example
|
|
3235
|
+
* ```ts
|
|
3236
|
+
* const isFrameLike = editor.isShapeFrameLike(someShape)
|
|
3237
|
+
* ```
|
|
3238
|
+
*
|
|
3239
|
+
* @param shape - The shape (or shape id) to test.
|
|
3240
|
+
*
|
|
3241
|
+
* @public
|
|
3242
|
+
*/
|
|
3243
|
+
isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
|
|
3125
3244
|
/**
|
|
3126
3245
|
* Get a shape by its id.
|
|
3127
3246
|
*
|
|
@@ -4655,6 +4774,16 @@ export declare function getFreshUserPreferences(): TLUserPreferences;
|
|
|
4655
4774
|
*/
|
|
4656
4775
|
export declare function getIncrementedName(name: string, others: string[]): string;
|
|
4657
4776
|
|
|
4777
|
+
/**
|
|
4778
|
+
* Get the resolved display values for an overlay, merging the base values with any overrides.
|
|
4779
|
+
*
|
|
4780
|
+
* @public
|
|
4781
|
+
*/
|
|
4782
|
+
export declare function getOverlayDisplayValues<Overlay extends TLOverlay, DisplayValues extends object>(util: {
|
|
4783
|
+
editor: Editor;
|
|
4784
|
+
options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
|
|
4785
|
+
}, overlay: Overlay, colorMode?: 'dark' | 'light'): DisplayValues;
|
|
4786
|
+
|
|
4658
4787
|
/* Excluded from this release type: getOwnerDocument */
|
|
4659
4788
|
|
|
4660
4789
|
/* Excluded from this release type: getOwnerWindow */
|
|
@@ -4788,7 +4917,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4788
4917
|
getDefaultProps(): TLGroupShape['props'];
|
|
4789
4918
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
4790
4919
|
component(shape: TLGroupShape): JSX.Element | null;
|
|
4791
|
-
|
|
4920
|
+
getIndicatorPath(shape: TLGroupShape): Path2D;
|
|
4792
4921
|
onChildrenChange(group: TLGroupShape): void;
|
|
4793
4922
|
}
|
|
4794
4923
|
|
|
@@ -5067,6 +5196,12 @@ export declare class InputsManager {
|
|
|
5067
5196
|
get isPointing(): boolean;
|
|
5068
5197
|
set isPointing(isPointing: boolean);
|
|
5069
5198
|
/* Excluded from this release type: setIsPointing */
|
|
5199
|
+
private _isRightPointing;
|
|
5200
|
+
/**
|
|
5201
|
+
* Whether the user is right-click pointing (before drag threshold).
|
|
5202
|
+
*/
|
|
5203
|
+
getIsRightPointing(): boolean;
|
|
5204
|
+
/* Excluded from this release type: setIsRightPointing */
|
|
5070
5205
|
private _isPinching;
|
|
5071
5206
|
/**
|
|
5072
5207
|
* Whether the user is pinching.
|
|
@@ -5410,6 +5545,185 @@ export declare function openWindow(url: string, target?: string, allowReferrer?:
|
|
|
5410
5545
|
/** @public */
|
|
5411
5546
|
export declare type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5412
5547
|
|
|
5548
|
+
/** @public */
|
|
5549
|
+
export declare class OverlayManager {
|
|
5550
|
+
readonly editor: Editor;
|
|
5551
|
+
constructor(editor: Editor);
|
|
5552
|
+
/* Excluded from this release type: _overlayUtils */
|
|
5553
|
+
/* Excluded from this release type: registerUtil */
|
|
5554
|
+
/**
|
|
5555
|
+
* Get an overlay util by type string, overlay instance, or by passing
|
|
5556
|
+
* a util class as a generic parameter for type-safe lookup.
|
|
5557
|
+
*
|
|
5558
|
+
* @example
|
|
5559
|
+
* ```ts
|
|
5560
|
+
* const util = editor.overlays.getOverlayUtil('brush')
|
|
5561
|
+
* const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>('brush')
|
|
5562
|
+
* const util = editor.overlays.getOverlayUtil(myOverlay)
|
|
5563
|
+
* ```
|
|
5564
|
+
*
|
|
5565
|
+
* @public
|
|
5566
|
+
*/
|
|
5567
|
+
getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
|
|
5568
|
+
getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
|
|
5569
|
+
/**
|
|
5570
|
+
* Returns all registered overlay utils in paint order (ascending zIndex).
|
|
5571
|
+
* Utils with the same zIndex preserve their registration order.
|
|
5572
|
+
*
|
|
5573
|
+
* @public
|
|
5574
|
+
*/
|
|
5575
|
+
getOverlayUtilsInZOrder(): OverlayUtil[];
|
|
5576
|
+
/**
|
|
5577
|
+
* Reactive list of active overlay utils paired with the overlays they
|
|
5578
|
+
* produced for the current editor state, in paint order (ascending
|
|
5579
|
+
* zIndex). Both the hit-test and render paths read from this single
|
|
5580
|
+
* cached scan instead of each re-deriving the active set. Active utils
|
|
5581
|
+
* are included even when their `getOverlays()` returns an empty array,
|
|
5582
|
+
* since `render()` may still draw non-interactive UI (e.g. the selection
|
|
5583
|
+
* bounding box during brushing).
|
|
5584
|
+
*
|
|
5585
|
+
* @public
|
|
5586
|
+
*/
|
|
5587
|
+
getActiveOverlayEntries(): TLOverlayEntry[];
|
|
5588
|
+
/**
|
|
5589
|
+
* Reactively computed list of all currently active overlays, in paint order.
|
|
5590
|
+
* @public
|
|
5591
|
+
*/
|
|
5592
|
+
getCurrentOverlays(): TLOverlay[];
|
|
5593
|
+
private _geometryCache;
|
|
5594
|
+
/**
|
|
5595
|
+
* Get hit-test geometry for an overlay, cached by overlay identity. Lets
|
|
5596
|
+
* hit-testing on a pointermove storm skip the per-overlay geometry
|
|
5597
|
+
* allocation that {@link OverlayUtil.getGeometry} would otherwise do on
|
|
5598
|
+
* every call.
|
|
5599
|
+
*
|
|
5600
|
+
* @public
|
|
5601
|
+
*/
|
|
5602
|
+
getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
|
|
5603
|
+
/**
|
|
5604
|
+
* The currently hovered overlay id.
|
|
5605
|
+
* @public
|
|
5606
|
+
*/
|
|
5607
|
+
private _hoveredOverlayId;
|
|
5608
|
+
getHoveredOverlayId(): null | string;
|
|
5609
|
+
getHoveredOverlay(): null | TLOverlay;
|
|
5610
|
+
setHoveredOverlay(id: null | string): void;
|
|
5611
|
+
/**
|
|
5612
|
+
* Hit test all active overlays at a given page point.
|
|
5613
|
+
* Returns the topmost overlay whose geometry contains the point, or null.
|
|
5614
|
+
* Utils are walked from highest zIndex to lowest so the overlay painted on
|
|
5615
|
+
* top also wins the hit test. Within a util, overlays are walked in
|
|
5616
|
+
* array order: the first overlay whose geometry contains the point wins,
|
|
5617
|
+
* so utils should place highest-priority overlays first in `getOverlays`.
|
|
5618
|
+
* Interactive overlays (those with geometry) are checked; non-interactive are skipped.
|
|
5619
|
+
*
|
|
5620
|
+
* @param point - Point in page coordinates
|
|
5621
|
+
* @param margin - Hit test margin
|
|
5622
|
+
* @public
|
|
5623
|
+
*/
|
|
5624
|
+
getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
|
|
5625
|
+
}
|
|
5626
|
+
|
|
5627
|
+
/** @public */
|
|
5628
|
+
export declare interface OverlayOptionsWithDisplayValues<Overlay extends TLOverlay, DisplayValues extends object> {
|
|
5629
|
+
getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): DisplayValues;
|
|
5630
|
+
getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): Partial<DisplayValues>;
|
|
5631
|
+
}
|
|
5632
|
+
|
|
5633
|
+
/**
|
|
5634
|
+
* Base class for overlay utilities. Overlays are ephemeral UI elements rendered
|
|
5635
|
+
* on top of the canvas (selection handles, rotation corners, shape handles, etc.).
|
|
5636
|
+
*
|
|
5637
|
+
* Each OverlayUtil defines a type of overlay and knows how to:
|
|
5638
|
+
* - Determine when its overlays should be active (predicate)
|
|
5639
|
+
* - Produce overlay instances from current editor state
|
|
5640
|
+
* - Provide hit-test geometry for interactive overlays
|
|
5641
|
+
* - Provide cursor style on hover
|
|
5642
|
+
* - Render into a canvas 2D context
|
|
5643
|
+
*
|
|
5644
|
+
* @public
|
|
5645
|
+
*/
|
|
5646
|
+
export declare abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
|
|
5647
|
+
editor: Editor;
|
|
5648
|
+
constructor(editor: Editor);
|
|
5649
|
+
static type: string;
|
|
5650
|
+
/**
|
|
5651
|
+
* Options for this overlay util. Override this to provide customization options.
|
|
5652
|
+
* Use {@link OverlayUtil.configure} to customize existing overlay utils.
|
|
5653
|
+
*
|
|
5654
|
+
* `zIndex` controls paint and hit-test order across utils — higher numbers
|
|
5655
|
+
* paint on top and are hit-tested first. Ties resolve by registration order.
|
|
5656
|
+
* Defaults to `0`; built-in utils use larger integers (100, 200, …) with
|
|
5657
|
+
* gaps so custom utils can slot between.
|
|
5658
|
+
*
|
|
5659
|
+
* @public
|
|
5660
|
+
*/
|
|
5661
|
+
options: {
|
|
5662
|
+
zIndex?: number;
|
|
5663
|
+
};
|
|
5664
|
+
/**
|
|
5665
|
+
* Create a new overlay util class with the given options merged in.
|
|
5666
|
+
*
|
|
5667
|
+
* @example
|
|
5668
|
+
* ```ts
|
|
5669
|
+
* const MyBrush = BrushOverlayUtil.configure({ fill: 'rgba(0,0,255,0.1)' })
|
|
5670
|
+
* ```
|
|
5671
|
+
*
|
|
5672
|
+
* @public
|
|
5673
|
+
*/
|
|
5674
|
+
static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
5675
|
+
options: infer Options;
|
|
5676
|
+
} ? Partial<Options> : never): T;
|
|
5677
|
+
/**
|
|
5678
|
+
* Whether this overlay util's overlays should currently be active.
|
|
5679
|
+
* Checked reactively to determine which overlays exist at any given time.
|
|
5680
|
+
*/
|
|
5681
|
+
abstract isActive(): boolean;
|
|
5682
|
+
/**
|
|
5683
|
+
* Returns the overlay instances that currently exist.
|
|
5684
|
+
* Called only when `isActive()` returns true.
|
|
5685
|
+
*/
|
|
5686
|
+
abstract getOverlays(): T[];
|
|
5687
|
+
/**
|
|
5688
|
+
* Returns hit-test geometry for an overlay instance, in page coordinates.
|
|
5689
|
+
* Return null for non-interactive overlays (e.g. snap indicators, scribbles).
|
|
5690
|
+
*/
|
|
5691
|
+
getGeometry(_overlay: T): Geometry2d | null;
|
|
5692
|
+
/**
|
|
5693
|
+
* Returns the cursor type to show when hovering this overlay.
|
|
5694
|
+
*/
|
|
5695
|
+
getCursor(_overlay: T): TLCursorType | undefined;
|
|
5696
|
+
/**
|
|
5697
|
+
* Called when the user points down on this overlay, before the default
|
|
5698
|
+
* routing runs. Acts as an interrupt: define it to take over the event.
|
|
5699
|
+
*
|
|
5700
|
+
* Return `false` to continue with the default behavior (e.g. the
|
|
5701
|
+
* built-in rotate/resize handle transitions or shape-handle dispatch).
|
|
5702
|
+
* Return `true` — or nothing at all — to skip the default. In other
|
|
5703
|
+
* words, once you override this method you own the event unless you
|
|
5704
|
+
* explicitly opt back in by returning `false`.
|
|
5705
|
+
*/
|
|
5706
|
+
onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
|
|
5707
|
+
/**
|
|
5708
|
+
* Render all active overlays into the canvas context.
|
|
5709
|
+
* The context is already transformed to page space (camera transform applied).
|
|
5710
|
+
* Called reactively when overlays or editor state changes.
|
|
5711
|
+
*/
|
|
5712
|
+
render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
|
|
5713
|
+
/**
|
|
5714
|
+
* Optional: render all active overlays into the minimap canvas.
|
|
5715
|
+
* The context is already transformed to page space (minimap camera applied),
|
|
5716
|
+
* so overlays can use the same page-space coordinates as in {@link OverlayUtil.render}.
|
|
5717
|
+
*
|
|
5718
|
+
* `zoom` is the minimap's screen-pixels-per-page-unit, analogous to
|
|
5719
|
+
* `editor.getCamera().z`; use `1 / zoom` for one-minimap-pixel line widths.
|
|
5720
|
+
*
|
|
5721
|
+
* Most overlays should leave this blank — only overlays that are meaningful
|
|
5722
|
+
* at minimap scale (e.g. brushes, collaborator cursors) should opt in.
|
|
5723
|
+
*/
|
|
5724
|
+
renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5413
5727
|
/**
|
|
5414
5728
|
* Parses a string created by {@link createDeepLinkString} back into a deep link descriptor.
|
|
5415
5729
|
*
|
|
@@ -5942,6 +6256,32 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5942
6256
|
/** @public */
|
|
5943
6257
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5944
6258
|
|
|
6259
|
+
/**
|
|
6260
|
+
* Overlay util for shape indicators — the selection / hover / hint outlines drawn
|
|
6261
|
+
* under the selection foreground. Paints local indicators in the theme's
|
|
6262
|
+
* selection color.
|
|
6263
|
+
*
|
|
6264
|
+
* Remote collaborator selection indicators are drawn by a separate overlay util
|
|
6265
|
+
* (e.g. `CollaboratorShapeIndicatorOverlayUtil` from `tldraw`) that runs at a
|
|
6266
|
+
* lower z-index so peer selections appear under the local indicators.
|
|
6267
|
+
*
|
|
6268
|
+
* Non-interactive: contributes no hit-test geometry.
|
|
6269
|
+
*
|
|
6270
|
+
* @public
|
|
6271
|
+
*/
|
|
6272
|
+
export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
|
|
6273
|
+
static type: string;
|
|
6274
|
+
options: {
|
|
6275
|
+
hintedLineWidth: number;
|
|
6276
|
+
lineWidth: number;
|
|
6277
|
+
zIndex: number;
|
|
6278
|
+
};
|
|
6279
|
+
private _instanceFlags$;
|
|
6280
|
+
isActive(): boolean;
|
|
6281
|
+
getOverlays(): TLShapeIndicatorOverlay[];
|
|
6282
|
+
render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
|
|
6283
|
+
}
|
|
6284
|
+
|
|
5945
6285
|
/** @public */
|
|
5946
6286
|
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5947
6287
|
editor: Editor;
|
|
@@ -6038,37 +6378,30 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6038
6378
|
*/
|
|
6039
6379
|
abstract component(shape: Shape): any;
|
|
6040
6380
|
/**
|
|
6041
|
-
* Get
|
|
6042
|
-
*
|
|
6043
|
-
*
|
|
6044
|
-
* @public
|
|
6045
|
-
*/
|
|
6046
|
-
abstract indicator(shape: Shape): any;
|
|
6047
|
-
/**
|
|
6048
|
-
* Whether to use the legacy React-based indicator rendering.
|
|
6381
|
+
* Get a Path2D (or a richer object with clip/additional paths) for rendering the
|
|
6382
|
+
* shape's indicator on the canvas. Shapes that return `undefined` will not render
|
|
6383
|
+
* an indicator.
|
|
6049
6384
|
*
|
|
6050
|
-
*
|
|
6051
|
-
*
|
|
6385
|
+
* For complex indicators that need clipping (e.g., arrows with labels), return an
|
|
6386
|
+
* object with `path`, `clipPath`, and `additionalPaths` properties.
|
|
6052
6387
|
*
|
|
6053
|
-
* @
|
|
6388
|
+
* @param shape - The shape.
|
|
6389
|
+
* @returns A Path2D to stroke, or an object with clipping info, or undefined to skip.
|
|
6054
6390
|
* @public
|
|
6055
6391
|
*/
|
|
6056
|
-
|
|
6392
|
+
abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
6057
6393
|
/**
|
|
6058
|
-
* Get
|
|
6059
|
-
*
|
|
6060
|
-
* When implemented, this is used instead of {@link ShapeUtil.indicator} for more
|
|
6061
|
-
* efficient canvas-based indicator rendering. Shapes that return `undefined` will
|
|
6062
|
-
* fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
|
|
6394
|
+
* Get JSX describing the shape's indicator (as an SVG element).
|
|
6063
6395
|
*
|
|
6064
|
-
*
|
|
6065
|
-
*
|
|
6396
|
+
* @deprecated SVG indicators are no longer rendered. Override
|
|
6397
|
+
* {@link ShapeUtil.getIndicatorPath} instead. This stub is retained so legacy
|
|
6398
|
+
* subclasses that still call `super.indicator()` keep type-checking; new shapes
|
|
6399
|
+
* should not implement it.
|
|
6066
6400
|
*
|
|
6067
6401
|
* @param shape - The shape.
|
|
6068
|
-
* @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
|
|
6069
6402
|
* @public
|
|
6070
6403
|
*/
|
|
6071
|
-
|
|
6404
|
+
indicator(_shape: Shape): any;
|
|
6072
6405
|
/**
|
|
6073
6406
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
6074
6407
|
* correctly.
|
|
@@ -6236,6 +6569,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6236
6569
|
* @public
|
|
6237
6570
|
*/
|
|
6238
6571
|
isAspectRatioLocked(shape: Shape): boolean;
|
|
6572
|
+
/**
|
|
6573
|
+
* Whether the shape behaves like a frame — a container that has child shapes,
|
|
6574
|
+
* requires full-brush selection, blocks erasure from inside, etc.
|
|
6575
|
+
*
|
|
6576
|
+
* @param shape - The shape.
|
|
6577
|
+
* @public
|
|
6578
|
+
*/
|
|
6579
|
+
isFrameLike(_shape: Shape): boolean;
|
|
6239
6580
|
/**
|
|
6240
6581
|
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
6241
6582
|
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
@@ -6277,13 +6618,28 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6277
6618
|
*/
|
|
6278
6619
|
getHandles?(shape: Shape): TLHandle[];
|
|
6279
6620
|
/**
|
|
6280
|
-
* Get whether the shape can receive children of a given type.
|
|
6621
|
+
* Get whether the shape can receive children of a given type. Used by the drag and drop system
|
|
6622
|
+
* to decide whether {@link ShapeUtil.onDragShapesIn} should fire when a shape of the given type
|
|
6623
|
+
* is dragged over this one.
|
|
6281
6624
|
*
|
|
6282
6625
|
* @param shape - The shape.
|
|
6283
6626
|
* @param type - The shape type.
|
|
6284
6627
|
* @public
|
|
6285
6628
|
*/
|
|
6286
6629
|
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
6630
|
+
/**
|
|
6631
|
+
* Get whether children of a given type can be removed from this shape. Used by the drag and
|
|
6632
|
+
* drop system to decide whether {@link ShapeUtil.onDragShapesOut} should fire when a child of
|
|
6633
|
+
* the given type is dragged out of this shape, and by `kickoutOccludedShapes` to decide
|
|
6634
|
+
* whether to auto-reparent a child of the given type when it has moved outside this shape's
|
|
6635
|
+
* geometry. Returning `false` therefore "pins" matching children — they stay parented to this
|
|
6636
|
+
* shape even when dragged or moved outside it. Defaults to `true`.
|
|
6637
|
+
*
|
|
6638
|
+
* @param shape - The shape.
|
|
6639
|
+
* @param type - The shape type.
|
|
6640
|
+
* @public
|
|
6641
|
+
*/
|
|
6642
|
+
canRemoveChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
6287
6643
|
/**
|
|
6288
6644
|
* Get the shape as an SVG object.
|
|
6289
6645
|
*
|
|
@@ -6827,6 +7183,19 @@ export declare const stopEventPropagation: (e: any) => any;
|
|
|
6827
7183
|
|
|
6828
7184
|
/* Excluded from this release type: StoreName */
|
|
6829
7185
|
|
|
7186
|
+
/**
|
|
7187
|
+
* Combine every batchable shape indicator into a single page-space `Path2D` and
|
|
7188
|
+
* emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
|
|
7189
|
+
* arrows with labels or complex arrowheads) can't be batched — they still
|
|
7190
|
+
* stroke individually inside a save/restore with `ctx.clip` applied.
|
|
7191
|
+
*
|
|
7192
|
+
* Shared by {@link ShapeIndicatorOverlayUtil} and any overlay util that paints
|
|
7193
|
+
* shape indicators (e.g. collaborator selections).
|
|
7194
|
+
*
|
|
7195
|
+
* @public
|
|
7196
|
+
*/
|
|
7197
|
+
export declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: TLShapeId[]): void;
|
|
7198
|
+
|
|
6830
7199
|
/** @public */
|
|
6831
7200
|
export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
6832
7201
|
|
|
@@ -7001,6 +7370,9 @@ export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
|
|
|
7001
7370
|
/** @public */
|
|
7002
7371
|
export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
7003
7372
|
|
|
7373
|
+
/** @public */
|
|
7374
|
+
export declare type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
|
|
7375
|
+
|
|
7004
7376
|
/** @public */
|
|
7005
7377
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
7006
7378
|
|
|
@@ -7044,15 +7416,6 @@ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends
|
|
|
7044
7416
|
migrations?: TLPropsMigrations;
|
|
7045
7417
|
}
|
|
7046
7418
|
|
|
7047
|
-
/** @public */
|
|
7048
|
-
export declare interface TLBrushProps {
|
|
7049
|
-
userId?: string;
|
|
7050
|
-
brush: BoxModel;
|
|
7051
|
-
color?: string;
|
|
7052
|
-
opacity?: number;
|
|
7053
|
-
className?: string;
|
|
7054
|
-
}
|
|
7055
|
-
|
|
7056
7419
|
/** @public */
|
|
7057
7420
|
export declare interface TLCameraConstraints {
|
|
7058
7421
|
/** The bounds (in page space) of the constrained space */
|
|
@@ -7240,17 +7603,6 @@ export declare interface TLClipboardWriteInfo {
|
|
|
7240
7603
|
readonly source: 'menu' | 'native';
|
|
7241
7604
|
}
|
|
7242
7605
|
|
|
7243
|
-
/** @public */
|
|
7244
|
-
export declare interface TLCollaboratorHintProps {
|
|
7245
|
-
userId: string;
|
|
7246
|
-
className?: string;
|
|
7247
|
-
point: VecModel;
|
|
7248
|
-
viewport: Box;
|
|
7249
|
-
zoom: number;
|
|
7250
|
-
opacity?: number;
|
|
7251
|
-
color: string;
|
|
7252
|
-
}
|
|
7253
|
-
|
|
7254
7606
|
/** @public */
|
|
7255
7607
|
export declare type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
|
|
7256
7608
|
|
|
@@ -7295,17 +7647,6 @@ export declare interface TLCurrentUser {
|
|
|
7295
7647
|
readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
|
|
7296
7648
|
}
|
|
7297
7649
|
|
|
7298
|
-
/** @public */
|
|
7299
|
-
export declare interface TLCursorProps {
|
|
7300
|
-
userId: string;
|
|
7301
|
-
className?: string;
|
|
7302
|
-
point: null | VecModel;
|
|
7303
|
-
zoom: number;
|
|
7304
|
-
color?: string;
|
|
7305
|
-
name: null | string;
|
|
7306
|
-
chatMessage: string;
|
|
7307
|
-
}
|
|
7308
|
-
|
|
7309
7650
|
/** @public */
|
|
7310
7651
|
export declare type TLDeepLink = {
|
|
7311
7652
|
bounds: BoxModel;
|
|
@@ -7399,6 +7740,10 @@ export declare interface TldrawEditorBaseProps {
|
|
|
7399
7740
|
* An array of asset utils to use in the editor.
|
|
7400
7741
|
*/
|
|
7401
7742
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
7743
|
+
/**
|
|
7744
|
+
* An array of overlay utils to use in the editor for canvas overlay UI elements.
|
|
7745
|
+
*/
|
|
7746
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7402
7747
|
/**
|
|
7403
7748
|
* An array of tools to add to the editor's state chart.
|
|
7404
7749
|
*/
|
|
@@ -7660,6 +8005,12 @@ export declare interface TldrawOptions {
|
|
|
7660
8005
|
* When false, the spacebar will not pan the camera.
|
|
7661
8006
|
*/
|
|
7662
8007
|
readonly spacebarPanning: boolean;
|
|
8008
|
+
/**
|
|
8009
|
+
* Whether to allow right-click + drag to pan the camera. When true, right-click + drag pans the
|
|
8010
|
+
* camera and a static right-click opens the context menu at the release position. When false,
|
|
8011
|
+
* right-click opens the context menu on press (no drag-to-pan).
|
|
8012
|
+
*/
|
|
8013
|
+
readonly rightClickPanning: boolean;
|
|
7663
8014
|
/**
|
|
7664
8015
|
* The default padding (in pixels) used when zooming to fit content in the viewport.
|
|
7665
8016
|
* This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
|
|
@@ -7789,34 +8140,17 @@ export declare interface TLDropShapesOverInfo {
|
|
|
7789
8140
|
/** @public */
|
|
7790
8141
|
export declare interface TLEditorComponents {
|
|
7791
8142
|
Background?: ComponentType | null;
|
|
7792
|
-
Brush?: ComponentType<TLBrushProps> | null;
|
|
7793
8143
|
Canvas?: ComponentType<TLCanvasComponentProps> | null;
|
|
7794
|
-
CollaboratorBrush?: ComponentType<TLBrushProps> | null;
|
|
7795
|
-
CollaboratorCursor?: ComponentType<TLCursorProps> | null;
|
|
7796
|
-
CollaboratorHint?: ComponentType<TLCollaboratorHintProps> | null;
|
|
7797
|
-
CollaboratorScribble?: ComponentType<TLScribbleProps> | null;
|
|
7798
|
-
CollaboratorShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7799
|
-
Cursor?: ComponentType<TLCursorProps> | null;
|
|
7800
8144
|
Grid?: ComponentType<TLGridProps> | null;
|
|
7801
|
-
Handle?: ComponentType<TLHandleProps> | null;
|
|
7802
|
-
Handles?: ComponentType<TLHandlesProps> | null;
|
|
7803
8145
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
7804
8146
|
LoadingScreen?: ComponentType | null;
|
|
7805
8147
|
OnTheCanvas?: ComponentType | null;
|
|
7806
|
-
Overlays?: ComponentType | null;
|
|
7807
|
-
Scribble?: ComponentType<TLScribbleProps> | null;
|
|
7808
8148
|
SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
|
|
7809
|
-
SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
|
|
7810
|
-
ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7811
|
-
ShapeIndicators?: ComponentType | null;
|
|
7812
8149
|
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
7813
|
-
SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
|
|
7814
8150
|
Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
|
|
7815
8151
|
SvgDefs?: ComponentType | null;
|
|
7816
|
-
ZoomBrush?: ComponentType<TLBrushProps> | null;
|
|
7817
8152
|
ErrorFallback?: TLErrorFallbackComponent;
|
|
7818
8153
|
ShapeErrorFallback?: TLShapeErrorFallbackComponent;
|
|
7819
|
-
ShapeIndicatorErrorFallback?: TLShapeIndicatorErrorFallbackComponent;
|
|
7820
8154
|
}
|
|
7821
8155
|
|
|
7822
8156
|
/** @public */
|
|
@@ -7838,6 +8172,11 @@ export declare interface TLEditorOptions {
|
|
|
7838
8172
|
* An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
|
|
7839
8173
|
*/
|
|
7840
8174
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
8175
|
+
/**
|
|
8176
|
+
* An array of overlay utils to use in the editor. These define canvas overlay UI elements
|
|
8177
|
+
* like selection handles, rotation corners, shape handles, etc.
|
|
8178
|
+
*/
|
|
8179
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7841
8180
|
/**
|
|
7842
8181
|
* An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
|
|
7843
8182
|
*/
|
|
@@ -8204,20 +8543,6 @@ export declare interface TLHandleDragInfo<T extends TLShape> {
|
|
|
8204
8543
|
initial?: T | undefined;
|
|
8205
8544
|
}
|
|
8206
8545
|
|
|
8207
|
-
/** @public */
|
|
8208
|
-
export declare interface TLHandleProps {
|
|
8209
|
-
shapeId: TLShapeId;
|
|
8210
|
-
handle: TLHandle;
|
|
8211
|
-
zoom: number;
|
|
8212
|
-
isCoarse: boolean;
|
|
8213
|
-
className?: string;
|
|
8214
|
-
}
|
|
8215
|
-
|
|
8216
|
-
/** @public */
|
|
8217
|
-
export declare interface TLHandlesProps {
|
|
8218
|
-
children: ReactNode;
|
|
8219
|
-
}
|
|
8220
|
-
|
|
8221
8546
|
/** @public */
|
|
8222
8547
|
export declare interface TLHistoryBatchOptions {
|
|
8223
8548
|
/**
|
|
@@ -8547,6 +8872,42 @@ export declare const tlmenus: {
|
|
|
8547
8872
|
*/
|
|
8548
8873
|
export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
|
|
8549
8874
|
|
|
8875
|
+
/** @public */
|
|
8876
|
+
export declare interface TLOverlay<Props = Record<string, unknown>> {
|
|
8877
|
+
/**
|
|
8878
|
+
* Globally unique id for this overlay instance across all overlay utils.
|
|
8879
|
+
* Hit-test and hover lookup key on `id` alone, so utils must namespace their
|
|
8880
|
+
* ids (e.g. `'selection_fg:top_left'`, `'handle:<shapeId>:<handleId>'`) to
|
|
8881
|
+
* avoid colliding with overlays from other utils.
|
|
8882
|
+
*/
|
|
8883
|
+
id: string;
|
|
8884
|
+
/** The overlay util type that owns this instance */
|
|
8885
|
+
type: string;
|
|
8886
|
+
/** Arbitrary props for the overlay (handle id, corner name, etc.) */
|
|
8887
|
+
props: Props;
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8890
|
+
/**
|
|
8891
|
+
* An active overlay util paired with the overlays it produced for the current
|
|
8892
|
+
* editor state. Returned by {@link OverlayManager.getActiveOverlayEntries} so
|
|
8893
|
+
* hit-test, render, and debug paths share a single scan per reactive tick.
|
|
8894
|
+
*
|
|
8895
|
+
* @public
|
|
8896
|
+
*/
|
|
8897
|
+
export declare interface TLOverlayEntry {
|
|
8898
|
+
util: OverlayUtil;
|
|
8899
|
+
overlays: TLOverlay[];
|
|
8900
|
+
}
|
|
8901
|
+
|
|
8902
|
+
/** @public */
|
|
8903
|
+
export declare interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
|
|
8904
|
+
new (editor: Editor): U;
|
|
8905
|
+
type: string;
|
|
8906
|
+
configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
8907
|
+
options: infer Options;
|
|
8908
|
+
} ? Partial<Options> : never): T;
|
|
8909
|
+
}
|
|
8910
|
+
|
|
8550
8911
|
/**
|
|
8551
8912
|
* Map of all performance event names to their payload types.
|
|
8552
8913
|
* Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
|
|
@@ -8674,6 +9035,10 @@ export declare type TLPointerEventTarget = {
|
|
|
8674
9035
|
handle?: TLSelectionHandle;
|
|
8675
9036
|
shape?: undefined;
|
|
8676
9037
|
target: 'selection';
|
|
9038
|
+
} | {
|
|
9039
|
+
overlay: TLOverlay;
|
|
9040
|
+
shape?: undefined;
|
|
9041
|
+
target: 'overlay';
|
|
8677
9042
|
} | {
|
|
8678
9043
|
shape: TLShape;
|
|
8679
9044
|
target: 'shape';
|
|
@@ -8744,28 +9109,12 @@ export declare type TLResizeShapeOptions = Partial<{
|
|
|
8744
9109
|
|
|
8745
9110
|
/* Excluded from this release type: TLRotationSnapshot */
|
|
8746
9111
|
|
|
8747
|
-
/** @public */
|
|
8748
|
-
export declare interface TLScribbleProps {
|
|
8749
|
-
userId?: string;
|
|
8750
|
-
scribble: TLScribble;
|
|
8751
|
-
zoom: number;
|
|
8752
|
-
color?: string;
|
|
8753
|
-
opacity?: number;
|
|
8754
|
-
className?: string;
|
|
8755
|
-
}
|
|
8756
|
-
|
|
8757
9112
|
/** @public */
|
|
8758
9113
|
export declare interface TLSelectionBackgroundProps {
|
|
8759
9114
|
bounds: Box;
|
|
8760
9115
|
rotation: number;
|
|
8761
9116
|
}
|
|
8762
9117
|
|
|
8763
|
-
/** @public */
|
|
8764
|
-
export declare interface TLSelectionForegroundProps {
|
|
8765
|
-
bounds: Box;
|
|
8766
|
-
rotation: number;
|
|
8767
|
-
}
|
|
8768
|
-
|
|
8769
9118
|
/** @public */
|
|
8770
9119
|
export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
|
|
8771
9120
|
|
|
@@ -8800,26 +9149,11 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
|
|
|
8800
9149
|
}>;
|
|
8801
9150
|
|
|
8802
9151
|
/** @public */
|
|
8803
|
-
export declare
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
export declare interface TLShapeIndicatorProps {
|
|
8809
|
-
userId?: string;
|
|
8810
|
-
shapeId: TLShapeId;
|
|
8811
|
-
color?: string | undefined;
|
|
8812
|
-
opacity?: number;
|
|
8813
|
-
className?: string;
|
|
8814
|
-
hidden?: boolean;
|
|
8815
|
-
}
|
|
8816
|
-
|
|
8817
|
-
/** @public */
|
|
8818
|
-
export declare interface TLShapeIndicatorsProps {
|
|
8819
|
-
/** Whether to hide all of the indicators */
|
|
8820
|
-
hideAll?: boolean;
|
|
8821
|
-
/** Whether to show all of the indicators */
|
|
8822
|
-
showAll?: boolean;
|
|
9152
|
+
export declare interface TLShapeIndicatorOverlay extends TLOverlay {
|
|
9153
|
+
props: {
|
|
9154
|
+
hintingShapeIds: TLShapeId[];
|
|
9155
|
+
idsToDisplay: TLShapeId[];
|
|
9156
|
+
};
|
|
8823
9157
|
}
|
|
8824
9158
|
|
|
8825
9159
|
/**
|
|
@@ -8907,13 +9241,6 @@ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDi
|
|
|
8907
9241
|
children: ReactNode;
|
|
8908
9242
|
}
|
|
8909
9243
|
|
|
8910
|
-
/** @public */
|
|
8911
|
-
export declare interface TLSnapIndicatorProps {
|
|
8912
|
-
className?: string;
|
|
8913
|
-
line: SnapIndicator;
|
|
8914
|
-
zoom: number;
|
|
8915
|
-
}
|
|
8916
|
-
|
|
8917
9244
|
/** @public */
|
|
8918
9245
|
export declare interface TLStateNodeConstructor {
|
|
8919
9246
|
new (editor: Editor, parent?: StateNode): StateNode;
|
|
@@ -9302,6 +9629,10 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
|
|
|
9302
9629
|
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
9303
9630
|
|
|
9304
9631
|
/**
|
|
9632
|
+
* Reactive list of peer user IDs for collaborators currently shown in the UI.
|
|
9633
|
+
* Mirrors {@link Editor.getVisibleCollaborators} — peers fade out as they
|
|
9634
|
+
* transition to idle/inactive, without requiring a manual re-render.
|
|
9635
|
+
*
|
|
9305
9636
|
* @returns The list of peer UserIDs
|
|
9306
9637
|
* @public
|
|
9307
9638
|
*/
|
|
@@ -9367,13 +9698,6 @@ export declare class UserPreferencesManager {
|
|
|
9367
9698
|
/** @public */
|
|
9368
9699
|
export declare const userTypeValidator: T.Validator<TLUserPreferences>;
|
|
9369
9700
|
|
|
9370
|
-
/** @public */
|
|
9371
|
-
export declare function useSelectionEvents(handle: TLSelectionHandle): {
|
|
9372
|
-
onPointerDown: PointerEventHandler<Element>;
|
|
9373
|
-
onPointerMove: (e: PointerEvent_2<Element>) => void;
|
|
9374
|
-
onPointerUp: PointerEventHandler<Element>;
|
|
9375
|
-
};
|
|
9376
|
-
|
|
9377
9701
|
/* Excluded from this release type: useShallowArrayIdentity */
|
|
9378
9702
|
|
|
9379
9703
|
/* Excluded from this release type: useShallowObjectIdentity */
|