Home / Function/ arbitraryValueToBareValueUtility() — tailwindcss Function Reference

arbitraryValueToBareValueUtility() — tailwindcss Function Reference

Architecture documentation for the arbitraryValueToBareValueUtility() function in canonicalize-candidates.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  a23fd354_f688_0a39_de4f_3c403164704a["arbitraryValueToBareValueUtility()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  a23fd354_f688_0a39_de4f_3c403164704a -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"]
  a23fd354_f688_0a39_de4f_3c403164704a -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f
  9d7dff21_77af_5de5_322b_3d9047c15d83["tryValueReplacements()"]
  a23fd354_f688_0a39_de4f_3c403164704a -->|calls| 9d7dff21_77af_5de5_322b_3d9047c15d83
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  a23fd354_f688_0a39_de4f_3c403164704a -->|calls| 2820372c_b982_9e06_fc23_f8f4ac308d00
  style a23fd354_f688_0a39_de4f_3c403164704a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 1367–1391

function arbitraryValueToBareValueUtility(
  candidate: Candidate,
  options: InternalCanonicalizeOptions,
): Candidate {
  // We are only interested in functional utilities with arbitrary values
  if (candidate.kind !== 'functional' || candidate.value?.kind !== 'arbitrary') {
    return candidate
  }

  let designSystem = options.designSystem
  let signatures = designSystem.storage[UTILITY_SIGNATURE_KEY].get(options.signatureOptions)

  let expectedSignature = signatures.get(designSystem.printCandidate(candidate))
  if (expectedSignature === null) return candidate

  for (let value of tryValueReplacements(candidate)) {
    let newSignature = signatures.get(designSystem.printCandidate({ ...candidate, value }))
    if (newSignature === expectedSignature) {
      candidate.value = value
      return candidate
    }
  }

  return candidate
}

Domain

Subdomains

Frequently Asked Questions

What does arbitraryValueToBareValueUtility() do?
arbitraryValueToBareValueUtility() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is arbitraryValueToBareValueUtility() defined?
arbitraryValueToBareValueUtility() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 1367.
What does arbitraryValueToBareValueUtility() call?
arbitraryValueToBareValueUtility() calls 3 function(s): get, printCandidate, tryValueReplacements.

Analyze Your Own Codebase

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

Try Supermodel Free