Skip to content

Commit f8034cd

Browse files
Merge branch 'main' into fix/oauth-preview-url
2 parents 1320467 + 9e276c3 commit f8034cd

82 files changed

Lines changed: 1565 additions & 591 deletions

Some content is hidden

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

app/app.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,37 @@ function handleGlobalKeyup() {
7979
showKbdHints.value = false
8080
}
8181
82-
/* A hack to get light dismiss to work in safari because it does not support closedby="any" yet */
82+
// Light dismiss fallback for browsers that don't support closedby="any" (Safari + old Chrome/Firefox)
8383
// https://codepen.io/paramagicdev/pen/gbYompq
8484
// see: https://github.com/npmx-dev/npmx.dev/pull/522#discussion_r2749978022
8585
function handleModalLightDismiss(e: MouseEvent) {
8686
const target = e.target as HTMLElement
8787
if (target.tagName === 'DIALOG' && target.hasAttribute('open')) {
88+
const rect = target.getBoundingClientRect()
89+
const isOutside =
90+
e.clientX < rect.left ||
91+
e.clientX > rect.right ||
92+
e.clientY < rect.top ||
93+
e.clientY > rect.bottom
94+
95+
if (!isOutside) return
8896
;(target as HTMLDialogElement).close()
8997
}
9098
}
9199
92100
if (import.meta.client) {
93101
useEventListener(document, 'keydown', handleGlobalKeydown)
94102
useEventListener(document, 'keyup', handleGlobalKeyup)
95-
useEventListener(document, 'click', handleModalLightDismiss)
103+
104+
// Feature check for native light dismiss support via closedby="any"
105+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby
106+
const supportsClosedBy =
107+
typeof HTMLDialogElement !== 'undefined' &&
108+
typeof HTMLDialogElement.prototype === 'object' &&
109+
'closedBy' in HTMLDialogElement.prototype
110+
if (!supportsClosedBy) {
111+
useEventListener(document, 'click', handleModalLightDismiss)
112+
}
96113
}
97114
</script>
98115

app/assets/main.css

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
:root[data-theme='dark'] {
99
/* background colors */
10-
--bg: oklch(0.145 0 0);
11-
--bg-subtle: oklch(0.178 0 0);
12-
--bg-muted: oklch(0.218 0 0);
13-
--bg-elevated: oklch(0.252 0 0);
10+
--bg: var(--bg-color, oklch(0.145 0 0));
11+
--bg-subtle: var(--bg-subtle-color, oklch(0.178 0 0));
12+
--bg-muted: var(--bg-muted-color, oklch(0.218 0 0));
13+
--bg-elevated: var(--bg-elevated-color, oklch(0.252 0 0));
1414

1515
/* text colors */
1616
--fg: oklch(0.985 0 0);
1717
--fg-muted: oklch(0.709 0 0);
1818
--fg-subtle: oklch(0.633 0 0);
1919

20-
/* border, seperator colors */
20+
/* border, separator colors */
2121
--border: oklch(0.269 0 0);
2222
--border-subtle: oklch(0.239 0 0);
2323
--border-hover: oklch(0.371 0 0);
@@ -43,11 +43,39 @@
4343
--badge-pink: oklch(0.584 0.189 343);
4444
}
4545

46+
:root[data-theme='dark'][data-bg-theme='slate'] {
47+
--bg: oklch(0.129 0.012 264.695);
48+
--bg-subtle: oklch(0.159 0.022 262.421);
49+
--bg-muted: oklch(0.204 0.033 261.234);
50+
--bg-elevated: oklch(0.259 0.041 260.031);
51+
}
52+
53+
:root[data-theme='dark'][data-bg-theme='zinc'] {
54+
--bg: oklch(0.141 0.005 285.823);
55+
--bg-subtle: oklch(0.168 0.005 285.894);
56+
--bg-muted: oklch(0.209 0.005 285.929);
57+
--bg-elevated: oklch(0.256 0.006 286.033);
58+
}
59+
60+
:root[data-theme='dark'][data-bg-theme='stone'] {
61+
--bg: oklch(0.147 0.004 49.25);
62+
--bg-subtle: oklch(0.178 0.004 49.321);
63+
--bg-muted: oklch(0.218 0.004 49.386);
64+
--bg-elevated: oklch(0.252 0.007 34.298);
65+
}
66+
67+
:root[data-theme='dark'][data-bg-theme='black'] {
68+
--bg: oklch(0 0 0);
69+
--bg-subtle: oklch(0.148 0 0);
70+
--bg-muted: oklch(0.204 0 0);
71+
--bg-elevated: oklch(0.264 0 0);
72+
}
73+
4674
:root[data-theme='light'] {
47-
--bg: oklch(1 0 0);
48-
--bg-subtle: oklch(0.979 0.001 286.375);
49-
--bg-muted: oklch(0.955 0 0);
50-
--bg-elevated: oklch(0.94 0 0);
75+
--bg: var(--bg-color, oklch(1 0 0));
76+
--bg-subtle: var(--bg-subtle-color, oklch(0.979 0.001 286.375));
77+
--bg-muted: var(--bg-muted-color, oklch(0.955 0 0));
78+
--bg-elevated: var(--bg-elevated-color, oklch(0.94 0 0));
5179

5280
--fg: oklch(0.145 0 0);
5381
--fg-muted: oklch(0.439 0 0);
@@ -75,6 +103,27 @@
75103
--badge-cyan: oklch(0.571 0.181 210);
76104
}
77105

106+
:root[data-theme='light'][data-bg-theme='slate'] {
107+
--bg: oklch(1 0 0);
108+
--bg-subtle: oklch(0.982 0.006 264.62);
109+
--bg-muted: oklch(0.96 0.041 261.234);
110+
--bg-elevated: oklch(0.943 0.013 255.52);
111+
}
112+
113+
:root[data-theme='light'][data-bg-theme='zinc'] {
114+
--bg: oklch(1 0 0);
115+
--bg-subtle: oklch(0.979 0.004 286.53);
116+
--bg-muted: oklch(0.958 0.004 286.39);
117+
--bg-elevated: oklch(0.939 0.004 286.32);
118+
}
119+
120+
:root[data-theme='light'][data-bg-theme='stone'] {
121+
--bg: oklch(1 0 0);
122+
--bg-subtle: oklch(0.979 0.005 48.762);
123+
--bg-muted: oklch(0.958 0.005 48.743);
124+
--bg-elevated: oklch(0.943 0.005 48.731);
125+
}
126+
78127
@media (prefers-contrast: more) {
79128
:root[data-theme='dark'] {
80129
/* text colors */

app/components/BaseCard.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
/** Whether this is an exact match for the query */
4+
isExactMatch?: boolean
5+
}>()
6+
</script>
7+
8+
<template>
9+
<article
10+
class="group bg-bg-subtle border border-border rounded-lg p-4 sm:p-6 transition-[border-color,background-color] duration-200 hover:(border-border-hover bg-bg-muted) cursor-pointer relative focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-bg focus-within:ring-offset-2 focus-within:ring-fg/50 focus-within:bg-bg-muted focus-within:border-border-hover"
11+
:class="{
12+
'border-accent/30 contrast-more:border-accent/90 bg-accent/5': isExactMatch,
13+
}"
14+
>
15+
<!-- Glow effect for exact matches -->
16+
<div
17+
v-if="isExactMatch"
18+
class="absolute -inset-px rounded-lg bg-gradient-to-r from-accent/0 via-accent/20 to-accent/0 opacity-100 blur-sm -z-1 pointer-events-none motion-reduce:opacity-50"
19+
aria-hidden="true"
20+
/>
21+
<slot />
22+
</article>
23+
</template>

app/components/ColumnPicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const columnLabelKey: Record<string, string> = {
4242
version: 'filters.columns.version',
4343
description: 'filters.columns.description',
4444
downloads: 'filters.columns.downloads',
45-
updated: 'filters.columns.updated',
45+
updated: 'filters.columns.published',
4646
maintainers: 'filters.columns.maintainers',
4747
keywords: 'filters.columns.keywords',
4848
qualityScore: 'filters.columns.quality_score',

app/components/Filter/Panel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
228228
:value="filters.text"
229229
:placeholder="searchPlaceholder"
230230
autocomplete="off"
231-
class="input-base"
231+
class="w-full bg-bg-subtle border border-border rounded-md px-4 py-3 font-mono text-sm text-fg placeholder:text-fg-subtle transition-all duration-200 focus:(border-fg/40 outline-none ring-1 ring-fg/10)"
232232
@input="handleTextInput"
233233
/>
234234
</div>

app/components/Header/AuthModal.client.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async function handleLogin() {
8787
{{ $t('auth.modal.what_is_atmosphere') }}
8888
</summary>
8989
<div class="mt-3">
90-
<i18n-t keypath="auth.modal.atmosphere_explanation" tag="p">
90+
<i18n-t keypath="auth.modal.atmosphere_explanation" tag="p" scope="global">
9191
<template #npmx>
9292
<span class="font-bold">npmx.dev</span>
9393
</template>

app/components/Header/ConnectorModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function handleDisconnect() {
8888
{{ $t('connector.modal.contributor_badge') }}
8989
</span>
9090
<p class="text-sm text-fg-muted">
91-
<i18n-t keypath="connector.modal.contributor_notice">
91+
<i18n-t keypath="connector.modal.contributor_notice" scope="global">
9292
<template #link>
9393
<a
9494
href="https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"

app/components/Package/Card.vue

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,7 @@ const pkgDescription = useMarkdown(() => ({
2929
</script>
3030

3131
<template>
32-
<article
33-
class="group card-interactive scroll-mt-48 scroll-mb-6 relative focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-bg focus-within:ring-offset-2 focus-within:ring-fg/50 focus-within:bg-bg-muted focus-within:border-border-hover"
34-
:class="{
35-
'border-accent/30 contrast-more:border-accent/90 bg-accent/5': isExactMatch,
36-
}"
37-
>
38-
<!-- Glow effect for exact matches -->
39-
<div
40-
v-if="isExactMatch"
41-
class="absolute -inset-px rounded-lg bg-gradient-to-r from-accent/0 via-accent/20 to-accent/0 opacity-100 blur-sm -z-1 pointer-events-none motion-reduce:opacity-50"
42-
aria-hidden="true"
43-
/>
32+
<BaseCard :isExactMatch="isExactMatch">
4433
<div class="mb-2 flex items-baseline justify-start gap-2">
4534
<component
4635
:is="headingLevel ?? 'h3'"
@@ -94,7 +83,7 @@ const pkgDescription = useMarkdown(() => ({
9483
<dd class="font-mono">{{ result.package.publisher.username }}</dd>
9584
</div>
9685
<div v-if="result.package.date" class="flex items-center gap-1.5">
97-
<dt class="sr-only">{{ $t('package.card.updated') }}</dt>
86+
<dt class="sr-only">{{ $t('package.card.published') }}</dt>
9887
<dd>
9988
<DateTime
10089
:datetime="result.package.date"
@@ -169,5 +158,5 @@ const pkgDescription = useMarkdown(() => ({
169158
{{ keyword }}
170159
</li>
171160
</ul>
172-
</article>
161+
</BaseCard>
173162
</template>

app/components/Package/ListControls.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const sortOptions = computed(
3333
() =>
3434
[
3535
{ value: 'downloads', label: $t('package.sort.downloads') },
36-
{ value: 'updated', label: $t('package.sort.updated') },
36+
{ value: 'updated', label: $t('package.sort.published') },
3737
{ value: 'name-asc', label: $t('package.sort.name_asc') },
3838
{ value: 'name-desc', label: $t('package.sort.name_desc') },
3939
] as const,

app/components/Package/ListToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const sortKeyLabelKeys: Record<SortKey, string> = {
9191
'downloads-day': 'filters.sort.downloads_day',
9292
'downloads-month': 'filters.sort.downloads_month',
9393
'downloads-year': 'filters.sort.downloads_year',
94-
'updated': 'filters.sort.updated',
94+
'updated': 'filters.sort.published',
9595
'name': 'filters.sort.name',
9696
'quality': 'filters.sort.quality',
9797
'popularity': 'filters.sort.popularity',

0 commit comments

Comments
 (0)