@slidev/client 0.49.0-beta.4 → 0.49.0-beta.5
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/CodeBlockWrapper.vue +2 -2
- package/builtin/KaTexBlockWrapper.vue +2 -2
- package/builtin/ShikiMagicMove.vue +2 -1
- package/builtin/VClickGap.vue +13 -15
- package/builtin/VClicks.ts +3 -3
- package/builtin/VSwitch.ts +114 -0
- package/composables/useClicks.ts +29 -10
- package/composables/useNav.ts +14 -6
- package/constants.ts +1 -1
- package/env.ts +2 -0
- package/internals/CodeRunner.vue +1 -3
- package/internals/Controls.vue +10 -2
- package/internals/DrawingControls.vue +1 -1
- package/internals/DrawingLayer.vue +1 -1
- package/internals/DrawingPreview.vue +1 -1
- package/internals/NavControls.vue +1 -5
- package/internals/NoteDisplay.vue +1 -1
- package/internals/QuickOverview.vue +8 -16
- package/internals/Settings.vue +1 -1
- package/internals/SlideContainer.vue +28 -46
- package/internals/SlideWrapper.vue +20 -28
- package/internals/SlidesShow.vue +5 -4
- package/logic/transition.ts +1 -1
- package/modules/v-click.ts +1 -3
- package/package.json +16 -17
- package/pages/entry.vue +18 -24
- package/pages/notes.vue +8 -11
- package/pages/overview.vue +4 -11
- package/pages/play.vue +9 -21
- package/pages/presenter.vue +11 -27
- package/setup/root.ts +4 -6
- package/styles/index.css +8 -0
- package/uno.config.ts +4 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { provideLocal, useElementSize, useStyleTag } from '@vueuse/core'
|
|
3
|
-
import { computed, ref
|
|
4
|
-
import { configs, slideAspect, slideHeight, slideWidth } from '../env'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
5
4
|
import { injectionSlideElement, injectionSlideScale } from '../constants'
|
|
5
|
+
import { slideAspect, slideHeight, slideWidth } from '../env'
|
|
6
6
|
import { useNav } from '../composables/useNav'
|
|
7
|
+
import { slideScale } from '../state'
|
|
7
8
|
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
width: {
|
|
@@ -12,83 +13,64 @@ const props = defineProps({
|
|
|
12
13
|
meta: {
|
|
13
14
|
default: () => ({}) as any,
|
|
14
15
|
},
|
|
15
|
-
scale: {
|
|
16
|
-
type: [Number, String],
|
|
17
|
-
},
|
|
18
16
|
isMain: {
|
|
19
17
|
type: Boolean,
|
|
20
18
|
default: false,
|
|
21
19
|
},
|
|
22
20
|
})
|
|
23
21
|
|
|
24
|
-
const {
|
|
22
|
+
const { isPrintMode } = useNav()
|
|
25
23
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
24
|
+
const container = ref<HTMLDivElement | null>(null)
|
|
25
|
+
const containerSize = useElementSize(container)
|
|
28
26
|
const slideElement = ref<HTMLElement | null>(null)
|
|
29
27
|
|
|
30
|
-
const width = computed(() => props.width
|
|
31
|
-
const height = computed(() => props.width ? props.width / slideAspect.value :
|
|
32
|
-
|
|
33
|
-
if (props.width) {
|
|
34
|
-
watchEffect(() => {
|
|
35
|
-
if (root.value) {
|
|
36
|
-
root.value.style.width = `${width.value}px`
|
|
37
|
-
root.value.style.height = `${height.value}px`
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const screenAspect = computed(() => width.value / height.value)
|
|
28
|
+
const width = computed(() => props.width ?? containerSize.width.value)
|
|
29
|
+
const height = computed(() => props.width ? props.width / slideAspect.value : containerSize.height.value)
|
|
43
30
|
|
|
44
31
|
const scale = computed(() => {
|
|
45
|
-
if (
|
|
46
|
-
return +
|
|
47
|
-
|
|
48
|
-
return width.value / slideWidth.value
|
|
49
|
-
return height.value * slideAspect.value / slideWidth.value
|
|
32
|
+
if (slideScale.value && !isPrintMode.value)
|
|
33
|
+
return +slideScale.value
|
|
34
|
+
return Math.min(width.value / slideWidth.value, height.value / slideHeight.value)
|
|
50
35
|
})
|
|
51
36
|
|
|
52
|
-
const
|
|
37
|
+
const contentStyle = computed(() => ({
|
|
53
38
|
'height': `${slideHeight.value}px`,
|
|
54
39
|
'width': `${slideWidth.value}px`,
|
|
55
40
|
'transform': `translate(-50%, -50%) scale(${scale.value})`,
|
|
56
41
|
'--slidev-slide-scale': scale.value,
|
|
57
42
|
}))
|
|
58
43
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}))
|
|
64
|
-
|
|
65
|
-
if (props.isMain) {
|
|
66
|
-
useStyleTag(computed(() => `
|
|
67
|
-
:root {
|
|
68
|
-
--slidev-slide-scale: ${scale.value};
|
|
44
|
+
const containerStyle = computed(() => props.width
|
|
45
|
+
? {
|
|
46
|
+
width: `${props.width}px`,
|
|
47
|
+
height: `${props.width / slideAspect.value}px`,
|
|
69
48
|
}
|
|
70
|
-
|
|
71
|
-
|
|
49
|
+
: {},
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
if (props.isMain)
|
|
53
|
+
useStyleTag(computed(() => `:root { --slidev-slide-scale: ${scale.value}; }`))
|
|
72
54
|
|
|
73
55
|
provideLocal(injectionSlideScale, scale)
|
|
74
56
|
provideLocal(injectionSlideElement, slideElement)
|
|
75
57
|
</script>
|
|
76
58
|
|
|
77
59
|
<template>
|
|
78
|
-
<div id="slide-container" ref="
|
|
79
|
-
<div id="slide-content" ref="slideElement" class="slidev-slide-content" :style="
|
|
60
|
+
<div :id="isMain ? 'slide-container' : undefined" ref="container" class="slidev-slide-container" :style="containerStyle">
|
|
61
|
+
<div :id="isMain ? 'slide-content' : undefined" ref="slideElement" class="slidev-slide-content" :style="contentStyle">
|
|
80
62
|
<slot />
|
|
81
63
|
</div>
|
|
82
64
|
<slot name="controls" />
|
|
83
65
|
</div>
|
|
84
66
|
</template>
|
|
85
67
|
|
|
86
|
-
<style lang="postcss">
|
|
87
|
-
|
|
88
|
-
@apply relative
|
|
68
|
+
<style scoped lang="postcss">
|
|
69
|
+
.slidev-slide-container {
|
|
70
|
+
@apply relative w-full h-full overflow-hidden;
|
|
89
71
|
}
|
|
90
72
|
|
|
91
|
-
|
|
92
|
-
@apply
|
|
73
|
+
.slidev-slide-content {
|
|
74
|
+
@apply absolute left-1/2 top-1/2 overflow-hidden bg-main;
|
|
93
75
|
}
|
|
94
76
|
</style>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, defineAsyncComponent, defineComponent, h, onMounted, ref, toRef } from 'vue'
|
|
3
|
-
import type { PropType } from 'vue'
|
|
3
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
4
4
|
import { provideLocal } from '@vueuse/core'
|
|
5
5
|
import type { ClicksContext, RenderContext, SlideRoute } from '@slidev/types'
|
|
6
|
-
import {
|
|
6
|
+
import { injectionClicksContext, injectionCurrentPage, injectionRenderContext, injectionRoute, injectionSlideZoom } from '../constants'
|
|
7
7
|
import { getSlideClass } from '../utils'
|
|
8
|
+
import { configs } from '../env'
|
|
8
9
|
import SlideLoading from './SlideLoading.vue'
|
|
9
10
|
|
|
10
11
|
const props = defineProps({
|
|
@@ -16,14 +17,6 @@ const props = defineProps({
|
|
|
16
17
|
type: String as PropType<RenderContext>,
|
|
17
18
|
default: 'slide',
|
|
18
19
|
},
|
|
19
|
-
active: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false,
|
|
22
|
-
},
|
|
23
|
-
is: {
|
|
24
|
-
type: Function as PropType<() => any>,
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
20
|
route: {
|
|
28
21
|
type: Object as PropType<SlideRoute>,
|
|
29
22
|
required: true,
|
|
@@ -34,12 +27,11 @@ const zoom = computed(() => props.route.meta?.slide?.frontmatter.zoom ?? 1)
|
|
|
34
27
|
|
|
35
28
|
provideLocal(injectionRoute, props.route)
|
|
36
29
|
provideLocal(injectionCurrentPage, ref(props.route.no))
|
|
37
|
-
provideLocal(injectionRenderContext, ref(props.renderContext
|
|
38
|
-
provideLocal(injectionActive, toRef(props, 'active'))
|
|
30
|
+
provideLocal(injectionRenderContext, ref(props.renderContext))
|
|
39
31
|
provideLocal(injectionClicksContext, toRef(props, 'clicksContext'))
|
|
40
32
|
provideLocal(injectionSlideZoom, zoom)
|
|
41
33
|
|
|
42
|
-
const
|
|
34
|
+
const zoomStyle = computed(() => {
|
|
43
35
|
return zoom.value === 1
|
|
44
36
|
? undefined
|
|
45
37
|
: {
|
|
@@ -49,32 +41,33 @@ const style = computed(() => {
|
|
|
49
41
|
transform: `scale(${zoom.value})`,
|
|
50
42
|
}
|
|
51
43
|
})
|
|
44
|
+
const style = computed<CSSProperties>(() => ({
|
|
45
|
+
...zoomStyle.value,
|
|
46
|
+
'user-select': configs.selectable ? undefined : 'none',
|
|
47
|
+
}))
|
|
52
48
|
|
|
53
|
-
const SlideComponent = defineAsyncComponent({
|
|
49
|
+
const SlideComponent = computed(() => props.route && defineAsyncComponent({
|
|
54
50
|
loader: async () => {
|
|
55
|
-
const component = await props.
|
|
51
|
+
const component = await props.route.component()
|
|
56
52
|
return defineComponent({
|
|
57
53
|
setup(_, { attrs }) {
|
|
58
|
-
onMounted(() =>
|
|
59
|
-
props.clicksContext?.onMounted?.()
|
|
60
|
-
})
|
|
54
|
+
onMounted(() => props.clicksContext?.onMounted?.())
|
|
61
55
|
return () => h(component.default, attrs)
|
|
62
56
|
},
|
|
63
57
|
})
|
|
64
58
|
},
|
|
65
59
|
delay: 300,
|
|
66
60
|
loadingComponent: SlideLoading,
|
|
67
|
-
})
|
|
61
|
+
}))
|
|
68
62
|
</script>
|
|
69
63
|
|
|
70
64
|
<template>
|
|
71
|
-
<div
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/>
|
|
65
|
+
<div
|
|
66
|
+
:data-slidev-no="props.route.no"
|
|
67
|
+
:class="getSlideClass(route, ['slide', 'presenter'].includes(props.renderContext) ? '' : 'disable-view-transition')"
|
|
68
|
+
:style="style"
|
|
69
|
+
>
|
|
70
|
+
<SlideComponent />
|
|
78
71
|
</div>
|
|
79
72
|
</template>
|
|
80
73
|
|
|
@@ -85,7 +78,6 @@ const SlideComponent = defineAsyncComponent({
|
|
|
85
78
|
|
|
86
79
|
.slidev-page {
|
|
87
80
|
position: absolute;
|
|
88
|
-
|
|
89
|
-
height: 100%;
|
|
81
|
+
inset: 0;
|
|
90
82
|
}
|
|
91
83
|
</style>
|
package/internals/SlidesShow.vue
CHANGED
|
@@ -8,7 +8,6 @@ import { createFixedClicks } from '../composables/useClicks'
|
|
|
8
8
|
import { activeDragElement } from '../state'
|
|
9
9
|
import { CLICKS_MAX } from '../constants'
|
|
10
10
|
import SlideWrapper from './SlideWrapper.vue'
|
|
11
|
-
import PresenterMouse from './PresenterMouse.vue'
|
|
12
11
|
import DragControl from './DragControl.vue'
|
|
13
12
|
|
|
14
13
|
import GlobalTop from '#slidev/global-components/top'
|
|
@@ -22,11 +21,11 @@ const {
|
|
|
22
21
|
currentSlideRoute,
|
|
23
22
|
currentTransition,
|
|
24
23
|
getPrimaryClicks,
|
|
25
|
-
isPresenter,
|
|
26
24
|
nextRoute,
|
|
27
25
|
slides,
|
|
28
26
|
isPrintMode,
|
|
29
27
|
isPrintWithClicks,
|
|
28
|
+
clicksDirection,
|
|
30
29
|
} = useNav()
|
|
31
30
|
|
|
32
31
|
// preload next route
|
|
@@ -64,10 +63,13 @@ function onAfterLeave() {
|
|
|
64
63
|
v-bind="skipTransition ? {} : currentTransition"
|
|
65
64
|
id="slideshow"
|
|
66
65
|
tag="div"
|
|
66
|
+
:class="{
|
|
67
|
+
'slidev-nav-go-forward': clicksDirection > 0,
|
|
68
|
+
'slidev-nav-go-backward': clicksDirection < 0,
|
|
69
|
+
}"
|
|
67
70
|
@after-leave="onAfterLeave"
|
|
68
71
|
>
|
|
69
72
|
<SlideWrapper
|
|
70
|
-
:is="route.component!"
|
|
71
73
|
v-for="route of loadedRoutes"
|
|
72
74
|
v-show="route === currentSlideRoute"
|
|
73
75
|
:key="route.no"
|
|
@@ -87,7 +89,6 @@ function onAfterLeave() {
|
|
|
87
89
|
<template v-if="(__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__) && DrawingLayer">
|
|
88
90
|
<DrawingLayer />
|
|
89
91
|
</template>
|
|
90
|
-
<PresenterMouse v-if="!isPresenter" />
|
|
91
92
|
</template>
|
|
92
93
|
|
|
93
94
|
<style scoped>
|
package/logic/transition.ts
CHANGED
|
@@ -9,7 +9,7 @@ const transitionResolveMap: Record<string, string | undefined> = {
|
|
|
9
9
|
'slide-down': 'slide-down | slide-up',
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function resolveTransition(transition?: string | TransitionGroupProps, isBackward = false): TransitionGroupProps | undefined {
|
|
12
|
+
export function resolveTransition(transition?: string | TransitionGroupProps, isBackward = false): TransitionGroupProps | undefined {
|
|
13
13
|
if (!transition)
|
|
14
14
|
return undefined
|
|
15
15
|
if (typeof transition === 'string') {
|
package/modules/v-click.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
injectionClicksContext,
|
|
12
12
|
} from '../constants'
|
|
13
13
|
import { directiveInject } from '../utils'
|
|
14
|
-
import { normalizeAtValue } from '../composables/useClicks'
|
|
15
14
|
|
|
16
15
|
export function createVClickDirectives() {
|
|
17
16
|
return {
|
|
@@ -126,8 +125,7 @@ export function resolveClick(el: Element | string, dir: DirectiveBinding<any>, v
|
|
|
126
125
|
const flagHide = explicitHide || (dir.modifiers.hide !== false && dir.modifiers.hide != null)
|
|
127
126
|
const flagFade = dir.modifiers.fade !== false && dir.modifiers.fade != null
|
|
128
127
|
|
|
129
|
-
const
|
|
130
|
-
const info = ctx.calculate(at)
|
|
128
|
+
const info = ctx.calculate(value)
|
|
131
129
|
if (!info)
|
|
132
130
|
return null
|
|
133
131
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.0-beta.
|
|
4
|
+
"version": "0.49.0-beta.5",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@antfu/utils": "^0.7.7",
|
|
32
|
-
"@iconify-json/carbon": "^1.1.
|
|
32
|
+
"@iconify-json/carbon": "^1.1.32",
|
|
33
33
|
"@iconify-json/ph": "^1.1.12",
|
|
34
34
|
"@iconify-json/svg-spinners": "^1.1.2",
|
|
35
|
-
"@shikijs/monaco": "^1.
|
|
36
|
-
"@shikijs/vitepress-twoslash": "^1.
|
|
35
|
+
"@shikijs/monaco": "^1.4.0",
|
|
36
|
+
"@shikijs/vitepress-twoslash": "^1.4.0",
|
|
37
37
|
"@slidev/rough-notation": "^0.1.0",
|
|
38
38
|
"@typescript/ata": "^0.9.4",
|
|
39
|
-
"@unhead/vue": "^1.9.
|
|
40
|
-
"@unocss/reset": "^0.59.
|
|
39
|
+
"@unhead/vue": "^1.9.8",
|
|
40
|
+
"@unocss/reset": "^0.59.4",
|
|
41
41
|
"@vueuse/core": "^10.9.0",
|
|
42
42
|
"@vueuse/math": "^10.9.0",
|
|
43
43
|
"@vueuse/motion": "^2.1.0",
|
|
@@ -49,21 +49,20 @@
|
|
|
49
49
|
"katex": "^0.16.10",
|
|
50
50
|
"lz-string": "^1.5.0",
|
|
51
51
|
"mermaid": "^10.9.0",
|
|
52
|
-
"monaco-editor": "^0.
|
|
52
|
+
"monaco-editor": "^0.48.0",
|
|
53
53
|
"prettier": "^3.2.5",
|
|
54
54
|
"recordrtc": "^5.6.2",
|
|
55
|
-
"shiki": "^1.
|
|
56
|
-
"shiki-magic-move": "^0.3.
|
|
55
|
+
"shiki": "^1.4.0",
|
|
56
|
+
"shiki-magic-move": "^0.3.7",
|
|
57
57
|
"typescript": "^5.4.5",
|
|
58
|
-
"unocss": "^0.59.
|
|
59
|
-
"vue": "^3.4.
|
|
60
|
-
"vue-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"@slidev/
|
|
64
|
-
"@slidev/types": "0.49.0-beta.4"
|
|
58
|
+
"unocss": "^0.59.4",
|
|
59
|
+
"vue": "^3.4.26",
|
|
60
|
+
"vue-router": "^4.3.2",
|
|
61
|
+
"yaml": "^2.4.2",
|
|
62
|
+
"@slidev/parser": "0.49.0-beta.5",
|
|
63
|
+
"@slidev/types": "0.49.0-beta.5"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"vite": "^5.2.
|
|
66
|
+
"vite": "^5.2.11"
|
|
68
67
|
}
|
|
69
68
|
}
|
package/pages/entry.vue
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="h-full w-full flex items-center justify-center gap-5 lt-md:flex-col">
|
|
3
|
-
<RouterLink
|
|
4
|
-
|
|
5
|
-
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
|
|
6
|
-
>
|
|
7
|
-
<carbon:presentation-file class="text-3em op50" />
|
|
8
|
-
Slides
|
|
3
|
+
<RouterLink to="/" class="page-link">
|
|
4
|
+
<carbon:presentation-file /> Slides
|
|
9
5
|
</RouterLink>
|
|
10
|
-
<RouterLink
|
|
11
|
-
|
|
12
|
-
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
|
|
13
|
-
>
|
|
14
|
-
<carbon:user-speaker class="text-3em op50" />
|
|
15
|
-
Presenter
|
|
6
|
+
<RouterLink to="/presenter" class="page-link">
|
|
7
|
+
<carbon:user-speaker /> Presenter
|
|
16
8
|
</RouterLink>
|
|
17
|
-
<RouterLink
|
|
18
|
-
|
|
19
|
-
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
|
|
20
|
-
>
|
|
21
|
-
<carbon:catalog class="text-3em op50" />
|
|
22
|
-
Notes
|
|
9
|
+
<RouterLink to="/notes" class="page-link">
|
|
10
|
+
<carbon:catalog /> Notes
|
|
23
11
|
</RouterLink>
|
|
24
|
-
<RouterLink
|
|
25
|
-
|
|
26
|
-
class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
|
|
27
|
-
>
|
|
28
|
-
<carbon:list-boxes class="text-3em op50" />
|
|
29
|
-
Overview
|
|
12
|
+
<RouterLink to="/overview" class="page-link">
|
|
13
|
+
<carbon:list-boxes /> Overview
|
|
30
14
|
</RouterLink>
|
|
31
15
|
</div>
|
|
32
16
|
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped lang="postcss">
|
|
19
|
+
.page-link {
|
|
20
|
+
@apply flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.page-link > svg {
|
|
24
|
+
@apply text-3em op50;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
package/pages/notes.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useHead } from '@unhead/vue'
|
|
3
3
|
import { computed, ref, watch } from 'vue'
|
|
4
4
|
import { useLocalStorage } from '@vueuse/core'
|
|
5
|
-
import {
|
|
5
|
+
import { slidesTitle } from '../env'
|
|
6
6
|
import { sharedState } from '../state/shared'
|
|
7
7
|
import { fullscreen } from '../state'
|
|
8
8
|
|
|
@@ -10,10 +10,7 @@ import NoteDisplay from '../internals/NoteDisplay.vue'
|
|
|
10
10
|
import IconButton from '../internals/IconButton.vue'
|
|
11
11
|
import { useNav } from '../composables/useNav'
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
useHead({
|
|
15
|
-
title: `Notes - ${slideTitle}`,
|
|
16
|
-
})
|
|
13
|
+
useHead({ title: `Notes - ${slidesTitle}` })
|
|
17
14
|
|
|
18
15
|
const { slides, total } = useNav()
|
|
19
16
|
const { isFullscreen, toggle: toggleFullscreen } = fullscreen
|
|
@@ -39,20 +36,20 @@ function decreaseFontSize() {
|
|
|
39
36
|
|
|
40
37
|
<template>
|
|
41
38
|
<div
|
|
42
|
-
class="fixed top-0 left-0 h-
|
|
43
|
-
:style="{ width: `${(pageNo - 1) / total * 100}%` }"
|
|
39
|
+
class="fixed top-0 left-0 h-3px bg-primary transition-all duration-500"
|
|
40
|
+
:style="{ width: `${(pageNo - 1) / (total - 1) * 100 + 1}%` }"
|
|
44
41
|
/>
|
|
45
|
-
<div class="h-full flex flex-col">
|
|
42
|
+
<div class="h-full pt-2 flex flex-col">
|
|
46
43
|
<div
|
|
47
44
|
ref="scroller"
|
|
48
45
|
class="px-5 flex-auto h-full overflow-auto"
|
|
49
46
|
:style="{ fontSize: `${fontSize}px` }"
|
|
50
47
|
>
|
|
51
48
|
<NoteDisplay
|
|
52
|
-
:note="currentRoute?.meta
|
|
53
|
-
:note-html="currentRoute?.meta
|
|
49
|
+
:note="currentRoute?.meta.slide.note"
|
|
50
|
+
:note-html="currentRoute?.meta.slide.noteHTML"
|
|
54
51
|
:placeholder="`No notes for Slide ${pageNo}.`"
|
|
55
|
-
:clicks-context="currentRoute?.meta
|
|
52
|
+
:clicks-context="currentRoute?.meta.__clicksContext"
|
|
56
53
|
:auto-scroll="true"
|
|
57
54
|
/>
|
|
58
55
|
</div>
|
package/pages/overview.vue
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
|
3
3
|
import { useHead } from '@unhead/vue'
|
|
4
4
|
import type { ClicksContext, SlideRoute } from '@slidev/types'
|
|
5
|
-
import {
|
|
5
|
+
import { slidesTitle } from '../env'
|
|
6
6
|
import { getSlidePath } from '../logic/slides'
|
|
7
7
|
import { createFixedClicks } from '../composables/useClicks'
|
|
8
8
|
import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
|
|
9
|
-
import { getSlideClass } from '../utils'
|
|
10
9
|
import SlideContainer from '../internals/SlideContainer.vue'
|
|
11
10
|
import SlideWrapper from '../internals/SlideWrapper.vue'
|
|
12
11
|
import DrawingPreview from '../internals/DrawingPreview.vue'
|
|
@@ -18,10 +17,7 @@ import { useNav } from '../composables/useNav'
|
|
|
18
17
|
|
|
19
18
|
const cardWidth = 450
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
useHead({
|
|
23
|
-
title: `Overview - ${slideTitle}`,
|
|
24
|
-
})
|
|
20
|
+
useHead({ title: `Overview - ${slidesTitle}` })
|
|
25
21
|
|
|
26
22
|
const { openInEditor, slides } = useNav()
|
|
27
23
|
|
|
@@ -102,7 +98,7 @@ onMounted(() => {
|
|
|
102
98
|
<div class="h-screen w-screen of-hidden flex">
|
|
103
99
|
<nav class="grid grid-rows-[auto_max-content] border-r border-main select-none max-h-full h-full">
|
|
104
100
|
<div class="relative">
|
|
105
|
-
<div class="absolute left-0 top-0 bottom-0 w-200 flex flex-col flex-auto items-end group p2 gap-1 max-h-full of-
|
|
101
|
+
<div class="absolute left-0 top-0 bottom-0 w-200 flex flex-col flex-auto items-end group p2 gap-1 max-h-full of-x-visible of-y-auto" style="direction:rtl">
|
|
106
102
|
<div
|
|
107
103
|
v-for="(route, idx) of slides"
|
|
108
104
|
:key="route.no"
|
|
@@ -180,9 +176,7 @@ onMounted(() => {
|
|
|
180
176
|
class="pointer-events-none important:[&_*]:select-none"
|
|
181
177
|
>
|
|
182
178
|
<SlideWrapper
|
|
183
|
-
:is="route.component!"
|
|
184
179
|
:clicks-context="getClicksContext(route)"
|
|
185
|
-
:class="getSlideClass(route)"
|
|
186
180
|
:route="route"
|
|
187
181
|
render-context="overview"
|
|
188
182
|
/>
|
|
@@ -191,9 +185,8 @@ onMounted(() => {
|
|
|
191
185
|
</div>
|
|
192
186
|
<ClicksSlider
|
|
193
187
|
v-if="getSlideClicks(route)"
|
|
194
|
-
mt-2
|
|
195
188
|
:clicks-context="getClicksContext(route)"
|
|
196
|
-
class="w-full"
|
|
189
|
+
class="w-full mt-2"
|
|
197
190
|
@dblclick="getClicksContext(route).current = CLICKS_MAX"
|
|
198
191
|
/>
|
|
199
192
|
</div>
|
package/pages/play.vue
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, shallowRef } from 'vue'
|
|
3
|
-
import { isEditorVertical, isScreenVertical, showEditor,
|
|
3
|
+
import { isEditorVertical, isScreenVertical, showEditor, windowSize } from '../state'
|
|
4
4
|
import { useSwipeControls } from '../composables/useSwipeControls'
|
|
5
5
|
import { registerShortcuts } from '../logic/shortcuts'
|
|
6
|
-
import { configs } from '../env'
|
|
7
6
|
import Controls from '../internals/Controls.vue'
|
|
8
7
|
import SlideContainer from '../internals/SlideContainer.vue'
|
|
9
8
|
import NavControls from '../internals/NavControls.vue'
|
|
@@ -12,10 +11,9 @@ import PrintStyle from '../internals/PrintStyle.vue'
|
|
|
12
11
|
import { onContextMenu } from '../logic/contextMenu'
|
|
13
12
|
import { useNav } from '../composables/useNav'
|
|
14
13
|
import { useDrawings } from '../composables/useDrawings'
|
|
14
|
+
import PresenterMouse from '../internals/PresenterMouse.vue'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const { next, prev, isEmbedded, isPrintMode } = useNav()
|
|
16
|
+
const { next, prev, isPrintMode } = useNav()
|
|
19
17
|
const { isDrawing } = useDrawings()
|
|
20
18
|
|
|
21
19
|
const root = ref<HTMLDivElement>()
|
|
@@ -25,7 +23,7 @@ function onClick(e: MouseEvent) {
|
|
|
25
23
|
|
|
26
24
|
if (e.button === 0 && (e.target as HTMLElement)?.id === 'slide-container') {
|
|
27
25
|
// click right to next, left to previous
|
|
28
|
-
if ((e.pageX / window.innerWidth) > 0.
|
|
26
|
+
if ((e.pageX / window.innerWidth) > 0.5)
|
|
29
27
|
next()
|
|
30
28
|
else
|
|
31
29
|
prev()
|
|
@@ -33,16 +31,13 @@ function onClick(e: MouseEvent) {
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
useSwipeControls(root)
|
|
34
|
+
registerShortcuts()
|
|
36
35
|
|
|
37
36
|
const persistNav = computed(() => isScreenVertical.value || showEditor.value)
|
|
38
37
|
|
|
39
38
|
const SideEditor = shallowRef<any>()
|
|
40
39
|
if (__DEV__ && __SLIDEV_FEATURE_EDITOR__)
|
|
41
40
|
import('../internals/SideEditor.vue').then(v => SideEditor.value = v.default)
|
|
42
|
-
|
|
43
|
-
const DrawingControls = shallowRef<any>()
|
|
44
|
-
if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
45
|
-
import('../internals/DrawingControls.vue').then(v => DrawingControls.value = v.default)
|
|
46
41
|
</script>
|
|
47
42
|
|
|
48
43
|
<template>
|
|
@@ -52,16 +47,15 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
52
47
|
:class="isEditorVertical ? 'grid-rows-[1fr_max-content]' : 'grid-cols-[1fr_max-content]'"
|
|
53
48
|
>
|
|
54
49
|
<SlideContainer
|
|
55
|
-
class="w-full h-full"
|
|
56
50
|
:style="{ background: 'var(--slidev-slide-container-background, black)' }"
|
|
57
51
|
:width="isPrintMode ? windowSize.width.value : undefined"
|
|
58
|
-
|
|
59
|
-
:is-main="true"
|
|
52
|
+
is-main
|
|
60
53
|
@pointerdown="onClick"
|
|
61
54
|
@contextmenu="onContextMenu"
|
|
62
55
|
>
|
|
63
56
|
<template #default>
|
|
64
57
|
<SlidesShow render-context="slide" />
|
|
58
|
+
<PresenterMouse />
|
|
65
59
|
</template>
|
|
66
60
|
<template #controls>
|
|
67
61
|
<div
|
|
@@ -72,17 +66,11 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
72
66
|
isDrawing ? 'pointer-events-none' : '',
|
|
73
67
|
]"
|
|
74
68
|
>
|
|
75
|
-
<NavControls
|
|
69
|
+
<NavControls :persist="persistNav" />
|
|
76
70
|
</div>
|
|
77
|
-
<template v-if="__SLIDEV_FEATURE_DRAWINGS__ && !configs.drawings.presenterOnly && !isEmbedded && DrawingControls">
|
|
78
|
-
<DrawingControls class="ml-0" />
|
|
79
|
-
</template>
|
|
80
71
|
</template>
|
|
81
72
|
</SlideContainer>
|
|
82
|
-
|
|
83
|
-
<template v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && SideEditor && showEditor">
|
|
84
|
-
<SideEditor :resize="true" />
|
|
85
|
-
</template>
|
|
73
|
+
<SideEditor v-if="SideEditor && showEditor" :resize="true" />
|
|
86
74
|
</div>
|
|
87
75
|
<Controls v-if="!isPrintMode" />
|
|
88
76
|
</template>
|