Skip to content

Commit 9d14c22

Browse files
committed
Merge remote-tracking branch 'origin/main' into test/mock-connector
2 parents 11d3781 + f345226 commit 9d14c22

File tree

134 files changed

+7948
-1771
lines changed

Some content is hidden

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

134 files changed

+7948
-1771
lines changed

.lighthouserc.cjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ module.exports = {
3535
chromePath: findChrome(),
3636
puppeteerScript: './lighthouse-setup.cjs',
3737
settings: {
38-
onlyCategories: ['accessibility'],
38+
onlyCategories: process.env.LH_PERF ? ['performance'] : ['accessibility'],
3939
skipAudits: ['valid-source-maps'],
4040
},
4141
},
4242
assert: {
43-
assertions: {
44-
'categories:accessibility': ['error', { minScore: 1 }],
45-
},
43+
assertions: process.env.LH_PERF
44+
? {
45+
'cumulative-layout-shift': ['error', { maxNumericValue: 0 }],
46+
}
47+
: {
48+
'categories:accessibility': ['error', { minScore: 1 }],
49+
},
4650
},
4751
upload: {
4852
target: 'temporary-public-storage',

CONTRIBUTING.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This focus helps guide our project decisions as a community and what we choose t
5454
- [Unit tests](#unit-tests)
5555
- [Component accessibility tests](#component-accessibility-tests)
5656
- [Lighthouse accessibility tests](#lighthouse-accessibility-tests)
57+
- [Lighthouse performance tests](#lighthouse-performance-tests)
5758
- [End to end tests](#end-to-end-tests)
5859
- [Test fixtures (mocking external APIs)](#test-fixtures-mocking-external-apis)
5960
- [Submitting changes](#submitting-changes)
@@ -114,6 +115,7 @@ pnpm test:unit # Unit tests only
114115
pnpm test:nuxt # Nuxt component tests
115116
pnpm test:browser # Playwright E2E tests
116117
pnpm test:a11y # Lighthouse accessibility audits
118+
pnpm test:perf # Lighthouse performance audits (CLS)
117119
```
118120

119121
### Project structure
@@ -641,18 +643,38 @@ pnpm test:a11y:prebuilt
641643

642644
# Or run a single color mode manually
643645
pnpm build:test
644-
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse-a11y.sh
646+
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse.sh
645647
```
646648

647649
This requires Chrome or Chromium to be installed. The script will auto-detect common installation paths. Results are printed to the terminal and saved in `.lighthouseci/`.
648650

649651
#### Configuration
650652

651-
| File | Purpose |
652-
| ---------------------------- | --------------------------------------------------------- |
653-
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
654-
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
655-
| `scripts/lighthouse-a11y.sh` | Shell wrapper that runs the audit for a given color mode |
653+
| File | Purpose |
654+
| ----------------------- | --------------------------------------------------------- |
655+
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
656+
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
657+
| `scripts/lighthouse.sh` | Shell wrapper that runs the audit for a given color mode |
658+
659+
### Lighthouse performance tests
660+
661+
The project also runs Lighthouse performance audits to enforce zero Cumulative Layout Shift (CLS). These run separately from the accessibility audits and test the same set of URLs.
662+
663+
#### How it works
664+
665+
The same `.lighthouserc.cjs` config is shared between accessibility and performance audits. When the `LH_PERF` environment variable is set, the config switches from the `accessibility` category to the `performance` category and asserts that CLS is exactly 0.
666+
667+
#### Running locally
668+
669+
```bash
670+
# Build + run performance audit
671+
pnpm test:perf
672+
673+
# Or against an existing test build
674+
pnpm test:perf:prebuilt
675+
```
676+
677+
Unlike the accessibility audits, performance audits do not run in separate light/dark modes.
656678

657679
### End to end tests
658680

@@ -817,8 +839,10 @@ Format: `type(scope): description`
817839
- `fix(i18n): update French translations`
818840
- `chore(deps): update vite to v6`
819841

842+
Where front end changes are made, please include before and after screenshots in your pull request description.
843+
820844
> [!NOTE]
821-
> The subject must start with a lowercase letter. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
845+
> Use lowercase letters in your pull request title. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
822846
823847
### PR descriptions
824848

app/components/BuildEnvironment.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const { footer = false, buildInfo: buildInfoProp } = defineProps<{
66
buildInfo?: BuildInfo
77
}>()
88
9-
const { locale } = useI18n()
109
const appConfig = useAppConfig()
1110
const buildInfo = computed(() => buildInfoProp || appConfig.buildInfo)
11+
const buildTime = computed(() => new Date(buildInfo.value.time))
1212
</script>
1313

1414
<template>
@@ -18,7 +18,7 @@ const buildInfo = computed(() => buildInfoProp || appConfig.buildInfo)
1818
style="animation-delay: 0.05s"
1919
>
2020
<i18n-t keypath="built_at" scope="global">
21-
<NuxtTime :datetime="buildInfo.time" :locale="locale" relative />
21+
<DateTime :datetime="buildTime" year="numeric" month="short" day="numeric" />
2222
</i18n-t>
2323
<span>&middot;</span>
2424
<LinkBase

app/components/Code/Viewer.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,31 @@ watch(
5757
},
5858
{ immediate: true },
5959
)
60+
61+
// Use Nuxt's `navigateTo` for the rendered import links
62+
function handleImportLinkNavigate() {
63+
if (!codeRef.value) return
64+
65+
const anchors = codeRef.value.querySelectorAll('a.import-link')
66+
anchors.forEach(anchor => {
67+
// NOTE: We do not need to remove previous listeners because we re-create the entire HTML content on each html update
68+
anchor.addEventListener('click', event => {
69+
const href = anchor.getAttribute('href')
70+
if (href) {
71+
event.preventDefault()
72+
navigateTo(href)
73+
}
74+
})
75+
})
76+
}
77+
78+
watch(
79+
() => props.html,
80+
() => {
81+
nextTick(handleImportLinkNavigate)
82+
},
83+
{ immediate: true },
84+
)
6085
</script>
6186

6287
<template>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import DownloadAnalytics from '../Package/DownloadAnalytics.vue'
2+
import TrendsChart from '../Package/TrendsChart.vue'
33
44
const { packages } = defineProps<{
55
packages: string[]
@@ -8,6 +8,6 @@ const { packages } = defineProps<{
88

99
<template>
1010
<div class="font-mono">
11-
<DownloadAnalytics :package-names="packages" :in-modal="false" />
11+
<TrendsChart :package-names="packages" :in-modal="false" show-facet-selector />
1212
</div>
1313
</template>

app/components/Compare/PackageSelector.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ function handleKeydown(e: KeyboardEvent) {
8989
} else if (hasMatchInPackages) {
9090
addPackage(inputValueTrim)
9191
}
92+
} else if (e.key === 'Escape') {
93+
inputValue.value = ''
9294
}
9395
}
9496
@@ -185,7 +187,7 @@ function handleFocus() {
185187
:aria-label="$t('compare.no_dependency.add_column')"
186188
@click="addPackage(NO_DEPENDENCY_ID)"
187189
>
188-
<span class="text-sm text-accent italic flex items-center gap-2 block">
190+
<span class="text-sm text-accent italic flex items-center gap-2">
189191
<span class="i-carbon:clean w-4 h-4" aria-hidden="true" />
190192
{{ $t('compare.no_dependency.typeahead_title') }}
191193
</span>
@@ -204,7 +206,10 @@ function handleFocus() {
204206
@click="addPackage(result.name)"
205207
>
206208
<span class="font-mono text-sm text-fg block">{{ result.name }}</span>
207-
<span v-if="result.description" class="text-xs text-fg-muted truncate mt-0.5">
209+
<span
210+
v-if="result.description"
211+
class="text-xs text-fg-muted truncate mt-0.5 w-full block"
212+
>
208213
{{ result.description }}
209214
</span>
210215
</ButtonBase>

app/components/Header/AccountMenu.client.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function openAuthModal() {
5656
</script>
5757

5858
<template>
59-
<div ref="accountMenuRef" class="relative flex min-w-24 justify-end">
59+
<div ref="accountMenuRef" class="relative flex min-w-28 justify-end">
6060
<ButtonBase
6161
type="button"
6262
:aria-expanded="isOpen"

app/components/Header/AccountMenu.server.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="relative flex min-w-24 justify-end">
2+
<div class="relative flex min-w-28 justify-end">
33
<div
44
class="inline-flex gap-x-1 items-center justify-center font-mono border border-border rounded-md text-sm px-4 py-2 bg-transparent text-fg border-none"
55
>

app/components/Header/AuthModal.client.vue

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { useAtproto } from '~/composables/atproto/useAtproto'
33
import { authRedirect } from '~/utils/atproto/helpers'
4-
import { ensureValidAtIdentifier } from '@atproto/syntax'
4+
import { isAtIdentifierString } from '@atproto/lex'
55
66
const handleInput = shallowRef('')
77
const errorMessage = shallowRef('')
@@ -28,20 +28,15 @@ async function handleCreateAccount() {
2828
2929
async function handleLogin() {
3030
if (handleInput.value) {
31-
// URLS to PDSs are valid for oauth redirects
32-
if (!handleInput.value.startsWith('https://')) {
33-
try {
34-
ensureValidAtIdentifier(handleInput.value)
35-
} catch (error) {
36-
errorMessage.value =
37-
error instanceof Error ? error.message : $t('auth.modal.default_input_error')
38-
return
39-
}
31+
// URLS to PDSs are valid for initiating oauth flows
32+
if (handleInput.value.startsWith('https://') || isAtIdentifierString(handleInput.value)) {
33+
await authRedirect(handleInput.value, {
34+
redirectTo: route.fullPath,
35+
locale: locale.value,
36+
})
37+
} else {
38+
errorMessage.value = $t('auth.modal.default_input_error')
4039
}
41-
await authRedirect(handleInput.value, {
42-
redirectTo: route.fullPath,
43-
locale: locale.value,
44-
})
4540
}
4641
}
4742

app/components/Input/Base.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ defineExpose({
3535
v-bind="props.noCorrect ? noCorrect : undefined"
3636
@focus="emit('focus', $event)"
3737
@blur="emit('blur', $event)"
38-
class="bg-bg-subtle border border-border font-mono text-fg placeholder:text-fg-subtle transition-[border-color,outline-color] duration-300 hover:border-fg-subtle outline-2 outline-transparent outline-offset-2 focus:border-accent focus-visible:outline-accent/70 disabled:(opacity-50 cursor-not-allowed)"
38+
class="appearance-none bg-bg-subtle border border-border font-mono text-fg placeholder:text-fg-subtle transition-[border-color,outline-color] duration-300 hover:border-fg-subtle outline-2 outline-transparent outline-offset-2 focus:border-accent focus-visible:outline-accent/70 disabled:(opacity-50 cursor-not-allowed)"
3939
:class="{
4040
'text-xs leading-[1.2] px-2 py-2 rounded-md': size === 'small',
4141
'text-sm leading-none px-3 py-2.5 rounded-lg': size === 'medium',
42-
'text-base leading-none px-6 py-3.5 h-14 rounded-xl': size === 'large',
42+
'text-base leading-[1.4] px-6 py-4 rounded-xl': size === 'large',
4343
}"
4444
:disabled="
4545
/** Catching Vue render-bug of invalid `disabled=false` attribute in the final HTML */

0 commit comments

Comments
 (0)