@tldraw/editor 3.14.0-canary.95353287a2be → 3.14.0-canary.d8a1c8c23469
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.d.ts +5 -3
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FocusManager.js +2 -0
- package/dist-cjs/lib/editor/managers/FocusManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +5 -5
- package/dist-cjs/lib/primitives/Vec.js.map +3 -3
- package/dist-cjs/lib/primitives/geometry/Edge2d.js +0 -4
- package/dist-cjs/lib/primitives/geometry/Edge2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +5 -0
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +5 -3
- package/dist-esm/index.mjs +4 -2
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FocusManager.mjs +2 -0
- package/dist-esm/lib/editor/managers/FocusManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +6 -6
- package/dist-esm/lib/primitives/Vec.mjs.map +3 -3
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs +0 -4
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +7 -1
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +4 -1
- package/src/lib/editor/managers/FocusManager.ts +2 -0
- package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +5 -2
- package/src/lib/primitives/Vec.ts +2 -2
- package/src/lib/primitives/geometry/Edge2d.ts +0 -7
- package/src/lib/primitives/geometry/Geometry2d.ts +6 -0
- package/src/version.ts +3 -3
package/dist-esm/version.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const version = "3.14.0-canary.
|
|
1
|
+
const version = "3.14.0-canary.d8a1c8c23469";
|
|
2
2
|
const publishDates = {
|
|
3
3
|
major: "2024-09-13T14:36:29.063Z",
|
|
4
|
-
minor: "2025-05-
|
|
5
|
-
patch: "2025-05-
|
|
4
|
+
minor: "2025-05-27T08:51:57.747Z",
|
|
5
|
+
patch: "2025-05-27T08:51:57.747Z"
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
publishDates,
|
package/dist-esm/version.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/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 = '3.14.0-canary.
|
|
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 = '3.14.0-canary.d8a1c8c23469'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-05-27T08:51:57.747Z',\n\tpatch: '2025-05-27T08:51:57.747Z',\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/editor",
|
|
3
3
|
"description": "A tiny little drawing app (editor).",
|
|
4
|
-
"version": "3.14.0-canary.
|
|
4
|
+
"version": "3.14.0-canary.d8a1c8c23469",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@tiptap/core": "^2.9.1",
|
|
49
49
|
"@tiptap/pm": "^2.9.1",
|
|
50
50
|
"@tiptap/react": "^2.9.1",
|
|
51
|
-
"@tldraw/state": "3.14.0-canary.
|
|
52
|
-
"@tldraw/state-react": "3.14.0-canary.
|
|
53
|
-
"@tldraw/store": "3.14.0-canary.
|
|
54
|
-
"@tldraw/tlschema": "3.14.0-canary.
|
|
55
|
-
"@tldraw/utils": "3.14.0-canary.
|
|
56
|
-
"@tldraw/validate": "3.14.0-canary.
|
|
51
|
+
"@tldraw/state": "3.14.0-canary.d8a1c8c23469",
|
|
52
|
+
"@tldraw/state-react": "3.14.0-canary.d8a1c8c23469",
|
|
53
|
+
"@tldraw/store": "3.14.0-canary.d8a1c8c23469",
|
|
54
|
+
"@tldraw/tlschema": "3.14.0-canary.d8a1c8c23469",
|
|
55
|
+
"@tldraw/utils": "3.14.0-canary.d8a1c8c23469",
|
|
56
|
+
"@tldraw/validate": "3.14.0-canary.d8a1c8c23469",
|
|
57
57
|
"@types/core-js": "^2.5.8",
|
|
58
58
|
"@use-gesture/react": "^10.3.1",
|
|
59
59
|
"classnames": "^2.5.1",
|
package/src/index.ts
CHANGED
|
@@ -185,7 +185,10 @@ export {
|
|
|
185
185
|
type TLShapeUtilConstructor,
|
|
186
186
|
} from './lib/editor/shapes/ShapeUtil'
|
|
187
187
|
export { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'
|
|
188
|
-
export {
|
|
188
|
+
export {
|
|
189
|
+
getPerfectDashProps,
|
|
190
|
+
type PerfectDashTerminal,
|
|
191
|
+
} from './lib/editor/shapes/shared/getPerfectDashProps'
|
|
189
192
|
export { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'
|
|
190
193
|
export { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'
|
|
191
194
|
export { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'
|
|
@@ -58,6 +58,8 @@ export class FocusManager {
|
|
|
58
58
|
|
|
59
59
|
private handleKeyDown(keyEvent: KeyboardEvent) {
|
|
60
60
|
const container = this.editor.getContainer()
|
|
61
|
+
if (this.editor.isIn('select.editing_shape')) return
|
|
62
|
+
if (document.activeElement === container && this.editor.getSelectedShapeIds().length > 0) return
|
|
61
63
|
if (['Tab', 'ArrowUp', 'ArrowDown'].includes(keyEvent.key)) {
|
|
62
64
|
container.classList.remove('tl-container__no-focus-ring')
|
|
63
65
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TLDefaultDashStyle } from '@tldraw/tlschema'
|
|
2
2
|
|
|
3
|
+
/** @public */
|
|
4
|
+
export type PerfectDashTerminal = 'skip' | 'outset' | 'none'
|
|
5
|
+
|
|
3
6
|
/** @public */
|
|
4
7
|
export function getPerfectDashProps(
|
|
5
8
|
totalLength: number,
|
|
@@ -7,8 +10,8 @@ export function getPerfectDashProps(
|
|
|
7
10
|
opts: {
|
|
8
11
|
style?: TLDefaultDashStyle
|
|
9
12
|
snap?: number
|
|
10
|
-
end?:
|
|
11
|
-
start?:
|
|
13
|
+
end?: PerfectDashTerminal
|
|
14
|
+
start?: PerfectDashTerminal
|
|
12
15
|
lengthRatio?: number
|
|
13
16
|
closed?: boolean
|
|
14
17
|
forceSolid?: boolean
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VecModel } from '@tldraw/tlschema'
|
|
2
2
|
import { EASINGS } from './easings'
|
|
3
|
-
import { toFixed } from './utils'
|
|
3
|
+
import { clamp, toFixed } from './utils'
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
6
|
export type VecLike = Vec | VecModel
|
|
@@ -487,7 +487,7 @@ export class Vec {
|
|
|
487
487
|
(Math.pow(A.x, 2) + Math.pow(A.y, 2)) * (Math.pow(B.x, 2) + Math.pow(B.y, 2))
|
|
488
488
|
)
|
|
489
489
|
const sign = A.x * B.y - A.y * B.x < 0 ? -1 : 1
|
|
490
|
-
const angle = sign * Math.acos(p / n)
|
|
490
|
+
const angle = sign * Math.acos(clamp(p / n, -1, 1))
|
|
491
491
|
|
|
492
492
|
return angle
|
|
493
493
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { linesIntersect } from '../intersect'
|
|
2
1
|
import { Vec, VecLike } from '../Vec'
|
|
3
2
|
import { Geometry2d } from './Geometry2d'
|
|
4
3
|
|
|
@@ -48,12 +47,6 @@ export class Edge2d extends Geometry2d {
|
|
|
48
47
|
return new Vec(cx, cy)
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
override hitTestLineSegment(A: VecLike, B: VecLike, distance = 0): boolean {
|
|
52
|
-
return (
|
|
53
|
-
linesIntersect(A, B, this.start, this.end) || this.distanceToLineSegment(A, B) <= distance
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
50
|
getSvgPathData(first = true) {
|
|
58
51
|
const { start, end } = this
|
|
59
52
|
return `${first ? `M${start.toFixed()}` : ``} L${end.toFixed()}`
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
intersectLineSegmentPolygon,
|
|
9
9
|
intersectLineSegmentPolyline,
|
|
10
10
|
intersectPolys,
|
|
11
|
+
linesIntersect,
|
|
11
12
|
} from '../intersect'
|
|
12
13
|
import { approximately, pointInPolygon } from '../utils'
|
|
13
14
|
|
|
@@ -107,8 +108,13 @@ export abstract class Geometry2d {
|
|
|
107
108
|
let nearest: Vec | undefined
|
|
108
109
|
let dist = Infinity
|
|
109
110
|
let d: number, p: Vec, q: Vec
|
|
111
|
+
const nextLimit = this.isClosed ? vertices.length : vertices.length - 1
|
|
110
112
|
for (let i = 0; i < vertices.length; i++) {
|
|
111
113
|
p = vertices[i]
|
|
114
|
+
if (i < nextLimit) {
|
|
115
|
+
const next = vertices[(i + 1) % vertices.length]
|
|
116
|
+
if (linesIntersect(A, B, p, next)) return 0
|
|
117
|
+
}
|
|
112
118
|
q = Vec.NearestPointOnLineSegment(A, B, p, true)
|
|
113
119
|
d = Vec.Dist2(p, q)
|
|
114
120
|
if (d < dist) {
|
package/src/version.ts
CHANGED
|
@@ -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.14.0-canary.
|
|
4
|
+
export const version = '3.14.0-canary.d8a1c8c23469'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-05-
|
|
8
|
-
patch: '2025-05-
|
|
7
|
+
minor: '2025-05-27T08:51:57.747Z',
|
|
8
|
+
patch: '2025-05-27T08:51:57.747Z',
|
|
9
9
|
}
|