theming: deprecate and remove legacy theme color generation
Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Don't know if it's intended behavior or not. Scss generated by mat.define-dark-theme or mat.define-light-theme have duplicated keys/values/styles.
Notice the duplicated values for:
- primary
- accent
- warn
- is-dark
- foreground
- background
Reproduction
Steps to reproduce:
- Create new project
ng new1.1 Choose SCSS as stylesheet - Add angular material
ng add @angular/material2.1 For prebuild theme, choose custom option - In styles.scss file, add
@debug$name-of-app-theme
Expected Behavior
Should exist only one definition for
- primary
- accent
- warn
- is-dark
- foreground
- background
Actual Behavior
Below I attached the result of @debug . Take a look at primary color, for example and notice the value is repeated for no reason.
The only difference is the parenthesis before.
Environment
- Angular: 13.0.1
- CDK/Material: 13.0.0
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Setting a low priority on this, because this is only in memory, it won't result in more CSS being generated.
This is actually an intentional duplication to ensure backwards compatibility since we changed some of the internals of the theming API in preparation for density with MDC etc.
We should mark this old pattern as deprecated in an upcoming minor and remove this in the future. Here is the related code:
https://github.com/angular/components/blob/df7c46b82a7ecdfe74aad136e0c880e5631c7b7b/src/material/core/theming/_theming.scss#L388-L411
Just capturing this here: https://github.com/angular/components/pull/24835. In V15/V16 we will remove this.
@crisbeto Did we explicitly deprecate the .import and legacy theming entry-point or can we just consider this being part of the PR above?
I don't think that we've announced anywhere that the .import files are deprecated, but we haven't been exposing any new APIs through them.