valaxy-theme-press 0.0.3 → 0.1.0
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/README.md +7 -0
- package/assets/images/none.jpg +0 -0
- package/components/PressAlgoliaSearch.vue +208 -0
- package/components/PressArticle.vue +12 -6
- package/components/PressAside.vue +24 -17
- package/components/PressBackdrop.vue +1 -1
- package/components/PressButton.vue +5 -1
- package/components/PressCategories.vue +8 -3
- package/components/PressCategory.vue +13 -11
- package/components/PressDocFooterLastUpdated.vue +2 -1
- package/components/PressFeatures.vue +1 -1
- package/components/PressFooter.vue +1 -1
- package/components/PressHome.vue +1 -1
- package/components/PressHomeFeatures.vue +1 -0
- package/components/PressHomeHero.vue +12 -10
- package/components/PressLocalNav.vue +9 -9
- package/components/PressNav.vue +30 -5
- package/components/PressNavBar.vue +94 -0
- package/components/PressNavBarAppearance.vue +5 -0
- package/components/PressNavBarHamburger.vue +79 -0
- package/components/PressNavBarMenu.vue +14 -0
- package/components/PressNavBarSearch.vue +40 -0
- package/components/PressNavBarSocialLinks.vue +26 -0
- package/components/PressNavBarTranslations.vue +5 -0
- package/components/{nav/PressNavItemGroup.vue → PressNavItemGroup.vue} +8 -5
- package/components/{nav/PressNavItemLink.vue → PressNavItemLink.vue} +2 -1
- package/components/PressNavScreen.vue +95 -0
- package/components/PressNavScreenAppearance.vue +32 -0
- package/components/PressNavScreenMenu.vue +22 -0
- package/components/PressNavScreenMenuGroup.vue +115 -0
- package/components/PressNavScreenMenuGroupLink.vue +32 -0
- package/components/PressNavScreenMenuGroupSection.vue +37 -0
- package/components/PressNavScreenMenuLink.vue +33 -0
- package/components/PressNavScreenSocialLinks.vue +13 -0
- package/components/PressNavScreenTranslations.vue +7 -0
- package/components/PressOutline.vue +3 -4
- package/components/PressPostList.vue +6 -6
- package/components/PressSidebar.vue +10 -9
- package/components/PressSocialLink.vue +40 -0
- package/components/PressSocialLinks.vue +26 -0
- package/components/ValaxyMain.vue +46 -33
- package/composables/config.ts +0 -1
- package/composables/nav.ts +37 -0
- package/config/index.ts +5 -2
- package/layouts/layout.vue +2 -3
- package/locales/en.yml +4 -0
- package/locales/zh-CN.yml +4 -0
- package/package.json +3 -13
- package/pages/{[..all].vue → [...all].vue} +1 -0
- package/setup/main.ts +16 -3
- package/styles/css-vars.scss +11 -6
- package/styles/markdown.scss +9 -12
- package/tsconfig.json +11 -11
- package/types/index.d.ts +20 -5
- package/utils/index.ts +8 -0
- package/components/DocsBoard.vue +0 -24
- package/components/nav/PressNavBar.vue +0 -111
- /package/components/{nav/PressSwitchAppearance.vue → PressSwitchAppearance.vue} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<PressSocialLinks
|
|
9
|
+
v-if="themeConfig.socialLinks"
|
|
10
|
+
class="pr-nav-screen-social-links"
|
|
11
|
+
:links="themeConfig.socialLinks"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
@@ -5,10 +5,8 @@ import {
|
|
|
5
5
|
useOutline,
|
|
6
6
|
} from 'valaxy'
|
|
7
7
|
import { useI18n } from 'vue-i18n'
|
|
8
|
-
import { useThemeConfig } from '../composables'
|
|
9
8
|
|
|
10
9
|
const { t } = useI18n()
|
|
11
|
-
const themeConfig = useThemeConfig()
|
|
12
10
|
|
|
13
11
|
const container = ref()
|
|
14
12
|
const marker = ref()
|
|
@@ -22,7 +20,7 @@ const { headers, handleClick } = useOutline()
|
|
|
22
20
|
<div v-show="headers.length" ref="container">
|
|
23
21
|
<div class="content">
|
|
24
22
|
<div class="outline-title">
|
|
25
|
-
{{
|
|
23
|
+
{{ t('theme.outlineTitle') }}
|
|
26
24
|
</div>
|
|
27
25
|
|
|
28
26
|
<div ref="marker" class="outline-marker" />
|
|
@@ -33,7 +31,7 @@ const { headers, handleClick } = useOutline()
|
|
|
33
31
|
</span>
|
|
34
32
|
|
|
35
33
|
<PressOutlineItem
|
|
36
|
-
class="va-toc relative z-1"
|
|
34
|
+
class="va-toc relative z-1 css-i18n-toc"
|
|
37
35
|
:headers="headers"
|
|
38
36
|
:on-click="handleClick"
|
|
39
37
|
root
|
|
@@ -58,6 +56,7 @@ const { headers, handleClick } = useOutline()
|
|
|
58
56
|
font-size: 14px;
|
|
59
57
|
text-align: left;
|
|
60
58
|
border-left: 1px solid var(--pr-aside-divider);
|
|
59
|
+
width: var(--va-aside-width + 16px);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
.outline-marker {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import type { Post } from 'valaxy'
|
|
4
|
-
import {
|
|
4
|
+
import { useSiteStore } from 'valaxy'
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(defineProps<{
|
|
7
7
|
type?: string
|
|
@@ -11,16 +11,16 @@ const props = withDefaults(defineProps<{
|
|
|
11
11
|
curPage: 1,
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
const posts = computed(() => props.posts ||
|
|
14
|
+
const site = useSiteStore()
|
|
15
|
+
const posts = computed(() => props.posts || site.postList)
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
19
|
<ul class="divide-y divide-gray-200">
|
|
20
|
-
<
|
|
21
|
-
<li class="py-12">
|
|
20
|
+
<TransitionGroup name="fade">
|
|
21
|
+
<li v-for="post, i in posts" :key="i" class="py-12">
|
|
22
22
|
<PressArticleCard :post="post" />
|
|
23
23
|
</li>
|
|
24
|
-
</
|
|
24
|
+
</TransitionGroup>
|
|
25
25
|
</ul>
|
|
26
26
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
import { useCategory, usePageList, useSidebar } from 'valaxy'
|
|
3
|
+
import { removeItemFromCategory, useCategory, usePageList, useSidebar } from 'valaxy'
|
|
4
4
|
import { useThemeConfig } from '../composables'
|
|
5
5
|
|
|
6
6
|
defineProps<{
|
|
@@ -12,16 +12,17 @@ const themeConfig = useThemeConfig()
|
|
|
12
12
|
|
|
13
13
|
const categories = computed(() => {
|
|
14
14
|
const cs = useCategory('', pages.value)
|
|
15
|
-
cs.
|
|
15
|
+
const cList = cs.value
|
|
16
|
+
removeItemFromCategory(cList, 'Uncategorized')
|
|
16
17
|
|
|
17
18
|
const sidebar = themeConfig.value.sidebar
|
|
18
19
|
if (sidebar) {
|
|
19
|
-
|
|
20
|
-
if (!themeConfig.value.sidebar.includes(
|
|
21
|
-
|
|
20
|
+
cList.children.forEach((item) => {
|
|
21
|
+
if (!themeConfig.value.sidebar.includes(item.name))
|
|
22
|
+
removeItemFromCategory(cList, item.name)
|
|
22
23
|
})
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return cList
|
|
25
26
|
})
|
|
26
27
|
|
|
27
28
|
const { hasSidebar } = useSidebar()
|
|
@@ -40,7 +41,7 @@ const { hasSidebar } = useSidebar()
|
|
|
40
41
|
</template>
|
|
41
42
|
|
|
42
43
|
<style lang="scss">
|
|
43
|
-
@use 'valaxy/client/styles/mixins' as *;
|
|
44
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
44
45
|
|
|
45
46
|
.press-sidebar {
|
|
46
47
|
position: fixed;
|
|
@@ -49,7 +50,7 @@ const { hasSidebar } = useSidebar()
|
|
|
49
50
|
left: 0;
|
|
50
51
|
padding: 1rem;
|
|
51
52
|
top: var(--pr-nav-height);
|
|
52
|
-
z-index: var(--pr-z-
|
|
53
|
+
z-index: var(--pr-z-sidebar);
|
|
53
54
|
width: calc(100vw - 64px);
|
|
54
55
|
max-width: 320px;
|
|
55
56
|
background-color: var(--va-c-bg);
|
|
@@ -68,7 +69,7 @@ const { hasSidebar } = useSidebar()
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
@include
|
|
72
|
+
@include screen('md') {
|
|
72
73
|
.press-sidebar {
|
|
73
74
|
z-index: 1;
|
|
74
75
|
width: var(--va-sidebar-width);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
icon: string
|
|
4
|
+
link: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<a
|
|
10
|
+
class="pr-social-link"
|
|
11
|
+
:href="link"
|
|
12
|
+
target="_blank"
|
|
13
|
+
rel="noopener"
|
|
14
|
+
>
|
|
15
|
+
<div :class="icon" />
|
|
16
|
+
</a>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style scoped>
|
|
20
|
+
.pr-social-link {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
width: 36px;
|
|
25
|
+
height: 36px;
|
|
26
|
+
color: var(--pr-c-text-2);
|
|
27
|
+
transition: color 0.5s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pr-social-link:hover {
|
|
31
|
+
color: var(--pr-c-text-1);
|
|
32
|
+
transition: color 0.25s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pr-social-link > :deep(svg) {
|
|
36
|
+
width: 20px;
|
|
37
|
+
height: 20px;
|
|
38
|
+
fill: currentColor;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { PressTheme } from '../types'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
links: PressTheme.SocialLink[]
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="pr-social-links">
|
|
11
|
+
<PressSocialLink
|
|
12
|
+
v-for="{ link, icon } in links"
|
|
13
|
+
:key="link"
|
|
14
|
+
:icon="icon"
|
|
15
|
+
:link="link"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style scoped>
|
|
21
|
+
.pr-social-links {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -1,73 +1,86 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { PageData, Post } from 'valaxy'
|
|
3
|
-
import {
|
|
3
|
+
import { useFrontmatter, useLayout, useSidebar, useSiteConfig } from 'valaxy'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import { useI18n } from 'vue-i18n'
|
|
6
|
+
import { getLocaleTitle } from '../utils'
|
|
4
7
|
|
|
5
8
|
defineProps<{
|
|
6
9
|
frontmatter: Post
|
|
7
10
|
data?: PageData
|
|
8
11
|
}>()
|
|
9
12
|
|
|
10
|
-
const
|
|
13
|
+
const siteConfig = useSiteConfig()
|
|
11
14
|
const frontmatter = useFrontmatter()
|
|
12
15
|
|
|
13
16
|
const { hasSidebar } = useSidebar()
|
|
14
17
|
const isHome = useLayout('home')
|
|
18
|
+
const layout = useLayout()
|
|
19
|
+
|
|
20
|
+
const { locale } = useI18n()
|
|
21
|
+
const localeTitle = computed(() => getLocaleTitle(locale.value, frontmatter.value))
|
|
15
22
|
</script>
|
|
16
23
|
|
|
17
24
|
<template>
|
|
18
25
|
<main
|
|
19
26
|
class="press-main flex" :class="{
|
|
20
|
-
'has-sidebar': hasSidebar,
|
|
27
|
+
'has-sidebar': hasSidebar && layout !== 'post',
|
|
21
28
|
}"
|
|
22
29
|
>
|
|
23
30
|
<div
|
|
24
31
|
w="full" flex="~" :class="{
|
|
25
32
|
'px-6 md:pl-12': hasSidebar,
|
|
33
|
+
'has-aside': !isHome,
|
|
26
34
|
}" p="t-4"
|
|
35
|
+
class="relative"
|
|
27
36
|
>
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
37
|
+
<div class="container" flex="~ grow" justify="between">
|
|
38
|
+
<slot name="main">
|
|
39
|
+
<div class="vp-doc content" w="full" :class="{ 'm-auto': !hasSidebar }" flex="~ col grow" p="lt-md:0">
|
|
40
|
+
<slot name="main-header" />
|
|
41
|
+
<slot name="main-header-after" />
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
<slot name="main-content">
|
|
44
|
+
<Transition appear>
|
|
45
|
+
<ValaxyMd class="prose mx-auto w-full max-w-4xl" :frontmatter="frontmatter">
|
|
46
|
+
<h1 v-if="hasSidebar && !isHome && frontmatter.title" :id="frontmatter.title" tabindex="-1">
|
|
47
|
+
{{ localeTitle }}
|
|
48
|
+
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true" />
|
|
49
|
+
</h1>
|
|
50
|
+
<slot name="main-content-md" />
|
|
51
|
+
<slot />
|
|
52
|
+
</ValaxyMd>
|
|
53
|
+
</Transition>
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
<PressDocFooter v-if="!isHome" class="pb-8 max-w-4xl" w="full" m="auto" />
|
|
44
56
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
<slot name="main-content-after" />
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
<slot name="main-nav-before" />
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
<slot name="main-nav" />
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
<slot name="main-nav-after" />
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
<slot v-if="siteConfig.comment.enable && frontmatter.comment !== false" name="comment" />
|
|
56
68
|
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
<slot name="footer" />
|
|
70
|
+
</slot>
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
<slot name="aside">
|
|
73
|
+
<PressAside v-if="!isHome" />
|
|
74
|
+
</slot>
|
|
75
|
+
</div>
|
|
63
76
|
</div>
|
|
64
77
|
</main>
|
|
65
78
|
</template>
|
|
66
79
|
|
|
67
|
-
<style lang="scss">
|
|
68
|
-
@use 'valaxy/client/styles/mixins' as *;
|
|
80
|
+
<style lang="scss" scoped>
|
|
81
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
69
82
|
|
|
70
|
-
@include
|
|
83
|
+
@include screen('md') {
|
|
71
84
|
.press-main {
|
|
72
85
|
&.has-sidebar {
|
|
73
86
|
padding-top: var(--pr-nav-height);
|
|
@@ -76,7 +89,7 @@ const isHome = useLayout('home')
|
|
|
76
89
|
}
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
@include
|
|
92
|
+
@include screen('xl') {
|
|
80
93
|
.content{
|
|
81
94
|
// 8px scrollbar width
|
|
82
95
|
max-width: calc(100vw - 2 * var(--va-sidebar-width) - 2.5rem);
|
package/composables/config.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ref, watch } from 'vue'
|
|
2
|
+
import { useRoute } from 'vue-router'
|
|
3
|
+
|
|
4
|
+
export function useNav() {
|
|
5
|
+
const isScreenOpen = ref(false)
|
|
6
|
+
|
|
7
|
+
function openScreen() {
|
|
8
|
+
isScreenOpen.value = true
|
|
9
|
+
window.addEventListener('resize', closeScreenOnTabletWindow)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function closeScreen() {
|
|
13
|
+
isScreenOpen.value = false
|
|
14
|
+
window.removeEventListener('resize', closeScreenOnTabletWindow)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function toggleScreen() {
|
|
18
|
+
isScreenOpen.value ? closeScreen() : openScreen()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Close screen when the user resizes the window wider than tablet size.
|
|
23
|
+
*/
|
|
24
|
+
function closeScreenOnTabletWindow() {
|
|
25
|
+
window.outerWidth >= 768 && closeScreen()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const route = useRoute()
|
|
29
|
+
watch(() => route.path, closeScreen)
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
isScreenOpen,
|
|
33
|
+
openScreen,
|
|
34
|
+
closeScreen,
|
|
35
|
+
toggleScreen,
|
|
36
|
+
}
|
|
37
|
+
}
|
package/config/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { ThemeConfig } from '../types'
|
|
2
2
|
|
|
3
|
-
export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Default Config
|
|
7
5
|
*/
|
|
8
6
|
export const defaultThemeConfig: ThemeConfig = {
|
|
7
|
+
logo: '',
|
|
9
8
|
outlineTitle: 'On this page',
|
|
10
9
|
|
|
11
10
|
colors: {
|
|
@@ -20,5 +19,9 @@ export const defaultThemeConfig: ThemeConfig = {
|
|
|
20
19
|
text: 'Edit this page on GitHub',
|
|
21
20
|
},
|
|
22
21
|
|
|
22
|
+
socialLinks: [
|
|
23
|
+
|
|
24
|
+
],
|
|
25
|
+
|
|
23
26
|
footer: {},
|
|
24
27
|
}
|
package/layouts/layout.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { useLayout, useSidebar } from 'valaxy'
|
|
2
|
+
import { asAny, useLayout, useSidebar } from 'valaxy'
|
|
3
3
|
|
|
4
4
|
const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSidebar()
|
|
5
5
|
const layout = useLayout()
|
|
@@ -16,7 +16,7 @@ const layout = useLayout()
|
|
|
16
16
|
|
|
17
17
|
<slot>
|
|
18
18
|
<router-view v-slot="{ Component }">
|
|
19
|
-
<component :is="Component">
|
|
19
|
+
<component :is="asAny(Component)">
|
|
20
20
|
<template #main-header>
|
|
21
21
|
<slot name="main-header" />
|
|
22
22
|
</template>
|
|
@@ -55,4 +55,3 @@ const layout = useLayout()
|
|
|
55
55
|
<PressFooter />
|
|
56
56
|
</div>
|
|
57
57
|
</template>
|
|
58
|
-
|
package/locales/en.yml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -19,20 +19,10 @@
|
|
|
19
19
|
"main": "node/index.ts",
|
|
20
20
|
"types": "types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@docsearch/css": "^3.
|
|
23
|
-
"@docsearch/js": "^3.
|
|
22
|
+
"@docsearch/css": "^3.5.2",
|
|
23
|
+
"@docsearch/js": "^3.5.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"valaxy": "workspace:*"
|
|
27
|
-
},
|
|
28
|
-
"pnpm": {
|
|
29
|
-
"peerDependencyRules": {
|
|
30
|
-
"ignoreMissing": [
|
|
31
|
-
"@algolia/client-search",
|
|
32
|
-
"@types/react",
|
|
33
|
-
"react",
|
|
34
|
-
"react-dom"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
27
|
}
|
|
38
28
|
}
|
package/setup/main.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { defineAppSetup } from 'valaxy'
|
|
2
2
|
import { nextTick } from 'vue'
|
|
3
3
|
|
|
4
|
+
import 'vitepress/dist/client/theme-default/styles/vars.css'
|
|
5
|
+
|
|
6
|
+
// import 'vitepress/dist/client/theme-default/styles/base.css'
|
|
7
|
+
// import 'vitepress/dist/client/theme-default/styles/utils.css'
|
|
8
|
+
// import 'vitepress/dist/client/theme-default/styles/components/vp-code.css'
|
|
9
|
+
import 'vitepress/dist/client/theme-default/styles/components/vp-code-group.css'
|
|
10
|
+
import 'vitepress/dist/client/theme-default/styles/components/vp-doc.css'
|
|
11
|
+
import 'vitepress/dist/client/theme-default/styles/components/custom-block.css'
|
|
12
|
+
|
|
13
|
+
// import 'vitepress/dist/client/theme-default/styles/components/vp-sponsor.css'
|
|
14
|
+
|
|
4
15
|
export default defineAppSetup((ctx) => {
|
|
5
16
|
const { router, isClient } = ctx
|
|
6
17
|
if (!isClient)
|
|
@@ -8,7 +19,7 @@ export default defineAppSetup((ctx) => {
|
|
|
8
19
|
|
|
9
20
|
window.addEventListener(
|
|
10
21
|
'click',
|
|
11
|
-
(e) => {
|
|
22
|
+
async (e) => {
|
|
12
23
|
const link = (e.target as Element).closest('a')
|
|
13
24
|
if (link) {
|
|
14
25
|
const { protocol, hostname, pathname, hash, target } = link
|
|
@@ -29,7 +40,9 @@ export default defineAppSetup((ctx) => {
|
|
|
29
40
|
e.preventDefault()
|
|
30
41
|
// scroll between hash anchors in the same page
|
|
31
42
|
if (hash && hash !== currentUrl.hash) {
|
|
32
|
-
|
|
43
|
+
await router.push({ hash })
|
|
44
|
+
history.replaceState({ ...history.state }, '')
|
|
45
|
+
|
|
33
46
|
// still emit the event so we can listen to it in themes
|
|
34
47
|
window.dispatchEvent(new Event('hashchange'))
|
|
35
48
|
// use smooth scroll when clicking on header anchor links
|
|
@@ -61,7 +74,7 @@ function scrollTo(el: HTMLElement, hash: string, smooth = false) {
|
|
|
61
74
|
try {
|
|
62
75
|
target = el.classList.contains('header-anchor')
|
|
63
76
|
? el
|
|
64
|
-
: (decodeURIComponent(hash) && document.querySelector(decodeURIComponent(hash))) || null
|
|
77
|
+
: ((decodeURIComponent(hash) && document.querySelector(decodeURIComponent(hash))) || null)
|
|
65
78
|
}
|
|
66
79
|
catch (e) {
|
|
67
80
|
console.warn(e)
|
package/styles/css-vars.scss
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
+
--pr-c-bg: var(--va-c-bg);
|
|
7
|
+
|
|
6
8
|
--pr-c-text-code: #374562;
|
|
7
9
|
--pr-c-text-1: #213547;
|
|
10
|
+
--pr-c-text-2: rgba(60, 60, 60, .7);
|
|
8
11
|
|
|
9
12
|
// aside
|
|
10
13
|
--pr-aside-text-1: var(--pr-c-text-1);
|
|
@@ -18,14 +21,15 @@
|
|
|
18
21
|
--pr-nav-height: var(--pr-nav-height-mobile);
|
|
19
22
|
--pr-nav-height-mobile: 60px;
|
|
20
23
|
--pr-nav-text: var(--pr-c-text-1);
|
|
24
|
+
--pr-nav-screen-bg-color: var(--pr-c-bg);
|
|
21
25
|
|
|
22
26
|
// z-index
|
|
23
|
-
--va-z-overlay: var(--pr-z-
|
|
24
|
-
--pr-z-
|
|
25
|
-
--pr-z-
|
|
26
|
-
--pr-z-
|
|
27
|
-
--pr-z-
|
|
28
|
-
--pr-z-
|
|
27
|
+
--va-z-overlay: var(--pr-z-backdrop);
|
|
28
|
+
--pr-z-local-nav: 8;
|
|
29
|
+
--pr-z-nav: 9;
|
|
30
|
+
--pr-z-backdrop: 10;
|
|
31
|
+
--pr-z-aside: 11;
|
|
32
|
+
--pr-z-sidebar: 12;
|
|
29
33
|
|
|
30
34
|
// switch
|
|
31
35
|
--pr-switch-divider: rgba(60, 60, 60, 0.29);
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
.dark {
|
|
36
40
|
--pr-c-text-code: var(--pr-c-indigo-lighter);
|
|
37
41
|
--pr-c-text-1: #ffffffde;
|
|
42
|
+
--pr-c-text-2: rgba(235, 235, 235, .6);
|
|
38
43
|
|
|
39
44
|
// aside
|
|
40
45
|
--pr-aside-text-2: #ebebeb99;
|
package/styles/markdown.scss
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
@use "valaxy/client/styles/mixins" as *;
|
|
1
|
+
@use "valaxy/client/styles/mixins/index.scss" as *;
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--va-code-mobile-margin-x: -1.5rem;
|
|
5
|
+
}
|
|
2
6
|
|
|
3
7
|
.prose {
|
|
4
8
|
--un-prose-body: var(--va-c-text);
|
|
@@ -17,10 +21,6 @@
|
|
|
17
21
|
text-decoration: none;
|
|
18
22
|
border-bottom: 1px solid transparent;
|
|
19
23
|
transition: all 0.4s;
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
border-bottom-color: var(--va-c-brand);
|
|
23
|
-
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
code:not(pre > code) {
|
|
@@ -38,12 +38,9 @@
|
|
|
38
38
|
content: none;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
margin: 0 -1.5rem;
|
|
47
|
-
}
|
|
42
|
+
ul {
|
|
43
|
+
margin-top: 0em;
|
|
44
|
+
margin-bottom: 0.25em;
|
|
48
45
|
}
|
|
49
|
-
}
|
|
46
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
// we need tsconfig.json to compile without
|
|
3
3
|
// error: This is likely not portable. A type annotation is necessary.
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"baseUrl": ".",
|
|
7
|
-
"module": "ESNext",
|
|
8
5
|
"target": "ESNext",
|
|
9
6
|
"lib": ["DOM", "ESNext"],
|
|
10
|
-
"strict": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
7
|
"jsx": "preserve",
|
|
13
|
-
"
|
|
8
|
+
"module": "ESNext",
|
|
14
9
|
"moduleResolution": "node",
|
|
15
|
-
"
|
|
16
|
-
"noUnusedLocals": true,
|
|
17
|
-
"strictNullChecks": true,
|
|
18
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"baseUrl": ".",
|
|
19
11
|
"types": [
|
|
20
12
|
"vite/client",
|
|
21
13
|
"vue/ref-macros",
|
|
22
14
|
"vite-plugin-pages/client",
|
|
23
15
|
"vite-plugin-vue-layouts/client"
|
|
24
|
-
]
|
|
16
|
+
],
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"strict": true,
|
|
22
|
+
"strictNullChecks": true,
|
|
23
|
+
"noUnusedLocals": true,
|
|
24
|
+
"skipLibCheck": true
|
|
25
25
|
},
|
|
26
26
|
"exclude": ["**/dist/**", "node_modules"]
|
|
27
27
|
}
|