Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

[Snyk] Upgrade styled-components from 5.1.0 to 5.1.1 #53

Merged
merged 2 commits into from
May 27, 2020

Conversation

snyk-bot
Copy link
Contributor

Snyk has created this PR to upgrade styled-components from 5.1.0 to 5.1.1.

merge advice

鉁╓hat is Merge Advice? We check thousands of dependency upgrade pull requests and CI tests every day to see which upgrades were successfully merged. After crunching this data, we give a recommendation on how safe we think the change is for you to merge without causing issues. Learn more, and share your feedback to help improve this feature. 馃檹
鈩癸笍 Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
  • The recommended version is 1 version ahead of your current version.
  • The recommended version was released a day ago, on 2020-05-25.
Release notes
Package name: styled-components
  • 5.1.1 - 2020-05-25

    New Functionality

    • Implement shouldForwardProp API for native and primitive platforms, which was previously missing in [v5.1.0] (see #3093)
      This has been released under a patch bump instead of a minor, since it's only been missing from Native-support.

    Bugfixes

    • Added useTheme hook to named exports for react-primitives entrypoint (see #2982) thanks @jladuval!
    • Escape every CSS ident character necessary when converting component display names to class names (see #3102) thanks @kripod!
  • 5.1.0 - 2020-04-07

    New Functionality

    • Add shouldForwardProp API (almost the same as emotion's, just a slightly different usage pattern); #3006

      Sometimes when composing multiple higher-order components together, it's possible to get into scenarios when multiple layers consume props by the same name. In the past we've introduced various workarounds for popular props like "as" but this power-user API allows for more granular customization of what props are passed down to descendant component children when using the styled() HOC wrapper.

      When combined with other APIs like .attrs() this becomes a very powerful constellation of abilities.

      Here's how you use it:

      const Comp = styled('div').withConfig({
        shouldForwardProp: (prop, defaultValidatorFn) => !['filterThis'].includes(prop),
      })`
        color: red;
      `;
      

      render(<Comp filterThis="abc" passThru="def" />);

      Renders: <div className="[generated]" passThru="def"></div>

      The second argument defaultValidatorFn is what we use internally to validate props based on known HTML attributes. It's provided so you can filter exactly what props you don't wish to pass and then fall-back to the default filtering mechanism if desired.

      Other methods on the styled HOC like .attrs can be chained after withConfig(), and before opening your template literal:

      const Comp = styled('div').withConfig({
        shouldForwardProp: (prop, defaultValidatorFn) => !['filterThis'].includes(prop),
      }).attrs({ className: 'foo' })`
        color: red;
      `;
      

      render(<Comp filterThis="abc" passThru="def" />);

      Renders: <div className="[generated] foo" passThru="def"></div>

      Thanks @stevesims and all that contributed!

    • Add "transient props" API; #3052

      Think of transient props as a lightweight, but complementary API to shouldForwardProp. Because styled-components allows any kind of prop to be used for styling (a trait shared by most CSS-in-JS libraries, but not the third party library ecosystem in general), adding a filter for every possible prop you might use can get cumbersome.

      Transient props are a new pattern to pass props that are explicitly consumed only by styled components and are not meant to be passed down to deeper component layers. Here's how you use them:

      const Comp = styled.div`
        color: ${props => props.$fg || 'black'};
      `;
      

      render(<Comp $fg="red">I'm red!</Comp>);

      Note the dollar sign ($) prefix on the prop; this marks it as transient and styled-components knows not to add it to the rendered DOM element or pass it further down the component hierarchy.

    Bugfixes

    • Fix slow SSR Rehydration for malformed CSS and increase fault-tolerance (see #3018)

    • Change isPlainObject (internal method) to support objects created in a different context (see #3068) thanks @keeganstreet!

    • Add support for the <video disablePictureInPicture> (see #3058) thanks @egdbear!

from styled-components GitHub release notes

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

馃 View latest project report

馃洜 Adjust upgrade PR settings

馃敃 Ignore this dependency or unsubscribe from future upgrade PRs

@willemliufdmg willemliufdmg merged commit 244496f into master May 27, 2020
@willemliufdmg willemliufdmg deleted the snyk-upgrade-b6aff83f6618a8d263edcf5d36460e94 branch May 27, 2020 07:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants