@tldraw/editor 3.15.0-canary.6b86fb379957 → 3.15.0-canary.6e52b88206f9

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.
@@ -5418,6 +5418,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5418
5418
  * @public
5419
5419
  */
5420
5420
  onResizeEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5421
+ /**
5422
+ * A callback called when a shape resize is cancelled.
5423
+ *
5424
+ * @param initial - The shape at the start of the resize.
5425
+ * @param current - The current shape.
5426
+ * @public
5427
+ */
5428
+ onResizeCancel?(initial: Shape, current: Shape): void;
5421
5429
  /**
5422
5430
  * A callback called when a shape starts being translated.
5423
5431
  *
@@ -5444,6 +5452,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5444
5452
  * @public
5445
5453
  */
5446
5454
  onTranslateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5455
+ /**
5456
+ * A callback called when a shape translation is cancelled.
5457
+ *
5458
+ * @param initial - The shape at the start of the translation.
5459
+ * @param current - The current shape.
5460
+ * @public
5461
+ */
5462
+ onTranslateCancel?(initial: Shape, current: Shape): void;
5463
+ /**
5464
+ * A callback called when a shape's handle starts being dragged.
5465
+ *
5466
+ * @param shape - The shape.
5467
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5468
+ * @returns A change to apply to the shape, or void.
5469
+ * @public
5470
+ */
5471
+ onHandleDragStart?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5447
5472
  /**
5448
5473
  * A callback called when a shape's handle changes.
5449
5474
  *
@@ -5453,6 +5478,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5453
5478
  * @public
5454
5479
  */
5455
5480
  onHandleDrag?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5481
+ /**
5482
+ * A callback called when a shape's handle finishes being dragged.
5483
+ *
5484
+ * @param current - The current shape.
5485
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5486
+ * @returns A change to apply to the shape, or void.
5487
+ * @public
5488
+ */
5489
+ onHandleDragEnd?(current: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5490
+ /**
5491
+ * A callback called when a shape's handle drag is cancelled.
5492
+ *
5493
+ * @param current - The current shape.
5494
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5495
+ * @public
5496
+ */
5497
+ onHandleDragCancel?(current: Shape, info: TLHandleDragInfo<Shape>): void;
5456
5498
  /**
5457
5499
  * A callback called when a shape starts being rotated.
5458
5500
  *
@@ -5479,6 +5521,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5479
5521
  * @public
5480
5522
  */
5481
5523
  onRotateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5524
+ /**
5525
+ * A callback called when a shape rotation is cancelled.
5526
+ *
5527
+ * @param initial - The shape at the start of the rotation.
5528
+ * @param current - The current shape.
5529
+ * @public
5530
+ */
5531
+ onRotateCancel?(initial: Shape, current: Shape): void;
5482
5532
  /* Excluded from this release type: onBindingChange */
5483
5533
  /**
5484
5534
  * A callback called when a shape's children change.
@@ -5707,6 +5757,12 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
5707
5757
  _currentToolIdMask: Atom<string | undefined, unknown>;
5708
5758
  getCurrentToolIdMask(): string | undefined;
5709
5759
  setCurrentToolIdMask(id: string | undefined): void;
5760
+ /**
5761
+ * Add a child node to this state node.
5762
+ *
5763
+ * @public
5764
+ */
5765
+ addChild(childConstructor: TLStateNodeConstructor): this;
5710
5766
  onWheel?(info: TLWheelEventInfo): void;
5711
5767
  onPointerDown?(info: TLPointerEventInfo): void;
5712
5768
  onPointerMove?(info: TLPointerEventInfo): void;
@@ -6770,6 +6826,7 @@ export declare interface TLGridProps {
6770
6826
  export declare interface TLHandleDragInfo<T extends TLShape> {
6771
6827
  handle: TLHandle;
6772
6828
  isPrecise: boolean;
6829
+ isCreatingShape: boolean;
6773
6830
  initial?: T | undefined;
6774
6831
  }
6775
6832
 
package/dist-cjs/index.js CHANGED
@@ -367,7 +367,7 @@ function debugEnableLicensing() {
367
367
  }
368
368
  (0, import_utils.registerTldrawLibraryVersion)(
369
369
  "@tldraw/editor",
370
- "3.15.0-canary.6b86fb379957",
370
+ "3.15.0-canary.6e52b88206f9",
371
371
  "cjs"
372
372
  );
373
373
  //# sourceMappingURL=index.js.map
@@ -3313,19 +3313,24 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
3313
3313
  */
3314
3314
  deletePage(page) {
3315
3315
  const id = typeof page === "string" ? page : page.id;
3316
- this.run(() => {
3317
- if (this.getIsReadonly()) return;
3318
- const pages = this.getPages();
3319
- if (pages.length === 1) return;
3320
- const deletedPage = this.getPage(id);
3321
- if (!deletedPage) return;
3322
- if (id === this.getCurrentPageId()) {
3323
- const index = pages.findIndex((page2) => page2.id === id);
3324
- const next = pages[index - 1] ?? pages[index + 1];
3325
- this.setCurrentPage(next.id);
3326
- }
3327
- this.store.remove([deletedPage.id]);
3328
- });
3316
+ this.run(
3317
+ () => {
3318
+ if (this.getIsReadonly()) return;
3319
+ const pages = this.getPages();
3320
+ if (pages.length === 1) return;
3321
+ const deletedPage = this.getPage(id);
3322
+ if (!deletedPage) return;
3323
+ if (id === this.getCurrentPageId()) {
3324
+ const index = pages.findIndex((page2) => page2.id === id);
3325
+ const next = pages[index - 1] ?? pages[index + 1];
3326
+ this.setCurrentPage(next.id);
3327
+ }
3328
+ const shapes = this.getSortedChildIdsForParent(deletedPage.id);
3329
+ this.deleteShapes(shapes);
3330
+ this.store.remove([deletedPage.id]);
3331
+ },
3332
+ { ignoreShapeLock: true }
3333
+ );
3329
3334
  return this;
3330
3335
  }
3331
3336
  /**