@slidev/client 0.43.10 → 0.43.12
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/internals/NavControls.vue +6 -1
- package/internals/NoteEditor.vue +9 -2
- package/internals/NotesView.vue +8 -1
- package/internals/Presenter.vue +42 -10
- package/package.json +3 -3
- package/state/index.ts +17 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { computed, ref, shallowRef } from 'vue'
|
|
3
3
|
import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
|
|
4
4
|
import { currentPage, downloadPDF, hasNext, hasPrev, isEmbedded, isPresenter, next, presenterPassword, prev, showPresenter, total } from '../logic/nav'
|
|
5
|
-
import { activeElement, breakpoints, fullscreen, showEditor, showInfoDialog, showPresenterCursor, toggleOverview } from '../state'
|
|
5
|
+
import { activeElement, breakpoints, fullscreen, presenterLayout, showEditor, showInfoDialog, showPresenterCursor, toggleOverview, togglePresenterLayout } from '../state'
|
|
6
6
|
import { brush, drawingEnabled } from '../logic/drawings'
|
|
7
7
|
import { configs } from '../env'
|
|
8
8
|
import Settings from './Settings.vue'
|
|
@@ -148,6 +148,11 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
148
148
|
<HiddenText :text="showEditor ? 'Hide editor' : 'Show editor'" />
|
|
149
149
|
<carbon:text-annotation-toggle />
|
|
150
150
|
</button>
|
|
151
|
+
|
|
152
|
+
<button v-if="isPresenter" class="slidev-icon-btn" title="Toggle Presenter Layout" @click="togglePresenterLayout">
|
|
153
|
+
<carbon:template />
|
|
154
|
+
{{ presenterLayout }}
|
|
155
|
+
</button>
|
|
151
156
|
</template>
|
|
152
157
|
<template v-if="!__DEV__">
|
|
153
158
|
<button v-if="configs.download" class="slidev-icon-btn" @click="downloadPDF">
|
package/internals/NoteEditor.vue
CHANGED
|
@@ -9,6 +9,9 @@ const props = defineProps({
|
|
|
9
9
|
class: {
|
|
10
10
|
default: '',
|
|
11
11
|
},
|
|
12
|
+
style: {
|
|
13
|
+
default: () => ({}),
|
|
14
|
+
},
|
|
12
15
|
placeholder: {
|
|
13
16
|
default: 'No notes for this slide',
|
|
14
17
|
},
|
|
@@ -62,7 +65,9 @@ onClickOutside(input, () => {
|
|
|
62
65
|
<template>
|
|
63
66
|
<NoteDisplay
|
|
64
67
|
v-if="!editing && note"
|
|
68
|
+
class="my--4 border-transparent border-2"
|
|
65
69
|
:class="props.class"
|
|
70
|
+
:style="props.style"
|
|
66
71
|
:note="note"
|
|
67
72
|
:note-html="info?.noteHTML"
|
|
68
73
|
@click="switchNoteEdit"
|
|
@@ -71,10 +76,12 @@ onClickOutside(input, () => {
|
|
|
71
76
|
v-else
|
|
72
77
|
ref="input"
|
|
73
78
|
v-model="note"
|
|
74
|
-
class="prose resize-none overflow-auto outline-none bg-transparent block"
|
|
75
|
-
style="line-height: 1.75;
|
|
79
|
+
class="prose resize-none overflow-auto outline-none bg-transparent block border-green border-2"
|
|
80
|
+
style="line-height: 1.75;"
|
|
81
|
+
:style="props.style"
|
|
76
82
|
:class="props.class"
|
|
77
83
|
:placeholder="placeholder"
|
|
84
|
+
@keydown.esc=" editing = false"
|
|
78
85
|
@focus="editing = true"
|
|
79
86
|
/>
|
|
80
87
|
</template>
|
package/internals/NotesView.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useHead } from '@vueuse/head'
|
|
3
|
-
import { computed } from 'vue'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
4
4
|
import { useLocalStorage } from '@vueuse/core'
|
|
5
5
|
import { configs } from '../env'
|
|
6
6
|
import { sharedState } from '../state/shared'
|
|
@@ -17,10 +17,16 @@ useHead({
|
|
|
17
17
|
|
|
18
18
|
const { isFullscreen, toggle: toggleFullscreen } = fullscreen
|
|
19
19
|
|
|
20
|
+
const scroller = ref<HTMLDivElement>()
|
|
20
21
|
const fontSize = useLocalStorage('slidev-notes-font-size', 18)
|
|
21
22
|
const pageNo = computed(() => sharedState.lastUpdate?.type === 'viewer' ? sharedState.viewerPage : sharedState.page)
|
|
22
23
|
const currentRoute = computed(() => rawRoutes.find(i => i.path === `${pageNo.value}`))
|
|
23
24
|
|
|
25
|
+
watch(pageNo, () => {
|
|
26
|
+
scroller.value?.scrollTo({ left: 0, top: 0, behavior: 'smooth' })
|
|
27
|
+
window.scrollTo({ left: 0, top: 0, behavior: 'smooth' })
|
|
28
|
+
})
|
|
29
|
+
|
|
24
30
|
function increaseFontSize() {
|
|
25
31
|
fontSize.value = fontSize.value + 1
|
|
26
32
|
}
|
|
@@ -37,6 +43,7 @@ function decreaseFontSize() {
|
|
|
37
43
|
/>
|
|
38
44
|
<div class="h-full flex flex-col">
|
|
39
45
|
<div
|
|
46
|
+
ref="scroller"
|
|
40
47
|
class="px-5 flex-auto h-full overflow-auto"
|
|
41
48
|
:style="{ fontSize: `${fontSize}px` }"
|
|
42
49
|
>
|
package/internals/Presenter.vue
CHANGED
|
@@ -3,7 +3,7 @@ import { useHead } from '@vueuse/head'
|
|
|
3
3
|
import { computed, onMounted, reactive, ref, shallowRef, watch } from 'vue'
|
|
4
4
|
import { useMouse, useWindowFocus } from '@vueuse/core'
|
|
5
5
|
import { clicks, clicksTotal, currentPage, currentRoute, hasNext, nextRoute, total, useSwipeControls } from '../logic/nav'
|
|
6
|
-
import { showEditor, showOverview, showPresenterCursor } from '../state'
|
|
6
|
+
import { decreasePresenterFontSize, increasePresenterFontSize, presenterLayout, presenterNotesFontSize, showEditor, showOverview, showPresenterCursor } from '../state'
|
|
7
7
|
import { configs, themeVars } from '../env'
|
|
8
8
|
import { sharedState } from '../state/shared'
|
|
9
9
|
import { registerShortcuts } from '../logic/shortcuts'
|
|
@@ -86,7 +86,7 @@ onMounted(() => {
|
|
|
86
86
|
|
|
87
87
|
<template>
|
|
88
88
|
<div class="bg-main h-full slidev-presenter">
|
|
89
|
-
<div class="grid-container">
|
|
89
|
+
<div class="grid-container" :class="`layout${presenterLayout}`">
|
|
90
90
|
<div class="grid-section top flex">
|
|
91
91
|
<img src="../assets/logo-title-horizontal.png" class="ml-2 my-auto h-10 py-1 lg:h-14 lg:py-2" style="height: 3.5rem;" alt="Slidev logo">
|
|
92
92
|
<div class="flex-auto" />
|
|
@@ -135,12 +135,31 @@ onMounted(() => {
|
|
|
135
135
|
next
|
|
136
136
|
</div>
|
|
137
137
|
</div>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<
|
|
138
|
+
<!-- Notes -->
|
|
139
|
+
<div v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && Editor && showEditor" class="grid-section note of-auto">
|
|
140
|
+
<Editor />
|
|
141
|
+
</div>
|
|
142
|
+
<div v-else class="grid-section note grid grid-rows-[1fr_min-content]">
|
|
143
|
+
<NoteEditor
|
|
144
|
+
v-if="__DEV__"
|
|
145
|
+
class="w-full max-w-full h-full overflow-auto p-2 lg:p-4"
|
|
146
|
+
:style="{ fontSize: `${presenterNotesFontSize}em` }"
|
|
147
|
+
/>
|
|
148
|
+
<NoteStatic
|
|
149
|
+
v-else
|
|
150
|
+
class="w-full max-w-full h-full overflow-auto p-2 lg:p-4"
|
|
151
|
+
:style="{ fontSize: `${presenterNotesFontSize}em` }"
|
|
152
|
+
/>
|
|
153
|
+
<div class="border-t border-main py-1 px-2 text-sm">
|
|
154
|
+
<button class="slidev-icon-btn" @click="increasePresenterFontSize">
|
|
155
|
+
<HiddenText text="Increase font size" />
|
|
156
|
+
<carbon:zoom-in />
|
|
157
|
+
</button>
|
|
158
|
+
<button class="slidev-icon-btn" @click="decreasePresenterFontSize">
|
|
159
|
+
<HiddenText text="Decrease font size" />
|
|
160
|
+
<carbon:zoom-out />
|
|
161
|
+
</button>
|
|
162
|
+
</div>
|
|
144
163
|
</div>
|
|
145
164
|
<div class="grid-section bottom">
|
|
146
165
|
<NavControls :persist="true" />
|
|
@@ -180,6 +199,9 @@ onMounted(() => {
|
|
|
180
199
|
@apply h-full w-full bg-gray-400 bg-opacity-15;
|
|
181
200
|
display: grid;
|
|
182
201
|
gap: 1px 1px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.grid-container.layout1 {
|
|
183
205
|
grid-template-columns: 1fr 1fr;
|
|
184
206
|
grid-template-rows: min-content 2fr 1fr min-content;
|
|
185
207
|
grid-template-areas:
|
|
@@ -189,8 +211,18 @@ onMounted(() => {
|
|
|
189
211
|
"bottom bottom";
|
|
190
212
|
}
|
|
191
213
|
|
|
214
|
+
.grid-container.layout2 {
|
|
215
|
+
grid-template-columns: 2fr 1fr;
|
|
216
|
+
grid-template-rows: min-content 2fr 1fr min-content;
|
|
217
|
+
grid-template-areas:
|
|
218
|
+
"top top"
|
|
219
|
+
"note main"
|
|
220
|
+
"note next"
|
|
221
|
+
"bottom bottom";
|
|
222
|
+
}
|
|
223
|
+
|
|
192
224
|
@media (max-aspect-ratio: 3/5) {
|
|
193
|
-
.grid-container {
|
|
225
|
+
.grid-container.layout1 {
|
|
194
226
|
grid-template-columns: 1fr;
|
|
195
227
|
grid-template-rows: min-content 1fr 1fr 1fr min-content;
|
|
196
228
|
grid-template-areas:
|
|
@@ -203,7 +235,7 @@ onMounted(() => {
|
|
|
203
235
|
}
|
|
204
236
|
|
|
205
237
|
@media (min-aspect-ratio: 1/1) {
|
|
206
|
-
.grid-container {
|
|
238
|
+
.grid-container.layout1 {
|
|
207
239
|
grid-template-columns: 1fr 1.1fr 0.9fr;
|
|
208
240
|
grid-template-rows: min-content 1fr 2fr min-content;
|
|
209
241
|
grid-template-areas:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.12",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,8 +45,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.12",
|
|
49
|
+
"@slidev/types": "0.43.12"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"vite": "^4.5.0"
|
package/state/index.ts
CHANGED
|
@@ -29,4 +29,21 @@ export const showPresenterCursor = useLocalStorage('slidev-presenter-cursor', tr
|
|
|
29
29
|
export const showEditor = useLocalStorage('slidev-show-editor', false)
|
|
30
30
|
export const editorWidth = useLocalStorage('slidev-editor-width', isClient ? window.innerWidth * 0.4 : 100)
|
|
31
31
|
|
|
32
|
+
export const presenterNotesFontSize = useLocalStorage('slidev-presenter-font-size', 1)
|
|
33
|
+
export const presenterLayout = useLocalStorage('slidev-presenter-layout', 1)
|
|
34
|
+
|
|
35
|
+
export function togglePresenterLayout() {
|
|
36
|
+
presenterLayout.value = presenterLayout.value + 1
|
|
37
|
+
if (presenterLayout.value > 2)
|
|
38
|
+
presenterLayout.value = 1
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function increasePresenterFontSize() {
|
|
42
|
+
presenterNotesFontSize.value = Math.min(2, presenterNotesFontSize.value + 0.1)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function decreasePresenterFontSize() {
|
|
46
|
+
presenterNotesFontSize.value = Math.max(0.5, presenterNotesFontSize.value - 0.1)
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
export const toggleOverview = useToggle(showOverview)
|