@slidev/client 0.38.4 → 0.38.7
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 +1 -1
- package/builtin/TocList.vue +2 -2
- package/composables/useNav.ts +1 -1
- package/internals/SlideWrapper.ts +1 -0
- package/internals/SlidesShow.vue +34 -13
- package/logic/drawings.ts +1 -0
- package/logic/nav.ts +1 -11
- package/package.json +7 -7
- package/setup/root.ts +2 -1
package/builtin/Toc.vue
CHANGED
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
-->
|
|
10
10
|
<script setup lang='ts'>
|
|
11
11
|
import { computed, inject } from 'vue'
|
|
12
|
-
import type { TocItem } from '
|
|
12
|
+
import type { TocItem } from '@slidev/types'
|
|
13
13
|
import { injectionSlidevContext } from '../constants'
|
|
14
14
|
|
|
15
15
|
const props = withDefaults(
|
package/builtin/TocList.vue
CHANGED
|
@@ -9,9 +9,9 @@ Usage:
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { computed } from 'vue'
|
|
11
11
|
import { toArray } from '@antfu/utils'
|
|
12
|
+
import type { TocItem } from '@slidev/types'
|
|
12
13
|
// @ts-expect-error virtual module
|
|
13
14
|
import Titles from '/@slidev/titles.md'
|
|
14
|
-
import type { TocItem } from '../logic/nav'
|
|
15
15
|
|
|
16
16
|
const props = withDefaults(defineProps<{
|
|
17
17
|
level: number
|
|
@@ -49,7 +49,7 @@ const classes = computed(() => {
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<style>
|
|
52
|
-
.slidev-toc-item p {
|
|
52
|
+
.slidev-layout .slidev-toc-item p {
|
|
53
53
|
margin: 0;
|
|
54
54
|
}
|
|
55
55
|
</style>
|
package/composables/useNav.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComputedRef } from 'vue'
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router'
|
|
4
|
-
import type { TocItem } from '
|
|
4
|
+
import type { TocItem } from '@slidev/types'
|
|
5
5
|
import { addToTree, filterTree, getPath, getTreeWithActiveStatuses } from '../logic/nav'
|
|
6
6
|
import { rawRoutes } from '../routes'
|
|
7
7
|
|
|
@@ -3,6 +3,7 @@ import { defineComponent, h, provide } from 'vue'
|
|
|
3
3
|
import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute, injectionSlideContext } from '../constants'
|
|
4
4
|
|
|
5
5
|
export default defineComponent({
|
|
6
|
+
name: 'SlideWrapper',
|
|
6
7
|
props: {
|
|
7
8
|
clicks: {
|
|
8
9
|
type: [Number, String],
|
package/internals/SlidesShow.vue
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { shallowRef, watch } from 'vue'
|
|
2
|
+
import { computed, ref, shallowRef, watch } from 'vue'
|
|
3
3
|
import { clicks, currentRoute, isPresenter, nextRoute, rawRoutes } from '../logic/nav'
|
|
4
4
|
import { getSlideClass } from '../utils'
|
|
5
|
+
import { configs } from '../env'
|
|
5
6
|
import SlideWrapper from './SlideWrapper'
|
|
6
7
|
// @ts-expect-error virtual module
|
|
7
8
|
import GlobalTop from '/@slidev/global-components/top'
|
|
@@ -22,6 +23,18 @@ watch(currentRoute, () => {
|
|
|
22
23
|
const DrawingLayer = shallowRef<any>()
|
|
23
24
|
if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
|
|
24
25
|
import('./DrawingLayer.vue').then(v => DrawingLayer.value = v.default)
|
|
26
|
+
|
|
27
|
+
const routes = computed(() => rawRoutes.filter(r => r.meta?.__preloaded || r === currentRoute.value))
|
|
28
|
+
|
|
29
|
+
const isLeaving = ref(false)
|
|
30
|
+
function onBeforeLeave() {
|
|
31
|
+
if (configs.pageTransition?.crossfade === false)
|
|
32
|
+
isLeaving.value = true
|
|
33
|
+
}
|
|
34
|
+
function onAfterLeave() {
|
|
35
|
+
if (configs.pageTransition?.crossfade === false)
|
|
36
|
+
isLeaving.value = false
|
|
37
|
+
}
|
|
25
38
|
</script>
|
|
26
39
|
|
|
27
40
|
<template>
|
|
@@ -29,18 +42,26 @@ if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
|
|
|
29
42
|
<GlobalBottom />
|
|
30
43
|
|
|
31
44
|
<!-- Slides -->
|
|
32
|
-
<template
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
<template
|
|
46
|
+
v-for="route of routes"
|
|
47
|
+
:key="route.path"
|
|
48
|
+
>
|
|
49
|
+
<Transition
|
|
50
|
+
v-bind="configs.pageTransition"
|
|
51
|
+
@before-leave="onBeforeLeave()"
|
|
52
|
+
@after-leave="onAfterLeave()"
|
|
53
|
+
>
|
|
54
|
+
<SlideWrapper
|
|
55
|
+
:is="route?.component as any"
|
|
56
|
+
v-show="route === currentRoute && !isLeaving"
|
|
57
|
+
:clicks="route === currentRoute ? clicks : 0"
|
|
58
|
+
:clicks-elements="route.meta?.__clicksElements || []"
|
|
59
|
+
:clicks-disabled="false"
|
|
60
|
+
:class="getSlideClass(route)"
|
|
61
|
+
:route="route"
|
|
62
|
+
:context="context"
|
|
63
|
+
/>
|
|
64
|
+
</Transition>
|
|
44
65
|
</template>
|
|
45
66
|
|
|
46
67
|
<!-- Global Top -->
|
package/logic/drawings.ts
CHANGED
package/logic/nav.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import type { RouteRecordRaw } from 'vue-router'
|
|
3
3
|
import { computed, nextTick, ref } from 'vue'
|
|
4
|
+
import type { TocItem } from '@slidev/types'
|
|
4
5
|
import { SwipeDirection, isString, timestamp, usePointerSwipe } from '@vueuse/core'
|
|
5
6
|
import { rawRoutes, router } from '../routes'
|
|
6
7
|
import { configs } from '../env'
|
|
7
8
|
import { useRouteQuery } from './route'
|
|
8
9
|
import { isDrawing } from './drawings'
|
|
9
10
|
|
|
10
|
-
export interface TocItem {
|
|
11
|
-
active?: boolean
|
|
12
|
-
activeParent?: boolean
|
|
13
|
-
children: TocItem[]
|
|
14
|
-
hasActiveParent?: boolean
|
|
15
|
-
level: number
|
|
16
|
-
path: string
|
|
17
|
-
hideInToc?: boolean
|
|
18
|
-
title?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
11
|
export { rawRoutes, router }
|
|
22
12
|
|
|
23
13
|
// force update collected elements when the route is fully resolved
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.7",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@antfu/utils": "^0.7.2",
|
|
19
19
|
"@unocss/reset": "^0.48.4",
|
|
20
|
-
"@vueuse/core": "^9.11.
|
|
21
|
-
"@vueuse/head": "^1.0.
|
|
22
|
-
"@vueuse/math": "^9.11.
|
|
20
|
+
"@vueuse/core": "^9.11.1",
|
|
21
|
+
"@vueuse/head": "^1.0.23",
|
|
22
|
+
"@vueuse/math": "^9.11.1",
|
|
23
23
|
"@vueuse/motion": "^2.0.0-beta.26",
|
|
24
24
|
"codemirror": "^5.65.5",
|
|
25
|
-
"defu": "^6.1.
|
|
25
|
+
"defu": "^6.1.2",
|
|
26
26
|
"drauu": "^0.3.2",
|
|
27
27
|
"file-saver": "^2.0.5",
|
|
28
28
|
"js-base64": "^3.7.4",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"vue-router": "^4.1.6",
|
|
41
41
|
"vue-starport": "^0.3.0",
|
|
42
42
|
"windicss": "^3.5.6",
|
|
43
|
-
"@slidev/parser": "0.38.
|
|
44
|
-
"@slidev/types": "0.38.
|
|
43
|
+
"@slidev/parser": "0.38.7",
|
|
44
|
+
"@slidev/types": "0.38.7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"vite": "^4.0.4"
|
package/setup/root.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
import { watch } from 'vue'
|
|
3
|
-
import { useHead } from '@vueuse/head'
|
|
3
|
+
import { useHead, useHtmlAttrs } from '@vueuse/head'
|
|
4
4
|
import { configs } from '../env'
|
|
5
5
|
import { initSharedState, onPatch, patch } from '../state/shared'
|
|
6
6
|
import { initDrawingState } from '../state/drawings'
|
|
@@ -16,6 +16,7 @@ export default function setupRoot() {
|
|
|
16
16
|
|
|
17
17
|
const title = configs.titleTemplate.replace('%s', configs.title || 'Slidev')
|
|
18
18
|
useHead({ title })
|
|
19
|
+
useHtmlAttrs(configs.htmlAttrs)
|
|
19
20
|
initSharedState(`${title} - shared`)
|
|
20
21
|
initDrawingState(`${title} - drawings`)
|
|
21
22
|
|