tldraw 3.16.0-canary.c2c4563957ce → 3.16.0-canary.c349490eaef0

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 (167) hide show
  1. package/dist-cjs/index.d.ts +12 -6
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/defaultExternalContentHandlers.js +10 -0
  4. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  5. package/dist-cjs/lib/shapes/arrow/arrowLabel.js +6 -0
  6. package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +3 -3
  7. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +4 -4
  8. package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
  9. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +2 -1
  10. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  11. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +8 -2
  12. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
  13. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +1 -0
  14. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
  15. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +2 -1
  16. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  17. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +4 -4
  18. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
  19. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js +3 -3
  20. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
  21. package/dist-cjs/lib/shapes/text/PlainTextArea.js +3 -2
  22. package/dist-cjs/lib/shapes/text/PlainTextArea.js.map +2 -2
  23. package/dist-cjs/lib/shapes/text/RichTextArea.js +3 -3
  24. package/dist-cjs/lib/shapes/text/RichTextArea.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/TldrawUiSlider.js +1 -1
  48. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
  49. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +1 -0
  50. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  51. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +40 -3
  52. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  53. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js +3 -0
  54. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
  55. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +8 -8
  56. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  57. package/dist-cjs/lib/ui/context/actions.js +6 -0
  58. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  59. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +1 -1
  60. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
  61. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  62. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +4 -2
  63. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  64. package/dist-cjs/lib/ui/version.js +3 -3
  65. package/dist-cjs/lib/ui/version.js.map +1 -1
  66. package/dist-esm/index.d.mts +12 -6
  67. package/dist-esm/index.mjs +1 -1
  68. package/dist-esm/lib/defaultExternalContentHandlers.mjs +10 -0
  69. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  70. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +6 -0
  71. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +3 -3
  72. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +4 -5
  73. package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
  74. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +2 -1
  75. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  76. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +9 -3
  77. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
  78. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +1 -0
  79. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
  80. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +2 -1
  81. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  82. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +5 -5
  83. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
  84. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs +3 -4
  85. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
  86. package/dist-esm/lib/shapes/text/PlainTextArea.mjs +4 -3
  87. package/dist-esm/lib/shapes/text/PlainTextArea.mjs.map +2 -2
  88. package/dist-esm/lib/shapes/text/RichTextArea.mjs +3 -4
  89. package/dist-esm/lib/shapes/text/RichTextArea.mjs.map +2 -2
  90. package/dist-esm/lib/ui/components/A11y.mjs +1 -2
  91. package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
  92. package/dist-esm/lib/ui/components/LanguageMenu.mjs +1 -0
  93. package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
  94. package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs +2 -1
  95. package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs.map +2 -2
  96. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
  97. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
  98. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +11 -2
  99. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +2 -2
  100. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +3 -2
  101. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
  102. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +5 -4
  103. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
  104. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +1 -1
  105. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
  106. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +6 -2
  107. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  108. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -2
  109. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
  110. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +6 -4
  111. package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
  112. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +1 -1
  113. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
  114. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +1 -0
  115. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  116. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +41 -3
  117. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  118. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs +3 -0
  119. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
  120. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +8 -8
  121. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  122. package/dist-esm/lib/ui/context/actions.mjs +6 -0
  123. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  124. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +1 -2
  125. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
  126. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +4 -2
  127. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  128. package/dist-esm/lib/ui/version.mjs +3 -3
  129. package/dist-esm/lib/ui/version.mjs.map +1 -1
  130. package/package.json +3 -3
  131. package/src/lib/defaultExternalContentHandlers.ts +14 -0
  132. package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +2 -2
  133. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +41 -0
  134. package/src/lib/shapes/arrow/arrowLabel.ts +8 -0
  135. package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +4 -5
  136. package/src/lib/shapes/frame/FrameShapeUtil.tsx +1 -0
  137. package/src/lib/shapes/frame/components/FrameLabelInput.tsx +10 -3
  138. package/src/lib/shapes/geo/GeoShapeUtil.tsx +1 -0
  139. package/src/lib/shapes/note/NoteShapeUtil.tsx +1 -0
  140. package/src/lib/shapes/shared/HyperlinkButton.tsx +5 -5
  141. package/src/lib/shapes/shared/useEditablePlainText.ts +3 -4
  142. package/src/lib/shapes/text/PlainTextArea.tsx +4 -3
  143. package/src/lib/shapes/text/RichTextArea.tsx +3 -4
  144. package/src/lib/ui/components/A11y.tsx +1 -2
  145. package/src/lib/ui/components/LanguageMenu.tsx +1 -0
  146. package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +2 -1
  147. package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +1 -2
  148. package/src/lib/ui/components/StylePanel/StylePanelButtonPicker.tsx +9 -2
  149. package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +4 -3
  150. package/src/lib/ui/components/Toolbar/LinkEditor.tsx +6 -5
  151. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +1 -1
  152. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +9 -2
  153. package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -2
  154. package/src/lib/ui/components/primitives/TldrawUiInput.tsx +6 -3
  155. package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +2 -2
  156. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +2 -1
  157. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +57 -13
  158. package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +4 -0
  159. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +9 -9
  160. package/src/lib/ui/context/actions.tsx +13 -0
  161. package/src/lib/ui/hooks/useClipboardEvents.ts +1 -2
  162. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +2 -0
  163. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +4 -2
  164. package/src/lib/ui/version.ts +3 -3
  165. package/src/lib/ui.css +10 -0
  166. package/src/test/getCulledShapes.test.tsx +71 -2
  167. package/tldraw.css +18 -3
@@ -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}
@@ -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
 
@@ -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}
@@ -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'
@@ -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',
@@ -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.c2c4563957ce'
4
+ export const version = '3.16.0-canary.c349490eaef0'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-09-03T11:25:43.960Z',
8
- patch: '2025-09-03T11:25:43.960Z',
7
+ minor: '2025-09-17T16:01:20.675Z',
8
+ patch: '2025-09-17T16:01:20.675Z',
9
9
  }
package/src/lib/ui.css CHANGED
@@ -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
  }
@@ -1,12 +1,50 @@
1
- import { Box, TLShapeId, createShapeId } from '@tldraw/editor'
1
+ import {
2
+ BaseBoxShapeUtil,
3
+ Box,
4
+ RecordProps,
5
+ T,
6
+ TLBaseShape,
7
+ TLShapeId,
8
+ createShapeId,
9
+ } from '@tldraw/editor'
2
10
  import { vi } from 'vitest'
3
11
  import { TestEditor } from './TestEditor'
4
12
  import { TL } from './test-jsx'
5
13
 
14
+ // Custom uncullable shape type for testing canCull override
15
+ type UncullableShape = TLBaseShape<'uncullable', { w: number; h: number }>
16
+
17
+ class UncullableShapeUtil extends BaseBoxShapeUtil<UncullableShape> {
18
+ static override type = 'uncullable' as const
19
+ static override props: RecordProps<UncullableShape> = {
20
+ w: T.number,
21
+ h: T.number,
22
+ }
23
+
24
+ override canCull() {
25
+ return false
26
+ }
27
+
28
+ override getDefaultProps(): UncullableShape['props'] {
29
+ return {
30
+ w: 100,
31
+ h: 100,
32
+ }
33
+ }
34
+
35
+ override component() {
36
+ return <div>Uncullable shape</div>
37
+ }
38
+
39
+ override indicator() {
40
+ return <div>Uncullable shape</div>
41
+ }
42
+ }
43
+
6
44
  let editor: TestEditor
7
45
 
8
46
  beforeEach(() => {
9
- editor = new TestEditor()
47
+ editor = new TestEditor({ shapeUtils: [UncullableShapeUtil] })
10
48
  editor.setScreenBounds({ x: 0, y: 0, w: 1800, h: 900 })
11
49
  })
12
50
 
@@ -203,3 +241,34 @@ it('works for shapes that are outside of the viewport, but are then moved inside
203
241
  // Arrow should also not be culled
204
242
  expect(editor.getCulledShapes()).toEqual(new Set())
205
243
  })
244
+
245
+ it('respects canCull override - shapes that cannot be culled are never culled', () => {
246
+ const cullableShapeId = createShapeId()
247
+ const uncullableShapeId = createShapeId()
248
+
249
+ // Create both shapes outside the viewport
250
+ editor.createShapes([
251
+ {
252
+ id: cullableShapeId,
253
+ type: 'geo',
254
+ x: -2000, // Way outside viewport
255
+ y: -2000,
256
+ props: { w: 100, h: 100 },
257
+ },
258
+ {
259
+ id: uncullableShapeId,
260
+ type: 'uncullable',
261
+ x: -2000, // Way outside viewport
262
+ y: -2000,
263
+ props: { w: 100, h: 100 },
264
+ },
265
+ ])
266
+
267
+ const culledShapes = editor.getCulledShapes()
268
+
269
+ // The regular geo shape should be culled since it's outside the viewport
270
+ expect(culledShapes).toContain(cullableShapeId)
271
+
272
+ // The uncullable shape should NOT be culled even though it's outside the viewport
273
+ expect(culledShapes).not.toContain(uncullableShapeId)
274
+ })
package/tldraw.css CHANGED
@@ -693,11 +693,17 @@ input,
693
693
  }
694
694
 
695
695
  .tl-text-measure {
696
- position: absolute;
697
696
  z-index: var(--tl-layer-canvas-hidden);
697
+ opacity: 0;
698
+ visibility: hidden;
699
+
700
+ /* pointer-events: all; */
701
+ /* opacity: 1; */
702
+ /* z-index: 99999; */
703
+
704
+ position: absolute;
698
705
  top: 0px;
699
706
  left: 0px;
700
- opacity: 0;
701
707
  width: max-content;
702
708
  box-sizing: border-box;
703
709
  pointer-events: none;
@@ -708,7 +714,6 @@ input,
708
714
  border: none;
709
715
  user-select: none;
710
716
  contain: style paint;
711
- visibility: hidden;
712
717
  /* N.B. This property, while discouraged ("intended for Document Type Definition (DTD) designers") is necessary for ensuring correct mixed RTL/LTR behavior when exporting SVGs. */
713
718
  unicode-bidi: plaintext;
714
719
  -webkit-user-select: none;
@@ -2285,6 +2290,10 @@ it from receiving any pointer events or affecting the cursor. */
2285
2290
  -webkit-user-select: auto !important;
2286
2291
  }
2287
2292
 
2293
+ .tlui-input::placeholder {
2294
+ color: var(--tl-color-text-3);
2295
+ }
2296
+
2288
2297
  .tlui-input__wrapper {
2289
2298
  width: 100%;
2290
2299
  height: 44px;
@@ -2369,6 +2378,12 @@ it from receiving any pointer events or affecting the cursor. */
2369
2378
  box-shadow: var(--tl-shadow-3);
2370
2379
  }
2371
2380
 
2381
+ @media (max-height: 600px) {
2382
+ .tlui-menu {
2383
+ max-height: 70vh;
2384
+ }
2385
+ }
2386
+
2372
2387
  .tlui-menu::-webkit-scrollbar {
2373
2388
  display: none;
2374
2389
  }