trousers

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

MIT License

Downloads
558
Stars
302
Committers
4

Bot releases are visible (Hide)

trousers - https://github.com/danieldelcore/trousers/releases/tag/@trousers/[email protected]

Published by github-actions[bot] over 4 years ago

Major Changes

  • e6a3323: # Version 3 πŸŽ‰

    This is Trousers' biggest update yet!

    Including:

    • Support for the CSS prop πŸ‘©β€πŸŽ€
    • Mono-repo setup and decomposition πŸ“¦
    • Object notation CSS 🍞
    • Theme CSS var package 🎨
    • insertRule 🏹
    • Smaller bundles 🐭
    • Custom style collectors πŸ•Ί
    • Trousers package with all exports for backwards compatibility

    Removed

    • withStyles HOC (please use css prop for class components)

    Developer experience

  • c9c8187: Trousers v3!

    • CSS prop πŸ‘©β€πŸŽ€
    • Mono-repo setup and decomposition πŸ“¦
    • Object notation CSS 🍞
    • Theme CSS var package 🎨
    • prod mode support for insertRule 🏹
    • Smaller bundles 🐭
    • Support for custom style collectors πŸ•Ί
    • Trousers package with all exports for backwards compatibility

    Dev

Patch Changes

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!