Skip to content

feat(ui): add input to filter package versions by any semver range#1405

Merged
danielroe merged 1 commit intomainfrom
feat/filter-pkg-versions-by-semver
Feb 13, 2026
Merged

feat(ui): add input to filter package versions by any semver range#1405
danielroe merged 1 commit intomainfrom
feat/filter-pkg-versions-by-semver

Conversation

@serhalp
Copy link
Member

@serhalp serhalp commented Feb 12, 2026

Add a text input to the versions section that filters displayed versions by any valid npm semver range (e.g. ^3.0.0, >=2.0.0 <3.0.0, ~1.5.0). It filters tag rows, expanded child versions, and "other versions" groups as-you-type. It shows an indication when the input is not a valid range, and a "no matches" message when nothing matches. It has a tooltip linking to a new docs page explaining npm semver ranges.

npmx.package.semver.filter.v2.mp4

(This PR is stacked on #1402 at the moment.)

@vercel
Copy link

vercel bot commented Feb 12, 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 13, 2026 1:58am
npmx.dev Ready Ready Preview, Comment Feb 13, 2026 1:58am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Feb 13, 2026 1:58am

Request Review

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
lunaria/files/en-GB.json Localization changed, will be marked as complete. 🔄️
lunaria/files/en-US.json Source changed, localizations will be marked as outdated.
lunaria/files/fr-FR.json Localization changed, will be marked as complete. 🔄️
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Add a text input to the versions section that filters displayed versions by any valid npm semver
range (e.g. `^3.0.0`, `>=2.0.0 <3.0.0`, `~1.5.0`). It filters tag rows, expanded child versions, and
"other versions" groups as-you-type. It shows an indication when the input is not a valid range, and
a "no matches" message when nothing matches. It has a tooltip linking to a new docs page explaining
npm semver ranges
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

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

Files with missing lines Patch % Lines
app/components/Package/Versions.vue 96.72% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@serhalp serhalp marked this pull request as ready for review February 13, 2026 02:02
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

This pull request introduces semver range filtering for package versions. A new filterVersions utility is added to process version arrays against semver range specifications. The Package/Versions.vue component is extended with filter state, computed properties for filtered data, and UI elements including input validation and error messaging. Supporting changes include extracting the docs URL to a shared constant (NPMX_DOCS_SITE), updating footer and header components to reference it, adding a new documentation page explaining semver range syntax, and expanding all localisation files (i18n and lunaria) with filter-related strings. Comprehensive tests cover both the utility function and component interaction patterns.

Possibly related PRs

Suggested labels

front, a11y

Suggested reviewers

  • danielroe
  • graphieros
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly describes the addition of a semver range filter for the versions section, matching the changeset across multiple files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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
  • Commit unit tests in branch feat/filter-pkg-versions-by-semver

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

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

Caution

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

⚠️ Outside diff range comments (2)
test/nuxt/components/PackageVersions.spec.ts (1)

894-907: ⚠️ Potential issue | 🟠 Major

Drop the focus-visible class assertion — it will always fail.

The component doesn’t set a focus-visible class; focus styles are applied globally, so this check is brittle and will break CI.

Suggested fix
-    it('expand buttons have visible focus states', async () => {
-      const component = await mountSuspended(PackageVersions, {
-        props: {
-          packageName: 'test-package',
-          versions: {
-            '1.0.0': createVersion('1.0.0'),
-          },
-          distTags: { latest: '1.0.0' },
-          time: { '1.0.0': '2024-01-15T12:00:00.000Z' },
-        },
-      })
-
-      const expandButton = component.find('button[aria-expanded]')
-      expect(expandButton.classes().some(c => c.includes('focus-visible'))).toBe(true)
-    })

Based on learnings: “In the npmx.dev project, ensure that focus-visible styling for button and select elements is implemented globally in app/assets/main.css … Do not apply per-element inline utility classes … rely on the global rule.”

app/components/Package/Versions.vue (1)

655-663: ⚠️ Potential issue | 🟡 Minor

Use colon icon syntax for UnoCSS preset-icons.

i-carbon-warning-hex should be i-carbon:warning-hex to match the project's icon convention used throughout the file and codebase.

Suggested fix
-                :classicon="v.deprecated ? 'i-carbon-warning-hex' : undefined"
+                :classicon="v.deprecated ? 'i-carbon:warning-hex' : undefined"

Note: There are 6 occurrences of this pattern in the file that should all be updated.

Comment on lines +218 to +225
// Whether the filter is active but nothing matches anywhere
const hasNoFilterMatches = computed(() => {
if (!isFilterActive.value) return false
return (
visibleTagRows.value.length === 0 &&
hiddenTagRows.value.length === 0 &&
filteredOtherMajorGroups.value.length === 0
)
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 13, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid showing “No versions match” when the range is invalid.

Right now an invalid range triggers both the error message and the no‑matches banner, which is confusing. Gate the banner on a valid range (and, optionally, after full load).

Suggested fix
 const hasNoFilterMatches = computed(() => {
   if (!isFilterActive.value) return false
+  if (isInvalidRange.value) return false
   return (
     visibleTagRows.value.length === 0 &&
     hiddenTagRows.value.length === 0 &&
     filteredOtherMajorGroups.value.length === 0
   )
 })

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it looks fine, but open to thoughts

Copy link
Contributor

Choose a reason for hiding this comment

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

@serhalp, totally understood! The double message could actually help some users understand that the filter just isn't working yet—I can see the logic there. Thanks for considering it! 🙂

/\_/\

( o.o )
> ^

@danielroe danielroe added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 456daee Feb 13, 2026
20 checks passed
@danielroe danielroe deleted the feat/filter-pkg-versions-by-semver branch February 13, 2026 08:21
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.

2 participants