diff --git a/demo/nuxt.config.ts b/demo/nuxt.config.ts index c3526ae..1453532 100644 --- a/demo/nuxt.config.ts +++ b/demo/nuxt.config.ts @@ -8,7 +8,6 @@ export default defineNuxtConfig({ }, notivue: { // addPlugin: true, - // limit: Infinity, notifications: { global: { // duration: Infinity, @@ -23,7 +22,8 @@ export default defineNuxtConfig({ }, vite: { build: { - cssMinify: 'lightningcss', + // Never use lightningcss - https://github.com/parcel-bundler/lightningcss/issues/288 + cssMinify: 'esbuild', }, css: { transformer: 'lightningcss', diff --git a/packages/notivue/Notivue/composables/useTouchEvents.ts b/packages/notivue/Notivue/composables/useTouchEvents.ts index 9921f87..a4b141c 100644 --- a/packages/notivue/Notivue/composables/useTouchEvents.ts +++ b/packages/notivue/Notivue/composables/useTouchEvents.ts @@ -21,17 +21,17 @@ export function useTouchEvents() { function pauseTouch(event: PointerEvent) { if (!isMouse(event)) { - clearTimeout(timeouts.touchDebounceTimeout) + window.clearTimeout(timeouts.touchDebounceTimeout) timeouts.pause() - timeouts.touchDebounceTimeout = setTimeout(() => { + timeouts.touchDebounceTimeout = window.setTimeout(() => { timeouts.resume() }, 2000) } } onBeforeUnmount(() => { - clearTimeout(timeouts.touchDebounceTimeout) + window.clearTimeout(timeouts.touchDebounceTimeout) }) return computed(() => diff --git a/packages/notivue/NotivueSwipe/NotivueSwipe.vue b/packages/notivue/NotivueSwipe/NotivueSwipe.vue index 14eb076..1532735 100644 --- a/packages/notivue/NotivueSwipe/NotivueSwipe.vue +++ b/packages/notivue/NotivueSwipe/NotivueSwipe.vue @@ -153,14 +153,14 @@ function getDebounceMs(e: PointerEvent) { } function pauseTimeouts() { - clearTimeout(timeouts.touchDebounceTimeout) + window.clearTimeout(timeouts.touchDebounceTimeout) timeouts.pause() } function resumeTimeouts(ms: number) { - clearTimeout(timeouts.touchDebounceTimeout) + window.clearTimeout(timeouts.touchDebounceTimeout) - timeouts.touchDebounceTimeout = setTimeout(() => { + timeouts.touchDebounceTimeout = window.setTimeout(() => { timeouts.resume() }, ms) } @@ -249,7 +249,7 @@ function onPointerMoveClear(e: PointerEvent) { } const animDuration = parseFloat(animations.getTransitionData()?.duration ?? 0) * 1000 - setTimeout(() => (state.isClearing = false), animDuration) + window.setTimeout(() => (state.isClearing = false), animDuration) } /** @@ -281,7 +281,7 @@ function onPointerUp(e: PointerEvent) { isLocked: true, }) - setTimeout(() => (state.isLocked = false), RETURN_DUR) + window.setTimeout(() => (state.isLocked = false), RETURN_DUR) } /** diff --git a/packages/notivue/core/createStore.ts b/packages/notivue/core/createStore.ts index 8fbee26..afc6af3 100644 --- a/packages/notivue/core/createStore.ts +++ b/packages/notivue/core/createStore.ts @@ -222,7 +222,7 @@ export function createAnimationsSlice( export function createTimeoutsSlice(items: ItemsSlice, animations: AnimationsSlice) { return { - touchDebounceTimeout: undefined as unknown as ReturnType, + touchDebounceTimeout: undefined as undefined | number, isStreamPaused: ref(false), isStreamFocused: ref(false), setStreamPause(newVal = true) { @@ -232,7 +232,7 @@ export function createTimeoutsSlice(items: ItemsSlice, animations: AnimationsSli this.isStreamFocused.value = newVal }, reset() { - clearTimeout(this.touchDebounceTimeout) + window.clearTimeout(this.touchDebounceTimeout) this.setStreamPause(false) this.setStreamFocus(false) @@ -256,7 +256,7 @@ export function createTimeoutsSlice(items: ItemsSlice, animations: AnimationsSli console.log('Pausing timeouts') items.updateAll((item) => { - clearTimeout(item.timeout as number) + window.clearTimeout(item.timeout as number) return { ...item, @@ -271,7 +271,7 @@ export function createTimeoutsSlice(items: ItemsSlice, animations: AnimationsSli console.log('Resuming timeouts') items.updateAll((item) => { - clearTimeout(item.timeout as number) + window.clearTimeout(item.timeout as number) /** * 'elapsed' may be equal to 'undefined' if a notification * is pushed while the stream is paused as pause() won't be called. diff --git a/tests/Notivue/config-pause-on-hover.cy.ts b/tests/Notivue/config-pause-on-hover.cy.ts index 71e0ca2..6363cc9 100644 --- a/tests/Notivue/config-pause-on-hover.cy.ts +++ b/tests/Notivue/config-pause-on-hover.cy.ts @@ -1,5 +1,3 @@ -import Notivue from './components/Notivue.vue' - import type { VueWrapper } from '@vue/test-utils' describe('Pause on hover', () => {