_elevation.scss 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // Copyright 2017 Google Inc.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. // stylelint-disable selector-class-pattern --
  23. // Selector '.mdc-*' should only be used in this project.
  24. @use '@material/theme/custom-properties';
  25. @use '@material/base/mixins' as base-mixins;
  26. @use '@material/feature-targeting/feature-targeting';
  27. @use '@material/theme/theme';
  28. @use '@material/theme/theme-color';
  29. @use './elevation-theme';
  30. @mixin core-styles($query: feature-targeting.all()) {
  31. $feat-animation: feature-targeting.create-target($query, animation);
  32. $feat-structure: feature-targeting.create-target($query, structure);
  33. @for $z-value from 0 through 24 {
  34. .mdc-elevation--z#{$z-value} {
  35. @include elevation-theme.elevation($z-value, $query: $query);
  36. }
  37. }
  38. .mdc-elevation-transition {
  39. @include feature-targeting.targets($feat-animation) {
  40. transition: elevation-theme.transition-value();
  41. }
  42. @include feature-targeting.targets($feat-structure) {
  43. will-change: elevation-theme.$property;
  44. }
  45. }
  46. }
  47. ///
  48. /// Called once per application to set up the global default elevation styles.
  49. ///
  50. @mixin overlay-common($query: feature-targeting.all()) {
  51. $feat-animation: feature-targeting.create-target($query, animation);
  52. $feat-structure: feature-targeting.create-target($query, structure);
  53. .mdc-elevation-overlay {
  54. @include feature-targeting.targets($feat-structure) {
  55. @include base-mixins.emit-once('mdc-elevation/common/structure') {
  56. position: absolute;
  57. border-radius: inherit;
  58. pointer-events: none;
  59. @include theme.property(
  60. opacity,
  61. custom-properties.create(--mdc-elevation-overlay-opacity, 0)
  62. );
  63. }
  64. }
  65. @include feature-targeting.targets($feat-animation) {
  66. @include base-mixins.emit-once('mdc-elevation/common/animation') {
  67. transition: elevation-theme.overlay-transition-value();
  68. }
  69. }
  70. @include base-mixins.emit-once('mdc-elevation/common/color') {
  71. $fill-color: custom-properties.create(
  72. --mdc-elevation-overlay-color,
  73. elevation-theme.$overlay-color
  74. );
  75. @include elevation-theme.overlay-fill-color($fill-color, $query: $query);
  76. }
  77. }
  78. }