From f88d9f1f229a28633ee1e0484e45e12810d23a54 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Tue, 3 Oct 2023 21:09:52 +0000 Subject: [PATCH] fix(material/menu): move unthemable tokens to theme mixin Though these tokens are not currently affected by the theme, in the future they will be affected by the design system used for theming (M2 or M3) BREAKING CHANGE: There are new styles emitted by mat.menu-theme that are not emitted by any of: mat.menu-color, mat.menu-typography, mat.menu-density. If you rely on the partial mixins only and don't call mat.menu-theme, you can add mat.menu-base to get the missing styles. --- src/material/_index.scss | 2 +- src/material/menu/_menu-theme.scss | 8 ++++++++ src/material/menu/menu.scss | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/material/_index.scss b/src/material/_index.scss index 10e11d74c54e..ae6efc5dfa18 100644 --- a/src/material/_index.scss +++ b/src/material/_index.scss @@ -102,7 +102,7 @@ input-density; @forward './list/list-theme' as list-* show list-theme, list-color, list-typography, list-density, list-base; -@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density; +@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density, menu-base; @forward './paginator/paginator-theme' as paginator-* show paginator-theme, paginator-color, paginator-typography, paginator-density; @forward './progress-bar/progress-bar-theme' as progress-bar-* show diff --git a/src/material/menu/_menu-theme.scss b/src/material/menu/_menu-theme.scss index 7d1213f1e4dc..653d98230772 100644 --- a/src/material/menu/_menu-theme.scss +++ b/src/material/menu/_menu-theme.scss @@ -5,6 +5,13 @@ @use '../core/theming/inspection'; @use '../core/typography/typography'; +@mixin base($theme) { + @include sass-utils.current-selector-or-root() { + @include token-utils.create-token-values(tokens-mat-menu.$prefix, + tokens-mat-menu.get-unthemable-tokens()); + } +} + @mixin color($theme) { @include sass-utils.current-selector-or-root() { @include token-utils.create-token-values(tokens-mat-menu.$prefix, @@ -23,6 +30,7 @@ @mixin theme($theme) { @include theming.private-check-duplicate-theme-styles($theme, 'mat-menu') { + @include base($theme); @if inspection.theme-has($theme, color) { @include color($theme); } diff --git a/src/material/menu/menu.scss b/src/material/menu/menu.scss index 5a6e2da18395..bd608743bee1 100644 --- a/src/material/menu/menu.scss +++ b/src/material/menu/menu.scss @@ -33,8 +33,6 @@ mat-menu { } .mat-mdc-menu-panel { - @include token-utils.create-token-values(tokens-mat-menu.$prefix, - tokens-mat-menu.get-unthemable-tokens()); @include menu-common.base; box-sizing: border-box; outline: 0;