mirror of
https://github.com/penpot/penpot.git
synced 2026-08-06 21:08:34 +00:00
The Color tokens picker showed token sets in their raw definition order (ascending precedence), so the lowest-precedence set appeared first and the highest-precedence (last-defined, winning) set appeared last. This is the opposite of what's useful: users care most about which set is currently winning, so that one should be at the top. get-sets returns sets in definition order and the picker's grouped-tokens-by-set pipeline (add-tokens-to-sets -> filter-active-sets -> filter-non-empty-sets -> group-sets -> combine-groups-with-resolved) preserves that order at every step, so the picker just rendered get-sets' raw order. Reverse the set seq once, before it enters the pipeline, so the highest-precedence set renders first. group-sets groups sets by parent path via group-by, which risked restoring definition order within a subgroup independent of the reversed input order. Added tests covering a flat set list, a reversed subgroup (to confirm group-by does not silently re-sort subgroup members), and a mixed flat/subgrouped list. Closes #10552 Signed-off-by: Andrew Cunliffe <cunliffeandrewc@gmail.com> Co-authored-by: Andrey Antukh <niwi@niwi.nz>