-
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 sidenav support
- Loading branch information
Showing
6 changed files
with
79 additions
and
23 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
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,38 +1,71 @@ | ||
@use 'sass:map'; | ||
@use '../core/theming/theming'; | ||
@use '../core/theming/inspection'; | ||
@use '../core/tokens/m2/mat/sidenav' as tokens-mat-sidenav; | ||
@use '../core/tokens/token-utils'; | ||
@use '../core/style/sass-utils'; | ||
|
||
@mixin base($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values( | ||
tokens-mat-sidenav.$prefix, tokens-mat-sidenav.get-unthemable-tokens()); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values( | ||
tokens-mat-sidenav.$prefix, tokens-mat-sidenav.get-unthemable-tokens()); | ||
} | ||
} | ||
} | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-sidenav.$prefix, | ||
tokens-mat-sidenav.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 token-utils.create-token-values(tokens-mat-sidenav.$prefix, | ||
tokens-mat-sidenav.get-color-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin typography($theme) {} | ||
@mixin typography($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, typography)); | ||
} | ||
@else {} | ||
} | ||
|
||
@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-sidenav') { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($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); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin _theme-from-tokens($tokens) { | ||
@if ($tokens != ()) { | ||
@include token-utils.create-token-values( | ||
tokens-mat-sidenav.$prefix, map.get($tokens, tokens-mat-sidenav.$prefix)); | ||
} | ||
} |