@slidev/client 0.48.0-beta.19 → 0.48.0-beta.20

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.
@@ -41,7 +41,7 @@ onMounted(() => {
41
41
  <template>
42
42
  <div class="slidev-code-wrapper slidev-code-magic-move">
43
43
  <ShikiMagicMovePrecompiled
44
- class="slidev-code relative shiki"
44
+ class="slidev-code relative shiki overflow-visible"
45
45
  :steps="steps"
46
46
  :step="index"
47
47
  :options="{ globalScale: scale }"
@@ -66,7 +66,7 @@ function useClicksContextBase(current: Ref<number>, clicksOverrides?: number): C
66
66
  export function usePrimaryClicks(route: RouteRecordRaw | undefined): ClicksContext {
67
67
  if (route?.meta?.__clicksContext)
68
68
  return route.meta.__clicksContext
69
- const thisPath = +(route?.path ?? CLICKS_MAX)
69
+ const thisPath = +(route?.path ?? Number.NaN)
70
70
  const current = computed({
71
71
  get() {
72
72
  const currentPath = +(currentRoute.value?.path ?? Number.NaN)
@@ -81,8 +81,10 @@ export function usePrimaryClicks(route: RouteRecordRaw | undefined): ClicksConte
81
81
  },
82
82
  set(v) {
83
83
  const currentPath = +(currentRoute.value?.path ?? Number.NaN)
84
- if (currentPath === thisPath)
85
- queryClicks.value = v
84
+ if (currentPath === thisPath) {
85
+ // eslint-disable-next-line ts/no-use-before-define
86
+ queryClicks.value = Math.min(v, context.total)
87
+ }
86
88
  },
87
89
  })
88
90
  const context = useClicksContextBase(
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { ClicksContext } from '@slidev/types'
3
3
  import { computed } from 'vue'
4
- import { CLICKS_MAX } from '../constants'
5
4
 
6
5
  const props = defineProps<{
7
6
  clicksContext: ClicksContext
@@ -34,15 +33,13 @@ function onMousedown() {
34
33
  >
35
34
  <div class="flex gap-1 items-center min-w-16">
36
35
  <carbon:cursor-1 text-sm op50 />
37
- <template v-if="current <= total && current >= 0">
38
- <span text-primary>{{ current }}</span>
39
- <span op50>/</span>
40
- </template>
36
+ <span text-primary>{{ current }}</span>
37
+ <span op50>/</span>
41
38
  <span op50>{{ total }}</span>
42
39
  </div>
43
40
  <div
44
41
  relative flex-auto h5 flex="~"
45
- @dblclick="current = CLICKS_MAX"
42
+ @dblclick="current = clicksContext.total"
46
43
  >
47
44
  <div
48
45
  v-for="i of range" :key="i"
@@ -71,6 +68,7 @@ function onMousedown() {
71
68
  type="range" :min="0" :max="total" :step="1" z-10 op0
72
69
  :style="{ '--thumb-width': `${1 / (total + 1) * 100}%` }"
73
70
  @mousedown="onMousedown"
71
+ @focus="event => (event.currentTarget as HTMLElement)?.blur()"
74
72
  >
75
73
  </div>
76
74
  </div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
3
  "type": "module",
4
- "version": "0.48.0-beta.19",
4
+ "version": "0.48.0-beta.20",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -56,8 +56,8 @@
56
56
  "unocss": "^0.58.5",
57
57
  "vue": "^3.4.20",
58
58
  "vue-router": "^4.3.0",
59
- "@slidev/types": "0.48.0-beta.19",
60
- "@slidev/parser": "0.48.0-beta.19"
59
+ "@slidev/types": "0.48.0-beta.20",
60
+ "@slidev/parser": "0.48.0-beta.20"
61
61
  },
62
62
  "devDependencies": {
63
63
  "vite": "^5.1.4"
package/setup/monaco.ts CHANGED
@@ -125,4 +125,10 @@ const setup = createSingletonPromise(async () => {
125
125
  }
126
126
  })
127
127
 
128
+ export async function addFile(raw: Promise<{ default: string }>, path: string) {
129
+ const code = (await raw).default
130
+ monaco.languages.typescript.typescriptDefaults.addExtraLib(code, `file:///${path}`)
131
+ monaco.editor.createModel(code, 'javascript', monaco.Uri.file(path))
132
+ }
133
+
128
134
  export default setup