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

Coming from [this other interesting issue](https://github.com/WICG/webcomponents/issues/986)
Maybe i am too late for this conversation, but here are a couple of thoughts...

I think there are some cool ideas on this issue.
But i think component authors should have some degree of control on which elements in the component are customisable and which are not.
To achieve this we currently can use `::part`, which is great. But it works on a single element, so it a pain to add parts for all elements on big components (or nested components)
We can also use css variables, but again it is cumbersome to create variables so users can style everything.

And opening the whole component to external customisation could lead to users breaking the component...

**Idea 1**
I think it would be cool to have some kind of `::part-group` which could expose a whole block (an element and its children) to the outside.
Kind of like the `::part` but for a whole block.
This would allow authors to expose the component elements that are customisable without needing to create a lot of `::part`, and still allow them to have some "private" elements in the component which are not customisable.

**Idea 2**
What if we could import a css @layer in the web component?
If i am creating a `my-component`, the component could import a `@layer my-component-custom-styles`.
By default this would be empty, so there would be no change. But it would allow users to create a `my-component-custom-styles` css layer and style the component as they wish.


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

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

Received on Saturday, 10 February 2024 08:16:58 UTC