tldraw/packages/utils/api/api.json
David Sheldrick 4f70a4f4e8
New migrations again (#3220)
Describe what your pull request does. If appropriate, add GIFs or images
showing the before and after.

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `galaxy brain` — Architectural changes



### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

#### BREAKING CHANGES

- The `Migrations` type is now called `LegacyMigrations`.
- The serialized schema format (e.g. returned by
`StoreSchema.serialize()` and `Store.getSnapshot()`) has changed. You
don't need to do anything about it unless you were reading data directly
from the schema for some reason. In which case it'd be best to avoid
that in the future! We have no plans to change the schema format again
(this time was traumatic enough) but you never know.
- `compareRecordVersions` and the `RecordVersion` type have both
disappeared. There is no replacement. These were public by mistake
anyway, so hopefully nobody had been using it.
- `compareSchemas` is a bit less useful now. Our migrations system has
become a little fuzzy to allow for simpler UX when adding/removing
custom extensions and 3rd party dependencies, and as a result we can no
longer compare serialized schemas in any rigorous manner. You can rely
on this function to return `0` if the schemas are the same. Otherwise it
will return `-1` if the schema on the right _seems_ to be newer than the
schema on the left, but it cannot guarantee that in situations where
migration sequences have been removed over time (e.g. if you remove one
of the builtin tldraw shapes).

Generally speaking, the best way to check schema compatibility now is to
call `store.schema.getMigrationsSince(persistedSchema)`. This will throw
an error if there is no upgrade path from the `persistedSchema` to the
current version.

- `defineMigrations` has been deprecated and will be removed in a future
release. For upgrade instructions see
https://tldraw.dev/docs/persistence#Updating-legacy-shape-migrations-defineMigrations

- `migrate` has been removed. Nobody should have been using this but if
you were you'll need to find an alternative. For migrating tldraw data,
you should stick to using `schema.migrateStoreSnapshot` and, if you are
building a nuanced sync engine that supports some amount of backwards
compatibility, also feel free to use `schema.migratePersistedRecord`.
- the `Migration` type has changed. If you need the old one for some
reason it has been renamed to `LegacyMigration`. It will be removed in a
future release.
- the `Migrations` type has been renamed to `LegacyMigrations` and will
be removed in a future release.
- the `SerializedSchema` type has been augmented. If you need the old
version specifically you can use `SerializedSchemaV1`

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-15 12:53:42 +00:00

3414 lines
100 KiB
JSON

{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "7.43.1",
"schemaVersion": 1011,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"noStandardTags": true,
"tagDefinitions": [
{
"tagName": "@alpha",
"syntaxKind": "modifier"
},
{
"tagName": "@beta",
"syntaxKind": "modifier"
},
{
"tagName": "@defaultValue",
"syntaxKind": "block"
},
{
"tagName": "@decorator",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@deprecated",
"syntaxKind": "block"
},
{
"tagName": "@eventProperty",
"syntaxKind": "modifier"
},
{
"tagName": "@example",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@experimental",
"syntaxKind": "modifier"
},
{
"tagName": "@inheritDoc",
"syntaxKind": "inline"
},
{
"tagName": "@internal",
"syntaxKind": "modifier"
},
{
"tagName": "@label",
"syntaxKind": "inline"
},
{
"tagName": "@link",
"syntaxKind": "inline",
"allowMultiple": true
},
{
"tagName": "@override",
"syntaxKind": "modifier"
},
{
"tagName": "@packageDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@param",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@privateRemarks",
"syntaxKind": "block"
},
{
"tagName": "@public",
"syntaxKind": "modifier"
},
{
"tagName": "@readonly",
"syntaxKind": "modifier"
},
{
"tagName": "@remarks",
"syntaxKind": "block"
},
{
"tagName": "@returns",
"syntaxKind": "block"
},
{
"tagName": "@sealed",
"syntaxKind": "modifier"
},
{
"tagName": "@see",
"syntaxKind": "block"
},
{
"tagName": "@throws",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@typeParam",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@virtual",
"syntaxKind": "modifier"
},
{
"tagName": "@betaDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@internalRemarks",
"syntaxKind": "block"
},
{
"tagName": "@preapproved",
"syntaxKind": "modifier"
}
],
"supportForTags": {
"@alpha": true,
"@beta": true,
"@defaultValue": true,
"@decorator": true,
"@deprecated": true,
"@eventProperty": true,
"@example": true,
"@experimental": true,
"@inheritDoc": true,
"@internal": true,
"@label": true,
"@link": true,
"@override": true,
"@packageDocumentation": true,
"@param": true,
"@privateRemarks": true,
"@public": true,
"@readonly": true,
"@remarks": true,
"@returns": true,
"@sealed": true,
"@see": true,
"@throws": true,
"@typeParam": true,
"@virtual": true,
"@betaDocumentation": true,
"@internalRemarks": true,
"@preapproved": true
},
"reportUnsupportedHtmlElements": false
}
},
"kind": "Package",
"canonicalReference": "@tldraw/utils!",
"docComment": "",
"name": "@tldraw/utils",
"preserveMemberOrder": false,
"members": [
{
"kind": "EntryPoint",
"canonicalReference": "@tldraw/utils!",
"name": "",
"preserveMemberOrder": false,
"members": [
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!debounce:function(1)",
"docComment": "/**\n * Debounce a function.\n *\n * @example\n * ```ts\n * const A = debounce(myFunction, 1000)\n * ```\n *\n * @see\n *\n * source - https://gist.github.com/ca0v/73a31f57b397606c9813472f7493a940\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function debounce<T extends "
},
{
"kind": "Content",
"text": "unknown[]"
},
{
"kind": "Content",
"text": ", U>(callback: "
},
{
"kind": "Content",
"text": "(...args: T) => "
},
{
"kind": "Reference",
"text": "PromiseLike",
"canonicalReference": "!PromiseLike:interface"
},
{
"kind": "Content",
"text": "<U> | U"
},
{
"kind": "Content",
"text": ", wait: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "{\n (...args: T): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<U>;\n cancel(): void;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/debounce.ts",
"returnTypeTokenRange": {
"startIndex": 9,
"endIndex": 12
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "callback",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 6
},
"isOptional": false
},
{
"parameterName": "wait",
"parameterTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "U",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "debounce"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!dedupe:function(1)",
"docComment": "/**\n * Deduplicate the items in an array\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function dedupe<T>(input: "
},
{
"kind": "Content",
"text": "T[]"
},
{
"kind": "Content",
"text": ", equals?: "
},
{
"kind": "Content",
"text": "(a: any, b: any) => boolean"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "T[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/array.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "input",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "equals",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": true
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "dedupe"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!ErrorResult:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type ErrorResult<E> = "
},
{
"kind": "Content",
"text": "{\n readonly error: E;\n readonly ok: false;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/control.ts",
"releaseTag": "Public",
"name": "ErrorResult",
"typeParameters": [
{
"typeParameterName": "E",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!Expand:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type Expand<T> = "
},
{
"kind": "Content",
"text": "T extends infer O ? {\n [K in keyof O]: O[K];\n} : never"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/types.ts",
"releaseTag": "Public",
"name": "Expand",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "Class",
"canonicalReference": "@tldraw/utils!FileHelpers:class",
"docComment": "/**\n * Helpers for files\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class FileHelpers "
}
],
"fileUrlPath": "packages/utils/src/lib/file.ts",
"releaseTag": "Public",
"isAbstract": false,
"name": "FileHelpers",
"preserveMemberOrder": false,
"members": [
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!FileHelpers.blobToDataUrl:member(1)",
"docComment": "/**\n * Convert a file to a base64 encoded data url.\n *\n * @param value - The file as a blob.\n *\n * @example\n * ```ts\n * const A = FileHelpers.toDataUrl(myImageFile)\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static blobToDataUrl(file: "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<string>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "file",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "blobToDataUrl"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!FileHelpers.blobToText:member(1)",
"docComment": "/**\n * Convert a file to a unicode text string.\n *\n * @param value - The file as a blob.\n *\n * @example\n * ```ts\n * const A = FileHelpers.fileToDataUrl(myTextFile)\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static blobToText(file: "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<string>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "file",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "blobToText"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!FileHelpers.dataUrlToArrayBuffer:member(1)",
"docComment": "/**\n * @param dataURL - The file as a string.\n *\n * from https://stackoverflow.com/a/53817185\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static dataUrlToArrayBuffer(dataURL: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "ArrayBuffer",
"canonicalReference": "!ArrayBuffer:interface"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "dataURL",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "dataUrlToArrayBuffer"
}
],
"implementsTokenRanges": []
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getFirstFromIterable:function(1)",
"docComment": "/**\n * Get the first item from an iterable Set or Map.\n *\n * @param value - The iterable Set or Map.\n *\n * @example\n * ```ts\n * const A = getFirstItem(new Set([1, 2, 3])) // 1\n * const B = getFirstItem(\n * \tnew Map([\n * \t\t['a', 1],\n * \t\t['b', 2],\n * \t])\n * ) // 1\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getFirstFromIterable<T = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": ">(set: "
},
{
"kind": "Reference",
"text": "Map",
"canonicalReference": "!Map:interface"
},
{
"kind": "Content",
"text": "<any, T> | "
},
{
"kind": "Reference",
"text": "Set",
"canonicalReference": "!Set:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/iterable.ts",
"returnTypeTokenRange": {
"startIndex": 8,
"endIndex": 9
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "set",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"name": "getFirstFromIterable"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getHashForBuffer:function(1)",
"docComment": "/**\n * Hash an ArrayBuffer using the FNV-1a algorithm.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getHashForBuffer(buffer: "
},
{
"kind": "Reference",
"text": "ArrayBuffer",
"canonicalReference": "!ArrayBuffer:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/hash.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "buffer",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "getHashForBuffer"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getHashForObject:function(1)",
"docComment": "/**\n * Hash a string using the FNV-1a algorithm.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getHashForObject(obj: "
},
{
"kind": "Content",
"text": "any"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/hash.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "obj",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "getHashForObject"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getHashForString:function(1)",
"docComment": "/**\n * Hash a string using the FNV-1a algorithm.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getHashForString(string: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/hash.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "string",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "getHashForString"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndexAbove:function(1)",
"docComment": "/**\n * Get the index above a given index.\n *\n * @param below - The index below.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndexAbove(below: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "below",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "getIndexAbove"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndexBelow:function(1)",
"docComment": "/**\n * Get the index below a given index.\n *\n * @param above - The index above.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndexBelow(above: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "above",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "getIndexBelow"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndexBetween:function(1)",
"docComment": "/**\n * Get the index between two indices.\n *\n * @param below - The index below.\n *\n * @param above - The index above.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndexBetween(below: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ", above?: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "below",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "above",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": true
}
],
"name": "getIndexBetween"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndices:function(1)",
"docComment": "/**\n * Get n number of indices, starting at an index.\n *\n * @param n - The number of indices to get.\n *\n * @param start - The index to start at.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndices(n: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", start?: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "n",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "start",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": true
}
],
"name": "getIndices"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndicesAbove:function(1)",
"docComment": "/**\n * Get a number of indices above an index.\n *\n * @param below - The index below.\n *\n * @param n - The number of indices to get.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndicesAbove(below: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ", n: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "below",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "n",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"name": "getIndicesAbove"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndicesBelow:function(1)",
"docComment": "/**\n * Get a number of indices below an index.\n *\n * @param above - The index above.\n *\n * @param n - The number of indices to get.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndicesBelow(above: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ", n: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "above",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "n",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"name": "getIndicesBelow"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!getIndicesBetween:function(1)",
"docComment": "/**\n * Get a number of indices between two indices.\n *\n * @param below - The index below.\n *\n * @param above - The index above.\n *\n * @param n - The number of indices to get.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getIndicesBetween(below: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": " | undefined"
},
{
"kind": "Content",
"text": ", above: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": " | undefined"
},
{
"kind": "Content",
"text": ", n: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": "[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 9,
"endIndex": 11
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "below",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
},
{
"parameterName": "above",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 6
},
"isOptional": false
},
{
"parameterName": "n",
"parameterTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"isOptional": false
}
],
"name": "getIndicesBetween"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!IndexKey:type",
"docComment": "/**\n * A string made up of an integer part followed by a fraction part. The fraction point consists of zero or more digits with no trailing zeros. Based on {@link https://observablehq.com/@dgreensp/implementing-fractional-indexing}.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type IndexKey = "
},
{
"kind": "Content",
"text": "string & {\n __orderKey: true;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/IndexKey.ts",
"releaseTag": "Public",
"name": "IndexKey",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!invLerp:function(1)",
"docComment": "/**\n * Inverse lerp between two values. Given a value `n` in the range [a, b], returns a number between 0 and 1.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function invLerp(a: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", t: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/number.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "a",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "b",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "t",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
}
],
"name": "invLerp"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!isDefined:function(1)",
"docComment": "/**\n * Get whether a value is not undefined.\n *\n * @param value - The value to check.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function isDefined<T>(value: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value"
},
{
"kind": "Content",
"text": " is typeof "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value:var"
},
{
"kind": "Content",
"text": " extends undefined ? never : T"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/value.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "value",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "isDefined"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!isNonNull:function(1)",
"docComment": "/**\n * Get whether a value is null\n *\n * @param value - The value to check.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function isNonNull<T>(value: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value"
},
{
"kind": "Content",
"text": " is typeof "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value:var"
},
{
"kind": "Content",
"text": " extends null ? never : T"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/value.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "value",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "isNonNull"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!isNonNullish:function(1)",
"docComment": "/**\n * Get whether a value is nullish (null, undefined).\n *\n * @param value - The value to check.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function isNonNullish<T>(value: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value"
},
{
"kind": "Content",
"text": " is typeof "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value:var"
},
{
"kind": "Content",
"text": " extends undefined ? never : typeof "
},
{
"kind": "Reference",
"text": "value",
"canonicalReference": "@tldraw/utils!~value:var"
},
{
"kind": "Content",
"text": " extends null ? never : T"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/value.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 9
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "value",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "isNonNullish"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!JsonArray:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type JsonArray = "
},
{
"kind": "Reference",
"text": "JsonValue",
"canonicalReference": "@tldraw/utils!JsonValue:type"
},
{
"kind": "Content",
"text": "[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/json-value.ts",
"releaseTag": "Public",
"name": "JsonArray",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 3
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!JsonObject:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type JsonObject = "
},
{
"kind": "Content",
"text": "{\n [key: string]: "
},
{
"kind": "Reference",
"text": "JsonValue",
"canonicalReference": "@tldraw/utils!JsonValue:type"
},
{
"kind": "Content",
"text": " | undefined;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/json-value.ts",
"releaseTag": "Public",
"name": "JsonObject",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 4
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!JsonPrimitive:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type JsonPrimitive = "
},
{
"kind": "Content",
"text": "boolean | null | number | string"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/json-value.ts",
"releaseTag": "Public",
"name": "JsonPrimitive",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!JsonValue:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type JsonValue = "
},
{
"kind": "Reference",
"text": "JsonArray",
"canonicalReference": "@tldraw/utils!JsonArray:type"
},
{
"kind": "Content",
"text": " | "
},
{
"kind": "Reference",
"text": "JsonObject",
"canonicalReference": "@tldraw/utils!JsonObject:type"
},
{
"kind": "Content",
"text": " | "
},
{
"kind": "Reference",
"text": "JsonPrimitive",
"canonicalReference": "@tldraw/utils!JsonPrimitive:type"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/json-value.ts",
"releaseTag": "Public",
"name": "JsonValue",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 6
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!lerp:function(1)",
"docComment": "/**\n * Linear interpolate between two values.\n *\n * @example\n * ```ts\n * const A = lerp(0, 1, 0.5)\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function lerp(a: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", t: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/number.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "a",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "b",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "t",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
}
],
"name": "lerp"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!lns:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function lns(str: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/hash.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "str",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "lns"
},
{
"kind": "Class",
"canonicalReference": "@tldraw/utils!MediaHelpers:class",
"docComment": "/**\n * Helpers for media\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class MediaHelpers "
}
],
"fileUrlPath": "packages/utils/src/lib/media.ts",
"releaseTag": "Public",
"isAbstract": false,
"name": "MediaHelpers",
"preserveMemberOrder": false,
"members": [
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!MediaHelpers.getImageSize:member(1)",
"docComment": "/**\n * Get the size of an image blob\n *\n * @param dataURL - A Blob containing the image.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static getImageSize(blob: "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<{\n h: number;\n w: number;\n }>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "blob",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "getImageSize"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!MediaHelpers.getVideoSize:member(1)",
"docComment": "/**\n * Get the size of a video blob\n *\n * @param src - A SharedBlob containing the video\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static getVideoSize(blob: "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<{\n h: number;\n w: number;\n }>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "blob",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "getVideoSize"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!MediaHelpers.loadImage:member(1)",
"docComment": "/**\n * Load an image from a url.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static loadImage(src: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "HTMLImageElement",
"canonicalReference": "!HTMLImageElement:interface"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "src",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "loadImage"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!MediaHelpers.loadVideo:member(1)",
"docComment": "/**\n * Load a video from a url.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "static loadVideo(src: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "HTMLVideoElement",
"canonicalReference": "!HTMLVideoElement:interface"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "src",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "loadVideo"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!MediaHelpers.usingObjectURL:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static usingObjectURL<T>(blob: "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": ", fn: "
},
{
"kind": "Content",
"text": "(url: string) => "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 9
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "blob",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "fn",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 6
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "usingObjectURL"
}
],
"implementsTokenRanges": []
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!modulate:function(1)",
"docComment": "/**\n * Modulate a value between two ranges.\n *\n * @param value - The interpolation value.\n *\n * @param rangeA - From [low, high]\n *\n * @param rangeB - To [low, high]\n *\n * @param clamp - Whether to clamp the the result to [low, high]\n *\n * @example\n * ```ts\n * const A = modulate(0, [0, 1], [0, 100])\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function modulate(value: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", rangeA: "
},
{
"kind": "Content",
"text": "number[]"
},
{
"kind": "Content",
"text": ", rangeB: "
},
{
"kind": "Content",
"text": "number[]"
},
{
"kind": "Content",
"text": ", clamp?: "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/number.ts",
"returnTypeTokenRange": {
"startIndex": 9,
"endIndex": 10
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "value",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "rangeA",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "rangeB",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
},
{
"parameterName": "clamp",
"parameterTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"isOptional": true
}
],
"name": "modulate"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!OkResult:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type OkResult<T> = "
},
{
"kind": "Content",
"text": "{\n readonly ok: true;\n readonly value: T;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/control.ts",
"releaseTag": "Public",
"name": "OkResult",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "Class",
"canonicalReference": "@tldraw/utils!PngHelpers:class",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class PngHelpers "
}
],
"fileUrlPath": "packages/utils/src/lib/png.ts",
"releaseTag": "Public",
"isAbstract": false,
"name": "PngHelpers",
"preserveMemberOrder": false,
"members": [
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.findChunk:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static findChunk(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", type: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "{\n dataOffset: number;\n size: number;\n start: number;\n }"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "type",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "findChunk"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.getChunkType:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static getChunkType(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", offset: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "offset",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "getChunkType"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.isPng:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static isPng(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", offset: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "offset",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "isPng"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.parsePhys:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static parsePhys(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", offset: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "{\n ppux: number;\n ppuy: number;\n unit: number;\n }"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "offset",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "parsePhys"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.readChunks:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static readChunks(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", offset?: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<string, {\n dataOffset: number;\n size: number;\n start: number;\n }>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "offset",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "readChunks"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/utils!PngHelpers.setPhysChunk:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static setPhysChunk(view: "
},
{
"kind": "Reference",
"text": "DataView",
"canonicalReference": "!DataView:interface"
},
{
"kind": "Content",
"text": ", dpr?: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ", options?: "
},
{
"kind": "Reference",
"text": "BlobPropertyBag",
"canonicalReference": "!BlobPropertyBag:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Blob",
"canonicalReference": "!Blob:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "view",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "dpr",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": true
},
{
"parameterName": "options",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "setPhysChunk"
}
],
"implementsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!RecursivePartial:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type RecursivePartial<T> = "
},
{
"kind": "Content",
"text": "{\n [P in keyof T]?: "
},
{
"kind": "Reference",
"text": "RecursivePartial",
"canonicalReference": "@tldraw/utils!RecursivePartial:type"
},
{
"kind": "Content",
"text": "<T[P]>;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/types.ts",
"releaseTag": "Public",
"name": "RecursivePartial",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 4
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/utils!Result:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type Result<T, E> = "
},
{
"kind": "Reference",
"text": "ErrorResult",
"canonicalReference": "@tldraw/utils!ErrorResult:type"
},
{
"kind": "Content",
"text": "<E> | "
},
{
"kind": "Reference",
"text": "OkResult",
"canonicalReference": "@tldraw/utils!OkResult:type"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/control.ts",
"releaseTag": "Public",
"name": "Result",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "E",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 5
}
},
{
"kind": "Variable",
"canonicalReference": "@tldraw/utils!Result:var",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "Result: "
},
{
"kind": "Content",
"text": "{\n err<E>(error: E): "
},
{
"kind": "Reference",
"text": "ErrorResult",
"canonicalReference": "@tldraw/utils!ErrorResult:type"
},
{
"kind": "Content",
"text": "<E>;\n ok<T>(value: T): "
},
{
"kind": "Reference",
"text": "OkResult",
"canonicalReference": "@tldraw/utils!OkResult:type"
},
{
"kind": "Content",
"text": "<T>;\n}"
}
],
"fileUrlPath": "packages/utils/src/lib/control.ts",
"isReadonly": true,
"releaseTag": "Public",
"name": "Result",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!rng:function(1)",
"docComment": "/**\n * Seeded random number generator, using [xorshift](https://en.wikipedia.org/wiki/Xorshift). The result will always be betweeen -1 and 1.\n *\n * Adapted from [seedrandom](https://github.com/davidbau/seedrandom).\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function rng(seed?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "() => number"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/number.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "seed",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": true
}
],
"name": "rng"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!rotateArray:function(1)",
"docComment": "/**\n * Rotate the contents of an array.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function rotateArray<T>(arr: "
},
{
"kind": "Content",
"text": "T[]"
},
{
"kind": "Content",
"text": ", offset: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "T[]"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/array.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "arr",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "offset",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "rotateArray"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!sortById:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function sortById<T extends "
},
{
"kind": "Content",
"text": "{\n id: any;\n}"
},
{
"kind": "Content",
"text": ">(a: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "-1 | 1"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/sort.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "a",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "b",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "sortById"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!sortByIndex:function(1)",
"docComment": "/**\n * Sort by index.\n *\n * @param a - An object with an index property.\n *\n * @param b - An object with an index property.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function sortByIndex<T extends "
},
{
"kind": "Content",
"text": "{\n index: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
},
{
"kind": "Content",
"text": ";\n}"
},
{
"kind": "Content",
"text": ">(a: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "-1 | 0 | 1"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"returnTypeTokenRange": {
"startIndex": 9,
"endIndex": 10
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "a",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
},
{
"parameterName": "b",
"parameterTypeTokenRange": {
"startIndex": 7,
"endIndex": 8
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "sortByIndex"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!structuredClone_2:function(1)",
"docComment": "/**\n * Create a deep copy of a value. Uses the structuredClone API if available, otherwise uses JSON.parse(JSON.stringify()).\n *\n * @param i - The value to clone.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "structuredClone: <T>(i: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ") => "
},
{
"kind": "Content",
"text": "T"
}
],
"fileUrlPath": "packages/utils/src/lib/value.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "i",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "structuredClone_2"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/utils!throttle:function(1)",
"docComment": "/**\n * Throttle a function.\n *\n * @example\n * ```ts\n * const A = throttle(myFunction, 1000)\n * ```\n *\n * @see\n *\n * source - https://github.com/bameyrick/throttle-typescript\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function throttle<T extends "
},
{
"kind": "Content",
"text": "(...args: any) => any"
},
{
"kind": "Content",
"text": ">(func: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ", limit: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "(...args: "
},
{
"kind": "Reference",
"text": "Parameters",
"canonicalReference": "!Parameters:type"
},
{
"kind": "Content",
"text": "<T>) => "
},
{
"kind": "Reference",
"text": "ReturnType",
"canonicalReference": "!ReturnType:type"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/utils/src/lib/function.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 12
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "func",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "limit",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "throttle"
},
{
"kind": "Variable",
"canonicalReference": "@tldraw/utils!ZERO_INDEX_KEY:var",
"docComment": "/**\n * The index key for the first index - 'a0'.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "ZERO_INDEX_KEY: "
},
{
"kind": "Reference",
"text": "IndexKey",
"canonicalReference": "@tldraw/utils!IndexKey:type"
}
],
"fileUrlPath": "packages/utils/src/lib/reordering/reordering.ts",
"isReadonly": true,
"releaseTag": "Public",
"name": "ZERO_INDEX_KEY",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
]
}
]
}