* Changed isPlainObject to support objects created in a different context
* Update isPlainObject test to support objects without a toString method
Co-authored-by: Keegan Street <keegan.street@rea-group.com>
* Add support for shouldForwardProp
adds support for use of `shouldForwardProp` config method, which can be used to explicitly determine which props should be forwarded on
if this config is not provided then existing functionality is preserved (i.e. all props passed to components, or for HTML elements check using `validAttr`)
Inspired by the same feature in emotion
* refactor of shouldForwardProp support
following feedback from @kitten, `shouldForwardProp` now has a proper flow-type definition
refactor how `shouldForwardProp` is used to make code slightly clearer
code to compose `shouldForwardProp` now in-lined into `createStyledCompontent`
* minor logic tweak following review
* Fix upper group limit to allow for 2^31 components.
Previously the formula for increasing the size of Uint32Arrays
in the GroupedTag was a little aggressive and would cut of very
short of 2^31 groups. Instead it would cut off between 2^12 and
2^13 components, which isn't quite a lot.
This new upper boundary is the absolute limit of how many slots
a Uint32Array is defined to be able to hold. After this limit we'll
see an error.
Instead of letting this error leak out we now throw a more clear
error that hints at this limitation.
* Add test for upper group limit
* Add additional check for GroupIDAllocator
We can make it easier to track the offending
dynamic components in development by adding another
SMI overflow check to the GroupIDAllocator
* Replace TypeError in dom utils with throwStyledError
* changelog entry
Co-authored-by: Evan Jacobs <probablyup@gmail.com>
* remove unnecessary int coercion in phash
* remove unnecessary int32 cast on the string length
* add baseline v5.0.0 benchmark to suite
* clip hash result to 32bit range
* treat benchmark compiled v5 file as binary
* fix hash not being empty in the case of no plugins
* attempt to resolve smi deopt
* faster variant of djb2
* [styled-components] fix xhtml compat for ssr stylesheet by mirroring attribute key in value
* [styled-components] data-styled=true for xhtml compat instead of copying the attribute
* remove an unnecessary allocation in cGS
* allocate cGS instances from the stylesheet instead
fixes#2913
Previously the cGS instance count was managed locally in the cGS factory,
which works fine client-side but will never be reset properly for
server-side rendering (in this case, each cGS factory should be reset
to an instance count of 0 per rendering run.)
* Add componentId to "Over 200 classes..." warning
Two minor changes:
- Add optional `componentId` parameter to `src/utils/createWarnTooManyClasses.js` that is then rendered in the warning if it exists.
- Pass in `componentId` in `src/models/StyledComponent.js`
Implements #2776
(cherry picked from commit c1c02425dcd5367bccd543332b8833d29e38b4ee)
* Remove `$FlowFixMe`
This was likely added during rebase / was brought over from the master branch.
(cherry picked from commit 0314552eafc090b63d4bbe2f0f907a2e468b4a30)
* minor adjustments
Co-authored-by: Bee Ellis <44533466+hegelocampus@users.noreply.github.com>
* emit differentiated dynamic hashes for subtrees with different stylis plugins
* reorganize hashing files to avoid a cycle
* prehash the stylis plugin function bodies to make later hashing faster
* look for plugin.name in stylisPlugins for uniqueness
* throw an error instead of a dev-time warning if stylis plugins aren't named
minification can introduce the issue, so a dev warning isn't sufficient
* remove unused fallback code
* use stylis-plugin-rtl
* actually add the plugin
* just use phash
* cache djb2 seed