|
| 1 | +@use '../../../style/elevation'; |
| 2 | +@use '../../../theming/inspection'; |
| 3 | +@use '../../../style/sass-utils'; |
| 4 | +@use '../../token-definition'; |
| 5 | + |
| 6 | +// The prefix used to generate the fully qualified name for tokens in this file. |
| 7 | +$prefix: (mdc, filled-card); |
| 8 | + |
| 9 | +// Tokens that can't be configured through Angular Material's current theming API, |
| 10 | +// but may be in a future version of the theming API. |
| 11 | +// |
| 12 | +// Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`. |
| 13 | +// `null` indicates that we are intentionally choosing not to emit a slot or value for the token in |
| 14 | +// our CSS. |
| 15 | +@function get-unthemable-tokens() { |
| 16 | + @return ( |
| 17 | + // The border-radius of the card. |
| 18 | + container-shape: 4px, |
| 19 | + // ============================================================================================= |
| 20 | + // = TOKENS NOT USED IN ANGULAR MATERIAL = |
| 21 | + // ============================================================================================= |
| 22 | + // Angular Material's card is not an interactive element, and therefore does not support states. |
| 23 | + disabled-container-elevation: null, |
| 24 | + disabled-outline-color: null, |
| 25 | + disabled-outline-opacity: null, |
| 26 | + dragged-container-elevation: null, |
| 27 | + dragged-outline-color: null, |
| 28 | + dragged-state-layer-color: null, |
| 29 | + dragged-state-layer-opacity: null, |
| 30 | + focus-container-elevation: null, |
| 31 | + focus-outline-color: null, |
| 32 | + focus-state-layer-color: null, |
| 33 | + focus-state-layer-opacity: null, |
| 34 | + hover-container-elevation: null, |
| 35 | + hover-outline-color: null, |
| 36 | + hover-state-layer-color: null, |
| 37 | + hover-state-layer-opacity: null, |
| 38 | + pressed-container-elevation: null, |
| 39 | + pressed-outline-color: null, |
| 40 | + pressed-state-layer-color: null, |
| 41 | + pressed-state-layer-opacity: null, |
| 42 | + container-shadow-color: null, |
| 43 | + // Angular Material does not currently support surface tint. |
| 44 | + container-surface-tint-layer-color: null, |
| 45 | + // MDC does not seem to use these tokens. |
| 46 | + icon-color: null, |
| 47 | + icon-size: null, |
| 48 | + ); |
| 49 | +} |
| 50 | + |
| 51 | +// Tokens that can be configured through Angular Material's color theming API. |
| 52 | +@function get-color-tokens($theme) { |
| 53 | + $elevation: inspection.get-theme-color($theme, foreground, elevation); |
| 54 | + |
| 55 | + @return ( |
| 56 | + // The background color of the card. |
| 57 | + container-color: inspection.get-theme-color($theme, background, card), |
| 58 | + container-elevation: elevation.get-box-shadow(0), |
| 59 | + ); |
| 60 | +} |
| 61 | + |
| 62 | +// Tokens that can be configured through Angular Material's typography theming API. |
| 63 | +@function get-typography-tokens($theme) { |
| 64 | + @return (); |
| 65 | +} |
| 66 | + |
| 67 | +// Tokens that can be configured through Angular Material's density theming API. |
| 68 | +@function get-density-tokens($theme) { |
| 69 | + @return (); |
| 70 | +} |
| 71 | + |
| 72 | +// Combines the tokens generated by the above functions into a single map with placeholder values. |
| 73 | +// This is used to create token slots. |
| 74 | +@function get-token-slots() { |
| 75 | + @return sass-utils.deep-merge-all( |
| 76 | + get-unthemable-tokens(), |
| 77 | + get-color-tokens(token-definition.$placeholder-color-config), |
| 78 | + get-typography-tokens(token-definition.$placeholder-typography-config), |
| 79 | + get-density-tokens(token-definition.$placeholder-density-config) |
| 80 | + ); |
| 81 | +} |
0 commit comments