Home / Function/ expandDeclaration() — tailwindcss Function Reference

expandDeclaration() — tailwindcss Function Reference

Architecture documentation for the expandDeclaration() function in expand-declaration.ts from the tailwindcss codebase.

Function typescript OxideCore Scanner calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  5e4110d6_8dee_8a97_307e_d0021e0225de["expandDeclaration()"]
  3c29a5ca_8e68_4fa2_4e91_392cf24c5a01["canonicalizeAst()"]
  3c29a5ca_8e68_4fa2_4e91_392cf24c5a01 -->|calls| 5e4110d6_8dee_8a97_307e_d0021e0225de
  9b0f6215_d728_39c5_c24a_2e50640933f4["expand()"]
  9b0f6215_d728_39c5_c24a_2e50640933f4 -->|calls| 5e4110d6_8dee_8a97_307e_d0021e0225de
  03b8d706_a876_a776_0056_186ced5d6067["segment()"]
  5e4110d6_8dee_8a97_307e_d0021e0225de -->|calls| 03b8d706_a876_a776_0056_186ced5d6067
  47ef7bd7_b959_59c4_dbd1_328f35d7cd89["decl()"]
  5e4110d6_8dee_8a97_307e_d0021e0225de -->|calls| 47ef7bd7_b959_59c4_dbd1_328f35d7cd89
  style 5e4110d6_8dee_8a97_307e_d0021e0225de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/expand-declaration.ts lines 66–93

export function expandDeclaration(
  node: Extract<AstNode, { kind: 'declaration' }>,
  options: SignatureFeatures,
): AstNode[] | null {
  if (options & SignatureFeatures.LogicalToPhysical) {
    if (node.property in VARIADIC_LOGICAL_EXPANSION_MAP) {
      let args = segment(node.value!, ' ')
      return VARIADIC_LOGICAL_EXPANSION_MAP[node.property][args.length]?.map(([prop, index]) => {
        return decl(prop, args[index], node.important)
      })
    }

    if (node.property in LOGICAL_EXPANSION_MAP) {
      return LOGICAL_EXPANSION_MAP[node.property]?.map((prop) => {
        return decl(prop, node.value!, node.important)
      })
    }
  }

  if (node.property in VARIADIC_EXPANSION_MAP) {
    let args = segment(node.value!, ' ')
    return VARIADIC_EXPANSION_MAP[node.property][args.length]?.map(([prop, index]) => {
      return decl(prop, args[index], node.important)
    })
  }

  return null
}

Domain

Subdomains

Frequently Asked Questions

What does expandDeclaration() do?
expandDeclaration() is a function in the tailwindcss codebase.
What does expandDeclaration() call?
expandDeclaration() calls 2 function(s): decl, segment.
What calls expandDeclaration()?
expandDeclaration() is called by 2 function(s): canonicalizeAst, expand.

Analyze Your Own Codebase

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

Try Supermodel Free