@slidev/client 52.15.2 → 52.17.0
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/App.vue +2 -0
- package/builtin/AutoFitText.vue +54 -35
- package/builtin/KaTexBlockWrapper.test.ts +41 -0
- package/builtin/KaTexBlockWrapper.vue +4 -19
- package/builtin/ShikiMagicMove.vue +2 -2
- package/builtin/TocList.vue +1 -1
- package/builtin/katex-lines.ts +22 -0
- package/composables/useEmbeddedCtrl.ts +4 -2
- package/composables/useNav.ts +1 -1
- package/composables/usePreloadImages.ts +40 -1
- package/constants.ts +1 -0
- package/env.ts +1 -1
- package/internals/ClicksSlider.vue +99 -48
- package/internals/CodeRunner.vue +2 -2
- package/internals/Goto.vue +2 -2
- package/internals/NavControls.vue +1 -1
- package/internals/NoteDisplay.vue +5 -0
- package/internals/NoteEditable.vue +2 -3
- package/internals/PrintSlideClick.vue +1 -1
- package/internals/PwaIndicator.vue +50 -0
- package/internals/SideEditor.vue +2 -7
- package/internals/SlideWrapper.vue +1 -1
- package/internals/SlidesShow.vue +1 -1
- package/logic/sideEditor.ts +14 -0
- package/logic/slidePath.test.ts +29 -0
- package/logic/slidePath.ts +10 -0
- package/logic/slides.ts +3 -3
- package/modules/mermaid.ts +1 -1
- package/package.json +26 -25
- package/pages/overview.vue +293 -64
- package/pages/presenter.vue +1 -4
- package/setup/code-runners.ts +2 -2
- package/setup/context-menu.ts +1 -1
- package/setup/main.ts +11 -5
- package/setup/mermaid.ts +1 -1
- package/setup/monaco.ts +4 -4
- package/setup/pwa.ts +28 -0
- package/setup/root.ts +1 -1
- package/setup/shiki.ts +1 -1
- package/setup/shortcuts.ts +1 -1
- package/shim-vue.d.ts +1 -0
- package/shim.d.ts +2 -0
- package/styles/index.ts +1 -1
|
@@ -131,10 +131,9 @@ watch(
|
|
|
131
131
|
v-else
|
|
132
132
|
ref="inputEl"
|
|
133
133
|
v-model="note"
|
|
134
|
-
class="prose dark:prose-invert resize-none overflow-auto outline-none bg-transparent block border-primary border-2"
|
|
135
|
-
style="line-height: 1.75;"
|
|
134
|
+
class="prose dark:prose-invert resize-none overflow-auto outline-none bg-transparent block border-primary border-2 slidev-note placeholder:op25"
|
|
136
135
|
:style="[props.style, inputHeight != null ? { height: `${inputHeight}px` } : {}]"
|
|
137
|
-
:class="props.class"
|
|
136
|
+
:class="[props.class, note ? '' : 'italic']"
|
|
138
137
|
:placeholder="placeholder"
|
|
139
138
|
@keydown.esc="editing = false"
|
|
140
139
|
@keydown="onKeyDown"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { SlidevContextNav } from '../composables/useNav'
|
|
3
|
-
import { GlobalBottom, GlobalTop } from '#slidev/global-layers'
|
|
4
3
|
import { provideLocal } from '@vueuse/core'
|
|
5
4
|
import { computed, reactive, shallowRef, useTemplateRef } from 'vue'
|
|
5
|
+
import { GlobalBottom, GlobalTop } from '#slidev/global-layers'
|
|
6
6
|
import { injectionSlideElement, injectionSlidevContext } from '../constants'
|
|
7
7
|
import { configs, slideHeight, slideWidth } from '../env'
|
|
8
8
|
import { getSlideClass } from '../utils'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { pwaCaching, pwaReady } from '../setup/pwa'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<Transition name="slidev-pwa-fade">
|
|
7
|
+
<div
|
|
8
|
+
v-if="pwaCaching || pwaReady"
|
|
9
|
+
class="slidev-pwa-indicator"
|
|
10
|
+
:class="{ ready: pwaReady }"
|
|
11
|
+
>
|
|
12
|
+
<span v-if="pwaCaching">Caching for offline…</span>
|
|
13
|
+
<span v-else-if="pwaReady">Ready offline</span>
|
|
14
|
+
</div>
|
|
15
|
+
</Transition>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.slidev-pwa-indicator {
|
|
20
|
+
position: fixed;
|
|
21
|
+
bottom: 1rem;
|
|
22
|
+
right: 1rem;
|
|
23
|
+
z-index: 9999;
|
|
24
|
+
padding: 0.4em 0.75em;
|
|
25
|
+
border-radius: 0.4em;
|
|
26
|
+
font-size: 0.75rem;
|
|
27
|
+
font-family: sans-serif;
|
|
28
|
+
line-height: 1.4;
|
|
29
|
+
background: rgba(0, 0, 0, 0.72);
|
|
30
|
+
color: #ccc;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
user-select: none;
|
|
33
|
+
backdrop-filter: blur(4px);
|
|
34
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.slidev-pwa-indicator.ready {
|
|
38
|
+
color: #7dce82;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.slidev-pwa-fade-enter-active,
|
|
42
|
+
.slidev-pwa-fade-leave-active {
|
|
43
|
+
transition: opacity 0.35s ease;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.slidev-pwa-fade-enter-from,
|
|
47
|
+
.slidev-pwa-fade-leave-to {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
package/internals/SideEditor.vue
CHANGED
|
@@ -3,6 +3,7 @@ import { throttledWatch, useEventListener } from '@vueuse/core'
|
|
|
3
3
|
import { computed, ref, watch } from 'vue'
|
|
4
4
|
import { useNav } from '../composables/useNav'
|
|
5
5
|
import { useDynamicSlideInfo } from '../composables/useSlideInfo'
|
|
6
|
+
import { parseSideEditorContent } from '../logic/sideEditor'
|
|
6
7
|
import { activeElement, editorHeight, editorWidth, isInputting, showEditor, isEditorVertical as vertical } from '../state'
|
|
7
8
|
import IconButton from './IconButton.vue'
|
|
8
9
|
import ShikiEditor from './ShikiEditor.vue'
|
|
@@ -11,8 +12,6 @@ const props = defineProps<{
|
|
|
11
12
|
resize?: boolean
|
|
12
13
|
}>()
|
|
13
14
|
|
|
14
|
-
const RE_FRONTMATTER_BLOCK = /^---\n([\s\S]*?)\n---\n/
|
|
15
|
-
|
|
16
15
|
const { currentSlideNo, openInEditor } = useNav()
|
|
17
16
|
|
|
18
17
|
const tab = ref<'content' | 'note'>('content')
|
|
@@ -38,11 +37,7 @@ watch(
|
|
|
38
37
|
async function save() {
|
|
39
38
|
dirty.value = false
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
const contentOnly = content.value.trim().replace(RE_FRONTMATTER_BLOCK, (_, f) => {
|
|
43
|
-
frontmatterRaw = f
|
|
44
|
-
return ''
|
|
45
|
-
})
|
|
40
|
+
const { content: contentOnly, frontmatterRaw } = parseSideEditorContent(content.value)
|
|
46
41
|
|
|
47
42
|
await update({
|
|
48
43
|
note: note.value || undefined,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { ClicksContext, RenderContext, SlideRoute } from '@slidev/types'
|
|
3
3
|
import type { CSSProperties, PropType } from 'vue'
|
|
4
|
-
import { SlideBottom, SlideTop } from '#slidev/global-layers'
|
|
5
4
|
import { provideLocal } from '@vueuse/core'
|
|
6
5
|
import { computed, ref, toRef } from 'vue'
|
|
6
|
+
import { SlideBottom, SlideTop } from '#slidev/global-layers'
|
|
7
7
|
import { injectionClicksContext, injectionCurrentPage, injectionFrontmatter, injectionRenderContext, injectionRoute, injectionSlideZoom } from '../constants'
|
|
8
8
|
import { configs } from '../env'
|
|
9
9
|
import { getSlideClass } from '../utils'
|
package/internals/SlidesShow.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { SlideRoute } from '@slidev/types'
|
|
3
|
-
import { GlobalBottom, GlobalTop } from '#slidev/global-layers'
|
|
4
3
|
import { recomputeAllPoppers } from 'floating-vue'
|
|
5
4
|
import { computed, shallowRef, TransitionGroup, watchEffect } from 'vue'
|
|
5
|
+
import { GlobalBottom, GlobalTop } from '#slidev/global-layers'
|
|
6
6
|
import { createFixedClicks } from '../composables/useClicks'
|
|
7
7
|
import { useNav } from '../composables/useNav'
|
|
8
8
|
import { usePreloadImages } from '../composables/usePreloadImages'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const RE_FRONTMATTER_BLOCK = /^---\n([\s\S]*?)\n---(?:\n|$)/
|
|
2
|
+
|
|
3
|
+
export function parseSideEditorContent(content: string) {
|
|
4
|
+
let frontmatterRaw: string | undefined
|
|
5
|
+
const contentOnly = content.trim().replace(RE_FRONTMATTER_BLOCK, (_, f) => {
|
|
6
|
+
frontmatterRaw = f
|
|
7
|
+
return ''
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
content: contentOnly,
|
|
12
|
+
frontmatterRaw,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SlideRoute } from '@slidev/types'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import { getSlideRoutePath } from './slidePath'
|
|
4
|
+
|
|
5
|
+
function route(no: number, routeAlias?: string): SlideRoute {
|
|
6
|
+
return {
|
|
7
|
+
no,
|
|
8
|
+
meta: {
|
|
9
|
+
slide: {
|
|
10
|
+
frontmatter: {
|
|
11
|
+
routeAlias,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as unknown as SlideRoute
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe('getSlideRoutePath', () => {
|
|
19
|
+
it('returns router paths without Vite base', () => {
|
|
20
|
+
expect(getSlideRoutePath(route(2), false)).toBe('/2')
|
|
21
|
+
expect(getSlideRoutePath(route(2), true)).toBe('/presenter/2')
|
|
22
|
+
expect(getSlideRoutePath(route(2), false, true)).toBe('/export/2')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('uses route aliases', () => {
|
|
26
|
+
expect(getSlideRoutePath(route(2, 'intro'), false)).toBe('/intro')
|
|
27
|
+
expect(getSlideRoutePath(route(2, 'intro'), true)).toBe('/presenter/intro')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SlideRoute } from '@slidev/types'
|
|
2
|
+
|
|
3
|
+
export function getSlideRoutePath(
|
|
4
|
+
route: SlideRoute,
|
|
5
|
+
presenter: boolean,
|
|
6
|
+
exporting: boolean = false,
|
|
7
|
+
) {
|
|
8
|
+
const no = route.meta.slide?.frontmatter.routeAlias ?? route.no
|
|
9
|
+
return exporting ? `/export/${no}` : presenter ? `/presenter/${no}` : `/${no}`
|
|
10
|
+
}
|
package/logic/slides.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { SlideRoute } from '@slidev/types'
|
|
2
|
-
import { slides } from '#slidev/slides'
|
|
3
2
|
import { tryOnMounted } from '@vueuse/core'
|
|
4
3
|
import { computed, watch } from 'vue'
|
|
4
|
+
import { slides } from '#slidev/slides'
|
|
5
5
|
import { useSlideContext } from '../context'
|
|
6
|
+
import { getSlideRoutePath } from './slidePath'
|
|
6
7
|
|
|
7
8
|
export { slides }
|
|
8
9
|
|
|
@@ -19,8 +20,7 @@ export function getSlidePath(
|
|
|
19
20
|
) {
|
|
20
21
|
if (typeof route === 'number' || typeof route === 'string')
|
|
21
22
|
route = getSlide(route)!
|
|
22
|
-
|
|
23
|
-
return exporting ? `/export/${no}` : presenter ? `/presenter/${no}` : `/${no}`
|
|
23
|
+
return getSlideRoutePath(route, presenter, exporting)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function useIsSlideActive() {
|
package/modules/mermaid.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import mermaidRenderers from '#slidev/setups/mermaid-renderer'
|
|
2
1
|
import { clearUndefined } from '@antfu/utils'
|
|
3
2
|
import lz from 'lz-string'
|
|
4
3
|
import mermaid from 'mermaid/dist/mermaid.esm.mjs'
|
|
4
|
+
import mermaidRenderers from '#slidev/setups/mermaid-renderer'
|
|
5
5
|
import { makeId } from '../logic/utils'
|
|
6
6
|
import setupMermaid from '../setup/mermaid'
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "52.
|
|
4
|
+
"version": "52.17.0",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,44 +30,45 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@antfu/utils": "^9.3.0",
|
|
32
32
|
"@fix-webm-duration/fix": "^1.0.1",
|
|
33
|
-
"@iconify-json/carbon": "^1.2.
|
|
33
|
+
"@iconify-json/carbon": "^1.2.24",
|
|
34
34
|
"@iconify-json/ph": "^1.2.2",
|
|
35
35
|
"@iconify-json/svg-spinners": "^1.2.4",
|
|
36
|
-
"@shikijs/engine-javascript": "^4.
|
|
37
|
-
"@shikijs/
|
|
38
|
-
"@shikijs/
|
|
36
|
+
"@shikijs/engine-javascript": "^4.3.1",
|
|
37
|
+
"@shikijs/magic-move": "^4.3.1",
|
|
38
|
+
"@shikijs/monaco": "^4.3.1",
|
|
39
|
+
"@shikijs/vitepress-twoslash": "^4.3.1",
|
|
39
40
|
"@slidev/rough-notation": "^0.1.0",
|
|
40
41
|
"@typescript/ata": "^0.9.8",
|
|
41
|
-
"@unhead/vue": "^
|
|
42
|
-
"@unocss/extractor-mdc": "^66.
|
|
43
|
-
"@unocss/preset-mini": "^66.
|
|
44
|
-
"@unocss/reset": "^66.
|
|
45
|
-
"@vueuse/core": "^14.
|
|
46
|
-
"@vueuse/math": "^14.
|
|
42
|
+
"@unhead/vue": "^3.1.7",
|
|
43
|
+
"@unocss/extractor-mdc": "^66.7.5",
|
|
44
|
+
"@unocss/preset-mini": "^66.7.5",
|
|
45
|
+
"@unocss/reset": "^66.7.5",
|
|
46
|
+
"@vueuse/core": "^14.3.0",
|
|
47
|
+
"@vueuse/math": "^14.3.0",
|
|
47
48
|
"@vueuse/motion": "^3.0.3",
|
|
48
|
-
"ansis": "^4.
|
|
49
|
+
"ansis": "^4.3.1",
|
|
49
50
|
"drauu": "^1.0.0",
|
|
50
51
|
"file-saver": "^2.0.5",
|
|
52
|
+
"fitty": "^2.4.2",
|
|
51
53
|
"floating-vue": "^5.2.2",
|
|
52
|
-
"fuse.js": "^7.
|
|
53
|
-
"katex": "^0.
|
|
54
|
+
"fuse.js": "^7.4.2",
|
|
55
|
+
"katex": "^0.17.0",
|
|
54
56
|
"lz-string": "^1.5.0",
|
|
55
|
-
"mermaid": "^11.
|
|
57
|
+
"mermaid": "^11.16.0",
|
|
56
58
|
"monaco-editor": "^0.55.1",
|
|
57
59
|
"nanotar": "^0.3.0",
|
|
58
60
|
"pptxgenjs": "^4.0.1",
|
|
59
61
|
"recordrtc": "^5.6.2",
|
|
60
|
-
"shiki": "^4.
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"vue": "^
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"@slidev/types": "52.
|
|
68
|
-
"@slidev/parser": "52.15.2"
|
|
62
|
+
"shiki": "^4.3.1",
|
|
63
|
+
"typescript": "^6.0.3",
|
|
64
|
+
"unocss": "^66.7.5",
|
|
65
|
+
"vue": "^3.5.39",
|
|
66
|
+
"vue-router": "^5.1.0",
|
|
67
|
+
"yaml": "^2.9.0",
|
|
68
|
+
"@slidev/parser": "52.17.0",
|
|
69
|
+
"@slidev/types": "52.17.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"vite": "^8.
|
|
72
|
+
"vite": "^8.1.3"
|
|
72
73
|
}
|
|
73
74
|
}
|