valaxy-theme-press 0.0.2 → 0.0.4
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/client/index.ts +1 -0
- package/components/PressAlgoliaSearch.vue +208 -0
- package/components/PressArticle.vue +27 -16
- package/components/PressArticleCard.vue +6 -2
- package/components/PressAside.vue +38 -27
- package/components/PressBackdrop.vue +1 -1
- package/components/PressButton.vue +5 -12
- package/components/PressCategories.vue +24 -3
- package/components/PressCategory.vue +24 -15
- package/components/PressDocFooter.vue +15 -0
- package/components/PressDocFooterLastUpdated.vue +44 -0
- package/components/PressFeature.vue +1 -1
- package/components/PressFeatures.vue +1 -1
- package/components/PressFooter.vue +53 -0
- package/components/PressHome.vue +1 -7
- package/components/PressHomeFeatures.vue +1 -0
- package/components/PressHomeHero.vue +7 -8
- 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/PressNavItemGroup.vue +101 -0
- package/components/PressNavItemLink.vue +40 -0
- 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/{PressToc.vue → PressOutline.vue} +14 -39
- package/components/PressOutlineItem.vue +48 -0
- package/components/PressPostList.vue +3 -3
- package/components/PressSidebar.vue +31 -10
- package/components/PressSocialLink.vue +40 -0
- package/components/PressSocialLinks.vue +26 -0
- package/components/ValaxyMain.vue +60 -42
- package/composables/edit-link.ts +14 -0
- package/composables/index.ts +1 -0
- package/composables/nav.ts +37 -0
- package/config/index.ts +13 -2
- package/layouts/layout.vue +5 -3
- package/package.json +15 -5
- package/pages/[..all].vue +1 -0
- package/setup/main.ts +5 -4
- package/styles/css-vars.scss +16 -8
- package/styles/helper.scss +0 -10
- package/styles/markdown.scss +18 -8
- package/types/index.d.ts +76 -22
- package/utils/index.ts +9 -0
- package/valaxy.config.ts +7 -0
- package/LICENSE +0 -21
- package/components/DocsBoard.vue +0 -24
- package/components/nav/PressNavBar.vue +0 -123
- /package/components/{nav/PressSwitchAppearance.vue → PressSwitchAppearance.vue} +0 -0
|
@@ -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,68 +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
|
-
<div
|
|
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
|
-
|
|
30
|
+
<div
|
|
31
|
+
w="full" flex="~" :class="{
|
|
32
|
+
'px-6 md:pl-12': hasSidebar,
|
|
33
|
+
'has-aside': !isHome,
|
|
34
|
+
}" p="t-4"
|
|
35
|
+
class="relative"
|
|
36
|
+
>
|
|
37
|
+
<div class="container" flex="~ grow" justify="between">
|
|
38
|
+
<slot name="main">
|
|
39
|
+
<div class="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" />
|
|
42
|
+
|
|
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">#</a>
|
|
49
|
+
</h1>
|
|
50
|
+
<slot name="main-content-md" />
|
|
51
|
+
<slot />
|
|
52
|
+
</ValaxyMd>
|
|
53
|
+
</Transition>
|
|
54
|
+
|
|
55
|
+
<PressDocFooter v-if="!isHome" class="pb-8 max-w-4xl" w="full" m="auto" />
|
|
56
|
+
|
|
57
|
+
<slot name="main-content-after" />
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<slot name="main-nav-before" />
|
|
62
|
+
|
|
63
|
+
<slot name="main-nav" />
|
|
64
|
+
|
|
65
|
+
<slot name="main-nav-after" />
|
|
66
|
+
|
|
67
|
+
<slot v-if="siteConfig.comment.enable && frontmatter.comment !== false" name="comment" />
|
|
68
|
+
|
|
69
|
+
<slot name="footer" />
|
|
70
|
+
</slot>
|
|
71
|
+
|
|
72
|
+
<slot name="aside">
|
|
73
|
+
<PressAside v-if="!isHome" />
|
|
74
|
+
</slot>
|
|
75
|
+
</div>
|
|
58
76
|
</div>
|
|
59
77
|
</main>
|
|
60
78
|
</template>
|
|
61
79
|
|
|
62
|
-
<style lang="scss">
|
|
63
|
-
@use 'valaxy/client/styles/mixins' as *;
|
|
80
|
+
<style lang="scss" scoped>
|
|
81
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
64
82
|
|
|
65
|
-
@include
|
|
83
|
+
@include screen('md') {
|
|
66
84
|
.press-main {
|
|
67
85
|
&.has-sidebar {
|
|
68
86
|
padding-top: var(--pr-nav-height);
|
|
@@ -71,7 +89,7 @@ const isHome = useLayout('home')
|
|
|
71
89
|
}
|
|
72
90
|
}
|
|
73
91
|
|
|
74
|
-
@include
|
|
92
|
+
@include screen('xl') {
|
|
75
93
|
.content{
|
|
76
94
|
// 8px scrollbar width
|
|
77
95
|
max-width: calc(100vw - 2 * var(--va-sidebar-width) - 2.5rem);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useData } from 'valaxy'
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useThemeConfig } from '.'
|
|
4
|
+
|
|
5
|
+
export function useEditLink() {
|
|
6
|
+
const themeConfig = useThemeConfig()
|
|
7
|
+
return computed(() => {
|
|
8
|
+
const { text = 'Edit this page', pattern } = themeConfig.value.editLink || {}
|
|
9
|
+
const { relativePath } = useData()
|
|
10
|
+
const url = pattern.replace(/:path/g, relativePath)
|
|
11
|
+
|
|
12
|
+
return { url, text }
|
|
13
|
+
})
|
|
14
|
+
}
|
package/composables/index.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
|
@@ -6,13 +6,24 @@ export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
|
|
|
6
6
|
* Default Config
|
|
7
7
|
*/
|
|
8
8
|
export const defaultThemeConfig: ThemeConfig = {
|
|
9
|
+
logo: '',
|
|
9
10
|
outlineTitle: 'On this page',
|
|
10
11
|
|
|
11
12
|
colors: {
|
|
12
13
|
primary: '#0078E7',
|
|
13
14
|
},
|
|
14
15
|
|
|
16
|
+
sidebar: [],
|
|
15
17
|
nav: [],
|
|
16
|
-
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
editLink: {
|
|
20
|
+
pattern: 'https://github.com/YunYouJun/valaxy/edit/main/docs/:path',
|
|
21
|
+
text: 'Edit this page on GitHub',
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
socialLinks: [
|
|
25
|
+
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
footer: {},
|
|
29
|
+
}
|
package/layouts/layout.vue
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { useSidebar } from 'valaxy
|
|
2
|
+
import { useLayout, useSidebar } from 'valaxy'
|
|
3
3
|
|
|
4
4
|
const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSidebar()
|
|
5
|
+
const layout = useLayout()
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<template>
|
|
@@ -9,7 +10,7 @@ const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSid
|
|
|
9
10
|
<PressNav />
|
|
10
11
|
<PressLocalNav :open="isSidebarOpen" @open-menu="openSidebar()" />
|
|
11
12
|
<slot name="sidebar">
|
|
12
|
-
<PressSidebar :open="isSidebarOpen" />
|
|
13
|
+
<PressSidebar v-if="layout !== 'post'" :open="isSidebarOpen" />
|
|
13
14
|
</slot>
|
|
14
15
|
<PressBackdrop :show="isSidebarOpen" @click="closeSidebar" />
|
|
15
16
|
|
|
@@ -50,6 +51,7 @@ const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSid
|
|
|
50
51
|
</component>
|
|
51
52
|
</router-view>
|
|
52
53
|
</slot>
|
|
54
|
+
|
|
55
|
+
<PressFooter />
|
|
53
56
|
</div>
|
|
54
57
|
</template>
|
|
55
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -19,10 +19,20 @@
|
|
|
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.3.3",
|
|
23
|
+
"@docsearch/js": "^3.3.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"valaxy": "
|
|
26
|
+
"valaxy": "workspace:*"
|
|
27
|
+
},
|
|
28
|
+
"pnpm": {
|
|
29
|
+
"peerDependencyRules": {
|
|
30
|
+
"ignoreMissing": [
|
|
31
|
+
"@algolia/client-search",
|
|
32
|
+
"@types/react",
|
|
33
|
+
"react",
|
|
34
|
+
"react-dom"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
|
-
}
|
|
38
|
+
}
|
package/pages/[..all].vue
CHANGED
package/setup/main.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default defineAppSetup((ctx) => {
|
|
|
8
8
|
|
|
9
9
|
window.addEventListener(
|
|
10
10
|
'click',
|
|
11
|
-
(e) => {
|
|
11
|
+
async (e) => {
|
|
12
12
|
const link = (e.target as Element).closest('a')
|
|
13
13
|
if (link) {
|
|
14
14
|
const { protocol, hostname, pathname, hash, target } = link
|
|
@@ -29,7 +29,9 @@ export default defineAppSetup((ctx) => {
|
|
|
29
29
|
e.preventDefault()
|
|
30
30
|
// scroll between hash anchors in the same page
|
|
31
31
|
if (hash && hash !== currentUrl.hash) {
|
|
32
|
-
|
|
32
|
+
await router.push({ hash })
|
|
33
|
+
history.replaceState({ ...history.state }, '')
|
|
34
|
+
|
|
33
35
|
// still emit the event so we can listen to it in themes
|
|
34
36
|
window.dispatchEvent(new Event('hashchange'))
|
|
35
37
|
// use smooth scroll when clicking on header anchor links
|
|
@@ -58,11 +60,10 @@ export default defineAppSetup((ctx) => {
|
|
|
58
60
|
|
|
59
61
|
function scrollTo(el: HTMLElement, hash: string, smooth = false) {
|
|
60
62
|
let target: Element | null = null
|
|
61
|
-
|
|
62
63
|
try {
|
|
63
64
|
target = el.classList.contains('header-anchor')
|
|
64
65
|
? el
|
|
65
|
-
: document.querySelector(decodeURIComponent(hash))
|
|
66
|
+
: ((decodeURIComponent(hash) && document.querySelector(decodeURIComponent(hash))) || null)
|
|
66
67
|
}
|
|
67
68
|
catch (e) {
|
|
68
69
|
console.warn(e)
|
package/styles/css-vars.scss
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
+
--pr-c-bg: var(--va-c-bg);
|
|
7
|
+
|
|
6
8
|
--pr-c-text-code: #374562;
|
|
9
|
+
--pr-c-text-1: #213547;
|
|
10
|
+
--pr-c-text-2: rgba(60, 60, 60, .7);
|
|
7
11
|
|
|
8
12
|
// aside
|
|
9
|
-
--pr-aside-text-1:
|
|
10
|
-
--pr-aside-text-2:
|
|
13
|
+
--pr-aside-text-1: var(--pr-c-text-1);
|
|
14
|
+
--pr-aside-text-2: rgba(60, 60, 60, 0.702);
|
|
11
15
|
|
|
12
16
|
--pr-aside-divider: rgba(60, 60, 60, 0.122);
|
|
13
17
|
|
|
@@ -16,13 +20,16 @@
|
|
|
16
20
|
// nav
|
|
17
21
|
--pr-nav-height: var(--pr-nav-height-mobile);
|
|
18
22
|
--pr-nav-height-mobile: 60px;
|
|
23
|
+
--pr-nav-text: var(--pr-c-text-1);
|
|
24
|
+
--pr-nav-screen-bg-color: var(--pr-c-bg);
|
|
19
25
|
|
|
20
26
|
// z-index
|
|
21
|
-
--va-z-overlay: var(--pr-z-
|
|
22
|
-
--pr-z-
|
|
23
|
-
--pr-z-
|
|
24
|
-
--pr-z-
|
|
25
|
-
--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;
|
|
26
33
|
|
|
27
34
|
// switch
|
|
28
35
|
--pr-switch-divider: rgba(60, 60, 60, 0.29);
|
|
@@ -31,9 +38,10 @@
|
|
|
31
38
|
|
|
32
39
|
.dark {
|
|
33
40
|
--pr-c-text-code: var(--pr-c-indigo-lighter);
|
|
41
|
+
--pr-c-text-1: #ffffffde;
|
|
42
|
+
--pr-c-text-2: rgba(235, 235, 235, .6);
|
|
34
43
|
|
|
35
44
|
// aside
|
|
36
|
-
--pr-aside-text-1: #ffffffde;
|
|
37
45
|
--pr-aside-text-2: #ebebeb99;
|
|
38
46
|
--pr-aside-divider: rgba(84, 84, 84, 0.48);
|
|
39
47
|
|
package/styles/helper.scss
CHANGED
|
@@ -28,17 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
border-radius: 50%;
|
|
30
30
|
|
|
31
|
-
transition: background-color var(--va-transition-duration);
|
|
32
|
-
|
|
33
31
|
div {
|
|
34
32
|
font-size: 1.2rem;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
&:hover {
|
|
38
|
-
background-color: rgba(var(--va-c-primary-rgb), 0.08);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:active {
|
|
42
|
-
background-color: rgba(var(--va-c-primary-rgb), 0.16);
|
|
43
|
-
}
|
|
44
34
|
}
|
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);
|
|
@@ -13,12 +17,13 @@
|
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
a {
|
|
20
|
+
display: inline-block;
|
|
16
21
|
text-decoration: none;
|
|
17
22
|
border-bottom: 1px solid transparent;
|
|
18
23
|
transition: all 0.4s;
|
|
19
24
|
|
|
20
25
|
&:hover {
|
|
21
|
-
border-bottom-color: var(--va-c-brand);
|
|
26
|
+
// border-bottom-color: var(--va-c-brand);
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
|
|
@@ -28,13 +33,18 @@
|
|
|
28
33
|
padding: 3px 6px;
|
|
29
34
|
border-radius: 4px;
|
|
30
35
|
font-weight: 500;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
div[class*="language-"] {
|
|
37
|
-
margin: 0 -1.5rem;
|
|
37
|
+
&::before {
|
|
38
|
+
content: none;
|
|
38
39
|
}
|
|
40
|
+
|
|
41
|
+
&::after {
|
|
42
|
+
content: none;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ul {
|
|
47
|
+
margin-top: 0em;
|
|
48
|
+
margin-bottom: 0.25em;
|
|
39
49
|
}
|
|
40
50
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,33 +1,87 @@
|
|
|
1
1
|
export * from '../composables'
|
|
2
2
|
export * from './home.d'
|
|
3
3
|
|
|
4
|
-
export namespace
|
|
5
|
-
export type Config = ThemeConfig
|
|
4
|
+
export namespace PressTheme {
|
|
6
5
|
export type Sidebar = any
|
|
7
|
-
}
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
export interface Footer {
|
|
8
|
+
message?: string;
|
|
9
|
+
copyright?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SocialLink {
|
|
13
|
+
icon: string
|
|
14
|
+
link: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface EditLink {
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Pattern for edit link.
|
|
20
|
+
*
|
|
21
|
+
* @example 'https://github.com/YunYouJun/valaxy/edit/main/docs/:path'
|
|
23
22
|
*/
|
|
24
|
-
|
|
23
|
+
pattern: string
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Custom text for edit link.
|
|
27
|
+
*
|
|
28
|
+
* @default 'Edit this page'
|
|
29
|
+
*/
|
|
30
|
+
text?: string
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
export interface Config {
|
|
34
|
+
logo: string
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* toc title
|
|
38
|
+
* @default 'On this page'
|
|
39
|
+
*/
|
|
40
|
+
outlineTitle: string
|
|
41
|
+
|
|
42
|
+
colors: {
|
|
43
|
+
/**
|
|
44
|
+
* primary color
|
|
45
|
+
* @default '#0078E7'
|
|
46
|
+
*/
|
|
47
|
+
primary: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
nav: Array<NavItem>
|
|
52
|
+
sidebar: string[]
|
|
53
|
+
|
|
54
|
+
editLink: EditLink
|
|
55
|
+
|
|
56
|
+
footer: Footer
|
|
57
|
+
|
|
58
|
+
socialLinks: SocialLink[]
|
|
59
|
+
|
|
60
|
+
// label
|
|
61
|
+
/**
|
|
62
|
+
* Toggle dark label
|
|
63
|
+
*/
|
|
64
|
+
darkModeSwitchLabel?: string
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface NavItemLink {
|
|
69
|
+
link: string
|
|
70
|
+
text: string
|
|
71
|
+
active?: string
|
|
31
72
|
}
|
|
32
73
|
|
|
33
|
-
export
|
|
74
|
+
export interface NavItemGroup {
|
|
75
|
+
text: string
|
|
76
|
+
items: NavItemLink[]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type NavItem = NavItemLink | NavItemGroup
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Theme Config
|
|
85
|
+
*/
|
|
86
|
+
export type ThemeConfig = PressTheme.Config
|
|
87
|
+
export type UserThemeConfig = Partial<ThemeConfig>
|
package/utils/index.ts
ADDED
package/valaxy.config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ResolvedValaxyOptions } from 'valaxy'
|
|
2
2
|
import { defineTheme } from 'valaxy'
|
|
3
3
|
import type { Plugin } from 'vite'
|
|
4
|
+
import { defaultThemeConfig } from './config'
|
|
4
5
|
import type { ThemeConfig } from './types'
|
|
5
6
|
|
|
6
7
|
function ThemeVitePlugin(options: ResolvedValaxyOptions<ThemeConfig>): Plugin {
|
|
@@ -29,7 +30,13 @@ function ThemeVitePlugin(options: ResolvedValaxyOptions<ThemeConfig>): Plugin {
|
|
|
29
30
|
|
|
30
31
|
export default defineTheme<ThemeConfig>((options) => {
|
|
31
32
|
return {
|
|
33
|
+
themeConfig: defaultThemeConfig,
|
|
32
34
|
vite: {
|
|
35
|
+
build: {
|
|
36
|
+
rollupOptions: {
|
|
37
|
+
external: ['valaxy-addon-algolia'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
33
40
|
plugins: [ThemeVitePlugin(options)],
|
|
34
41
|
},
|
|
35
42
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 云游君 YunYouJun <me@yunyoujun.cn>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|