-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(material-experimental/theming): add M3 dialog support (#28163)
(cherry picked from commit 7a1cd42)
- Loading branch information
Showing
4 changed files
with
57 additions
and
17 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,43 +1,74 @@ | ||
@use 'sass:map'; | ||
@use '@material/dialog/dialog-theme' as mdc-dialog-theme; | ||
@use '../core/style/sass-utils'; | ||
@use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog; | ||
@use '../core/theming/theming'; | ||
@use '../core/theming/inspection'; | ||
@use '../core/typography/typography'; | ||
|
||
|
||
@mixin base($theme) { | ||
// Add default values for tokens not related to color, typography, or density. | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens()); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); | ||
} | ||
@else { | ||
// Add default values for tokens not related to color, typography, or density. | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens()); | ||
} | ||
} | ||
} | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin typography($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, typography)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin density($theme) {} | ||
@mixin density($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, density)); | ||
} | ||
@else {} | ||
} | ||
|
||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($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); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin _theme-from-tokens($tokens) { | ||
@if ($tokens != ()) { | ||
@include mdc-dialog-theme.theme(map.get($tokens, tokens-mdc-dialog.$prefix)); | ||
} | ||
} |