valaxy-theme-press 0.0.4 → 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/PressAside.vue +1 -6
- package/components/PressButton.vue +5 -1
- package/components/PressCategories.vue +8 -3
- package/components/PressCategory.vue +1 -1
- package/components/PressDocFooterLastUpdated.vue +2 -1
- package/components/PressHomeHero.vue +5 -2
- package/components/PressNavBarSearch.vue +1 -1
- package/components/PressNavItemGroup.vue +6 -3
- package/components/PressOutline.vue +2 -4
- package/components/PressPostList.vue +3 -3
- package/components/ValaxyMain.vue +2 -2
- package/composables/config.ts +0 -1
- package/config/index.ts +0 -2
- package/layouts/layout.vue +2 -2
- package/locales/en.yml +4 -0
- package/locales/zh-CN.yml +4 -0
- package/package.json +3 -13
- package/setup/main.ts +11 -0
- package/styles/markdown.scss +0 -4
- package/tsconfig.json +11 -11
- package/types/index.d.ts +4 -5
- package/utils/index.ts +0 -1
- package/valaxy.config.ts +0 -5
- /package/pages/{[..all].vue → [...all].vue} +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This is a theme for valaxy docs.
|
|
4
4
|
|
|
5
|
+
Inspired by [vitepress](https://vitepress.dev).
|
|
6
|
+
|
|
7
|
+
我开发此主题以编写 Valaxy 的初期文档,同时以便发现 valaxy 编写主题中的痛点。
|
|
8
|
+
<!-- 它增加了 VitePress 一些所没有的功能,而随着 VitePress 的完善,该主题将不再被维护,文档也将在未来迁移至 VitePress。 -->
|
|
9
|
+
|
|
10
|
+
- [预览](https://press.valaxy.site)
|
|
11
|
+
|
|
5
12
|
## Reference
|
|
6
13
|
|
|
7
14
|
- [vitepress](https://vitepress.vuejs.org/)
|
|
Binary file
|
|
@@ -18,8 +18,7 @@ const app = useAppStore()
|
|
|
18
18
|
<ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
|
|
19
19
|
|
|
20
20
|
<aside
|
|
21
|
-
class="press-aside lt-xl:fixed shadow
|
|
22
|
-
press-card xl:(shadow-none hover:shadow-none) hover:shadow-lg"
|
|
21
|
+
class="press-aside lt-xl:fixed shadow xl:(shadow-none hover:shadow-none) hover:shadow-lg"
|
|
23
22
|
flex="~ col grow"
|
|
24
23
|
p="l-0 xl:l-8" text="center"
|
|
25
24
|
z="$"
|
|
@@ -41,10 +40,6 @@ const app = useAppStore()
|
|
|
41
40
|
<style lang="scss">
|
|
42
41
|
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
43
42
|
|
|
44
|
-
.press-card{
|
|
45
|
-
background-color: var(--va-c-bg);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
43
|
.press-aside {
|
|
49
44
|
top: 0;
|
|
50
45
|
bottom: 0;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
|
|
4
|
+
import { useI18n } from 'vue-i18n'
|
|
5
|
+
|
|
4
6
|
const props = defineProps<{
|
|
5
7
|
theme: 'brand' | 'alt'
|
|
6
8
|
link: string
|
|
@@ -16,6 +18,8 @@ const classes = computed(() => {
|
|
|
16
18
|
|
|
17
19
|
return arr
|
|
18
20
|
})
|
|
21
|
+
|
|
22
|
+
const { t } = useI18n()
|
|
19
23
|
</script>
|
|
20
24
|
|
|
21
25
|
<template>
|
|
@@ -26,6 +30,6 @@ const classes = computed(() => {
|
|
|
26
30
|
class="sese-btn btn rounded-full hover:shadow-lg" bg="gradient-to-r"
|
|
27
31
|
p="x-6"
|
|
28
32
|
>
|
|
29
|
-
{{ text }}
|
|
33
|
+
{{ t(text) }}
|
|
30
34
|
</AppLink>
|
|
31
35
|
</template>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useThemeConfig } from 'valaxy'
|
|
3
3
|
import type { Categories } from 'valaxy'
|
|
4
4
|
import { computed, ref } from 'vue'
|
|
5
|
+
import type { PressTheme } from '../types'
|
|
5
6
|
|
|
6
7
|
const props = withDefaults(defineProps<{
|
|
7
8
|
categories: Categories
|
|
@@ -18,15 +19,19 @@ const props = withDefaults(defineProps<{
|
|
|
18
19
|
|
|
19
20
|
const collapsable = ref(props.collapsable)
|
|
20
21
|
|
|
21
|
-
const themeConfig = useThemeConfig()
|
|
22
|
+
const themeConfig = useThemeConfig<PressTheme.Config>()
|
|
22
23
|
const sidebar = computed(() => themeConfig.value.sidebar)
|
|
24
|
+
|
|
25
|
+
function getCategoryByName(name: string) {
|
|
26
|
+
return props.categories.find(c => c.name === name)
|
|
27
|
+
}
|
|
23
28
|
</script>
|
|
24
29
|
|
|
25
30
|
<template>
|
|
26
31
|
<ul v-for="item in sidebar" :key="item" class="category-list">
|
|
27
32
|
<PressCategory
|
|
28
|
-
v-if="
|
|
29
|
-
:category="
|
|
33
|
+
v-if="getCategoryByName(item)"
|
|
34
|
+
:category="getCategoryByName(item)"
|
|
30
35
|
:level="level + 1"
|
|
31
36
|
:display-category="displayCategory"
|
|
32
37
|
:collapsable="collapsable"
|
|
@@ -35,7 +35,7 @@ function getTitle(post: Post | any) {
|
|
|
35
35
|
class="category-list-item inline-flex items-center justify-between"
|
|
36
36
|
>
|
|
37
37
|
<span class="category-name" font="bold" m="l-1" @click="displayCategory ? displayCategory(category.name) : null">
|
|
38
|
-
{{ category.name === 'Uncategorized' ? t('category.uncategorized') : category.name }}
|
|
38
|
+
{{ category.name === 'Uncategorized' ? t('category.uncategorized') : t(`category.${category.name}`) }}
|
|
39
39
|
<!-- <sup font="normal">[{{ category.total }}]</sup> -->
|
|
40
40
|
</span>
|
|
41
41
|
<span class="folder-action inline-flex cursor-pointer" opacity="50" @click="collapsable = !collapsable">
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, onMounted, ref, watchEffect } from 'vue'
|
|
3
3
|
import { useData, useThemeConfig } from 'valaxy'
|
|
4
|
+
import type { PressTheme } from '../types'
|
|
4
5
|
|
|
5
6
|
const data = useData()
|
|
6
|
-
const themeConfig = useThemeConfig()
|
|
7
|
+
const themeConfig = useThemeConfig<PressTheme.Config>()
|
|
7
8
|
|
|
8
9
|
const date = computed(() => new Date(data.lastUpdated!))
|
|
9
10
|
const isoDatetime = computed(() => date.value.toISOString())
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useFrontmatter } from 'valaxy'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import PressButton from './PressButton.vue'
|
|
4
5
|
|
|
5
6
|
const fm = useFrontmatter()
|
|
7
|
+
|
|
8
|
+
const { t } = useI18n()
|
|
6
9
|
</script>
|
|
7
10
|
|
|
8
11
|
<template>
|
|
@@ -14,9 +17,9 @@ const fm = useFrontmatter()
|
|
|
14
17
|
</div>
|
|
15
18
|
|
|
16
19
|
<h2 m="b-10" text="center 6xl" font="black" leading="tight">
|
|
17
|
-
|
|
20
|
+
{{ t('banner.next-generation') }}
|
|
18
21
|
<br>
|
|
19
|
-
|
|
22
|
+
{{ t('banner.static') }} <span class="gradient-text from-blue-500 to-purple-700" bg="gradient-to-r">{{ t('banner.blog') }}</span> {{ t('banner.framework') }}
|
|
20
23
|
</h2>
|
|
21
24
|
|
|
22
25
|
<div p="2" text="center">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import type { NavItemGroup } from '../types'
|
|
4
5
|
|
|
5
6
|
defineProps<{
|
|
@@ -7,6 +8,8 @@ defineProps<{
|
|
|
7
8
|
}>()
|
|
8
9
|
|
|
9
10
|
const open = ref(false)
|
|
11
|
+
|
|
12
|
+
const { t } = useI18n()
|
|
10
13
|
</script>
|
|
11
14
|
|
|
12
15
|
<template>
|
|
@@ -19,18 +22,18 @@ const open = ref(false)
|
|
|
19
22
|
>
|
|
20
23
|
<button
|
|
21
24
|
type="button"
|
|
22
|
-
class="button flex items-center"
|
|
25
|
+
class="button flex items-center bg-transparent"
|
|
23
26
|
@click="open = !open"
|
|
24
27
|
>
|
|
25
28
|
<span class="text">
|
|
26
|
-
{{ item.text }}
|
|
29
|
+
{{ t(item.text) }}
|
|
27
30
|
</span>
|
|
28
31
|
<div i-ri-arrow-drop-down-line />
|
|
29
32
|
</button>
|
|
30
33
|
|
|
31
34
|
<div class="menu grow" flex="~ col" items="start">
|
|
32
35
|
<AppLink v-for="itemLink in item.items" :key="itemLink.text" class="menu-item" p="x-3" :to="itemLink.link">
|
|
33
|
-
{{ itemLink.text }}
|
|
36
|
+
{{ t(itemLink.text) }}
|
|
34
37
|
</AppLink>
|
|
35
38
|
</div>
|
|
36
39
|
</div>
|
|
@@ -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
|
|
@@ -17,10 +17,10 @@ const posts = computed(() => props.posts || site.postList)
|
|
|
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>
|
|
@@ -36,7 +36,7 @@ const localeTitle = computed(() => getLocaleTitle(locale.value, frontmatter.valu
|
|
|
36
36
|
>
|
|
37
37
|
<div class="container" flex="~ grow" justify="between">
|
|
38
38
|
<slot name="main">
|
|
39
|
-
<div class="content" w="full" :class="{ 'm-auto': !hasSidebar }" flex="~ col grow" p="lt-md:0">
|
|
39
|
+
<div class="vp-doc content" w="full" :class="{ 'm-auto': !hasSidebar }" flex="~ col grow" p="lt-md:0">
|
|
40
40
|
<slot name="main-header" />
|
|
41
41
|
<slot name="main-header-after" />
|
|
42
42
|
|
|
@@ -45,7 +45,7 @@ const localeTitle = computed(() => getLocaleTitle(locale.value, frontmatter.valu
|
|
|
45
45
|
<ValaxyMd class="prose mx-auto w-full max-w-4xl" :frontmatter="frontmatter">
|
|
46
46
|
<h1 v-if="hasSidebar && !isHome && frontmatter.title" :id="frontmatter.title" tabindex="-1">
|
|
47
47
|
{{ localeTitle }}
|
|
48
|
-
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true"
|
|
48
|
+
<a class="header-anchor" :href="`#${frontmatter.title}`" aria-hidden="true" />
|
|
49
49
|
</h1>
|
|
50
50
|
<slot name="main-content-md" />
|
|
51
51
|
<slot />
|
package/composables/config.ts
CHANGED
package/config/index.ts
CHANGED
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>
|
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)
|
package/styles/markdown.scss
CHANGED
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
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export namespace PressTheme {
|
|
|
5
5
|
export type Sidebar = any
|
|
6
6
|
|
|
7
7
|
export interface Footer {
|
|
8
|
-
message?: string
|
|
9
|
-
copyright?: string
|
|
8
|
+
message?: string
|
|
9
|
+
copyright?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface SocialLink {
|
|
@@ -46,7 +46,6 @@ export namespace PressTheme {
|
|
|
46
46
|
*/
|
|
47
47
|
primary: string
|
|
48
48
|
}
|
|
49
|
-
|
|
50
49
|
|
|
51
50
|
nav: Array<NavItem>
|
|
52
51
|
sidebar: string[]
|
|
@@ -62,6 +61,8 @@ export namespace PressTheme {
|
|
|
62
61
|
* Toggle dark label
|
|
63
62
|
*/
|
|
64
63
|
darkModeSwitchLabel?: string
|
|
64
|
+
|
|
65
|
+
lastUpdatedText?: string
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -78,8 +79,6 @@ export interface NavItemGroup {
|
|
|
78
79
|
|
|
79
80
|
export type NavItem = NavItemLink | NavItemGroup
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
82
|
/**
|
|
84
83
|
* Theme Config
|
|
85
84
|
*/
|
package/utils/index.ts
CHANGED
package/valaxy.config.ts
CHANGED
|
File without changes
|