Commit 211ea19345
Unsigned
Layout: unified · split
docs/.vitepress/configs/markdown/extRepoPlugin.ts added +136
| @@ -0,0 +1,136 @@ | |||
| 1 | import type MarkdownIt from 'markdown-it' | ||
| 2 | |||
| 3 | // Types | ||
| 4 | |||
| 5 | interface ParsedRepoRow { | ||
| 6 | name: string | ||
| 7 | indexUrl: string | ||
| 8 | note?: string | ||
| 9 | } | ||
| 10 | |||
| 11 | interface ParsedRepoEntry { | ||
| 12 | name: string | ||
| 13 | url?: string | ||
| 14 | src?: string | ||
| 15 | raw?: string | ||
| 16 | note?: string | ||
| 17 | } | ||
| 18 | |||
| 19 | // Parser | ||
| 20 | |||
| 21 | function parseAttrs(info: string): Record<string, string> { | ||
| 22 | const match = info.match(/\{([^}]*)\}/) | ||
| 23 | if (!match) return {} | ||
| 24 | const attrs: Record<string, string> = {} | ||
| 25 | for (const pair of match[1].split(/\s+/).filter(Boolean)) { | ||
| 26 | const [key, value] = pair.split('=') | ||
| 27 | if (key && value) attrs[key] = value.replace(/^["']|["']$/g, '') | ||
| 28 | } | ||
| 29 | return attrs | ||
| 30 | } | ||
| 31 | |||
| 32 | const FIELD_KEYS = new Set(['url', 'src', 'raw', 'note']) | ||
| 33 | |||
| 34 | function parseEntries(bodyLines: string[]): ParsedRepoEntry[] { | ||
| 35 | const entries: ParsedRepoEntry[] = [] | ||
| 36 | let current: ParsedRepoEntry | null = null | ||
| 37 | |||
| 38 | for (const rawLine of bodyLines) { | ||
| 39 | const line = rawLine.trim() | ||
| 40 | if (!line) continue | ||
| 41 | |||
| 42 | const headingMatch = line.match(/^==\s+(.+)$/) | ||
| 43 | if (headingMatch) { | ||
| 44 | if (current) entries.push(current) | ||
| 45 | current = { name: headingMatch[1].trim() } | ||
| 46 | continue | ||
| 47 | } | ||
| 48 | |||
| 49 | const fieldMatch = line.match(/^-\s*([a-zA-Z]+)\s*:\s*(.+)$/) | ||
| 50 | if (fieldMatch && current) { | ||
| 51 | const key = fieldMatch[1].toLowerCase() | ||
| 52 | if (FIELD_KEYS.has(key)) current[key as 'url' | 'src' | 'raw' | 'note'] = fieldMatch[2].trim() | ||
| 53 | } | ||
| 54 | } | ||
| 55 | if (current) entries.push(current) | ||
| 56 | |||
| 57 | return entries | ||
| 58 | } | ||
| 59 | |||
| 60 | function nameMarkdown(entry: ParsedRepoEntry): string { | ||
| 61 | const label = entry.url ? `[${entry.name}](${entry.url})` : entry.name | ||
| 62 | return entry.src ? `${label} [:src:](${entry.src})` : label | ||
| 63 | } | ||
| 64 | |||
| 65 | // Plugin | ||
| 66 | |||
| 67 | export function extRepoPlugin(md: MarkdownIt): void { | ||
| 68 | const MARKER = ':' | ||
| 69 | const MIN_MARKERS = 3 | ||
| 70 | const NAME = 'extrepo' | ||
| 71 | |||
| 72 | md.block.ruler.before( | ||
| 73 | 'fence', | ||
| 74 | 'ext_repo', | ||
| 75 | (state, startLine, endLine, silent) => { | ||
| 76 | let pos = state.bMarks[startLine] + state.tShift[startLine] | ||
| 77 | let max = state.eMarks[startLine] | ||
| 78 | |||
| 79 | let markerCount = 0 | ||
| 80 | while (pos < max && state.src[pos] === MARKER) { | ||
| 81 | pos++ | ||
| 82 | markerCount++ | ||
| 83 | } | ||
| 84 | if (markerCount < MIN_MARKERS) return false | ||
| 85 | |||
| 86 | const params = state.src.slice(pos, max).trim() | ||
| 87 | if (!params.toLowerCase().startsWith(NAME)) return false | ||
| 88 | |||
| 89 | if (silent) return true | ||
| 90 | |||
| 91 | let nextLine = startLine + 1 | ||
| 92 | let found = false | ||
| 93 | while (nextLine < endLine) { | ||
| 94 | let p = state.bMarks[nextLine] + state.tShift[nextLine] | ||
| 95 | const m = state.eMarks[nextLine] | ||
| 96 | if (p < m && state.sCount[nextLine] < state.blkIndent) break | ||
| 97 | |||
| 98 | let cnt = 0 | ||
| 99 | while (p < m && state.src[p] === MARKER) { p++; cnt++ } | ||
| 100 | if (cnt >= markerCount && state.src.slice(p, m).trim() === '') { | ||
| 101 | found = true | ||
| 102 | break | ||
| 103 | } | ||
| 104 | nextLine++ | ||
| 105 | } | ||
| 106 | |||
| 107 | const bodyLines: string[] = [] | ||
| 108 | for (let i = startLine + 1; i < nextLine; i++) { | ||
| 109 | bodyLines.push(state.src.slice(state.bMarks[i], state.eMarks[i])) | ||
| 110 | } | ||
| 111 | |||
| 112 | const attrs = parseAttrs(params) | ||
| 113 | const scheme = attrs.scheme || 'tachiyomi' | ||
| 114 | |||
| 115 | const rows: ParsedRepoRow[] = [] | ||
| 116 | for (const entry of parseEntries(bodyLines)) { | ||
| 117 | if (!entry.raw) continue | ||
| 118 | rows.push({ | ||
| 119 | name: md.renderInline(nameMarkdown(entry), state.env), | ||
| 120 | indexUrl: entry.raw, | ||
| 121 | note: entry.note ? md.render(entry.note) : undefined | ||
| 122 | }) | ||
| 123 | } | ||
| 124 | |||
| 125 | const reposJson = JSON.stringify(rows).replace(/'/g, ''') | ||
| 126 | |||
| 127 | const token = state.push('html_block', '', 0) | ||
| 128 | token.map = [startLine, nextLine] | ||
| 129 | token.content = `<ExtensionRepos scheme="${scheme}" :repos='${reposJson}' />\n` | ||
| 130 | |||
| 131 | state.line = found ? nextLine + 1 : nextLine | ||
| 132 | return true | ||
| 133 | }, | ||
| 134 | { alt: ['paragraph', 'reference', 'blockquote', 'list'] } | ||
| 135 | ) | ||
| 136 | } | ||
docs/.vitepress/configs/markdown/index.ts +2
| @@ -24,6 +24,7 @@ import { | |||
| 24 | import { getTooltip } from '../../utils/tooltips' | 24 | import { getTooltip } from '../../utils/tooltips' |
| 25 | import { headersPlugin } from '../markdown/headers' | 25 | import { headersPlugin } from '../markdown/headers' |
| 26 | import { emojiRender } from './emoji' | 26 | import { emojiRender } from './emoji' |
| 27 | import { extRepoPlugin } from './extRepoPlugin' | ||
| 27 | import { nestedContainersPlugin } from './nestedContainers' | 28 | import { nestedContainersPlugin } from './nestedContainers' |
| 28 | import { scrapeTablePlugin } from './scrapeTablePlugin' | 29 | import { scrapeTablePlugin } from './scrapeTablePlugin' |
| 29 | import markdownSteps from './steps' | 30 | import markdownSteps from './steps' |
| @@ -50,6 +51,7 @@ export function configureMarkdown(md: MarkdownRenderer) { | |||
| 50 | renderInlineTooltip(md) | 51 | renderInlineTooltip(md) |
| 51 | md.use(markdownSteps) | 52 | md.use(markdownSteps) |
| 52 | md.use(scrapeTablePlugin) | 53 | md.use(scrapeTablePlugin) |
| 54 | md.use(extRepoPlugin) | ||
| 53 | renderHighlight(md) | 55 | renderHighlight(md) |
| 54 | } | 56 | } |
| 55 | 57 | ||
docs/.vitepress/configs/markdown/langFlags.ts added +85
| @@ -0,0 +1,85 @@ | |||
| 1 | /** | ||
| 2 | * ISO 639-1 language code -> Twemoji flag icon name (from @iconify-json/twemoji). | ||
| 3 | * Shared between ExtensionRepos.vue (to build `i-twemoji-<icon>` classes at | ||
| 4 | * runtime) and unocss.config.ts (to safelist those classes, since UnoCSS's | ||
| 5 | * static scanner can't see template-literal-constructed class names). | ||
| 6 | */ | ||
| 7 | export const LANG_FLAG_ICONS: Record<string, string> = { | ||
| 8 | all: 'globe-showing-asia-australia', | ||
| 9 | en: 'flag-united-kingdom', | ||
| 10 | ja: 'flag-japan', | ||
| 11 | zh: 'flag-china', | ||
| 12 | 'zh-hans': 'flag-china', | ||
| 13 | 'zh-hant': 'flag-taiwan', | ||
| 14 | 'zh-tw': 'flag-taiwan', | ||
| 15 | 'zh-hk': 'flag-hong-kong-sar-china', | ||
| 16 | ko: 'flag-south-korea', | ||
| 17 | es: 'flag-spain', | ||
| 18 | 'es-419': 'flag-mexico', | ||
| 19 | fr: 'flag-france', | ||
| 20 | de: 'flag-germany', | ||
| 21 | it: 'flag-italy', | ||
| 22 | pt: 'flag-portugal', | ||
| 23 | 'pt-br': 'flag-brazil', | ||
| 24 | ru: 'flag-russia', | ||
| 25 | ar: 'flag-saudi-arabia', | ||
| 26 | vi: 'flag-vietnam', | ||
| 27 | id: 'flag-indonesia', | ||
| 28 | jv: 'flag-indonesia', | ||
| 29 | ms: 'flag-malaysia', | ||
| 30 | tr: 'flag-turkiye', | ||
| 31 | pl: 'flag-poland', | ||
| 32 | nl: 'flag-netherlands', | ||
| 33 | cs: 'flag-czechia', | ||
| 34 | da: 'flag-denmark', | ||
| 35 | sv: 'flag-sweden', | ||
| 36 | uk: 'flag-ukraine', | ||
| 37 | hi: 'flag-india', | ||
| 38 | pa: 'flag-india', | ||
| 39 | ta: 'flag-india', | ||
| 40 | te: 'flag-india', | ||
| 41 | kn: 'flag-india', | ||
| 42 | ml: 'flag-india', | ||
| 43 | mr: 'flag-india', | ||
| 44 | th: 'flag-thailand', | ||
| 45 | fa: 'flag-iran', | ||
| 46 | hu: 'flag-hungary', | ||
| 47 | ro: 'flag-romania', | ||
| 48 | mo: 'flag-moldova', | ||
| 49 | el: 'flag-greece', | ||
| 50 | fi: 'flag-finland', | ||
| 51 | bg: 'flag-bulgaria', | ||
| 52 | no: 'flag-norway', | ||
| 53 | he: 'flag-israel', | ||
| 54 | bn: 'flag-bangladesh', | ||
| 55 | ceb: 'flag-philippines', | ||
| 56 | fil: 'flag-philippines', | ||
| 57 | tl: 'flag-philippines', | ||
| 58 | et: 'flag-estonia', | ||
| 59 | lv: 'flag-latvia', | ||
| 60 | lt: 'flag-lithuania', | ||
| 61 | sk: 'flag-slovakia', | ||
| 62 | sl: 'flag-slovenia', | ||
| 63 | sr: 'flag-serbia', | ||
| 64 | hr: 'flag-croatia', | ||
| 65 | sq: 'flag-albania', | ||
| 66 | az: 'flag-azerbaijan', | ||
| 67 | be: 'flag-belarus', | ||
| 68 | ka: 'flag-georgia', | ||
| 69 | kk: 'flag-kazakhstan', | ||
| 70 | uz: 'flag-uzbekistan', | ||
| 71 | mn: 'flag-mongolia', | ||
| 72 | my: 'flag-myanmar-burma', | ||
| 73 | ne: 'flag-nepal', | ||
| 74 | ur: 'flag-pakistan', | ||
| 75 | af: 'flag-south-africa', | ||
| 76 | ga: 'flag-ireland', | ||
| 77 | is: 'flag-iceland', | ||
| 78 | eu: 'flag-spain', | ||
| 79 | ca: 'flag-spain', | ||
| 80 | co: 'flag-france', | ||
| 81 | vec: 'flag-italy', | ||
| 82 | lmo: 'flag-italy' | ||
| 83 | } | ||
| 84 | |||
| 85 | export const LANG_FLAG_FALLBACK = 'globe-showing-asia-australia' | ||
docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue added +122
| @@ -0,0 +1,122 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { computed, ref } from 'vue' | ||
| 3 | import { data as repoData } from '../../../../ext/extensionRepos.data' | ||
| 4 | import { langLabel, stripHtml } from './helpers' | ||
| 5 | import RepoRow from './RepoRow.vue' | ||
| 6 | import SettingsMenu from './SettingsMenu.vue' | ||
| 7 | import SiteGrid from './SiteGrid.vue' | ||
| 8 | import type { MatchedSite, RatingFilter, Repo } from './types' | ||
| 9 | |||
| 10 | const props = defineProps<{ | ||
| 11 | repos: Repo[] | ||
| 12 | scheme: string | ||
| 13 | }>() | ||
| 14 | |||
| 15 | const query = ref('') | ||
| 16 | const langFilter = ref('') | ||
| 17 | const ratingFilter = ref<RatingFilter>('all') | ||
| 18 | |||
| 19 | const allSites = computed<MatchedSite[]>(() => { | ||
| 20 | const repoNames = new Map(props.repos.map(repo => [repo.indexUrl, stripHtml(repo.name)])) | ||
| 21 | const sites: MatchedSite[] = [] | ||
| 22 | for (const repo of props.repos) { | ||
| 23 | for (const site of repoData[repo.indexUrl]?.sites ?? []) { | ||
| 24 | sites.push({ ...site, repoName: repoNames.get(repo.indexUrl) ?? '' }) | ||
| 25 | } | ||
| 26 | } | ||
| 27 | return sites | ||
| 28 | }) | ||
| 29 | |||
| 30 | const hasSuggestive = computed(() => allSites.value.some(site => site.rating === 'suggestive')) | ||
| 31 | const hasMultiLanguage = computed(() => allSites.value.some(site => site.lang.toLowerCase() === 'all')) | ||
| 32 | |||
| 33 | const availableLangs = computed(() => { | ||
| 34 | const codes = new Set(allSites.value.map(site => site.lang)) | ||
| 35 | codes.delete('all') | ||
| 36 | return [...codes].sort((a, b) => langLabel(a).localeCompare(langLabel(b))) | ||
| 37 | }) | ||
| 38 | |||
| 39 | const isFiltering = computed(() => { | ||
| 40 | return query.value.trim() !== '' || langFilter.value !== '' || ratingFilter.value !== 'all' | ||
| 41 | }) | ||
| 42 | |||
| 43 | const filteredSites = computed(() => { | ||
| 44 | const q = query.value.trim().toLowerCase() | ||
| 45 | return allSites.value.filter(site => { | ||
| 46 | if (q && !site.name.toLowerCase().includes(q)) return false | ||
| 47 | if (langFilter.value && site.lang !== langFilter.value) return false | ||
| 48 | if (ratingFilter.value !== 'all' && site.rating !== ratingFilter.value) return false | ||
| 49 | return true | ||
| 50 | }) | ||
| 51 | }) | ||
| 52 | </script> | ||
| 53 | |||
| 54 | <template> | ||
| 55 | <div class="ext-repos"> | ||
| 56 | <div class="ext-toolbar"> | ||
| 57 | <div class="ext-search"> | ||
| 58 | <span class="i-lucide:search" /> | ||
| 59 | <input v-model="query" type="text" placeholder="Search all sites…" /> | ||
| 60 | </div> | ||
| 61 | <SettingsMenu | ||
| 62 | v-model:lang-filter="langFilter" | ||
| 63 | v-model:rating-filter="ratingFilter" | ||
| 64 | :available-langs="availableLangs" | ||
| 65 | :has-multi-language="hasMultiLanguage" | ||
| 66 | :has-suggestive="hasSuggestive" | ||
| 67 | /> | ||
| 68 | </div> | ||
| 69 | |||
| 70 | <SiteGrid | ||
| 71 | v-if="isFiltering" | ||
| 72 | class="ext-search-results" | ||
| 73 | :sites="filteredSites" | ||
| 74 | empty-text="No sites match your filters." | ||
| 75 | /> | ||
| 76 | |||
| 77 | <div v-else> | ||
| 78 | <RepoRow v-for="repo in repos" :key="repo.indexUrl" :repo="repo" :scheme="scheme" /> | ||
| 79 | </div> | ||
| 80 | </div> | ||
| 81 | </template> | ||
| 82 | |||
| 83 | <style scoped> | ||
| 84 | .ext-repos { | ||
| 85 | margin: 16px 0; | ||
| 86 | border: 1px solid var(--vp-c-divider); | ||
| 87 | border-radius: var(--radius-xl, 12px); | ||
| 88 | overflow: hidden; | ||
| 89 | } | ||
| 90 | |||
| 91 | .ext-toolbar { | ||
| 92 | display: flex; | ||
| 93 | flex-wrap: wrap; | ||
| 94 | align-items: center; | ||
| 95 | gap: 8px; | ||
| 96 | padding: 10px; | ||
| 97 | background-color: var(--vp-c-bg-soft); | ||
| 98 | border-bottom: 1px solid var(--vp-c-divider); | ||
| 99 | } | ||
| 100 | |||
| 101 | .ext-search { | ||
| 102 | display: flex; | ||
| 103 | align-items: center; | ||
| 104 | gap: 6px; | ||
| 105 | flex: 1 1 200px; | ||
| 106 | padding: 6px 10px; | ||
| 107 | border-radius: 8px; | ||
| 108 | border: 1px solid var(--vp-c-divider); | ||
| 109 | background-color: var(--vp-c-bg); | ||
| 110 | color: var(--vp-c-text-2); | ||
| 111 | } | ||
| 112 | |||
| 113 | .ext-search input { | ||
| 114 | flex: 1; | ||
| 115 | min-width: 0; | ||
| 116 | border: none; | ||
| 117 | outline: none; | ||
| 118 | background: transparent; | ||
| 119 | color: var(--vp-c-text-1); | ||
| 120 | font-size: 13px; | ||
| 121 | } | ||
| 122 | </style> | ||
docs/.vitepress/theme/components/extrepo/LangSelect.vue added +186
| @@ -0,0 +1,186 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui' | ||
| 3 | import { onMounted, onUnmounted, ref } from 'vue' | ||
| 4 | import { langFlagClass, langLabel } from './helpers' | ||
| 5 | import MenuTitle from './MenuTitle.vue' | ||
| 6 | |||
| 7 | defineProps<{ | ||
| 8 | modelValue: string | ||
| 9 | availableLangs: string[] | ||
| 10 | hasMultiLanguage: boolean | ||
| 11 | }>() | ||
| 12 | |||
| 13 | const emit = defineEmits<{ | ||
| 14 | 'update:modelValue': [value: string] | ||
| 15 | }>() | ||
| 16 | |||
| 17 | const rootRef = ref<HTMLElement>() | ||
| 18 | const open = ref(false) | ||
| 19 | |||
| 20 | function select(lang: string) { | ||
| 21 | emit('update:modelValue', lang) | ||
| 22 | open.value = false | ||
| 23 | } | ||
| 24 | |||
| 25 | function onDocClick(e: MouseEvent) { | ||
| 26 | if (rootRef.value && !rootRef.value.contains(e.target as Node)) open.value = false | ||
| 27 | } | ||
| 28 | |||
| 29 | onMounted(() => document.addEventListener('click', onDocClick, true)) | ||
| 30 | onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | ||
| 31 | </script> | ||
| 32 | |||
| 33 | <template> | ||
| 34 | <div ref="rootRef" class="ext-lang-select" :class="{ 'ext-lang-select--open': open }"> | ||
| 35 | <MenuTitle icon="i-lucide:languages" title="Language" /> | ||
| 36 | <NuInputHighlight class="rounded-md"> | ||
| 37 | <button | ||
| 38 | type="button" | ||
| 39 | class="ext-lang-trigger" | ||
| 40 | aria-haspopup="listbox" | ||
| 41 | :aria-expanded="open" | ||
| 42 | @click="open = !open" | ||
| 43 | > | ||
| 44 | <span class="ext-lang-label">{{ modelValue ? langLabel(modelValue) : 'All languages' }}</span> | ||
| 45 | <span class="ext-lang-chevron i-lucide:chevron-down" :class="{ 'ext-lang-chevron--open': open }" /> | ||
| 46 | </button> | ||
| 47 | |||
| 48 | <NuVerticalTransition :duration="200"> | ||
| 49 | <div v-show="open" class="ext-lang-options" role="listbox"> | ||
| 50 | <button | ||
| 51 | type="button" | ||
| 52 | role="option" | ||
| 53 | class="ext-lang-option" | ||
| 54 | :class="{ 'ext-lang-option--selected': modelValue === '' }" | ||
| 55 | :aria-selected="modelValue === ''" | ||
| 56 | @click="select('')" | ||
| 57 | > | ||
| 58 | <span class="ext-lang-option-label">All languages</span> | ||
| 59 | <span class="ext-lang-option-flag" :class="langFlagClass('')" aria-hidden="true" /> | ||
| 60 | </button> | ||
| 61 | <button | ||
| 62 | v-if="hasMultiLanguage" | ||
| 63 | type="button" | ||
| 64 | role="option" | ||
| 65 | class="ext-lang-option" | ||
| 66 | :class="{ 'ext-lang-option--selected': modelValue === 'all' }" | ||
| 67 | :aria-selected="modelValue === 'all'" | ||
| 68 | @click="select('all')" | ||
| 69 | > | ||
| 70 | <span class="ext-lang-option-label">Multi-language</span> | ||
| 71 | <span class="ext-lang-option-flag" :class="langFlagClass('all')" aria-hidden="true" /> | ||
| 72 | </button> | ||
| 73 | <button | ||
| 74 | v-for="lang in availableLangs" | ||
| 75 | :key="lang" | ||
| 76 | type="button" | ||
| 77 | role="option" | ||
| 78 | class="ext-lang-option" | ||
| 79 | :class="{ 'ext-lang-option--selected': modelValue === lang }" | ||
| 80 | :aria-selected="modelValue === lang" | ||
| 81 | @click="select(lang)" | ||
| 82 | > | ||
| 83 | <span class="ext-lang-option-label">{{ langLabel(lang) }}</span> | ||
| 84 | <span class="ext-lang-option-flag" :class="langFlagClass(lang)" aria-hidden="true" /> | ||
| 85 | </button> | ||
| 86 | </div> | ||
| 87 | </NuVerticalTransition> | ||
| 88 | </NuInputHighlight> | ||
| 89 | </div> | ||
| 90 | </template> | ||
| 91 | |||
| 92 | <style scoped> | ||
| 93 | .ext-lang-select { | ||
| 94 | position: relative; | ||
| 95 | } | ||
| 96 | |||
| 97 | .ext-lang-trigger { | ||
| 98 | display: flex; | ||
| 99 | align-items: center; | ||
| 100 | gap: 8px; | ||
| 101 | width: 100%; | ||
| 102 | min-height: 44px; | ||
| 103 | padding: 7px 10px; | ||
| 104 | border-radius: 8px; | ||
| 105 | border: 2px solid var(--vp-c-divider); | ||
| 106 | background: var(--wk-c-menu-bg); | ||
| 107 | color: var(--vp-c-text-1); | ||
| 108 | font-size: 13px; | ||
| 109 | cursor: pointer; | ||
| 110 | transition: border-color 0.15s, background-color 0.15s; | ||
| 111 | } | ||
| 112 | |||
| 113 | .ext-lang-trigger:hover, | ||
| 114 | .ext-lang-select--open .ext-lang-trigger { | ||
| 115 | border-color: var(--vp-c-brand-1); | ||
| 116 | } | ||
| 117 | |||
| 118 | .ext-lang-label { | ||
| 119 | flex: 1; | ||
| 120 | text-align: left; | ||
| 121 | } | ||
| 122 | |||
| 123 | .ext-lang-chevron { | ||
| 124 | flex-shrink: 0; | ||
| 125 | color: var(--vp-c-text-2); | ||
| 126 | transition: transform 0.2s ease; | ||
| 127 | } | ||
| 128 | |||
| 129 | .ext-lang-chevron--open { | ||
| 130 | transform: rotate(180deg); | ||
| 131 | } | ||
| 132 | |||
| 133 | .ext-lang-options { | ||
| 134 | margin-top: 6px; | ||
| 135 | max-height: 240px; | ||
| 136 | overflow-y: auto; | ||
| 137 | overscroll-behavior: contain; | ||
| 138 | display: flex; | ||
| 139 | flex-direction: column; | ||
| 140 | gap: 2px; | ||
| 141 | padding: 4px; | ||
| 142 | border-radius: 8px; | ||
| 143 | border: 1px solid var(--vp-c-divider); | ||
| 144 | background: var(--vp-c-bg-elv); | ||
| 145 | box-shadow: var(--vp-shadow-2, 0 4px 16px rgba(0, 0, 0, 0.2)); | ||
| 146 | } | ||
| 147 | |||
| 148 | .ext-lang-option { | ||
| 149 | display: flex; | ||
| 150 | align-items: center; | ||
| 151 | gap: 8px; | ||
| 152 | padding: 5px 8px; | ||
| 153 | border-radius: 8px; | ||
| 154 | border: none; | ||
| 155 | background: transparent; | ||
| 156 | cursor: pointer; | ||
| 157 | color: var(--vp-c-text-1); | ||
| 158 | font-size: 13px; | ||
| 159 | text-align: left; | ||
| 160 | width: 100%; | ||
| 161 | transition: background-color 0.15s; | ||
| 162 | } | ||
| 163 | |||
| 164 | .ext-lang-option-label { | ||
| 165 | flex: 1; | ||
| 166 | min-width: 0; | ||
| 167 | } | ||
| 168 | |||
| 169 | .ext-lang-option-flag { | ||
| 170 | flex-shrink: 0; | ||
| 171 | font-size: 14px; | ||
| 172 | } | ||
| 173 | |||
| 174 | .ext-lang-option:hover { | ||
| 175 | background-color: var(--vp-c-bg-soft); | ||
| 176 | } | ||
| 177 | |||
| 178 | .ext-lang-option--selected { | ||
| 179 | background-color: var(--vp-c-brand-soft); | ||
| 180 | font-weight: 600; | ||
| 181 | } | ||
| 182 | |||
| 183 | .ext-lang-option--selected:hover { | ||
| 184 | background-color: var(--vp-c-brand-soft); | ||
| 185 | } | ||
| 186 | </style> | ||
docs/.vitepress/theme/components/extrepo/MenuTitle.vue added +30
| @@ -0,0 +1,30 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | defineProps<{ | ||
| 3 | icon: string | ||
| 4 | title: string | ||
| 5 | }>() | ||
| 6 | </script> | ||
| 7 | |||
| 8 | <template> | ||
| 9 | <h3 class="ext-menu-title"> | ||
| 10 | <span :class="icon" aria-hidden="true" /> | ||
| 11 | {{ title }} | ||
| 12 | </h3> | ||
| 13 | </template> | ||
| 14 | |||
| 15 | <style scoped> | ||
| 16 | .ext-menu-title { | ||
| 17 | display: flex; | ||
| 18 | align-items: center; | ||
| 19 | gap: 6px; | ||
| 20 | margin: 0 0 8px; | ||
| 21 | font-size: 13px; | ||
| 22 | font-weight: 600; | ||
| 23 | color: var(--vp-c-text-1); | ||
| 24 | } | ||
| 25 | |||
| 26 | .ext-menu-title span { | ||
| 27 | font-size: 14px; | ||
| 28 | color: var(--vp-c-text-2); | ||
| 29 | } | ||
| 30 | </style> | ||
docs/.vitepress/theme/components/extrepo/RatingFilter.vue added +50
| @@ -0,0 +1,50 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { NuInputHorizontalRadioGroup } from '@nolebase/ui' | ||
| 3 | import { computed } from 'vue' | ||
| 4 | import MenuTitle from './MenuTitle.vue' | ||
| 5 | import type { RatingFilter } from './types' | ||
| 6 | |||
| 7 | const props = defineProps<{ | ||
| 8 | modelValue: RatingFilter | ||
| 9 | hasSuggestive: boolean | ||
| 10 | }>() | ||
| 11 | |||
| 12 | const emit = defineEmits<{ | ||
| 13 | 'update:modelValue': [value: RatingFilter] | ||
| 14 | }>() | ||
| 15 | |||
| 16 | const options = computed(() => { | ||
| 17 | const base = [ | ||
| 18 | { value: 'all', title: 'All', ariaLabel: 'All', text: 'All', name: 'Rating' }, | ||
| 19 | { value: 'safe', title: 'Safe', ariaLabel: 'Safe', text: 'Safe', name: 'Rating' } | ||
| 20 | ] | ||
| 21 | if (props.hasSuggestive) { | ||
| 22 | base.push({ value: 'suggestive', title: 'Mature', ariaLabel: 'Mature', text: 'Mature', name: 'Rating' }) | ||
| 23 | } | ||
| 24 | base.push({ | ||
| 25 | value: 'nsfw', | ||
| 26 | title: props.hasSuggestive ? 'Adult' : 'NSFW', | ||
| 27 | ariaLabel: 'NSFW', | ||
| 28 | text: props.hasSuggestive ? 'Adult' : 'NSFW', | ||
| 29 | name: 'Rating' | ||
| 30 | }) | ||
| 31 | return base | ||
| 32 | }) | ||
| 33 | |||
| 34 | const rating = computed({ | ||
| 35 | get: () => props.modelValue, | ||
| 36 | set: (value: RatingFilter) => emit('update:modelValue', value) | ||
| 37 | }) | ||
| 38 | </script> | ||
| 39 | |||
| 40 | <template> | ||
| 41 | <div class="ext-rating" role="radiogroup"> | ||
| 42 | <MenuTitle icon="i-lucide:shield" title="Rating" /> | ||
| 43 | <NuInputHorizontalRadioGroup | ||
| 44 | v-model="rating" | ||
| 45 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" | ||
| 46 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" | ||
| 47 | :options="options" | ||
| 48 | /> | ||
| 49 | </div> | ||
| 50 | </template> | ||
docs/.vitepress/theme/components/extrepo/RepoRow.vue added +195
| @@ -0,0 +1,195 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { computed, ref } from 'vue' | ||
| 3 | import { data as repoData } from '../../../../ext/extensionRepos.data' | ||
| 4 | import { copyValue, installHref } from './install' | ||
| 5 | import SiteGrid from './SiteGrid.vue' | ||
| 6 | import type { Repo } from './types' | ||
| 7 | |||
| 8 | const props = defineProps<{ | ||
| 9 | repo: Repo | ||
| 10 | scheme: string | ||
| 11 | }>() | ||
| 12 | |||
| 13 | const open = ref(false) | ||
| 14 | const copied = ref(false) | ||
| 15 | |||
| 16 | const sites = computed(() => repoData[props.repo.indexUrl]?.sites ?? []) | ||
| 17 | const isExpandable = computed(() => sites.value.length > 1) | ||
| 18 | |||
| 19 | async function copyUrl() { | ||
| 20 | await navigator.clipboard.writeText(copyValue(props.scheme, props.repo.indexUrl)) | ||
| 21 | copied.value = true | ||
| 22 | setTimeout(() => { copied.value = false }, 1500) | ||
| 23 | } | ||
| 24 | </script> | ||
| 25 | |||
| 26 | <template> | ||
| 27 | <div class="ext-repo"> | ||
| 28 | <div class="ext-repo-row"> | ||
| 29 | <div class="ext-repo-name"> | ||
| 30 | <span v-html="repo.name" /> | ||
| 31 | <VTooltip v-if="repo.note" theme="vp-tooltip"> | ||
| 32 | <button type="button" class="ext-note-btn" aria-label="Note"> | ||
| 33 | <span class="i-lucide:lightbulb" /> | ||
| 34 | </button> | ||
| 35 | <template #popper> | ||
| 36 | <div class="ext-note-popper" v-html="repo.note" /> | ||
| 37 | </template> | ||
| 38 | </VTooltip> | ||
| 39 | </div> | ||
| 40 | <div class="ext-repo-actions"> | ||
| 41 | <a class="ext-btn ext-btn-install" :href="installHref(scheme, repo)"> | ||
| 42 | <span class="i-lucide:download" /> | ||
| 43 | Install | ||
| 44 | </a> | ||
| 45 | <button class="ext-btn ext-btn-copy" type="button" @click="copyUrl"> | ||
| 46 | <span v-if="copied" class="i-lucide:check" /> | ||
| 47 | <span v-else class="i-lucide:copy" /> | ||
| 48 | </button> | ||
| 49 | <button | ||
| 50 | class="ext-btn ext-btn-toggle" | ||
| 51 | type="button" | ||
| 52 | :class="{ open, 'ext-btn-toggle-hidden': !isExpandable }" | ||
| 53 | :aria-expanded="open" | ||
| 54 | :aria-hidden="!isExpandable" | ||
| 55 | :tabindex="isExpandable ? undefined : -1" | ||
| 56 | @click="isExpandable && (open = !open)" | ||
| 57 | > | ||
| 58 | <span class="i-lucide:chevron-down" /> | ||
| 59 | </button> | ||
| 60 | </div> | ||
| 61 | </div> | ||
| 62 | |||
| 63 | <SiteGrid v-if="isExpandable && open" :sites="sites" empty-text="No site data available." /> | ||
| 64 | </div> | ||
| 65 | </template> | ||
| 66 | |||
| 67 | <style scoped> | ||
| 68 | .ext-repo + .ext-repo { | ||
| 69 | border-top: 1px solid var(--vp-c-divider); | ||
| 70 | } | ||
| 71 | |||
| 72 | .ext-repo-row { | ||
| 73 | display: flex; | ||
| 74 | align-items: center; | ||
| 75 | justify-content: space-between; | ||
| 76 | gap: 12px; | ||
| 77 | padding: 10px 14px; | ||
| 78 | background-color: var(--vp-c-bg-soft); | ||
| 79 | } | ||
| 80 | |||
| 81 | .ext-repo-name { | ||
| 82 | font-size: 14px; | ||
| 83 | font-weight: 600; | ||
| 84 | color: var(--vp-c-text-1); | ||
| 85 | display: flex; | ||
| 86 | align-items: center; | ||
| 87 | gap: 6px; | ||
| 88 | min-width: 0; | ||
| 89 | } | ||
| 90 | |||
| 91 | .ext-repo-name :deep(a) { | ||
| 92 | color: inherit; | ||
| 93 | } | ||
| 94 | |||
| 95 | .ext-note-btn { | ||
| 96 | display: inline-flex; | ||
| 97 | align-items: center; | ||
| 98 | justify-content: center; | ||
| 99 | padding: 0; | ||
| 100 | margin: 0; | ||
| 101 | border: none; | ||
| 102 | background: transparent; | ||
| 103 | color: var(--vp-c-brand-1); | ||
| 104 | cursor: pointer; | ||
| 105 | line-height: 0; | ||
| 106 | flex-shrink: 0; | ||
| 107 | } | ||
| 108 | |||
| 109 | .ext-note-btn span { | ||
| 110 | font-size: 13px; | ||
| 111 | vertical-align: 0; | ||
| 112 | } | ||
| 113 | |||
| 114 | .ext-note-popper { | ||
| 115 | max-width: 280px; | ||
| 116 | padding: 10px 12px; | ||
| 117 | border-radius: 8px; | ||
| 118 | border: 2px solid var(--vp-c-divider); | ||
| 119 | background-color: var(--vp-c-bg-elv, var(--vp-c-bg)); | ||
| 120 | box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); | ||
| 121 | font-size: 13px; | ||
| 122 | font-weight: 400; | ||
| 123 | line-height: 1.5; | ||
| 124 | color: var(--vp-c-text-2); | ||
| 125 | } | ||
| 126 | |||
| 127 | .ext-repo-actions { | ||
| 128 | display: flex; | ||
| 129 | align-items: center; | ||
| 130 | gap: 6px; | ||
| 131 | flex-shrink: 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | .ext-btn { | ||
| 135 | display: inline-flex; | ||
| 136 | align-items: center; | ||
| 137 | gap: 4px; | ||
| 138 | padding: 5px 10px; | ||
| 139 | border-radius: 8px; | ||
| 140 | border: 1px solid var(--vp-c-divider); | ||
| 141 | background-color: var(--vp-c-bg); | ||
| 142 | color: var(--vp-c-text-1); | ||
| 143 | font-size: 13px; | ||
| 144 | line-height: 1; | ||
| 145 | cursor: pointer; | ||
| 146 | transition: border-color 0.2s, background-color 0.2s, color 0.2s; | ||
| 147 | } | ||
| 148 | |||
| 149 | .ext-btn:hover { | ||
| 150 | border-color: var(--vp-c-brand-1); | ||
| 151 | } | ||
| 152 | |||
| 153 | .ext-btn-install { | ||
| 154 | background-color: var(--vp-button-brand-bg); | ||
| 155 | color: var(--vp-button-brand-text) !important; | ||
| 156 | border-color: var(--vp-button-brand-border); | ||
| 157 | text-decoration: none !important; | ||
| 158 | font-weight: 600; | ||
| 159 | } | ||
| 160 | |||
| 161 | .ext-btn-install:hover { | ||
| 162 | filter: brightness(1.08); | ||
| 163 | border-color: var(--vp-button-brand-hover-border); | ||
| 164 | } | ||
| 165 | |||
| 166 | .ext-btn-copy { | ||
| 167 | padding: 5px 8px; | ||
| 168 | } | ||
| 169 | |||
| 170 | .ext-btn-toggle { | ||
| 171 | padding: 0; | ||
| 172 | border: none; | ||
| 173 | background: transparent; | ||
| 174 | color: var(--vp-c-text-1); | ||
| 175 | } | ||
| 176 | |||
| 177 | .ext-btn-toggle:hover { | ||
| 178 | border-color: transparent; | ||
| 179 | color: var(--vp-c-brand-1); | ||
| 180 | } | ||
| 181 | |||
| 182 | .ext-btn-toggle span { | ||
| 183 | font-size: 18px; | ||
| 184 | transition: transform 0.2s; | ||
| 185 | } | ||
| 186 | |||
| 187 | .ext-btn-toggle.open span { | ||
| 188 | transform: rotate(180deg); | ||
| 189 | } | ||
| 190 | |||
| 191 | .ext-btn-toggle-hidden { | ||
| 192 | visibility: hidden; | ||
| 193 | pointer-events: none; | ||
| 194 | } | ||
| 195 | </style> | ||
docs/.vitepress/theme/components/extrepo/SettingsMenu.vue added +162
| @@ -0,0 +1,162 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { nextTick, onMounted, onUnmounted, ref } from 'vue' | ||
| 3 | import LangSelect from './LangSelect.vue' | ||
| 4 | import RatingFilter from './RatingFilter.vue' | ||
| 5 | import type { RatingFilter as RatingFilterValue } from './types' | ||
| 6 | |||
| 7 | defineProps<{ | ||
| 8 | langFilter: string | ||
| 9 | ratingFilter: RatingFilterValue | ||
| 10 | availableLangs: string[] | ||
| 11 | hasMultiLanguage: boolean | ||
| 12 | hasSuggestive: boolean | ||
| 13 | }>() | ||
| 14 | |||
| 15 | defineEmits<{ | ||
| 16 | 'update:langFilter': [value: string] | ||
| 17 | 'update:ratingFilter': [value: RatingFilterValue] | ||
| 18 | }>() | ||
| 19 | |||
| 20 | const rootRef = ref<HTMLElement>() | ||
| 21 | const btnRef = ref<HTMLElement>() | ||
| 22 | const menuRef = ref<HTMLElement>() | ||
| 23 | const open = ref(false) | ||
| 24 | const menuStyle = ref<Record<string, string>>({}) | ||
| 25 | |||
| 26 | function updatePosition() { | ||
| 27 | if (!btnRef.value) return | ||
| 28 | |||
| 29 | const viewportMargin = 12 | ||
| 30 | const menuWidth = menuRef.value?.offsetWidth ?? 260 | ||
| 31 | const btnRect = btnRef.value.getBoundingClientRect() | ||
| 32 | const maxLeft = Math.max(viewportMargin, window.innerWidth - viewportMargin - menuWidth) | ||
| 33 | const left = Math.min(Math.max(btnRect.right - menuWidth, viewportMargin), maxLeft) | ||
| 34 | const maxTop = Math.max(viewportMargin, window.innerHeight - viewportMargin) | ||
| 35 | const top = Math.min(btnRect.bottom + 6, maxTop) | ||
| 36 | |||
| 37 | menuStyle.value = { top: `${top}px`, left: `${left}px` } | ||
| 38 | } | ||
| 39 | |||
| 40 | function toggle() { | ||
| 41 | open.value = !open.value | ||
| 42 | if (open.value) void nextTick(updatePosition) | ||
| 43 | } | ||
| 44 | |||
| 45 | function onDocClick(e: MouseEvent) { | ||
| 46 | const target = e.target as Node | ||
| 47 | if ( | ||
| 48 | rootRef.value && !rootRef.value.contains(target) | ||
| 49 | && menuRef.value && !menuRef.value.contains(target) | ||
| 50 | ) { | ||
| 51 | open.value = false | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | function onReposition() { | ||
| 56 | if (open.value) updatePosition() | ||
| 57 | } | ||
| 58 | |||
| 59 | onMounted(() => { | ||
| 60 | document.addEventListener('click', onDocClick, true) | ||
| 61 | window.addEventListener('resize', onReposition) | ||
| 62 | window.addEventListener('scroll', onReposition, true) | ||
| 63 | }) | ||
| 64 | |||
| 65 | onUnmounted(() => { | ||
| 66 | document.removeEventListener('click', onDocClick, true) | ||
| 67 | window.removeEventListener('resize', onReposition) | ||
| 68 | window.removeEventListener('scroll', onReposition, true) | ||
| 69 | }) | ||
| 70 | </script> | ||
| 71 | |||
| 72 | <template> | ||
| 73 | <div ref="rootRef" class="ext-settings"> | ||
| 74 | <button | ||
| 75 | ref="btnRef" | ||
| 76 | type="button" | ||
| 77 | class="ext-settings-btn" | ||
| 78 | aria-haspopup="true" | ||
| 79 | :aria-expanded="open" | ||
| 80 | aria-label="Filters" | ||
| 81 | @click="toggle" | ||
| 82 | > | ||
| 83 | <span class="i-lucide:settings" /> | ||
| 84 | </button> | ||
| 85 | |||
| 86 | <Teleport to="body"> | ||
| 87 | <div | ||
| 88 | v-show="open" | ||
| 89 | ref="menuRef" | ||
| 90 | class="ext-settings-menu" | ||
| 91 | :class="{ 'ext-settings-menu--wide': hasSuggestive }" | ||
| 92 | :style="menuStyle" | ||
| 93 | > | ||
| 94 | <LangSelect | ||
| 95 | :model-value="langFilter" | ||
| 96 | :available-langs="availableLangs" | ||
| 97 | :has-multi-language="hasMultiLanguage" | ||
| 98 | @update:model-value="$emit('update:langFilter', $event)" | ||
| 99 | /> | ||
| 100 | <RatingFilter | ||
| 101 | :model-value="ratingFilter" | ||
| 102 | :has-suggestive="hasSuggestive" | ||
| 103 | @update:model-value="$emit('update:ratingFilter', $event)" | ||
| 104 | /> | ||
| 105 | </div> | ||
| 106 | </Teleport> | ||
| 107 | </div> | ||
| 108 | </template> | ||
| 109 | |||
| 110 | <style scoped> | ||
| 111 | .ext-settings { | ||
| 112 | position: relative; | ||
| 113 | } | ||
| 114 | |||
| 115 | .ext-settings-btn { | ||
| 116 | display: flex; | ||
| 117 | align-items: center; | ||
| 118 | justify-content: center; | ||
| 119 | width: 30px; | ||
| 120 | height: 30px; | ||
| 121 | padding: 0; | ||
| 122 | border-radius: 8px; | ||
| 123 | border: 1px solid transparent; | ||
| 124 | background-color: transparent; | ||
| 125 | color: var(--vp-c-text-1); | ||
| 126 | cursor: pointer; | ||
| 127 | transition: border-color 0.15s, color 0.15s; | ||
| 128 | } | ||
| 129 | |||
| 130 | .ext-settings-btn:hover { | ||
| 131 | border-color: var(--vp-c-brand-1); | ||
| 132 | color: var(--vp-c-brand-1); | ||
| 133 | } | ||
| 134 | |||
| 135 | .ext-settings-btn span { | ||
| 136 | font-size: 15px; | ||
| 137 | } | ||
| 138 | |||
| 139 | .ext-settings-menu { | ||
| 140 | --vp-nolebase-enhanced-readabilities-menu-background-color: var(--wk-c-menu-bg); | ||
| 141 | --vp-nolebase-enhanced-readabilities-menu-text-color: var(--vp-c-text-1); | ||
| 142 | position: fixed; | ||
| 143 | z-index: 100; | ||
| 144 | width: 260px; | ||
| 145 | max-width: calc(100vw - 24px); | ||
| 146 | max-height: calc(100vh - 24px); | ||
| 147 | overflow-y: auto; | ||
| 148 | padding: 12px; | ||
| 149 | border-radius: 12px; | ||
| 150 | border: 1px solid var(--vp-c-divider); | ||
| 151 | background-color: var(--vp-c-bg-elv); | ||
| 152 | box-shadow: var(--vp-shadow-3, 0 4px 16px rgba(0, 0, 0, 0.3)); | ||
| 153 | } | ||
| 154 | |||
| 155 | .ext-settings-menu > * + * { | ||
| 156 | margin-top: 14px; | ||
| 157 | } | ||
| 158 | |||
| 159 | .ext-settings-menu--wide { | ||
| 160 | width: 320px; | ||
| 161 | } | ||
| 162 | </style> | ||
docs/.vitepress/theme/components/extrepo/SiteCell.vue added +95
| @@ -0,0 +1,95 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import { langFlagClass, ratingIcon, ratingTitle } from './helpers' | ||
| 3 | import type { RepoSite } from './types' | ||
| 4 | |||
| 5 | defineProps<{ | ||
| 6 | site: RepoSite & { repoName?: string } | ||
| 7 | }>() | ||
| 8 | </script> | ||
| 9 | |||
| 10 | <template> | ||
| 11 | <component | ||
| 12 | :is="site.url ? 'a' : 'div'" | ||
| 13 | class="ext-site-cell" | ||
| 14 | :class="{ 'ext-site-cell-static': !site.url }" | ||
| 15 | :href="site.url || undefined" | ||
| 16 | :target="site.url ? '_blank' : undefined" | ||
| 17 | :rel="site.url ? 'noopener noreferrer' : undefined" | ||
| 18 | > | ||
| 19 | <img class="ext-site-icon" :src="site.icon" :alt="site.name" loading="lazy" /> | ||
| 20 | <span class="ext-site-name"> | ||
| 21 | <span class="ext-site-name-text">{{ site.name }}</span> | ||
| 22 | <span v-if="site.repoName" class="ext-site-repo">{{ site.repoName }}</span> | ||
| 23 | </span> | ||
| 24 | <span v-if="site.rating !== 'safe'" class="ext-site-nsfw" :class="ratingIcon(site.rating)" :title="ratingTitle(site.rating)" /> | ||
| 25 | <span class="ext-site-lang" :class="langFlagClass(site.lang)" :title="site.lang" /> | ||
| 26 | </component> | ||
| 27 | </template> | ||
| 28 | |||
| 29 | <style scoped> | ||
| 30 | .ext-site-repo { | ||
| 31 | display: block; | ||
| 32 | font-size: 10.5px; | ||
| 33 | color: var(--vp-c-text-2); | ||
| 34 | white-space: nowrap; | ||
| 35 | overflow: hidden; | ||
| 36 | text-overflow: ellipsis; | ||
| 37 | } | ||
| 38 | |||
| 39 | .ext-site-cell { | ||
| 40 | display: flex; | ||
| 41 | align-items: center; | ||
| 42 | gap: 6px; | ||
| 43 | padding: 6px 8px; | ||
| 44 | border-radius: 6px; | ||
| 45 | border: 1px solid var(--vp-c-divider); | ||
| 46 | background-color: var(--vp-c-bg-soft); | ||
| 47 | min-width: 0; | ||
| 48 | color: var(--vp-c-text-1) !important; | ||
| 49 | text-decoration: none !important; | ||
| 50 | transition: border-color 0.2s, background-color 0.2s; | ||
| 51 | } | ||
| 52 | |||
| 53 | .ext-site-cell:hover { | ||
| 54 | border-color: var(--vp-c-brand-1); | ||
| 55 | background-color: var(--vp-c-bg); | ||
| 56 | } | ||
| 57 | |||
| 58 | .ext-site-cell-static { | ||
| 59 | cursor: default; | ||
| 60 | } | ||
| 61 | |||
| 62 | .ext-site-cell-static:hover { | ||
| 63 | border-color: var(--vp-c-divider); | ||
| 64 | background-color: var(--vp-c-bg-soft); | ||
| 65 | } | ||
| 66 | |||
| 67 | .ext-site-icon { | ||
| 68 | width: 18px; | ||
| 69 | height: 18px; | ||
| 70 | border-radius: 4px; | ||
| 71 | flex-shrink: 0; | ||
| 72 | object-fit: contain; | ||
| 73 | } | ||
| 74 | |||
| 75 | .ext-site-name { | ||
| 76 | display: flex; | ||
| 77 | flex-direction: column; | ||
| 78 | flex: 1; | ||
| 79 | min-width: 0; | ||
| 80 | } | ||
| 81 | |||
| 82 | .ext-site-name-text { | ||
| 83 | font-size: 12.5px; | ||
| 84 | color: var(--vp-c-text-1); | ||
| 85 | white-space: nowrap; | ||
| 86 | overflow: hidden; | ||
| 87 | text-overflow: ellipsis; | ||
| 88 | } | ||
| 89 | |||
| 90 | .ext-site-nsfw, | ||
| 91 | .ext-site-lang { | ||
| 92 | flex-shrink: 0; | ||
| 93 | font-size: 12px; | ||
| 94 | } | ||
| 95 | </style> | ||
docs/.vitepress/theme/components/extrepo/SiteGrid.vue added +37
| @@ -0,0 +1,37 @@ | |||
| 1 | <script setup lang="ts"> | ||
| 2 | import SiteCell from './SiteCell.vue' | ||
| 3 | import type { RepoSite } from './types' | ||
| 4 | |||
| 5 | defineProps<{ | ||
| 6 | sites: (RepoSite & { repoName?: string })[] | ||
| 7 | emptyText: string | ||
| 8 | }>() | ||
| 9 | </script> | ||
| 10 | |||
| 11 | <template> | ||
| 12 | <div class="ext-site-grid"> | ||
| 13 | <div v-if="sites.length === 0" class="ext-site-empty"> | ||
| 14 | {{ emptyText }} | ||
| 15 | </div> | ||
| 16 | <SiteCell v-for="site in sites" :key="`${site.repoName ?? ''}-${site.name}-${site.lang}`" :site="site" /> | ||
| 17 | </div> | ||
| 18 | </template> | ||
| 19 | |||
| 20 | <style scoped> | ||
| 21 | .ext-site-grid { | ||
| 22 | display: grid; | ||
| 23 | grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); | ||
| 24 | gap: 6px; | ||
| 25 | padding: 10px; | ||
| 26 | max-height: 340px; | ||
| 27 | overflow-y: auto; | ||
| 28 | background-color: var(--vp-c-bg); | ||
| 29 | } | ||
| 30 | |||
| 31 | .ext-site-empty { | ||
| 32 | grid-column: 1 / -1; | ||
| 33 | color: var(--vp-c-text-2); | ||
| 34 | font-size: 13px; | ||
| 35 | padding: 8px 4px; | ||
| 36 | } | ||
| 37 | </style> | ||
docs/.vitepress/theme/components/extrepo/helpers.ts added +31
| @@ -0,0 +1,31 @@ | |||
| 1 | import { LANG_FLAG_FALLBACK, LANG_FLAG_ICONS } from '../../../configs/markdown/langFlags' | ||
| 2 | import type { Rating } from './types' | ||
| 3 | |||
| 4 | export function langFlagClass(lang: string): string { | ||
| 5 | const key = lang.toLowerCase() | ||
| 6 | const icon = LANG_FLAG_ICONS[key] ?? LANG_FLAG_ICONS[key.split('-')[0]] ?? LANG_FLAG_FALLBACK | ||
| 7 | return `i-twemoji-${icon}` | ||
| 8 | } | ||
| 9 | |||
| 10 | const langDisplayNames = new Intl.DisplayNames(['en'], { type: 'language' }) | ||
| 11 | |||
| 12 | export function langLabel(lang: string): string { | ||
| 13 | if (lang.toLowerCase() === 'all') return 'Multi-language' | ||
| 14 | try { | ||
| 15 | return langDisplayNames.of(lang) ?? lang | ||
| 16 | } catch { | ||
| 17 | return lang | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | export function stripHtml(html: string): string { | ||
| 22 | return html.replace(/<[^>]*>/g, '').trim() | ||
| 23 | } | ||
| 24 | |||
| 25 | export function ratingIcon(rating: Rating): string { | ||
| 26 | return rating === 'nsfw' ? 'i-twemoji-no-one-under-eighteen' : 'i-twemoji-warning' | ||
| 27 | } | ||
| 28 | |||
| 29 | export function ratingTitle(rating: Rating): string { | ||
| 30 | return rating === 'nsfw' ? 'NSFW' : 'Mature' | ||
| 31 | } | ||
docs/.vitepress/theme/components/extrepo/index.ts added +3
| @@ -0,0 +1,3 @@ | |||
| 1 | import ExtensionRepos from './ExtensionRepos.vue' | ||
| 2 | |||
| 3 | export { ExtensionRepos } | ||
docs/.vitepress/theme/components/extrepo/install.ts added +22
| @@ -0,0 +1,22 @@ | |||
| 1 | import { stripHtml } from './helpers' | ||
| 2 | import type { Repo } from './types' | ||
| 3 | |||
| 4 | export function paperbackBase(indexUrl: string): string { | ||
| 5 | return indexUrl.replace(/\/versioning\.json$/, '') | ||
| 6 | } | ||
| 7 | |||
| 8 | const INSTALL_URL_BUILDERS: Record<string, (repo: Repo) => string> = { | ||
| 9 | aidoku: repo => `aidoku://addSourceList?url=${encodeURIComponent(repo.indexUrl)}`, | ||
| 10 | paperback: repo => `paperback://addRepo?displayName=${encodeURIComponent(stripHtml(repo.name))}&url=${paperbackBase(repo.indexUrl)}`, | ||
| 11 | cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}` | ||
| 12 | } | ||
| 13 | |||
| 14 | export function installHref(scheme: string, repo: Repo): string { | ||
| 15 | const build = INSTALL_URL_BUILDERS[scheme] | ||
| 16 | if (build) return build(repo) | ||
| 17 | return `${scheme}://add-repo?url=${encodeURIComponent(repo.indexUrl)}` | ||
| 18 | } | ||
| 19 | |||
| 20 | export function copyValue(scheme: string, indexUrl: string): string { | ||
| 21 | return scheme === 'paperback' ? paperbackBase(indexUrl) : indexUrl | ||
| 22 | } | ||
docs/.vitepress/theme/components/extrepo/types.ts added +20
| @@ -0,0 +1,20 @@ | |||
| 1 | export type Rating = 'safe' | 'suggestive' | 'nsfw' | ||
| 2 | export type RatingFilter = 'all' | Rating | ||
| 3 | |||
| 4 | export interface Repo { | ||
| 5 | name: string | ||
| 6 | indexUrl: string | ||
| 7 | note?: string | ||
| 8 | } | ||
| 9 | |||
| 10 | export interface RepoSite { | ||
| 11 | name: string | ||
| 12 | lang: string | ||
| 13 | icon: string | ||
| 14 | url: string | ||
| 15 | rating: Rating | ||
| 16 | } | ||
| 17 | |||
| 18 | export interface MatchedSite extends RepoSite { | ||
| 19 | repoName: string | ||
| 20 | } | ||
docs/.vitepress/theme/index.ts +2
| @@ -18,6 +18,7 @@ import Tooltip from './components/Tooltip.vue' | |||
| 18 | import { createMediumZoomProvider } from './composables/medium-zoom' | 18 | import { createMediumZoomProvider } from './composables/medium-zoom' |
| 19 | import 'virtual:uno.css' | 19 | import 'virtual:uno.css' |
| 20 | import Collapsible from './components/Collapsible.vue' | 20 | import Collapsible from './components/Collapsible.vue' |
| 21 | import { ExtensionRepos } from './components/extrepo' | ||
| 21 | import Fb from './components/Fb.vue' | 22 | import Fb from './components/Fb.vue' |
| 22 | import Feedback from './components/Feedback.vue' | 23 | import Feedback from './components/Feedback.vue' |
| 23 | import ScrapeTable from './components/ScrapeTable.vue' | 24 | import ScrapeTable from './components/ScrapeTable.vue' |
| @@ -58,6 +59,7 @@ export default { | |||
| 58 | app.component('fb', Fb) | 59 | app.component('fb', Fb) |
| 59 | app.component('Collapsible', Collapsible) | 60 | app.component('Collapsible', Collapsible) |
| 60 | app.component('ScrapeTable', ScrapeTable) | 61 | app.component('ScrapeTable', ScrapeTable) |
| 62 | app.component('ExtensionRepos', ExtensionRepos) | ||
| 61 | createMediumZoomProvider(app, router) | 63 | createMediumZoomProvider(app, router) |
| 62 | app.use( | 64 | app.use( |
| 63 | NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(), | 65 | NolebasePagePropertiesPlugin<{ tags: string[]; progress: number }>(), |
docs/ext/extensionRepos.data.ts added +275
| @@ -0,0 +1,275 @@ | |||
| 1 | import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs' | ||
| 2 | import { dirname, join } from 'node:path' | ||
| 3 | import { fileURLToPath } from 'node:url' | ||
| 4 | |||
| 5 | const IGNORED_DIRS = new Set(['node_modules', '.vitepress', '.git']) | ||
| 6 | |||
| 7 | export type Rating = 'safe' | 'suggestive' | 'nsfw' | ||
| 8 | |||
| 9 | export interface RepoSite { | ||
| 10 | name: string | ||
| 11 | lang: string | ||
| 12 | icon: string | ||
| 13 | url: string | ||
| 14 | rating: Rating | ||
| 15 | } | ||
| 16 | |||
| 17 | export interface RepoData { | ||
| 18 | sites: RepoSite[] | ||
| 19 | } | ||
| 20 | |||
| 21 | interface MihonSource { | ||
| 22 | name: string | ||
| 23 | lang: string | ||
| 24 | baseUrl: string | ||
| 25 | } | ||
| 26 | |||
| 27 | interface MihonExtension { | ||
| 28 | pkg: string | ||
| 29 | nsfw?: number | ||
| 30 | sources?: MihonSource[] | ||
| 31 | } | ||
| 32 | |||
| 33 | interface AidokuSource { | ||
| 34 | name: string | ||
| 35 | iconURL: string | ||
| 36 | languages?: string[] | ||
| 37 | contentRating?: number | ||
| 38 | baseURL: string | ||
| 39 | } | ||
| 40 | |||
| 41 | interface AidokuIndex { | ||
| 42 | sources: AidokuSource[] | ||
| 43 | } | ||
| 44 | |||
| 45 | interface AidokuLegacySource { | ||
| 46 | name: string | ||
| 47 | icon: string | ||
| 48 | lang: string | ||
| 49 | nsfw?: number | ||
| 50 | } | ||
| 51 | |||
| 52 | interface PaperbackSource { | ||
| 53 | id: string | ||
| 54 | name: string | ||
| 55 | icon: string | ||
| 56 | language?: string | ||
| 57 | contentRating?: string | ||
| 58 | websiteBaseURL?: string | ||
| 59 | } | ||
| 60 | |||
| 61 | interface PaperbackIndex { | ||
| 62 | sources: PaperbackSource[] | ||
| 63 | builtWith?: { toolchain?: string } | ||
| 64 | } | ||
| 65 | |||
| 66 | interface CloudstreamRepo { | ||
| 67 | pluginLists: string[] | ||
| 68 | } | ||
| 69 | |||
| 70 | interface CloudstreamPlugin { | ||
| 71 | name: string | ||
| 72 | iconUrl?: string | ||
| 73 | language?: string | ||
| 74 | } | ||
| 75 | |||
| 76 | const EXT_DIR = dirname(fileURLToPath(import.meta.url)) | ||
| 77 | const DOCS_DIR = join(EXT_DIR, '..') | ||
| 78 | const CACHE_DIR = join(EXT_DIR, '../.vitepress/cache/extension-repos') | ||
| 79 | const CACHE_TTL_MS = 6 * 60 * 60 * 1000 | ||
| 80 | |||
| 81 | function findMarkdownFiles(dir: string): string[] { | ||
| 82 | const files: string[] = [] | ||
| 83 | for (const entry of readdirSync(dir, { withFileTypes: true })) { | ||
| 84 | if (entry.isDirectory()) { | ||
| 85 | if (!IGNORED_DIRS.has(entry.name)) files.push(...findMarkdownFiles(join(dir, entry.name))) | ||
| 86 | } else if (entry.name.endsWith('.md')) { | ||
| 87 | files.push(join(dir, entry.name)) | ||
| 88 | } | ||
| 89 | } | ||
| 90 | return files | ||
| 91 | } | ||
| 92 | |||
| 93 | function collectIndexUrls(): string[] { | ||
| 94 | const urls = new Set<string>() | ||
| 95 | const blockRe = /:::\s*extrepo[^\n]*\n([\s\S]*?)\n\s*:::/g | ||
| 96 | const rowRe = /^\s*-\s*raw\s*:\s*(https?:\/\/\S+)\s*$/gim | ||
| 97 | |||
| 98 | for (const file of findMarkdownFiles(DOCS_DIR)) { | ||
| 99 | const src = readFileSync(file, 'utf-8') | ||
| 100 | |||
| 101 | let block: RegExpExecArray | null | ||
| 102 | blockRe.lastIndex = 0 | ||
| 103 | while ((block = blockRe.exec(src))) { | ||
| 104 | rowRe.lastIndex = 0 | ||
| 105 | let row: RegExpExecArray | null | ||
| 106 | while ((row = rowRe.exec(block[1]))) urls.add(row[1].trim()) | ||
| 107 | } | ||
| 108 | } | ||
| 109 | return [...urls] | ||
| 110 | } | ||
| 111 | |||
| 112 | function cachePathFor(url: string): string { | ||
| 113 | return join(CACHE_DIR, `${Buffer.from(url).toString('base64url')}.json`) | ||
| 114 | } | ||
| 115 | |||
| 116 | async function fetchIndex(url: string): Promise<unknown> { | ||
| 117 | const cachePath = cachePathFor(url) | ||
| 118 | if (existsSync(cachePath) && Date.now() - statSync(cachePath).mtimeMs < CACHE_TTL_MS) { | ||
| 119 | return JSON.parse(readFileSync(cachePath, 'utf-8')) | ||
| 120 | } | ||
| 121 | |||
| 122 | try { | ||
| 123 | const res = await fetch(url) | ||
| 124 | if (!res.ok) throw new Error(`${res.status} ${res.statusText}`) | ||
| 125 | const json = await res.json() | ||
| 126 | mkdirSync(CACHE_DIR, { recursive: true }) | ||
| 127 | writeFileSync(cachePath, JSON.stringify(json)) | ||
| 128 | return json | ||
| 129 | } catch (err) { | ||
| 130 | if (existsSync(cachePath)) return JSON.parse(readFileSync(cachePath, 'utf-8')) | ||
| 131 | console.warn(`[extrepo] failed to fetch ${url}: ${(err as Error).message}`) | ||
| 132 | return [] | ||
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 136 | function ratingFromLevel(level: number): Rating { | ||
| 137 | if (level >= 2) return 'nsfw' | ||
| 138 | if (level >= 1) return 'suggestive' | ||
| 139 | return 'safe' | ||
| 140 | } | ||
| 141 | |||
| 142 | const LANG_ALIASES: Record<string, string> = { jp: 'ja', english: 'en' } | ||
| 143 | |||
| 144 | function normalizeLang(lang: string): string { | ||
| 145 | const key = LANG_ALIASES[lang.toLowerCase()] ?? lang.toLowerCase() | ||
| 146 | return key === 'multi' ? 'all' : key | ||
| 147 | } | ||
| 148 | |||
| 149 | function toRepoDataMihon(iconBase: string, extensions: MihonExtension[]): RepoSite[] { | ||
| 150 | const seen = new Set<string>() | ||
| 151 | const sites: RepoSite[] = [] | ||
| 152 | |||
| 153 | for (const ext of extensions) { | ||
| 154 | const icon = `${iconBase}/icon/${ext.pkg}.png` | ||
| 155 | for (const source of ext.sources ?? []) { | ||
| 156 | const key = `${source.name}::${source.lang}::${source.baseUrl}` | ||
| 157 | if (seen.has(key)) continue | ||
| 158 | seen.add(key) | ||
| 159 | sites.push({ name: source.name, lang: source.lang, icon, url: source.baseUrl, rating: ext.nsfw === 1 ? 'nsfw' : 'safe' }) | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | return sites | ||
| 164 | } | ||
| 165 | |||
| 166 | function toRepoDataAidoku(iconBase: string, index: AidokuIndex): RepoSite[] { | ||
| 167 | const seen = new Set<string>() | ||
| 168 | const sites: RepoSite[] = [] | ||
| 169 | |||
| 170 | for (const source of index.sources ?? []) { | ||
| 171 | const icon = `${iconBase}/${source.iconURL}` | ||
| 172 | const rating = ratingFromLevel(source.contentRating ?? 0) | ||
| 173 | const langs = source.languages?.length ? source.languages : ['all'] | ||
| 174 | for (const rawLang of langs) { | ||
| 175 | const lang = normalizeLang(rawLang) | ||
| 176 | const key = `${source.name}::${lang}::${source.baseURL}` | ||
| 177 | if (seen.has(key)) continue | ||
| 178 | seen.add(key) | ||
| 179 | sites.push({ name: source.name, lang, icon, url: source.baseURL, rating }) | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | return sites | ||
| 184 | } | ||
| 185 | |||
| 186 | function toRepoDataPaperback(iconBase: string, index: PaperbackIndex): RepoSite[] { | ||
| 187 | const seen = new Set<string>() | ||
| 188 | const sites: RepoSite[] = [] | ||
| 189 | // Legacy 0.8.x toolchain builds serve icons under `<id>/includes/`; the | ||
| 190 | // 1.0.0-alpha toolchain (used by both 0.9 and some relabeled 0.8 repos) | ||
| 191 | // serves them under `<id>/static/`. | ||
| 192 | const iconDir = index.builtWith?.toolchain?.startsWith('0.8') ? 'includes' : 'static' | ||
| 193 | |||
| 194 | for (const source of index.sources ?? []) { | ||
| 195 | const lang = normalizeLang(source.language ?? 'all') | ||
| 196 | const key = `${source.id}::${lang}` | ||
| 197 | if (seen.has(key)) continue | ||
| 198 | seen.add(key) | ||
| 199 | const icon = `${iconBase}/${source.id}/${iconDir}/${source.icon}` | ||
| 200 | const rating: Rating = source.contentRating === 'ADULT' ? 'nsfw' : source.contentRating === 'MATURE' ? 'suggestive' : 'safe' | ||
| 201 | sites.push({ name: source.name, lang, icon, url: source.websiteBaseURL ?? '', rating }) | ||
| 202 | } | ||
| 203 | |||
| 204 | return sites | ||
| 205 | } | ||
| 206 | |||
| 207 | function normalizeGoogleFaviconUrl(url: string): string { | ||
| 208 | return url.replace('%size%', '64') | ||
| 209 | } | ||
| 210 | |||
| 211 | async function toRepoDataCloudstream(repo: CloudstreamRepo): Promise<RepoSite[]> { | ||
| 212 | const seen = new Set<string>() | ||
| 213 | const sites: RepoSite[] = [] | ||
| 214 | |||
| 215 | const lists = await Promise.all(repo.pluginLists.map(url => fetchIndex(url))) | ||
| 216 | for (const list of lists) { | ||
| 217 | if (!Array.isArray(list)) continue | ||
| 218 | for (const plugin of list as CloudstreamPlugin[]) { | ||
| 219 | if (seen.has(plugin.name)) continue | ||
| 220 | seen.add(plugin.name) | ||
| 221 | const lang = normalizeLang(plugin.language ?? 'all') | ||
| 222 | const icon = plugin.iconUrl ? normalizeGoogleFaviconUrl(plugin.iconUrl) : '' | ||
| 223 | sites.push({ name: plugin.name, lang, icon, url: '', rating: 'safe' }) | ||
| 224 | } | ||
| 225 | } | ||
| 226 | |||
| 227 | return sites | ||
| 228 | } | ||
| 229 | |||
| 230 | function toRepoDataAidokuLegacy(iconBase: string, sources: AidokuLegacySource[]): RepoSite[] { | ||
| 231 | const seen = new Set<string>() | ||
| 232 | const sites: RepoSite[] = [] | ||
| 233 | |||
| 234 | for (const source of sources) { | ||
| 235 | const lang = normalizeLang(source.lang) | ||
| 236 | const key = `${source.name}::${lang}` | ||
| 237 | if (seen.has(key)) continue | ||
| 238 | seen.add(key) | ||
| 239 | sites.push({ name: source.name, lang, icon: `${iconBase}/icons/${source.icon}`, url: '', rating: ratingFromLevel(source.nsfw ?? 0) }) | ||
| 240 | } | ||
| 241 | |||
| 242 | return sites | ||
| 243 | } | ||
| 244 | |||
| 245 | async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { | ||
| 246 | const iconBase = indexUrl.slice(0, indexUrl.lastIndexOf('/')) | ||
| 247 | let sites: RepoSite[] | ||
| 248 | if (Array.isArray(json)) { | ||
| 249 | sites = json.length > 0 && 'sources' in json[0] | ||
| 250 | ? toRepoDataMihon(iconBase, json as MihonExtension[]) | ||
| 251 | : toRepoDataAidokuLegacy(iconBase, json as AidokuLegacySource[]) | ||
| 252 | } else if (Array.isArray((json as CloudstreamRepo).pluginLists)) { | ||
| 253 | sites = await toRepoDataCloudstream(json as CloudstreamRepo) | ||
| 254 | } else if ((json as AidokuIndex).sources?.length && 'iconURL' in (json as AidokuIndex).sources[0]) { | ||
| 255 | sites = toRepoDataAidoku(iconBase, json as AidokuIndex) | ||
| 256 | } else { | ||
| 257 | sites = toRepoDataPaperback(iconBase, json as PaperbackIndex) | ||
| 258 | } | ||
| 259 | sites.sort((a, b) => a.name.localeCompare(b.name)) | ||
| 260 | return { sites } | ||
| 261 | } | ||
| 262 | |||
| 263 | export declare const data: Record<string, RepoData> | ||
| 264 | |||
| 265 | export default { | ||
| 266 | watch: ['../**/*.md'], | ||
| 267 | async load(): Promise<Record<string, RepoData>> { | ||
| 268 | const urls = collectIndexUrls() | ||
| 269 | const result: Record<string, RepoData> = {} | ||
| 270 | await Promise.all(urls.map(async url => { | ||
| 271 | result[url] = await toRepoData(url, await fetchIndex(url)) | ||
| 272 | })) | ||
| 273 | return result | ||
| 274 | } | ||
| 275 | } | ||
docs/sandbox.md +235
| @@ -0,0 +1,235 @@ | |||
| 1 | # Sandbox | ||
| 2 | |||
| 3 | ## Cloudstream | ||
| 4 | |||
| 5 | ::: extrepo {scheme=cloudstreamrepo} | ||
| 6 | |||
| 7 | == MegaRepo | ||
| 8 | - url: https://github.com/self-similarity/MegaRepo/ | ||
| 9 | - raw: https://raw.githubusercontent.com/self-similarity/MegaRepo/builds/repo.json | ||
| 10 | |||
| 11 | == Aniyomi Compat | ||
| 12 | - url: https://github.com/CranberrySoup/AniyomiCompatExtension | ||
| 13 | - raw: https://raw.githubusercontent.com/CranberrySoup/AniyomiCompatExtension/master/repo.json | ||
| 14 | |||
| 15 | == CakesTwix | ||
| 16 | - url: https://github.com/CakesTwix/cloudstream-extensions-uk | ||
| 17 | - raw: https://raw.githubusercontent.com/CakesTwix/cloudstream-extensions-uk/master/repo.json | ||
| 18 | |||
| 19 | == CloudX | ||
| 20 | - url: https://github.com/Asm0d3usX/CloudX-V2 | ||
| 21 | - raw: https://raw.githubusercontent.com/Asm0d3usX/CloudX/builds/repo.json | ||
| 22 | |||
| 23 | == CSX | ||
| 24 | - url: https://github.com/SaurabhKaperwan/CSX | ||
| 25 | - raw: https://raw.githubusercontent.com/SaurabhKaperwan/CSX/builds/CS.json | ||
| 26 | |||
| 27 | == CuxPlug | ||
| 28 | - url: https://github.com/ycngmn/CuxPlug | ||
| 29 | - raw: https://raw.githubusercontent.com/ycngmn/CuxPlug/refs/heads/main/repo.json | ||
| 30 | |||
| 31 | == doGior | ||
| 32 | - url: https://github.com/doGior/doGiorsHadEnough | ||
| 33 | - raw: https://raw.githubusercontent.com/doGior/doGiorsHadEnough/refs/heads/builds/repo.json | ||
| 34 | |||
| 35 | == Gian-Fr | ||
| 36 | - url: https://github.com/Gian-Fr/ItalianProvider | ||
| 37 | - raw: https://raw.githubusercontent.com/Gian-Fr/ItalianProvider/builds/repo.json | ||
| 38 | |||
| 39 | == Kraptor | ||
| 40 | - url: https://github.com/Kraptor123/cs-kraptor | ||
| 41 | - raw: https://raw.githubusercontent.com/Kraptor123/cs-kraptor/refs/heads/master/repo.json | ||
| 42 | |||
| 43 | == NetMirror | ||
| 44 | - url: https://github.com/Sushan64/NetMirror-Extension/ | ||
| 45 | - raw: https://raw.githubusercontent.com/Sushan64/NetMirror-Extension/refs/heads/builds/Netflix.json | ||
| 46 | |||
| 47 | == Phisher | ||
| 48 | - url: https://github.com/phisher98/cloudstream-extensions-phisher | ||
| 49 | - raw: https://raw.githubusercontent.com/phisher98/cloudstream-extensions-phisher/refs/heads/builds/repo.json | ||
| 50 | |||
| 51 | == Redowan | ||
| 52 | - url: https://github.com/redowan99/Redowan-CloudStream | ||
| 53 | - raw: https://raw.githubusercontent.com/redowan99/Redowan-CloudStream/master/repo.json | ||
| 54 | |||
| 55 | == Reflex | ||
| 56 | - url: https://github.com/Reflex755/ReflexRepo | ||
| 57 | - raw: https://raw.githubusercontent.com/Reflex755/ReflexRepo/refs/heads/builds/repo.json | ||
| 58 | |||
| 59 | == Tearrs | ||
| 60 | - url: https://gitlab.com/tearrs/cloudstream-vietnamese | ||
| 61 | - raw: https://gitlab.com/tearrs/cloudstream-vietnamese/-/raw/main/repo.json | ||
| 62 | |||
| 63 | == zzikozz | ||
| 64 | - url: https://codeberg.org/zzikozz/frencharchive/ | ||
| 65 | - raw: https://codeberg.org/zzikozz/frencharchive/raw/branch/Release/repo.json | ||
| 66 | ::: | ||
| 67 | |||
| 68 | ## Aidoku | ||
| 69 | |||
| 70 | ::: extrepo {scheme=aidoku} | ||
| 71 | |||
| 72 | == Amqx | ||
| 73 | - url: https://amqx.github.io/sources/ | ||
| 74 | - src: https://github.com/Amqx/sources | ||
| 75 | - raw: https://amqx.github.io/sources/index.min.json | ||
| 76 | |||
| 77 | == Community | ||
| 78 | - url: https://aidoku-community.github.io/sources/ | ||
| 79 | - src: https://github.com/Aidoku-Community/sources | ||
| 80 | - raw: https://aidoku-community.github.io/sources/index.min.json | ||
| 81 | |||
| 82 | == kunihir0 | ||
| 83 | - url: https://kunihir0.github.io/aidoku-sources/ | ||
| 84 | - src: https://github.com/kunihir0/aidoku-sources | ||
| 85 | - raw: https://kunihir0.github.io/aidoku-sources/index.min.json | ||
| 86 | |||
| 87 | == Moomooo95 | ||
| 88 | - url: https://github.com/Moomooo95/aidoku-french-sources | ||
| 89 | - raw: https://moomooo95.github.io/aidoku-french-sources/index.min.json | ||
| 90 | |||
| 91 | == Smexhy | ||
| 92 | - url: https://smexhy.github.io/yomu-aidoku-sources/ | ||
| 93 | - src: https://github.com/Smexhy/yomu-aidoku-sources | ||
| 94 | - raw: https://smexhy.github.io/yomu-aidoku-sources/index.min.json | ||
| 95 | |||
| 96 | == Suiyuran | ||
| 97 | - url: https://github.com/suiyuran/aidoku-zh-sources | ||
| 98 | - raw: https://raw.githubusercontent.com/suiyuran/aidoku-zh-sources/refs/heads/main/public/index.min.json | ||
| 99 | |||
| 100 | == Skittyblock | ||
| 101 | - url: https://github.com/Skittyblock/aidoku-community-sources | ||
| 102 | - note: Discontinued, kept for archival access | ||
| 103 | - raw: https://skitty.xyz/aidoku-community-sources/index.min.json | ||
| 104 | ::: | ||
| 105 | |||
| 106 | ## Paperback | ||
| 107 | |||
| 108 | ::: extrepo {scheme=paperback} | ||
| 109 | |||
| 110 | == Inkdex | ||
| 111 | - url: https://inkdex.github.io/ | ||
| 112 | - src: https://github.com/inkdex/extensions | ||
| 113 | - raw: https://inkdex.github.io/extensions/0.9/stable/versioning.json | ||
| 114 | |||
| 115 | == Kakarot0 | ||
| 116 | - url: https://karrot0.github.io/KakarotExtension/0.9/stable/ | ||
| 117 | - src: https://github.com/karrot0/KakarotExtension/ | ||
| 118 | - raw: https://karrot0.github.io/KakarotExtension/0.9/stable/versioning.json | ||
| 119 | |||
| 120 | == Kinso | ||
| 121 | - url: https://xdkinso.github.io/KinsoExtension/ | ||
| 122 | - src: https://github.com/xdKinso/KinsoExtension | ||
| 123 | - raw: https://xdkinso.github.io/KinsoExtension/versioning.json | ||
| 124 | |||
| 125 | == Lucifer | ||
| 126 | - url: https://read.pirate.vodka/ | ||
| 127 | - src: https://github.com/LucifersCircle/pirate.vodka-extensions | ||
| 128 | - raw: https://read.pirate.vodka/versioning.json | ||
| 129 | |||
| 130 | == Nicartjay | ||
| 131 | - url: https://nicartjay.github.io/PaperbackExt/0.9/stable/ | ||
| 132 | - src: https://github.com/Nicartjay/PaperbackExt | ||
| 133 | - raw: https://nicartjay.github.io/PaperbackExt/0.9/stable/versioning.json | ||
| 134 | |||
| 135 | == Nyzzik | ||
| 136 | - url: https://paperback.nyzz.me/ | ||
| 137 | - src: https://github.com/nyzzik/extensions | ||
| 138 | - raw: https://paperback.nyzz.me/versioning.json | ||
| 139 | |||
| 140 | == Sinon | ||
| 141 | - url: https://catta1997.github.io/Sinon-Paperback-Extensions/0.9/stable/ | ||
| 142 | - src: https://github.com/Catta1997/Sinon-Paperback-Extensions | ||
| 143 | - raw: https://catta1997.github.io/Sinon-Paperback-Extensions/0.9/stable/versioning.json | ||
| 144 | ::: | ||
| 145 | |||
| 146 | ## Paperback (v0.8) | ||
| 147 | |||
| 148 | ::: extrepo {scheme=paperback} | ||
| 149 | |||
| 150 | == Ace | ||
| 151 | - url: https://acepilot147.github.io/pb-extensions/0.8/ | ||
| 152 | - src: https://github.com/acepilot147/pb-extensions | ||
| 153 | - raw: https://acepilot147.github.io/pb-extensions/0.8/versioning.json | ||
| 154 | |||
| 155 | == Default | ||
| 156 | - url: https://paperback-ios.github.io/extensions/main/ | ||
| 157 | - src: https://github.com/paperback-ios/extensions | ||
| 158 | - raw: https://paperback-ios.github.io/extensions/main/versioning.json | ||
| 159 | |||
| 160 | == Ivan | ||
| 161 | - url: https://ivanmatthew.github.io/ivans-paperback-extensions/paperback-0.8/ | ||
| 162 | - src: https://github.com/ivanmatthew/ivans-paperback-extensions | ||
| 163 | - raw: https://ivanmatthew.github.io/ivans-paperback-extensions/paperback-0.8/versioning.json | ||
| 164 | |||
| 165 | == Kakarot0 | ||
| 166 | - url: https://karrot0.github.io/kakarotextension0.8/0.8-stable/ | ||
| 167 | - src: https://github.com/karrot0/kakarotextension0.8 | ||
| 168 | - raw: https://karrot0.github.io/kakarotextension0.8/0.8-stable/versioning.json | ||
| 169 | |||
| 170 | == Kinso | ||
| 171 | - url: https://xdkinso.github.io/kinso-extensions-v0.8/ | ||
| 172 | - src: https://github.com/xdKinso/kinso-extensions-v0.8 | ||
| 173 | - raw: https://xdkinso.github.io/kinso-extensions-v0.8/versioning.json | ||
| 174 | |||
| 175 | == Shadorig | ||
| 176 | - url: https://shadorig.github.io/real-extensions/sources/ | ||
| 177 | - src: https://github.com/shadorig/real-extensions | ||
| 178 | - raw: https://shadorig.github.io/real-extensions/sources/versioning.json | ||
| 179 | ::: | ||
| 180 | |||
| 181 | ## Anime | ||
| 182 | |||
| 183 | ::: extrepo {scheme=aniyomi} | ||
| 184 | |||
| 185 | == Yūzōnō | ||
| 186 | - url: https://yuzono.github.io | ||
| 187 | - src: https://github.com/yuzono/anime-extensions | ||
| 188 | - raw: https://raw.githubusercontent.com/yuzono/anime-repo/repo/index.min.json | ||
| 189 | |||
| 190 | == Secozzi | ||
| 191 | - url: https://github.com/Secozzi/aniyomi-extensions | ||
| 192 | - raw: https://raw.githubusercontent.com/Secozzi/aniyomi-extensions/refs/heads/repo/index.min.json | ||
| 193 | |||
| 194 | == Claudemirovsky | ||
| 195 | - url: https://github.com/Claudemirovsky/cursedyomi-extensions | ||
| 196 | - raw: https://raw.githubusercontent.com/Claudemirovsky/cursedyomi-extensions/repo/index.min.json | ||
| 197 | |||
| 198 | == hollow | ||
| 199 | - url: https://codeberg.org/hollow/aniyomi-extensions-fr | ||
| 200 | - raw: https://codeberg.org/hollow/aniyomi-extensions-fr/media/branch/repo/index.min.json | ||
| 201 | ::: | ||
| 202 | |||
| 203 | ## Manga | ||
| 204 | |||
| 205 | ::: extrepo {scheme=tachiyomi} | ||
| 206 | |||
| 207 | == Keiyoushi | ||
| 208 | - url: https://keiyoushi.github.io/ | ||
| 209 | - src: https://github.com/keiyoushi/extensions-source | ||
| 210 | - note: Maintained by former Tachiyomi contributors | ||
| 211 | - raw: https://raw.githubusercontent.com/keiyoushi/extensions/repo/index.min.json | ||
| 212 | |||
| 213 | == Yūzōnō | ||
| 214 | - url: https://yuzono.github.io | ||
| 215 | - src: https://github.com/yuzono/tachiyomi-extensions | ||
| 216 | - note: By Komikku dev. Mirrors Keiyoushi repo with a few extra extensions | ||
| 217 | - raw: https://raw.githubusercontent.com/yuzono/manga-repo/repo/index.min.json | ||
| 218 | |||
| 219 | == Fucked by FAKKU | ||
| 220 | - url: https://github.com/mojuru/cursed-manga-repo | ||
| 221 | - note: Removed extensions from Keiyoushi due to DMCA by FAKKU. Maintained by Kommikku dev. | ||
| 222 | - raw: https://raw.githubusercontent.com/mojuru/cursed-manga-repo/repo/index.min.json | ||
| 223 | |||
| 224 | == Kavita | ||
| 225 | - url: https://github.com/Kareadita/tach-extension/ | ||
| 226 | - raw: https://raw.githubusercontent.com/Kareadita/tach-extension/repo/index.min.json | ||
| 227 | |||
| 228 | == Suwayomi | ||
| 229 | - url: https://github.com/Suwayomi/tachiyomi-extension | ||
| 230 | - raw: https://raw.githubusercontent.com/Suwayomi/tachiyomi-extension/repo/index.min.json | ||
| 231 | |||
| 232 | == copymanga-copy20 | ||
| 233 | - url: https://github.com/LittleSurvival/copymanga-copy20 | ||
| 234 | - raw: https://raw.githubusercontent.com/LittleSurvival/copymanga-copy20/repo/index.min.json | ||
| 235 | ::: | ||
unocss.config.ts +11 −1
| @@ -18,6 +18,7 @@ import { | |||
| 18 | transformerDirectives | 18 | transformerDirectives |
| 19 | } from 'unocss' | 19 | } from 'unocss' |
| 20 | import { aliases } from './docs/.vitepress/configs/markdown/emoji' | 20 | import { aliases } from './docs/.vitepress/configs/markdown/emoji' |
| 21 | import { LANG_FLAG_FALLBACK, LANG_FLAG_ICONS } from './docs/.vitepress/configs/markdown/langFlags' | ||
| 21 | 22 | ||
| 22 | const iconPrefixes = [ | 23 | const iconPrefixes = [ |
| 23 | 'octicon-', | 24 | 'octicon-', |
| @@ -75,7 +76,16 @@ const safelist = [ | |||
| 75 | 'i-lucide:message-circle', | 76 | 'i-lucide:message-circle', |
| 76 | 'i-lucide:copy', | 77 | 'i-lucide:copy', |
| 77 | 'i-lucide:check', | 78 | 'i-lucide:check', |
| 78 | 'i-lucide:settings' | 79 | 'i-lucide:settings', |
| 80 | 'i-lucide:download', | ||
| 81 | 'i-lucide:chevron-down', | ||
| 82 | 'i-lucide:search', | ||
| 83 | 'i-lucide:languages', | ||
| 84 | 'i-lucide:shield', | ||
| 85 | 'i-twemoji-no-one-under-eighteen', | ||
| 86 | ...Array.from(new Set([...Object.values(LANG_FLAG_ICONS), LANG_FLAG_FALLBACK])).map( | ||
| 87 | (icon) => `i-twemoji-${icon}` | ||
| 88 | ) | ||
| 79 | ] | 89 | ] |
| 80 | 90 | ||
| 81 | export default defineConfig({ | 91 | export default defineConfig({ |