@tldraw/editor 5.6.0 → 5.7.0-canary.04258659f7da

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 (31) hide show
  1. package/dist-cjs/index.d.ts +19 -1
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/editor/Editor.js +11 -4
  4. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  5. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
  6. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  7. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +11 -0
  8. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  9. package/dist-cjs/lib/license/LicenseManager.js +6 -1
  10. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  11. package/dist-cjs/version.js +3 -3
  12. package/dist-cjs/version.js.map +1 -1
  13. package/dist-esm/index.d.mts +19 -1
  14. package/dist-esm/index.mjs +1 -1
  15. package/dist-esm/lib/editor/Editor.mjs +11 -4
  16. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  17. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
  18. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  19. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +11 -0
  20. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  21. package/dist-esm/lib/license/LicenseManager.mjs +6 -1
  22. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  23. package/dist-esm/version.mjs +3 -3
  24. package/dist-esm/version.mjs.map +1 -1
  25. package/package.json +7 -7
  26. package/src/lib/editor/Editor.ts +11 -4
  27. package/src/lib/editor/shapes/ShapeUtil.ts +12 -0
  28. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +14 -0
  29. package/src/lib/license/LicenseManager.test.ts +31 -0
  30. package/src/lib/license/LicenseManager.ts +8 -1
  31. package/src/version.ts +3 -3
@@ -319,7 +319,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
319
319
  import { uniq } from "./lib/utils/uniq.mjs";
320
320
  registerTldrawLibraryVersion(
321
321
  "@tldraw/editor",
322
- "5.6.0",
322
+ "5.7.0-canary.04258659f7da",
323
323
  "esm"
324
324
  );
325
325
  import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
@@ -1669,7 +1669,7 @@ class Editor extends EventEmitter {
1669
1669
  const filteredShapes = this.getCurrentPageShapes().filter(
1670
1670
  (shape2) => isSelectedWithinContainer ? shape2.parentId === firstParentId : isPageId(shape2.parentId)
1671
1671
  );
1672
- const readingOrderShapes = this._getShapesInReadingOrder(filteredShapes);
1672
+ const readingOrderShapes = this.getShapesInReadingOrder(filteredShapes);
1673
1673
  const currentShapeId = selectedShapeIds.length === 1 ? selectedShapeIds[0] : readingOrderShapes.find((shape2) => selectedShapeIds.includes(shape2.id))?.id;
1674
1674
  let adjacentShapeId;
1675
1675
  if (direction === "next" || direction === "prev") {
@@ -1689,9 +1689,16 @@ class Editor extends EventEmitter {
1689
1689
  }
1690
1690
  getCurrentPageShapesInReadingOrder() {
1691
1691
  const shapes = this.getCurrentPageShapes().filter((shape) => isPageId(shape.parentId));
1692
- return this._getShapesInReadingOrder(shapes);
1692
+ return this.getShapesInReadingOrder(shapes);
1693
1693
  }
1694
- _getShapesInReadingOrder(shapes) {
1694
+ /**
1695
+ * Sort the given shapes into reading order (left-to-right, top-to-bottom), dropping any that
1696
+ * can't be tabbed to. Use this for the children of a frame or group, which
1697
+ * {@link Editor.getCurrentPageShapesInReadingOrder} leaves out.
1698
+ *
1699
+ * @public
1700
+ */
1701
+ getShapesInReadingOrder(shapes) {
1695
1702
  const SHALLOW_ANGLE = 20;
1696
1703
  const ROW_THRESHOLD = 100;
1697
1704
  const tabbableShapes = shapes.filter((shape) => this.getShapeUtil(shape).canTabTo(shape));
@@ -1805,7 +1812,7 @@ class Editor extends EventEmitter {
1805
1812
  const children = compact(
1806
1813
  this.getSortedChildIdsForParent(selectedShape.id).map((id) => this.getShape(id))
1807
1814
  );
1808
- const sortedChildren = this._getShapesInReadingOrder(children);
1815
+ const sortedChildren = this.getShapesInReadingOrder(children);
1809
1816
  if (sortedChildren.length === 0) return;
1810
1817
  this._selectShapesAndZoom([sortedChildren[0].id]);
1811
1818
  }