Comparing version 5.0.0-next.186 to 5.0.0-next.187
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.186", | ||
"version": "5.0.0-next.187", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -421,3 +421,3 @@ /** @import * as ESTree from 'estree' */ | ||
const accept_fn_body = [ | ||
b.stmt(b.call('$.set', b.id('s'), b.member(b.id('module'), b.id('default')))) | ||
b.stmt(b.call('$.set', b.id('s'), b.member(b.id('module.default'), b.id('original')))) | ||
]; | ||
@@ -444,4 +444,10 @@ | ||
b.const(b.id('filename'), b.member(b.id(analysis.name), b.id('filename'))), | ||
b.const(b.id('$$original'), b.id(analysis.name)), | ||
b.stmt(b.assignment('=', b.id(analysis.name), b.call('$.hmr', b.id('s')))), | ||
b.stmt(b.assignment('=', b.member(b.id(analysis.name), b.id('filename')), b.id('filename'))), | ||
// Assign the original component to the wrapper so we can use it on hot reload patching, | ||
// else we would call the HMR function two times | ||
b.stmt( | ||
b.assignment('=', b.member(b.id(analysis.name), b.id('original')), b.id('$$original')) | ||
), | ||
b.stmt(b.call('import.meta.hot.accept', b.arrow([b.id('module')], b.block(accept_fn_body)))) | ||
@@ -448,0 +454,0 @@ ]); |
@@ -99,6 +99,13 @@ import { noop, is_function } from '../../../shared/utils.js'; | ||
animation = animate(this.element, options, undefined, 1, () => { | ||
animation?.abort(); | ||
animation = undefined; | ||
}); | ||
animation = animate( | ||
this.element, | ||
options, | ||
undefined, | ||
1, | ||
() => { | ||
animation?.abort(); | ||
animation = undefined; | ||
}, | ||
undefined | ||
); | ||
} | ||
@@ -161,6 +168,7 @@ }, | ||
var is_outro = (flags & TRANSITION_OUT) !== 0; | ||
var is_both = is_intro && is_outro; | ||
var is_global = (flags & TRANSITION_GLOBAL) !== 0; | ||
/** @type {'in' | 'out' | 'both'} */ | ||
var direction = is_intro && is_outro ? 'both' : is_intro ? 'in' : 'out'; | ||
var direction = is_both ? 'both' : is_intro ? 'in' : 'out'; | ||
@@ -196,9 +204,22 @@ /** @type {import('#client').AnimationConfig | ((opts: { direction: 'in' | 'out' }) => import('#client').AnimationConfig) | undefined} */ | ||
outro?.abort(); | ||
// abort previous intro (can happen if an element is intro'd, then outro'd, then intro'd again) | ||
intro?.abort(); | ||
if (is_intro) { | ||
dispatch_event(element, 'introstart'); | ||
intro = animate(element, get_options(), outro, 1, () => { | ||
dispatch_event(element, 'introend'); | ||
intro = current_options = undefined; | ||
}); | ||
intro = animate( | ||
element, | ||
get_options(), | ||
outro, | ||
1, | ||
() => { | ||
dispatch_event(element, 'introend'); | ||
intro = current_options = undefined; | ||
}, | ||
is_both | ||
? undefined | ||
: () => { | ||
intro = current_options = undefined; | ||
} | ||
); | ||
} else { | ||
@@ -209,2 +230,5 @@ reset?.(); | ||
out(fn) { | ||
// abort previous outro (can happen if an element is outro'd, then intro'd, then outro'd again) | ||
outro?.abort(); | ||
if (is_outro) { | ||
@@ -214,7 +238,18 @@ element.inert = true; | ||
dispatch_event(element, 'outrostart'); | ||
outro = animate(element, get_options(), intro, 0, () => { | ||
dispatch_event(element, 'outroend'); | ||
outro = current_options = undefined; | ||
fn?.(); | ||
}); | ||
outro = animate( | ||
element, | ||
get_options(), | ||
intro, | ||
0, | ||
() => { | ||
dispatch_event(element, 'outroend'); | ||
outro = current_options = undefined; | ||
fn?.(); | ||
}, | ||
is_both | ||
? undefined | ||
: () => { | ||
outro = current_options = undefined; | ||
} | ||
); | ||
@@ -271,6 +306,7 @@ // TODO arguably the outro should never null itself out until _all_ outros for this effect have completed... | ||
* @param {number} t2 The target `t` value — `1` for intro, `0` for outro | ||
* @param {(() => void) | undefined} callback | ||
* @param {(() => void) | undefined} on_finish Called after successfully completing the animation | ||
* @param {(() => void) | undefined} on_abort Called if the animation is aborted | ||
* @returns {import('#client').Animation} | ||
*/ | ||
function animate(element, options, counterpart, t2, callback) { | ||
function animate(element, options, counterpart, t2, on_finish, on_abort) { | ||
var is_intro = t2 === 1; | ||
@@ -287,3 +323,3 @@ | ||
var o = options({ direction: is_intro ? 'in' : 'out' }); | ||
a = animate(element, o, counterpart, t2, callback); | ||
a = animate(element, o, counterpart, t2, on_finish, on_abort); | ||
}); | ||
@@ -304,3 +340,3 @@ | ||
if (!options?.duration) { | ||
callback?.(); | ||
on_finish?.(); | ||
return { | ||
@@ -330,2 +366,3 @@ abort: noop, | ||
if (css) { | ||
// run after a micro task so that all transitions that are lining up and are about to run can correctly measure the DOM | ||
queue_micro_task(() => { | ||
@@ -361,3 +398,3 @@ // WAAPI | ||
.then(() => { | ||
callback?.(); | ||
on_finish?.(); | ||
@@ -389,3 +426,3 @@ if (t2 === 1) { | ||
tick?.(t2, 1 - t2); | ||
callback?.(); | ||
on_finish?.(); | ||
return false; | ||
@@ -407,5 +444,7 @@ } | ||
task?.abort(); | ||
on_abort?.(); | ||
}, | ||
deactivate: () => { | ||
callback = undefined; | ||
on_finish = undefined; | ||
on_abort = undefined; | ||
}, | ||
@@ -412,0 +451,0 @@ reset: () => { |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.186'; | ||
export const VERSION = '5.0.0-next.187'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2141835
47103