@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.
@@ -1,8 +1,8 @@
1
- const version = "3.11.0-canary.e4e632644179";
1
+ const version = "3.11.0-canary.e999671f7c64";
2
2
  const publishDates = {
3
3
  major: "2024-09-13T14:36:29.063Z",
4
- minor: "2025-03-13T23:34:18.189Z",
5
- patch: "2025-03-13T23:34:18.189Z"
4
+ minor: "2025-03-15T12:23:31.016Z",
5
+ patch: "2025-03-15T12:23:31.016Z"
6
6
  };
7
7
  export {
8
8
  publishDates,
@@ -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": "AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/editor",
3
3
  "description": "A tiny little drawing app (editor).",
4
- "version": "3.11.0-canary.e4e632644179",
4
+ "version": "3.11.0-canary.e999671f7c64",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -48,12 +48,12 @@
48
48
  "@tiptap/core": "^2.9.1",
49
49
  "@tiptap/pm": "^2.9.1",
50
50
  "@tiptap/react": "^2.9.1",
51
- "@tldraw/state": "3.11.0-canary.e4e632644179",
52
- "@tldraw/state-react": "3.11.0-canary.e4e632644179",
53
- "@tldraw/store": "3.11.0-canary.e4e632644179",
54
- "@tldraw/tlschema": "3.11.0-canary.e4e632644179",
55
- "@tldraw/utils": "3.11.0-canary.e4e632644179",
56
- "@tldraw/validate": "3.11.0-canary.e4e632644179",
51
+ "@tldraw/state": "3.11.0-canary.e999671f7c64",
52
+ "@tldraw/state-react": "3.11.0-canary.e999671f7c64",
53
+ "@tldraw/store": "3.11.0-canary.e999671f7c64",
54
+ "@tldraw/tlschema": "3.11.0-canary.e999671f7c64",
55
+ "@tldraw/utils": "3.11.0-canary.e999671f7c64",
56
+ "@tldraw/validate": "3.11.0-canary.e999671f7c64",
57
57
  "@types/core-js": "^2.5.8",
58
58
  "@use-gesture/react": "^10.3.1",
59
59
  "classnames": "^2.5.1",
@@ -6328,21 +6328,22 @@ export class Editor extends EventEmitter<TLEventMap> {
6328
6328
  *
6329
6329
  * @example
6330
6330
  * ```ts
6331
- * editor.stackShapes([box1, box2], 'horizontal', 32)
6332
- * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal', 32)
6331
+ * editor.stackShapes([box1, box2], 'horizontal')
6332
+ * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal')
6333
6333
  * ```
6334
6334
  *
6335
6335
  * @param shapes - The shapes (or shape ids) to stack.
6336
6336
  * @param operation - Whether to stack horizontally or vertically.
6337
- * @param gap - The gap to leave between shapes.
6337
+ * @param gap - The gap to leave between shapes. By default, uses the editor's `adjacentShapeMargin` option.
6338
6338
  *
6339
6339
  * @public
6340
6340
  */
6341
6341
  stackShapes(
6342
6342
  shapes: TLShapeId[] | TLShape[],
6343
6343
  operation: 'horizontal' | 'vertical',
6344
- gap: number
6344
+ gap?: number
6345
6345
  ): this {
6346
+ const _gap = gap ?? this.options.adjacentShapeMargin
6346
6347
  const ids =
6347
6348
  typeof shapes[0] === 'string'
6348
6349
  ? (shapes as TLShapeId[])
@@ -6400,7 +6401,7 @@ export class Editor extends EventEmitter<TLEventMap> {
6400
6401
  }
6401
6402
 
6402
6403
  const len = shapeClustersToStack.length
6403
- if ((gap === 0 && len < 3) || len < 2) return this
6404
+ if ((_gap === 0 && len < 3) || len < 2) return this
6404
6405
 
6405
6406
  let val: 'x' | 'y'
6406
6407
  let min: 'minX' | 'minY'
@@ -6421,7 +6422,7 @@ export class Editor extends EventEmitter<TLEventMap> {
6421
6422
 
6422
6423
  let shapeGap: number = 0
6423
6424
 
6424
- if (gap === 0) {
6425
+ if (_gap === 0) {
6425
6426
  // note: this is not used in the current tldraw.com; there we use a specified stack
6426
6427
 
6427
6428
  const gaps: Record<number, number> = {}
@@ -6461,7 +6462,7 @@ export class Editor extends EventEmitter<TLEventMap> {
6461
6462
  }
6462
6463
  } else {
6463
6464
  // If a gap was provided, then use that instead.
6464
- shapeGap = gap
6465
+ shapeGap = _gap
6465
6466
  }
6466
6467
 
6467
6468
  const changes: TLShapePartial[] = []
@@ -6500,17 +6501,19 @@ export class Editor extends EventEmitter<TLEventMap> {
6500
6501
  *
6501
6502
  * @example
6502
6503
  * ```ts
6503
- * editor.packShapes([box1, box2], 32)
6504
+ * editor.packShapes([box1, box2])
6504
6505
  * editor.packShapes(editor.getSelectedShapeIds(), 32)
6505
6506
  * ```
6506
6507
  *
6507
6508
  *
6508
6509
  * @param shapes - The shapes (or shape ids) to pack.
6509
- * @param gap - The padding to apply to the packed shapes. Defaults to 16.
6510
+ * @param gap - The padding to apply to the packed shapes. Defaults to the editor's `adjacentShapeMargin` option.
6510
6511
  */
6511
- packShapes(shapes: TLShapeId[] | TLShape[], gap: number): this {
6512
+ packShapes(shapes: TLShapeId[] | TLShape[], _gap?: number): this {
6512
6513
  if (this.getIsReadonly()) return this
6513
6514
 
6515
+ const gap = _gap ?? this.options.adjacentShapeMargin
6516
+
6514
6517
  const ids =
6515
6518
  typeof shapes[0] === 'string'
6516
6519
  ? (shapes as TLShapeId[])
package/src/version.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '3.11.0-canary.e4e632644179'
4
+ export const version = '3.11.0-canary.e999671f7c64'
5
5
  export const publishDates = {
6
6
  major: '2024-09-13T14:36:29.063Z',
7
- minor: '2025-03-13T23:34:18.189Z',
8
- patch: '2025-03-13T23:34:18.189Z',
7
+ minor: '2025-03-15T12:23:31.016Z',
8
+ patch: '2025-03-15T12:23:31.016Z',
9
9
  }