4.0 Roadmap
quantizor opened this issue Β· 23 comments
planned
-
drop React 15 support and switch to React 16-compliant lifecycle methods, etc without polyfills -
drop HTML element whitelist-
desugar syntax via babel plugin (styled-components/babel-plugin-styled-components#140) -
add "no-tags" entry (#1912) -
replace imports to "styled-components" with "styled-components/no tags" entry when using the babel plugin (styled-components/babel-plugin-styled-components#150)
-
-
update documentation to strongly recommend using the babel plugin (styled-components/styled-components-website#288) -
remove preprocess functionality (styled-components/babel-plugin-styled-components#135) -
drop.extend()
API (#1908) -
delete the now unnecessaryconsolidateStreamedStyles()
API (#1906) -
component-based global style API (#1333)-
remove the injectGlobal API (#1333)
-
-
migrate TS typings out of the repo to DefinitelyTyped (#1778, DefinitelyTyped/DefinitelyTyped#28207, #1922) - add syntax highlighting support for new APIs (styled-components/webstorm-styled-components#55, styled-components/stylelint-processor-styled-components#209, styled-components/vscode-styled-components#126,
styled-components/vim-styled-components#48) -
drop prod builds of things and just let downstream webpack etc handle minification and such -
stop bundling PropTypes with the UMD build (#1921) -
document all new APIs, mark old APIs as deprecated in the docs -
remove jsnext:main from package.json (#1907)
nice to have
Global style component?
@kitten I wasn't sure if I should add sweetsour to the checklist just yet? I'd love to target a mid-summer release for 4.0, depending on how much time we have.
@probablyup ππππππ
update documentation to strongly recommend using the babel plugin (will be required to use styled.x syntax vs styled('x'))
I'm not a big fan of the bold part.
Instead, we should have the "default" bundle which does ship with the tag list, and then as soon as you install the Babel plugin it transpiles it to use a different entry point without the tag list automatically under the hood:
// β¬β¬β¬β¬β¬ In β¬β¬β¬β¬β¬
import styled from 'styled-components';
const Button = styled.button`
color: blue;
`
// β¬β¬β¬β¬β¬ Out β¬β¬β¬β¬β¬
import styled from 'styled-components/no-tag-list';
const Button = styled('button')`
color: blue;
`
That way, beginner users who are just dipping their toes into styled-components can use it just like all the docs and articles around it suggest without problems, and then once they graduate to using it seriously it should be obvious that you should be using the Babel plugin which automatically gets you huge size gains. We could even do a simple check whether the default bundle was used in production and emit a console.warn("Please use the Babel plugin for massive size savings!")
.
Potentially we could also sacrifice browser compat in the default bundle and use a proxy, but I'm not a big fan of that simply because create-react-app
users won't have a way to opt-into better browser support.
@mxstbr I kinda see what you're saying but from the perspective of someone using the library, I'd rather be told the correct way to do something from the onset so I didn't have to go back and refactor it all later, you know?
@probablyup but it's not a refactoring at all, it's fully automatic? Once you're ready to go full prod mode we recommend you drop in the Babel pluginβyou just don't have to use it from the onset.
Are there any plans to change the innerRef
prop to ref
and leverage React 16.3 forwardRef
?
@migueloller yup definitely, that's part of the "drop React 15 support and switch to React 16-compliant lifecycle methods, etc without polyfills" item!
@probablyup Awesome! π
https://github.com/styled-components/styled-components/tree/develop is the 4.0 branch π
First big piece of this is going in soon, thanks to #1894
I think we can check off the "unsafe async-lifecycles" task after #1894 got merged. Can't find any references to componentWillReceiveProps
, componentWillMount
or componentWillUpdate
anywhere but in the benchmark code (could send in a PR for this but the we might get misleading results compared to master)
I'd also like to add "Use React.forwardRef
API" to the checklist, that way we won't have to use a innerRef
prop anymore.
Stylis is having an ongoing rewrite so that's something we might want to add in v4 as well
@alexandernanberg Yup I think that context API work ended up checking off a lot of things! π
forwardRef
is definitely something we want to do. You're welcome to pick it up if you have time!
@probablyup Cool! Yeah I'd definitely like to do that when I got some extra time over π
Edit: So right now enzyme doesn't support React.forwardRef
which blocks us from adding this because it breaks a lot of test. When this PR gets merged and they release a new version we can revisit this. Unless someone has a solution to this.
π From what I understand you are approaching v4 release and I would like to make a proposal for it.
While prop whitelist is obviously non-ideal solution and has its costs (2kb+) the approach is used by more than 1 library, it would be great if we could just use for the time being the same module for it so the cost would be one time thing.
I'd like to propose using is-prop-valid. It's obviously used by emotion, but also by popmotion since recently and I know that if we could all agree on a single module @diegohaz would love to dedupe his copied validAttr
from reakit.
Your solution is more correct (i.e. validating post data-
characters) but IMHO this is not really needed, the solution without that extreme correctness is "good enough" and is also slightly lighter (~0.5kb from what I remember).
@Andarist I think we can use it but they're missing some props - going to make an issue now
Super! Just to add - I have not consulted any other emotion team member on this, just got the ball rolling here. I don't think anyone on the team will have anything against it though.
What about new typings for TypeScript like createGlobalStyle ?
The TS typings were moved out of the repository so that's job for DefinitelyTyped community, not styled-components team.
@ctretyak I'm already on it. π Watch this issue and then within a day after it gets merged it'll be available for use. DefinitelyTyped/DefinitelyTyped#29389
Thanks so much @Lavoaster!