@tldraw/editor 4.3.0-canary.da35795ba8e2 → 4.3.0-canary.e1766dd4eab3

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 (89) hide show
  1. package/dist-cjs/index.d.ts +111 -37
  2. package/dist-cjs/index.js +2 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +3 -3
  5. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  6. package/dist-cjs/lib/editor/Editor.js +47 -15
  7. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  8. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
  9. package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
  10. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  11. package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
  12. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  13. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js +1 -1
  14. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js.map +2 -2
  15. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  16. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.js.map +2 -2
  17. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
  18. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  19. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  20. package/dist-cjs/lib/globals/environment.js +45 -9
  21. package/dist-cjs/lib/globals/environment.js.map +2 -2
  22. package/dist-cjs/lib/globals/menus.js +1 -1
  23. package/dist-cjs/lib/globals/menus.js.map +2 -2
  24. package/dist-cjs/lib/hooks/useCoarsePointer.js +14 -29
  25. package/dist-cjs/lib/hooks/useCoarsePointer.js.map +2 -2
  26. package/dist-cjs/lib/hooks/useZoomCss.js +4 -8
  27. package/dist-cjs/lib/hooks/useZoomCss.js.map +2 -2
  28. package/dist-cjs/lib/options.js +3 -1
  29. package/dist-cjs/lib/options.js.map +2 -2
  30. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  31. package/dist-cjs/version.js +3 -3
  32. package/dist-cjs/version.js.map +1 -1
  33. package/dist-esm/index.d.mts +111 -37
  34. package/dist-esm/index.mjs +3 -2
  35. package/dist-esm/index.mjs.map +2 -2
  36. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +3 -3
  37. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  38. package/dist-esm/lib/editor/Editor.mjs +47 -15
  39. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  40. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
  41. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
  42. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  43. package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
  44. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  45. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs +1 -1
  46. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs.map +2 -2
  47. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  48. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs.map +2 -2
  49. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
  50. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  51. package/dist-esm/lib/globals/environment.mjs +45 -9
  52. package/dist-esm/lib/globals/environment.mjs.map +2 -2
  53. package/dist-esm/lib/globals/menus.mjs +1 -1
  54. package/dist-esm/lib/globals/menus.mjs.map +2 -2
  55. package/dist-esm/lib/hooks/useCoarsePointer.mjs +15 -30
  56. package/dist-esm/lib/hooks/useCoarsePointer.mjs.map +2 -2
  57. package/dist-esm/lib/hooks/useZoomCss.mjs +4 -8
  58. package/dist-esm/lib/hooks/useZoomCss.mjs.map +2 -2
  59. package/dist-esm/lib/options.mjs +3 -1
  60. package/dist-esm/lib/options.mjs.map +2 -2
  61. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  62. package/dist-esm/version.mjs +3 -3
  63. package/dist-esm/version.mjs.map +1 -1
  64. package/editor.css +8 -4
  65. package/package.json +10 -10
  66. package/src/index.ts +1 -1
  67. package/src/lib/components/default-components/DefaultCanvas.tsx +4 -3
  68. package/src/lib/editor/Editor.test.ts +10 -10
  69. package/src/lib/editor/Editor.ts +159 -63
  70. package/src/lib/editor/bindings/BindingUtil.ts +15 -9
  71. package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
  72. package/src/lib/editor/managers/FontManager/FontManager.test.ts +14 -4
  73. package/src/lib/editor/managers/SnapManager/SnapManager.ts +3 -3
  74. package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
  75. package/src/lib/editor/shapes/ShapeUtil.ts +5 -8
  76. package/src/lib/editor/shapes/group/DashedOutlineBox.tsx +1 -1
  77. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -3
  78. package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
  79. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
  80. package/src/lib/editor/types/emit-types.ts +3 -1
  81. package/src/lib/exports/getSvgJsx.test.ts +10 -19
  82. package/src/lib/exports/getSvgJsx.tsx +2 -5
  83. package/src/lib/globals/environment.ts +65 -10
  84. package/src/lib/globals/menus.ts +1 -1
  85. package/src/lib/hooks/useCoarsePointer.ts +16 -59
  86. package/src/lib/hooks/useZoomCss.ts +3 -8
  87. package/src/lib/options.ts +13 -0
  88. package/src/lib/utils/reparenting.ts +5 -5
  89. package/src/version.ts +3 -3
@@ -7,6 +7,7 @@ import { Editor as Editor_2 } from '@tiptap/core';
7
7
  import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
8
8
  import EventEmitter from 'eventemitter3';
9
9
  import { ExoticComponent } from 'react';
10
+ import { ExtractShapeByProps } from '@tldraw/tlschema';
10
11
  import { ForwardRefExoticComponent } from 'react';
11
12
  import { HistoryEntry } from '@tldraw/store';
12
13
  import { IndexKey } from '@tldraw/utils';
@@ -48,6 +49,7 @@ import { TLBindingId } from '@tldraw/tlschema';
48
49
  import { TLBindingUpdate } from '@tldraw/tlschema';
49
50
  import { TLBookmarkAsset } from '@tldraw/tlschema';
50
51
  import { TLCamera } from '@tldraw/tlschema';
52
+ import { TLCreateShapePartial } from '@tldraw/tlschema';
51
53
  import { TLCursor } from '@tldraw/tlschema';
52
54
  import { TLCursorType } from '@tldraw/tlschema';
53
55
  import { TLDefaultDashStyle } from '@tldraw/tlschema';
@@ -147,7 +149,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
147
149
  static id: string;
148
150
  static initial: string;
149
151
  static children(): TLStateNodeConstructor[];
150
- abstract shapeType: string;
152
+ abstract shapeType: TLBaseBoxShape['type'];
151
153
  onCreate?(_shape: null | TLShape): null | void;
152
154
  }
153
155
 
@@ -165,7 +167,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
165
167
  *
166
168
  * @public
167
169
  */
168
- export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding> {
170
+ export declare interface BindingOnChangeOptions<Binding extends TLBinding = TLBinding> {
169
171
  /** The binding record before the change is made. */
170
172
  bindingBefore: Binding;
171
173
  /** The binding record after the change is made. */
@@ -178,7 +180,7 @@ export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding
178
180
  *
179
181
  * @public
180
182
  */
181
- export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding> {
183
+ export declare interface BindingOnCreateOptions<Binding extends TLBinding = TLBinding> {
182
184
  /** The binding being created. */
183
185
  binding: Binding;
184
186
  }
@@ -189,7 +191,7 @@ export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding
189
191
  *
190
192
  * @public
191
193
  */
192
- export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding> {
194
+ export declare interface BindingOnDeleteOptions<Binding extends TLBinding = TLBinding> {
193
195
  /** The binding being deleted. */
194
196
  binding: Binding;
195
197
  }
@@ -200,7 +202,7 @@ export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding
200
202
  *
201
203
  * @public
202
204
  */
203
- export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBinding> {
205
+ export declare interface BindingOnShapeChangeOptions<Binding extends TLBinding = TLBinding> {
204
206
  /** The binding record linking these two shapes. */
205
207
  binding: Binding;
206
208
  /** The shape record before the change is made. */
@@ -224,7 +226,7 @@ export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBi
224
226
  *
225
227
  * @public
226
228
  */
227
- export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBinding> {
229
+ export declare interface BindingOnShapeDeleteOptions<Binding extends TLBinding = TLBinding> {
228
230
  /** The binding record that refers to the shape in question. */
229
231
  binding: Binding;
230
232
  /** The shape that is about to be deleted. */
@@ -256,7 +258,7 @@ export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBi
256
258
  *
257
259
  * @public
258
260
  */
259
- export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownBinding> {
261
+ export declare interface BindingOnShapeIsolateOptions<Binding extends TLBinding = TLBinding> {
260
262
  /** The binding record that refers to the shape in question. */
261
263
  binding: Binding;
262
264
  /**
@@ -267,7 +269,7 @@ export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownB
267
269
  }
268
270
 
269
271
  /** @public */
270
- export declare abstract class BindingUtil<Binding extends TLUnknownBinding = TLUnknownBinding> {
272
+ export declare abstract class BindingUtil<Binding extends TLBinding = TLBinding> {
271
273
  editor: Editor;
272
274
  constructor(editor: Editor);
273
275
  static props?: RecordProps<TLUnknownBinding>;
@@ -861,6 +863,8 @@ export declare const defaultTldrawOptions: {
861
863
  readonly collaboratorIdleTimeoutMs: 3000;
862
864
  readonly collaboratorInactiveTimeoutMs: 60000;
863
865
  readonly createTextOnCanvasDoubleClick: true;
866
+ readonly debouncedZoom: true;
867
+ readonly debouncedZoomThreshold: 500;
864
868
  readonly defaultSvgPadding: 32;
865
869
  readonly doubleClickDurationMs: 450;
866
870
  readonly dragDistanceSquared: 16;
@@ -1129,7 +1133,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1129
1133
  * @public
1130
1134
  */
1131
1135
  shapeUtils: {
1132
- readonly [K in string]?: ShapeUtil<TLUnknownShape>;
1136
+ readonly [K in string]?: ShapeUtil<TLShape>;
1133
1137
  };
1134
1138
  styleProps: {
1135
1139
  [key: string]: Map<StyleProp<any>, string>;
@@ -1149,16 +1153,18 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1149
1153
  *
1150
1154
  * @public
1151
1155
  */
1152
- getShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): ShapeUtil<S>;
1153
- getShapeUtil<S extends TLUnknownShape>(type: S['type']): ShapeUtil<S>;
1156
+ getShapeUtil<K extends TLShape['type']>(type: K): ShapeUtil<Extract<TLShape, {
1157
+ type: K;
1158
+ }>>;
1159
+ getShapeUtil<S extends TLShape>(shape: S | S['type'] | TLShapePartial<S>): ShapeUtil<S>;
1154
1160
  getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
1155
1161
  /**
1156
1162
  * Returns true if the editor has a shape util for the given shape / shape type.
1157
1163
  *
1158
1164
  * @param shape - A shape, shape partial, or shape type.
1159
1165
  */
1160
- hasShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): boolean;
1161
- hasShapeUtil<S extends TLUnknownShape>(type: S['type']): boolean;
1166
+ hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
1167
+ hasShapeUtil(type: TLShape['type']): boolean;
1162
1168
  hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
1163
1169
  /**
1164
1170
  * A map of shape utility classes (TLShapeUtils) by shape type.
@@ -1166,7 +1172,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1166
1172
  * @public
1167
1173
  */
1168
1174
  bindingUtils: {
1169
- readonly [K in string]?: BindingUtil<TLUnknownBinding>;
1175
+ readonly [K in string]?: BindingUtil<TLBinding>;
1170
1176
  };
1171
1177
  /**
1172
1178
  * Get a binding util from a binding itself.
@@ -1183,10 +1189,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1183
1189
  *
1184
1190
  * @public
1185
1191
  */
1186
- getBindingUtil<S extends TLUnknownBinding>(binding: {
1192
+ getBindingUtil<K extends TLBinding['type']>(type: K): BindingUtil<Extract<TLBinding, {
1193
+ type: K;
1194
+ }>>;
1195
+ getBindingUtil<S extends TLBinding>(binding: {
1187
1196
  type: S['type'];
1188
1197
  } | S): BindingUtil<S>;
1189
- getBindingUtil<S extends TLUnknownBinding>(type: S['type']): BindingUtil<S>;
1190
1198
  getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
1191
1199
  /**
1192
1200
  * A manager for the app's history.
@@ -1849,6 +1857,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1849
1857
  * @public
1850
1858
  */
1851
1859
  getZoomLevel(): number;
1860
+ private _debouncedZoomLevel;
1861
+ /**
1862
+ * Get the debounced zoom level. When the camera is moving, this returns the zoom level
1863
+ * from when the camera started moving rather than the current zoom level. This can be
1864
+ * used to avoid expensive re-renders during camera movements.
1865
+ *
1866
+ * This behavior is controlled by the `useDebouncedZoom` option. When `useDebouncedZoom`
1867
+ * is `false`, this method always returns the current zoom level.
1868
+ *
1869
+ * @public
1870
+ */
1871
+ getDebouncedZoomLevel(): number;
1872
+ private _getAboveDebouncedZoomThreshold;
1873
+ /**
1874
+ * Get the efficient zoom level. This returns the current zoom level if there are less than 300 shapes on the page,
1875
+ * otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
1876
+ *
1877
+ * @public
1878
+ * @example
1879
+ * ```ts
1880
+ * editor.getEfficientZoomLevel()
1881
+ * ```
1882
+ *
1883
+ * @public
1884
+ */
1885
+ getEfficientZoomLevel(): number;
1852
1886
  /**
1853
1887
  * Get the camera's initial or reset zoom level.
1854
1888
  *
@@ -2192,8 +2226,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2192
2226
  /* Excluded from this release type: getUnorderedRenderingShapes */
2193
2227
  private _cameraState;
2194
2228
  private _cameraStateTimeoutRemaining;
2195
- _decayCameraStateTimeout(elapsed: number): void;
2196
- _tickCameraState(): void;
2229
+ private _decayCameraStateTimeout;
2230
+ private _tickCameraState;
2197
2231
  /**
2198
2232
  * Whether the camera is moving or idle.
2199
2233
  *
@@ -2765,7 +2799,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2765
2799
  *
2766
2800
  * @example
2767
2801
  * ```ts
2768
- * const isArrowShape = isShapeOfType<TLArrowShape>(someShape, 'arrow')
2802
+ * const isArrowShape = isShapeOfType(someShape, 'arrow')
2769
2803
  * ```
2770
2804
  *
2771
2805
  * @param util - the TLShapeUtil constructor to test against
@@ -2773,8 +2807,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2773
2807
  *
2774
2808
  * @public
2775
2809
  */
2776
- isShapeOfType<T extends TLUnknownShape>(shape: TLUnknownShape, type: T['type']): shape is T;
2777
- isShapeOfType<T extends TLUnknownShape>(shapeId: TLUnknownShape['id'], type: T['type']): shapeId is T['id'];
2810
+ isShapeOfType<K extends TLShape['type']>(shape: TLShape, type: K): shape is Extract<TLShape, {
2811
+ type: K;
2812
+ }>;
2813
+ isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is Extract<TLShape, {
2814
+ type: T['type'];
2815
+ }>;
2816
+ isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
2778
2817
  /**
2779
2818
  * Get a shape by its id.
2780
2819
  *
@@ -2925,17 +2964,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2925
2964
  * Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
2926
2965
  * `fromId` matched the shape's ID.
2927
2966
  */
2928
- getBindingsFromShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2967
+ getBindingsFromShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
2968
+ type: K;
2969
+ }>[];
2970
+ getBindingsFromShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2929
2971
  /**
2930
2972
  * Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
2931
2973
  * `toId` matches the shape's ID.
2932
2974
  */
2933
- getBindingsToShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2975
+ getBindingsToShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
2976
+ type: K;
2977
+ }>[];
2978
+ getBindingsToShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
2934
2979
  /**
2935
2980
  * Get all bindings involving a particular shape. This includes bindings where the shape is the
2936
2981
  * `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
2937
2982
  */
2938
- getBindingsInvolvingShape<Binding extends TLUnknownBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
2983
+ getBindingsInvolvingShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
2984
+ type: K;
2985
+ }>[];
2986
+ getBindingsInvolvingShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
2939
2987
  /**
2940
2988
  * Create bindings from a list of partial bindings. You can omit the ID and most props of a
2941
2989
  * binding, but the `type`, `toId`, and `fromId` must all be provided.
@@ -3250,7 +3298,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3250
3298
  *
3251
3299
  * @public
3252
3300
  */
3253
- canCreateShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'> | T['id']): boolean;
3301
+ canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
3254
3302
  /**
3255
3303
  * Get whether the provided shapes can be created.
3256
3304
  *
@@ -3258,7 +3306,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3258
3306
  *
3259
3307
  * @public
3260
3308
  */
3261
- canCreateShapes<T extends TLUnknownShape>(shapes: (OptionalKeys<TLShapePartial<T>, 'id'> | T['id'])[]): boolean;
3309
+ canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
3262
3310
  /**
3263
3311
  * Create a single shape.
3264
3312
  *
@@ -3272,7 +3320,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3272
3320
  *
3273
3321
  * @public
3274
3322
  */
3275
- createShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'>): this;
3323
+ createShape<TShape extends TLShape>(shape: TLCreateShapePartial<TShape>): this;
3276
3324
  /**
3277
3325
  * Create shapes.
3278
3326
  *
@@ -3286,7 +3334,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3286
3334
  *
3287
3335
  * @public
3288
3336
  */
3289
- createShapes<T extends TLUnknownShape>(shapes: OptionalKeys<TLShapePartial<T>, 'id'>[]): this;
3337
+ createShapes<TShape extends TLShape = TLShape>(shapes: TLCreateShapePartial<TShape>[]): this;
3290
3338
  private animatingShapes;
3291
3339
  /**
3292
3340
  * Animate a shape.
@@ -3372,7 +3420,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3372
3420
  *
3373
3421
  * @public
3374
3422
  */
3375
- updateShape<T extends TLUnknownShape>(partial: null | TLShapePartial<T> | undefined): this;
3423
+ updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
3376
3424
  /**
3377
3425
  * Update shapes using partials of each shape.
3378
3426
  *
@@ -3385,7 +3433,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3385
3433
  *
3386
3434
  * @public
3387
3435
  */
3388
- updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3436
+ updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3389
3437
  /* Excluded from this release type: _updateShapes */
3390
3438
  /* Excluded from this release type: _getUnlockedShapeIds */
3391
3439
  /**
@@ -5116,7 +5164,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
5116
5164
  export declare function setUserPreferences(user: TLUserPreferences): void;
5117
5165
 
5118
5166
  /** @public */
5119
- export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
5167
+ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5120
5168
  editor: Editor;
5121
5169
  /** Configure this shape utils {@link ShapeUtil.options | `options`}. */
5122
5170
  static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
@@ -6041,7 +6089,7 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
6041
6089
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
6042
6090
 
6043
6091
  /** @public */
6044
- export declare type TLBaseBoxShape = TLBaseShape<string, {
6092
+ export declare type TLBaseBoxShape = ExtractShapeByProps<{
6045
6093
  h: number;
6046
6094
  w: number;
6047
6095
  }>;
@@ -6063,7 +6111,7 @@ export declare interface TLBaseExternalContent {
6063
6111
  }
6064
6112
 
6065
6113
  /** @public */
6066
- export declare interface TLBindingUtilConstructor<T extends TLUnknownBinding, U extends BindingUtil<T> = BindingUtil<T>> {
6114
+ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends BindingUtil<T> = BindingUtil<T>> {
6067
6115
  new (editor: Editor): U;
6068
6116
  type: T['type'];
6069
6117
  /** Validations for this binding's props. */
@@ -6569,6 +6617,17 @@ export declare interface TldrawOptions {
6569
6617
  * Branding name of the app, currently only used for adding aria-label for the application.
6570
6618
  */
6571
6619
  readonly branding?: string;
6620
+ /**
6621
+ * Whether to use debounced zoom level for certain rendering optimizations. When true,
6622
+ * `editor.getDebouncedZoomLevel()` returns a cached zoom value while the camera is moving,
6623
+ * reducing re-renders. When false, it always returns the current zoom level.
6624
+ */
6625
+ readonly debouncedZoom: boolean;
6626
+ /**
6627
+ * The number of shapes that must be on the page for the debounced zoom level to be used.
6628
+ * Defaults to 300 shapes.
6629
+ */
6630
+ readonly debouncedZoomThreshold: number;
6572
6631
  }
6573
6632
 
6574
6633
  /** @public */
@@ -6705,6 +6764,8 @@ export declare type TLEnterEventHandler = (info: any, from: string) => void;
6705
6764
 
6706
6765
  /**
6707
6766
  * An object that contains information about the current device and environment.
6767
+ * This object is not reactive and will not update automatically when the environment changes,
6768
+ * so only include values that are fixed, such as the user's browser and operating system.
6708
6769
  *
6709
6770
  * @public
6710
6771
  */
@@ -6719,6 +6780,17 @@ export declare const tlenv: {
6719
6780
  isWebview: boolean;
6720
6781
  };
6721
6782
 
6783
+ /**
6784
+ * An atom that contains information about the current device and environment.
6785
+ * This object is reactive and will update automatically when the environment changes.
6786
+ * Use it for values that may change over time, such as the pointer type.
6787
+ *
6788
+ * @public
6789
+ */
6790
+ export declare const tlenvReactive: Atom< {
6791
+ isCoarsePointer: boolean;
6792
+ }, unknown>;
6793
+
6722
6794
  /** @public */
6723
6795
  export declare interface TLErrorBoundaryProps {
6724
6796
  children: React_2.ReactNode;
@@ -6782,6 +6854,7 @@ export declare interface TLEventMap {
6782
6854
  event: [TLEventInfo];
6783
6855
  tick: [number];
6784
6856
  frame: [number];
6857
+ resize: [BoxModel];
6785
6858
  'select-all-text': [{
6786
6859
  shapeId: TLShapeId;
6787
6860
  }];
@@ -6796,6 +6869,7 @@ export declare interface TLEventMap {
6796
6869
  'edited-shapes': [TLRecord[]];
6797
6870
  'deleted-shapes': [TLShapeId[]];
6798
6871
  edit: [];
6872
+ dispose: [];
6799
6873
  }
6800
6874
 
6801
6875
  /** @public */
@@ -7497,11 +7571,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
7497
7571
  *
7498
7572
  * @public
7499
7573
  */
7500
- export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
7574
+ export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
7501
7575
  /** The type of shape referenced by the `fromId` of the binding. */
7502
- fromShapeType: string;
7576
+ fromShapeType: TLShape['type'];
7503
7577
  /** The type of shape referenced by the `toId` of the binding. */
7504
- toShapeType: string;
7578
+ toShapeType: TLShape['type'];
7505
7579
  /** The type of binding. */
7506
7580
  bindingType: string;
7507
7581
  }
@@ -7513,7 +7587,7 @@ export declare interface TLShapeUtilCanvasSvgDef {
7513
7587
  }
7514
7588
 
7515
7589
  /** @public */
7516
- export declare interface TLShapeUtilConstructor<T extends TLUnknownShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7590
+ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7517
7591
  new (editor: Editor): U;
7518
7592
  type: T['type'];
7519
7593
  props?: RecordProps<T>;
package/dist-cjs/index.js CHANGED
@@ -194,6 +194,7 @@ __export(index_exports, {
194
194
  stopEventPropagation: () => import_dom.stopEventPropagation,
195
195
  suffixSafeId: () => import_useSafeId.suffixSafeId,
196
196
  tlenv: () => import_environment.tlenv,
197
+ tlenvReactive: () => import_environment.tlenvReactive,
197
198
  tlmenus: () => import_menus.tlmenus,
198
199
  tltime: () => import_time.tltime,
199
200
  toDomPrecision: () => import_utils2.toDomPrecision,
@@ -370,7 +371,7 @@ var import_uniq = require("./lib/utils/uniq");
370
371
  var import_window_open = require("./lib/utils/window-open");
371
372
  (0, import_utils.registerTldrawLibraryVersion)(
372
373
  "@tldraw/editor",
373
- "4.3.0-canary.da35795ba8e2",
374
+ "4.3.0-canary.e1766dd4eab3",
374
375
  "cjs"
375
376
  );
376
377
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRAR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C7B,2BAA8B;AAC9B,2CAA8C;AAC9C,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,gCAAmC;AACnC,wBAAiD;AACjD,0BAA6B;AAC7B,+BAAkC;AAClC,4BAQO;AACP,6BAAgC;AAChC,qBAAyD;AACzD,iBASO;AACP,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,gCAA6C;AAC7C,wBAMO;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAC,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAOO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AACrB,yBAA2B;AAAA,IAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAOO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AACrB,yBAA2B;AAAA,IAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_at", "import_utils"]
7
7
  }
@@ -201,7 +201,7 @@ function GridWrapper() {
201
201
  function ScribbleWrapper() {
202
202
  const editor = (0, import_useEditor.useEditor)();
203
203
  const scribbles = (0, import_state_react.useValue)("scribbles", () => editor.getInstanceState().scribbles, [editor]);
204
- const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getZoomLevel(), [editor]);
204
+ const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getEfficientZoomLevel(), [editor]);
205
205
  const { Scribble } = (0, import_useEditorComponents.useEditorComponents)();
206
206
  if (!(Scribble && scribbles.length)) return null;
207
207
  return scribbles.map((scribble) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Scribble, { className: "tl-user-scribble", scribble, zoom: zoomLevel }, scribble.id));
@@ -223,7 +223,7 @@ function ZoomBrushWrapper() {
223
223
  function SnapIndicatorWrapper() {
224
224
  const editor = (0, import_useEditor.useEditor)();
225
225
  const lines = (0, import_state_react.useValue)("snapLines", () => editor.snaps.getIndicators(), [editor]);
226
- const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getZoomLevel(), [editor]);
226
+ const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getEfficientZoomLevel(), [editor]);
227
227
  const { SnapIndicator } = (0, import_useEditorComponents.useEditorComponents)();
228
228
  if (!(SnapIndicator && lines.length > 0)) return null;
229
229
  return lines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SnapIndicator, { className: "tl-user-snapline", line, zoom: zoomLevel }, line.id));
@@ -249,7 +249,7 @@ function HandlesWrapper() {
249
249
  function HandlesWrapperInner({ shapeId }) {
250
250
  const editor = (0, import_useEditor.useEditor)();
251
251
  const { Handles } = (0, import_useEditorComponents.useEditorComponents)();
252
- const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getZoomLevel(), [editor]);
252
+ const zoomLevel = (0, import_state_react.useValue)("zoomLevel", () => editor.getEfficientZoomLevel(), [editor]);
253
253
  const isCoarse = (0, import_state_react.useValue)("coarse pointer", () => editor.getInstanceState().isCoarsePointer, [
254
254
  editor
255
255
  ]);