tldraw 5.5.2 → 5.6.0-canary.0091c91994d6
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/DOCS.md +264 -93
- package/RELEASE_NOTES.md +8 -36
- package/dist-cjs/index.d.ts +161 -26
- package/dist-cjs/index.js +6 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/Tldraw.js +1 -1
- package/dist-cjs/lib/Tldraw.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +31 -11
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/overlays/ShapeIndicatorOverlayUtil.js +1 -1
- package/dist-cjs/lib/overlays/ShapeIndicatorOverlayUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Idle.js +24 -16
- package/dist-cjs/lib/shapes/arrow/toolStates/Idle.js.map +2 -2
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +6 -0
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +4 -1
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +13 -0
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +9 -0
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/interpolate-props.js +5 -0
- package/dist-cjs/lib/shapes/shared/interpolate-props.js.map +2 -2
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +6 -0
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +3 -6
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/LaserTool/LaserTool.js +14 -0
- package/dist-cjs/lib/tools/LaserTool/LaserTool.js.map +2 -2
- package/dist-cjs/lib/tools/LaserTool/childStates/Idle.js +2 -8
- package/dist-cjs/lib/tools/LaserTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/LaserTool/childStates/Lasering.js +8 -1
- package/dist-cjs/lib/tools/LaserTool/childStates/Lasering.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +2 -8
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js +13 -9
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +3 -3
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Cropping.js +2 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Cropping.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js +2 -9
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +6 -13
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.js +5 -12
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +44 -71
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +3 -3
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingCanvas.js +6 -4
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingCanvas.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js +4 -16
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingResizeHandle.js +5 -14
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingResizeHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingRotateHandle.js +5 -12
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingRotateHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js +2 -7
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +19 -23
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/selectHelpers.js +53 -0
- package/dist-cjs/lib/tools/SelectTool/selectHelpers.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/selectOnCanvasPointerUp.js +2 -1
- package/dist-cjs/lib/tools/selection-logic/selectOnCanvasPointerUp.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/updateHoveredShapeId.js.map +2 -2
- package/dist-cjs/lib/ui/TldrawUi.js +7 -1
- package/dist-cjs/lib/ui/TldrawUi.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +24 -7
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +5 -1
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +6 -2
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.js +26 -48
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/ColorSchemeMenu.js +12 -6
- package/dist-cjs/lib/ui/components/ColorSchemeMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenu.js +4 -1
- package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenuContent.js +13 -1
- package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/CursorChatBubble.js +4 -1
- package/dist-cjs/lib/ui/components/CursorChatBubble.js.map +2 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +4 -1
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/EditLinkDialog.js +11 -8
- package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/EmbedDialog.js +24 -8
- package/dist-cjs/lib/ui/components/EmbedDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/HelpMenu/DefaultHelpMenu.js +12 -1
- package/dist-cjs/lib/ui/components/HelpMenu/DefaultHelpMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/HelpMenu/DefaultHelpMenuContent.js +8 -1
- package/dist-cjs/lib/ui/components/HelpMenu/DefaultHelpMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/InputModeMenu.js +18 -5
- package/dist-cjs/lib/ui/components/InputModeMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog.js +9 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +98 -27
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/LanguageMenu.js +6 -3
- package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenu.js +4 -1
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +13 -9
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js +4 -1
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js.map +2 -2
- package/dist-cjs/lib/ui/components/MobileStylePanel.js +2 -1
- package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +9 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/OfflineIndicator/OfflineIndicator.js +5 -1
- package/dist-cjs/lib/ui/components/OfflineIndicator/OfflineIndicator.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +49 -28
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +3 -3
- package/dist-cjs/lib/ui/components/PageMenu/PageItemSubmenu.js +32 -7
- package/dist-cjs/lib/ui/components/PageMenu/PageItemSubmenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/QuickActions/DefaultQuickActionsContent.js +4 -10
- package/dist-cjs/lib/ui/components/QuickActions/DefaultQuickActionsContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenu.js +4 -1
- package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenuItem.js +17 -3
- package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/DefaultUserPresenceEditor.js +8 -3
- package/dist-cjs/lib/ui/components/SharePanel/DefaultUserPresenceEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +4 -1
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +4 -1
- package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +12 -11
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +4 -3
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js +3 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js +5 -4
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toasts.js +12 -3
- package/dist-cjs/lib/ui/components/Toasts.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +7 -3
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +4 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +27 -10
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js +7 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.js +12 -4
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +4 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbar.js +4 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbarContent.js +8 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +6 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +7 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +4 -1
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/ZoomMenu/DefaultZoomMenu.js +5 -2
- package/dist-cjs/lib/ui/components/ZoomMenu/DefaultZoomMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +115 -344
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonCheck.js +6 -1
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonCheck.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +5 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDropdownMenu.js +5 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDropdownMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem.js +16 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuActionItem.js +23 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuActionItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js +5 -1
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js +2 -1
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +13 -4
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/consumerMessages.js +70 -0
- package/dist-cjs/lib/ui/consumerMessages.js.map +7 -0
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +19 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/action-predicates.js +157 -0
- package/dist-cjs/lib/ui/context/action-predicates.js.map +7 -0
- package/dist-cjs/lib/ui/context/action-state.js +81 -0
- package/dist-cjs/lib/ui/context/action-state.js.map +7 -0
- package/dist-cjs/lib/ui/context/actions.js +555 -306
- package/dist-cjs/lib/ui/context/actions.js.map +3 -3
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/context/i18n.js +57 -0
- package/dist-cjs/lib/ui/context/i18n.js.map +7 -0
- package/dist-cjs/lib/ui/hooks/menu-hooks.js +4 -88
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useActionState.js +59 -0
- package/dist-cjs/lib/ui/hooks/useActionState.js.map +7 -0
- package/dist-cjs/lib/ui/hooks/useCopyAs.js +9 -2
- package/dist-cjs/lib/ui/hooks/useCopyAs.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js +12 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +1 -0
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +54 -14
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/translations.js +10 -13
- package/dist-cjs/lib/ui/hooks/useTranslation/translations.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/useTranslation.js +65 -17
- package/dist-cjs/lib/ui/hooks/useTranslation/useTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/overrides.js.map +2 -2
- package/dist-cjs/lib/ui/styleMessages.js +150 -0
- package/dist-cjs/lib/ui/styleMessages.js.map +7 -0
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/frames/frames.js +1 -1
- package/dist-cjs/lib/utils/frames/frames.js.map +2 -2
- package/dist-cjs/lib/utils/text/richText.js +3 -2
- package/dist-cjs/lib/utils/text/richText.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/file.js +26 -7
- package/dist-cjs/lib/utils/tldr/file.js.map +2 -2
- package/dist-esm/index.d.mts +161 -26
- package/dist-esm/index.mjs +9 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/Tldraw.mjs +2 -1
- package/dist-esm/lib/Tldraw.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +36 -15
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/overlays/ShapeIndicatorOverlayUtil.mjs +1 -1
- package/dist-esm/lib/overlays/ShapeIndicatorOverlayUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Idle.mjs +24 -16
- package/dist-esm/lib/shapes/arrow/toolStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +11 -3
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +5 -2
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +23 -9
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +19 -8
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/interpolate-props.mjs +5 -0
- package/dist-esm/lib/shapes/shared/interpolate-props.mjs.map +2 -2
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +11 -3
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +3 -6
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/LaserTool/LaserTool.mjs +14 -0
- package/dist-esm/lib/tools/LaserTool/LaserTool.mjs.map +2 -2
- package/dist-esm/lib/tools/LaserTool/childStates/Idle.mjs +2 -8
- package/dist-esm/lib/tools/LaserTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/LaserTool/childStates/Lasering.mjs +8 -1
- package/dist-esm/lib/tools/LaserTool/childStates/Lasering.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +2 -8
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs +13 -9
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +3 -3
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Cropping.mjs +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Cropping.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs +2 -9
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +6 -13
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.mjs +5 -12
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +45 -71
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +3 -3
- package/dist-esm/lib/tools/SelectTool/childStates/PointingCanvas.mjs +6 -4
- package/dist-esm/lib/tools/SelectTool/childStates/PointingCanvas.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs +5 -17
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingResizeHandle.mjs +5 -14
- package/dist-esm/lib/tools/SelectTool/childStates/PointingResizeHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingRotateHandle.mjs +5 -12
- package/dist-esm/lib/tools/SelectTool/childStates/PointingRotateHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs +2 -7
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +20 -24
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +2 -3
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/selectHelpers.mjs +56 -1
- package/dist-esm/lib/tools/SelectTool/selectHelpers.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/selectOnCanvasPointerUp.mjs +2 -1
- package/dist-esm/lib/tools/selection-logic/selectOnCanvasPointerUp.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/updateHoveredShapeId.mjs.map +2 -2
- package/dist-esm/lib/ui/TldrawUi.mjs +15 -2
- package/dist-esm/lib/ui/TldrawUi.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +25 -7
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +5 -1
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +6 -2
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.mjs +26 -55
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ColorSchemeMenu.mjs +13 -7
- package/dist-esm/lib/ui/components/ColorSchemeMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenu.mjs +5 -1
- package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs +13 -1
- package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/CursorChatBubble.mjs +5 -2
- package/dist-esm/lib/ui/components/CursorChatBubble.mjs.map +2 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +5 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs +12 -9
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/EmbedDialog.mjs +25 -9
- package/dist-esm/lib/ui/components/EmbedDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/HelpMenu/DefaultHelpMenu.mjs +13 -2
- package/dist-esm/lib/ui/components/HelpMenu/DefaultHelpMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/HelpMenu/DefaultHelpMenuContent.mjs +8 -1
- package/dist-esm/lib/ui/components/HelpMenu/DefaultHelpMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/InputModeMenu.mjs +19 -6
- package/dist-esm/lib/ui/components/InputModeMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog.mjs +10 -3
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +99 -28
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/LanguageMenu.mjs +7 -4
- package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenu.mjs +5 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +13 -9
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs +8 -4
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs +2 -1
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +10 -3
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/OfflineIndicator/OfflineIndicator.mjs +5 -1
- package/dist-esm/lib/ui/components/OfflineIndicator/OfflineIndicator.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +51 -29
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +3 -3
- package/dist-esm/lib/ui/components/PageMenu/PageItemSubmenu.mjs +33 -8
- package/dist-esm/lib/ui/components/PageMenu/PageItemSubmenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/QuickActions/DefaultQuickActionsContent.mjs +4 -15
- package/dist-esm/lib/ui/components/QuickActions/DefaultQuickActionsContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenu.mjs +5 -2
- package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs +18 -4
- package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/DefaultUserPresenceEditor.mjs +9 -4
- package/dist-esm/lib/ui/components/SharePanel/DefaultUserPresenceEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +12 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +5 -2
- package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +12 -11
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +4 -3
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs +3 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs +5 -4
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toasts.mjs +13 -4
- package/dist-esm/lib/ui/components/Toasts.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +12 -4
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +5 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +28 -10
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs +15 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.mjs +18 -5
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +5 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbar.mjs +5 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbarContent.mjs +9 -4
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +7 -3
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +8 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +5 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ZoomMenu/DefaultZoomMenu.mjs +6 -3
- package/dist-esm/lib/ui/components/ZoomMenu/DefaultZoomMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +117 -354
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonCheck.mjs +6 -1
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonCheck.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +5 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDropdownMenu.mjs +6 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiDropdownMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem.mjs +16 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuActionItem.mjs +23 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuActionItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs +6 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs +3 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +13 -4
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/consumerMessages.mjs +50 -0
- package/dist-esm/lib/ui/consumerMessages.mjs.map +7 -0
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +26 -4
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/action-predicates.mjs +137 -0
- package/dist-esm/lib/ui/context/action-predicates.mjs.map +7 -0
- package/dist-esm/lib/ui/context/action-state.mjs +61 -0
- package/dist-esm/lib/ui/context/action-state.mjs.map +7 -0
- package/dist-esm/lib/ui/context/actions.mjs +579 -305
- package/dist-esm/lib/ui/context/actions.mjs.map +3 -3
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/context/i18n.mjs +42 -0
- package/dist-esm/lib/ui/context/i18n.mjs.map +7 -0
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs +8 -88
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useActionState.mjs +39 -0
- package/dist-esm/lib/ui/hooks/useActionState.mjs.map +7 -0
- package/dist-esm/lib/ui/hooks/useCopyAs.mjs +10 -3
- package/dist-esm/lib/ui/hooks/useCopyAs.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useExportAs.mjs +13 -3
- package/dist-esm/lib/ui/hooks/useExportAs.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +1 -0
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +55 -14
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/translations.mjs +11 -14
- package/dist-esm/lib/ui/hooks/useTranslation/translations.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/useTranslation.mjs +73 -19
- package/dist-esm/lib/ui/hooks/useTranslation/useTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/overrides.mjs.map +2 -2
- package/dist-esm/lib/ui/styleMessages.mjs +130 -0
- package/dist-esm/lib/ui/styleMessages.mjs.map +7 -0
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/frames/frames.mjs +1 -1
- package/dist-esm/lib/utils/frames/frames.mjs.map +2 -2
- package/dist-esm/lib/utils/text/richText.mjs +3 -2
- package/dist-esm/lib/utils/text/richText.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/file.mjs +30 -10
- package/dist-esm/lib/utils/tldr/file.mjs.map +2 -2
- package/package.json +20 -24
- package/src/index.ts +8 -0
- package/src/lib/Tldraw.test.tsx +16 -0
- package/src/lib/Tldraw.tsx +4 -1
- package/src/lib/defaultExternalContentHandlers.ts +43 -20
- package/src/lib/overlays/ShapeIndicatorOverlayUtil.ts +1 -1
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +43 -0
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +4 -0
- package/src/lib/shapes/arrow/toolStates/Idle.tsx +29 -17
- package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +13 -3
- package/src/lib/shapes/draw/DrawShapeUtil.test.ts +32 -0
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
- package/src/lib/shapes/frame/components/FrameLabelInput.tsx +6 -2
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +30 -14
- package/src/lib/shapes/highlight/HighlightShapeUtil.test.ts +15 -0
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +4 -0
- package/src/lib/shapes/image/ImageShapeUtil.tsx +26 -12
- package/src/lib/shapes/line/LineShapeUtil.tsx +4 -0
- package/src/lib/shapes/shared/interpolate-props.test.ts +52 -0
- package/src/lib/shapes/shared/interpolate-props.ts +10 -0
- package/src/lib/shapes/video/VideoShapeUtil.tsx +13 -3
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +3 -8
- package/src/lib/tools/LaserTool/LaserTool.ts +15 -0
- package/src/lib/tools/LaserTool/childStates/Idle.ts +2 -8
- package/src/lib/tools/LaserTool/childStates/Lasering.ts +12 -1
- package/src/lib/tools/SelectTool/DragAndDropManager.ts +2 -9
- package/src/lib/tools/SelectTool/childStates/Brushing.ts +20 -11
- package/src/lib/tools/SelectTool/childStates/Crop/children/Cropping.ts +2 -2
- package/src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts +5 -10
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +6 -19
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.ts +5 -18
- package/src/lib/tools/SelectTool/childStates/EditingShape.ts +2 -2
- package/src/lib/tools/SelectTool/childStates/Idle.ts +50 -74
- package/src/lib/tools/SelectTool/childStates/PointingCanvas.ts +11 -9
- package/src/lib/tools/SelectTool/childStates/PointingHandle.ts +5 -23
- package/src/lib/tools/SelectTool/childStates/PointingResizeHandle.ts +5 -20
- package/src/lib/tools/SelectTool/childStates/PointingRotateHandle.ts +5 -18
- package/src/lib/tools/SelectTool/childStates/PointingSelection.ts +2 -16
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +22 -33
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +2 -6
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +1 -4
- package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -2
- package/src/lib/tools/SelectTool/selectHelpers.ts +89 -0
- package/src/lib/tools/selection-logic/selectOnCanvasPointerUp.ts +2 -1
- package/src/lib/tools/selection-logic/updateHoveredShapeId.ts +2 -5
- package/src/lib/ui/TldrawUi.tsx +16 -2
- package/src/lib/ui/components/A11y.tsx +35 -17
- package/src/lib/ui/components/AccessibilityMenu.tsx +6 -1
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +7 -2
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.tsx +26 -63
- package/src/lib/ui/components/ColorSchemeMenu.tsx +14 -7
- package/src/lib/ui/components/ContextMenu/DefaultContextMenu.tsx +6 -1
- package/src/lib/ui/components/ContextMenu/DefaultContextMenuContent.tsx +14 -2
- package/src/lib/ui/components/CursorChatBubble.tsx +6 -2
- package/src/lib/ui/components/DefaultMenuPanel.tsx +6 -2
- package/src/lib/ui/components/EditLinkDialog.tsx +25 -11
- package/src/lib/ui/components/EmbedDialog.tsx +27 -10
- package/src/lib/ui/components/HelpMenu/DefaultHelpMenu.tsx +10 -2
- package/src/lib/ui/components/HelpMenu/DefaultHelpMenuContent.tsx +9 -1
- package/src/lib/ui/components/InputModeMenu.tsx +21 -6
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog.tsx +12 -3
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +97 -28
- package/src/lib/ui/components/LanguageMenu.tsx +8 -4
- package/src/lib/ui/components/MainMenu/DefaultMainMenu.tsx +6 -2
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +14 -9
- package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +9 -4
- package/src/lib/ui/components/MobileStylePanel.tsx +2 -1
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +11 -3
- package/src/lib/ui/components/OfflineIndicator/OfflineIndicator.tsx +7 -2
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +60 -29
- package/src/lib/ui/components/PageMenu/PageItemSubmenu.tsx +28 -8
- package/src/lib/ui/components/QuickActions/DefaultQuickActionsContent.tsx +4 -15
- package/src/lib/ui/components/SharePanel/DefaultPeopleMenu.tsx +6 -2
- package/src/lib/ui/components/SharePanel/DefaultPeopleMenuItem.tsx +18 -6
- package/src/lib/ui/components/SharePanel/DefaultUserPresenceEditor.tsx +10 -4
- package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +13 -2
- package/src/lib/ui/components/Spinner.tsx +6 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +12 -11
- package/src/lib/ui/components/StylePanel/StylePanelButtonPicker.tsx +4 -4
- package/src/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.tsx +4 -3
- package/src/lib/ui/components/StylePanel/StylePanelDropdownPicker.tsx +6 -9
- package/src/lib/ui/components/Toasts.tsx +22 -4
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +16 -4
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +6 -2
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +34 -10
- package/src/lib/ui/components/Toolbar/DefaultRichTextToolbar.tsx +17 -2
- package/src/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.tsx +28 -8
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +6 -2
- package/src/lib/ui/components/Toolbar/DefaultVideoToolbar.tsx +6 -2
- package/src/lib/ui/components/Toolbar/DefaultVideoToolbarContent.tsx +10 -4
- package/src/lib/ui/components/Toolbar/LinkEditor.tsx +8 -3
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +9 -3
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +7 -3
- package/src/lib/ui/components/ZoomMenu/DefaultZoomMenu.tsx +7 -3
- package/src/lib/ui/components/menu-items.tsx +136 -416
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonCheck.tsx +7 -1
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +6 -1
- package/src/lib/ui/components/primitives/TldrawUiDropdownMenu.tsx +7 -3
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuActionCheckboxItem.tsx +17 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuActionItem.tsx +25 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +7 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +4 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +6 -1
- package/src/lib/ui/consumerMessages.ts +60 -0
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +25 -2
- package/src/lib/ui/context/action-predicates.ts +194 -0
- package/src/lib/ui/context/action-state.ts +93 -0
- package/src/lib/ui/context/actions.tsx +630 -377
- package/src/lib/ui/context/events.tsx +3 -0
- package/src/lib/ui/context/i18n.test.tsx +343 -0
- package/src/lib/ui/context/i18n.tsx +111 -0
- package/src/lib/ui/hooks/menu-hooks.ts +10 -118
- package/src/lib/ui/hooks/useActionState.ts +61 -0
- package/src/lib/ui/hooks/useCopyAs.ts +11 -3
- package/src/lib/ui/hooks/useExportAs.ts +14 -3
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +4 -1
- package/src/lib/ui/hooks/useTools.tsx +62 -14
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +333 -385
- package/src/lib/ui/hooks/useTranslation/translations.ts +15 -22
- package/src/lib/ui/hooks/useTranslation/useTranslation.test.tsx +55 -2
- package/src/lib/ui/hooks/useTranslation/useTranslation.tsx +163 -24
- package/src/lib/ui/overrides.ts +4 -0
- package/src/lib/ui/styleMessages.test.ts +83 -0
- package/src/lib/ui/styleMessages.ts +169 -0
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/utils/frames/frames.ts +1 -1
- package/src/lib/utils/text/richText.test.ts +37 -0
- package/src/lib/utils/text/richText.ts +3 -2
- package/src/lib/utils/tldr/file.ts +36 -14
- package/src/test/A11y.test.tsx +85 -13
- package/src/test/EraserTool.test.ts +42 -1
- package/src/test/LaserTool.test.ts +86 -0
- package/src/test/ScribbleManager.test.ts +25 -0
- package/src/test/SelectTool.test.ts +31 -60
- package/src/test/TldrawEditor.test.tsx +66 -1
- package/src/test/commands/duplicatePage.test.ts +41 -1
- package/src/test/cropping.test.ts +66 -66
- package/src/test/deferredDoubleClick.test.ts +231 -0
- package/src/test/frames.test.ts +89 -0
- package/src/test/navigation.test.ts +26 -66
- package/src/test/pinch-dom.test.tsx +1 -24
- package/src/test/pointercancel-dom.test.tsx +1 -23
- package/src/test/resizeBox.test.ts +25 -0
- package/src/test/resizing.test.ts +158 -0
- package/src/test/richTextToolbarEvents.test.tsx +46 -0
- package/src/test/select.test.tsx +143 -0
- package/src/test/shapeIdsInCurrentPage.test.ts +37 -0
- package/src/test/shapeutils.test.ts +58 -1
- package/src/test/spatialIndex.test.ts +35 -0
- package/src/test/testutils/renderTldrawComponent.tsx +3 -3
- package/src/test/toolbar-tool-selection.test.tsx +41 -0
- package/src/test/ui/FrameSelectionMenuItem.test.tsx +11 -2
- package/src/test/ui/PageMenu.test.tsx +165 -0
- package/src/test/ui/SkipToMainContent.test.tsx +51 -0
- package/src/test/ui/actionGate.test.tsx +197 -0
- package/src/test/ui/actionGating.test.tsx +447 -0
- package/src/test/ui/actionPredicates.test.ts +156 -0
- package/src/test/ui/keyboardShortcuts.test.tsx +376 -26
- package/src/test/ui/menuActionItem.test.tsx +548 -0
- package/src/test/ui/menuGating.test.tsx +336 -0
- package/src/test/ui/menuPaste.test.tsx +18 -0
- package/src/test/ui/menuSubmenus.test.tsx +111 -0
- package/tldraw.css +1 -5
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -567
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +0 -7
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -547
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +0 -7
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -558
package/DOCS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tldraw Documentation
|
|
2
2
|
|
|
3
|
-
Version: `5.
|
|
3
|
+
Version: `5.6.0-canary.0091c91994d6`
|
|
4
4
|
|
|
5
5
|
This file is generated during package publishing from the tldraw docs content for this exact package version.
|
|
6
6
|
|
|
@@ -1890,8 +1890,8 @@ Attach each incoming WebSocket to the room and forward its events:
|
|
|
1890
1890
|
room.handleSocketConnect({ sessionId, socket })
|
|
1891
1891
|
// If your platform doesn't let the room add listeners to the socket itself
|
|
1892
1892
|
// (Bun.serve, Cloudflare hibernation), forward events by hand:
|
|
1893
|
-
room.handleSocketMessage(sessionId, message)
|
|
1894
|
-
room.handleSocketClose(sessionId)
|
|
1893
|
+
room.handleSocketMessage(sessionId, message, socket)
|
|
1894
|
+
room.handleSocketClose(sessionId, socket)
|
|
1895
1895
|
```
|
|
1896
1896
|
|
|
1897
1897
|
You should make sure that there's only ever one `TLSocketRoom` globally for each room in your app.
|
|
@@ -1986,7 +1986,8 @@ interface SocketAttachment {
|
|
|
1986
1986
|
|
|
1987
1987
|
export class TldrawDurableObject extends DurableObject {
|
|
1988
1988
|
private room: TLSocketRoom<TLRecord, void> | null = null
|
|
1989
|
-
// Maps sessionId → ws.
|
|
1989
|
+
// Maps sessionId → ws. Set it on connect and on resume, never from webSocketMessage: a
|
|
1990
|
+
// superseded socket for the same session id can still deliver messages.
|
|
1990
1991
|
private readonly sessionIdToWs = new Map<string, WebSocket>()
|
|
1991
1992
|
|
|
1992
1993
|
private getOrCreateRoom() {
|
|
@@ -2015,6 +2016,7 @@ export class TldrawDurableObject extends DurableObject {
|
|
|
2015
2016
|
socket: ws,
|
|
2016
2017
|
snapshot: attachment.snapshot,
|
|
2017
2018
|
})
|
|
2019
|
+
this.sessionIdToWs.set(attachment.sessionId, ws)
|
|
2018
2020
|
}
|
|
2019
2021
|
}
|
|
2020
2022
|
|
|
@@ -2025,7 +2027,7 @@ export class TldrawDurableObject extends DurableObject {
|
|
|
2025
2027
|
|
|
2026
2028
|
Three pieces make this work. The `onSessionSnapshot` callback persists each session's state to its WebSocket's attachment so the snapshot is still around after hibernation. When the object wakes up with sockets still open, `handleSocketResume` replays each saved snapshot and the session lands straight in `Connected` state; the client never sees a reconnect. Setting `clientTimeout: Infinity` disables the room's idle timer; hibernating platforms handle keep-alive themselves and would otherwise see the room disconnect healthy clients.
|
|
2027
2029
|
|
|
2028
|
-
For a complete implementation, including the hibernation event handlers that
|
|
2030
|
+
For a complete implementation, including the connect handler and the hibernation event handlers that pass each socket to the room, see the [sync-cloudflare template](https://github.com/tldraw/tldraw/tree/main/templates/sync-cloudflare).
|
|
2029
2031
|
|
|
2030
2032
|
For non-hibernating environments (Node servers, long-lived processes), you don't need any of this. The in-memory `TLSocketRoom` outlives individual sockets, and the default `clientTimeout` (20 seconds) removes idle sessions.
|
|
2031
2033
|
|
|
@@ -4261,9 +4263,9 @@ The `priority` option accepts `'polite'` or `'assertive'` and defaults to `'asse
|
|
|
4261
4263
|
|
|
4262
4264
|
Users can navigate between shapes using the keyboard. With a shape selected, Tab moves selection to the next shape in reading order and Shift+Tab moves to the previous shape. Arrow keys with Ctrl/Cmd move selection to the nearest shape in that direction, and Ctrl/Cmd+Shift+Down or Up select a group's first child or its parent. `Editor#selectAdjacentShape` is the programmatic equivalent.
|
|
4263
4265
|
|
|
4264
|
-
Tldraw determines reading order by analyzing shape positions on the canvas. Shapes are grouped into rows based on their vertical position, then sorted left-to-right within each row. This creates a natural top-to-bottom, left-to-right reading order similar to text. You can access this order programmatically with `Editor#getCurrentPageShapesInReadingOrder`.
|
|
4266
|
+
Tldraw determines reading order by analyzing shape positions on the canvas. Shapes are grouped into rows based on their vertical position, then sorted left-to-right within each row. This creates a natural top-to-bottom, left-to-right reading order similar to text. You can access this order programmatically with `Editor#getCurrentPageShapesInReadingOrder`. Locked shapes are included, so keyboard users can reach a locked shape and unlock it.
|
|
4265
4267
|
|
|
4266
|
-
A "
|
|
4268
|
+
A "Move focus to canvas" button appears when users Tab into the editor. It selects the first shape in reading order and zooms to it.
|
|
4267
4269
|
|
|
4268
4270
|
##### Excluding shapes from keyboard navigation
|
|
4269
4271
|
|
|
@@ -4480,16 +4482,19 @@ Keyboard shortcuts are bound automatically. The `useKeyboardShortcuts` hook pars
|
|
|
4480
4482
|
|
|
4481
4483
|
The `TLUiActionItem` interface defines what an action contains:
|
|
4482
4484
|
|
|
4483
|
-
| Property | Description
|
|
4484
|
-
| ---------------------- |
|
|
4485
|
-
| `id` | Unique identifier for the action (e.g., `'duplicate'`, `'zoom-in'`)
|
|
4486
|
-
| `label` | Translation key for display text. Can be a string or an object mapping contexts to different keys (see [Context-sensitive labels](#context-sensitive-labels))
|
|
4487
|
-
| `icon` | Icon name from tldraw's icon set, or a custom React element
|
|
4488
|
-
| `kbd` | Keyboard shortcut string. Use commas to bind several combinations, e.g. `'cmd+g,ctrl+g'` (see [Keyboard shortcuts](#keyboard-shortcuts))
|
|
4489
|
-
| `readonlyOk` | When `true`, the action
|
|
4490
|
-
| `checkbox` | When `true`, renders as a toggle with a checkmark indicator in menus
|
|
4491
|
-
| `isRequiredA11yAction` | When `true`, the keyboard shortcut works even when shortcuts are normally disabled (e.g., while editing a shape). Used for accessibility actions
|
|
4492
|
-
| `
|
|
4485
|
+
| Property | Description |
|
|
4486
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
4487
|
+
| `id` | Unique identifier for the action (e.g., `'duplicate'`, `'zoom-in'`) |
|
|
4488
|
+
| `label` | Translation key for display text. Can be a string or an object mapping contexts to different keys (see [Context-sensitive labels](#context-sensitive-labels)) |
|
|
4489
|
+
| `icon` | Icon name from tldraw's icon set, or a custom React element |
|
|
4490
|
+
| `kbd` | Keyboard shortcut string. Use commas to bind several combinations, e.g. `'cmd+g,ctrl+g'` (see [Keyboard shortcuts](#keyboard-shortcuts)) |
|
|
4491
|
+
| `readonlyOk` | When `true`, the action runs in readonly mode; otherwise it doesn't run, however it's triggered. Defaults to `false` |
|
|
4492
|
+
| `checkbox` | When `true`, renders as a toggle with a checkmark indicator in menus |
|
|
4493
|
+
| `isRequiredA11yAction` | When `true`, the keyboard shortcut works even when shortcuts are normally disabled (e.g., while editing a shape). Used for accessibility actions |
|
|
4494
|
+
| `isAvailable` | Optional `(editor) => boolean`. When it returns `false`, menus hide the action, and the action doesn't run (see [Enabling and checking actions](#enabling-and-checking-actions)) |
|
|
4495
|
+
| `isEnabled` | Optional `(editor) => boolean`. When it returns `false`, menus disable or hide the action, and the action doesn't run |
|
|
4496
|
+
| `isChecked` | Optional `(editor) => boolean`. For checkbox actions, whether the item shows as checked |
|
|
4497
|
+
| `onSelect` | Handler called when the action is triggered. Receives a `TLUiEventSource` indicating the trigger origin (`'kbd'`, `'menu'`, `'toolbar'`, etc.) |
|
|
4493
4498
|
|
|
4494
4499
|
#### Accessing actions
|
|
4495
4500
|
|
|
@@ -4518,13 +4523,14 @@ The default actions cover most editing operations you'd expect in a canvas appli
|
|
|
4518
4523
|
| Category | Action ids |
|
|
4519
4524
|
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
4520
4525
|
| Editing | `undo`, `redo`, `duplicate`, `delete`, `copy`, `cut`, `paste` |
|
|
4521
|
-
| Grouping | `group`, `ungroup`
|
|
4526
|
+
| Grouping | `group`, `ungroup`, `toggle-group` |
|
|
4527
|
+
| Frames | `frame-selection`, `remove-frame`, `toggle-frame`, `fit-frame-to-content` |
|
|
4522
4528
|
| Arrangement | `bring-to-front`, `bring-forward`, `send-backward`, `send-to-back`, `align-left`, `align-center-horizontal`, `align-right`, `distribute-horizontal`, `distribute-vertical` |
|
|
4523
4529
|
| Export | `export-as-svg`, `export-as-png`, `copy-as-svg`, `copy-as-png` |
|
|
4524
4530
|
| Zoom | `zoom-in`, `zoom-out`, `zoom-to-100`, `zoom-to-fit`, `zoom-to-selection`, `select-zoom-tool` |
|
|
4525
4531
|
| Preferences | `toggle-dark-mode`, `toggle-snap-mode`, `toggle-grid`, `toggle-focus-mode` |
|
|
4526
4532
|
|
|
4527
|
-
The full list is in the [default actions source](https://github.com/tldraw/tldraw/blob/main/packages/tldraw/src/lib/ui/context/actions.tsx).
|
|
4533
|
+
The full list is in the [default actions source](https://github.com/tldraw/tldraw/blob/main/packages/tldraw/src/lib/ui/context/actions.tsx). An action doesn't run when its `isAvailable` or `isEnabled` returns false, or when the editor is readonly and it isn't `readonlyOk`, including when you call `onSelect` on an action from `useActions()`. For example, `group` does nothing unless two or more unlocked shapes are selected in the select tool.
|
|
4528
4534
|
|
|
4529
4535
|
#### Overriding actions
|
|
4530
4536
|
|
|
@@ -4550,7 +4556,9 @@ function App() {
|
|
|
4550
4556
|
}
|
|
4551
4557
|
```
|
|
4552
4558
|
|
|
4553
|
-
The `copy`, `cut`, and `paste` shortcuts are handled by native clipboard events rather than the `kbd` system, so changing their `kbd` has no effect.
|
|
4559
|
+
The `copy`, `cut`, and `paste` shortcuts are handled by native clipboard events rather than the `kbd` system, so changing their `kbd` or `isEnabled` has no effect on them.
|
|
4560
|
+
|
|
4561
|
+
Cmd+G and Cmd+Alt+G belong to `toggle-group` and `toggle-frame`, which run `group` or `ungroup`, and `frame-selection` or `remove-frame`, depending on the selection. To change or remove those shortcuts, override the toggle actions, not `group` or `frame-selection`.
|
|
4554
4562
|
|
|
4555
4563
|
##### Modifying behavior
|
|
4556
4564
|
|
|
@@ -4576,7 +4584,7 @@ You can call the original handler before or after your custom logic, or replace
|
|
|
4576
4584
|
|
|
4577
4585
|
##### Adding custom actions
|
|
4578
4586
|
|
|
4579
|
-
Add new actions by inserting them into the actions record
|
|
4587
|
+
Add new actions by inserting them into the actions record. The `actions` map passed to `overrides` isn't gated yet, so calling a built-in's `onSelect` on it from inside a custom action skips the readonly check, `isAvailable` and `isEnabled`. Before you call it, check `editor.getIsReadonly()` (unless it's `readonlyOk`) and whichever of `isAvailable` and `isEnabled` it defines. Actions you get from `useActions()` in component code are gated.
|
|
4580
4588
|
|
|
4581
4589
|
```typescript
|
|
4582
4590
|
const overrides: TLUiOverrides = {
|
|
@@ -4681,7 +4689,7 @@ function CustomMenu() {
|
|
|
4681
4689
|
}
|
|
4682
4690
|
```
|
|
4683
4691
|
|
|
4684
|
-
This component looks up the action by ID and renders it with the correct label, icon, and shortcut hint. Pass `disabled`
|
|
4692
|
+
This component looks up the action by ID and renders it with the correct label, icon, and shortcut hint. If the action defines `isEnabled`, the item disables itself when it returns false. Pass `whenDisabled="hide"` to hide it instead, whether it's disabled by `isEnabled` or by your own `disabled` prop. In the context menu, a disabled `TldrawUiMenuActionItem` is hidden either way. For toggle actions, use `TldrawUiMenuActionCheckboxItem`; it reads `checked` from the action's `isChecked` unless you pass `checked`.
|
|
4685
4693
|
|
|
4686
4694
|
#### Context-sensitive labels
|
|
4687
4695
|
|
|
@@ -4689,18 +4697,72 @@ Some actions show different labels depending on where they appear. The `label` p
|
|
|
4689
4697
|
|
|
4690
4698
|
```typescript
|
|
4691
4699
|
actions['export-as-svg'] = {
|
|
4692
|
-
|
|
4700
|
+
...actions['export-as-svg'],
|
|
4693
4701
|
label: {
|
|
4694
4702
|
default: 'action.export-as-svg',
|
|
4695
4703
|
menu: 'action.export-as-svg.short',
|
|
4696
4704
|
'context-menu': 'action.export-as-svg.short',
|
|
4697
4705
|
},
|
|
4698
|
-
// ...
|
|
4699
4706
|
}
|
|
4700
4707
|
```
|
|
4701
4708
|
|
|
4702
4709
|
The menu component uses the appropriate label based on its context. If no specific label exists for a context, it falls back to `default`.
|
|
4703
4710
|
|
|
4711
|
+
#### Enabling and checking actions
|
|
4712
|
+
|
|
4713
|
+
`isEnabled` tells every menu whether the action can run right now. `isChecked` tells checkbox items whether they're on. Both receive the editor and must not change anything. Menus re-run them when the editor state they read changes, so read everything they depend on from the editor; a value read from anywhere else won't update the menu.
|
|
4714
|
+
|
|
4715
|
+
```tsx
|
|
4716
|
+
actions['make-red'] = {
|
|
4717
|
+
id: 'make-red',
|
|
4718
|
+
label: 'action.make-red',
|
|
4719
|
+
isEnabled: (editor) => editor.getSelectedShapeIds().length > 0,
|
|
4720
|
+
onSelect() {
|
|
4721
|
+
// ...
|
|
4722
|
+
},
|
|
4723
|
+
}
|
|
4724
|
+
```
|
|
4725
|
+
|
|
4726
|
+
Menus, keyboard shortcuts and `onSelect` calls on actions from `useActions()` all respect `isEnabled`, so `onSelect` doesn't need to check it again. The gate comes from the action as `overrides` returned it, so changing `isEnabled` on a copy of an action from `useActions()` doesn't change when it runs; override it instead. The exception is the copy, cut and paste shortcuts: they come from native clipboard events, which don't check the action's `isEnabled`.
|
|
4727
|
+
|
|
4728
|
+
When you change a built-in action, spread the original so it keeps its `isAvailable`, `isEnabled` and `isChecked`:
|
|
4729
|
+
|
|
4730
|
+
```tsx
|
|
4731
|
+
actions['group'] = { ...actions['group'], onSelect: myGroup }
|
|
4732
|
+
```
|
|
4733
|
+
|
|
4734
|
+
Replacing an action with a new object drops them, along with `readonlyOk`: menus show it as always enabled, a checkbox item for it always shows as unchecked, shortcuts and `onSelect` calls run it whatever the selection, and if the built-in was `readonlyOk`, it stops running while the editor is readonly.
|
|
4735
|
+
|
|
4736
|
+
Use `isAvailable` instead when the action doesn't exist in the current context at all, rather than being blocked right now. Every menu item hides an unavailable action, whatever `whenDisabled` says; only the keyboard shortcuts dialog still lists it. The built-in paste (without clipboard read access), copy as PNG (without clipboard write access), copy as JSON (outside debug mode), cursor chat (on touch), exit pen mode, stop following, and back to content work this way.
|
|
4737
|
+
|
|
4738
|
+
```tsx
|
|
4739
|
+
actions['open-devtools'] = {
|
|
4740
|
+
id: 'open-devtools',
|
|
4741
|
+
label: 'action.open-devtools',
|
|
4742
|
+
isAvailable: (editor) => editor.getInstanceState().isDebugMode,
|
|
4743
|
+
onSelect() {
|
|
4744
|
+
// ...
|
|
4745
|
+
},
|
|
4746
|
+
}
|
|
4747
|
+
```
|
|
4748
|
+
|
|
4749
|
+
To hide a submenu when none of its actions can run, use `useSomeActionsEnabled`. It returns true when any of the given actions is available and enabled; actions that aren't `readonlyOk` count as unavailable while the editor is readonly:
|
|
4750
|
+
|
|
4751
|
+
```tsx
|
|
4752
|
+
const IDS = ['make-red', 'make-blue']
|
|
4753
|
+
|
|
4754
|
+
function ColorsSubmenu() {
|
|
4755
|
+
if (!useSomeActionsEnabled(IDS)) return null
|
|
4756
|
+
return (
|
|
4757
|
+
<TldrawUiMenuSubmenu id="colors" label="menu.colors">
|
|
4758
|
+
{IDS.map((id) => (
|
|
4759
|
+
<TldrawUiMenuActionItem key={id} actionId={id} whenDisabled="hide" />
|
|
4760
|
+
))}
|
|
4761
|
+
</TldrawUiMenuSubmenu>
|
|
4762
|
+
)
|
|
4763
|
+
}
|
|
4764
|
+
```
|
|
4765
|
+
|
|
4704
4766
|
#### Tracking action usage
|
|
4705
4767
|
|
|
4706
4768
|
The `source` parameter tells you where the action was triggered. Use this for analytics:
|
|
@@ -6779,7 +6841,9 @@ Mount the layer through the `InFrontOfTheCanvas` component slot so it sits above
|
|
|
6779
6841
|
|
|
6780
6842
|
#### Placing comments
|
|
6781
6843
|
|
|
6782
|
-
`commentToolOverrides` puts the comment tool in Quick Actions with the `C` shortcut. With the tool active, clicking empty canvas starts a thread anchored to that point, and clicking a shape anchors a comment to the shape. You can also turn on region comments, where dragging the tool out covers an area. Either way the click only opens a composer: nothing is written to the store until the comment is posted.
|
|
6844
|
+
`commentToolOverrides` puts the comment tool in Quick Actions with the `C` shortcut, and adds a **Comment** item to the canvas context menu that opens the composer where the menu was opened. With the tool active, clicking empty canvas starts a thread anchored to that point, and clicking a shape anchors a comment to the shape. You can also turn on region comments, where dragging the tool out covers an area. Either way the click only opens a composer: nothing is written to the store until the comment is posted.
|
|
6845
|
+
|
|
6846
|
+
To start a comment from somewhere else, such as your own menu item, call `startCommentAt(editor, point)` with a page point. It enters the comment tool and opens the composer there, anchored the same way a click would be.
|
|
6783
6847
|
|
|
6784
6848
|
Once a comment thread exists, its pin is the handle for everything else.
|
|
6785
6849
|
|
|
@@ -7318,19 +7382,19 @@ This is the same question the client's [`canModifyComment`](#who-can-edit-and-de
|
|
|
7318
7382
|
|
|
7319
7383
|
`CanvasComments` is one way to assemble the parts, and every part it uses is exported. You can rebuild it, or build something quite different, from the same pieces.
|
|
7320
7384
|
|
|
7321
|
-
| Export
|
|
7322
|
-
|
|
|
7323
|
-
| `CommentTool`, `commentToolOverrides`
|
|
7324
|
-
| `CommentPin`, `CountBadge`
|
|
7325
|
-
| `CommentThread`, `CommentCard`, `Byline`
|
|
7326
|
-
| `CommentComposer`, `SendButton`
|
|
7327
|
-
| `CommentsList`, `CommentListItem`
|
|
7328
|
-
| `EmptyState`, `sortSidebarRows`
|
|
7329
|
-
| `Avatar`, `Mention`, `MentionList`
|
|
7330
|
-
| `Reaction`, `Reactions`
|
|
7331
|
-
| `anchorPagePoint`, `shapeAnchorAt`
|
|
7332
|
-
| `editComment`, `deleteComment`
|
|
7333
|
-
| `registerCommentAnchorLifecycle`
|
|
7385
|
+
| Export | Description |
|
|
7386
|
+
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
7387
|
+
| `CommentTool`, `commentToolOverrides`, `startCommentAt` | Placement: the tool state machine, its toolbar entry, and starting a comment at a point. |
|
|
7388
|
+
| `CommentPin`, `CountBadge` | The pin marker and the clustered-count badge. |
|
|
7389
|
+
| `CommentThread`, `CommentCard`, `Byline` | A thread and its comments. |
|
|
7390
|
+
| `CommentComposer`, `SendButton` | The composer and its send control. |
|
|
7391
|
+
| `CommentsList`, `CommentListItem` | A list of threads and one row of it. |
|
|
7392
|
+
| `EmptyState`, `sortSidebarRows` | The list's empty state, and the sidebar's ordering. |
|
|
7393
|
+
| `Avatar`, `Mention`, `MentionList` | Author avatars and the mention picker. |
|
|
7394
|
+
| `Reaction`, `Reactions` | A reaction pill and a comment's row of them. |
|
|
7395
|
+
| `anchorPagePoint`, `shapeAnchorAt` | Anchor math: page position from an anchor, and the reverse. |
|
|
7396
|
+
| `editComment`, `deleteComment` | The write verbs. See [Writing comments](#writing-comments). |
|
|
7397
|
+
| `registerCommentAnchorLifecycle` | Keeps shape-anchored threads alive across shape deletion. |
|
|
7334
7398
|
|
|
7335
7399
|
The presentational components take plain props and know nothing about the editor. The canvas layer, the tool, and the hooks build on them. `CanvasComments` registers the anchor lifecycle for you, so call `registerCommentAnchorLifecycle` yourself only if you're replacing the layer wholesale.
|
|
7336
7400
|
|
|
@@ -7840,31 +7904,34 @@ The `type` determines the visual appearance—like `'default'`, `'grab'`, or `'n
|
|
|
7840
7904
|
|
|
7841
7905
|
tldraw supports these cursor types:
|
|
7842
7906
|
|
|
7843
|
-
| Type
|
|
7844
|
-
|
|
|
7845
|
-
| `default`
|
|
7846
|
-
| `pointer`
|
|
7847
|
-
| `cross`
|
|
7848
|
-
| `comment`
|
|
7849
|
-
| `grab`
|
|
7850
|
-
| `grabbing`
|
|
7851
|
-
| `text`
|
|
7852
|
-
| `move`
|
|
7853
|
-
| `zoom-in`
|
|
7854
|
-
| `zoom-out`
|
|
7855
|
-
| `ew-resize`
|
|
7856
|
-
| `ns-resize`
|
|
7857
|
-
| `nesw-resize`
|
|
7858
|
-
| `nwse-resize`
|
|
7859
|
-
| `nesw-rotate`
|
|
7860
|
-
| `nwse-rotate`
|
|
7861
|
-
| `senw-rotate`
|
|
7862
|
-
| `swne-rotate`
|
|
7863
|
-
| `none`
|
|
7907
|
+
| Type | Description |
|
|
7908
|
+
| --------------- | --------------------------------------------------------- |
|
|
7909
|
+
| `default` | Standard pointer arrow |
|
|
7910
|
+
| `pointer` | Hand indicating clickable element |
|
|
7911
|
+
| `cross` | Crosshair for precise positioning |
|
|
7912
|
+
| `comment` | Speech bubble for placing comments |
|
|
7913
|
+
| `grab` | Open hand for draggable content |
|
|
7914
|
+
| `grabbing` | Closed hand while dragging |
|
|
7915
|
+
| `text` | I-beam for text editing |
|
|
7916
|
+
| `move` | Four-way arrow for moving elements |
|
|
7917
|
+
| `zoom-in` | Magnifying glass with plus |
|
|
7918
|
+
| `zoom-out` | Magnifying glass with minus |
|
|
7919
|
+
| `ew-resize` | Horizontal resize (east-west) |
|
|
7920
|
+
| `ns-resize` | Vertical resize (north-south) |
|
|
7921
|
+
| `nesw-resize` | Diagonal resize (northeast-southwest) |
|
|
7922
|
+
| `nwse-resize` | Diagonal resize (northwest-southeast) |
|
|
7923
|
+
| `nesw-rotate` | Rotation handle (northeast-southwest position) |
|
|
7924
|
+
| `nwse-rotate` | Rotation handle (northwest-southeast position) |
|
|
7925
|
+
| `senw-rotate` | Rotation handle (southeast-northwest position) |
|
|
7926
|
+
| `swne-rotate` | Rotation handle (southwest-northeast position) |
|
|
7927
|
+
| `none` | Hidden cursor |
|
|
7928
|
+
| `rotate` | Static rotation cursor (falls back to `pointer`) |
|
|
7929
|
+
| `resize-edge` | Static edge resize cursor (falls back to `ew-resize`) |
|
|
7930
|
+
| `resize-corner` | Static corner resize cursor (falls back to `nesw-resize`) |
|
|
7864
7931
|
|
|
7865
7932
|
Static cursors like `default`, `pointer`, and `grab` are prerendered SVG cursors defined as CSS custom properties in tldraw's stylesheet (`--tl-cursor-default`, `--tl-cursor-grab`, and so on). Dynamic cursors like the resize and rotate types are generated at runtime as SVGs with the current rotation applied. The canvas reads the result from the `--tl-cursor` variable.
|
|
7866
7933
|
|
|
7867
|
-
|
|
7934
|
+
The `rotate`, `resize-edge`, and `resize-corner` types are static too: they map to `--tl-cursor-rotate`, `--tl-cursor-resize-edge`, and `--tl-cursor-resize-corner`, which default to the browser's `pointer`, `ew-resize`, and `nesw-resize` cursors and ignore the cursor rotation. Use the direction-specific `*-resize` and `*-rotate` types when you want the rotated SVG cursors.
|
|
7868
7935
|
|
|
7869
7936
|
#### Setting the cursor
|
|
7870
7937
|
|
|
@@ -10883,7 +10950,7 @@ editor.createShape({
|
|
|
10883
10950
|
|
|
10884
10951
|
#### Creating frames
|
|
10885
10952
|
|
|
10886
|
-
You can create a frame programmatically with `Editor#createShape`, or interactively with the frame tool. The frame tool ships in the default toolbar; users can also press `F` to switch to it. The **Frame selection** action
|
|
10953
|
+
You can create a frame programmatically with `Editor#createShape`, or interactively with the frame tool. The frame tool ships in the default toolbar; users can also press `F` to switch to it. The **Frame selection** action wraps the current selection in a new frame. `Cmd/Ctrl+Alt+G` runs the `toggle-frame` action: it frames the selection, or removes the frame if only frames are selected. Override `toggle-frame` to rebind it.
|
|
10887
10954
|
|
|
10888
10955
|
When the user drags a frame around existing shapes, the frame tool reparents any sibling shapes that fall fully inside the frame's bounds. Locked shapes are skipped. This is what makes "draw a frame around the things I want to group" work as a single gesture.
|
|
10889
10956
|
|
|
@@ -10966,7 +11033,7 @@ import { removeFrame } from 'tldraw'
|
|
|
10966
11033
|
removeFrame(editor, [frameId])
|
|
10967
11034
|
```
|
|
10968
11035
|
|
|
10969
|
-
The **Remove frame** and **Fit frame to content** actions in the main menu and the context menu's Edit submenu call these helpers when a frame is selected. **
|
|
11036
|
+
The **Remove frame** and **Fit frame to content** actions in the main menu and the context menu's Edit submenu call these helpers when a frame is selected. **Remove frame** (`remove-frame`) has its own shortcut, `Cmd/Ctrl+Alt+Shift+G`.
|
|
10970
11037
|
|
|
10971
11038
|
#### Exporting frames
|
|
10972
11039
|
|
|
@@ -11870,7 +11937,7 @@ editor.groupShapes([shapeId1, shapeId2], {
|
|
|
11870
11937
|
})
|
|
11871
11938
|
```
|
|
11872
11939
|
|
|
11873
|
-
Grouping requires at least two shapes. The method does nothing if you pass fewer, and it skips [locked shapes](https://tldraw.dev/sdk-features/locked-shapes). Users can also group shapes with Ctrl+G (Cmd+G on Mac)
|
|
11940
|
+
Grouping requires at least two shapes. The method does nothing if you pass fewer, and it skips [locked shapes](https://tldraw.dev/sdk-features/locked-shapes). Users can also group shapes with Ctrl+G (Cmd+G on Mac). Pressing the shortcut again with the resulting group selected ungroups it. The shortcut belongs to the `toggle-group` action, so override that action to rebind it.
|
|
11874
11941
|
|
|
11875
11942
|
The new group is positioned at the top-left of the combined bounds of all grouped shapes. It takes the z-index of the topmost grouped shape, so it sits where that shape was in its parent's layer stack.
|
|
11876
11943
|
|
|
@@ -13392,6 +13459,48 @@ function CopyButton() {
|
|
|
13392
13459
|
}
|
|
13393
13460
|
```
|
|
13394
13461
|
|
|
13462
|
+
Pass a second argument to fill in a message's placeholders:
|
|
13463
|
+
|
|
13464
|
+
```tsx
|
|
13465
|
+
function SelectionStatus({ count }: { count: number }) {
|
|
13466
|
+
const msg = useTranslation()
|
|
13467
|
+
return <p>{msg('a11y.multiple-shapes', { num: count })}</p>
|
|
13468
|
+
}
|
|
13469
|
+
```
|
|
13470
|
+
|
|
13471
|
+
##### Rendering a message as an element
|
|
13472
|
+
|
|
13473
|
+
`F` renders a message where it belongs in the markup, with its English alongside:
|
|
13474
|
+
|
|
13475
|
+
```tsx
|
|
13476
|
+
import { F } from 'tldraw'
|
|
13477
|
+
|
|
13478
|
+
function CopyButton() {
|
|
13479
|
+
return (
|
|
13480
|
+
<button>
|
|
13481
|
+
<F defaultMessage="Copy" id="action.copy" />
|
|
13482
|
+
</button>
|
|
13483
|
+
)
|
|
13484
|
+
}
|
|
13485
|
+
```
|
|
13486
|
+
|
|
13487
|
+
Where a string is needed instead — an `aria-label`, a `title`, a `placeholder` — pass the declared message to `useTranslation`. If the current locale has no translation for it yet, its `defaultMessage` is used:
|
|
13488
|
+
|
|
13489
|
+
```tsx
|
|
13490
|
+
import { defineMessages, useTranslation } from 'tldraw'
|
|
13491
|
+
|
|
13492
|
+
const messages = defineMessages({
|
|
13493
|
+
close: { id: 'ui.close', defaultMessage: 'Close' },
|
|
13494
|
+
})
|
|
13495
|
+
|
|
13496
|
+
function CloseButton() {
|
|
13497
|
+
const msg = useTranslation()
|
|
13498
|
+
return <button aria-label={msg(messages.close)} />
|
|
13499
|
+
}
|
|
13500
|
+
```
|
|
13501
|
+
|
|
13502
|
+
Both resolve against the same translations, so an override reaches each of them.
|
|
13503
|
+
|
|
13395
13504
|
Use `useCurrentTranslation` for the full translation object, including locale and text direction:
|
|
13396
13505
|
|
|
13397
13506
|
```tsx
|
|
@@ -13410,6 +13519,25 @@ function LocaleInfo() {
|
|
|
13410
13519
|
|
|
13411
13520
|
The `TLUiTranslation` object contains a `locale` code (e.g., `'fr'`), a `label` in the native script (e.g., `'Français'`), a `messages` record with all translation strings, and a `dir` indicating text direction (`'ltr'` or `'rtl'`).
|
|
13412
13521
|
|
|
13522
|
+
##### Generated message ids
|
|
13523
|
+
|
|
13524
|
+
The SDK's own messages have hand-written ids, because an app overrides by id and an id has to survive a reworded English string. An app's own messages needn't: if you use [@formatjs/unplugin](https://formatjs.github.io/docs/tooling/bundler-plugins) with an `idInterpolationPattern`, your bundler derives each id from the message's own text, and you can leave it out.
|
|
13525
|
+
|
|
13526
|
+
```tsx
|
|
13527
|
+
import { defineMessages, F } from 'tldraw'
|
|
13528
|
+
|
|
13529
|
+
const messages = defineMessages({
|
|
13530
|
+
// No id: the plugin injects one at build.
|
|
13531
|
+
welcome: { defaultMessage: 'Welcome back' },
|
|
13532
|
+
})
|
|
13533
|
+
|
|
13534
|
+
function Greeting() {
|
|
13535
|
+
return <F {...messages.welcome} />
|
|
13536
|
+
}
|
|
13537
|
+
```
|
|
13538
|
+
|
|
13539
|
+
Where no plugin ran either — a unit test, normally — the English stands in as the id. It matches nothing in any catalogue, so the message renders as that English rather than failing.
|
|
13540
|
+
|
|
13413
13541
|
#### Overriding translations
|
|
13414
13542
|
|
|
13415
13543
|
Pass translation overrides through the `overrides` prop on `Tldraw`:
|
|
@@ -13438,6 +13566,46 @@ function App() {
|
|
|
13438
13566
|
|
|
13439
13567
|
Overrides are merged with the base translations for each language. English is the fallback: any key missing from the target language uses the English string. If you add your own keys (for example a custom tool label), provide at least an `en` override for them.
|
|
13440
13568
|
|
|
13569
|
+
Your strings are ICU messages too, so they can pluralise and take placeholders. A `{` that isn't opening a placeholder has to be escaped as `'{'`, or the message won't parse — a message that fails to parse renders as written rather than disappearing.
|
|
13570
|
+
|
|
13571
|
+
#### Message format
|
|
13572
|
+
|
|
13573
|
+
Messages are [ICU MessageFormat](https://unicode-org.github.io/icu/userguide/format_parse/messages/), so a single message can say the right thing for any number:
|
|
13574
|
+
|
|
13575
|
+
```json
|
|
13576
|
+
{
|
|
13577
|
+
"comments.replies": "{count, plural, one {# reply} other {# replies}}"
|
|
13578
|
+
}
|
|
13579
|
+
```
|
|
13580
|
+
|
|
13581
|
+
```tsx
|
|
13582
|
+
msg('comments.replies', { count: 1 }) // "1 reply"
|
|
13583
|
+
msg('comments.replies', { count: 4 }) // "4 replies"
|
|
13584
|
+
```
|
|
13585
|
+
|
|
13586
|
+
This matters beyond English. A language picks between its own plural categories, which is why one string per number doesn't travel: Arabic has six, Polish four, Russian three. ICU asks the locale which category a number falls into, so the translator writes each form their language needs and the right one is chosen at runtime.
|
|
13587
|
+
|
|
13588
|
+
`select` chooses between fixed options rather than numbers:
|
|
13589
|
+
|
|
13590
|
+
```json
|
|
13591
|
+
{
|
|
13592
|
+
"my.app.greeting": "{gender, select, female {She} male {He} other {They}} shared a file"
|
|
13593
|
+
}
|
|
13594
|
+
```
|
|
13595
|
+
|
|
13596
|
+
Numbers and dates are formatted for the locale as well:
|
|
13597
|
+
|
|
13598
|
+
```json
|
|
13599
|
+
{
|
|
13600
|
+
"my.app.fileCount": "{count, number} files",
|
|
13601
|
+
"my.app.lastEdited": "Edited {when, date, medium}"
|
|
13602
|
+
}
|
|
13603
|
+
```
|
|
13604
|
+
|
|
13605
|
+
> Use `#` inside a plural to print the number being matched. Outside a plural it's a literal `#`.
|
|
13606
|
+
|
|
13607
|
+
A message's `defaultMessage` is its English, and it's formatted as English. The translation from the catalog is what gets the user's locale and its plural categories, so a locale missing a string falls back to readable English rather than to English grammar applied to another language.
|
|
13608
|
+
|
|
13441
13609
|
##### Translation keys
|
|
13442
13610
|
|
|
13443
13611
|
Translation keys follow a hierarchical naming convention. Common prefixes include `action.*` for user actions like copy and paste, `tool.*` for tool names, `menu.*` for menu labels, `style-panel.*` for style panel UI, and `a11y.*` for accessibility announcements.
|
|
@@ -13771,7 +13939,7 @@ When this returns `true`, `Editor#canEditShape` allows the shape to enter edit m
|
|
|
13771
13939
|
|
|
13772
13940
|
#### Locking in the UI
|
|
13773
13941
|
|
|
13774
|
-
In the default tldraw UI, users can lock shapes through the context menu or the keyboard shortcut (`Shift+L`). Right-clicking a locked shape opens the context menu with an unlock option
|
|
13942
|
+
In the default tldraw UI, users can lock shapes through the context menu or the keyboard shortcut (`Shift+L`). Right-clicking a locked shape opens the context menu with an unlock option. Keyboard users can Tab to a locked shape and press `Shift+L`, or use "Toggle locked" in the main menu's Edit submenu. The Edit submenu also has an "Unlock all" action.
|
|
13775
13943
|
|
|
13776
13944
|
#### Related examples
|
|
13777
13945
|
|
|
@@ -13985,7 +14153,7 @@ Configure selection handles and click target areas:
|
|
|
13985
14153
|
| --------------------- | ------- | --------------------------------------------- |
|
|
13986
14154
|
| `handleRadius` | 12 | Radius of selection handles |
|
|
13987
14155
|
| `coarseHandleRadius` | 20 | Handle radius for touch input |
|
|
13988
|
-
| `hitTestMargin` |
|
|
14156
|
+
| `hitTestMargin` | 4.5 | Additional margin around shapes for hit tests |
|
|
13989
14157
|
| `coarseHitTestMargin` | 4 | Hit test margin when using a coarse pointer |
|
|
13990
14158
|
|
|
13991
14159
|
##### Edge scrolling
|
|
@@ -16314,7 +16482,7 @@ editor.selectAdjacentShape('up')
|
|
|
16314
16482
|
editor.selectAdjacentShape('down')
|
|
16315
16483
|
```
|
|
16316
16484
|
|
|
16317
|
-
Cardinal directions score candidate shapes by distance and by how far they sit off the axis of travel, then pick the lowest score. If the selection is inside a group or frame, only siblings in that container are considered. Shapes whose util returns `false` from `ShapeUtil#canTabTo` are skipped. In the default UI, Tab and Shift+Tab move to the next and previous shape, and Cmd/Ctrl+Arrow moves by direction.
|
|
16485
|
+
Cardinal directions score candidate shapes by distance and by how far they sit off the axis of travel, then pick the lowest score. If the selection is inside a group or frame, only siblings in that container are considered. Shapes whose util returns `false` from `ShapeUtil#canTabTo` are skipped. Locked shapes are not, so keyboard users can reach them. In the default UI, Tab and Shift+Tab move to the next and previous shape, and Cmd/Ctrl+Arrow moves by direction.
|
|
16318
16486
|
|
|
16319
16487
|
##### Hierarchical selection
|
|
16320
16488
|
|
|
@@ -16811,6 +16979,8 @@ editor.flipShapes([box1, box2], 'vertical')
|
|
|
16811
16979
|
|
|
16812
16980
|
When flipping groups, the editor includes all children of the group so the whole hierarchy flips together. Shapes can opt out of flipping by returning `false` from `ShapeUtil#canBeLaidOut`; arrows do this when the shape they're bound to isn't part of the flip.
|
|
16813
16981
|
|
|
16982
|
+
The default UI only offers flip for a single selected shape when `ShapeUtil#canFlip` returns `true`, meaning flipping changes the shape itself by mirroring it or toggling its stored flip. `Editor#flipShapes` doesn't check it. It defaults to `false`; the built-in group, image, arrow, line, draw, highlight and geo shapes return `true`. Override it in your shape util if your shape changes when flipped. Shapes that return `false` still move with the rest of a multi-shape flip.
|
|
16983
|
+
|
|
16814
16984
|
##### Rotation
|
|
16815
16985
|
|
|
16816
16986
|
`Editor#rotateShapesBy` rotates shapes by a delta in radians around a common center point. The editor calculates the center of all the shapes' rotated bounds, then rotates each shape around that point and around its own origin: shapes orbit the selection center while also rotating individually. Pass `{ center }` to rotate around a different point.
|
|
@@ -20984,7 +21154,7 @@ The tldraw SDK is a product of a company. See [tldraw.dev](https://tldraw.dev/co
|
|
|
20984
21154
|
|
|
20985
21155
|
### Dependencies
|
|
20986
21156
|
|
|
20987
|
-
{/* This page is generated by `
|
|
21157
|
+
{/* This page is generated by `pnpm license-report --prod`. Do not edit it by hand. */}
|
|
20988
21158
|
|
|
20989
21159
|
The tldraw SDK itself is published under the [tldraw license](https://tldraw.dev/legal/tldraw-license). It also depends on the third-party packages listed below, each under its own license.
|
|
20990
21160
|
|
|
@@ -20992,32 +21162,33 @@ This covers the runtime dependencies that the `@tldraw/*` packages declare direc
|
|
|
20992
21162
|
|
|
20993
21163
|
#### Dependencies
|
|
20994
21164
|
|
|
20995
|
-
| Dependency | Version | License
|
|
20996
|
-
| -------------------------------------------------------------------- | ------- |
|
|
20997
|
-
| [@tiptap/core](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
20998
|
-
| [@tiptap/extension-code](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
20999
|
-
| [@tiptap/extension-highlight](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21000
|
-
| [@tiptap/extension-list](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21001
|
-
| [@tiptap/extension-mention](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21002
|
-
| [@tiptap/extension-typography](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21003
|
-
| [@tiptap/pm](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21004
|
-
| [@tiptap/react](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21005
|
-
| [@tiptap/starter-kit](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21006
|
-
| [@tiptap/suggestion](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT
|
|
21007
|
-
| [classnames](https://github.com/JedWatson/classnames) | 2.5.1 | MIT
|
|
21008
|
-
| [eventemitter3](https://github.com/primus/eventemitter3) | 4.0.7 | MIT
|
|
21009
|
-
| [idb](https://github.com/jakearchibald/idb) | 7.1.1 | ISC
|
|
21010
|
-
| [is-plain-object](https://github.com/jonschlinkert/is-plain-object) | 5.0.0 | MIT
|
|
21011
|
-
| [lodash.isequal](https://github.com/lodash/lodash) | 4.5.0 | MIT
|
|
21012
|
-
| [lodash.isequalwith](https://github.com/lodash/lodash) | 4.4.0 | MIT
|
|
21013
|
-
| [lodash.throttle](https://github.com/lodash/lodash) | 4.1.1 | MIT
|
|
21014
|
-
| [lodash.uniq](https://github.com/lodash/lodash) | 4.5.0 | MIT
|
|
21015
|
-
| [lz-string](https://github.com/pieroxy/lz-string) | 1.5.0 | MIT
|
|
21016
|
-
| [mermaid](https://github.com/mermaid-js/mermaid) | 11.16.1 | MIT
|
|
21017
|
-
| [nanoevents](https://github.com/ai/nanoevents) | 7.0.1 | MIT
|
|
21018
|
-
| [radix-ui](https://github.com/radix-ui/primitives) | 1.4.2 | MIT
|
|
21019
|
-
| [rbush](https://github.com/mourner/rbush) | 3.0.1 | MIT
|
|
21020
|
-
|
|
|
21165
|
+
| Dependency | Version | License | Used by |
|
|
21166
|
+
| -------------------------------------------------------------------- | ------- | ------------ | -------------------------------------------- |
|
|
21167
|
+
| [@tiptap/core](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `commenting`, `editor`, `mentions`, `tldraw` |
|
|
21168
|
+
| [@tiptap/extension-code](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `tldraw` |
|
|
21169
|
+
| [@tiptap/extension-highlight](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `tldraw` |
|
|
21170
|
+
| [@tiptap/extension-list](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `tldraw` |
|
|
21171
|
+
| [@tiptap/extension-mention](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `mentions` |
|
|
21172
|
+
| [@tiptap/extension-typography](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `tldraw` |
|
|
21173
|
+
| [@tiptap/pm](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `commenting`, `editor`, `mentions`, `tldraw` |
|
|
21174
|
+
| [@tiptap/react](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `commenting`, `editor`, `mentions`, `tldraw` |
|
|
21175
|
+
| [@tiptap/starter-kit](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `tldraw` |
|
|
21176
|
+
| [@tiptap/suggestion](https://github.com/ueberdosis/tiptap) | 3.13.0 | MIT | `mentions` |
|
|
21177
|
+
| [classnames](https://github.com/JedWatson/classnames) | 2.5.1 | MIT | `editor`, `tldraw` |
|
|
21178
|
+
| [eventemitter3](https://github.com/primus/eventemitter3) | 4.0.7 | MIT | `editor` |
|
|
21179
|
+
| [idb](https://github.com/jakearchibald/idb) | 7.1.1 | ISC | `editor`, `tldraw` |
|
|
21180
|
+
| [is-plain-object](https://github.com/jonschlinkert/is-plain-object) | 5.0.0 | MIT | `editor` |
|
|
21181
|
+
| [lodash.isequal](https://github.com/lodash/lodash) | 4.5.0 | MIT | `utils` |
|
|
21182
|
+
| [lodash.isequalwith](https://github.com/lodash/lodash) | 4.4.0 | MIT | `utils` |
|
|
21183
|
+
| [lodash.throttle](https://github.com/lodash/lodash) | 4.1.1 | MIT | `utils` |
|
|
21184
|
+
| [lodash.uniq](https://github.com/lodash/lodash) | 4.5.0 | MIT | `utils` |
|
|
21185
|
+
| [lz-string](https://github.com/pieroxy/lz-string) | 1.5.0 | MIT | `tldraw` |
|
|
21186
|
+
| [mermaid](https://github.com/mermaid-js/mermaid) | 11.16.1 | MIT | `mermaid` |
|
|
21187
|
+
| [nanoevents](https://github.com/ai/nanoevents) | 7.0.1 | MIT | `sync`, `sync-core` |
|
|
21188
|
+
| [radix-ui](https://github.com/radix-ui/primitives) | 1.4.2 | MIT | `tldraw` |
|
|
21189
|
+
| [rbush](https://github.com/mourner/rbush) | 3.0.1 | MIT | `editor` |
|
|
21190
|
+
| react-intl | 12.1.4 | BSD-3-Clause | `tldraw` |
|
|
21191
|
+
| [ws](https://github.com/websockets/ws) | 8.21.0 | MIT | `sync`, `sync-core` |
|
|
21021
21192
|
|
|
21022
21193
|
#### Inline code
|
|
21023
21194
|
|