@slidev/client 0.43.2 → 0.43.3
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/builtin/Toc.vue +11 -1
- package/builtin/TocList.vue +15 -1
- package/logic/nav.ts +2 -2
- package/package.json +4 -4
package/builtin/Toc.vue
CHANGED
|
@@ -16,6 +16,8 @@ const props = withDefaults(
|
|
|
16
16
|
defineProps<{
|
|
17
17
|
columns?: string | number
|
|
18
18
|
listClass?: string | string[]
|
|
19
|
+
start?: string | number
|
|
20
|
+
listStyle?: string | string[]
|
|
19
21
|
maxDepth?: string | number
|
|
20
22
|
minDepth?: string | number
|
|
21
23
|
mode?: 'all' | 'onlyCurrentTree' | 'onlySiblings'
|
|
@@ -23,6 +25,8 @@ const props = withDefaults(
|
|
|
23
25
|
{
|
|
24
26
|
columns: 1,
|
|
25
27
|
listClass: '',
|
|
28
|
+
start: 1,
|
|
29
|
+
listStyle: '',
|
|
26
30
|
maxDepth: Number.POSITIVE_INFINITY,
|
|
27
31
|
minDepth: 1,
|
|
28
32
|
mode: 'all',
|
|
@@ -85,6 +89,12 @@ const toc = computed(() => {
|
|
|
85
89
|
|
|
86
90
|
<template>
|
|
87
91
|
<div class="slidev-toc" :style="`column-count:${columns}`">
|
|
88
|
-
<TocList
|
|
92
|
+
<TocList
|
|
93
|
+
:level="1"
|
|
94
|
+
:start="start"
|
|
95
|
+
:list-style="listStyle"
|
|
96
|
+
:list="toc"
|
|
97
|
+
:list-class="listClass"
|
|
98
|
+
/>
|
|
89
99
|
</div>
|
|
90
100
|
</template>
|
package/builtin/TocList.vue
CHANGED
|
@@ -14,6 +14,8 @@ import Titles from '/@slidev/titles.md'
|
|
|
14
14
|
|
|
15
15
|
const props = withDefaults(defineProps<{
|
|
16
16
|
level: number
|
|
17
|
+
start?: number
|
|
18
|
+
listStyle?: string | string[]
|
|
17
19
|
list: TocItem[]
|
|
18
20
|
listClass?: string | string[]
|
|
19
21
|
}>(), { level: 1 })
|
|
@@ -25,10 +27,21 @@ const classes = computed(() => {
|
|
|
25
27
|
`slidev-toc-list-level-${props.level}`,
|
|
26
28
|
]
|
|
27
29
|
})
|
|
30
|
+
|
|
31
|
+
const styles = computed(() => {
|
|
32
|
+
return [
|
|
33
|
+
...toArray(props.listStyle || []),
|
|
34
|
+
]
|
|
35
|
+
})
|
|
28
36
|
</script>
|
|
29
37
|
|
|
30
38
|
<template>
|
|
31
|
-
<ol
|
|
39
|
+
<ol
|
|
40
|
+
v-if="list && list.length > 0"
|
|
41
|
+
:class="classes"
|
|
42
|
+
:start="level === 1 ? start : undefined"
|
|
43
|
+
:style="styles.length >= level ? `list-style:${styles[level - 1]}` : undefined"
|
|
44
|
+
>
|
|
32
45
|
<li
|
|
33
46
|
v-for="item of list"
|
|
34
47
|
:key="item.path" class="slidev-toc-item"
|
|
@@ -40,6 +53,7 @@ const classes = computed(() => {
|
|
|
40
53
|
<TocList
|
|
41
54
|
v-if="item.children.length > 0"
|
|
42
55
|
:level="level + 1"
|
|
56
|
+
:list-style="listStyle"
|
|
43
57
|
:list="item.children"
|
|
44
58
|
:list-class="listClass"
|
|
45
59
|
/>
|
package/logic/nav.ts
CHANGED
|
@@ -146,7 +146,7 @@ export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
|
|
|
146
146
|
|
|
147
147
|
const x = Math.abs(distanceX.value)
|
|
148
148
|
const y = Math.abs(distanceY.value)
|
|
149
|
-
if (x / window.innerWidth > 0.3 || x >
|
|
149
|
+
if (x / window.innerWidth > 0.3 || x > 75) {
|
|
150
150
|
if (direction.value === 'left')
|
|
151
151
|
next()
|
|
152
152
|
else
|
|
@@ -195,7 +195,7 @@ export function addToTree(tree: TocItem[], route: RouteRecordRaw, level = 1) {
|
|
|
195
195
|
children: [],
|
|
196
196
|
level,
|
|
197
197
|
path: route.path,
|
|
198
|
-
hideInToc: Boolean(route.meta?.hideInToc),
|
|
198
|
+
hideInToc: Boolean(route.meta?.slide?.frontmatter?.hideInToc),
|
|
199
199
|
title: route.meta?.slide?.title,
|
|
200
200
|
})
|
|
201
201
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.3",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@vueuse/motion": "^2.0.0",
|
|
24
24
|
"codemirror": "^5.65.5",
|
|
25
25
|
"defu": "^6.1.2",
|
|
26
|
-
"drauu": "^0.3.
|
|
26
|
+
"drauu": "^0.3.7",
|
|
27
27
|
"file-saver": "^2.0.5",
|
|
28
28
|
"fuse.js": "^6.6.2",
|
|
29
29
|
"js-base64": "^3.7.5",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"vue-router": "^4.2.4",
|
|
42
42
|
"vue-starport": "^0.4.0",
|
|
43
43
|
"windicss": "^3.5.6",
|
|
44
|
-
"@slidev/parser": "0.43.
|
|
45
|
-
"@slidev/types": "0.43.
|
|
44
|
+
"@slidev/parser": "0.43.3",
|
|
45
|
+
"@slidev/types": "0.43.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"vite": "^4.4.9"
|