Skip to content

fix(material/core): output tokens from theme under same selector #31295

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 11 additions & 9 deletions src/material/core/tokens/_m3-system.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@use '../theming/config-validation';
@use '../theming/definition';
@use '../theming/palettes';
@use '../style/sass-utils';
@use './m3';
@use 'sass:map';
@use 'sass:meta';
Expand Down Expand Up @@ -196,7 +197,7 @@
m3.md-sys-shape-values(),
m3.md-sys-state-values());

& {
@include sass-utils.current-selector-or-root {
@each $name, $value in $overrides {
@if (map.has-key($sys-names, $name)) {
--#{$prefix}-#{$name}: #{map.get($overrides, $name)};
Expand All @@ -222,7 +223,7 @@
$sys-colors: map.set($sys-colors, neutral-variant20, map.get($palettes, neutral-variant, 20));
$sys-colors: map.set($sys-colors, neutral10, map.get($palettes, neutral, 10));

& {
@include sass-utils.current-selector-or-root {
@each $name, $value in $sys-colors {
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
}
Expand Down Expand Up @@ -261,7 +262,7 @@
typography-system-variables-prefix) or definition.$system-level-prefix;
}

& {
@include sass-utils.current-selector-or-root {
@each $name, $value in m3.md-sys-typescale-values($font-definition) {
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
}
Expand All @@ -272,25 +273,26 @@
$shadow-color: map.get(
$theme, definition.$internals, palettes, neutral, 0);

@each $name, $value in m3.md-sys-elevation-values() {
$level: map.get($overrides, $name) or $value;
$value: elevation.get-box-shadow($level, $shadow-color);
& {

@include sass-utils.current-selector-or-root {
@each $name, $value in m3.md-sys-elevation-values() {
$level: map.get($overrides, $name) or $value;
$value: elevation.get-box-shadow($level, $shadow-color);
--#{$prefix}-#{$name}: #{$value};
}
}
}

@mixin system-level-shape($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
& {
@include sass-utils.current-selector-or-root {
@each $name, $value in m3.md-sys-shape-values() {
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
}
}
}

@mixin system-level-state($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
& {
@include sass-utils.current-selector-or-root {
@each $name, $value in m3.md-sys-state-values() {
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
}
Expand Down
Loading