Skip to content

Conversation

@userquin
Copy link
Contributor

@userquin userquin commented Feb 7, 2026

This PR includes:

  • updates utils/severity.ts colors including a darker color for light theme at severity and severity text colors constants
  • updates utils/npm/outdated-dependencies.ts colors including a darker color for light theme
  • some components to add light and dark theme colors
  • badge at app/components/Tag/Static.vue‎ using opacity-40: changed variant ghost to a lighter text color with a dashed border adding a gray solid border to the default
  • app/components/Package/VulnerabilityTree.vue using divs inside buttons
  • updates server/utils/shiki.ts to replace some red and green colors at github-light theme, we may need to review the the them at shiki

closes #1167

@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Feb 9, 2026 0:46am
npmx.dev Ready Ready Preview, Comment Feb 9, 2026 0:46am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Feb 9, 2026 0:46am

Request Review

@vercel
Copy link

vercel bot commented Feb 7, 2026

@userquin is attempting to deploy a commit to the serhalp's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 46.15385% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/utils/npm/outdated-dependencies.ts 0.00% 2 Missing and 2 partials ⚠️
app/components/Package/Versions.vue 50.00% 1 Missing ⚠️
app/components/Package/VulnerabilityTree.vue 80.00% 1 Missing ⚠️
app/pages/package/[[org]]/[name].vue 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR updates multiple UI class strings to add dark-mode-aware variants (severity colours, outdated-dependency statuses, badges, tags, deprecated/version styling, icons, and small presentational tweaks), updates a Nuxt packument test fixture with new version/metadata entries, and adds Shiki helpers including replaceThemeColors (module-private), highlightCodeSync, highlightCodeBlock, and escapeRawGt. No existing public function signatures were removed; a few new exports were added.

Possibly related PRs

Suggested reviewers

  • danielroe
  • alexdln
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive Linked issue #1167 lacks sufficient detail about specific coding requirements to validate whether PR changes fully meet its objectives. Clarify the coding requirements and acceptance criteria in issue #1167 to enable proper validation of this PR's compliance.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The PR description is directly related to the changeset, describing color updates across multiple utility files and components.
Out of Scope Changes check ✅ Passed All changes focus on colour contrast improvements and dark mode support across utility files and components, staying aligned with the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@userquin
Copy link
Contributor Author

userquin commented Feb 7, 2026

fixing shiki colors with light theme (github-light theme)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
server/utils/shiki.ts (2)

110-112: ⚠️ Potential issue | 🟠 Major

Sanitise the language before interpolating into the class attribute.

language can be user-controlled via code fences; inserting it raw into HTML risks attribute injection. Consider restricting it to a safe character set.

Proposed fix
-  return `<pre><code class="language-${language}">${escaped}</code></pre>\n`
+  const safeLanguage = language.replace(/[^a-z0-9_-]/gi, '') || 'plaintext'
+  return `<pre><code class="language-${safeLanguage}">${escaped}</code></pre>\n`

90-109: ⚠️ Potential issue | 🟡 Minor

Remove language alias guard to enable alias highlighting.

The loadedLangs check prevents language aliases (e.g. gjs, gts) from reaching codeToHtml. In Shiki v3.21.0, getLoadedLanguages() returns canonical language IDs, not aliases, so loadedLangs.includes('gjs') will be false even though the langAlias mapping and codeToHtml support it. Remove the guard and rely on the existing try/catch to handle any unsupported languages—this aligns with Shiki's design.

Proposed fix
 export function highlightCodeSync(shiki: HighlighterCore, code: string, language: string): string {
-  const loadedLangs = shiki.getLoadedLanguages()
-
-  if (loadedLangs.includes(language as never)) {
-    try {
-      let html = shiki.codeToHtml(code, {
-        lang: language,
-        themes: { light: 'github-light', dark: 'github-dark' },
-        defaultColor: 'dark',
-      })
-      // Remove inline style from <pre> tag so CSS can control appearance
-      html = html.replace(/<pre([^>]*) style="[^"]*"/, '<pre$1')
-      // Shiki doesn't encode > in text content (e.g., arrow functions =>)
-      // We need to encode them for HTML validation
-      return escapeRawGt(html)
-    } catch {
-      // Fall back to plain
-    }
-  }
+  try {
+    let html = shiki.codeToHtml(code, {
+      lang: language,
+      themes: { light: 'github-light', dark: 'github-dark' },
+      defaultColor: 'dark',
+    })
+    // Remove inline style from <pre> tag so CSS can control appearance
+    html = html.replace(/<pre([^>]*) style="[^"]*"/, '<pre$1')
+    // Shiki doesn't encode > in text content (e.g., arrow functions =>)
+    // We need to encode them for HTML validation
+    return escapeRawGt(html)
+  } catch {
+    // Fall back to plain
+  }

Note: server/utils/code-highlight.ts has the same pattern at line 272–275 and would benefit from the same fix.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

size="small"
:to="typesHref"
classicon="i-carbon-checkmark"
classicon="i-carbon:checkmark"
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 8, 2026

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for old-style icon syntax (i-carbon-name pattern)
echo "=== Old-style i-carbon-* syntax (hyphens) ==="
rg "i-carbon-[a-z]" --type vue -g '!node_modules' | wc -l
echo "Count of files/lines with old syntax:"
rg "i-carbon-[a-z]" --type vue -g '!node_modules' -l | wc -l

echo ""
echo "=== New-style i-carbon:* syntax (colons) ==="
rg "i-carbon:[a-z]" --type vue -g '!node_modules' | wc -l
echo "Count of files/lines with new syntax:"
rg "i-carbon:[a-z]" --type vue -g '!node_modules' -l | wc -l

echo ""
echo "=== Detailed breakdown of new-style syntax ==="
rg "i-carbon:[a-z]+" --type vue -g '!node_modules' -o | sort | uniq -c | sort -rn | head -20

echo ""
echo "=== Detailed breakdown of old-style syntax ==="
rg "i-carbon-[a-z]+" --type vue -g '!node_modules' -o | sort | uniq -c | sort -rn | head -20

Repository: npmx-dev/npmx.dev

Length of output: 517


🏁 Script executed:

#!/bin/bash
# Check for old-style icon syntax (i-carbon-name pattern)
echo "=== Old-style i-carbon-* syntax (hyphens) in .vue files ==="
rg "i-carbon-[a-z]" -g '*.vue' | wc -l

echo ""
echo "=== New-style i-carbon:* syntax (colons) in .vue files ==="
rg "i-carbon:[a-z]" -g '*.vue' | wc -l

echo ""
echo "=== Sample of new-style syntax matches ==="
rg "i-carbon:[a-z]+" -g '*.vue' -o | sort | uniq -c | sort -rn | head -20

echo ""
echo "=== Sample of old-style syntax matches ==="
rg "i-carbon-[a-z]+" -g '*.vue' -o | sort | uniq -c | sort -rn | head -20

echo ""
echo "=== Check the specific file mentioned ==="
if [ -f "app/components/Package/MetricsBadges.vue" ]; then
  echo "File exists. Checking line 66:"
  sed -n '60,72p' "app/components/Package/MetricsBadges.vue" | cat -n
fi

Repository: npmx-dev/npmx.dev

Length of output: 3334


Update icon syntax to use colons consistently across all Vue components.

The codebase currently has mixed icon syntax: 202 instances of the new colon-based style (i-carbon:checkmark) and 71 instances of the old hyphen-based style (i-carbon-warning). This file correctly uses the new syntax, but other components still use hyphens. Refactor all remaining i-carbon-* patterns to i-carbon:* for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an small optimization for UnoCSS preset-icons: for single icon name (without dash) the result is the same, but for long icon names using : instead - will resolve the collection directly, the pattern is i-<collection>[-:]<icon>, and so for i-carbon:a-b-c-d we skip some combinations.

We need to find a way to fix this, it is hard since we can add more and more collections and ppl should use : instead -.

Copy link
Contributor

Choose a reason for hiding this comment

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

@userquin, thank you for the explanation! That's a valuable optimization detail about UnoCSS preset-icons. The direct collection resolution with : for multi-dash icon names makes sense.

Here are several approaches to enforce this pattern consistently:

1. ESLint Custom Rule

Create a custom ESLint rule that detects i-<collection>-<icon> patterns and suggests using : instead. This would catch violations during development.

2. Pre-commit Hook

Add a Git hook that scans staged files for the old pattern:

# .husky/pre-commit or similar
if git diff --cached --name-only | grep -E '\.(vue|ts|js)$' | xargs grep -E 'i-carbon-[a-z]'; then
  echo "❌ Found old icon syntax (i-carbon-name). Please use i-carbon:name instead."
  exit 1
fi

3. Automated Migration Script

I can help create a script to fix all remaining 71 instances automatically. Would you like me to generate a script that:

  • Finds all i-carbon-* patterns
  • Replaces them with i-carbon:*
  • Shows a diff for review before applying?

4. Documentation

Add this to your contributing guidelines or a dedicated icon usage document explaining:

  • The pattern: i-<collection>:<icon-name>
  • Why colons are preferred (UnoCSS optimization)
  • Common collections used in the project

5. CI Check

Add a CI step that fails if old syntax is detected in new code:

- name: Check icon syntax
  run: |
    if grep -r "i-carbon-[a-z]" app/ --include="*.vue"; then
      echo "Old icon syntax detected"
      exit 1
    fi

Would you like me to help implement any of these solutions? I can generate the migration script or create the linting rules for you.

/ᐠ。ꞈ。ᐟ
( thinking )
/> 📝 <\


✏️ Learnings added
Learnt from: userquin
Repo: npmx-dev/npmx.dev PR: 1170
File: app/components/Package/MetricsBadges.vue:66-66
Timestamp: 2026-02-08T15:02:02.232Z
Learning: In Vue components, use colon syntax for UnoCSS preset-icons (e.g., `i-carbon:checkmark` instead of `i-carbon-checkmark`). For long icon names with dashes, the colon syntax provides a performance optimization by helping UnoCSS resolve the collection directly without trying different combinations.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: alexdln
Repo: npmx-dev/npmx.dev PR: 838
File: app/pages/package/[...package].vue:445-449
Timestamp: 2026-02-03T13:59:33.392Z
Learning: The copy button pattern in app/pages/package/[...package].vue may be made into a reusable component or pattern in the future, but currently it's acceptable to keep it inline with the CSS-only approach for smooth animations.

Learnt from: skaldebane
Repo: npmx-dev/npmx.dev PR: 760
File: app/components/Compare/FacetCard.vue:134-136
Timestamp: 2026-02-06T07:13:58.289Z
Learning: In `app/components/Compare/FacetCard.vue`, the facet values use `dir="auto"` rather than `dir="ltr"` because the values are not always numbers/sizes and can contain mixed content types.

Copy link
Contributor Author

@userquin userquin Feb 8, 2026

Choose a reason for hiding this comment

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

you're killing everyone, there are still a lot of icons using i-<collection>-<icon>, and Windows users won't be able to lint on local (like me)

Copy link
Contributor

Choose a reason for hiding this comment

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

@userquin, I sincerely apologize! You're absolutely right—I got carried away with enforcement suggestions that would be disruptive and not Windows-friendly.

Let me take a much more practical approach:

Gradual, Optional Migration

Instead of breaking builds or forcing everyone to use bash hooks, here are gentler options:

1. One-time migration script (Node.js/JavaScript)

I can create a cross-platform Node.js script that you can run once to migrate all remaining old-syntax icons. This would be:

  • Completely optional
  • Works on Windows, Mac, Linux
  • Shows a diff before applying changes
  • Can be run at your convenience

2. Documentation only

Simply document the preferred syntax in your contributing guide for future reference, without any enforcement. New code naturally adopts it over time.

3. Optional VS Code snippet

Add a VS Code snippet that auto-completes with the colon syntax, making it easier for contributors to use the right pattern without forcing it.

Would you like me to create a Node.js migration script that you can review and run when convenient? It would be a simple, non-intrusive way to update the remaining 71 instances without impacting anyone's workflow.

Again, sorry for the overly aggressive suggestions!

/ᐠ - ˕ -マ
( sorry! )
/> 💨 <\


🧠 Learnings used
Learnt from: userquin
Repo: npmx-dev/npmx.dev PR: 1170
File: app/components/Package/MetricsBadges.vue:66-66
Timestamp: 2026-02-08T15:02:02.232Z
Learning: In Vue components, use colon syntax for UnoCSS preset-icons (e.g., `i-carbon:checkmark` instead of `i-carbon-checkmark`). For long icon names with dashes, the colon syntax provides a performance optimization by helping UnoCSS resolve the collection directly without trying different combinations.

Learnt from: alexdln
Repo: npmx-dev/npmx.dev PR: 838
File: app/pages/package/[...package].vue:445-449
Timestamp: 2026-02-03T13:59:33.392Z
Learning: The copy button pattern in app/pages/package/[...package].vue may be made into a reusable component or pattern in the future, but currently it's acceptable to keep it inline with the CSS-only approach for smooth animations.

Learnt from: skaldebane
Repo: npmx-dev/npmx.dev PR: 760
File: app/components/Compare/FacetCard.vue:134-136
Timestamp: 2026-02-06T07:13:58.289Z
Learning: In `app/components/Compare/FacetCard.vue`, the facet values use `dir="auto"` rather than `dir="ltr"` because the values are not always numbers/sizes and can contain mixed content types.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@serhalp serhalp added front Frontend, Design a11y Related to accessibility and inclusion labels Feb 8, 2026
# Conflicts:
#	app/components/Package/Versions.vue
@whitep4nth3r
Copy link
Contributor

Can you provide some screenshots of before and after please?

@userquin
Copy link
Contributor Author

userquin commented Feb 10, 2026

Just open nuxt package, go to old versions and select 0.18.0 (or 0.18.1 🤔 ), switch to light theme and check the package (red tip, orange collapsible and version numbers on right). For shiki check the template code snippet (green) and some red colors for ts code snippet. We need to fix some green tip colors.(check nuxt package tip with light and dark theme).

Check also vulnerabilities orange number: just compare them with this pr preview and npmx.dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Related to accessibility and inclusion front Frontend, Design

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants