valaxy-theme-press 0.0.1 → 0.0.2
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 +8 -0
- package/components/DocsBoard.vue +24 -0
- package/components/PressAside.vue +88 -0
- package/components/PressBackdrop.vue +39 -0
- package/components/PressButton.vue +38 -0
- package/components/PressCategories.vue +50 -0
- package/components/PressCategory.vue +51 -0
- package/components/PressFeature.vue +61 -0
- package/components/PressFeatures.vue +26 -0
- package/components/PressHome.vue +21 -0
- package/components/PressHomeFeatures.vue +12 -0
- package/components/PressHomeHero.vue +34 -0
- package/components/PressLocalNav.vue +109 -0
- package/components/PressNav.vue +17 -35
- package/components/PressSidebar.vue +68 -0
- package/components/PressToc.vue +137 -0
- package/components/PressToggleLocale.vue +1 -1
- package/components/ValaxyMain.vue +45 -6
- package/components/nav/PressNavBar.vue +123 -0
- package/components/nav/PressSwitchAppearance.vue +71 -0
- package/config/index.ts +1 -12
- package/layouts/404.vue +13 -12
- package/layouts/home.vue +1 -7
- package/layouts/layout.vue +49 -39
- package/node/index.ts +1 -42
- package/package.json +4 -13
- package/pages/[..all].vue +15 -0
- package/setup/main.ts +90 -0
- package/styles/css-vars.scss +43 -0
- package/styles/helper.scss +44 -0
- package/styles/index.scss +7 -0
- package/styles/markdown.scss +40 -0
- package/types/home.d.ts +5 -0
- package/types/{index.ts → index.d.ts} +3 -0
- package/valaxy.config.ts +36 -0
- package/components/PressHeader.vue +0 -26
- package/pages/index.vue +0 -8
- package/tsup.config.ts +0 -16
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
import type { Header } from 'valaxy'
|
|
5
|
+
import {
|
|
6
|
+
resolveHeaders,
|
|
7
|
+
useActiveAnchor,
|
|
8
|
+
useFrontmatter,
|
|
9
|
+
} from 'valaxy'
|
|
10
|
+
import { useThemeConfig } from '../composables'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{ headers: Header[] }>()
|
|
13
|
+
|
|
14
|
+
const frontmatter = useFrontmatter()
|
|
15
|
+
const themeConfig = useThemeConfig()
|
|
16
|
+
|
|
17
|
+
const { locale, t } = useI18n()
|
|
18
|
+
const container = ref()
|
|
19
|
+
const marker = ref()
|
|
20
|
+
|
|
21
|
+
useActiveAnchor(container, marker)
|
|
22
|
+
|
|
23
|
+
const resolvedHeaders = computed(() => {
|
|
24
|
+
return resolveHeaders(props.headers || [])
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
function handleClick({ target: el }: Event) {
|
|
28
|
+
const id = `#${(el as HTMLAnchorElement).href!.split('#')[1]}`
|
|
29
|
+
const heading = document.querySelector(decodeURIComponent(id)) as HTMLAnchorElement
|
|
30
|
+
heading?.focus()
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div v-show="headers.length" ref="container" p="t-6">
|
|
36
|
+
<div class="content">
|
|
37
|
+
<div class="outline-title">
|
|
38
|
+
{{ themeConfig.outlineTitle || t('sidebar.toc') }}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div ref="marker" class="outline-marker" />
|
|
42
|
+
|
|
43
|
+
<nav aria-labelledby="doc-outline-aria-label">
|
|
44
|
+
<span id="doc-outline-aria-label" class="visually-hidden">
|
|
45
|
+
Table of Contents for current page
|
|
46
|
+
</span>
|
|
47
|
+
|
|
48
|
+
<ul class="va-toc relative z-1">
|
|
49
|
+
<li
|
|
50
|
+
v-for="{ text, link, children, hidden, lang } in resolvedHeaders"
|
|
51
|
+
v-show="!hidden"
|
|
52
|
+
:key="link"
|
|
53
|
+
class="va-toc-item"
|
|
54
|
+
:lang="lang || locale"
|
|
55
|
+
>
|
|
56
|
+
<a class="outline-link" :href="link" @click="handleClick">
|
|
57
|
+
{{ text }}
|
|
58
|
+
</a>
|
|
59
|
+
<ul v-if="children && frontmatter.outline === 'deep'">
|
|
60
|
+
<li v-for="item in children" v-show="!item.hidden" :key="item.link" :lang="lang || locale">
|
|
61
|
+
<a class="outline-link" p="l-3" :href="link" @click="handleClick">
|
|
62
|
+
{{ item.text }}
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
</ul>
|
|
66
|
+
</li>
|
|
67
|
+
</ul>
|
|
68
|
+
</nav>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
.va-toc {
|
|
75
|
+
text-align: left;
|
|
76
|
+
|
|
77
|
+
.va-toc-item {
|
|
78
|
+
color: var(--va-c-text-light);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.content {
|
|
83
|
+
position: relative;
|
|
84
|
+
padding-left: 16px;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
text-align: left;
|
|
87
|
+
border-left: 1px solid var(--pr-aside-divider);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.outline-marker {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 32px;
|
|
93
|
+
left: -1px;
|
|
94
|
+
z-index: 0;
|
|
95
|
+
opacity: 0;
|
|
96
|
+
width: 1px;
|
|
97
|
+
height: 18px;
|
|
98
|
+
background-color: var(--va-c-brand);
|
|
99
|
+
transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s;
|
|
100
|
+
border-top-right-radius: 2px;
|
|
101
|
+
border-bottom-right-radius: 2px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.outline-title {
|
|
105
|
+
letter-spacing: 0.4px;
|
|
106
|
+
line-height: 28px;
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.outline-link {
|
|
112
|
+
display: block;
|
|
113
|
+
line-height: 28px;
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
color: var(--pr-aside-text-2);
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
transition: color 0.5s;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.outline-link:hover,
|
|
123
|
+
.outline-link.active {
|
|
124
|
+
color: var(--pr-aside-text-1);
|
|
125
|
+
transition: color 0.25s;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.visually-hidden {
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: 1px;
|
|
131
|
+
height: 1px;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
clip: rect(0 0 0 0);
|
|
134
|
+
clip-path: inset(50%);
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
@@ -7,7 +7,7 @@ const { toggleLocales } = useLocale()
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
|
-
<button
|
|
10
|
+
<button :title="t('button.toggle_langs')" @click="toggleLocales">
|
|
11
11
|
<div i-ri-translate class="transition transform" :class="locale === 'en' ? 'rotate-y-180' : ''" />
|
|
12
12
|
</button>
|
|
13
13
|
</template>
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { PageData, Post } from 'valaxy'
|
|
3
|
-
import { useConfig } from 'valaxy'
|
|
3
|
+
import { useConfig, useFrontmatter, useLayout, useSidebar } from 'valaxy'
|
|
4
4
|
|
|
5
5
|
defineProps<{
|
|
6
6
|
frontmatter: Post
|
|
7
7
|
data?: PageData
|
|
8
8
|
}>()
|
|
9
|
+
|
|
9
10
|
const config = useConfig()
|
|
11
|
+
const frontmatter = useFrontmatter()
|
|
12
|
+
|
|
13
|
+
const { hasSidebar } = useSidebar()
|
|
14
|
+
const isHome = useLayout('home')
|
|
10
15
|
</script>
|
|
11
16
|
|
|
12
17
|
<template>
|
|
13
|
-
<main
|
|
14
|
-
|
|
18
|
+
<main
|
|
19
|
+
class="press-main flex" :class="{
|
|
20
|
+
'has-sidebar': hasSidebar,
|
|
21
|
+
}"
|
|
22
|
+
>
|
|
23
|
+
<div w="full" flex="~" p="t-8 x-6 md:x-8">
|
|
15
24
|
<slot name="main">
|
|
16
|
-
<div class="content" flex="~ col grow" w="full" p="
|
|
25
|
+
<div class="content" m="auto y-0" flex="~ col grow" w="full" p="x-12 lt-md:0">
|
|
17
26
|
<slot name="main-header" />
|
|
18
27
|
<slot name="main-header-after" />
|
|
19
28
|
|
|
20
29
|
<slot name="main-content">
|
|
21
30
|
<div class="markdown-body prose max-w-none pb-8">
|
|
22
31
|
<ValaxyMd :frontmatter="frontmatter">
|
|
32
|
+
<h1 v-if="!isHome && frontmatter.title" :id="frontmatter.title" tabindex="-1">
|
|
33
|
+
{{ frontmatter.title }}
|
|
34
|
+
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true">#</a>
|
|
35
|
+
</h1>
|
|
23
36
|
<slot name="main-content-md" />
|
|
24
37
|
<slot />
|
|
25
38
|
</ValaxyMd>
|
|
@@ -38,8 +51,34 @@ const config = useConfig()
|
|
|
38
51
|
|
|
39
52
|
<slot name="footer" />
|
|
40
53
|
</slot>
|
|
41
|
-
</div>
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
<slot name="aside">
|
|
56
|
+
<PressAside v-if="!isHome" />
|
|
57
|
+
</slot>
|
|
58
|
+
</div>
|
|
44
59
|
</main>
|
|
45
60
|
</template>
|
|
61
|
+
|
|
62
|
+
<style lang="scss">
|
|
63
|
+
@use 'valaxy/client/styles/mixins' as *;
|
|
64
|
+
|
|
65
|
+
@include media('md') {
|
|
66
|
+
.press-main {
|
|
67
|
+
&.has-sidebar {
|
|
68
|
+
padding-top: var(--pr-nav-height);
|
|
69
|
+
padding-left: var(--va-sidebar-width);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@include media('xl') {
|
|
75
|
+
.content{
|
|
76
|
+
// 8px scrollbar width
|
|
77
|
+
max-width: calc(100vw - 2 * var(--va-sidebar-width) - 2.5rem);
|
|
78
|
+
|
|
79
|
+
&.no-aside {
|
|
80
|
+
max-width: calc(100vw - var(--va-sidebar-width));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useConfig, useSidebar } from 'valaxy'
|
|
3
|
+
import { useThemeConfig } from '../../composables'
|
|
4
|
+
import PressSwitchAppearance from './PressSwitchAppearance.vue'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
isScreenOpen?: boolean
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
defineEmits<{
|
|
11
|
+
(e: 'toggle-screen'): void
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const { hasSidebar } = useSidebar()
|
|
15
|
+
|
|
16
|
+
const config = useConfig()
|
|
17
|
+
const themeConfig = useThemeConfig()
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="press-navbar flex justify-between items-center px-6 py-4" :class="{ 'has-sidebar': hasSidebar }">
|
|
22
|
+
<a class="text-xl" href="/" :aria-label="config.title">
|
|
23
|
+
<span class="md:inline">{{ config.title }}</span>
|
|
24
|
+
</a>
|
|
25
|
+
<div class="flex justify-center items-centertext-sm leading-5">
|
|
26
|
+
<template v-for="(item, i) in themeConfig.nav" :key="i">
|
|
27
|
+
<a
|
|
28
|
+
class="hover:text-gray-700"
|
|
29
|
+
:href="item.link"
|
|
30
|
+
target="_blank"
|
|
31
|
+
rel="noopener"
|
|
32
|
+
>{{ item.text }}</a>
|
|
33
|
+
|
|
34
|
+
<span v-if="i !== themeConfig.nav.length - 1" class="mr-2 ml-2">·</span>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<PressToggleLocale m="x-2" />
|
|
38
|
+
<PressSwitchAppearance m="l-2" />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
@use 'valaxy/client/styles/mixins' as *;
|
|
45
|
+
|
|
46
|
+
.press-navbar {
|
|
47
|
+
position: relative;
|
|
48
|
+
border-bottom: 1px solid var(--pr-c-divider-light);
|
|
49
|
+
padding: 0 8px 0 24px;
|
|
50
|
+
height: var(--pr-nav-height);
|
|
51
|
+
transition: border-color 0.5s, background-color 0.5s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include media('md') {
|
|
55
|
+
.press-navbar {
|
|
56
|
+
padding: 0 32px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@include media('md') {
|
|
61
|
+
.press-navbar.has-sidebar .content {
|
|
62
|
+
margin-right: -32px;
|
|
63
|
+
padding-right: 32px;
|
|
64
|
+
-webkit-backdrop-filter: saturate(50%) blur(8px);
|
|
65
|
+
backdrop-filter: saturate(50%) blur(8px);
|
|
66
|
+
background: rgba(255, 255, 255, 0.7);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.dark .press-navbar.has-sidebar .content {
|
|
70
|
+
background: rgba(36, 36, 36, 0.7);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@supports not (backdrop-filter: saturate(50%) blur(8px)) {
|
|
74
|
+
.press-navbar.has-sidebar .content {
|
|
75
|
+
background: rgba(255, 255, 255, 0.95);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dark .press-navbar.has-sidebar .content {
|
|
79
|
+
background: rgba(36, 36, 36, 0.95);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.container {
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
margin: 0 auto;
|
|
88
|
+
max-width: calc(var(--pr-layout-max-width) - 64px);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.content {
|
|
92
|
+
display: flex;
|
|
93
|
+
justify-content: flex-end;
|
|
94
|
+
align-items: center;
|
|
95
|
+
flex-grow: 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.menu + .translations::before,
|
|
99
|
+
.menu + .appearance::before,
|
|
100
|
+
.menu + .social-links::before,
|
|
101
|
+
.translations + .appearance::before,
|
|
102
|
+
.appearance + .social-links::before {
|
|
103
|
+
margin-right: 8px;
|
|
104
|
+
margin-left: 8px;
|
|
105
|
+
width: 1px;
|
|
106
|
+
height: 24px;
|
|
107
|
+
background-color: var(--pr-c-divider-light);
|
|
108
|
+
content: "";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.menu + .appearance::before,
|
|
112
|
+
.translations + .appearance::before {
|
|
113
|
+
margin-right: 16px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.appearance + .social-links::before {
|
|
117
|
+
margin-left: 16px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.social-links {
|
|
121
|
+
margin-right: -8px;
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { isDark, toggleDark } from 'valaxy'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<button class="switch switch-appearance" type="button" aria-label="Toggle Dark Mode" @click="toggleDark()">
|
|
7
|
+
<span class="check">
|
|
8
|
+
<span class="icon-wrap">
|
|
9
|
+
<div v-if="!isDark" class="icon" i-ri-sun-line />
|
|
10
|
+
<div v-else class="icon" i-ri-moon-line />
|
|
11
|
+
</span>
|
|
12
|
+
</span>
|
|
13
|
+
</button>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style lang="scss" scoped>
|
|
17
|
+
.switch {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: block;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 40px;
|
|
22
|
+
height: 22px;
|
|
23
|
+
border-radius: 11px;
|
|
24
|
+
border: 1px solid var(--pr-switch-divider);
|
|
25
|
+
background-color: var(--pr-switch-bg);
|
|
26
|
+
transition: border-color 0.25s, background-color 0.25s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.switch:hover {
|
|
30
|
+
border-color: #8e8e8e;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.check {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 1px;
|
|
36
|
+
left: 1px;
|
|
37
|
+
width: 18px;
|
|
38
|
+
height: 18px;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
background-color: #ffffff;
|
|
41
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
42
|
+
transition: background-color 0.25s, transform 0.25s;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dark .check {
|
|
46
|
+
background-color: #1a1a1a;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon-wrap {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
display: block;
|
|
52
|
+
padding: 3px;
|
|
53
|
+
width: 18px;
|
|
54
|
+
height: 18px;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon {
|
|
59
|
+
width: 12px;
|
|
60
|
+
height: 12px;
|
|
61
|
+
background-color: rgba(60, 60, 60, 0.7);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dark .icon {
|
|
65
|
+
background-color: rgba(255, 255, 255, 0.87);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dark .switch-appearance :deep(.check) {
|
|
69
|
+
transform: translateX(18px);
|
|
70
|
+
}
|
|
71
|
+
</style>
|
package/config/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ThemeConfig
|
|
1
|
+
import type { ThemeConfig } from '../types'
|
|
2
2
|
|
|
3
3
|
export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
|
|
4
4
|
|
|
@@ -16,14 +16,3 @@ export const defaultThemeConfig: ThemeConfig = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default defaultThemeConfig
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* generateSafelist by config
|
|
22
|
-
* @param themeConfig
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
-
export function generateSafelist(themeConfig: ThemeUserConfig) {
|
|
27
|
-
const safelist: string[] = []
|
|
28
|
-
return safelist
|
|
29
|
-
}
|
package/layouts/404.vue
CHANGED
|
@@ -8,18 +8,19 @@ const { t } = useI18n()
|
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
10
|
<Layout>
|
|
11
|
-
<template #
|
|
12
|
-
<div
|
|
13
|
-
<div text-4xl>
|
|
14
|
-
<div i-ri-alarm-warning-line inline-block />
|
|
15
|
-
</div>
|
|
16
|
-
<router-view />
|
|
17
|
-
<div>
|
|
18
|
-
<button btn text-sm m="3 t8" @click="router.back()">
|
|
19
|
-
{{ t('button.back') }}
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
11
|
+
<template #sidebar>
|
|
12
|
+
<div />
|
|
23
13
|
</template>
|
|
14
|
+
<div text="center" m="t-20">
|
|
15
|
+
<div text-4xl>
|
|
16
|
+
<div i-ri-alarm-warning-line inline-block />
|
|
17
|
+
</div>
|
|
18
|
+
<router-view />
|
|
19
|
+
<div>
|
|
20
|
+
<button btn text-sm m="3 t8" @click="router.back()">
|
|
21
|
+
{{ t('button.back') }}
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
24
25
|
</Layout>
|
|
25
26
|
</template>
|
package/layouts/home.vue
CHANGED
package/layouts/layout.vue
CHANGED
|
@@ -1,45 +1,55 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useSidebar } from 'valaxy/client'
|
|
3
|
+
|
|
4
|
+
const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSidebar()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
1
7
|
<template>
|
|
2
|
-
<div class="antialiased">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
<div class="layout antialiased">
|
|
9
|
+
<PressNav />
|
|
10
|
+
<PressLocalNav :open="isSidebarOpen" @open-menu="openSidebar()" />
|
|
11
|
+
<slot name="sidebar">
|
|
12
|
+
<PressSidebar :open="isSidebarOpen" />
|
|
13
|
+
</slot>
|
|
14
|
+
<PressBackdrop :show="isSidebarOpen" @click="closeSidebar" />
|
|
6
15
|
|
|
7
|
-
<
|
|
8
|
-
<slot>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
</template>
|
|
16
|
+
<slot>
|
|
17
|
+
<router-view v-slot="{ Component }">
|
|
18
|
+
<component :is="Component">
|
|
19
|
+
<template #main-header>
|
|
20
|
+
<slot name="main-header" />
|
|
21
|
+
</template>
|
|
14
22
|
|
|
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
|
-
|
|
23
|
+
<template #main-header-after>
|
|
24
|
+
<slot name="main-header-after" />
|
|
25
|
+
</template>
|
|
26
|
+
<template #main>
|
|
27
|
+
<slot name="main" />
|
|
28
|
+
</template>
|
|
29
|
+
<template #main-content>
|
|
30
|
+
<slot name="main-content" />
|
|
31
|
+
</template>
|
|
32
|
+
<template #main-content-after>
|
|
33
|
+
<slot name="main-content-after" />
|
|
34
|
+
</template>
|
|
35
|
+
<template #main-nav-before>
|
|
36
|
+
<slot name="main-nav-before" />
|
|
37
|
+
</template>
|
|
38
|
+
<template #main-nav-after>
|
|
39
|
+
<slot name="main-nav-after" />
|
|
40
|
+
</template>
|
|
41
|
+
<template #aside>
|
|
42
|
+
<slot name="aside" />
|
|
43
|
+
</template>
|
|
44
|
+
<template #aside-custom>
|
|
45
|
+
<slot name="aside-custom" />
|
|
46
|
+
</template>
|
|
47
|
+
<template #footer>
|
|
48
|
+
<slot name="footer" />
|
|
49
|
+
</template>
|
|
50
|
+
</component>
|
|
51
|
+
</router-view>
|
|
52
|
+
</slot>
|
|
43
53
|
</div>
|
|
44
54
|
</template>
|
|
45
55
|
|
package/node/index.ts
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import { defineThemePlugin } from 'valaxy'
|
|
2
|
-
import type { ResolvedValaxyOptions } from 'valaxy'
|
|
3
|
-
import type { Plugin } from 'vite'
|
|
4
|
-
|
|
5
1
|
export * from '../config'
|
|
6
|
-
export * from '../types'
|
|
7
|
-
|
|
8
|
-
export interface UserOptions {
|
|
9
|
-
colors: {
|
|
10
|
-
primary: string
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function ThemeYunVitePlugin(options: ResolvedValaxyOptions): Plugin {
|
|
15
|
-
const themeConfig = options.config.themeConfig
|
|
16
|
-
return {
|
|
17
|
-
name: 'valaxy-theme-yun',
|
|
18
|
-
enforce: 'pre',
|
|
19
|
-
config() {
|
|
20
|
-
return {
|
|
21
|
-
css: {
|
|
22
|
-
preprocessorOptions: {
|
|
23
|
-
scss: {
|
|
24
|
-
additionalData: `$c-primary: ${themeConfig.colors?.primary || '#0078E7'} !default;`,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
optimizeDeps: {
|
|
30
|
-
exclude: ['@docsearch/js'],
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default defineThemePlugin((options) => {
|
|
38
|
-
return {
|
|
39
|
-
vite: {
|
|
40
|
-
plugins: [ThemeYunVitePlugin(options)],
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
})
|
|
2
|
+
export * from '../types/index.d'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -14,24 +14,15 @@
|
|
|
14
14
|
"url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-theme-press"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"require": "./dist/index.js",
|
|
19
|
-
"import": "./dist/index.mjs"
|
|
20
|
-
},
|
|
21
17
|
"./*": "./*"
|
|
22
18
|
},
|
|
23
|
-
"main": "
|
|
24
|
-
"
|
|
25
|
-
"types": "dist/index.d.ts",
|
|
19
|
+
"main": "node/index.ts",
|
|
20
|
+
"types": "types/index.d.ts",
|
|
26
21
|
"dependencies": {
|
|
27
22
|
"@docsearch/css": "^3.1.1",
|
|
28
23
|
"@docsearch/js": "^3.1.1"
|
|
29
24
|
},
|
|
30
25
|
"devDependencies": {
|
|
31
|
-
"valaxy": "0.
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "rimraf dist && tsup",
|
|
35
|
-
"dev": "tsup --watch"
|
|
26
|
+
"valaxy": "0.10.0"
|
|
36
27
|
}
|
|
37
28
|
}
|