svelte 5.45.3 → 5.45.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/index.js +1 -1
- package/package.json +2 -2
- package/src/compiler/phases/2-analyze/index.js +5 -0
- package/src/internal/client/constants.js +1 -0
- package/src/internal/client/dev/debug.js +4 -4
- package/src/internal/client/dom/blocks/css-props.js +2 -3
- package/src/internal/client/dom/blocks/each.js +212 -222
- package/src/internal/client/dom/blocks/html.js +7 -5
- package/src/internal/client/dom/blocks/svelte-element.js +11 -14
- package/src/internal/client/dom/blocks/svelte-head.js +2 -2
- package/src/internal/client/dom/elements/transitions.js +15 -7
- package/src/internal/client/dom/hydration.js +2 -2
- package/src/internal/client/dom/operations.js +10 -13
- package/src/internal/client/dom/template.js +15 -13
- package/src/internal/client/reactivity/async.js +1 -6
- package/src/internal/client/reactivity/batch.js +1 -1
- package/src/internal/client/reactivity/effects.js +25 -27
- package/src/internal/client/render.js +5 -4
- package/src/internal/client/runtime.js +1 -1
- package/src/version.js +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
|
@@ -54,9 +54,9 @@ export function html(node, get_value, svg = false, mathml = false, skip_warning
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (effect.
|
|
58
|
-
remove_effect_dom(effect.
|
|
59
|
-
effect.
|
|
57
|
+
if (effect.nodes !== null) {
|
|
58
|
+
remove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));
|
|
59
|
+
effect.nodes = null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (value === '') return;
|
|
@@ -65,6 +65,8 @@ export function html(node, get_value, svg = false, mathml = false, skip_warning
|
|
|
65
65
|
// We're deliberately not trying to repair mismatches between server and client,
|
|
66
66
|
// as it's costly and error-prone (and it's an edge case to have a mismatch anyway)
|
|
67
67
|
var hash = /** @type {Comment} */ (hydrate_node).data;
|
|
68
|
+
|
|
69
|
+
/** @type {TemplateNode | null} */
|
|
68
70
|
var next = hydrate_next();
|
|
69
71
|
var last = next;
|
|
70
72
|
|
|
@@ -73,7 +75,7 @@ export function html(node, get_value, svg = false, mathml = false, skip_warning
|
|
|
73
75
|
(next.nodeType !== COMMENT_NODE || /** @type {Comment} */ (next).data !== '')
|
|
74
76
|
) {
|
|
75
77
|
last = next;
|
|
76
|
-
next =
|
|
78
|
+
next = get_next_sibling(next);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
if (next === null) {
|
|
@@ -110,7 +112,7 @@ export function html(node, get_value, svg = false, mathml = false, skip_warning
|
|
|
110
112
|
|
|
111
113
|
if (svg || mathml) {
|
|
112
114
|
while (get_first_child(node)) {
|
|
113
|
-
anchor.before(/** @type {
|
|
115
|
+
anchor.before(/** @type {TemplateNode} */ (get_first_child(node)));
|
|
114
116
|
}
|
|
115
117
|
} else {
|
|
116
118
|
anchor.before(node);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @import { Effect, TemplateNode } from '#client' */
|
|
1
|
+
/** @import { Effect, EffectNodes, TemplateNode } from '#client' */
|
|
2
2
|
import { FILENAME, NAMESPACE_SVG } from '../../../../constants.js';
|
|
3
3
|
import {
|
|
4
4
|
hydrate_next,
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
import { create_text, get_first_child } from '../operations.js';
|
|
11
11
|
import { block, teardown } from '../../reactivity/effects.js';
|
|
12
12
|
import { set_should_intro } from '../../render.js';
|
|
13
|
-
import { current_each_item, set_current_each_item } from './each.js';
|
|
14
13
|
import { active_effect } from '../../runtime.js';
|
|
15
14
|
import { component_context, dev_stack } from '../../context.js';
|
|
16
15
|
import { DEV } from 'esm-env';
|
|
@@ -18,6 +17,7 @@ import { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';
|
|
|
18
17
|
import { assign_nodes } from '../template.js';
|
|
19
18
|
import { is_raw_text_element } from '../../../../utils.js';
|
|
20
19
|
import { BranchManager } from './branches.js';
|
|
20
|
+
import { set_animation_effect_override } from '../elements/transitions.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @param {Comment | Element} node
|
|
@@ -48,11 +48,10 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
48
48
|
var anchor = /** @type {TemplateNode} */ (hydrating ? hydrate_node : node);
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* The keyed `{#each ...}` item block, if any, that this element is inside.
|
|
52
51
|
* We track this so we can set it when changing the element, allowing any
|
|
53
52
|
* `animate:` directive to bind itself to the correct block
|
|
54
53
|
*/
|
|
55
|
-
var
|
|
54
|
+
var parent_effect = /** @type {Effect} */ (active_effect);
|
|
56
55
|
|
|
57
56
|
var branches = new BranchManager(anchor, false);
|
|
58
57
|
|
|
@@ -67,10 +66,6 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
branches.ensure(next_tag, (anchor) => {
|
|
70
|
-
// See explanation of `each_item_block` above
|
|
71
|
-
var previous_each_item = current_each_item;
|
|
72
|
-
set_current_each_item(each_item_block);
|
|
73
|
-
|
|
74
69
|
if (next_tag) {
|
|
75
70
|
element = hydrating
|
|
76
71
|
? /** @type {Element} */ (element)
|
|
@@ -100,9 +95,9 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
100
95
|
|
|
101
96
|
// If hydrating, use the existing ssr comment as the anchor so that the
|
|
102
97
|
// inner open and close methods can pick up the existing nodes correctly
|
|
103
|
-
var child_anchor =
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
var child_anchor = hydrating
|
|
99
|
+
? get_first_child(element)
|
|
100
|
+
: element.appendChild(create_text());
|
|
106
101
|
|
|
107
102
|
if (hydrating) {
|
|
108
103
|
if (child_anchor === null) {
|
|
@@ -112,21 +107,23 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
|
|
|
112
107
|
}
|
|
113
108
|
}
|
|
114
109
|
|
|
110
|
+
set_animation_effect_override(parent_effect);
|
|
111
|
+
|
|
115
112
|
// `child_anchor` is undefined if this is a void element, but we still
|
|
116
113
|
// need to call `render_fn` in order to run actions etc. If the element
|
|
117
114
|
// contains children, it's a user error (which is warned on elsewhere)
|
|
118
115
|
// and the DOM will be silently discarded
|
|
119
116
|
render_fn(element, child_anchor);
|
|
117
|
+
|
|
118
|
+
set_animation_effect_override(null);
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
// we do this after calling `render_fn` so that child effects don't override `nodes.end`
|
|
123
|
-
/** @type {Effect} */ (active_effect).
|
|
122
|
+
/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = element;
|
|
124
123
|
|
|
125
124
|
anchor.before(element);
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
set_current_each_item(previous_each_item);
|
|
129
|
-
|
|
130
127
|
if (hydrating) {
|
|
131
128
|
set_hydrate_node(anchor);
|
|
132
129
|
}
|
|
@@ -21,7 +21,7 @@ export function head(hash, render_fn) {
|
|
|
21
21
|
if (hydrating) {
|
|
22
22
|
previous_hydrate_node = hydrate_node;
|
|
23
23
|
|
|
24
|
-
var head_anchor =
|
|
24
|
+
var head_anchor = get_first_child(document.head);
|
|
25
25
|
|
|
26
26
|
// There might be multiple head blocks in our app, and they could have been
|
|
27
27
|
// rendered in an arbitrary order — find one corresponding to this component
|
|
@@ -29,7 +29,7 @@ export function head(hash, render_fn) {
|
|
|
29
29
|
head_anchor !== null &&
|
|
30
30
|
(head_anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (head_anchor).data !== hash)
|
|
31
31
|
) {
|
|
32
|
-
head_anchor =
|
|
32
|
+
head_anchor = get_next_sibling(head_anchor);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// If we can't find an opening hydration marker, skip hydration (this can happen
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/** @import { AnimateFn, Animation, AnimationConfig, EachItem, Effect, TransitionFn, TransitionManager } from '#client' */
|
|
1
|
+
/** @import { AnimateFn, Animation, AnimationConfig, EachItem, Effect, EffectNodes, TransitionFn, TransitionManager } from '#client' */
|
|
2
2
|
import { noop, is_function } from '../../../shared/utils.js';
|
|
3
3
|
import { effect } from '../../reactivity/effects.js';
|
|
4
4
|
import { active_effect, untrack } from '../../runtime.js';
|
|
5
5
|
import { loop } from '../../loop.js';
|
|
6
6
|
import { should_intro } from '../../render.js';
|
|
7
|
-
import { current_each_item } from '../blocks/each.js';
|
|
8
7
|
import { TRANSITION_GLOBAL, TRANSITION_IN, TRANSITION_OUT } from '../../../../constants.js';
|
|
9
8
|
import { BLOCK_EFFECT, EFFECT_RAN, EFFECT_TRANSPARENT } from '#client/constants';
|
|
10
9
|
import { queue_micro_task } from '../task.js';
|
|
@@ -66,6 +65,14 @@ function css_to_keyframe(css) {
|
|
|
66
65
|
/** @param {number} t */
|
|
67
66
|
const linear = (t) => t;
|
|
68
67
|
|
|
68
|
+
/** @type {Effect | null} */
|
|
69
|
+
let animation_effect_override = null;
|
|
70
|
+
|
|
71
|
+
/** @param {Effect | null} v */
|
|
72
|
+
export function set_animation_effect_override(v) {
|
|
73
|
+
animation_effect_override = v;
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
/**
|
|
70
77
|
* Called inside keyed `{#each ...}` blocks (as `$.animation(...)`). This creates an animation manager
|
|
71
78
|
* and attaches it to the block, so that moves can be animated following reconciliation.
|
|
@@ -75,7 +82,8 @@ const linear = (t) => t;
|
|
|
75
82
|
* @param {(() => P) | null} get_params
|
|
76
83
|
*/
|
|
77
84
|
export function animation(element, get_fn, get_params) {
|
|
78
|
-
var
|
|
85
|
+
var effect = animation_effect_override ?? /** @type {Effect} */ (active_effect);
|
|
86
|
+
var nodes = /** @type {EffectNodes} */ (effect.nodes);
|
|
79
87
|
|
|
80
88
|
/** @type {DOMRect} */
|
|
81
89
|
var from;
|
|
@@ -89,7 +97,7 @@ export function animation(element, get_fn, get_params) {
|
|
|
89
97
|
/** @type {null | { position: string, width: string, height: string, transform: string }} */
|
|
90
98
|
var original_styles = null;
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
nodes.a ??= {
|
|
93
101
|
element,
|
|
94
102
|
measure() {
|
|
95
103
|
from = this.element.getBoundingClientRect();
|
|
@@ -161,7 +169,7 @@ export function animation(element, get_fn, get_params) {
|
|
|
161
169
|
// when an animation manager already exists, if the tag changes. in that case, we need to
|
|
162
170
|
// swap out the element rather than creating a new manager, in case it happened at the same
|
|
163
171
|
// moment as a reconciliation
|
|
164
|
-
|
|
172
|
+
nodes.a.element = element;
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
/**
|
|
@@ -265,9 +273,9 @@ export function transition(flags, element, get_fn, get_params) {
|
|
|
265
273
|
}
|
|
266
274
|
};
|
|
267
275
|
|
|
268
|
-
var e = /** @type {Effect} */ (active_effect);
|
|
276
|
+
var e = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);
|
|
269
277
|
|
|
270
|
-
(e.
|
|
278
|
+
(e.nodes.t ??= []).push(transition);
|
|
271
279
|
|
|
272
280
|
// if this is a local transition, we only want to run it if the parent (branch) effect's
|
|
273
281
|
// parent (block) effect is where the state change happened. we can determine that by
|
|
@@ -30,7 +30,7 @@ export function set_hydrating(value) {
|
|
|
30
30
|
*/
|
|
31
31
|
export let hydrate_node;
|
|
32
32
|
|
|
33
|
-
/** @param {TemplateNode} node */
|
|
33
|
+
/** @param {TemplateNode | null} node */
|
|
34
34
|
export function set_hydrate_node(node) {
|
|
35
35
|
if (node === null) {
|
|
36
36
|
w.hydration_mismatch();
|
|
@@ -41,7 +41,7 @@ export function set_hydrate_node(node) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export function hydrate_next() {
|
|
44
|
-
return set_hydrate_node(
|
|
44
|
+
return set_hydrate_node(get_next_sibling(hydrate_node));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** @param {TemplateNode} node */
|
|
@@ -83,21 +83,19 @@ export function create_text(value = '') {
|
|
|
83
83
|
/**
|
|
84
84
|
* @template {Node} N
|
|
85
85
|
* @param {N} node
|
|
86
|
-
* @returns {Node | null}
|
|
87
86
|
*/
|
|
88
87
|
/*@__NO_SIDE_EFFECTS__*/
|
|
89
88
|
export function get_first_child(node) {
|
|
90
|
-
return first_child_getter.call(node);
|
|
89
|
+
return /** @type {TemplateNode | null} */ (first_child_getter.call(node));
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
/**
|
|
94
93
|
* @template {Node} N
|
|
95
94
|
* @param {N} node
|
|
96
|
-
* @returns {Node | null}
|
|
97
95
|
*/
|
|
98
96
|
/*@__NO_SIDE_EFFECTS__*/
|
|
99
97
|
export function get_next_sibling(node) {
|
|
100
|
-
return next_sibling_getter.call(node);
|
|
98
|
+
return /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
/**
|
|
@@ -105,14 +103,14 @@ export function get_next_sibling(node) {
|
|
|
105
103
|
* @template {Node} N
|
|
106
104
|
* @param {N} node
|
|
107
105
|
* @param {boolean} is_text
|
|
108
|
-
* @returns {
|
|
106
|
+
* @returns {TemplateNode | null}
|
|
109
107
|
*/
|
|
110
108
|
export function child(node, is_text) {
|
|
111
109
|
if (!hydrating) {
|
|
112
110
|
return get_first_child(node);
|
|
113
111
|
}
|
|
114
112
|
|
|
115
|
-
var child =
|
|
113
|
+
var child = get_first_child(hydrate_node);
|
|
116
114
|
|
|
117
115
|
// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty
|
|
118
116
|
if (child === null) {
|
|
@@ -130,14 +128,13 @@ export function child(node, is_text) {
|
|
|
130
128
|
|
|
131
129
|
/**
|
|
132
130
|
* Don't mark this as side-effect-free, hydration needs to walk all nodes
|
|
133
|
-
* @param {
|
|
131
|
+
* @param {TemplateNode} node
|
|
134
132
|
* @param {boolean} [is_text]
|
|
135
|
-
* @returns {
|
|
133
|
+
* @returns {TemplateNode | null}
|
|
136
134
|
*/
|
|
137
|
-
export function first_child(
|
|
135
|
+
export function first_child(node, is_text = false) {
|
|
138
136
|
if (!hydrating) {
|
|
139
|
-
|
|
140
|
-
var first = /** @type {DocumentFragment} */ (get_first_child(/** @type {Node} */ (fragment)));
|
|
137
|
+
var first = get_first_child(node);
|
|
141
138
|
|
|
142
139
|
// TODO prevent user comments with the empty string when preserveComments is true
|
|
143
140
|
if (first instanceof Comment && first.data === '') return get_next_sibling(first);
|
|
@@ -163,7 +160,7 @@ export function first_child(fragment, is_text = false) {
|
|
|
163
160
|
* @param {TemplateNode} node
|
|
164
161
|
* @param {number} count
|
|
165
162
|
* @param {boolean} is_text
|
|
166
|
-
* @returns {
|
|
163
|
+
* @returns {TemplateNode | null}
|
|
167
164
|
*/
|
|
168
165
|
export function sibling(node, count = 1, is_text = false) {
|
|
169
166
|
let next_sibling = hydrating ? hydrate_node : node;
|
|
@@ -195,7 +192,7 @@ export function sibling(node, count = 1, is_text = false) {
|
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
set_hydrate_node(next_sibling);
|
|
198
|
-
return
|
|
195
|
+
return next_sibling;
|
|
199
196
|
}
|
|
200
197
|
|
|
201
198
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @import { Effect, TemplateNode } from '#client' */
|
|
1
|
+
/** @import { Effect, EffectNodes, TemplateNode } from '#client' */
|
|
2
2
|
/** @import { TemplateStructure } from './types' */
|
|
3
3
|
import { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';
|
|
4
4
|
import {
|
|
@@ -28,9 +28,8 @@ import { COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, EFFECT_RAN, TEXT_NODE } from '#cl
|
|
|
28
28
|
*/
|
|
29
29
|
export function assign_nodes(start, end) {
|
|
30
30
|
var effect = /** @type {Effect} */ (active_effect);
|
|
31
|
-
if (effect.
|
|
32
|
-
effect.
|
|
33
|
-
effect.nodes_end = end;
|
|
31
|
+
if (effect.nodes === null) {
|
|
32
|
+
effect.nodes = { start, end, a: null, t: null };
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
@@ -61,7 +60,7 @@ export function from_html(content, flags) {
|
|
|
61
60
|
|
|
62
61
|
if (node === undefined) {
|
|
63
62
|
node = create_fragment_from_html(has_start ? content : '<!>' + content);
|
|
64
|
-
if (!is_fragment) node = /** @type {
|
|
63
|
+
if (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
var clone = /** @type {TemplateNode} */ (
|
|
@@ -114,7 +113,7 @@ function from_namespace(content, flags, ns = 'svg') {
|
|
|
114
113
|
if (is_fragment) {
|
|
115
114
|
node = document.createDocumentFragment();
|
|
116
115
|
while (get_first_child(root)) {
|
|
117
|
-
node.appendChild(/** @type {
|
|
116
|
+
node.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));
|
|
118
117
|
}
|
|
119
118
|
} else {
|
|
120
119
|
node = /** @type {Element} */ (get_first_child(root));
|
|
@@ -228,7 +227,7 @@ export function from_tree(structure, flags) {
|
|
|
228
227
|
: undefined;
|
|
229
228
|
|
|
230
229
|
node = fragment_from_tree(structure, ns);
|
|
231
|
-
if (!is_fragment) node = /** @type {
|
|
230
|
+
if (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
var clone = /** @type {TemplateNode} */ (
|
|
@@ -270,7 +269,8 @@ function run_scripts(node) {
|
|
|
270
269
|
/** @type {HTMLElement} */ (node).tagName === 'SCRIPT'
|
|
271
270
|
? [/** @type {HTMLScriptElement} */ (node)]
|
|
272
271
|
: node.querySelectorAll('script');
|
|
273
|
-
|
|
272
|
+
|
|
273
|
+
const effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);
|
|
274
274
|
|
|
275
275
|
for (const script of scripts) {
|
|
276
276
|
const clone = document.createElement('script');
|
|
@@ -282,10 +282,10 @@ function run_scripts(node) {
|
|
|
282
282
|
|
|
283
283
|
// The script has changed - if it's at the edges, the effect now points at dead nodes
|
|
284
284
|
if (is_fragment ? node.firstChild === script : node === script) {
|
|
285
|
-
effect.
|
|
285
|
+
effect.nodes.start = clone;
|
|
286
286
|
}
|
|
287
287
|
if (is_fragment ? node.lastChild === script : node === script) {
|
|
288
|
-
effect.
|
|
288
|
+
effect.nodes.end = clone;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
script.replaceWith(clone);
|
|
@@ -344,13 +344,15 @@ export function comment() {
|
|
|
344
344
|
*/
|
|
345
345
|
export function append(anchor, dom) {
|
|
346
346
|
if (hydrating) {
|
|
347
|
-
var effect = /** @type {Effect} */ (active_effect);
|
|
347
|
+
var effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);
|
|
348
|
+
|
|
348
349
|
// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,
|
|
349
350
|
// then by the time the inner resolves we have already advanced to the end of the hydrated nodes
|
|
350
351
|
// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.
|
|
351
|
-
if ((effect.f & EFFECT_RAN) === 0 || effect.
|
|
352
|
-
effect.
|
|
352
|
+
if ((effect.f & EFFECT_RAN) === 0 || effect.nodes.end === null) {
|
|
353
|
+
effect.nodes.end = hydrate_node;
|
|
353
354
|
}
|
|
355
|
+
|
|
354
356
|
hydrate_next();
|
|
355
357
|
return;
|
|
356
358
|
}
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from './deriveds.js';
|
|
27
27
|
import { aborted } from './effects.js';
|
|
28
28
|
import { hydrate_next, hydrating, set_hydrate_node, skip_nodes } from '../dom/hydration.js';
|
|
29
|
-
import { current_each_item, set_current_each_item } from '../dom/blocks/each.js';
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* @param {Array<Promise<void>>} blockers
|
|
@@ -90,11 +89,7 @@ export function flatten(blockers, sync, async, fn) {
|
|
|
90
89
|
* @param {(values: Value[]) => any} fn
|
|
91
90
|
*/
|
|
92
91
|
export function run_after_blockers(blockers, fn) {
|
|
93
|
-
|
|
94
|
-
flatten(blockers, [], [], (v) => {
|
|
95
|
-
set_current_each_item(each_item);
|
|
96
|
-
fn(v);
|
|
97
|
-
});
|
|
92
|
+
flatten(blockers, [], [], fn);
|
|
98
93
|
}
|
|
99
94
|
|
|
100
95
|
/**
|
|
@@ -708,7 +708,7 @@ function flush_queued_effects(effects) {
|
|
|
708
708
|
// don't know if we need to keep them until they are executed. Doing the check
|
|
709
709
|
// here (rather than in `update_effect`) allows us to skip the work for
|
|
710
710
|
// immediate effects.
|
|
711
|
-
if (effect.deps === null && effect.first === null && effect.
|
|
711
|
+
if (effect.deps === null && effect.first === null && effect.nodes === null) {
|
|
712
712
|
// if there's no teardown or abort controller we completely unlink
|
|
713
713
|
// the effect from the graph
|
|
714
714
|
if (effect.teardown === null && effect.ac === null) {
|
|
@@ -101,8 +101,7 @@ function create_effect(type, fn, sync) {
|
|
|
101
101
|
var effect = {
|
|
102
102
|
ctx: component_context,
|
|
103
103
|
deps: null,
|
|
104
|
-
|
|
105
|
-
nodes_end: null,
|
|
104
|
+
nodes: null,
|
|
106
105
|
f: type | DIRTY | CONNECTED,
|
|
107
106
|
first: null,
|
|
108
107
|
fn,
|
|
@@ -112,7 +111,6 @@ function create_effect(type, fn, sync) {
|
|
|
112
111
|
b: parent && parent.b,
|
|
113
112
|
prev: null,
|
|
114
113
|
teardown: null,
|
|
115
|
-
transitions: null,
|
|
116
114
|
wv: 0,
|
|
117
115
|
ac: null
|
|
118
116
|
};
|
|
@@ -143,7 +141,7 @@ function create_effect(type, fn, sync) {
|
|
|
143
141
|
sync &&
|
|
144
142
|
e.deps === null &&
|
|
145
143
|
e.teardown === null &&
|
|
146
|
-
e.
|
|
144
|
+
e.nodes === null &&
|
|
147
145
|
e.first === e.last && // either `null`, or a singular child
|
|
148
146
|
(e.f & EFFECT_PRESERVED) === 0
|
|
149
147
|
) {
|
|
@@ -497,10 +495,10 @@ export function destroy_effect(effect, remove_dom = true) {
|
|
|
497
495
|
|
|
498
496
|
if (
|
|
499
497
|
(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&
|
|
500
|
-
effect.
|
|
501
|
-
effect.
|
|
498
|
+
effect.nodes !== null &&
|
|
499
|
+
effect.nodes.end !== null
|
|
502
500
|
) {
|
|
503
|
-
remove_effect_dom(effect.
|
|
501
|
+
remove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));
|
|
504
502
|
removed = true;
|
|
505
503
|
}
|
|
506
504
|
|
|
@@ -508,7 +506,7 @@ export function destroy_effect(effect, remove_dom = true) {
|
|
|
508
506
|
remove_reactions(effect, 0);
|
|
509
507
|
set_signal_status(effect, DESTROYED);
|
|
510
508
|
|
|
511
|
-
var transitions = effect.
|
|
509
|
+
var transitions = effect.nodes && effect.nodes.t;
|
|
512
510
|
|
|
513
511
|
if (transitions !== null) {
|
|
514
512
|
for (const transition of transitions) {
|
|
@@ -537,8 +535,7 @@ export function destroy_effect(effect, remove_dom = true) {
|
|
|
537
535
|
effect.ctx =
|
|
538
536
|
effect.deps =
|
|
539
537
|
effect.fn =
|
|
540
|
-
effect.
|
|
541
|
-
effect.nodes_end =
|
|
538
|
+
effect.nodes =
|
|
542
539
|
effect.ac =
|
|
543
540
|
null;
|
|
544
541
|
}
|
|
@@ -551,7 +548,7 @@ export function destroy_effect(effect, remove_dom = true) {
|
|
|
551
548
|
export function remove_effect_dom(node, end) {
|
|
552
549
|
while (node !== null) {
|
|
553
550
|
/** @type {TemplateNode | null} */
|
|
554
|
-
var next = node === end ? null :
|
|
551
|
+
var next = node === end ? null : get_next_sibling(node);
|
|
555
552
|
|
|
556
553
|
node.remove();
|
|
557
554
|
node = next;
|
|
@@ -593,17 +590,11 @@ export function pause_effect(effect, callback, destroy = true) {
|
|
|
593
590
|
|
|
594
591
|
pause_children(effect, transitions, true);
|
|
595
592
|
|
|
596
|
-
|
|
593
|
+
var fn = () => {
|
|
597
594
|
if (destroy) destroy_effect(effect);
|
|
598
595
|
if (callback) callback();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
596
|
+
};
|
|
601
597
|
|
|
602
|
-
/**
|
|
603
|
-
* @param {TransitionManager[]} transitions
|
|
604
|
-
* @param {() => void} fn
|
|
605
|
-
*/
|
|
606
|
-
export function run_out_transitions(transitions, fn) {
|
|
607
598
|
var remaining = transitions.length;
|
|
608
599
|
if (remaining > 0) {
|
|
609
600
|
var check = () => --remaining || fn();
|
|
@@ -620,12 +611,14 @@ export function run_out_transitions(transitions, fn) {
|
|
|
620
611
|
* @param {TransitionManager[]} transitions
|
|
621
612
|
* @param {boolean} local
|
|
622
613
|
*/
|
|
623
|
-
|
|
614
|
+
function pause_children(effect, transitions, local) {
|
|
624
615
|
if ((effect.f & INERT) !== 0) return;
|
|
625
616
|
effect.f ^= INERT;
|
|
626
617
|
|
|
627
|
-
|
|
628
|
-
|
|
618
|
+
var t = effect.nodes && effect.nodes.t;
|
|
619
|
+
|
|
620
|
+
if (t !== null) {
|
|
621
|
+
for (const transition of t) {
|
|
629
622
|
if (transition.is_global || local) {
|
|
630
623
|
transitions.push(transition);
|
|
631
624
|
}
|
|
@@ -688,8 +681,10 @@ function resume_children(effect, local) {
|
|
|
688
681
|
child = sibling;
|
|
689
682
|
}
|
|
690
683
|
|
|
691
|
-
|
|
692
|
-
|
|
684
|
+
var t = effect.nodes && effect.nodes.t;
|
|
685
|
+
|
|
686
|
+
if (t !== null) {
|
|
687
|
+
for (const transition of t) {
|
|
693
688
|
if (transition.is_global || local) {
|
|
694
689
|
transition.in();
|
|
695
690
|
}
|
|
@@ -706,12 +701,15 @@ export function aborted(effect = /** @type {Effect} */ (active_effect)) {
|
|
|
706
701
|
* @param {DocumentFragment} fragment
|
|
707
702
|
*/
|
|
708
703
|
export function move_effect(effect, fragment) {
|
|
709
|
-
|
|
710
|
-
|
|
704
|
+
if (!effect.nodes) return;
|
|
705
|
+
|
|
706
|
+
/** @type {TemplateNode | null} */
|
|
707
|
+
var node = effect.nodes.start;
|
|
708
|
+
var end = effect.nodes.end;
|
|
711
709
|
|
|
712
710
|
while (node !== null) {
|
|
713
711
|
/** @type {TemplateNode | null} */
|
|
714
|
-
var next = node === end ? null :
|
|
712
|
+
var next = node === end ? null : get_next_sibling(node);
|
|
715
713
|
|
|
716
714
|
fragment.append(node);
|
|
717
715
|
node = next;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @import { ComponentContext, Effect, TemplateNode } from '#client' */
|
|
1
|
+
/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */
|
|
2
2
|
/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */
|
|
3
3
|
import { DEV } from 'esm-env';
|
|
4
4
|
import {
|
|
@@ -99,12 +99,13 @@ export function hydrate(component, options) {
|
|
|
99
99
|
const previous_hydrate_node = hydrate_node;
|
|
100
100
|
|
|
101
101
|
try {
|
|
102
|
-
var anchor =
|
|
102
|
+
var anchor = get_first_child(target);
|
|
103
|
+
|
|
103
104
|
while (
|
|
104
105
|
anchor &&
|
|
105
106
|
(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)
|
|
106
107
|
) {
|
|
107
|
-
anchor =
|
|
108
|
+
anchor = get_next_sibling(anchor);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
if (!anchor) {
|
|
@@ -228,7 +229,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
|
|
|
228
229
|
should_intro = true;
|
|
229
230
|
|
|
230
231
|
if (hydrating) {
|
|
231
|
-
/** @type {Effect} */ (active_effect).
|
|
232
|
+
/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;
|
|
232
233
|
|
|
233
234
|
if (
|
|
234
235
|
hydrate_node === null ||
|
|
@@ -278,7 +278,7 @@ export function update_reaction(reaction) {
|
|
|
278
278
|
reaction.deps = deps = new_deps;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
if (
|
|
281
|
+
if (effect_tracking() && (reaction.f & CONNECTED) !== 0) {
|
|
282
282
|
for (i = skipped_deps; i < deps.length; i++) {
|
|
283
283
|
(deps[i].reactions ??= []).push(reaction);
|
|
284
284
|
}
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -272,6 +272,6 @@
|
|
|
272
272
|
null,
|
|
273
273
|
null
|
|
274
274
|
],
|
|
275
|
-
"mappings": "
|
|
275
|
+
"mappings": ";;;;;;;;;kBAUiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkC/BC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwEhBC,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;kBAwBbC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCbC,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;;aAwBrBC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA6BdC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;kBAuBRC,OAAOA;;;;;;;;;;;;;;;;kBAgBPC,eAAeA;;;;;;;;;;;;;;;;aAgBpBC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0CPC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCnSLC,cAAcA;;;;;;;;;;;;iBAsBdC,OAAOA;;;;;;;;iBAwBPC,SAASA;;;;;;;;;;;;;;;;;;;;;;iBA0CTC,qBAAqBA;;;;;;;;;;iBA2CrBC,YAAYA;;;;;;;;;;iBAuBZC,WAAWA;iBClNXC,UAAUA;;;;iBC4DVC,gBAAgBA;;;;;MCvEpBC,W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