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 )
3532const displayVersion = computed (() => pkg .value ?.requestedVersion ?? null )
3633
3734const repositoryUrl = computed (() => {
@@ -48,9 +45,7 @@ const repositoryUrl = computed(() => {
4845const { repoRef, stars, refresh : refreshRepoMeta } = useRepoMeta (repositoryUrl )
4946
5047const 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
5550const { 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+ }
9394const treeRows = shallowRef <TreeRow []>([])
9495
9596async 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+ }
129134const symbolRows = shallowRef <SymbolRow []>([])
130135
131136const 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
185190try {
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 >
0 commit comments