@slidev/client 0.43.12 → 0.43.14
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/composables/useViewTransition.ts +11 -2
- package/internals/NoteEditor.vue +17 -16
- package/internals/Presenter.vue +12 -2
- package/internals/PrintSlide.vue +2 -1
- package/layouts/two-cols-header.vue +10 -3
- package/package.json +8 -8
- package/routes.ts +1 -0
- package/setup/root.ts +2 -0
|
@@ -10,8 +10,17 @@ export function useViewTransition() {
|
|
|
10
10
|
|
|
11
11
|
const supportViewTransition = typeof document !== 'undefined' && 'startViewTransition' in document
|
|
12
12
|
|
|
13
|
-
router.beforeResolve((
|
|
14
|
-
|
|
13
|
+
router.beforeResolve((to, from) => {
|
|
14
|
+
const fromNo = from.meta.slide?.no
|
|
15
|
+
const toNo = to.meta.slide?.no
|
|
16
|
+
if (
|
|
17
|
+
!(
|
|
18
|
+
fromNo !== undefined && toNo !== undefined && (
|
|
19
|
+
(from.meta.transition === 'view-transition' && fromNo < toNo)
|
|
20
|
+
|| (to.meta.transition === 'view-transition' && toNo < fromNo)
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
) {
|
|
15
24
|
isViewTransition.value = false
|
|
16
25
|
return
|
|
17
26
|
}
|
package/internals/NoteEditor.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ignorableWatch, onClickOutside } from '@vueuse/core'
|
|
3
|
-
import {
|
|
2
|
+
import { ignorableWatch, onClickOutside, useVModel } from '@vueuse/core'
|
|
3
|
+
import { ref, watch, watchEffect } from 'vue'
|
|
4
4
|
import { currentSlideId } from '../logic/nav'
|
|
5
5
|
import { useDynamicSlideInfo } from '../logic/note'
|
|
6
6
|
import NoteDisplay from './NoteDisplay.vue'
|
|
@@ -9,6 +9,9 @@ const props = defineProps({
|
|
|
9
9
|
class: {
|
|
10
10
|
default: '',
|
|
11
11
|
},
|
|
12
|
+
editing: {
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
12
15
|
style: {
|
|
13
16
|
default: () => ({}),
|
|
14
17
|
},
|
|
@@ -17,6 +20,11 @@ const props = defineProps({
|
|
|
17
20
|
},
|
|
18
21
|
})
|
|
19
22
|
|
|
23
|
+
const emit = defineEmits([
|
|
24
|
+
'update:editing',
|
|
25
|
+
])
|
|
26
|
+
const editing = useVModel(props, 'editing', emit, { passive: true })
|
|
27
|
+
|
|
20
28
|
const { info, update } = useDynamicSlideInfo(currentSlideId)
|
|
21
29
|
|
|
22
30
|
const note = ref('')
|
|
@@ -45,17 +53,11 @@ watch(
|
|
|
45
53
|
)
|
|
46
54
|
|
|
47
55
|
const input = ref<HTMLTextAreaElement>()
|
|
48
|
-
const editing = ref(false)
|
|
49
|
-
|
|
50
|
-
async function switchNoteEdit(e: MouseEvent) {
|
|
51
|
-
if ((e?.target as HTMLElement)?.tagName === 'A')
|
|
52
|
-
return
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
57
|
+
watchEffect(() => {
|
|
58
|
+
if (editing.value)
|
|
59
|
+
input.value?.focus()
|
|
60
|
+
})
|
|
59
61
|
|
|
60
62
|
onClickOutside(input, () => {
|
|
61
63
|
editing.value = false
|
|
@@ -64,13 +66,12 @@ onClickOutside(input, () => {
|
|
|
64
66
|
|
|
65
67
|
<template>
|
|
66
68
|
<NoteDisplay
|
|
67
|
-
v-if="!editing
|
|
69
|
+
v-if="!editing"
|
|
68
70
|
class="my--4 border-transparent border-2"
|
|
69
|
-
:class="props.class"
|
|
71
|
+
:class="[props.class, note ? '' : 'opacity-50']"
|
|
70
72
|
:style="props.style"
|
|
71
|
-
:note="note"
|
|
73
|
+
:note="note || placeholder"
|
|
72
74
|
:note-html="info?.noteHTML"
|
|
73
|
-
@click="switchNoteEdit"
|
|
74
75
|
/>
|
|
75
76
|
<textarea
|
|
76
77
|
v-else
|
package/internals/Presenter.vue
CHANGED
|
@@ -30,6 +30,8 @@ useHead({
|
|
|
30
30
|
title: `Presenter - ${slideTitle}`,
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
+
const notesEditing = ref(false)
|
|
34
|
+
|
|
33
35
|
const { timer, resetTimer } = useTimer()
|
|
34
36
|
|
|
35
37
|
const nextTabElements = ref([])
|
|
@@ -139,10 +141,11 @@ onMounted(() => {
|
|
|
139
141
|
<div v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && Editor && showEditor" class="grid-section note of-auto">
|
|
140
142
|
<Editor />
|
|
141
143
|
</div>
|
|
142
|
-
<div v-else class="grid-section note grid grid-rows-[1fr_min-content]">
|
|
144
|
+
<div v-else class="grid-section note grid grid-rows-[1fr_min-content] overflow-hidden">
|
|
143
145
|
<NoteEditor
|
|
144
146
|
v-if="__DEV__"
|
|
145
147
|
class="w-full max-w-full h-full overflow-auto p-2 lg:p-4"
|
|
148
|
+
:editing="notesEditing"
|
|
146
149
|
:style="{ fontSize: `${presenterNotesFontSize}em` }"
|
|
147
150
|
/>
|
|
148
151
|
<NoteStatic
|
|
@@ -159,6 +162,13 @@ onMounted(() => {
|
|
|
159
162
|
<HiddenText text="Decrease font size" />
|
|
160
163
|
<carbon:zoom-out />
|
|
161
164
|
</button>
|
|
165
|
+
<button
|
|
166
|
+
v-if="__DEV__"
|
|
167
|
+
class="slidev-icon-btn" @click="notesEditing = !notesEditing"
|
|
168
|
+
>
|
|
169
|
+
<HiddenText text="Edit Notes" />
|
|
170
|
+
<carbon:edit />
|
|
171
|
+
</button>
|
|
162
172
|
</div>
|
|
163
173
|
</div>
|
|
164
174
|
<div class="grid-section bottom">
|
|
@@ -212,7 +222,7 @@ onMounted(() => {
|
|
|
212
222
|
}
|
|
213
223
|
|
|
214
224
|
.grid-container.layout2 {
|
|
215
|
-
grid-template-columns: 2fr
|
|
225
|
+
grid-template-columns: 3fr 2fr;
|
|
216
226
|
grid-template-rows: min-content 2fr 1fr min-content;
|
|
217
227
|
grid-template-areas:
|
|
218
228
|
"top top"
|
package/internals/PrintSlide.vue
CHANGED
|
@@ -8,6 +8,7 @@ import PrintSlideClick from './PrintSlideClick.vue'
|
|
|
8
8
|
const props = defineProps<{ route: RouteRecordRaw }>()
|
|
9
9
|
|
|
10
10
|
const clicksElements = ref(props.route.meta?.__clicksElements || [])
|
|
11
|
+
const clicks = computed(() => props.route.meta?.clicks ?? clicksElements.value.length)
|
|
11
12
|
|
|
12
13
|
const route = computed(() => props.route)
|
|
13
14
|
const nav = useNav(route)
|
|
@@ -16,6 +17,6 @@ const nav = useNav(route)
|
|
|
16
17
|
<template>
|
|
17
18
|
<PrintSlideClick v-model:clicks-elements="clicksElements" :clicks="0" :nav="nav" :route="route" />
|
|
18
19
|
<template v-if="!isClicksDisabled">
|
|
19
|
-
<PrintSlideClick v-for="i of
|
|
20
|
+
<PrintSlideClick v-for="i of clicks" :key="i" :clicks="i" :nav="nav" :route="route" />
|
|
20
21
|
</template>
|
|
21
22
|
</template>
|
|
@@ -11,6 +11,9 @@ This shows on the left
|
|
|
11
11
|
::right::
|
|
12
12
|
# Right
|
|
13
13
|
This shows on the right
|
|
14
|
+
::bottom::
|
|
15
|
+
# Bottom
|
|
16
|
+
This shows at bottom, below left and right
|
|
14
17
|
```
|
|
15
18
|
-->
|
|
16
19
|
|
|
@@ -36,6 +39,9 @@ const props = defineProps({
|
|
|
36
39
|
<div class="col-right" :class="props.class">
|
|
37
40
|
<slot name="right" />
|
|
38
41
|
</div>
|
|
42
|
+
<div class="col-bottom" :class="props.class">
|
|
43
|
+
<slot name="bottom" />
|
|
44
|
+
</div>
|
|
39
45
|
</div>
|
|
40
46
|
</template>
|
|
41
47
|
|
|
@@ -46,7 +52,8 @@ const props = defineProps({
|
|
|
46
52
|
grid-template-rows: repeat(2, 1fr);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
|
-
.col-header
|
|
50
|
-
.col-
|
|
51
|
-
.col-
|
|
55
|
+
.col-header,
|
|
56
|
+
.col-bottom { grid-column: -1/1; }
|
|
57
|
+
.col-left,
|
|
58
|
+
.col-right { grid-column: span 2; }
|
|
52
59
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.14",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@antfu/utils": "^0.7.6",
|
|
23
|
-
"@unocss/reset": "^0.57.
|
|
23
|
+
"@unocss/reset": "^0.57.2",
|
|
24
24
|
"@vueuse/core": "^10.5.0",
|
|
25
25
|
"@vueuse/head": "^2.0.0",
|
|
26
26
|
"@vueuse/math": "^10.5.0",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"js-base64": "^3.7.5",
|
|
34
34
|
"js-yaml": "^4.1.0",
|
|
35
35
|
"katex": "^0.16.9",
|
|
36
|
-
"mermaid": "^10.6.
|
|
36
|
+
"mermaid": "^10.6.1",
|
|
37
37
|
"monaco-editor": "^0.37.1",
|
|
38
|
-
"nanoid": "^5.0.
|
|
38
|
+
"nanoid": "^5.0.3",
|
|
39
39
|
"prettier": "^3.0.3",
|
|
40
40
|
"recordrtc": "^5.6.2",
|
|
41
41
|
"resolve": "^1.22.8",
|
|
42
|
-
"unocss": "^0.57.
|
|
42
|
+
"unocss": "^0.57.2",
|
|
43
43
|
"vite-plugin-windicss": "^1.9.1",
|
|
44
|
-
"vue": "^3.3.
|
|
44
|
+
"vue": "^3.3.8",
|
|
45
45
|
"vue-router": "^4.2.5",
|
|
46
46
|
"vue-starport": "^0.4.0",
|
|
47
47
|
"windicss": "^3.5.6",
|
|
48
|
-
"@slidev/parser": "0.43.
|
|
49
|
-
"@slidev/types": "0.43.
|
|
48
|
+
"@slidev/parser": "0.43.14",
|
|
49
|
+
"@slidev/types": "0.43.14"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"vite": "^4.5.0"
|
package/routes.ts
CHANGED
package/setup/root.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { initDrawingState } from '../state/drawings'
|
|
|
8
8
|
import { clicks, currentPage, getPath, isNotesViewer, isPresenter } from '../logic/nav'
|
|
9
9
|
import { router } from '../routes'
|
|
10
10
|
import { TRUST_ORIGINS } from '../constants'
|
|
11
|
+
import { skipTransition } from '../composables/hmr'
|
|
11
12
|
|
|
12
13
|
export default function setupRoot() {
|
|
13
14
|
// @ts-expect-error injected in runtime
|
|
@@ -58,6 +59,7 @@ export default function setupRoot() {
|
|
|
58
59
|
if (!routePath.match(/^\/(\d+|presenter)\/?/))
|
|
59
60
|
return
|
|
60
61
|
if (state.lastUpdate?.type === 'presenter' && (+state.page !== +currentPage.value || +clicks.value !== +state.clicks)) {
|
|
62
|
+
skipTransition.value = false
|
|
61
63
|
router.replace({
|
|
62
64
|
path: getPath(state.page),
|
|
63
65
|
query: {
|