Skip to content

Commit 5c8e3a8

Browse files
committed
chore: update
1 parent 602ede8 commit 5c8e3a8

19 files changed

Lines changed: 1089 additions & 1008 deletions

File tree

packages/rolldown/src/app/components/compare/ChangeBadge.vue

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/rolldown/src/app/components/compare/DeltaBar.vue

Lines changed: 0 additions & 46 deletions
This file was deleted.

packages/rolldown/src/app/components/compare/SessionMeta.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface CompareSessionSummaryItem {
33
label: string
44
value: string
55
icon: string
6+
tone?: 'increase' | 'decrease'
67
}
78
89
defineProps<{
@@ -37,7 +38,10 @@ defineProps<{
3738
<div text-xs op50>
3839
{{ summary.label }}
3940
</div>
40-
<div font-mono font-600>
41+
<div
42+
font-mono font-600
43+
:class="summary.tone === 'increase' ? 'text-red-500' : summary.tone === 'decrease' ? 'text-green-500' : undefined"
44+
>
4145
{{ summary.value }}
4246
</div>
4347
</div>

packages/rolldown/src/app/components/compare/SingleSideRow.vue

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@ interface SingleSideDiffStat {
88
}
99
1010
withDefaults(defineProps<{
11-
status: 'added' | 'removed'
1211
sessionLabel: string
1312
title: string
1413
titleMeta?: string
15-
value: number
1614
delta: number
1715
format: 'bytes' | 'duration' | 'number'
1816
subtitle?: string
1917
badges?: string[]
2018
stats?: SingleSideDiffStat[]
21-
ratioText?: string
2219
}>(), {
2320
subtitle: '',
2421
titleMeta: '',
2522
badges: () => [],
2623
stats: () => [],
27-
ratioText: '',
2824
})
2925
</script>
3026

@@ -48,15 +44,7 @@ withDefaults(defineProps<{
4844

4945
<div v-if="badges.length || stats.length" flex="~ items-center gap-2 wrap" text-xs>
5046
<DisplayBadge v-for="badge of badges" :key="badge" :text="badge" />
51-
<span v-if="stats.length" flex="~ items-baseline gap-1" op55>
52-
<span>(</span>
53-
<template v-for="(stat, index) of stats" :key="stat.label">
54-
<span v-if="index" op70>|</span>
55-
<span font-mono font-600 :class="stat.tone === 'increase' ? 'text-green-500' : stat.tone === 'decrease' ? 'text-red-500' : 'op85'">{{ stat.value }}</span>
56-
<span>{{ stat.label }}</span>
57-
</template>
58-
<span>)</span>
59-
</span>
47+
<CompareStatsStrip :stats="stats" />
6048
</div>
6149
</div>
6250
</template>

packages/rolldown/src/app/components/compare/SplitRow.vue

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import type { SessionCompareChangeStatus } from '~~/shared/types'
32
import DisplayBadge from '@vitejs/devtools-ui/components/DisplayBadge.vue'
43
import { computed } from 'vue'
54
@@ -11,7 +10,6 @@ interface SplitDiffStat {
1110
}
1211
1312
const props = withDefaults(defineProps<{
14-
status: SessionCompareChangeStatus
1513
previousTitle?: string
1614
currentTitle?: string
1715
previousTitleMeta?: string
@@ -71,18 +69,11 @@ const ratioClass = computed(() => {
7169
{{ previousSubtitle }}
7270
</div>
7371
</div>
74-
<div flex="~ items-center gap-2 wrap">
75-
<DisplayBadge v-for="badge of previousBadges" :key="badge" :text="badge" />
76-
<span v-if="previousStats.length" flex="~ items-baseline gap-1" text-xs op55>
77-
<span>(</span>
78-
<template v-for="(stat, index) of previousStats" :key="stat.label">
79-
<span v-if="index" op70>|</span>
80-
<span font-mono font-600 :class="stat.tone === 'increase' ? 'text-green-500' : stat.tone === 'decrease' ? 'text-red-500' : 'op85'">{{ stat.value }}</span>
81-
<span>{{ stat.label }}</span>
82-
</template>
83-
<span>)</span>
84-
</span>
85-
<span flex-1 />
72+
<div flex="~ items-end gap-3 justify-between">
73+
<div min-w-0 flex="~ items-center gap-2 wrap">
74+
<DisplayBadge v-for="badge of previousBadges" :key="badge" :text="badge" />
75+
<CompareStatsStrip :stats="previousStats" />
76+
</div>
8677
<span text-lg font-600>
8778
<CompareDeltaValue :value="previous" :format="format" />
8879
</span>
@@ -108,18 +99,11 @@ const ratioClass = computed(() => {
10899
{{ currentSubtitle }}
109100
</div>
110101
</div>
111-
<div flex="~ items-center gap-2 wrap">
112-
<DisplayBadge v-for="badge of currentBadges" :key="badge" :text="badge" />
113-
<span v-if="currentStats.length" flex="~ items-baseline gap-1" text-xs op55>
114-
<span>(</span>
115-
<template v-for="(stat, index) of currentStats" :key="stat.label">
116-
<span v-if="index" op70>|</span>
117-
<span font-mono font-600 :class="stat.tone === 'increase' ? 'text-green-500' : stat.tone === 'decrease' ? 'text-red-500' : 'op85'">{{ stat.value }}</span>
118-
<span>{{ stat.label }}</span>
119-
</template>
120-
<span>)</span>
121-
</span>
122-
<span flex-1 />
102+
<div flex="~ items-end gap-3 justify-between">
103+
<div min-w-0 flex="~ items-center gap-2 wrap">
104+
<DisplayBadge v-for="badge of currentBadges" :key="badge" :text="badge" />
105+
<CompareStatsStrip :stats="currentStats" />
106+
</div>
123107
<span text-lg font-600>
124108
<CompareDeltaValue :value="current" :format="format" />
125109
</span>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
4+
interface CompareStat {
5+
value: string
6+
label: string
7+
tone?: 'increase' | 'decrease'
8+
hidden?: boolean
9+
}
10+
11+
const props = withDefaults(defineProps<{
12+
stats?: CompareStat[]
13+
}>(), {
14+
stats: () => [],
15+
})
16+
17+
const visibleStats = computed(() => props.stats.filter(stat => !stat.hidden))
18+
</script>
19+
20+
<template>
21+
<div v-if="visibleStats.length" flex="~ items-baseline gap-1.5 wrap" min-w-0 text-xs>
22+
<template v-for="(stat, index) of visibleStats" :key="stat.label">
23+
<span v-if="index" op35>&middot;</span>
24+
<span inline-flex items-baseline gap-1>
25+
<span
26+
font-mono font-600
27+
:class="stat.tone === 'increase' ? 'text-red-500' : stat.tone === 'decrease' ? 'text-green-500' : 'op85'"
28+
>
29+
{{ stat.value }}
30+
</span>
31+
<span op55>{{ stat.label }}</span>
32+
</span>
33+
</template>
34+
</div>
35+
</template>

0 commit comments

Comments
 (0)