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 Oxide Scanner calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  25758157_37c7_6a41_4b05_7fc8c0e52eed["expandDeclaration()"]
  8e85a534_6601_c513_9452_8a311dc16b8f["expand-declaration.ts"]
  25758157_37c7_6a41_4b05_7fc8c0e52eed -->|defined in| 8e85a534_6601_c513_9452_8a311dc16b8f
  e559573b_f2f8_833b_27e7_100efea815c0["canonicalizeAst()"]
  e559573b_f2f8_833b_27e7_100efea815c0 -->|calls| 25758157_37c7_6a41_4b05_7fc8c0e52eed
  6f4989fd_689b_7bce_afb3_9718fc06d93c["expand()"]
  6f4989fd_689b_7bce_afb3_9718fc06d93c -->|calls| 25758157_37c7_6a41_4b05_7fc8c0e52eed
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment()"]
  25758157_37c7_6a41_4b05_7fc8c0e52eed -->|calls| c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  1369a6dc_e395_347d_5d24_b88e22c5446d["decl()"]
  25758157_37c7_6a41_4b05_7fc8c0e52eed -->|calls| 1369a6dc_e395_347d_5d24_b88e22c5446d
  style 25758157_37c7_6a41_4b05_7fc8c0e52eed 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