Home / Function/ distance() — tailwindcss Function Reference

distance() — tailwindcss Function Reference

Architecture documentation for the distance() function in sort-buckets.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  90a499aa_8b0d_b1e9_a745_5565e744ac90["distance()"]
  e043f45b_85cc_a577_dfe0_8d4c73200c27["sortBuckets()"]
  e043f45b_85cc_a577_dfe0_8d4c73200c27 -->|calls| 90a499aa_8b0d_b1e9_a745_5565e744ac90
  style 90a499aa_8b0d_b1e9_a745_5565e744ac90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts lines 152–161

function distance(before?: ChildNode, after?: ChildNode): number | null {
  if (!before || !after) return null
  if (!before.source || !after.source) return null
  if (!before.source.start || !after.source.start) return null
  if (!before.source.end || !after.source.end) return null

  // Compare end of Before, to start of After
  let d = Math.abs(before.source.end.line - after.source.start.line)
  return d
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does distance() do?
distance() is a function in the tailwindcss codebase.
What calls distance()?
distance() is called by 1 function(s): sortBuckets.

Analyze Your Own Codebase

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

Try Supermodel Free