@slidev/client 0.36.5 → 0.36.7
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/Print.vue +2 -6
- package/internals/PrintContainer.vue +1 -4
- package/layouts/two-cols-header.vue +39 -0
- package/modules/directives.ts +2 -2
- package/package.json +13 -13
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])
|
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
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Usage:
|
|
3
|
+
```md
|
|
4
|
+
---
|
|
5
|
+
layout: two-cols-header
|
|
6
|
+
---
|
|
7
|
+
This spans both
|
|
8
|
+
::left::
|
|
9
|
+
# Left
|
|
10
|
+
This shows on the left
|
|
11
|
+
::right::
|
|
12
|
+
# Right
|
|
13
|
+
This shows on the right
|
|
14
|
+
```
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
class: {
|
|
20
|
+
type: String,
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div class="slidev-layout two-columns w-full h-full">
|
|
27
|
+
<div class="col-span-2">
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
<div class="grid grid-cols-2">
|
|
31
|
+
<div class="col-left" :class="props.class">
|
|
32
|
+
<slot name="left" />
|
|
33
|
+
</div>
|
|
34
|
+
<div class="col-right" :class="props.class">
|
|
35
|
+
<slot name="right" />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
package/modules/directives.ts
CHANGED
|
@@ -45,7 +45,7 @@ export default function createDirectives() {
|
|
|
45
45
|
elements.value.push(el)
|
|
46
46
|
|
|
47
47
|
// Set default dir.value
|
|
48
|
-
if (dir.value
|
|
48
|
+
if (dir.value == null)
|
|
49
49
|
dir.value = elements?.value.length
|
|
50
50
|
|
|
51
51
|
// If orderMap didn't have dir.value aka the order key, then initialize it.
|
|
@@ -123,7 +123,7 @@ export default function createDirectives() {
|
|
|
123
123
|
const prev = elements?.value.length
|
|
124
124
|
|
|
125
125
|
// Set default dir.value
|
|
126
|
-
if (dir.value
|
|
126
|
+
if (dir.value == null)
|
|
127
127
|
dir.value = elements?.value.length
|
|
128
128
|
|
|
129
129
|
// If a v-click order before v-after is lower than v-after, the order map will
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.7",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,34 +16,34 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@antfu/utils": "^0.5.2",
|
|
19
|
-
"@slidev/parser": "0.36.
|
|
20
|
-
"@slidev/types": "0.36.
|
|
21
|
-
"@unocss/reset": "^0.45.
|
|
22
|
-
"@vueuse/core": "^9.
|
|
23
|
-
"@vueuse/head": "^0.
|
|
24
|
-
"@vueuse/math": "^9.
|
|
25
|
-
"@vueuse/motion": "^2.0.0-beta.
|
|
19
|
+
"@slidev/parser": "0.36.7",
|
|
20
|
+
"@slidev/types": "0.36.7",
|
|
21
|
+
"@unocss/reset": "^0.45.29",
|
|
22
|
+
"@vueuse/core": "^9.3.0",
|
|
23
|
+
"@vueuse/head": "^0.9.8",
|
|
24
|
+
"@vueuse/math": "^9.3.0",
|
|
25
|
+
"@vueuse/motion": "^2.0.0-beta.23",
|
|
26
26
|
"codemirror": "^5.65.5",
|
|
27
27
|
"defu": "^6.1.0",
|
|
28
|
-
"drauu": "^0.3.
|
|
28
|
+
"drauu": "^0.3.2",
|
|
29
29
|
"file-saver": "^2.0.5",
|
|
30
30
|
"js-base64": "^3.7.2",
|
|
31
31
|
"js-yaml": "^4.1.0",
|
|
32
32
|
"katex": "^0.16.2",
|
|
33
|
-
"mermaid": "^9.1.
|
|
33
|
+
"mermaid": "^9.1.7",
|
|
34
34
|
"monaco-editor": "^0.33.0",
|
|
35
35
|
"nanoid": "^4.0.0",
|
|
36
36
|
"prettier": "^2.7.1",
|
|
37
37
|
"recordrtc": "^5.6.2",
|
|
38
38
|
"resolve": "^1.22.1",
|
|
39
|
-
"unocss": "^0.45.
|
|
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
|
}
|