trousers

hooks-first CSS-in-JS library, focused on semantics and runtime performance

MIT License

Downloads
558
Stars
302
Committers
4

Bot releases are hidden (Show)

trousers - Minor rerender fixes

Published by danieldelcore almost 5 years ago

πŸ›Fixes issues with unwanted rerenders https://github.com/danieldelcore/trousers/pull/38
πŸ”§ Removes the elementName getter, in favour of a name property on the style definition https://github.com/danieldelcore/trousers/pull/36
πŸ“ƒ Minor changes to the misc storybook example https://github.com/danieldelcore/trousers/pull/36

trousers - Modifier names ✨

Published by danieldelcore about 5 years ago

Adds the ability to create named modifiers

New API looks like...

const styles = styleCollector('button')
  .element``
  .modifier('primary', props => props.primary)`
    color: red;
  `;

This approach uses method overloading to allow the modifier name to be optional and provide backward compatibility. Which means, this is also allowed and works πŸŽ‰

const styles = styleCollector('button')
  .element``
  .modifier('props => props.primary)`
    color: red;
  `;
trousers -

Published by danieldelcore about 5 years ago

Improvements πŸ’ͺ

🌏 Reworked globals βœ…
⚑️ Performance improvements βœ…
🎨 Fix paint flashing βœ…
πŸ‘Ύ Improved SSR API βœ…
🐭 Reduced bundle size βœ…
πŸ“ƒ Better docs βœ…
βš”οΈ Battle tested βœ…

Breaking changes πŸ’₯

  • useGlobal renamed to useGlobals
  • useTrousers alias removed, please use useStyles
  • withTrousers alias removed, please use withStyles
  • trousers alias removed, please use styleCollector
  • severStyleRegistry.get() now returns React Nodes

Misc 🎁

  • TypeScript users no longer have to pass all generic types to useStyles, css and styleCollector
  • Render flashing is now gone, courtesy of useLayoutEffect
  • Removed murmurhash in favour of a small hand-rolled alternative
  • useGlobals will now accept an array of styles
  • Unit tests everywhere!