Manual cleanup of src/runtime/motion/spring.js

pull/8569/head
S. Elliott Johnson 3 years ago
parent 739141f2a2
commit b836ba476e

@ -1,7 +1,9 @@
import { writable } from '../store'; import { writable } from '../store.js';
import { loop, now } from '../internal'; import { loop, now } from '../internal.js';
import { is_date } from './utils'; import { is_date } from './utils.js';
/** @param {TickContext<T>} ctx
/**
* @param {TickContext<T>} ctx
* @param {T} last_value * @param {T} last_value
* @param {T} current_value * @param {T} current_value
* @param {T} target_value * @param {T} target_value
@ -41,7 +43,9 @@ function tick_spring(ctx, last_value, current_value, target_value) {
throw new Error(`Cannot spring ${typeof current_value} values`); throw new Error(`Cannot spring ${typeof current_value} values`);
} }
} }
/** @param {T} value
/**
* @param {T} value
* @param {SpringOpts} opts * @param {SpringOpts} opts
* @returns {import("/Users/elliottjohnson/dev/sveltejs/svelte/spring.ts-to-jsdoc").Spring<T>} * @returns {import("/Users/elliottjohnson/dev/sveltejs/svelte/spring.ts-to-jsdoc").Spring<T>}
*/ */
@ -128,22 +132,29 @@ export function spring(value, opts = {}) {
* @template T * @template T
*/ */
/** @typedef {Object} TickContext /**
* @typedef {Object} TickContext
* @property {number} inv_mass * @property {number} inv_mass
* @property {number} dt * @property {number} dt
* @property {Spring<T>} opts * @property {Spring<T>} opts
* @property {boolean} settled * @property {boolean} settled
*/ */
/** @typedef {Object} SpringOpts
/**
* @typedef {Object} SpringOpts
* @property {number} [stiffness] * @property {number} [stiffness]
* @property {number} [damping] * @property {number} [damping]
* @property {number} [precision] * @property {number} [precision]
*/ */
/** @typedef {Object} SpringUpdateOpts
/**
* @typedef {Object} SpringUpdateOpts
* @property {any} [hard] * @property {any} [hard]
* @property {string|number|boolean} [soft] * @property {string|number|boolean} [soft]
*/ */
/** @typedef {Object} Spring
/**
* @typedef {Object} Spring
* @property {(new_value:T,opts?:SpringUpdateOpts)=>Promise<void>} set * @property {(new_value:T,opts?:SpringUpdateOpts)=>Promise<void>} set
* @property {(fn:Updater<T>,opts?:SpringUpdateOpts)=>Promise<void>} update * @property {(fn:Updater<T>,opts?:SpringUpdateOpts)=>Promise<void>} update
* @property {number} precision * @property {number} precision

Loading…
Cancel
Save