Skip to content

Commit 5570651

Browse files
authored
Merge branch 'main' into chore/add-issue-templates
2 parents 9336d0d + 54aa86a commit 5570651

43 files changed

Lines changed: 1735 additions & 454 deletions

Some content is hidden

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

app/components/CallToAction.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const socialLinks = computed(() => [
2525
ctaKey: $t('about.get_involved.follow.cta'),
2626
},
2727
])
28+
29+
function handleCardClick(event: MouseEvent) {
30+
if ((event.target as HTMLElement).closest(':any-link')) return
31+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return
32+
33+
const selection = window.getSelection()
34+
if (selection && selection.type === 'Range') return
35+
36+
const card = event.currentTarget as HTMLElement
37+
const link = card.querySelector('a')
38+
link?.click()
39+
}
2840
</script>
2941

3042
<template>
@@ -37,15 +49,16 @@ const socialLinks = computed(() => [
3749
<div
3850
v-for="link in socialLinks"
3951
:key="link.id"
40-
class="group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
52+
@click="handleCardClick"
53+
class="cursor-pointer group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
4154
>
42-
<h3 class="z-1 flex gap-2">
55+
<h3 class="flex gap-2">
4356
<span :class="link.icon" class="shrink-0 mt-1 w-5 h-5 text-fg" aria-hidden="true" />
4457
<span class="font-medium text-fg">
4558
{{ link.titleKey }}
4659
</span>
4760
</h3>
48-
<p class="z-1 text-sm text-fg-muted leading-relaxed">
61+
<p class="text-sm text-fg-muted leading-relaxed">
4962
{{ link.descriptionKey }}
5063
</p>
5164
<a
@@ -56,7 +69,6 @@ const socialLinks = computed(() => [
5669
>
5770
{{ link.ctaKey }}
5871
<span class="i-lucide:arrow-right rtl-flip w-3 h-3" aria-hidden="true" />
59-
<span class="absolute z-0 inset-0" aria-hidden="true" />
6072
</a>
6173
</div>
6274
</div>

app/components/Code/DirectoryListing.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ const bytesFormatter = useBytesFormatter()
120120
</svg>
121121
<span class="w-full flex justify-self-stretch items-center gap-2">
122122
<span class="flex-1">{{ node.name }}</span>
123-
<span
124-
v-if="node.type === 'file' && node.size"
125-
class="text-end text-xs text-fg-subtle"
126-
>
123+
<span v-if="typeof node.size === 'number'" class="text-end text-xs text-fg-subtle">
127124
{{ bytesFormatter.format(node.size) }}
128125
</span>
129126
</span>

app/components/Compare/PackageSelector.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,20 @@ function handleKeydown(e: KeyboardEvent) {
105105
case 'ArrowDown':
106106
e.preventDefault()
107107
if (count === 0) return
108-
highlightedIndex.value = Math.min(highlightedIndex.value + 1, count - 1)
108+
if (highlightedIndex.value < count - 1) {
109+
highlightedIndex.value++
110+
} else {
111+
highlightedIndex.value = 0
112+
}
109113
break
110114
111115
case 'ArrowUp':
112116
e.preventDefault()
113117
if (count === 0) return
114118
if (highlightedIndex.value > 0) {
115119
highlightedIndex.value--
120+
} else {
121+
highlightedIndex.value = count - 1
116122
}
117123
break
118124

app/components/Package/ClaimPackageModal.vue

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { checkPackageName } from '~/utils/package-name'
33
44
const props = defineProps<{
55
packageName: string
6+
packageScope?: string | null
7+
canPublishToScope: boolean
68
}>()
79
810
const {
@@ -221,9 +223,19 @@ const previewPackageJson = computed(() => {
221223
</div>
222224

223225
<!-- Availability status -->
224-
<div v-if="checkResult.valid">
226+
<template v-if="checkResult.valid">
225227
<div
226-
v-if="checkResult.available"
228+
v-if="isConnected && !canPublishToScope"
229+
class="flex items-center gap-3 p-4 bg-red-500/10 border border-red-500/20 rounded-lg"
230+
>
231+
<span class="i-lucide:x text-red-500 w-5 h-5" aria-hidden="true" />
232+
<p class="font-mono text-sm text-fg">
233+
{{ $t('claim.modal.missing_permission', { scope: packageScope }) }}
234+
</p>
235+
</div>
236+
237+
<div
238+
v-else-if="checkResult.available"
227239
class="flex items-center gap-3 p-4 bg-green-500/10 border border-green-500/20 rounded-lg"
228240
>
229241
<span class="i-lucide:check text-green-500 w-5 h-5" aria-hidden="true" />
@@ -237,10 +249,10 @@ const previewPackageJson = computed(() => {
237249
<span class="i-lucide:x text-red-500 w-5 h-5" aria-hidden="true" />
238250
<p class="font-mono text-sm text-fg">{{ $t('claim.modal.taken') }}</p>
239251
</div>
240-
</div>
252+
</template>
241253

242254
<!-- Similar packages warning -->
243-
<div v-if="checkResult.similarPackages?.length && checkResult.available">
255+
<template v-if="checkResult.similarPackages?.length && checkResult.available">
244256
<div
245257
:class="
246258
hasDangerousSimilarPackages
@@ -290,7 +302,7 @@ const previewPackageJson = computed(() => {
290302
</li>
291303
</ul>
292304
</div>
293-
</div>
305+
</template>
294306

295307
<!-- Error message -->
296308
<div
@@ -336,7 +348,7 @@ const previewPackageJson = computed(() => {
336348
</div>
337349

338350
<!-- Claim button -->
339-
<div v-else class="space-y-3">
351+
<div v-else-if="isConnected && canPublishToScope" class="space-y-3">
340352
<p class="text-sm text-fg-muted">
341353
{{ $t('claim.modal.publish_hint') }}
342354
</p>

app/components/Package/Playgrounds.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
22
import type { PlaygroundLink } from '#shared/types'
3-
import { decodeHtmlEntities } from '~/utils/formatters'
43
54
const props = defineProps<{
65
links: PlaygroundLink[]
@@ -130,7 +129,7 @@ function focusMenuItem(index: number) {
130129
:class="[getIcon(firstLink.provider), getColor(firstLink.provider), 'w-4 h-4 shrink-0']"
131130
aria-hidden="true"
132131
/>
133-
<span class="truncate text-fg-muted">{{ decodeHtmlEntities(firstLink.label) }}</span>
132+
<span class="truncate text-fg-muted">{{ firstLink.label }}</span>
134133
</a>
135134
</TooltipApp>
136135

@@ -186,7 +185,7 @@ function focusMenuItem(index: number) {
186185
:class="[getIcon(link.provider), getColor(link.provider), 'w-4 h-4 shrink-0']"
187186
aria-hidden="true"
188187
/>
189-
<span class="truncate">{{ decodeHtmlEntities(link.label) }}</span>
188+
<span class="truncate">{{ link.label }}</span>
190189
</a>
191190
</TooltipApp>
192191
</div>

app/components/Package/Table.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function getColumnLabel(id: ColumnId): string {
193193
<template v-if="isSortable('downloads')">
194194
<span
195195
v-if="isColumnSorted('downloads')"
196-
class="i-lucide:caret-down w-3 h-3"
196+
class="i-lucide:chevron-down w-3 h-3"
197197
:class="getSortDirection('downloads') === 'asc' ? 'rotate-180' : ''"
198198
aria-hidden="true"
199199
/>
@@ -231,7 +231,7 @@ function getColumnLabel(id: ColumnId): string {
231231
<template v-if="isSortable('updated')">
232232
<span
233233
v-if="isColumnSorted('updated')"
234-
class="i-lucide:caret-down w-3 h-3"
234+
class="i-lucide:chevron-down w-3 h-3"
235235
:class="getSortDirection('updated') === 'asc' ? 'rotate-180' : ''"
236236
aria-hidden="true"
237237
/>

app/components/Package/TrendsChart.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,7 @@ const chartConfig = computed(() => {
15751575
zoom: {
15761576
maxWidth: isMobile.value ? 350 : 500,
15771577
highlightColor: colors.value.bgElevated,
1578+
useResetSlot: true,
15781579
minimap: {
15791580
show: true,
15801581
lineColor: '#FAFAFA',
@@ -1805,6 +1806,19 @@ watch(selectedMetric, value => {
18051806
</div>
18061807
</template>
18071808

1809+
<!-- Custom minimap reset button -->
1810+
<template #reset-action="{ reset: resetMinimap }">
1811+
<button
1812+
type="button"
1813+
aria-label="reset minimap"
1814+
class="absolute inset-is-1/2 -translate-x-1/2 -bottom-18 sm:inset-is-unset sm:translate-x-0 sm:bottom-auto sm:-inset-ie-20 sm:-top-3 flex items-center justify-center px-2.5 py-1.75 border border-transparent rounded-md text-fg-subtle hover:text-fg transition-colors hover:border-border focus-visible:outline-accent/70 sm:mb-0"
1815+
style="pointer-events: all !important"
1816+
@click="resetMinimap"
1817+
>
1818+
<span class="i-lucide:undo-2 w-5 h-5" aria-hidden="true" />
1819+
</button>
1820+
</template>
1821+
18081822
<template #menuIcon="{ isOpen }">
18091823
<span v-if="isOpen" class="i-lucide:x w-6 h-6" aria-hidden="true" />
18101824
<span v-else class="i-lucide:ellipsis-vertical w-6 h-6" aria-hidden="true" />

app/components/Package/VersionDistribution.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const chartConfig = computed(() => {
243243
zoom: {
244244
maxWidth: isMobile.value ? 350 : 500,
245245
highlightColor: colors.value.bgElevated,
246+
useResetSlot: true,
246247
minimap: {
247248
show: true,
248249
lineColor: '#FAFAFA',
@@ -521,6 +522,19 @@ const endDate = computed(() => {
521522
</div>
522523
</template>
523524

525+
<!-- Custom minimap reset button -->
526+
<template #reset-action="{ reset: resetMinimap }">
527+
<button
528+
type="button"
529+
aria-label="reset minimap"
530+
class="absolute inset-is-1/2 -translate-x-1/2 -bottom-18 sm:inset-is-unset sm:translate-x-0 sm:bottom-auto sm:-inset-ie-20 sm:-top-3 flex items-center justify-center px-2.5 py-1.75 border border-transparent rounded-md text-fg-subtle hover:text-fg transition-colors hover:border-border focus-visible:outline-accent/70 sm:mb-0"
531+
style="pointer-events: all !important"
532+
@click="resetMinimap"
533+
>
534+
<span class="i-lucide:undo-2 w-5 h-5" aria-hidden="true" />
535+
</button>
536+
</template>
537+
524538
<!-- Contextual menu icon -->
525539
<template #menuIcon="{ isOpen }">
526540
<span v-if="isOpen" class="i-lucide:x w-6 h-6" aria-hidden="true" />

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ const config = computed(() => {
362362
.vue-ui-sparkline-title span {
363363
padding: 0 !important;
364364
letter-spacing: 0.04rem;
365+
@apply font-mono;
365366
}
366367
367368
.vue-ui-sparkline text {

app/composables/useMarkdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decodeHtmlEntities } from '~/utils/formatters'
1+
import { decodeHtmlEntities } from '#shared/utils/html'
22

33
interface UseMarkdownOptions {
44
text: string

0 commit comments

Comments
 (0)