@slidev/client 0.38.2 → 0.38.4
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/LightOrDark.vue +8 -0
- package/builtin/TocList.vue +6 -0
- package/internals/NavControls.vue +2 -2
- package/internals/PrintContainer.vue +3 -3
- package/internals/SlidesOverview.vue +2 -2
- package/logic/drawings.ts +1 -1
- package/modules/mermaid.ts +0 -1
- package/package.json +10 -10
- package/routes.ts +9 -6
- package/state/syncState.ts +4 -4
- package/styles/code.css +4 -4
- package/styles/layouts-base.css +34 -3
package/builtin/TocList.vue
CHANGED
|
@@ -97,7 +97,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
97
97
|
</button>
|
|
98
98
|
</template>
|
|
99
99
|
|
|
100
|
-
<template v-if="__SLIDEV_FEATURE_DRAWINGS__ && !configs.drawings.presenterOnly && !isEmbedded">
|
|
100
|
+
<template v-if="__SLIDEV_FEATURE_DRAWINGS__ && (!configs.drawings.presenterOnly || isPresenter) && !isEmbedded">
|
|
101
101
|
<button class="icon-btn relative" title="Drawing" @click="drawingEnabled = !drawingEnabled">
|
|
102
102
|
<carbon:pen />
|
|
103
103
|
<div
|
|
@@ -113,7 +113,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
113
113
|
<RouterLink v-if="isPresenter" :to="nonPresenterLink" class="icon-btn" title="Play Mode">
|
|
114
114
|
<carbon:presentation-file />
|
|
115
115
|
</RouterLink>
|
|
116
|
-
<RouterLink v-if="showPresenter" :to="presenterLink" class="icon-btn" title="Presenter Mode">
|
|
116
|
+
<RouterLink v-if="__SLIDEV_FEATURE_PRESENTER__ && showPresenter" :to="presenterLink" class="icon-btn" title="Presenter Mode">
|
|
117
117
|
<carbon:user-speaker />
|
|
118
118
|
</RouterLink>
|
|
119
119
|
|
|
@@ -3,7 +3,7 @@ import { parseRangeString } from '@slidev/parser/core'
|
|
|
3
3
|
import { computed, provide } from 'vue'
|
|
4
4
|
import { configs, slideAspect, slideWidth } from '../env'
|
|
5
5
|
import { injectionSlideScale } from '../constants'
|
|
6
|
-
import {
|
|
6
|
+
import { route as currentRoute, rawRoutes } from '../logic/nav'
|
|
7
7
|
import PrintSlide from './PrintSlide.vue'
|
|
8
8
|
|
|
9
9
|
const props = defineProps<{
|
|
@@ -23,8 +23,8 @@ const scale = computed(() => {
|
|
|
23
23
|
|
|
24
24
|
// Remove the "end" slide
|
|
25
25
|
let routes = rawRoutes.slice(0, -1)
|
|
26
|
-
if (
|
|
27
|
-
const r = parseRangeString(routes.length,
|
|
26
|
+
if (currentRoute.value.query.range) {
|
|
27
|
+
const r = parseRangeString(routes.length, currentRoute.value.query.range as string)
|
|
28
28
|
routes = r.map(i => routes[i - 1])
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -71,8 +71,8 @@ watchEffect(() => {
|
|
|
71
71
|
class="relative"
|
|
72
72
|
>
|
|
73
73
|
<div
|
|
74
|
-
class="inline-block border
|
|
75
|
-
:class="{ 'border-$slidev-theme-primary': focus(idx + 1) }"
|
|
74
|
+
class="inline-block border rounded border-opacity-50 overflow-hidden bg-main hover:border-$slidev-theme-primary"
|
|
75
|
+
:class="{ 'border-$slidev-theme-primary': focus(idx + 1), 'border-gray-400': !focus(idx + 1) }"
|
|
76
76
|
:style="themeVars"
|
|
77
77
|
@click="go(+route.path)"
|
|
78
78
|
>
|
package/logic/drawings.ts
CHANGED
|
@@ -52,7 +52,7 @@ export const drawingMode = computed({
|
|
|
52
52
|
|
|
53
53
|
export const drauuOptions: DrauuOptions = reactive({
|
|
54
54
|
brush,
|
|
55
|
-
acceptsInputTypes: computed(() => drawingEnabled.value ? undefined : ['pen' as const]),
|
|
55
|
+
acceptsInputTypes: computed(() => (drawingEnabled.value && (!configs.drawings.presenterOnly || isPresenter.value)) ? undefined : ['pen' as const]),
|
|
56
56
|
coordinateTransform: false,
|
|
57
57
|
})
|
|
58
58
|
export const drauu = markRaw(createDrauu(drauuOptions))
|
package/modules/mermaid.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.4",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,34 +16,34 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@antfu/utils": "^0.7.2",
|
|
19
|
-
"@unocss/reset": "^0.
|
|
20
|
-
"@vueuse/core": "^9.
|
|
19
|
+
"@unocss/reset": "^0.48.4",
|
|
20
|
+
"@vueuse/core": "^9.11.0",
|
|
21
21
|
"@vueuse/head": "^1.0.22",
|
|
22
|
-
"@vueuse/math": "^9.
|
|
22
|
+
"@vueuse/math": "^9.11.0",
|
|
23
23
|
"@vueuse/motion": "^2.0.0-beta.26",
|
|
24
24
|
"codemirror": "^5.65.5",
|
|
25
25
|
"defu": "^6.1.1",
|
|
26
26
|
"drauu": "^0.3.2",
|
|
27
27
|
"file-saver": "^2.0.5",
|
|
28
|
-
"js-base64": "^3.7.
|
|
28
|
+
"js-base64": "^3.7.4",
|
|
29
29
|
"js-yaml": "^4.1.0",
|
|
30
30
|
"katex": "^0.16.4",
|
|
31
31
|
"mermaid": "^9.3.0",
|
|
32
32
|
"monaco-editor": "^0.33.0",
|
|
33
33
|
"nanoid": "^4.0.0",
|
|
34
|
-
"prettier": "^2.8.
|
|
34
|
+
"prettier": "^2.8.3",
|
|
35
35
|
"recordrtc": "^5.6.2",
|
|
36
36
|
"resolve": "^1.22.1",
|
|
37
|
-
"unocss": "^0.
|
|
37
|
+
"unocss": "^0.48.4",
|
|
38
38
|
"vite-plugin-windicss": "^1.8.10",
|
|
39
39
|
"vue": "^3.2.45",
|
|
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.4",
|
|
44
|
+
"@slidev/types": "0.38.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"vite": "^4.0.
|
|
47
|
+
"vite": "^4.0.4"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/routes.ts
CHANGED
|
@@ -20,8 +20,11 @@ export const routes: RouteRecordRaw[] = [
|
|
|
20
20
|
{ name: 'print', path: '/print', component: Print },
|
|
21
21
|
{ path: '', redirect: { path: '/1' } },
|
|
22
22
|
{ path: '/:pathMatch(.*)', redirect: { path: '/1' } },
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
if (__SLIDEV_FEATURE_PRESENTER__) {
|
|
26
|
+
routes.push({ path: '/presenter/print', component: () => import('./internals/PresenterPrint.vue') })
|
|
27
|
+
routes.push({
|
|
25
28
|
name: 'presenter',
|
|
26
29
|
path: '/presenter/:no',
|
|
27
30
|
component: () => import('./internals/Presenter.vue'),
|
|
@@ -38,12 +41,12 @@ export const routes: RouteRecordRaw[] = [
|
|
|
38
41
|
return { path: `/${to.params.no}` }
|
|
39
42
|
return { path: '' }
|
|
40
43
|
},
|
|
41
|
-
}
|
|
42
|
-
{
|
|
44
|
+
})
|
|
45
|
+
routes.push({
|
|
43
46
|
path: '/presenter',
|
|
44
47
|
redirect: { path: '/presenter/1' },
|
|
45
|
-
}
|
|
46
|
-
|
|
48
|
+
})
|
|
49
|
+
}
|
|
47
50
|
|
|
48
51
|
export const router = createRouter({
|
|
49
52
|
history: __SLIDEV_HASH_ROUTE__ ? createWebHashHistory(import.meta.env.BASE_URL) : createWebHistory(import.meta.env.BASE_URL),
|
package/state/syncState.ts
CHANGED
|
@@ -7,7 +7,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
7
7
|
let patchingTimeout: NodeJS.Timeout
|
|
8
8
|
let updatingTimeout: NodeJS.Timeout
|
|
9
9
|
|
|
10
|
-
const state =
|
|
10
|
+
const state = __USE_SERVER__
|
|
11
11
|
? reactive<State>(serverState) as State
|
|
12
12
|
: reactive<State>(defaultState) as State
|
|
13
13
|
|
|
@@ -35,11 +35,11 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
35
35
|
|
|
36
36
|
function init(channelKey: string) {
|
|
37
37
|
let stateChannel: BroadcastChannel
|
|
38
|
-
if (!
|
|
38
|
+
if (!__USE_SERVER__ && !persist) {
|
|
39
39
|
stateChannel = new BroadcastChannel(channelKey)
|
|
40
40
|
stateChannel.addEventListener('message', (event: MessageEvent<Partial<State>>) => onUpdate(event.data))
|
|
41
41
|
}
|
|
42
|
-
else if (!
|
|
42
|
+
else if (!__USE_SERVER__ && persist) {
|
|
43
43
|
window.addEventListener('storage', (event) => {
|
|
44
44
|
if (event && event.key === channelKey && event.newValue)
|
|
45
45
|
onUpdate(JSON.parse(event.newValue) as Partial<State>)
|
|
@@ -56,7 +56,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
watch(state, onDrawingStateChanged, { deep: true })
|
|
59
|
-
if (!
|
|
59
|
+
if (!__USE_SERVER__ && persist) {
|
|
60
60
|
const serialzedState = window.localStorage.getItem(channelKey)
|
|
61
61
|
if (serialzedState)
|
|
62
62
|
onUpdate(JSON.parse(serialzedState) as Partial<State>)
|
package/styles/code.css
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
html.dark:root {
|
|
2
|
+
color-scheme: dark;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
html.dark .shiki-light {
|
|
2
6
|
display: none;
|
|
3
7
|
}
|
|
@@ -6,10 +10,6 @@ html:not(.dark) .shiki-dark {
|
|
|
6
10
|
display: none;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
::-webkit-scrollbar {
|
|
10
|
-
width: 0px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
13
|
.slidev-code-wrapper {
|
|
14
14
|
margin: var(--slidev-code-margin) !important;
|
|
15
15
|
&:-webkit-scrollbar {
|
package/styles/layouts-base.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
h1 {
|
|
9
|
-
@apply text-4xl mb-4
|
|
9
|
+
@apply text-4xl mb-4;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
h2 {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
h6 {
|
|
29
|
-
@apply text-sm pt-1 uppercase tracking-widest font-500
|
|
29
|
+
@apply text-sm pt-1 uppercase tracking-widest font-500;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
h6:not(.opacity-100) {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
li {
|
|
49
|
-
@apply
|
|
49
|
+
@apply leading-1.8em;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
blockquote {
|
|
@@ -86,3 +86,34 @@
|
|
|
86
86
|
@apply bg-gray-400 bg-opacity-5 py-0.5 px-1 text-xs font-mono;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
.slidev-layout,
|
|
91
|
+
[dir=ltr],
|
|
92
|
+
.slidev-layout [dir=ltr] {
|
|
93
|
+
h1 {
|
|
94
|
+
@apply -ml-[0.05em] mr-0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
h6 {
|
|
98
|
+
@apply -ml-[0.05em] mr-0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
li {
|
|
102
|
+
@apply ml-1.1em pl-0.2em mr-0 pr-0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[dir=rtl],
|
|
107
|
+
.slidev-layout [dir=rtl] {
|
|
108
|
+
h1 {
|
|
109
|
+
@apply -mr-[0.05em] ml-0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
h6 {
|
|
113
|
+
@apply -mr-[0.05em] ml-0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
li {
|
|
117
|
+
@apply mr-1.1em pr-0.2em ml-0 pl-0;
|
|
118
|
+
}
|
|
119
|
+
}
|