feat(material): layer shipped CSS for predictable app overrides#33013
feat(material): layer shipped CSS for predictable app overrides#33013jitterbox wants to merge 2 commits intoangular:mainfrom
Conversation
- Add core/style cascade-layers API: with-cascade-layer mixin and default angular-material layer name - Extend mat.theme with optional third argument cascade-layer (default null) - Document layer ordering with CDK (cdk-overlay, cdk-resets) in theming guide - Cross-reference overlay-structure.scss and add sass/unit tests Related to angular#26451 Made-with: Cursor
|
The reason we haven't done this ourselves is that it's super breaking for our internal users and likely externally too. |
I understand that you don't want to introduce unnecessary breaking changes. But I think the advantages of CSS cascade layers (as explained in the linked issue) far outweigh the potential dangers. I think there are two main scenarios of how Angular Material components are currently used in web applications:
So I think that this PR would be a great boon for all web developers using Angular Material (myself included). |
|
@crisbeto Why not make it optional then? |
|
It's been a while since we looked at it, but I think the problem was that we can't make it optional. The styles with the |
Summary
angular-materialcascade layermat.theme-layerso app-authored theme output can participate in the same layer orderingCloses #26451.
Test plan
pnpm exec bazel test //src/material/core/theming/tests:unit_testspnpm exec bazel test //src/material/schematics:unit_testspnpm exec bazel test //src/material/slider:e2e_testspnpm exec bazel build //src/material/tabs:tabs //src/material-experimental/menubar:menubar //src/material/prebuilt-themes:azure-blue