@slidev/client 0.31.1 → 0.31.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/Link.vue +2 -2
- package/builtin/Mermaid.vue +2 -1
- package/constants.ts +2 -0
- package/internals/DrawingLayer.vue +3 -2
- package/internals/NavControls.vue +5 -4
- package/internals/Presenter.vue +1 -0
- package/internals/PrintSlideClick.vue +1 -0
- package/internals/ShadowRoot.vue +18 -0
- package/internals/SlideWrapper.ts +6 -1
- package/internals/SlidesOverview.vue +1 -0
- package/internals/SlidesShow.vue +1 -0
- package/logic/nav.ts +2 -0
- package/package.json +7 -7
- package/routes.ts +14 -0
package/builtin/Link.vue
CHANGED
|
@@ -19,8 +19,8 @@ defineProps<{
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
|
-
<RouterLink v-if="!isPrintMode && title" :to="to" @click="$event.target.blur()" v-html="title" />
|
|
23
|
-
<RouterLink v-else-if="!isPrintMode && !title" :to="to" @click="$event.target.blur()">
|
|
22
|
+
<RouterLink v-if="!isPrintMode && title" :to="String(to)" @click="$event.target.blur()" v-html="title" />
|
|
23
|
+
<RouterLink v-else-if="!isPrintMode && !title" :to="String(to)" @click="$event.target.blur()">
|
|
24
24
|
<slot />
|
|
25
25
|
</RouterLink>
|
|
26
26
|
<a v-else-if="isPrintMode && title" :href="`#${to}`" v-html="title" />
|
package/builtin/Mermaid.vue
CHANGED
|
@@ -15,6 +15,7 @@ pie
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import { computed, getCurrentInstance, ref, watch, watchEffect } from 'vue'
|
|
17
17
|
import { renderMermaid } from '../modules/mermaid'
|
|
18
|
+
import ShadowRoot from '../internals/ShadowRoot.vue'
|
|
18
19
|
|
|
19
20
|
const props = defineProps<{
|
|
20
21
|
code: string
|
|
@@ -51,5 +52,5 @@ watchEffect(() => {
|
|
|
51
52
|
</script>
|
|
52
53
|
|
|
53
54
|
<template>
|
|
54
|
-
<
|
|
55
|
+
<ShadowRoot class="mermaid" :inner-html="html" />
|
|
55
56
|
</template>
|
package/constants.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComputedRef, InjectionKey, Ref } from 'vue'
|
|
2
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
3
|
import type { SlidevContext } from './modules/context'
|
|
3
4
|
|
|
4
5
|
export const injectionClicks: InjectionKey<Ref<number>> = Symbol('v-click-clicks')
|
|
@@ -7,6 +8,7 @@ export const injectionOrderMap: InjectionKey<Ref<Map<number, HTMLElement[]>>> =
|
|
|
7
8
|
export const injectionClicksDisabled: InjectionKey<Ref<boolean>> = Symbol('v-click-clicks-disabled')
|
|
8
9
|
export const injectionSlideScale: InjectionKey<ComputedRef<number>> = Symbol('slidev-slide-scale')
|
|
9
10
|
export const injectionSlidevContext: InjectionKey<SlidevContext> = Symbol('slidev-slidev-context')
|
|
11
|
+
export const injectionRoute: InjectionKey<RouteRecordRaw> = Symbol('slidev-route')
|
|
10
12
|
|
|
11
13
|
export const CLASS_VCLICK_TARGET = 'slidev-vclick-target'
|
|
12
14
|
export const CLASS_VCLICK_HIDDEN = 'slidev-vclick-hidden'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
3
|
-
import { drauu, loadCanvas } from '../logic/drawings'
|
|
3
|
+
import { drauu, drawingEnabled, loadCanvas } from '../logic/drawings'
|
|
4
4
|
import { injectionSlideScale } from '../constants'
|
|
5
5
|
|
|
6
6
|
const scale = inject(injectionSlideScale)!
|
|
@@ -20,6 +20,7 @@ onBeforeUnmount(() => {
|
|
|
20
20
|
<template>
|
|
21
21
|
<svg
|
|
22
22
|
ref="svg"
|
|
23
|
-
class="w-full h-full absolute top-0
|
|
23
|
+
class="w-full h-full absolute top-0"
|
|
24
|
+
:class="{ 'pointer-events-none': !drawingEnabled, 'touch-none': drawingEnabled }"
|
|
24
25
|
/>
|
|
25
26
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, shallowRef } from 'vue'
|
|
3
3
|
import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
|
|
4
|
-
import { currentPage, downloadPDF, hasNext, hasPrev, isEmbedded, isPresenter, next, prev, total } from '../logic/nav'
|
|
4
|
+
import { currentPage, downloadPDF, hasNext, hasPrev, isEmbedded, isPresenter, next, presenterPassword, prev, showPresenter, total } from '../logic/nav'
|
|
5
5
|
import { activeElement, breakpoints, fullscreen, showEditor, showInfoDialog, showPresenterCursor, toggleOverview } from '../state'
|
|
6
6
|
import { brush, drawingEnabled } from '../logic/drawings'
|
|
7
7
|
import { configs } from '../env'
|
|
@@ -20,8 +20,9 @@ const props = defineProps({
|
|
|
20
20
|
const md = breakpoints.smaller('md')
|
|
21
21
|
const { isFullscreen, toggle: toggleFullscreen } = fullscreen
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const query = computed(() => presenterPassword.value ? `?password=${presenterPassword.value}` : '')
|
|
24
|
+
const presenterLink = computed(() => `/presenter/${currentPage.value}${query.value}`)
|
|
25
|
+
const nonPresenterLink = computed(() => `/${currentPage.value}${query.value}`)
|
|
25
26
|
|
|
26
27
|
const root = ref<HTMLDivElement>()
|
|
27
28
|
const onMouseLeave = () => {
|
|
@@ -112,7 +113,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
112
113
|
<RouterLink v-if="isPresenter" :to="nonPresenterLink" class="icon-btn" title="Play Mode">
|
|
113
114
|
<carbon:presentation-file />
|
|
114
115
|
</RouterLink>
|
|
115
|
-
<RouterLink v-if="
|
|
116
|
+
<RouterLink v-if="showPresenter" :to="presenterLink" class="icon-btn" title="Presenter Mode">
|
|
116
117
|
<carbon:user-speaker />
|
|
117
118
|
</RouterLink>
|
|
118
119
|
|
package/internals/Presenter.vue
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watchEffect } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
innerHtml: string
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const el = ref<HTMLDivElement>()
|
|
9
|
+
const shadow = computed(() => el.value ? (el.value.shadowRoot || el.value.attachShadow({ mode: 'open' })) : null)
|
|
10
|
+
watchEffect(() => {
|
|
11
|
+
if (shadow.value)
|
|
12
|
+
shadow.value.innerHTML = props.innerHtml
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div ref="el" />
|
|
18
|
+
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useVModel } from '@vueuse/core'
|
|
2
2
|
import { defineComponent, h, provide } from 'vue'
|
|
3
|
-
import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap } from '../constants'
|
|
3
|
+
import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute } from '../constants'
|
|
4
4
|
|
|
5
5
|
export default defineComponent({
|
|
6
6
|
props: {
|
|
@@ -24,6 +24,10 @@ export default defineComponent({
|
|
|
24
24
|
type: Object,
|
|
25
25
|
default: undefined,
|
|
26
26
|
},
|
|
27
|
+
route: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: undefined,
|
|
30
|
+
},
|
|
27
31
|
},
|
|
28
32
|
setup(props, { emit }) {
|
|
29
33
|
const clicks = useVModel(props, 'clicks', emit)
|
|
@@ -33,6 +37,7 @@ export default defineComponent({
|
|
|
33
37
|
|
|
34
38
|
clicksElements.value.length = 0
|
|
35
39
|
|
|
40
|
+
provide(injectionRoute, props.route)
|
|
36
41
|
provide(injectionClicks, clicks)
|
|
37
42
|
provide(injectionClicksDisabled, clicksDisabled)
|
|
38
43
|
provide(injectionClicksElements, clicksElements)
|
package/internals/SlidesShow.vue
CHANGED
package/logic/nav.ts
CHANGED
|
@@ -36,6 +36,8 @@ export const isPrintWithClicks = computed(() => route.value.query.print === 'cli
|
|
|
36
36
|
export const isEmbedded = computed(() => route.value.query.embedded !== undefined)
|
|
37
37
|
export const isPresenter = computed(() => route.value.path.startsWith('/presenter'))
|
|
38
38
|
export const isClicksDisabled = computed(() => isPrintMode.value && !isPrintWithClicks.value)
|
|
39
|
+
export const presenterPassword = computed(() => route.value.query.password)
|
|
40
|
+
export const showPresenter = computed(() => !isPresenter.value && (!configs.remote || presenterPassword.value === configs.remote))
|
|
39
41
|
|
|
40
42
|
export const queryClicks = useRouteQuery('clicks', '0')
|
|
41
43
|
export const total = computed(() => rawRoutes.length - 1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.4",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"homepage": "https://sli.dev",
|
|
6
6
|
"bugs": "https://github.com/slidevjs/slidev/issues",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"funding": "https://github.com/sponsors/antfu",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@antfu/utils": "^0.5.
|
|
16
|
-
"@slidev/parser": "0.31.
|
|
17
|
-
"@slidev/types": "0.31.
|
|
18
|
-
"@vueuse/core": "^8.4.
|
|
15
|
+
"@antfu/utils": "^0.5.2",
|
|
16
|
+
"@slidev/parser": "0.31.4",
|
|
17
|
+
"@slidev/types": "0.31.4",
|
|
18
|
+
"@vueuse/core": "^8.4.2",
|
|
19
19
|
"@vueuse/head": "^0.7.6",
|
|
20
20
|
"@vueuse/motion": "^2.0.0-beta.18",
|
|
21
21
|
"codemirror": "^5.65.3",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"js-base64": "^3.7.2",
|
|
26
26
|
"js-yaml": "^4.1.0",
|
|
27
27
|
"katex": "^0.15.3",
|
|
28
|
-
"mermaid": "^9.
|
|
28
|
+
"mermaid": "^9.1.1",
|
|
29
29
|
"monaco-editor": "^0.33.0",
|
|
30
30
|
"nanoid": "^3.3.4",
|
|
31
31
|
"prettier": "^2.6.2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"vue": "^3.2.33",
|
|
36
36
|
"vue-router": "^4.0.15",
|
|
37
37
|
"vue-starport": "^0.2.10",
|
|
38
|
-
"windicss": "^3.5.
|
|
38
|
+
"windicss": "^3.5.3"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=14.0.0"
|
package/routes.ts
CHANGED
|
@@ -4,6 +4,7 @@ import Play from './internals/Play.vue'
|
|
|
4
4
|
import Print from './internals/Print.vue'
|
|
5
5
|
// @ts-expect-error missing types
|
|
6
6
|
import _rawRoutes from '/@slidev/routes'
|
|
7
|
+
import _configs from '/@slidev/configs'
|
|
7
8
|
|
|
8
9
|
export const rawRoutes = _rawRoutes as RouteRecordRaw[]
|
|
9
10
|
|
|
@@ -23,6 +24,19 @@ export const routes: RouteRecordRaw[] = [
|
|
|
23
24
|
name: 'presenter',
|
|
24
25
|
path: '/presenter/:no',
|
|
25
26
|
component: () => import('./internals/Presenter.vue'),
|
|
27
|
+
beforeEnter: (to) => {
|
|
28
|
+
if (!_configs.remote || _configs.remote === to.query.password)
|
|
29
|
+
return true
|
|
30
|
+
if (_configs.remote && to.query.password === undefined) {
|
|
31
|
+
// eslint-disable-next-line no-alert
|
|
32
|
+
const password = prompt('Enter password')
|
|
33
|
+
if (_configs.remote === password)
|
|
34
|
+
return true
|
|
35
|
+
}
|
|
36
|
+
if (to.params.no)
|
|
37
|
+
return { path: `/${to.params.no}` }
|
|
38
|
+
return { path: '' }
|
|
39
|
+
},
|
|
26
40
|
},
|
|
27
41
|
{
|
|
28
42
|
path: '/presenter',
|