tldraw 5.6.0 → 5.7.0-canary.2c3156fdd583
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 +29 -23
- package/RELEASE_NOTES.md +66 -3
- package/dist-cjs/index.d.ts +17 -5
- package/dist-cjs/index.js +1 -1
- 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/draw/DrawShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +3 -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 +3 -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/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/Idle.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingCanvas.js +2 -3
- 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 -3
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +1 -3
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/selectHelpers.js +48 -0
- package/dist-cjs/lib/tools/SelectTool/selectHelpers.js.map +2 -2
- package/dist-cjs/lib/ui/components/ColorSchemeMenu.js +2 -2
- package/dist-cjs/lib/ui/components/ColorSchemeMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/InputModeMenu.js +2 -2
- package/dist-cjs/lib/ui/components/InputModeMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +3 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/LanguageMenu.js +2 -2
- package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +2 -2
- package/dist-cjs/lib/ui/components/menu-items.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/context/action-predicates.js +14 -5
- package/dist-cjs/lib/ui/context/action-predicates.js.map +2 -2
- 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 +105 -161
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useActionState.js +3 -44
- package/dist-cjs/lib/ui/hooks/useActionState.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/overrides.js.map +2 -2
- 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-esm/index.d.mts +17 -5
- package/dist-esm/index.mjs +1 -1
- 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/draw/DrawShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +3 -0
- 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 +3 -0
- 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/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/Idle.mjs +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingCanvas.mjs +2 -3
- 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 -3
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +2 -4
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/selectHelpers.mjs +48 -0
- package/dist-esm/lib/tools/SelectTool/selectHelpers.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ColorSchemeMenu.mjs +2 -2
- package/dist-esm/lib/ui/components/ColorSchemeMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/InputModeMenu.mjs +2 -2
- package/dist-esm/lib/ui/components/InputModeMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +3 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/LanguageMenu.mjs +2 -2
- package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +2 -2
- package/dist-esm/lib/ui/components/menu-items.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/context/action-predicates.mjs +14 -5
- package/dist-esm/lib/ui/context/action-predicates.mjs.map +2 -2
- 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 +107 -162
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useActionState.mjs +1 -42
- package/dist-esm/lib/ui/hooks/useActionState.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/overrides.mjs.map +2 -2
- 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/package.json +6 -6
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +4 -0
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +4 -0
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +4 -0
- package/src/lib/shapes/image/ImageShapeUtil.tsx +4 -0
- package/src/lib/shapes/line/LineShapeUtil.tsx +4 -0
- 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/Idle.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/PointingCanvas.ts +2 -8
- 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 -8
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +2 -9
- package/src/lib/tools/SelectTool/selectHelpers.ts +75 -0
- package/src/lib/ui/components/ColorSchemeMenu.tsx +2 -2
- package/src/lib/ui/components/InputModeMenu.tsx +2 -2
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +3 -2
- package/src/lib/ui/components/LanguageMenu.tsx +2 -2
- package/src/lib/ui/components/menu-items.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +4 -2
- package/src/lib/ui/context/action-predicates.ts +26 -7
- package/src/lib/ui/context/action-state.ts +93 -0
- package/src/lib/ui/context/actions.tsx +142 -235
- package/src/lib/ui/hooks/useActionState.ts +2 -64
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +4 -1
- package/src/lib/ui/overrides.ts +4 -0
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/utils/frames/frames.ts +1 -1
- package/src/test/SelectTool.test.ts +0 -60
- package/src/test/cropping.test.ts +41 -66
- package/src/test/deferredDoubleClick.test.ts +231 -0
- package/src/test/frames.test.ts +19 -0
- package/src/test/ui/FrameSelectionMenuItem.test.tsx +11 -2
- package/src/test/ui/actionGate.test.tsx +197 -0
- package/src/test/ui/actionGating.test.tsx +102 -1
- package/src/test/ui/actionPredicates.test.ts +24 -0
- package/src/test/ui/keyboardShortcuts.test.tsx +350 -26
- package/src/test/ui/menuActionItem.test.tsx +37 -0
package/DOCS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tldraw Documentation
|
|
2
2
|
|
|
3
|
-
Version: `5.
|
|
3
|
+
Version: `5.7.0-canary.2c3156fdd583`
|
|
4
4
|
|
|
5
5
|
This file is generated during package publishing from the tldraw docs content for this exact package version.
|
|
6
6
|
|
|
@@ -383,6 +383,7 @@ We ship an experimental `tldraw-migrate` agent skill that helps a coding agent u
|
|
|
383
383
|
|
|
384
384
|
#### v5.x
|
|
385
385
|
|
|
386
|
+
- [v5.6](https://tldraw.dev/releases/v5.6.0) - ICU MessageFormat and react-intl for translations, action-driven menu gating, a ThrottledFunction type in @tldraw/utils, commenting improvements, and fixes across selection, undo/redo, local persistence, sync, and the store
|
|
386
387
|
- [v5.5](https://tldraw.dev/releases/v5.5.0) - Smart typography and matched-pair wrapping in rich text, pasting links onto shapes, a replaceable note attribution badge, TipTap's extension API re-exported from tldraw, and a reliability pass across the SDK
|
|
387
388
|
- [v5.4](https://tldraw.dev/releases/v5.4.0) - A center align operation, a tleditors registry of mounted editors, faster signals and store layers, and a broad reliability pass across the SDK
|
|
388
389
|
- [v5.3](https://tldraw.dev/releases/v5.3.0) - Commenting with anchored threads on the canvas, new collaboration packages, geo shape flipping, crop snapping, and faster viewport culling
|
|
@@ -4482,19 +4483,19 @@ Keyboard shortcuts are bound automatically. The `useKeyboardShortcuts` hook pars
|
|
|
4482
4483
|
|
|
4483
4484
|
The `TLUiActionItem` interface defines what an action contains:
|
|
4484
4485
|
|
|
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
|
|
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 (see [Enabling and checking actions](#enabling-and-checking-actions))
|
|
4495
|
-
| `isEnabled` | Optional `(editor) => boolean`. When it returns `false`, menus disable or hide the action
|
|
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.)
|
|
4486
|
+
| Property | Description |
|
|
4487
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
4488
|
+
| `id` | Unique identifier for the action (e.g., `'duplicate'`, `'zoom-in'`) |
|
|
4489
|
+
| `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)) |
|
|
4490
|
+
| `icon` | Icon name from tldraw's icon set, or a custom React element |
|
|
4491
|
+
| `kbd` | Keyboard shortcut string. Use commas to bind several combinations, e.g. `'cmd+g,ctrl+g'` (see [Keyboard shortcuts](#keyboard-shortcuts)) |
|
|
4492
|
+
| `readonlyOk` | When `true`, the action runs in readonly mode; otherwise it doesn't run, however it's triggered. Defaults to `false` |
|
|
4493
|
+
| `checkbox` | When `true`, renders as a toggle with a checkmark indicator in menus |
|
|
4494
|
+
| `isRequiredA11yAction` | When `true`, the keyboard shortcut works even when shortcuts are normally disabled (e.g., while editing a shape). Used for accessibility actions |
|
|
4495
|
+
| `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)) |
|
|
4496
|
+
| `isEnabled` | Optional `(editor) => boolean`. When it returns `false`, menus disable or hide the action, and the action doesn't run |
|
|
4497
|
+
| `isChecked` | Optional `(editor) => boolean`. For checkbox actions, whether the item shows as checked |
|
|
4498
|
+
| `onSelect` | Handler called when the action is triggered. Receives a `TLUiEventSource` indicating the trigger origin (`'kbd'`, `'menu'`, `'toolbar'`, etc.) |
|
|
4498
4499
|
|
|
4499
4500
|
#### Accessing actions
|
|
4500
4501
|
|
|
@@ -4523,13 +4524,14 @@ The default actions cover most editing operations you'd expect in a canvas appli
|
|
|
4523
4524
|
| Category | Action ids |
|
|
4524
4525
|
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
4525
4526
|
| Editing | `undo`, `redo`, `duplicate`, `delete`, `copy`, `cut`, `paste` |
|
|
4526
|
-
| Grouping | `group`, `ungroup`
|
|
4527
|
+
| Grouping | `group`, `ungroup`, `toggle-group` |
|
|
4528
|
+
| Frames | `frame-selection`, `remove-frame`, `toggle-frame`, `fit-frame-to-content` |
|
|
4527
4529
|
| Arrangement | `bring-to-front`, `bring-forward`, `send-backward`, `send-to-back`, `align-left`, `align-center-horizontal`, `align-right`, `distribute-horizontal`, `distribute-vertical` |
|
|
4528
4530
|
| Export | `export-as-svg`, `export-as-png`, `copy-as-svg`, `copy-as-png` |
|
|
4529
4531
|
| Zoom | `zoom-in`, `zoom-out`, `zoom-to-100`, `zoom-to-fit`, `zoom-to-selection`, `select-zoom-tool` |
|
|
4530
4532
|
| Preferences | `toggle-dark-mode`, `toggle-snap-mode`, `toggle-grid`, `toggle-focus-mode` |
|
|
4531
4533
|
|
|
4532
|
-
The full list is in the [default actions source](https://github.com/tldraw/tldraw/blob/main/packages/tldraw/src/lib/ui/context/actions.tsx).
|
|
4534
|
+
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.
|
|
4533
4535
|
|
|
4534
4536
|
#### Overriding actions
|
|
4535
4537
|
|
|
@@ -4555,7 +4557,9 @@ function App() {
|
|
|
4555
4557
|
}
|
|
4556
4558
|
```
|
|
4557
4559
|
|
|
4558
|
-
The `copy`, `cut`, and `paste` shortcuts are handled by native clipboard events rather than the `kbd` system, so changing their `kbd` has no effect.
|
|
4560
|
+
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.
|
|
4561
|
+
|
|
4562
|
+
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`.
|
|
4559
4563
|
|
|
4560
4564
|
##### Modifying behavior
|
|
4561
4565
|
|
|
@@ -4581,7 +4585,7 @@ You can call the original handler before or after your custom logic, or replace
|
|
|
4581
4585
|
|
|
4582
4586
|
##### Adding custom actions
|
|
4583
4587
|
|
|
4584
|
-
Add new actions by inserting them into the actions record
|
|
4588
|
+
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.
|
|
4585
4589
|
|
|
4586
4590
|
```typescript
|
|
4587
4591
|
const overrides: TLUiOverrides = {
|
|
@@ -4720,7 +4724,7 @@ actions['make-red'] = {
|
|
|
4720
4724
|
}
|
|
4721
4725
|
```
|
|
4722
4726
|
|
|
4723
|
-
|
|
4727
|
+
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`.
|
|
4724
4728
|
|
|
4725
4729
|
When you change a built-in action, spread the original so it keeps its `isAvailable`, `isEnabled` and `isChecked`:
|
|
4726
4730
|
|
|
@@ -4728,7 +4732,7 @@ When you change a built-in action, spread the original so it keeps its `isAvaila
|
|
|
4728
4732
|
actions['group'] = { ...actions['group'], onSelect: myGroup }
|
|
4729
4733
|
```
|
|
4730
4734
|
|
|
4731
|
-
Replacing an action with a new object drops them
|
|
4735
|
+
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.
|
|
4732
4736
|
|
|
4733
4737
|
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.
|
|
4734
4738
|
|
|
@@ -10947,7 +10951,7 @@ editor.createShape({
|
|
|
10947
10951
|
|
|
10948
10952
|
#### Creating frames
|
|
10949
10953
|
|
|
10950
|
-
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
|
|
10954
|
+
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.
|
|
10951
10955
|
|
|
10952
10956
|
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.
|
|
10953
10957
|
|
|
@@ -11030,7 +11034,7 @@ import { removeFrame } from 'tldraw'
|
|
|
11030
11034
|
removeFrame(editor, [frameId])
|
|
11031
11035
|
```
|
|
11032
11036
|
|
|
11033
|
-
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. **
|
|
11037
|
+
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`.
|
|
11034
11038
|
|
|
11035
11039
|
#### Exporting frames
|
|
11036
11040
|
|
|
@@ -11934,7 +11938,7 @@ editor.groupShapes([shapeId1, shapeId2], {
|
|
|
11934
11938
|
})
|
|
11935
11939
|
```
|
|
11936
11940
|
|
|
11937
|
-
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)
|
|
11941
|
+
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.
|
|
11938
11942
|
|
|
11939
11943
|
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.
|
|
11940
11944
|
|
|
@@ -16976,6 +16980,8 @@ editor.flipShapes([box1, box2], 'vertical')
|
|
|
16976
16980
|
|
|
16977
16981
|
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.
|
|
16978
16982
|
|
|
16983
|
+
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.
|
|
16984
|
+
|
|
16979
16985
|
##### Rotation
|
|
16980
16986
|
|
|
16981
16987
|
`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.
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,39 +1,79 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
-
Version: `5.
|
|
3
|
+
Version: `5.7.0-canary.2c3156fdd583`
|
|
4
4
|
|
|
5
5
|
This file is generated during package publishing from the tldraw release notes content for this exact package version.
|
|
6
6
|
|
|
7
7
|
## v5.6.0
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.6.0)
|
|
10
|
+
|
|
11
|
+
This release introduces ICU MessageFormat and react-intl for translations, action-driven menu gating, and a `ThrottledFunction` type in `@tldraw/utils`. It also improves commenting, canvas navigation, and the select tool, and includes a broad set of bug fixes across selection, undo/redo, local persistence, sync, and the store.
|
|
12
|
+
|
|
13
|
+
### What's new
|
|
14
|
+
|
|
15
|
+
#### ICU MessageFormat and react-intl for translations ([#8036](https://github.com/tldraw/tldraw/pull/8036))
|
|
16
|
+
|
|
17
|
+
The SDK's UI strings now use [ICU MessageFormat](https://unicode-org.github.io/icu/userguide/format_parse/messages/), allowing messages to support pluralization, selections, and values interpolation cleanly across languages. We've also added react-intl authoring on top: `defineMessages` and `<F>` declare and render messages with their default English next to the code that uses them.
|
|
18
|
+
|
|
19
|
+
Existing translations overridden by ID through `overrides.translations` continue to work unchanged.
|
|
10
20
|
|
|
11
21
|
### API changes
|
|
12
22
|
|
|
13
|
-
- Add
|
|
23
|
+
- Add ICU MessageFormat translation support with `defineMessages`, `<F>`, and `useTldrawI18n`. `useTranslation`'s `msg` now supports interpolating values through an optional second argument and accepts declared message descriptors. ([#8036](https://github.com/tldraw/tldraw/pull/8036))
|
|
14
24
|
- Add `isAvailable(editor)`, `isEnabled(editor)` and `isChecked(editor)` to actions. Menu items built with `TldrawUiMenuActionItem` and `TldrawUiMenuActionCheckboxItem` read them: an unavailable action is hidden, a disabled one is greyed out or hidden depending on `whenDisabled: 'hide' | 'disable'`. `useSomeActionsEnabled` returns whether any of the given actions is available and enabled, so a submenu can hide when none of its items can run. If you replace a built-in action with a new object instead of spreading it, it loses its gating, and a toggle's checkbox always shows as unchecked. ([#11038](https://github.com/tldraw/tldraw/pull/11038))
|
|
15
25
|
- `TldrawUiMenuActionItem` now disables itself when its action's `isEnabled` returns false, so custom menus that render built-in actions grey them out when they can't run. The public menu item wrappers, such as `GroupMenuItem`, `FrameSelectionMenuItem` and `ArrangeMenuSubmenu`, now also hide outside the select tool, where their actions do nothing. ([#11038](https://github.com/tldraw/tldraw/pull/11038))
|
|
26
|
+
- Add a `ThrottledFunction<T>` type to `@tldraw/utils` for annotating the result of `throttle`. `throttle` now returns this type, with the same runtime behavior. ([#10927](https://github.com/tldraw/tldraw/pull/10927))
|
|
27
|
+
- Add `startCommentAt(editor, point)` to `@tldraw/commenting` for starting a comment thread at a specific canvas location from outside the comment tool. ([#10970](https://github.com/tldraw/tldraw/pull/10970))
|
|
28
|
+
- `TLSocketRoom.handleSocketMessage(sessionId, message, socket?)`, `handleSocketClose(sessionId, socket?)`, and `handleSocketError(sessionId, socket?)` now accept an optional originating socket parameter so messages and events from superseded connections are ignored. ([#11067](https://github.com/tldraw/tldraw/pull/11067))
|
|
29
|
+
- Add `LaserTool.startScribble()` which adds a laser scribble to the current session, starting a fresh session if none is active. ([#10781](https://github.com/tldraw/tldraw/pull/10781))
|
|
16
30
|
|
|
17
31
|
### Improvements
|
|
18
32
|
|
|
19
33
|
- Menus no longer offer actions that would do nothing: grouping locked shapes, flipping a locked shape, unlocking when nothing is locked, exporting all shapes on an empty page, moving to a new page at the page limit, and grouping an arrow away from a shape it's bound to. The main menu hides Paste, instead of disabling it, in browsers that can't read the clipboard. ([#11038](https://github.com/tldraw/tldraw/pull/11038))
|
|
34
|
+
- Allow keyboard navigation (Tab, Ctrl/Cmd+arrow, and the "Move focus to canvas" button) to reach locked shapes again, so keyboard users can select and unlock them. ([#11134](https://github.com/tldraw/tldraw/pull/11134))
|
|
35
|
+
- Add a **Comment** item to the default canvas context menu when commenting is configured. It opens the comment composer where you right-clicked. ([#11095](https://github.com/tldraw/tldraw/pull/11095))
|
|
36
|
+
- Move the comments filter menu to the right of the hide comments toggle in the comments panel header. ([#11135](https://github.com/tldraw/tldraw/pull/11135))
|
|
37
|
+
- Cancel comment draft placement and return to the select tool when clicking the canvas, instead of moving the draft comment. ([#10969](https://github.com/tldraw/tldraw/pull/10969))
|
|
20
38
|
- Draw the hinted outline around shapes, such as a frame you're dragging a shape into, at 2px instead of 2.5px. ([#10952](https://github.com/tldraw/tldraw/pull/10952))
|
|
21
39
|
- Speed up `store.query.index()` and `store.query.ids()` updates by no longer allocating for each change. ([#10228](https://github.com/tldraw/tldraw/pull/10228))
|
|
22
40
|
|
|
23
41
|
### Bug fixes
|
|
24
42
|
|
|
25
43
|
- Fix the edge scrolling preference showing as off when edge scrolling is on at a speed other than 1, such as 0.5 or 2. ([#11038](https://github.com/tldraw/tldraw/pull/11038))
|
|
44
|
+
- Fix edge scrolling jumping to partial speed after its start delay. ([#11126](https://github.com/tldraw/tldraw/pull/11126))
|
|
26
45
|
- Fix three resize issues: flipping a rotated selection gave its children the wrong rotation, shapes not aligned with the selection received `onResizeStart` and `onResizeEnd` more than once, and `resizeBox` slid the fixed edge when a shape hit its `maxWidth` or `maxHeight`. ([#10351](https://github.com/tldraw/tldraw/pull/10351))
|
|
27
46
|
- Fix duplicating a page moving its shapes when they were off screen, and starting the new page with the current page's camera instead of the duplicated page's. ([#10465](https://github.com/tldraw/tldraw/pull/10465))
|
|
47
|
+
- Fix the page menu closing and getting stuck mid-drag when Escape is pressed while reordering pages. ([#11115](https://github.com/tldraw/tldraw/pull/11115))
|
|
48
|
+
- Fix an empty line under a heading in a text shape that could not be deleted. ([#11114](https://github.com/tldraw/tldraw/pull/11114))
|
|
49
|
+
- Fix the "rhombus-2" (rhombus left) geo tool showing a raw translation key as its label. ([#11062](https://github.com/tldraw/tldraw/pull/11062))
|
|
50
|
+
- Fix the keyboard shortcuts dialog opening via keyboard shortcut when `KeyboardShortcutsDialog` is overridden with `null`. ([#11019](https://github.com/tldraw/tldraw/pull/11019))
|
|
51
|
+
- Fix the rich text toolbar reporting the wrong operation in `onUiEvent` for italic, code, and highlight. ([#11018](https://github.com/tldraw/tldraw/pull/11018))
|
|
52
|
+
- Fix undo after double-clicking a frame's corner or edge to fit it to content creating an inconsistent history step. ([#11075](https://github.com/tldraw/tldraw/pull/11075))
|
|
53
|
+
- Fix undo reverting an earlier edit after brushing to select, right-clicking an empty canvas to deselect, pressing Enter on a group, or navigating the selection with the keyboard. ([#10476](https://github.com/tldraw/tldraw/pull/10476))
|
|
54
|
+
- Fix clicking a child of a locked group selecting the locked group. ([#10180](https://github.com/tldraw/tldraw/pull/10180))
|
|
55
|
+
- Fix bookmarks, notes, and other non-resizing shapes being mispositioned when their containing group is resized or flipped. ([#10619](https://github.com/tldraw/tldraw/pull/10619))
|
|
56
|
+
- Fix bounds snapping not engaging while resizing or cropping shapes inside slightly rotated frames or groups. ([#10181](https://github.com/tldraw/tldraw/pull/10181))
|
|
28
57
|
- Fix the arrow tool's precise mode carrying over when you move to a different target shape. ([#10244](https://github.com/tldraw/tldraw/pull/10244))
|
|
29
58
|
- Fix holding Cmd/Ctrl+Shift+Arrow switching from selecting a parent or child to selecting the adjacent shape once the key starts repeating. ([#10184](https://github.com/tldraw/tldraw/pull/10184))
|
|
59
|
+
- Fix arrow-key nudging moving diagonally after using a Cmd+Arrow shortcut on macOS. ([#10892](https://github.com/tldraw/tldraw/pull/10892))
|
|
60
|
+
- Fix the eraser sometimes dropping a highlighted shape when dragging near a group. ([#10182](https://github.com/tldraw/tldraw/pull/10182))
|
|
30
61
|
- Fix `editor.setCursor` throwing for the rotate and resize cursor types, and hex cursor colors breaking SVG cursors. ([#10350](https://github.com/tldraw/tldraw/pull/10350))
|
|
62
|
+
- Fix `editor.animateShapes` throwing a `TypeError` when interpolating draw or highlight shapes to or from empty segments. ([#10771](https://github.com/tldraw/tldraw/pull/10771))
|
|
63
|
+
- Fix the laser tool crashing when its scribble session times out mid-stroke. ([#10781](https://github.com/tldraw/tldraw/pull/10781))
|
|
64
|
+
- Fix scribbles added without points disappearing after one idle frame before points could be added on pointer move. ([#10336](https://github.com/tldraw/tldraw/pull/10336))
|
|
65
|
+
- Fix hit testing and viewport culling using stale bounds when text fonts finish loading after measurement, and fix container descendants retaining stale current-page membership when reparented to another page. ([#10341](https://github.com/tldraw/tldraw/pull/10341))
|
|
31
66
|
- Fix edits being lost when an editor remounts with the same `persistenceKey` while the previous one is still saving. ([#10752](https://github.com/tldraw/tldraw/pull/10752))
|
|
67
|
+
- Fix the comment composer requiring a second tap before focusing and raising the software keyboard on iOS. ([#9957](https://github.com/tldraw/tldraw/pull/9957))
|
|
32
68
|
- Fix store changes made in the last frame before a listener is removed never reaching that listener. ([#10802](https://github.com/tldraw/tldraw/pull/10802))
|
|
33
69
|
- Fix a reaction that writes to the store re-running on every unrelated store change. ([#10236](https://github.com/tldraw/tldraw/pull/10236))
|
|
34
70
|
- Fix undo restoring an in-between state after a single `put` updated the same record twice. ([#10203](https://github.com/tldraw/tldraw/pull/10203))
|
|
71
|
+
- Fix store listeners and `extractingChanges` receiving changes from transactions that rolled back. ([#10205](https://github.com/tldraw/tldraw/pull/10205))
|
|
72
|
+
- Fix computed caches in `store.query` not re-running their derive functions when a previously removed record is recreated with the same ID. ([#10225](https://github.com/tldraw/tldraw/pull/10225))
|
|
35
73
|
- Fix `migrateStoreSnapshot` throwing on a malformed persisted schema instead of returning a migration error. ([#10220](https://github.com/tldraw/tldraw/pull/10220))
|
|
36
74
|
- Fix migrations rerunning on records when a persisted schema's sequence version isn't a number. ([#10917](https://github.com/tldraw/tldraw/pull/10917))
|
|
75
|
+
- Fix a record deleted while offline occasionally reappearing after reconnecting. ([#10997](https://github.com/tldraw/tldraw/pull/10997))
|
|
76
|
+
- Fix large chunked sync messages being dropped and active sessions being cancelled by a previous socket's late close or error when reconnecting with the same session ID. ([#11067](https://github.com/tldraw/tldraw/pull/11067))
|
|
37
77
|
- Fix a resumed sync session on a hibernating host skipping the version checks made on first connect, so after a server redeploy a client could be sent changes its schema couldn't handle. It's now rejected with `SERVER_TOO_OLD` or `CLIENT_TOO_OLD`, as on connect. ([#10122](https://github.com/tldraw/tldraw/pull/10122))
|
|
38
78
|
- Fix a record field set to `undefined` getting the sync session kicked with `INVALID_RECORD`, and ignore `__proto__` keys in incoming changes. ([#10118](https://github.com/tldraw/tldraw/pull/10118))
|
|
39
79
|
- Fix older sync clients (protocol version 7) silently falling out of sync when the server sent them text-append changes they don't support. ([#10095](https://github.com/tldraw/tldraw/pull/10095))
|
|
@@ -219,6 +259,29 @@ import { Mark, mergeAttributes } from 'tldraw'
|
|
|
219
259
|
|
|
220
260
|
- Fix `create-tldraw --no-telemetry` being ignored. ([#10789](https://github.com/tldraw/tldraw/pull/10789))
|
|
221
261
|
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### Patch releases
|
|
265
|
+
|
|
266
|
+
#### v5.5.1
|
|
267
|
+
|
|
268
|
+
- Fix shape hover and selection feeling offset below shapes, caused by the default cursor's hotspot sitting above its visible tip. ([#11033](https://github.com/tldraw/tldraw/pull/11033))
|
|
269
|
+
|
|
270
|
+
[View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.5.1)
|
|
271
|
+
|
|
272
|
+
#### v5.5.2
|
|
273
|
+
|
|
274
|
+
- Fix license domain validation for pages loaded from `blob:` URLs. ([#11040](https://github.com/tldraw/tldraw/pull/11040))
|
|
275
|
+
|
|
276
|
+
[View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.5.2)
|
|
277
|
+
|
|
278
|
+
#### v5.5.4
|
|
279
|
+
|
|
280
|
+
- Increase the default hit test margin from 3 to 4.5, making shape edges easier to hover and select. ([#11108](https://github.com/tldraw/tldraw/pull/11108))
|
|
281
|
+
- Add a tracked license flag that always sends the tracking ping. ([#11178](https://github.com/tldraw/tldraw/pull/11178))
|
|
282
|
+
|
|
283
|
+
[View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.5.4)
|
|
284
|
+
|
|
222
285
|
## v5.4.0
|
|
223
286
|
|
|
224
287
|
[View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.4.0)
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -432,6 +432,7 @@ export declare class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
|
|
432
432
|
} & Partial<Omit<TLArrowShape, "id" | "meta" | "props" | "type">>) | undefined;
|
|
433
433
|
onTranslate(initialShape: TLArrowShape, shape: TLArrowShape): void;
|
|
434
434
|
private readonly _resizeInitialBindings;
|
|
435
|
+
canFlip(): boolean;
|
|
435
436
|
onResize(shape: TLArrowShape, info: TLResizeInfo<TLArrowShape>): {
|
|
436
437
|
props: {
|
|
437
438
|
bend: number;
|
|
@@ -1685,6 +1686,7 @@ export declare class DrawShapeUtil extends ShapeUtil<TLDrawShape> {
|
|
|
1685
1686
|
getIndicatorPath(shape: TLDrawShape): Path2D;
|
|
1686
1687
|
toSvg(shape: TLDrawShape, ctx: SvgExportContext): JSX.Element;
|
|
1687
1688
|
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[];
|
|
1689
|
+
canFlip(): boolean;
|
|
1688
1690
|
onResize(shape: TLDrawShape, info: TLResizeInfo<TLDrawShape>): {
|
|
1689
1691
|
props: {
|
|
1690
1692
|
scaleX: number;
|
|
@@ -2304,6 +2306,7 @@ export declare class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
|
|
|
2304
2306
|
getIndicatorPath(shape: TLGeoShape): Path2D | undefined;
|
|
2305
2307
|
toSvg(shape: TLGeoShape, ctx: SvgExportContext): JSX.Element;
|
|
2306
2308
|
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[];
|
|
2309
|
+
canFlip(): boolean;
|
|
2307
2310
|
onResize(shape: TLGeoShape, { handle, newPoint, scaleX, scaleY, initialShape }: TLResizeInfo<TLGeoShape>): {
|
|
2308
2311
|
props: {
|
|
2309
2312
|
flipX: boolean;
|
|
@@ -2779,6 +2782,7 @@ export declare class HighlightShapeUtil extends ShapeUtil<TLHighlightShape> {
|
|
|
2779
2782
|
getIndicatorPath(shape: TLHighlightShape): Path2D;
|
|
2780
2783
|
toSvg(shape: TLHighlightShape, ctx: SvgExportContext): JSX.Element;
|
|
2781
2784
|
toBackgroundSvg(shape: TLHighlightShape, ctx: SvgExportContext): JSX.Element;
|
|
2785
|
+
canFlip(): boolean;
|
|
2782
2786
|
onResize(shape: TLHighlightShape, info: TLResizeInfo<TLHighlightShape>): {
|
|
2783
2787
|
props: {
|
|
2784
2788
|
scaleX: number;
|
|
@@ -2844,6 +2848,7 @@ export declare class ImageShapeUtil extends BaseBoxShapeUtil<TLImageShape> {
|
|
|
2844
2848
|
createShapeForAsset(asset: TLAsset, position: VecModel): null | TLShapePartial;
|
|
2845
2849
|
getGeometry(shape: TLImageShape): Geometry2d;
|
|
2846
2850
|
getAriaDescriptor(shape: TLImageShape): string;
|
|
2851
|
+
canFlip(): boolean;
|
|
2847
2852
|
onResize(shape: TLImageShape, info: TLResizeInfo<TLImageShape>): TLImageShape;
|
|
2848
2853
|
component(shape: TLImageShape): JSX.Element;
|
|
2849
2854
|
getIndicatorPath(shape: TLImageShape): Path2D | undefined;
|
|
@@ -2923,6 +2928,7 @@ export declare class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
2923
2928
|
getDefaultProps(): TLLineShape['props'];
|
|
2924
2929
|
getGeometry(shape: TLLineShape): PathBuilderGeometry2d;
|
|
2925
2930
|
getHandles(shape: TLLineShape): TLHandle[];
|
|
2931
|
+
canFlip(): boolean;
|
|
2926
2932
|
onResize(shape: TLLineShape, info: TLResizeInfo<TLLineShape>): {
|
|
2927
2933
|
props: {
|
|
2928
2934
|
points: {
|
|
@@ -4932,19 +4938,21 @@ export declare interface TLUiActionItem<TransationKey extends string = string, I
|
|
|
4932
4938
|
label?: {
|
|
4933
4939
|
[key: string]: TransationKey;
|
|
4934
4940
|
} | TransationKey;
|
|
4941
|
+
/** When `true`, the action runs while the editor is readonly. Defaults to `false`. */
|
|
4935
4942
|
readonlyOk?: boolean;
|
|
4936
4943
|
checkbox?: boolean;
|
|
4937
4944
|
isRequiredA11yAction?: boolean;
|
|
4938
4945
|
/**
|
|
4939
4946
|
* Whether the action exists in the current context at all, e.g. clipboard support or debug
|
|
4940
|
-
* mode.
|
|
4941
|
-
*
|
|
4947
|
+
* mode. When false, menus hide the item (the keyboard shortcuts dialog still lists it) and the
|
|
4948
|
+
* action doesn't run from a menu, a shortcut or `useActions()`. Must be pure and read only
|
|
4949
|
+
* editor state.
|
|
4942
4950
|
*/
|
|
4943
4951
|
isAvailable?(editor: Editor): boolean;
|
|
4944
4952
|
/**
|
|
4945
|
-
* Whether the action can run now.
|
|
4946
|
-
*
|
|
4947
|
-
* that state changes, so anything else it reads goes stale.
|
|
4953
|
+
* Whether the action can run now. When false, menus disable or hide the item and the action
|
|
4954
|
+
* doesn't run from a menu, a shortcut or `useActions()`. Must be pure and read only editor
|
|
4955
|
+
* state: menus re-run it when that state changes, so anything else it reads goes stale.
|
|
4948
4956
|
*/
|
|
4949
4957
|
isEnabled?(editor: Editor): boolean;
|
|
4950
4958
|
/** For checkbox actions: whether the item shows as checked. Must be pure and read only editor state. */
|
|
@@ -5635,6 +5643,10 @@ export declare type TLUiOverrideHelpers = ReturnType<typeof useDefaultHelpers>;
|
|
|
5635
5643
|
|
|
5636
5644
|
/** @public */
|
|
5637
5645
|
export declare interface TLUiOverrides {
|
|
5646
|
+
/**
|
|
5647
|
+
* The `actions` passed in aren't gated yet: calling one's `onSelect` here skips the readonly
|
|
5648
|
+
* check, `isAvailable` and `isEnabled`.
|
|
5649
|
+
*/
|
|
5638
5650
|
actions?(editor: Editor, actions: TLUiActionsContextType, helpers: TLUiOverrideHelpers): TLUiActionsContextType;
|
|
5639
5651
|
tools?(editor: Editor, tools: TLUiToolsContextType, helpers: TLUiOverrideHelpers): TLUiToolsContextType;
|
|
5640
5652
|
translations?: TLUiTranslationProviderProps['overrides'];
|
package/dist-cjs/index.js
CHANGED
|
@@ -671,7 +671,7 @@ var import_buildFromV1Document = require("./lib/utils/tldr/buildFromV1Document")
|
|
|
671
671
|
var import_file = require("./lib/utils/tldr/file");
|
|
672
672
|
(0, import_editor.registerTldrawLibraryVersion)(
|
|
673
673
|
"tldraw",
|
|
674
|
-
"5.
|
|
674
|
+
"5.7.0-canary.2c3156fdd583",
|
|
675
675
|
"cjs"
|
|
676
676
|
);
|
|
677
677
|
//# sourceMappingURL=index.js.map
|
|
@@ -512,6 +512,9 @@ class ArrowShapeUtil extends import_editor.ShapeUtil {
|
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
_resizeInitialBindings = new import_editor.WeakCache();
|
|
515
|
+
canFlip() {
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
515
518
|
onResize(shape, info) {
|
|
516
519
|
const { scaleX, scaleY } = info;
|
|
517
520
|
const bindings = this._resizeInitialBindings.get(
|