Skip to content
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
38 changes: 16 additions & 22 deletions src/material/autocomplete/_autocomplete-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,44 @@
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/typography/typography';
@use '../core/style/sass-utils';
@use '../core/tokens/token-utils';
@use 'm2-autocomplete';
@use 'm3-autocomplete';

@mixin base($theme) {
$tokens: m2-autocomplete.get-unthemable-tokens();
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-autocomplete.get-tokens($theme), base));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-autocomplete.get-unthemable-tokens());
}
$tokens: map.get(m3-autocomplete.get-tokens($theme), base);
}

@include token-utils.values($tokens);
}

@mixin color($theme) {
$tokens: m2-autocomplete.get-color-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-autocomplete.get-tokens($theme), color));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-autocomplete.get-color-tokens($theme));
}
$tokens: map.get(m3-autocomplete.get-tokens($theme), color);
}

@include token-utils.values($tokens);
}

@mixin typography($theme) {
$tokens: m2-autocomplete.get-typography-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-autocomplete.get-tokens($theme), typography));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-autocomplete.get-typography-tokens($theme));
}
$tokens: map.get(m3-autocomplete.get-tokens($theme), typography);
}

@include token-utils.values($tokens);
}

@mixin density($theme) {
$tokens: m2-autocomplete.get-density-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-autocomplete.get-tokens($theme), density));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-autocomplete.get-density-tokens($theme));
}
$tokens: map.get(m3-autocomplete.get-tokens($theme), density);
}

@include token-utils.values($tokens);
}

/// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
Expand Down
50 changes: 22 additions & 28 deletions src/material/badge/_badge-theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use '../core/style/sass-utils';
@use '../core/theming/inspection';
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
Expand All @@ -12,14 +11,12 @@
/// for the mat-badge.
/// @param {Map} $theme The theme to generate base styles for.
@mixin base($theme) {
$tokens: m2-badge.get-unthemable-tokens();
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-badge.get-tokens($theme), base));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-badge.get-unthemable-tokens()
);
}
$tokens: map.get(m3-badge.get-tokens($theme), base);
}

@include token-utils.values($tokens);
}

/// Outputs color theme styles for the mat-badge.
Expand All @@ -28,49 +25,46 @@
/// the badge: primary, secondary, tertiary, or error (If not specified,
/// default error color will be used).
@mixin color($theme, $color-variant: null) {
$tokens: m2-badge.get-color-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-badge.get-tokens($theme, $color-variant), color));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-badge.get-color-tokens($theme));
}
$tokens: map.get(m3-badge.get-tokens($theme, $color-variant), color);
}

@include token-utils.values($tokens);

@if inspection.get-theme-version($theme) != 1 {
.mat-badge-accent {
@include token-utils.create-token-values-mixed(
m2-badge.private-get-color-palette-color-tokens($theme, secondary)
);
$tokens: m2-badge.private-get-color-palette-color-tokens($theme, secondary);
@include token-utils.values($tokens);
}

.mat-badge-warn {
@include token-utils.create-token-values-mixed(
m2-badge.private-get-color-palette-color-tokens($theme, error)
);
$tokens: m2-badge.private-get-color-palette-color-tokens($theme, error);
@include token-utils.values($tokens);
}
}
}

/// Outputs typography theme styles for the mat-badge.
/// @param {Map} $theme The theme to generate typography styles for.
@mixin typography($theme) {
$tokens: m2-badge.get-typography-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-badge.get-tokens($theme), typography));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-badge.get-typography-tokens($theme)
);
}
$tokens: map.get(m3-badge.get-tokens($theme), typography);
}

@include token-utils.values($tokens);
}

/// Outputs density theme styles for the mat-badge.
/// @param {Map} $theme The theme to generate density styles for.
@mixin density($theme) {
$tokens: m2-badge.get-density-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-badge.get-tokens($theme), density));
} @else {
$tokens: map.get(m3-badge.get-tokens($theme), density);
}

@include token-utils.values($tokens);
}

/// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
Expand Down
41 changes: 16 additions & 25 deletions src/material/bottom-sheet/_bottom-sheet-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,44 @@
@use '../core/typography/typography';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/style/sass-utils';
@use '../core/tokens/token-utils';
@use './m2-bottom-sheet';
@use './m3-bottom-sheet';

@mixin base($theme) {
$tokens: m2-bottom-sheet.get-unthemable-tokens();
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-bottom-sheet.get-tokens($theme), base));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-bottom-sheet.get-unthemable-tokens());
}
$tokens: map.get(m3-bottom-sheet.get-tokens($theme), base);
}

@include token-utils.values($tokens);
}

@mixin color($theme) {
$tokens: m2-bottom-sheet.get-color-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-bottom-sheet.get-tokens($theme), color));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-bottom-sheet.get-color-tokens($theme)
);
}
$tokens: map.get(m3-bottom-sheet.get-tokens($theme), color);
}

@include token-utils.values($tokens);
}

@mixin typography($theme) {
$tokens: m2-bottom-sheet.get-typography-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-bottom-sheet.get-tokens($theme), typography));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-bottom-sheet.get-typography-tokens($theme)
);
}
$tokens: map.get(m3-bottom-sheet.get-tokens($theme), typography);
}

@include token-utils.values($tokens);
}

@mixin density($theme) {
$tokens: m2-bottom-sheet.get-density-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-bottom-sheet.get-tokens($theme), density));
} @else {
$tokens: map.get(m3-bottom-sheet.get-tokens($theme), density);
}

@include token-utils.values($tokens);
}

/// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
Expand Down
44 changes: 16 additions & 28 deletions src/material/button-toggle/_button-toggle-theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@use '../core/style/sass-utils';
@use '../core/theming/inspection';
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
Expand All @@ -11,58 +10,47 @@
/// for the mat-button-toggle.
/// @param {Map} $theme The theme to generate base styles for.
@mixin base($theme) {
$tokens: m2-button-toggle.get-unthemable-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(map.get(m3-button-toggle.get-tokens($theme), base));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-button-toggle.get-unthemable-tokens($theme));
}
$tokens: map.get(m3-button-toggle.get-tokens($theme), base);
}

@include token-utils.values($tokens);
}

/// Outputs color theme styles for the mat-button-toggle.
/// @param {Map} $theme The theme to generate color styles for.
/// @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 color($theme, $color-variant: null) {
$tokens: m2-button-toggle.get-color-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-button-toggle.get-tokens($theme, $color-variant), color));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-button-toggle.get-color-tokens($theme)
);
}
$tokens: map.get(m3-button-toggle.get-tokens($theme, $color-variant), color);
}

@include token-utils.values($tokens);
}

/// Outputs typography theme styles for the mat-button-toggle.
/// @param {Map} $theme The theme to generate typography styles for.
@mixin typography($theme) {
$tokens: m2-button-toggle.get-typography-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-button-toggle.get-tokens($theme), typography));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(
m2-button-toggle.get-typography-tokens($theme));
}
$tokens: map.get(m3-button-toggle.get-tokens($theme), typography);
}

@include token-utils.values($tokens);
}

/// Outputs density theme styles for the mat-button-toggle.
/// @param {Map} $theme The theme to generate density styles for.
@mixin density($theme) {
$tokens: m2-button-toggle.get-density-tokens($theme);
@if inspection.get-theme-version($theme) == 1 {
@include token-utils.create-token-values(
map.get(m3-button-toggle.get-tokens($theme), density));
} @else {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values-mixed(m2-button-toggle.get-density-tokens($theme));
}
$tokens: map.get(m3-button-toggle.get-tokens($theme), density);
}

@include token-utils.values($tokens);
}

/// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
Expand Down
Loading
Loading