tldraw 3.16.0-canary.ba3bc37d4418 → 3.16.0-canary.bf7be9dad88b

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 (40) hide show
  1. package/dist-cjs/index.d.ts +1 -0
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +2 -2
  4. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
  5. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +3 -3
  6. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
  7. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +1 -1
  8. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
  9. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +6 -2
  10. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
  11. package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js +3 -1
  12. package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js.map +2 -2
  13. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +7 -6
  14. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  15. package/dist-cjs/lib/ui/version.js +3 -3
  16. package/dist-cjs/lib/ui/version.js.map +1 -1
  17. package/dist-esm/index.d.mts +1 -0
  18. package/dist-esm/index.mjs +1 -1
  19. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +2 -2
  20. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
  21. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +3 -3
  22. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
  23. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +1 -1
  24. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
  25. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +6 -2
  26. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  27. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +3 -1
  28. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
  29. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +7 -6
  30. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  31. package/dist-esm/lib/ui/version.mjs +3 -3
  32. package/dist-esm/lib/ui/version.mjs.map +1 -1
  33. package/package.json +3 -3
  34. package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +3 -3
  35. package/src/lib/ui/components/Toolbar/LinkEditor.tsx +5 -5
  36. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +1 -1
  37. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +9 -2
  38. package/src/lib/ui/components/primitives/TldrawUiInput.tsx +3 -0
  39. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +7 -6
  40. package/src/lib/ui/version.ts +3 -3
@@ -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,
@@ -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
  ) {
@@ -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}
@@ -173,16 +173,17 @@ function TooltipSingleton() {
173
173
 
174
174
  useEffect(() => {
175
175
  function handleKeyDown(event: KeyboardEvent) {
176
- if (event.key === 'Escape' && currentTooltip) {
176
+ if (event.key === 'Escape' && currentTooltip && isOpen) {
177
177
  tooltipManager.hideTooltip(editor, currentTooltip.id)
178
+ event.stopPropagation()
178
179
  }
179
180
  }
180
181
 
181
- document.addEventListener('keydown', handleKeyDown)
182
+ document.addEventListener('keydown', handleKeyDown, { capture: true })
182
183
  return () => {
183
- document.removeEventListener('keydown', handleKeyDown)
184
+ document.removeEventListener('keydown', handleKeyDown, { capture: true })
184
185
  }
185
- }, [editor, currentTooltip])
186
+ }, [editor, currentTooltip, isOpen])
186
187
 
187
188
  // Update open state and trigger position
188
189
  useEffect(() => {
@@ -306,9 +307,9 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
306
307
  }
307
308
 
308
309
  // Fallback to old behavior if no provider
309
- if (!hasProvider) {
310
+ if (!hasProvider || showUiLabels) {
310
311
  return (
311
- <_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent>
312
+ <_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent={!showUiLabels}>
312
313
  <_Tooltip.Trigger asChild ref={ref}>
313
314
  {children}
314
315
  </_Tooltip.Trigger>
@@ -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.ba3bc37d4418'
4
+ export const version = '3.16.0-canary.bf7be9dad88b'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-09-16T14:55:49.384Z',
8
- patch: '2025-09-16T14:55:49.384Z',
7
+ minor: '2025-09-17T15:01:00.589Z',
8
+ patch: '2025-09-17T15:01:00.589Z',
9
9
  }