fix: fix tsdoc comments (#21)

Closes: #18
This commit is contained in:
Jacob
2022-08-04 13:41:39 +02:00
committed by GitHub
parent 44020372a9
commit 4b6cb660ad
39 changed files with 415 additions and 197 deletions

View File

@@ -3,18 +3,19 @@
"browser": true,
"es2021": true
},
"ignorePatterns": ["**/*.js"],
"ignorePatterns": ["**/*.js", "**/*.d.ts", "packages/template"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "eslint-plugin-tsdoc"],
"rules": {
"require-yield": "off",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off"
"@typescript-eslint/ban-ts-comment": "off",
"tsdoc/syntax": "warn"
}
}

142
package-lock.json generated
View File

@@ -14,6 +14,7 @@
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"eslint": "^8.21.0",
"eslint-plugin-tsdoc": "^0.2.16",
"husky": "^8.0.0",
"lerna": "^5.3.0",
"lint-staged": "^13.0.3",
@@ -2697,6 +2698,59 @@
"node": "^14.15.0 || >=16.0.0"
}
},
"node_modules/@microsoft/tsdoc": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz",
"integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==",
"dev": true
},
"node_modules/@microsoft/tsdoc-config": {
"version": "0.16.1",
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz",
"integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==",
"dev": true,
"dependencies": {
"@microsoft/tsdoc": "0.14.1",
"ajv": "~6.12.6",
"jju": "~1.4.0",
"resolve": "~1.19.0"
}
},
"node_modules/@microsoft/tsdoc-config/node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/@microsoft/tsdoc-config/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
"node_modules/@microsoft/tsdoc-config/node_modules/resolve": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
"integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
"dev": true,
"dependencies": {
"is-core-module": "^2.1.0",
"path-parse": "^1.0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/@motion-canvas/core": {
"resolved": "packages/core",
"link": true
@@ -6357,6 +6411,16 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-tsdoc": {
"version": "0.2.16",
"resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz",
"integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==",
"dev": true,
"dependencies": {
"@microsoft/tsdoc": "0.14.1",
"@microsoft/tsdoc-config": "0.16.1"
}
},
"node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@@ -8913,6 +8977,12 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/jju": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz",
"integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==",
"dev": true
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -14825,7 +14895,7 @@
},
"packages/core": {
"name": "@motion-canvas/core",
"version": "9.0.0",
"version": "9.1.0",
"license": "MIT",
"dependencies": {
"@types/prismjs": "^1.26.0",
@@ -15049,10 +15119,10 @@
},
"packages/ui": {
"name": "@motion-canvas/ui",
"version": "9.0.0",
"version": "9.1.0",
"license": "MIT",
"devDependencies": {
"@motion-canvas/core": "*",
"@motion-canvas/core": "^9.1.0",
"css-loader": "^6.7.1",
"preact": "^10.7.3",
"sass": "^1.52.2",
@@ -17237,6 +17307,54 @@
"write-file-atomic": "^4.0.1"
}
},
"@microsoft/tsdoc": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz",
"integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==",
"dev": true
},
"@microsoft/tsdoc-config": {
"version": "0.16.1",
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz",
"integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==",
"dev": true,
"requires": {
"@microsoft/tsdoc": "0.14.1",
"ajv": "~6.12.6",
"jju": "~1.4.0",
"resolve": "~1.19.0"
},
"dependencies": {
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
"resolve": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
"integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
"dev": true,
"requires": {
"is-core-module": "^2.1.0",
"path-parse": "^1.0.6"
}
}
}
},
"@motion-canvas/core": {
"version": "file:packages/core",
"requires": {
@@ -17382,7 +17500,7 @@
"@motion-canvas/ui": {
"version": "file:packages/ui",
"requires": {
"@motion-canvas/core": "*",
"@motion-canvas/core": "^9.1.0",
"css-loader": "^6.7.1",
"preact": "10.7.3",
"sass": "^1.52.2",
@@ -20290,6 +20408,16 @@
}
}
},
"eslint-plugin-tsdoc": {
"version": "0.2.16",
"resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz",
"integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==",
"dev": true,
"requires": {
"@microsoft/tsdoc": "0.14.1",
"@microsoft/tsdoc-config": "0.16.1"
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@@ -22192,6 +22320,12 @@
}
}
},
"jju": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz",
"integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==",
"dev": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View File

@@ -12,7 +12,8 @@
"ui:build": "npm run build -w packages/ui",
"ui:serve": "npm run serve -w packages/ui",
"template:serve": "npm run serve -w packages/template",
"template:ui": "npm run ui -w packages/template"
"template:ui": "npm run ui -w packages/template",
"eslint": "eslint --fix \"**/*.ts?(x)\""
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
@@ -20,6 +21,7 @@
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"eslint": "^8.21.0",
"eslint-plugin-tsdoc": "^0.2.16",
"husky": "^8.0.0",
"lerna": "^5.3.0",
"lint-staged": "^13.0.3",

View File

@@ -10,13 +10,13 @@ export interface Metadata {
/**
* Represents the meta file of a given entity.
*
* @template T Type of the data stored in the meta file.
* @typeParam T - The type of the data stored in the meta file.
*/
export class Meta<T extends Metadata = Metadata> {
/**
* Triggered when metadata changes.
*
* @event T
* @eventProperty
*/
public get onDataChanged() {
return this.data.subscribable;
@@ -37,9 +37,10 @@ export class Meta<T extends Metadata = Metadata> {
/**
* Set data without waiting for confirmation.
*
* @remarks
* Any possible errors will be logged to the console.
*
* @param data
* @param data - New data.
*/
public setDataSync(data: Partial<T>) {
this.setData(data).catch(console.error);
@@ -72,10 +73,11 @@ export class Meta<T extends Metadata = Metadata> {
/**
* Get the {@link Meta} object for the given entity.
*
* @param name Name of the entity the metadata refers to.
* @template T Concrete type of the metadata. Depends on the entity.
* See {@link SceneMetadata} and {@link ProjectMetadata} for sample
* types.
* @param name - The name of the entity the metadata refers to.
*
* @typeParam T - The concrete type of the metadata. Depends on the entity.
* See {@link SceneMetadata} and {@link ProjectMetadata} for
* sample types.
*
* @internal
*/
@@ -89,12 +91,14 @@ export class Meta<T extends Metadata = Metadata> {
/**
* Register a new version of metadata.
*
* @remarks
* Called directly by meta files themselves.
* Occurs during the initial load as well as during hot reloads.
*
* @param name Name of the entity this metadata refers to.
* @param source Path to the source file relative to the compilation context.
* @param rawData New metadata as JSON.
* @param name - The Name of the entity this metadata refers to.
* @param source - The path to the source file relative to the compilation
* context.
* @param rawData - New metadata as JSON.
*
* @internal
*/

View File

@@ -17,7 +17,7 @@ decorate(showTop, threadable());
/**
* Show the given node by sliding it up.
*
* @param node
* @param node - The node to animate.
*/
export function* showTop(node: Node): ThreadGenerator {
const to = node.offsetY();
@@ -38,7 +38,7 @@ decorate(showSurfaceVertically, threadable());
/**
* Show the given surface by expanding its mask vertically.
*
* @param surface
* @param surface - The surface to animate.
*/
export function* showSurfaceVertically(surface: Surface): ThreadGenerator {
const mask = surface.getMask();
@@ -57,9 +57,9 @@ decorate(showCircle, threadable());
/**
* Show the given surface using a circle mask.
*
* @param surface
* @param duration
* @param origin The center of the circle mask.
* @param surface - The surface to animate.
* @param duration - The duration of the animation.
* @param origin - The center of the circle mask.
*/
export function* showCircle(
surface: Surface,

View File

@@ -18,17 +18,18 @@ export interface SurfaceFromConfig {
/**
* Whether the transition arc should be reversed.
*
* See {@link rectArcTween} from more detail.
* @remarks
* See {@link rectArcTween} for more detail.
*/
reverse?: boolean;
/**
* A function called when the initial surface is updated.
*
* @param surface The initial surface.
* @param value Completion of the entire transition.
* @param surface - The initial surface.
* @param value - Completion of the entire transition.
*
* @return `true` if the default changes made by {@link surfaceFrom}
* should be prevented.
* @returns `true` if the default changes made by {@link surfaceFrom}
* should be prevented.
*/
onUpdate?: (surface: Surface, value: number) => boolean | void;
duration?: number;
@@ -38,10 +39,10 @@ decorate(surfaceFrom, threadable());
/**
* Animate the mask of the surface from the initial state to its current state.
*
* @param surface
* @param mask The initial mask
* @param position The initial position
* @param config
* @param surface - The surface to animate.
* @param mask - The initial mask.
* @param position - The initial position.
* @param config - Additional configuration.
*/
export function* surfaceFrom(
surface: Surface,

View File

@@ -14,6 +14,7 @@ import {ThreadGenerator} from '../threading';
/**
* Configuration for {@link surfaceTransition}.
*
* @remarks
* For {@link SurfaceTransitionConfig.onInitialSurfaceUpdate | `onInitialSurfaceUpdate`}
* and {@link SurfaceTransitionConfig.onTargetSurfaceUpdate | `onTargetSurfaceUpdate`}
* callbacks, the `value` and `relativeValue` arguments represent the absolute
@@ -32,24 +33,25 @@ export interface SurfaceTransitionConfig {
/**
* Whether the transition arc should be reversed.
*
* See {@link rectArcTween} from more detail.
* @remarks
* See {@link rectArcTween} for more detail.
*/
reverse?: boolean;
/**
* A function called when the currently displayed surface changes.
*
* @param surface
* @param surface - The new surface.
*/
onSurfaceChange?: (surface: Surface) => void;
/**
* A function called when the initial surface is updated.
*
* @param surface The initial surface.
* @param value Completion of the entire transition.
* @param relativeValue Relative completion of the transition.
* @param surface - The initial surface.
* @param value - Completion of the entire transition.
* @param relativeValue - Relative completion of the transition.
*
* @return `true` if the default changes made by {@link surfaceTransition}
* should be prevented
* @returns `true` if the default changes made by {@link surfaceTransition}
* should be prevented
*/
onInitialSurfaceUpdate?: (
surface: Surface,
@@ -59,12 +61,12 @@ export interface SurfaceTransitionConfig {
/**
* A function called when the target surface is updated.
*
* @param surface The target surface.
* @param value Completion of the entire transition.
* @param relativeValue Relative completion of the transition.
* @param surface - The target surface.
* @param value - Completion of the entire transition.
* @param relativeValue - Relative completion of the transition.
*
* @return `true` if the default changes made by {@link surfaceTransition}
* should be prevented
* @returns `true` if the default changes made by {@link surfaceTransition}
* should be prevented
*/
onTargetSurfaceUpdate?: (
surface: Surface,
@@ -82,9 +84,9 @@ decorate(surfaceTransition, threadable());
/**
* Morph one surface into another.
*
* @param initial
* @param target
* @param config
* @param initial - The initial surface.
* @param target - The target surface.
* @param config - Additional configuration.
*/
export function* surfaceTransition(
initial: Surface,

View File

@@ -25,6 +25,7 @@ export interface SpriteConfig extends ShapeConfig {
/**
* A class for animated sprites.
*
* @remarks
* Allows to use custom alpha masks and skins.
*/
@KonvaNode()
@@ -47,6 +48,7 @@ export class Sprite extends Shape {
/**
* An image that defines which parts of the sprite should be visible.
*
* @remarks
* The red channel is used for sampling.
*/
@getset(null, Sprite.prototype.updateMask, Sprite.prototype.maskTween)
@@ -211,6 +213,7 @@ export class Sprite extends Shape {
/**
* A generator that runs this sprite's animation.
*
* @remarks
* For the animation to actually play, the {@link Sprite.playing} value has to
* be set to `true`.
*
@@ -238,9 +241,9 @@ export class Sprite extends Shape {
/**
* Play the given animation once.
*
* @param animation The animation to play.
* @param next An optional animation that should be switched to next. If not
* present the sprite will go back to the previous animation.
* @param animation - The animation to play.
* @param next - An optional animation that should be switched to next. If not
* present the sprite will go back to the previous animation.
*/
@threadable()
public *playOnce(
@@ -257,8 +260,9 @@ export class Sprite extends Shape {
}
/**
* Cancel the current {@link Sprite.play()} generator.
* Cancel the current {@link Sprite.play} generator.
*
* @remarks
* Should be used instead of manually canceling the generator.
*/
@threadable()
@@ -286,7 +290,7 @@ export class Sprite extends Shape {
/**
* Wait until the given frame is shown.
*
* @param frame
* @param frame - The frame to wait for.
*/
@threadable()
public *waitForFrame(frame: number): ThreadGenerator {

View File

@@ -109,7 +109,7 @@ export class Surface extends Group {
}
/**
* @deprecated
* @deprecated Use {@link ripple} instead.
*/
public doRipple() {
return this.ripple();

View File

@@ -7,10 +7,11 @@ export interface AsyncEventHandler<T> {
/**
* Dispatches an asynchronous {@link SubscribableEvent}.
*
* @remarks
* The {@link dispatch} method returns a promise that resolves when all the
* handlers resolve.
*
* Example:
* @example
* ```ts
* class Example {
* // expose the event to external classes
@@ -27,7 +28,7 @@ export interface AsyncEventHandler<T> {
* }
* ```
*
* @template T Type of the argument passed to subscribers.
* @typeParam T - The type of the argument passed to subscribers.
*/
export class AsyncEventDispatcher<T> extends EventDispatcherBase<
T,
@@ -41,9 +42,10 @@ export class AsyncEventDispatcher<T> extends EventDispatcherBase<
/**
* Provides safe access to the public interface of {@link AsyncEventDispatcher}.
*
* @remarks
* External classes can use it to subscribe to an event without being able to
* dispatch it.
*
* @template T Type of the argument passed to subscribers.
* @typeParam T - The type of the argument passed to subscribers.
*/
export type SubscribableAsyncEvent<T> = Subscribable<T, AsyncEventHandler<T>>;

View File

@@ -3,7 +3,7 @@ import {EventDispatcherBase, Subscribable} from './EventDispatcherBase';
/**
* Dispatches a {@link SubscribableEvent}.
*
* Example:
* @example
* ```ts
* class Example {
* // expose the event to external classes
@@ -20,7 +20,7 @@ import {EventDispatcherBase, Subscribable} from './EventDispatcherBase';
* }
* ```
*
* @template T Type of the value argument to subscribers.
* @typeParam T - The type of the value argument to subscribers.
*/
export class EventDispatcher<T> extends EventDispatcherBase<T> {
public dispatch(value: T) {
@@ -31,9 +31,10 @@ export class EventDispatcher<T> extends EventDispatcherBase<T> {
/**
* Provides safe access to the public interface of {@link EventDispatcher}.
*
* @remarks
* External classes can use it to subscribe to an event without being able to
* dispatch it.
*
* @template T Type of the argument passed to subscribers.
* @typeParam T - The type of the argument passed to subscribers.
*/
export type SubscribableEvent<T> = Subscribable<T>;

View File

@@ -5,8 +5,8 @@ export interface EventHandler<T> {
/**
* A base for dispatching {@link Subscribable}s.
*
* @template TValue Type of the argument passed to subscribers.
* @template THandler Type of the callback function.
* @typeParam TValue - The type of the argument passed to subscribers.
* @typeParam THandler - The type of the callback function.
*/
export abstract class EventDispatcherBase<
TValue,
@@ -18,7 +18,7 @@ export abstract class EventDispatcherBase<
private subscribers = new Set<THandler>();
/**
* @inheritDoc SubscribableEvent.subscribe
* {@inheritDoc SubscribableEvent.subscribe}
*/
public subscribe(handler: THandler) {
this.subscribers.add(handler);
@@ -26,7 +26,7 @@ export abstract class EventDispatcherBase<
}
/**
* @inheritDoc SubscribableEvent.unsubscribe
* {@inheritDoc SubscribableEvent.unsubscribe}
*/
public unsubscribe(handler: THandler) {
this.subscribers.delete(handler);
@@ -47,11 +47,12 @@ export abstract class EventDispatcherBase<
/**
* Provides safe access to the public interface of {@link EventDispatcherBase}.
*
* @remarks
* External classes can use it to subscribe to an event without being able to
* dispatch it.
*
* @template TValue Type of the argument passed to subscribers.
* @template THandler Type of the callback function.
* @typeParam TValue - The type of the argument passed to subscribers.
* @typeParam THandler - The type of the callback function.
*/
export class Subscribable<
TValue,
@@ -64,9 +65,9 @@ export class Subscribable<
/**
* Subscribe to the event.
*
* @param handler
* @param handler - The handler to invoke when the event occurs.
*
* @return Callback function that cancels the subscription.
* @returns A callback function that cancels the subscription.
*/
public subscribe(handler: THandler) {
return this.dispatcher.subscribe(handler);
@@ -75,7 +76,7 @@ export class Subscribable<
/**
* Unsubscribe from the event.
*
* @param handler
* @param handler - The handler to unsubscribe.
*/
public unsubscribe(handler: THandler) {
this.dispatcher.unsubscribe(handler);

View File

@@ -7,10 +7,11 @@ import {
/**
* Dispatches a {@link SubscribableValueEvent}
*
* @remarks
* Changing the value stored by a value dispatcher will immediately notify all
* its subscribers.
*
* Example:
* @example
* ```ts
* class Example {
* // expose the event to external classes
@@ -27,7 +28,7 @@ import {
* }
* ```
*
* @template T Type of the value passed to subscribers.
* @typeParam T - The type of the value passed to subscribers.
*/
export class ValueDispatcher<T> extends EventDispatcherBase<T> {
public readonly subscribable: SubscribableValueEvent<T> =
@@ -36,9 +37,10 @@ export class ValueDispatcher<T> extends EventDispatcherBase<T> {
/**
* Set the current value of this dispatcher.
*
* @remarks
* Setting the value will immediately notify all subscribers.
*
* @param value
* @param value - The new value.
*/
public set current(value: T) {
this.value = value;
@@ -46,21 +48,21 @@ export class ValueDispatcher<T> extends EventDispatcherBase<T> {
}
/**
* @inheritDoc SubscribableValueEvent.current
* {@inheritDoc SubscribableValueEvent.current}
*/
public get current() {
return this.value;
}
/**
* @param value Initial value.
* @param value - The initial value.
*/
public constructor(private value: T) {
super();
}
/**
* @inheritDoc SubscribableValueEvent.subscribe
* {@inheritDoc SubscribableValueEvent.subscribe}
*/
public subscribe(handler: EventHandler<T>, dispatchImmediately = true) {
const unsubscribe = super.subscribe(handler);
@@ -74,10 +76,11 @@ export class ValueDispatcher<T> extends EventDispatcherBase<T> {
/**
* Provides safe access to the public interface of {@link ValueDispatcher}.
*
* @remarks
* External classes can use it to subscribe to an event without being able to
* dispatch it.
*
* @template T Type of the value passed to subscribers.
* @typeParam T - The type of the value passed to subscribers.
*/
export class SubscribableValueEvent<T> extends Subscribable<
T,
@@ -95,11 +98,11 @@ export class SubscribableValueEvent<T> extends Subscribable<
*
* Subscribing will immediately invoke the handler with the most recent value.
*
* @param handler
* @param dispatchImmediately Whether the handler should be immediately
* invoked with the most recent value.
* @param handler - The handler to invoke when the event occurs.
* @param dispatchImmediately - Whether the handler should be immediately
* invoked with the most recent value.
*
* @return Callback function that cancels the subscription.
* @returns Callback function that cancels the subscription.
*/
public subscribe(
handler: EventHandler<T>,

View File

@@ -5,7 +5,7 @@ decorate(all, threadable());
/**
* Run all tasks concurrently and wait for all of them to finish.
*
* Example:
* @example
* ```
* // current time: 0s
* yield* all(
@@ -15,7 +15,7 @@ decorate(all, threadable());
* // current time: 2s
* ```
*
* @param tasks
* @param tasks - A list of tasks to run.
*/
export function* all(...tasks: ThreadGenerator[]): ThreadGenerator {
for (const task of tasks) {

View File

@@ -5,7 +5,7 @@ decorate(any, threadable());
/**
* Run all tasks concurrently and wait for any of them to finish.
*
* Example:
* @example
* ```
* // current time: 0s
* yield* any(
@@ -15,7 +15,7 @@ decorate(any, threadable());
* // current time: 1s
* ```
*
* @param tasks
* @param tasks - A list of tasks to run.
*/
export function* any(...tasks: ThreadGenerator[]): ThreadGenerator {
for (const task of tasks) {

View File

@@ -5,7 +5,7 @@ decorate(chain, threadable());
/**
* Run tasks one after another.
*
* Example:
* @example
* ```ts
* // current time: 0s
* yield* chain(
@@ -33,7 +33,7 @@ decorate(chain, threadable());
* );
* ```
*
* @param tasks
* @param tasks - A list of tasks to run.
*/
export function* chain(
...tasks: (ThreadGenerator | Callback)[]

View File

@@ -6,7 +6,7 @@ decorate(delay, threadable());
/**
* Run the given generator or callback after a specific amount of time.
*
* Example:
* @example
* ```ts
* yield* delay(1, rect.fill('#ff0000', 2));
* ```
@@ -26,8 +26,8 @@ decorate(delay, threadable());
* );
* ```
*
* @param time Delay in seconds
* @param task
* @param time - The delay in seconds
* @param task - The task or callback to run after the delay.
*/
export function* delay(
time: number,

View File

@@ -7,7 +7,7 @@ import {useProject} from '../utils';
*/
export interface EveryCallback {
/**
* @param tick The amount of times the timer has ticked.
* @param tick - The amount of times the timer has ticked.
*/
(tick: number): void;
}
@@ -29,7 +29,7 @@ export interface EveryTimer {
/**
* Call the given callback every N seconds.
*
* Example:
* @example
* ```ts
* const timer = every(2, time => console.log(time));
* yield timer.runner;
@@ -41,8 +41,8 @@ export interface EveryTimer {
* // current time: 6s
* ```
*
* @param interval
* @param callback
* @param interval - The interval between subsequent calls.
* @param callback - The callback to be called.
*/
export function every(interval: number, callback: EveryCallback): EveryTimer {
let changed = false;

View File

@@ -6,7 +6,7 @@ import {ThreadGenerator} from '../threading';
*/
export interface LoopCallback {
/**
* @param i The current iteration index.
* @param i - The current iteration index.
*/
(i: number): ThreadGenerator | void;
}
@@ -15,9 +15,10 @@ decorate(loop, threadable());
/**
* Run the given generator N times.
*
* @remarks
* Each time iteration waits until the previous one is completed.
*
* Example:
* @example
* ```ts
* const colors = [
* '#ff6470',
@@ -32,9 +33,9 @@ decorate(loop, threadable());
* });
* ```
*
* @param iterations Number of iterations.
* @param factory A function creating the generator to run. Because generators
* can't be reset, a new generator is created each iteration.
* @param iterations - The number of iterations.
* @param factory - A function creating the generator to run. Because generators
* can't be reset, a new generator is created on each iteration.
*/
export function* loop(
iterations: number,

View File

@@ -11,7 +11,7 @@ import {GeneratorHelper} from '../helpers';
* });
* ```
*
* @param runner A generator function or a factory that creates the generator.
* @param runner - A generator function or a factory that creates the generator.
*/
export function run(runner: () => ThreadGenerator): ThreadGenerator;
/**
@@ -24,8 +24,8 @@ export function run(runner: () => ThreadGenerator): ThreadGenerator;
* });
* ```
*
* @param runner A generator function or a factory that creates the generator.
* @param name An optional name used when displaying this generator in the UI.
* @param runner - A generator function or a factory that creates the generator.
* @param name - An optional name used when displaying this generator in the UI.
*/
export function run(
name: string,

View File

@@ -6,16 +6,17 @@ decorate(waitUntil, threadable());
/**
* Wait until the given time event.
*
* @remarks
* Time events are displayed on the timeline and can be edited to adjust the
* delay. By default, an event happens immediately - without any delay.
*
* Example:
* @example
* ```ts
* yield waitUntil('event');
* ```
*
* @param event Name of the time event.
* @param after
* @param event - The name of the time event.
* @param after - An optional task to be run after the function completes.
*/
export function* waitUntil(
event: string,
@@ -37,7 +38,7 @@ decorate(waitFor, threadable());
/**
* Wait for the given amount of time.
*
* Example:
* @example
* ```ts
* // current time: 0s
* yield waitFor(2);
@@ -46,8 +47,8 @@ decorate(waitFor, threadable());
* // current time: 5s
* ```
*
* @param seconds Relative time in seconds.
* @param after
* @param seconds - The relative time in seconds.
* @param after - An optional task to be run after the function completes.
*/
export function* waitFor(
seconds = 0,

View File

@@ -6,6 +6,7 @@ decorate(sequence, threadable());
/**
* Start all tasks one after another with a constant delay between.
*
* @remarks
* The function doesn't wait until the previous task in the sequence has
* finished. Once the delay has passed, the next task will start event if
* the previous is still running.
@@ -18,8 +19,8 @@ decorate(sequence, threadable());
* );
* ```
*
* @param delay
* @param tasks
* @param delay - The delay between each of the tasks.
* @param tasks - A list of tasks to be run in a sequence.
*/
export function* sequence(
delay: number,

View File

@@ -65,9 +65,9 @@ export class AudioManager {
/**
* Pause/resume the audio.
*
* @param isPaused
* @param isPaused - Whether the audio should be paused or resumed.
*
* @return `true` if the audio successfully started playing.
* @returns `true` if the audio successfully started playing.
*/
public async setPaused(isPaused: boolean): Promise<boolean> {
if (this.source && this.audioElement.paused !== isPaused) {

View File

@@ -40,43 +40,36 @@ declare module 'konva/lib/Node' {
origin: GetSet<Origin, this>;
/**
* @param value
* @ignore
*/
setX(value: number): this;
/**
* @param value
* @ignore
*/
setY(value: number): this;
/**
* @param width
* @ignore
*/
setWidth(width: number): void;
/**
* @param height
* @ignore
*/
setHeight(height: number): void;
/**
* @param value
* @ignore
*/
setPadd(value: PossibleSpacing): this;
/**
* @param value
* @ignore
*/
setMargin(value: PossibleSpacing): this;
/**
* @param value
* @ignore
*/
setOrigin(value: Origin): this;
@@ -99,45 +92,51 @@ declare module 'konva/lib/Node' {
/**
* Get the size of this node used for layout calculations.
*
* @remarks
* The returned size should include the padding.
* A node can use the size of its children to derive its own dimensions.
*
* @param custom Custom node configuration to use during the calculations.
* When present, the method will return the layout size that
* the node would have, if it had these options configured.
* @param custom - Custom node configuration to use during the calculations.
* When present, the method will return the layout size that
* the node would have, if it had these options configured.
*/
getLayoutSize(custom?: NodeConfig): Size;
/**
* Get the vector from the local origin of this node to its current origin.
*
* @remarks
* The local origin is the center of coordinates of the canvas when drawing
* the node. Centroid nodes will have their local origin at the center.
* Other shapes will have it in the top left corner.
*
* The current origin is configured via {@link Node.origin}.
*
* @param custom Custom node configuration to use during the calculations.
* When present, the method will return the origin offset that
* the node would have, if it had these options configured.
* @param custom - Custom node configuration to use during the calculations.
* When present, the method will return the origin offset
* that the node would have, if it had these options
* configured.
*/
getOriginOffset(custom?: NodeConfig): Vector2d;
/**
* Get the vector from the current origin of this node to the `newOrigin`.
*
* @param newOrigin The origin to which the delta should be calculated.
* @param newOrigin - The origin to which the delta should be calculated.
*
* @param custom Custom node configuration to use during the calculations.
* When present, the method will return the origin offset that
* the node would have, if it had these options configured.
* @param custom - Custom node configuration to use during the calculations.
* When present, the method will return the origin offset
* that the node would have, if it had these options
* configured.
*/
getOriginDelta(newOrigin: Origin, custom?: NodeConfig): Vector2d;
/**
* Update the layout of this node and all its children.
*
* If the node is considered dirty the {@see recalculateLayout} method will be called.
* @remarks
* If the node is considered dirty the {@link recalculateLayout} method will
* be called.
*/
updateLayout(): void;
@@ -149,7 +148,9 @@ declare module 'konva/lib/Node' {
/**
* Mark this node as dirty.
*
* It will cause the layout of this node and all its ancestors to be recalculated before drawing the next frame.
* @remarks
* It will cause the layout of this node and all its ancestors to be
* recalculated before drawing the next frame.
*/
markDirty(force?: boolean): void;
@@ -159,8 +160,10 @@ declare module 'konva/lib/Node' {
isDirty(): boolean;
/**
* Check if the layout of this node has been recalculated during the current layout process.
* Check if the layout of this node has been recalculated during the current
* layout process.
*
* @remarks
* Containers can use this method to check if their children has changed.
*/
wasDirty(): boolean;

View File

@@ -3,6 +3,7 @@ import {Rect, Vector2} from '../types';
/**
* Represents an element to inspect.
*
* @remarks
* The type is not important because the UI does not interact with it.
* It serves as a key that will be passed back to an Inspectable scene to
* receive more information about said element.
@@ -47,39 +48,42 @@ export interface Inspectable {
/**
* Get a possible element to inspect at a given position.
*
* @param x
* @param y
* @param x - The x coordinate.
* @param y - The y coordinate.
*/
inspectPosition(x: number, y: number): InspectedElement | null;
/**
* Validate if the inspected element is still valid.
*
* @remarks
* If a scene destroys and recreates its components upon every reset, the
* reference may no longer be valid. Even though the component is still
* present. This method should check that and return a new reference.
*
* See {@link KonvaScene.validateInspection()} for a sample implementation.
* See {@link KonvaScene.validateInspection} for a sample implementation.
*
* @param element
* @param element - The element to validate.
*/
validateInspection(element: InspectedElement | null): InspectedElement | null;
/**
* Return the attributes of the inspected element.
*
* @remarks
* This information will be displayed in the "Properties" panel.
*
* @param element
* @param element - The element to inspect.
*/
inspectAttributes(element: InspectedElement): InspectedAttributes | null;
/**
* Return the sizes of the inspected element.
*
* @remarks
* This information will be used to draw the bounding boxes on the screen.
*
* @param element
* @param element - The element to inspect.
*/
inspectBoundingBox(element: InspectedElement): InspectedSize;
}

View File

@@ -41,7 +41,7 @@ export function useKonvaView(): KonvaView {
* });
* ```
*
* @param factory
* @param factory - The generator function for this scene.
*/
export function makeKonvaScene(
factory: ThreadGeneratorFactory<KonvaView>,

View File

@@ -12,11 +12,13 @@ export interface SceneMetadata extends Metadata {
/**
* The constructor used when creating new scenes.
*
* @remarks
* Each class implementing the {@link Scene} interface should have a matching
* constructor.
*
* @template T The type of the configuration object. This object will be passed
* to the constructor from {@link SceneDescription.config}.
* @typeParam T - The type of the configuration object. This object will be
* passed to the constructor from
* {@link SceneDescription.config}.
*/
export interface SceneConstructor<T> {
new (project: Project, name: string, config: T): Scene;
@@ -25,7 +27,7 @@ export interface SceneConstructor<T> {
/**
* Describes a scene exposed by a `*.scene.tsx` file.
*
* @template T The type of the configuration object.
* @typeParam T - The type of the configuration object.
*/
export interface SceneDescription<T = unknown> {
/**
@@ -33,8 +35,9 @@ export interface SceneDescription<T = unknown> {
*/
klass: SceneConstructor<T>;
/**
* Name of the scene.
* The name of the scene.
*
* @remarks
* Should match the first portion of the file name (`[name].scene.ts`).
*/
name: string;
@@ -79,21 +82,24 @@ export enum SceneRenderEvent {
/**
* The main interface for scenes.
*
* @remarks
* Any class implementing this interface should have a constructor matching
* {@link SceneConstructor}.
*
* @template T The type of the configuration object.
* @typeParam T - The type of the configuration object.
*/
export interface Scene<T = unknown> {
/**
* Name of the scene.
*
* @remarks
* Will be passed as the second argument to the constructor.
*/
readonly name: string;
/**
* Reference to the project.
*
* @remarks
* Will be passed as the first argument to the constructor.
*/
readonly project: Project;
@@ -113,21 +119,21 @@ export interface Scene<T = unknown> {
/**
* Triggered when the cached data changes.
*
* @event CachedSceneData
* @eventProperty
*/
get onCacheChanged(): SubscribableValueEvent<CachedSceneData>;
/**
* Triggered when the scene is reloaded.
*
* @event void
* @eventProperty
*/
get onReloaded(): SubscribableEvent<void>;
/**
* Triggered after scene is recalculated.
*
* @event void
* @eventProperty
*/
get onRecalculated(): SubscribableEvent<void>;
@@ -139,7 +145,7 @@ export interface Scene<T = unknown> {
/**
* Triggered at various stages of the render lifecycle with an event title and a Context2D.
*
* @event [SceneRenderEvent, CanvasRenderingContext2D]
* @eventProperty
*/
get onRenderLifecycle(): SubscribableEvent<
[SceneRenderEvent, CanvasRenderingContext2D]
@@ -148,7 +154,7 @@ export interface Scene<T = unknown> {
/**
* Triggered when the scene is reset.
*
* @event void
* @eventProperty
*/
get onReset(): SubscribableEvent<void>;
@@ -160,26 +166,28 @@ export interface Scene<T = unknown> {
/**
* Render the scene onto a canvas.
*
* @param context
* @param canvas
* @param context - The context to used when rendering.
* @param canvas - The canvas onto which the scene should be rendered.
*/
render(context: CanvasRenderingContext2D, canvas: HTMLCanvasElement): void;
/**
* Reload the scene.
*
* @remarks
* This method is called whenever something related to this scene has changed:
* time events, source code, metadata, etc.
*
* Should trigger {@link onReloaded}.
*
* @param config If present, a new configuration object.
* @param config - If present, a new configuration object.
*/
reload(config?: T): void;
/**
* Recalculate the scene.
*
* @remarks
* The task of this method is to calculate new timings stored in the cache.
* When this method is invoked, `this.project.frame` is set to the frame at
* which this scene should start ({@link firstFrame}).
@@ -199,7 +207,7 @@ export interface Scene<T = unknown> {
/**
* Reset this scene to its initial state.
*
* @param previous If present, the previous scene.
* @param previous - If present, the previous scene.
*/
reset(previous?: Scene): Promise<void>;

View File

@@ -10,6 +10,7 @@ export enum SceneState {
/**
* The scene has finished transitioning in.
*
* @remarks
* Informs the Project that the previous scene is no longer necessary and can
* be disposed of.
*/
@@ -18,8 +19,9 @@ export enum SceneState {
/**
* The scene is ready to transition out.
*
* @remarks
* Informs the project that the next scene can begin.
* The {@link Scene.next()} method will still be invoked until the next scene
* The {@link Scene.next} method will still be invoked until the next scene
* enters {@link AfterTransitionIn}.
*/
CanTransitionOut,
@@ -27,7 +29,8 @@ export enum SceneState {
/**
* The scene has finished.
*
* Invoking {@link Scene.next()} won't have any effect.
* @remarks
* Invoking {@link Scene.next} won't have any effect.
*/
Finished,
}

View File

@@ -5,13 +5,14 @@ import {Thread} from '../threading';
* Scenes can implement this interface to display their thread hierarchy in the
* UI.
*
* @remarks
* This interface is only useful when a scene uses thread generators to run.
*/
export interface Threadable {
/**
* Triggered when the main thread changes.
*
* @event Thread
* @eventProperty
*/
get onThreadChanged(): SubscribableValueEvent<Thread>;
}

View File

@@ -13,7 +13,8 @@ export interface TimeEvent {
* Time in seconds, relative to the beginning of the scene, at which the event
* was registered.
*
* In other words, the moment at which {@link flow!waitUntil} for this event
* @remarks
* In other words, the moment at which {@link waitUntil} for this event
* was invoked.
*/
initialTime: number;
@@ -43,7 +44,7 @@ export class TimeEvents {
/**
* Triggered when time events change.
*
* @event TimeEvent[]
* @eventProperty
*/
public get onChanged() {
return this.events.subscribable;
@@ -81,11 +82,11 @@ export class TimeEvents {
/**
* Change the time offset of the given event.
*
* @param name Name of the event.
* @param offset Time offset in seconds.
* @param preserve Whether the timing of the consecutive events should be
* preserved. When set to `true` their offsets will be
* adjusted to keep them in place.
* @param name - The name of the event.
* @param offset - The time offset in seconds.
* @param preserve - Whether the timing of the consecutive events should be
* preserved. When set to `true` their offsets will be
* adjusted to keep them in place.
*/
public set(name: string, offset: number, preserve = true) {
if (!this.lookup[name] || this.lookup[name].offset === offset) {
@@ -106,9 +107,9 @@ export class TimeEvents {
/**
* Register a time event.
*
* @param name Name of the event.
* @param name - The name of the event.
*
* @return The absolute frame at which the event should occur.
* @returns The absolute frame at which the event should occur.
*
* @internal
*/

View File

@@ -5,6 +5,7 @@ import {endThread, startThread, useProject} from '../utils';
/**
* A class representing an individual thread.
*
* @remarks
* Thread is a wrapper for a generator that can be executed concurrently.
*
* Aside from the main thread, all threads need to have a parent.
@@ -20,7 +21,8 @@ export class Thread {
/**
* The current time of this thread.
*
* Used by {@link flow!waitFor} and other time-based functions to properly
* @remarks
* Used by {@link waitFor} and other time-based functions to properly
* support durations shorter than one frame.
*/
public time = 0;

View File

@@ -3,6 +3,7 @@ import {Thread} from './Thread';
/**
* The main generator type produced by all generator functions in Motion Canvas.
*
* @example
* Yielded values can be used to control the flow of animation:
*
* - Progress to the next frame:
@@ -36,7 +37,7 @@ export type ThreadGenerator = Generator<
/**
* Check if the given value is a {@link ThreadGenerator}.
*
* @param value A possible thread {@link ThreadGenerator}.
* @param value - A possible thread {@link ThreadGenerator}.
*/
export function isThreadGenerator(value: unknown): value is ThreadGenerator {
return typeof value === 'object' && Symbol.iterator in value;

View File

@@ -13,7 +13,7 @@ import {useThread} from '../utils';
* yield* cancel(task);
* ```
*
* @param tasks
* @param tasks - A list of tasks to cancel.
*/
export function cancel(...tasks: ThreadGenerator[]) {
const thread = useThread();

View File

@@ -6,7 +6,7 @@ decorate(join, threadable());
/**
* Pause the current generator until all listed tasks are finished.
*
* Example:
* @example
* ```ts
* const task = yield generatorFunction();
*
@@ -15,13 +15,13 @@ decorate(join, threadable());
* yield* join(task);
* ```
*
* @param tasks
* @param tasks - A list of tasks to join.
*/
export function join(...tasks: ThreadGenerator[]): ThreadGenerator;
/**
* Pause the current generator until listed tasks are finished.
*
* Example
* @example
* ```ts
* const taskA = yield generatorFunctionA();
* const taskB = yield generatorFunctionB();
@@ -32,8 +32,8 @@ export function join(...tasks: ThreadGenerator[]): ThreadGenerator;
* yield* join(false, taskA, taskB);
* ```
*
* @param all Whether we should wait for all tasks or for at least one.
* @param tasks
* @param all - Whether we should wait for all tasks or for at least one.
* @param tasks - A list of tasks to join.
*/
export function join(
all: boolean,

View File

@@ -6,7 +6,7 @@ import {isThreadGenerator, ThreadGenerator} from './ThreadGenerator';
/**
* Check if the given value is a [Promise][promise].
*
* @param value A possible [Promise][promise].
* @param value - A possible [Promise][promise].
*
* [promise]: https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/promise
*/
@@ -29,11 +29,12 @@ decorate(threads, threadable());
/**
* Create a context in which generators can be run concurrently.
*
* @remarks
* From the perspective of the external generator, `threads` is executed
* synchronously. By default, each scene generator is wrapped in its own
* `threads` generator.
*
* Example:
* @example
* ```ts
* // first
*
@@ -46,9 +47,9 @@ decorate(threads, threadable());
* // third
* ```
*
* @param factory
* @param callback Called whenever threads are created, canceled or finished.
* Used for debugging purposes.
* @param factory - A function that returns the generator to run.
* @param callback - Called whenever threads are created, canceled or finished.
* Used for debugging purposes.
*/
export function* threads(
factory: ThreadsFactory,

View File

@@ -39,14 +39,19 @@ export function textTween(from: string, to: string, value: number) {
}
/**
* Interpolate between any two Records, including objects and Maps, even with mismatched keys.
* Any old key that is missing in `to` will be removed immediately once value is not 0.
* Any new key that is missing in `from` will be added once value reaches 1.
* Interpolate between any two Records, including objects and Maps, even with
* mismatched keys.
*
* @param from - the input to favor when value is 0
* @param to - the input to favor when value is 1
* @param value - on a scale between 0 and 1, how closely to favor from vs to
* @returns a value matching the structure of from and to
* @remarks
* Any old key that is missing in `to` will be removed immediately once value is
* not 0. Any new key that is missing in `from` will be added once value reaches
* 1.
*
* @param from - The input to favor when value is 0.
* @param to - The input to favor when value is 1.
* @param value - On a scale between 0 and 1, how closely to favor from vs to.
*
* @returns A value matching the structure of from and to.
*/
export function deepTween<
TFrom extends Record<any, unknown>,
@@ -55,10 +60,11 @@ export function deepTween<
/**
* Interpolate between any two values, including objects, arrays, and Maps.
*
* @param from - the input to favor when value is 0
* @param to - the input to favor when value is 1
* @param value - on a scale between 0 and 1, how closely to favor from vs to
* @returns a value matching the structure of from and to
* @param from - The input to favor when value is 0.
* @param to - The input to favor when value is 1.
* @param value - On a scale between 0 and 1, how closely to favor from vs to.
*
* @returns A value matching the structure of from and to.
*/
export function deepTween<T>(from: T, to: T, value: number): T;
export function deepTween(from: any, to: any, value: number): any {
@@ -115,22 +121,24 @@ export function deepTween(from: any, to: any, value: number): any {
interface ColorTweenOptions {
/**
* the space to use during interpolation, affecting the intermediate colors
* The space to use during interpolation, affecting the intermediate colors
*/
space: string;
space?: string;
/**
* the format in which to return values
* The format in which to return values
*/
outputSpace: string;
outputSpace?: string;
}
/**
* Mix two colors together.
*
* @param from - the value to use at 0
* @param to - the value to use at 1
* @param value - how much of each color to use, on a scale of 0 to 1
* @returns an srgb string, or one of the input values if value is 0 or 1
* @param from - The value to use at 0.
* @param to - The value to use at 1.
* @param value - How much of each color to use, on a scale of 0 to 1.
* @param options - Additional configuration.
*
* @returns An srgb string, or one of the input values if value is 0 or 1.
*/
export function colorTween(
from: string | typeof Color,

View File

@@ -3,8 +3,9 @@ import {useThread} from './useThread';
/**
* Get the real time since the start of the animation.
*
* @remarks
* The returned value accounts for offsets caused by functions such as
* {@link waitFor()}.
* {@link waitFor}.
*
* @example
* ```ts

27
packages/core/tsdoc.json Normal file
View File

@@ -0,0 +1,27 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"tagDefinitions": [
{
"tagName": "@module",
"syntaxKind": "modifier"
},
{
"tagName": "@ignore",
"syntaxKind": "modifier"
}
],
"supportForTags": {
"@module": true,
"@param": true,
"@deprecated": true,
"@returns": true,
"@remarks": true,
"@example": true,
"@link": true,
"@internal": true,
"@eventProperty": true,
"@typeParam": true,
"@ignore": true,
"@inheritDoc": true
}
}

View File

@@ -7,7 +7,7 @@ import {useSubscribableValue} from './useSubscribable';
* Get a stateful value representing the contents of the given meta file and
* a function to update it.
*
* @param meta
* @param meta - The meta object to extract data from.
*/
export function useMeta<T extends Metadata>(
meta: Meta<T>,