atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.15k stars 43 forks source link

Implement `toCss` utility and fix `styles` prop #114

Open efoken opened 10 months ago

efoken commented 10 months ago

This PR allows using objects for styles with a toCss utility as an alternative to the template literal as mentioned in https://github.com/atomicojs/atomico/issues/91#issuecomment-1239000709.

I tried to implement a very basic solution with tiny amount of code. Let me know what you think. Maybe I want to add support for nested objects similar to SCSS, but I'm not sure if that's still needed when nested CSS is starting to get supported by browsers.

This PR also fixes the style prop to work like in React, with non-dimensional values – check the tests.