Skip to content

fix(preset-wind4): improve regex accuracy#4776

Merged
zyyv merged 3 commits into
mainfrom
wind4-color
Jun 25, 2025
Merged

fix(preset-wind4): improve regex accuracy#4776
zyyv merged 3 commits into
mainfrom
wind4-color

Conversation

@zyyv
Copy link
Copy Markdown
Member

@zyyv zyyv commented Jun 25, 2025

close #4774

@zyyv zyyv requested a review from antfu as a code owner June 25, 2025 09:49
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 25, 2025

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit c911aa8
🔍 Latest deploy log https://app.netlify.com/projects/unocss/deploys/685bff7183ba410008e261c3
😎 Deploy Preview https://deploy-preview-4776--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 project configuration.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 25, 2025

Open in StackBlitz

commit: c911aa8

@zyyv zyyv marked this pull request as draft June 25, 2025 10:05
@zyyv zyyv marked this pull request as ready for review June 25, 2025 13:55
@zyyv zyyv requested a review from Copilot June 25, 2025 14:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a bug fix in the preset-wind4 package by adding a new raw parsing utility and updating tests to cover additional color key patterns. Key changes include the introduction of new test cases with additional keys, an update to the regex in the parseColor utility to improve numerical parsing, and enhanced logic for merging numeric parts in theme color keys.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/preset-wind4.test.ts New test cases added to validate additional color keys and their corresponding CSS generation
packages-presets/preset-wind4/src/utils/utilities.ts Updated regex for numerical separation and added fallback logic to merge numeric parts in the theme key
Comments suppressed due to low confidence (1)

test/preset-wind4.test.ts:283

  • [nitpick] The key 'quxx_1' uses an underscore which differs from the kebab-case convention seen in other keys; consider standardizing naming for consistency.
          'quxx_1': '#000',

@@ -159,14 +159,27 @@ export function parseColor(body: string, theme: Theme) {
}

const colors = main
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Consider adding a comment to explain the negative lookahead in this regex, clarifying that it prevents inserting a dash when the digit is immediately followed by a hyphen, underscore, or letter.

Suggested change
const colors = main
const colors = main
// Add a dash between a letter and a digit, unless the digit is immediately followed by a hyphen, underscore, or letter.

Copilot uses AI. Check for mistakes.
@zyyv zyyv changed the title fix(preset-wind4): add parse the raw utility fix(preset-wind4): improve regex accuracy Jun 25, 2025
@zyyv zyyv merged commit 2fa0dfe into main Jun 25, 2025
12 checks passed
@zyyv zyyv deleted the wind4-color branch June 25, 2025 14:15
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.

old bug of colors in preset-wind4

2 participants