@@ -20,9 +20,18 @@ const OG_PADDING_X = 80
2020const CONTENT_WIDTH = 1200 - OG_PADDING_X * 2
2121
2222const ACCENT_COLORS = [
23- ' #60a5fa' , ' #f472b6' , ' #34d399' , ' #fbbf24' ,
24- ' #a78bfa' , ' #fb923c' , ' #22d3ee' , ' #e879f9' ,
25- ' #4ade80' , ' #f87171' , ' #38bdf8' , ' #facc15' ,
23+ ' #60a5fa' ,
24+ ' #f472b6' ,
25+ ' #34d399' ,
26+ ' #fbbf24' ,
27+ ' #a78bfa' ,
28+ ' #fb923c' ,
29+ ' #22d3ee' ,
30+ ' #e879f9' ,
31+ ' #4ade80' ,
32+ ' #f87171' ,
33+ ' #38bdf8' ,
34+ ' #facc15' ,
2635]
2736
2837// Tier thresholds
@@ -33,9 +42,7 @@ const SUMMARY_TOP_COUNT = 3
3342
3443const displayPackages = computed (() => {
3544 const raw = props .packages
36- return (typeof raw === ' string' ? raw .split (' ,' ) : raw )
37- .map (p => p .trim ())
38- .filter (Boolean )
45+ return (typeof raw === ' string' ? raw .split (' ,' ) : raw ).map (p => p .trim ()).filter (Boolean )
3946})
4047
4148type LayoutTier = ' full' | ' compact' | ' grid' | ' summary'
@@ -70,10 +77,13 @@ if (layoutTier.value !== 'summary') {
7077 { timeout: FETCH_TIMEOUT_MS },
7178 ).catch (() => null ),
7279 needsVersion
73- ? $fetch <{ ' dist-tags' ? : { latest? : string } }>(` https://registry.npmjs.org/${encoded } ` , {
74- timeout: FETCH_TIMEOUT_MS ,
75- headers: { Accept: ' application/vnd.npm.install-v1+json' },
76- }).catch (() => null )
80+ ? $fetch <{ ' dist-tags' ? : { latest? : string } }>(
81+ ` https://registry.npmjs.org/${encoded } ` ,
82+ {
83+ timeout: FETCH_TIMEOUT_MS ,
84+ headers: { Accept: ' application/vnd.npm.install-v1+json' },
85+ },
86+ ).catch (() => null )
7787 : Promise .resolve (null ),
7888 ])
7989 return {
@@ -125,7 +135,9 @@ const gridColumns = computed(() => {
125135})
126136
127137const GRID_ITEM_GAP = 10
128- const gridItemWidth = computed (() => ` ${Math .floor (CONTENT_WIDTH / gridColumns .value ) - GRID_ITEM_GAP }px ` )
138+ const gridItemWidth = computed (
139+ () => ` ${Math .floor (CONTENT_WIDTH / gridColumns .value ) - GRID_ITEM_GAP }px ` ,
140+ )
129141
130142const gridRows = computed (() => {
131143 const cols = gridColumns .value
@@ -137,7 +149,9 @@ const gridRows = computed(() => {
137149})
138150
139151const summaryTopNames = computed (() => displayPackages .value .slice (0 , SUMMARY_TOP_COUNT ))
140- const summaryRemainder = computed (() => Math .max (0 , displayPackages .value .length - SUMMARY_TOP_COUNT ))
152+ const summaryRemainder = computed (() =>
153+ Math .max (0 , displayPackages .value .length - SUMMARY_TOP_COUNT ),
154+ )
141155 </script >
142156
143157<template >
@@ -248,12 +262,12 @@ const summaryRemainder = computed(() => Math.max(0, displayPackages.value.length
248262 </div >
249263
250264 <!-- GRID layout (7-12 packages): packages in a side-by-side grid -->
251- <div v-else-if = " layoutTier === 'grid' " class = " flex flex-col gap-6 " style = " font-family : ' Geist ' , sans-serif " >
252- < div
253- v-for = " (row, ri) in gridRows "
254- :key = " ri "
255- class = " flex items-start "
256- >
265+ <div
266+ v-else-if = " layoutTier === 'grid' "
267+ class = " flex flex-col gap-6 "
268+ style = " font-family : ' Geist ' , sans-serif "
269+ >
270+ < div v-for = " (row, ri) in gridRows " :key = " ri " class = " flex items-start " >
257271 <!-- Using <span> as grid items because Satori treats <div> as full-width flex columns -->
258272 <span
259273 v-for =" pkg in row"
@@ -274,9 +288,12 @@ const summaryRemainder = computed(() => Math.max(0, displayPackages.value.length
274288 whiteSpace: 'nowrap',
275289 color: pkg.color,
276290 }"
277- >{{ pkg.name }}</span >
291+ >{{ pkg.name }}</span
292+ >
278293 <span class =" flex items-baseline gap-0.5" >
279- <span class =" text-2xl font-bold text-[#e5e5e5]" >{{ formatDownloads(pkg.downloads) }}</span >
294+ <span class =" text-2xl font-bold text-[#e5e5e5]" >{{
295+ formatDownloads(pkg.downloads)
296+ }}</span >
280297 <span class =" text-sm font-medium text-[#737373]" >/wk</span >
281298 </span >
282299 </span >
0 commit comments