2019-05-27 09:24:57 +02:00
|
|
|
import { slide as svelteSlide } from 'svelte-transitions'
|
2021-07-05 05:19:04 +02:00
|
|
|
import { store } from '../_store/store.js'
|
|
|
|
import { noop } from '../_utils/lodash-lite.js'
|
2019-05-27 09:24:57 +02:00
|
|
|
|
|
|
|
// same as svelte-transitions, but respecting reduceMotion
|
|
|
|
export function slide (node, ref) {
|
2019-08-03 22:49:37 +02:00
|
|
|
const { reduceMotion } = store.get()
|
2019-05-27 09:24:57 +02:00
|
|
|
if (reduceMotion) {
|
|
|
|
return {
|
|
|
|
delay: 0,
|
|
|
|
duration: 1, // setting to 0 causes some kind of built-in duration
|
|
|
|
easing: _ => _,
|
|
|
|
css: noop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return svelteSlide(node, ref)
|
|
|
|
}
|