Commit 70f1c357bc

70f1c357bc0408447512b61aa07c1bf0613c956b

parent: 9478696275

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-13 15:10 UTC

extrepo update

Layout: unified · split

docs/.vitepress/theme/components/extrepo/SiteGrid.vue +5 −32
@@ -15,40 +15,13 @@ interface SiteGroup {
1515}
1616
1717const groups = computed<SiteGroup[]>(() => {
18 const parent = props.sites.map((_, i) => i)
19 function find(i: number): number {
20 while (parent[i] !== i) {
21 parent[i] = parent[parent[i]]
22 i = parent[i]
23 }
24 return i
25 }
26 function union(a: number, b: number) {
27 const rootA = find(a)
28 const rootB = find(b)
29 if (rootA !== rootB) parent[rootA] = rootB
30 }
31
32 const byName = new Map<string, number>()
33 const byUrl = new Map<string, number>()
34 props.sites.forEach((site, i) => {
35 const scope = site.repoName ?? ''
36 const nameKey = `${scope}-${site.name}`
37 if (byName.has(nameKey)) union(i, byName.get(nameKey)!)
38 else byName.set(nameKey, i)
39
40 const urlKey = `${scope}-${site.url}`
41 if (byUrl.has(urlKey)) union(i, byUrl.get(urlKey)!)
42 else byUrl.set(urlKey, i)
43 })
44
45 const map = new Map<number, SiteGroup>()
18 const map = new Map<string, SiteGroup>()
4619 props.sites.forEach((site, i) => {
47 const root = find(i)
48 let group = map.get(root)
20 const key = site.url ? `${site.repoName ?? ''}-${site.url}` : `no-url-${i}`
21 let group = map.get(key)
4922 if (!group) {
50 group = { key: `group-${root}`, sites: [] }
51 map.set(root, group)
23 group = { key, sites: [] }
24 map.set(key, group)
5225 }
5326 group.sites.push(site)
5427 })
docs/.vitepress/theme/components/extrepo/SiteGroupCell.vue +7 −3
@@ -1,6 +1,6 @@
11<script setup lang="ts">
22import { computed } from 'vue'
3import { ratingIcon, ratingTitle } from './helpers'
3import { langLabel, ratingIcon, ratingTitle } from './helpers'
44import LazyIcon from './LazyIcon.vue'
55import type { RepoSite } from './types'
66
@@ -26,7 +26,11 @@ const groupName = computed(() => {
2626 if (wordLists.every(words => words[i] === word)) common.push(word)
2727 else break
2828 }
29 return common.length > 0 ? common.join(' ') : primary.value.name
29 if (common.length > 0) return common.join(' ')
30
31 const label = langLabel(primary.value.lang)
32 const stripped = primary.value.name.replace(new RegExp(`\\s*${label}$`, 'i'), '').trim()
33 return stripped || primary.value.name
3034})
3135</script>
3236
@@ -48,7 +52,7 @@ const groupName = computed(() => {
4852 :class="ratingIcon(highestRated.rating)"
4953 :title="ratingTitle(highestRated.rating)"
5054 />
51 <span class="ext-site-layers i-lucide:layers" title="Multiple varsions available" />
55 <span class="ext-site-layers i-lucide:layers" :title="`${sites.length} versions available`" />
5256 </div>
5357 <span v-if="primary.repoName" class="ext-site-repo">{{ primary.repoName }}</span>
5458 </button>