Skip to content

refactor: rename mdc- prefixed tokens/variables to mat- #30677

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
Mar 27, 2025
Merged
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
@@ -2,7 +2,7 @@
// within the scene bounds.
.mat-mdc-snack-bar-container {
margin: 8px !important;
--mdc-snackbar-container-color: red;
--mat-snackbar-container-color: red;
color: rgba(white, 0.87) !important;

button {
9 changes: 5 additions & 4 deletions src/material/button/_icon-button-theme.scss
Original file line number Diff line number Diff line change
@@ -108,14 +108,15 @@
// Match the styles that used to be present. This is necessary for backwards
// compat to match the previous implementations selector count (two classes).
--mdc-icon-button-state-layer-size: #{$calculated-size};
--mat-icon-button-state-layer-size: #{$calculated-size};

// TODO: Switch calculated-size to "var(--mdc-icon-button-state-layer-size)"
// TODO: Switch calculated-size to "var(--mat-icon-button-state-layer-size)"
// Currently fails validation because the variable is "undefined"
// in the sass stack.
// TODO: Switch icon-size to "var(--mdc-icon-button-icon-size)". Currently
// TODO: Switch icon-size to "var(--mat-icon-button-icon-size)". Currently
// fails validation because the variable is "undefined" in the sass stack.
width: var(--mdc-icon-button-state-layer-size);
height: var(--mdc-icon-button-state-layer-size);
width: var(--mat-icon-button-state-layer-size);
height: var(--mat-icon-button-state-layer-size);
padding: math.div($calculated-size - $icon-size, 2);
}
}
2 changes: 1 addition & 1 deletion src/material/chips/chip.scss
Original file line number Diff line number Diff line change
@@ -629,7 +629,7 @@ $_avatar-trailing-padding: 8px;

// Technically the avatar is only supposed to have an image, but we also allow for icons.
// Set the color so the icons inherit the correct color.
color: var(--mdc-chip-with-icon-icon-color, currentColor);
color: var(--mat-chip-with-icon-icon-color, currentColor);
}

// Required for the strong focus indicator to fill the chip.
4 changes: 2 additions & 2 deletions src/material/core/theming/_definition.scss
Original file line number Diff line number Diff line change
@@ -7,12 +7,12 @@
@use './config-validation';

// Prefix used for component token fallback variables, e.g.
// `color: var(--mdc-text-button-label-text-color, var(--mat-sys-primary));`
// `color: var(--mat-text-button-label-text-color, var(--mat-sys-primary));`
$system-fallback-prefix: mat-sys;

// Default system level prefix to use when directly calling the `system-level-*` mixins.
// Prefix used for component token fallback variables, e.g.
// `color: var(--mdc-text-button-label-text-color, var(--mat-sys-primary));`
// `color: var(--mat-text-button-label-text-color, var(--mat-sys-primary));`
// TODO: Remove this variable after internal clients are migrated from "sys"
$system-level-prefix: mat-sys;

4 changes: 2 additions & 2 deletions src/material/core/theming/_inspection.scss
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
@if not theme-has($theme, color) {
@error 'Color information is not available on this theme.';
}
$color-roles: map.get($theme, $_internals, color-tokens, (mdc, theme));
$color-roles: map.get($theme, $_internals, color-tokens, (mat, theme));
$result: map.get($color-roles, $color-role-name);
@if not $result {
@error #{'Valid color roles are: #{map.keys($color-roles)}. Got:'} $color-role-name;
@@ -185,7 +185,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
font-weight: '-weight'
), $property);
$token-name: '#{$typescale}#{$property-key}';
@return map.get($theme, $_internals, typography-tokens, (mdc, typography), $token-name);
@return map.get($theme, $_internals, typography-tokens, (mat, typography), $token-name);
}
@else {
@error #{'Unrecognized theme version:'} $version;
10 changes: 5 additions & 5 deletions src/material/core/theming/tests/m3-theme.spec.ts
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ describe('M3 theme', () => {
}
`);

expect(css).toContain('--mdc-checkbox-selected-checkmark-color: magenta');
expect(css).toContain('--mat-checkbox-selected-checkmark-color: magenta');
expectNoWarning(/`selected-checkmark-color` is deprecated/);
});

@@ -162,8 +162,8 @@ describe('M3 theme', () => {
}
`);

expect(css).toContain('--mdc-filled-text-field-caret-color: magenta');
expect(css).not.toContain('--mdc-outline-text-field-caret-color: magenta');
expect(css).toContain('--mat-filled-text-field-caret-color: magenta');
expect(css).not.toContain('--mat-outline-text-field-caret-color: magenta');
expectNoWarning(/`filled-caret-color` is deprecated/);
});

@@ -174,8 +174,8 @@ describe('M3 theme', () => {
}
`);

expect(css).toContain('--mdc-filled-text-field-caret-color: magenta');
expect(css).toContain('--mdc-outlined-text-field-caret-color: magenta');
expect(css).toContain('--mat-filled-text-field-caret-color: magenta');
expect(css).toContain('--mat-outlined-text-field-caret-color: magenta');
expectWarning(
/Token `caret-color` is deprecated. Please use one of the following alternatives: filled-caret-color, outlined-caret-color/,
);
18 changes: 9 additions & 9 deletions src/material/core/theming/tests/theming-definition-api.spec.ts
Original file line number Diff line number Diff line change
@@ -111,10 +111,10 @@ describe('theming definition api', () => {
));
$data: map.get($theme, $internals);
:root {
--token-surface: #{map.get($data, color-tokens, (mdc, theme), surface)};
--token-primary: #{map.get($data, color-tokens, (mdc, theme), primary)};
--token-secondary: #{map.get($data, color-tokens, (mdc, theme), secondary)};
--token-tertiary: #{map.get($data, color-tokens, (mdc, theme), tertiary)};
--token-surface: #{map.get($data, color-tokens, (mat, theme), surface)};
--token-primary: #{map.get($data, color-tokens, (mat, theme), primary)};
--token-secondary: #{map.get($data, color-tokens, (mat, theme), secondary)};
--token-tertiary: #{map.get($data, color-tokens, (mat, theme), tertiary)};
--palette-primary: #{map.get($data, palettes, primary, 50)};
--palette-secondary: #{map.get($data, palettes, secondary, 50)};
--palette-tertiary: #{map.get($data, palettes, tertiary, 50)};
@@ -146,13 +146,13 @@ describe('theming definition api', () => {
$data: map.get($theme, $internals);
:root {
--display-font:
#{map.get($data, typography-tokens, (mdc, typography), display-large-font)};
#{map.get($data, typography-tokens, (mat, typography), display-large-font)};
--display-weight:
#{map.get($data, typography-tokens, (mdc, typography), display-large-weight)};
#{map.get($data, typography-tokens, (mat, typography), display-large-weight)};
--title-font:
#{map.get($data, typography-tokens, (mdc, typography), title-small-font)};
#{map.get($data, typography-tokens, (mat, typography), title-small-font)};
--title-weight:
#{map.get($data, typography-tokens, (mdc, typography), title-small-weight)};
#{map.get($data, typography-tokens, (mat, typography), title-small-weight)};
}
`);
const vars = getRootVars(css);
@@ -171,7 +171,7 @@ describe('theming definition api', () => {
));
$data: map.get($theme, $internals);
:root {
--size: #{map.get($data, density-tokens, (mdc, checkbox), state-layer-size)};
--size: #{map.get($data, density-tokens, (mat, checkbox), state-layer-size)};
}
`);
const vars = getRootVars(css);
Loading
Loading