Releases: styled-components/polished
v2.0.1
v2.0.0
This is a major release that introduces new modules, improvements to existing modules, bug fixes, improved TypeScript and Flow Support, and some deprecations.
Breaking Changes
We introduced one necessary breaking change in this release. In the future, we will warn a full major version ahead of time, but this one necessitated an immediate fix. (Un)luckily, it was never working properly in the first place.
mix
color module now requires a ratio in order to work. It originally tried to default to.5
but this broke in most cases.
Deprecations
These items have been marked for deprecation in v3 of polished
.
placeholder
mixin is no longer required to address gaps in vendor prefixing in major CSS-in-JS libraries.selection
mixin is no longer required to address gaps in vendor prefixing in major CSS-in-JS libraries.
These items have been deprecated immediately as the change doesn't introduce any breaking changes. However, you will want to update your code accordingly.
normalize
no longer acceptsexcludeOpinionated
as a parameter, as opinionated rules have been removed in the latest versions of normalize.css.
New Modules
This release addresses our most popular feature requests as voted on by users. If something you were hoping for didn't make it, you can make your voice heard by 👍a module request in our issues.
Mixins
between
mixin added to return a CSS calc formula for linear interpolation of a property between two values.cover
mixin added to return CSS to fully cover an area similar tobackground-image: cover
.fluidRange
mixin added to returns a set of media queries that resizes a property (or set of properties) between a provided fromSize and toSize linearly.
Shorthands
border
shorthand added to return shorthand for the border property that splits out individual properties for use with tools like Fela and Styletron.
Helpers
getValueAndUnit
helper added returns a given CSS value and its unit as elements of an array.
New Features
We have made a variety of improvements to existing modules as well.
Mixins
fontFace
now supportsfont-display
,font-variation-settings
, andfont-feature-settings
.triangle
now supports any unit of measure instead of justpx
. (Thanks @lifeiscontent)normalize
has been upgraded to use normalize.css 8.0.
Color Modules
- All color modules now support hex color values with alpha values (commonly referred to as 8-Digit hex colors).
- All color modules now support string values for all parameters.
mix
fixed an issue where mix would not curry properly.
Shorthands
transitions
now supports applying the same transition to multiple properties in one call.
Bug Fixes
Mixins
ellipsis
- fixed a bug to avoid potential white-space issues withdisplay: inline-block
.normalize
- fixed an issue where vendor prefixed values were not properly camel-cased.retinaImage
- fixed a bug that was causing background-image to be set toundefined
(instead of not set at all) when a background image is not passed.
Flow
mix
now properly passes flow tests in all cases, including when curried.- All Modules now uses the
Styles
type for better compatibility with CSS-In-JS libraries and their Flow type definitions. (Thanks @vhfmag) - All Modules - fixed various issues with typings including improperly declared optional parameters, too loose array definitions, and inadequate object property strictness.
- All custom types are now exported separately for use elsewhere instead of being embedded with specific modules.
TypeScript (Thanks @ForbesLindesay)
- TypeScript build now works properly in Windows
- Added additional TypeScript tests for all modules.
- TypeScript definitions properly generate regardless of module export policy.
- All Modules now uses the
Styles
type for better compatibility with CSS-In-JS libraries and their TypeScript definitions. (Thanks @vhfmag)
Documentation
- Docs have been upgraded to the latest version of
documentation.js
and generation should no longer randomly break for contributors. triangle
documentation now properly displays.toColorString
documentation now properly displays.- Variety of clarifications and typo fixes.