@tldraw/editor 3.16.0-next.282b7be564ae → 3.16.0-next.2f9d39693e4c

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 (146) hide show
  1. package/dist-cjs/index.d.ts +54 -101
  2. package/dist-cjs/index.js +1 -5
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +5 -5
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/Shape.js +7 -10
  7. package/dist-cjs/lib/components/Shape.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -23
  9. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  10. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  11. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  12. package/dist-cjs/lib/config/TLUserPreferences.js +1 -1
  13. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  14. package/dist-cjs/lib/editor/Editor.js +41 -110
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +1 -1
  17. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  18. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +13 -0
  19. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  20. package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
  21. package/dist-cjs/lib/exports/getSvgJsx.js +34 -14
  22. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  23. package/dist-cjs/lib/hooks/useCanvasEvents.js +7 -5
  24. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  25. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +4 -1
  26. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  27. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +4 -1
  28. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  29. package/dist-cjs/lib/license/LicenseManager.js +17 -22
  30. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  31. package/dist-cjs/lib/license/LicenseProvider.js +5 -0
  32. package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
  33. package/dist-cjs/lib/license/Watermark.js +4 -4
  34. package/dist-cjs/lib/license/Watermark.js.map +1 -1
  35. package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
  36. package/dist-cjs/lib/options.js +6 -0
  37. package/dist-cjs/lib/options.js.map +2 -2
  38. package/dist-cjs/lib/primitives/Box.js +3 -0
  39. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  40. package/dist-cjs/lib/primitives/Vec.js +0 -4
  41. package/dist-cjs/lib/primitives/Vec.js.map +2 -2
  42. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +26 -18
  43. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  44. package/dist-cjs/lib/primitives/geometry/Group2d.js +3 -0
  45. package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
  46. package/dist-cjs/lib/utils/reparenting.js +2 -35
  47. package/dist-cjs/lib/utils/reparenting.js.map +3 -3
  48. package/dist-cjs/version.js +3 -3
  49. package/dist-cjs/version.js.map +1 -1
  50. package/dist-esm/index.d.mts +54 -101
  51. package/dist-esm/index.mjs +1 -5
  52. package/dist-esm/index.mjs.map +2 -2
  53. package/dist-esm/lib/TldrawEditor.mjs +5 -5
  54. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  55. package/dist-esm/lib/components/Shape.mjs +7 -10
  56. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  57. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +4 -23
  58. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  59. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  60. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  61. package/dist-esm/lib/config/TLUserPreferences.mjs +1 -1
  62. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  63. package/dist-esm/lib/editor/Editor.mjs +41 -110
  64. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  65. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +1 -1
  66. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  67. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +13 -0
  68. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  69. package/dist-esm/lib/exports/getSvgJsx.mjs +34 -14
  70. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  71. package/dist-esm/lib/hooks/useCanvasEvents.mjs +7 -5
  72. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  73. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +4 -1
  74. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  75. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +4 -1
  76. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  77. package/dist-esm/lib/license/LicenseManager.mjs +17 -22
  78. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  79. package/dist-esm/lib/license/LicenseProvider.mjs +5 -0
  80. package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
  81. package/dist-esm/lib/license/Watermark.mjs +4 -4
  82. package/dist-esm/lib/license/Watermark.mjs.map +1 -1
  83. package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
  84. package/dist-esm/lib/options.mjs +6 -0
  85. package/dist-esm/lib/options.mjs.map +2 -2
  86. package/dist-esm/lib/primitives/Box.mjs +4 -1
  87. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  88. package/dist-esm/lib/primitives/Vec.mjs +0 -4
  89. package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
  90. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +29 -19
  91. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  92. package/dist-esm/lib/primitives/geometry/Group2d.mjs +3 -0
  93. package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
  94. package/dist-esm/lib/utils/reparenting.mjs +3 -40
  95. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  96. package/dist-esm/version.mjs +3 -3
  97. package/dist-esm/version.mjs.map +1 -1
  98. package/editor.css +8 -0
  99. package/package.json +14 -37
  100. package/src/index.ts +1 -9
  101. package/src/lib/TldrawEditor.tsx +6 -12
  102. package/src/lib/components/Shape.tsx +6 -12
  103. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -22
  104. package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
  105. package/src/lib/config/TLUserPreferences.ts +1 -1
  106. package/src/lib/editor/Editor.test.ts +12 -11
  107. package/src/lib/editor/Editor.ts +49 -147
  108. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
  109. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
  110. package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
  111. package/src/lib/editor/managers/FontManager/FontManager.test.ts +24 -23
  112. package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
  113. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
  114. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
  115. package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
  116. package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
  117. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +21 -26
  118. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +1 -1
  119. package/src/lib/editor/shapes/ShapeUtil.ts +35 -0
  120. package/src/lib/editor/types/misc-types.ts +0 -6
  121. package/src/lib/exports/getSvgJsx.test.ts +868 -0
  122. package/src/lib/exports/getSvgJsx.tsx +76 -19
  123. package/src/lib/hooks/useCanvasEvents.ts +6 -6
  124. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +4 -1
  125. package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
  126. package/src/lib/license/LicenseManager.test.ts +61 -52
  127. package/src/lib/license/LicenseManager.ts +32 -24
  128. package/src/lib/license/LicenseProvider.tsx +8 -0
  129. package/src/lib/license/Watermark.test.tsx +2 -1
  130. package/src/lib/license/Watermark.tsx +4 -4
  131. package/src/lib/license/useLicenseManagerState.ts +2 -2
  132. package/src/lib/options.ts +6 -0
  133. package/src/lib/primitives/Box.test.ts +126 -0
  134. package/src/lib/primitives/Box.ts +10 -1
  135. package/src/lib/primitives/Vec.ts +0 -5
  136. package/src/lib/primitives/geometry/Geometry2d.ts +49 -19
  137. package/src/lib/primitives/geometry/Group2d.ts +4 -0
  138. package/src/lib/utils/reparenting.ts +3 -69
  139. package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
  140. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
  141. package/src/version.ts +3 -3
  142. package/dist-cjs/lib/utils/nearestMultiple.js +0 -34
  143. package/dist-cjs/lib/utils/nearestMultiple.js.map +0 -7
  144. package/dist-esm/lib/utils/nearestMultiple.mjs +0 -14
  145. package/dist-esm/lib/utils/nearestMultiple.mjs.map +0 -7
  146. package/src/lib/utils/nearestMultiple.ts +0 -13
@@ -46,7 +46,7 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
46
46
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
47
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
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, _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, _getIsMenuOpen_dec, _getOpenMenus_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _getCanRedo_dec, _getCanUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
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, _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, _getCanRedo_dec, _getCanUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
50
50
  import {
51
51
  EMPTY_ARRAY,
52
52
  atom,
@@ -120,7 +120,6 @@ import {
120
120
  } from "../constants.mjs";
121
121
  import { exportToSvg } from "../exports/exportToSvg.mjs";
122
122
  import { getSvgAsImage } from "../exports/getSvgAsImage.mjs";
123
- import { tlenv } from "../globals/environment.mjs";
124
123
  import { tlmenus } from "../globals/menus.mjs";
125
124
  import { tltime } from "../globals/time.mjs";
126
125
  import { defaultTldrawOptions } from "../options.mjs";
@@ -158,7 +157,7 @@ import { TextManager } from "./managers/TextManager/TextManager.mjs";
158
157
  import { TickManager } from "./managers/TickManager/TickManager.mjs";
159
158
  import { UserPreferencesManager } from "./managers/UserPreferencesManager/UserPreferencesManager.mjs";
160
159
  import { RootState } from "./tools/RootState.mjs";
161
- class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed], _getCanUndo_dec = [computed], _getCanRedo_dec = [computed], _getPath_dec = [computed], _getCurrentTool_dec = [computed], _getCurrentToolId_dec = [computed], _getDocumentSettings_dec = [computed], _getInstanceState_dec = [computed], _getOpenMenus_dec = [computed], _getIsMenuOpen_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], _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) {
160
+ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed], _getCanUndo_dec = [computed], _getCanRedo_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], _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) {
162
161
  constructor({
163
162
  store,
164
163
  user,
@@ -172,8 +171,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
172
171
  autoFocus,
173
172
  inferDarkMode,
174
173
  options,
175
- // eslint-disable-next-line @typescript-eslint/no-deprecated
176
- isShapeHidden,
177
174
  getShapeVisibility,
178
175
  fontAssetUrls
179
176
  }) {
@@ -240,13 +237,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
240
237
  * @public
241
238
  */
242
239
  __publicField(this, "fonts");
243
- /**
244
- * A manager for the editor's environment.
245
- *
246
- * @deprecated This is deprecated and will be removed in a future version. Use the `tlenv` global export instead.
247
- * @public
248
- */
249
- __publicField(this, "environment", tlenv);
250
240
  /**
251
241
  * A manager for the editor's scribbles.
252
242
  *
@@ -449,14 +439,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
449
439
  /** @internal */
450
440
  __publicField(this, "performanceTrackerTimeout", -1);
451
441
  __publicField(this, "_pendingEventsForNextTick", []);
452
- assert(
453
- !(isShapeHidden && getShapeVisibility),
454
- "Cannot use both isShapeHidden and getShapeVisibility"
455
- );
456
- this._getShapeVisibility = isShapeHidden ? (
457
- // eslint-disable-next-line @typescript-eslint/no-deprecated
458
- ((shape, editor) => isShapeHidden(shape, editor) ? "hidden" : "inherit")
459
- ) : getShapeVisibility;
442
+ this._getShapeVisibility = getShapeVisibility;
460
443
  this.options = { ...defaultTldrawOptions, ...options };
461
444
  this.store = store;
462
445
  this.history = new HistoryManager({
@@ -936,34 +919,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
936
919
  getCanRedo() {
937
920
  return this.history.getNumRedos() > 0;
938
921
  }
939
- /**
940
- * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
941
- * any redos.
942
- *
943
- * @example
944
- * ```ts
945
- * editor.mark()
946
- * editor.mark('flip shapes')
947
- * ```
948
- *
949
- * @param markId - The mark's id, usually the reason for adding the mark.
950
- *
951
- * @public
952
- * @deprecated use {@link Editor.markHistoryStoppingPoint} instead
953
- */
954
- mark(markId) {
955
- if (typeof markId === "string") {
956
- console.warn(
957
- `[tldraw] \`editor.history.mark("${markId}")\` is deprecated. Please use \`const myMarkId = editor.markHistoryStoppingPoint()\` instead.`
958
- );
959
- } else {
960
- console.warn(
961
- "[tldraw] `editor.mark()` is deprecated. Use `editor.markHistoryStoppingPoint()` instead."
962
- );
963
- }
964
- this.history._mark(markId ?? uniqueId());
965
- return this;
966
- }
967
922
  /**
968
923
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
969
924
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1079,12 +1034,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1079
1034
  }
1080
1035
  return this;
1081
1036
  }
1082
- /**
1083
- * @deprecated Use `Editor.run` instead.
1084
- */
1085
- batch(fn, opts) {
1086
- return this.run(fn, opts);
1087
- }
1088
1037
  /* --------------------- Errors --------------------- */
1089
1038
  /** @internal */
1090
1039
  annotateError(error, {
@@ -1306,39 +1255,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1306
1255
  ]);
1307
1256
  }, opts);
1308
1257
  }
1309
- getOpenMenus() {
1310
- return this.menus.getOpenMenus();
1311
- }
1312
- /**
1313
- * @deprecated Use `editor.menus.addOpenMenu` instead.
1314
- *
1315
- * @public
1316
- */
1317
- addOpenMenu(id) {
1318
- this.menus.addOpenMenu(id);
1319
- return this;
1320
- }
1321
- /**
1322
- * @deprecated Use `editor.menus.deleteOpenMenu` instead.
1323
- *
1324
- * @public
1325
- */
1326
- deleteOpenMenu(id) {
1327
- this.menus.deleteOpenMenu(id);
1328
- return this;
1329
- }
1330
- /**
1331
- * @deprecated Use `editor.menus.clearOpenMenus` instead.
1332
- *
1333
- * @public
1334
- */
1335
- clearOpenMenus() {
1336
- this.menus.clearOpenMenus();
1337
- return this;
1338
- }
1339
- getIsMenuOpen() {
1340
- return this.menus.hasAnyOpenMenus();
1341
- }
1342
1258
  /* --------------------- Cursor --------------------- */
1343
1259
  /**
1344
1260
  * Set the cursor.
@@ -3700,16 +3616,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3700
3616
  _getShapeMaskCache() {
3701
3617
  return this.store.createComputedCache("pageMaskCache", (shape) => {
3702
3618
  if (isPageId(shape.parentId)) return void 0;
3703
- const frameAncestors = this.getShapeAncestors(shape.id).filter(
3704
- (shape2) => this.isShapeOfType(shape2, "frame")
3705
- );
3706
- if (frameAncestors.length === 0) return void 0;
3707
- const pageMask = frameAncestors.map((s) => {
3708
- const geometry = this.getShapeGeometry(s.id);
3709
- const pageTransform = this.getShapePageTransform(s.id);
3710
- return pageTransform.applyToPoints(geometry.vertices);
3711
- }).reduce((acc, b) => {
3712
- if (!(b && acc)) return void 0;
3619
+ const clipPaths = [];
3620
+ for (const ancestor of this.getShapeAncestors(shape.id)) {
3621
+ const util = this.getShapeUtil(ancestor);
3622
+ const clipPath = util.getClipPath?.(ancestor);
3623
+ if (!clipPath) continue;
3624
+ if (util.shouldClipChild?.(shape) === false) continue;
3625
+ const pageTransform = this.getShapePageTransform(ancestor.id);
3626
+ clipPaths.push(pageTransform.applyToPoints(clipPath));
3627
+ }
3628
+ if (clipPaths.length === 0) return void 0;
3629
+ const pageMask = clipPaths.reduce((acc, b) => {
3713
3630
  const intersection = intersectPolygonPolygon(acc, b);
3714
3631
  if (intersection) {
3715
3632
  return intersection.map(Vec.Cast);
@@ -4407,10 +4324,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4407
4324
  }
4408
4325
  return shapeIds;
4409
4326
  }
4410
- /** @deprecated Use {@link Editor.getDraggingOverShape} instead */
4411
- getDroppingOverShape(point, droppingShapes) {
4412
- return this.getDraggingOverShape(point, droppingShapes);
4413
- }
4414
4327
  /**
4415
4328
  * Get the shape that some shapes should be dropped on at a given point.
4416
4329
  *
@@ -4782,7 +4695,16 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4782
4695
  }
4783
4696
  this.createShapes(shapesToCreate);
4784
4697
  this.createBindings(bindingsToCreate);
4785
- this.setSelectedShapes(compact(ids.map((id) => shapeIds.get(id))));
4698
+ this.setSelectedShapes(
4699
+ compact(
4700
+ ids.map((oldId) => {
4701
+ const newId = shapeIds.get(oldId);
4702
+ if (!newId) return null;
4703
+ if (!this.getShape(newId)) return null;
4704
+ return newId;
4705
+ })
4706
+ )
4707
+ );
4786
4708
  if (offset !== void 0) {
4787
4709
  const selectionPageBounds = this.getSelectionPageBounds();
4788
4710
  const viewportPageBounds = this.getViewportPageBounds();
@@ -6912,12 +6834,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
6912
6834
  height: result.height
6913
6835
  };
6914
6836
  }
6915
- /** @deprecated Use {@link Editor.getSvgString} or {@link Editor.getSvgElement} instead. */
6916
- async getSvg(shapes, opts = {}) {
6917
- const result = await this.getSvgElement(shapes, opts);
6918
- if (!result) return void 0;
6919
- return result.svg;
6920
- }
6921
6837
  /**
6922
6838
  * Get an exported image of the given shapes.
6923
6839
  *
@@ -6967,6 +6883,23 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
6967
6883
  }
6968
6884
  }
6969
6885
  }
6886
+ /**
6887
+ * Get an exported image of the given shapes as a data URL.
6888
+ *
6889
+ * @param shapes - The shapes (or shape ids) to export.
6890
+ * @param opts - Options for the export.
6891
+ *
6892
+ * @returns A data URL of the image.
6893
+ * @public
6894
+ */
6895
+ async toImageDataUrl(shapes, opts = {}) {
6896
+ const { blob, width, height } = await this.toImage(shapes, opts);
6897
+ return {
6898
+ url: await FileHelpers.blobToDataUrl(blob),
6899
+ width,
6900
+ height
6901
+ };
6902
+ }
6970
6903
  /**
6971
6904
  * Update the input points from a pointer, pinch, or wheel event.
6972
6905
  *
@@ -7881,8 +7814,6 @@ __decorateElement(_init, 1, "getCurrentTool", _getCurrentTool_dec, Editor);
7881
7814
  __decorateElement(_init, 1, "getCurrentToolId", _getCurrentToolId_dec, Editor);
7882
7815
  __decorateElement(_init, 1, "getDocumentSettings", _getDocumentSettings_dec, Editor);
7883
7816
  __decorateElement(_init, 1, "getInstanceState", _getInstanceState_dec, Editor);
7884
- __decorateElement(_init, 1, "getOpenMenus", _getOpenMenus_dec, Editor);
7885
- __decorateElement(_init, 1, "getIsMenuOpen", _getIsMenuOpen_dec, Editor);
7886
7817
  __decorateElement(_init, 1, "getPageStates", _getPageStates_dec, Editor);
7887
7818
  __decorateElement(_init, 1, "_getPageStatesQuery", __getPageStatesQuery_dec, Editor);
7888
7819
  __decorateElement(_init, 1, "getCurrentPageState", _getCurrentPageState_dec, Editor);