Skip to content

Commit 440bdb1

Browse files
committed
chore: sync
1 parent b4b7ffc commit 440bdb1

24 files changed

Lines changed: 315 additions & 655 deletions

app/components/OgImage/Package.takumi.vue

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ if (
2828
})
2929
}
3030
31-
const { data: pkg, refresh: refreshPkg } = usePackage(
32-
name,
33-
() => resolvedVersion.value ?? version,
34-
)
31+
const { data: pkg, refresh: refreshPkg } = usePackage(name, () => resolvedVersion.value ?? version)
3532
const displayVersion = computed(() => pkg.value?.requestedVersion ?? null)
3633
3734
const repositoryUrl = computed(() => {
@@ -48,9 +45,7 @@ const repositoryUrl = computed(() => {
4845
const { repoRef, stars, refresh: refreshRepoMeta } = useRepoMeta(repositoryUrl)
4946
5047
const compactFormat = new Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 1 })
51-
const formattedStars = computed(() =>
52-
stars.value > 0 ? compactFormat.format(stars.value) : '',
53-
)
48+
const formattedStars = computed(() => (stars.value > 0 ? compactFormat.format(stars.value) : ''))
5449
5550
const { name: siteName } = useSiteConfig()
5651
@@ -73,7 +68,9 @@ async function fetchWeeklyEvolution() {
7368
if (!pkgName) return
7469
7570
const today = new Date()
76-
const end = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - 1))
71+
const end = new Date(
72+
Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - 1),
73+
)
7774
const start = new Date(end.getTime() - (52 * 7 - 1) * 86400000)
7875
7976
const startIso = start.toISOString().slice(0, 10)
@@ -89,7 +86,11 @@ async function fetchWeeklyEvolution() {
8986
}
9087
9188
// Flatten file tree into renderable rows for code-tree variant
92-
interface TreeRow { name: string; depth: number; isDir: boolean }
89+
interface TreeRow {
90+
name: string
91+
depth: number
92+
isDir: boolean
93+
}
9394
const treeRows = shallowRef<TreeRow[]>([])
9495
9596
async function fetchCodeTree() {
@@ -125,7 +126,11 @@ async function fetchCodeTree() {
125126
}
126127
127128
// Parse docs TOC HTML to extract API symbols for function-tree variant
128-
interface SymbolRow { name: string; kind: 'section' | 'symbol'; icon: string }
129+
interface SymbolRow {
130+
name: string
131+
kind: 'section' | 'symbol'
132+
icon: string
133+
}
129134
const symbolRows = shallowRef<SymbolRow[]>([])
130135
131136
const KIND_ICONS: Record<string, string> = {
@@ -142,9 +147,9 @@ async function fetchFunctionTree() {
142147
const ver = resolvedVersion.value ?? version
143148
if (!name || !ver) return
144149
145-
const resp = await $fetch<{ toc: string | null }>(
146-
`/api/registry/docs/${name}/v/${ver}`,
147-
).catch(() => null)
150+
const resp = await $fetch<{ toc: string | null }>(`/api/registry/docs/${name}/v/${ver}`).catch(
151+
() => null,
152+
)
148153
if (!resp?.toc) return
149154
150155
const rows: SymbolRow[] = []
@@ -183,10 +188,7 @@ function fetchVariantData() {
183188
}
184189
185190
try {
186-
await Promise.all([
187-
refreshPkg().then(() => refreshRepoMeta()),
188-
fetchVariantData(),
189-
])
191+
await Promise.all([refreshPkg().then(() => refreshRepoMeta()), fetchVariantData()])
190192
} catch (err) {
191193
console.warn('[og-image-package] Failed to load data server-side:', err)
192194
throw createError({
@@ -233,22 +235,36 @@ const sparklineSrc = computed(() => {
233235

234236
<template>
235237
<div class="flex flex-col justify-center w-full bg-bg text-fg relative overflow-hidden font-sans">
236-
<div class="absolute -top-10 left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
238+
<div class="absolute -top-10 force-left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
237239

238240
<div class="p-15 flex flex-col gap-12">
239241
<div class="flex gap-4">
240-
<img src="/logo.svg" width="60" height="60" alt="npmx logo">
242+
<img src="/logo.svg" width="60" height="60" alt="npmx logo" />
241243
<h1 class="text-5xl tracking-tighter font-mono">{{ siteName }}</h1>
242244
</div>
243245

244246
<div class="flex flex-col max-w-full gap-3">
245-
<div v-if="pkgOrg" class="lg:text-5xl text-3xl opacity-50 font-mono tracking-tight leading-none" :style="{ textOverflow: 'ellipsis', lineClamp: 1 }">
247+
<div
248+
v-if="pkgOrg"
249+
class="lg:text-5xl text-3xl opacity-50 font-mono tracking-tight leading-none"
250+
:style="{ textOverflow: 'ellipsis', lineClamp: 1 }"
251+
>
246252
{{ pkgOrg }}
247253
</div>
248-
<div class="tracking-tighter font-mono leading-none overflow-hidden" :class="(pkgShortName?.length ?? 0) > 20 ? 'lg:text-6xl text-4xl' : 'lg:text-7xl text-5xl'" :style="{ textOverflow: 'ellipsis', lineClamp: 1, wordBreak: 'break-all' }">
254+
<div
255+
class="tracking-tighter font-mono leading-none overflow-hidden"
256+
:class="
257+
(pkgShortName?.length ?? 0) > 20 ? 'lg:text-6xl text-4xl' : 'lg:text-7xl text-5xl'
258+
"
259+
:style="{ textOverflow: 'ellipsis', lineClamp: 1, wordBreak: 'break-all' }"
260+
>
249261
{{ pkgShortName }}
250262
</div>
251-
<div v-if="version" class="pt-3 lg:text-4xl text-3xl opacity-70 font-mono tracking-tight leading-none" :style="{ textOverflow: 'ellipsis', lineClamp: 1 }">
263+
<div
264+
v-if="version"
265+
class="pt-3 lg:text-4xl text-3xl opacity-70 font-mono tracking-tight leading-none"
266+
:style="{ textOverflow: 'ellipsis', lineClamp: 1 }"
267+
>
252268
v{{ version }}
253269
</div>
254270
</div>
@@ -267,7 +283,11 @@ const sparklineSrc = computed(() => {
267283
<span>{{ formattedStars }}</span>
268284
</span>
269285

270-
<div v-if="pkg?.license && !pkg.license.includes(' ')" class="flex items-center gap-2" data-testid="license">
286+
<div
287+
v-if="pkg?.license && !pkg.license.includes(' ')"
288+
class="flex items-center gap-2"
289+
data-testid="license"
290+
>
271291
<div class="i-lucide:scale w-8 h-8 text-fg-subtle flex-shrink-0 self-center" />
272292
<span>{{ pkg.license }}</span>
273293
</div>
@@ -278,29 +298,32 @@ const sparklineSrc = computed(() => {
278298
<img
279299
v-if="variant === 'download-chart' && sparklineSrc"
280300
:src="sparklineSrc"
281-
class="absolute left-0 bottom-0 w-full h-[65%] opacity-45"
282-
>
301+
class="absolute force-left-0 bottom-0 w-full h-[65%] opacity-45"
302+
/>
283303

284304
<!-- Code tree variant -->
285305
<div
286306
v-if="variant === 'code-tree' && treeRows.length"
287-
class="absolute right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-25 overflow-hidden font-mono text-[18px] leading-[28px]"
307+
class="absolute force-right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-25 overflow-hidden font-mono text-4.5 leading-7"
288308
>
289309
<div
290310
v-for="(row, i) in treeRows"
291311
:key="i"
292312
class="flex items-center whitespace-nowrap text-fg"
293313
:style="{ paddingLeft: `${row.depth * 20}px` }"
294314
>
295-
<span class="w-5 h-5 shrink-0 mr-1.5" :class="row.isDir ? 'i-lucide:folder' : 'i-lucide:file'" />
315+
<span
316+
class="w-5 h-5 shrink-0 force-mr-1.5"
317+
:class="row.isDir ? 'i-lucide:folder' : 'i-lucide:file'"
318+
/>
296319
<span>{{ row.name }}</span>
297320
</div>
298321
</div>
299322

300323
<!-- Function tree variant (API symbols) -->
301324
<div
302325
v-if="variant === 'function-tree' && symbolRows.length"
303-
class="absolute right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-25 overflow-hidden font-mono text-[18px] leading-[28px]"
326+
class="absolute force-right-8 top-8 bottom-8 w-[340px] flex flex-col gap-0 opacity-25 overflow-hidden font-mono text-4.5 leading-7"
304327
>
305328
<div
306329
v-for="(row, i) in symbolRows"
@@ -310,10 +333,10 @@ const sparklineSrc = computed(() => {
310333
>
311334
<span
312335
v-if="row.kind === 'symbol'"
313-
class="w-5 h-5 shrink-0 mr-1.5"
336+
class="w-5 h-5 shrink-0 force-mr-1.5"
314337
:class="row.icon"
315338
/>
316-
<span :class="row.kind === 'section' ? 'opacity-60 text-[16px] mt-1' : ''">{{ row.name }}</span>
339+
<span :class="row.kind === 'section' ? 'opacity-60 text-4 mt-1' : ''">{{ row.name }}</span>
317340
</div>
318341
</div>
319342
</div>

app/components/OgImage/Page.takumi.vue

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,34 @@ const { name: siteName } = useSiteConfig()
88
</script>
99

1010
<template>
11-
<div
12-
data-theme="dark"
13-
class="flex w-full h-full items-center justify-center bg-bg text-fg font-sans"
14-
>
15-
<div class="absolute -top-10 left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
11+
<div
12+
data-theme="dark"
13+
class="flex w-full h-full items-center justify-center bg-bg text-fg font-sans"
14+
>
15+
<div class="absolute -top-10 force-left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
1616

17-
<div class="p-15 flex flex-col gap-12">
18-
<div class="flex gap-4">
19-
<img src="/logo.svg" width="60" height="60" alt="npmx logo">
20-
<h1 class="text-5xl tracking-tighter font-mono">{{ siteName }}</h1>
21-
</div>
17+
<div class="p-15 flex flex-col gap-12">
18+
<div class="flex gap-4">
19+
<img src="/logo.svg" width="60" height="60" alt="npmx logo" />
20+
<h1 class="text-5xl tracking-tighter font-mono">{{ siteName }}</h1>
21+
</div>
2222

23-
<div class="flex flex-col max-w-full gap-3">
24-
<div class="lg:text-7xl text-5xl tracking-tighter font-mono leading-none" :style="{ lineClamp: 1, textOverflow: 'ellipsis' }">
25-
{{ title }}
23+
<div class="flex flex-col max-w-full gap-3">
24+
<div
25+
class="lg:text-7xl text-5xl tracking-tighter font-mono leading-none"
26+
:style="{ lineClamp: 1, textOverflow: 'ellipsis' }"
27+
>
28+
{{ title }}
29+
</div>
2630
</div>
27-
</div>
2831

29-
<div v-if="description" class="pt-3 lg:text-4xl text-3xl opacity-70" :style="{ lineClamp: 2, textOverflow: 'ellipsis' }">
30-
{{ description }}
32+
<div
33+
v-if="description"
34+
class="pt-3 lg:text-4xl text-3xl opacity-70"
35+
:style="{ lineClamp: 2, textOverflow: 'ellipsis' }"
36+
>
37+
{{ description }}
38+
</div>
3139
</div>
3240
</div>
33-
34-
</div>
3541
</template>

app/components/OgImage/Splash.takumi.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ const { name, description } = useSiteConfig()
33
</script>
44

55
<template>
6-
<div
7-
data-theme="dark"
8-
class="px-20 flex w-full h-full items-center justify-center bg-bg text-fg font-sans"
9-
>
10-
<div class="absolute -top-10 left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
6+
<div
7+
data-theme="dark"
8+
class="px-20 flex w-full h-full items-center justify-center bg-bg text-fg font-sans"
9+
>
10+
<div class="absolute -top-10 force-left-12 size-[700px] rounded-full blur-3xl bg-fg/3" />
1111

12-
<div class="flex flex-col">
13-
<div class="flex items-center gap-4">
14-
<img src="/logo.svg" width="100" height="100" />
15-
<h1 class="text-8xl pb-3 font-mono">{{ name }}</h1>
16-
</div>
17-
<div class="text-4xl text-fg-muted gap-3">
18-
{{ description }}
12+
<div class="flex flex-col">
13+
<div class="flex items-center gap-4">
14+
<img src="/logo.svg" width="100" height="100" />
15+
<h1 class="text-8xl pb-3 font-mono">{{ name }}</h1>
16+
</div>
17+
<div class="text-4xl text-fg-muted gap-3">
18+
{{ description }}
19+
</div>
1920
</div>
2021
</div>
21-
22-
</div>
2322
</template>

app/composables/useCharts.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ export function buildRollingWeeklyEvolutionFromDaily(
148148
})
149149
}
150150

151-
152151
/** Catmull-Rom monotone cubic spline — same algorithm as vue-data-ui's smoothPath for OG Images */
153-
export function smoothPath(pts: { x: number, y: number }[]): string {
152+
export function smoothPath(pts: { x: number; y: number }[]): string {
154153
if (pts.length < 2) return '0,0'
155154
const n = pts.length - 1
156155
const r = (v: number) => Math.round(v * 100) / 100
@@ -169,20 +168,23 @@ export function smoothPath(pts: { x: number, y: number }[]): string {
169168
t[0] = m[0]!
170169
t[n] = m[n - 1]!
171170
for (let i = 1; i < n; i++) {
172-
t[i] = m[i - 1]! * m[i]! <= 0 ? 0 : 2 * m[i - 1]! * m[i]! / (m[i - 1]! + m[i]!)
171+
t[i] = m[i - 1]! * m[i]! <= 0 ? 0 : (2 * m[i - 1]! * m[i]!) / (m[i - 1]! + m[i]!)
173172
}
174173

175174
for (let i = 0; i < n; i++) {
176-
const x0 = pts[i]!.x, y0 = pts[i]!.y
177-
const x1 = pts[i + 1]!.x, y1 = pts[i + 1]!.y
175+
const x0 = pts[i]!.x,
176+
y0 = pts[i]!.y
177+
const x1 = pts[i + 1]!.x,
178+
y1 = pts[i + 1]!.y
178179
const seg = x1 - x0
179-
out.push(`C ${r(x0 + seg / 3)},${r(y0 + t[i]! * seg / 3)} ${r(x1 - seg / 3)},${r(y1 - t[i + 1]! * seg / 3)} ${r(x1)},${r(y1)}`)
180+
out.push(
181+
`C ${r(x0 + seg / 3)},${r(y0 + (t[i]! * seg) / 3)} ${r(x1 - seg / 3)},${r(y1 - (t[i + 1]! * seg) / 3)} ${r(x1)},${r(y1)}`,
182+
)
180183
}
181184

182185
return out.join(' ')
183186
}
184187

185-
186188
export function buildMonthlyEvolutionFromDaily(daily: DailyRawPoint[]): MonthlyDataPoint[] {
187189
const sorted = daily.slice().sort((a, b) => a.day.localeCompare(b.day))
188190
const valuesByMonth = new Map<string, number>()

app/pages/accessibility.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ useSeoMeta({
1010
1111
defineOgImage('Page.takumi', {
1212
title: () => $t('a11y.title'),
13-
description: () => $t('a11y.welcome', { app: 'npmx' }),
13+
description: () =>
14+
'erwtfggk890i4e 5rg8904e5r890g8954g8dcf jk458jg8945j8gwrg 4we5ghj987u4e5jg 8794j5897gj4 895jg9845j89gjtj' +
15+
$t('a11y.welcome', { app: 'npmx' }),
1416
})
1517
1618
const router = useRouter()

app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,15 @@ useSeoMeta({
298298
twitterDescription: () => `Browse source code for ${packageName.value}@${version.value}`,
299299
})
300300
301-
defineOgImage('Package.takumi', {
302-
name: () => packageName.value,
303-
version: () => version.value,
304-
variant: 'code-tree',
305-
}, [
306-
{ key: 'og' },
307-
{ key: 'whatsapp', width: 800, height: 800 },
308-
])
301+
defineOgImage(
302+
'Package.takumi',
303+
{
304+
name: () => packageName.value,
305+
version: () => version.value,
306+
variant: 'code-tree',
307+
},
308+
[{ key: 'og' }, { key: 'whatsapp', width: 800, height: 800 }],
309+
)
309310
</script>
310311

311312
<template>

app/pages/package-docs/[...path].vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ useSeoMeta({
109109
twitterDescription: () => pkg.value?.license ?? '',
110110
})
111111
112-
defineOgImage('Package.takumi', {
113-
name: () => packageName.value,
114-
version: () => resolvedVersion.value,
115-
variant: 'function-tree',
116-
}, [
117-
{ key: 'og' },
118-
{ key: 'whatsapp', width: 800, height: 800 },
119-
])
112+
defineOgImage(
113+
'Package.takumi',
114+
{
115+
name: () => packageName.value,
116+
version: () => resolvedVersion.value,
117+
variant: 'function-tree',
118+
},
119+
[{ key: 'og' }, { key: 'whatsapp', width: 800, height: 800 }],
120+
)
120121
121122
const showLoading = computed(
122123
() => docsStatus.value === 'pending' || (docsStatus.value === 'idle' && docsUrl.value !== null),

0 commit comments

Comments
 (0)