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
  8e1f22b2_13b1_c4b5_7edd_423453055d39["expandDeclaration()"]
  6ad94eb5_5050_c104_6930_f586671c39b4["expand-declaration.ts"]
  8e1f22b2_13b1_c4b5_7edd_423453055d39 -->|defined in| 6ad94eb5_5050_c104_6930_f586671c39b4
  b634c4e7_2242_e72b_2b52_bbbae37fc41b["canonicalizeAst()"]
  b634c4e7_2242_e72b_2b52_bbbae37fc41b -->|calls| 8e1f22b2_13b1_c4b5_7edd_423453055d39
  1e8a63fb_d767_393f_749f_708105a54264["expand()"]
  1e8a63fb_d767_393f_749f_708105a54264 -->|calls| 8e1f22b2_13b1_c4b5_7edd_423453055d39
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment()"]
  8e1f22b2_13b1_c4b5_7edd_423453055d39 -->|calls| f712ed47_45d4_4e5a_dd73_fdefa1da71da
  c203f636_607a_d332_b4c5_6a40c108f778["decl()"]
  8e1f22b2_13b1_c4b5_7edd_423453055d39 -->|calls| c203f636_607a_d332_b4c5_6a40c108f778
  style 8e1f22b2_13b1_c4b5_7edd_423453055d39 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, defined in packages/tailwindcss/src/expand-declaration.ts.
Where is expandDeclaration() defined?
expandDeclaration() is defined in packages/tailwindcss/src/expand-declaration.ts at line 66.
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