stylistic changes to variable name and clean up comment

pull/5922/head
Chris Chua 6 years ago
parent e4ea648a70
commit f7daf112e7

@ -89,10 +89,10 @@ export function create_in_transition(node: Element & ElementCSSInlineStyle, fn:
easing = linear, easing = linear,
tick = noop, tick = noop,
css, css,
staticCss, static_css
} = config || null_transition; } = config || null_transition;
if (staticCss) static_class_name = create_static_rule(node, staticCss, uid++); if (static_css) static_class_name = create_static_rule(node, static_css, uid++);
if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++); if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);
tick(0, 1); tick(0, 1);
@ -272,7 +272,7 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline
easing = linear, easing = linear,
tick = noop, tick = noop,
css, css,
staticCss static_css
} = config || null_transition; } = config || null_transition;
const program = { const program = {
@ -291,8 +291,8 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline
} else { } else {
// if this is an intro, and there's a delay, we need to do // if this is an intro, and there's a delay, we need to do
// an initial tick and/or apply CSS animation immediately // an initial tick and/or apply CSS animation immediately
if (staticCss && !static_class_name) { if (static_css && !static_class_name) {
static_class_name = create_static_rule(node, staticCss); static_class_name = create_static_rule(node, static_css);
} }
if (css) { if (css) {
clear_animation(); clear_animation();

@ -4,11 +4,11 @@ import { assign, is_function } from 'svelte/internal';
export type EasingFunction = (t: number) => number; export type EasingFunction = (t: number) => number;
export interface TransitionConfig { export interface TransitionConfig {
static_css?: string;
delay?: number; delay?: number;
duration?: number; duration?: number;
easing?: EasingFunction; easing?: EasingFunction;
css?: (t: number, u: number) => string; css?: (t: number, u: number) => string;
staticCss?: string;
tick?: (t: number, u: number) => void; tick?: (t: number, u: number) => void;
} }
@ -117,17 +117,16 @@ export function slide(node: Element, {
const border_bottom_width = parseFloat(style.borderBottomWidth); const border_bottom_width = parseFloat(style.borderBottomWidth);
let displayOverride = ''; let displayOverride = '';
// May want to use a whitelist instead
if (style.display.includes('table')) { if (style.display.includes('table')) {
displayOverride = 'display: block;'; displayOverride = 'display: block;';
} }
return { return {
// Support a custom className to be added before and cleaned up after the thing.
staticCss: displayOverride + 'overflow: hidden;',
delay, delay,
duration, duration,
easing, easing,
static_css: displayOverride +
'overflow: hidden;',
css: t => css: t =>
`opacity: ${Math.min(t * 20, 1) * opacity};` + `opacity: ${Math.min(t * 20, 1) * opacity};` +
`height: ${t * height}px;` + `height: ${t * height}px;` +

Loading…
Cancel
Save