Skip to content

Commit a523134

Browse files
committed
more
1 parent 341d2bf commit a523134

File tree

3 files changed

+38
-36
lines changed

3 files changed

+38
-36
lines changed

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { ComponentContext, ComponentContextLegacy, Effect, Reaction, TemplateNode, TransitionManager } from '#client' */
12
import {
23
check_dirtiness,
34
current_component_context,
@@ -57,8 +58,8 @@ export function validate_effect(rune) {
5758
}
5859

5960
/**
60-
* @param {import("#client").Effect} effect
61-
* @param {import("#client").Reaction} parent_effect
61+
* @param {Effect} effect
62+
* @param {Reaction} parent_effect
6263
*/
6364
export function push_effect(effect, parent_effect) {
6465
var parent_last = parent_effect.last;
@@ -76,12 +77,12 @@ export function push_effect(effect, parent_effect) {
7677
* @param {null | (() => void | (() => void))} fn
7778
* @param {boolean} sync
7879
* @param {boolean} push
79-
* @returns {import('#client').Effect}
80+
* @returns {Effect}
8081
*/
8182
function create_effect(type, fn, sync, push = true) {
8283
var is_root = (type & ROOT_EFFECT) !== 0;
8384

84-
/** @type {import('#client').Effect} */
85+
/** @type {Effect} */
8586
var effect = {
8687
ctx: current_component_context,
8788
deps: null,
@@ -187,7 +188,7 @@ export function user_effect(fn) {
187188
}
188189

189190
if (defer) {
190-
var context = /** @type {import('#client').ComponentContext} */ (current_component_context);
191+
var context = /** @type {ComponentContext} */ (current_component_context);
191192
(context.e ??= []).push(fn);
192193
} else {
193194
var signal = effect(fn);
@@ -198,7 +199,7 @@ export function user_effect(fn) {
198199
/**
199200
* Internal representation of `$effect.pre(...)`
200201
* @param {() => void | (() => void)} fn
201-
* @returns {import('#client').Effect}
202+
* @returns {Effect}
202203
*/
203204
export function user_pre_effect(fn) {
204205
validate_effect('$effect.pre');
@@ -229,7 +230,7 @@ export function effect_root(fn) {
229230

230231
/**
231232
* @param {() => void | (() => void)} fn
232-
* @returns {import('#client').Effect}
233+
* @returns {Effect}
233234
*/
234235
export function effect(fn) {
235236
return create_effect(EFFECT, fn, false);
@@ -241,9 +242,9 @@ export function effect(fn) {
241242
* @param {() => void | (() => void)} fn
242243
*/
243244
export function legacy_pre_effect(deps, fn) {
244-
var context = /** @type {import('#client').ComponentContextLegacy} */ (current_component_context);
245+
var context = /** @type {ComponentContextLegacy} */ (current_component_context);
245246

246-
/** @type {{ effect: null | import('#client').Effect, ran: boolean }} */
247+
/** @type {{ effect: null | Effect, ran: boolean }} */
247248
var token = { effect: null, ran: false };
248249
context.l.r1.push(token);
249250

@@ -261,7 +262,7 @@ export function legacy_pre_effect(deps, fn) {
261262
}
262263

263264
export function legacy_pre_effect_reset() {
264-
var context = /** @type {import('#client').ComponentContextLegacy} */ (current_component_context);
265+
var context = /** @type {ComponentContextLegacy} */ (current_component_context);
265266

266267
render_effect(() => {
267268
if (!get(context.l.r2)) return;
@@ -283,15 +284,15 @@ export function legacy_pre_effect_reset() {
283284

284285
/**
285286
* @param {() => void | (() => void)} fn
286-
* @returns {import('#client').Effect}
287+
* @returns {Effect}
287288
*/
288289
export function render_effect(fn) {
289290
return create_effect(RENDER_EFFECT, fn, true);
290291
}
291292

292293
/**
293294
* @param {() => void | (() => void)} fn
294-
* @returns {import('#client').Effect}
295+
* @returns {Effect}
295296
*/
296297
export function template_effect(fn) {
297298
if (DEV) {
@@ -319,7 +320,7 @@ export function branch(fn, push = true) {
319320
}
320321

321322
/**
322-
* @param {import("#client").Effect} effect
323+
* @param {Effect} effect
323324
*/
324325
export function execute_effect_teardown(effect) {
325326
var teardown = effect.teardown;
@@ -338,22 +339,21 @@ export function execute_effect_teardown(effect) {
338339
}
339340

340341
/**
341-
* @param {import('#client').Effect} effect
342+
* @param {Effect} effect
342343
* @param {boolean} [remove_dom]
343344
* @returns {void}
344345
*/
345346
export function destroy_effect(effect, remove_dom = true) {
346347
var removed = false;
347348

348349
if ((remove_dom || (effect.f & HEAD_EFFECT) !== 0) && effect.nodes !== null) {
349-
/** @type {import('#client').TemplateNode | null} */
350+
/** @type {TemplateNode | null} */
350351
var node = effect.nodes.start;
351352
var end = effect.nodes.end;
352353

353354
while (node !== null) {
354-
/** @type {import('#client').TemplateNode | null} */
355-
var next =
356-
node === end ? null : /** @type {import('#client').TemplateNode} */ (node.nextSibling);
355+
/** @type {TemplateNode | null} */
356+
var next = node === end ? null : /** @type {TemplateNode} */ (node.nextSibling);
357357

358358
node.remove();
359359
node = next;
@@ -396,7 +396,7 @@ export function destroy_effect(effect, remove_dom = true) {
396396
/**
397397
* Detach an effect from the effect tree, freeing up memory and
398398
* reducing the amount of work that happens on subsequent traversals
399-
* @param {import('#client').Effect} effect
399+
* @param {Effect} effect
400400
*/
401401
export function unlink_effect(effect) {
402402
var parent = effect.parent;
@@ -418,11 +418,11 @@ export function unlink_effect(effect) {
418418
* It stays around (in memory, and in the DOM) until outro transitions have
419419
* completed, and if the state change is reversed then we _resume_ it.
420420
* A paused effect does not update, and the DOM subtree becomes inert.
421-
* @param {import('#client').Effect} effect
421+
* @param {Effect} effect
422422
* @param {() => void} [callback]
423423
*/
424424
export function pause_effect(effect, callback) {
425-
/** @type {import('#client').TransitionManager[]} */
425+
/** @type {TransitionManager[]} */
426426
var transitions = [];
427427

428428
pause_children(effect, transitions, true);
@@ -434,7 +434,7 @@ export function pause_effect(effect, callback) {
434434
}
435435

436436
/**
437-
* @param {import('#client').TransitionManager[]} transitions
437+
* @param {TransitionManager[]} transitions
438438
* @param {() => void} fn
439439
*/
440440
export function run_out_transitions(transitions, fn) {
@@ -450,8 +450,8 @@ export function run_out_transitions(transitions, fn) {
450450
}
451451

452452
/**
453-
* @param {import('#client').Effect} effect
454-
* @param {import('#client').TransitionManager[]} transitions
453+
* @param {Effect} effect
454+
* @param {TransitionManager[]} transitions
455455
* @param {boolean} local
456456
*/
457457
export function pause_children(effect, transitions, local) {
@@ -482,14 +482,14 @@ export function pause_children(effect, transitions, local) {
482482
/**
483483
* The opposite of `pause_effect`. We call this if (for example)
484484
* `x` becomes falsy then truthy: `{#if x}...{/if}`
485-
* @param {import('#client').Effect} effect
485+
* @param {Effect} effect
486486
*/
487487
export function resume_effect(effect) {
488488
resume_children(effect, true);
489489
}
490490

491491
/**
492-
* @param {import('#client').Effect} effect
492+
* @param {Effect} effect
493493
* @param {boolean} local
494494
*/
495495
function resume_children(effect, local) {

packages/svelte/src/internal/client/reactivity/sources.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Derived, Effect, Source, Value } from '#client' */
12
import { DEV } from 'esm-env';
23
import {
34
current_component_context,
@@ -31,7 +32,7 @@ let inspect_effects = new Set();
3132
/**
3233
* @template V
3334
* @param {V} v
34-
* @returns {import('#client').Source<V>}
35+
* @returns {Source<V>}
3536
*/
3637
/*#__NO_SIDE_EFFECTS__*/
3738
export function source(v) {
@@ -47,7 +48,7 @@ export function source(v) {
4748
/**
4849
* @template V
4950
* @param {V} initial_value
50-
* @returns {import('#client').Source<V>}
51+
* @returns {Source<V>}
5152
*/
5253
/*#__NO_SIDE_EFFECTS__*/
5354
export function mutable_source(initial_value) {
@@ -65,7 +66,7 @@ export function mutable_source(initial_value) {
6566

6667
/**
6768
* @template V
68-
* @param {import('#client').Value<V>} source
69+
* @param {Value<V>} source
6970
* @param {V} value
7071
*/
7172
export function mutate(source, value) {
@@ -78,7 +79,7 @@ export function mutate(source, value) {
7879

7980
/**
8081
* @template V
81-
* @param {import('#client').Source<V>} source
82+
* @param {Source<V>} source
8283
* @param {V} value
8384
* @returns {V}
8485
*/
@@ -129,7 +130,7 @@ export function set(source, value) {
129130
}
130131

131132
/**
132-
* @param {import('#client').Value} signal
133+
* @param {Value} signal
133134
* @param {number} status should be DIRTY or MAYBE_DIRTY
134135
* @returns {void}
135136
*/
@@ -161,9 +162,9 @@ function mark_reactions(signal, status) {
161162
// If the signal a) was previously clean or b) is an unowned derived, then mark it
162163
if ((flags & (CLEAN | UNOWNED)) !== 0) {
163164
if ((flags & DERIVED) !== 0) {
164-
mark_reactions(/** @type {import('#client').Derived} */ (reaction), MAYBE_DIRTY);
165+
mark_reactions(/** @type {Derived} */ (reaction), MAYBE_DIRTY);
165166
} else {
166-
schedule_effect(/** @type {import('#client').Effect} */ (reaction));
167+
schedule_effect(/** @type {Effect} */ (reaction));
167168
}
168169
}
169170
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Component, Payload } from '#server' */
12
import {
23
FILENAME,
34
disallowed_paragraph_contents,
@@ -33,7 +34,7 @@ function stringify(element) {
3334
}
3435

3536
/**
36-
* @param {import('#server').Payload} payload
37+
* @param {Payload} payload
3738
* @param {Element} parent
3839
* @param {Element} child
3940
*/
@@ -51,13 +52,13 @@ function print_error(payload, parent, child) {
5152
}
5253

5354
/**
54-
* @param {import('#server').Payload} payload
55+
* @param {Payload} payload
5556
* @param {string} tag
5657
* @param {number} line
5758
* @param {number} column
5859
*/
5960
export function push_element(payload, tag, line, column) {
60-
var filename = /** @type {import('#server').Component} */ (current_component).function[FILENAME];
61+
var filename = /** @type {Component} */ (current_component).function[FILENAME];
6162
var child = { tag, parent, filename, line, column };
6263

6364
if (parent !== null && !is_tag_valid_with_parent(tag, parent.tag)) {

0 commit comments

Comments
 (0)