@slidev/client 0.42.2 → 0.42.4

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.
@@ -23,12 +23,13 @@ const props = defineProps({
23
23
  ranges: {
24
24
  default: () => [],
25
25
  },
26
- options: {
27
- type: Object,
28
- default: () => ({
29
- startLine: 1,
30
- lines: false,
31
- }),
26
+ startLine: {
27
+ type: Number,
28
+ default: 1,
29
+ },
30
+ lines: {
31
+ type: Boolean,
32
+ default: configs.lineNumbers,
32
33
  },
33
34
  at: {
34
35
  type: Number,
@@ -78,7 +79,7 @@ onMounted(() => {
78
79
  return
79
80
  const isDuoTone = el.value.querySelector('.shiki-dark')
80
81
  const targets = isDuoTone ? Array.from(el.value.querySelectorAll('.shiki')) : [el.value]
81
- const startLine = props.options.startLine ?? 1
82
+ const startLine = props.startLine
82
83
  for (const target of targets) {
83
84
  const lines = Array.from(target.querySelectorAll('.line'))
84
85
  const highlights: number[] = parseRangeString(lines.length + startLine - 1, rangeStr.value)
@@ -110,25 +111,18 @@ function copyCode() {
110
111
  if (code)
111
112
  copy(code)
112
113
  }
113
-
114
- function showLines() {
115
- if (props.options.lines == null)
116
- return configs.lineNumbers ?? false
117
- else
118
- return props.options.lines ?? false
119
- }
120
114
  </script>
121
115
 
122
116
  <template>
123
117
  <div
124
118
  ref="el" class="slidev-code-wrapper relative group"
125
119
  :class="{
126
- 'slidev-code-line-numbers': showLines(),
120
+ 'slidev-code-line-numbers': props.lines,
127
121
  }"
128
122
  :style="{
129
123
  'max-height': props.maxHeight,
130
124
  'overflow-y': props.maxHeight ? 'scroll' : undefined,
131
- '--start': props.options.startLine ?? 1,
125
+ '--start': props.startLine,
132
126
  }"
133
127
  >
134
128
  <slot />
@@ -8,7 +8,7 @@ import { rawRoutes } from '../routes'
8
8
 
9
9
  export function useNav(route: ComputedRef<RouteRecordRaw | RouteLocationNormalizedLoaded>): SlidevContextNav {
10
10
  const path = computed(() => route.value.path)
11
- const total = computed(() => rawRoutes.length - 1)
11
+ const total = computed(() => rawRoutes.length)
12
12
 
13
13
  const currentPage = computed(() => parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
14
14
  const currentPath = computed(() => getPath(currentPage.value))
package/logic/nav.ts CHANGED
@@ -32,7 +32,7 @@ export const presenterPassword = computed(() => route.value.query.password)
32
32
  export const showPresenter = computed(() => !isPresenter.value && (!configs.remote || presenterPassword.value === configs.remote))
33
33
 
34
34
  export const queryClicks = useRouteQuery('clicks', '0')
35
- export const total = computed(() => rawRoutes.length - 1)
35
+ export const total = computed(() => rawRoutes.length)
36
36
  export const path = computed(() => route.value.path)
37
37
 
38
38
  export const currentPage = computed(() => parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
package/logic/overview.ts CHANGED
@@ -3,9 +3,7 @@ import { rawRoutes } from '../routes'
3
3
 
4
4
  // To have same format(.value) as max, wrap it with ref.
5
5
  const min = ref(1)
6
- // The last page is an end page generated by slidev,
7
- // so we need to subtract 1.
8
- const max = computed(() => rawRoutes.length - 1)
6
+ const max = computed(() => rawRoutes.length)
9
7
 
10
8
  export const currentOverviewPage = ref(0)
11
9
  export const overviewRowCount = ref(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.42.2",
3
+ "version": "0.42.4",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -15,8 +15,8 @@
15
15
  "node": ">=14.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@antfu/utils": "^0.7.2",
19
- "@unocss/reset": "^0.52.4",
18
+ "@antfu/utils": "^0.7.4",
19
+ "@unocss/reset": "^0.53.0",
20
20
  "@vueuse/core": "^10.1.2",
21
21
  "@vueuse/head": "^1.1.26",
22
22
  "@vueuse/math": "^10.1.2",
@@ -29,20 +29,20 @@
29
29
  "js-base64": "^3.7.5",
30
30
  "js-yaml": "^4.1.0",
31
31
  "katex": "^0.16.7",
32
- "mermaid": "^10.2.0",
32
+ "mermaid": "^10.2.2",
33
33
  "monaco-editor": "^0.37.1",
34
34
  "nanoid": "^4.0.2",
35
35
  "prettier": "^2.8.8",
36
36
  "recordrtc": "^5.6.2",
37
37
  "resolve": "^1.22.2",
38
- "unocss": "^0.52.4",
38
+ "unocss": "^0.53.0",
39
39
  "vite-plugin-windicss": "^1.9.0",
40
40
  "vue": "^3.3.4",
41
41
  "vue-router": "^4.2.2",
42
42
  "vue-starport": "^0.3.0",
43
43
  "windicss": "^3.5.6",
44
- "@slidev/parser": "0.42.2",
45
- "@slidev/types": "0.42.2"
44
+ "@slidev/parser": "0.42.4",
45
+ "@slidev/types": "0.42.4"
46
46
  },
47
47
  "devDependencies": {
48
48
  "vite": "^4.3.9"
@@ -5,6 +5,10 @@
5
5
  @apply select-text;
6
6
  }
7
7
 
8
+ code {
9
+ @apply font-mono;
10
+ }
11
+
8
12
  h1 {
9
13
  @apply text-4xl mb-4;
10
14
  }