@tldraw/editor 4.6.0-next.5a871ec02ff3 → 4.6.0-next.d15997ff5a4b

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
@@ -5,12 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
9
- var __typeError = (msg) => {
10
- throw TypeError(msg);
11
- };
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
8
  var __export = (target, all) => {
15
9
  for (var name in all)
16
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -32,45 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
26
  mod
33
27
  ));
34
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
- var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
36
- var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
37
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
38
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
39
- var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
40
- var __runInitializers = (array, flags, self, value) => {
41
- 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);
42
- return value;
43
- };
44
- var __decorateElement = (array, flags, name, decorators, target, extra) => {
45
- var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
46
- var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
47
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
48
- var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
49
- return __privateGet(this, extra);
50
- }, set [name](x) {
51
- return __privateSet(this, extra, x);
52
- } }, name));
53
- k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
54
- for (var i = decorators.length - 1; i >= 0; i--) {
55
- ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
56
- if (k) {
57
- ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
58
- if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
59
- if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
60
- }
61
- 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;
62
- if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
63
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
64
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
65
- }
66
- return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
29
+ var __decorateClass = (decorators, target, key, kind) => {
30
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
31
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
32
+ if (decorator = decorators[i])
33
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
34
+ if (kind && result) __defProp(target, key, result);
35
+ return result;
67
36
  };
68
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
69
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
70
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
71
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
72
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
73
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
74
37
  var Editor_exports = {};
75
38
  __export(Editor_exports, {
76
39
  Editor: () => Editor
@@ -81,10 +44,10 @@ var import_store = require("@tldraw/store");
81
44
  var import_tlschema = require("@tldraw/tlschema");
82
45
  var import_utils = require("@tldraw/utils");
83
46
  var import_eventemitter3 = __toESM(require("eventemitter3"), 1);
84
- var import_TLEditorSnapshot = require("../config/TLEditorSnapshot");
85
47
  var import_createTLUser = require("../config/createTLUser");
86
48
  var import_defaultBindings = require("../config/defaultBindings");
87
49
  var import_defaultShapes = require("../config/defaultShapes");
50
+ var import_TLEditorSnapshot = require("../config/TLEditorSnapshot");
88
51
  var import_constants = require("../constants");
89
52
  var import_domUtils = require("../exports/domUtils");
90
53
  var import_exportToSvg = require("../exports/exportToSvg");
@@ -93,13 +56,12 @@ var import_menus = require("../globals/menus");
93
56
  var import_time = require("../globals/time");
94
57
  var import_options = require("../options");
95
58
  var import_Box = require("../primitives/Box");
96
- var import_Mat = require("../primitives/Mat");
97
- var import_Vec = require("../primitives/Vec");
98
59
  var import_easings = require("../primitives/easings");
99
60
  var import_Group2d = require("../primitives/geometry/Group2d");
100
61
  var import_intersect = require("../primitives/intersect");
62
+ var import_Mat = require("../primitives/Mat");
101
63
  var import_utils2 = require("../primitives/utils");
102
- var import_SharedStylesMap = require("../utils/SharedStylesMap");
64
+ var import_Vec = require("../primitives/Vec");
103
65
  var import_areShapesContentEqual = require("../utils/areShapesContentEqual");
104
66
  var import_assets = require("../utils/assets");
105
67
  var import_debug_flags = require("../utils/debug-flags");
@@ -108,6 +70,7 @@ var import_getIncrementedName = require("../utils/getIncrementedName");
108
70
  var import_reorderShapes = require("../utils/reorderShapes");
109
71
  var import_reparenting = require("../utils/reparenting");
110
72
  var import_rotation = require("../utils/rotation");
73
+ var import_SharedStylesMap = require("../utils/SharedStylesMap");
111
74
  var import_bindingsIndex = require("./derivations/bindingsIndex");
112
75
  var import_notVisibleShapes = require("./derivations/notVisibleShapes");
113
76
  var import_parentsToChildren = require("./derivations/parentsToChildren");
@@ -125,8 +88,8 @@ var import_TextManager = require("./managers/TextManager/TextManager");
125
88
  var import_TickManager = require("./managers/TickManager/TickManager");
126
89
  var import_UserPreferencesManager = require("./managers/UserPreferencesManager/UserPreferencesManager");
127
90
  var import_RootState = require("./tools/RootState");
128
- 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;
129
- class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _canUndo_dec = [import_state.computed], _canRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getResizeScaleFactor_dec = [import_state.computed], _getDebouncedZoomLevel_dec = [import_state.computed], __getAboveDebouncedZoomThreshold_dec = [import_state.computed], _getEfficientZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
91
+ class Editor extends import_eventemitter3.default {
92
+ id = (0, import_utils.uniqueId)();
130
93
  constructor({
131
94
  store,
132
95
  user,
@@ -148,233 +111,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
148
111
  fontAssetUrls
149
112
  }) {
150
113
  super();
151
- __runInitializers(_init, 5, this);
152
- __publicField(this, "id", (0, import_utils.uniqueId)());
153
- __publicField(this, "_getShapeVisibility");
154
- __publicField(this, "options");
155
- __publicField(this, "contextId", (0, import_utils.uniqueId)());
156
- /**
157
- * The editor's store
158
- *
159
- * @public
160
- */
161
- __publicField(this, "store");
162
- /**
163
- * The root state of the statechart.
164
- *
165
- * @public
166
- */
167
- __publicField(this, "root");
168
- /**
169
- * A set of functions to call when the editor is disposed.
170
- *
171
- * @public
172
- */
173
- __publicField(this, "disposables", /* @__PURE__ */ new Set());
174
- /**
175
- * Whether the editor is disposed.
176
- *
177
- * @public
178
- */
179
- __publicField(this, "isDisposed", false);
180
- /**
181
- * A manager for the editor's tick events.
182
- *
183
- * @internal */
184
- __publicField(this, "_tickManager");
185
- /**
186
- * A manager for the editor's input state.
187
- *
188
- * @public
189
- */
190
- __publicField(this, "inputs");
191
- /**
192
- * A manager for the editor's snapping feature.
193
- *
194
- * @public
195
- */
196
- __publicField(this, "snaps");
197
- __publicField(this, "_spatialIndex");
198
- /**
199
- * A manager for the any asynchronous events and making sure they're
200
- * cleaned up upon disposal.
201
- *
202
- * @public
203
- */
204
- __publicField(this, "timers", import_time.tltime.forContext(this.contextId));
205
- /**
206
- * A manager for the user and their preferences.
207
- *
208
- * @public
209
- */
210
- __publicField(this, "user");
211
- /**
212
- * A helper for measuring text.
213
- *
214
- * @public
215
- */
216
- __publicField(this, "textMeasure");
217
- /**
218
- * A utility for managing the set of fonts that should be rendered in the document.
219
- *
220
- * @public
221
- */
222
- __publicField(this, "fonts");
223
- /**
224
- * A manager for the editor's scribbles.
225
- *
226
- * @public
227
- */
228
- __publicField(this, "scribbles");
229
- /**
230
- * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
231
- *
232
- * @public
233
- */
234
- __publicField(this, "sideEffects");
235
- /**
236
- * A manager for moving the camera when the mouse is at the edge of the screen.
237
- *
238
- * @public
239
- */
240
- __publicField(this, "edgeScrollManager");
241
- /**
242
- * A manager for ensuring correct focus. See FocusManager for details.
243
- *
244
- * @internal
245
- */
246
- __publicField(this, "focusManager");
247
- /**
248
- * The current HTML element containing the editor.
249
- *
250
- * @example
251
- * ```ts
252
- * const container = editor.getContainer()
253
- * ```
254
- *
255
- * @public
256
- */
257
- __publicField(this, "getContainer");
258
- /* ------------------- Shape Utils ------------------ */
259
- /**
260
- * A map of shape utility classes (TLShapeUtils) by shape type.
261
- *
262
- * @public
263
- */
264
- __publicField(this, "shapeUtils");
265
- __publicField(this, "styleProps");
266
- /* ------------------- Binding Utils ------------------ */
267
- /**
268
- * A map of shape utility classes (TLShapeUtils) by shape type.
269
- *
270
- * @public
271
- */
272
- __publicField(this, "bindingUtils");
273
- /* --------------------- History -------------------- */
274
- /**
275
- * A manager for the editor's history.
276
- *
277
- * @readonly
278
- */
279
- __publicField(this, "history");
280
- __publicField(this, "_shouldIgnoreShapeLock", false);
281
- /** @internal */
282
- __publicField(this, "_crashingError", null);
283
- /** @internal */
284
- __publicField(this, "_isChangingStyleTimeout", -1);
285
- // Menus
286
- __publicField(this, "menus", import_menus.tlmenus.forContext(this.contextId));
287
- // Rich text editor
288
- __publicField(this, "_currentRichTextEditor", (0, import_state.atom)("rich text editor", null));
289
- __publicField(this, "_textOptions");
290
- __publicField(this, "_debouncedZoomLevel", (0, import_state.atom)("debounced zoom level", 1));
291
- __publicField(this, "_cameraOptions", (0, import_state.atom)("camera options", import_constants.DEFAULT_CAMERA_OPTIONS));
292
- /** @internal */
293
- __publicField(this, "_viewportAnimation", null);
294
- // Viewport
295
- /** @internal */
296
- __publicField(this, "_willSetInitialBounds", true);
297
- // Following
298
- // When we are 'locked on' to a user, our camera is derived from their camera.
299
- __publicField(this, "_isLockedOnFollowingUser", (0, import_state.atom)("isLockedOnFollowingUser", false));
300
- // Camera state
301
- // Camera state does two things: first, it allows us to subscribe to whether
302
- // the camera is moving or not; and second, it allows us to update the rendering
303
- // shapes on the canvas. Changing the rendering shapes may cause shapes to
304
- // unmount / remount in the DOM, which is expensive; and computing visibility is
305
- // also expensive in large projects. For this reason, we use a second bounding
306
- // box just for rendering, and we only update after the camera stops moving.
307
- __publicField(this, "_cameraStateTimeoutRemaining", 0);
308
- /* @internal */
309
- __publicField(this, "_currentPageShapeIds");
310
- /* --------------------- Shapes --------------------- */
311
- __publicField(this, "_shapeGeometryCaches", {});
312
- __publicField(this, "_notVisibleShapes", (0, import_notVisibleShapes.notVisibleShapes)(this));
313
- __publicField(this, "_culledShapesCache", null);
314
- // Parents and children
315
- /**
316
- * A cache of parents to children.
317
- *
318
- * @internal
319
- */
320
- __publicField(this, "_parentIdsToChildIds");
321
- __publicField(this, "animatingShapes", /* @__PURE__ */ new Map());
322
- /* --------------------- Content -------------------- */
323
- /** @internal */
324
- __publicField(this, "externalAssetContentHandlers", {
325
- file: null,
326
- url: null
327
- });
328
- /** @internal */
329
- __publicField(this, "temporaryAssetPreview", /* @__PURE__ */ new Map());
330
- /** @internal */
331
- __publicField(this, "externalContentHandlers", {
332
- text: null,
333
- files: null,
334
- "file-replace": null,
335
- embed: null,
336
- "svg-text": null,
337
- url: null,
338
- tldraw: null,
339
- excalidraw: null
340
- });
341
- /**
342
- * A manager for recording multiple click events.
343
- *
344
- * @internal
345
- */
346
- __publicField(this, "_clickManager", new import_ClickManager.ClickManager(this));
347
- /**
348
- * The previous cursor. Used for restoring the cursor after pan events.
349
- *
350
- * @internal
351
- */
352
- __publicField(this, "_prevCursor", "default");
353
- /** @internal */
354
- __publicField(this, "_shiftKeyTimeout", -1);
355
- /** @internal */
356
- __publicField(this, "_altKeyTimeout", -1);
357
- /** @internal */
358
- __publicField(this, "_ctrlKeyTimeout", -1);
359
- /** @internal */
360
- __publicField(this, "_metaKeyTimeout", -1);
361
- /** @internal */
362
- __publicField(this, "_restoreToolId", "select");
363
- /** @internal */
364
- __publicField(this, "_didPinch", false);
365
- /** @internal */
366
- __publicField(this, "_selectedShapeIdsAtPointerDown", []);
367
- /** @internal */
368
- __publicField(this, "_longPressTimeout", -1);
369
- /** @internal */
370
- __publicField(this, "capturedPointerId", null);
371
- /** @internal */
372
- __publicField(this, "performanceTracker");
373
- /** @internal */
374
- __publicField(this, "performanceTrackerTimeout", -1);
375
- /** @internal */
376
- __publicField(this, "handledEvents", /* @__PURE__ */ new WeakSet());
377
- __publicField(this, "_pendingEventsForNextTick", []);
378
114
  this._getShapeVisibility = getShapeVisibility;
379
115
  const options = _textOptions ? { ..._options, text: _options?.text ?? _textOptions } : _options;
380
116
  this.options = { ...import_options.defaultTldrawOptions, ...options };
@@ -780,6 +516,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
780
516
  );
781
517
  }
782
518
  }
519
+ _getShapeVisibility;
783
520
  getIsShapeHiddenCache() {
784
521
  if (!this._getShapeVisibility) return null;
785
522
  return this.store.createComputedCache("isShapeHidden", (shape) => {
@@ -795,6 +532,20 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
795
532
  typeof shapeOrId === "string" ? shapeOrId : shapeOrId.id
796
533
  );
797
534
  }
535
+ options;
536
+ contextId = (0, import_utils.uniqueId)();
537
+ /**
538
+ * The editor's store
539
+ *
540
+ * @public
541
+ */
542
+ store;
543
+ /**
544
+ * The root state of the statechart.
545
+ *
546
+ * @public
547
+ */
548
+ root;
798
549
  /**
799
550
  * Set a tool. Useful if you need to add a tool to the state chart on demand,
800
551
  * after the editor has already been initialized.
@@ -826,6 +577,96 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
826
577
  delete parent.children[Tool.id];
827
578
  }
828
579
  }
580
+ /**
581
+ * A set of functions to call when the editor is disposed.
582
+ *
583
+ * @public
584
+ */
585
+ disposables = /* @__PURE__ */ new Set();
586
+ /**
587
+ * Whether the editor is disposed.
588
+ *
589
+ * @public
590
+ */
591
+ isDisposed = false;
592
+ /**
593
+ * A manager for the editor's tick events.
594
+ *
595
+ * @internal */
596
+ _tickManager;
597
+ /**
598
+ * A manager for the editor's input state.
599
+ *
600
+ * @public
601
+ */
602
+ inputs;
603
+ /**
604
+ * A manager for the editor's snapping feature.
605
+ *
606
+ * @public
607
+ */
608
+ snaps;
609
+ _spatialIndex;
610
+ /**
611
+ * A manager for the any asynchronous events and making sure they're
612
+ * cleaned up upon disposal.
613
+ *
614
+ * @public
615
+ */
616
+ timers = import_time.tltime.forContext(this.contextId);
617
+ /**
618
+ * A manager for the user and their preferences.
619
+ *
620
+ * @public
621
+ */
622
+ user;
623
+ /**
624
+ * A helper for measuring text.
625
+ *
626
+ * @public
627
+ */
628
+ textMeasure;
629
+ /**
630
+ * A utility for managing the set of fonts that should be rendered in the document.
631
+ *
632
+ * @public
633
+ */
634
+ fonts;
635
+ /**
636
+ * A manager for the editor's scribbles.
637
+ *
638
+ * @public
639
+ */
640
+ scribbles;
641
+ /**
642
+ * A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
643
+ *
644
+ * @public
645
+ */
646
+ sideEffects;
647
+ /**
648
+ * A manager for moving the camera when the mouse is at the edge of the screen.
649
+ *
650
+ * @public
651
+ */
652
+ edgeScrollManager;
653
+ /**
654
+ * A manager for ensuring correct focus. See FocusManager for details.
655
+ *
656
+ * @internal
657
+ */
658
+ focusManager;
659
+ /**
660
+ * The current HTML element containing the editor.
661
+ *
662
+ * @example
663
+ * ```ts
664
+ * const container = editor.getContainer()
665
+ * ```
666
+ *
667
+ * @public
668
+ */
669
+ getContainer;
829
670
  /**
830
671
  * The document that the editor's container element belongs to.
831
672
  * Use this instead of the global `document` to support cross-window embedding.
@@ -856,6 +697,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
856
697
  this.isDisposed = true;
857
698
  this.emit("dispose");
858
699
  }
700
+ /* ------------------- Shape Utils ------------------ */
701
+ /**
702
+ * A map of shape utility classes (TLShapeUtils) by shape type.
703
+ *
704
+ * @public
705
+ */
706
+ shapeUtils;
707
+ styleProps;
859
708
  getShapeUtil(arg) {
860
709
  const type = typeof arg === "string" ? arg : arg.type;
861
710
  const shapeUtil = (0, import_utils.getOwnProperty)(this.shapeUtils, type);
@@ -866,12 +715,26 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
866
715
  const type = typeof arg === "string" ? arg : arg.type;
867
716
  return (0, import_utils.hasOwnProperty)(this.shapeUtils, type);
868
717
  }
718
+ /* ------------------- Binding Utils ------------------ */
719
+ /**
720
+ * A map of shape utility classes (TLShapeUtils) by shape type.
721
+ *
722
+ * @public
723
+ */
724
+ bindingUtils;
869
725
  getBindingUtil(arg) {
870
726
  const type = typeof arg === "string" ? arg : arg.type;
871
727
  const bindingUtil = (0, import_utils.getOwnProperty)(this.bindingUtils, type);
872
728
  (0, import_utils.assert)(bindingUtil, `No binding util found for type "${type}"`);
873
729
  return bindingUtil;
874
730
  }
731
+ /* --------------------- History -------------------- */
732
+ /**
733
+ * A manager for the editor's history.
734
+ *
735
+ * @readonly
736
+ */
737
+ history;
875
738
  /**
876
739
  * Undo to the last mark.
877
740
  *
@@ -999,6 +862,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
999
862
  this.history.bailToMark(id);
1000
863
  return this;
1001
864
  }
865
+ _shouldIgnoreShapeLock = false;
1002
866
  /**
1003
867
  * Run a function in a transaction with optional options for context.
1004
868
  * You can use the options to change the way that history is treated
@@ -1090,6 +954,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1090
954
  };
1091
955
  }
1092
956
  }
957
+ /** @internal */
958
+ _crashingError = null;
1093
959
  /**
1094
960
  * We can't use an `atom` here because there's a chance that when `crashAndReportError` is called,
1095
961
  * we're in a transaction that's about to be rolled back due to the same error we're currently
@@ -1256,6 +1122,10 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1256
1122
  ]);
1257
1123
  }, opts);
1258
1124
  }
1125
+ /** @internal */
1126
+ _isChangingStyleTimeout = -1;
1127
+ // Menus
1128
+ menus = import_menus.tlmenus.forContext(this.contextId);
1259
1129
  /* --------------------- Cursor --------------------- */
1260
1130
  /**
1261
1131
  * Set the cursor.
@@ -1821,6 +1691,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1821
1691
  );
1822
1692
  return this;
1823
1693
  }
1694
+ // Rich text editor
1695
+ _currentRichTextEditor = (0, import_state.atom)("rich text editor", null);
1824
1696
  getRichTextEditor() {
1825
1697
  return this._currentRichTextEditor.get();
1826
1698
  }
@@ -2000,6 +1872,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2000
1872
  }
2001
1873
  return this;
2002
1874
  }
1875
+ _textOptions;
2003
1876
  /**
2004
1877
  * Get the current text options.
2005
1878
  *
@@ -2070,6 +1943,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2070
1943
  getResizeScaleFactor() {
2071
1944
  return this.user.getIsDynamicResizeMode() ? 1 / this.getZoomLevel() : 1;
2072
1945
  }
1946
+ _debouncedZoomLevel = (0, import_state.atom)("debounced zoom level", 1);
2073
1947
  getDebouncedZoomLevel() {
2074
1948
  if (this.options.debouncedZoom) {
2075
1949
  if (this.getCameraState() === "idle") {
@@ -2174,6 +2048,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2174
2048
  }
2175
2049
  }
2176
2050
  }
2051
+ _cameraOptions = (0, import_state.atom)("camera options", import_constants.DEFAULT_CAMERA_OPTIONS);
2177
2052
  /**
2178
2053
  * Get the current camera options.
2179
2054
  *
@@ -2648,6 +2523,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2648
2523
  return this;
2649
2524
  }
2650
2525
  /** @internal */
2526
+ _viewportAnimation = null;
2527
+ /** @internal */
2651
2528
  _animateViewport(ms) {
2652
2529
  if (!this._viewportAnimation) return;
2653
2530
  this._viewportAnimation.elapsed += ms;
@@ -2786,6 +2663,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2786
2663
  });
2787
2664
  return this;
2788
2665
  }
2666
+ // Viewport
2667
+ /** @internal */
2668
+ _willSetInitialBounds = true;
2789
2669
  /**
2790
2670
  * Update the viewport. The viewport will measure the size and screen position of its container
2791
2671
  * element. This should be done whenever the container's position on the screen changes.
@@ -2941,6 +2821,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2941
2821
  const currentPageId = this.getCurrentPageId();
2942
2822
  return this.getCollaborators().filter((c) => c.currentPageId === currentPageId);
2943
2823
  }
2824
+ // Following
2825
+ // When we are 'locked on' to a user, our camera is derived from their camera.
2826
+ _isLockedOnFollowingUser = (0, import_state.atom)("isLockedOnFollowingUser", false);
2944
2827
  /**
2945
2828
  * Start viewport-following a user.
2946
2829
  *
@@ -3116,6 +2999,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3116
2999
  }
3117
3000
  return renderingShapes;
3118
3001
  }
3002
+ // Camera state
3003
+ // Camera state does two things: first, it allows us to subscribe to whether
3004
+ // the camera is moving or not; and second, it allows us to update the rendering
3005
+ // shapes on the canvas. Changing the rendering shapes may cause shapes to
3006
+ // unmount / remount in the DOM, which is expensive; and computing visibility is
3007
+ // also expensive in large projects. For this reason, we use a second bounding
3008
+ // box just for rendering, and we only update after the camera stops moving.
3009
+ _cameraStateTimeoutRemaining = 0;
3119
3010
  _decayCameraStateTimeout(elapsed) {
3120
3011
  this._cameraStateTimeoutRemaining -= elapsed;
3121
3012
  if (this._cameraStateTimeoutRemaining > 0) return;
@@ -3187,6 +3078,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3187
3078
  getPage(page) {
3188
3079
  return this.store.get(typeof page === "string" ? page : page.id);
3189
3080
  }
3081
+ /* @internal */
3082
+ _currentPageShapeIds;
3190
3083
  /**
3191
3084
  * An array of all of the shapes on the current page.
3192
3085
  *
@@ -3508,6 +3401,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3508
3401
  async uploadAsset(asset, file, abortSignal) {
3509
3402
  return await this.store.props.assets.upload(asset, file, abortSignal);
3510
3403
  }
3404
+ /* --------------------- Shapes --------------------- */
3405
+ _shapeGeometryCaches = {};
3511
3406
  /**
3512
3407
  * Get the geometry of a shape in shape-space.
3513
3408
  *
@@ -3878,6 +3773,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3878
3773
  getNotVisibleShapes() {
3879
3774
  return this._notVisibleShapes.get();
3880
3775
  }
3776
+ _notVisibleShapes = (0, import_notVisibleShapes.notVisibleShapes)(this);
3777
+ _culledShapesCache = null;
3881
3778
  getCulledShapes() {
3882
3779
  const notVisibleShapes2 = this.getNotVisibleShapes();
3883
3780
  const selectedShapeIds = this.getSelectedShapeIds();
@@ -4292,6 +4189,13 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
4292
4189
  return this.getAncestorPageId(this.getShape(_shape.parentId));
4293
4190
  }
4294
4191
  }
4192
+ // Parents and children
4193
+ /**
4194
+ * A cache of parents to children.
4195
+ *
4196
+ * @internal
4197
+ */
4198
+ _parentIdsToChildIds;
4295
4199
  /**
4296
4200
  * Reparent shapes to a new parent. This operation preserves the shape's current page positions /
4297
4201
  * rotations.
@@ -5936,6 +5840,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5936
5840
  });
5937
5841
  return this;
5938
5842
  }
5843
+ animatingShapes = /* @__PURE__ */ new Map();
5939
5844
  /**
5940
5845
  * Animate a shape.
5941
5846
  *
@@ -6429,6 +6334,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6429
6334
  }
6430
6335
  return this;
6431
6336
  }
6337
+ /* --------------------- Content -------------------- */
6338
+ /** @internal */
6339
+ externalAssetContentHandlers = {
6340
+ file: null,
6341
+ url: null
6342
+ };
6343
+ /** @internal */
6344
+ temporaryAssetPreview = /* @__PURE__ */ new Map();
6432
6345
  /**
6433
6346
  * Register an external asset handler. This handler will be called when the editor needs to
6434
6347
  * create an asset for some external content, like an image/video file or a bookmark URL. For
@@ -6514,6 +6427,17 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6514
6427
  hasExternalAssetHandler(type) {
6515
6428
  return !!this.externalAssetContentHandlers[type];
6516
6429
  }
6430
+ /** @internal */
6431
+ externalContentHandlers = {
6432
+ text: null,
6433
+ files: null,
6434
+ "file-replace": null,
6435
+ embed: null,
6436
+ "svg-text": null,
6437
+ url: null,
6438
+ tldraw: null,
6439
+ excalidraw: null
6440
+ };
6517
6441
  /**
6518
6442
  * Register an external content handler. This handler will be called when the editor receives
6519
6443
  * external content of the provided type. For example, the 'image' type handler will be called
@@ -7403,6 +7327,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7403
7327
  scheduleEffect.cancel();
7404
7328
  };
7405
7329
  }
7330
+ /**
7331
+ * A manager for recording multiple click events.
7332
+ *
7333
+ * @internal
7334
+ */
7335
+ _clickManager = new import_ClickManager.ClickManager(this);
7406
7336
  /**
7407
7337
  * Prevent a double click event from firing the next time the user clicks
7408
7338
  *
@@ -7411,6 +7341,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7411
7341
  cancelDoubleClick() {
7412
7342
  this._clickManager.cancelDoubleClickTimeout();
7413
7343
  }
7344
+ /**
7345
+ * The previous cursor. Used for restoring the cursor after pan events.
7346
+ *
7347
+ * @internal
7348
+ */
7349
+ _prevCursor = "default";
7350
+ /** @internal */
7351
+ _shiftKeyTimeout = -1;
7414
7352
  _setShiftKeyTimeout() {
7415
7353
  this.inputs.setShiftKey(false);
7416
7354
  this.dispatch({
@@ -7425,6 +7363,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7425
7363
  code: "ShiftLeft"
7426
7364
  });
7427
7365
  }
7366
+ /** @internal */
7367
+ _altKeyTimeout = -1;
7428
7368
  _setAltKeyTimeout() {
7429
7369
  this.inputs.setAltKey(false);
7430
7370
  this.dispatch({
@@ -7439,6 +7379,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7439
7379
  code: "AltLeft"
7440
7380
  });
7441
7381
  }
7382
+ /** @internal */
7383
+ _ctrlKeyTimeout = -1;
7442
7384
  _setCtrlKeyTimeout() {
7443
7385
  this.inputs.setCtrlKey(false);
7444
7386
  this.dispatch({
@@ -7453,6 +7395,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7453
7395
  code: "ControlLeft"
7454
7396
  });
7455
7397
  }
7398
+ /** @internal */
7399
+ _metaKeyTimeout = -1;
7456
7400
  _setMetaKeyTimeout() {
7457
7401
  this.inputs.setMetaKey(false);
7458
7402
  this.dispatch({
@@ -7467,6 +7411,22 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7467
7411
  code: "MetaLeft"
7468
7412
  });
7469
7413
  }
7414
+ /** @internal */
7415
+ _restoreToolId = "select";
7416
+ /** @internal */
7417
+ _didPinch = false;
7418
+ /** @internal */
7419
+ _selectedShapeIdsAtPointerDown = [];
7420
+ /** @internal */
7421
+ _longPressTimeout = -1;
7422
+ /** @internal */
7423
+ capturedPointerId = null;
7424
+ /** @internal */
7425
+ performanceTracker;
7426
+ /** @internal */
7427
+ performanceTrackerTimeout = -1;
7428
+ /** @internal */
7429
+ handledEvents = /* @__PURE__ */ new WeakSet();
7470
7430
  /**
7471
7431
  * In tldraw, events are sometimes handled by multiple components. For example, the shapes might
7472
7432
  * have events, but the canvas handles events too. The way that the canvas handles events can
@@ -7512,6 +7472,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7512
7472
  }
7513
7473
  return this;
7514
7474
  }
7475
+ _pendingEventsForNextTick = [];
7515
7476
  _flushEventsForTick(elapsed) {
7516
7477
  this.run(() => {
7517
7478
  if (this._pendingEventsForNextTick.length > 0) {
@@ -7919,83 +7880,231 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7919
7880
  }
7920
7881
  }
7921
7882
  }
7922
- _init = __decoratorStart(_a);
7923
- __decorateElement(_init, 1, "getIsShapeHiddenCache", _getIsShapeHiddenCache_dec, Editor);
7924
- __decorateElement(_init, 1, "canUndo", _canUndo_dec, Editor);
7925
- __decorateElement(_init, 1, "canRedo", _canRedo_dec, Editor);
7926
- __decorateElement(_init, 1, "getPath", _getPath_dec, Editor);
7927
- __decorateElement(_init, 1, "getCurrentTool", _getCurrentTool_dec, Editor);
7928
- __decorateElement(_init, 1, "getCurrentToolId", _getCurrentToolId_dec, Editor);
7929
- __decorateElement(_init, 1, "getDocumentSettings", _getDocumentSettings_dec, Editor);
7930
- __decorateElement(_init, 1, "getInstanceState", _getInstanceState_dec, Editor);
7931
- __decorateElement(_init, 1, "getPageStates", _getPageStates_dec, Editor);
7932
- __decorateElement(_init, 1, "_getPageStatesQuery", __getPageStatesQuery_dec, Editor);
7933
- __decorateElement(_init, 1, "getCurrentPageState", _getCurrentPageState_dec, Editor);
7934
- __decorateElement(_init, 1, "_getCurrentPageStateId", __getCurrentPageStateId_dec, Editor);
7935
- __decorateElement(_init, 1, "getSelectedShapeIds", _getSelectedShapeIds_dec, Editor);
7936
- __decorateElement(_init, 1, "getSelectedShapes", _getSelectedShapes_dec, Editor);
7937
- __decorateElement(_init, 1, "getCurrentPageShapesInReadingOrder", _getCurrentPageShapesInReadingOrder_dec, Editor);
7938
- __decorateElement(_init, 1, "getOnlySelectedShapeId", _getOnlySelectedShapeId_dec, Editor);
7939
- __decorateElement(_init, 1, "getOnlySelectedShape", _getOnlySelectedShape_dec, Editor);
7940
- __decorateElement(_init, 1, "getSelectionPageBounds", _getSelectionPageBounds_dec, Editor);
7941
- __decorateElement(_init, 1, "getSelectionRotation", _getSelectionRotation_dec, Editor);
7942
- __decorateElement(_init, 1, "getSelectionRotatedPageBounds", _getSelectionRotatedPageBounds_dec, Editor);
7943
- __decorateElement(_init, 1, "getSelectionRotatedScreenBounds", _getSelectionRotatedScreenBounds_dec, Editor);
7944
- __decorateElement(_init, 1, "getFocusedGroupId", _getFocusedGroupId_dec, Editor);
7945
- __decorateElement(_init, 1, "getFocusedGroup", _getFocusedGroup_dec, Editor);
7946
- __decorateElement(_init, 1, "getEditingShapeId", _getEditingShapeId_dec, Editor);
7947
- __decorateElement(_init, 1, "getEditingShape", _getEditingShape_dec, Editor);
7948
- __decorateElement(_init, 1, "getRichTextEditor", _getRichTextEditor_dec, Editor);
7949
- __decorateElement(_init, 1, "getHoveredShapeId", _getHoveredShapeId_dec, Editor);
7950
- __decorateElement(_init, 1, "getHoveredShape", _getHoveredShape_dec, Editor);
7951
- __decorateElement(_init, 1, "getHintingShapeIds", _getHintingShapeIds_dec, Editor);
7952
- __decorateElement(_init, 1, "getHintingShape", _getHintingShape_dec, Editor);
7953
- __decorateElement(_init, 1, "getErasingShapeIds", _getErasingShapeIds_dec, Editor);
7954
- __decorateElement(_init, 1, "getErasingShapes", _getErasingShapes_dec, Editor);
7955
- __decorateElement(_init, 1, "_unsafe_getCameraId", __unsafe_getCameraId_dec, Editor);
7956
- __decorateElement(_init, 1, "getCamera", _getCamera_dec, Editor);
7957
- __decorateElement(_init, 1, "getViewportPageBoundsForFollowing", _getViewportPageBoundsForFollowing_dec, Editor);
7958
- __decorateElement(_init, 1, "getCameraForFollowing", _getCameraForFollowing_dec, Editor);
7959
- __decorateElement(_init, 1, "getZoomLevel", _getZoomLevel_dec, Editor);
7960
- __decorateElement(_init, 1, "getResizeScaleFactor", _getResizeScaleFactor_dec, Editor);
7961
- __decorateElement(_init, 1, "getDebouncedZoomLevel", _getDebouncedZoomLevel_dec, Editor);
7962
- __decorateElement(_init, 1, "_getAboveDebouncedZoomThreshold", __getAboveDebouncedZoomThreshold_dec, Editor);
7963
- __decorateElement(_init, 1, "getEfficientZoomLevel", _getEfficientZoomLevel_dec, Editor);
7964
- __decorateElement(_init, 1, "getViewportScreenBounds", _getViewportScreenBounds_dec, Editor);
7965
- __decorateElement(_init, 1, "getViewportScreenCenter", _getViewportScreenCenter_dec, Editor);
7966
- __decorateElement(_init, 1, "getViewportPageBounds", _getViewportPageBounds_dec, Editor);
7967
- __decorateElement(_init, 1, "_getCollaboratorsQuery", __getCollaboratorsQuery_dec, Editor);
7968
- __decorateElement(_init, 1, "getCollaborators", _getCollaborators_dec, Editor);
7969
- __decorateElement(_init, 1, "getCollaboratorsOnCurrentPage", _getCollaboratorsOnCurrentPage_dec, Editor);
7970
- __decorateElement(_init, 1, "getRenderingShapes", _getRenderingShapes_dec, Editor);
7971
- __decorateElement(_init, 1, "_getAllPagesQuery", __getAllPagesQuery_dec, Editor);
7972
- __decorateElement(_init, 1, "getPages", _getPages_dec, Editor);
7973
- __decorateElement(_init, 1, "getCurrentPageId", _getCurrentPageId_dec, Editor);
7974
- __decorateElement(_init, 1, "getCurrentPageShapeIdsSorted", _getCurrentPageShapeIdsSorted_dec, Editor);
7975
- __decorateElement(_init, 1, "_getAllAssetsQuery", __getAllAssetsQuery_dec, Editor);
7976
- __decorateElement(_init, 1, "_getShapeHandlesCache", __getShapeHandlesCache_dec, Editor);
7977
- __decorateElement(_init, 1, "_getShapePageTransformCache", __getShapePageTransformCache_dec, Editor);
7978
- __decorateElement(_init, 1, "_getShapePageBoundsCache", __getShapePageBoundsCache_dec, Editor);
7979
- __decorateElement(_init, 1, "_getShapeClipPathCache", __getShapeClipPathCache_dec, Editor);
7980
- __decorateElement(_init, 1, "_getShapeMaskCache", __getShapeMaskCache_dec, Editor);
7981
- __decorateElement(_init, 1, "_getShapeMaskedPageBoundsCache", __getShapeMaskedPageBoundsCache_dec, Editor);
7982
- __decorateElement(_init, 1, "getNotVisibleShapes", _getNotVisibleShapes_dec, Editor);
7983
- __decorateElement(_init, 1, "getCulledShapes", _getCulledShapes_dec, Editor);
7984
- __decorateElement(_init, 1, "getCurrentPageBounds", _getCurrentPageBounds_dec, Editor);
7985
- __decorateElement(_init, 1, "getCurrentPageShapes", _getCurrentPageShapes_dec, Editor);
7986
- __decorateElement(_init, 1, "getCurrentPageShapesSorted", _getCurrentPageShapesSorted_dec, Editor);
7987
- __decorateElement(_init, 1, "getCurrentPageRenderingShapesSorted", _getCurrentPageRenderingShapesSorted_dec, Editor);
7988
- __decorateElement(_init, 1, "_getBindingsIndexCache", __getBindingsIndexCache_dec, Editor);
7989
- __decorateElement(_init, 1, "_getSelectionSharedStyles", __getSelectionSharedStyles_dec, Editor);
7990
- __decorateElement(_init, 1, "getSharedStyles", _getSharedStyles_dec, Editor);
7991
- __decorateElement(_init, 1, "getSharedOpacity", _getSharedOpacity_dec, Editor);
7992
- __decorateElement(_init, 1, "getIsFocused", _getIsFocused_dec, Editor);
7993
- __decorateElement(_init, 1, "getIsReadonly", _getIsReadonly_dec, Editor);
7994
- __decorateElement(_init, 1, "_setShiftKeyTimeout", __setShiftKeyTimeout_dec, Editor);
7995
- __decorateElement(_init, 1, "_setAltKeyTimeout", __setAltKeyTimeout_dec, Editor);
7996
- __decorateElement(_init, 1, "_setCtrlKeyTimeout", __setCtrlKeyTimeout_dec, Editor);
7997
- __decorateElement(_init, 1, "_setMetaKeyTimeout", __setMetaKeyTimeout_dec, Editor);
7998
- __decoratorMetadata(_init, Editor);
7883
+ __decorateClass([
7884
+ import_state.computed
7885
+ ], Editor.prototype, "getIsShapeHiddenCache", 1);
7886
+ __decorateClass([
7887
+ import_state.computed
7888
+ ], Editor.prototype, "canUndo", 1);
7889
+ __decorateClass([
7890
+ import_state.computed
7891
+ ], Editor.prototype, "canRedo", 1);
7892
+ __decorateClass([
7893
+ import_state.computed
7894
+ ], Editor.prototype, "getPath", 1);
7895
+ __decorateClass([
7896
+ import_state.computed
7897
+ ], Editor.prototype, "getCurrentTool", 1);
7898
+ __decorateClass([
7899
+ import_state.computed
7900
+ ], Editor.prototype, "getCurrentToolId", 1);
7901
+ __decorateClass([
7902
+ import_state.computed
7903
+ ], Editor.prototype, "getDocumentSettings", 1);
7904
+ __decorateClass([
7905
+ import_state.computed
7906
+ ], Editor.prototype, "getInstanceState", 1);
7907
+ __decorateClass([
7908
+ import_state.computed
7909
+ ], Editor.prototype, "getPageStates", 1);
7910
+ __decorateClass([
7911
+ import_state.computed
7912
+ ], Editor.prototype, "_getPageStatesQuery", 1);
7913
+ __decorateClass([
7914
+ import_state.computed
7915
+ ], Editor.prototype, "getCurrentPageState", 1);
7916
+ __decorateClass([
7917
+ import_state.computed
7918
+ ], Editor.prototype, "_getCurrentPageStateId", 1);
7919
+ __decorateClass([
7920
+ import_state.computed
7921
+ ], Editor.prototype, "getSelectedShapeIds", 1);
7922
+ __decorateClass([
7923
+ import_state.computed
7924
+ ], Editor.prototype, "getSelectedShapes", 1);
7925
+ __decorateClass([
7926
+ import_state.computed
7927
+ ], Editor.prototype, "getCurrentPageShapesInReadingOrder", 1);
7928
+ __decorateClass([
7929
+ import_state.computed
7930
+ ], Editor.prototype, "getOnlySelectedShapeId", 1);
7931
+ __decorateClass([
7932
+ import_state.computed
7933
+ ], Editor.prototype, "getOnlySelectedShape", 1);
7934
+ __decorateClass([
7935
+ import_state.computed
7936
+ ], Editor.prototype, "getSelectionPageBounds", 1);
7937
+ __decorateClass([
7938
+ import_state.computed
7939
+ ], Editor.prototype, "getSelectionRotation", 1);
7940
+ __decorateClass([
7941
+ import_state.computed
7942
+ ], Editor.prototype, "getSelectionRotatedPageBounds", 1);
7943
+ __decorateClass([
7944
+ import_state.computed
7945
+ ], Editor.prototype, "getSelectionRotatedScreenBounds", 1);
7946
+ __decorateClass([
7947
+ import_state.computed
7948
+ ], Editor.prototype, "getFocusedGroupId", 1);
7949
+ __decorateClass([
7950
+ import_state.computed
7951
+ ], Editor.prototype, "getFocusedGroup", 1);
7952
+ __decorateClass([
7953
+ import_state.computed
7954
+ ], Editor.prototype, "getEditingShapeId", 1);
7955
+ __decorateClass([
7956
+ import_state.computed
7957
+ ], Editor.prototype, "getEditingShape", 1);
7958
+ __decorateClass([
7959
+ import_state.computed
7960
+ ], Editor.prototype, "getRichTextEditor", 1);
7961
+ __decorateClass([
7962
+ import_state.computed
7963
+ ], Editor.prototype, "getHoveredShapeId", 1);
7964
+ __decorateClass([
7965
+ import_state.computed
7966
+ ], Editor.prototype, "getHoveredShape", 1);
7967
+ __decorateClass([
7968
+ import_state.computed
7969
+ ], Editor.prototype, "getHintingShapeIds", 1);
7970
+ __decorateClass([
7971
+ import_state.computed
7972
+ ], Editor.prototype, "getHintingShape", 1);
7973
+ __decorateClass([
7974
+ import_state.computed
7975
+ ], Editor.prototype, "getErasingShapeIds", 1);
7976
+ __decorateClass([
7977
+ import_state.computed
7978
+ ], Editor.prototype, "getErasingShapes", 1);
7979
+ __decorateClass([
7980
+ import_state.computed
7981
+ ], Editor.prototype, "_unsafe_getCameraId", 1);
7982
+ __decorateClass([
7983
+ import_state.computed
7984
+ ], Editor.prototype, "getCamera", 1);
7985
+ __decorateClass([
7986
+ import_state.computed
7987
+ ], Editor.prototype, "getViewportPageBoundsForFollowing", 1);
7988
+ __decorateClass([
7989
+ import_state.computed
7990
+ ], Editor.prototype, "getCameraForFollowing", 1);
7991
+ __decorateClass([
7992
+ import_state.computed
7993
+ ], Editor.prototype, "getZoomLevel", 1);
7994
+ __decorateClass([
7995
+ import_state.computed
7996
+ ], Editor.prototype, "getResizeScaleFactor", 1);
7997
+ __decorateClass([
7998
+ import_state.computed
7999
+ ], Editor.prototype, "getDebouncedZoomLevel", 1);
8000
+ __decorateClass([
8001
+ import_state.computed
8002
+ ], Editor.prototype, "_getAboveDebouncedZoomThreshold", 1);
8003
+ __decorateClass([
8004
+ import_state.computed
8005
+ ], Editor.prototype, "getEfficientZoomLevel", 1);
8006
+ __decorateClass([
8007
+ import_state.computed
8008
+ ], Editor.prototype, "getViewportScreenBounds", 1);
8009
+ __decorateClass([
8010
+ import_state.computed
8011
+ ], Editor.prototype, "getViewportScreenCenter", 1);
8012
+ __decorateClass([
8013
+ import_state.computed
8014
+ ], Editor.prototype, "getViewportPageBounds", 1);
8015
+ __decorateClass([
8016
+ import_state.computed
8017
+ ], Editor.prototype, "_getCollaboratorsQuery", 1);
8018
+ __decorateClass([
8019
+ import_state.computed
8020
+ ], Editor.prototype, "getCollaborators", 1);
8021
+ __decorateClass([
8022
+ import_state.computed
8023
+ ], Editor.prototype, "getCollaboratorsOnCurrentPage", 1);
8024
+ __decorateClass([
8025
+ import_state.computed
8026
+ ], Editor.prototype, "getRenderingShapes", 1);
8027
+ __decorateClass([
8028
+ import_state.computed
8029
+ ], Editor.prototype, "_getAllPagesQuery", 1);
8030
+ __decorateClass([
8031
+ import_state.computed
8032
+ ], Editor.prototype, "getPages", 1);
8033
+ __decorateClass([
8034
+ import_state.computed
8035
+ ], Editor.prototype, "getCurrentPageId", 1);
8036
+ __decorateClass([
8037
+ import_state.computed
8038
+ ], Editor.prototype, "getCurrentPageShapeIdsSorted", 1);
8039
+ __decorateClass([
8040
+ import_state.computed
8041
+ ], Editor.prototype, "_getAllAssetsQuery", 1);
8042
+ __decorateClass([
8043
+ import_state.computed
8044
+ ], Editor.prototype, "_getShapeHandlesCache", 1);
8045
+ __decorateClass([
8046
+ import_state.computed
8047
+ ], Editor.prototype, "_getShapePageTransformCache", 1);
8048
+ __decorateClass([
8049
+ import_state.computed
8050
+ ], Editor.prototype, "_getShapePageBoundsCache", 1);
8051
+ __decorateClass([
8052
+ import_state.computed
8053
+ ], Editor.prototype, "_getShapeClipPathCache", 1);
8054
+ __decorateClass([
8055
+ import_state.computed
8056
+ ], Editor.prototype, "_getShapeMaskCache", 1);
8057
+ __decorateClass([
8058
+ import_state.computed
8059
+ ], Editor.prototype, "_getShapeMaskedPageBoundsCache", 1);
8060
+ __decorateClass([
8061
+ import_state.computed
8062
+ ], Editor.prototype, "getNotVisibleShapes", 1);
8063
+ __decorateClass([
8064
+ import_state.computed
8065
+ ], Editor.prototype, "getCulledShapes", 1);
8066
+ __decorateClass([
8067
+ import_state.computed
8068
+ ], Editor.prototype, "getCurrentPageBounds", 1);
8069
+ __decorateClass([
8070
+ import_state.computed
8071
+ ], Editor.prototype, "getCurrentPageShapes", 1);
8072
+ __decorateClass([
8073
+ import_state.computed
8074
+ ], Editor.prototype, "getCurrentPageShapesSorted", 1);
8075
+ __decorateClass([
8076
+ import_state.computed
8077
+ ], Editor.prototype, "getCurrentPageRenderingShapesSorted", 1);
8078
+ __decorateClass([
8079
+ import_state.computed
8080
+ ], Editor.prototype, "_getBindingsIndexCache", 1);
8081
+ __decorateClass([
8082
+ import_state.computed
8083
+ ], Editor.prototype, "_getSelectionSharedStyles", 1);
8084
+ __decorateClass([
8085
+ (0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })
8086
+ ], Editor.prototype, "getSharedStyles", 1);
8087
+ __decorateClass([
8088
+ import_state.computed
8089
+ ], Editor.prototype, "getSharedOpacity", 1);
8090
+ __decorateClass([
8091
+ import_state.computed
8092
+ ], Editor.prototype, "getIsFocused", 1);
8093
+ __decorateClass([
8094
+ import_state.computed
8095
+ ], Editor.prototype, "getIsReadonly", 1);
8096
+ __decorateClass([
8097
+ import_utils.bind
8098
+ ], Editor.prototype, "_setShiftKeyTimeout", 1);
8099
+ __decorateClass([
8100
+ import_utils.bind
8101
+ ], Editor.prototype, "_setAltKeyTimeout", 1);
8102
+ __decorateClass([
8103
+ import_utils.bind
8104
+ ], Editor.prototype, "_setCtrlKeyTimeout", 1);
8105
+ __decorateClass([
8106
+ import_utils.bind
8107
+ ], Editor.prototype, "_setMetaKeyTimeout", 1);
7999
8108
  function alertMaxShapes(editor, pageId = editor.getCurrentPageId()) {
8000
8109
  const name = editor.getPage(pageId).name;
8001
8110
  editor.emit("max-shapes", { name, pageId, count: editor.options.maxShapesPerPage });