//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

//-------------------------
// 🎌 Feature Flags
//-------------------------

/// Initialize the feature flag map with default values.
/// @access public
/// @type Map
/// @group feature-flags
/// @example
/// @example scss - Overriding defaults from the `$default-feature-flags` map
///   $feature-flags: (
///     ui-shell: false,
///     grid: true,
///     grid-columns-16: false,
///     grid--fallback: false,
///   );
$feature-flags: () !default;

/// Default feature flag values
/// @access private
/// @type Map
/// @group feature-flags
$default-feature-flags: (
  ui-shell: true,
  grid: true,
  grid-columns-16: false,
  grid--fallback: false,
  enable-css-custom-properties: false,
);

$feature-flags: map-merge($default-feature-flags, $feature-flags);

@if map-get($feature-flags, grid) != true {
  // We supported a flag for experimental grid in the past that we want to keep
  // supporting till our next major release. These two @if statements will assign
  // these values over into the map if they are defined.
  @if variable-exists(css--use-experimental-grid) == true {
    $feature-flags: map-merge(
      $feature-flags,
      (
        grid: $css--use-experimental-grid,
      )
    );
  }

  @if variable-exists(css--use-experimental-grid-fallback) == true {
    $feature-flags: map-merge(
      $feature-flags,
      (
        grid--fallback: $css--use-experimental-grid-fallback,
      )
    );
  }
}
