257 Commits

Author SHA1 Message Date
Phil Pluckthun
f0a84f418e v5.1.1 2020-05-26 00:25:34 +01:00
macintoshhelper
4add697ac7 Implement shouldForwardProp for React Native/Primitives (#3107)
* implement shouldForwardProp for React Native and primitives #3093

* return true in native default prop validator function

* Update CHANGELOG.md
2020-04-24 12:08:46 -04:00
Kristóf Poduszló
01e5747aa4 fix: escape every CSS ident character necessary (#3102)
* fix: escape every CSS ident character necessary

* fix: failing tests

* fix(escape): merging multiple dashes into one

* chore(changelog): add entry
2020-04-13 16:42:55 -04:00
macintoshhelper
4893cbe7cb export useTheme in primitives entrypoint #2975 (#3108) 2020-04-13 13:14:26 -04:00
Evan Jacobs
c57a273ed7 v5.1.0 2020-04-07 01:20:46 -04:00
Evan Jacobs
58538b72be shouldForwardProp receives the second argument, a default filter function 2020-04-07 00:59:07 -04:00
Evan Jacobs
8836289376 add knowledge of react-is "typeof" to rollup 2020-04-07 00:47:41 -04:00
dependabot[bot]
55fc70a4d2 Bump acorn from 5.7.3 to 7.1.1 in /packages/styled-components (#3092)
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...7.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-07 00:46:19 -04:00
Keegan Street
843b018873 Change isPlainObject to support objects created in a different context (#3068)
* 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>
2020-04-07 00:46:04 -04:00
Evan Jacobs
0c6852bd86 transient props (#3052) 2020-04-07 00:42:33 -04:00
Evan Jacobs
4293579342 minor dep updates (#3091)
* minor dep updates

* move stuff out of dependencies that shouldn't be there
2020-04-07 00:41:06 -04:00
egdbear
94df8bb57c Bump is-prop-valid (#3058) 2020-03-10 14:24:17 -04:00
Evan Jacobs
e02109e626 shouldForwardProp support (#3006)
* 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
2020-03-05 15:31:58 -05:00
Evan Jacobs
e56952a7d7 revise SSR+hydration functionality to be more fault-tolerant (#3018)
* Fix RULE_RE to reduce backtracking

Fix #3017

* Add CHANGELOG entry

* revise SSR emitter & rehydrator to use a split sequence instead of regex

* Fix splitting to be per rule

* Update CHANGELOG entry

* Add newline to SPLITTER constant

* skip garbage nodes

* adjust snapshot

Co-authored-by: Evan Jacobs <probablyup@gmail.com>
2020-03-05 15:23:35 -05:00
Evan Jacobs
4440112278 v5.0.1 2020-02-04 12:42:11 -05:00
Phil Plückthun
3390244224 Add warning for components that are created dynamically (#2998)
* Add check for whether component is used dynamically

* Fix checkDynamicCreation call and dedup by message

* Add tests for dynamic creation warning
2020-02-04 12:38:53 -05:00
Evan Jacobs
581993b039 add dev-time warning discouraging usage of @import (#2997)
* add dev-time warning discouraging usage of @import

* includes -> indexOf for IE compat
2020-01-31 17:31:40 -05:00
Phil Plückthun
4bf44fcd44 Fix upper group limit in GroupedTag (#2996)
* 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>
2020-01-30 23:10:09 -05:00
Evan Jacobs
216f03deb0 attempt to resolve a SSR deopt in the hashing function (#2983)
* 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
2020-01-30 11:11:08 -05:00
Matt Lubner
3f6c31a29b Skip multi-instance warning in test environments (#2991) 2020-01-27 14:43:55 -05:00
Samuli Ulmanen
93a00472e3 Fix xhtml compat for ssr stylesheet (works in v4) (#2968)
* [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
2020-01-27 10:49:36 +00:00
Matt Lubner
092ebcfc42 Regenerate yarn.lock to update fsevents for node>=12 (#2990)
* Regenerate yarn.lock to update fsevents for node>=12

* Update snapshots to reflect minor differences in generated output
2020-01-26 23:17:09 +00:00
Jacob Duval
d9a3becc14 Add useTheme to the list of native exports (#2982)
* Add useTheme to the default export

* Update CHANGELOG.md

Co-authored-by: Evan Jacobs <probablyup@gmail.com>
2020-01-25 15:00:28 -05:00
Evan Jacobs
60d02ee0b4 v5.0.0 2020-01-13 13:13:32 -05:00
Evan Jacobs
147b0e9a1f Merge pull request #2863 from styled-components/v5
v5
2020-01-13 13:05:27 -05:00
Evan Jacobs
aca9186920 allocate cGS instances from the stylesheet instead (#2947)
* 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.)
2020-01-13 13:00:47 -05:00
Evan Jacobs
fe2a2ccfa4 adjust rehydration regex to handle deeply-nested MQs (#2949)
fixes #2946
2020-01-06 16:29:03 -05:00
Evan Jacobs
d227ec9bdc Add componentId to "Over 200 classes..." warning (#2948)
* 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>
2020-01-06 16:27:54 -05:00
Evan Jacobs
dff9510b0b inline stylis-rule-sheet (#2940)
fixes #2874

(and saves some bytes)
2020-01-03 12:06:24 -05:00
Evan Jacobs
37f472da70 v5.0.0-rc.3 2019-12-29 22:54:20 -05:00
Evan Jacobs
cd3ef89673 refactor stylis management (#2936)
* 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
2019-12-29 22:35:55 -05:00
James Armenta
7ea065cba6 Expose version in API (#2888)
* Export bundle version

* Comment for version export

* Better version comment
2019-12-27 16:10:17 -05:00
Evan Jacobs
bef7299b73 fix usage of nested stylesheetmanagers in SSR 2019-12-25 23:15:06 -05:00
Toru Kobayashi
9aaac333e9 use funding field instead of post install script (#2931) 2019-12-23 11:27:37 -05:00
Evan Jacobs
7e11092c7a switch back to mainline hoist-non-react-statics (#2934)
should fix #2930
2019-12-23 11:27:01 -05:00
Max Stoiber
9e29e497a1 Merge pull request #2898 from vepor/css-without-interpolations
Unnecessary flattening and interleave of css without interpolations
2019-12-02 10:34:44 +01:00
Luděk Vepřek
ffa7d5a895 Unnecessary flattening and interleave of css without interpolations 2019-12-02 09:46:26 +01:00
Jafar Rezaei
9b7a60c3f5 Make useTheme cleaner (#2879) 2019-11-30 18:05:25 -05:00
Evan Jacobs
50d1284518 v5.0.0-rc.2 2019-11-12 16:48:04 -05:00
Evan Jacobs
270d464a94 replace rehydration from CSSOM with progressive regex (#2872)
* replace rehydration from CSSOM with progressive regex

* lighter suppression comment, remove some unnecessary allocations
2019-11-12 16:42:44 -05:00
Evan Jacobs
062cfca5a9 fix building benchmarks 2019-11-07 16:29:15 -05:00
Evan Jacobs
e4b7fd4e14 remove some rebasing artifacts 2019-11-07 16:14:03 -05:00
Samuli Ulmanen
e2e93a635e [styled-components] add ThemeProvider to Example (#2856) 2019-11-07 16:10:19 -05:00
Samuli Ulmanen
02aaba9b70 [styled-components] streaming ssr example to devServer (#2855) 2019-11-07 16:09:50 -05:00
Evan Jacobs
12a9f3c847 (v5) aggregate classNames passed via attrs (#2859)
* add failing test

* aggregate classNames passed via attrs

fixes #2839

Normally attrs fully override the previous value, but in the case of
className they're often composed additively and it's desired to retain
the previous value in a HOC or folding scenario.

* changelog entry [skip ci]

* add simple joining util

* add function signature
2019-11-07 16:03:00 -05:00
Evan Jacobs
df36f93b76 remove the theme usage dev-time check
this was also removed in a later v4 version but missed doing it here
2019-11-07 16:03:00 -05:00
Evan Jacobs
d2f4509254 fix a few missed cases where attrs were not preferred over props 2019-11-07 16:03:00 -05:00
Evan Jacobs
5485947008 v5.0.0-rc.1 2019-11-07 16:02:59 -05:00
Evan Jacobs
4ee67293c6 inline mixinDeep util (#2846)
* inline mixinDeep util

This will ensure the ES6 syntax gets transpiled properly

* inline MIT license from mixin-deep
2019-11-07 16:02:59 -05:00
Evan Jacobs
72a6c4193e v5.0.0-rc.0 2019-11-07 16:02:59 -05:00