Skip to content

Commit 6742e14

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 76d5190 + 38b3baa commit 6742e14

File tree

188 files changed

+3373
-3440
lines changed

Some content is hidden

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

188 files changed

+3373
-3440
lines changed

.vitepress/config.ts

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Config as ThemeConfig } from '@vue/theme'
55
import baseConfig from '@vue/theme/config'
66
import { headerPlugin } from './headerMdPlugin'
77

8-
const nav = [
8+
const nav: ThemeConfig['nav'] = [
99
{
1010
text: 'Docs',
1111
activeMatch: `^/(guide|style-guide|cookbook|examples)/`,
@@ -48,10 +48,11 @@ const nav = [
4848
]
4949
},
5050
{
51-
text: 'Core Libraries',
51+
text: 'Official Libraries',
5252
items: [
5353
{ text: 'Vue Router', link: 'https://router.vuejs.org/' },
54-
{ text: 'Pinia', link: 'https://pinia.vuejs.org/' }
54+
{ text: 'Pinia', link: 'https://pinia.vuejs.org/' },
55+
{ text: 'Tooling Guide', link: '/guide/scaling-up/tooling.html' }
5556
]
5657
},
5758
{
@@ -86,8 +87,8 @@ const nav = [
8687
items: [
8788
{ text: 'Blog', link: 'https://blog.vuejs.org/' },
8889
{ text: 'Twitter', link: 'https://twitter.com/vuejs' },
89-
{ text: 'Newsletter', link: 'https://news.vuejs.org/' },
90-
{ text: 'Events', link: 'https://events.vuejs.org/' }
90+
{ text: 'Events', link: 'https://events.vuejs.org/' },
91+
{ text: 'Newsletters', link: '/ecosystem/newsletters' }
9192
]
9293
}
9394
]
@@ -121,7 +122,7 @@ const nav = [
121122
}
122123
]
123124

124-
export const sidebar = {
125+
export const sidebar: ThemeConfig['sidebar'] = {
125126
'/guide/': [
126127
{
127128
text: 'Getting Started',
@@ -187,6 +188,7 @@ export const sidebar = {
187188
},
188189
{ text: 'Props', link: '/guide/components/props' },
189190
{ text: 'Events', link: '/guide/components/events' },
191+
{ text: 'Component v-model', link: '/guide/components/v-model' },
190192
{
191193
text: 'Fallthrough Attributes',
192194
link: '/guide/components/attrs'
@@ -549,6 +551,10 @@ export const sidebar = {
549551
]
550552
}
551553

554+
// Placeholder of the i18n config for @vuejs-translations.
555+
// const i18n: ThemeConfig['i18n'] = {
556+
// }
557+
552558
export default defineConfigWithTheme<ThemeConfig>({
553559
extends: baseConfig,
554560

@@ -560,7 +566,7 @@ export default defineConfigWithTheme<ThemeConfig>({
560566
scrollOffset: 'header',
561567

562568
head: [
563-
['meta', { name: 'theme-color', content: "#3c8772" }],
569+
['meta', { name: 'theme-color', content: '#3c8772' }],
564570
['meta', { name: 'twitter:site', content: '@vuejs' }],
565571
['meta', { name: 'twitter:card', content: 'summary' }],
566572
[
@@ -599,6 +605,26 @@ export default defineConfigWithTheme<ThemeConfig>({
599605
themeConfig: {
600606
nav,
601607
sidebar,
608+
// Placeholder of the i18n config for @vuejs-translations.
609+
// i18n,
610+
611+
localeLinks: [
612+
{
613+
link: 'https://cn.vuejs.org',
614+
text: '简体中文',
615+
repo: 'https://github.com/vuejs-translations/docs-zh-cn'
616+
},
617+
{
618+
link: 'https://ja.vuejs.org',
619+
text: '日本語',
620+
repo: 'https://github.com/vuejs-translations/docs-ja'
621+
},
622+
{
623+
link: '/translations/',
624+
text: 'Help Us Translate!',
625+
isTranslationsDesc: true
626+
}
627+
],
602628

603629
algolia: {
604630
indexName: 'vuejs',
@@ -615,7 +641,6 @@ export default defineConfigWithTheme<ThemeConfig>({
615641
},
616642

617643
socialLinks: [
618-
{ icon: 'languages', link: '/translations/' },
619644
{ icon: 'github', link: 'https://github.com/vuejs/' },
620645
{ icon: 'twitter', link: 'https://twitter.com/vuejs' },
621646
{ icon: 'discord', link: 'https://discord.com/invite/HBherRA' }

.vitepress/headerMdPlugin.ts

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,47 @@
1111
*/
1212

1313
import MarkdownIt from 'markdown-it'
14-
import { MarkdownRenderer } from 'vitepress'
14+
import { Header } from 'vitepress'
1515

16-
declare module 'vitepress' {
17-
interface Header {
18-
compositionOnly?: boolean
19-
optionsOnly?: boolean
20-
}
16+
export interface AugmentedHeader extends Header {
17+
compositionOnly?: boolean
18+
optionsOnly?: boolean
2119
}
2220

2321
export const headerPlugin = (md: MarkdownIt) => {
24-
const originalOpen = md.renderer.rules.heading_open!
25-
md.renderer.rules.heading_open = (tokens, i, ...rest) => {
22+
md.renderer.rules.heading_open = (tokens, i, options, env, self) => {
2623
for (const child of tokens[i + 1].children!) {
2724
if (child.type === 'text' && child.content.endsWith('*')) {
2825
child.content = child.content.replace(/\s*\*+$/, '')
2926
}
3027
}
31-
return originalOpen.call(null, tokens, i, ...rest)
28+
return self.renderToken(tokens, i, options)
29+
}
30+
31+
const render = md.render
32+
md.render = (content, env) => {
33+
const res = render(content, env)
34+
35+
if (env && env.headers) {
36+
processHeaders(env.headers)
37+
}
38+
39+
return res
3240
}
41+
}
3342

34-
md.renderer.rules.heading_close = (tokens, i, options, _env, self) => {
35-
const headers = (md as MarkdownRenderer).__data?.headers
36-
if (headers) {
37-
const last = headers[headers.length - 1]
38-
if (last.title.endsWith('*')) {
39-
if (last.title.endsWith('**')) {
40-
last.compositionOnly = true
41-
} else {
42-
last.optionsOnly = true
43-
}
44-
last.title = last.title.replace(/\s*\*+$/, '')
43+
function processHeaders(headers: AugmentedHeader[]) {
44+
for (const h of headers) {
45+
if (h.title.endsWith('*')) {
46+
if (h.title.endsWith('**')) {
47+
h.compositionOnly = true
48+
} else {
49+
h.optionsOnly = true
4550
}
51+
h.title = h.title.replace(/\s*\*+$/, '')
52+
}
53+
if (h.children) {
54+
processHeaders(h.children)
4655
}
47-
return self.renderToken(tokens, i, options)
4856
}
4957
}

.vitepress/inlined-scripts/restorePreference.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
restore('vue-docs-prefer-composition', 'prefer-composition')
99
restore('vue-docs-prefer-sfc', 'prefer-sfc', true)
1010

11-
window.__VUE_BANNER_ID__ = 'vuejsdeConf2022'
12-
restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
11+
// window.__VUE_BANNER_ID__ = ''
12+
// restore(`vue-docs-banner-${__VUE_BANNER_ID__}`, 'banner-dismissed')
1313
})()

.vitepress/jobsMdPlugin.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import MarkdownIt from 'markdown-it'
2+
3+
const excludedPages = [
4+
'guide/introduction.md',
5+
'guide/quick-start.md',
6+
'guide/essentials/computed.md',
7+
'guide/essentials/conditional.md',
8+
'guide/essentials/list.md',
9+
'guide/essentials/event-handling.md',
10+
'guide/essentials/forms.md',
11+
'guide/components/registration.md',
12+
'guide/components/props.md',
13+
'guide/components/events.md',
14+
'guide/components/slots.md',
15+
'guide/built-ins/teleport.md',
16+
'about/faq.md',
17+
'about/team.md',
18+
'about/releases.md',
19+
'about/community-guide.md',
20+
'about/coc.md',
21+
'sponsor/index.md',
22+
'translations/index.md'
23+
]
24+
25+
export const jobsPlugin = (md: MarkdownIt) => {
26+
md.renderer.rules.heading_close = (tokens, i, options, env, self) => {
27+
const relativePath = env.relativePath
28+
const renderedContent = self.renderToken(tokens, i, options)
29+
30+
return excludedPages.includes(relativePath)
31+
? renderedContent
32+
: renderedContent.replace(/<\/h1>/, '</h1><VueJobs/>')
33+
}
34+
}

.vitepress/theme/components/Banner.vue

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
99
let open = $ref(true)
10-
1110
/**
1211
* Call this if the banner is dismissible
1312
*/
@@ -19,27 +18,7 @@ function dismiss() {
1918
</script>
2019

2120
<template>
22-
<div class="banner banner-vuejsconf" v-if="open">
23-
<a href="https://conf.vuejs.de" target="_blank">
24-
<picture>
25-
<source
26-
media="(min-width:1200px)"
27-
srcset="/images/vuejsde-conf/vuejsdeconf_banner_large.png"
28-
/>
29-
<source
30-
media="(min-width:920px)"
31-
srcset="/images/vuejsde-conf/vuejsdeconf_banner_medium.png"
32-
/>
33-
<img
34-
src="/images/vuejsde-conf/vuejsdeconf_banner_small.png"
35-
alt=""
36-
/>
37-
</picture>
38-
</a>
39-
<div class="close-btn" @click.stop.prevent="dismiss">
40-
<img src="/images/vuejsde-conf/close.svg" alt="Close" />
41-
</div>
42-
</div>
21+
<div class="banner" v-if="open"></div>
4322
</template>
4423

4524
<style>
@@ -68,27 +47,4 @@ html:not(.banner-dismissed) {
6847
.banner-dismissed .banner {
6948
display: none;
7049
}
71-
72-
a {
73-
text-decoration: underline;
74-
}
75-
76-
.banner-vuejsconf {
77-
background: linear-gradient(90deg, #fff 50%, var(--vt-c-green) 50%);
78-
}
79-
80-
.banner-vuejsconf a {
81-
display: inline-block;
82-
margin: 0 auto;
83-
}
84-
85-
.banner-vuejsconf .close-btn {
86-
top: 26%;
87-
right: 10px;
88-
z-index: 99;
89-
position: absolute;
90-
border-radius: 50%;
91-
background-color: var(--vt-c-brand-dark);
92-
padding: 8px;
93-
}
9450
</style>

.vitepress/theme/components/Home.vue

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script setup lang="ts">
2-
import { onMounted } from 'vue';
3-
import NewsLetter from './NewsLetter.vue'
4-
import { load, data, base } from './sponsors';
5-
import SponsorsGroup from './SponsorsGroup.vue';
6-
import VueMasteryModal from './VueMasteryModal.vue';
2+
import { onMounted } from 'vue'
3+
import SiteMap from './SiteMap.vue';
4+
// import NewsLetter from './NewsLetter.vue'
5+
import { load, data, base } from './sponsors'
6+
import SponsorsGroup from './SponsorsGroup.vue'
7+
import VueMasteryModal from './VueMasteryModal.vue'
78
89
onMounted(async () => {
910
await load()
@@ -42,7 +43,7 @@ onMounted(async () => {
4243
</section>
4344

4445
<section id="special-sponsor">
45-
<span>Special Sponsor</span>
46+
<span class="lead">Special Sponsor</span>
4647
<template v-if="data && data.special">
4748
<template v-for="{ url, img, name, description } of data.special">
4849
<a :href="url" target="_blank" rel="sponsored noopener">
@@ -52,7 +53,7 @@ onMounted(async () => {
5253
</picture>
5354
<img v-else :src="`${base}/images/${img}`" :alt="name" />
5455
</a>
55-
<span v-if="description">{{ description }}</span>
56+
<span>{{ description }}</span>
5657
</template>
5758
</template>
5859
</section>
@@ -88,7 +89,8 @@ onMounted(async () => {
8889
<SponsorsGroup tier="gold" placement="landing" />
8990
</section>
9091

91-
<NewsLetter />
92+
<SiteMap />
93+
<!-- <NewsLetter /> -->
9294
</template>
9395

9496
<style scoped>
@@ -178,22 +180,31 @@ html:not(.dark) .accent,
178180
border-top: 1px solid var(--vt-c-divider-light);
179181
border-bottom: 1px solid var(--vt-c-divider-light);
180182
padding: 12px 24px;
181-
text-align: center;
183+
display: flex;
184+
align-items: center;
182185
}
183186
184187
#special-sponsor span {
185188
color: var(--vt-c-text-2);
186189
font-weight: 500;
187190
font-size: 13px;
188191
vertical-align: middle;
189-
margin-right: 24px;
192+
flex: 1;
193+
}
194+
195+
#special-sponsor span:first-child {
196+
text-align: right;
197+
}
198+
199+
#special-sponsor a {
200+
display: flex;
201+
justify-content: center;
202+
padding: 0 24px;
190203
}
191204
192205
#special-sponsor img {
193-
display: inline-block;
194-
vertical-align: middle;
195-
height: 36px;
196-
margin-right: 24px;
206+
height: 42px;
207+
margin: -6px 0;
197208
}
198209
199210
.dark #special-sponsor img {
@@ -265,9 +276,15 @@ html:not(.dark) .accent,
265276
font-size: 16px;
266277
margin: 18px 0 30px;
267278
}
279+
#special-sponsor {
280+
flex-direction: column;
281+
}
268282
#special-sponsor img {
269-
display: block;
270-
margin: 2px auto 1px;
283+
height: 36px;
284+
margin: 8px 0;
285+
}
286+
#special-sponsor span {
287+
text-align: center !important;
271288
}
272289
#highlights h3 {
273290
margin-bottom: 0.6em;

0 commit comments

Comments
 (0)