svelte 5.55.4 → 5.55.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/package.json
CHANGED
|
@@ -48,7 +48,8 @@ export const EFFECT_OFFSCREEN = 1 << 25;
|
|
|
48
48
|
/**
|
|
49
49
|
* Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
|
|
50
50
|
* Will be lifted during execution of the derived and during checking its dirty state (both are necessary
|
|
51
|
-
* because a derived might be checked but not executed).
|
|
51
|
+
* because a derived might be checked but not executed). This is a pure performance optimization flag and
|
|
52
|
+
* should not be used for any other purpose!
|
|
52
53
|
*/
|
|
53
54
|
export const WAS_MARKED = 1 << 16;
|
|
54
55
|
|
|
@@ -115,10 +115,17 @@ export function animation(element, get_fn, get_params) {
|
|
|
115
115
|
) {
|
|
116
116
|
const options = get_fn()(this.element, { from, to }, get_params?.());
|
|
117
117
|
|
|
118
|
-
animation = animate(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
animation = animate(
|
|
119
|
+
this.element,
|
|
120
|
+
options,
|
|
121
|
+
undefined,
|
|
122
|
+
1,
|
|
123
|
+
() => {},
|
|
124
|
+
() => {
|
|
125
|
+
animation?.abort();
|
|
126
|
+
animation = undefined;
|
|
127
|
+
}
|
|
128
|
+
);
|
|
122
129
|
}
|
|
123
130
|
},
|
|
124
131
|
fix() {
|
|
@@ -239,15 +246,24 @@ export function transition(flags, element, get_fn, get_params) {
|
|
|
239
246
|
intro?.abort();
|
|
240
247
|
}
|
|
241
248
|
|
|
242
|
-
intro = animate(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
intro = animate(
|
|
250
|
+
element,
|
|
251
|
+
get_options(),
|
|
252
|
+
outro,
|
|
253
|
+
1,
|
|
254
|
+
() => {
|
|
255
|
+
dispatch_event(element, 'introstart');
|
|
256
|
+
},
|
|
257
|
+
() => {
|
|
258
|
+
dispatch_event(element, 'introend');
|
|
259
|
+
|
|
260
|
+
// Ensure we cancel the animation to prevent leaking
|
|
261
|
+
intro?.abort();
|
|
262
|
+
intro = current_options = undefined;
|
|
263
|
+
|
|
264
|
+
element.style.overflow = overflow;
|
|
265
|
+
}
|
|
266
|
+
);
|
|
251
267
|
},
|
|
252
268
|
out(fn) {
|
|
253
269
|
if (!is_outro) {
|
|
@@ -258,10 +274,19 @@ export function transition(flags, element, get_fn, get_params) {
|
|
|
258
274
|
|
|
259
275
|
element.inert = true;
|
|
260
276
|
|
|
261
|
-
outro = animate(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
277
|
+
outro = animate(
|
|
278
|
+
element,
|
|
279
|
+
get_options(),
|
|
280
|
+
intro,
|
|
281
|
+
0,
|
|
282
|
+
() => {
|
|
283
|
+
dispatch_event(element, 'outrostart');
|
|
284
|
+
},
|
|
285
|
+
() => {
|
|
286
|
+
dispatch_event(element, 'outroend');
|
|
287
|
+
fn?.();
|
|
288
|
+
}
|
|
289
|
+
);
|
|
265
290
|
},
|
|
266
291
|
stop: () => {
|
|
267
292
|
intro?.abort();
|
|
@@ -306,10 +331,11 @@ export function transition(flags, element, get_fn, get_params) {
|
|
|
306
331
|
* @param {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig)} options
|
|
307
332
|
* @param {Animation | undefined} counterpart The corresponding intro/outro to this outro/intro
|
|
308
333
|
* @param {number} t2 The target `t` value — `1` for intro, `0` for outro
|
|
334
|
+
* @param {(() => void)} on_begin Called just before beginning the animation
|
|
309
335
|
* @param {(() => void)} on_finish Called after successfully completing the animation
|
|
310
336
|
* @returns {Animation}
|
|
311
337
|
*/
|
|
312
|
-
function animate(element, options, counterpart, t2, on_finish) {
|
|
338
|
+
function animate(element, options, counterpart, t2, on_begin, on_finish) {
|
|
313
339
|
var is_intro = t2 === 1;
|
|
314
340
|
|
|
315
341
|
if (is_function(options)) {
|
|
@@ -323,7 +349,7 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
323
349
|
queue_micro_task(() => {
|
|
324
350
|
if (aborted) return;
|
|
325
351
|
var o = options({ direction: is_intro ? 'in' : 'out' });
|
|
326
|
-
a = animate(element, o, counterpart, t2, on_finish);
|
|
352
|
+
a = animate(element, o, counterpart, t2, on_begin, on_finish);
|
|
327
353
|
});
|
|
328
354
|
|
|
329
355
|
// ...but we want to do so without using `async`/`await` everywhere, so
|
|
@@ -342,7 +368,7 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
342
368
|
counterpart?.deactivate();
|
|
343
369
|
|
|
344
370
|
if (!options?.duration && !options?.delay) {
|
|
345
|
-
|
|
371
|
+
on_begin();
|
|
346
372
|
on_finish();
|
|
347
373
|
|
|
348
374
|
return {
|
|
@@ -382,7 +408,7 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
382
408
|
// remove dummy animation from the stack to prevent conflict with main animation
|
|
383
409
|
animation.cancel();
|
|
384
410
|
|
|
385
|
-
|
|
411
|
+
on_begin();
|
|
386
412
|
|
|
387
413
|
// for bidirectional transitions, we start from the current position,
|
|
388
414
|
// rather than doing a full intro/outro
|
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
ROOT_EFFECT,
|
|
28
28
|
ASYNC,
|
|
29
29
|
WAS_MARKED,
|
|
30
|
-
CONNECTED
|
|
30
|
+
CONNECTED,
|
|
31
|
+
REACTION_IS_UPDATING
|
|
31
32
|
} from '#client/constants';
|
|
32
33
|
import * as e from '../errors.js';
|
|
33
34
|
import { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';
|
|
@@ -356,8 +357,11 @@ function mark_reactions(signal, status, updated_during_traversal) {
|
|
|
356
357
|
batch_values?.delete(derived);
|
|
357
358
|
|
|
358
359
|
if ((flags & WAS_MARKED) === 0) {
|
|
359
|
-
// Only connected deriveds can be reliably unmarked right away
|
|
360
|
-
if (
|
|
360
|
+
// Only connected deriveds being executed outside the update cycle can be reliably unmarked right away
|
|
361
|
+
if (
|
|
362
|
+
flags & CONNECTED &&
|
|
363
|
+
(active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)
|
|
364
|
+
) {
|
|
361
365
|
reaction.f |= WAS_MARKED;
|
|
362
366
|
}
|
|
363
367
|
|
package/src/version.js
CHANGED