Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

@matthewp 

> @knowler's approach is a _push_ syntax isn't it? it is pushing styles into the shadowroots. Where as @robglidden's idea is pulling them into the component. At least in my brain these are different. Maybe just me.

I guess it depends. I’d imagine this syntax going along with some other opt-in mechanism inside the shadow root which might define where the styles are ordered. So it would be _push_, but not without consent (this makes it compatible with existing web components IMO). To me it doesn’t make sense to pull unless you know that you want _everything_.

There really are multiple use cases here:

- A component that knows it wants all of the document styles: _pull_
- A component that does want document styles, but it doesn’t know what: _opt-in, order, and allow the document to push_.

I think a shadow root shouldn’t have the ability to just pull a layer from the document. That really requires coordination and I do know Rob’s proposal includes a mechanism for this, I just think the document needs to opt-in the pulling. I do think it’s valuable for a shadow root to set up multiple layers as almost “(named) slots” for where a document can push styles to.

> @knowler I don't mind your idea, but it does immediately remind me of IIFEs from back in the day in JS before modules, ala (function(){})(). Something that you instinctively always have to write and nest your real code inside of. If all global .css files needed that wrapper it would be a bummer (but I'd still take it over the status quo).

Ya, I see that. It also would affect how styles are written in the document since you can’t just use this to wrap styles you want to push into the shadow root—the `@scope` has effects on how the scoped styles are cascaded in the document.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-1995333210
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/1995333210@github.com>

Received on Wednesday, 13 March 2024 18:40:20 UTC