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
  d110683b_9feb_ade8_7566_cf09fdf4f164["distance()"]
  ecf9faa2_4ccf_f16c_bb10_222be63faed0["sort-buckets.ts"]
  d110683b_9feb_ade8_7566_cf09fdf4f164 -->|defined in| ecf9faa2_4ccf_f16c_bb10_222be63faed0
  92a12a9f_b36d_4c66_d885_e04224081f21["sortBuckets()"]
  92a12a9f_b36d_4c66_d885_e04224081f21 -->|calls| d110683b_9feb_ade8_7566_cf09fdf4f164
  style d110683b_9feb_ade8_7566_cf09fdf4f164 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
}

Subdomains

Called By

Frequently Asked Questions

What does distance() do?
distance() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts.
Where is distance() defined?
distance() is defined in packages/@tailwindcss-upgrade/src/codemods/css/sort-buckets.ts at line 152.
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