Home / Function/ alphaReplacedDropShadowProperties() — tailwindcss Function Reference

alphaReplacedDropShadowProperties() — tailwindcss Function Reference

Architecture documentation for the alphaReplacedDropShadowProperties() function in utilities.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90["alphaReplacedDropShadowProperties()"]
  2bc6f8eb_6339_d09c_79df_e9025a479c97["utilities.ts"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|defined in| 2bc6f8eb_6339_d09c_79df_e9025a479c97
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| f712ed47_45d4_4e5a_dd73_fdefa1da71da
  5bac8829_51ba_4cde_5b5b_16bf890de6ec["replaceShadowColors()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| 5bac8829_51ba_4cde_5b5b_16bf890de6ec
  b71e300f_d366_e92d_f71f_413f7ee24e95["withAlpha()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| b71e300f_d366_e92d_f71f_413f7ee24e95
  3f0c8c99_3ead_e51c_3ce2_4cae3716184f["replaceAlpha()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| 3f0c8c99_3ead_e51c_3ce2_4cae3716184f
  c203f636_607a_d332_b4c5_6a40c108f778["decl()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| c203f636_607a_d332_b4c5_6a40c108f778
  66319c06_7c38_f9ea_4bf0_2a0e18bac1a4["rule()"]
  6e33a9d2_fe1c_c268_d0ec_3c5725803a90 -->|calls| 66319c06_7c38_f9ea_4bf0_2a0e18bac1a4
  style 6e33a9d2_fe1c_c268_d0ec_3c5725803a90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utilities.ts lines 6493–6542

function alphaReplacedDropShadowProperties(
  property: string,
  value: string,
  alpha: string | null | undefined,
  varInjector: (color: string) => string,
  prefix: string = '',
): AstNode[] {
  let requiresFallback = false

  let replacedValue = segment(value, ',')
    .map((value) =>
      replaceShadowColors(value, (color) => {
        if (alpha == null) {
          return varInjector(color)
        }

        // When the input is currentcolor, we use our existing `color-mix(…)` approach to increase
        // browser support. Note that the fallback of this is handled more generically in
        // post-processing.
        if (color.startsWith('current')) {
          return varInjector(withAlpha(color, alpha))
        }

        // If any dynamic values are needed for the relative color syntax, we need to insert a
        // replacement as lightningcss won't be able to resolve them statically.
        if (color.startsWith('var(') || alpha.startsWith('var(')) {
          requiresFallback = true
        }

        return varInjector(replaceAlpha(color, alpha))
      }),
    )
    .map((value) => `drop-shadow(${value})`)
    .join(' ')

  if (requiresFallback) {
    return [
      decl(
        property,
        prefix +
          segment(value, ',')
            .map((value) => `drop-shadow(${replaceShadowColors(value, varInjector)})`)
            .join(' '),
      ),
      rule('@supports (color: lab(from red l a b))', [decl(property, prefix + replacedValue)]),
    ]
  } else {
    return [decl(property, prefix + replacedValue)]
  }
}

Domain

Subdomains

Frequently Asked Questions

What does alphaReplacedDropShadowProperties() do?
alphaReplacedDropShadowProperties() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/utilities.ts.
Where is alphaReplacedDropShadowProperties() defined?
alphaReplacedDropShadowProperties() is defined in packages/tailwindcss/src/utilities.ts at line 6493.
What does alphaReplacedDropShadowProperties() call?
alphaReplacedDropShadowProperties() calls 6 function(s): decl, replaceAlpha, replaceShadowColors, rule, segment, withAlpha.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free