Skip to content

fix: optimize shortcuts ordering#4566

Open
jrr997 wants to merge 1 commit into
unocss:mainfrom
jrr997:my-origin/fix/shortcut
Open

fix: optimize shortcuts ordering#4566
jrr997 wants to merge 1 commit into
unocss:mainfrom
jrr997:my-origin/fix/shortcut

Conversation

@jrr997

@jrr997 jrr997 commented Apr 5, 2025

Copy link
Copy Markdown

This pr tries to fix #4379

The sorting of shortcuts depends on the order of their tokens in the rules array. For example, with

'btn-notworking': 'bg-gray-200 hover:bg-gray-300 active:bg-blue active:scale-95'

The index of active:scale-95 in the rules array comes before active:bg-blue. Meanwhile, the sorting of btn-notworking:active takes the minimum value (the index of active:scale-95), which results in the final generated style having 'btn-notworking:active' placed before 'btn-notworking:hover'.

I think it would be more reasonable for the sorting of shortcuts to be based on the maximum index in the rules array.

@jrr997
jrr997 requested review from antfu and zyyv as code owners April 5, 2025 12:33
@netlify

netlify Bot commented Apr 5, 2025

Copy link
Copy Markdown

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 961c799
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/67f1230bb55e540008d27651
😎 Deploy Preview https://deploy-preview-4566--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pkg-pr-new

pkg-pr-new Bot commented Apr 8, 2025

Copy link
Copy Markdown

Open in StackBlitz

commit: 961c799

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.

active:bg not working when active:scale used [only when using shortcut]

1 participant