@vuepress/theme-default 2.0.0-rc.102 → 2.0.0-rc.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/components/VPAutoLink.vue +5 -8
- package/lib/client/components/VPFadeSlideYTransition.vue +2 -2
- package/lib/client/components/VPNavbarDropdown.vue +3 -7
- package/lib/client/components/VPPage.vue +1 -1
- package/lib/client/components/VPSidebarItem.vue +14 -18
- package/lib/client/components/global/Badge.vue +19 -24
- package/lib/client/composables/useNavbarSelectLanguage.js +9 -3
- package/lib/client/layouts/NotFound.vue +44 -8
- package/lib/client/styles/content/code.scss +34 -14
- package/lib/node/defaultTheme.js +2 -2
- package/package.json +18 -18
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
NonNullableSlotContent,
|
|
4
|
-
SlotContent,
|
|
5
|
-
} from '@vuepress/helper/client'
|
|
2
|
+
import type { RequiredSlot, Slot } from '@vuepress/helper/client'
|
|
6
3
|
import type { AutoLinkConfig } from 'vuepress/client'
|
|
7
4
|
import { AutoLink } from 'vuepress/client'
|
|
8
5
|
|
|
9
|
-
defineProps<{
|
|
6
|
+
const { config } = defineProps<{
|
|
10
7
|
/**
|
|
11
8
|
* The auto link config
|
|
12
9
|
*/
|
|
@@ -14,9 +11,9 @@ defineProps<{
|
|
|
14
11
|
}>()
|
|
15
12
|
|
|
16
13
|
defineSlots<{
|
|
17
|
-
default?:
|
|
18
|
-
before?:
|
|
19
|
-
after?:
|
|
14
|
+
default?: RequiredSlot<AutoLinkConfig>
|
|
15
|
+
before?: Slot<AutoLinkConfig>
|
|
16
|
+
after?: Slot<AutoLinkConfig>
|
|
20
17
|
}>()
|
|
21
18
|
</script>
|
|
22
19
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SingleSlot } from '@vuepress/helper/client'
|
|
3
3
|
import '@vuepress/helper/transition/fade-in-down.css'
|
|
4
4
|
|
|
5
5
|
defineEmits<{
|
|
@@ -7,7 +7,7 @@ defineEmits<{
|
|
|
7
7
|
beforeLeave: []
|
|
8
8
|
}>()
|
|
9
9
|
defineSlots<{
|
|
10
|
-
default:
|
|
10
|
+
default: SingleSlot
|
|
11
11
|
}>()
|
|
12
12
|
</script>
|
|
13
13
|
|
|
@@ -2,24 +2,20 @@
|
|
|
2
2
|
import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
3
3
|
import { FadeInExpandTransition } from '@vuepress/helper/client'
|
|
4
4
|
import { useToggle } from '@vueuse/core'
|
|
5
|
-
import { computed
|
|
5
|
+
import { computed } from 'vue'
|
|
6
6
|
import { onContentUpdated } from 'vuepress/client'
|
|
7
7
|
import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
|
|
8
8
|
|
|
9
9
|
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const { config } = defineProps<{
|
|
12
12
|
/** dropdown config */
|
|
13
13
|
config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
|
|
14
14
|
}>()
|
|
15
15
|
|
|
16
|
-
const { config } = toRefs(props)
|
|
17
|
-
|
|
18
16
|
const [open, toggleOpen] = useToggle()
|
|
19
17
|
|
|
20
|
-
const dropdownAriaLabel = computed(
|
|
21
|
-
() => config.value.ariaLabel || config.value.text,
|
|
22
|
-
)
|
|
18
|
+
const dropdownAriaLabel = computed(() => config.ariaLabel || config.text)
|
|
23
19
|
|
|
24
20
|
const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
|
|
25
21
|
array[array.length - 1] === arrayItem
|
|
@@ -3,33 +3,29 @@ import VPAutoLink from '@theme/VPAutoLink.vue'
|
|
|
3
3
|
import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
|
|
4
4
|
import { isActiveSidebarItem } from '@theme/isActiveSidebarItem'
|
|
5
5
|
import { useToggle } from '@vueuse/core'
|
|
6
|
-
import { computed, nextTick, onBeforeUnmount
|
|
6
|
+
import { computed, nextTick, onBeforeUnmount } from 'vue'
|
|
7
7
|
import { useRoute, useRouter } from 'vuepress/client'
|
|
8
8
|
import type { SidebarGroupItem, SidebarItem } from '../typings.js'
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}>(),
|
|
21
|
-
{ depth: 0 },
|
|
22
|
-
)
|
|
10
|
+
const { item, depth = 0 } = defineProps<{
|
|
11
|
+
/**
|
|
12
|
+
* The sidebar item to be rendered
|
|
13
|
+
*/
|
|
14
|
+
item: SidebarItem
|
|
15
|
+
/**
|
|
16
|
+
* The depth of the current sidebar item
|
|
17
|
+
*/
|
|
18
|
+
depth?: number
|
|
19
|
+
}>()
|
|
23
20
|
|
|
24
|
-
const { item, depth } = toRefs(props)
|
|
25
21
|
const route = useRoute()
|
|
26
22
|
const router = useRouter()
|
|
27
23
|
|
|
28
|
-
const collapsible = computed(() => (item
|
|
29
|
-
const isActive = computed(() => isActiveSidebarItem(item
|
|
24
|
+
const collapsible = computed(() => (item as SidebarGroupItem).collapsible)
|
|
25
|
+
const isActive = computed(() => isActiveSidebarItem(item, route))
|
|
30
26
|
const itemClass = computed(() => ({
|
|
31
27
|
'vp-sidebar-item': true,
|
|
32
|
-
'vp-sidebar-heading': depth
|
|
28
|
+
'vp-sidebar-heading': depth === 0,
|
|
33
29
|
'active': isActive.value,
|
|
34
30
|
'collapsible': collapsible.value,
|
|
35
31
|
}))
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Slot } from '@vuepress/helper/client'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
vertical: undefined,
|
|
23
|
-
},
|
|
24
|
-
)
|
|
4
|
+
const {
|
|
5
|
+
type = 'tip',
|
|
6
|
+
text = '',
|
|
7
|
+
vertical = '',
|
|
8
|
+
} = defineProps<{
|
|
9
|
+
/**
|
|
10
|
+
* The type of the badge
|
|
11
|
+
*/
|
|
12
|
+
type?: string
|
|
13
|
+
/**
|
|
14
|
+
* The text of the badge
|
|
15
|
+
*/
|
|
16
|
+
text?: string
|
|
17
|
+
/**
|
|
18
|
+
* The vertical align of the badge
|
|
19
|
+
*/
|
|
20
|
+
vertical?: string
|
|
21
|
+
}>()
|
|
25
22
|
|
|
26
23
|
defineSlots<{
|
|
27
24
|
default?: Slot
|
|
@@ -32,9 +29,7 @@ defineSlots<{
|
|
|
32
29
|
<span
|
|
33
30
|
class="vp-badge"
|
|
34
31
|
:class="type"
|
|
35
|
-
:style="{
|
|
36
|
-
verticalAlign: vertical,
|
|
37
|
-
}"
|
|
32
|
+
:style="vertical ? { verticalAlign: vertical } : ''"
|
|
38
33
|
>
|
|
39
34
|
<slot>{{ text }}</slot>
|
|
40
35
|
</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useData } from '@theme/useData';
|
|
2
2
|
import { useRoutePaths } from '@vuepress/helper/client';
|
|
3
|
-
import { computed } from 'vue';
|
|
3
|
+
import { computed, onMounted, ref } from 'vue';
|
|
4
4
|
import { useRoute } from 'vuepress/client';
|
|
5
5
|
/**
|
|
6
6
|
* Get navbar config of select language dropdown
|
|
@@ -9,6 +9,10 @@ export const useNavbarSelectLanguage = () => {
|
|
|
9
9
|
const route = useRoute();
|
|
10
10
|
const routePaths = useRoutePaths();
|
|
11
11
|
const { routeLocale, site, siteLocale, theme, themeLocale } = useData();
|
|
12
|
+
const isMounted = ref(false);
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
isMounted.value = true;
|
|
15
|
+
});
|
|
12
16
|
return computed(() => {
|
|
13
17
|
const localePaths = Object.keys(site.value.locales);
|
|
14
18
|
// do not display language selection dropdown if there is only one language
|
|
@@ -34,7 +38,7 @@ export const useNavbarSelectLanguage = () => {
|
|
|
34
38
|
return {
|
|
35
39
|
text,
|
|
36
40
|
activeMatch: '.',
|
|
37
|
-
link:
|
|
41
|
+
link: isMounted.value ? currentFullPath : currentPath,
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
44
|
// if the target language is not current language
|
|
@@ -45,7 +49,9 @@ export const useNavbarSelectLanguage = () => {
|
|
|
45
49
|
text,
|
|
46
50
|
// try to keep current hash and params across languages
|
|
47
51
|
link: routePaths.value.some((item) => item === targetLocalePage)
|
|
48
|
-
?
|
|
52
|
+
? isMounted.value
|
|
53
|
+
? currentFullPath.replace(currentPath, targetLocalePage)
|
|
54
|
+
: targetLocalePage
|
|
49
55
|
: (targetThemeLocale.home ?? targetLocalePath),
|
|
50
56
|
};
|
|
51
57
|
}),
|
|
@@ -1,17 +1,53 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useData } from '@theme/useData'
|
|
3
|
-
import { computed } from 'vue'
|
|
3
|
+
import { computed, onMounted, ref } from 'vue'
|
|
4
4
|
import { RouteLink } from 'vuepress/client'
|
|
5
5
|
|
|
6
|
-
const { routeLocale, themeLocale } = useData()
|
|
6
|
+
const { routeLocale, theme, themeLocale } = useData()
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const isMounted = ref(false)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// 404 page will fall back to root locale,
|
|
11
|
+
// so we shall use the '/' to avoid SSR mismatch
|
|
12
|
+
const expectedRouteLocale = computed(() =>
|
|
13
|
+
isMounted.value ? routeLocale.value : '/',
|
|
14
|
+
)
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
// 404 page will fall back to root locale,
|
|
17
|
+
// so we shall use the root theme locale to avoid SSR mismatch
|
|
18
|
+
const expectedThemeLocale = computed(() => {
|
|
19
|
+
if (isMounted.value) return themeLocale.value
|
|
20
|
+
|
|
21
|
+
const { locales, ...baseOptions } = theme.value
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...baseOptions,
|
|
25
|
+
...locales?.['/'],
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const homeLink = computed(
|
|
30
|
+
() => expectedThemeLocale.value.home ?? expectedRouteLocale.value,
|
|
31
|
+
)
|
|
32
|
+
const homeText = computed(
|
|
33
|
+
() => expectedThemeLocale.value.backToHome ?? 'Back to home',
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
const messages = computed(
|
|
37
|
+
() => expectedThemeLocale.value.notFound ?? ['Not Found'],
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const notFoundMsg = computed(() => {
|
|
41
|
+
if (isMounted.value) {
|
|
42
|
+
return messages.value[Math.floor(Math.random() * messages.value.length)]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return messages.value[0]
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
isMounted.value = true
|
|
50
|
+
})
|
|
15
51
|
</script>
|
|
16
52
|
|
|
17
53
|
<template>
|
|
@@ -20,7 +56,7 @@ const homeText = computed(() => themeLocale.value.backToHome ?? 'Back to home')
|
|
|
20
56
|
<div vp-content>
|
|
21
57
|
<h1>404</h1>
|
|
22
58
|
|
|
23
|
-
<blockquote>{{
|
|
59
|
+
<blockquote>{{ notFoundMsg }}</blockquote>
|
|
24
60
|
|
|
25
61
|
<RouteLink :to="homeLink">{{ homeText }}</RouteLink>
|
|
26
62
|
</div>
|
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
@use '../variables' as *;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
div[class*='language-'] {
|
|
5
|
-
margin: 0.75rem 0;
|
|
6
|
-
transition:
|
|
7
|
-
background-color var(--vp-t-color),
|
|
8
|
-
color var(--vp-t-color);
|
|
9
|
-
|
|
3
|
+
#content {
|
|
10
4
|
@media (max-width: $MQMobileNarrow) {
|
|
11
5
|
--code-border-radius: 0;
|
|
6
|
+
--tab-border-radius: 0;
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
// code block
|
|
9
|
+
> div[class*='language-'],
|
|
10
|
+
> .code-block-with-title > div[class*='language-'] {
|
|
11
|
+
margin-inline: -1.5rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// code block title bar
|
|
15
|
+
.code-block-title-bar {
|
|
16
|
+
margin-inline: -1.5rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// code tabs
|
|
20
|
+
> .vp-code-tabs {
|
|
21
|
+
.vp-code-tabs-nav {
|
|
22
|
+
margin-inline: -1.5rem;
|
|
23
|
+
border-radius: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
div[class*='language-'] {
|
|
27
|
+
margin-inline: -1.5rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// tabs
|
|
32
|
+
> .vp-tabs {
|
|
33
|
+
margin-inline: -1.5rem;
|
|
34
|
+
border-inline: none;
|
|
35
|
+
}
|
|
15
36
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
transition: background-color var(--vp-t-color);
|
|
37
|
+
// reveal.js
|
|
38
|
+
.vp-reveal {
|
|
39
|
+
width: calc(100% + 3rem);
|
|
40
|
+
margin: 0 -1.5rem;
|
|
21
41
|
}
|
|
22
42
|
}
|
|
23
43
|
}
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -36,7 +36,7 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
36
36
|
.readdirSync(path.resolve(__dirname, '../client/composables'))
|
|
37
37
|
.filter((file) => file.endsWith('.js'))
|
|
38
38
|
.map((file) => [
|
|
39
|
-
`@theme/${file.
|
|
39
|
+
`@theme/${file.slice(0, -3)}`,
|
|
40
40
|
path.resolve(__dirname, '../client/composables', file),
|
|
41
41
|
])),
|
|
42
42
|
// use alias to make all utils replaceable
|
|
@@ -44,7 +44,7 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
44
44
|
.readdirSync(path.resolve(__dirname, '../client/utils'))
|
|
45
45
|
.filter((file) => file.endsWith('.js'))
|
|
46
46
|
.map((file) => [
|
|
47
|
-
`@theme/${file.
|
|
47
|
+
`@theme/${file.slice(0, -3)}`,
|
|
48
48
|
path.resolve(__dirname, '../client/utils', file),
|
|
49
49
|
])),
|
|
50
50
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/theme-default",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.104",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -42,21 +42,21 @@
|
|
|
42
42
|
"templates"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-active-header-links": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-copy-code": "2.0.0-rc.
|
|
49
|
-
"@vuepress/plugin-git": "2.0.0-rc.
|
|
50
|
-
"@vuepress/plugin-links-check": "2.0.0-rc.
|
|
51
|
-
"@vuepress/plugin-markdown-hint": "2.0.0-rc.
|
|
52
|
-
"@vuepress/plugin-markdown-tab": "2.0.0-rc.
|
|
53
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-rc.
|
|
54
|
-
"@vuepress/plugin-nprogress": "2.0.0-rc.
|
|
55
|
-
"@vuepress/plugin-palette": "2.0.0-rc.
|
|
56
|
-
"@vuepress/plugin-prismjs": "2.0.0-rc.
|
|
57
|
-
"@vuepress/plugin-seo": "2.0.0-rc.
|
|
58
|
-
"@vuepress/plugin-sitemap": "2.0.0-rc.
|
|
59
|
-
"@vuepress/plugin-theme-data": "2.0.0-rc.
|
|
45
|
+
"@vuepress/helper": "2.0.0-rc.104",
|
|
46
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.103",
|
|
47
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.104",
|
|
48
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.104",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-rc.104",
|
|
50
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.104",
|
|
51
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.104",
|
|
52
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.104",
|
|
53
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.104",
|
|
54
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.104",
|
|
55
|
+
"@vuepress/plugin-palette": "2.0.0-rc.104",
|
|
56
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.104",
|
|
57
|
+
"@vuepress/plugin-seo": "2.0.0-rc.104",
|
|
58
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.104",
|
|
59
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.103",
|
|
60
60
|
"@vueuse/core": "^13.1.0",
|
|
61
61
|
"vue": "^3.5.13"
|
|
62
62
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"sass": "^1.86.3",
|
|
65
65
|
"sass-embedded": "^1.86.3",
|
|
66
66
|
"sass-loader": "^16.0.5",
|
|
67
|
-
"vuepress": "2.0.0-rc.
|
|
67
|
+
"vuepress": "2.0.0-rc.23"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"sass": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "34f6cf13f83e5c0bd758f44c0a1b372413c6ded9"
|
|
84
84
|
}
|