Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 #451

Open
cristianbote opened this issue Apr 27, 2022 · 1 comment
Open

v3 #451

cristianbote opened this issue Apr 27, 2022 · 1 comment

Comments

@cristianbote
Copy link
Owner

Starting to think about v3 but not necessarily new features that pops up but rather breaking changes in APIs.

  1. Move away from second argument as function to object based to allow passing forwardRef and shouldForwardProp functions.
// ❌ old
const Old = styled('div', React.forwardRef)`
  border-radius: 1em;
`

// ✅ new
const NewWay = styled('div', {
  forwardRef: React.forwardRef,
  shouldForwardProp: () => {}
})`
  border-radius: 1em;
`
  1. With the above, the setup function will not be needed anymore to have a 4th argument
// ❌ old
setup(React.createElement, undefined, undefined, shouldForwardPropFn)

// ✅ new
setup(React.createElement)
  1. Remove glob export from goober
@ksenginew
Copy link
Contributor

HI @cristianbote I would like to introduce some of my ideas. (maybe it's a new implementation for goober)

currently goober converts input to an object(if input is an object keeps it as it is), then breaks down it to css strings, and update an style element(in DOM)

  1. create a constructable stylesheet. if it's not supported in the current environment, then import a very basic implementation(based on style element) and use it.
  2. check if css nesting is supported(its works for 60% of global users). otherwise import a parser to handle this behavior.
  3. convert input to an css string.(without handling nested styles)
  4. update stylesheet with styles.
  5. walk through newly updated styles and prefix them.(it's now already parsed by browser)

any thoughts 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants