Skip to content

Commit a6ad3f9

Browse files
authored
Merge branch 'main' into fix/issue-2044
2 parents 91bfb34 + fbb9011 commit a6ad3f9

File tree

131 files changed

+835
-891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+835
-891
lines changed

.storybook/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const config = {
88
features: {
99
backgrounds: false,
1010
},
11-
async viteFinal(config) {
12-
config.plugins ??= []
11+
async viteFinal(newConfig) {
12+
newConfig.plugins ??= []
1313

14-
config.plugins.push({
14+
newConfig.plugins.push({
1515
name: 'ignore-internals',
1616
transform(_, id) {
1717
if (id.includes('/app/pages/blog/') && id.endsWith('.md')) {
@@ -23,7 +23,7 @@ const config = {
2323
// vue-docgen-api can crash on components that import types from other
2424
// .vue files (it tries to parse the SFC with @babel/parser as plain TS).
2525
// This wrapper catches those errors so the build doesn't fail.
26-
const docgenPlugin = config.plugins?.find(
26+
const docgenPlugin = newConfig.plugins?.find(
2727
(p): p is Extract<typeof p, { name: string }> =>
2828
!!p && typeof p === 'object' && 'name' in p && p.name === 'storybook:vue-docgen-plugin',
2929
)
@@ -48,7 +48,7 @@ const config = {
4848
}
4949
}
5050

51-
return config
51+
return newConfig
5252
},
5353
} satisfies StorybookConfig
5454

app/components/BuildEnvironment.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import type { BuildInfo } from '#shared/types'
3-
42
const { footer = false, buildInfo: buildInfoProp } = defineProps<{
53
footer?: boolean
64
buildInfo?: BuildInfo

app/components/Code/DirectoryListing.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import type { PackageFileTree } from '#shared/types'
32
import type { RouteLocationRaw } from 'vue-router'
43
import type { RouteNamedMap } from 'vue-router/auto-routes'
54
import { ADDITIONAL_ICONS, getFileIcon } from '~/utils/file-icons'

app/components/Code/FileTree.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import type { PackageFileTree } from '#shared/types'
32
import type { RouteLocationRaw } from 'vue-router'
43
import type { RouteNamedMap } from 'vue-router/auto-routes'
54
import { ADDITIONAL_ICONS, getFileIcon } from '~/utils/file-icons'

app/components/Code/MobileTreeDrawer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import type { PackageFileTree } from '#shared/types'
32
import type { RouteNamedMap } from 'vue-router/auto-routes'
43
54
defineProps<{

app/components/Compare/ComparisonGrid.vue

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const props = defineProps<{
1717
1818
/** Total column count including the optional no-dep column */
1919
const totalColumns = computed(() => props.columns.length + (props.showNoDependency ? 1 : 0))
20+
const visibleColumns = computed(() => Math.min(totalColumns.value, 4))
2021
2122
/** Compute plain-text tooltip for a replacement column */
2223
function getReplacementTooltip(col: ComparisonGridColumn): string {
@@ -30,32 +31,43 @@ function getReplacementTooltip(col: ComparisonGridColumn): string {
3031
<div class="overflow-x-auto">
3132
<div
3233
class="comparison-grid"
33-
:class="[totalColumns === 4 ? 'min-w-[800px]' : 'min-w-[600px]', `columns-${totalColumns}`]"
34-
:style="{ '--columns': totalColumns }"
34+
:style="{
35+
'--package-count': totalColumns,
36+
'--visible-columns': visibleColumns,
37+
}"
3538
>
3639
<!-- Header row -->
3740
<div class="comparison-header">
38-
<div class="comparison-label" />
41+
<div class="comparison-label relative bg-bg" />
3942

4043
<!-- Package columns -->
41-
<div v-for="col in columns" :key="col.name" class="comparison-cell comparison-cell-header">
42-
<span class="inline-flex items-center gap-1.5 truncate">
44+
<div
45+
v-for="col in columns"
46+
:key="col.name"
47+
class="comparison-cell comparison-cell-header min-w-0"
48+
>
49+
<div class="flex items-start justify-center gap-1.5 min-w-0">
4350
<LinkBase
4451
:to="packageRoute(col.name, col.version)"
45-
class="text-sm truncate"
46-
block
52+
class="flex min-w-0 flex-col items-center text-center text-sm"
4753
:title="col.version ? `${col.name}@${col.version}` : col.name"
4854
>
49-
{{ col.name }}<template v-if="col.version">@{{ col.version }}</template>
55+
<span class="min-w-0 break-words line-clamp-1">
56+
{{ col.name }}
57+
</span>
58+
<span v-if="col.version" class="text-fg-muted line-clamp-1">
59+
@{{ col.version }}
60+
</span>
5061
</LinkBase>
62+
5163
<TooltipApp v-if="col.replacement" :text="getReplacementTooltip(col)" position="bottom">
5264
<span
53-
class="i-lucide:lightbulb w-3.5 h-3.5 text-amber-500 shrink-0 cursor-help"
65+
class="i-lucide:lightbulb mt-0.5 h-3.5 w-3.5 shrink-0 cursor-help text-amber-500"
5466
role="img"
5567
:aria-label="$t('package.replacement.title')"
5668
/>
5769
</TooltipApp>
58-
</span>
70+
</div>
5971
</div>
6072

6173
<!-- "No dep" column (always last) -->
@@ -100,29 +112,30 @@ function getReplacementTooltip(col: ComparisonGridColumn): string {
100112

101113
<style scoped>
102114
.comparison-grid {
115+
--label-column-width: 140px;
116+
--package-column-width: calc((100% - var(--label-column-width)) / var(--visible-columns));
103117
display: grid;
104118
gap: 0;
105-
}
106-
107-
.comparison-grid.columns-2 {
108-
grid-template-columns: minmax(120px, 180px) repeat(2, 1fr);
109-
}
110-
111-
.comparison-grid.columns-3 {
112-
grid-template-columns: minmax(120px, 160px) repeat(3, 1fr);
113-
}
114-
115-
.comparison-grid.columns-4 {
116-
grid-template-columns: minmax(100px, 140px) repeat(4, 1fr);
119+
grid-template-columns:
120+
var(--label-column-width)
121+
repeat(var(--package-count), minmax(var(--package-column-width), var(--package-column-width)));
117122
}
118123
119124
.comparison-header {
120125
display: contents;
121126
}
122127
123128
.comparison-header > .comparison-label {
124-
padding: 0.75rem 1rem;
125-
border-bottom: 1px solid var(--color-border);
129+
z-index: 3;
130+
}
131+
132+
.comparison-label {
133+
position: sticky;
134+
left: 0;
135+
z-index: 2;
136+
inline-size: var(--label-column-width);
137+
min-inline-size: var(--label-column-width);
138+
isolation: isolate;
126139
}
127140
128141
.comparison-header > .comparison-cell-header {

app/components/Compare/FacetBarChart.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
178178
bold: false,
179179
color: colors.value.fg,
180180
value: {
181-
formatter: ({ config }) => {
182-
return config?.datapoint?.formattedValue ?? '0'
181+
formatter: ({ config: formatterConfig }) => {
182+
return formatterConfig?.datapoint?.formattedValue ?? '0'
183183
},
184184
},
185185
},

app/components/Compare/FacetCard.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import type { FacetValue } from '#shared/types'
3-
42
const props = defineProps<{
53
/** Facet label */
64
label: string

app/components/Compare/FacetRow.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import type { FacetValue } from '#shared/types'
3-
42
const props = defineProps<{
53
/** Facet label */
64
label: string
@@ -90,7 +88,9 @@ function isCellLoading(index: number): boolean {
9088
<template>
9189
<div class="contents">
9290
<!-- Label cell -->
93-
<div class="comparison-label flex items-center gap-1.5 px-4 py-3 border-b border-border">
91+
<div
92+
class="comparison-label relative bg-bg flex items-center gap-1.5 px-4 py-3 border-b border-border"
93+
>
9494
<span class="text-xs text-fg-muted uppercase tracking-wider">{{ label }}</span>
9595
<TooltipApp v-if="description" :text="description" position="top">
9696
<span class="i-lucide:info w-3 h-3 text-fg-subtle cursor-help" aria-hidden="true" />
@@ -153,3 +153,13 @@ function isCellLoading(index: number): boolean {
153153
</div>
154154
</div>
155155
</template>
156+
157+
<style lang="css" scoped>
158+
.comparison-label {
159+
position: sticky;
160+
left: 0;
161+
z-index: 2;
162+
inline-size: var(--label-column-width);
163+
min-inline-size: var(--label-column-width);
164+
}
165+
</style>

app/components/OgImage/Package.vue

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import { joinURL } from 'ufo'
3-
42
const props = withDefaults(
53
defineProps<{
64
name: string
@@ -38,16 +36,7 @@ const { data: pkg, refresh: refreshPkg } = usePackage(
3836
)
3937
const displayVersion = computed(() => pkg.value?.requestedVersion ?? null)
4038
41-
const repositoryUrl = computed(() => {
42-
const repo = displayVersion.value?.repository
43-
if (!repo?.url) return null
44-
let url = normalizeGitUrl(repo.url)
45-
// append `repository.directory` for monorepo packages
46-
if (repo.directory) {
47-
url = joinURL(`${url}/tree/HEAD`, repo.directory)
48-
}
49-
return url
50-
})
39+
const { repositoryUrl } = useRepositoryUrl(displayVersion)
5140
5241
const { data: likes, refresh: refreshLikes } = useFetch(() => `/api/social/likes/${name.value}`, {
5342
default: () => ({ totalLikes: 0, userHasLiked: false }),

0 commit comments

Comments
 (0)