Changed
-
Sorting: Complete overhaul with list-based configuration system
THE GOLDEN RULE: If it's not in the TOML, it doesn't affect sorting.
Every sort decision can now be traced back to an ordered list in the configuration file.
No more regex patterns for utility groups - everything is explicit and predictable.New configuration structure:
component_orderdefines comparison priority:["variant", "prefix", "direction", "size", "value", "color", "shade", "alpha"]variantslist for variant ordering (breakpoints, states, pseudo-elements)prefixeslist for utility prefix ordering (layout, spacing, typography, etc.)directionslist for directional modifiers (x, y, t, r, b, l, etc.)sizeslist for size modifiers (xs, sm, md, lg, xl, etc.)numericslist for spacing/sizing values (0, 1, 2, 4, 8, etc.)colorslist for color orderingshadeslist for color shade ordering (50-950)alphaslist for opacity values
Sorting behavior:
- Non-Tailwind classes sort first (preserves external library classes)
- No-direction utilities sort before directional variants (
border-1beforeborder-t-1) - Base utilities sort before modified variants (
blurbeforeblur-sm) - Variants support prefix matching (
min-[320px]:matchesminin variants list)
Configuration improvements:
- Grouped
flex/inline-flexandgrid/inline-gridtogether - Added missing utilities:
text-wrap,text-pretty,underline,uppercase,italic, etc. - Added
inset-x,inset-yfor positioning - Added
grid-flow-row,grid-flow-col,grid-flow-densevariants - Added
min/maxto variants for arbitrary breakpoint support - Removed duplicate
contententry - Removed mutually exclusive values (border styles,
auto,none) - they don't need ordering since you can't have bothborder-solidandborder-dashed
Benefits:
- Fully declarative - every ordering decision is visible in the TOML
- Predictable - no hidden regex magic
- Extensible - add new utilities by adding to the appropriate list
- Debuggable - trace any sort order to a specific list position
-
Performance: Optimized sorting hot path for ~45% faster execution
- Added
slots=TruetoParsedClassdataclass for reduced memory and faster attribute access - Replaced dict construction with if/elif chain in
_component_rank()(called 6x per class) - Moved
_MAX_RANKconstant to module level to avoid repeated allocation - Changed list comprehension to generator expression in diff output
Benchmark results (median of 10 pytest runs):
Before After Improvement 1.81s 0.99s 45% faster - Added
-
Colors: Colors and custom_colors are now merged and sorted alphabetically
- Custom colors integrate naturally with built-in colors (e.g.,
brandsorts betweenblueandcurrent) - Removed unused
all_colorsset from configuration
- Custom colors integrate naturally with built-in colors (e.g.,