@slidev/client 0.30.0 → 0.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builtin/Link.vue +2 -2
- package/builtin/Monaco.vue +4 -4
- package/builtin/PlantUml.vue +4 -4
- package/builtin/TocList.vue +6 -2
- package/builtin/Tweet.vue +7 -3
- package/internals/Controls.vue +3 -5
- package/internals/Goto.vue +20 -7
- package/internals/NavControls.vue +2 -2
- package/internals/PrintContainer.vue +2 -1
- package/logic/nav.ts +4 -2
- package/package.json +3 -3
- package/setup/prettier.ts +0 -1
package/builtin/Link.vue
CHANGED
|
@@ -17,8 +17,8 @@ defineProps<{
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<template>
|
|
20
|
-
<RouterLink v-if="!isPrintMode && title" :to="to" v-html="title" />
|
|
21
|
-
<RouterLink v-else-if="!isPrintMode && !title" :to="to">
|
|
20
|
+
<RouterLink v-if="!isPrintMode && title" :to="to" @click="$event.target.blur()" v-html="title" />
|
|
21
|
+
<RouterLink v-else-if="!isPrintMode && !title" :to="to" @click="$event.target.blur()">
|
|
22
22
|
<slot />
|
|
23
23
|
</RouterLink>
|
|
24
24
|
<a v-else-if="isPrintMode && title" :href="'#' + to" v-html="title" />
|
package/builtin/Monaco.vue
CHANGED
|
@@ -11,10 +11,6 @@ const your_code = 'here'
|
|
|
11
11
|
Learn more: https://sli.dev/guide/syntax.html#monaco-editor
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
-
<template>
|
|
15
|
-
<iframe ref="iframe" class="text-base w-full rounded" :style="{ height }" />
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
14
|
<script setup lang="ts">
|
|
19
15
|
import { computed, onMounted, ref, watchEffect } from 'vue'
|
|
20
16
|
import { useEventListener } from '@vueuse/core'
|
|
@@ -135,3 +131,7 @@ watchEffect(() => {
|
|
|
135
131
|
postStyle()
|
|
136
132
|
})
|
|
137
133
|
</script>
|
|
134
|
+
|
|
135
|
+
<template>
|
|
136
|
+
<iframe ref="iframe" class="text-base w-full rounded" :style="{ height }" />
|
|
137
|
+
</template>
|
package/builtin/PlantUml.vue
CHANGED
|
@@ -10,10 +10,6 @@ Alice -> Bob : Hello!
|
|
|
10
10
|
@enduml
|
|
11
11
|
```
|
|
12
12
|
-->
|
|
13
|
-
<template>
|
|
14
|
-
<img alt="PlantUML diagram" :src="uri" :style="{scale}">
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
13
|
<script setup lang="ts">
|
|
18
14
|
|
|
19
15
|
import { computed } from 'vue'
|
|
@@ -27,3 +23,7 @@ const props = defineProps<{
|
|
|
27
23
|
const uri = computed(() => `${props.server}/svg/${props.code}`)
|
|
28
24
|
|
|
29
25
|
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<img alt="PlantUML diagram" :src="uri" :style="{scale}">
|
|
29
|
+
</template>
|
package/builtin/TocList.vue
CHANGED
|
@@ -9,6 +9,8 @@ Usage:
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { computed } from 'vue'
|
|
11
11
|
import { toArray } from '@antfu/utils'
|
|
12
|
+
// @ts-expect-error virtual module
|
|
13
|
+
import Titles from '/@slidev/titles.md'
|
|
12
14
|
import type { TocItem } from '../logic/nav'
|
|
13
15
|
|
|
14
16
|
const props = withDefaults(defineProps<{
|
|
@@ -29,8 +31,10 @@ const classes = computed(() => {
|
|
|
29
31
|
<template>
|
|
30
32
|
<ol v-if="list && list.length > 0" :class="classes">
|
|
31
33
|
<li v-for="item in list" :key="item.path" :class="['slidev-toc-item', {'slidev-toc-item-active': item.active}, {'slidev-toc-item-parent-active': item.activeParent}]">
|
|
32
|
-
<Link :to="item.path"
|
|
33
|
-
|
|
34
|
+
<Link :to="item.path">
|
|
35
|
+
<Titles :no="item.path" />
|
|
36
|
+
</Link>
|
|
37
|
+
<TocList v-if="item.children.length > 0" :level="level + 1" :list="item.children" :list-class="listClass" />
|
|
34
38
|
</li>
|
|
35
39
|
</ol>
|
|
36
40
|
</template>
|
package/builtin/Tweet.vue
CHANGED
|
@@ -21,10 +21,11 @@ const tweet = ref<HTMLElement | null>()
|
|
|
21
21
|
|
|
22
22
|
const vm = getCurrentInstance()!
|
|
23
23
|
const loaded = ref(false)
|
|
24
|
+
const tweetNotFound = ref(false)
|
|
24
25
|
|
|
25
26
|
async function create() {
|
|
26
27
|
// @ts-expect-error global
|
|
27
|
-
await window.twttr.widgets.createTweet(
|
|
28
|
+
const element = await window.twttr.widgets.createTweet(
|
|
28
29
|
props.id.toString(),
|
|
29
30
|
tweet.value,
|
|
30
31
|
{
|
|
@@ -33,6 +34,8 @@ async function create() {
|
|
|
33
34
|
},
|
|
34
35
|
)
|
|
35
36
|
loaded.value = true
|
|
37
|
+
if (element === undefined)
|
|
38
|
+
tweetNotFound.value = true
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
// @ts-expect-error global
|
|
@@ -55,10 +58,11 @@ else {
|
|
|
55
58
|
|
|
56
59
|
<template>
|
|
57
60
|
<Transform :scale="scale || 1">
|
|
58
|
-
<div ref="tweet" class="tweet" data-waitfor="iframe">
|
|
59
|
-
<div v-if="!loaded" class="w-30 h-30 my-10px bg-gray-400 bg-opacity-10 rounded-lg flex opacity-50">
|
|
61
|
+
<div ref="tweet" class="tweet" :data-waitfor="tweetNotFound ? '' : 'iframe'">
|
|
62
|
+
<div v-if="!loaded || tweetNotFound" class="w-30 h-30 my-10px bg-gray-400 bg-opacity-10 rounded-lg flex opacity-50">
|
|
60
63
|
<div class="m-auto animate-pulse text-4xl">
|
|
61
64
|
<carbon:logo-twitter />
|
|
65
|
+
<span v-if="tweetNotFound">Could not load tweet with id="{{ props.id }}"</span>
|
|
62
66
|
</div>
|
|
63
67
|
</div>
|
|
64
68
|
</div>
|
package/internals/Controls.vue
CHANGED
|
@@ -8,7 +8,7 @@ import Goto from './Goto.vue'
|
|
|
8
8
|
|
|
9
9
|
const WebCamera = shallowRef<any>()
|
|
10
10
|
const RecordingDialog = shallowRef<any>()
|
|
11
|
-
if (
|
|
11
|
+
if (__SLIDEV_FEATURE_RECORD__) {
|
|
12
12
|
import('./WebCamera.vue').then(v => WebCamera.value = v.default)
|
|
13
13
|
import('./RecordingDialog.vue').then(v => RecordingDialog.value = v.default)
|
|
14
14
|
}
|
|
@@ -17,9 +17,7 @@ if (__DEV__) {
|
|
|
17
17
|
<template>
|
|
18
18
|
<SlidesOverview v-model="showOverview" />
|
|
19
19
|
<Goto />
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
<RecordingDialog v-if="RecordingDialog" v-model="showRecordingDialog" />
|
|
23
|
-
</template>
|
|
20
|
+
<WebCamera v-if="WebCamera" />
|
|
21
|
+
<RecordingDialog v-if="RecordingDialog" v-model="showRecordingDialog" />
|
|
24
22
|
<InfoDialog v-if="configs.info" v-model="showInfoDialog" />
|
|
25
23
|
</template>
|
package/internals/Goto.vue
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, nextTick, ref, watch } from 'vue'
|
|
3
|
-
import { go, total } from '../logic/nav'
|
|
3
|
+
import { go, rawRoutes, total } from '../logic/nav'
|
|
4
4
|
import { showGotoDialog } from '../state'
|
|
5
5
|
|
|
6
6
|
const input = ref<HTMLInputElement>()
|
|
7
7
|
const text = ref('')
|
|
8
|
-
|
|
9
|
-
const valid = computed(() =>
|
|
8
|
+
|
|
9
|
+
const valid = computed(() => {
|
|
10
|
+
if (text.value.startsWith('/')) {
|
|
11
|
+
return !!rawRoutes.find(r => r.path === text.value.substring(1))
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const num = +text.value
|
|
15
|
+
return !isNaN(num) && num > 0 && num <= total.value
|
|
16
|
+
}
|
|
17
|
+
})
|
|
10
18
|
|
|
11
19
|
function goTo() {
|
|
12
|
-
if (valid.value)
|
|
13
|
-
|
|
20
|
+
if (valid.value) {
|
|
21
|
+
if (text.value.startsWith('/'))
|
|
22
|
+
go(text.value.substring(1))
|
|
23
|
+
|
|
24
|
+
else
|
|
25
|
+
go(+text.value)
|
|
26
|
+
}
|
|
14
27
|
close()
|
|
15
28
|
}
|
|
16
29
|
|
|
@@ -31,8 +44,8 @@ watch(showGotoDialog, async(show) => {
|
|
|
31
44
|
|
|
32
45
|
// remove the g character coming from the key that triggered showGotoDialog (e.g. in Firefox)
|
|
33
46
|
watch(text, (t) => {
|
|
34
|
-
if (t.match(/^[^0-9]/))
|
|
35
|
-
text.value = text.value.
|
|
47
|
+
if (t.match(/^[^0-9/]/))
|
|
48
|
+
text.value = text.value.substring(1)
|
|
36
49
|
})
|
|
37
50
|
</script>
|
|
38
51
|
|
|
@@ -35,7 +35,7 @@ const barStyle = computed(() => props.persist
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
const RecordingControls = shallowRef<any>()
|
|
38
|
-
if (
|
|
38
|
+
if (__SLIDEV_FEATURE_RECORD__)
|
|
39
39
|
import('./RecordingControls.vue').then(v => RecordingControls.value = v.default)
|
|
40
40
|
|
|
41
41
|
const DrawingControls = shallowRef<any>()
|
|
@@ -79,7 +79,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
79
79
|
|
|
80
80
|
<VerticalDivider />
|
|
81
81
|
|
|
82
|
-
<template v-if="
|
|
82
|
+
<template v-if="!isEmbedded">
|
|
83
83
|
<template v-if="!isPresenter && !md && RecordingControls">
|
|
84
84
|
<RecordingControls />
|
|
85
85
|
<VerticalDivider />
|
|
@@ -15,7 +15,8 @@ const height = computed(() => props.width / slideAspect)
|
|
|
15
15
|
const screenAspect = computed(() => width.value / height.value)
|
|
16
16
|
|
|
17
17
|
const scale = computed(() => {
|
|
18
|
-
if (screenAspect.value < slideAspect)
|
|
18
|
+
if (screenAspect.value < slideAspect)
|
|
19
|
+
return width.value / slideWidth
|
|
19
20
|
return (height.value * slideAspect) / slideWidth
|
|
20
21
|
})
|
|
21
22
|
|
package/logic/nav.ts
CHANGED
|
@@ -113,7 +113,7 @@ export async function prevSlide(lastClicks = true) {
|
|
|
113
113
|
router.replace({ query: { ...route.value.query, clicks: clicksTotal.value } })
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export function go(page: number, clicks?: number) {
|
|
116
|
+
export function go(page: number | string, clicks?: number) {
|
|
117
117
|
return router.push({ path: getPath(page), query: { ...route.value.query, clicks } })
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -158,7 +158,9 @@ export async function downloadPDF() {
|
|
|
158
158
|
saveAs(
|
|
159
159
|
isString(configs.download)
|
|
160
160
|
? configs.download
|
|
161
|
-
:
|
|
161
|
+
: configs.exportFilename
|
|
162
|
+
? `${configs.exportFilename}.pdf`
|
|
163
|
+
: `${import.meta.env.BASE_URL}slidev-exported.pdf`,
|
|
162
164
|
`${configs.title}.pdf`,
|
|
163
165
|
)
|
|
164
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"homepage": "https://sli.dev",
|
|
6
6
|
"bugs": "https://github.com/slidevjs/slidev/issues",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"funding": "https://github.com/sponsors/antfu",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@antfu/utils": "^0.5.1",
|
|
16
|
-
"@slidev/parser": "0.30.
|
|
17
|
-
"@slidev/types": "0.30.
|
|
16
|
+
"@slidev/parser": "0.30.3",
|
|
17
|
+
"@slidev/types": "0.30.3",
|
|
18
18
|
"@vueuse/core": "^8.2.5",
|
|
19
19
|
"@vueuse/head": "^0.7.5",
|
|
20
20
|
"@vueuse/motion": "^2.0.0-beta.18",
|
package/setup/prettier.ts
CHANGED