@slidev/client 0.49.29 → 0.50.0-beta.10
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/Arrow.vue +1 -1
- package/builtin/CodeBlockWrapper.vue +3 -3
- package/builtin/KaTexBlockWrapper.vue +3 -3
- package/builtin/Mermaid.vue +1 -1
- package/builtin/Monaco.vue +6 -5
- package/builtin/RenderWhen.vue +2 -2
- package/builtin/ShikiMagicMove.vue +5 -5
- package/builtin/SlidevVideo.vue +2 -2
- package/builtin/Toc.vue +1 -1
- package/builtin/TocList.vue +6 -3
- package/builtin/Tweet.vue +1 -1
- package/builtin/VAfter.ts +1 -1
- package/builtin/VClick.ts +1 -1
- package/builtin/VClickGap.vue +1 -1
- package/builtin/VClicks.ts +1 -1
- package/builtin/VDrag.vue +1 -1
- package/builtin/VDragArrow.vue +1 -1
- package/builtin/VSwitch.ts +4 -4
- package/composables/useClicks.ts +1 -1
- package/composables/useDragElements.ts +3 -3
- package/composables/useDrawings.ts +3 -3
- package/composables/useNav.ts +8 -8
- package/composables/useSlideInfo.ts +2 -2
- package/composables/useSwipeControls.ts +1 -1
- package/composables/useTimer.ts +20 -0
- package/composables/useViewTransition.ts +2 -3
- package/constants.ts +3 -1
- package/context.ts +2 -2
- package/env.ts +2 -2
- package/index.ts +23 -5
- package/internals/ClicksSlider.vue +1 -1
- package/internals/CodeRunner.vue +5 -5
- package/internals/ContextMenu.vue +8 -6
- package/internals/Controls.vue +6 -6
- package/internals/DevicesList.vue +2 -2
- package/internals/DragControl.vue +2 -2
- package/internals/Draggable.vue +1 -1
- package/internals/DrawingControls.vue +140 -139
- package/internals/DrawingLayer.vue +1 -1
- package/internals/Goto.vue +3 -3
- package/internals/NavControls.vue +21 -21
- package/internals/NoteDisplay.vue +1 -1
- package/internals/NoteEditable.vue +2 -2
- package/internals/PrintContainer.vue +4 -4
- package/internals/PrintSlide.vue +1 -1
- package/internals/PrintSlideClick.vue +3 -3
- package/internals/QuickOverview.vue +11 -9
- package/internals/RecordingControls.vue +5 -5
- package/internals/RecordingDialog.vue +2 -2
- package/internals/SelectList.vue +6 -4
- package/internals/Settings.vue +1 -1
- package/internals/ShikiEditor.vue +1 -1
- package/internals/SideEditor.vue +7 -7
- package/internals/SlideContainer.vue +31 -3
- package/internals/SlideWrapper.vue +5 -4
- package/internals/SlidesShow.vue +6 -6
- package/internals/WebCamera.vue +1 -1
- package/layouts/error.vue +5 -1
- package/logic/contextMenu.ts +3 -3
- package/logic/recording.ts +4 -4
- package/logic/shortcuts.ts +3 -3
- package/logic/slides.ts +2 -2
- package/logic/snapshot.ts +86 -0
- package/logic/utils.ts +0 -23
- package/main.ts +7 -3
- package/modules/context.ts +1 -1
- package/modules/mermaid.ts +3 -3
- package/modules/v-click.ts +1 -1
- package/modules/v-drag.ts +1 -1
- package/modules/v-mark.ts +2 -2
- package/modules/v-motion.ts +3 -3
- package/package.json +26 -25
- package/pages/entry.vue +4 -4
- package/pages/notes.vue +11 -11
- package/pages/overview.vue +27 -14
- package/pages/play.vue +14 -12
- package/pages/presenter/print.vue +2 -2
- package/pages/presenter.vue +38 -39
- package/pages/print.vue +3 -3
- package/setup/code-runners.ts +4 -4
- package/setup/context-menu.ts +15 -24
- package/setup/main.ts +4 -4
- package/setup/mermaid.ts +1 -1
- package/setup/monaco.ts +18 -18
- package/setup/root.ts +9 -9
- package/setup/shortcuts.ts +6 -7
- package/state/drawings.ts +1 -0
- package/state/index.ts +1 -1
- package/state/shared.ts +2 -1
- package/state/snapshot.ts +13 -0
- package/state/syncState.ts +76 -24
- package/styles/index.css +5 -0
- package/uno.config.ts +5 -2
package/builtin/Arrow.vue
CHANGED
|
@@ -12,13 +12,13 @@ Learn more: https://sli.dev/guide/syntax.html#line-highlighting
|
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
+
import type { PropType } from 'vue'
|
|
15
16
|
import { useClipboard } from '@vueuse/core'
|
|
16
17
|
import { computed, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
17
|
-
import type { PropType } from 'vue'
|
|
18
|
-
import { configs } from '../env'
|
|
19
|
-
import { makeId, updateCodeHighlightRange } from '../logic/utils'
|
|
20
18
|
import { CLASS_VCLICK_HIDDEN, CLICKS_MAX } from '../constants'
|
|
21
19
|
import { useSlideContext } from '../context'
|
|
20
|
+
import { configs } from '../env'
|
|
21
|
+
import { makeId, updateCodeHighlightRange } from '../logic/utils'
|
|
22
22
|
|
|
23
23
|
const props = defineProps({
|
|
24
24
|
ranges: {
|
|
@@ -20,12 +20,12 @@ Learn more: https://sli.dev/guide/syntax.html#latex-line-highlighting
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
|
-
import { computed, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
24
23
|
import type { PropType } from 'vue'
|
|
25
|
-
import { parseRangeString } from '@slidev/parser'
|
|
24
|
+
import { parseRangeString } from '@slidev/parser/utils'
|
|
25
|
+
import { computed, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
26
26
|
import { CLASS_VCLICK_HIDDEN, CLASS_VCLICK_TARGET, CLICKS_MAX } from '../constants'
|
|
27
|
-
import { makeId } from '../logic/utils'
|
|
28
27
|
import { useSlideContext } from '../context'
|
|
28
|
+
import { makeId } from '../logic/utils'
|
|
29
29
|
|
|
30
30
|
const props = defineProps({
|
|
31
31
|
ranges: {
|
package/builtin/Mermaid.vue
CHANGED
|
@@ -14,9 +14,9 @@ pie
|
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import { getCurrentInstance, ref, watch, watchEffect } from 'vue'
|
|
17
|
-
import { renderMermaid } from '../modules/mermaid'
|
|
18
17
|
import ShadowRoot from '../internals/ShadowRoot.vue'
|
|
19
18
|
import { isDark } from '../logic/dark'
|
|
19
|
+
import { renderMermaid } from '../modules/mermaid'
|
|
20
20
|
|
|
21
21
|
const props = defineProps<{
|
|
22
22
|
codeLz: string
|
package/builtin/Monaco.vue
CHANGED
|
@@ -12,15 +12,15 @@ Learn more: https://sli.dev/guide/syntax.html#monaco-editor
|
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
+
import type { RawAtValue } from '@slidev/types'
|
|
16
|
+
import type * as monaco from 'monaco-editor'
|
|
15
17
|
import { debounce } from '@antfu/utils'
|
|
18
|
+
import { whenever } from '@vueuse/core'
|
|
16
19
|
import lz from 'lz-string'
|
|
17
|
-
import type * as monaco from 'monaco-editor'
|
|
18
20
|
import { computed, defineAsyncComponent, nextTick, onMounted, ref } from 'vue'
|
|
19
|
-
import type { RawAtValue } from '@slidev/types'
|
|
20
|
-
import { whenever } from '@vueuse/core'
|
|
21
|
-
import { makeId } from '../logic/utils'
|
|
22
|
-
import { useSlideContext } from '../context'
|
|
23
21
|
import { useNav } from '../composables/useNav'
|
|
22
|
+
import { useSlideContext } from '../context'
|
|
23
|
+
import { makeId } from '../logic/utils'
|
|
24
24
|
|
|
25
25
|
const props = withDefaults(defineProps<{
|
|
26
26
|
codeLz: string
|
|
@@ -197,6 +197,7 @@ onMounted(async () => {
|
|
|
197
197
|
})
|
|
198
198
|
|
|
199
199
|
nextTick(() => monaco.editor.remeasureFonts())
|
|
200
|
+
setTimeout(() => monaco.editor.remeasureFonts(), 1000)
|
|
200
201
|
})
|
|
201
202
|
</script>
|
|
202
203
|
|
package/builtin/RenderWhen.vue
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { RenderContext } from '@slidev/types'
|
|
3
|
-
import { computed, ref } from 'vue'
|
|
4
3
|
import { useElementVisibility } from '@vueuse/core'
|
|
5
|
-
import {
|
|
4
|
+
import { computed, ref } from 'vue'
|
|
6
5
|
import { useNav } from '../composables/useNav'
|
|
6
|
+
import { useSlideContext } from '../context'
|
|
7
7
|
|
|
8
8
|
type Context = 'main' | 'visible' | 'print' | RenderContext
|
|
9
9
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ShikiMagicMovePrecompiled } from 'shiki-magic-move/vue'
|
|
3
2
|
import type { KeyedTokensInfo } from 'shiki-magic-move/types'
|
|
4
3
|
import type { PropType } from 'vue'
|
|
5
|
-
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
6
|
-
import lz from 'lz-string'
|
|
7
4
|
import { sleep } from '@antfu/utils'
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
5
|
+
import lz from 'lz-string'
|
|
6
|
+
import { ShikiMagicMovePrecompiled } from 'shiki-magic-move/vue'
|
|
7
|
+
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
10
8
|
import { useNav } from '../composables/useNav'
|
|
11
9
|
import { CLICKS_MAX } from '../constants'
|
|
10
|
+
import { useSlideContext } from '../context'
|
|
12
11
|
import { configs } from '../env'
|
|
12
|
+
import { makeId, updateCodeHighlightRange } from '../logic/utils'
|
|
13
13
|
|
|
14
14
|
const props = defineProps({
|
|
15
15
|
at: {
|
package/builtin/SlidevVideo.vue
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, ref, watch } from 'vue'
|
|
3
2
|
import { and } from '@vueuse/math'
|
|
3
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
4
|
+
import { useNav } from '../composables/useNav'
|
|
4
5
|
import { useSlideContext } from '../context'
|
|
5
6
|
import { resolvedClickMap } from '../modules/v-click'
|
|
6
|
-
import { useNav } from '../composables/useNav'
|
|
7
7
|
|
|
8
8
|
const props = defineProps<{
|
|
9
9
|
autoplay?: boolean | 'once'
|
package/builtin/Toc.vue
CHANGED
|
@@ -8,8 +8,8 @@ Usage:
|
|
|
8
8
|
<Toc columns='2' maxDepth='3' mode='onlySiblings'/>
|
|
9
9
|
-->
|
|
10
10
|
<script setup lang='ts'>
|
|
11
|
-
import { computed } from 'vue'
|
|
12
11
|
import type { TocItem } from '@slidev/types'
|
|
12
|
+
import { computed } from 'vue'
|
|
13
13
|
import { useSlideContext } from '../context'
|
|
14
14
|
import TocList from './TocList.vue'
|
|
15
15
|
|
package/builtin/TocList.vue
CHANGED
|
@@ -7,10 +7,11 @@ Usage:
|
|
|
7
7
|
<TocList :list="list"/>
|
|
8
8
|
-->
|
|
9
9
|
<script setup lang="ts">
|
|
10
|
-
import { computed } from 'vue'
|
|
11
|
-
import { toArray } from '@antfu/utils'
|
|
12
10
|
import type { TocItem } from '@slidev/types'
|
|
13
11
|
import TitleRenderer from '#slidev/title-renderer'
|
|
12
|
+
import { toArray } from '@antfu/utils'
|
|
13
|
+
import { computed } from 'vue'
|
|
14
|
+
import { useNav } from '../composables/useNav'
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(defineProps<{
|
|
16
17
|
level: number
|
|
@@ -20,6 +21,8 @@ const props = withDefaults(defineProps<{
|
|
|
20
21
|
listClass?: string | string[]
|
|
21
22
|
}>(), { level: 1 })
|
|
22
23
|
|
|
24
|
+
const { isPresenter } = useNav()
|
|
25
|
+
|
|
23
26
|
const classes = computed(() => {
|
|
24
27
|
return [
|
|
25
28
|
...toArray(props.listClass || []),
|
|
@@ -47,7 +50,7 @@ const styles = computed(() => {
|
|
|
47
50
|
:key="item.path" class="slidev-toc-item"
|
|
48
51
|
:class="[{ 'slidev-toc-item-active': item.active }, { 'slidev-toc-item-parent-active': item.activeParent }]"
|
|
49
52
|
>
|
|
50
|
-
<Link :to="item.path">
|
|
53
|
+
<Link :to="isPresenter ? `/presenter${item.path}` : item.path">
|
|
51
54
|
<TitleRenderer :no="item.no" />
|
|
52
55
|
</Link>
|
|
53
56
|
<TocList
|
package/builtin/Tweet.vue
CHANGED
|
@@ -55,7 +55,7 @@ onMounted(() => {
|
|
|
55
55
|
<div ref="tweet" class="tweet slidev-tweet">
|
|
56
56
|
<div v-if="!loaded || tweetNotFound" class="w-30 h-30 my-10px bg-gray-400 bg-opacity-10 rounded-lg flex opacity-50">
|
|
57
57
|
<div class="m-auto animate-pulse text-4xl">
|
|
58
|
-
<carbon:logo-twitter />
|
|
58
|
+
<div class="i-carbon:logo-twitter" />
|
|
59
59
|
<span v-if="tweetNotFound">Could not load tweet with id="{{ props.id }}"</span>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
package/builtin/VAfter.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Learn more: https://sli.dev/guide/animations.html#click-animation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { toArray } from '@antfu/utils'
|
|
8
7
|
import type { Directive, VNode } from 'vue'
|
|
8
|
+
import { toArray } from '@antfu/utils'
|
|
9
9
|
import { defineComponent, h, resolveDirective, withDirectives } from 'vue'
|
|
10
10
|
|
|
11
11
|
export default defineComponent({
|
package/builtin/VClick.ts
CHANGED
package/builtin/VClickGap.vue
CHANGED
package/builtin/VClicks.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Learn more: https://sli.dev/guide/animations.html#click-animation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { toArray } from '@antfu/utils'
|
|
8
7
|
import type { VNode, VNodeArrayChildren } from 'vue'
|
|
8
|
+
import { toArray } from '@antfu/utils'
|
|
9
9
|
import { Comment, createVNode, defineComponent, h, isVNode, resolveDirective, withDirectives } from 'vue'
|
|
10
10
|
import { normalizeSingleAtValue } from '../composables/useClicks'
|
|
11
11
|
import VClickGap from './VClickGap.vue'
|
package/builtin/VDrag.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onMounted, onUnmounted } from 'vue'
|
|
3
2
|
import type { DragElementMarkdownSource } from '../composables/useDragElements'
|
|
3
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
4
4
|
import { useDragElement } from '../composables/useDragElements'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<{
|
package/builtin/VDragArrow.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, onUnmounted } from 'vue'
|
|
3
2
|
import type { DragElementMarkdownSource } from '../composables/useDragElements'
|
|
3
|
+
import { computed, onMounted, onUnmounted } from 'vue'
|
|
4
4
|
import { useDragElement } from '../composables/useDragElements'
|
|
5
5
|
import Arrow from './Arrow.vue'
|
|
6
6
|
|
package/builtin/VSwitch.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PropType, Ref, Slot, TransitionGroupProps, VNode } from 'vue'
|
|
2
|
-
import { TransitionGroup, defineComponent, h, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
3
2
|
import { recomputeAllPoppers } from 'floating-vue'
|
|
3
|
+
import { defineComponent, h, onMounted, onUnmounted, ref, TransitionGroup, watchEffect } from 'vue'
|
|
4
|
+
import { CLASS_VCLICK_CURRENT, CLASS_VCLICK_DISPLAY_NONE, CLASS_VCLICK_PRIOR, CLASS_VCLICK_TARGET, CLICKS_MAX } from '../constants'
|
|
4
5
|
import { useSlideContext } from '../context'
|
|
5
|
-
import { makeId } from '../logic/utils'
|
|
6
|
-
import { resolveTransition } from '../logic/transition'
|
|
7
6
|
import { skipTransition } from '../logic/hmr'
|
|
8
|
-
import {
|
|
7
|
+
import { resolveTransition } from '../logic/transition'
|
|
8
|
+
import { makeId } from '../logic/utils'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
props: {
|
package/composables/useClicks.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { clamp, sum } from '@antfu/utils'
|
|
2
1
|
import type { ClicksContext, NormalizedRangeClickValue, NormalizedSingleClickValue, RawAtValue, RawSingleAtValue, SlideRoute } from '@slidev/types'
|
|
3
2
|
import type { Ref } from 'vue'
|
|
3
|
+
import { clamp, sum } from '@antfu/utils'
|
|
4
4
|
import { computed, onMounted, onUnmounted, ref, shallowReactive } from 'vue'
|
|
5
5
|
|
|
6
6
|
export function normalizeSingleAtValue(at: RawSingleAtValue): NormalizedSingleClickValue {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { debounce, ensureSuffix } from '@antfu/utils'
|
|
2
1
|
import type { SlidePatch } from '@slidev/types'
|
|
3
|
-
import { injectLocal, onClickOutside, useWindowFocus } from '@vueuse/core'
|
|
4
2
|
import type { CSSProperties, DirectiveBinding, InjectionKey, WatchStopHandle } from 'vue'
|
|
3
|
+
import { debounce, ensureSuffix } from '@antfu/utils'
|
|
4
|
+
import { injectLocal, onClickOutside, useWindowFocus } from '@vueuse/core'
|
|
5
5
|
import { computed, ref, watch } from 'vue'
|
|
6
6
|
import { injectionCurrentPage, injectionFrontmatter, injectionRenderContext, injectionSlideElement, injectionSlideScale, injectionSlideZoom } from '../constants'
|
|
7
7
|
import { makeId } from '../logic/utils'
|
|
@@ -69,7 +69,7 @@ export function useDragElementsUpdater(no: number) {
|
|
|
69
69
|
|
|
70
70
|
section = type === 'prop'
|
|
71
71
|
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
72
|
-
? section.replace(/<(v-?drag-?\w*)(.*?)(\/)?>/gi, (full, tag, attrs, selfClose, index) => {
|
|
72
|
+
? section.replace(/<(v-?drag-?\w*)(.*?)(\/)?>/gi, (full, tag, attrs, selfClose = '', index) => {
|
|
73
73
|
if (index === idx) {
|
|
74
74
|
replaced = true
|
|
75
75
|
const posMatch = attrs.match(/pos=".*?"/)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { computed, markRaw, nextTick, reactive, ref, watch } from 'vue'
|
|
2
1
|
import type { Brush, Options as DrauuOptions, DrawingMode } from 'drauu'
|
|
3
|
-
import { createDrauu } from 'drauu'
|
|
4
2
|
import { createSharedComposable, toReactive, useLocalStorage } from '@vueuse/core'
|
|
5
|
-
import {
|
|
3
|
+
import { createDrauu } from 'drauu'
|
|
4
|
+
import { computed, markRaw, nextTick, reactive, ref, watch } from 'vue'
|
|
6
5
|
import { configs } from '../env'
|
|
7
6
|
import { isInputting } from '../state'
|
|
7
|
+
import { drawingState, onPatchDrawingState, patchDrawingState } from '../state/drawings'
|
|
8
8
|
import { useNav } from './useNav'
|
|
9
9
|
|
|
10
10
|
export const useDrawings = createSharedComposable(() => {
|
package/composables/useNav.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { ClicksContext, SlideRoute, TocItem } from '@slidev/types'
|
|
2
2
|
import type { ComputedRef, Ref, TransitionGroupProps, WritableComputedRef } from 'vue'
|
|
3
|
-
import { computed, ref, watch } from 'vue'
|
|
4
|
-
import { useRouter } from 'vue-router'
|
|
5
3
|
import type { RouteLocationNormalized, Router } from 'vue-router'
|
|
4
|
+
import { slides } from '#slidev/slides'
|
|
5
|
+
import { clamp } from '@antfu/utils'
|
|
6
6
|
import { createSharedComposable } from '@vueuse/core'
|
|
7
7
|
import { logicOr } from '@vueuse/math'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { getSlide, getSlidePath } from '../logic/slides'
|
|
8
|
+
import { computed, ref, watch } from 'vue'
|
|
9
|
+
import { useRouter } from 'vue-router'
|
|
11
10
|
import { CLICKS_MAX } from '../constants'
|
|
12
|
-
import { skipTransition } from '../logic/hmr'
|
|
13
11
|
import { configs } from '../env'
|
|
12
|
+
import { skipTransition } from '../logic/hmr'
|
|
14
13
|
import { useRouteQuery } from '../logic/route'
|
|
15
|
-
import {
|
|
14
|
+
import { getSlide, getSlidePath } from '../logic/slides'
|
|
15
|
+
import { getCurrentTransition } from '../logic/transition'
|
|
16
16
|
import { createClicksContextBase } from './useClicks'
|
|
17
|
-
import {
|
|
17
|
+
import { useTocTree } from './useTocTree'
|
|
18
18
|
|
|
19
19
|
export interface SlidevContextNav {
|
|
20
20
|
slides: Ref<SlideRoute[]>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { SlideInfo, SlidePatch } from '@slidev/types'
|
|
1
2
|
import type { MaybeRef } from '@vueuse/core'
|
|
2
|
-
import { useFetch } from '@vueuse/core'
|
|
3
3
|
import type { Ref } from 'vue'
|
|
4
|
+
import { useFetch } from '@vueuse/core'
|
|
4
5
|
import { computed, ref, unref } from 'vue'
|
|
5
|
-
import type { SlideInfo, SlidePatch } from '@slidev/types'
|
|
6
6
|
import { getSlide } from '../logic/slides'
|
|
7
7
|
|
|
8
8
|
export interface UseSlideInfo {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useInterval } from '@vueuse/core'
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
export function useTimer() {
|
|
5
|
+
const { counter, isActive, reset, pause, resume } = useInterval(1000, { controls: true })
|
|
6
|
+
|
|
7
|
+
const timer = computed(() => {
|
|
8
|
+
const passed = counter.value
|
|
9
|
+
const sec = Math.floor(passed % 60).toString().padStart(2, '0')
|
|
10
|
+
const min = Math.floor(passed / 60).toString().padStart(2, '0')
|
|
11
|
+
return `${min}:${sec}`
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
timer,
|
|
16
|
+
isTimerAvctive: isActive,
|
|
17
|
+
resetTimer: reset,
|
|
18
|
+
toggleTimer: () => (isActive.value ? pause() : resume()),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref } from 'vue'
|
|
2
2
|
import { useRouter } from 'vue-router'
|
|
3
|
-
import { getSlide } from '../logic/slides'
|
|
4
3
|
import { configs } from '../env'
|
|
4
|
+
import { getSlide } from '../logic/slides'
|
|
5
5
|
|
|
6
6
|
export function useViewTransition() {
|
|
7
7
|
const router = useRouter()
|
|
@@ -17,7 +17,7 @@ export function useViewTransition() {
|
|
|
17
17
|
const toMeta = getSlide(to.params.no as string)?.meta
|
|
18
18
|
const fromNo = fromMeta?.slide?.no
|
|
19
19
|
const toNo = toMeta?.slide?.no
|
|
20
|
-
const transitionType = fromNo != null && toNo != null
|
|
20
|
+
const transitionType = fromNo != null && toNo != null && fromNo !== toNo
|
|
21
21
|
&& ((fromNo < toNo ? fromMeta?.transition : toMeta?.transition) ?? configs.transition)
|
|
22
22
|
if (transitionType !== 'view-transition') {
|
|
23
23
|
isViewTransition.value = false
|
|
@@ -41,7 +41,6 @@ export function useViewTransition() {
|
|
|
41
41
|
|
|
42
42
|
// Wait for `TransitionGroup` to become normal `div`
|
|
43
43
|
setTimeout(() => {
|
|
44
|
-
// @ts-expect-error missing types
|
|
45
44
|
document.startViewTransition(() => {
|
|
46
45
|
changeRoute()
|
|
47
46
|
return promise
|
package/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComputedRef, InjectionKey, Ref, UnwrapNestedRefs } from 'vue'
|
|
2
1
|
import type { ClicksContext, RenderContext, SlideRoute } from '@slidev/types'
|
|
2
|
+
import type { ComputedRef, InjectionKey, Ref, UnwrapNestedRefs } from 'vue'
|
|
3
3
|
import type { SlidevContext } from './modules/context'
|
|
4
4
|
|
|
5
5
|
// Here we use string literal instead of symbols to make HMR more stable
|
|
@@ -45,6 +45,7 @@ export const FRONTMATTER_FIELDS = [
|
|
|
45
45
|
'transition',
|
|
46
46
|
'zoom',
|
|
47
47
|
'dragPos',
|
|
48
|
+
'lang',
|
|
48
49
|
]
|
|
49
50
|
|
|
50
51
|
export const HEADMATTER_FIELDS = [
|
|
@@ -81,4 +82,5 @@ export const HEADMATTER_FIELDS = [
|
|
|
81
82
|
'mdc',
|
|
82
83
|
'contextMenu',
|
|
83
84
|
'wakeLock',
|
|
85
|
+
'overviewSnapshots',
|
|
84
86
|
]
|
package/context.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed, ref, toRef } from 'vue'
|
|
2
1
|
import { injectLocal, objectOmit } from '@vueuse/core'
|
|
2
|
+
import { computed, ref, toRef } from 'vue'
|
|
3
3
|
import {
|
|
4
4
|
FRONTMATTER_FIELDS,
|
|
5
5
|
HEADMATTER_FIELDS,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
injectionRenderContext,
|
|
10
10
|
injectionRoute,
|
|
11
11
|
injectionSlideScale,
|
|
12
|
-
injectionSlideZoom,
|
|
13
12
|
injectionSlidevContext,
|
|
13
|
+
injectionSlideZoom,
|
|
14
14
|
} from './constants'
|
|
15
15
|
|
|
16
16
|
/**
|
package/env.ts
CHANGED
package/index.ts
CHANGED
|
@@ -3,11 +3,29 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The other files despite they are accessable, are not meant to be used directly, breaking changes might happen.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export { useNav } from './composables/useNav'
|
|
8
|
-
export { useDrawings } from './composables/useDrawings'
|
|
6
|
+
|
|
9
7
|
export { useDarkMode } from './composables/useDarkMode'
|
|
10
|
-
export {
|
|
8
|
+
export { useDrawings } from './composables/useDrawings'
|
|
9
|
+
export { useNav } from './composables/useNav'
|
|
10
|
+
|
|
11
|
+
export { useSlideContext } from './context'
|
|
11
12
|
|
|
12
|
-
export * from './layoutHelper'
|
|
13
13
|
export * from './env'
|
|
14
|
+
export * from './layoutHelper'
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
onSlideEnter,
|
|
18
|
+
onSlideLeave,
|
|
19
|
+
useIsSlideActive,
|
|
20
|
+
} from './logic/slides'
|
|
21
|
+
|
|
22
|
+
export type { DrawingsState } from './state/drawings'
|
|
23
|
+
export { drawingState, onDrawingUpdate } from './state/drawings'
|
|
24
|
+
export type { SharedState } from './state/shared'
|
|
25
|
+
export { onSharedUpdate, sharedState } from './state/shared'
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
addSyncMethod,
|
|
29
|
+
createSyncState,
|
|
30
|
+
disableBuiltinSync,
|
|
31
|
+
} from './state/syncState'
|
|
@@ -42,7 +42,7 @@ function onMousedown() {
|
|
|
42
42
|
:class="length && props.clicksContext.isMounted ? '' : 'op50'"
|
|
43
43
|
>
|
|
44
44
|
<div class="flex gap-0.2 items-center min-w-16 font-mono mr1">
|
|
45
|
-
<carbon:cursor-1 text-sm op50 />
|
|
45
|
+
<div class="i-carbon:cursor-1 text-sm op50" />
|
|
46
46
|
<template v-if="current >= 0 && current !== CLICKS_MAX && active">
|
|
47
47
|
<div flex-auto />
|
|
48
48
|
<span text-primary>{{ current }}</span>
|
package/internals/CodeRunner.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { CodeRunnerOutputs, RawAtValue } from '@slidev/types'
|
|
2
3
|
import { debounce, toArray } from '@antfu/utils'
|
|
3
4
|
import { useVModel } from '@vueuse/core'
|
|
4
|
-
import type { CodeRunnerOutputs, RawAtValue } from '@slidev/types'
|
|
5
5
|
import { computed, onMounted, onUnmounted, ref, shallowRef, toValue, watch, watchSyncEffect } from 'vue'
|
|
6
|
-
import { useSlideContext } from '../context'
|
|
7
|
-
import setupCodeRunners from '../setup/code-runners'
|
|
8
6
|
import { useNav } from '../composables/useNav'
|
|
7
|
+
import { useSlideContext } from '../context'
|
|
9
8
|
import { makeId } from '../logic/utils'
|
|
10
|
-
import
|
|
9
|
+
import setupCodeRunners from '../setup/code-runners'
|
|
11
10
|
import DomElement from './DomElement.vue'
|
|
11
|
+
import IconButton from './IconButton.vue'
|
|
12
12
|
|
|
13
13
|
const props = defineProps<{
|
|
14
14
|
modelValue: string
|
|
@@ -119,7 +119,7 @@ else if (autorun)
|
|
|
119
119
|
</div>
|
|
120
120
|
<div v-if="code.trim()" class="absolute right-1 top-1 max-h-full flex gap-1">
|
|
121
121
|
<IconButton class="w-8 h-8 max-h-full flex justify-center items-center" title="Run code" @click="triggerRun">
|
|
122
|
-
<carbon:play />
|
|
122
|
+
<div class="i-carbon:play" />
|
|
123
123
|
</IconButton>
|
|
124
124
|
</div>
|
|
125
125
|
</template>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { onClickOutside, useElementBounding, useEventListener, useWindowFocus } from '@vueuse/core'
|
|
3
3
|
import { computed, ref, watch } from 'vue'
|
|
4
|
-
import { closeContextMenu, currentContextMenu } from '../logic/contextMenu'
|
|
5
4
|
import { useDynamicSlideInfo } from '../composables/useSlideInfo'
|
|
6
|
-
import { windowSize } from '../state'
|
|
7
5
|
import { configs } from '../env'
|
|
6
|
+
import { closeContextMenu, currentContextMenu } from '../logic/contextMenu'
|
|
7
|
+
import { windowSize } from '../state'
|
|
8
8
|
|
|
9
9
|
const container = ref<HTMLElement>()
|
|
10
10
|
|
|
@@ -69,12 +69,13 @@ const top = computed(() => {
|
|
|
69
69
|
<div v-if="item === 'separator'" :key="index" class="w-full my1 border-t border-main" />
|
|
70
70
|
<div
|
|
71
71
|
v-else-if="item.small"
|
|
72
|
-
class="p-2 w-[40px] h-[40px] inline-block text-center cursor-pointer rounded"
|
|
72
|
+
class="p-2 w-[40px] h-[40px] inline-block text-center cursor-pointer rounded flex"
|
|
73
73
|
:class="item.disabled ? `op40` : `hover:bg-active`"
|
|
74
74
|
:title="(item.label as string)"
|
|
75
75
|
@click="item.action"
|
|
76
76
|
>
|
|
77
|
-
<
|
|
77
|
+
<div v-if="typeof item.icon === 'string'" :class="item.icon" class="text-1.2em ma" />
|
|
78
|
+
<component :is="item.icon" v-else />
|
|
78
79
|
</div>
|
|
79
80
|
<div
|
|
80
81
|
v-else
|
|
@@ -82,8 +83,9 @@ const top = computed(() => {
|
|
|
82
83
|
:class="item.disabled ? `op40` : `hover:bg-active`"
|
|
83
84
|
@click="item.action"
|
|
84
85
|
>
|
|
85
|
-
<div class="mx-auto">
|
|
86
|
-
<
|
|
86
|
+
<div class="mx-auto flex">
|
|
87
|
+
<div v-if="typeof item.icon === 'string'" :class="item.icon" class="text-1.2em ma" />
|
|
88
|
+
<component :is="item.icon" v-else />
|
|
87
89
|
</div>
|
|
88
90
|
<div v-if="typeof item.label === 'string'">
|
|
89
91
|
{{ item.label }}
|
package/internals/Controls.vue
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { shallowRef } from 'vue'
|
|
3
|
-
import { showInfoDialog, showRecordingDialog } from '../state'
|
|
4
|
-
import { configs } from '../env'
|
|
5
3
|
import { useNav } from '../composables/useNav'
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import Goto from './Goto.vue'
|
|
4
|
+
import { configs } from '../env'
|
|
5
|
+
import { showInfoDialog, showRecordingDialog } from '../state'
|
|
9
6
|
import ContextMenu from './ContextMenu.vue'
|
|
7
|
+
import Goto from './Goto.vue'
|
|
8
|
+
import InfoDialog from './InfoDialog.vue'
|
|
9
|
+
import QuickOverview from './QuickOverview.vue'
|
|
10
10
|
|
|
11
11
|
const { isEmbedded } = useNav()
|
|
12
12
|
const drawingEnabled = __SLIDEV_FEATURE_DRAWINGS__ && !configs.drawings.presenterOnly && !isEmbedded.value
|
|
@@ -23,7 +23,7 @@ if (__SLIDEV_FEATURE_RECORD__) {
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
|
-
<DrawingControls v-if="
|
|
26
|
+
<DrawingControls v-if="DrawingControls" />
|
|
27
27
|
<QuickOverview />
|
|
28
28
|
<Goto />
|
|
29
29
|
<WebCamera v-if="WebCamera" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { SelectionItem } from './types'
|
|
2
3
|
import { computed } from 'vue'
|
|
3
|
-
import { currentCamera, currentMic } from '../state'
|
|
4
4
|
import {
|
|
5
5
|
cameras,
|
|
6
6
|
ensureDevicesListPermissions,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
mimeType,
|
|
10
10
|
supportedMimeTypes,
|
|
11
11
|
} from '../logic/recording'
|
|
12
|
+
import { currentCamera, currentMic } from '../state'
|
|
12
13
|
import SelectList from './SelectList.vue'
|
|
13
|
-
import type { SelectionItem } from './types'
|
|
14
14
|
|
|
15
15
|
const camerasItems = computed<SelectionItem<string>[]>(() => [
|
|
16
16
|
{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { clamp } from '@antfu/utils'
|
|
3
2
|
import type { Pausable } from '@vueuse/core'
|
|
3
|
+
import type { DragElementState } from '../composables/useDragElements'
|
|
4
|
+
import { clamp } from '@antfu/utils'
|
|
4
5
|
import { useIntervalFn } from '@vueuse/core'
|
|
5
6
|
import { computed, inject, ref, watchEffect } from 'vue'
|
|
6
|
-
import type { DragElementState } from '../composables/useDragElements'
|
|
7
7
|
import { useSlideBounds } from '../composables/useSlideBounds'
|
|
8
8
|
import { injectionSlideScale } from '../constants'
|
|
9
9
|
import { slideHeight, slideWidth } from '../env'
|