@slidev/client 0.36.8 → 0.36.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.
@@ -13,7 +13,7 @@ export function useNav(route: ComputedRef<RouteLocationNormalizedLoaded>) {
13
13
  const currentPath = computed(() => getPath(currentPage.value))
14
14
  const currentRoute = computed(() => rawRoutes.find(i => i.path === `${currentPage.value}`))
15
15
  const currentSlideId = computed(() => currentRoute.value?.meta?.slide?.id)
16
- const currentLayout = computed(() => currentRoute.value?.meta?.layout)
16
+ const currentLayout = computed(() => currentRoute.value?.meta?.layout || (currentPage.value === 1 ? 'cover' : 'default'))
17
17
 
18
18
  const nextRoute = computed(() => rawRoutes.find(i => i.path === `${Math.min(rawRoutes.length, currentPage.value + 1)}`))
19
19
 
@@ -1,10 +1,29 @@
1
1
  <script setup lang="ts">
2
- import { useHead } from '@vueuse/head'
3
2
  import { computed } from '@vue/reactivity'
4
- import { rawRoutes, total } from '../logic/nav'
3
+ import { useStyleTag } from '@vueuse/core'
4
+ import { useHead } from '@vueuse/head'
5
5
  import { configs, themeVars } from '../env'
6
+ import { rawRoutes, total } from '../logic/nav'
6
7
  import NoteViewer from './NoteViewer.vue'
7
8
 
9
+ useStyleTag(`
10
+ @page {
11
+ size: A4;
12
+ margin-top: 1.5cm;
13
+ margin-bottom: 1cm;
14
+ }
15
+ * {
16
+ -webkit-print-color-adjust: exact;
17
+ }
18
+ html,
19
+ html body,
20
+ html #app,
21
+ html #page-root {
22
+ height: auto;
23
+ overflow: auto !important;
24
+ }
25
+ `)
26
+
8
27
  useHead({ title: `Notes - ${configs.title}` })
9
28
 
10
29
  const slidesWithNote = computed(() => rawRoutes
@@ -25,7 +44,7 @@ const slidesWithNote = computed(() => rawRoutes
25
44
  </div>
26
45
  </div>
27
46
 
28
- <div v-for="(slide, index) of slidesWithNote" :key="index" class="flex flex-col gap-4">
47
+ <div v-for="(slide, index) of slidesWithNote" :key="index" class="flex flex-col gap-4 break-inside-avoid-page">
29
48
  <div>
30
49
  <h2 class="text-lg">
31
50
  <div class="font-bold flex gap-2">
@@ -43,9 +62,3 @@ const slidesWithNote = computed(() => rawRoutes
43
62
  </div>
44
63
  </div>
45
64
  </template>
46
-
47
- <style lang="postcss">
48
- @page {
49
- size: A4;
50
- }
51
- </style>
package/logic/nav.ts CHANGED
@@ -47,7 +47,7 @@ export const currentPage = computed(() => parseInt(path.value.split(/\//g).slice
47
47
  export const currentPath = computed(() => getPath(currentPage.value))
48
48
  export const currentRoute = computed(() => rawRoutes.find(i => i.path === `${currentPage.value}`))
49
49
  export const currentSlideId = computed(() => currentRoute.value?.meta?.slide?.id)
50
- export const currentLayout = computed(() => currentRoute.value?.meta?.layout)
50
+ export const currentLayout = computed(() => currentRoute.value?.meta?.layout || (currentPage.value === 1 ? 'cover' : 'default'))
51
51
 
52
52
  export const nextRoute = computed(() => rawRoutes.find(i => i.path === `${Math.min(rawRoutes.length, currentPage.value + 1)}`))
53
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.36.8",
3
+ "version": "0.36.10",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@antfu/utils": "^0.5.2",
19
- "@slidev/parser": "0.36.8",
20
- "@slidev/types": "0.36.8",
19
+ "@slidev/parser": "0.36.10",
20
+ "@slidev/types": "0.36.10",
21
21
  "@unocss/reset": "^0.45.29",
22
22
  "@vueuse/core": "^9.3.0",
23
23
  "@vueuse/head": "^0.9.8",
package/routes.ts CHANGED
@@ -1,7 +1,6 @@
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'
5
4
  import Print from './internals/Print.vue'
6
5
  // @ts-expect-error missing types
7
6
  import _rawRoutes from '/@slidev/routes'
@@ -21,7 +20,7 @@ export const routes: RouteRecordRaw[] = [
21
20
  { name: 'print', path: '/print', component: Print },
22
21
  { path: '', redirect: { path: '/1' } },
23
22
  { path: '/:pathMatch(.*)', redirect: { path: '/1' } },
24
- { path: '/presenter/print', component: PresenterPrint },
23
+ { path: '/presenter/print', component: () => import('./internals/PresenterPrint.vue') },
25
24
  {
26
25
  name: 'presenter',
27
26
  path: '/presenter/:no',