vueuse / motion

🀹 Vue Composables putting your components in motion
https://motion.vueuse.org
MIT License
2.37k stars 82 forks source link

[DRAFT] fix: `:initial` variant style not applied during SSR using `v-motion` #199

Closed BobbieGoede closed 5 months ago

BobbieGoede commented 5 months ago

πŸ”— Linked issue

❓ Type of change

πŸ“š Description

I spent some time updating https://github.com/intlify/vue-i18n-extensions and tried to see what I could from it at the same time.

This PR adds a directive transform to extract the style provided in :initial and bind it to the element during SSR, since there isn't really any documentation on writing a directive transform this was mostly trial and error to see what worked, while the code looks sloppy this does seem to work with my initial tests.

The implementation so far is still a work in progress as it doesn't handle the shorthand properties (such as x, y, etc.) that we normally support. Ideally I can add tests as well but setting up tests for SSR will probably be a challenge on its own, perhaps I can test the transform in isolation like https://github.com/intlify/vue-i18n-extensions does instead.

πŸ“ Checklist