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

feat: Shadow DOM #57

Conversation

Marshal27
Copy link

@Marshal27 Marshal27 commented Sep 29, 2022

@devknoll Created this PR based on your #53

impl containing the following:

  • monkeypatch CSSStyleSheet.replace and CSSStyleSheet.replaceSync.
  • associate the container descriptors with the CSSStyleSheet on shadowRoot.
  • pass the set of query descriptors as part of the state/context.
  • only monkeypatch CSSStyleSheet.replace and CSSStyleSheet.replaceSync if prototype function is defined.

pending:

  • need to test/and or possibly implement support for ::slotted() and ::part()
  • need to complete further testing with :host() (so far base level testing here of setting container-type seems to be working).

@Marshal27
Copy link
Author

Marshal27 commented Sep 29, 2022

@devknoll I just realized you pushed a commit with some significant changes while I was working on this.

I will take a look at the new iteration.

src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
@devknoll
Copy link
Collaborator

Apologies for the churn -- I was hoping to get those changes in before you rebased 🙂

@Marshal27
Copy link
Author

Apologies for the churn -- I was hoping to get those changes in before you rebased 🙂

no problem at all, I welcome the feedback/interaction 😄

@devknoll devknoll deleted the branch GoogleChromeLabs:main September 30, 2022 01:01
@devknoll devknoll closed this Sep 30, 2022
@devknoll devknoll reopened this Sep 30, 2022
@Marshal27 Marshal27 changed the base branch from x-fix-updating-step to main September 30, 2022 13:22
@Marshal27 Marshal27 mentioned this pull request Sep 30, 2022
src/engine.ts Outdated Show resolved Hide resolved
src/types/global.d.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
@devknoll
Copy link
Collaborator

#53 was merged, so you should be able to rebase against main now.

@Marshal27
Copy link
Author

@devknoll if you are good with current impls, would you be ok with me rebasing and landing this on main and then handling any additional work for ::slotted() ::part() or :host() in a separate PR?

@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch 5 times, most recently from 900b435 to 7b67497 Compare September 30, 2022 21:25
@Marshal27 Marshal27 marked this pull request as ready for review September 30, 2022 21:27
@Marshal27
Copy link
Author

@devknoll this is ready for final review/merge when you have a moment to do another pass.

@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch from 7b67497 to 80c7d0b Compare October 10, 2022 13:49
@devknoll
Copy link
Collaborator

Very sorry for the delay, I've been swamped with other things. Will review this today or tomorrow!

Copy link
Collaborator

@devknoll devknoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are good with current impls, would you be ok with me rebasing and landing this on main and then handling any additional work for ::slotted() ::part() or :host() in a separate PR?

@Marshal27 I'm not too keen on landing partial feature support. That said, I think enabling shadow roots at all may be a good incremental step, so I think I would be willing to land this if we deferred the :host and related changes (e.g. processCssRules), so that this PR was focused on just allowing you to use containers inside a shadow root that were defined inside that shadow root. The processCssRules change is going to need some further iteration anyway I think.

How does that sound?

src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
@Marshal27
Copy link
Author

if you are good with current impls, would you be ok with me rebasing and landing this on main and then handling any additional work for ::slotted() ::part() or :host() in a separate PR?

@Marshal27 I'm not too keen on landing partial feature support. That said, I think enabling shadow roots at all may be a good incremental step, so I think I would be willing to land this if we deferred the :host and related changes (e.g. processCssRules), so that this PR was focused on just allowing you to use containers inside a shadow root that were defined inside that shadow root. The processCssRules change is going to need some further iteration anyway I think.

How does that sound?

I agree with you on not landing partial work, but, I also agree with your recommended approach to keep this focused on enabling containers in the shadowRoot etc. Based on recent dialog (#56 Support for non-trivial CSS Selectors) the processCssRules work will likely be driven by patterns adopted for that topic so it makes sense in my opinion to compartmentalize the processCssRules work.

@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch from 80c7d0b to b3fb604 Compare October 18, 2022 23:15
src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch 2 times, most recently from f1ef64c to 4031f5d Compare October 19, 2022 02:26
@Marshal27
Copy link
Author

Marshal27 commented Oct 19, 2022

@devknoll if you spot any additional items let me know and I will get them implemented... if not, it should be GTG.

src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
src/engine.ts Outdated Show resolved Hide resolved
src/globals.d.ts Outdated Show resolved Hide resolved
@gkatsev
Copy link
Contributor

gkatsev commented Oct 28, 2022

Thanks for your work on this! Though, I'm wondering is this supposed to be with just a standard style element or only with Constructable Stylesheets?

I'm trying it out on a project where our existing web component templates include a style element inside of them, and with this PR it didn't work. Though, once I switched it to use constructable stylesheets it worked like a champ.

@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch from f84c7a8 to adf970b Compare November 1, 2022 22:44
@Marshal27
Copy link
Author

@gkatsev I appreciate you bringing that to my attention. The latest push should provide basic support for standard style elements; please give it a test drive and let me know how it goes.

Please note:

Attempting either of the following is not currently working for standard style elements, however, these two approaches are currently working for the constructed stylesheets.

Because that impl is currently under review by @devknoll I did not want to incorporate it here until I get his thoughts on the approach. Other than that, basic functionality should now be available.

:host { container-type: inline-size; }

or

:host[attribute] { container-type: inline-size; }

@gkatsev
Copy link
Contributor

gkatsev commented Nov 1, 2022

Awesome, let me try it out!
I don't currently use :host with container queries, so, it's working out.

@gkatsev
Copy link
Contributor

gkatsev commented Nov 1, 2022

Seems to be working now without requiring us to adopt Constructable Stylesheets immediately. Thanks!

@gkatsev
Copy link
Contributor

gkatsev commented Nov 1, 2022

Thank you for the PR and for the maintainers for maintaining this polyfill. I hope this gets pulled in soon.

@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch from adf970b to 02c0463 Compare November 2, 2022 16:36
@Marshal27 Marshal27 force-pushed the feature/#7_Web_Components_support branch from 02c0463 to 3c24f13 Compare November 4, 2022 21:09
@gkatsev gkatsev mentioned this pull request Nov 8, 2022
@devknoll
Copy link
Collaborator

devknoll commented Nov 9, 2022

@Marshal27 Thank you for all of your hard work on this PR. This is an important feature that many folks are passionate about, and one that I had hoped we'd be able to get in.

Unfortunately, I have moved on to other projects and there isn't currently anyone working full-time on the polyfill right now. Without an owner who can help see this full feature through to completion, we don't feel very comfortable merging this PR (or any other new features) right this moment. I'm very sorry about that ☹️

That said, I highly encourage you to continue development on your fork: there are clearly many folks that want this feature and you're best poised to provide it. For testing, the repository is configured to use BrowserStack. You should know that BrowserStack provides free sponsorship for OSS projects, and we encourage you to apply so that you can continue to test your changes against the official Web Platform Tests, which include tests for ShadowDOM support.

My sincere apologies ☹️

@devknoll devknoll closed this Nov 9, 2022
@devknoll devknoll mentioned this pull request Nov 9, 2022
@Marshal27
Copy link
Author

Posting this link here for posterity.

https://github.com/Marshal27/shadow-container-query-polyfill

@gkatsev
Copy link
Contributor

gkatsev commented Nov 10, 2022

Awesome, I was wondering whether you'd be willing to maintain a community fork @Marshal27.

@Marshal27
Copy link
Author

Awesome, I was wondering whether you'd be willing to maintain a community fork @Marshal27.

I will definitely do my best. Feel free to add any shadow dom specific issues you may run into over there and I will do what I can.

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

Successfully merging this pull request may close these issues.

3 participants