@tldraw/editor 3.13.0-canary.712bc0b8b5bc → 3.13.0-canary.8b1562e59f12

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.
@@ -0,0 +1,5 @@
1
+ const areShapesContentEqual = (a, b) => a.props === b.props && a.meta === b.meta;
2
+ export {
3
+ areShapesContentEqual
4
+ };
5
+ //# sourceMappingURL=areShapesContentEqual.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/utils/areShapesContentEqual.ts"],
4
+ "sourcesContent": ["import { TLShape } from '@tldraw/tlschema'\n\nexport const areShapesContentEqual = (a: TLShape, b: TLShape) =>\n\ta.props === b.props && a.meta === b.meta\n"],
5
+ "mappings": "AAEO,MAAM,wBAAwB,CAAC,GAAY,MACjD,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE;",
6
+ "names": []
7
+ }
@@ -1,8 +1,8 @@
1
- const version = "3.13.0-canary.712bc0b8b5bc";
1
+ const version = "3.13.0-canary.8b1562e59f12";
2
2
  const publishDates = {
3
3
  major: "2024-09-13T14:36:29.063Z",
4
- minor: "2025-05-02T09:55:00.703Z",
5
- patch: "2025-05-02T09:55:00.703Z"
4
+ minor: "2025-05-05T15:52:26.021Z",
5
+ patch: "2025-05-05T15:52:26.021Z"
6
6
  };
7
7
  export {
8
8
  publishDates,
@@ -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.13.0-canary.712bc0b8b5bc'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-05-02T09:55:00.703Z',\n\tpatch: '2025-05-02T09:55:00.703Z',\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 = '3.13.0-canary.8b1562e59f12'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-05-05T15:52:26.021Z',\n\tpatch: '2025-05-05T15:52:26.021Z',\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.13.0-canary.712bc0b8b5bc",
4
+ "version": "3.13.0-canary.8b1562e59f12",
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.13.0-canary.712bc0b8b5bc",
52
- "@tldraw/state-react": "3.13.0-canary.712bc0b8b5bc",
53
- "@tldraw/store": "3.13.0-canary.712bc0b8b5bc",
54
- "@tldraw/tlschema": "3.13.0-canary.712bc0b8b5bc",
55
- "@tldraw/utils": "3.13.0-canary.712bc0b8b5bc",
56
- "@tldraw/validate": "3.13.0-canary.712bc0b8b5bc",
51
+ "@tldraw/state": "3.13.0-canary.8b1562e59f12",
52
+ "@tldraw/state-react": "3.13.0-canary.8b1562e59f12",
53
+ "@tldraw/store": "3.13.0-canary.8b1562e59f12",
54
+ "@tldraw/tlschema": "3.13.0-canary.8b1562e59f12",
55
+ "@tldraw/utils": "3.13.0-canary.8b1562e59f12",
56
+ "@tldraw/validate": "3.13.0-canary.8b1562e59f12",
57
57
  "@types/core-js": "^2.5.8",
58
58
  "@use-gesture/react": "^10.3.1",
59
59
  "classnames": "^2.5.1",
@@ -6,6 +6,7 @@ import { ShapeUtil } from '../editor/shapes/ShapeUtil'
6
6
  import { useEditor } from '../hooks/useEditor'
7
7
  import { useEditorComponents } from '../hooks/useEditorComponents'
8
8
  import { Mat } from '../primitives/Mat'
9
+ import { areShapesContentEqual } from '../utils/areShapesContentEqual'
9
10
  import { setStyleProperty } from '../utils/dom'
10
11
  import { OptionalErrorBoundary } from './ErrorBoundary'
11
12
 
@@ -190,10 +191,7 @@ export const InnerShape = memo(
190
191
  [util, shape.id]
191
192
  )
192
193
  },
193
- (prev, next) =>
194
- prev.shape.props === next.shape.props &&
195
- prev.shape.meta === next.shape.meta &&
196
- prev.util === next.util
194
+ (prev, next) => areShapesContentEqual(prev.shape, next.shape) && prev.util === next.util
197
195
  )
198
196
 
199
197
  export const InnerShapeBackground = memo(
@@ -9,13 +9,21 @@ import { useEditorComponents } from '../../hooks/useEditorComponents'
9
9
  import { OptionalErrorBoundary } from '../ErrorBoundary'
10
10
 
11
11
  // need an extra layer of indirection here to allow hooks to be used inside the indicator render
12
- const EvenInnererIndicator = memo(({ shape, util }: { shape: TLShape; util: ShapeUtil<any> }) => {
13
- return useStateTracking('Indicator: ' + shape.type, () =>
14
- // always fetch the latest shape from the store even if the props/meta have not changed, to avoid
15
- // calling the render method with stale data.
16
- util.indicator(util.editor.store.unsafeGetWithoutCapture(shape.id) as TLShape)
17
- )
18
- })
12
+ const EvenInnererIndicator = memo(
13
+ ({ shape, util }: { shape: TLShape; util: ShapeUtil<any> }) => {
14
+ return useStateTracking('Indicator: ' + shape.type, () =>
15
+ // always fetch the latest shape from the store even if the props/meta have not changed, to avoid
16
+ // calling the render method with stale data.
17
+ util.indicator(util.editor.store.unsafeGetWithoutCapture(shape.id) as TLShape)
18
+ )
19
+ },
20
+ (prevProps, nextProps) => {
21
+ return (
22
+ prevProps.shape.props === nextProps.shape.props &&
23
+ prevProps.shape.meta === nextProps.shape.meta
24
+ )
25
+ }
26
+ )
19
27
 
20
28
  const InnerIndicator = memo(({ editor, id }: { editor: Editor; id: TLShapeId }) => {
21
29
  const shape = useValue('shape for indicator', () => editor.store.get(id), [editor, id])
@@ -61,13 +69,14 @@ export const DefaultShapeIndicator = memo(function DefaultShapeIndicator({
61
69
  useQuickReactor(
62
70
  'indicator transform',
63
71
  () => {
72
+ if (hidden) return
64
73
  const elm = rIndicator.current
65
74
  if (!elm) return
66
75
  const pageTransform = editor.getShapePageTransform(shapeId)
67
76
  if (!pageTransform) return
68
77
  elm.style.setProperty('transform', pageTransform.toCssString())
69
78
  },
70
- [editor, shapeId]
79
+ [editor, shapeId, hidden]
71
80
  )
72
81
 
73
82
  useLayoutEffect(() => {
@@ -129,6 +129,7 @@ import { Group2d } from '../primitives/geometry/Group2d'
129
129
  import { intersectPolygonPolygon } from '../primitives/intersect'
130
130
  import { PI, approximately, areAnglesCompatible, clamp, pointInPolygon } from '../primitives/utils'
131
131
  import { ReadonlySharedStyleMap, SharedStyle, SharedStyleMap } from '../utils/SharedStylesMap'
132
+ import { areShapesContentEqual } from '../utils/areShapesContentEqual'
132
133
  import { dataUrlToFile } from '../utils/assets'
133
134
  import { debugFlags } from '../utils/debug-flags'
134
135
  import {
@@ -4574,7 +4575,7 @@ export class Editor extends EventEmitter<TLEventMap> {
4574
4575
  this.fonts.trackFontsForShape(shape)
4575
4576
  return this.getShapeUtil(shape).getGeometry(shape, opts)
4576
4577
  },
4577
- { areRecordsEqual: (a, b) => a.props === b.props }
4578
+ { areRecordsEqual: areShapesContentEqual }
4578
4579
  )
4579
4580
  }
4580
4581
  return this._shapeGeometryCaches[context].get(
@@ -4622,9 +4623,15 @@ export class Editor extends EventEmitter<TLEventMap> {
4622
4623
 
4623
4624
  /** @internal */
4624
4625
  @computed private _getShapeHandlesCache(): ComputedCache<TLHandle[] | undefined, TLShape> {
4625
- return this.store.createComputedCache('handles', (shape) => {
4626
- return this.getShapeUtil(shape).getHandles?.(shape)
4627
- })
4626
+ return this.store.createComputedCache(
4627
+ 'handles',
4628
+ (shape) => {
4629
+ return this.getShapeUtil(shape).getHandles?.(shape)
4630
+ },
4631
+ {
4632
+ areRecordsEqual: areShapesContentEqual,
4633
+ }
4634
+ )
4628
4635
  }
4629
4636
 
4630
4637
  /**
@@ -5845,9 +5852,15 @@ export class Editor extends EventEmitter<TLEventMap> {
5845
5852
  @computed
5846
5853
  private _getBindingsIndexCache() {
5847
5854
  const index = bindingsIndex(this)
5848
- return this.store.createComputedCache<TLBinding[], TLShape>('bindingsIndex', (shape) => {
5849
- return index.get().get(shape.id)
5850
- })
5855
+ return this.store.createComputedCache<TLBinding[], TLShape>(
5856
+ 'bindingsIndex',
5857
+ (shape) => {
5858
+ return index.get().get(shape.id)
5859
+ },
5860
+ // we can ignore the shape equality check here because the index is
5861
+ // computed incrementally based on what bindings are in the store
5862
+ { areRecordsEqual: () => true }
5863
+ )
5851
5864
  }
5852
5865
 
5853
5866
  /**
@@ -0,0 +1,4 @@
1
+ import { TLShape } from '@tldraw/tlschema'
2
+
3
+ export const areShapesContentEqual = (a: TLShape, b: TLShape) =>
4
+ a.props === b.props && a.meta === b.meta
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.13.0-canary.712bc0b8b5bc'
4
+ export const version = '3.13.0-canary.8b1562e59f12'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-05-02T09:55:00.703Z',
8
- patch: '2025-05-02T09:55:00.703Z',
7
+ minor: '2025-05-05T15:52:26.021Z',
8
+ patch: '2025-05-05T15:52:26.021Z',
9
9
  }