<commit_before>//
// Copyright 2017 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@import "@material/base/mixins";
@import "@material/feature-targeting/functions";
@import "@material/feature-targeting/mixins";
@import "@material/theme/mixins";
@import "@material/theme/variables";
@import "./functions";
@import "./variables";

@mixin mdc-elevation-core-styles($query: mdc-feature-all()) {
  $feat-animation: mdc-feature-create-target($query, animation);
  $feat-structure: mdc-feature-create-target($query, structure);

  @for $z-value from 0 through 24 {
    .mdc-elevation--z#{$z-value} {
      @include mdc-elevation($z-value, $query: $query);
    }
  }

  .mdc-elevation-transition {
    @include mdc-feature-targets($feat-animation) {
      transition: mdc-elevation-transition-value();
    }

    @include mdc-feature-targets($feat-structure) {
      will-change: $mdc-elevation-property;
    }
  }
}

///
/// Called once per application to set up the global default elevation styles.
///
@mixin mdc-elevation-overlay-common($query: mdc-feature-all()) {
  $feat-animation: mdc-feature-create-target($query, animation);
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-structure) {
      @include mdc-base-emit-once("mdc-elevation/common/structure") {
        position: absolute;
        border-radius: inherit;
        opacity: 0;
        pointer-events: none;
      }
    }

    @include mdc-feature-targets($feat-animation) {
      @include mdc-base-emit-once("mdc-elevation/common/animation") {
        transition: mdc-elevation-overlay-transition-value();
      }
    }
  }

  @include mdc-base-emit-once("mdc-elevation/common/color") {
    @include mdc-elevation-overlay-fill-color($mdc-elevation-overlay-color, $query: $query);
  }
}

///
/// Sets the shadow of the element.
///
/// @param {String} $box-shadow - The shadow to apply to the element.
///
@mixin mdc-elevation-shadow($box-shadow, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-feature-targets($feat-color) {
    /* @alternate */
    box-shadow: $box-shadow;
  }
}

///
/// Sets the elevation overlay surface required positioning.
///
@mixin mdc-elevation-overlay-surface-position($query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-feature-targets($feat-structure) {
    /* @alternate */
    position: relative;
  }
}

///
/// Sets the dimensions of the elevation overlay, including positioning and sizing.
///
/// @param {Number} $width - The width of the elevation overlay
/// @param {Number} [$height] - The height of the elevation overlay
/// @param {Boolean} [$has-content-sizing] - Set to false if the container has no content sizing
///
@mixin mdc-elevation-overlay-dimensions($width, $height: $width, $has-content-sizing: true, $query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-structure) {
      width: $width;
      height: $height;

      @if $has-content-sizing {
        top: 0;
        /* @noflip */
        left: 0;
      } @else {
        top: 50%;
        /* @noflip */
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}

///
/// Sets the elevation overlay fill color.
///
/// @param {Color} $color - The color of the elevation overlay.
///
@mixin mdc-elevation-overlay-fill-color($color, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-color) {
      @include mdc-theme-prop(background-color, $color);
    }
  }
}

///
/// Sets the elevation overlay opacity.
///
/// @param {Number} $opacity - The opacity of the elevation overlay.
///
@mixin mdc-elevation-overlay-opacity($opacity, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-color) {
      opacity: $opacity;
    }
  }
}

// Applies the correct CSS rules to an element to give it the elevation specified by $z-value.
// The $z-value must be between 0 and 24.
// If $color has an alpha channel, it will be ignored and overridden. To increase the opacity of the shadow, use
// $opacity-boost.
@mixin mdc-elevation($z-value, $color: $mdc-elevation-baseline-color, $opacity-boost: 0, $query: mdc-feature-all()) {
  @if type-of($z-value) != number or not unitless($z-value) {
    @error "$z-value must be a unitless number, but received '#{$z-value}'";
  }

  @if $z-value < 0 or $z-value > 24 {
    @error "$z-value must be between 0 and 24, but received '#{$z-value}'";
  }

  $feat-color: mdc-feature-create-target($query, color);

  $color: mdc-theme-prop-value($color);

  $umbra-z-value: map-get($mdc-elevation-umbra-map, $z-value);
  $penumbra-z-value: map-get($mdc-elevation-penumbra-map, $z-value);
  $ambient-z-value: map-get($mdc-elevation-ambient-map, $z-value);

  $umbra-color: rgba($color, $mdc-elevation-umbra-opacity + $opacity-boost);
  $penumbra-color: rgba($color, $mdc-elevation-penumbra-opacity + $opacity-boost);
  $ambient-color: rgba($color, $mdc-elevation-ambient-opacity + $opacity-boost);

  $box-shadow: (
    #{"#{$umbra-z-value} #{$umbra-color}"},
    #{"#{$penumbra-z-value} #{$penumbra-color}"},
    #{$ambient-z-value} $ambient-color,
  );

  @include mdc-elevation-shadow($box-shadow, $query: $query);
}

// Private

///
/// Sets the elevation overlay transition value.
///
/// @param {String} $duration - The duration of the transition.
/// @param {String} $easing - The easing function for the transition.
/// @return {String}
/// @access private
///
@mixin mdc-elevation-overlay-selector_ {
  .mdc-elevation-overlay {
    @content;
  }
}
<commit_msg>fix(elevation): Update overlay color mixin (#5331)<commit_after>//
// Copyright 2017 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@import "@material/base/mixins";
@import "@material/feature-targeting/functions";
@import "@material/feature-targeting/mixins";
@import "@material/theme/mixins";
@import "@material/theme/variables";
@import "./functions";
@import "./variables";

@mixin mdc-elevation-core-styles($query: mdc-feature-all()) {
  $feat-animation: mdc-feature-create-target($query, animation);
  $feat-structure: mdc-feature-create-target($query, structure);

  @for $z-value from 0 through 24 {
    .mdc-elevation--z#{$z-value} {
      @include mdc-elevation($z-value, $query: $query);
    }
  }

  .mdc-elevation-transition {
    @include mdc-feature-targets($feat-animation) {
      transition: mdc-elevation-transition-value();
    }

    @include mdc-feature-targets($feat-structure) {
      will-change: $mdc-elevation-property;
    }
  }
}

///
/// Called once per application to set up the global default elevation styles.
///
@mixin mdc-elevation-overlay-common($query: mdc-feature-all()) {
  $feat-animation: mdc-feature-create-target($query, animation);
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-structure) {
      @include mdc-base-emit-once("mdc-elevation/common/structure") {
        position: absolute;
        border-radius: inherit;
        opacity: 0;
        pointer-events: none;
      }
    }

    @include mdc-feature-targets($feat-animation) {
      @include mdc-base-emit-once("mdc-elevation/common/animation") {
        transition: mdc-elevation-overlay-transition-value();
      }
    }

    @include mdc-base-emit-once("mdc-elevation/common/color") {
      @include mdc-elevation-overlay-fill-color($mdc-elevation-overlay-color, $query: $query);
    }
  }
}

///
/// Sets the shadow of the element.
///
/// @param {String} $box-shadow - The shadow to apply to the element.
///
@mixin mdc-elevation-shadow($box-shadow, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-feature-targets($feat-color) {
    /* @alternate */
    box-shadow: $box-shadow;
  }
}

///
/// Sets the elevation overlay surface required positioning.
///
@mixin mdc-elevation-overlay-surface-position($query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-feature-targets($feat-structure) {
    /* @alternate */
    position: relative;
  }
}

///
/// Sets the dimensions of the elevation overlay, including positioning and sizing.
///
/// @param {Number} $width - The width of the elevation overlay
/// @param {Number} [$height] - The height of the elevation overlay
/// @param {Boolean} [$has-content-sizing] - Set to false if the container has no content sizing
///
@mixin mdc-elevation-overlay-dimensions($width, $height: $width, $has-content-sizing: true, $query: mdc-feature-all()) {
  $feat-structure: mdc-feature-create-target($query, structure);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-structure) {
      width: $width;
      height: $height;

      @if $has-content-sizing {
        top: 0;
        /* @noflip */
        left: 0;
      } @else {
        top: 50%;
        /* @noflip */
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}

///
/// Sets the elevation overlay fill color.
/// Expected to be called directly on the elevation overlay element.
///
/// @param {Color} $color - The color of the elevation overlay.
///
@mixin mdc-elevation-overlay-fill-color($color, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-feature-targets($feat-color) {
    @include mdc-theme-prop(background-color, $color);
  }
}

///
/// Sets the elevation overlay opacity.
/// Expected to be called from a parent element.
///
/// @param {Number} $opacity - The opacity of the elevation overlay.
///
@mixin mdc-elevation-overlay-opacity($opacity, $query: mdc-feature-all()) {
  $feat-color: mdc-feature-create-target($query, color);

  @include mdc-elevation-overlay-selector_ {
    @include mdc-feature-targets($feat-color) {
      opacity: $opacity;
    }
  }
}

// Applies the correct CSS rules to an element to give it the elevation specified by $z-value.
// The $z-value must be between 0 and 24.
// If $color has an alpha channel, it will be ignored and overridden. To increase the opacity of the shadow, use
// $opacity-boost.
@mixin mdc-elevation($z-value, $color: $mdc-elevation-baseline-color, $opacity-boost: 0, $query: mdc-feature-all()) {
  @if type-of($z-value) != number or not unitless($z-value) {
    @error "$z-value must be a unitless number, but received '#{$z-value}'";
  }

  @if $z-value < 0 or $z-value > 24 {
    @error "$z-value must be between 0 and 24, but received '#{$z-value}'";
  }

  $feat-color: mdc-feature-create-target($query, color);

  $color: mdc-theme-prop-value($color);

  $umbra-z-value: map-get($mdc-elevation-umbra-map, $z-value);
  $penumbra-z-value: map-get($mdc-elevation-penumbra-map, $z-value);
  $ambient-z-value: map-get($mdc-elevation-ambient-map, $z-value);

  $umbra-color: rgba($color, $mdc-elevation-umbra-opacity + $opacity-boost);
  $penumbra-color: rgba($color, $mdc-elevation-penumbra-opacity + $opacity-boost);
  $ambient-color: rgba($color, $mdc-elevation-ambient-opacity + $opacity-boost);

  $box-shadow: (
    #{"#{$umbra-z-value} #{$umbra-color}"},
    #{"#{$penumbra-z-value} #{$penumbra-color}"},
    #{$ambient-z-value} $ambient-color,
  );

  @include mdc-elevation-shadow($box-shadow, $query: $query);
}

// Private

///
/// Sets the elevation overlay transition value.
///
/// @param {String} $duration - The duration of the transition.
/// @param {String} $easing - The easing function for the transition.
/// @return {String}
/// @access private
///
@mixin mdc-elevation-overlay-selector_ {
  .mdc-elevation-overlay {
    @content;
  }
}

{'fraction_non_alphanumeric': 0.15600624024961, 'fraction_numerical': 0.004254715643171181, 'mean_word_length': 3.330058335891925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5882075', 'n_tokens_mistral': 4734, 'n_tokens_neox': 4440, 'n_words': 1203}