@slidev/client 0.34.2 → 0.34.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.
@@ -27,6 +27,10 @@ const props = defineProps({
27
27
  type: Number,
28
28
  default: undefined,
29
29
  },
30
+ maxHeight: {
31
+ type: String,
32
+ default: undefined,
33
+ },
30
34
  })
31
35
 
32
36
  const clicks = inject(injectionClicks)
@@ -76,6 +80,11 @@ onMounted(() => {
76
80
  line.classList.toggle('highlighted', highlighted)
77
81
  line.classList.toggle('dishonored', !highlighted)
78
82
  })
83
+ if (props.maxHeight) {
84
+ const firstHighlightedEl = target.querySelector('.line.highlighted')
85
+ if (firstHighlightedEl)
86
+ firstHighlightedEl.scrollIntoView({ behavior: 'smooth', block: 'center' })
87
+ }
79
88
  }
80
89
  })
81
90
  })
@@ -90,7 +99,13 @@ function copyCode() {
90
99
  </script>
91
100
 
92
101
  <template>
93
- <div ref="el" class="slidev-code-wrapper relative group">
102
+ <div
103
+ ref="el" class="slidev-code-wrapper relative group"
104
+ :style="{
105
+ 'max-height': props.maxHeight,
106
+ 'overflow-y': props.maxHeight ? 'scroll' : undefined,
107
+ }"
108
+ >
94
109
  <slot />
95
110
  <button
96
111
  v-if="configs.codeCopy"
package/logic/nav.ts CHANGED
@@ -115,6 +115,14 @@ export async function prevSlide(lastClicks = true) {
115
115
  router.replace({ query: { ...route.value.query, clicks: clicksTotal.value } })
116
116
  }
117
117
 
118
+ export function goFirst() {
119
+ return go(1)
120
+ }
121
+
122
+ export function goLast() {
123
+ return go(total.value)
124
+ }
125
+
118
126
  export function go(page: number | string, clicks?: number) {
119
127
  return router.push({ path: getPath(page), query: { ...route.value.query, clicks } })
120
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.34.2",
3
+ "version": "0.34.3",
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.34.2",
20
- "@slidev/types": "0.34.2",
19
+ "@slidev/parser": "0.34.3",
20
+ "@slidev/types": "0.34.3",
21
21
  "@unocss/reset": "^0.42.0",
22
22
  "@vueuse/core": "^8.7.5",
23
23
  "@vueuse/head": "^0.7.6",
@@ -1,7 +1,7 @@
1
1
  /* __imports__ */
2
2
 
3
3
  import type { NavOperations, ShortcutOptions } from '@slidev/types'
4
- import { downloadPDF, go, next, nextSlide, prev, prevSlide } from '../logic/nav'
4
+ import { downloadPDF, go, goFirst, goLast, next, nextSlide, prev, prevSlide } from '../logic/nav'
5
5
  import { toggleDark } from '../logic/dark'
6
6
  import { showGotoDialog, showOverview, toggleOverview } from '../state'
7
7
  import { drawingEnabled } from '../logic/drawings'
@@ -15,6 +15,8 @@ export default function setupShortcuts() {
15
15
  nextSlide,
16
16
  prevSlide,
17
17
  go,
18
+ goFirst,
19
+ goLast,
18
20
  downloadPDF,
19
21
  toggleDark,
20
22
  toggleOverview,
package/styles/code.css CHANGED
@@ -6,8 +6,15 @@ html:not(.dark) .shiki-dark {
6
6
  display: none;
7
7
  }
8
8
 
9
+ ::-webkit-scrollbar {
10
+ width: 0px;
11
+ }
12
+
9
13
  .slidev-code-wrapper {
10
14
  margin: var(--slidev-code-margin) !important;
15
+ &:-webkit-scrollbar {
16
+ width: 0px;
17
+ }
11
18
  }
12
19
 
13
20
  .slidev-code {