tldraw 3.16.0-canary.6c77a180e58d → 3.16.0-canary.783c93150be6

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 (39) hide show
  1. package/dist-cjs/index.js +1 -1
  2. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +2 -1
  3. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  4. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +1 -0
  5. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
  6. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +2 -1
  7. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  8. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +7 -1
  9. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  10. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +5 -5
  11. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +1 -1
  12. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +2 -2
  13. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +1 -1
  14. package/dist-cjs/lib/ui/version.js +3 -3
  15. package/dist-cjs/lib/ui/version.js.map +1 -1
  16. package/dist-esm/index.mjs +1 -1
  17. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +2 -1
  18. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  19. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +1 -0
  20. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
  21. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +2 -1
  22. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  23. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +7 -1
  24. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  25. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +5 -5
  26. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +1 -1
  27. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +2 -2
  28. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +1 -1
  29. package/dist-esm/lib/ui/version.mjs +3 -3
  30. package/dist-esm/lib/ui/version.mjs.map +1 -1
  31. package/package.json +3 -3
  32. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +41 -0
  33. package/src/lib/shapes/frame/FrameShapeUtil.tsx +1 -0
  34. package/src/lib/shapes/geo/GeoShapeUtil.tsx +1 -0
  35. package/src/lib/shapes/note/NoteShapeUtil.tsx +1 -0
  36. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +8 -2
  37. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +6 -6
  38. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +2 -2
  39. package/src/lib/ui/version.ts +3 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tldraw",
3
3
  "description": "A tiny little drawing editor.",
4
- "version": "3.16.0-canary.6c77a180e58d",
4
+ "version": "3.16.0-canary.783c93150be6",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -55,8 +55,8 @@
55
55
  "@tiptap/pm": "^2.9.1",
56
56
  "@tiptap/react": "^2.9.1",
57
57
  "@tiptap/starter-kit": "^2.9.1",
58
- "@tldraw/editor": "3.16.0-canary.6c77a180e58d",
59
- "@tldraw/store": "3.16.0-canary.6c77a180e58d",
58
+ "@tldraw/editor": "3.16.0-canary.783c93150be6",
59
+ "@tldraw/store": "3.16.0-canary.783c93150be6",
60
60
  "classnames": "^2.5.1",
61
61
  "hotkeys-js": "^3.13.9",
62
62
  "idb": "^7.1.1",
@@ -579,3 +579,44 @@ describe("an arrow's parents", () => {
579
579
  })
580
580
  })
581
581
  })
582
+
583
+ describe('Arrow export bounds', () => {
584
+ it('excludes labels from shape bounds for export', () => {
585
+ editor.selectAll().deleteShapes(editor.getSelectedShapeIds())
586
+
587
+ // Create shapes for the arrow to bind to
588
+ editor.createShapes([
589
+ { id: ids.box1, type: 'geo', x: 100, y: 100, props: { w: 100, h: 100 } },
590
+ { id: ids.box2, type: 'geo', x: 300, y: 100, props: { w: 100, h: 100 } },
591
+ ])
592
+
593
+ // Create an arrow with a label
594
+ editor.createShapes([
595
+ {
596
+ id: ids.arrow1,
597
+ type: 'arrow',
598
+ x: 0,
599
+ y: 0,
600
+ props: {
601
+ start: { x: 0, y: 0 },
602
+ end: { x: 0, y: 100 },
603
+ richText: toRichText('Test Label'),
604
+ },
605
+ },
606
+ ])
607
+
608
+ // Get the page bounds (should exclude labels due to excludeFromShapeBounds flag)
609
+ const pageBounds = editor.getShapePageBounds(ids.arrow1)
610
+ expect(pageBounds).toBeDefined()
611
+
612
+ // The bounds should be smaller than if labels were included
613
+ // Since the arrow has a label that's excluded, the bounds should be minimal
614
+ expect(pageBounds!.width).toBeLessThan(200) // Should not include label width
615
+ expect(pageBounds!.height).toBeLessThan(200) // Should not include label height
616
+
617
+ // Verify that the arrow has a label (which should be excluded from shape bounds)
618
+ const arrow = editor.getShape(ids.arrow1) as TLArrowShape
619
+ expect(arrow.props.richText).toBeDefined()
620
+ expect(arrow.props.richText).not.toBeNull()
621
+ })
622
+ })
@@ -196,6 +196,7 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
196
196
  height,
197
197
  isFilled: true,
198
198
  isLabel: true,
199
+ excludeFromShapeBounds: true,
199
200
  }),
200
201
  ],
201
202
  })
@@ -126,6 +126,7 @@ export class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
126
126
  height: unscaledLabelHeight * shape.props.scale,
127
127
  isFilled: true,
128
128
  isLabel: true,
129
+ excludeFromShapeBounds: true,
129
130
  isEmptyLabel: isEmptyRichText(shape.props.richText),
130
131
  }),
131
132
  ],
@@ -147,6 +147,7 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
147
147
  height: lh,
148
148
  isFilled: true,
149
149
  isLabel: true,
150
+ excludeFromShapeBounds: true,
150
151
  }),
151
152
  ],
152
153
  })
@@ -241,6 +241,7 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
241
241
  const editor = useMaybeEditor()
242
242
  const tooltipId = useRef<string>(uniqueId())
243
243
  const hasProvider = useContext(TooltipSingletonContext)
244
+ const showUiLabels = useValue('showUiLabels', () => editor?.user.getShowUiLabels(), [editor])
244
245
 
245
246
  const orientationCtx = useTldrawUiOrientation()
246
247
  const sideToUse = side ?? orientationCtx.tooltipSide
@@ -259,8 +260,13 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
259
260
  return <>{children}</>
260
261
  }
261
262
 
262
- const delayDurationToUse =
263
- delayDuration ?? (editor?.options.tooltipDelayMs || DEFAULT_TOOLTIP_DELAY_MS)
263
+ let delayDurationToUse
264
+ if (showUiLabels) {
265
+ delayDurationToUse = 0
266
+ } else {
267
+ delayDurationToUse =
268
+ delayDuration ?? (editor?.options.tooltipDelayMs || DEFAULT_TOOLTIP_DELAY_MS)
269
+ }
264
270
 
265
271
  // Fallback to old behavior if no provider
266
272
  if (!hasProvider) {
@@ -213,7 +213,7 @@ export function TldrawUiMenuItem<
213
213
  icon={icon}
214
214
  onSelect={onSelect}
215
215
  onDragStart={onDragStart}
216
- labelToUse={labelToUse}
216
+ labelStr={labelStr}
217
217
  titleStr={titleStr}
218
218
  disabled={disabled}
219
219
  isSelected={isSelected}
@@ -247,7 +247,7 @@ export function TldrawUiMenuItem<
247
247
  icon={icon}
248
248
  onSelect={onSelect}
249
249
  onDragStart={onDragStart}
250
- labelToUse={labelToUse}
250
+ labelStr={labelStr}
251
251
  titleStr={titleStr}
252
252
  disabled={disabled}
253
253
  isSelected={isSelected}
@@ -392,7 +392,7 @@ function useDraggableEvents(
392
392
 
393
393
  function DraggableToolbarButton({
394
394
  id,
395
- labelToUse,
395
+ labelStr,
396
396
  titleStr,
397
397
  disabled,
398
398
  isSelected,
@@ -403,7 +403,7 @@ function DraggableToolbarButton({
403
403
  }: {
404
404
  id: string
405
405
  disabled: boolean
406
- labelToUse?: string
406
+ labelStr?: string
407
407
  titleStr?: string
408
408
  isSelected?: boolean
409
409
  icon: TLUiMenuItemProps['icon']
@@ -416,7 +416,7 @@ function DraggableToolbarButton({
416
416
  if (overflow) {
417
417
  return (
418
418
  <TldrawUiToolbarButton
419
- aria-label={labelToUse}
419
+ aria-label={labelStr}
420
420
  aria-pressed={isSelected ? 'true' : 'false'}
421
421
  isActive={isSelected}
422
422
  className="tlui-button-grid__button"
@@ -434,7 +434,7 @@ function DraggableToolbarButton({
434
434
 
435
435
  return (
436
436
  <TldrawUiToolbarButton
437
- aria-label={labelToUse}
437
+ aria-label={labelStr}
438
438
  aria-pressed={isSelected ? 'true' : 'false'}
439
439
  data-testid={`tools.${id}`}
440
440
  data-value={id}
@@ -92,9 +92,9 @@ export const DEFAULT_TRANSLATION = {
92
92
  'action.toggle-wrap-mode': 'Toggle Select on wrap',
93
93
  'action.toggle-reduce-motion.menu': 'Reduce motion',
94
94
  'action.toggle-reduce-motion': 'Toggle reduce motion',
95
- 'action.toggle-keyboard-shortcuts.menu': 'Keyboard shortcuts',
95
+ 'action.toggle-keyboard-shortcuts.menu': 'Enable keyboard shortcuts',
96
96
  'action.toggle-keyboard-shortcuts': 'Toggle keyboard shortcuts',
97
- 'action.toggle-ui-labels.menu': 'UI labels',
97
+ 'action.toggle-ui-labels.menu': 'Enable UI labels',
98
98
  'action.toggle-ui-labels': 'Toggle UI labels',
99
99
  'action.toggle-edge-scrolling.menu': 'Edge scrolling',
100
100
  'action.toggle-edge-scrolling': 'Toggle edge scrolling',
@@ -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.6c77a180e58d'
4
+ export const version = '3.16.0-canary.783c93150be6'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-09-10T11:52:19.209Z',
8
- patch: '2025-09-10T11:52:19.209Z',
7
+ minor: '2025-09-11T09:28:00.618Z',
8
+ patch: '2025-09-11T09:28:00.618Z',
9
9
  }