tldraw 5.1.0 → 5.1.1

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.
package/dist-cjs/index.js CHANGED
@@ -648,7 +648,7 @@ var import_buildFromV1Document = require("./lib/utils/tldr/buildFromV1Document")
648
648
  var import_file = require("./lib/utils/tldr/file");
649
649
  (0, import_editor.registerTldrawLibraryVersion)(
650
650
  "tldraw",
651
- "5.1.0",
651
+ "5.1.1",
652
652
  "cjs"
653
653
  );
654
654
  //# sourceMappingURL=index.js.map
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "5.1.0";
25
+ const version = "5.1.1";
26
26
  const publishDates = {
27
27
  major: "2026-05-06T16:28:18.473Z",
28
28
  minor: "2026-06-03T10:26:13.606Z",
29
- patch: "2026-06-03T10:26:13.606Z"
29
+ patch: "2026-06-12T16:33:21.130Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/ui/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.1.0'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-03T10:26:13.606Z',\n\tpatch: '2026-06-03T10:26:13.606Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.1.1'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-03T10:26:13.606Z',\n\tpatch: '2026-06-12T16:33:21.130Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -632,7 +632,7 @@ import {
632
632
  } from "./lib/utils/tldr/file.mjs";
633
633
  registerTldrawLibraryVersion(
634
634
  "tldraw",
635
- "5.1.0",
635
+ "5.1.1",
636
636
  "esm"
637
637
  );
638
638
  export {
@@ -1,8 +1,8 @@
1
- const version = "5.1.0";
1
+ const version = "5.1.1";
2
2
  const publishDates = {
3
3
  major: "2026-05-06T16:28:18.473Z",
4
4
  minor: "2026-06-03T10:26:13.606Z",
5
- patch: "2026-06-03T10:26:13.606Z"
5
+ patch: "2026-06-12T16:33:21.130Z"
6
6
  };
7
7
  export {
8
8
  publishDates,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/ui/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.1.0'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-03T10:26:13.606Z',\n\tpatch: '2026-06-03T10:26:13.606Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '5.1.1'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-06-03T10:26:13.606Z',\n\tpatch: '2026-06-12T16:33:21.130Z',\n}\n"],
5
5
  "mappings": "AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tldraw",
3
3
  "description": "A tiny little drawing editor.",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -61,9 +61,9 @@
61
61
  "@tiptap/pm": "^3.12.1",
62
62
  "@tiptap/react": "^3.12.1",
63
63
  "@tiptap/starter-kit": "^3.12.1",
64
- "@tldraw/driver": "5.1.0",
65
- "@tldraw/editor": "5.1.0",
66
- "@tldraw/store": "5.1.0",
64
+ "@tldraw/driver": "5.1.1",
65
+ "@tldraw/editor": "5.1.1",
66
+ "@tldraw/store": "5.1.1",
67
67
  "classnames": "^2.5.1",
68
68
  "idb": "^7.1.1",
69
69
  "lz-string": "^1.5.0",
@@ -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 = '5.1.0'
4
+ export const version = '5.1.1'
5
5
  export const publishDates = {
6
6
  major: '2026-05-06T16:28:18.473Z',
7
7
  minor: '2026-06-03T10:26:13.606Z',
8
- patch: '2026-06-03T10:26:13.606Z',
8
+ patch: '2026-06-12T16:33:21.130Z',
9
9
  }
@@ -1,4 +1,4 @@
1
- import { Vec } from '@tldraw/editor'
1
+ import { TLDrawShape, Vec } from '@tldraw/editor'
2
2
  import { TestEditor } from '../TestEditor'
3
3
 
4
4
  let editor: TestEditor
@@ -27,3 +27,56 @@ it('ignores touch events while in pen mode', async () => {
27
27
 
28
28
  expect(editor.getCurrentPageShapes().length).toBe(0)
29
29
  })
30
+
31
+ describe('forgiving palm touches when entering pen mode', () => {
32
+ it('does not connect a palm touch to the stylus stroke', () => {
33
+ editor.setCurrentTool('draw')
34
+ expect(editor.getInstanceState().isPenMode).toBe(false)
35
+
36
+ // A palm rests on the canvas first (not a pen, pen mode is still off)
37
+ editor.pointerDown(100, 100, { isPen: false })
38
+ editor.expectToBeIn('draw.drawing')
39
+
40
+ // Then the stylus lands, which switches the editor into pen mode
41
+ editor.pointerDown(300, 300, { isPen: true })
42
+ expect(editor.getInstanceState().isPenMode).toBe(true)
43
+
44
+ // The stylus draws its stroke
45
+ editor.pointerMove(310, 310, { isPen: true })
46
+ editor.pointerMove(320, 320, { isPen: true })
47
+ editor.pointerUp(320, 320, { isPen: true })
48
+
49
+ expect(editor.getCurrentPageShapes().length).toBe(1)
50
+ const shape = editor.getCurrentPageShapes()[0] as TLDrawShape
51
+
52
+ // The stroke should begin where the stylus landed, not at the palm point.
53
+ const bounds = editor.getShapePageBounds(shape.id)!
54
+ expect(bounds.minX).toBeGreaterThan(200)
55
+ expect(bounds.minY).toBeGreaterThan(200)
56
+ })
57
+
58
+ it('forgives a palm touch that was already dragging before the stylus lands', () => {
59
+ editor.setCurrentTool('draw')
60
+
61
+ // A palm rests on the canvas and drags a little before the stylus arrives
62
+ editor.pointerDown(100, 100, { isPen: false })
63
+ editor.pointerMove(120, 120, { isPen: false })
64
+ editor.pointerMove(140, 140, { isPen: false })
65
+ editor.expectToBeIn('draw.drawing')
66
+
67
+ // The stylus lands, switching into pen mode and forgiving the palm stroke
68
+ editor.pointerDown(300, 300, { isPen: true })
69
+ expect(editor.getInstanceState().isPenMode).toBe(true)
70
+
71
+ editor.pointerMove(310, 310, { isPen: true })
72
+ editor.pointerMove(320, 320, { isPen: true })
73
+ editor.pointerUp(320, 320, { isPen: true })
74
+
75
+ expect(editor.getCurrentPageShapes().length).toBe(1)
76
+ const shape = editor.getCurrentPageShapes()[0] as TLDrawShape
77
+
78
+ const bounds = editor.getShapePageBounds(shape.id)!
79
+ expect(bounds.minX).toBeGreaterThan(200)
80
+ expect(bounds.minY).toBeGreaterThan(200)
81
+ })
82
+ })