@skeletonlabs/skeleton
Version:
A SvelteKit component library.
12 lines (11 loc) • 473 B
JavaScript
// Transitions ---
export function dynamicTransition(node, dynParams) {
const { transition, params, enabled } = dynParams;
if (enabled)
return transition(node, params);
// it's better to just set the `duration` to 0 to prevent flickering
if ('duration' in params)
return transition(node, { duration: 0 });
// if the transition doesn't provide a `duration` prop, then we'll just return this as a last resort
return { duration: 0 };
}