From e10b77a56b373c91937184956243defae4c5af1b Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 30 Jul 2024 09:01:02 +0200 Subject: [PATCH] fix(material/core): custom system-level variable prefix not used in some mixins Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user. Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`. Fixes #29504. --- src/material/core/theming/_definition.scss | 2 ++ src/material/core/tokens/_m3-tokens.scss | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/material/core/theming/_definition.scss b/src/material/core/theming/_definition.scss index 2c70ea33b353..f1e1bc522e34 100644 --- a/src/material/core/theming/_definition.scss +++ b/src/material/core/theming/_definition.scss @@ -55,6 +55,7 @@ $theme-version: 1; neutral-variant: map.get($primary, neutral-variant), error: map.get($primary, error), ), + color-system-variables-prefix: $system-variables-prefix, color-tokens: m3-tokens.generate-color-tokens( $type, $primary, $tertiary, map.get($primary, error), $system-variables-prefix) ) @@ -88,6 +89,7 @@ $theme-version: 1; medium: $medium, regular: $regular, ), + typography-system-variables-prefix: $system-variables-prefix, typography-tokens: m3-tokens.generate-typography-tokens( $brand, $plain, $bold, $medium, $regular, $system-variables-prefix) ) diff --git a/src/material/core/tokens/_m3-tokens.scss b/src/material/core/tokens/_m3-tokens.scss index a4b682307619..605d6322cae0 100644 --- a/src/material/core/tokens/_m3-tokens.scss +++ b/src/material/core/tokens/_m3-tokens.scss @@ -135,7 +135,8 @@ $_cached-token-slots: null; ); $type: map.get($theme, _mat-theming-internals-do-not-access, theme-type); - $system-variables-prefix: map.get($theme, system-variables-prefix) or sys; + $system-variables-prefix: map.get($theme, _mat-theming-internals-do-not-access, + color-system-variables-prefix) or sys; $primary: map.merge(map.get($palettes, primary), $base-palettes); $tertiary: map.merge(map.get($palettes, tertiary), $base-palettes); $error: map.get($palettes, error); @@ -160,7 +161,8 @@ $_cached-token-slots: null; $bold: map.get($font-definition, bold); $medium: map.get($font-definition, medium); $regular: map.get($font-definition, regular); - $system-variables-prefix: map.get($theme, system-variables-prefix) or sys; + $system-variables-prefix: map.get($theme, _mat-theming-internals-do-not-access, + typography-system-variables-prefix) or sys; $ref: ( md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) );