Skip to content

Commit 4a27f3b

Browse files
committed
Merge remote-tracking branch 'origin/main' into vt/commands
2 parents 5bb7fea + 88e5b89 commit 4a27f3b

19 files changed

Lines changed: 342 additions & 124 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ watch(open, isOpen => {
121121
</p>
122122

123123
<div
124-
class="flex items-center p-3 bg-[#0d0d0d] border border-border rounded-lg font-mono text-sm"
124+
class="flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
125125
>
126126
<span class="text-fg-subtle">$</span>
127-
<span class="text-fg ml-2">{{ executeNpmxConnectorCommand }}</span>
127+
<span class="text-fg-subtle ml-2">{{ executeNpmxConnectorCommand }}</span>
128128
<button
129129
type="button"
130130
:aria-label="

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: 40 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[]
@@ -414,9 +426,18 @@ const chartData = computed<{ dataset: VueUiXyDatasetItem[] | null; dates: string
414426
415427
const formatter = ({ value }: { value: number }) => formatCompactNumber(value, { decimals: 1 })
416428
429+
const loadFile = (link: string, filename: string) => {
430+
const a = document.createElement('a')
431+
a.href = link
432+
a.download = filename
433+
a.click()
434+
a.remove()
435+
}
436+
417437
const config = computed(() => ({
418438
theme: isDarkMode.value ? 'dark' : 'default',
419439
chart: {
440+
height: isMobile.value ? 850 : 600,
420441
userOptions: {
421442
buttons: {
422443
pdf: false,
@@ -425,6 +446,22 @@ const config = computed(() => ({
425446
table: false,
426447
tooltip: false,
427448
},
449+
callbacks: {
450+
img: ({ imageUri }: { imageUri: string }) => {
451+
loadFile(imageUri, `${packageName}-${selectedGranularity.value}.png`)
452+
},
453+
csv: (csvStr: string) => {
454+
const blob = new Blob([csvStr.replace('data:text/csv;charset=utf-8,', '')])
455+
const url = URL.createObjectURL(blob)
456+
loadFile(url, `${packageName}-${selectedGranularity.value}.csv`)
457+
URL.revokeObjectURL(url)
458+
},
459+
svg: ({ blob }: { blob: Blob }) => {
460+
const url = URL.createObjectURL(blob)
461+
loadFile(url, `${packageName}-${selectedGranularity.value}.svg`)
462+
URL.revokeObjectURL(url)
463+
},
464+
},
428465
},
429466
backgroundColor: isDarkMode.value ? '#0A0A0A' : '#FFFFFF',
430467
grid: {
@@ -474,6 +511,7 @@ const config = computed(() => ({
474511
},
475512
},
476513
zoom: {
514+
maxWidth: 500,
477515
highlightColor: isDarkMode.value ? '#2A2A2A' : '#E1E5E8',
478516
minimap: {
479517
show: true,
@@ -699,9 +737,4 @@ const config = computed(() => ({
699737
background: var(--bg-elevated) !important;
700738
box-shadow: none !important;
701739
}
702-
703-
.vue-data-ui-zoom {
704-
max-width: 500px;
705-
margin: 0 auto;
706-
}
707740
</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

0 commit comments

Comments
 (0)