angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.73k forks source link

feat(all): Support for CSS Cascade Layers #26451

Open johanndev opened 1 year ago

johanndev commented 1 year ago

Feature Description

Are there any plans to introduce support for CSS Cascade Layers?

References: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_layers https://caniuse.com/css-cascade-layers https://www.smashingmagazine.com/2022/01/introduction-css-cascade-layers/

Use Case

To meet the demands of our customers, our team often has to override the default styles of angular material components. We'd like to use cascade layers to organize our normalization, override, and custom styles. If the angular components would be wrapped in a dedicated (configurable?) layer, our material overrides could be embedded more conveniently into our overall style logic.

alexlehner86 commented 1 year ago

I'd very much appreciate this too! The problem right now is that many Angular Material components add CSS rules inside a style tag to the document's head. Currently there is no way to configure that these CSS rules should be defined as part of a specific CSS cascade layer.

I would also like to offer my help in implementing this feature.

alexlehner86 commented 1 year ago

Any update on this?

Opcyc-Ben commented 7 months ago

Can I be of assistance with this? Has anyone already worked on this, or do you guys have a specific design in mind?

alexlehner86 commented 7 months ago

@OpCyc-Ben As far as I know, nobody has worked on this yet. Here's a suggestion how it could work:

What do you think?

Opcyc-Ben commented 7 months ago

@alexlehner86 While I love that idea, I'd like to first discuss first what we are conceptually trying to do. I'm even torn whether angular itself might be a better place for this. To be transparent about my motivation, our (my) use-case for this would be to wrap any non-layered styles into a base-layer. This use-case would go beyond the scope of 'material' or angular's own components.

My open questions to you would be: Where exactly do you envision that InjectionToken to go, and what exactly do you think it should do to the output? What's your use-case?