@slidev/client 0.36.6 → 0.36.8
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/env.ts +3 -1
- package/internals/PresenterPrint.vue +51 -0
- package/internals/Print.vue +2 -6
- package/internals/PrintContainer.vue +1 -4
- package/layouts/image-left.vue +1 -1
- package/layouts/image-right.vue +1 -1
- package/package.json +6 -6
- package/routes.ts +2 -0
package/env.ts
CHANGED
|
@@ -7,7 +7,9 @@ import _configs from '/@slidev/configs'
|
|
|
7
7
|
export const configs = _configs as SlidevConfig
|
|
8
8
|
export const slideAspect = configs.aspectRatio ?? (16 / 9)
|
|
9
9
|
export const slideWidth = configs.canvasWidth ?? 980
|
|
10
|
-
|
|
10
|
+
// To honor the aspect ratio more as possible, we need to approximate the height to the next integer.
|
|
11
|
+
// Doing this, we will prevent on print, to create an additional empty white page after each page.
|
|
12
|
+
export const slideHeight = Math.ceil(slideWidth / slideAspect)
|
|
11
13
|
|
|
12
14
|
export const themeVars = computed(() => {
|
|
13
15
|
return objectMap(configs.themeConfig || {}, (k, v) => [`--slidev-theme-${k}`, v])
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useHead } from '@vueuse/head'
|
|
3
|
+
import { computed } from '@vue/reactivity'
|
|
4
|
+
import { rawRoutes, total } from '../logic/nav'
|
|
5
|
+
import { configs, themeVars } from '../env'
|
|
6
|
+
import NoteViewer from './NoteViewer.vue'
|
|
7
|
+
|
|
8
|
+
useHead({ title: `Notes - ${configs.title}` })
|
|
9
|
+
|
|
10
|
+
const slidesWithNote = computed(() => rawRoutes
|
|
11
|
+
.slice(0, -1)
|
|
12
|
+
.map(route => route.meta?.slide)
|
|
13
|
+
.filter(slide => slide !== undefined && slide.notesHTML !== ''))
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div id="page-root" :style="themeVars">
|
|
18
|
+
<div class="m-4">
|
|
19
|
+
<div class="mb-10">
|
|
20
|
+
<h1 class="text-4xl font-bold mt-2">
|
|
21
|
+
{{ configs.title }}
|
|
22
|
+
</h1>
|
|
23
|
+
<div class="opacity-50">
|
|
24
|
+
{{ new Date().toLocaleString() }}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div v-for="(slide, index) of slidesWithNote" :key="index" class="flex flex-col gap-4">
|
|
29
|
+
<div>
|
|
30
|
+
<h2 class="text-lg">
|
|
31
|
+
<div class="font-bold flex gap-2">
|
|
32
|
+
<div class="opacity-50">
|
|
33
|
+
{{ slide?.no }}/{{ total }}
|
|
34
|
+
</div>
|
|
35
|
+
{{ slide?.title }}
|
|
36
|
+
<div class="flex-auto" />
|
|
37
|
+
</div>
|
|
38
|
+
</h2>
|
|
39
|
+
<NoteViewer :note-html="slide!.notesHTML" class="max-w-full" />
|
|
40
|
+
</div>
|
|
41
|
+
<hr v-if="index < slidesWithNote.length - 1" class="border-gray-400/50 mb-8">
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<style lang="postcss">
|
|
48
|
+
@page {
|
|
49
|
+
size: A4;
|
|
50
|
+
}
|
|
51
|
+
</style>
|
package/internals/Print.vue
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Slots } from 'vue'
|
|
3
3
|
import { h, watchEffect } from 'vue'
|
|
4
|
-
import _configs from '/@slidev/configs'
|
|
5
4
|
import { windowSize } from '../state'
|
|
6
5
|
import { isPrintMode } from '../logic/nav'
|
|
7
|
-
import { themeVars } from '../env'
|
|
6
|
+
import { slideHeight, slideWidth, themeVars } from '../env'
|
|
8
7
|
import PrintContainer from './PrintContainer.vue'
|
|
9
8
|
|
|
10
|
-
const width = _configs.canvasWidth
|
|
11
|
-
const height = Math.round(width / _configs.aspectRatio) + 1
|
|
12
|
-
|
|
13
9
|
function vStyle<Props>(props: Props, { slots }: { slots: Slots }) {
|
|
14
10
|
if (slots.default)
|
|
15
11
|
return h('style', slots.default())
|
|
@@ -25,7 +21,7 @@ watchEffect(() => {
|
|
|
25
21
|
|
|
26
22
|
<template>
|
|
27
23
|
<vStyle>
|
|
28
|
-
@page { size: {{
|
|
24
|
+
@page { size: {{ slideWidth }}px {{ slideHeight }}px; margin: 0px; }
|
|
29
25
|
</vStyle>
|
|
30
26
|
<div id="page-root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
|
|
31
27
|
<PrintContainer
|
package/layouts/image-left.vue
CHANGED
|
@@ -15,7 +15,7 @@ const style = computed(() => handleBackground(props.image))
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<div class="grid grid-cols-2 w-full h-full">
|
|
18
|
+
<div class="grid grid-cols-2 w-full h-full auto-rows-fr">
|
|
19
19
|
<div class="w-full w-full" :style="style" />
|
|
20
20
|
<div class="slidev-layout default" :class="props.class">
|
|
21
21
|
<slot />
|
package/layouts/image-right.vue
CHANGED
|
@@ -15,7 +15,7 @@ const style = computed(() => handleBackground(props.image))
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<div class="grid grid-cols-2 w-full h-full">
|
|
18
|
+
<div class="grid grid-cols-2 w-full h-full auto-rows-fr">
|
|
19
19
|
<div class="slidev-layout default" :class="props.class">
|
|
20
20
|
<slot />
|
|
21
21
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.8",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@antfu/utils": "^0.5.2",
|
|
19
|
-
"@slidev/parser": "0.36.
|
|
20
|
-
"@slidev/types": "0.36.
|
|
19
|
+
"@slidev/parser": "0.36.8",
|
|
20
|
+
"@slidev/types": "0.36.8",
|
|
21
21
|
"@unocss/reset": "^0.45.29",
|
|
22
22
|
"@vueuse/core": "^9.3.0",
|
|
23
|
-
"@vueuse/head": "^0.9.
|
|
23
|
+
"@vueuse/head": "^0.9.8",
|
|
24
24
|
"@vueuse/math": "^9.3.0",
|
|
25
25
|
"@vueuse/motion": "^2.0.0-beta.23",
|
|
26
26
|
"codemirror": "^5.65.5",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"resolve": "^1.22.1",
|
|
39
39
|
"unocss": "^0.45.29",
|
|
40
40
|
"vite-plugin-windicss": "^1.8.8",
|
|
41
|
-
"vue": "^3.2.
|
|
41
|
+
"vue": "^3.2.41",
|
|
42
42
|
"vue-router": "^4.1.5",
|
|
43
43
|
"vue-starport": "^0.3.0",
|
|
44
44
|
"windicss": "^3.5.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"vite": "^3.1.
|
|
47
|
+
"vite": "^3.1.8"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/routes.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RouteRecordRaw } from 'vue-router'
|
|
2
2
|
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
|
3
3
|
import Play from './internals/Play.vue'
|
|
4
|
+
import PresenterPrint from './internals/PresenterPrint.vue'
|
|
4
5
|
import Print from './internals/Print.vue'
|
|
5
6
|
// @ts-expect-error missing types
|
|
6
7
|
import _rawRoutes from '/@slidev/routes'
|
|
@@ -20,6 +21,7 @@ export const routes: RouteRecordRaw[] = [
|
|
|
20
21
|
{ name: 'print', path: '/print', component: Print },
|
|
21
22
|
{ path: '', redirect: { path: '/1' } },
|
|
22
23
|
{ path: '/:pathMatch(.*)', redirect: { path: '/1' } },
|
|
24
|
+
{ path: '/presenter/print', component: PresenterPrint },
|
|
23
25
|
{
|
|
24
26
|
name: 'presenter',
|
|
25
27
|
path: '/presenter/:no',
|