tldraw 4.1.0-canary.d0d868ee0e4c → 4.1.0-canary.d89f813fd441

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 (99) hide show
  1. package/dist-cjs/index.d.ts +11 -2
  2. package/dist-cjs/index.js +4 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Cropping.js +20 -4
  5. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Cropping.js.map +2 -2
  6. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.js +23 -11
  7. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.js.map +2 -2
  8. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +18 -5
  9. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  10. package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js +21 -9
  11. package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js.map +2 -2
  12. package/dist-cjs/lib/tools/SelectTool/childStates/PointingResizeHandle.js +24 -8
  13. package/dist-cjs/lib/tools/SelectTool/childStates/PointingResizeHandle.js.map +2 -2
  14. package/dist-cjs/lib/tools/SelectTool/childStates/PointingRotateHandle.js +21 -9
  15. package/dist-cjs/lib/tools/SelectTool/childStates/PointingRotateHandle.js.map +2 -2
  16. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +23 -8
  17. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
  18. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +21 -9
  19. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
  20. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +26 -11
  21. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
  22. package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js +2 -2
  23. package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js.map +1 -1
  24. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +63 -55
  25. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
  26. package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +54 -47
  27. package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +3 -3
  28. package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js +62 -55
  29. package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js.map +2 -2
  30. package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js +12 -5
  31. package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js.map +2 -2
  32. package/dist-cjs/lib/ui/components/menu-items.js +2 -2
  33. package/dist-cjs/lib/ui/components/menu-items.js.map +1 -1
  34. package/dist-cjs/lib/ui/hooks/useEditorEvents.js +1 -1
  35. package/dist-cjs/lib/ui/hooks/useEditorEvents.js.map +1 -1
  36. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +4 -4
  37. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +1 -1
  38. package/dist-cjs/lib/ui/version.js +3 -3
  39. package/dist-cjs/lib/ui/version.js.map +1 -1
  40. package/dist-esm/index.d.mts +11 -2
  41. package/dist-esm/index.mjs +10 -4
  42. package/dist-esm/index.mjs.map +2 -2
  43. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Cropping.mjs +20 -4
  44. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Cropping.mjs.map +2 -2
  45. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.mjs +23 -11
  46. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.mjs.map +2 -2
  47. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +18 -5
  48. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  49. package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs +21 -9
  50. package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs.map +2 -2
  51. package/dist-esm/lib/tools/SelectTool/childStates/PointingResizeHandle.mjs +24 -8
  52. package/dist-esm/lib/tools/SelectTool/childStates/PointingResizeHandle.mjs.map +2 -2
  53. package/dist-esm/lib/tools/SelectTool/childStates/PointingRotateHandle.mjs +21 -9
  54. package/dist-esm/lib/tools/SelectTool/childStates/PointingRotateHandle.mjs.map +2 -2
  55. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +23 -8
  56. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
  57. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +21 -9
  58. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
  59. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +26 -11
  60. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
  61. package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs +2 -2
  62. package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs.map +1 -1
  63. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +68 -57
  64. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
  65. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +54 -47
  66. package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +3 -3
  67. package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs +63 -56
  68. package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs.map +2 -2
  69. package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs +12 -5
  70. package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs.map +2 -2
  71. package/dist-esm/lib/ui/components/menu-items.mjs +2 -2
  72. package/dist-esm/lib/ui/components/menu-items.mjs.map +1 -1
  73. package/dist-esm/lib/ui/hooks/useEditorEvents.mjs +1 -1
  74. package/dist-esm/lib/ui/hooks/useEditorEvents.mjs.map +1 -1
  75. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +4 -4
  76. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +1 -1
  77. package/dist-esm/lib/ui/version.mjs +3 -3
  78. package/dist-esm/lib/ui/version.mjs.map +1 -1
  79. package/package.json +3 -3
  80. package/src/index.ts +3 -0
  81. package/src/lib/tools/SelectTool/childStates/Crop/children/Cropping.ts +23 -6
  82. package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCropHandle.ts +24 -12
  83. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +21 -10
  84. package/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +23 -11
  85. package/src/lib/tools/SelectTool/childStates/PointingResizeHandle.ts +26 -9
  86. package/src/lib/tools/SelectTool/childStates/PointingRotateHandle.ts +23 -10
  87. package/src/lib/tools/SelectTool/childStates/Resizing.ts +24 -9
  88. package/src/lib/tools/SelectTool/childStates/Rotating.ts +27 -11
  89. package/src/lib/tools/SelectTool/childStates/Translating.ts +28 -12
  90. package/src/lib/ui/components/DebugMenu/DefaultDebugMenuContent.tsx +2 -2
  91. package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +60 -49
  92. package/src/lib/ui/components/StylePanel/StylePanelButtonPicker.tsx +70 -53
  93. package/src/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.tsx +105 -90
  94. package/src/lib/ui/components/StylePanel/StylePanelDropdownPicker.tsx +72 -51
  95. package/src/lib/ui/components/menu-items.tsx +2 -2
  96. package/src/lib/ui/hooks/useEditorEvents.ts +1 -1
  97. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +4 -4
  98. package/src/lib/ui/version.ts +3 -3
  99. package/src/test/SelectTool.test.ts +251 -0
@@ -482,11 +482,11 @@ export function MoveToPageMenu() {
482
482
 
483
483
  if (toPage) {
484
484
  addToast({
485
- title: 'Changed Page',
485
+ title: 'Changed page',
486
486
  description: `Moved to ${toPage.name}.`,
487
487
  actions: [
488
488
  {
489
- label: 'Go Back',
489
+ label: 'Go back',
490
490
  type: 'primary',
491
491
  onClick: () => {
492
492
  editor.markHistoryStoppingPoint('change-page')
@@ -10,7 +10,7 @@ export function useEditorEvents() {
10
10
  useEffect(() => {
11
11
  function handleMaxShapes({ name, count }: { name: string; pageId: string; count: number }) {
12
12
  addToast({
13
- title: 'Maximum Shapes Reached',
13
+ title: 'Maximum shapes reached',
14
14
  description: `You've reached the maximum number of shapes allowed on ${name} (${count}). Please delete some shapes or move to a different page to continue.`,
15
15
  severity: 'warning',
16
16
  })
@@ -8,8 +8,8 @@ export const DEFAULT_TRANSLATION = {
8
8
  'action.toggle-auto-none': 'Auto',
9
9
  'action.toggle-mouse': 'Mouse',
10
10
  'action.toggle-trackpad': 'Trackpad',
11
- 'action.convert-to-bookmark': 'Convert to Bookmark',
12
- 'action.convert-to-embed': 'Convert to Embed',
11
+ 'action.convert-to-bookmark': 'Convert to bookmark',
12
+ 'action.convert-to-embed': 'Convert to embed',
13
13
  'action.open-embed-link': 'Open link',
14
14
  'action.align-bottom': 'Align bottom',
15
15
  'action.align-center-horizontal': 'Align horizontally',
@@ -94,7 +94,7 @@ export const DEFAULT_TRANSLATION = {
94
94
  'action.toggle-paste-at-cursor.menu': 'Paste at cursor',
95
95
  'action.toggle-paste-at-cursor': 'Toggle paste at cursor',
96
96
  'action.toggle-wrap-mode.menu': 'Select on wrap',
97
- 'action.toggle-wrap-mode': 'Toggle Select on wrap',
97
+ 'action.toggle-wrap-mode': 'Toggle select on wrap',
98
98
  'action.toggle-reduce-motion.menu': 'Reduce motion',
99
99
  'action.toggle-reduce-motion': 'Toggle reduce motion',
100
100
  'action.toggle-keyboard-shortcuts.menu': 'Enable keyboard shortcuts',
@@ -364,7 +364,7 @@ export const DEFAULT_TRANSLATION = {
364
364
  'people-menu.change-color': 'Change color',
365
365
  'people-menu.follow': 'Following',
366
366
  'people-menu.following': 'Following',
367
- 'people-menu.leading': 'Following You',
367
+ 'people-menu.leading': 'Following you',
368
368
  'people-menu.user': '(You)',
369
369
  'people-menu.invite': 'Invite others',
370
370
  'people-menu.anonymous-user': 'New user',
@@ -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 = '4.1.0-canary.d0d868ee0e4c'
4
+ export const version = '4.1.0-canary.d89f813fd441'
5
5
  export const publishDates = {
6
6
  major: '2025-09-18T14:39:22.803Z',
7
- minor: '2025-10-14T14:37:21.186Z',
8
- patch: '2025-10-14T14:37:21.186Z',
7
+ minor: '2025-10-15T10:22:57.952Z',
8
+ patch: '2025-10-15T10:22:57.952Z',
9
9
  }
@@ -648,3 +648,254 @@ test('right clicking a shape inside of a group does not focus the group if the g
648
648
  editor.pointerUp(100, 100, { target: 'shape', button: 0, shape: editor.getShape(boxAId)! })
649
649
  expect(editor.getFocusedGroupId()).toBe(groupId)
650
650
  })
651
+
652
+ describe('when passing a function to onInteractionEnd', () => {
653
+ it('calls the function for cropping', () => {
654
+ const id = createShapeId('image')
655
+ editor.createShapes([
656
+ {
657
+ id,
658
+ type: 'image',
659
+ x: 100,
660
+ y: 100,
661
+ props: {
662
+ w: 1200,
663
+ h: 800,
664
+ },
665
+ },
666
+ ])
667
+
668
+ editor.select(id)
669
+
670
+ const fn = vi.fn()
671
+ editor.setCurrentTool('select.cropping', {
672
+ handle: 'bottom_right',
673
+ onInteractionEnd: fn,
674
+ })
675
+ editor.pointerUp(50, 50)
676
+
677
+ expect(fn).toHaveBeenCalled()
678
+ })
679
+
680
+ it('calls the function for pointing crop handle', () => {
681
+ const fn = vi.fn()
682
+ editor.setCurrentTool('select.crop.pointing_crop_handle', {
683
+ onInteractionEnd: fn,
684
+ })
685
+ editor.pointerUp(50, 50)
686
+ expect(fn).toHaveBeenCalled()
687
+ })
688
+
689
+ it('calls the function for pointing arrow label', () => {
690
+ const fn = vi.fn()
691
+ const id = createShapeId('arrow')
692
+
693
+ const arrow = {
694
+ id,
695
+ type: 'arrow' as const,
696
+ x: 100,
697
+ y: 100,
698
+ props: {
699
+ richText: toRichText('Test Label'),
700
+ start: { x: 0, y: 0 },
701
+ end: { x: 100, y: 0 },
702
+ },
703
+ }
704
+
705
+ editor.createShapes<TLArrowShape>([arrow])
706
+
707
+ editor.setCurrentTool('select.pointing_arrow_label', {
708
+ shape: arrow,
709
+ onInteractionEnd: fn,
710
+ })
711
+ editor.pointerUp(50, 50)
712
+ expect(fn).toHaveBeenCalled()
713
+ })
714
+
715
+ it('calls the function for pointing a resize handle', () => {
716
+ const fn = vi.fn()
717
+ editor.setCurrentTool('select.pointing_resize_handle', {
718
+ target: 'selection',
719
+ handle: 'bottom_right',
720
+ onInteractionEnd: fn,
721
+ })
722
+ editor.pointerUp(50, 50)
723
+ expect(fn).toHaveBeenCalled()
724
+ })
725
+
726
+ it('calls the function for pointing a rotate handle', () => {
727
+ const fn = vi.fn()
728
+ editor.setCurrentTool('select.pointing_rotate_handle', {
729
+ target: 'selection',
730
+ handle: 'bottom_right_rotate',
731
+ onInteractionEnd: fn,
732
+ })
733
+ editor.pointerUp(50, 50)
734
+ expect(fn).toHaveBeenCalled()
735
+ })
736
+
737
+ it('calls the function for resizing', () => {
738
+ const id = createShapeId('box')
739
+ editor.createShapes([
740
+ {
741
+ id,
742
+ type: 'geo',
743
+ x: 100,
744
+ y: 100,
745
+ },
746
+ ])
747
+
748
+ editor.select(id)
749
+
750
+ const fn = vi.fn()
751
+ editor.setCurrentTool('select.resizing', {
752
+ target: 'selection',
753
+ handle: 'bottom_right',
754
+ onInteractionEnd: fn,
755
+ })
756
+ editor.pointerUp(50, 50)
757
+ expect(fn).toHaveBeenCalled()
758
+ })
759
+
760
+ it('calls the function for translating', () => {
761
+ const id = createShapeId('box')
762
+ editor.createShapes([
763
+ {
764
+ id,
765
+ type: 'geo',
766
+ x: 100,
767
+ y: 100,
768
+ },
769
+ ])
770
+ editor.select(id)
771
+
772
+ const fn = vi.fn()
773
+ editor.setCurrentTool('select.translating', {
774
+ onInteractionEnd: fn,
775
+ })
776
+ editor.pointerUp(50, 50)
777
+ expect(fn).toHaveBeenCalled()
778
+ })
779
+ })
780
+
781
+ describe('when passing a string to onInteractionEnd', () => {
782
+ it('transitions to the tool for cropping', () => {
783
+ const id = createShapeId('image')
784
+ editor.createShapes([
785
+ {
786
+ id,
787
+ type: 'image',
788
+ x: 100,
789
+ y: 100,
790
+ props: {
791
+ w: 1200,
792
+ h: 800,
793
+ },
794
+ },
795
+ ])
796
+
797
+ editor.select(id)
798
+
799
+ editor.setCurrentTool('select.cropping', {
800
+ handle: 'bottom_right',
801
+ onInteractionEnd: 'select.idle',
802
+ })
803
+ editor.pointerUp(50, 50)
804
+
805
+ editor.expectToBeIn('select.idle')
806
+ })
807
+
808
+ it('transitions to the tool for pointing crop handle', () => {
809
+ editor.setCurrentTool('select.crop.pointing_crop_handle', {
810
+ onInteractionEnd: 'select.idle',
811
+ })
812
+ editor.pointerUp(50, 50)
813
+ editor.expectToBeIn('select.idle')
814
+ })
815
+
816
+ it('transitions to the tool for pointing arrow label', () => {
817
+ const id = createShapeId('arrow')
818
+
819
+ const arrow = {
820
+ id,
821
+ type: 'arrow' as const,
822
+ x: 100,
823
+ y: 100,
824
+ props: {
825
+ richText: toRichText('Test Label'),
826
+ start: { x: 0, y: 0 },
827
+ end: { x: 100, y: 0 },
828
+ },
829
+ }
830
+
831
+ editor.createShapes<TLArrowShape>([arrow])
832
+
833
+ editor.setCurrentTool('select.pointing_arrow_label', {
834
+ shape: arrow,
835
+ onInteractionEnd: 'select.idle',
836
+ })
837
+ editor.pointerUp(50, 50)
838
+ editor.expectToBeIn('select.idle')
839
+ })
840
+
841
+ it('transitions to the tool for pointing a resize handle', () => {
842
+ editor.setCurrentTool('select.pointing_resize_handle', {
843
+ target: 'selection',
844
+ handle: 'bottom_right',
845
+ onInteractionEnd: 'select.idle',
846
+ })
847
+ editor.pointerUp(50, 50)
848
+ editor.expectToBeIn('select.idle')
849
+ })
850
+
851
+ it('transitions to the tool for pointing a rotate handle', () => {
852
+ editor.setCurrentTool('select.pointing_rotate_handle', {
853
+ target: 'selection',
854
+ handle: 'bottom_right_rotate',
855
+ onInteractionEnd: 'select.idle',
856
+ })
857
+ editor.pointerUp(50, 50)
858
+ editor.expectToBeIn('select.idle')
859
+ })
860
+
861
+ it('transitions to the tool for resizing', () => {
862
+ const id = createShapeId('box')
863
+ editor.createShapes([
864
+ {
865
+ id,
866
+ type: 'geo',
867
+ x: 100,
868
+ y: 100,
869
+ },
870
+ ])
871
+
872
+ editor.select(id)
873
+
874
+ editor.setCurrentTool('select.resizing', {
875
+ target: 'selection',
876
+ handle: 'bottom_right',
877
+ onInteractionEnd: 'select.idle',
878
+ })
879
+ editor.pointerUp(50, 50)
880
+ editor.expectToBeIn('select.idle')
881
+ })
882
+
883
+ it('transitions to the tool for translating', () => {
884
+ const id = createShapeId('box')
885
+ editor.createShapes([
886
+ {
887
+ id,
888
+ type: 'geo',
889
+ x: 100,
890
+ y: 100,
891
+ },
892
+ ])
893
+ editor.select(id)
894
+
895
+ editor.setCurrentTool('select.translating', {
896
+ onInteractionEnd: 'select.idle',
897
+ })
898
+ editor.pointerUp(50, 50)
899
+ editor.expectToBeIn('select.idle')
900
+ })
901
+ })