-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathchangelog.vue
More file actions
199 lines (185 loc) · 6.26 KB
/
changelog.vue
File metadata and controls
199 lines (185 loc) · 6.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<script setup lang="ts">
import type { Release } from '#shared/types'
definePageMeta({
heroBackground: 'opacity-0'
})
const title = 'Changelog'
const description = 'Discover the latest releases from Nuxt and the official modules.'
useSeoMeta({
titleTemplate: '%s',
title,
description,
ogDescription: description,
ogTitle: title
})
useCanonical('/raw/changelog.md')
defineOgImage('Docs.takumi', {
headline: 'Changelog',
title,
description
})
if (import.meta.server) {
prerenderRoutes(['/raw/changelog.md'])
}
const { data: releases } = await useFetch('/api/releases')
const openStates = reactive<Record<string, boolean>>({})
const { modules } = useModules()
const { copy } = useClipboard()
const repoLinks = computed(() => {
const links: Record<string, string> = { 'nuxt/nuxt': '/docs' }
for (const mod of modules.value) {
const repo = mod.repo?.split('#')[0]
if (repo && mod.website) {
links[repo] = mod.website
}
}
return links
})
function formatDate(date: string) {
return new Date(date).toLocaleDateString('en', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
function copyRelease(release: Release) {
const md = `# ${release.title}\n\n${release.markdown}`
copy(md, {
title: 'Release notes copied!',
description: `${release.title} markdown copied to clipboard.`,
icon: 'i-lucide-clipboard-check'
})
}
</script>
<template>
<div class="xl:grid xl:grid-cols-2">
<div class="relative border-b border-default xl:border-b-0 xl:sticky xl:inset-y-0 xl:h-screen overflow-hidden">
<div class="absolute -right-1/2 z-[-1] rounded-full bg-primary blur-[300px] size-60 sm:size-100 transform -translate-y-1/2 top-1/2" />
<div class="h-full flex flex-col justify-center px-6 sm:px-12 lg:px-16 py-12 sm:py-16 xl:ps-[max(2rem,calc((100vw-var(--ui-container))/2+2rem))]">
<h1 class="text-4xl sm:text-5xl font-bold text-highlighted tracking-tight">
{{ title }}
</h1>
<p class="text-lg/7 text-muted max-w-sm mt-4">
Latest changes, improvements, and fixes across Nuxt core and the official modules.
</p>
<div class="flex items-center gap-1 mt-8 -ms-2.5">
<UButton
to="https://github.com/nuxt/nuxt/releases"
target="_blank"
icon="i-simple-icons-github"
label="GitHub"
variant="ghost"
color="neutral"
/>
<UButton
to="/blog"
icon="i-lucide-newspaper"
label="Blog"
variant="ghost"
color="neutral"
/>
<UButton
to="/changelog/rss.xml"
external
icon="i-lucide-rss"
label="RSS"
variant="ghost"
color="neutral"
/>
</div>
</div>
</div>
<section class="px-4 sm:px-6 xl:px-0 xl:-ms-30 xl:flex-1">
<UChangelogVersions
as="main"
:indicator-motion="false"
:ui="{
root: 'py-16 sm:py-24 lg:py-32',
indicator: 'inset-y-0'
}"
>
<UChangelogVersion
v-for="release in releases"
:key="release.tag"
:to="release.url"
target="_blank"
:title="release.title"
:date="formatDate(release.date)"
:ui="{
root: 'flex items-start',
container: 'max-w-xl 2xl:mx-12 w-full relative',
header: 'border-b border-default pb-4',
title: 'text-2xl sm:text-3xl tracking-tight',
date: 'text-xs text-muted font-mono tabular-nums',
indicator: 'sticky top-0 pt-16 -mt-16 sm:pt-24 sm:-mt-24 lg:pt-32 lg:-mt-32'
}"
>
<template #header>
<div class="flex items-start justify-between gap-4">
<div class="flex flex-col gap-1.5">
<UButton
:label="release.repo === 'nuxt/nuxt' ? 'nuxt' : `@${release.repo}`"
:to="repoLinks[release.repo]"
:target="repoLinks[release.repo]?.startsWith('http') ? '_blank' : undefined"
variant="outline"
:color="release.repo === 'nuxt/nuxt' ? 'primary' : 'neutral'"
size="xs"
class="w-fit"
/>
<NuxtLink :to="release.url" target="_blank" class="text-2xl sm:text-3xl tracking-tight font-semibold text-highlighted hover:text-primary transition-colors">
{{ release.title }}
</NuxtLink>
</div>
<UButton
label="Copy release"
size="xs"
color="neutral"
variant="link"
@click.prevent="copyRelease(release)"
/>
</div>
</template>
<template #body>
<div
class="relative"
:class="{
'h-auto min-h-[200px]': openStates[release.tag],
'h-[200px] overflow-y-hidden': !openStates[release.tag] && release.body.children.length > 4
}"
>
<MDCRenderer
v-if="release.body"
:body="release.body"
style="zoom: 0.85"
/>
<div
v-if="!openStates[release.tag] && release.body.children.length > 4"
class="h-16 absolute inset-x-0 bottom-0 flex items-end justify-center bg-linear-to-t from-default to-default/50"
>
<UButton
size="sm"
icon="i-lucide-chevron-down"
color="neutral"
variant="outline"
label="Expand release"
class="group"
@click="openStates[release.tag] = true"
/>
</div>
</div>
<div v-if="openStates[release.tag]" class="flex justify-center pt-4">
<UButton
size="sm"
icon="i-lucide-chevron-up"
color="neutral"
variant="outline"
label="Collapse release"
@click="openStates[release.tag] = false"
/>
</div>
</template>
</UChangelogVersion>
</UChangelogVersions>
</section>
</div>
</template>