From 7281e1d060cd7a8e5dfdee9452317c2d5f3c1c35 Mon Sep 17 00:00:00 2001 From: Aelita Date: Sat, 2 Dec 2023 01:22:35 +1100 Subject: [PATCH] fix: slide will now treat `0` as is instead of generating `-0` --- src/utils.ts | 2 +- test/slide.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index f5fb411..8faef83 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -28,7 +28,7 @@ export const handleSlide = ( if (!value.startsWith('var(--') && ['top', 'left'].includes(dir ?? '')) { if (value.startsWith('-')) value = value.slice(1) - else + else if (value !== '0') value = `-${value}` } diff --git a/test/slide.test.ts b/test/slide.test.ts index 500fcfe..45d7389 100644 --- a/test/slide.test.ts +++ b/test/slide.test.ts @@ -205,7 +205,7 @@ describe('slide animation', () => { .slide-in-t--70{--una-enter-translate-y:17.5rem;} .slide-in-t--80{--una-enter-translate-y:20rem;} .slide-in-t--90{--una-enter-translate-y:22.5rem;} - .slide-in-t-0{--una-enter-translate-y:-0;} + .slide-in-t-0{--una-enter-translate-y:0;} .slide-in-t-10{--una-enter-translate-y:-2.5rem;} .slide-in-t-100{--una-enter-translate-y:-25rem;} .slide-in-t-110{--una-enter-translate-y:-27.5rem;} @@ -510,7 +510,7 @@ describe('slide animation', () => { .slide-out-t--70{--una-exit-translate-y:17.5rem;} .slide-out-t--80{--una-exit-translate-y:20rem;} .slide-out-t--90{--una-exit-translate-y:22.5rem;} - .slide-out-t-0{--una-exit-translate-y:-0;} + .slide-out-t-0{--una-exit-translate-y:0;} .slide-out-t-10{--una-exit-translate-y:-2.5rem;} .slide-out-t-100{--una-exit-translate-y:-25rem;} .slide-out-t-110{--una-exit-translate-y:-27.5rem;}