Skip to content

Commit bf2b20b

Browse files
authored
fix: bump vue-data-ui and impacts (#1568)
1 parent d0d819d commit bf2b20b

File tree

5 files changed

+35
-52
lines changed

5 files changed

+35
-52
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { VueUiXyDatasetItem } from 'vue-data-ui'
33
import { VueUiXy } from 'vue-data-ui/vue-ui-xy'
44
import { useDebounceFn, useElementSize } from '@vueuse/core'
55
import { useCssVariables } from '~/composables/useColors'
6-
import { OKLCH_NEUTRAL_FALLBACK, transparentizeOklch } from '~/utils/colors'
6+
import { OKLCH_NEUTRAL_FALLBACK, transparentizeOklch, lightenOklch } from '~/utils/colors'
77
import { getFrameworkColor, isListedFramework } from '~/utils/frameworks'
88
import { drawNpmxLogoAndTaglineWatermark } from '~/composables/useChartWatermark'
99
import type { RepoRef } from '#shared/utils/git-providers'
@@ -201,59 +201,41 @@ function formatXyDataset(
201201
dataset: EvolutionData,
202202
seriesName: string,
203203
): { dataset: VueUiXyDatasetItem[] | null; dates: number[] } {
204+
const lightColor = isDarkMode.value ? lightenOklch(accent.value, 0.618) : undefined
205+
206+
// Subtle path gradient applied in dark mode only
207+
const temperatureColors = lightColor ? [lightColor, accent.value] : undefined
208+
209+
const datasetItem: VueUiXyDatasetItem = {
210+
name: seriesName,
211+
type: 'line',
212+
series: dataset.map(d => d.value),
213+
color: accent.value,
214+
temperatureColors,
215+
useArea: true,
216+
}
217+
204218
if (selectedGranularity === 'weekly' && isWeeklyDataset(dataset)) {
205219
return {
206-
dataset: [
207-
{
208-
name: seriesName,
209-
type: 'line',
210-
series: dataset.map(d => d.value),
211-
color: accent.value,
212-
useArea: true,
213-
},
214-
],
220+
dataset: [datasetItem],
215221
dates: dataset.map(d => d.timestampEnd),
216222
}
217223
}
218224
if (selectedGranularity === 'daily' && isDailyDataset(dataset)) {
219225
return {
220-
dataset: [
221-
{
222-
name: seriesName,
223-
type: 'line',
224-
series: dataset.map(d => d.value),
225-
color: accent.value,
226-
useArea: true,
227-
},
228-
],
226+
dataset: [datasetItem],
229227
dates: dataset.map(d => d.timestamp),
230228
}
231229
}
232230
if (selectedGranularity === 'monthly' && isMonthlyDataset(dataset)) {
233231
return {
234-
dataset: [
235-
{
236-
name: seriesName,
237-
type: 'line',
238-
series: dataset.map(d => d.value),
239-
color: accent.value,
240-
useArea: true,
241-
},
242-
],
232+
dataset: [datasetItem],
243233
dates: dataset.map(d => d.timestamp),
244234
}
245235
}
246236
if (selectedGranularity === 'yearly' && isYearlyDataset(dataset)) {
247237
return {
248-
dataset: [
249-
{
250-
name: seriesName,
251-
type: 'line',
252-
series: dataset.map(d => d.value),
253-
color: accent.value,
254-
useArea: true,
255-
},
256-
],
238+
dataset: [datasetItem],
257239
dates: dataset.map(d => d.timestamp),
258240
}
259241
}
@@ -1529,7 +1511,7 @@ const chartConfig = computed(() => {
15291511
backdropFilter: false,
15301512
backgroundColor: 'transparent',
15311513
customFormat: ({ datapoint }: { datapoint: Record<string, any> | any[] }) => {
1532-
if (!datapoint) return ''
1514+
if (!datapoint || pending.value) return ''
15331515
15341516
const items = Array.isArray(datapoint) ? datapoint : [datapoint[0]]
15351517
const hasMultipleItems = items.length > 1

app/components/Package/VersionDistribution.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
} from 'vue-data-ui'
99
import { useElementSize } from '@vueuse/core'
1010
import { useCssVariables } from '~/composables/useColors'
11-
import { OKLCH_NEUTRAL_FALLBACK, transparentizeOklch } from '~/utils/colors'
11+
import { OKLCH_NEUTRAL_FALLBACK, transparentizeOklch, lightenHex } from '~/utils/colors'
1212
import {
1313
drawSvgPrintLegend,
1414
drawNpmxLogoAndTaglineWatermark,
@@ -212,7 +212,7 @@ const chartConfig = computed(() => {
212212
backgroundColor: 'transparent',
213213
customFormat: (params: TooltipParams) => {
214214
const { datapoint, absoluteIndex, bars } = params
215-
if (!datapoint) return ''
215+
if (!datapoint || pending.value) return ''
216216
217217
// Use absoluteIndex to get the correct version from chartDataset
218218
const index = Number(absoluteIndex)
@@ -496,11 +496,12 @@ const endDate = computed(() => {
496496
/>
497497
</template>
498498

499-
<!-- Subtle gradient applied for area charts -->
500-
<template #area-gradient="{ series: chartModalSeries, id: gradientId }">
501-
<linearGradient :id="gradientId" x1="0" x2="0" y1="0" y2="1">
502-
<stop offset="0%" :stop-color="chartModalSeries.color" stop-opacity="0.2" />
503-
<stop offset="100%" :stop-color="colors.bg" stop-opacity="0" />
499+
<!-- Custom bar gradient based on the series color -->
500+
<template #bar-gradient="{ series, positiveId }">
501+
<linearGradient :id="positiveId" x1="0" x2="0" y1="0" y2="1">
502+
<!-- vue-data-ui exposes hex-normalized colors -->
503+
<stop offset="0%" :stop-color="lightenHex(series.color, 0.618)" />
504+
<stop offset="100%" :stop-color="series.color" stop-opacity="0.618" />
504505
</linearGradient>
505506
</template>
506507

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const config = computed(() => {
231231
easing: 'ease-in-out',
232232
trail: {
233233
show: true,
234-
length: 20,
234+
length: 30,
235235
opacity: 0.75,
236236
},
237237
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"vite-plugin-pwa": "1.2.0",
110110
"vite-plus": "0.0.0-833c515fa25cef20905a7f9affb156dfa6f151ab",
111111
"vue": "3.5.28",
112-
"vue-data-ui": "3.15.0"
112+
"vue-data-ui": "3.15.5"
113113
},
114114
"devDependencies": {
115115
"@e18e/eslint-plugin": "0.1.4",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)