@tldraw/editor 3.15.0-next.39f008bfb627 → 3.15.0-next.f1dfcef63951

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 (46) hide show
  1. package/dist-cjs/index.d.ts +40 -42
  2. package/dist-cjs/index.js +16 -16
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/config/TLUserPreferences.js +1 -7
  5. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  6. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +101 -96
  7. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  8. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +2 -7
  9. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  10. package/dist-cjs/lib/primitives/intersect.js +4 -4
  11. package/dist-cjs/lib/primitives/intersect.js.map +2 -2
  12. package/dist-cjs/lib/primitives/utils.js +0 -4
  13. package/dist-cjs/lib/primitives/utils.js.map +2 -2
  14. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +1 -0
  15. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
  16. package/dist-cjs/version.js +3 -3
  17. package/dist-cjs/version.js.map +1 -1
  18. package/dist-esm/index.d.mts +40 -42
  19. package/dist-esm/index.mjs +41 -41
  20. package/dist-esm/index.mjs.map +2 -2
  21. package/dist-esm/lib/config/TLUserPreferences.mjs +1 -7
  22. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  23. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +101 -96
  24. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  25. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +2 -7
  26. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  27. package/dist-esm/lib/primitives/intersect.mjs +5 -5
  28. package/dist-esm/lib/primitives/intersect.mjs.map +2 -2
  29. package/dist-esm/lib/primitives/utils.mjs +0 -4
  30. package/dist-esm/lib/primitives/utils.mjs.map +2 -2
  31. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +1 -0
  32. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
  33. package/dist-esm/version.mjs +3 -3
  34. package/dist-esm/version.mjs.map +1 -1
  35. package/package.json +7 -7
  36. package/src/index.ts +62 -62
  37. package/src/lib/config/TLUserPreferences.ts +0 -7
  38. package/src/lib/editor/managers/TextManager/TextManager.ts +128 -108
  39. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +0 -21
  40. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +0 -8
  41. package/src/lib/license/LicenseManager.test.ts +1 -1
  42. package/src/lib/primitives/intersect.ts +5 -12
  43. package/src/lib/primitives/utils.ts +0 -11
  44. package/src/lib/utils/sync/TLLocalSyncClient.ts +1 -0
  45. package/src/version.ts +3 -3
  46. package/src/lib/primitives/intersect.test.ts +0 -946
@@ -1,5 +1,5 @@
1
1
  import { Box } from './Box'
2
- import { approximately, approximatelyLte, pointInPolygon } from './utils'
2
+ import { pointInPolygon } from './utils'
3
3
  import { Vec, VecLike } from './Vec'
4
4
 
5
5
  // need even more intersections? See https://gist.github.com/steveruizok/35c02d526c707003a5c79761bfb89a52
@@ -17,8 +17,7 @@ export function intersectLineSegmentLineSegment(
17
17
  a1: VecLike,
18
18
  a2: VecLike,
19
19
  b1: VecLike,
20
- b2: VecLike,
21
- precision = 1e-10
20
+ b2: VecLike
22
21
  ) {
23
22
  const ABx = a1.x - b1.x
24
23
  const ABy = a1.y - b1.y
@@ -30,19 +29,14 @@ export function intersectLineSegmentLineSegment(
30
29
  const ub_t = AVx * ABy - AVy * ABx
31
30
  const u_b = BVy * AVx - BVx * AVy
32
31
 
33
- if (approximately(ua_t, 0, precision) || approximately(ub_t, 0, precision)) return null // coincident
32
+ if (ua_t === 0 || ub_t === 0) return null // coincident
34
33
 
35
- if (approximately(u_b, 0, precision)) return null // parallel
34
+ if (u_b === 0) return null // parallel
36
35
 
37
36
  if (u_b !== 0) {
38
37
  const ua = ua_t / u_b
39
38
  const ub = ub_t / u_b
40
- if (
41
- approximatelyLte(0, ua, precision) &&
42
- approximatelyLte(ua, 1, precision) &&
43
- approximatelyLte(0, ub, precision) &&
44
- approximatelyLte(ub, 1, precision)
45
- ) {
39
+ if (0 <= ua && ua <= 1 && 0 <= ub && ub <= 1) {
46
40
  return Vec.AddXY(a1, ua * AVx, ua * AVy)
47
41
  }
48
42
  }
@@ -131,7 +125,6 @@ export function intersectLineSegmentPolygon(a1: VecLike, a2: VecLike, points: Ve
131
125
  points[i - 1],
132
126
  points[i % points.length]
133
127
  )
134
-
135
128
  if (segmentIntersection) result.push(segmentIntersection)
136
129
  }
137
130
 
@@ -77,17 +77,6 @@ export function approximately(a: number, b: number, precision = 0.000001) {
77
77
  return Math.abs(a - b) <= precision
78
78
  }
79
79
 
80
- /**
81
- * Whether a number is approximately less than or equal to another number.
82
- *
83
- * @param a - The first number.
84
- * @param b - The second number.
85
- * @public
86
- */
87
- export function approximatelyLte(a: number, b: number, precision = 0.000001) {
88
- return a < b || approximately(a, b, precision)
89
- }
90
-
91
80
  /**
92
81
  * Find the approximate perimeter of an ellipse.
93
82
  *
@@ -266,6 +266,7 @@ export class TLLocalSyncClient {
266
266
 
267
267
  private isPersisting = false
268
268
  private didLastWriteError = false
269
+ // eslint-disable-next-line no-restricted-globals
269
270
  private scheduledPersistTimeout: ReturnType<typeof setTimeout> | null = null
270
271
 
271
272
  /**
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.15.0-next.39f008bfb627'
4
+ export const version = '3.15.0-next.f1dfcef63951'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-07-10T06:54:15.368Z',
8
- patch: '2025-07-10T06:54:15.368Z',
7
+ minor: '2025-07-03T10:22:18.515Z',
8
+ patch: '2025-07-03T10:22:18.515Z',
9
9
  }