Skip to content

Commit 782f642

Browse files
authored
Merge branch 'main' into fix-search
2 parents e4ae47e + b73edaf commit 782f642

123 files changed

Lines changed: 6840 additions & 1355 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.

.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: 28 additions & 6 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

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>

app/components/Compare/PackageSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function handleFocus() {
185185
:aria-label="$t('compare.no_dependency.add_column')"
186186
@click="addPackage(NO_DEPENDENCY_ID)"
187187
>
188-
<span class="text-sm text-accent italic flex items-center gap-2 block">
188+
<span class="text-sm text-accent italic flex items-center gap-2">
189189
<span class="i-carbon:clean w-4 h-4" aria-hidden="true" />
190190
{{ $t('compare.no_dependency.typeahead_title') }}
191191
</span>

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 */

app/components/Org/MembersPanel.vue

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const isLoadingTeams = shallowRef(false)
3535
// Search/filter
3636
const searchQuery = shallowRef('')
3737
const filterRole = shallowRef<MemberRoleFilter>('all')
38-
const filterTeam = shallowRef<string | null>(null)
38+
const filterTeam = shallowRef<string>('')
3939
const sortBy = shallowRef<'name' | 'role'>('name')
4040
const sortOrder = shallowRef<'asc' | 'desc'>('asc')
4141
@@ -362,18 +362,19 @@ watch(lastExecutionTime, () => {
362362
</div>
363363
<!-- Team filter -->
364364
<div v-if="teamNames.length > 0">
365-
<label for="team-filter" class="sr-only">{{ $t('org.members.filter_by_team') }}</label>
366-
<select
365+
<SelectField
366+
:label="$t('org.members.filter_by_team')"
367+
hidden-label
367368
id="team-filter"
368369
v-model="filterTeam"
369370
name="team-filter"
370-
class="px-2 py-1 font-mono text-xs bg-bg-subtle border border-border rounded text-fg transition-colors duration-200 focus:border-border-hover"
371-
>
372-
<option :value="null">{{ $t('org.members.all_teams') }}</option>
373-
<option v-for="team in teamNames" :key="team" :value="team">
374-
{{ team }}
375-
</option>
376-
</select>
371+
block
372+
size="sm"
373+
:items="[
374+
{ label: $t('org.members.all_teams'), value: '' },
375+
...teamNames.map(team => ({ label: team, value: team })),
376+
]"
377+
/>
377378
</div>
378379
<div
379380
class="flex items-center gap-1 text-xs"
@@ -462,22 +463,22 @@ watch(lastExecutionTime, () => {
462463
<label :for="`role-${member.name}`" class="sr-only">{{
463464
$t('org.members.change_role_for', { name: member.name })
464465
}}</label>
465-
<select
466+
<SelectField
467+
:label="$t('org.members.change_role_for', { name: member.name })"
468+
hidden-label
466469
:id="`role-${member.name}`"
467-
:value="member.role"
470+
:model-value="member.role"
468471
:name="`role-${member.name}`"
469-
class="px-1.5 py-0.5 font-mono text-xs bg-bg-subtle border border-border rounded text-fg transition-colors duration-200 focus:border-border-hover"
470-
@change="
471-
handleChangeRole(
472-
member.name,
473-
($event.target as HTMLSelectElement).value as 'developer' | 'admin' | 'owner',
474-
)
475-
"
476-
>
477-
<option value="developer">{{ getRoleLabel('developer') }}</option>
478-
<option value="admin">{{ getRoleLabel('admin') }}</option>
479-
<option value="owner">{{ getRoleLabel('owner') }}</option>
480-
</select>
472+
block
473+
size="sm"
474+
:items="[
475+
{ label: getRoleLabel('developer'), value: 'developer' },
476+
{ label: getRoleLabel('admin'), value: 'admin' },
477+
{ label: getRoleLabel('owner'), value: 'owner' },
478+
]"
479+
:value="member.role"
480+
@update:modelValue="value => handleChangeRole(member.name, value as MemberRole)"
481+
/>
481482
<!-- Remove button -->
482483
<button
483484
type="button"
@@ -528,30 +529,36 @@ watch(lastExecutionTime, () => {
528529
size="small"
529530
/>
530531
<div class="flex items-center gap-2">
531-
<label for="new-member-role" class="sr-only">{{ $t('org.members.role_label') }}</label>
532-
<select
532+
<SelectField
533+
:label="$t('org.members.role_label')"
534+
hidden-label
533535
id="new-member-role"
534536
v-model="newRole"
535537
name="new-member-role"
536-
class="flex-1 px-2 py-1.5 font-mono text-sm bg-bg border border-border rounded text-fg transition-colors duration-200 focus:border-border-hover"
537-
>
538-
<option value="developer">{{ $t('org.members.role.developer') }}</option>
539-
<option value="admin">{{ $t('org.members.role.admin') }}</option>
540-
<option value="owner">{{ $t('org.members.role.owner') }}</option>
541-
</select>
538+
block
539+
class="flex-1"
540+
size="sm"
541+
:items="[
542+
{ label: $t('org.members.role.developer'), value: 'developer' },
543+
{ label: $t('org.members.role.admin'), value: 'admin' },
544+
{ label: $t('org.members.role.owner'), value: 'owner' },
545+
]"
546+
/>
542547
<!-- Team selection -->
543-
<label for="new-member-team" class="sr-only">{{ $t('org.members.team_label') }}</label>
544-
<select
548+
<SelectField
549+
:label="$t('org.members.team_label')"
550+
hidden-label
545551
id="new-member-team"
546552
v-model="newTeam"
547553
name="new-member-team"
548-
class="flex-1 px-2 py-1.5 font-mono text-sm bg-bg border border-border rounded text-fg transition-colors duration-200 focus:border-border-hover"
549-
>
550-
<option value="">{{ $t('org.members.no_team') }}</option>
551-
<option v-for="team in teamNames" :key="team" :value="team">
552-
{{ team }}
553-
</option>
554-
</select>
554+
block
555+
class="flex-1"
556+
size="sm"
557+
:items="[
558+
{ label: $t('org.members.no_team'), value: '' },
559+
...teamNames.map(team => ({ label: team, value: team })),
560+
]"
561+
/>
555562
<button
556563
type="submit"
557564
:disabled="!newUsername.trim() || isAddingMember"

0 commit comments

Comments
 (0)