Skip to content

refactor: remove duplicate theme style warnings #31361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,13 @@
@mixin density($theme) {}

@mixin theme($theme) {
@include mat.private-check-duplicate-theme-styles($theme, 'mat-column-resize') {
@if mat.theme-has($theme, color) {
@include color($theme);
}
@if mat.theme-has($theme, density) {
@include density($theme);
}
@if mat.theme-has($theme, typography) {
@include typography($theme);
}
@if mat.theme-has($theme, color) {
@include color($theme);
}
@if mat.theme-has($theme, density) {
@include density($theme);
}
@if mat.theme-has($theme, typography) {
@include typography($theme);
}
}
18 changes: 8 additions & 10 deletions src/material-experimental/popover-edit/_popover-edit-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@
@mixin density($theme) {}

@mixin theme($theme) {
@include mat.private-check-duplicate-theme-styles($theme, 'mat-popover-edit') {
@if mat.theme-has($theme, color) {
@include color($theme);
}
@if mat.theme-has($theme, density) {
@include density($theme);
}
@if mat.theme-has($theme, typography) {
@include typography($theme);
}
@if mat.theme-has($theme, color) {
@include color($theme);
}
@if mat.theme-has($theme, density) {
@include density($theme);
}
@if mat.theme-has($theme, typography) {
@include typography($theme);
}
}
3 changes: 0 additions & 3 deletions src/material-experimental/selection/_selection.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@use '@angular/material' as mat;

@mixin theme($theme) {
@include mat.private-check-duplicate-theme-styles($theme, 'mat-selection');
}

@mixin typography($theme) {}
3 changes: 1 addition & 2 deletions src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

// Private/Internal
@forward './core/density/private/all-density' show all-component-densities;
@forward './core/theming/theming' show private-check-duplicate-theme-styles,
private-legacy-get-theme, private-is-theme-object;
@forward './core/theming/theming' show private-legacy-get-theme, private-is-theme-object;
@forward './core/style/private' show private-theme-elevation;
@forward './core/style/vendor-prefixes' as private-* show private-user-select;
@forward './core/style/variables' as private-* show $private-swift-ease-in-duration,
Expand Down
27 changes: 12 additions & 15 deletions src/material/autocomplete/_autocomplete-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use 'sass:map';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/typography/typography';
@use '../core/tokens/token-utils';
Expand Down Expand Up @@ -57,23 +56,21 @@
}

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-autocomplete') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
29 changes: 13 additions & 16 deletions src/material/badge/_badge-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use '../core/theming/inspection';
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
@use '../core/typography/typography';
@use './m2-badge';
Expand Down Expand Up @@ -87,23 +86,21 @@
/// @param {Map} $theme The theme to generate styles for.
/// @param {String} $color-variant The color variant to use for the component
@mixin theme($theme, $color-variant: null) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-badge') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
27 changes: 12 additions & 15 deletions src/material/bottom-sheet/_bottom-sheet-theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use 'sass:map';
@use '../core/typography/typography';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/tokens/token-utils';
@use './m2-bottom-sheet';
Expand Down Expand Up @@ -57,23 +56,21 @@
}

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-bottom-sheet') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
29 changes: 13 additions & 16 deletions src/material/button-toggle/_button-toggle-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use '../core/theming/inspection';
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
@use '../core/typography/typography';
@use './m2-button-toggle';
Expand Down Expand Up @@ -74,23 +73,21 @@
/// @param {String} $color-variant: The color variant to use for the button toggle: primary,
/// secondary, tertiary, or error (If not specified, default secondary color will be used).
@mixin theme($theme, $color-variant: null) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button-toggle') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
29 changes: 13 additions & 16 deletions src/material/button/_button-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use '../core/theming/inspection';
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
@use '../core/typography/typography';
@use './m2-button';
Expand Down Expand Up @@ -94,23 +93,21 @@
/// @param {String} $color-variant: The color variant to use for the button: primary, secondary,
// tertiary, or error (If not specified, default primary color will be used).
@mixin theme($theme, $color-variant: null) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
29 changes: 13 additions & 16 deletions src/material/button/_fab-theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use './m2-fab';
@use './m3-fab';
Expand Down Expand Up @@ -92,23 +91,21 @@
/// @param {Map} $theme The theme to generate styles for.
/// @param {String} $color-variant: The color variant to use for the fab
@mixin theme($theme, $color-variant: null) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-fab') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
3 changes: 0 additions & 3 deletions src/material/button/_icon-button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@use './m2-icon-button';
@use './m3-icon-button';
@use '../core/tokens/token-utils';
@use '../core/theming/theming';
@use '../core/theming/inspection';

@mixin base($theme) {
Expand Down Expand Up @@ -125,7 +124,6 @@
/// @param {String} $color-variant: The color variant to use for the button: primary,
// secondary, tertiary, or error.
@mixin theme($theme, $color-variant: null) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-icon-button') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme, $color-variant);
Expand All @@ -141,7 +139,6 @@
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
27 changes: 12 additions & 15 deletions src/material/card/_card-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use 'sass:map';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/typography/typography';
@use '../core/tokens/token-utils';
Expand Down Expand Up @@ -57,23 +56,21 @@
}

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-card') {
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@if inspection.get-theme-version($theme) == 1 {
@include base($theme);
@include color($theme);
@include density($theme);
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
} @else {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
@if inspection.theme-has($theme, density) {
@include density($theme);
}
@if inspection.theme-has($theme, typography) {
@include typography($theme);
}
}
}
}
Loading
Loading