Skip to content

Commit 6d96f7e

Browse files
committed
Merge branch 'main' into feat/201
2 parents e18e87e + 485cc9c commit 6d96f7e

193 files changed

Lines changed: 4510 additions & 1102 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#secure password, can use openssl rand --hex 32
2+
NUXT_SESSION_PASSWORD=""

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text eol=lf
1+
* text=auto eol=lf

.github/workflows/autofix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: 📦 Install browsers
3535
run: pnpm playwright install
3636

37+
- name: 🌐 Compare translations
38+
run: pnpm i18n:check
39+
3740
- name: 🌍 Update lunaria data
3841
run: pnpm build:lunaria
3942

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
branches:
1212
- main
1313

14+
# cancel in-progress runs on new commits to same PR (gitub.event.number)
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
17+
cancel-in-progress: true
18+
1419
permissions:
1520
contents: read
1621

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ This Code of Conduct applies within all project spaces, and it also applies when
3434

3535
## Enforcement
3636

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38-
39-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project stewards (`@danielroe` and `@patak.dev`) by DM in our [community chat](https://chat.npmx.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The stewards are obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
4038

4139
## Attribution
4240

CONTRIBUTING.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,31 @@ To add a new locale:
284284

285285
Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info.
286286

287+
### Update translation
288+
289+
We track the current progress of translations with [Lunaria](https://lunaria.dev/) on this site: https://i18n.npmx.dev/
290+
If you see any outdated translations in your language, feel free to update the keys to match then English version.
291+
292+
In order to make sure you have everything up-to-date, you can run:
293+
294+
```bash
295+
pnpm i18n:check <country-code>
296+
```
297+
298+
For example to check if all Japanese translation keys are up-to-date, run:
299+
300+
```bash
301+
pnpm i18n:check ja-JP
302+
```
303+
304+
To automatically add missing keys with English placeholders, use `--fix`:
305+
306+
```bash
307+
pnpm i18n:check:fix fr-FR
308+
```
309+
310+
This will add missing keys with `"EN TEXT TO REPLACE: {english text}"` as placeholder values, making it easier to see what needs translation.
311+
287312
#### Country variants (advanced)
288313

289314
Most languages only need a single locale file. Country variants are only needed when you want to support regional differences (e.g., `es-ES` for Spain vs `es-419` for Latin America).
@@ -344,13 +369,17 @@ We recommend the [i18n-ally](https://marketplace.visualstudio.com/items?itemName
344369

345370
The extension is included in our workspace recommendations, so VSCode should prompt you to install it.
346371

347-
### Formatting with locale
372+
### Formatting numbers and dates
348373

349-
When formatting numbers or dates that should respect the user's locale, pass the locale:
374+
Use vue-i18n's built-in formatters for locale-aware formatting:
350375

351-
```typescript
352-
const { locale } = useI18n()
353-
const formatted = formatNumber(12345, locale.value) // "12,345" in en-US
376+
```vue
377+
<template>
378+
<p>{{ $n(12345) }}</p>
379+
<!-- "12,345" in en-US, "12 345" in fr-FR -->
380+
<p>{{ $d(new Date()) }}</p>
381+
<!-- locale-aware date -->
382+
</template>
354383
```
355384

356385
## Testing

GOVERNANCE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Governance
2+
3+
This document outlines the governance model for npmx. This includes descriptions of different roles, nomination processes, code review processes, and Code of Conduct enforcement.
4+
5+
**All community members must follow the [Code of Conduct (CoC)](CODE_OF_CONDUCT.md).**
6+
7+
## Get Involved
8+
9+
**Anything that supports the npmx community is a valuable contribution!**
10+
11+
All types of contribution are meaningful. This can include code changes, type fixes, Discord activity, and even posting about npmx to your personal blog. No contribution is too small!
12+
13+
Anyone can become an npmx contributor. Engineering ability is not required. Our goal is to recognize all contributors to the project regardless of skill, experience or background.
14+
15+
## Roles
16+
17+
Each contributor role comes with a set of privileges and responsibilities, and they are granted for as long as the individual wishes to engage with the project. Contributors can voluntarily leave the project at any time.
18+
19+
### Contributor
20+
21+
Have you done something (big or small) to contribute to the health, success, or growth of npmx? Congratulations, you're officially recognized as a **Contributor** to the project! Examples of recognized contributions are helping on the repo, chat, and social. But also blogging, podcasting, and livestreaming about npmx.
22+
23+
This role does not require any extra responsibilities nor time commitment. We hope you stick around and keep participating in our community!
24+
25+
### Maintainer
26+
27+
The **Maintainer** role is available to contributors who want to join the team and take part in the long-term maintenance and growth of npmx. This role is critical to the long-term health of npmx. Maintainers act as the first line of defense when it comes to new issues, pull requests and chat activity.
28+
29+
Maintainers are not required to write code! Some Maintainers spend most of their time inside of our chat, maintaining a healthy community there. Others work on technical documentation, support, or design. There is no strict minimum number of contributions needed to reach this level, as long as you can show sustained involvement over time.
30+
31+
### Core
32+
33+
The **Core** role is available to community members who have a larger-than-usual impact on the npmx project and community. They are seen as leaders in the project and are listened to by the wider npmx community, often before they have even reached this level. A Core member is recognized for contributing a significant amount of time and energy to the project through issues, pull requests, bug fixes, implementing advanced features, or actively posting on our chat.
34+
35+
Not every contributor will reach this level, and that's okay! Maintainers still have significant responsibility and privileges within our community.
36+
37+
### Project Steward
38+
39+
**Stewards** control and maintain sensitive project asset and assist in shaping the direction and vision of the project. We aim to act with consensus within the core team, but stewards can resolve disagreements when needed. Stewards act in the project's best interest and should be an example for the rest of the community. New Stewards are added based on a unanimous vote by the existing Stewards.
40+
41+
The npmx project Stewards are currently:
42+
43+
- **Daniel Roe** ([website](https://roe.dev), [social](https://bsky.app/profile/danielroe.dev), [github](https://github.com/danielroe), [@danielroe](https://chat.npmx.dev))
44+
- **Matias Capeletto** ([website](https://patak.dev), [social](https://bsky.app/profile/patak.dev), [github](https://github.com/patak-dev), [@patak.dev](https://chat.npmx.dev))
45+
46+
---
47+
48+
Inspired by [Astro](https://github.com/withastro/.github/blob/main/GOVERNANCE.md), [ESLint](https://eslint.org/docs/6.0.0/maintainer-guide/governance), [Rome](https://github.com/rome/tools/blob/203b8efaf3ff087e82b97c484dedc5b5c5f15bcd/GOVERNANCE.md) and [Blitz](https://blitzjs.com/docs/maintainers).

app/app.vue

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { locale, locales } = useI18n()
1010
initPreferencesOnPrehydrate()
1111
1212
const isHomepage = computed(() => route.name === 'index')
13+
const showKbdHints = shallowRef(false)
1314
1415
const localeMap = locales.value.reduce(
1516
(acc, l) => {
@@ -21,8 +22,9 @@ const localeMap = locales.value.reduce(
2122
2223
useHead({
2324
htmlAttrs: {
24-
lang: () => locale.value,
25-
dir: () => localeMap[locale.value] ?? 'ltr',
25+
'lang': () => locale.value,
26+
'dir': () => localeMap[locale.value] ?? 'ltr',
27+
'data-kbd-hints': () => showKbdHints.value,
2628
},
2729
titleTemplate: titleChunk => {
2830
return titleChunk ? titleChunk : 'npmx - Better npm Package Browser'
@@ -33,16 +35,16 @@ if (import.meta.server) {
3335
setJsonLd(createWebSiteSchema())
3436
}
3537
36-
// Global keyboard shortcut: "/" focuses search or navigates to search page
38+
// Global keyboard shortcut:
39+
// "/" focuses search or navigates to search page
40+
// "?" highlights all keyboard shortcut elements
3741
function handleGlobalKeydown(e: KeyboardEvent) {
3842
const target = e.target as HTMLElement
3943
4044
const isEditableTarget =
4145
target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable
4246
43-
if (isEditableTarget) {
44-
return
45-
}
47+
if (isEditableTarget) return
4648
4749
if (e.key === '/') {
4850
e.preventDefault()
@@ -59,15 +61,26 @@ function handleGlobalKeydown(e: KeyboardEvent) {
5961
6062
router.push('/search')
6163
}
64+
65+
if (e.key === '?') {
66+
e.preventDefault()
67+
showKbdHints.value = true
68+
}
69+
}
70+
71+
function handleGlobalKeyup() {
72+
showKbdHints.value = false
6273
}
6374
6475
if (import.meta.client) {
6576
useEventListener(document, 'keydown', handleGlobalKeydown)
77+
useEventListener(document, 'keyup', handleGlobalKeyup)
6678
}
6779
</script>
6880

6981
<template>
7082
<div class="min-h-screen flex flex-col bg-bg text-fg">
83+
<NuxtPwaAssets />
7184
<a href="#main-content" class="skip-link font-mono">{{ $t('common.skip_link') }}</a>
7285

7386
<AppHeader :show-logo="!isHomepage" />
@@ -81,3 +94,25 @@ if (import.meta.client) {
8194
<ScrollToTop />
8295
</div>
8396
</template>
97+
98+
<style>
99+
/* Keyboard shortcut highlight on "?" key press */
100+
kbd {
101+
position: relative;
102+
}
103+
104+
kbd::before {
105+
content: '';
106+
position: absolute;
107+
inset: 0;
108+
border-radius: inherit;
109+
box-shadow: 0 0 4px 2px var(--accent);
110+
opacity: 0;
111+
transition: opacity 200ms ease-out;
112+
pointer-events: none;
113+
}
114+
115+
html[data-kbd-hints='true'] kbd::before {
116+
opacity: 1;
117+
}
118+
</style>

app/assets/main.css

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ html.light .shiki span {
463463
border-collapse: collapse;
464464
margin: 1.5rem 0;
465465
font-size: 0.875rem;
466+
word-break: keep-all;
466467
}
467468

468469
.readme-content th,
@@ -541,12 +542,6 @@ input[type='search']::-webkit-search-results-decoration {
541542
appearance: none;
542543
}
543544

544-
/* View transition for logo (hero -> header) */
545-
.hero-logo,
546-
.header-logo {
547-
view-transition-name: site-logo;
548-
}
549-
550545
/* Disable the default fade transition on page navigation */
551546
::view-transition-old(root),
552547
::view-transition-new(root) {
@@ -555,9 +550,7 @@ input[type='search']::-webkit-search-results-decoration {
555550

556551
/* Customize the view transition animations for specific elements */
557552
::view-transition-old(search-box),
558-
::view-transition-new(search-box),
559-
::view-transition-old(site-logo),
560-
::view-transition-new(site-logo) {
553+
::view-transition-new(search-box) {
561554
animation-duration: 0.3s;
562555
animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
563556
}

app/components/AnnounceTooltip.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script setup lang="ts">
2+
const props = defineProps<{
3+
/** Tooltip text */
4+
text: string
5+
/** Position: 'top' | 'bottom' | 'left' | 'right' */
6+
position?: 'top' | 'bottom' | 'left' | 'right'
7+
/** is tooltip visible */
8+
isVisible: boolean
9+
}>()
10+
</script>
11+
12+
<template>
13+
<BaseTooltip :text :isVisible :position :tooltip-attr="{ 'aria-live': 'polite' }"
14+
><slot
15+
/></BaseTooltip>
16+
</template>

0 commit comments

Comments
 (0)