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

[jss-isolate] Option for isolation like in shadow dom. #326

Closed
kof opened this issue Oct 1, 2016 · 4 comments
Closed

[jss-isolate] Option for isolation like in shadow dom. #326

kof opened this issue Oct 1, 2016 · 4 comments
Labels
enhancement No kittens die if we don't do that. idea What if we turn JSS into styled-components? plugin When unplugged is fine

Comments

@kof
Copy link
Member

kof commented Oct 1, 2016

We can achieve this by defining a default rule name, which will be reset. We can still use inheritance within one component, but it won't spread down to nested components.

We can achieve this by adding an isolate option to the plugin creator.

  • jss.use(isolate({isolate: true}) is the current behavior, isolates all rules if you don't set isolate: false on a sheet or on a rule
  • jss.use(isolate({isolate: false}) will not isolate any rule by default, to isolate you will need to set isolate: true on a sheet or on the rule.
  • jss.use(isolate({isolate: 'root'}) - will isolate automatically only rules with name "root" or any other name you want to use. This is identical to shadow dom behavior. This allows children in this component to inherit inheritable values, but components which have own roots will be isolated, so that inheritance doesn't spread to all children.
@kof
Copy link
Member Author

kof commented Oct 1, 2016

thanks @giuseppeg for the input!

@kof
Copy link
Member Author

kof commented Oct 1, 2016

cc @maximkoretskiy

@giuseppeg
Copy link
Member

FYI there is a list of [inherited] properties for CSS2.1 on the W3C site. You'd need to add the missing CSS3/4 ones – there is a list on StackOverflow but I haven't validated it yet.

@kof kof added enhancement No kittens die if we don't do that. idea What if we turn JSS into styled-components? labels Oct 1, 2016
@kof kof changed the title [jss-isolate] Per component isolation like shadow dom. [jss-isolate] Option for isolation like in shadow dom. Oct 27, 2016
@kof kof added the plugin When unplugged is fine label Dec 2, 2016
@kof
Copy link
Member Author

kof commented Jan 19, 2017

Done, check it out https://github.com/cssinjs/jss-isolate (not published)

@kof kof closed this as completed Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement No kittens die if we don't do that. idea What if we turn JSS into styled-components? plugin When unplugged is fine
Projects
None yet
Development

No branches or pull requests

2 participants