Skip to content

Commit 8e5c66b

Browse files
Merge branch 'main' into main
2 parents 6def648 + bf4b537 commit 8e5c66b

Some content is hidden

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

46 files changed

+2778
-1205
lines changed

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#secure password, can use openssl rand -hex 32
2-
NUXT_SESSION_PASSWORD=""
2+
NUXT_SESSION_PASSWORD=""
3+
4+
#HMAC secret for image proxy URL signing, can use openssl rand -hex 32
5+
NUXT_IMAGE_PROXY_SECRET=""

app/components/Filter/Panel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,19 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
217217
</label>
218218
<!-- Search scope toggle -->
219219
<div
220-
class="inline-flex rounded-md border border-border p-0.5 bg-bg"
220+
class="inline-flex rounded-md border border-border p-0.5 bg-bg-muted"
221221
role="group"
222222
:aria-label="$t('filters.search_scope')"
223223
>
224224
<button
225225
v-for="scope in SEARCH_SCOPE_VALUES"
226226
:key="scope"
227227
type="button"
228-
class="px-2 py-0.5 text-xs font-mono rounded-sm transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
228+
class="px-2 py-0.5 text-xs font-mono rounded-sm border transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
229229
:class="
230230
filters.searchScope === scope
231-
? 'bg-bg-muted text-fg'
232-
: 'text-fg-muted hover:text-fg'
231+
? 'bg-bg-subtle text-fg border-fg-subtle'
232+
: 'text-fg-muted hover:text-fg border-transparent'
233233
"
234234
:aria-pressed="filters.searchScope === scope"
235235
:title="getScopeDescriptionKey(scope)"

app/components/Package/Playgrounds.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ function focusMenuItem(index: number) {
119119

120120
<template>
121121
<section v-if="links.length > 0" class="px-1">
122-
<h2
123-
id="playgrounds-heading"
124-
class="text-xs font-mono text-fg-subtle uppercase tracking-wider text-white mb-3"
125-
>
122+
<h2 id="playgrounds-heading" class="text-xs font-mono text-fg uppercase tracking-wider mb-3">
126123
{{ $t('package.playgrounds.title') }}
127124
</h2>
128125

app/components/Package/VersionDistribution.vue

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ import {
99
drawNpmxLogoAndTaglineWatermark,
1010
} from '~/composables/useChartWatermark'
1111
import TooltipApp from '~/components/Tooltip/App.vue'
12+
import { copyAltTextForVersionsBarChart } from '~/utils/charts'
1213
1314
const props = defineProps<{
1415
packageName: string
1516
inModal?: boolean
1617
}>()
1718
1819
const { accentColors, selectedAccentColor } = useAccentColor()
20+
const { copy, copied } = useClipboard()
21+
1922
const colorMode = useColorMode()
2023
const resolvedMode = shallowRef<'light' | 'dark'>('light')
2124
const rootEl = shallowRef<HTMLElement | null>(null)
@@ -190,14 +193,14 @@ const chartConfig = computed<VueUiXyConfig>(() => {
190193
fullscreen: false,
191194
table: false,
192195
tooltip: false,
193-
altCopy: false, // TODO: set to true to enable the alt copy feature
196+
altCopy: true,
194197
},
195198
buttonTitles: {
196199
csv: $t('package.trends.download_file', { fileType: 'CSV' }),
197200
img: $t('package.trends.download_file', { fileType: 'PNG' }),
198201
svg: $t('package.trends.download_file', { fileType: 'SVG' }),
199202
annotator: $t('package.trends.toggle_annotator'),
200-
altCopy: undefined, // TODO: set to proper translation key
203+
altCopy: $t('package.trends.copy_alt.button_label'), // Do not make this text dependant on the `copied` variable, since this would re-render the component, which is undesirable if the minimap was used to select a time frame.
201204
},
202205
callbacks: {
203206
img: args => {
@@ -230,10 +233,19 @@ const chartConfig = computed<VueUiXyConfig>(() => {
230233
loadFile(url, buildExportFilename('svg'))
231234
URL.revokeObjectURL(url)
232235
},
233-
// altCopy: ({ dataset: dst, config: cfg }: { dataset: Array<VueUiXyDatasetItem>; config: VueUiXyConfig}) => {
234-
// // TODO: implement a reusable copy-alt-text-to-clipboard feature based on the dataset & configuration
235-
// console.log({ dst, cfg})
236-
// }
236+
altCopy: ({ dataset: dst, config: cfg }) =>
237+
copyAltTextForVersionsBarChart({
238+
dataset: dst,
239+
config: {
240+
...cfg,
241+
datapointLabels: xAxisLabels.value,
242+
dateRangeLabel: dateRangeLabel.value,
243+
semverGroupingMode: groupingMode.value,
244+
copy,
245+
$t,
246+
numberFormatter: compactNumberFormatter.value.format,
247+
},
248+
}),
237249
},
238250
},
239251
grid: {
@@ -575,6 +587,16 @@ const chartConfig = computed<VueUiXyConfig>(() => {
575587
aria-hidden="true"
576588
/>
577589
</template>
590+
<template #optionAltCopy>
591+
<span
592+
class="w-6 h-6"
593+
:class="
594+
copied ? 'i-lucide:check text-accent' : 'i-lucide:person-standing text-fg-subtle'
595+
"
596+
style="pointer-events: none"
597+
aria-hidden="true"
598+
/>
599+
</template>
578600
</VueUiXy>
579601
</div>
580602

0 commit comments

Comments
 (0)