tldraw 3.16.0-canary.1e91d2e19e07 → 3.16.0-canary.1f09406e5b86

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.
Files changed (163) hide show
  1. package/dist-cjs/index.d.ts +91 -8
  2. package/dist-cjs/index.js +5 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/defaultExternalContentHandlers.js +10 -0
  5. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  6. package/dist-cjs/lib/shapes/arrow/arrow-types.js.map +1 -1
  7. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +3 -2
  8. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  9. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +1 -1
  10. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  11. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +4 -4
  12. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
  13. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +8 -2
  14. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
  15. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +4 -4
  16. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
  17. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js +3 -3
  18. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
  19. package/dist-cjs/lib/shapes/text/PlainTextArea.js +3 -2
  20. package/dist-cjs/lib/shapes/text/PlainTextArea.js.map +2 -2
  21. package/dist-cjs/lib/shapes/text/RichTextArea.js +3 -3
  22. package/dist-cjs/lib/shapes/text/RichTextArea.js.map +2 -2
  23. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +3 -1
  24. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  25. package/dist-cjs/lib/ui/components/A11y.js +1 -1
  26. package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
  27. package/dist-cjs/lib/ui/components/LanguageMenu.js +1 -0
  28. package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
  29. package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js +2 -1
  30. package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js.map +2 -2
  31. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -1
  32. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
  33. package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +11 -2
  34. package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +2 -2
  35. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +3 -2
  36. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
  37. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +5 -4
  38. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
  39. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +1 -1
  40. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
  41. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +6 -2
  42. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
  43. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
  44. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
  45. package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js +5 -3
  46. package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js.map +2 -2
  47. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +1 -0
  48. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  49. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +14 -2
  50. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  51. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js +3 -0
  52. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
  53. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +3 -3
  54. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  55. package/dist-cjs/lib/ui/context/actions.js +6 -0
  56. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  57. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +1 -1
  58. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
  59. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  60. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +2 -0
  61. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  62. package/dist-cjs/lib/ui/version.js +3 -3
  63. package/dist-cjs/lib/ui/version.js.map +1 -1
  64. package/dist-esm/index.d.mts +91 -8
  65. package/dist-esm/index.mjs +9 -1
  66. package/dist-esm/index.mjs.map +2 -2
  67. package/dist-esm/lib/defaultExternalContentHandlers.mjs +10 -0
  68. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  69. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +3 -2
  70. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  71. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +1 -1
  72. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  73. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +4 -5
  74. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
  75. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +9 -3
  76. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
  77. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +5 -5
  78. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
  79. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs +3 -4
  80. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
  81. package/dist-esm/lib/shapes/text/PlainTextArea.mjs +4 -3
  82. package/dist-esm/lib/shapes/text/PlainTextArea.mjs.map +2 -2
  83. package/dist-esm/lib/shapes/text/RichTextArea.mjs +3 -4
  84. package/dist-esm/lib/shapes/text/RichTextArea.mjs.map +2 -2
  85. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +3 -1
  86. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  87. package/dist-esm/lib/ui/components/A11y.mjs +1 -2
  88. package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
  89. package/dist-esm/lib/ui/components/LanguageMenu.mjs +1 -0
  90. package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
  91. package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs +2 -1
  92. package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs.map +2 -2
  93. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
  94. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
  95. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +11 -2
  96. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +2 -2
  97. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +3 -2
  98. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
  99. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +5 -4
  100. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
  101. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +1 -1
  102. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
  103. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +6 -2
  104. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  105. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -2
  106. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
  107. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +6 -4
  108. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
  109. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +1 -0
  110. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  111. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +14 -2
  112. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  113. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs +3 -0
  114. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
  115. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +3 -3
  116. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  117. package/dist-esm/lib/ui/context/actions.mjs +6 -0
  118. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  119. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +1 -2
  120. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
  121. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +2 -0
  122. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  123. package/dist-esm/lib/ui/version.mjs +3 -3
  124. package/dist-esm/lib/ui/version.mjs.map +1 -1
  125. package/package.json +3 -3
  126. package/src/index.ts +7 -0
  127. package/src/lib/defaultExternalContentHandlers.ts +14 -0
  128. package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +83 -13
  129. package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +97 -3
  130. package/src/lib/shapes/arrow/arrow-types.ts +3 -5
  131. package/src/lib/shapes/arrow/arrowTargetState.ts +34 -3
  132. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
  133. package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +4 -5
  134. package/src/lib/shapes/frame/components/FrameLabelInput.tsx +10 -3
  135. package/src/lib/shapes/shared/HyperlinkButton.tsx +5 -5
  136. package/src/lib/shapes/shared/useEditablePlainText.ts +3 -4
  137. package/src/lib/shapes/text/PlainTextArea.tsx +4 -3
  138. package/src/lib/shapes/text/RichTextArea.tsx +3 -4
  139. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +6 -2
  140. package/src/lib/ui/components/A11y.tsx +1 -2
  141. package/src/lib/ui/components/LanguageMenu.tsx +1 -0
  142. package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +2 -1
  143. package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +1 -2
  144. package/src/lib/ui/components/StylePanel/StylePanelButtonPicker.tsx +9 -2
  145. package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +4 -3
  146. package/src/lib/ui/components/Toolbar/LinkEditor.tsx +6 -5
  147. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +1 -1
  148. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +9 -2
  149. package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -2
  150. package/src/lib/ui/components/primitives/TldrawUiInput.tsx +6 -3
  151. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +2 -1
  152. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +16 -2
  153. package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +4 -0
  154. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +3 -3
  155. package/src/lib/ui/context/actions.tsx +13 -0
  156. package/src/lib/ui/hooks/useClipboardEvents.ts +1 -2
  157. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +2 -0
  158. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +2 -0
  159. package/src/lib/ui/version.ts +3 -3
  160. package/src/lib/ui.css +24 -1
  161. package/src/test/TestEditor.ts +8 -2
  162. package/src/test/frames.test.ts +15 -0
  163. package/tldraw.css +24 -1
@@ -137,6 +137,7 @@ export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T ext
137
137
  >
138
138
  <Layout>
139
139
  {items.map((item) => {
140
+ const isActive = value.type === 'shared' && value.value === item.value
140
141
  const label =
141
142
  title + ' — ' + msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
142
143
  return (
@@ -145,10 +146,16 @@ export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T ext
145
146
  key={item.value}
146
147
  data-id={item.value}
147
148
  data-testid={`style.${uiType}.${item.value}`}
148
- aria-label={label}
149
+ aria-label={label + (isActive ? ` (${msg('style-panel.selected')})` : '')}
150
+ tooltip={
151
+ <>
152
+ <div>{label}</div>
153
+ {isActive ? <div>({msg('style-panel.selected')})</div> : null}
154
+ </>
155
+ }
149
156
  value={item.value}
150
157
  data-state={value.type === 'shared' && value.value === item.value ? 'on' : 'off'}
151
- data-isactive={value.type === 'shared' && value.value === item.value}
158
+ data-isactive={isActive}
152
159
  title={label}
153
160
  style={
154
161
  style === (DefaultColorStyle as StyleProp<unknown>)
@@ -2,9 +2,9 @@ import { preventDefault, TLShape, TLShapeId, useEditor } from '@tldraw/editor'
2
2
  import { useCallback, useEffect, useRef, useState } from 'react'
3
3
  import { useUiEvents } from '../../context/events'
4
4
  import { useTranslation } from '../../hooks/useTranslation/useTranslation'
5
+ import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
5
6
  import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
6
7
  import { TldrawUiInput } from '../primitives/TldrawUiInput'
7
- import { TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
8
8
 
9
9
  /** @public */
10
10
  export interface AltTextEditorProps {
@@ -70,13 +70,14 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
70
70
  data-testid="media-toolbar.alt-text-input"
71
71
  value={altText}
72
72
  placeholder={msg('tool.media-alt-text-desc')}
73
+ aria-label={msg('tool.media-alt-text-desc')}
73
74
  onValueChange={handleValueChange}
74
75
  onComplete={handleComplete}
75
76
  onCancel={handleAltTextCancel}
76
77
  disabled={isReadonly}
77
78
  />
78
79
  {!isReadonly && (
79
- <TldrawUiToolbarButton
80
+ <TldrawUiButton
80
81
  title={msg('tool.media-alt-text-confirm')}
81
82
  data-testid="tool.media-alt-text-confirm"
82
83
  type="icon"
@@ -84,7 +85,7 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
84
85
  onClick={handleConfirm}
85
86
  >
86
87
  <TldrawUiButtonIcon small icon="check" />
87
- </TldrawUiToolbarButton>
88
+ </TldrawUiButton>
88
89
  )}
89
90
  </>
90
91
  )
@@ -2,9 +2,9 @@ import { preventDefault, TiptapEditor, useEditor } from '@tldraw/editor'
2
2
  import { useEffect, useRef, useState } from 'react'
3
3
  import { useUiEvents } from '../../context/events'
4
4
  import { useTranslation } from '../../hooks/useTranslation/useTranslation'
5
+ import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
5
6
  import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
6
7
  import { TldrawUiInput } from '../primitives/TldrawUiInput'
7
- import { TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
8
8
 
9
9
  /** @public */
10
10
  export interface LinkEditorProps {
@@ -75,8 +75,9 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
75
75
  onComplete={handleLinkComplete}
76
76
  onCancel={handleLinkCancel}
77
77
  placeholder="example.com"
78
+ aria-label="example.com"
78
79
  />
79
- <TldrawUiToolbarButton
80
+ <TldrawUiButton
80
81
  className="tlui-rich-text__toolbar-link-visit"
81
82
  title={msg('tool.rich-text-link-visit')}
82
83
  type="icon"
@@ -85,8 +86,8 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
85
86
  disabled={!value}
86
87
  >
87
88
  <TldrawUiButtonIcon small icon="external-link" />
88
- </TldrawUiToolbarButton>
89
- <TldrawUiToolbarButton
89
+ </TldrawUiButton>
90
+ <TldrawUiButton
90
91
  className="tlui-rich-text__toolbar-link-remove"
91
92
  title={msg('tool.rich-text-link-remove')}
92
93
  data-testid="rich-text.link-remove"
@@ -95,7 +96,7 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
95
96
  onClick={handleRemoveLink}
96
97
  >
97
98
  <TldrawUiButtonIcon small icon="trash" />
98
- </TldrawUiToolbarButton>
99
+ </TldrawUiButton>
99
100
  </>
100
101
  )
101
102
  }
@@ -101,7 +101,7 @@ export function OverflowingToolbar({
101
101
  items: collectItems(child.children),
102
102
  element: child as HTMLElement,
103
103
  })
104
- } else {
104
+ } else if (!child.hasAttribute('data-radix-popper-content-wrapper')) {
105
105
  items.push({ type: 'item', element: child as HTMLElement })
106
106
  }
107
107
  }
@@ -1,8 +1,10 @@
1
1
  import { useEditor, useValue } from '@tldraw/editor'
2
2
  import classNames from 'classnames'
3
3
  import { PORTRAIT_BREAKPOINT } from '../../constants'
4
+ import { useActions } from '../../context/actions'
4
5
  import { useBreakpoint } from '../../context/breakpoints'
5
6
  import { useTranslation } from '../../hooks/useTranslation/useTranslation'
7
+ import { kbdStr } from '../../kbd-utils'
6
8
  import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
7
9
  import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
8
10
  import { TldrawUiTooltip } from '../primitives/TldrawUiTooltip'
@@ -17,6 +19,7 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
17
19
  const editor = useEditor()
18
20
  const breakpoint = useBreakpoint()
19
21
  const msg = useTranslation()
22
+ const actions = useActions()
20
23
 
21
24
  const isToolLocked = useValue('is tool locked', () => editor.getInstanceState().isToolLocked, [
22
25
  editor,
@@ -25,11 +28,15 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
25
28
 
26
29
  if (!activeToolId || !tool.isLockable) return null
27
30
 
31
+ const toggleLockAction = actions['toggle-tool-lock']
32
+ const tooltipContent = toggleLockAction?.kbd
33
+ ? `${msg('action.toggle-tool-lock')} ${kbdStr(toggleLockAction.kbd)}`
34
+ : msg('action.toggle-tool-lock')
35
+
28
36
  return (
29
- <TldrawUiTooltip content={msg('action.toggle-tool-lock')}>
37
+ <TldrawUiTooltip content={tooltipContent}>
30
38
  <TldrawUiButton
31
39
  type="normal"
32
- title={msg('action.toggle-tool-lock')}
33
40
  data-testid="tool-lock"
34
41
  className={classNames('tlui-main-toolbar__lock-button', {
35
42
  'tlui-main-toolbar__lock-button__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
@@ -4,7 +4,6 @@ import {
4
4
  clamp,
5
5
  Editor,
6
6
  react,
7
- stopEventPropagation,
8
7
  useAtom,
9
8
  useEditor,
10
9
  usePassThroughMouseOverEvents,
@@ -170,7 +169,7 @@ export const TldrawUiContextualToolbar = ({
170
169
  data-visible={false}
171
170
  data-testid="contextual-toolbar"
172
171
  className={classNames('tlui-contextual-toolbar', className)}
173
- onPointerDown={stopEventPropagation}
172
+ onPointerDown={editor.markEventAsHandled}
174
173
  >
175
174
  <TldrawUiToolbar
176
175
  orientation="horizontal"
@@ -1,4 +1,4 @@
1
- import { stopEventPropagation, tlenv, tltime, useMaybeEditor } from '@tldraw/editor'
1
+ import { tlenv, tltime, useMaybeEditor } from '@tldraw/editor'
2
2
  import classNames from 'classnames'
3
3
  import * as React from 'react'
4
4
  import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey'
@@ -35,6 +35,7 @@ export interface TLUiInputProps {
35
35
  shouldManuallyMaintainScrollPositionWhenFocused?: boolean
36
36
  value?: string
37
37
  'data-testid'?: string
38
+ 'aria-label'?: string
38
39
  }
39
40
 
40
41
  /** @public @react */
@@ -60,6 +61,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
60
61
  value,
61
62
  'data-testid': dataTestId,
62
63
  disabled,
64
+ 'aria-label': ariaLabel,
63
65
  },
64
66
  ref
65
67
  ) {
@@ -118,7 +120,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
118
120
  // `onChange` with a duplicated text value.
119
121
  if (isComposing.current) return
120
122
  e.currentTarget.blur()
121
- stopEventPropagation(e)
123
+ e.stopPropagation()
122
124
  onComplete?.(e.currentTarget.value)
123
125
  break
124
126
  }
@@ -126,7 +128,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
126
128
  e.currentTarget.value = rInitialValue.current
127
129
  onCancel?.(e.currentTarget.value)
128
130
  e.currentTarget.blur()
129
- stopEventPropagation(e)
131
+ e.stopPropagation()
130
132
  break
131
133
  }
132
134
  }
@@ -198,6 +200,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
198
200
  onCompositionStart={handleCompositionStart}
199
201
  onCompositionEnd={handleCompositionEnd}
200
202
  autoFocus={autoFocus}
203
+ aria-label={ariaLabel}
201
204
  placeholder={placeholder}
202
205
  value={value}
203
206
  data-testid={dataTestId}
@@ -71,6 +71,7 @@ export const TldrawUiToolbarButton = React.forwardRef<HTMLButtonElement, TLUiToo
71
71
  draggable={false}
72
72
  data-isactive={isActive}
73
73
  {...props}
74
+ aria-label={props.title}
74
75
  // The tooltip takes care of this.
75
76
  title={undefined}
76
77
  className={classnames('tlui-button', `tlui-button__${type}`, props.className)}
@@ -127,7 +128,7 @@ export interface TLUiToolbarToggleItemProps extends React.HTMLAttributes<HTMLBut
127
128
  className?: string
128
129
  type: 'icon' | 'tool'
129
130
  value: string
130
- tooltip?: string
131
+ tooltip?: React.ReactNode
131
132
  }
132
133
 
133
134
  /** @public @react */
@@ -171,6 +171,20 @@ function TooltipSingleton() {
171
171
  }
172
172
  }, [cameraState, isOpen, currentTooltip, editor])
173
173
 
174
+ useEffect(() => {
175
+ function handleKeyDown(event: KeyboardEvent) {
176
+ if (event.key === 'Escape' && currentTooltip && isOpen) {
177
+ tooltipManager.hideTooltip(editor, currentTooltip.id)
178
+ event.stopPropagation()
179
+ }
180
+ }
181
+
182
+ document.addEventListener('keydown', handleKeyDown, { capture: true })
183
+ return () => {
184
+ document.removeEventListener('keydown', handleKeyDown, { capture: true })
185
+ }
186
+ }, [editor, currentTooltip, isOpen])
187
+
174
188
  // Update open state and trigger position
175
189
  useEffect(() => {
176
190
  let timer: ReturnType<typeof setTimeout> | null = null
@@ -293,9 +307,9 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
293
307
  }
294
308
 
295
309
  // Fallback to old behavior if no provider
296
- if (!hasProvider) {
310
+ if (!hasProvider || showUiLabels) {
297
311
  return (
298
- <_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent>
312
+ <_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent={!showUiLabels}>
299
313
  <_Tooltip.Trigger asChild ref={ref}>
300
314
  {children}
301
315
  </_Tooltip.Trigger>
@@ -19,6 +19,7 @@ export interface TLUiMenuCheckboxItemProps<
19
19
  kbd?: string
20
20
  title?: string
21
21
  label?: TranslationKey | { [key: string]: TranslationKey }
22
+ lang?: string
22
23
  readonlyOk?: boolean
23
24
  onSelect(source: TLUiEventSource): Promise<void> | void
24
25
  toggle?: boolean
@@ -34,6 +35,7 @@ export function TldrawUiMenuCheckboxItem<
34
35
  id,
35
36
  kbd,
36
37
  label,
38
+ lang,
37
39
  readonlyOk,
38
40
  onSelect,
39
41
  toggle = false,
@@ -55,6 +57,7 @@ export function TldrawUiMenuCheckboxItem<
55
57
  return (
56
58
  <_DropdownMenu.CheckboxItem
57
59
  dir="ltr"
60
+ lang={lang}
58
61
  className="tlui-button tlui-button__menu tlui-button__checkbox"
59
62
  title={labelStr}
60
63
  onSelect={(e) => {
@@ -84,6 +87,7 @@ export function TldrawUiMenuCheckboxItem<
84
87
  key={id}
85
88
  className="tlui-button tlui-button__menu tlui-button__checkbox"
86
89
  dir="ltr"
90
+ lang={lang}
87
91
  title={labelStr}
88
92
  onSelect={(e) => {
89
93
  onSelect(sourceId)
@@ -333,7 +333,7 @@ function useDraggableEvents(
333
333
  type: 'pointer',
334
334
  target: 'canvas',
335
335
  name: 'pointer_down',
336
- ...getPointerInfo(e),
336
+ ...getPointerInfo(editor, e),
337
337
  point: screenSpaceStart,
338
338
  })
339
339
 
@@ -345,7 +345,7 @@ function useDraggableEvents(
345
345
  type: 'pointer',
346
346
  target: 'canvas',
347
347
  name: 'pointer_move',
348
- ...getPointerInfo(e),
348
+ ...getPointerInfo(editor, e),
349
349
  point: screenSpaceStart,
350
350
  })
351
351
 
@@ -365,7 +365,7 @@ function useDraggableEvents(
365
365
  type: 'pointer',
366
366
  target: 'canvas',
367
367
  name: 'pointer_up',
368
- ...getPointerInfo(e),
368
+ ...getPointerInfo(editor, e),
369
369
  })
370
370
  }
371
371
 
@@ -1584,6 +1584,19 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
1584
1584
  onSelect: async (source) => {
1585
1585
  if (!canApplySelectionAction()) return
1586
1586
 
1587
+ const onlySelectedShape = editor.getOnlySelectedShape()
1588
+ if (
1589
+ onlySelectedShape &&
1590
+ (editor.isShapeOfType<TLImageShape>(onlySelectedShape, 'image') ||
1591
+ editor.isShapeOfType<TLVideoShape>(onlySelectedShape, 'video'))
1592
+ ) {
1593
+ const firstToolbarButton = editor
1594
+ .getContainer()
1595
+ .querySelector('.tlui-contextual-toolbar button:first-child') as HTMLElement | null
1596
+ firstToolbarButton?.focus()
1597
+ return
1598
+ }
1599
+
1587
1600
  const firstButton = editor
1588
1601
  .getContainer()
1589
1602
  .querySelector('.tlui-style-panel button') as HTMLElement | null
@@ -8,7 +8,6 @@ import {
8
8
  compact,
9
9
  isDefined,
10
10
  preventDefault,
11
- stopEventPropagation,
12
11
  uniq,
13
12
  useEditor,
14
13
  useMaybeEditor,
@@ -763,7 +762,7 @@ export function useNativeClipboardEvents() {
763
762
 
764
763
  const paste = (e: ClipboardEvent) => {
765
764
  if (disablingMiddleClickPaste) {
766
- stopEventPropagation(e)
765
+ editor.markEventAsHandled(e)
767
766
  return
768
767
  }
769
768
 
@@ -122,6 +122,7 @@ export type TLUiTranslationKey =
122
122
  | 'action.zoom-to-fit'
123
123
  | 'action.zoom-to-selection'
124
124
  | 'assets.files.size-too-big'
125
+ | 'assets.files.maximum-size'
125
126
  | 'assets.files.type-not-allowed'
126
127
  | 'assets.files.upload-failed'
127
128
  | 'assets.files.amount-too-many'
@@ -411,6 +412,7 @@ export type TLUiTranslationKey =
411
412
  | 'style-panel.opacity'
412
413
  | 'style-panel.size'
413
414
  | 'style-panel.spline'
415
+ | 'style-panel.selected'
414
416
  | 'tool-panel.title'
415
417
  | 'tool-panel.more'
416
418
  | 'navigation-zone.title'
@@ -123,6 +123,7 @@ export const DEFAULT_TRANSLATION = {
123
123
  'action.zoom-to-fit': 'Zoom to fit',
124
124
  'action.zoom-to-selection': 'Zoom to selection',
125
125
  'assets.files.size-too-big': 'File size is too big',
126
+ 'assets.files.maximum-size': 'Maximum file size is {size}',
126
127
  'assets.files.type-not-allowed': 'File type is not allowed',
127
128
  'assets.files.upload-failed': 'Upload failed',
128
129
  'assets.files.amount-too-many': 'Too many files',
@@ -414,6 +415,7 @@ export const DEFAULT_TRANSLATION = {
414
415
  'style-panel.opacity': 'Opacity',
415
416
  'style-panel.size': 'Size',
416
417
  'style-panel.spline': 'Spline',
418
+ 'style-panel.selected': 'selected',
417
419
  'tool-panel.title': 'Tools',
418
420
  'tool-panel.more': 'More',
419
421
  'navigation-zone.title': 'Navigation',
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '3.16.0-canary.1e91d2e19e07'
4
+ export const version = '3.16.0-canary.1f09406e5b86'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-09-12T17:16:34.637Z',
8
- patch: '2025-09-12T17:16:34.637Z',
7
+ minor: '2025-09-18T13:28:56.456Z',
8
+ patch: '2025-09-18T13:28:56.456Z',
9
9
  }
package/src/lib/ui.css CHANGED
@@ -168,7 +168,7 @@
168
168
  min-height: 40px;
169
169
  width: 100%;
170
170
  gap: 8px;
171
- margin: -4px 0px;
171
+ margin-top: -4px;
172
172
  }
173
173
 
174
174
  .tlui-button__menu::after {
@@ -494,6 +494,10 @@
494
494
  -webkit-user-select: auto !important;
495
495
  }
496
496
 
497
+ .tlui-input::placeholder {
498
+ color: var(--tl-color-text-3);
499
+ }
500
+
497
501
  .tlui-input__wrapper {
498
502
  width: 100%;
499
503
  height: 44px;
@@ -578,6 +582,12 @@
578
582
  box-shadow: var(--tl-shadow-3);
579
583
  }
580
584
 
585
+ @media (max-height: 600px) {
586
+ .tlui-menu {
587
+ max-height: 70vh;
588
+ }
589
+ }
590
+
581
591
  .tlui-menu::-webkit-scrollbar {
582
592
  display: none;
583
593
  }
@@ -1029,6 +1039,19 @@ tldraw? probably.
1029
1039
  display: none;
1030
1040
  }
1031
1041
 
1042
+ /*
1043
+ * This is used in a couple places, like Align and Vertical Align.
1044
+ * It's because we have a toolbar with a Toggle Group but then an adjacent button
1045
+ * next to it that opens a popup.
1046
+ */
1047
+ .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) {
1048
+ flex-wrap: wrap;
1049
+ }
1050
+
1051
+ .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) .tlui-style-panel__subheading {
1052
+ margin-left: -2px;
1053
+ }
1054
+
1032
1055
  .tlui-style-panel__section__common:not(:only-child) {
1033
1056
  margin-bottom: 7px;
1034
1057
  border-bottom: 1px solid var(--tl-color-divider);
@@ -86,8 +86,14 @@ export class TestEditor extends Editor {
86
86
  elm.tabIndex = 0
87
87
  elm.getBoundingClientRect = () => bounds as DOMRect
88
88
 
89
- const shapeUtilsWithDefaults = [...defaultShapeUtils, ...(options.shapeUtils ?? [])]
90
- const bindingUtilsWithDefaults = [...defaultBindingUtils, ...(options.bindingUtils ?? [])]
89
+ const shapeUtilsWithDefaults = [
90
+ ...defaultShapeUtils.filter((s) => !options.shapeUtils?.some((su) => su.type === s.type)),
91
+ ...(options.shapeUtils ?? []),
92
+ ]
93
+ const bindingUtilsWithDefaults = [
94
+ ...defaultBindingUtils.filter((b) => !options.bindingUtils?.some((bu) => bu.type === b.type)),
95
+ ...(options.bindingUtils ?? []),
96
+ ]
91
97
 
92
98
  super({
93
99
  ...options,
@@ -1680,3 +1680,18 @@ it('drops into the top-most frame, if there is one', () => {
1680
1680
 
1681
1681
  expect(editor.getShape(rect)?.parentId).toBe(editor.getCurrentPageId())
1682
1682
  })
1683
+
1684
+ it('does not get drop children of nested frame if they are occluded from the outer frame', () => {
1685
+ const frame1Id = dragCreateFrame({ down: [100, 100], move: [300, 300], up: [300, 300] })
1686
+ const frame2Id = dragCreateFrame({ down: [150, 150], move: [290, 290], up: [290, 290] })
1687
+
1688
+ const rect1 = createRect({ pos: [280, 160], size: [10, 30] })
1689
+
1690
+ expect(editor.getShape(rect1)?.parentId).toBe(frame2Id)
1691
+ expect(editor.getShape(frame2Id)?.parentId).toBe(frame1Id)
1692
+
1693
+ editor.select(frame2Id)
1694
+ editor.translateSelection(30, 0)
1695
+
1696
+ expect(editor.getShape(rect1)?.parentId).toBe(frame2Id)
1697
+ })
package/tldraw.css CHANGED
@@ -1964,7 +1964,7 @@ it from receiving any pointer events or affecting the cursor. */
1964
1964
  min-height: 40px;
1965
1965
  width: 100%;
1966
1966
  gap: 8px;
1967
- margin: -4px 0px;
1967
+ margin-top: -4px;
1968
1968
  }
1969
1969
 
1970
1970
  .tlui-button__menu::after {
@@ -2290,6 +2290,10 @@ it from receiving any pointer events or affecting the cursor. */
2290
2290
  -webkit-user-select: auto !important;
2291
2291
  }
2292
2292
 
2293
+ .tlui-input::placeholder {
2294
+ color: var(--tl-color-text-3);
2295
+ }
2296
+
2293
2297
  .tlui-input__wrapper {
2294
2298
  width: 100%;
2295
2299
  height: 44px;
@@ -2374,6 +2378,12 @@ it from receiving any pointer events or affecting the cursor. */
2374
2378
  box-shadow: var(--tl-shadow-3);
2375
2379
  }
2376
2380
 
2381
+ @media (max-height: 600px) {
2382
+ .tlui-menu {
2383
+ max-height: 70vh;
2384
+ }
2385
+ }
2386
+
2377
2387
  .tlui-menu::-webkit-scrollbar {
2378
2388
  display: none;
2379
2389
  }
@@ -2825,6 +2835,19 @@ tldraw? probably.
2825
2835
  display: none;
2826
2836
  }
2827
2837
 
2838
+ /*
2839
+ * This is used in a couple places, like Align and Vertical Align.
2840
+ * It's because we have a toolbar with a Toggle Group but then an adjacent button
2841
+ * next to it that opens a popup.
2842
+ */
2843
+ .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) {
2844
+ flex-wrap: wrap;
2845
+ }
2846
+
2847
+ .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) .tlui-style-panel__subheading {
2848
+ margin-left: -2px;
2849
+ }
2850
+
2828
2851
  .tlui-style-panel__section__common:not(:only-child) {
2829
2852
  margin-bottom: 7px;
2830
2853
  border-bottom: 1px solid var(--tl-color-divider);