Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/components/OgImage/Compare.takumi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ if (layoutTier.value !== 'summary') {
}
}),
)
// Sort by downloads descending for readability
stats.value = results.sort((a, b) => b.downloads - a.downloads)
const packageOrder = new Map(displayPackages.value.map((name, index) => [name, index]))
stats.value = results.sort((a, b) => {
const downloadsDiff = b.downloads - a.downloads
if (downloadsDiff !== 0) return downloadsDiff
return (packageOrder.get(a.name) ?? 0) - (packageOrder.get(b.name) ?? 0)
})
} catch {
stats.value = displayPackages.value.map((name, index) => ({
name,
Expand Down
67 changes: 60 additions & 7 deletions app/components/OgImage/Package.takumi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ if (

const { data: pkg, refresh: refreshPkg } = usePackage(name, () => resolvedVersion.value ?? version)
const displayVersion = computed(() => pkg.value?.requestedVersion ?? null)
const versionLabel = computed(() => (version ? `v${version}` : ''))

const repositoryUrl = computed(() => {
const repo = displayVersion.value?.repository
Expand All @@ -63,8 +64,6 @@ const repositoryUrl = computed(() => {
})

const { repoRef, stars, refresh: refreshRepoMeta } = useRepoMeta(repositoryUrl)
const repoProviderIcon = useProviderIcon(() => repoRef.value?.provider, 'i-lucide:code')

const formattedStars = computed(() => (stars.value > 0 ? compactFormat.format(stars.value) : ''))

const formattedDownloads = computed(() => {
Expand Down Expand Up @@ -270,14 +269,65 @@ const sparklineSrc = computed(() => {
class="pt-3 lg:text-4xl text-3xl font-mono tracking-tight leading-none"
style="opacity: 0.7; text-overflow: ellipsis; line-clamp: 1"
>
v{{ version }}
{{ versionLabel }}
</div>
</div>

<div class="flex flex-col gap-3 text-4xl text-fg-muted">
<div v-if="repositoryUrl" class="flex items-center gap-2">
<div
:class="[repoProviderIcon, 'shrink-0 text-fg-muted']"
v-if="repoRef?.provider === 'github'"
class="i-simple-icons:github shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'gitlab'"
class="i-simple-icons:gitlab shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'bitbucket'"
class="i-simple-icons:bitbucket shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'codeberg'"
class="i-simple-icons:codeberg shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'gitea'"
class="i-simple-icons:gitea shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'forgejo'"
class="i-simple-icons:forgejo shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'gitee'"
class="i-simple-icons:gitee shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'sourcehut'"
class="i-simple-icons:sourcehut shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'tangled'"
class="i-custom:tangled shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else-if="repoRef?.provider === 'radicle'"
class="i-lucide:network shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<div
v-else
class="i-lucide:code shrink-0 text-fg-muted"
style="width: 24px; height: 24px"
/>
<span v-if="repoRef" class="max-w-[500px]" style="text-overflow: ellipsis">
Expand Down Expand Up @@ -330,13 +380,15 @@ const sparklineSrc = computed(() => {
<img
v-if="variant === 'download-chart' && sparklineSrc"
:src="sparklineSrc"
class="absolute force-left-0 bottom-0 w-full h-[65%]"
class="absolute bottom-0 w-full h-[65%]"
style="left: 0"
/>

<!-- Code tree variant -->
<div
v-else-if="variant === 'code-tree' && treeRows.length"
class="text-fg-muted absolute force-right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-30 overflow-hidden font-mono text-4.5 leading-8"
class="text-fg-muted absolute top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-30 overflow-hidden font-mono text-4.5 leading-8"
style="right: 2rem"
>
<div
v-for="(row, i) in treeRows"
Expand All @@ -361,7 +413,8 @@ const sparklineSrc = computed(() => {
<!-- Function tree variant (API symbols) -->
<div
v-else-if="variant === 'function-tree' && symbolRows.length"
class="absolute force-right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-30 overflow-hidden font-mono text-4.5 leading-8"
class="absolute top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-30 overflow-hidden font-mono text-4.5 leading-8"
style="right: 2rem"
>
<div
v-for="(row, i) in symbolRows"
Expand Down
2 changes: 1 addition & 1 deletion app/components/OgLayout.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
data-theme="dark"
class="flex w-full h-full bg-bg text-fg relative overflow-hidden font-sans"
class="block w-full h-full bg-bg text-fg relative overflow-hidden font-sans"
>
<slot />
</div>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"@shikijs/langs": "4.0.2",
"@shikijs/markdown-exit": "4.0.2",
"@shikijs/themes": "4.0.2",
"@takumi-rs/core": "1.0.9",
"@takumi-rs/wasm": "1.0.9",
"@takumi-rs/core": "2.0.0-rc.5",
"@takumi-rs/wasm": "2.0.0-rc.5",
"@unocss/nuxt": "66.6.7",
"@unocss/preset-wind4": "66.6.7",
"@upstash/redis": "1.37.0",
Expand All @@ -93,7 +93,7 @@
"marked": "18.0.0",
"module-replacements": "3.0.0-beta.8",
"nuxt": "4.4.8",
"nuxt-og-image": "^6.6.0",
"nuxt-og-image": "^6.7.2",
"ofetch": "1.5.1",
"ohash": "2.0.11",
"packumeta": "0.4.1",
Expand Down
Loading
Loading