Skip to content

Commit 4729a53

Browse files
Merge branch 'main' into fix/hydration
2 parents 885aec6 + d3cfce5 commit 4729a53

55 files changed

Lines changed: 1929 additions & 1017 deletions

Some content is hidden

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

app/assets/main.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,16 @@ dd {
275275
}
276276

277277
/* Shiki theme colors */
278-
html.light .shiki,
279-
html.light .shiki span {
278+
html.light .shiki {
280279
color: var(--shiki-light) !important;
281280
background-color: var(--shiki-light-bg) !important;
282-
font-style: var(--shiki-light-font-style) !important;
283-
font-weight: var(--shiki-light-font-weight) !important;
284-
text-decoration: var(--shiki-light-text-decoration) !important;
281+
282+
& span {
283+
color: var(--shiki-light) !important;
284+
font-style: var(--shiki-light-font-style) !important;
285+
font-weight: var(--shiki-light-font-weight) !important;
286+
text-decoration: var(--shiki-light-text-decoration) !important;
287+
}
285288
}
286289

287290
/* Inline code in package descriptions */

app/components/Alert.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script setup lang="ts">
2+
interface Props {
3+
variant: 'warning' | 'error'
4+
title?: string
5+
}
6+
7+
defineProps<Props>()
8+
9+
const WRAPPER_CLASSES: Record<Props['variant'], string> = {
10+
warning: 'border-amber-400/20 bg-amber-500/8',
11+
error: 'border-red-400/20 bg-red-500/8',
12+
}
13+
14+
const TITLE_CLASSES: Record<Props['variant'], string> = {
15+
warning: 'text-amber-800 dark:text-amber-300',
16+
error: 'text-red-800 dark:text-red-300',
17+
}
18+
19+
const BODY_CLASSES: Record<Props['variant'], string> = {
20+
warning: 'text-amber-700 dark:text-amber-400',
21+
error: 'text-red-700 dark:text-red-400',
22+
}
23+
24+
const ROLES: Record<Props['variant'], 'status' | 'alert'> = {
25+
warning: 'status',
26+
error: 'alert',
27+
}
28+
</script>
29+
30+
<template>
31+
<div
32+
:role="ROLES[variant]"
33+
class="border rounded-md px-3 py-2.5"
34+
:class="WRAPPER_CLASSES[variant]"
35+
>
36+
<p v-if="title" class="font-semibold mb-1" :class="TITLE_CLASSES[variant]">{{ title }}</p>
37+
<div class="text-xs" :class="BODY_CLASSES[variant]">
38+
<slot />
39+
</div>
40+
</div>
41+
</template>

app/components/Compare/FacetBarChart.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,18 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
220220
const name = datapoint?.name?.replace(/\n/g, '<br>')
221221
return `
222222
<div class="font-mono p-3 border border-border rounded-md bg-[var(--bg)]/10 backdrop-blur-md">
223-
<div class="flex items-center gap-2">
223+
<div class="grid grid-cols-[12px_minmax(0,1fr)_max-content] items-center gap-x-3">
224224
<div class="w-3 h-3">
225225
<svg viewBox="0 0 2 2" class="w-full h-full">
226226
<rect x="0" y="0" width="2" height="2" rx="0.3" fill="${datapoint?.color}" />
227227
</svg>
228228
</div>
229-
<span>${name}: ${(datapoint as VueUiHorizontalBarDatapoint).formattedValue ?? 0}</span>
229+
<span class="text-3xs uppercase tracking-wide text-[var(--fg)]/70 truncate">
230+
${name}
231+
</span>
232+
<span class="text-base text-[var(--fg)] font-mono tabular-nums text-end">
233+
${(datapoint as VueUiHorizontalBarDatapoint).formattedValue ?? 0}
234+
</span>
230235
</div>
231236
</div>
232237
`

app/components/Header/SearchBox.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ defineExpose({ focus })
4444

4545
<div class="relative group" :class="{ 'is-focused': isSearchFocused }">
4646
<div class="search-box relative flex items-center">
47-
<span
48-
class="absolute inset-is-3 text-fg-subtle font-mono text-sm pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1"
47+
<kbd
48+
class="absolute inset-is-3 text-fg-subtle font-mono text-sm pointer-events-none transition-colors duration-200 motion-reduce:transition-none [.group:hover:not(:focus-within)_&]:text-fg/80 group-focus-within:text-accent z-1 rounded"
49+
aria-hidden="true"
4950
>
5051
/
51-
</span>
52+
</kbd>
5253

5354
<InputBase
5455
id="header-search"
@@ -62,6 +63,7 @@ defineExpose({ focus })
6263
@focus="isSearchFocused = true"
6364
@blur="isSearchFocused = false"
6465
size="small"
66+
ariaKeyshortcuts="/"
6567
/>
6668
<button
6769
v-if="hasSearchQuery"

app/components/Input/Base.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const props = withDefaults(
1414
* @default true
1515
*/
1616
noCorrect?: boolean
17+
/** Keyboard shortcut hint */
18+
ariaKeyshortcuts?: string
1719
}>(),
1820
{
1921
size: 'medium',
@@ -28,6 +30,8 @@ const emit = defineEmits<{
2830
2931
const el = useTemplateRef('el')
3032
33+
const keyboardShortcutsEnabled = useKeyboardShortcuts()
34+
3135
defineExpose({
3236
focus: () => el.value?.focus(),
3337
blur: () => el.value?.blur(),
@@ -51,5 +55,6 @@ defineExpose({
5155
/** Catching Vue render-bug of invalid `disabled=false` attribute in the final HTML */
5256
disabled ? true : undefined
5357
"
58+
:aria-keyshortcuts="keyboardShortcutsEnabled ? ariaKeyshortcuts : undefined"
5459
/>
5560
</template>

app/components/Package/ClaimPackageModal.vue

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -199,28 +199,26 @@ const previewPackageJson = computed(() => {
199199
</div>
200200

201201
<!-- Validation errors -->
202-
<div
202+
<Alert
203203
v-if="checkResult.validationErrors?.length"
204-
class="p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
205-
role="alert"
204+
variant="error"
205+
:title="$t('claim.modal.invalid_name')"
206206
>
207-
<p class="font-medium mb-1">{{ $t('claim.modal.invalid_name') }}</p>
208207
<ul class="list-disc list-inside space-y-1">
209208
<li v-for="err in checkResult.validationErrors" :key="err">{{ err }}</li>
210209
</ul>
211-
</div>
210+
</Alert>
212211

213212
<!-- Validation warnings -->
214-
<div
213+
<Alert
215214
v-if="checkResult.validationWarnings?.length"
216-
class="p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
217-
role="alert"
215+
variant="warning"
216+
:title="$t('common.warnings')"
218217
>
219-
<p class="font-medium mb-1">{{ $t('common.warnings') }}</p>
220218
<ul class="list-disc list-inside space-y-1">
221219
<li v-for="warn in checkResult.validationWarnings" :key="warn">{{ warn }}</li>
222220
</ul>
223-
</div>
221+
</Alert>
224222

225223
<!-- Availability status -->
226224
<template v-if="checkResult.valid">
@@ -305,39 +303,23 @@ const previewPackageJson = computed(() => {
305303
</template>
306304

307305
<!-- Error message -->
308-
<div
309-
v-if="mergedError"
310-
role="alert"
311-
class="p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
312-
>
313-
{{ mergedError }}
314-
</div>
306+
<Alert v-if="mergedError" variant="error">{{ mergedError }}</Alert>
315307

316308
<!-- Actions -->
317309
<div v-if="checkResult.available && checkResult.valid" class="space-y-3">
318310
<!-- Warning for unscoped packages -->
319-
<div
320-
v-if="!isScoped"
321-
class="p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
322-
>
323-
<p class="font-medium mb-1">{{ $t('claim.modal.scope_warning_title') }}</p>
324-
<p class="text-xs text-yellow-400/80">
325-
{{
326-
$t('claim.modal.scope_warning_text', {
327-
username: npmUser || 'username',
328-
name: packageName,
329-
})
330-
}}
331-
</p>
332-
</div>
311+
<Alert v-if="!isScoped" variant="warning" :title="$t('claim.modal.scope_warning_title')">
312+
{{
313+
$t('claim.modal.scope_warning_text', {
314+
username: npmUser || 'username',
315+
name: packageName,
316+
})
317+
}}
318+
</Alert>
333319

334320
<!-- Not connected warning -->
335321
<div v-if="!isConnected" class="space-y-3">
336-
<div
337-
class="p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
338-
>
339-
<p>{{ $t('claim.modal.connect_required') }}</p>
340-
</div>
322+
<Alert variant="warning">{{ $t('claim.modal.connect_required') }}</Alert>
341323
<button
342324
type="button"
343325
class="w-full px-4 py-2 font-mono text-sm text-bg bg-fg rounded-md transition-colors duration-200 hover:bg-fg/90 focus-visible:outline-accent/70"
@@ -389,12 +371,7 @@ const previewPackageJson = computed(() => {
389371

390372
<!-- Error state -->
391373
<div v-else-if="mergedError" class="space-y-4">
392-
<div
393-
role="alert"
394-
class="p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
395-
>
396-
{{ mergedError }}
397-
</div>
374+
<Alert variant="error">{{ mergedError }}</Alert>
398375
<button
399376
type="button"
400377
class="w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-accent/70"

0 commit comments

Comments
 (0)