@tldraw/editor 4.6.0-internal.c7df3c92455a → 4.6.0-next.0eb36d65eec3

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 (189) hide show
  1. package/dist-cjs/index.d.ts +124 -6
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  5. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +1 -1
  6. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  7. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +1 -1
  8. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +2 -2
  9. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  10. package/dist-cjs/lib/config/createTLStore.js +1 -1
  11. package/dist-cjs/lib/config/createTLStore.js.map +2 -2
  12. package/dist-cjs/lib/config/createTLUser.js.map +1 -1
  13. package/dist-cjs/lib/config/defaultShapes.js.map +2 -2
  14. package/dist-cjs/lib/editor/Editor.js +463 -354
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +25 -64
  17. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
  18. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -1
  19. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  20. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +14 -53
  21. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +1 -1
  22. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +71 -112
  23. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
  24. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +21 -56
  25. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +2 -2
  26. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +11 -52
  27. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +2 -2
  28. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +19 -56
  29. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +1 -1
  30. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +4 -4
  31. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
  32. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +102 -30
  33. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  34. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +16 -55
  35. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
  36. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +57 -68
  37. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  38. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +1 -1
  39. package/dist-cjs/lib/exports/ExportDelay.js +12 -53
  40. package/dist-cjs/lib/exports/ExportDelay.js.map +1 -1
  41. package/dist-cjs/lib/exports/FontEmbedder.js +14 -57
  42. package/dist-cjs/lib/exports/FontEmbedder.js.map +1 -1
  43. package/dist-cjs/lib/exports/StyleEmbedder.js +1 -1
  44. package/dist-cjs/lib/exports/StyleEmbedder.js.map +2 -2
  45. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  46. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  47. package/dist-cjs/lib/hooks/useLocalStore.js.map +2 -2
  48. package/dist-cjs/lib/options.js +3 -0
  49. package/dist-cjs/lib/options.js.map +2 -2
  50. package/dist-cjs/lib/primitives/Box.js +26 -26
  51. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  52. package/dist-cjs/lib/primitives/Vec.js +1 -1
  53. package/dist-cjs/lib/primitives/Vec.js.map +1 -1
  54. package/dist-cjs/lib/primitives/geometry/Arc2d.js +2 -2
  55. package/dist-cjs/lib/primitives/geometry/Arc2d.js.map +2 -2
  56. package/dist-cjs/lib/primitives/geometry/Circle2d.js +2 -2
  57. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +2 -2
  58. package/dist-cjs/lib/primitives/geometry/CubicSpline2d.js +1 -1
  59. package/dist-cjs/lib/primitives/geometry/CubicSpline2d.js.map +1 -1
  60. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +3 -3
  61. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
  62. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +10 -9
  63. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  64. package/dist-cjs/lib/primitives/geometry/Polyline2d.js +2 -2
  65. package/dist-cjs/lib/primitives/geometry/Polyline2d.js.map +2 -2
  66. package/dist-cjs/lib/primitives/geometry/Stadium2d.js +1 -1
  67. package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +2 -2
  68. package/dist-cjs/lib/utils/SharedStylesMap.js +1 -1
  69. package/dist-cjs/lib/utils/SharedStylesMap.js.map +1 -1
  70. package/dist-cjs/lib/utils/getSvgPathFromPoints.js.map +2 -2
  71. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +3 -2
  72. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
  73. package/dist-cjs/version.js +3 -3
  74. package/dist-cjs/version.js.map +1 -1
  75. package/dist-esm/index.d.mts +124 -6
  76. package/dist-esm/index.mjs +4 -2
  77. package/dist-esm/index.mjs.map +2 -2
  78. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  79. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -1
  80. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  81. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +1 -1
  82. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +2 -2
  83. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  84. package/dist-esm/lib/config/createTLStore.mjs +1 -1
  85. package/dist-esm/lib/config/createTLStore.mjs.map +2 -2
  86. package/dist-esm/lib/config/createTLUser.mjs.map +1 -1
  87. package/dist-esm/lib/config/defaultShapes.mjs.map +2 -2
  88. package/dist-esm/lib/editor/Editor.mjs +465 -357
  89. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  90. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +25 -64
  91. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
  92. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -1
  93. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  94. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +14 -53
  95. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +1 -1
  96. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +71 -112
  97. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
  98. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +21 -56
  99. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +2 -2
  100. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +11 -52
  101. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +2 -2
  102. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +19 -56
  103. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +1 -1
  104. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +4 -4
  105. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +2 -2
  106. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +102 -30
  107. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  108. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +16 -55
  109. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
  110. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +57 -68
  111. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  112. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +1 -1
  113. package/dist-esm/lib/exports/ExportDelay.mjs +12 -53
  114. package/dist-esm/lib/exports/ExportDelay.mjs.map +1 -1
  115. package/dist-esm/lib/exports/FontEmbedder.mjs +14 -57
  116. package/dist-esm/lib/exports/FontEmbedder.mjs.map +1 -1
  117. package/dist-esm/lib/exports/StyleEmbedder.mjs +1 -1
  118. package/dist-esm/lib/exports/StyleEmbedder.mjs.map +2 -2
  119. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  120. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  121. package/dist-esm/lib/hooks/useLocalStore.mjs.map +2 -2
  122. package/dist-esm/lib/options.mjs +3 -0
  123. package/dist-esm/lib/options.mjs.map +2 -2
  124. package/dist-esm/lib/primitives/Box.mjs +26 -26
  125. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  126. package/dist-esm/lib/primitives/Vec.mjs +1 -1
  127. package/dist-esm/lib/primitives/Vec.mjs.map +1 -1
  128. package/dist-esm/lib/primitives/geometry/Arc2d.mjs +2 -2
  129. package/dist-esm/lib/primitives/geometry/Arc2d.mjs.map +2 -2
  130. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +2 -2
  131. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
  132. package/dist-esm/lib/primitives/geometry/CubicSpline2d.mjs +1 -1
  133. package/dist-esm/lib/primitives/geometry/CubicSpline2d.mjs.map +1 -1
  134. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +3 -3
  135. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
  136. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +10 -9
  137. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  138. package/dist-esm/lib/primitives/geometry/Polyline2d.mjs +2 -2
  139. package/dist-esm/lib/primitives/geometry/Polyline2d.mjs.map +2 -2
  140. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs +1 -1
  141. package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +2 -2
  142. package/dist-esm/lib/utils/SharedStylesMap.mjs +1 -1
  143. package/dist-esm/lib/utils/SharedStylesMap.mjs.map +1 -1
  144. package/dist-esm/lib/utils/getSvgPathFromPoints.mjs.map +2 -2
  145. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +3 -2
  146. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
  147. package/dist-esm/version.mjs +3 -3
  148. package/dist-esm/version.mjs.map +1 -1
  149. package/package.json +8 -8
  150. package/src/index.ts +15 -7
  151. package/src/lib/TldrawEditor.tsx +1 -1
  152. package/src/lib/components/default-components/DefaultCanvas.tsx +1 -1
  153. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +1 -1
  154. package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -0
  155. package/src/lib/config/TLEditorSnapshot.test.ts +1 -1
  156. package/src/lib/config/createTLStore.ts +1 -1
  157. package/src/lib/config/createTLUser.ts +3 -3
  158. package/src/lib/config/defaultShapes.ts +1 -1
  159. package/src/lib/editor/Editor.ts +9 -8
  160. package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
  161. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +1 -1
  162. package/src/lib/editor/managers/InputsManager/InputsManager.ts +30 -30
  163. package/src/lib/editor/managers/SnapManager/BoundsSnaps.ts +1 -1
  164. package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +1 -1
  165. package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +5 -5
  166. package/src/lib/editor/managers/TextManager/TextManager.test.ts +18 -4
  167. package/src/lib/editor/managers/TextManager/TextManager.ts +140 -34
  168. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +1 -1
  169. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +1 -1
  170. package/src/lib/editor/shapes/ShapeUtil.ts +2 -2
  171. package/src/lib/exports/StyleEmbedder.ts +1 -1
  172. package/src/lib/exports/getSvgJsx.tsx +1 -1
  173. package/src/lib/hooks/useEditorComponents.tsx +1 -1
  174. package/src/lib/hooks/useLocalStore.ts +1 -1
  175. package/src/lib/options.ts +108 -0
  176. package/src/lib/primitives/Box.ts +26 -26
  177. package/src/lib/primitives/Vec.ts +1 -1
  178. package/src/lib/primitives/geometry/Arc2d.ts +2 -2
  179. package/src/lib/primitives/geometry/Circle2d.ts +2 -2
  180. package/src/lib/primitives/geometry/CubicSpline2d.ts +1 -1
  181. package/src/lib/primitives/geometry/Ellipse2d.ts +3 -3
  182. package/src/lib/primitives/geometry/Geometry2d.ts +10 -9
  183. package/src/lib/primitives/geometry/Polyline2d.ts +2 -2
  184. package/src/lib/primitives/geometry/Stadium2d.ts +1 -1
  185. package/src/lib/utils/SharedStylesMap.ts +1 -1
  186. package/src/lib/utils/getSvgPathFromPoints.ts +1 -1
  187. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +1 -1
  188. package/src/lib/utils/sync/TLLocalSyncClient.ts +2 -1
  189. package/src/version.ts +3 -3
@@ -1,52 +1,13 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
5
- var __typeError = (msg) => {
6
- throw TypeError(msg);
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
7
10
  };
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
11
- var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
12
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
13
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
14
- var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
15
- var __runInitializers = (array, flags, self, value) => {
16
- for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
17
- return value;
18
- };
19
- var __decorateElement = (array, flags, name, decorators, target, extra) => {
20
- var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
21
- var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
22
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
23
- var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
24
- return __privateGet(this, extra);
25
- }, set [name](x) {
26
- return __privateSet(this, extra, x);
27
- } }, name));
28
- k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
29
- for (var i = decorators.length - 1; i >= 0; i--) {
30
- ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
31
- if (k) {
32
- ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
33
- if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
34
- if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
35
- }
36
- it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
37
- if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
38
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
39
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
40
- }
41
- return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
42
- };
43
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
44
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
45
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
46
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
47
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
48
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
49
- var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getEfficientZoomLevel_dec, __getAboveDebouncedZoomThreshold_dec, _getDebouncedZoomLevel_dec, _getResizeScaleFactor_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _canRedo_dec, _canUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
50
11
  import {
51
12
  EMPTY_ARRAY,
52
13
  atom,
@@ -101,13 +62,13 @@ import {
101
62
  uniqueId
102
63
  } from "@tldraw/utils";
103
64
  import EventEmitter from "eventemitter3";
65
+ import { createTLUser } from "../config/createTLUser.mjs";
66
+ import { checkBindings } from "../config/defaultBindings.mjs";
67
+ import { checkShapesAndAddCore } from "../config/defaultShapes.mjs";
104
68
  import {
105
69
  getSnapshot,
106
70
  loadSnapshot
107
71
  } from "../config/TLEditorSnapshot.mjs";
108
- import { createTLUser } from "../config/createTLUser.mjs";
109
- import { checkBindings } from "../config/defaultBindings.mjs";
110
- import { checkShapesAndAddCore } from "../config/defaultShapes.mjs";
111
72
  import {
112
73
  DEFAULT_ANIMATION_OPTIONS,
113
74
  DEFAULT_CAMERA_OPTIONS,
@@ -124,13 +85,12 @@ import { tlmenus } from "../globals/menus.mjs";
124
85
  import { tltime } from "../globals/time.mjs";
125
86
  import { defaultTldrawOptions } from "../options.mjs";
126
87
  import { Box } from "../primitives/Box.mjs";
127
- import { Mat } from "../primitives/Mat.mjs";
128
- import { Vec } from "../primitives/Vec.mjs";
129
88
  import { EASINGS } from "../primitives/easings.mjs";
130
89
  import { Group2d } from "../primitives/geometry/Group2d.mjs";
131
90
  import { intersectPolygonPolygon } from "../primitives/intersect.mjs";
91
+ import { Mat } from "../primitives/Mat.mjs";
132
92
  import { PI, approximately, areAnglesCompatible, clamp, pointInPolygon } from "../primitives/utils.mjs";
133
- import { SharedStyleMap } from "../utils/SharedStylesMap.mjs";
93
+ import { Vec } from "../primitives/Vec.mjs";
134
94
  import { areShapesContentEqual } from "../utils/areShapesContentEqual.mjs";
135
95
  import { dataUrlToFile } from "../utils/assets.mjs";
136
96
  import { debugFlags } from "../utils/debug-flags.mjs";
@@ -142,6 +102,7 @@ import { getIncrementedName } from "../utils/getIncrementedName.mjs";
142
102
  import { getReorderingShapesChanges } from "../utils/reorderShapes.mjs";
143
103
  import { getDroppedShapesToNewParents, kickoutOccludedShapes } from "../utils/reparenting.mjs";
144
104
  import { applyRotationToSnapshotShapes, getRotationSnapshot } from "../utils/rotation.mjs";
105
+ import { SharedStyleMap } from "../utils/SharedStylesMap.mjs";
145
106
  import { bindingsIndex } from "./derivations/bindingsIndex.mjs";
146
107
  import { notVisibleShapes } from "./derivations/notVisibleShapes.mjs";
147
108
  import { parentsToChildren } from "./derivations/parentsToChildren.mjs";
@@ -159,7 +120,8 @@ import { TextManager } from "./managers/TextManager/TextManager.mjs";
159
120
  import { TickManager } from "./managers/TickManager/TickManager.mjs";
160
121
  import { UserPreferencesManager } from "./managers/UserPreferencesManager/UserPreferencesManager.mjs";
161
122
  import { RootState } from "./tools/RootState.mjs";
162
- class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed], _canUndo_dec = [computed], _canRedo_dec = [computed], _getPath_dec = [computed], _getCurrentTool_dec = [computed], _getCurrentToolId_dec = [computed], _getDocumentSettings_dec = [computed], _getInstanceState_dec = [computed], _getPageStates_dec = [computed], __getPageStatesQuery_dec = [computed], _getCurrentPageState_dec = [computed], __getCurrentPageStateId_dec = [computed], _getSelectedShapeIds_dec = [computed], _getSelectedShapes_dec = [computed], _getCurrentPageShapesInReadingOrder_dec = [computed], _getOnlySelectedShapeId_dec = [computed], _getOnlySelectedShape_dec = [computed], _getSelectionPageBounds_dec = [computed], _getSelectionRotation_dec = [computed], _getSelectionRotatedPageBounds_dec = [computed], _getSelectionRotatedScreenBounds_dec = [computed], _getFocusedGroupId_dec = [computed], _getFocusedGroup_dec = [computed], _getEditingShapeId_dec = [computed], _getEditingShape_dec = [computed], _getRichTextEditor_dec = [computed], _getHoveredShapeId_dec = [computed], _getHoveredShape_dec = [computed], _getHintingShapeIds_dec = [computed], _getHintingShape_dec = [computed], _getErasingShapeIds_dec = [computed], _getErasingShapes_dec = [computed], __unsafe_getCameraId_dec = [computed], _getCamera_dec = [computed], _getViewportPageBoundsForFollowing_dec = [computed], _getCameraForFollowing_dec = [computed], _getZoomLevel_dec = [computed], _getResizeScaleFactor_dec = [computed], _getDebouncedZoomLevel_dec = [computed], __getAboveDebouncedZoomThreshold_dec = [computed], _getEfficientZoomLevel_dec = [computed], _getViewportScreenBounds_dec = [computed], _getViewportScreenCenter_dec = [computed], _getViewportPageBounds_dec = [computed], __getCollaboratorsQuery_dec = [computed], _getCollaborators_dec = [computed], _getCollaboratorsOnCurrentPage_dec = [computed], _getRenderingShapes_dec = [computed], __getAllPagesQuery_dec = [computed], _getPages_dec = [computed], _getCurrentPageId_dec = [computed], _getCurrentPageShapeIdsSorted_dec = [computed], __getAllAssetsQuery_dec = [computed], __getShapeHandlesCache_dec = [computed], __getShapePageTransformCache_dec = [computed], __getShapePageBoundsCache_dec = [computed], __getShapeClipPathCache_dec = [computed], __getShapeMaskCache_dec = [computed], __getShapeMaskedPageBoundsCache_dec = [computed], _getNotVisibleShapes_dec = [computed], _getCulledShapes_dec = [computed], _getCurrentPageBounds_dec = [computed], _getCurrentPageShapes_dec = [computed], _getCurrentPageShapesSorted_dec = [computed], _getCurrentPageRenderingShapesSorted_dec = [computed], __getBindingsIndexCache_dec = [computed], __getSelectionSharedStyles_dec = [computed], _getSharedStyles_dec = [computed({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [computed], _getIsFocused_dec = [computed], _getIsReadonly_dec = [computed], __setShiftKeyTimeout_dec = [bind], __setAltKeyTimeout_dec = [bind], __setCtrlKeyTimeout_dec = [bind], __setMetaKeyTimeout_dec = [bind], _a) {
123
+ class Editor extends EventEmitter {
124
+ id = uniqueId();
163
125
  constructor({
164
126
  store,
165
127
  user,
@@ -181,233 +143,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
181
143
  fontAssetUrls
182
144
  }) {
183
145
  super();
184
- __runInitializers(_init, 5, this);
185
- __publicField(this, "id", uniqueId());
186
- __publicField(this, "_getShapeVisibility");
187
- __publicField(this, "options");
188
- __publicField(this, "contextId", uniqueId());
189
- /**
190
- * The editor's store
191
- *
192
- * @public
193
- */
194
- __publicField(this, "store");
195
- /**
196
- * The root state of the statechart.
197
- *
198
- * @public
199
- */
200
- __publicField(this, "root");
201
- /**
202
- * A set of functions to call when the editor is disposed.
203
- *
204
- * @public
205
- */
206
- __publicField(this, "disposables", /* @__PURE__ */ new Set());
207
- /**
208
- * Whether the editor is disposed.
209
- *
210
- * @public
211
- */
212
- __publicField(this, "isDisposed", false);
213
- /**
214
- * A manager for the editor's tick events.
215
- *
216
- * @internal */
217
- __publicField(this, "_tickManager");
218
- /**
219
- * A manager for the editor's input state.
220
- *
221
- * @public
222
- */
223
- __publicField(this, "inputs");
224
- /**
225
- * A manager for the editor's snapping feature.
226
- *
227
- * @public
228
- */
229
- __publicField(this, "snaps");
230
- __publicField(this, "_spatialIndex");
231
- /**
232
- * A manager for the any asynchronous events and making sure they're
233
- * cleaned up upon disposal.
234
- *
235
- * @public
236
- */
237
- __publicField(this, "timers", tltime.forContext(this.contextId));
238
- /**
239
- * A manager for the user and their preferences.
240
- *
241
- * @public
242
- */
243
- __publicField(this, "user");
244
- /**
245
- * A helper for measuring text.
246
- *
247
- * @public
248
- */
249
- __publicField(this, "textMeasure");
250
- /**
251
- * A utility for managing the set of fonts that should be rendered in the document.
252
- *
253
- * @public
254
- */
255
- __publicField(this, "fonts");
256
- /**
257
- * A manager for the editor's scribbles.
258
- *
259
- * @public
260
- */
261
- __publicField(this, "scribbles");
262
- /**
263
- * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
264
- *
265
- * @public
266
- */
267
- __publicField(this, "sideEffects");
268
- /**
269
- * A manager for moving the camera when the mouse is at the edge of the screen.
270
- *
271
- * @public
272
- */
273
- __publicField(this, "edgeScrollManager");
274
- /**
275
- * A manager for ensuring correct focus. See FocusManager for details.
276
- *
277
- * @internal
278
- */
279
- __publicField(this, "focusManager");
280
- /**
281
- * The current HTML element containing the editor.
282
- *
283
- * @example
284
- * ```ts
285
- * const container = editor.getContainer()
286
- * ```
287
- *
288
- * @public
289
- */
290
- __publicField(this, "getContainer");
291
- /* ------------------- Shape Utils ------------------ */
292
- /**
293
- * A map of shape utility classes (TLShapeUtils) by shape type.
294
- *
295
- * @public
296
- */
297
- __publicField(this, "shapeUtils");
298
- __publicField(this, "styleProps");
299
- /* ------------------- Binding Utils ------------------ */
300
- /**
301
- * A map of shape utility classes (TLShapeUtils) by shape type.
302
- *
303
- * @public
304
- */
305
- __publicField(this, "bindingUtils");
306
- /* --------------------- History -------------------- */
307
- /**
308
- * A manager for the editor's history.
309
- *
310
- * @readonly
311
- */
312
- __publicField(this, "history");
313
- __publicField(this, "_shouldIgnoreShapeLock", false);
314
- /** @internal */
315
- __publicField(this, "_crashingError", null);
316
- /** @internal */
317
- __publicField(this, "_isChangingStyleTimeout", -1);
318
- // Menus
319
- __publicField(this, "menus", tlmenus.forContext(this.contextId));
320
- // Rich text editor
321
- __publicField(this, "_currentRichTextEditor", atom("rich text editor", null));
322
- __publicField(this, "_textOptions");
323
- __publicField(this, "_debouncedZoomLevel", atom("debounced zoom level", 1));
324
- __publicField(this, "_cameraOptions", atom("camera options", DEFAULT_CAMERA_OPTIONS));
325
- /** @internal */
326
- __publicField(this, "_viewportAnimation", null);
327
- // Viewport
328
- /** @internal */
329
- __publicField(this, "_willSetInitialBounds", true);
330
- // Following
331
- // When we are 'locked on' to a user, our camera is derived from their camera.
332
- __publicField(this, "_isLockedOnFollowingUser", atom("isLockedOnFollowingUser", false));
333
- // Camera state
334
- // Camera state does two things: first, it allows us to subscribe to whether
335
- // the camera is moving or not; and second, it allows us to update the rendering
336
- // shapes on the canvas. Changing the rendering shapes may cause shapes to
337
- // unmount / remount in the DOM, which is expensive; and computing visibility is
338
- // also expensive in large projects. For this reason, we use a second bounding
339
- // box just for rendering, and we only update after the camera stops moving.
340
- __publicField(this, "_cameraStateTimeoutRemaining", 0);
341
- /* @internal */
342
- __publicField(this, "_currentPageShapeIds");
343
- /* --------------------- Shapes --------------------- */
344
- __publicField(this, "_shapeGeometryCaches", {});
345
- __publicField(this, "_notVisibleShapes", notVisibleShapes(this));
346
- __publicField(this, "_culledShapesCache", null);
347
- // Parents and children
348
- /**
349
- * A cache of parents to children.
350
- *
351
- * @internal
352
- */
353
- __publicField(this, "_parentIdsToChildIds");
354
- __publicField(this, "animatingShapes", /* @__PURE__ */ new Map());
355
- /* --------------------- Content -------------------- */
356
- /** @internal */
357
- __publicField(this, "externalAssetContentHandlers", {
358
- file: null,
359
- url: null
360
- });
361
- /** @internal */
362
- __publicField(this, "temporaryAssetPreview", /* @__PURE__ */ new Map());
363
- /** @internal */
364
- __publicField(this, "externalContentHandlers", {
365
- text: null,
366
- files: null,
367
- "file-replace": null,
368
- embed: null,
369
- "svg-text": null,
370
- url: null,
371
- tldraw: null,
372
- excalidraw: null
373
- });
374
- /**
375
- * A manager for recording multiple click events.
376
- *
377
- * @internal
378
- */
379
- __publicField(this, "_clickManager", new ClickManager(this));
380
- /**
381
- * The previous cursor. Used for restoring the cursor after pan events.
382
- *
383
- * @internal
384
- */
385
- __publicField(this, "_prevCursor", "default");
386
- /** @internal */
387
- __publicField(this, "_shiftKeyTimeout", -1);
388
- /** @internal */
389
- __publicField(this, "_altKeyTimeout", -1);
390
- /** @internal */
391
- __publicField(this, "_ctrlKeyTimeout", -1);
392
- /** @internal */
393
- __publicField(this, "_metaKeyTimeout", -1);
394
- /** @internal */
395
- __publicField(this, "_restoreToolId", "select");
396
- /** @internal */
397
- __publicField(this, "_didPinch", false);
398
- /** @internal */
399
- __publicField(this, "_selectedShapeIdsAtPointerDown", []);
400
- /** @internal */
401
- __publicField(this, "_longPressTimeout", -1);
402
- /** @internal */
403
- __publicField(this, "capturedPointerId", null);
404
- /** @internal */
405
- __publicField(this, "performanceTracker");
406
- /** @internal */
407
- __publicField(this, "performanceTrackerTimeout", -1);
408
- /** @internal */
409
- __publicField(this, "handledEvents", /* @__PURE__ */ new WeakSet());
410
- __publicField(this, "_pendingEventsForNextTick", []);
411
146
  this._getShapeVisibility = getShapeVisibility;
412
147
  const options = _textOptions ? { ..._options, text: _options?.text ?? _textOptions } : _options;
413
148
  this.options = { ...defaultTldrawOptions, ...options };
@@ -813,6 +548,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
813
548
  );
814
549
  }
815
550
  }
551
+ _getShapeVisibility;
816
552
  getIsShapeHiddenCache() {
817
553
  if (!this._getShapeVisibility) return null;
818
554
  return this.store.createComputedCache("isShapeHidden", (shape) => {
@@ -828,6 +564,20 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
828
564
  typeof shapeOrId === "string" ? shapeOrId : shapeOrId.id
829
565
  );
830
566
  }
567
+ options;
568
+ contextId = uniqueId();
569
+ /**
570
+ * The editor's store
571
+ *
572
+ * @public
573
+ */
574
+ store;
575
+ /**
576
+ * The root state of the statechart.
577
+ *
578
+ * @public
579
+ */
580
+ root;
831
581
  /**
832
582
  * Set a tool. Useful if you need to add a tool to the state chart on demand,
833
583
  * after the editor has already been initialized.
@@ -859,6 +609,96 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
859
609
  delete parent.children[Tool.id];
860
610
  }
861
611
  }
612
+ /**
613
+ * A set of functions to call when the editor is disposed.
614
+ *
615
+ * @public
616
+ */
617
+ disposables = /* @__PURE__ */ new Set();
618
+ /**
619
+ * Whether the editor is disposed.
620
+ *
621
+ * @public
622
+ */
623
+ isDisposed = false;
624
+ /**
625
+ * A manager for the editor's tick events.
626
+ *
627
+ * @internal */
628
+ _tickManager;
629
+ /**
630
+ * A manager for the editor's input state.
631
+ *
632
+ * @public
633
+ */
634
+ inputs;
635
+ /**
636
+ * A manager for the editor's snapping feature.
637
+ *
638
+ * @public
639
+ */
640
+ snaps;
641
+ _spatialIndex;
642
+ /**
643
+ * A manager for the any asynchronous events and making sure they're
644
+ * cleaned up upon disposal.
645
+ *
646
+ * @public
647
+ */
648
+ timers = tltime.forContext(this.contextId);
649
+ /**
650
+ * A manager for the user and their preferences.
651
+ *
652
+ * @public
653
+ */
654
+ user;
655
+ /**
656
+ * A helper for measuring text.
657
+ *
658
+ * @public
659
+ */
660
+ textMeasure;
661
+ /**
662
+ * A utility for managing the set of fonts that should be rendered in the document.
663
+ *
664
+ * @public
665
+ */
666
+ fonts;
667
+ /**
668
+ * A manager for the editor's scribbles.
669
+ *
670
+ * @public
671
+ */
672
+ scribbles;
673
+ /**
674
+ * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
675
+ *
676
+ * @public
677
+ */
678
+ sideEffects;
679
+ /**
680
+ * A manager for moving the camera when the mouse is at the edge of the screen.
681
+ *
682
+ * @public
683
+ */
684
+ edgeScrollManager;
685
+ /**
686
+ * A manager for ensuring correct focus. See FocusManager for details.
687
+ *
688
+ * @internal
689
+ */
690
+ focusManager;
691
+ /**
692
+ * The current HTML element containing the editor.
693
+ *
694
+ * @example
695
+ * ```ts
696
+ * const container = editor.getContainer()
697
+ * ```
698
+ *
699
+ * @public
700
+ */
701
+ getContainer;
862
702
  /**
863
703
  * The document that the editor's container element belongs to.
864
704
  * Use this instead of the global `document` to support cross-window embedding.
@@ -889,6 +729,14 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
889
729
  this.isDisposed = true;
890
730
  this.emit("dispose");
891
731
  }
732
+ /* ------------------- Shape Utils ------------------ */
733
+ /**
734
+ * A map of shape utility classes (TLShapeUtils) by shape type.
735
+ *
736
+ * @public
737
+ */
738
+ shapeUtils;
739
+ styleProps;
892
740
  getShapeUtil(arg) {
893
741
  const type = typeof arg === "string" ? arg : arg.type;
894
742
  const shapeUtil = getOwnProperty(this.shapeUtils, type);
@@ -899,12 +747,26 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
899
747
  const type = typeof arg === "string" ? arg : arg.type;
900
748
  return hasOwnProperty(this.shapeUtils, type);
901
749
  }
750
+ /* ------------------- Binding Utils ------------------ */
751
+ /**
752
+ * A map of shape utility classes (TLShapeUtils) by shape type.
753
+ *
754
+ * @public
755
+ */
756
+ bindingUtils;
902
757
  getBindingUtil(arg) {
903
758
  const type = typeof arg === "string" ? arg : arg.type;
904
759
  const bindingUtil = getOwnProperty(this.bindingUtils, type);
905
760
  assert(bindingUtil, `No binding util found for type "${type}"`);
906
761
  return bindingUtil;
907
762
  }
763
+ /* --------------------- History -------------------- */
764
+ /**
765
+ * A manager for the editor's history.
766
+ *
767
+ * @readonly
768
+ */
769
+ history;
908
770
  /**
909
771
  * Undo to the last mark.
910
772
  *
@@ -1032,6 +894,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1032
894
  this.history.bailToMark(id);
1033
895
  return this;
1034
896
  }
897
+ _shouldIgnoreShapeLock = false;
1035
898
  /**
1036
899
  * Run a function in a transaction with optional options for context.
1037
900
  * You can use the options to change the way that history is treated
@@ -1123,6 +986,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1123
986
  };
1124
987
  }
1125
988
  }
989
+ /** @internal */
990
+ _crashingError = null;
1126
991
  /**
1127
992
  * We can't use an `atom` here because there's a chance that when `crashAndReportError` is called,
1128
993
  * we're in a transaction that's about to be rolled back due to the same error we're currently
@@ -1289,6 +1154,10 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1289
1154
  ]);
1290
1155
  }, opts);
1291
1156
  }
1157
+ /** @internal */
1158
+ _isChangingStyleTimeout = -1;
1159
+ // Menus
1160
+ menus = tlmenus.forContext(this.contextId);
1292
1161
  /* --------------------- Cursor --------------------- */
1293
1162
  /**
1294
1163
  * Set the cursor.
@@ -1854,6 +1723,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1854
1723
  );
1855
1724
  return this;
1856
1725
  }
1726
+ // Rich text editor
1727
+ _currentRichTextEditor = atom("rich text editor", null);
1857
1728
  getRichTextEditor() {
1858
1729
  return this._currentRichTextEditor.get();
1859
1730
  }
@@ -2033,6 +1904,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2033
1904
  }
2034
1905
  return this;
2035
1906
  }
1907
+ _textOptions;
2036
1908
  /**
2037
1909
  * Get the current text options.
2038
1910
  *
@@ -2103,6 +1975,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2103
1975
  getResizeScaleFactor() {
2104
1976
  return this.user.getIsDynamicResizeMode() ? 1 / this.getZoomLevel() : 1;
2105
1977
  }
1978
+ _debouncedZoomLevel = atom("debounced zoom level", 1);
2106
1979
  getDebouncedZoomLevel() {
2107
1980
  if (this.options.debouncedZoom) {
2108
1981
  if (this.getCameraState() === "idle") {
@@ -2207,6 +2080,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2207
2080
  }
2208
2081
  }
2209
2082
  }
2083
+ _cameraOptions = atom("camera options", DEFAULT_CAMERA_OPTIONS);
2210
2084
  /**
2211
2085
  * Get the current camera options.
2212
2086
  *
@@ -2681,6 +2555,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2681
2555
  return this;
2682
2556
  }
2683
2557
  /** @internal */
2558
+ _viewportAnimation = null;
2559
+ /** @internal */
2684
2560
  _animateViewport(ms) {
2685
2561
  if (!this._viewportAnimation) return;
2686
2562
  this._viewportAnimation.elapsed += ms;
@@ -2819,6 +2695,9 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2819
2695
  });
2820
2696
  return this;
2821
2697
  }
2698
+ // Viewport
2699
+ /** @internal */
2700
+ _willSetInitialBounds = true;
2822
2701
  /**
2823
2702
  * Update the viewport. The viewport will measure the size and screen position of its container
2824
2703
  * element. This should be done whenever the container's position on the screen changes.
@@ -2974,6 +2853,9 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
2974
2853
  const currentPageId = this.getCurrentPageId();
2975
2854
  return this.getCollaborators().filter((c) => c.currentPageId === currentPageId);
2976
2855
  }
2856
+ // Following
2857
+ // When we are 'locked on' to a user, our camera is derived from their camera.
2858
+ _isLockedOnFollowingUser = atom("isLockedOnFollowingUser", false);
2977
2859
  /**
2978
2860
  * Start viewport-following a user.
2979
2861
  *
@@ -3149,6 +3031,14 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3149
3031
  }
3150
3032
  return renderingShapes;
3151
3033
  }
3034
+ // Camera state
3035
+ // Camera state does two things: first, it allows us to subscribe to whether
3036
+ // the camera is moving or not; and second, it allows us to update the rendering
3037
+ // shapes on the canvas. Changing the rendering shapes may cause shapes to
3038
+ // unmount / remount in the DOM, which is expensive; and computing visibility is
3039
+ // also expensive in large projects. For this reason, we use a second bounding
3040
+ // box just for rendering, and we only update after the camera stops moving.
3041
+ _cameraStateTimeoutRemaining = 0;
3152
3042
  _decayCameraStateTimeout(elapsed) {
3153
3043
  this._cameraStateTimeoutRemaining -= elapsed;
3154
3044
  if (this._cameraStateTimeoutRemaining > 0) return;
@@ -3220,6 +3110,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3220
3110
  getPage(page) {
3221
3111
  return this.store.get(typeof page === "string" ? page : page.id);
3222
3112
  }
3113
+ /* @internal */
3114
+ _currentPageShapeIds;
3223
3115
  /**
3224
3116
  * An array of all of the shapes on the current page.
3225
3117
  *
@@ -3541,6 +3433,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3541
3433
  async uploadAsset(asset, file, abortSignal) {
3542
3434
  return await this.store.props.assets.upload(asset, file, abortSignal);
3543
3435
  }
3436
+ /* --------------------- Shapes --------------------- */
3437
+ _shapeGeometryCaches = {};
3544
3438
  /**
3545
3439
  * Get the geometry of a shape in shape-space.
3546
3440
  *
@@ -3911,6 +3805,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3911
3805
  getNotVisibleShapes() {
3912
3806
  return this._notVisibleShapes.get();
3913
3807
  }
3808
+ _notVisibleShapes = notVisibleShapes(this);
3809
+ _culledShapesCache = null;
3914
3810
  getCulledShapes() {
3915
3811
  const notVisibleShapes2 = this.getNotVisibleShapes();
3916
3812
  const selectedShapeIds = this.getSelectedShapeIds();
@@ -4325,6 +4221,13 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4325
4221
  return this.getAncestorPageId(this.getShape(_shape.parentId));
4326
4222
  }
4327
4223
  }
4224
+ // Parents and children
4225
+ /**
4226
+ * A cache of parents to children.
4227
+ *
4228
+ * @internal
4229
+ */
4230
+ _parentIdsToChildIds;
4328
4231
  /**
4329
4232
  * Reparent shapes to a new parent. This operation preserves the shape's current page positions /
4330
4233
  * rotations.
@@ -5969,6 +5872,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
5969
5872
  });
5970
5873
  return this;
5971
5874
  }
5875
+ animatingShapes = /* @__PURE__ */ new Map();
5972
5876
  /**
5973
5877
  * Animate a shape.
5974
5878
  *
@@ -6462,6 +6366,14 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
6462
6366
  }
6463
6367
  return this;
6464
6368
  }
6369
+ /* --------------------- Content -------------------- */
6370
+ /** @internal */
6371
+ externalAssetContentHandlers = {
6372
+ file: null,
6373
+ url: null
6374
+ };
6375
+ /** @internal */
6376
+ temporaryAssetPreview = /* @__PURE__ */ new Map();
6465
6377
  /**
6466
6378
  * Register an external asset handler. This handler will be called when the editor needs to
6467
6379
  * create an asset for some external content, like an image/video file or a bookmark URL. For
@@ -6547,6 +6459,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
6547
6459
  hasExternalAssetHandler(type) {
6548
6460
  return !!this.externalAssetContentHandlers[type];
6549
6461
  }
6462
+ /** @internal */
6463
+ externalContentHandlers = {
6464
+ text: null,
6465
+ files: null,
6466
+ "file-replace": null,
6467
+ embed: null,
6468
+ "svg-text": null,
6469
+ url: null,
6470
+ tldraw: null,
6471
+ excalidraw: null
6472
+ };
6550
6473
  /**
6551
6474
  * Register an external content handler. This handler will be called when the editor receives
6552
6475
  * external content of the provided type. For example, the 'image' type handler will be called
@@ -7436,6 +7359,12 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7436
7359
  scheduleEffect.cancel();
7437
7360
  };
7438
7361
  }
7362
+ /**
7363
+ * A manager for recording multiple click events.
7364
+ *
7365
+ * @internal
7366
+ */
7367
+ _clickManager = new ClickManager(this);
7439
7368
  /**
7440
7369
  * Prevent a double click event from firing the next time the user clicks
7441
7370
  *
@@ -7444,6 +7373,14 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7444
7373
  cancelDoubleClick() {
7445
7374
  this._clickManager.cancelDoubleClickTimeout();
7446
7375
  }
7376
+ /**
7377
+ * The previous cursor. Used for restoring the cursor after pan events.
7378
+ *
7379
+ * @internal
7380
+ */
7381
+ _prevCursor = "default";
7382
+ /** @internal */
7383
+ _shiftKeyTimeout = -1;
7447
7384
  _setShiftKeyTimeout() {
7448
7385
  this.inputs.setShiftKey(false);
7449
7386
  this.dispatch({
@@ -7458,6 +7395,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7458
7395
  code: "ShiftLeft"
7459
7396
  });
7460
7397
  }
7398
+ /** @internal */
7399
+ _altKeyTimeout = -1;
7461
7400
  _setAltKeyTimeout() {
7462
7401
  this.inputs.setAltKey(false);
7463
7402
  this.dispatch({
@@ -7472,6 +7411,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7472
7411
  code: "AltLeft"
7473
7412
  });
7474
7413
  }
7414
+ /** @internal */
7415
+ _ctrlKeyTimeout = -1;
7475
7416
  _setCtrlKeyTimeout() {
7476
7417
  this.inputs.setCtrlKey(false);
7477
7418
  this.dispatch({
@@ -7486,6 +7427,8 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7486
7427
  code: "ControlLeft"
7487
7428
  });
7488
7429
  }
7430
+ /** @internal */
7431
+ _metaKeyTimeout = -1;
7489
7432
  _setMetaKeyTimeout() {
7490
7433
  this.inputs.setMetaKey(false);
7491
7434
  this.dispatch({
@@ -7500,6 +7443,22 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7500
7443
  code: "MetaLeft"
7501
7444
  });
7502
7445
  }
7446
+ /** @internal */
7447
+ _restoreToolId = "select";
7448
+ /** @internal */
7449
+ _didPinch = false;
7450
+ /** @internal */
7451
+ _selectedShapeIdsAtPointerDown = [];
7452
+ /** @internal */
7453
+ _longPressTimeout = -1;
7454
+ /** @internal */
7455
+ capturedPointerId = null;
7456
+ /** @internal */
7457
+ performanceTracker;
7458
+ /** @internal */
7459
+ performanceTrackerTimeout = -1;
7460
+ /** @internal */
7461
+ handledEvents = /* @__PURE__ */ new WeakSet();
7503
7462
  /**
7504
7463
  * In tldraw, events are sometimes handled by multiple components. For example, the shapes might
7505
7464
  * have events, but the canvas handles events too. The way that the canvas handles events can
@@ -7545,6 +7504,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7545
7504
  }
7546
7505
  return this;
7547
7506
  }
7507
+ _pendingEventsForNextTick = [];
7548
7508
  _flushEventsForTick(elapsed) {
7549
7509
  this.run(() => {
7550
7510
  if (this._pendingEventsForNextTick.length > 0) {
@@ -7952,83 +7912,231 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
7952
7912
  }
7953
7913
  }
7954
7914
  }
7955
- _init = __decoratorStart(_a);
7956
- __decorateElement(_init, 1, "getIsShapeHiddenCache", _getIsShapeHiddenCache_dec, Editor);
7957
- __decorateElement(_init, 1, "canUndo", _canUndo_dec, Editor);
7958
- __decorateElement(_init, 1, "canRedo", _canRedo_dec, Editor);
7959
- __decorateElement(_init, 1, "getPath", _getPath_dec, Editor);
7960
- __decorateElement(_init, 1, "getCurrentTool", _getCurrentTool_dec, Editor);
7961
- __decorateElement(_init, 1, "getCurrentToolId", _getCurrentToolId_dec, Editor);
7962
- __decorateElement(_init, 1, "getDocumentSettings", _getDocumentSettings_dec, Editor);
7963
- __decorateElement(_init, 1, "getInstanceState", _getInstanceState_dec, Editor);
7964
- __decorateElement(_init, 1, "getPageStates", _getPageStates_dec, Editor);
7965
- __decorateElement(_init, 1, "_getPageStatesQuery", __getPageStatesQuery_dec, Editor);
7966
- __decorateElement(_init, 1, "getCurrentPageState", _getCurrentPageState_dec, Editor);
7967
- __decorateElement(_init, 1, "_getCurrentPageStateId", __getCurrentPageStateId_dec, Editor);
7968
- __decorateElement(_init, 1, "getSelectedShapeIds", _getSelectedShapeIds_dec, Editor);
7969
- __decorateElement(_init, 1, "getSelectedShapes", _getSelectedShapes_dec, Editor);
7970
- __decorateElement(_init, 1, "getCurrentPageShapesInReadingOrder", _getCurrentPageShapesInReadingOrder_dec, Editor);
7971
- __decorateElement(_init, 1, "getOnlySelectedShapeId", _getOnlySelectedShapeId_dec, Editor);
7972
- __decorateElement(_init, 1, "getOnlySelectedShape", _getOnlySelectedShape_dec, Editor);
7973
- __decorateElement(_init, 1, "getSelectionPageBounds", _getSelectionPageBounds_dec, Editor);
7974
- __decorateElement(_init, 1, "getSelectionRotation", _getSelectionRotation_dec, Editor);
7975
- __decorateElement(_init, 1, "getSelectionRotatedPageBounds", _getSelectionRotatedPageBounds_dec, Editor);
7976
- __decorateElement(_init, 1, "getSelectionRotatedScreenBounds", _getSelectionRotatedScreenBounds_dec, Editor);
7977
- __decorateElement(_init, 1, "getFocusedGroupId", _getFocusedGroupId_dec, Editor);
7978
- __decorateElement(_init, 1, "getFocusedGroup", _getFocusedGroup_dec, Editor);
7979
- __decorateElement(_init, 1, "getEditingShapeId", _getEditingShapeId_dec, Editor);
7980
- __decorateElement(_init, 1, "getEditingShape", _getEditingShape_dec, Editor);
7981
- __decorateElement(_init, 1, "getRichTextEditor", _getRichTextEditor_dec, Editor);
7982
- __decorateElement(_init, 1, "getHoveredShapeId", _getHoveredShapeId_dec, Editor);
7983
- __decorateElement(_init, 1, "getHoveredShape", _getHoveredShape_dec, Editor);
7984
- __decorateElement(_init, 1, "getHintingShapeIds", _getHintingShapeIds_dec, Editor);
7985
- __decorateElement(_init, 1, "getHintingShape", _getHintingShape_dec, Editor);
7986
- __decorateElement(_init, 1, "getErasingShapeIds", _getErasingShapeIds_dec, Editor);
7987
- __decorateElement(_init, 1, "getErasingShapes", _getErasingShapes_dec, Editor);
7988
- __decorateElement(_init, 1, "_unsafe_getCameraId", __unsafe_getCameraId_dec, Editor);
7989
- __decorateElement(_init, 1, "getCamera", _getCamera_dec, Editor);
7990
- __decorateElement(_init, 1, "getViewportPageBoundsForFollowing", _getViewportPageBoundsForFollowing_dec, Editor);
7991
- __decorateElement(_init, 1, "getCameraForFollowing", _getCameraForFollowing_dec, Editor);
7992
- __decorateElement(_init, 1, "getZoomLevel", _getZoomLevel_dec, Editor);
7993
- __decorateElement(_init, 1, "getResizeScaleFactor", _getResizeScaleFactor_dec, Editor);
7994
- __decorateElement(_init, 1, "getDebouncedZoomLevel", _getDebouncedZoomLevel_dec, Editor);
7995
- __decorateElement(_init, 1, "_getAboveDebouncedZoomThreshold", __getAboveDebouncedZoomThreshold_dec, Editor);
7996
- __decorateElement(_init, 1, "getEfficientZoomLevel", _getEfficientZoomLevel_dec, Editor);
7997
- __decorateElement(_init, 1, "getViewportScreenBounds", _getViewportScreenBounds_dec, Editor);
7998
- __decorateElement(_init, 1, "getViewportScreenCenter", _getViewportScreenCenter_dec, Editor);
7999
- __decorateElement(_init, 1, "getViewportPageBounds", _getViewportPageBounds_dec, Editor);
8000
- __decorateElement(_init, 1, "_getCollaboratorsQuery", __getCollaboratorsQuery_dec, Editor);
8001
- __decorateElement(_init, 1, "getCollaborators", _getCollaborators_dec, Editor);
8002
- __decorateElement(_init, 1, "getCollaboratorsOnCurrentPage", _getCollaboratorsOnCurrentPage_dec, Editor);
8003
- __decorateElement(_init, 1, "getRenderingShapes", _getRenderingShapes_dec, Editor);
8004
- __decorateElement(_init, 1, "_getAllPagesQuery", __getAllPagesQuery_dec, Editor);
8005
- __decorateElement(_init, 1, "getPages", _getPages_dec, Editor);
8006
- __decorateElement(_init, 1, "getCurrentPageId", _getCurrentPageId_dec, Editor);
8007
- __decorateElement(_init, 1, "getCurrentPageShapeIdsSorted", _getCurrentPageShapeIdsSorted_dec, Editor);
8008
- __decorateElement(_init, 1, "_getAllAssetsQuery", __getAllAssetsQuery_dec, Editor);
8009
- __decorateElement(_init, 1, "_getShapeHandlesCache", __getShapeHandlesCache_dec, Editor);
8010
- __decorateElement(_init, 1, "_getShapePageTransformCache", __getShapePageTransformCache_dec, Editor);
8011
- __decorateElement(_init, 1, "_getShapePageBoundsCache", __getShapePageBoundsCache_dec, Editor);
8012
- __decorateElement(_init, 1, "_getShapeClipPathCache", __getShapeClipPathCache_dec, Editor);
8013
- __decorateElement(_init, 1, "_getShapeMaskCache", __getShapeMaskCache_dec, Editor);
8014
- __decorateElement(_init, 1, "_getShapeMaskedPageBoundsCache", __getShapeMaskedPageBoundsCache_dec, Editor);
8015
- __decorateElement(_init, 1, "getNotVisibleShapes", _getNotVisibleShapes_dec, Editor);
8016
- __decorateElement(_init, 1, "getCulledShapes", _getCulledShapes_dec, Editor);
8017
- __decorateElement(_init, 1, "getCurrentPageBounds", _getCurrentPageBounds_dec, Editor);
8018
- __decorateElement(_init, 1, "getCurrentPageShapes", _getCurrentPageShapes_dec, Editor);
8019
- __decorateElement(_init, 1, "getCurrentPageShapesSorted", _getCurrentPageShapesSorted_dec, Editor);
8020
- __decorateElement(_init, 1, "getCurrentPageRenderingShapesSorted", _getCurrentPageRenderingShapesSorted_dec, Editor);
8021
- __decorateElement(_init, 1, "_getBindingsIndexCache", __getBindingsIndexCache_dec, Editor);
8022
- __decorateElement(_init, 1, "_getSelectionSharedStyles", __getSelectionSharedStyles_dec, Editor);
8023
- __decorateElement(_init, 1, "getSharedStyles", _getSharedStyles_dec, Editor);
8024
- __decorateElement(_init, 1, "getSharedOpacity", _getSharedOpacity_dec, Editor);
8025
- __decorateElement(_init, 1, "getIsFocused", _getIsFocused_dec, Editor);
8026
- __decorateElement(_init, 1, "getIsReadonly", _getIsReadonly_dec, Editor);
8027
- __decorateElement(_init, 1, "_setShiftKeyTimeout", __setShiftKeyTimeout_dec, Editor);
8028
- __decorateElement(_init, 1, "_setAltKeyTimeout", __setAltKeyTimeout_dec, Editor);
8029
- __decorateElement(_init, 1, "_setCtrlKeyTimeout", __setCtrlKeyTimeout_dec, Editor);
8030
- __decorateElement(_init, 1, "_setMetaKeyTimeout", __setMetaKeyTimeout_dec, Editor);
8031
- __decoratorMetadata(_init, Editor);
7915
+ __decorateClass([
7916
+ computed
7917
+ ], Editor.prototype, "getIsShapeHiddenCache", 1);
7918
+ __decorateClass([
7919
+ computed
7920
+ ], Editor.prototype, "canUndo", 1);
7921
+ __decorateClass([
7922
+ computed
7923
+ ], Editor.prototype, "canRedo", 1);
7924
+ __decorateClass([
7925
+ computed
7926
+ ], Editor.prototype, "getPath", 1);
7927
+ __decorateClass([
7928
+ computed
7929
+ ], Editor.prototype, "getCurrentTool", 1);
7930
+ __decorateClass([
7931
+ computed
7932
+ ], Editor.prototype, "getCurrentToolId", 1);
7933
+ __decorateClass([
7934
+ computed
7935
+ ], Editor.prototype, "getDocumentSettings", 1);
7936
+ __decorateClass([
7937
+ computed
7938
+ ], Editor.prototype, "getInstanceState", 1);
7939
+ __decorateClass([
7940
+ computed
7941
+ ], Editor.prototype, "getPageStates", 1);
7942
+ __decorateClass([
7943
+ computed
7944
+ ], Editor.prototype, "_getPageStatesQuery", 1);
7945
+ __decorateClass([
7946
+ computed
7947
+ ], Editor.prototype, "getCurrentPageState", 1);
7948
+ __decorateClass([
7949
+ computed
7950
+ ], Editor.prototype, "_getCurrentPageStateId", 1);
7951
+ __decorateClass([
7952
+ computed
7953
+ ], Editor.prototype, "getSelectedShapeIds", 1);
7954
+ __decorateClass([
7955
+ computed
7956
+ ], Editor.prototype, "getSelectedShapes", 1);
7957
+ __decorateClass([
7958
+ computed
7959
+ ], Editor.prototype, "getCurrentPageShapesInReadingOrder", 1);
7960
+ __decorateClass([
7961
+ computed
7962
+ ], Editor.prototype, "getOnlySelectedShapeId", 1);
7963
+ __decorateClass([
7964
+ computed
7965
+ ], Editor.prototype, "getOnlySelectedShape", 1);
7966
+ __decorateClass([
7967
+ computed
7968
+ ], Editor.prototype, "getSelectionPageBounds", 1);
7969
+ __decorateClass([
7970
+ computed
7971
+ ], Editor.prototype, "getSelectionRotation", 1);
7972
+ __decorateClass([
7973
+ computed
7974
+ ], Editor.prototype, "getSelectionRotatedPageBounds", 1);
7975
+ __decorateClass([
7976
+ computed
7977
+ ], Editor.prototype, "getSelectionRotatedScreenBounds", 1);
7978
+ __decorateClass([
7979
+ computed
7980
+ ], Editor.prototype, "getFocusedGroupId", 1);
7981
+ __decorateClass([
7982
+ computed
7983
+ ], Editor.prototype, "getFocusedGroup", 1);
7984
+ __decorateClass([
7985
+ computed
7986
+ ], Editor.prototype, "getEditingShapeId", 1);
7987
+ __decorateClass([
7988
+ computed
7989
+ ], Editor.prototype, "getEditingShape", 1);
7990
+ __decorateClass([
7991
+ computed
7992
+ ], Editor.prototype, "getRichTextEditor", 1);
7993
+ __decorateClass([
7994
+ computed
7995
+ ], Editor.prototype, "getHoveredShapeId", 1);
7996
+ __decorateClass([
7997
+ computed
7998
+ ], Editor.prototype, "getHoveredShape", 1);
7999
+ __decorateClass([
8000
+ computed
8001
+ ], Editor.prototype, "getHintingShapeIds", 1);
8002
+ __decorateClass([
8003
+ computed
8004
+ ], Editor.prototype, "getHintingShape", 1);
8005
+ __decorateClass([
8006
+ computed
8007
+ ], Editor.prototype, "getErasingShapeIds", 1);
8008
+ __decorateClass([
8009
+ computed
8010
+ ], Editor.prototype, "getErasingShapes", 1);
8011
+ __decorateClass([
8012
+ computed
8013
+ ], Editor.prototype, "_unsafe_getCameraId", 1);
8014
+ __decorateClass([
8015
+ computed
8016
+ ], Editor.prototype, "getCamera", 1);
8017
+ __decorateClass([
8018
+ computed
8019
+ ], Editor.prototype, "getViewportPageBoundsForFollowing", 1);
8020
+ __decorateClass([
8021
+ computed
8022
+ ], Editor.prototype, "getCameraForFollowing", 1);
8023
+ __decorateClass([
8024
+ computed
8025
+ ], Editor.prototype, "getZoomLevel", 1);
8026
+ __decorateClass([
8027
+ computed
8028
+ ], Editor.prototype, "getResizeScaleFactor", 1);
8029
+ __decorateClass([
8030
+ computed
8031
+ ], Editor.prototype, "getDebouncedZoomLevel", 1);
8032
+ __decorateClass([
8033
+ computed
8034
+ ], Editor.prototype, "_getAboveDebouncedZoomThreshold", 1);
8035
+ __decorateClass([
8036
+ computed
8037
+ ], Editor.prototype, "getEfficientZoomLevel", 1);
8038
+ __decorateClass([
8039
+ computed
8040
+ ], Editor.prototype, "getViewportScreenBounds", 1);
8041
+ __decorateClass([
8042
+ computed
8043
+ ], Editor.prototype, "getViewportScreenCenter", 1);
8044
+ __decorateClass([
8045
+ computed
8046
+ ], Editor.prototype, "getViewportPageBounds", 1);
8047
+ __decorateClass([
8048
+ computed
8049
+ ], Editor.prototype, "_getCollaboratorsQuery", 1);
8050
+ __decorateClass([
8051
+ computed
8052
+ ], Editor.prototype, "getCollaborators", 1);
8053
+ __decorateClass([
8054
+ computed
8055
+ ], Editor.prototype, "getCollaboratorsOnCurrentPage", 1);
8056
+ __decorateClass([
8057
+ computed
8058
+ ], Editor.prototype, "getRenderingShapes", 1);
8059
+ __decorateClass([
8060
+ computed
8061
+ ], Editor.prototype, "_getAllPagesQuery", 1);
8062
+ __decorateClass([
8063
+ computed
8064
+ ], Editor.prototype, "getPages", 1);
8065
+ __decorateClass([
8066
+ computed
8067
+ ], Editor.prototype, "getCurrentPageId", 1);
8068
+ __decorateClass([
8069
+ computed
8070
+ ], Editor.prototype, "getCurrentPageShapeIdsSorted", 1);
8071
+ __decorateClass([
8072
+ computed
8073
+ ], Editor.prototype, "_getAllAssetsQuery", 1);
8074
+ __decorateClass([
8075
+ computed
8076
+ ], Editor.prototype, "_getShapeHandlesCache", 1);
8077
+ __decorateClass([
8078
+ computed
8079
+ ], Editor.prototype, "_getShapePageTransformCache", 1);
8080
+ __decorateClass([
8081
+ computed
8082
+ ], Editor.prototype, "_getShapePageBoundsCache", 1);
8083
+ __decorateClass([
8084
+ computed
8085
+ ], Editor.prototype, "_getShapeClipPathCache", 1);
8086
+ __decorateClass([
8087
+ computed
8088
+ ], Editor.prototype, "_getShapeMaskCache", 1);
8089
+ __decorateClass([
8090
+ computed
8091
+ ], Editor.prototype, "_getShapeMaskedPageBoundsCache", 1);
8092
+ __decorateClass([
8093
+ computed
8094
+ ], Editor.prototype, "getNotVisibleShapes", 1);
8095
+ __decorateClass([
8096
+ computed
8097
+ ], Editor.prototype, "getCulledShapes", 1);
8098
+ __decorateClass([
8099
+ computed
8100
+ ], Editor.prototype, "getCurrentPageBounds", 1);
8101
+ __decorateClass([
8102
+ computed
8103
+ ], Editor.prototype, "getCurrentPageShapes", 1);
8104
+ __decorateClass([
8105
+ computed
8106
+ ], Editor.prototype, "getCurrentPageShapesSorted", 1);
8107
+ __decorateClass([
8108
+ computed
8109
+ ], Editor.prototype, "getCurrentPageRenderingShapesSorted", 1);
8110
+ __decorateClass([
8111
+ computed
8112
+ ], Editor.prototype, "_getBindingsIndexCache", 1);
8113
+ __decorateClass([
8114
+ computed
8115
+ ], Editor.prototype, "_getSelectionSharedStyles", 1);
8116
+ __decorateClass([
8117
+ computed({ isEqual: (a, b) => a.equals(b) })
8118
+ ], Editor.prototype, "getSharedStyles", 1);
8119
+ __decorateClass([
8120
+ computed
8121
+ ], Editor.prototype, "getSharedOpacity", 1);
8122
+ __decorateClass([
8123
+ computed
8124
+ ], Editor.prototype, "getIsFocused", 1);
8125
+ __decorateClass([
8126
+ computed
8127
+ ], Editor.prototype, "getIsReadonly", 1);
8128
+ __decorateClass([
8129
+ bind
8130
+ ], Editor.prototype, "_setShiftKeyTimeout", 1);
8131
+ __decorateClass([
8132
+ bind
8133
+ ], Editor.prototype, "_setAltKeyTimeout", 1);
8134
+ __decorateClass([
8135
+ bind
8136
+ ], Editor.prototype, "_setCtrlKeyTimeout", 1);
8137
+ __decorateClass([
8138
+ bind
8139
+ ], Editor.prototype, "_setMetaKeyTimeout", 1);
8032
8140
  function alertMaxShapes(editor, pageId = editor.getCurrentPageId()) {
8033
8141
  const name = editor.getPage(pageId).name;
8034
8142
  editor.emit("max-shapes", { name, pageId, count: editor.options.maxShapesPerPage });