123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- @use 'sass:map';
- @use '../core/tokens/m2/mat/table' as tokens-mat-table;
- @use '../core/theming/theming';
- @use '../core/theming/inspection';
- @use '../core/theming/validation';
- @use '../core/typography/typography';
- @use '../core/tokens/token-utils';
- @use '../core/style/sass-utils';
- @mixin base($theme) {
- @if inspection.get-theme-version($theme) == 1 {
- @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
- } @else {
- @include sass-utils.current-selector-or-root() {
- @include token-utils.create-token-values(
- tokens-mat-table.$prefix,
- tokens-mat-table.get-unthemable-tokens()
- );
- }
- }
- }
- @mixin color($theme) {
- @if inspection.get-theme-version($theme) == 1 {
- @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
- } @else {
- @include sass-utils.current-selector-or-root() {
- @include token-utils.create-token-values(
- tokens-mat-table.$prefix,
- tokens-mat-table.get-color-tokens($theme)
- );
- }
- }
- }
- @mixin typography($theme) {
- @if inspection.get-theme-version($theme) == 1 {
- @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
- } @else {
- @include sass-utils.current-selector-or-root() {
- @include token-utils.create-token-values(
- tokens-mat-table.$prefix,
- tokens-mat-table.get-typography-tokens($theme)
- );
- }
- }
- }
- @mixin density($theme) {
- @if inspection.get-theme-version($theme) == 1 {
- @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
- } @else {
- @include sass-utils.current-selector-or-root() {
- @include token-utils.create-token-values(
- tokens-mat-table.$prefix,
- tokens-mat-table.get-density-tokens($theme)
- );
- }
- }
- }
- /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
- @function _define-overrides() {
- @return (
- (
- namespace: tokens-mat-table.$prefix,
- tokens: tokens-mat-table.get-token-slots(),
- ),
- );
- }
- @mixin overrides($tokens: ()) {
- @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
- }
- @mixin theme($theme) {
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-table') {
- @if inspection.get-theme-version($theme) == 1 {
- @include _theme-from-tokens(inspection.get-theme-tokens($theme));
- } @else {
- @include base($theme);
- @if inspection.theme-has($theme, color) {
- @include color($theme);
- }
- @if inspection.theme-has($theme, density) {
- @include density($theme);
- }
- @if inspection.theme-has($theme, typography) {
- @include typography($theme);
- }
- }
- }
- }
- @mixin _theme-from-tokens($tokens) {
- @include validation.selector-defined(
- 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector'
- );
- @if ($tokens != ()) {
- @include token-utils.create-token-values(
- tokens-mat-table.$prefix,
- map.get($tokens, tokens-mat-table.$prefix)
- );
- }
- }
|