Skip to content

Commit e3ffec2

Browse files
committed
more
1 parent a523134 commit e3ffec2

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

packages/svelte/src/internal/server/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { ComponentType, SvelteComponent } from 'svelte' */
12
/** @import { Component, Payload, RenderOutput } from '#server' */
23
/** @import { Store } from '#shared' */
34
export { FILENAME, HMR } from '../../constants.js';
@@ -103,7 +104,7 @@ export let on_destroy = [];
103104
* Only available on the server and when compiling with the `server` option.
104105
* Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
105106
* @template {Record<string, any>} Props
106-
* @param {import('svelte').Component<Props> | import('svelte').ComponentType<import('svelte').SvelteComponent<Props>>} component
107+
* @param {import('svelte').Component<Props> | ComponentType<SvelteComponent<Props>>} component
107108
* @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any> }} [options]
108109
* @returns {RenderOutput}
109110
*/

packages/svelte/src/motion/spring.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
/** @import { Task } from '#client' */
2+
/** @import { SpringOpts, SpringUpdateOpts, TickContext } from './private.js' */
3+
/** @import { Spring } from './public.js' */
14
import { writable } from '../store/index.js';
25
import { loop } from '../internal/client/loop.js';
36
import { raf } from '../internal/client/timing.js';
47
import { is_date } from './utils.js';
58

69
/**
710
* @template T
8-
* @param {import('./private').TickContext<T>} ctx
11+
* @param {TickContext<T>} ctx
912
* @param {T} last_value
1013
* @param {T} current_value
1114
* @param {T} target_value
@@ -53,15 +56,15 @@ function tick_spring(ctx, last_value, current_value, target_value) {
5356
* https://svelte.dev/docs/svelte-motion#spring
5457
* @template [T=any]
5558
* @param {T} [value]
56-
* @param {import('./private').SpringOpts} [opts]
57-
* @returns {import('./public.js').Spring<T>}
59+
* @param {SpringOpts} [opts]
60+
* @returns {Spring<T>}
5861
*/
5962
export function spring(value, opts = {}) {
6063
const store = writable(value);
6164
const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;
6265
/** @type {number} */
6366
let last_time;
64-
/** @type {import('../internal/client/types').Task | null} */
67+
/** @type {Task | null} */
6568
let task;
6669
/** @type {object} */
6770
let current_token;
@@ -74,7 +77,7 @@ export function spring(value, opts = {}) {
7477
let cancel_task = false;
7578
/**
7679
* @param {T} new_value
77-
* @param {import('./private').SpringUpdateOpts} opts
80+
* @param {SpringUpdateOpts} opts
7881
* @returns {Promise<void>}
7982
*/
8083
function set(new_value, opts = {}) {
@@ -101,7 +104,7 @@ export function spring(value, opts = {}) {
101104
return false;
102105
}
103106
inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);
104-
/** @type {import('./private').TickContext<T>} */
107+
/** @type {TickContext<T>} */
105108
const ctx = {
106109
inv_mass,
107110
opts: spring,
@@ -120,12 +123,12 @@ export function spring(value, opts = {}) {
120123
});
121124
}
122125
return new Promise((fulfil) => {
123-
/** @type {import('../internal/client/types').Task} */ (task).promise.then(() => {
126+
/** @type {Task} */ (task).promise.then(() => {
124127
if (token === current_token) fulfil();
125128
});
126129
});
127130
}
128-
/** @type {import('./public.js').Spring<T>} */
131+
/** @type {Spring<T>} */
129132
const spring = {
130133
set,
131134
update: (fn, opts) => set(fn(/** @type {T} */ (target_value), /** @type {T} */ (value)), opts),

packages/svelte/src/reactivity/map.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Source } from '#client' */
12
import { DEV } from 'esm-env';
23
import { source, set } from '../internal/client/reactivity/sources.js';
34
import { get } from '../internal/client/runtime.js';
@@ -9,7 +10,7 @@ import { increment } from './utils.js';
910
* @extends {Map<K, V>}
1011
*/
1112
export class SvelteMap extends Map {
12-
/** @type {Map<K, import('#client').Source<number>>} */
13+
/** @type {Map<K, Source<number>>} */
1314
#sources = new Map();
1415
#version = source(0);
1516
#size = source(0);

packages/svelte/src/reactivity/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Source } from '#client' */
12
import { DEV } from 'esm-env';
23
import { source, set } from '../internal/client/reactivity/sources.js';
34
import { get } from '../internal/client/runtime.js';
@@ -13,7 +14,7 @@ var inited = false;
1314
* @extends {Set<T>}
1415
*/
1516
export class SvelteSet extends Set {
16-
/** @type {Map<T, import('#client').Source<boolean>>} */
17+
/** @type {Map<T, Source<boolean>>} */
1718
#sources = new Map();
1819
#version = source(0);
1920
#size = source(0);

packages/svelte/src/reactivity/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Source } from '#client' */
12
import { set } from '../internal/client/reactivity/sources.js';
23

34
/**
@@ -30,7 +31,7 @@ function get_this() {
3031
return this;
3132
}
3233

33-
/** @param {import('#client').Source<number>} source */
34+
/** @param {Source<number>} source */
3435
export function increment(source) {
3536
set(source, source.v + 1);
3637
}

0 commit comments

Comments
 (0)