@tldraw/tlschema 4.3.0 → 4.4.0-canary.09e80a09d230
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.d.ts +2 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/misc/TLScribble.js +7 -1
- package/dist-cjs/misc/TLScribble.js.map +2 -2
- package/dist-esm/index.d.mts +2 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/misc/TLScribble.mjs +7 -1
- package/dist-esm/misc/TLScribble.mjs.map +2 -2
- package/package.json +5 -5
- package/src/misc/TLScribble.ts +8 -1
package/dist-cjs/index.d.ts
CHANGED
|
@@ -2862,6 +2862,7 @@ export declare const TL_HANDLE_TYPES: Set<"clone" | "create" | "vertex" | "virtu
|
|
|
2862
2862
|
* - `starting`: The scribble is being initiated
|
|
2863
2863
|
* - `paused`: The scribble is temporarily paused
|
|
2864
2864
|
* - `active`: The scribble is actively being drawn
|
|
2865
|
+
* - `complete`: The scribble is done being drawn but not yet fading
|
|
2865
2866
|
* - `stopping`: The scribble is being finished
|
|
2866
2867
|
*
|
|
2867
2868
|
* These states help manage the drawing lifecycle and apply appropriate
|
|
@@ -2880,7 +2881,7 @@ export declare const TL_HANDLE_TYPES: Set<"clone" | "create" | "vertex" | "virtu
|
|
|
2880
2881
|
*
|
|
2881
2882
|
* @public
|
|
2882
2883
|
*/
|
|
2883
|
-
export declare const TL_SCRIBBLE_STATES: Set<"active" | "paused" | "starting" | "stopping">;
|
|
2884
|
+
export declare const TL_SCRIBBLE_STATES: Set<"active" | "complete" | "paused" | "starting" | "stopping">;
|
|
2884
2885
|
|
|
2885
2886
|
/**
|
|
2886
2887
|
* Represents a binding relationship between an arrow shape and another shape.
|
package/dist-cjs/index.js
CHANGED
|
@@ -181,7 +181,7 @@ var import_translations = require("./translations/translations");
|
|
|
181
181
|
var import_b64Vecs = require("./misc/b64Vecs");
|
|
182
182
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
183
183
|
"@tldraw/tlschema",
|
|
184
|
-
"4.
|
|
184
|
+
"4.4.0-canary.09e80a09d230",
|
|
185
185
|
"cjs"
|
|
186
186
|
);
|
|
187
187
|
//# sourceMappingURL=index.js.map
|
|
@@ -25,7 +25,13 @@ module.exports = __toCommonJS(TLScribble_exports);
|
|
|
25
25
|
var import_validate = require("@tldraw/validate");
|
|
26
26
|
var import_TLColor = require("./TLColor");
|
|
27
27
|
var import_geometry_types = require("./geometry-types");
|
|
28
|
-
const TL_SCRIBBLE_STATES = /* @__PURE__ */ new Set([
|
|
28
|
+
const TL_SCRIBBLE_STATES = /* @__PURE__ */ new Set([
|
|
29
|
+
"starting",
|
|
30
|
+
"paused",
|
|
31
|
+
"active",
|
|
32
|
+
"complete",
|
|
33
|
+
"stopping"
|
|
34
|
+
]);
|
|
29
35
|
const scribbleValidator = import_validate.T.object({
|
|
30
36
|
id: import_validate.T.string,
|
|
31
37
|
points: import_validate.T.arrayOf(import_geometry_types.vecModelValidator),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/TLScribble.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n * console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set(['starting'
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAElB,qBAA4D;AAC5D,4BAA4C;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `complete`: The scribble is done being drawn but not yet fading\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n * console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set([\n\t'starting',\n\t'paused',\n\t'active',\n\t'complete',\n\t'stopping',\n] as const)\n\n/**\n * A scribble object representing a drawing stroke in tldraw.\n *\n * Scribbles are temporary drawing strokes that appear during freehand drawing\n * operations. They provide visual feedback as the user draws and can be styled\n * with various properties like size, color, and effects.\n *\n * @example\n * ```ts\n * // A basic scribble stroke\n * const scribble: TLScribble = {\n * id: 'scribble-123',\n * points: [\n * { x: 0, y: 0, z: 0.5 },\n * { x: 10, y: 5, z: 0.7 },\n * { x: 20, y: 10, z: 0.6 }\n * ],\n * size: 4,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.1,\n * taper: true\n * }\n *\n * // A laser pointer scribble\n * const laserScribble: TLScribble = {\n * id: 'laser-pointer',\n * points: [{ x: 50, y: 50, z: 1.0 }],\n * size: 8,\n * color: 'laser',\n * opacity: 1.0,\n * state: 'active',\n * delay: 100,\n * shrink: 0,\n * taper: false\n * }\n * ```\n *\n * @public\n */\nexport interface TLScribble {\n\t/** Unique identifier for the scribble */\n\tid: string\n\t/** Array of points that make up the scribble path */\n\tpoints: VecModel[]\n\t/** The brush size/width of the scribble stroke */\n\tsize: number\n\t/** The color of the scribble using canvas UI color types */\n\tcolor: TLCanvasUiColor\n\t/** The opacity of the scribble (0-1) */\n\topacity: number\n\t/** The current state of the scribble drawing */\n\tstate: SetValue<typeof TL_SCRIBBLE_STATES>\n\t/** Time delay in milliseconds for animation effects */\n\tdelay: number\n\t/** Amount the stroke should shrink over time (0-1) */\n\tshrink: number\n\t/** Whether the stroke should taper at the ends */\n\ttaper: boolean\n}\n\n/**\n * A validator for TLScribble objects.\n *\n * This validator ensures that scribble objects have all required properties\n * with valid types and values. It validates the points array, size constraints,\n * color types, and state values according to the scribble system requirements.\n *\n * @example\n * ```ts\n * import { scribbleValidator } from '@tldraw/tlschema'\n *\n * // Validate a scribble object\n * try {\n * const validScribble = scribbleValidator.validate({\n * id: 'scribble-1',\n * points: [{ x: 0, y: 0, z: 1 }, { x: 10, y: 10, z: 1 }],\n * size: 3,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.05,\n * taper: true\n * })\n * console.log('Valid scribble:', validScribble)\n * } catch (error) {\n * console.error('Invalid scribble:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const scribbleValidator: T.ObjectValidator<TLScribble> = T.object({\n\tid: T.string,\n\tpoints: T.arrayOf(vecModelValidator),\n\tsize: T.positiveNumber,\n\tcolor: canvasUiColorTypeValidator,\n\topacity: T.number,\n\tstate: T.setEnum(TL_SCRIBBLE_STATES),\n\tdelay: T.number,\n\tshrink: T.number,\n\ttaper: T.boolean,\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkB;AAElB,qBAA4D;AAC5D,4BAA4C;AA6BrC,MAAM,qBAAqB,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAU;AAiGH,MAAM,oBAAmD,kBAAE,OAAO;AAAA,EACxE,IAAI,kBAAE;AAAA,EACN,QAAQ,kBAAE,QAAQ,uCAAiB;AAAA,EACnC,MAAM,kBAAE;AAAA,EACR,OAAO;AAAA,EACP,SAAS,kBAAE;AAAA,EACX,OAAO,kBAAE,QAAQ,kBAAkB;AAAA,EACnC,OAAO,kBAAE;AAAA,EACT,QAAQ,kBAAE;AAAA,EACV,OAAO,kBAAE;AACV,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -2862,6 +2862,7 @@ export declare const TL_HANDLE_TYPES: Set<"clone" | "create" | "vertex" | "virtu
|
|
|
2862
2862
|
* - `starting`: The scribble is being initiated
|
|
2863
2863
|
* - `paused`: The scribble is temporarily paused
|
|
2864
2864
|
* - `active`: The scribble is actively being drawn
|
|
2865
|
+
* - `complete`: The scribble is done being drawn but not yet fading
|
|
2865
2866
|
* - `stopping`: The scribble is being finished
|
|
2866
2867
|
*
|
|
2867
2868
|
* These states help manage the drawing lifecycle and apply appropriate
|
|
@@ -2880,7 +2881,7 @@ export declare const TL_HANDLE_TYPES: Set<"clone" | "create" | "vertex" | "virtu
|
|
|
2880
2881
|
*
|
|
2881
2882
|
* @public
|
|
2882
2883
|
*/
|
|
2883
|
-
export declare const TL_SCRIBBLE_STATES: Set<"active" | "paused" | "starting" | "stopping">;
|
|
2884
|
+
export declare const TL_SCRIBBLE_STATES: Set<"active" | "complete" | "paused" | "starting" | "stopping">;
|
|
2884
2885
|
|
|
2885
2886
|
/**
|
|
2886
2887
|
* Represents a binding relationship between an arrow shape and another shape.
|
package/dist-esm/index.mjs
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { T } from "@tldraw/validate";
|
|
2
2
|
import { canvasUiColorTypeValidator } from "./TLColor.mjs";
|
|
3
3
|
import { vecModelValidator } from "./geometry-types.mjs";
|
|
4
|
-
const TL_SCRIBBLE_STATES = /* @__PURE__ */ new Set([
|
|
4
|
+
const TL_SCRIBBLE_STATES = /* @__PURE__ */ new Set([
|
|
5
|
+
"starting",
|
|
6
|
+
"paused",
|
|
7
|
+
"active",
|
|
8
|
+
"complete",
|
|
9
|
+
"stopping"
|
|
10
|
+
]);
|
|
5
11
|
const scribbleValidator = T.object({
|
|
6
12
|
id: T.string,
|
|
7
13
|
points: T.arrayOf(vecModelValidator),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/TLScribble.ts"],
|
|
4
|
-
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n * console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set(['starting'
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAElB,SAA0B,kCAAkC;AAC5D,SAAmB,yBAAyB;
|
|
4
|
+
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `complete`: The scribble is done being drawn but not yet fading\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n * console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set([\n\t'starting',\n\t'paused',\n\t'active',\n\t'complete',\n\t'stopping',\n] as const)\n\n/**\n * A scribble object representing a drawing stroke in tldraw.\n *\n * Scribbles are temporary drawing strokes that appear during freehand drawing\n * operations. They provide visual feedback as the user draws and can be styled\n * with various properties like size, color, and effects.\n *\n * @example\n * ```ts\n * // A basic scribble stroke\n * const scribble: TLScribble = {\n * id: 'scribble-123',\n * points: [\n * { x: 0, y: 0, z: 0.5 },\n * { x: 10, y: 5, z: 0.7 },\n * { x: 20, y: 10, z: 0.6 }\n * ],\n * size: 4,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.1,\n * taper: true\n * }\n *\n * // A laser pointer scribble\n * const laserScribble: TLScribble = {\n * id: 'laser-pointer',\n * points: [{ x: 50, y: 50, z: 1.0 }],\n * size: 8,\n * color: 'laser',\n * opacity: 1.0,\n * state: 'active',\n * delay: 100,\n * shrink: 0,\n * taper: false\n * }\n * ```\n *\n * @public\n */\nexport interface TLScribble {\n\t/** Unique identifier for the scribble */\n\tid: string\n\t/** Array of points that make up the scribble path */\n\tpoints: VecModel[]\n\t/** The brush size/width of the scribble stroke */\n\tsize: number\n\t/** The color of the scribble using canvas UI color types */\n\tcolor: TLCanvasUiColor\n\t/** The opacity of the scribble (0-1) */\n\topacity: number\n\t/** The current state of the scribble drawing */\n\tstate: SetValue<typeof TL_SCRIBBLE_STATES>\n\t/** Time delay in milliseconds for animation effects */\n\tdelay: number\n\t/** Amount the stroke should shrink over time (0-1) */\n\tshrink: number\n\t/** Whether the stroke should taper at the ends */\n\ttaper: boolean\n}\n\n/**\n * A validator for TLScribble objects.\n *\n * This validator ensures that scribble objects have all required properties\n * with valid types and values. It validates the points array, size constraints,\n * color types, and state values according to the scribble system requirements.\n *\n * @example\n * ```ts\n * import { scribbleValidator } from '@tldraw/tlschema'\n *\n * // Validate a scribble object\n * try {\n * const validScribble = scribbleValidator.validate({\n * id: 'scribble-1',\n * points: [{ x: 0, y: 0, z: 1 }, { x: 10, y: 10, z: 1 }],\n * size: 3,\n * color: 'black',\n * opacity: 0.8,\n * state: 'active',\n * delay: 0,\n * shrink: 0.05,\n * taper: true\n * })\n * console.log('Valid scribble:', validScribble)\n * } catch (error) {\n * console.error('Invalid scribble:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const scribbleValidator: T.ObjectValidator<TLScribble> = T.object({\n\tid: T.string,\n\tpoints: T.arrayOf(vecModelValidator),\n\tsize: T.positiveNumber,\n\tcolor: canvasUiColorTypeValidator,\n\topacity: T.number,\n\tstate: T.setEnum(TL_SCRIBBLE_STATES),\n\tdelay: T.number,\n\tshrink: T.number,\n\ttaper: T.boolean,\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAElB,SAA0B,kCAAkC;AAC5D,SAAmB,yBAAyB;AA6BrC,MAAM,qBAAqB,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAU;AAiGH,MAAM,oBAAmD,EAAE,OAAO;AAAA,EACxE,IAAI,EAAE;AAAA,EACN,QAAQ,EAAE,QAAQ,iBAAiB;AAAA,EACnC,MAAM,EAAE;AAAA,EACR,OAAO;AAAA,EACP,SAAS,EAAE;AAAA,EACX,OAAO,EAAE,QAAQ,kBAAkB;AAAA,EACnC,OAAO,EAAE;AAAA,EACT,QAAQ,EAAE;AAAA,EACV,OAAO,EAAE;AACV,CAAC;",
|
|
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.
|
|
4
|
+
"version": "4.4.0-canary.09e80a09d230",
|
|
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.
|
|
55
|
-
"@tldraw/store": "4.
|
|
56
|
-
"@tldraw/utils": "4.
|
|
57
|
-
"@tldraw/validate": "4.
|
|
54
|
+
"@tldraw/state": "4.4.0-canary.09e80a09d230",
|
|
55
|
+
"@tldraw/store": "4.4.0-canary.09e80a09d230",
|
|
56
|
+
"@tldraw/utils": "4.4.0-canary.09e80a09d230",
|
|
57
|
+
"@tldraw/validate": "4.4.0-canary.09e80a09d230"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^18.2.0 || ^19.2.1",
|
package/src/misc/TLScribble.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { VecModel, vecModelValidator } from './geometry-types'
|
|
|
11
11
|
* - `starting`: The scribble is being initiated
|
|
12
12
|
* - `paused`: The scribble is temporarily paused
|
|
13
13
|
* - `active`: The scribble is actively being drawn
|
|
14
|
+
* - `complete`: The scribble is done being drawn but not yet fading
|
|
14
15
|
* - `stopping`: The scribble is being finished
|
|
15
16
|
*
|
|
16
17
|
* These states help manage the drawing lifecycle and apply appropriate
|
|
@@ -29,7 +30,13 @@ import { VecModel, vecModelValidator } from './geometry-types'
|
|
|
29
30
|
*
|
|
30
31
|
* @public
|
|
31
32
|
*/
|
|
32
|
-
export const TL_SCRIBBLE_STATES = new Set([
|
|
33
|
+
export const TL_SCRIBBLE_STATES = new Set([
|
|
34
|
+
'starting',
|
|
35
|
+
'paused',
|
|
36
|
+
'active',
|
|
37
|
+
'complete',
|
|
38
|
+
'stopping',
|
|
39
|
+
] as const)
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* A scribble object representing a drawing stroke in tldraw.
|