Skip to content

Commit 0fb0c6c

Browse files
authored
Merge branch 'main' into visual-adjustments
2 parents f2dc027 + 3b7c027 commit 0fb0c6c

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,6 @@ jobs:
191191

192192
- name: 🧹 Check for unused code
193193
run: pnpm knip
194+
195+
- name: 🧹 Check for unused production code
196+
run: pnpm knip --production

app/components/Compare/ComparisonGrid.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ defineProps<{
2222
:key="index"
2323
class="comparison-cell comparison-cell-header"
2424
>
25-
<span class="font-mono text-sm font-medium text-fg truncate" :title="header">
25+
<NuxtLink
26+
:to="`/package/${header}`"
27+
class="link-subtle font-mono text-sm font-medium text-fg truncate"
28+
:title="header"
29+
>
2630
{{ header }}
27-
</span>
31+
</NuxtLink>
2832
</div>
2933
</div>
3034

knip.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const config: KnipConfig = {
2525
'uno-preset-rtl.ts!',
2626
'scripts/**/*.ts',
2727
],
28-
project: ['**/*.{ts,vue,cjs,mjs}'],
29-
ignore: ['test/fixtures/**'],
28+
project: ['**/*.{ts,vue,cjs,mjs}', '!test/fixtures/**'],
3029
ignoreDependencies: [
3130
'@iconify-json/*',
3231
'@vercel/kv',

server/api/registry/badge/[type]/[...pkg].get.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ const COLORS = {
3131
white: '#ffffff',
3232
}
3333

34-
function measureTextWidth(text: string): number {
35-
const charWidth = 7
34+
const DEFAULT_CHAR_WIDTH = 7
35+
const CHARS_WIDTH = {
36+
engines: 5.5,
37+
}
38+
39+
function measureTextWidth(text: string, charWidth?: number): number {
40+
charWidth ??= DEFAULT_CHAR_WIDTH
3641
const paddingX = 8
3742
return Math.max(40, Math.round(text.length * charWidth) + paddingX * 2)
3843
}
@@ -288,7 +293,10 @@ export default defineCachedEventHandler(
288293
const finalLabelColor = rawLabelColor?.startsWith('#') ? rawLabelColor : `#${rawLabelColor}`
289294

290295
const leftWidth = measureTextWidth(finalLabel)
291-
const rightWidth = measureTextWidth(finalValue)
296+
const rightWidth = measureTextWidth(
297+
finalValue,
298+
CHARS_WIDTH[strategyKey as keyof typeof CHARS_WIDTH],
299+
)
292300
const totalWidth = leftWidth + rightWidth
293301
const height = 20
294302

0 commit comments

Comments
 (0)