From 5ecc5b4d07c4304cc0a248c05a08b060624c95b9 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Sat, 31 May 2025 06:29:52 -0600 Subject: [PATCH 1/3] refactor: use system level shadow color for elevation # Conflicts: # src/material/core/m2/_theming.scss --- src/material/core/_m2-app.scss | 4 +--- src/material/core/m2/_theming.scss | 2 ++ src/material/core/style/_private.scss | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/material/core/_m2-app.scss b/src/material/core/_m2-app.scss index 243b99800765..3e3d6f4f1a68 100644 --- a/src/material/core/_m2-app.scss +++ b/src/material/core/_m2-app.scss @@ -19,9 +19,7 @@ ); @for $zValue from 0 through 24 { - $elevation-color: inspection.get-theme-color($theme, foreground, elevation); - $shadow: elevation.get-box-shadow($zValue, - if($elevation-color == null, elevation.$color, $elevation-color)); + $shadow: elevation.get-box-shadow($zValue, map.get($system, shadow)); $tokens: map.set($tokens, 'app-elevation-shadow-level-#{$zValue}', $shadow); } diff --git a/src/material/core/m2/_theming.scss b/src/material/core/m2/_theming.scss index bdd7cff4cc05..854b22a6925d 100644 --- a/src/material/core/m2/_theming.scss +++ b/src/material/core/m2/_theming.scss @@ -135,6 +135,7 @@ hover-state-layer-opacity: 0.04, focus-state-layer-opacity: 0.12, pressed-state-layer-opacity: 0.12, + shadow: black, primary: map.get($primary, default), on-primary: map.get($primary, default-contrast), secondary: map.get($accent, default), @@ -167,6 +168,7 @@ hover-state-layer-opacity: 0.04, focus-state-layer-opacity: 0.12, pressed-state-layer-opacity: 0.12, + shadow: black, primary: map.get($primary, default), on-primary: map.get($primary, default-contrast), secondary: map.get($accent, default), diff --git a/src/material/core/style/_private.scss b/src/material/core/style/_private.scss index 026717998738..c2fd048b33fc 100644 --- a/src/material/core/style/_private.scss +++ b/src/material/core/style/_private.scss @@ -1,18 +1,17 @@ @use './elevation'; @use '../theming/inspection'; +@use '../tokens/m2-utils'; +@use '../tokens/m3-utils'; +@use 'sass:map'; @mixin private-theme-elevation($zValue, $theme) { - $elevation-color: inspection.get-theme-color($theme, foreground, elevation); - $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color); - - @include elevation.elevation($zValue, $elevation-color-or-default); + $system: m2-utils.get-system($theme); + @include elevation.elevation($zValue, map.get($system, shadow)); } @mixin private-theme-overridable-elevation($zValue, $theme) { - $elevation-color: inspection.get-theme-color($theme, foreground, elevation); - $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color); - - @include elevation.overridable-elevation($zValue, $elevation-color-or-default); + $system: m2-utils.get-system($theme); + @include elevation.overridable-elevation($zValue, map.get($system, shadow)); } // If the mat-animation-noop class is present on the components root element, From 0b131d1a72f54e5d72d98f722f876a1790e12e47 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Sat, 31 May 2025 06:33:48 -0600 Subject: [PATCH 2/3] refactor: fix build --- src/material/core/style/BUILD.bazel | 1 + src/material/core/style/_private.scss | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/material/core/style/BUILD.bazel b/src/material/core/style/BUILD.bazel index 663f7ffff165..906d6af56d3e 100644 --- a/src/material/core/style/BUILD.bazel +++ b/src/material/core/style/BUILD.bazel @@ -57,6 +57,7 @@ sass_library( deps = [ ":elevation", "//src/material/core/theming:_inspection", + "//src/material/core/tokens:m2_utils", ], ) diff --git a/src/material/core/style/_private.scss b/src/material/core/style/_private.scss index c2fd048b33fc..005ca8141059 100644 --- a/src/material/core/style/_private.scss +++ b/src/material/core/style/_private.scss @@ -1,7 +1,6 @@ @use './elevation'; @use '../theming/inspection'; @use '../tokens/m2-utils'; -@use '../tokens/m3-utils'; @use 'sass:map'; @mixin private-theme-elevation($zValue, $theme) { From 6d1c4d0f227e78b8f445c8121443975b7df6ee37 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Sat, 31 May 2025 06:48:51 -0600 Subject: [PATCH 3/3] refactor: lint --- src/material/core/_m2-app.scss | 1 - src/material/core/style/_private.scss | 1 - 2 files changed, 2 deletions(-) diff --git a/src/material/core/_m2-app.scss b/src/material/core/_m2-app.scss index 3e3d6f4f1a68..cf781eb6fafb 100644 --- a/src/material/core/_m2-app.scss +++ b/src/material/core/_m2-app.scss @@ -1,5 +1,4 @@ @use 'sass:map'; -@use './theming/inspection'; @use './style/elevation'; @use '../core/tokens/m2-utils'; diff --git a/src/material/core/style/_private.scss b/src/material/core/style/_private.scss index 005ca8141059..9274ce8365be 100644 --- a/src/material/core/style/_private.scss +++ b/src/material/core/style/_private.scss @@ -1,5 +1,4 @@ @use './elevation'; -@use '../theming/inspection'; @use '../tokens/m2-utils'; @use 'sass:map';