diff --git a/src/material/_index.scss b/src/material/_index.scss index 994fa88cf21d..ad196cd60f1b 100644 --- a/src/material/_index.scss +++ b/src/material/_index.scss @@ -17,7 +17,6 @@ @forward './core/theming/theming' as private-* show private-clamp-density; @forward './core/typography/typography' show typography-hierarchy; @forward './core/typography/typography-utils' show font-shorthand; -@forward 'core/tokens/m2-tokens' show m2-tokens-from-theme; @forward './core/tokens/m3-system' show system-level-colors, system-level-typography, system-level-elevation, system-level-shape, system-level-motion, system-level-state, theme, theme-overrides; diff --git a/src/material/core/BUILD.bazel b/src/material/core/BUILD.bazel index 464cf8261e5e..9324bbaaf9cc 100644 --- a/src/material/core/BUILD.bazel +++ b/src/material/core/BUILD.bazel @@ -86,6 +86,7 @@ sass_library( "_core-theme.scss", ], deps = [ + ":m2", "//src/material/core:ripple_sass_theme", "//src/material/core/option:theme", "//src/material/core/selection/pseudo-checkbox:sass_theme", diff --git a/src/material/core/option/BUILD.bazel b/src/material/core/option/BUILD.bazel index 7313d8ef22c7..2f6117f4547e 100644 --- a/src/material/core/option/BUILD.bazel +++ b/src/material/core/option/BUILD.bazel @@ -35,6 +35,7 @@ sass_library( "_option-theme.scss", ], deps = [ + ":m2", "//src/material/core/style:sass_utils", "//src/material/core/theming", "//src/material/core/theming:_inspection", diff --git a/src/material/core/selection/pseudo-checkbox/BUILD.bazel b/src/material/core/selection/pseudo-checkbox/BUILD.bazel index 7fa6756d4d92..744a69374472 100644 --- a/src/material/core/selection/pseudo-checkbox/BUILD.bazel +++ b/src/material/core/selection/pseudo-checkbox/BUILD.bazel @@ -48,6 +48,7 @@ sass_library( "_pseudo-checkbox-theme.scss", ], deps = [ + ":m2", "//src/material/core/style:sass_utils", "//src/material/core/theming", "//src/material/core/theming:_inspection", diff --git a/src/material/core/tokens/BUILD.bazel b/src/material/core/tokens/BUILD.bazel index 7e91512f1b42..2a5ba76e40be 100644 --- a/src/material/core/tokens/BUILD.bazel +++ b/src/material/core/tokens/BUILD.bazel @@ -48,7 +48,6 @@ sass_library( srcs = ["_m3-tokens.scss"], deps = [ ":format_tokens", - ":m2_tokens", "//src/material/autocomplete:m3", "//src/material/badge:m3", "//src/material/bottom-sheet:m3", @@ -93,52 +92,3 @@ sass_library( "//src/material/tree:m3", ], ) - -sass_library( - name = "m2_tokens", - srcs = ["_m2-tokens.scss"], - deps = [ - ":format_tokens", - "//src/material/autocomplete:m2", - "//src/material/badge:m2", - "//src/material/bottom-sheet:m2", - "//src/material/button:m2", - "//src/material/button-toggle:m2", - "//src/material/card:m2", - "//src/material/checkbox:m2", - "//src/material/chips:m2", - "//src/material/core:m2", - "//src/material/core:ripple_m2", - "//src/material/core/m2:m2_sass", - "//src/material/core/option:m2", - "//src/material/core/selection/pseudo-checkbox:m2", - "//src/material/core/style:sass_utils", - "//src/material/core/theming", - "//src/material/datepicker:m2", - "//src/material/dialog:m2", - "//src/material/divider:m2", - "//src/material/expansion:m2", - "//src/material/form-field:m2", - "//src/material/grid-list:m2", - "//src/material/icon:m2", - "//src/material/list:m2", - "//src/material/menu:m2", - "//src/material/paginator:m2", - "//src/material/progress-bar:m2", - "//src/material/progress-spinner:m2", - "//src/material/radio:m2", - "//src/material/select:m2", - "//src/material/sidenav:m2", - "//src/material/slide-toggle:m2", - "//src/material/slider:m2", - "//src/material/snack-bar:m2", - "//src/material/sort:m2", - "//src/material/stepper:m2", - "//src/material/table:m2", - "//src/material/tabs:m2", - "//src/material/timepicker:m2", - "//src/material/toolbar:m2", - "//src/material/tooltip:m2", - "//src/material/tree:m2", - ], -) diff --git a/src/material/core/tokens/_m2-tokens.scss b/src/material/core/tokens/_m2-tokens.scss deleted file mode 100644 index b7af3fa4a84c..000000000000 --- a/src/material/core/tokens/_m2-tokens.scss +++ /dev/null @@ -1,131 +0,0 @@ -@use '../../autocomplete/m2-autocomplete'; -@use '../../badge/m2-badge'; -@use '../../bottom-sheet/m2-bottom-sheet'; -@use '../../button-toggle/m2-button-toggle'; -@use '../../button/m2-button'; -@use '../../button/m2-fab'; -@use '../../button/m2-icon-button'; -@use '../../card/m2-card'; -@use '../../checkbox/m2-checkbox'; -@use '../../chips/m2-chip'; -@use '../../datepicker/m2-datepicker'; -@use '../../dialog/m2-dialog'; -@use '../../divider/m2-divider'; -@use '../../expansion/m2-expansion'; -@use '../../form-field/m2-form-field'; -@use '../../grid-list/m2-grid-list'; -@use '../../icon/m2-icon'; -@use '../../list/m2-list'; -@use '../../menu/m2-menu'; -@use '../../paginator/m2-paginator'; -@use '../../progress-bar/m2-progress-bar'; -@use '../../progress-spinner/m2-progress-spinner'; -@use '../../radio/m2-radio'; -@use '../../select/m2-select'; -@use '../../sidenav/m2-sidenav'; -@use '../../slide-toggle/m2-slide-toggle'; -@use '../../slider/m2-slider'; -@use '../../snack-bar/m2-snack-bar'; -@use '../../sort/m2-sort'; -@use '../../stepper/m2-stepper'; -@use '../../table/m2-table'; -@use '../../tabs/m2-tabs'; -@use '../../timepicker/m2-timepicker'; -@use '../../toolbar/m2-toolbar'; -@use '../../tooltip/m2-tooltip'; -@use '../../tree/m2-tree'; -@use '../m2-app'; -@use '../option/m2-optgroup'; -@use '../option/m2-option'; -@use '../ripple/m2-ripple'; -@use '../selection/pseudo-checkbox/m2-pseudo-checkbox'; -@use '../style/sass-utils'; -@use '../theming/inspection'; -@use 'sass:map'; -@use 'sass:meta'; - -/// Gets the tokens for the given theme, m2 tokens module, and theming system. -/// @param {Map} $theme The Angular Material theme object to generate token values from. -/// @param {String} $module The Sass module containing the token getter functions. -/// @param {String} $system The theming system to get tokens for. Valid values are: unthemable, -/// color, typography, density. -/// @return {Map} The token map by calling the token getter for the given system in the given module -/// with the given Angular Material theme. Token names are not fully-qualified. -@function _get-tokens-for-module-and-system($theme, $module, $system) { - @if $system == unthemable { - @return meta.call(meta.get-function(get-#{$system}-tokens, $module: $module)); - } - @if not inspection.theme-has($theme, $system) { - @return (); - } - @return meta.call(meta.get-function(get-#{$system}-tokens, $module: $module), $theme); -} - -/// Gets the fully qualified tokens map for the given theme and m2 tokens module. -/// @param {Map} $theme The Angular Material theme object to generate token values from. -/// @param {String} $module The Sass module containing the token getter functions. -/// @return {Map} The token map by calling the token getters in the given module with the given -/// Angular Material theme. Token names are fully-qualified. -@function _get-tokens-for-module($theme, $module) { - $tokens: sass-utils.deep-merge-all( - _get-tokens-for-module-and-system($theme, $module, unthemable), - _get-tokens-for-module-and-system($theme, $module, color), - _get-tokens-for-module-and-system($theme, $module, typography), - _get-tokens-for-module-and-system($theme, $module, density) - ); - @return map.set((), map.get(meta.module-variables($module), prefix), $tokens); -} - -/// Gets the full set of M2 tokens for the given theme object. -/// @param {Map} $theme The Angular Material theme object to generate token values from. -/// @return {Map} The token map for the given Angular Material theme. Returned format: -/// ( -/// (fully, qualified, namespace): ( -/// token: value -/// ) -/// ) -@function m2-tokens-from-theme($theme) { - @return sass-utils.deep-merge-all( - _get-tokens-for-module($theme, m2-app), - _get-tokens-for-module($theme, m2-autocomplete), - _get-tokens-for-module($theme, m2-badge), - _get-tokens-for-module($theme, m2-bottom-sheet), - _get-tokens-for-module($theme, m2-button), - _get-tokens-for-module($theme, m2-button-toggle), - _get-tokens-for-module($theme, m2-card), - _get-tokens-for-module($theme, m2-checkbox), - _get-tokens-for-module($theme, m2-chip), - _get-tokens-for-module($theme, m2-datepicker), - _get-tokens-for-module($theme, m2-dialog), - _get-tokens-for-module($theme, m2-divider), - _get-tokens-for-module($theme, m2-expansion), - _get-tokens-for-module($theme, m2-fab), - _get-tokens-for-module($theme, m2-form-field), - _get-tokens-for-module($theme, m2-grid-list), - _get-tokens-for-module($theme, m2-icon), - _get-tokens-for-module($theme, m2-icon-button), - _get-tokens-for-module($theme, m2-list), - _get-tokens-for-module($theme, m2-menu), - _get-tokens-for-module($theme, m2-optgroup), - _get-tokens-for-module($theme, m2-option), - _get-tokens-for-module($theme, m2-paginator), - _get-tokens-for-module($theme, m2-progress-bar), - _get-tokens-for-module($theme, m2-progress-spinner), - _get-tokens-for-module($theme, m2-pseudo-checkbox), - _get-tokens-for-module($theme, m2-radio), - _get-tokens-for-module($theme, m2-ripple), - _get-tokens-for-module($theme, m2-select), - _get-tokens-for-module($theme, m2-sidenav), - _get-tokens-for-module($theme, m2-slide-toggle), - _get-tokens-for-module($theme, m2-slider), - _get-tokens-for-module($theme, m2-snack-bar), - _get-tokens-for-module($theme, m2-sort), - _get-tokens-for-module($theme, m2-stepper), - _get-tokens-for-module($theme, m2-tabs), - _get-tokens-for-module($theme, m2-table), - _get-tokens-for-module($theme, m2-timepicker), - _get-tokens-for-module($theme, m2-toolbar), - _get-tokens-for-module($theme, m2-tooltip), - _get-tokens-for-module($theme, m2-tree), - ); -} diff --git a/src/material/form-field/BUILD.bazel b/src/material/form-field/BUILD.bazel index ccfdbc352d11..9b2d6f066816 100644 --- a/src/material/form-field/BUILD.bazel +++ b/src/material/form-field/BUILD.bazel @@ -39,6 +39,7 @@ sass_library( "_form-field-theme.scss", ], deps = [ + ":m2", "//src/material/core/style:sass_utils", "//src/material/core/theming", "//src/material/core/theming:_inspection", diff --git a/src/material/list/BUILD.bazel b/src/material/list/BUILD.bazel index ac1f11f3beeb..25548029ac75 100644 --- a/src/material/list/BUILD.bazel +++ b/src/material/list/BUILD.bazel @@ -42,12 +42,14 @@ sass_library( ], deps = [ ":m2", + "//src/material/checkbox:m2", "//src/material/core/style:sass_utils", "//src/material/core/theming", "//src/material/core/theming:_inspection", "//src/material/core/theming:_validation", "//src/material/core/tokens:token_utils", "//src/material/core/typography", + "//src/material/radio:m2", ], ) diff --git a/src/material/tabs/BUILD.bazel b/src/material/tabs/BUILD.bazel index e1125c36b23b..def50ed2cabb 100644 --- a/src/material/tabs/BUILD.bazel +++ b/src/material/tabs/BUILD.bazel @@ -18,6 +18,7 @@ sass_library( ], deps = [ "//src/material/core/style:sass_utils", + "//src/material/core/theming:_inspection", "//src/material/core/tokens:m3_utils", ], ) @@ -41,6 +42,7 @@ sass_library( "_tabs-theme.scss", ], deps = [ + ":m2", "//src/material/core/style:sass_utils", "//src/material/core/theming", "//src/material/core/theming:_inspection",