@tldraw/editor 5.5.0-next.a2698a88ecfb → 5.5.0-next.c25ed1f4cf7f
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.
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +15 -9
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +14 -6
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +3 -3
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js +13 -17
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +78 -40
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +15 -9
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +14 -6
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +3 -3
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs +13 -17
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +78 -40
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +32 -16
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +23 -8
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +28 -0
- package/src/lib/utils/sync/LocalIndexedDb.ts +18 -20
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +236 -0
- package/src/lib/utils/sync/TLLocalSyncClient.ts +106 -54
- package/src/version.ts +3 -3
package/dist-cjs/index.js
CHANGED
|
@@ -392,7 +392,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
392
392
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
393
393
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
394
394
|
"@tldraw/editor",
|
|
395
|
-
"5.5.0-next.
|
|
395
|
+
"5.5.0-next.c25ed1f4cf7f",
|
|
396
396
|
"cjs"
|
|
397
397
|
);
|
|
398
398
|
//# sourceMappingURL=index.js.map
|
|
@@ -1610,12 +1610,15 @@ class Editor extends import_eventemitter3.default {
|
|
|
1610
1610
|
const selectedShapeIds = this.getSelectedShapeIds();
|
|
1611
1611
|
const firstParentId = selectedShapeIds[0] ? this.getShape(selectedShapeIds[0])?.parentId : null;
|
|
1612
1612
|
const isSelectedWithinContainer = firstParentId && selectedShapeIds.every((shapeId) => this.getShape(shapeId)?.parentId === firstParentId) && !(0, import_tlschema.isPageId)(firstParentId);
|
|
1613
|
-
const filteredShapes =
|
|
1614
|
-
|
|
1613
|
+
const filteredShapes = this.getCurrentPageShapes().filter(
|
|
1614
|
+
(shape2) => !this.isShapeOrAncestorLocked(shape2) && (isSelectedWithinContainer ? shape2.parentId === firstParentId : (0, import_tlschema.isPageId)(shape2.parentId))
|
|
1615
|
+
);
|
|
1616
|
+
const readingOrderShapes = this._getShapesInReadingOrder(filteredShapes);
|
|
1615
1617
|
const currentShapeId = selectedShapeIds.length === 1 ? selectedShapeIds[0] : readingOrderShapes.find((shape2) => selectedShapeIds.includes(shape2.id))?.id;
|
|
1616
1618
|
let adjacentShapeId;
|
|
1617
1619
|
if (direction === "next" || direction === "prev") {
|
|
1618
1620
|
const shapeIds = readingOrderShapes.map((shape2) => shape2.id);
|
|
1621
|
+
if (shapeIds.length === 0) return;
|
|
1619
1622
|
const currentIndex = currentShapeId ? shapeIds.indexOf(currentShapeId) : -1;
|
|
1620
1623
|
const startIndex = currentIndex === -1 && direction === "prev" ? 0 : currentIndex;
|
|
1621
1624
|
const adjacentIndex = (startIndex + (direction === "next" ? 1 : -1) + shapeIds.length) % shapeIds.length;
|
|
@@ -2498,14 +2501,16 @@ class Editor extends import_eventemitter3.default {
|
|
|
2498
2501
|
setCamera(point, opts) {
|
|
2499
2502
|
const { isLocked } = this._cameraOptions.__unsafe__getWithoutCapture();
|
|
2500
2503
|
if (isLocked && !opts?.force) return this;
|
|
2504
|
+
const _point = import_Vec.Vec.Cast(point);
|
|
2505
|
+
if (!Number.isFinite(_point.x) || !Number.isFinite(_point.y) || !Number.isFinite(_point.z)) {
|
|
2506
|
+
throw Error(
|
|
2507
|
+
`Editor.setCamera: expected finite values, got (${_point.x}, ${_point.y}, ${_point.z}).`
|
|
2508
|
+
);
|
|
2509
|
+
}
|
|
2501
2510
|
this.stopCameraAnimation();
|
|
2502
2511
|
if (this.getInstanceState().followingUserId) {
|
|
2503
2512
|
this.stopFollowingUser();
|
|
2504
2513
|
}
|
|
2505
|
-
const _point = import_Vec.Vec.Cast(point);
|
|
2506
|
-
if (!Number.isFinite(_point.x)) _point.x = 0;
|
|
2507
|
-
if (!Number.isFinite(_point.y)) _point.y = 0;
|
|
2508
|
-
if (_point.z === void 0 || !Number.isFinite(_point.z)) point.z = this.getZoomLevel();
|
|
2509
2514
|
const camera = this.getConstrainedCamera(_point, opts);
|
|
2510
2515
|
if (opts?.animation) {
|
|
2511
2516
|
const { width, height } = this.getViewportScreenBounds();
|
|
@@ -2918,6 +2923,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
2918
2923
|
}
|
|
2919
2924
|
const isOnSamePage = presence.currentPageId === this.getCurrentPageId();
|
|
2920
2925
|
if (!isOnSamePage) {
|
|
2926
|
+
this.markHistoryStoppingPoint("change-page");
|
|
2921
2927
|
this.setCurrentPage(presence.currentPageId);
|
|
2922
2928
|
}
|
|
2923
2929
|
if (opts && opts.animation && !isOnSamePage) {
|
|
@@ -5358,7 +5364,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
5358
5364
|
const shapesMovingTogether = [shape];
|
|
5359
5365
|
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5360
5366
|
this.collectShapesViaArrowBindings({
|
|
5361
|
-
bindings: this.
|
|
5367
|
+
bindings: this.getBindingsInvolvingShape(shape.id, "arrow"),
|
|
5362
5368
|
initialShapes: freshShapes,
|
|
5363
5369
|
resultShapes: shapesMovingTogether,
|
|
5364
5370
|
resultBounds: boundsOfShapesMovingTogether,
|
|
@@ -8295,8 +8301,8 @@ class Editor extends import_eventemitter3.default {
|
|
|
8295
8301
|
break;
|
|
8296
8302
|
}
|
|
8297
8303
|
case "keyboard": {
|
|
8298
|
-
if (info.
|
|
8299
|
-
if (info.
|
|
8304
|
+
if (info.code === "ShiftRight") info.code = "ShiftLeft";
|
|
8305
|
+
if (info.code === "AltRight") info.code = "AltLeft";
|
|
8300
8306
|
if (info.code === "ControlRight") info.code = "ControlLeft";
|
|
8301
8307
|
if (info.code === "MetaRight") info.code = "MetaLeft";
|
|
8302
8308
|
switch (info.name) {
|