@slidev/client 0.40.12 → 0.40.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/env.ts +1 -0
- package/internals/NavControls.vue +1 -0
- package/internals/PrintSlideClick.vue +2 -0
- package/internals/SlidesShow.vue +2 -0
- package/package.json +6 -6
- package/routes.ts +2 -0
- package/setup/root.ts +6 -3
- package/state/syncState.ts +6 -5
package/env.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { configs } from '../env'
|
|
|
8
8
|
import Settings from './Settings.vue'
|
|
9
9
|
import MenuButton from './MenuButton.vue'
|
|
10
10
|
import VerticalDivider from './VerticalDivider.vue'
|
|
11
|
+
|
|
11
12
|
// @ts-expect-error virtual module
|
|
12
13
|
import CustomNavControls from '/@slidev/custom-nav-controls'
|
|
13
14
|
|
|
@@ -8,8 +8,10 @@ import { configs, slideHeight, slideWidth } from '../env'
|
|
|
8
8
|
import { getSlideClass } from '../utils'
|
|
9
9
|
import type { SlidevContextNav } from '../modules/context'
|
|
10
10
|
import SlideWrapper from './SlideWrapper'
|
|
11
|
+
|
|
11
12
|
// @ts-expect-error virtual module
|
|
12
13
|
import GlobalTop from '/@slidev/global-components/top'
|
|
14
|
+
|
|
13
15
|
// @ts-expect-error virtual module
|
|
14
16
|
import GlobalBottom from '/@slidev/global-components/bottom'
|
|
15
17
|
|
package/internals/SlidesShow.vue
CHANGED
|
@@ -3,8 +3,10 @@ import { computed, shallowRef, watch } from 'vue'
|
|
|
3
3
|
import { clicks, currentRoute, isPresenter, nextRoute, rawRoutes, transition } from '../logic/nav'
|
|
4
4
|
import { getSlideClass } from '../utils'
|
|
5
5
|
import SlideWrapper from './SlideWrapper'
|
|
6
|
+
|
|
6
7
|
// @ts-expect-error virtual module
|
|
7
8
|
import GlobalTop from '/@slidev/global-components/top'
|
|
9
|
+
|
|
8
10
|
// @ts-expect-error virtual module
|
|
9
11
|
import GlobalBottom from '/@slidev/global-components/bottom'
|
|
10
12
|
import PresenterMouse from './PresenterMouse.vue'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.14",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@antfu/utils": "^0.7.2",
|
|
19
|
-
"@unocss/reset": "^0.51.
|
|
19
|
+
"@unocss/reset": "^0.51.5",
|
|
20
20
|
"@vueuse/core": "^10.0.2",
|
|
21
21
|
"@vueuse/head": "^1.1.26",
|
|
22
22
|
"@vueuse/math": "^10.0.2",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"prettier": "^2.8.7",
|
|
36
36
|
"recordrtc": "^5.6.2",
|
|
37
37
|
"resolve": "^1.22.2",
|
|
38
|
-
"unocss": "^0.51.
|
|
38
|
+
"unocss": "^0.51.5",
|
|
39
39
|
"vite-plugin-windicss": "^1.8.10",
|
|
40
40
|
"vue": "^3.2.47",
|
|
41
41
|
"vue-router": "^4.1.6",
|
|
42
42
|
"vue-starport": "^0.3.0",
|
|
43
43
|
"windicss": "^3.5.6",
|
|
44
|
-
"@slidev/parser": "0.40.
|
|
45
|
-
"@slidev/types": "0.40.
|
|
44
|
+
"@slidev/parser": "0.40.14",
|
|
45
|
+
"@slidev/types": "0.40.14"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"vite": "^4.
|
|
48
|
+
"vite": "^4.3.0"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/routes.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router
|
|
|
3
3
|
import type { TransitionGroupProps } from 'vue'
|
|
4
4
|
import Play from './internals/Play.vue'
|
|
5
5
|
import Print from './internals/Print.vue'
|
|
6
|
+
|
|
6
7
|
// @ts-expect-error missing types
|
|
7
8
|
import _rawRoutes from '/@slidev/routes'
|
|
9
|
+
|
|
8
10
|
// @ts-expect-error missing types
|
|
9
11
|
import _configs from '/@slidev/configs'
|
|
10
12
|
|
package/setup/root.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
import { watch } from 'vue'
|
|
3
|
-
import { useHead
|
|
3
|
+
import { useHead } from '@vueuse/head'
|
|
4
4
|
import { nanoid } from 'nanoid'
|
|
5
5
|
import { configs } from '../env'
|
|
6
6
|
import { initSharedState, onPatch, patch } from '../state/shared'
|
|
@@ -17,8 +17,10 @@ export default function setupRoot() {
|
|
|
17
17
|
/* __injections__ */
|
|
18
18
|
|
|
19
19
|
const title = configs.titleTemplate.replace('%s', configs.title || 'Slidev')
|
|
20
|
-
useHead({
|
|
21
|
-
|
|
20
|
+
useHead({
|
|
21
|
+
title,
|
|
22
|
+
htmlAttrs: configs.htmlAttrs,
|
|
23
|
+
})
|
|
22
24
|
initSharedState(`${title} - shared`)
|
|
23
25
|
initDrawingState(`${title} - drawings`)
|
|
24
26
|
|
|
@@ -41,6 +43,7 @@ export default function setupRoot() {
|
|
|
41
43
|
patch('viewerPage', +currentPage.value)
|
|
42
44
|
patch('viewerClicks', clicks.value)
|
|
43
45
|
}
|
|
46
|
+
|
|
44
47
|
patch('lastUpdate', {
|
|
45
48
|
id,
|
|
46
49
|
type: isPresenter.value ? 'presenter' : 'viewer',
|
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 = __SLIDEV_HAS_SERVER__
|
|
11
11
|
? reactive<State>(serverState) as State
|
|
12
12
|
: reactive<State>(defaultState) as State
|
|
13
13
|
|
|
@@ -37,11 +37,11 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
37
37
|
|
|
38
38
|
function init(channelKey: string) {
|
|
39
39
|
let stateChannel: BroadcastChannel
|
|
40
|
-
if (!
|
|
40
|
+
if (!__SLIDEV_HAS_SERVER__ && !persist) {
|
|
41
41
|
stateChannel = new BroadcastChannel(channelKey)
|
|
42
42
|
stateChannel.addEventListener('message', (event: MessageEvent<Partial<State>>) => onUpdate(event.data))
|
|
43
43
|
}
|
|
44
|
-
else if (!
|
|
44
|
+
else if (!__SLIDEV_HAS_SERVER__ && persist) {
|
|
45
45
|
window.addEventListener('storage', (event) => {
|
|
46
46
|
if (event && event.key === channelKey && event.newValue)
|
|
47
47
|
onUpdate(JSON.parse(event.newValue) as Partial<State>)
|
|
@@ -57,8 +57,9 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
57
57
|
onPatchCallbacks.forEach((fn: (state: State) => void) => fn(state))
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
watch(state, onStateChanged, { deep: true })
|
|
61
|
-
|
|
60
|
+
watch(state, onStateChanged, { deep: true, flush: 'sync' })
|
|
61
|
+
|
|
62
|
+
if (!__SLIDEV_HAS_SERVER__ && persist) {
|
|
62
63
|
const serialzedState = window.localStorage.getItem(channelKey)
|
|
63
64
|
if (serialzedState)
|
|
64
65
|
onUpdate(JSON.parse(serialzedState) as Partial<State>)
|