Commit f6db947345

f6db947345a9b6a0960138e05f79412ee18b1279

parent: b39613b6eb

Unsigned

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

ext count

Layout: unified · split

docs/.vitepress/theme/components/extrepo/RepoRow.vue +26
@@ -1,6 +1,7 @@
11<script setup lang="ts">
22import { computed, ref } from 'vue'
33import { NOT_EXPANDABLE_REPOS } from './constants'
4import { groupSites } from './groupSites'
45import { stripHtml } from './helpers'
56import {
67 copyValue,
@@ -37,6 +38,26 @@ const sites = computed(() => {
3738 const all = repoData.value[dataUrl]?.sites ?? []
3839 return props.showBroken ? all : all.filter(site => !site.isBroken)
3940})
41const siteCount = computed(() => {
42 const countFor = (url: string | null | undefined) => {
43 const all = url ? repoData.value[url]?.sites ?? [] : []
44 const visible = props.showBroken
45 ? all
46 : all.filter(site => !site.isBroken)
47 return groupSites(visible).length
48 }
49 if (props.repo.variants?.length) {
50 return props.repo.variants.reduce(
51 (total, variant) => total + countFor(mangayomiCopyValue(variant)),
52 0
53 )
54 }
55 return countFor(props.repo.data ?? props.repo.indexUrl)
56})
57const siteCountTitle = computed(
58 () =>
59 `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available`
60)
4061const repoName = computed(() => stripHtml(props.repo.name))
4162const isExpandable = computed(() => !NOT_EXPANDABLE_REPOS.has(repoName.value))
4263const installUrl = computed(() =>
@@ -83,6 +104,11 @@ async function copyHeaderVariantUrl() {
83104 <div class="ext-repo-row">
84105 <div class="ext-repo-name">
85106 <span v-html="repo.name" />
107 <span
108 v-if="siteCount"
109 class="ext-repo-count"
110 :title="siteCountTitle"
111 >{{ siteCount }}</span>
86112 <VTooltip v-if="repo.note" theme="vp-tooltip">
87113 <button type="button" class="ext-note-btn" aria-label="Note">
88114 <span class="i-lucide:lightbulb" />
docs/.vitepress/theme/components/extrepo/RepoVariantRow.vue +17 −1
@@ -1,5 +1,6 @@
11<script setup lang="ts">
22import { computed, ref } from 'vue'
3import { groupSites } from './groupSites'
34import {
45 mangayomiCopyValue,
56 mangayomiHref,
@@ -37,6 +38,11 @@ const sites = computed(() => {
3738 const all = url ? repoData.value[url]?.sites ?? [] : []
3839 return props.showBroken ? all : all.filter(site => !site.isBroken)
3940})
41const siteCount = computed(() => groupSites(sites.value).length)
42const siteCountTitle = computed(
43 () =>
44 `${siteCount.value} extension${siteCount.value === 1 ? '' : 's'} available`
45)
4046
4147async function copyVariantUrl() {
4248 if (!copyValue.value) return
@@ -47,7 +53,14 @@ async function copyVariantUrl() {
4753<template>
4854 <div class="ext-repo-variant">
4955 <div class="ext-repo-variant-row">
50 <span class="ext-repo-variant-label">{{ variant.label }}</span>
56 <span class="ext-repo-variant-label">
57 {{ variant.label }}
58 <span
59 v-if="siteCount"
60 class="ext-repo-count"
61 :title="siteCountTitle"
62 >{{ siteCount }}</span>
63 </span>
5164 <div class="ext-repo-actions">
5265 <template v-if="showActions">
5366 <a class="ext-btn ext-btn-install" :href="installUrl">
@@ -115,6 +128,9 @@ async function copyVariantUrl() {
115128 border-top: 1px solid var(--vp-c-divider);
116129}
117130.ext-repo-variant-label {
131 display: inline-flex;
132 align-items: center;
133 gap: 6px;
118134 font-size: 13px;
119135 color: var(--vp-c-text-2);
120136}
docs/.vitepress/theme/components/extrepo/repoRowShared.css +16
@@ -4,6 +4,22 @@
44 gap: 6px;
55 flex-shrink: 0;
66}
7.ext-repo-count {
8 display: inline-flex;
9 align-items: center;
10 justify-content: center;
11 min-width: 20px;
12 padding: 1px 6px;
13 border-radius: 6px;
14 border: 1px solid var(--vp-c-divider);
15 background-color: var(--vp-c-bg);
16 color: var(--vp-c-text-2);
17 font-size: 11px;
18 font-weight: 600;
19 line-height: 16px;
20 font-variant-numeric: tabular-nums;
21 flex-shrink: 0;
22}
723.ext-btn {
824 display: inline-flex;
925 align-items: center;