Skip to content

Commit 8300f89

Browse files
committed
Merge branch 'main' into jg/lazy-docs
2 parents 8afc853 + ba87a55 commit 8300f89

File tree

27 files changed

+509
-163
lines changed

27 files changed

+509
-163
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "\U0001F41E Bug report"
2+
description: Create a report to help us improve npmx
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Please carefully read the contribution docs before creating a bug report
8+
👉 https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md
9+
- type: textarea
10+
id: bug-description
11+
attributes:
12+
label: Describe the bug
13+
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
14+
placeholder: Bug description
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: additional
19+
attributes:
20+
label: Additional context
21+
description: If applicable, add any other context about the problem here
22+
- type: textarea
23+
id: logs
24+
attributes:
25+
label: Logs
26+
description: |
27+
Optional if you have reproduction steps. Please try not to insert an image but copy paste the log text.
28+
render: shell-script

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: 📚 npmx documentation
4+
url: https://docs.npmx.dev/
5+
about: Check the documentation for usage of npmx
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: '🚀 Feature request'
2+
description: Suggest a feature that will improve npmx
3+
labels: ['pending triage']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for taking the time to fill out this feature request!
9+
10+
Please carefully read the contribution docs before suggesting a new feature
11+
👉 https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md
12+
- type: textarea
13+
id: feature-description
14+
attributes:
15+
label: Describe the feature
16+
description: A clear and concise description of what you think would be a helpful addition to npmx, including the possible use cases and alternatives you have considered. If you have a working prototype or module that implements it, please include a link.
17+
placeholder: Feature description
18+
validations:
19+
required: true
20+
- type: checkboxes
21+
id: additional-info
22+
attributes:
23+
label: Additional information
24+
description: Additional information that helps us decide how to proceed.
25+
options:
26+
- label: Would you be willing to help implement this feature?
27+
- type: checkboxes
28+
id: required-info
29+
attributes:
30+
label: Final checks
31+
description: Before submitting, please make sure you do the following
32+
options:
33+
- label: Read the [contribution guide](https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md).
34+
required: true
35+
- label: Check existing [issues](https://github.com/npmx-dev/npmx.dev/issues).
36+
required: true

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### 🔗 Linked issue
2+
3+
<!-- Please ensure there is an open issue and mention its number. For example, "resolves #123" -->
4+
5+
### 🧭 Context
6+
7+
<!-- Brief background and why this change is needed -->
8+
9+
<!-- High-level summary of what changed -->
10+
11+
### 📚 Description
12+
13+
<!-- Describe your changes in detail. Why is this change required? What problem does it solve? -->
14+
15+
<!-- If you used AI tools to help with this contribution, please ensure the PR description and code reflect your own understanding.
16+
Write in your own voice rather than copying AI-generated text. -->
17+
18+
<!----------------------------------------------------------------------
19+
Before creating the pull request, please make sure you do the following:
20+
21+
- Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us reviewing it.
22+
- Ensure that PR title follows conventional commits (https://www.conventionalcommits.org)
23+
- Update the corresponding documentation if needed.
24+
- Include relevant tests that fail without this PR but pass with it.
25+
- Add any additional context, tradeoffs, follow-ups, or things reviewers should be aware of.
26+
27+
Thank you for contributing to npmx!
28+
----------------------------------------------------------------------->

app/components/Button/Base.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts">
2+
import type { IconClass } from '~/types'
3+
24
const props = withDefaults(
35
defineProps<{
46
disabled?: boolean
@@ -8,7 +10,7 @@ const props = withDefaults(
810
ariaKeyshortcuts?: string
911
block?: boolean
1012
11-
classicon?: string
13+
classicon?: IconClass
1214
}>(),
1315
{
1416
type: 'button',

app/components/Link/Base.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
import type { NuxtLinkProps } from '#app'
3+
import type { IconClass } from '~/types'
34
45
const props = withDefaults(
56
defineProps<
@@ -26,7 +27,7 @@ const props = withDefaults(
2627
*/
2728
rel?: never
2829
29-
classicon?: string
30+
classicon?: IconClass
3031
3132
to?: NuxtLinkProps['to']
3233

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: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const props = defineProps<{
1313
1414
const router = useRouter()
1515
const route = useRoute()
16+
const { settings } = useSettings()
1617
1718
const chartModal = useModal('chart-modal')
1819
const hasChartModalTransitioned = shallowRef(false)
@@ -87,6 +88,12 @@ const { colors } = useCssVariables(
8788
},
8889
)
8990
91+
function toggleSparklineAnimation() {
92+
settings.value.sidebar.animateSparkline = !settings.value.sidebar.animateSparkline
93+
}
94+
95+
const hasSparklineAnimation = computed(() => settings.value.sidebar.animateSparkline)
96+
9097
const isDarkMode = computed(() => resolvedMode.value === 'dark')
9198
9299
const accentColorValueById = computed<Record<string, string>>(() => {
@@ -224,14 +231,14 @@ const config = computed(() => {
224231
line: {
225232
color: colors.value.borderHover,
226233
pulse: {
227-
show: true, // the pulse will not show if prefers-reduced-motion (enforced by vue-data-ui)
234+
show: hasSparklineAnimation.value, // the pulse will not show if prefers-reduced-motion (enforced by vue-data-ui)
228235
loop: true, // runs only once if false
229236
radius: 1.5,
230237
color: pulseColor.value,
231238
easing: 'ease-in-out',
232239
trail: {
233240
show: true,
234-
length: 20,
241+
length: 30,
235242
opacity: 0.75,
236243
},
237244
},
@@ -302,6 +309,16 @@ const config = computed(() => {
302309
</div>
303310
</template>
304311
</ClientOnly>
312+
313+
<div v-if="hasWeeklyDownloads" class="hidden motion-safe:flex justify-end">
314+
<ButtonBase size="small" @click="toggleSparklineAnimation">
315+
{{
316+
hasSparklineAnimation
317+
? $t('package.trends.pause_animation')
318+
: $t('package.trends.play_animation')
319+
}}
320+
</ButtonBase>
321+
</div>
305322
</template>
306323
<p v-else class="py-2 text-sm font-mono text-fg-subtle">
307324
{{ $t('package.trends.no_data') }}

app/components/Readme.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ function handleClick(event: MouseEvent) {
154154
/* I don't know what kind of sorcery this is, but it ensures this icon can't wrap to a new line on its own. */
155155
content: '__';
156156
@apply inline i-lucide:link rtl-flip ms-1 opacity-0;
157+
font-size: 0.75em;
157158
}
158159
159160
.readme :deep(a[href^='#']:hover::after) {

0 commit comments

Comments
 (0)