_input-theme.scss 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. @use '../core/theming/theming';
  2. @use '../core/theming/inspection';
  3. @use '../core/theming/validation';
  4. @use '../core/typography/typography';
  5. @use '../core/tokens/token-utils';
  6. @mixin base($theme) {
  7. @if inspection.get-theme-version($theme) == 1 {
  8. @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
  9. } @else {
  10. }
  11. }
  12. @mixin color($theme) {
  13. @if inspection.get-theme-version($theme) == 1 {
  14. @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
  15. } @else {
  16. }
  17. }
  18. @mixin typography($theme) {
  19. @if inspection.get-theme-version($theme) == 1 {
  20. @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
  21. } @else {
  22. }
  23. }
  24. @mixin density($theme) {
  25. @if inspection.get-theme-version($theme) == 1 {
  26. @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
  27. } @else {
  28. }
  29. }
  30. /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
  31. @function _define-overrides() {
  32. @return (
  33. (
  34. namespace: '',
  35. tokens: (),
  36. ),
  37. );
  38. }
  39. @mixin overrides($tokens: ()) {
  40. @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
  41. }
  42. @mixin theme($theme) {
  43. @include theming.private-check-duplicate-theme-styles($theme, 'mat-input') {
  44. @if inspection.get-theme-version($theme) == 1 {
  45. @include _theme-from-tokens(inspection.get-theme-tokens($theme));
  46. } @else {
  47. @include base($theme);
  48. @if inspection.theme-has($theme, color) {
  49. @include color($theme);
  50. }
  51. @if inspection.theme-has($theme, density) {
  52. @include density($theme);
  53. }
  54. @if inspection.theme-has($theme, typography) {
  55. @include typography($theme);
  56. }
  57. }
  58. }
  59. }
  60. @mixin _theme-from-tokens($tokens) {
  61. @include validation.selector-defined(
  62. 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector'
  63. );
  64. }