Home / Function/ expandDeclaration() — tailwindcss Function Reference

expandDeclaration() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  524663ee_dcd5_80b9_29bd_e2f21fc950aa["expandDeclaration()"]
  84dbd847_e2eb_8fba_afa7_47012ee6086f["canonicalizeAst()"]
  84dbd847_e2eb_8fba_afa7_47012ee6086f -->|calls| 524663ee_dcd5_80b9_29bd_e2f21fc950aa
  8ea56f72_5e23_1ddc_863d_757d2deb5a0f["expand()"]
  8ea56f72_5e23_1ddc_863d_757d2deb5a0f -->|calls| 524663ee_dcd5_80b9_29bd_e2f21fc950aa
  2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"]
  524663ee_dcd5_80b9_29bd_e2f21fc950aa -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66
  85b46de2_edfa_9371_e2c6_e60f3f5346a2["decl()"]
  524663ee_dcd5_80b9_29bd_e2f21fc950aa -->|calls| 85b46de2_edfa_9371_e2c6_e60f3f5346a2
  style 524663ee_dcd5_80b9_29bd_e2f21fc950aa 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
}

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