Skip to content

refactor: optimize rules and redesign options#21

Merged
zyyv merged 7 commits into
mainfrom
refactor
Feb 27, 2026
Merged

refactor: optimize rules and redesign options#21
zyyv merged 7 commits into
mainfrom
refactor

Conversation

@zyyv

@zyyv zyyv commented Feb 26, 2026

Copy link
Copy Markdown
Member

Warning

This PR changes the following:

  • Optimized previous rules to better conform to Unocss syntax and speed up parsing.

  • Deprecated numberToUnit. Unocss has built-in number unit parsing; I recommend aligning it with presetWind3and presetWind4. If unit conversion is needed, handle it in other steps, such as postprocess.

  • Deprecated prefix. Prefixes are not compatible with shortcuts in sccollbar. sccollbar is already quite special, and I believe prefixes are sufficient; they are redundant and should be removed.

  • Rename noCompatible to compatible

  • Updated test snapshots.

fixes #20, fixes #15, fixes #16

Copilot AI review requested due to automatic review settings February 26, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the unocss-preset-scrollbar preset API and rule set to streamline utilities/autocomplete and adjust compatibility behavior, with corresponding Vitest snapshot updates.

Changes:

  • Switch test setup to presetWind3 and adjust generator usage/autocomplete snapshots.
  • Redesign preset options (noCompatible -> compatible, remove prefix/numberToUnit), and refactor rules (unify thumb/track color rules, add opacity utilities).
  • Update snapshots to reflect new generated CSS for default + compatible modes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/index.test.ts Updates generator preset and modifies assertions/snapshots for new rule outputs and autocomplete shape.
test/index-compatible.test.ts Updates option name to compatible and refreshes snapshots for the “compatible” configuration.
test/snapshots/index.test.ts.snap Snapshot updates for new default CSS output and removed tests.
test/snapshots/index-compatible.test.ts.snap Snapshot updates for new “compatible” test output.
src/index.ts Core refactor of preset options, shortcuts, rules, and compatibility behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts
Comment thread src/index.ts
Comment thread src/index.ts
Comment thread test/index.test.ts Outdated
Comment thread test/index-compatible.test.ts Outdated
@zyyv

zyyv commented Feb 26, 2026

Copy link
Copy Markdown
Member Author

@action-hong Would you be able to review this?
Also, my npm account has changed; I need to do OIDC publishing, which requires settings on npm. Could you please try inviting my new npm account? Looking forward to your reply.

@zyyv zyyv merged commit bc130c0 into main Feb 27, 2026
6 checks passed
@zyyv zyyv deleted the refactor branch February 27, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants