valaxy-theme-press 0.17.0-beta.2 → 0.17.0-beta.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.
|
@@ -52,7 +52,7 @@ function getTitle(post: Post | any) {
|
|
|
52
52
|
</li>
|
|
53
53
|
|
|
54
54
|
<ul v-if="!collapsable">
|
|
55
|
-
<li v-for="categoryItem, i in category.children" :key="i" class="post-list-item">
|
|
55
|
+
<li v-for="categoryItem, i in category.children.values()" :key="i" class="post-list-item">
|
|
56
56
|
<template v-if="!isCategoryList(categoryItem)">
|
|
57
57
|
<RouterLink v-if="categoryItem.title" :to="categoryItem.path || ''" class="inline-flex items-center" active-class="active">
|
|
58
58
|
<span m="l-1" text="sm">{{ getTitle(categoryItem) }}</span>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { CategoryList } from 'valaxy'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
categories: CategoryList
|
|
7
|
+
item: string
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const category = computed(() => {
|
|
11
|
+
const c = props.categories.children.get(props.item)
|
|
12
|
+
return c
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<PressCategory
|
|
18
|
+
v-if="category"
|
|
19
|
+
:category="category"
|
|
20
|
+
:collapsable="false"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
@@ -11,8 +11,8 @@ const pages = usePageList()
|
|
|
11
11
|
const themeConfig = useThemeConfig()
|
|
12
12
|
|
|
13
13
|
const sidebar = computed(() => themeConfig.value.sidebar)
|
|
14
|
+
const cs = useCategories('', pages.value)
|
|
14
15
|
const categories = computed(() => {
|
|
15
|
-
const cs = useCategories('', pages.value)
|
|
16
16
|
const cList = cs.value
|
|
17
17
|
removeItemFromCategory(cList, 'Uncategorized')
|
|
18
18
|
|
|
@@ -23,13 +23,10 @@ const categories = computed(() => {
|
|
|
23
23
|
removeItemFromCategory(cList, item.name)
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
return cList
|
|
27
28
|
})
|
|
28
29
|
|
|
29
|
-
function getCategoryByName(name: string) {
|
|
30
|
-
return categories.value.children.find(c => c.name === name)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
30
|
const { hasSidebar } = useSidebar()
|
|
34
31
|
</script>
|
|
35
32
|
|
|
@@ -42,10 +39,9 @@ const { hasSidebar } = useSidebar()
|
|
|
42
39
|
<div text="left" m="2">
|
|
43
40
|
<ul v-for="item in sidebar" :key="item" class="category-list">
|
|
44
41
|
<template v-if="typeof item === 'string'">
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
:
|
|
48
|
-
:collapsable="false"
|
|
42
|
+
<PressCategoryByName
|
|
43
|
+
:categories="categories"
|
|
44
|
+
:item="item"
|
|
49
45
|
/>
|
|
50
46
|
</template>
|
|
51
47
|
<PressSidebarItem
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './node'
|
package/node/index.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import type { UserThemeConfig } from '../types'
|
|
2
|
+
|
|
1
3
|
export * from '../config'
|
|
2
4
|
export * from '../types/index.d'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* valaxy-theme-press
|
|
8
|
+
* @see https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-theme-press
|
|
9
|
+
*/
|
|
10
|
+
export function defineThemeConfig(config: UserThemeConfig) {
|
|
11
|
+
return config
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.17.0-beta.
|
|
3
|
+
"version": "0.17.0-beta.4",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"@docsearch/js": "^3.5.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"valaxy": "0.17.0-beta.
|
|
26
|
+
"valaxy": "0.17.0-beta.4"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useThemeConfig } from 'valaxy'
|
|
3
|
-
import type { Categories } from 'valaxy'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
import type { PressTheme } from '../types'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<{
|
|
8
|
-
categories: Categories
|
|
9
|
-
/**
|
|
10
|
-
* 当前层级
|
|
11
|
-
*/
|
|
12
|
-
level?: number
|
|
13
|
-
displayCategory?: (category: string) => void
|
|
14
|
-
collapsable?: boolean
|
|
15
|
-
}>(), {
|
|
16
|
-
level: 0,
|
|
17
|
-
collapsable: true,
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const collapsable = ref(props.collapsable)
|
|
21
|
-
|
|
22
|
-
const themeConfig = useThemeConfig<PressTheme.Config>()
|
|
23
|
-
const sidebar = computed(() => themeConfig.value.sidebar)
|
|
24
|
-
|
|
25
|
-
function getCategoryByName(name: string) {
|
|
26
|
-
return props.categories.find(c => c.name === name)
|
|
27
|
-
}
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<ul v-for="item in sidebar" :key="item" class="category-list">
|
|
32
|
-
<PressCategory
|
|
33
|
-
v-if="getCategoryByName(item)"
|
|
34
|
-
:category="getCategoryByName(item)"
|
|
35
|
-
:level="level + 1"
|
|
36
|
-
:display-category="displayCategory"
|
|
37
|
-
:collapsable="collapsable"
|
|
38
|
-
/>
|
|
39
|
-
</ul>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<style lang="scss">
|
|
43
|
-
.category-list {
|
|
44
|
-
&:first-child {
|
|
45
|
-
.category-list-item {
|
|
46
|
-
border-top: 0;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.post-list-item {
|
|
52
|
-
a {
|
|
53
|
-
color: var(--va-c-text-light);
|
|
54
|
-
transition: all 0.2s;
|
|
55
|
-
|
|
56
|
-
&:hover {
|
|
57
|
-
color: var(--va-c-primary);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.active {
|
|
61
|
-
color: var(--va-c-primary);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.category-list-item {
|
|
67
|
-
.folder-action {
|
|
68
|
-
&:hover {
|
|
69
|
-
color: var(--va-c-primary);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.category-list+.category-list {
|
|
75
|
-
margin-top: 1rem;
|
|
76
|
-
}
|
|
77
|
-
</style>
|