@use '../../../theming/theming';
@use '../../token-utils';

@use 'sass:map';

// The prefix used to generate the fully qualified name for tokens in this file.
$prefix: (mdc, fab);

// Tokens that can't be configured through Angular Material's current theming API,
// but may be in a future version of the theming API.
//
// Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
// `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
// our CSS.
$height: 56px;
$mini-height: 40px;
$shape-radius: 50%;
$ripple-target: '.mdc-fab__ripple';

@function get-unthemable-tokens() {
  @return (
    container-shape: 50%,
    icon-size: 24px,

    container-elevation: null,
    container-height: null,
    container-shadow-color: null,
    container-surface-tint-layer-color: null,
    container-width: null,

    focus-container-elevation: null,
    focus-icon-color: null,
    focus-outline-color: null,
    focus-outline-width: null,
    focus-state-layer-color: null,
    focus-state-layer-opacity: null,

    hover-container-elevation: null,
    hover-icon-color: null,
    hover-state-layer-color: null,
    hover-state-layer-opacity: null,

    lowered-container-elevation: null,
    lowered-focus-container-elevation: null,
    lowered-hover-container-elevation: null,
    lowered-pressed-container-elevation: null,

    pressed-container-elevation: null,
    pressed-icon-color: null,
    pressed-ripple-color: null,
    pressed-ripple-opacity: null,
    pressed-state-layer-color: null,
    pressed-state-layer-opacity: null
  );
}

// Tokens that can be configured through Angular Material's color theming API.
@function get-color-tokens($config) {
  $primary: map.get($config, primary);
  $surface: theming.get-color-from-palette($primary, default);
  $on-surface: theming.get-color-from-palette($primary, default-contrast);

  @return (container-color: $surface, icon-color: $on-surface);
}

// Tokens that can be configured through Angular Material's typography theming API.
@function get-typography-tokens($config) {
  @return ();
}

// Tokens that can be configured through Angular Material's density theming API.
@function get-density-tokens($config) {
  @return ();
}

// Combines the tokens generated by the above functions into a single map with placeholder values.
// This is used to create token slots.
@function get-token-slots() {
  @return map.merge(
    get-unthemable-tokens(),
    map.merge(
      get-color-tokens(token-utils.$placeholder-color-config),
      map.merge(
        get-typography-tokens(token-utils.$placeholder-typography-config),
        get-density-tokens(token-utils.$placeholder-density-config)
      )
    )
  );
}
