Skip to content

Commit 8942e90

Browse files
authored
Merge branch 'main' into i18n/update
2 parents 5d72fc0 + 0667638 commit 8942e90

15 files changed

Lines changed: 185 additions & 61 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/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[]
@@ -417,6 +429,7 @@ const formatter = ({ value }: { value: number }) => formatCompactNumber(value, {
417429
const config = computed(() => ({
418430
theme: isDarkMode.value ? 'dark' : 'default',
419431
chart: {
432+
height: isMobile.value ? 850 : 600,
420433
userOptions: {
421434
buttons: {
422435
pdf: false,
@@ -474,6 +487,7 @@ const config = computed(() => ({
474487
},
475488
},
476489
zoom: {
490+
maxWidth: 500,
477491
highlightColor: isDarkMode.value ? '#2A2A2A' : '#E1E5E8',
478492
minimap: {
479493
show: true,
@@ -699,9 +713,4 @@ const config = computed(() => ({
699713
background: var(--bg-elevated) !important;
700714
box-shadow: none !important;
701715
}
702-
703-
.vue-data-ui-zoom {
704-
max-width: 500px;
705-
margin: 0 auto;
706-
}
707716
</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

app/utils/install-command.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
import type { JsrPackageInfo } from '#shared/types/jsr'
22

3+
// @unocss-include
34
export const packageManagers = [
4-
{ id: 'npm', label: 'npm', action: 'install', execute: 'npx' },
5-
{ id: 'pnpm', label: 'pnpm', action: 'add', execute: 'pnpm dlx' },
6-
{ id: 'yarn', label: 'yarn', action: 'add', execute: 'yarn dlx' },
7-
{ id: 'bun', label: 'bun', action: 'add', execute: 'bunx' },
8-
{ id: 'deno', label: 'deno', action: 'add', execute: 'deno run' },
9-
{ id: 'vlt', label: 'vlt', action: 'install', execute: 'vlt x' },
5+
{
6+
id: 'npm',
7+
label: 'npm',
8+
action: 'install',
9+
execute: 'npx',
10+
icon: 'i-simple-icons:npm',
11+
},
12+
{
13+
id: 'pnpm',
14+
label: 'pnpm',
15+
action: 'add',
16+
execute: 'pnpm dlx',
17+
icon: 'i-simple-icons:pnpm',
18+
},
19+
{
20+
id: 'yarn',
21+
label: 'yarn',
22+
action: 'add',
23+
execute: 'yarn dlx',
24+
icon: 'i-simple-icons:yarn',
25+
},
26+
{ id: 'bun', label: 'bun', action: 'add', execute: 'bunx', icon: 'i-simple-icons:bun' },
27+
{
28+
id: 'deno',
29+
label: 'deno',
30+
action: 'add',
31+
execute: 'deno run',
32+
icon: 'i-simple-icons:deno',
33+
},
34+
{ id: 'vlt', label: 'vlt', action: 'install', execute: 'vlt x', icon: 'i-custom-vlt' },
1035
] as const
1136

1237
export type PackageManagerId = (typeof packageManagers)[number]['id']

0 commit comments

Comments
 (0)