@tldraw/editor 3.11.0-canary.e4e632644179 → 3.11.0-canary.e999671f7c64

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.
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "3.11.0-canary.e4e632644179";
25
+ const version = "3.11.0-canary.e999671f7c64";
26
26
  const publishDates = {
27
27
  major: "2024-09-13T14:36:29.063Z",
28
- minor: "2025-03-13T23:34:18.189Z",
29
- patch: "2025-03-13T23:34:18.189Z"
28
+ minor: "2025-03-15T12:23:31.016Z",
29
+ patch: "2025-03-15T12:23:31.016Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.11.0-canary.e4e632644179'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-03-13T23:34:18.189Z',\n\tpatch: '2025-03-13T23:34:18.189Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.11.0-canary.e999671f7c64'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-03-15T12:23:31.016Z',\n\tpatch: '2025-03-15T12:23:31.016Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -3125,31 +3125,31 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3125
3125
  *
3126
3126
  * @example
3127
3127
  * ```ts
3128
- * editor.stackShapes([box1, box2], 'horizontal', 32)
3129
- * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal', 32)
3128
+ * editor.stackShapes([box1, box2], 'horizontal')
3129
+ * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal')
3130
3130
  * ```
3131
3131
  *
3132
3132
  * @param shapes - The shapes (or shape ids) to stack.
3133
3133
  * @param operation - Whether to stack horizontally or vertically.
3134
- * @param gap - The gap to leave between shapes.
3134
+ * @param gap - The gap to leave between shapes. By default, uses the editor's `adjacentShapeMargin` option.
3135
3135
  *
3136
3136
  * @public
3137
3137
  */
3138
- stackShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical', gap: number): this;
3138
+ stackShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical', gap?: number): this;
3139
3139
  /**
3140
3140
  * Pack shapes into a grid centered on their current position. Based on potpack (https://github.com/mapbox/potpack).
3141
3141
  *
3142
3142
  * @example
3143
3143
  * ```ts
3144
- * editor.packShapes([box1, box2], 32)
3144
+ * editor.packShapes([box1, box2])
3145
3145
  * editor.packShapes(editor.getSelectedShapeIds(), 32)
3146
3146
  * ```
3147
3147
  *
3148
3148
  *
3149
3149
  * @param shapes - The shapes (or shape ids) to pack.
3150
- * @param gap - The padding to apply to the packed shapes. Defaults to 16.
3150
+ * @param gap - The padding to apply to the packed shapes. Defaults to the editor's `adjacentShapeMargin` option.
3151
3151
  */
3152
- packShapes(shapes: TLShape[] | TLShapeId[], gap: number): this;
3152
+ packShapes(shapes: TLShape[] | TLShapeId[], _gap?: number): this;
3153
3153
  /**
3154
3154
  * Align shape positions.
3155
3155
  *
@@ -297,7 +297,7 @@ function debugEnableLicensing() {
297
297
  }
298
298
  registerTldrawLibraryVersion(
299
299
  "@tldraw/editor",
300
- "3.11.0-canary.e4e632644179",
300
+ "3.11.0-canary.e999671f7c64",
301
301
  "esm"
302
302
  );
303
303
  export {
@@ -4803,17 +4803,18 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4803
4803
  *
4804
4804
  * @example
4805
4805
  * ```ts
4806
- * editor.stackShapes([box1, box2], 'horizontal', 32)
4807
- * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal', 32)
4806
+ * editor.stackShapes([box1, box2], 'horizontal')
4807
+ * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal')
4808
4808
  * ```
4809
4809
  *
4810
4810
  * @param shapes - The shapes (or shape ids) to stack.
4811
4811
  * @param operation - Whether to stack horizontally or vertically.
4812
- * @param gap - The gap to leave between shapes.
4812
+ * @param gap - The gap to leave between shapes. By default, uses the editor's `adjacentShapeMargin` option.
4813
4813
  *
4814
4814
  * @public
4815
4815
  */
4816
4816
  stackShapes(shapes, operation, gap) {
4817
+ const _gap = gap ?? this.options.adjacentShapeMargin;
4817
4818
  const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4818
4819
  if (this.getIsReadonly()) return this;
4819
4820
  const shapesToStackFirstPass = compact(ids.map((id) => this.getShape(id)));
@@ -4849,7 +4850,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4849
4850
  allBounds.push(commonPageBounds);
4850
4851
  }
4851
4852
  const len = shapeClustersToStack.length;
4852
- if (gap === 0 && len < 3 || len < 2) return this;
4853
+ if (_gap === 0 && len < 3 || len < 2) return this;
4853
4854
  let val;
4854
4855
  let min;
4855
4856
  let max;
@@ -4866,7 +4867,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4866
4867
  dim = "height";
4867
4868
  }
4868
4869
  let shapeGap = 0;
4869
- if (gap === 0) {
4870
+ if (_gap === 0) {
4870
4871
  const gaps = {};
4871
4872
  shapeClustersToStack.sort((a, b) => a.pageBounds[min] - b.pageBounds[min]);
4872
4873
  for (let i = 0; i < len - 1; i++) {
@@ -4894,7 +4895,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4894
4895
  shapeGap /= totalCount;
4895
4896
  }
4896
4897
  } else {
4897
- shapeGap = gap;
4898
+ shapeGap = _gap;
4898
4899
  }
4899
4900
  const changes = [];
4900
4901
  let v = shapeClustersToStack[0].pageBounds[max];
@@ -4922,16 +4923,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4922
4923
  *
4923
4924
  * @example
4924
4925
  * ```ts
4925
- * editor.packShapes([box1, box2], 32)
4926
+ * editor.packShapes([box1, box2])
4926
4927
  * editor.packShapes(editor.getSelectedShapeIds(), 32)
4927
4928
  * ```
4928
4929
  *
4929
4930
  *
4930
4931
  * @param shapes - The shapes (or shape ids) to pack.
4931
- * @param gap - The padding to apply to the packed shapes. Defaults to 16.
4932
+ * @param gap - The padding to apply to the packed shapes. Defaults to the editor's `adjacentShapeMargin` option.
4932
4933
  */
4933
- packShapes(shapes, gap) {
4934
+ packShapes(shapes, _gap) {
4934
4935
  if (this.getIsReadonly()) return this;
4936
+ const gap = _gap ?? this.options.adjacentShapeMargin;
4935
4937
  const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4936
4938
  const shapesToPackFirstPass = compact(ids.map((id) => this.getShape(id)));
4937
4939
  const shapeClustersToPack = [];