Skip to content

sort: place svg, object-fit and table-layout in canonical order#122

Merged
samoht merged 12 commits into
mainfrom
fix-family-sort-mid
Jul 13, 2026
Merged

sort: place svg, object-fit and table-layout in canonical order#122
samoht merged 12 commits into
mainfrom
fix-family-sort-mid

Conversation

@samoht

@samoht samoht commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Stacked on #121. Completes the family-order re-calibration so the ocaml.org corpus is render-identical to Tailwind v4: tw <corpus> --diff now prints No differences found (from 52 reorders + 5 container block-placement markers at the start).

Every displaced family moved to its canonical slot, via per-variant priority : t -> int where a module spans several families:

  • svg fill/stroke and object-fit before padding (priority band 21..30 shifted up two to open the slot)
  • table-layout after flex; size-* first among sizing
  • resize/appearance out of interactivity; list-style/truncate/vertical-align out of typography; to their early slots
  • outline after box-shadow/ring
  • late-typography reordered to tracking < word-break < whitespace < text-transform < italic < text-decoration < font-smoothing
  • text-color interleaved into late-typography; border-color placed with border-width
  • !important classes order by their base family instead of falling to last place

Plus the within-family value orders: tracking and font-family alphabetical; border sides side-major; outline-style after outline-width; max-width in Tailwind's three bands (container scale, numeric, keywords); and named/arbitrary border colors sharing a suborder so they interleave by class name.

@samoht
samoht force-pushed the fix-family-sort-order branch from 826a6c2 to 4dddd24 Compare July 13, 2026 04:35
samoht added 12 commits July 12, 2026 21:35
svg (fill/stroke, canonical rank 70) sat at priority 30 - after padding, typography and effects - and object-fit was buried in layout's display priority. Both belong just after backgrounds and before padding, so this shifts the priority-21..30 band up by two to open the slot and drops svg into it, with object-fit returning its own priority per-variant.
table-auto, border-collapse and border-spacing (canonical rank 41) emit right after flex_props' shrink/grow/basis and before transforms; they were at the display priority (4), far too early.
…anonical slots

size-* sorts first among sizing; resize (rank 47) and appearance (rank 49) split out of interactivity to just after cursor; list-style (rank 48) and text-overflow/truncate (rank 62) split out of late-typography to their early slots; vertical-align moves to just after text-align. All via per-variant priority with suborders that thread between the neighbouring families.
outline-* (rank ~92) split out of borders' border-width handler to after box-shadow/ring; and the late-typography families reordered to Tailwind's sequence tracking < word-break < whitespace < text-transform < italic < text-decoration < font-smoothing (italic moved from the early handler, decoration/word-break/antialiased resuborded).
text-clip/text-ellipsis (plain text-overflow, unlike the truncate shorthand) sort late with the text utilities, right after word-break.
tracking sorts alphabetically (normal before tight); border sides are side-major so each side's bare/numeric/arbitrary widths group together (border-t, border-t-2, border-t-[1px], border-r, ...) as Tailwind emits them.
text-color (the color property, canonical rank ~86) sorts after text-transform and before font-style/italic, not with the other color families. color.ml's Text_* variants return priority 26 with a fixed suborder in that gap, leaving accent/caret/etc at 25.
extract_base_utility left the leading ! on important classes (!flex, !max-h-screen), so they failed to parse and fell to the default last-place order; stripping it lets them sort with their base family as Tailwind emits them.
border-color (rank ~65) sorts alongside border-width/style at priority 19, not with the other color families at 25.
font-family sorts alphabetically (mono, sans, serif); outline-style (outline-none etc.) sorts after outline-width, matching Tailwind.
max-width sorts in Tailwind's three bands (container scale sizes 2xl..7xl, then numeric spacing, then letter keywords). Border colors: color.ml's arbitrary all-sides colors share suborder 1500 with borders.ml's named colors so they tie and sort by class name, and per-side colors sort after all-sides. This closes the ocaml.org canonical corpus diff to zero.
@samoht
samoht force-pushed the fix-family-sort-mid branch from 70e5fa7 to ec84fe1 Compare July 13, 2026 04:36
Base automatically changed from fix-family-sort-order to main July 13, 2026 06:30
@samoht
samoht merged commit dc24c90 into main Jul 13, 2026
2 checks passed
@samoht
samoht deleted the fix-family-sort-mid branch July 13, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant