tldraw 3.16.0-canary.9e28d92565ca → 3.16.0-canary.9f9886f75150

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 (30) hide show
  1. package/dist-cjs/index.d.ts +0 -77
  2. package/dist-cjs/index.js +1 -5
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  5. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +1 -1
  6. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  7. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +1 -3
  8. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  9. package/dist-cjs/lib/ui/version.js +3 -3
  10. package/dist-cjs/lib/ui/version.js.map +1 -1
  11. package/dist-esm/index.d.mts +0 -77
  12. package/dist-esm/index.mjs +1 -9
  13. package/dist-esm/index.mjs.map +2 -2
  14. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  15. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +1 -1
  16. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  17. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +1 -3
  18. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  19. package/dist-esm/lib/ui/version.mjs +3 -3
  20. package/dist-esm/lib/ui/version.mjs.map +1 -1
  21. package/package.json +3 -3
  22. package/src/index.ts +0 -7
  23. package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +3 -97
  24. package/src/lib/shapes/arrow/arrowTargetState.ts +0 -30
  25. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
  26. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +2 -6
  27. package/src/lib/ui/version.ts +3 -3
  28. package/src/lib/ui.css +2 -11
  29. package/src/test/TestEditor.ts +2 -8
  30. package/tldraw.css +2 -11
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.9e28d92565ca",
4
+ "version": "3.16.0-canary.9f9886f75150",
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.9e28d92565ca",
59
- "@tldraw/store": "3.16.0-canary.9e28d92565ca",
58
+ "@tldraw/editor": "3.16.0-canary.9f9886f75150",
59
+ "@tldraw/store": "3.16.0-canary.9f9886f75150",
60
60
  "classnames": "^2.5.1",
61
61
  "hotkeys-js": "^3.13.9",
62
62
  "idb": "^7.1.1",
package/src/index.ts CHANGED
@@ -106,13 +106,6 @@ export {
106
106
  } from './lib/shapes/arrow/arrow-types'
107
107
  export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
108
108
  export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
109
- export {
110
- clearArrowTargetState,
111
- getArrowTargetState,
112
- updateArrowTargetState,
113
- type ArrowTargetState,
114
- type UpdateArrowTargetStateOpts,
115
- } from './lib/shapes/arrow/arrowTargetState'
116
109
  export {
117
110
  type ElbowArrowBox,
118
111
  type ElbowArrowBoxEdges,
@@ -1,8 +1,6 @@
1
1
  import { IndexKey, TLArrowShape, TLShapeId, Vec, createShapeId } from '@tldraw/editor'
2
2
  import { vi } from 'vitest'
3
3
  import { TestEditor } from '../../../test/TestEditor'
4
- import { defaultShapeUtils } from '../../defaultShapeUtils'
5
- import { ArrowShapeUtil } from './ArrowShapeUtil'
6
4
  import { getArrowTargetState } from './arrowTargetState'
7
5
  import { getArrowBindings } from './shared'
8
6
 
@@ -28,8 +26,8 @@ function bindings(id: TLShapeId) {
28
26
  return getArrowBindings(editor, editor.getShape(id) as TLArrowShape)
29
27
  }
30
28
 
31
- function init(opts?: ConstructorParameters<typeof TestEditor>[0]) {
32
- editor = new TestEditor(opts)
29
+ beforeEach(() => {
30
+ editor = new TestEditor()
33
31
  editor
34
32
  .selectAll()
35
33
  .deleteShapes(editor.getSelectedShapeIds())
@@ -38,9 +36,7 @@ function init(opts?: ConstructorParameters<typeof TestEditor>[0]) {
38
36
  { id: ids.box2, type: 'geo', x: 300, y: 300, props: { w: 100, h: 100 } },
39
37
  { id: ids.box3, type: 'geo', x: 350, y: 350, props: { w: 50, h: 50 } }, // overlapping box2, but smaller!
40
38
  ])
41
- }
42
-
43
- beforeEach(init)
39
+ })
44
40
 
45
41
  it('enters the arrow state', () => {
46
42
  editor.setCurrentTool('arrow')
@@ -582,96 +578,6 @@ describe('reparenting issue', () => {
582
578
  })
583
579
  })
584
580
 
585
- describe('precision timeout configuration', () => {
586
- it('uses a timeout when dragging arrow handles', () => {
587
- // Create an arrow first
588
-
589
- editor.setCurrentTool('arrow').pointerDown(0, 0)
590
- // Use high velocity to avoid precise mode immediately
591
- editor.inputs.pointerVelocity = new Vec(1, 1)
592
- editor.pointerMove(100, 100)
593
-
594
- const arrow = editor.getCurrentPageShapes()[
595
- editor.getCurrentPageShapes().length - 1
596
- ] as TLArrowShape
597
-
598
- editor.expectToBeIn('select.dragging_handle')
599
-
600
- expect(bindings(arrow.id)).toMatchObject({
601
- end: {
602
- toId: ids.box1,
603
- props: {
604
- isPrecise: false,
605
- },
606
- },
607
- })
608
-
609
- vi.advanceTimersByTime(1000)
610
-
611
- expect(bindings(arrow.id)).toMatchObject({
612
- end: {
613
- toId: ids.box1,
614
- props: {
615
- isPrecise: true,
616
- },
617
- },
618
- })
619
- })
620
-
621
- it('allows configuring the pointingPreciseTimeout', () => {
622
- init({
623
- shapeUtils: [
624
- ...defaultShapeUtils.map((s) =>
625
- s.type === 'arrow' ? ArrowShapeUtil.configure({ pointingPreciseTimeout: 2000 }) : s
626
- ),
627
- ],
628
- })
629
- // Create an arrow first
630
-
631
- editor.setCurrentTool('arrow').pointerDown(0, 0)
632
- // Use high velocity to avoid precise mode immediately
633
- editor.inputs.pointerVelocity = new Vec(1, 1)
634
- editor.pointerMove(100, 100)
635
-
636
- const arrow = editor.getCurrentPageShapes()[
637
- editor.getCurrentPageShapes().length - 1
638
- ] as TLArrowShape
639
-
640
- editor.expectToBeIn('select.dragging_handle')
641
-
642
- expect(bindings(arrow.id)).toMatchObject({
643
- end: {
644
- toId: ids.box1,
645
- props: {
646
- isPrecise: false,
647
- },
648
- },
649
- })
650
-
651
- vi.advanceTimersByTime(1000)
652
-
653
- expect(bindings(arrow.id)).toMatchObject({
654
- end: {
655
- toId: ids.box1,
656
- props: {
657
- isPrecise: false,
658
- },
659
- },
660
- })
661
-
662
- vi.advanceTimersByTime(1000)
663
-
664
- expect(bindings(arrow.id)).toMatchObject({
665
- end: {
666
- toId: ids.box1,
667
- props: {
668
- isPrecise: true,
669
- },
670
- },
671
- })
672
- })
673
- })
674
-
675
581
  describe('line bug', () => {
676
582
  it('works as expected when binding to a straight line', () => {
677
583
  editor.selectAll().deleteShapes(editor.getSelectedShapeIds())
@@ -27,11 +27,6 @@ import {
27
27
  ElbowArrowSideDeltas,
28
28
  } from './elbow/definitions'
29
29
 
30
- /**
31
- * Options passed to {@link updateArrowTargetState}.
32
- *
33
- * @public
34
- */
35
30
  export interface UpdateArrowTargetStateOpts {
36
31
  editor: Editor
37
32
  pointInPageSpace: VecLike
@@ -42,13 +37,6 @@ export interface UpdateArrowTargetStateOpts {
42
37
  oppositeBinding: TLArrowBinding | undefined
43
38
  }
44
39
 
45
- /**
46
- * State representing what we're pointing to when drawing or updating an arrow. You can get this
47
- * state using {@link getArrowTargetState}, and update it as part of an arrow interaction with
48
- * {@link updateArrowTargetState} or {@link clearArrowTargetState}.
49
- *
50
- * @public
51
- */
52
40
  export interface ArrowTargetState {
53
41
  target: TLShape
54
42
  arrowKind: TLArrowShapeKind
@@ -75,32 +63,14 @@ function getArrowTargetAtom(editor: Editor) {
75
63
  return arrowTargetStore.get(editor, () => atom('arrowTarget', null))
76
64
  }
77
65
 
78
- /**
79
- * Get the current arrow target state for an editor. See {@link ArrowTargetState} for more
80
- * information.
81
- *
82
- * @public
83
- */
84
66
  export function getArrowTargetState(editor: Editor) {
85
67
  return getArrowTargetAtom(editor).get()
86
68
  }
87
69
 
88
- /**
89
- * Clear the current arrow target state for an editor. See {@link ArrowTargetState} for more
90
- * information.
91
- *
92
- * @public
93
- */
94
70
  export function clearArrowTargetState(editor: Editor) {
95
71
  getArrowTargetAtom(editor).set(null)
96
72
  }
97
73
 
98
- /**
99
- * Update the current arrow target state for an editor. See {@link ArrowTargetState} for more
100
- * information.
101
- *
102
- * @public
103
- */
104
74
  export function updateArrowTargetState({
105
75
  editor,
106
76
  pointInPageSpace,
@@ -163,7 +163,7 @@ export class Pointing extends StateNode {
163
163
  const endHandle = handles.find((h) => h.id === 'end')!
164
164
  const change = util.onHandleDrag?.(this.editor.getShape(shape)!, {
165
165
  handle: { ...endHandle, x: point.x, y: point.y },
166
- isPrecise: this.isPrecise,
166
+ isPrecise: false,
167
167
  isCreatingShape: true,
168
168
  initial: initial,
169
169
  })
@@ -13,7 +13,6 @@ import {
13
13
  sortByIndex,
14
14
  structuredClone,
15
15
  } from '@tldraw/editor'
16
- import { ArrowShapeUtil } from '../../../shapes/arrow/ArrowShapeUtil'
17
16
  import { clearArrowTargetState } from '../../../shapes/arrow/arrowTargetState'
18
17
  import { getArrowBindings } from '../../../shapes/arrow/shared'
19
18
 
@@ -136,13 +135,10 @@ export class DraggingHandle extends StateNode {
136
135
  }
137
136
 
138
137
  // Only relevant to arrows
139
- private exactTimeout = -1
138
+ private exactTimeout = -1 as any
140
139
 
141
140
  // Only relevant to arrows
142
141
  private resetExactTimeout() {
143
- const arrowUtil = this.editor.getShapeUtil<ArrowShapeUtil>('arrow')
144
- const timeoutValue = arrowUtil.options.pointingPreciseTimeout
145
-
146
142
  if (this.exactTimeout !== -1) {
147
143
  this.clearExactTimeout()
148
144
  }
@@ -154,7 +150,7 @@ export class DraggingHandle extends StateNode {
154
150
  this.update()
155
151
  }
156
152
  this.exactTimeout = -1
157
- }, timeoutValue)
153
+ }, 750)
158
154
  }
159
155
 
160
156
  // Only relevant to arrows
@@ -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.9e28d92565ca'
4
+ export const version = '3.16.0-canary.9f9886f75150'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-09-18T12:01:01.351Z',
8
- patch: '2025-09-18T12:01:01.351Z',
7
+ minor: '2025-09-18T09:27:24.175Z',
8
+ patch: '2025-09-18T09:27:24.175Z',
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-top: -4px;
171
+ margin: -4px 0px;
172
172
  }
173
173
 
174
174
  .tlui-button__menu::after {
@@ -1039,19 +1039,10 @@ tldraw? probably.
1039
1039
  display: none;
1040
1040
  }
1041
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) {
1042
+ .tlui-style-panel[data-ismobile='true'] .tlui-style-panel__section .tlui-row.tlui-toolbar {
1048
1043
  flex-wrap: wrap;
1049
1044
  }
1050
1045
 
1051
- .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) .tlui-style-panel__subheading {
1052
- margin-left: -2px;
1053
- }
1054
-
1055
1046
  .tlui-style-panel__section__common:not(:only-child) {
1056
1047
  margin-bottom: 7px;
1057
1048
  border-bottom: 1px solid var(--tl-color-divider);
@@ -86,14 +86,8 @@ export class TestEditor extends Editor {
86
86
  elm.tabIndex = 0
87
87
  elm.getBoundingClientRect = () => bounds as DOMRect
88
88
 
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
- ]
89
+ const shapeUtilsWithDefaults = [...defaultShapeUtils, ...(options.shapeUtils ?? [])]
90
+ const bindingUtilsWithDefaults = [...defaultBindingUtils, ...(options.bindingUtils ?? [])]
97
91
 
98
92
  super({
99
93
  ...options,
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-top: -4px;
1967
+ margin: -4px 0px;
1968
1968
  }
1969
1969
 
1970
1970
  .tlui-button__menu::after {
@@ -2835,19 +2835,10 @@ tldraw? probably.
2835
2835
  display: none;
2836
2836
  }
2837
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) {
2838
+ .tlui-style-panel[data-ismobile='true'] .tlui-style-panel__section .tlui-row.tlui-toolbar {
2844
2839
  flex-wrap: wrap;
2845
2840
  }
2846
2841
 
2847
- .tlui-style-panel__section .tlui-toolbar:has(.tlui-toolbar) .tlui-style-panel__subheading {
2848
- margin-left: -2px;
2849
- }
2850
-
2851
2842
  .tlui-style-panel__section__common:not(:only-child) {
2852
2843
  margin-bottom: 7px;
2853
2844
  border-bottom: 1px solid var(--tl-color-divider);