@@ -17,6 +17,7 @@ const props = defineProps<{
1717 versions: Record <string , SlimVersion >
1818 distTags: Record <string , string >
1919 time: Record <string , string >
20+ selectedVersion? : string
2021}>()
2122
2223/** Maximum number of dist-tag rows to show before collapsing into "Other versions" */
@@ -42,6 +43,10 @@ function versionRoute(version: string): RouteLocationRaw {
4243// Version to tags lookup (supports multiple tags per version)
4344const versionToTags = computed (() => buildVersionToTagsMap (props .distTags ))
4445
46+ const effectiveCurrentVersion = computed (
47+ () => props .selectedVersion ?? props .distTags .latest ?? undefined ,
48+ )
49+
4550// All tag rows derived from props (SSR-safe)
4651// Deduplicates so each version appears only once, with all its tags
4752const allTagRows = computed (() => {
@@ -298,6 +303,36 @@ function toggleMajorGroup(groupKey: string) {
298303function getTagVersions(tag : string ): VersionDisplay [] {
299304 return tagVersions .value .get (tag ) ?? []
300305}
306+
307+ function findClaimingTag(version : string ): string | null {
308+ const versionChannel = getPrereleaseChannel (version )
309+
310+ // First matching tag claims the version
311+ for (const row of allTagRows .value ) {
312+ const tagVersion = props .distTags [row .tag ]
313+ if (! tagVersion ) continue
314+
315+ const tagChannel = getPrereleaseChannel (tagVersion )
316+
317+ if (isSameVersionGroup (version , tagVersion ) && versionChannel === tagChannel ) {
318+ return row .tag
319+ }
320+ }
321+
322+ return null
323+ }
324+
325+ // Whether this row should be highlighted for the current version
326+ function rowContainsCurrentVersion(row : (typeof visibleTagRows .value )[0 ]): boolean {
327+ if (! effectiveCurrentVersion .value ) return false
328+
329+ if (row .primaryVersion .version === effectiveCurrentVersion .value ) return true
330+
331+ if (getTagVersions (row .tag ).some (v => v .version === effectiveCurrentVersion .value )) return true
332+
333+ const claimingTag = findClaimingTag (effectiveCurrentVersion .value )
334+ return claimingTag === row .tag
335+ }
301336 </script >
302337
303338<template >
@@ -323,7 +358,7 @@ function getTagVersions(tag: string): VersionDisplay[] {
323358 <div v-for =" row in visibleTagRows" :key =" row.id" >
324359 <div
325360 class =" flex items-center gap-2 pe-2 px-1"
326- :class =" row.tag === 'latest' ? 'bg-bg-subtle rounded-lg' : ''"
361+ :class =" rowContainsCurrentVersion( row) ? 'bg-bg-subtle rounded-lg' : ''"
327362 >
328363 <!-- Expand button (only if there are more versions to show) -->
329364 <button
@@ -419,7 +454,12 @@ function getTagVersions(tag: string): VersionDisplay[] {
419454 v-if =" expandedTags.has(row.tag) && getTagVersions(row.tag).length > 1"
420455 class =" ms-4 ps-2 border-is border-border space-y-0.5 pe-2"
421456 >
422- <div v-for =" v in getTagVersions(row.tag).slice(1)" :key =" v.version" class =" py-1" >
457+ <div
458+ v-for =" v in getTagVersions(row.tag).slice(1)"
459+ :key =" v.version"
460+ class =" py-1"
461+ :class =" v.version === effectiveCurrentVersion ? 'rounded bg-bg-subtle px-2 -mx-2' : ''"
462+ >
423463 <div class =" flex items-center justify-between gap-2" >
424464 <NuxtLink
425465 :to =" versionRoute(v.version)"
0 commit comments