@tldraw/tlschema 4.2.0-next.b7f56801f23f → 4.2.0-next.bfd9ab728a80

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.
@@ -4324,6 +4324,8 @@ export declare interface TLHandle {
4324
4324
  canSnap?: boolean;
4325
4325
  /** The type of snap to use for this handle */
4326
4326
  snapType?: 'align' | 'point';
4327
+ /** The ID of the handle to use as reference point for shift-modifier angle snapping */
4328
+ snapReferenceHandleId?: string;
4327
4329
  /** The fractional index used for ordering handles */
4328
4330
  index: IndexKey;
4329
4331
  /** The x-coordinate of the handle in the shape's local coordinate system */
package/dist-cjs/index.js CHANGED
@@ -177,7 +177,7 @@ var import_TLVerticalAlignStyle = require("./styles/TLVerticalAlignStyle");
177
177
  var import_translations = require("./translations/translations");
178
178
  (0, import_utils.registerTldrawLibraryVersion)(
179
179
  "@tldraw/tlschema",
180
- "4.2.0-next.b7f56801f23f",
180
+ "4.2.0-next.bfd9ab728a80",
181
181
  "cjs"
182
182
  );
183
183
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLHandle.ts"],
4
- "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * All available handle types used by shapes in the tldraw editor.\n *\n * Handles are interactive control points on shapes that allow users to\n * modify the shape's geometry. Different handle types serve different purposes:\n *\n * - `vertex`: A control point that defines a vertex of the shape\n * - `virtual`: A handle that exists between vertices for adding new points\n * - `create`: A handle for creating new geometry (like extending a line)\n * - `clone`: A handle for duplicating or cloning shape elements\n *\n * @example\n * ```ts\n * // Check if a handle type is valid\n * if (TL_HANDLE_TYPES.has('vertex')) {\n * console.log('Valid handle type')\n * }\n *\n * // Get all available handle types\n * const allHandleTypes = Array.from(TL_HANDLE_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A union type representing all available handle types.\n *\n * Handle types determine how a handle behaves when interacted with and\n * what kind of shape modification it enables.\n *\n * @example\n * ```ts\n * const vertexHandle: TLHandleType = 'vertex'\n * const virtualHandle: TLHandleType = 'virtual'\n * const createHandle: TLHandleType = 'create'\n * const cloneHandle: TLHandleType = 'clone'\n * ```\n *\n * @public\n */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A handle object representing an interactive control point on a shape.\n *\n * Handles allow users to manipulate shape geometry by dragging control points.\n * Each handle has a position, type, and various properties that control its\n * behavior during interactions.\n *\n * @example\n * ```ts\n * // A vertex handle for a line endpoint\n * const lineEndHandle: TLHandle = {\n * id: 'end',\n * label: 'End point',\n * type: 'vertex',\n * canSnap: true,\n * index: 'a1',\n * x: 100,\n * y: 50\n * }\n *\n * // A virtual handle for adding new points\n * const virtualHandle: TLHandle = {\n * id: 'virtual-1',\n * type: 'virtual',\n * canSnap: false,\n * index: 'a1V',\n * x: 75,\n * y: 25\n * }\n *\n * // A create handle for extending geometry\n * const createHandle: TLHandle = {\n * id: 'create',\n * type: 'create',\n * canSnap: true,\n * index: 'a2',\n * x: 200,\n * y: 100\n * }\n * ```\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle within the shape */\n\tid: string\n\t/** Optional human-readable label for the handle */\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\t/** The type of handle, determining its behavior and interaction mode */\n\ttype: TLHandleType\n\t/**\n\t * @deprecated Use `snapType` instead. Whether this handle should snap to other geometry during interactions.\n\t */\n\tcanSnap?: boolean\n\t/** The type of snap to use for this handle */\n\tsnapType?: 'point' | 'align'\n\t/** The fractional index used for ordering handles */\n\tindex: IndexKey\n\t/** The x-coordinate of the handle in the shape's local coordinate system */\n\tx: number\n\t/** The y-coordinate of the handle in the shape's local coordinate system */\n\ty: number\n}\n"],
4
+ "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * All available handle types used by shapes in the tldraw editor.\n *\n * Handles are interactive control points on shapes that allow users to\n * modify the shape's geometry. Different handle types serve different purposes:\n *\n * - `vertex`: A control point that defines a vertex of the shape\n * - `virtual`: A handle that exists between vertices for adding new points\n * - `create`: A handle for creating new geometry (like extending a line)\n * - `clone`: A handle for duplicating or cloning shape elements\n *\n * @example\n * ```ts\n * // Check if a handle type is valid\n * if (TL_HANDLE_TYPES.has('vertex')) {\n * console.log('Valid handle type')\n * }\n *\n * // Get all available handle types\n * const allHandleTypes = Array.from(TL_HANDLE_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A union type representing all available handle types.\n *\n * Handle types determine how a handle behaves when interacted with and\n * what kind of shape modification it enables.\n *\n * @example\n * ```ts\n * const vertexHandle: TLHandleType = 'vertex'\n * const virtualHandle: TLHandleType = 'virtual'\n * const createHandle: TLHandleType = 'create'\n * const cloneHandle: TLHandleType = 'clone'\n * ```\n *\n * @public\n */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A handle object representing an interactive control point on a shape.\n *\n * Handles allow users to manipulate shape geometry by dragging control points.\n * Each handle has a position, type, and various properties that control its\n * behavior during interactions.\n *\n * @example\n * ```ts\n * // A vertex handle for a line endpoint\n * const lineEndHandle: TLHandle = {\n * id: 'end',\n * label: 'End point',\n * type: 'vertex',\n * canSnap: true,\n * index: 'a1',\n * x: 100,\n * y: 50\n * }\n *\n * // A virtual handle for adding new points\n * const virtualHandle: TLHandle = {\n * id: 'virtual-1',\n * type: 'virtual',\n * canSnap: false,\n * index: 'a1V',\n * x: 75,\n * y: 25\n * }\n *\n * // A create handle for extending geometry\n * const createHandle: TLHandle = {\n * id: 'create',\n * type: 'create',\n * canSnap: true,\n * index: 'a2',\n * x: 200,\n * y: 100\n * }\n * ```\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle within the shape */\n\tid: string\n\t/** Optional human-readable label for the handle */\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\t/** The type of handle, determining its behavior and interaction mode */\n\ttype: TLHandleType\n\t/**\n\t * @deprecated Use `snapType` instead. Whether this handle should snap to other geometry during interactions.\n\t */\n\tcanSnap?: boolean\n\t/** The type of snap to use for this handle */\n\tsnapType?: 'point' | 'align'\n\t/** The ID of the handle to use as reference point for shift-modifier angle snapping */\n\tsnapReferenceHandleId?: string\n\t/** The fractional index used for ordering handles */\n\tindex: IndexKey\n\t/** The x-coordinate of the handle in the shape's local coordinate system */\n\tx: number\n\t/** The y-coordinate of the handle in the shape's local coordinate system */\n\ty: number\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
6
6
  "names": []
7
7
  }
@@ -4324,6 +4324,8 @@ export declare interface TLHandle {
4324
4324
  canSnap?: boolean;
4325
4325
  /** The type of snap to use for this handle */
4326
4326
  snapType?: 'align' | 'point';
4327
+ /** The ID of the handle to use as reference point for shift-modifier angle snapping */
4328
+ snapReferenceHandleId?: string;
4327
4329
  /** The fractional index used for ordering handles */
4328
4330
  index: IndexKey;
4329
4331
  /** The x-coordinate of the handle in the shape's local coordinate system */
@@ -172,7 +172,7 @@ import {
172
172
  } from "./translations/translations.mjs";
173
173
  registerTldrawLibraryVersion(
174
174
  "@tldraw/tlschema",
175
- "4.2.0-next.b7f56801f23f",
175
+ "4.2.0-next.bfd9ab728a80",
176
176
  "esm"
177
177
  );
178
178
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/misc/TLHandle.ts"],
4
- "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * All available handle types used by shapes in the tldraw editor.\n *\n * Handles are interactive control points on shapes that allow users to\n * modify the shape's geometry. Different handle types serve different purposes:\n *\n * - `vertex`: A control point that defines a vertex of the shape\n * - `virtual`: A handle that exists between vertices for adding new points\n * - `create`: A handle for creating new geometry (like extending a line)\n * - `clone`: A handle for duplicating or cloning shape elements\n *\n * @example\n * ```ts\n * // Check if a handle type is valid\n * if (TL_HANDLE_TYPES.has('vertex')) {\n * console.log('Valid handle type')\n * }\n *\n * // Get all available handle types\n * const allHandleTypes = Array.from(TL_HANDLE_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A union type representing all available handle types.\n *\n * Handle types determine how a handle behaves when interacted with and\n * what kind of shape modification it enables.\n *\n * @example\n * ```ts\n * const vertexHandle: TLHandleType = 'vertex'\n * const virtualHandle: TLHandleType = 'virtual'\n * const createHandle: TLHandleType = 'create'\n * const cloneHandle: TLHandleType = 'clone'\n * ```\n *\n * @public\n */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A handle object representing an interactive control point on a shape.\n *\n * Handles allow users to manipulate shape geometry by dragging control points.\n * Each handle has a position, type, and various properties that control its\n * behavior during interactions.\n *\n * @example\n * ```ts\n * // A vertex handle for a line endpoint\n * const lineEndHandle: TLHandle = {\n * id: 'end',\n * label: 'End point',\n * type: 'vertex',\n * canSnap: true,\n * index: 'a1',\n * x: 100,\n * y: 50\n * }\n *\n * // A virtual handle for adding new points\n * const virtualHandle: TLHandle = {\n * id: 'virtual-1',\n * type: 'virtual',\n * canSnap: false,\n * index: 'a1V',\n * x: 75,\n * y: 25\n * }\n *\n * // A create handle for extending geometry\n * const createHandle: TLHandle = {\n * id: 'create',\n * type: 'create',\n * canSnap: true,\n * index: 'a2',\n * x: 200,\n * y: 100\n * }\n * ```\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle within the shape */\n\tid: string\n\t/** Optional human-readable label for the handle */\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\t/** The type of handle, determining its behavior and interaction mode */\n\ttype: TLHandleType\n\t/**\n\t * @deprecated Use `snapType` instead. Whether this handle should snap to other geometry during interactions.\n\t */\n\tcanSnap?: boolean\n\t/** The type of snap to use for this handle */\n\tsnapType?: 'point' | 'align'\n\t/** The fractional index used for ordering handles */\n\tindex: IndexKey\n\t/** The x-coordinate of the handle in the shape's local coordinate system */\n\tx: number\n\t/** The y-coordinate of the handle in the shape's local coordinate system */\n\ty: number\n}\n"],
4
+ "sourcesContent": ["import { IndexKey } from '@tldraw/utils'\nimport { SetValue } from '../util-types'\n\n/**\n * All available handle types used by shapes in the tldraw editor.\n *\n * Handles are interactive control points on shapes that allow users to\n * modify the shape's geometry. Different handle types serve different purposes:\n *\n * - `vertex`: A control point that defines a vertex of the shape\n * - `virtual`: A handle that exists between vertices for adding new points\n * - `create`: A handle for creating new geometry (like extending a line)\n * - `clone`: A handle for duplicating or cloning shape elements\n *\n * @example\n * ```ts\n * // Check if a handle type is valid\n * if (TL_HANDLE_TYPES.has('vertex')) {\n * console.log('Valid handle type')\n * }\n *\n * // Get all available handle types\n * const allHandleTypes = Array.from(TL_HANDLE_TYPES)\n * ```\n *\n * @public\n */\nexport const TL_HANDLE_TYPES = new Set(['vertex', 'virtual', 'create', 'clone'] as const)\n\n/**\n * A union type representing all available handle types.\n *\n * Handle types determine how a handle behaves when interacted with and\n * what kind of shape modification it enables.\n *\n * @example\n * ```ts\n * const vertexHandle: TLHandleType = 'vertex'\n * const virtualHandle: TLHandleType = 'virtual'\n * const createHandle: TLHandleType = 'create'\n * const cloneHandle: TLHandleType = 'clone'\n * ```\n *\n * @public\n */\nexport type TLHandleType = SetValue<typeof TL_HANDLE_TYPES>\n\n/**\n * A handle object representing an interactive control point on a shape.\n *\n * Handles allow users to manipulate shape geometry by dragging control points.\n * Each handle has a position, type, and various properties that control its\n * behavior during interactions.\n *\n * @example\n * ```ts\n * // A vertex handle for a line endpoint\n * const lineEndHandle: TLHandle = {\n * id: 'end',\n * label: 'End point',\n * type: 'vertex',\n * canSnap: true,\n * index: 'a1',\n * x: 100,\n * y: 50\n * }\n *\n * // A virtual handle for adding new points\n * const virtualHandle: TLHandle = {\n * id: 'virtual-1',\n * type: 'virtual',\n * canSnap: false,\n * index: 'a1V',\n * x: 75,\n * y: 25\n * }\n *\n * // A create handle for extending geometry\n * const createHandle: TLHandle = {\n * id: 'create',\n * type: 'create',\n * canSnap: true,\n * index: 'a2',\n * x: 200,\n * y: 100\n * }\n * ```\n *\n * @public\n */\nexport interface TLHandle {\n\t/** A unique identifier for the handle within the shape */\n\tid: string\n\t/** Optional human-readable label for the handle */\n\t// TODO(mime): this needs to be required.\n\tlabel?: string\n\t/** The type of handle, determining its behavior and interaction mode */\n\ttype: TLHandleType\n\t/**\n\t * @deprecated Use `snapType` instead. Whether this handle should snap to other geometry during interactions.\n\t */\n\tcanSnap?: boolean\n\t/** The type of snap to use for this handle */\n\tsnapType?: 'point' | 'align'\n\t/** The ID of the handle to use as reference point for shift-modifier angle snapping */\n\tsnapReferenceHandleId?: string\n\t/** The fractional index used for ordering handles */\n\tindex: IndexKey\n\t/** The x-coordinate of the handle in the shape's local coordinate system */\n\tx: number\n\t/** The y-coordinate of the handle in the shape's local coordinate system */\n\ty: number\n}\n"],
5
5
  "mappings": "AA2BO,MAAM,kBAAkB,oBAAI,IAAI,CAAC,UAAU,WAAW,UAAU,OAAO,CAAU;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/tlschema",
3
3
  "description": "tldraw infinite canvas SDK (schema).",
4
- "version": "4.2.0-next.b7f56801f23f",
4
+ "version": "4.2.0-next.bfd9ab728a80",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -51,10 +51,10 @@
51
51
  "vitest": "^3.2.4"
52
52
  },
53
53
  "dependencies": {
54
- "@tldraw/state": "4.2.0-next.b7f56801f23f",
55
- "@tldraw/store": "4.2.0-next.b7f56801f23f",
56
- "@tldraw/utils": "4.2.0-next.b7f56801f23f",
57
- "@tldraw/validate": "4.2.0-next.b7f56801f23f"
54
+ "@tldraw/state": "4.2.0-next.bfd9ab728a80",
55
+ "@tldraw/store": "4.2.0-next.bfd9ab728a80",
56
+ "@tldraw/utils": "4.2.0-next.bfd9ab728a80",
57
+ "@tldraw/validate": "4.2.0-next.bfd9ab728a80"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^18.2.0 || ^19.0.0",
@@ -102,6 +102,8 @@ export interface TLHandle {
102
102
  canSnap?: boolean
103
103
  /** The type of snap to use for this handle */
104
104
  snapType?: 'point' | 'align'
105
+ /** The ID of the handle to use as reference point for shift-modifier angle snapping */
106
+ snapReferenceHandleId?: string
105
107
  /** The fractional index used for ordering handles */
106
108
  index: IndexKey
107
109
  /** The x-coordinate of the handle in the shape's local coordinate system */