@slidev/client 0.27.18 → 0.28.1
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/AutoFitText.vue +4 -3
- package/builtin/CodeHighlightController.vue +1 -1
- package/builtin/Mermaid.vue +1 -1
- package/builtin/Monaco.vue +2 -2
- package/builtin/PlantUml.vue +1 -1
- package/builtin/Toc.vue +83 -0
- package/builtin/TocList.vue +27 -0
- package/builtin/Tweet.vue +3 -3
- package/builtin/VAfter.ts +2 -1
- package/builtin/VClicks.ts +2 -1
- package/builtin/Youtube.vue +1 -1
- package/constants.ts +1 -1
- package/env.ts +2 -2
- package/internals/Controls.vue +1 -1
- package/internals/DevicesList.vue +1 -1
- package/internals/Draggable.vue +2 -2
- package/internals/DrawingControls.vue +4 -4
- package/internals/DrawingLayer.vue +2 -2
- package/internals/DrawingPreview.vue +2 -2
- package/internals/Editor.vue +8 -8
- package/internals/Goto.vue +1 -1
- package/internals/InfoDialog.vue +2 -2
- package/internals/Modal.vue +1 -1
- package/internals/NavControls.vue +5 -5
- package/internals/NoteEditor.vue +2 -2
- package/internals/Play.vue +8 -8
- package/internals/Presenter.vue +5 -5
- package/internals/RecordingDialog.vue +4 -4
- package/internals/SlideContainer.vue +1 -1
- package/internals/SlideWrapper.ts +1 -1
- package/internals/SlidesShow.vue +3 -3
- package/internals/WebCamera.vue +2 -3
- package/layouts/iframe-left.vue +2 -11
- package/layouts/iframe-right.vue +2 -11
- package/layouts/iframe.vue +2 -8
- package/layouts/image-left.vue +1 -1
- package/layouts/image-right.vue +1 -1
- package/logic/drawings.ts +4 -3
- package/logic/nav.ts +68 -2
- package/logic/note.ts +4 -2
- package/logic/recording.ts +5 -4
- package/logic/shortcuts.ts +5 -3
- package/logic/utils.ts +1 -1
- package/modules/context.ts +4 -3
- package/modules/directives.ts +10 -9
- package/modules/mermaid.ts +1 -1
- package/package.json +18 -17
- package/routes.ts +5 -2
- package/setup/codemirror.ts +2 -1
- package/setup/main.ts +2 -2
- package/setup/mermaid.ts +2 -1
- package/setup/monaco.ts +3 -3
- package/setup/prettier.ts +4 -5
- package/setup/root.ts +2 -2
- package/setup/shortcuts.ts +4 -4
- package/shim.d.ts +1 -1
- package/state/index.ts +1 -1
package/builtin/AutoFitText.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[Expiremental]
|
|
3
3
|
|
|
4
4
|
Think this component as the TextBox you that will see
|
|
5
|
-
in PowerPoint or Keynote. It will
|
|
5
|
+
in PowerPoint or Keynote. It will automatically resize
|
|
6
6
|
the font size based on it's content to fit them in.
|
|
7
7
|
|
|
8
8
|
Usage:
|
|
@@ -18,7 +18,9 @@ or
|
|
|
18
18
|
import { useElementSize, useVModel } from '@vueuse/core'
|
|
19
19
|
import { computed, ref, watch } from 'vue'
|
|
20
20
|
|
|
21
|
-
const emit = defineEmits<{
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(e: any): void
|
|
23
|
+
}>()
|
|
22
24
|
const props = defineProps({
|
|
23
25
|
modelValue: {
|
|
24
26
|
default: '',
|
|
@@ -34,7 +36,6 @@ const props = defineProps({
|
|
|
34
36
|
const container = ref<HTMLDivElement>()
|
|
35
37
|
const inner = ref<HTMLDivElement>()
|
|
36
38
|
const size = ref(100)
|
|
37
|
-
// @ts-ignore
|
|
38
39
|
const fontSize = computed(() => `${size.value}px`)
|
|
39
40
|
const value = useVModel(props, 'modelValue', emit)
|
|
40
41
|
|
|
@@ -15,7 +15,7 @@ Learn more: https://sli.dev/guide/syntax.html#line-highlighting
|
|
|
15
15
|
import { range, remove } from '@antfu/utils'
|
|
16
16
|
import { parseRangeString } from '@slidev/parser/core'
|
|
17
17
|
import { computed, getCurrentInstance, inject, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
18
|
-
import {
|
|
18
|
+
import { CLASS_VCLICK_TARGET, injectionClicks, injectionClicksDisabled, injectionClicksElements } from '../constants'
|
|
19
19
|
|
|
20
20
|
const props = defineProps({
|
|
21
21
|
ranges: {
|
package/builtin/Mermaid.vue
CHANGED
package/builtin/Monaco.vue
CHANGED
|
@@ -12,11 +12,11 @@ Learn more: https://sli.dev/guide/syntax.html#monaco-editor
|
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
|
-
<iframe ref="iframe" class="text-base w-full rounded" :style="{ height }"
|
|
15
|
+
<iframe ref="iframe" class="text-base w-full rounded" :style="{ height }" />
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
|
-
import {
|
|
19
|
+
import { computed, onMounted, ref, watchEffect } from 'vue'
|
|
20
20
|
import { useEventListener } from '@vueuse/core'
|
|
21
21
|
import { decode } from 'js-base64'
|
|
22
22
|
import { nanoid } from 'nanoid'
|
package/builtin/PlantUml.vue
CHANGED
package/builtin/Toc.vue
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Table Of content
|
|
3
|
+
|
|
4
|
+
`mode` can be either 'all', 'onlyCurrentTree' or 'onlySiblings'
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
|
|
8
|
+
<Toc columns='2' maxDepth='3' mode='onlySiblings'/>
|
|
9
|
+
-->
|
|
10
|
+
<script setup lang='ts'>
|
|
11
|
+
import { computed } from 'vue'
|
|
12
|
+
import type { TocItem } from '../logic/nav'
|
|
13
|
+
import { tree } from '../logic/nav'
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
columns?: string | number
|
|
18
|
+
maxDepth?: string | number
|
|
19
|
+
minDepth?: string | number
|
|
20
|
+
mode?: 'all' | 'onlyCurrentTree' | 'onlySiblings'
|
|
21
|
+
}>(),
|
|
22
|
+
{
|
|
23
|
+
columns: 1,
|
|
24
|
+
maxDepth: Infinity,
|
|
25
|
+
minDepth: 1,
|
|
26
|
+
mode: 'all',
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
function filterTreeDepth(tree: TocItem[], level = 1): TocItem[] {
|
|
31
|
+
if (level > Number(props.maxDepth)) {
|
|
32
|
+
return []
|
|
33
|
+
}
|
|
34
|
+
else if (level < Number(props.minDepth)) {
|
|
35
|
+
const activeItem = tree.find((item: TocItem) => item.active || item.activeParent)
|
|
36
|
+
return activeItem ? filterTreeDepth(activeItem.children, level + 1) : []
|
|
37
|
+
}
|
|
38
|
+
return tree
|
|
39
|
+
.map((item: TocItem) => ({
|
|
40
|
+
...item,
|
|
41
|
+
children: filterTreeDepth(item.children, level + 1),
|
|
42
|
+
}))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function filterOnlyCurrentTree(tree: TocItem[]): TocItem[] {
|
|
46
|
+
return tree
|
|
47
|
+
.filter(
|
|
48
|
+
(item: TocItem) =>
|
|
49
|
+
item.active || item.activeParent || item.hasActiveParent,
|
|
50
|
+
)
|
|
51
|
+
.map((item: TocItem) => ({
|
|
52
|
+
...item,
|
|
53
|
+
children: filterOnlyCurrentTree(item.children),
|
|
54
|
+
}))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function filterOnlySiblings(tree: TocItem[]): TocItem[] {
|
|
58
|
+
const treehasActiveItem = tree.some(
|
|
59
|
+
(item: TocItem) => item.active || item.activeParent || item.hasActiveParent,
|
|
60
|
+
)
|
|
61
|
+
return tree
|
|
62
|
+
.filter(() => treehasActiveItem)
|
|
63
|
+
.map((item: TocItem) => ({
|
|
64
|
+
...item,
|
|
65
|
+
children: filterOnlySiblings(item.children),
|
|
66
|
+
}))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const toc = computed(() => {
|
|
70
|
+
let tocTree = filterTreeDepth(tree.value)
|
|
71
|
+
if (props.mode === 'onlyCurrentTree')
|
|
72
|
+
tocTree = filterOnlyCurrentTree(tocTree)
|
|
73
|
+
else if (props.mode === 'onlySiblings')
|
|
74
|
+
tocTree = filterOnlySiblings(tocTree)
|
|
75
|
+
return tocTree
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<div :style="`column-count:${columns}`">
|
|
81
|
+
<TocList :level="1" :list="toc" />
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TOC list
|
|
3
|
+
(used by Toc component, you don't need to use this component directly)
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
|
|
7
|
+
<TocList :list="list"/>
|
|
8
|
+
-->
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import type { TocItem } from '../logic/nav'
|
|
11
|
+
|
|
12
|
+
withDefaults(defineProps<{
|
|
13
|
+
level: number
|
|
14
|
+
list: TocItem[]
|
|
15
|
+
}>(), { level: 1 })
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<ul v-if="list && list.length > 0" :class="['toc', `toc-level-${level}`]">
|
|
20
|
+
<li v-for="item in list" :key="item.path" :class="['toc-item', {'toc-item-active': item.active}, {'toc-item-parent-active': item.activeParent}]">
|
|
21
|
+
<RouterLink :to="item.path">
|
|
22
|
+
{{ item.title }}
|
|
23
|
+
</RouterLink>
|
|
24
|
+
<TocList :level="level + 1" :list="item.children" />
|
|
25
|
+
</li>
|
|
26
|
+
</ul>
|
|
27
|
+
</template>
|
package/builtin/Tweet.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
A simple wrapper for
|
|
2
|
+
A simple wrapper for embedded Tweet
|
|
3
3
|
|
|
4
4
|
Usage:
|
|
5
5
|
|
|
@@ -23,7 +23,7 @@ const vm = getCurrentInstance()!
|
|
|
23
23
|
const loaded = ref(false)
|
|
24
24
|
|
|
25
25
|
async function create() {
|
|
26
|
-
// @ts-
|
|
26
|
+
// @ts-expect-error global
|
|
27
27
|
await window.twttr.widgets.createTweet(
|
|
28
28
|
props.id.toString(),
|
|
29
29
|
tweet.value,
|
|
@@ -35,7 +35,7 @@ async function create() {
|
|
|
35
35
|
loaded.value = true
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// @ts-
|
|
38
|
+
// @ts-expect-error global
|
|
39
39
|
if (window?.twttr?.widgets) {
|
|
40
40
|
onMounted(create)
|
|
41
41
|
}
|
package/builtin/VAfter.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { toArray } from '@antfu/utils'
|
|
8
|
-
import {
|
|
8
|
+
import type { Directive, VNode } from 'vue'
|
|
9
|
+
import { defineComponent, h, resolveDirective, withDirectives } from 'vue'
|
|
9
10
|
|
|
10
11
|
export default defineComponent({
|
|
11
12
|
render() {
|
package/builtin/VClicks.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { toArray } from '@antfu/utils'
|
|
8
|
-
import {
|
|
8
|
+
import type { Directive, VNode, VNodeArrayChildren } from 'vue'
|
|
9
|
+
import { defineComponent, h, isVNode, resolveDirective, withDirectives } from 'vue'
|
|
9
10
|
|
|
10
11
|
export default defineComponent({
|
|
11
12
|
props: {
|
package/builtin/Youtube.vue
CHANGED
package/constants.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComputedRef, InjectionKey, Ref } from 'vue'
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref } from 'vue'
|
|
2
2
|
|
|
3
3
|
export const injectionClicks: InjectionKey<Ref<number>> = Symbol('v-click-clicks')
|
|
4
4
|
export const injectionClicksElements: InjectionKey<Ref<(Element | string)[]>> = Symbol('v-click-clicks-elements')
|
package/env.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SlidevConfig } from '@slidev/types'
|
|
1
|
+
import type { SlidevConfig } from '@slidev/types'
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { objectMap } from '@antfu/utils'
|
|
4
|
-
// @ts-expect-error
|
|
4
|
+
// @ts-expect-error missing types
|
|
5
5
|
import _configs from '/@slidev/configs'
|
|
6
6
|
import _serverState from 'server-reactive:nav'
|
|
7
7
|
import _serverDrawingState from 'server-reactive:drawings?diff'
|
package/internals/Controls.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { shallowRef } from 'vue'
|
|
3
|
-
import { showOverview, showRecordingDialog
|
|
3
|
+
import { showInfoDialog, showOverview, showRecordingDialog } from '../state'
|
|
4
4
|
import { configs } from '../env'
|
|
5
5
|
import SlidesOverview from './SlidesOverview.vue'
|
|
6
6
|
import InfoDialog from './InfoDialog.vue'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { currentCamera, currentMic } from '../state'
|
|
4
|
-
import { cameras,
|
|
4
|
+
import { cameras, ensureDevicesListPermissions, microphones } from '../logic/recording'
|
|
5
5
|
import SelectList from './SelectList.vue'
|
|
6
6
|
import type { SelectionItem } from './types'
|
|
7
7
|
|
package/internals/Draggable.vue
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
-
import {
|
|
3
|
+
import { useDraggable, useStorage } from '@vueuse/core'
|
|
4
4
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
storageKey?: string
|
|
7
|
-
initial?: {x: number; y: number}
|
|
7
|
+
initial?: { x: number; y: number }
|
|
8
8
|
}>()
|
|
9
9
|
|
|
10
10
|
const el = ref<HTMLElement | null>(null)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
brush, brushColors, canClear,
|
|
4
|
+
canRedo, canUndo, clearDrauu,
|
|
5
|
+
drauu, drawingEnabled, drawingMode, drawingPinned,
|
|
6
6
|
} from '../logic/drawings'
|
|
7
7
|
import VerticalDivider from './VerticalDivider.vue'
|
|
8
8
|
import Draggable from './Draggable.vue'
|
|
@@ -36,7 +36,7 @@ function setBrushColor(color: typeof brush.color) {
|
|
|
36
36
|
</button>
|
|
37
37
|
<button class="icon-btn" :class="{ shallow: drawingMode != 'line' }" @click="setDrawingMode('line')">
|
|
38
38
|
<svg width="1em" height="1em" class="-mt-0.5" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
|
|
39
|
-
<path d="M21.71 3.29a1 1 0 0 0-1.42 0l-18 18a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l18-18a1 1 0 0 0 0-1.42z" fill="currentColor"
|
|
39
|
+
<path d="M21.71 3.29a1 1 0 0 0-1.42 0l-18 18a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l18-18a1 1 0 0 0 0-1.42z" fill="currentColor" />
|
|
40
40
|
</svg>
|
|
41
41
|
</button>
|
|
42
42
|
<button class="icon-btn" :class="{ shallow: drawingMode != 'arrow' }" @click="setDrawingMode('arrow')">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
3
3
|
import { drauu, loadCanvas } from '../logic/drawings'
|
|
4
4
|
import { injectionSlideScale } from '../constants'
|
|
5
5
|
|
|
@@ -21,5 +21,5 @@ onBeforeUnmount(() => {
|
|
|
21
21
|
<svg
|
|
22
22
|
ref="svg"
|
|
23
23
|
class="w-full h-full absolute top-0 pointer-events-none"
|
|
24
|
-
|
|
24
|
+
/>
|
|
25
25
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { drawingState } from '../logic/drawings'
|
|
3
3
|
|
|
4
|
-
defineProps<{page: number}>()
|
|
4
|
+
defineProps<{ page: number }>()
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<template>
|
|
@@ -10,5 +10,5 @@ defineProps<{page: number}>()
|
|
|
10
10
|
ref="svg"
|
|
11
11
|
class="w-full h-full absolute top-0 pointer-events-none"
|
|
12
12
|
v-html="drawingState[page]"
|
|
13
|
-
|
|
13
|
+
/>
|
|
14
14
|
</template>
|
package/internals/Editor.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { computed,
|
|
4
|
-
import { activeElement,
|
|
2
|
+
import { throttledWatch, useEventListener } from '@vueuse/core'
|
|
3
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
4
|
+
import { activeElement, editorWidth, isInputting, showEditor } from '../state'
|
|
5
5
|
import { useCodeMirror } from '../setup/codemirror'
|
|
6
6
|
import { currentSlideId, openInEditor } from '../logic/nav'
|
|
7
7
|
import { useDynamicSlideInfo } from '../logic/note'
|
|
@@ -66,7 +66,7 @@ onMounted(() => {
|
|
|
66
66
|
{
|
|
67
67
|
mode: 'markdown',
|
|
68
68
|
lineWrapping: true,
|
|
69
|
-
// @ts-
|
|
69
|
+
// @ts-expect-error missing types
|
|
70
70
|
highlightFormatting: true,
|
|
71
71
|
fencedCodeBlockDefaultMode: 'javascript',
|
|
72
72
|
},
|
|
@@ -84,7 +84,7 @@ onMounted(() => {
|
|
|
84
84
|
{
|
|
85
85
|
mode: 'markdown',
|
|
86
86
|
lineWrapping: true,
|
|
87
|
-
// @ts-
|
|
87
|
+
// @ts-expect-error missing types
|
|
88
88
|
highlightFormatting: true,
|
|
89
89
|
fencedCodeBlockDefaultMode: 'javascript',
|
|
90
90
|
},
|
|
@@ -100,7 +100,7 @@ function updateWidth(v: number) {
|
|
|
100
100
|
}
|
|
101
101
|
function switchTab(newTab: typeof tab.value) {
|
|
102
102
|
tab.value = newTab
|
|
103
|
-
// @ts-expect-error
|
|
103
|
+
// @ts-expect-error force cast
|
|
104
104
|
document.activeElement?.blur?.()
|
|
105
105
|
}
|
|
106
106
|
useEventListener('pointermove', (e) => {
|
|
@@ -130,7 +130,7 @@ throttledWatch(
|
|
|
130
130
|
:class="{'!opacity-30': handlerDown}"
|
|
131
131
|
:style="{right: `${editorWidth - 5}px`, cursor: 'col-resize'}"
|
|
132
132
|
@pointerdown="onHandlerDown"
|
|
133
|
-
|
|
133
|
+
/>
|
|
134
134
|
<div
|
|
135
135
|
class="shadow bg-main p-4 grid grid-rows-[max-content,1fr] h-full overflow-hidden border-l border-gray-400 border-opacity-20"
|
|
136
136
|
:style="{width: `${editorWidth}px`}"
|
|
@@ -147,7 +147,7 @@ throttledWatch(
|
|
|
147
147
|
<span class="text-2xl pt-1">
|
|
148
148
|
{{ tab === 'content' ? 'Slide' : 'Notes' }}
|
|
149
149
|
</span>
|
|
150
|
-
<div class="flex-auto"
|
|
150
|
+
<div class="flex-auto" />
|
|
151
151
|
<button class="icon-btn" @click="openInEditor()">
|
|
152
152
|
<carbon:launch />
|
|
153
153
|
</button>
|
package/internals/Goto.vue
CHANGED
package/internals/InfoDialog.vue
CHANGED
|
@@ -4,7 +4,7 @@ import { computed } from 'vue'
|
|
|
4
4
|
import { configs } from '../env'
|
|
5
5
|
import Modal from './Modal.vue'
|
|
6
6
|
|
|
7
|
-
const emit = defineEmits<{(name: 'modelValue', v: boolean): void}>()
|
|
7
|
+
const emit = defineEmits<{ (name: 'modelValue', v: boolean): void }>()
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
modelValue: {
|
|
10
10
|
default: false,
|
|
@@ -34,7 +34,7 @@ const hasInfo = computed(() => typeof configs.info === 'string')
|
|
|
34
34
|
class="w-5 h-5"
|
|
35
35
|
src="../assets/logo.png"
|
|
36
36
|
alt="Slidev"
|
|
37
|
-
|
|
37
|
+
>
|
|
38
38
|
<div style="color: #2082A6">
|
|
39
39
|
<b>Sli</b>dev
|
|
40
40
|
</div>
|
package/internals/Modal.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useVModel } from '@vueuse/core'
|
|
3
3
|
|
|
4
|
-
const emit = defineEmits<{(name: 'modelValue', v: boolean): void}>()
|
|
4
|
+
const emit = defineEmits<{ (name: 'modelValue', v: boolean): void }>()
|
|
5
5
|
const props = defineProps({
|
|
6
6
|
modelValue: {
|
|
7
7
|
default: false,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, shallowRef } from 'vue'
|
|
3
|
-
import { isDark, toggleDark
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
|
|
4
|
+
import { currentPage, downloadPDF, hasNext, hasPrev, isEmbedded, isPresenter, next, prev, total } from '../logic/nav'
|
|
5
|
+
import { activeElement, breakpoints, fullscreen, showEditor, showInfoDialog, showPresenterCursor, toggleOverview } from '../state'
|
|
6
|
+
import { brush, drawingEnabled } from '../logic/drawings'
|
|
7
7
|
import { configs } from '../env'
|
|
8
8
|
import Settings from './Settings.vue'
|
|
9
9
|
import MenuButton from './MenuButton.vue'
|
|
@@ -101,7 +101,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
101
101
|
v-if="drawingEnabled"
|
|
102
102
|
class="absolute left-1 right-1 bottom-0 h-0.7 rounded-full"
|
|
103
103
|
:style="{ background: brush.color }"
|
|
104
|
-
|
|
104
|
+
/>
|
|
105
105
|
</button>
|
|
106
106
|
<VerticalDivider />
|
|
107
107
|
</template>
|
package/internals/NoteEditor.vue
CHANGED
|
@@ -66,14 +66,14 @@ onClickOutside(input, () => {
|
|
|
66
66
|
:class="props.class"
|
|
67
67
|
@click="switchNoteEdit"
|
|
68
68
|
v-html="info?.notesHTML"
|
|
69
|
-
|
|
69
|
+
/>
|
|
70
70
|
<div
|
|
71
71
|
v-else
|
|
72
72
|
class="prose overflow-auto outline-none"
|
|
73
73
|
:class="props.class"
|
|
74
74
|
@click="switchNoteEdit"
|
|
75
75
|
v-text="note"
|
|
76
|
-
|
|
76
|
+
/>
|
|
77
77
|
</template>
|
|
78
78
|
<textarea
|
|
79
79
|
v-else
|
package/internals/Play.vue
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isPrintMode, next, prev, useSwipeControls
|
|
2
|
+
import { computed, ref, shallowRef } from 'vue'
|
|
3
|
+
import { isScreenVertical, showEditor, slideScale, windowSize } from '../state'
|
|
4
|
+
import { isEmbedded, isPrintMode, next, prev, useSwipeControls } from '../logic/nav'
|
|
5
5
|
import { isDrawing } from '../logic/drawings'
|
|
6
6
|
import { registerShortcuts } from '../logic/shortcuts'
|
|
7
|
-
import {
|
|
7
|
+
import { configs, themeVars } from '../env'
|
|
8
8
|
import Controls from './Controls.vue'
|
|
9
9
|
import SlideContainer from './SlideContainer.vue'
|
|
10
10
|
import NavControls from './NavControls.vue'
|
|
@@ -18,7 +18,7 @@ function onClick(e: MouseEvent) {
|
|
|
18
18
|
return
|
|
19
19
|
|
|
20
20
|
if ((e.target as HTMLElement)?.id === 'slide-container') {
|
|
21
|
-
// click right to next, left to
|
|
21
|
+
// click right to next, left to previous
|
|
22
22
|
if ((e.screenX / window.innerWidth) > 0.6)
|
|
23
23
|
next()
|
|
24
24
|
else
|
|
@@ -28,7 +28,7 @@ function onClick(e: MouseEvent) {
|
|
|
28
28
|
|
|
29
29
|
useSwipeControls(root)
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const persistNav = computed(() => isScreenVertical.value || showEditor.value)
|
|
32
32
|
|
|
33
33
|
const Editor = shallowRef<any>()
|
|
34
34
|
if (__DEV__)
|
|
@@ -55,11 +55,11 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
55
55
|
<div
|
|
56
56
|
class="absolute bottom-0 left-0 transition duration-300 opacity-0 hover:opacity-100"
|
|
57
57
|
:class="[
|
|
58
|
-
|
|
58
|
+
persistNav ? 'opacity-100 right-0' : 'oapcity-0 p-2',
|
|
59
59
|
isDrawing ? 'pointer-events-none': ''
|
|
60
60
|
]"
|
|
61
61
|
>
|
|
62
|
-
<NavControls class="m-auto" :persist="
|
|
62
|
+
<NavControls class="m-auto" :persist="persistNav" />
|
|
63
63
|
</div>
|
|
64
64
|
<template v-if="__SLIDEV_FEATURE_DRAWINGS__ && !configs.drawings.presenterOnly && !isEmbedded && DrawingControls">
|
|
65
65
|
<DrawingControls class="ml-0" />
|
package/internals/Presenter.vue
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useHead } from '@vueuse/head'
|
|
3
|
-
import {
|
|
3
|
+
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
|
4
4
|
import { useMouse, useWindowFocus } from '@vueuse/core'
|
|
5
|
-
import {
|
|
5
|
+
import { clicks, clicksTotal, currentPage, currentRoute, hasNext, nextRoute, total, useSwipeControls } from '../logic/nav'
|
|
6
6
|
import { showOverview, showPresenterCursor } from '../state'
|
|
7
|
-
import { configs,
|
|
7
|
+
import { configs, serverState, themeVars } from '../env'
|
|
8
8
|
import { registerShortcuts } from '../logic/shortcuts'
|
|
9
9
|
import { getSlideClass } from '../utils'
|
|
10
10
|
import { useTimer } from '../logic/utils'
|
|
@@ -82,7 +82,7 @@ onMounted(() => {
|
|
|
82
82
|
<div class="bg-main h-full slidev-presenter">
|
|
83
83
|
<div class="grid-container">
|
|
84
84
|
<div class="grid-section top flex">
|
|
85
|
-
<img src="../assets/logo-title-horizontal.png" class="h-14 ml-2 py-2 my-auto"
|
|
85
|
+
<img src="../assets/logo-title-horizontal.png" class="h-14 ml-2 py-2 my-auto">
|
|
86
86
|
<div class="flex-auto" />
|
|
87
87
|
<div
|
|
88
88
|
class="timer-btn my-auto relative w-22px h-22px cursor-pointer text-lg"
|
|
@@ -133,7 +133,7 @@ onMounted(() => {
|
|
|
133
133
|
<div
|
|
134
134
|
class="progress h-2px bg-primary transition-all"
|
|
135
135
|
:style="{ width: `${(currentPage - 1) / (total - 1) * 100}%` }"
|
|
136
|
-
|
|
136
|
+
/>
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
139
139
|
<Goto />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useVModel } from '@vueuse/core'
|
|
3
3
|
import { nextTick } from 'vue'
|
|
4
|
-
import {
|
|
4
|
+
import { getFilename, recordCamera, recorder, recordingName } from '../logic/recording'
|
|
5
5
|
import Modal from './Modal.vue'
|
|
6
6
|
import DevicesList from './DevicesList.vue'
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ async function start() {
|
|
|
42
42
|
name="title"
|
|
43
43
|
type="text"
|
|
44
44
|
placeholder="Enter the title..."
|
|
45
|
-
|
|
45
|
+
>
|
|
46
46
|
<div class="text-xs w-full opacity-50 py-2">
|
|
47
47
|
<div>This will be used in the output filename that might <br>help you better orangize your recording chips.</div>
|
|
48
48
|
</div>
|
|
@@ -52,7 +52,7 @@ async function start() {
|
|
|
52
52
|
v-model="recordCamera"
|
|
53
53
|
name="record-camera"
|
|
54
54
|
type="checkbox"
|
|
55
|
-
|
|
55
|
+
>
|
|
56
56
|
<label for="record-camera" @click="recordCamera = !recordCamera">Record camera separately</label>
|
|
57
57
|
</div>
|
|
58
58
|
<div class="text-xs w-full opacity-50">
|
|
@@ -73,7 +73,7 @@ async function start() {
|
|
|
73
73
|
<button class="cancel" @click="close">
|
|
74
74
|
Cancel
|
|
75
75
|
</button>
|
|
76
|
-
<div class="flex-auto"
|
|
76
|
+
<div class="flex-auto" />
|
|
77
77
|
<button @click="start">
|
|
78
78
|
Start
|
|
79
79
|
</button>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useElementSize } from '@vueuse/core'
|
|
3
3
|
import { computed, provide, ref, watchEffect } from 'vue'
|
|
4
|
-
import {
|
|
4
|
+
import { configs, slideAspect, slideHeight, slideWidth } from '../env'
|
|
5
5
|
import { injectionSlideScale } from '../constants'
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useVModel } from '@vueuse/core'
|
|
2
|
-
import {
|
|
2
|
+
import { defineComponent, h, provide } from 'vue'
|
|
3
3
|
import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap } from '../constants'
|
|
4
4
|
|
|
5
5
|
export default defineComponent({
|
package/internals/SlidesShow.vue
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { shallowRef, watch } from 'vue'
|
|
3
|
-
import {
|
|
3
|
+
import { clicks, currentRoute, isPresenter, nextRoute, rawRoutes } from '../logic/nav'
|
|
4
4
|
import { getSlideClass } from '../utils'
|
|
5
5
|
import SlideWrapper from './SlideWrapper'
|
|
6
|
-
// @ts-
|
|
6
|
+
// @ts-expect-error virtual module
|
|
7
7
|
import GlobalTop from '/@slidev/global-components/top'
|
|
8
|
-
// @ts-
|
|
8
|
+
// @ts-expect-error virtual module
|
|
9
9
|
import GlobalBottom from '/@slidev/global-components/bottom'
|
|
10
10
|
import PresenterMouse from './PresenterMouse.vue'
|
|
11
11
|
|
package/internals/WebCamera.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useEventListener, useStorage
|
|
2
|
+
import { useDraggable, useEventListener, useStorage } from '@vueuse/core'
|
|
3
3
|
import { computed, onMounted, ref, watchEffect } from 'vue'
|
|
4
4
|
import { currentCamera } from '../state'
|
|
5
5
|
import { recorder } from '../logic/recording'
|
|
@@ -80,7 +80,6 @@ onMounted(fixPosition)
|
|
|
80
80
|
class="absolute bottom-0 right-0 rounded-full bg-main shadow opacity-0 shadow z-30 hover:opacity-100 dark:(border border-true-gray-700)"
|
|
81
81
|
:style="handleStyle"
|
|
82
82
|
:class="handlerDown ? '!opacity-100' : ''"
|
|
83
|
-
|
|
84
|
-
</div>
|
|
83
|
+
/>
|
|
85
84
|
</div>
|
|
86
85
|
</template>
|
package/layouts/iframe-left.vue
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
class: {
|
|
5
|
-
type: String,
|
|
6
|
-
},
|
|
7
|
-
url: {
|
|
8
|
-
type: String,
|
|
9
|
-
},
|
|
10
|
-
})
|
|
11
|
-
const url = ref(props.url)
|
|
2
|
+
const props = defineProps<{ class?: string; url: string }>()
|
|
12
3
|
</script>
|
|
13
4
|
|
|
14
5
|
<template>
|
|
15
6
|
<div class="grid grid-cols-2 w-full h-full">
|
|
16
7
|
<div class="h-full">
|
|
17
|
-
<iframe id="frame" class="w-full h-full" :src="url"
|
|
8
|
+
<iframe id="frame" class="w-full h-full" :src="url" />
|
|
18
9
|
</div>
|
|
19
10
|
<div class="slidev-layout default" :class="props.class">
|
|
20
11
|
<slot />
|
package/layouts/iframe-right.vue
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
class: {
|
|
5
|
-
type: String,
|
|
6
|
-
},
|
|
7
|
-
url: {
|
|
8
|
-
type: String,
|
|
9
|
-
},
|
|
10
|
-
})
|
|
11
|
-
const url = ref(props.url)
|
|
2
|
+
const props = defineProps<{ class?: string; url: string }>()
|
|
12
3
|
</script>
|
|
13
4
|
|
|
14
5
|
<template>
|
|
@@ -17,7 +8,7 @@ const url = ref(props.url)
|
|
|
17
8
|
<slot />
|
|
18
9
|
</div>
|
|
19
10
|
<div class="h-full">
|
|
20
|
-
<iframe id="frame" class="w-full h-full" :src="url"
|
|
11
|
+
<iframe id="frame" class="w-full h-full" :src="url" />
|
|
21
12
|
</div>
|
|
22
13
|
</div>
|
|
23
14
|
</template>
|
package/layouts/iframe.vue
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
url: {
|
|
5
|
-
type: String,
|
|
6
|
-
},
|
|
7
|
-
})
|
|
8
|
-
const url = ref(props.url)
|
|
2
|
+
defineProps<{ url: string }>()
|
|
9
3
|
</script>
|
|
10
4
|
|
|
11
5
|
<template>
|
|
12
6
|
<div class="h-full w-full">
|
|
13
7
|
<div class="w-full h-full">
|
|
14
|
-
<iframe id="frame" class="w-full h-full" :src="url"
|
|
8
|
+
<iframe id="frame" class="w-full h-full" :src="url" />
|
|
15
9
|
</div>
|
|
16
10
|
</div>
|
|
17
11
|
</template>
|
package/layouts/image-left.vue
CHANGED
|
@@ -16,7 +16,7 @@ const style = computed(() => handleBackground(props.image))
|
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
18
|
<div class="grid grid-cols-2 w-full h-full">
|
|
19
|
-
<div class="w-full w-full" :style="style"
|
|
19
|
+
<div class="w-full w-full" :style="style" />
|
|
20
20
|
<div class="slidev-layout default" :class="props.class">
|
|
21
21
|
<slot />
|
|
22
22
|
</div>
|
package/layouts/image-right.vue
CHANGED
|
@@ -19,6 +19,6 @@ const style = computed(() => handleBackground(props.image))
|
|
|
19
19
|
<div class="slidev-layout default" :class="props.class">
|
|
20
20
|
<slot />
|
|
21
21
|
</div>
|
|
22
|
-
<div class="w-full w-full" :style="style"
|
|
22
|
+
<div class="w-full w-full" :style="style" />
|
|
23
23
|
</div>
|
|
24
24
|
</template>
|
package/logic/drawings.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { computed, markRaw, nextTick, reactive, ref, watch, watchEffect } from 'vue'
|
|
2
|
-
import { Brush,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { Brush, Options as DrauuOptions, DrawingMode } from 'drauu'
|
|
3
|
+
import { createDrauu } from 'drauu'
|
|
4
|
+
import { toReactive, useStorage } from '@vueuse/core'
|
|
5
|
+
import { configs, serverDrawingState as drawingState } from '../env'
|
|
5
6
|
import { currentPage, isPresenter } from './nav'
|
|
6
7
|
|
|
7
8
|
export const brushColors = [
|
package/logic/nav.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
3
|
+
import { computed, nextTick, ref } from 'vue'
|
|
4
|
+
import { SwipeDirection, isString, timestamp, usePointerSwipe } from '@vueuse/core'
|
|
3
5
|
import { rawRoutes, router } from '../routes'
|
|
4
6
|
import { configs } from '../env'
|
|
5
7
|
import { useRouteQuery } from './route'
|
|
6
8
|
import { isDrawing } from './drawings'
|
|
7
9
|
|
|
10
|
+
export interface TocItem {
|
|
11
|
+
active?: boolean
|
|
12
|
+
activeParent?: boolean
|
|
13
|
+
children: TocItem[]
|
|
14
|
+
hasActiveParent?: boolean
|
|
15
|
+
level: number
|
|
16
|
+
path: string
|
|
17
|
+
hideInToc?: boolean
|
|
18
|
+
title?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
export { rawRoutes, router }
|
|
9
22
|
|
|
10
23
|
// force update collected elements when the route is fully resolved
|
|
@@ -61,6 +74,15 @@ export const clicksTotal = computed(() => +(currentRoute.value?.meta?.clicks ??
|
|
|
61
74
|
export const hasNext = computed(() => currentPage.value < rawRoutes.length - 1 || clicks.value < clicksTotal.value)
|
|
62
75
|
export const hasPrev = computed(() => currentPage.value > 1 || clicks.value > 0)
|
|
63
76
|
|
|
77
|
+
export const rawTree = computed(() => rawRoutes
|
|
78
|
+
.filter((route: RouteRecordRaw) => route.meta?.slide?.title)
|
|
79
|
+
.reduce((acc: TocItem[], route: RouteRecordRaw) => {
|
|
80
|
+
addToTree(acc, route)
|
|
81
|
+
return acc
|
|
82
|
+
}, []))
|
|
83
|
+
export const treeWithActiveStatuses = computed(() => getTreeWithActiveStatuses(rawTree.value))
|
|
84
|
+
export const tree = computed(() => filterTree(treeWithActiveStatuses.value))
|
|
85
|
+
|
|
64
86
|
export function next() {
|
|
65
87
|
if (clicksTotal.value <= clicks.value)
|
|
66
88
|
nextSlide()
|
|
@@ -151,3 +173,47 @@ export async function openInEditor(url?: string) {
|
|
|
151
173
|
await fetch(`/__open-in-editor?file=${encodeURIComponent(url)}`)
|
|
152
174
|
return true
|
|
153
175
|
}
|
|
176
|
+
|
|
177
|
+
export function addToTree(tree: TocItem[], route: RouteRecordRaw, level = 1) {
|
|
178
|
+
const titleLevel = route.meta?.slide?.level
|
|
179
|
+
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
180
|
+
addToTree(tree[tree.length - 1].children, route, level + 1)
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
tree.push({
|
|
184
|
+
children: [],
|
|
185
|
+
level,
|
|
186
|
+
path: route.path,
|
|
187
|
+
hideInToc: Boolean(route.meta?.hideInToc),
|
|
188
|
+
title: route.meta?.slide?.title,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function getTreeWithActiveStatuses(
|
|
194
|
+
tree: TocItem[],
|
|
195
|
+
hasActiveParent = false,
|
|
196
|
+
parent?: TocItem,
|
|
197
|
+
): TocItem[] {
|
|
198
|
+
return tree.map((item: TocItem) => {
|
|
199
|
+
const clone = {
|
|
200
|
+
...item,
|
|
201
|
+
active: item.path === currentRoute.value?.path,
|
|
202
|
+
hasActiveParent,
|
|
203
|
+
}
|
|
204
|
+
if (clone.children.length > 0)
|
|
205
|
+
clone.children = getTreeWithActiveStatuses(clone.children, clone.active || clone.hasActiveParent, clone)
|
|
206
|
+
if (parent && (clone.active || clone.activeParent))
|
|
207
|
+
parent.activeParent = true
|
|
208
|
+
return clone
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function filterTree(tree: TocItem[], level = 1): TocItem[] {
|
|
213
|
+
return tree
|
|
214
|
+
.filter((item: TocItem) => !item.hideInToc)
|
|
215
|
+
.map((item: TocItem) => ({
|
|
216
|
+
...item,
|
|
217
|
+
children: filterTree(item.children, level + 1),
|
|
218
|
+
}))
|
|
219
|
+
}
|
package/logic/note.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { MaybeRef
|
|
2
|
-
import {
|
|
1
|
+
import type { MaybeRef } from '@vueuse/core'
|
|
2
|
+
import { useFetch } from '@vueuse/core'
|
|
3
|
+
import type { Ref } from 'vue'
|
|
4
|
+
import { computed, ref, unref } from 'vue'
|
|
3
5
|
import type { SlideInfo, SlideInfoExtended } from '@slidev/types'
|
|
4
6
|
|
|
5
7
|
export interface UseSlideInfo{
|
package/logic/recording.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
import { nextTick, ref, shallowRef, watch } from 'vue'
|
|
3
|
+
import { useDevicesList, useEventListener } from '@vueuse/core'
|
|
3
4
|
import { isTruthy } from '@antfu/utils'
|
|
4
|
-
import RecorderType from 'recordrtc'
|
|
5
|
+
import type RecorderType from 'recordrtc'
|
|
5
6
|
import type { Options as RecorderOptions } from 'recordrtc'
|
|
6
7
|
import { currentCamera, currentMic } from '../state'
|
|
7
8
|
|
|
@@ -123,7 +124,7 @@ export function useRecording() {
|
|
|
123
124
|
frameRate: 15,
|
|
124
125
|
width: 3840,
|
|
125
126
|
height: 2160,
|
|
126
|
-
// @ts-expect-error
|
|
127
|
+
// @ts-expect-error missing types
|
|
127
128
|
cursor: 'motion',
|
|
128
129
|
resizeMode: 'crop-and-scale',
|
|
129
130
|
},
|
package/logic/shortcuts.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Fn,
|
|
2
|
-
import {
|
|
1
|
+
import type { Fn, KeyFilter } from '@vueuse/core'
|
|
2
|
+
import { and, not, onKeyStroke } from '@vueuse/core'
|
|
3
|
+
import type { Ref } from 'vue'
|
|
4
|
+
import { watch } from 'vue'
|
|
3
5
|
import type { ShortcutOptions } from '@slidev/types'
|
|
4
|
-
import { fullscreen,
|
|
6
|
+
import { fullscreen, isInputting, isOnFocus, magicKeys, shortcutsEnabled, showGotoDialog, showOverview, toggleOverview } from '../state'
|
|
5
7
|
import setupShortcuts from '../setup/shortcuts'
|
|
6
8
|
import { toggleDark } from './dark'
|
|
7
9
|
import { next, nextSlide, prev, prevSlide } from './nav'
|
package/logic/utils.ts
CHANGED
package/modules/context.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { App
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import { computed, reactive, readonly } from 'vue'
|
|
2
3
|
import { objectKeys } from '@antfu/utils'
|
|
3
4
|
import type { UnwrapNestedRefs } from '@vue/reactivity'
|
|
4
5
|
import * as nav from '../logic/nav'
|
|
@@ -22,7 +23,7 @@ export default function createSlidevContext() {
|
|
|
22
23
|
// need to copy over to get rid of the "Module" object type (will not unwrap)
|
|
23
24
|
for (const key of objectKeys(nav)) {
|
|
24
25
|
if (typeof key === 'string')
|
|
25
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error I know :)
|
|
26
27
|
navObj[key] = nav[key]
|
|
27
28
|
}
|
|
28
29
|
const context = reactive({
|
|
@@ -34,7 +35,7 @@ export default function createSlidevContext() {
|
|
|
34
35
|
|
|
35
36
|
// allows controls from postMessages
|
|
36
37
|
if (__DEV__) {
|
|
37
|
-
// @ts-expect-error
|
|
38
|
+
// @ts-expect-error expose global
|
|
38
39
|
window.__slidev__ = context
|
|
39
40
|
window.addEventListener('message', ({ data }) => {
|
|
40
41
|
if (data && data.target === 'slidev') {
|
package/modules/directives.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { App, DirectiveBinding, InjectionKey
|
|
1
|
+
import type { App, DirectiveBinding, InjectionKey } from 'vue'
|
|
2
|
+
import { watch } from 'vue'
|
|
2
3
|
import { remove } from '@antfu/utils'
|
|
3
4
|
import { isClicksDisabled } from '../logic/nav'
|
|
4
5
|
import {
|
|
5
|
-
injectionClicksDisabled,
|
|
6
|
-
injectionClicksElements,
|
|
7
|
-
injectionClicks,
|
|
8
|
-
injectionOrderMap,
|
|
9
6
|
CLASS_VCLICK_CURRENT,
|
|
7
|
+
CLASS_VCLICK_FADE,
|
|
10
8
|
CLASS_VCLICK_HIDDEN,
|
|
11
9
|
CLASS_VCLICK_HIDDEN_EXP,
|
|
12
10
|
CLASS_VCLICK_PRIOR,
|
|
13
11
|
CLASS_VCLICK_TARGET,
|
|
14
|
-
|
|
12
|
+
injectionClicks,
|
|
13
|
+
injectionClicksDisabled,
|
|
14
|
+
injectionClicksElements,
|
|
15
|
+
injectionOrderMap,
|
|
15
16
|
} from '../constants'
|
|
16
17
|
|
|
17
18
|
function dirInject<T = unknown>(dir: DirectiveBinding<any>, key: InjectionKey<T> | string, defaultValue?: T): T | undefined {
|
|
@@ -22,7 +23,7 @@ export default function createDirectives() {
|
|
|
22
23
|
return {
|
|
23
24
|
install(app: App) {
|
|
24
25
|
app.directive('click', {
|
|
25
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-expect-error extra prop
|
|
26
27
|
name: 'v-click',
|
|
27
28
|
|
|
28
29
|
mounted(el: HTMLElement, dir) {
|
|
@@ -108,7 +109,7 @@ export default function createDirectives() {
|
|
|
108
109
|
})
|
|
109
110
|
|
|
110
111
|
app.directive('after', {
|
|
111
|
-
// @ts-expect-error
|
|
112
|
+
// @ts-expect-error extra prop
|
|
112
113
|
name: 'v-after',
|
|
113
114
|
|
|
114
115
|
mounted(el: HTMLElement, dir) {
|
|
@@ -159,7 +160,7 @@ export default function createDirectives() {
|
|
|
159
160
|
})
|
|
160
161
|
|
|
161
162
|
app.directive('click-hide', {
|
|
162
|
-
// @ts-expect-error
|
|
163
|
+
// @ts-expect-error extra prop
|
|
163
164
|
name: 'v-click-hide',
|
|
164
165
|
|
|
165
166
|
mounted(el: HTMLElement, dir) {
|
package/modules/mermaid.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"homepage": "https://sli.dev",
|
|
6
6
|
"bugs": "https://github.com/slidevjs/slidev/issues",
|
|
@@ -12,30 +12,31 @@
|
|
|
12
12
|
"funding": "https://github.com/sponsors/antfu",
|
|
13
13
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@antfu/utils": "^0.
|
|
16
|
-
"@slidev/parser": "0.
|
|
17
|
-
"@slidev/types": "0.
|
|
18
|
-
"@vueuse/core": "^
|
|
19
|
-
"@vueuse/head": "^0.
|
|
20
|
-
"@vueuse/motion": "^2.0.0-beta.
|
|
21
|
-
"codemirror": "^5.
|
|
15
|
+
"@antfu/utils": "^0.4.0",
|
|
16
|
+
"@slidev/parser": "0.28.1",
|
|
17
|
+
"@slidev/types": "0.28.1",
|
|
18
|
+
"@vueuse/core": "^7.5.3",
|
|
19
|
+
"@vueuse/head": "^0.7.4",
|
|
20
|
+
"@vueuse/motion": "^2.0.0-beta.9",
|
|
21
|
+
"codemirror": "^5.65.0",
|
|
22
22
|
"drauu": "^0.2.1",
|
|
23
23
|
"file-saver": "^2.0.5",
|
|
24
24
|
"js-base64": "^3.7.2",
|
|
25
25
|
"js-yaml": "^4.1.0",
|
|
26
|
-
"katex": "^0.
|
|
26
|
+
"katex": "^0.15.2",
|
|
27
27
|
"mermaid": "8.13.0",
|
|
28
|
-
"monaco-editor": "^0.
|
|
29
|
-
"nanoid": "^3.1.
|
|
30
|
-
"prettier": "^2.
|
|
28
|
+
"monaco-editor": "^0.31.1",
|
|
29
|
+
"nanoid": "^3.1.32",
|
|
30
|
+
"prettier": "^2.5.1",
|
|
31
31
|
"recordrtc": "^5.6.2",
|
|
32
|
-
"resolve": "^1.
|
|
33
|
-
"vite-plugin-windicss": "^1.
|
|
34
|
-
"vue": "^3.2.
|
|
32
|
+
"resolve": "^1.21.0",
|
|
33
|
+
"vite-plugin-windicss": "^1.6.2",
|
|
34
|
+
"vue": "^3.2.26",
|
|
35
35
|
"vue-router": "^4.0.12",
|
|
36
|
-
"windicss": "^3.
|
|
36
|
+
"windicss": "^3.4.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14.0.0"
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"readme": "# @slidev/client\n\n[](https://www.npmjs.com/package/@slidev/client)\n\nClient code for [Slidev](https://sli.dev). Shipped with [`@slidev/cli`](https://www.npmjs.com/package/@slidev/cli).\n\n## License\n\nMIT License © 2021 [Anthony Fu](https://github.com/antfu)\n\n"
|
|
41
42
|
}
|
package/routes.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
|
2
3
|
import Play from './internals/Play.vue'
|
|
3
|
-
// @ts-expect-error
|
|
4
|
+
// @ts-expect-error missing types
|
|
4
5
|
import _rawRoutes from '/@slidev/routes'
|
|
5
6
|
|
|
6
7
|
export const rawRoutes = _rawRoutes as RouteRecordRaw[]
|
|
@@ -50,6 +51,8 @@ declare module 'vue-router' {
|
|
|
50
51
|
id: number
|
|
51
52
|
no: number
|
|
52
53
|
filepath: string
|
|
54
|
+
title?: string
|
|
55
|
+
level?: number
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
// private fields
|
package/setup/codemirror.ts
CHANGED
package/setup/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
|
|
3
|
-
import { AppContext } from '@slidev/types'
|
|
3
|
+
import type { AppContext } from '@slidev/types'
|
|
4
4
|
import { MotionPlugin } from '@vueuse/motion'
|
|
5
5
|
|
|
6
6
|
export default function setupMain(context: AppContext) {
|
|
@@ -14,7 +14,7 @@ export default function setupMain(context: AppContext) {
|
|
|
14
14
|
|
|
15
15
|
context.app.use(MotionPlugin)
|
|
16
16
|
|
|
17
|
-
// @ts-expect-error
|
|
17
|
+
// @ts-expect-error inject in runtime
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
19
|
const injection_arg = context
|
|
20
20
|
|
package/setup/mermaid.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { MermaidOptions } from '@slidev/types'
|
|
4
|
+
import { defineMermaidSetup } from '@slidev/types'
|
|
4
5
|
|
|
5
6
|
export default defineMermaidSetup(() => {
|
|
6
7
|
// eslint-disable-next-line prefer-const
|
package/setup/monaco.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentInstance, onMounted } from 'vue'
|
|
2
2
|
import * as monaco from 'monaco-editor'
|
|
3
3
|
import { createSingletonPromise } from '@antfu/utils'
|
|
4
|
-
import { MonacoSetupReturn } from '@slidev/types'
|
|
4
|
+
import type { MonacoSetupReturn } from '@slidev/types'
|
|
5
5
|
/* __imports__ */
|
|
6
6
|
|
|
7
7
|
const setup = createSingletonPromise(async() => {
|
|
@@ -31,7 +31,7 @@ const setup = createSingletonPromise(async() => {
|
|
|
31
31
|
import('monaco-editor/esm/vs/language/typescript/ts.worker?worker'),
|
|
32
32
|
])
|
|
33
33
|
|
|
34
|
-
// @ts-expect-error
|
|
34
|
+
// @ts-expect-error global config for monaca
|
|
35
35
|
window.MonacoEnvironment = {
|
|
36
36
|
getWorker(_: any, label: string) {
|
|
37
37
|
if (label === 'json')
|
|
@@ -48,7 +48,7 @@ const setup = createSingletonPromise(async() => {
|
|
|
48
48
|
})(),
|
|
49
49
|
])
|
|
50
50
|
|
|
51
|
-
// @ts-expect-error
|
|
51
|
+
// @ts-expect-error injected in runtime
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
53
|
const injection_arg = monaco
|
|
54
54
|
// eslint-disable-next-line prefer-const
|
package/setup/prettier.ts
CHANGED
|
@@ -11,23 +11,23 @@ export async function formatCode(code: string, lang: string) {
|
|
|
11
11
|
case 'typescript':
|
|
12
12
|
parser = 'typescript'
|
|
13
13
|
plugins = [
|
|
14
|
-
// @ts-expect-error
|
|
14
|
+
// @ts-expect-error missing types
|
|
15
15
|
(await import('prettier/esm/parser-babel')).default,
|
|
16
|
-
// @ts-expect-error
|
|
16
|
+
// @ts-expect-error missing types
|
|
17
17
|
(await import('prettier/esm/parser-typescript')).default,
|
|
18
18
|
]
|
|
19
19
|
break
|
|
20
20
|
case 'html':
|
|
21
21
|
parser = 'html'
|
|
22
22
|
plugins = [
|
|
23
|
-
// @ts-expect-error
|
|
23
|
+
// @ts-expect-error missing types
|
|
24
24
|
(await import('prettier/esm/parser-html')).default,
|
|
25
25
|
]
|
|
26
26
|
break
|
|
27
27
|
default:
|
|
28
28
|
parser = 'babel'
|
|
29
29
|
plugins = [
|
|
30
|
-
// @ts-expect-error
|
|
30
|
+
// @ts-expect-error missing types
|
|
31
31
|
(await import('prettier/esm/parser-babel')).default,
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -42,7 +42,6 @@ export async function formatCode(code: string, lang: string) {
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
45
|
console.error(e)
|
|
47
46
|
return code
|
|
48
47
|
}
|
package/setup/root.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
import { useHead } from '@vueuse/head'
|
|
3
3
|
import { watch } from 'vue'
|
|
4
|
-
import { currentPage, getPath,
|
|
4
|
+
import { clicks, currentPage, getPath, isPresenter } from '../logic/nav'
|
|
5
5
|
import { router } from '../routes'
|
|
6
6
|
import { configs, serverState } from '../env'
|
|
7
7
|
|
|
8
8
|
export default function setupRoot() {
|
|
9
|
-
// @ts-expect-error
|
|
9
|
+
// @ts-expect-error injected in runtime
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
11
|
const injection_arg = undefined
|
|
12
12
|
|
package/setup/shortcuts.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { NavOperations, ShortcutOptions } from '@slidev/types'
|
|
4
|
+
import { downloadPDF, next, nextSlide, prev, prevSlide } from '../logic/nav'
|
|
5
5
|
import { toggleDark } from '../logic/dark'
|
|
6
|
-
import {
|
|
6
|
+
import { showGotoDialog, showOverview, toggleOverview } from '../state'
|
|
7
7
|
import { drawingEnabled } from '../logic/drawings'
|
|
8
8
|
|
|
9
9
|
export default function setupShortcuts() {
|
|
10
|
-
// @ts-expect-error
|
|
10
|
+
// @ts-expect-error injected in runtime
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
12
|
const injection_arg: NavOperations = {
|
|
13
13
|
next,
|
package/shim.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare interface Window {
|
|
|
6
6
|
|
|
7
7
|
// with vite-plugin-md, markdowns can be treat as Vue components
|
|
8
8
|
declare module '*.md' {
|
|
9
|
-
import { ComponentOptions } from 'vue'
|
|
9
|
+
import type { ComponentOptions } from 'vue'
|
|
10
10
|
const component: ComponentOptions
|
|
11
11
|
export default component
|
|
12
12
|
}
|
package/state/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { breakpointsTailwind, isClient, useActiveElement, useBreakpoints, useFullscreen, useMagicKeys, useStorage, useToggle, useWindowSize } from '@vueuse/core'
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
3
|
import { slideAspect } from '../env'
|
|
4
4
|
|