Merge pull request #2246 from sveltejs/null-transition

allow transition functions to return nothing
pull/3358/head
Rich Harris 5 years ago committed by GitHub
commit d61387d933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -65,6 +65,8 @@ export function transition_out(block, local: 0 | 1, detach: 0 | 1, callback) {
}
}
const null_transition: TransitionConfig = { duration: 0 };
type TransitionFn = (node: Element, params: any) => TransitionConfig;
export function create_in_transition(node: Element & ElementCSSInlineStyle, fn: TransitionFn, params: any) {
@ -85,7 +87,7 @@ export function create_in_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;
if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);
tick(0, 1);
@ -164,7 +166,7 @@ export function create_out_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;
if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css);
@ -258,7 +260,7 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline
easing = linear,
tick = noop,
css
} = config;
} = config || null_transition;
const program = {
start: now() + delay,

Loading…
Cancel
Save