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
  f82aa221_959b_12a7_fef5_44d13694b11e["alphaReplacedDropShadowProperties()"]
  03b8d706_a876_a776_0056_186ced5d6067["segment()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| 03b8d706_a876_a776_0056_186ced5d6067
  ee6a51e8_b2d4_4e8c_e8b0_55eae5041272["replaceShadowColors()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| ee6a51e8_b2d4_4e8c_e8b0_55eae5041272
  8412278d_9a59_ef02_8a3b_9c8e8ab65674["withAlpha()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| 8412278d_9a59_ef02_8a3b_9c8e8ab65674
  b7205c5d_8a1a_a50a_229f_7133a6a9c980["replaceAlpha()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| b7205c5d_8a1a_a50a_229f_7133a6a9c980
  47ef7bd7_b959_59c4_dbd1_328f35d7cd89["decl()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| 47ef7bd7_b959_59c4_dbd1_328f35d7cd89
  f4f92a3d_c13e_a751_8402_451ffa4c772f["rule()"]
  f82aa221_959b_12a7_fef5_44d13694b11e -->|calls| f4f92a3d_c13e_a751_8402_451ffa4c772f
  style f82aa221_959b_12a7_fef5_44d13694b11e 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.
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