Skip to content

Commit f475794

Browse files
authored
Merge branch 'main' into feat/package-analytics-download-file-name
2 parents 091780e + b2589b1 commit f475794

18 files changed

Lines changed: 238 additions & 86 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The aim of [npmx.dev](https://npmx.dev) is to provide a better browser for the n
2121
## Shortcuts
2222

2323
> [!IMPORTANT]
24-
> We're keeping the website, repository, and our discord community low-profile until the browser is polished enough. We'll do a formal announcement at that point. Please avoid sharing the website or the invite link to discord on social media directly. The repo is public, so people who care about the project can easily find it and join us. Anyone who wants to help is more than welcome to [join the community](https://chat.npm.dev). If you know others who would be interested, please invite them too!
24+
> We're keeping the website, repository, and our discord community low-profile until the browser is polished enough. We'll do a formal announcement at that point. Please avoid sharing the website or the invite link to discord on social media directly. The repo is public, so people who care about the project can easily find it and join us. Anyone who wants to help is more than welcome to [join the community](https://chat.npmx.dev). If you know others who would be interested, please invite them too!
2525
2626
- [chat.npmx.dev](https://chat.npmx.dev) - Discord Server
2727
- [social.npmx.dev](https://social.npmx.dev) - Bluesky Profile

app/components/ChartModal.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<script setup lang="ts">
22
const open = defineModel<boolean>('open', { default: false })
33
4+
function close() {
5+
open.value = false
6+
}
7+
48
function handleKeydown(event: KeyboardEvent) {
59
if (event.key === 'Escape') {
6-
open.value = false
10+
close()
711
}
812
}
913
</script>
@@ -53,6 +57,8 @@ function handleKeydown(event: KeyboardEvent) {
5357
<slot />
5458
</div>
5559
</div>
60+
61+
<slot name="after" v-bind="{ close }" />
5662
</div>
5763
</div>
5864
</Transition>

app/components/ClaimPackageModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ const connectorModalOpen = shallowRef(false)
370370
>
371371
{{ $t('claim.modal.preview_json') }}
372372
</summary>
373-
<pre class="p-3 text-xs font-mono text-fg-muted bg-[#0d0d0d] overflow-x-auto">{{
373+
<pre class="p-3 text-xs font-mono text-fg-muted bg-bg-muted overflow-x-auto">{{
374374
JSON.stringify(previewPackageJson, null, 2)
375375
}}</pre>
376376
</details>

app/components/ConnectorModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ watch(open, isOpen => {
125125
</p>
126126

127127
<div
128-
class="flex items-center p-3 bg-[#0d0d0d] border border-border rounded-lg font-mono text-sm"
128+
class="flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
129129
>
130130
<span class="text-fg-subtle">$</span>
131131
<span class="text-fg ml-2">{{ executeNpmxConnectorCommand }}</span>

app/components/DateTime.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const props = withDefaults(
2929
},
3030
)
3131
32+
const { locale } = useI18n()
33+
3234
const relativeDates = useRelativeDates()
3335
3436
// Compute the title - always show full date for accessibility
@@ -41,7 +43,13 @@ const titleValue = computed(() => {
4143

4244
<template>
4345
<ClientOnly>
44-
<NuxtTime v-if="relativeDates" :datetime="datetime" :title="titleValue" relative />
46+
<NuxtTime
47+
v-if="relativeDates"
48+
:datetime="datetime"
49+
:title="titleValue"
50+
relative
51+
:locale="locale"
52+
/>
4553
<NuxtTime
4654
v-else
4755
:datetime="datetime"
@@ -50,6 +58,7 @@ const titleValue = computed(() => {
5058
:year="year"
5159
:month="month"
5260
:day="day"
61+
:locale="locale"
5362
/>
5463
<template #fallback>
5564
<NuxtTime
@@ -59,6 +68,7 @@ const titleValue = computed(() => {
5968
:year="year"
6069
:month="month"
6170
:day="day"
71+
:locale="locale"
6272
/>
6373
</template>
6474
</ClientOnly>

app/components/OperationsQueue.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ onUnmounted(() => {
198198
<!-- Result output for completed/failed -->
199199
<div
200200
v-else-if="op.result && (op.status === 'completed' || op.status === 'failed')"
201-
class="mt-2 p-2 bg-[#0d0d0d] border border-border rounded text-xs font-mono"
201+
class="mt-2 p-2 bg-bg-muted border border-border rounded text-xs font-mono"
202202
>
203203
<pre v-if="op.result.stdout" class="text-fg-muted whitespace-pre-wrap">{{
204204
op.result.stdout

app/components/PackageDownloadAnalytics.vue

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { ref, computed, shallowRef, watch } from 'vue'
33
import type { VueUiXyDatasetItem } from 'vue-data-ui'
44
import { VueUiXy } from 'vue-data-ui/vue-ui-xy'
5-
import { useDebounceFn } from '@vueuse/core'
5+
import { useDebounceFn, useElementSize } from '@vueuse/core'
66
77
const {
88
weeklyDownloads,
@@ -18,8 +18,10 @@ const {
1818
1919
const { accentColors, selectedAccentColor } = useAccentColor()
2020
const colorMode = useColorMode()
21-
2221
const resolvedMode = ref<'light' | 'dark'>('light')
22+
const rootEl = shallowRef<HTMLElement | null>(null)
23+
24+
const { width } = useElementSize(rootEl)
2325
2426
onMounted(() => {
2527
resolvedMode.value = colorMode.value === 'dark' ? 'dark' : 'light'
@@ -50,6 +52,16 @@ const accent = computed(() => {
5052
return id ? (oklchToHex(accentColorValueById.value[id]!) ?? '#8A8A8A') : '#8A8A8A'
5153
})
5254
55+
const mobileBreakpointWidth = 640
56+
57+
const isMobile = computed(() => {
58+
return width.value > 0 && width.value < mobileBreakpointWidth
59+
})
60+
61+
onMounted(() => {
62+
rootEl.value = document.documentElement
63+
})
64+
5365
type ChartTimeGranularity = 'daily' | 'weekly' | 'monthly' | 'yearly'
5466
type EvolutionData =
5567
| DailyDownloadPoint[]
@@ -425,6 +437,7 @@ const loadFile = (link: string, filename: string) => {
425437
const config = computed(() => ({
426438
theme: isDarkMode.value ? 'dark' : 'default',
427439
chart: {
440+
height: isMobile.value ? 850 : 600,
428441
userOptions: {
429442
buttons: {
430443
pdf: false,
@@ -498,6 +511,7 @@ const config = computed(() => ({
498511
},
499512
},
500513
zoom: {
514+
maxWidth: 500,
501515
highlightColor: isDarkMode.value ? '#2A2A2A' : '#E1E5E8',
502516
minimap: {
503517
show: true,
@@ -723,9 +737,4 @@ const config = computed(() => ({
723737
background: var(--bg-elevated) !important;
724738
box-shadow: none !important;
725739
}
726-
727-
.vue-data-ui-zoom {
728-
max-width: 500px;
729-
margin: 0 auto;
730-
}
731740
</style>

app/components/PackageWeeklyDownloadStats.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,19 @@ const config = computed(() => {
202202
:packageName="packageName"
203203
:createdIso="createdIso"
204204
/>
205+
206+
<template #after="{ close }">
207+
<div class="sm:hidden flex justify-center">
208+
<button
209+
type="button"
210+
@click="close"
211+
class="w-12 h-12 bg-bg-elevated border border-border rounded-full shadow-lg flex items-center justify-center text-fg-muted hover:text-fg transition-colors"
212+
:aria-label="$t('common.close')"
213+
>
214+
<span class="w-5 h-5 i-carbon-close" />
215+
</button>
216+
</div>
217+
</template>
205218
</ChartModal>
206219
</template>
207220

app/pages/[...package].vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,14 +680,15 @@ defineOgImageComponent('Package', {
680680
:key="pm.id"
681681
role="tab"
682682
:aria-selected="selectedPM === pm.id"
683-
class="px-2 py-1 font-mono text-xs rounded transition-colors duration-150 border border-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
683+
class="px-2 py-1 font-mono text-xs rounded transition-colors duration-150 border border-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 inline-flex items-center gap-1.5"
684684
:class="
685685
selectedPM === pm.id
686686
? 'bg-bg shadow text-fg border-border'
687687
: 'text-fg-subtle hover:text-fg border-transparent'
688688
"
689689
@click="selectedPM = pm.id"
690690
>
691+
<span class="inline-block h-3 w-3" :class="pm.icon" aria-hidden="true" />
691692
{{ pm.label }}
692693
</button>
693694
<template #fallback>

app/pages/search.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ const { data: results, status } = useNpmSearch(query, () => ({
8989
}))
9090
9191
// Keep track of previous results to show while loading
92-
const previousQuery = ref('')
92+
// Use useState so the value persists from SSR to client hydration
93+
const previousQuery = useState('search-previous-query', () => query.value)
9394
const cachedResults = ref(results.value)
9495
9596
// Update cached results smartly

0 commit comments

Comments
 (0)