-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(multiple): convert components to theme inspection API (round…
… 4) (#27740) BREAKING CHANGE: - Themes are now more strictly validated when calling Angular Material theme mixins. For example, calling `mat.button-typography` with a theme has `typography: null` is now an error. - The `mat.legacy-typography-hierarchy` mixin has been removed in favor of `mat.typography-hierarchy`
- Loading branch information
Showing
62 changed files
with
676 additions
and
1,423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
@use '@angular/material' as mat; | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: mat.private-legacy-get-theme($theme-or-color-config); | ||
@mixin theme($theme) { | ||
@include mat.private-check-duplicate-theme-styles($theme, 'mat-selection'); | ||
} | ||
|
||
@mixin typography($config-or-theme) {} | ||
@mixin typography($theme) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
@use '../core/theming/theming'; | ||
@use '../core/theming/inspection'; | ||
@use '../core/typography/typography'; | ||
@use '../core/style/sass-utils'; | ||
@use '../core/tokens/token-utils'; | ||
@use '../core/tokens/m2/mat/autocomplete' as tokens-mat-autocomplete; | ||
|
||
@mixin color($config-or-theme) { | ||
$config: theming.get-color-config($config-or-theme); | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-autocomplete.$prefix, | ||
tokens-mat-autocomplete.get-color-tokens($config)); | ||
tokens-mat-autocomplete.get-color-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin typography($config-or-theme) {} | ||
@mixin typography($theme) {} | ||
|
||
@mixin density($config-or-theme) {} | ||
@mixin density($theme) {} | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-autocomplete') { | ||
$color: theming.get-color-config($theme); | ||
$density: theming.get-density-config($theme); | ||
$typography: theming.get-typography-config($theme); | ||
|
||
@if $color != null { | ||
@include color($color); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if $density != null { | ||
@include density($density); | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
} | ||
@if $typography != null { | ||
@include typography($typography); | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,36 @@ | ||
@use '../core/typography/typography'; | ||
@use '../core/theming/theming'; | ||
@use '../core/theming/inspection'; | ||
@use '../core/style/sass-utils'; | ||
@use '../core/tokens/token-utils'; | ||
@use '../core/tokens/m2/mat/bottom-sheet' as tokens-mat-bottom-sheet; | ||
|
||
@mixin color($config-or-theme) { | ||
$config: theming.get-color-config($config-or-theme); | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-bottom-sheet.$prefix, | ||
tokens-mat-bottom-sheet.get-color-tokens($config)); | ||
tokens-mat-bottom-sheet.get-color-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin typography($config-or-theme) { | ||
$config: typography.private-typography-to-2014-config( | ||
theming.get-typography-config($config-or-theme)); | ||
|
||
@mixin typography($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-bottom-sheet.$prefix, | ||
tokens-mat-bottom-sheet.get-typography-tokens($config)); | ||
tokens-mat-bottom-sheet.get-typography-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin density($config-or-theme) {} | ||
@mixin density($theme) {} | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-bottom-sheet') { | ||
$color: theming.get-color-config($theme); | ||
$density: theming.get-density-config($theme); | ||
$typography: theming.get-typography-config($theme); | ||
|
||
@if $color != null { | ||
@include color($color); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if $density != null { | ||
@include density($density); | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
} | ||
@if $typography != null { | ||
@include typography($typography); | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,48 @@ | ||
@use '../core/theming/theming'; | ||
@use '../core/theming/inspection'; | ||
@use '../core/typography/typography'; | ||
@use '../core/tokens/m2/mat/legacy-button-toggle' as tokens-mat-legacy-button-toggle; | ||
@use '../core/tokens/m2/mat/standard-button-toggle' as tokens-mat-standard-button-toggle; | ||
@use '../core/tokens/token-utils'; | ||
@use '../core/style/sass-utils'; | ||
|
||
@mixin color($config-or-theme) { | ||
$config: theming.get-color-config($config-or-theme); | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix, | ||
tokens-mat-legacy-button-toggle.get-color-tokens($config)); | ||
tokens-mat-legacy-button-toggle.get-color-tokens($theme)); | ||
@include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix, | ||
tokens-mat-standard-button-toggle.get-color-tokens($config)); | ||
tokens-mat-standard-button-toggle.get-color-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin typography($config-or-theme) { | ||
$config: typography.private-typography-to-2014-config( | ||
theming.get-typography-config($config-or-theme)); | ||
|
||
@mixin typography($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix, | ||
tokens-mat-legacy-button-toggle.get-typography-tokens($config)); | ||
tokens-mat-legacy-button-toggle.get-typography-tokens($theme)); | ||
@include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix, | ||
tokens-mat-standard-button-toggle.get-typography-tokens($config)); | ||
tokens-mat-standard-button-toggle.get-typography-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin density($config-or-theme) { | ||
$density-scale: theming.get-density-config($config-or-theme); | ||
|
||
@mixin density($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix, | ||
tokens-mat-legacy-button-toggle.get-density-tokens($density-scale)); | ||
tokens-mat-legacy-button-toggle.get-density-tokens($theme)); | ||
@include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix, | ||
tokens-mat-standard-button-toggle.get-density-tokens($density-scale)); | ||
tokens-mat-standard-button-toggle.get-density-tokens($theme)); | ||
} | ||
} | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button-toggle') { | ||
$color: theming.get-color-config($theme); | ||
$density: theming.get-density-config($theme); | ||
$typography: theming.get-typography-config($theme); | ||
|
||
@if $color != null { | ||
@include color($color); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if $density != null { | ||
@include density($density); | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
} | ||
@if $typography != null { | ||
@include typography($typography); | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
} | ||
} | ||
} |
Oops, something went wrong.