@slidev/client 0.32.3 → 0.32.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.
@@ -74,11 +74,9 @@ onMounted(() => {
74
74
  'allow-top-navigation-by-user-activation',
75
75
  ].join(' '))
76
76
 
77
- /* eslint-disable no-undef */
78
77
  frame.src = __DEV__
79
78
  ? `${location.origin}${__SLIDEV_CLIENT_ROOT__}/iframes/monaco/index.html`
80
79
  : `${import.meta.env.BASE_URL}iframes/monaco/index.html`
81
- /* eslint-enable no-undef */
82
80
 
83
81
  frame.style.backgroundColor = 'transparent'
84
82
 
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import { computed, inject } from 'vue'
3
+ import type { RenderContext } from '@slidev/types'
4
+
5
+ import { injectionSlideContext } from '../constants'
6
+
7
+ type Context = 'main' | RenderContext
8
+
9
+ const props = defineProps<{
10
+ context: Context | Context[]
11
+ }>()
12
+ const { context } = props
13
+
14
+ const currentContext = inject(injectionSlideContext)
15
+
16
+ const shouldRender = computed(() => Array.isArray(context) ? context.some(contextMatch) : contextMatch(context))
17
+
18
+ function contextMatch(context: Context) {
19
+ if (context === currentContext)
20
+ return true
21
+ if (context === 'main' && (currentContext === 'slide' || currentContext === 'presenter'))
22
+ return true
23
+ return false
24
+ }
25
+ </script>
26
+
27
+ <template>
28
+ <slot v-if="shouldRender" />
29
+ </template>
package/constants.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ComputedRef, InjectionKey, Ref } from 'vue'
2
2
  import type { RouteRecordRaw } from 'vue-router'
3
+ import type { RenderContext } from '@slidev/types'
3
4
  import type { SlidevContext } from './modules/context'
4
5
 
5
6
  export const injectionClicks: InjectionKey<Ref<number>> = Symbol('v-click-clicks')
@@ -9,6 +10,7 @@ export const injectionClicksDisabled: InjectionKey<Ref<boolean>> = Symbol('v-cli
9
10
  export const injectionSlideScale: InjectionKey<ComputedRef<number>> = Symbol('slidev-slide-scale')
10
11
  export const injectionSlidevContext: InjectionKey<SlidevContext> = Symbol('slidev-slidev-context')
11
12
  export const injectionRoute: InjectionKey<RouteRecordRaw> = Symbol('slidev-route')
13
+ export const injectionSlideContext: InjectionKey<RenderContext> = Symbol('slidev-slide-context')
12
14
 
13
15
  export const CLASS_VCLICK_TARGET = 'slidev-vclick-target'
14
16
  export const CLASS_VCLICK_HIDDEN = 'slidev-vclick-hidden'
@@ -48,8 +48,8 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
48
48
  :scale="slideScale"
49
49
  @pointerdown="onClick"
50
50
  >
51
- <template #>
52
- <SlidesShow />
51
+ <template #default>
52
+ <SlidesShow context="slide" />
53
53
  </template>
54
54
  <template #controls>
55
55
  <div
@@ -52,7 +52,7 @@ const nextSlide = computed(() => {
52
52
  }
53
53
  })
54
54
 
55
- // sync presenter cusor
55
+ // sync presenter cursor
56
56
  onMounted(() => {
57
57
  const slidesContainer = main.value!.querySelector('#slide-content')!
58
58
  const mouse = reactive(useMouse())
@@ -102,8 +102,8 @@ onMounted(() => {
102
102
  key="main"
103
103
  class="h-full w-full"
104
104
  >
105
- <template #>
106
- <SlidesShow />
105
+ <template #default>
106
+ <SlidesShow context="presenter" />
107
107
  </template>
108
108
  </SlideContainer>
109
109
  </div>
@@ -120,6 +120,7 @@ onMounted(() => {
120
120
  :clicks-disabled="false"
121
121
  :class="getSlideClass(nextSlide.route)"
122
122
  :route="nextSlide.route"
123
+ context="previewNext"
123
124
  />
124
125
  </SlideContainer>
125
126
  </div>
@@ -1,6 +1,6 @@
1
1
  import { useVModel } from '@vueuse/core'
2
2
  import { defineComponent, h, provide } from 'vue'
3
- import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute } from '../constants'
3
+ import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute, injectionSlideContext } from '../constants'
4
4
 
5
5
  export default defineComponent({
6
6
  props: {
@@ -20,6 +20,10 @@ export default defineComponent({
20
20
  type: Boolean,
21
21
  default: false,
22
22
  },
23
+ context: {
24
+ type: String,
25
+ default: 'main',
26
+ },
23
27
  is: {
24
28
  type: Object,
25
29
  default: undefined,
@@ -38,6 +42,7 @@ export default defineComponent({
38
42
  clicksElements.value.length = 0
39
43
 
40
44
  provide(injectionRoute, props.route)
45
+ provide(injectionSlideContext, props.context)
41
46
  provide(injectionClicks, clicks)
42
47
  provide(injectionClicksDisabled, clicksDisabled)
43
48
  provide(injectionClicksElements, clicksElements)
@@ -85,6 +85,7 @@ watchEffect(() => {
85
85
  :clicks-disabled="true"
86
86
  :class="getSlideClass(route)"
87
87
  :route="route"
88
+ context="overview"
88
89
  />
89
90
  <DrawingPreview :page="+route.path" />
90
91
  </SlideContainer>
@@ -9,6 +9,8 @@ import GlobalTop from '/@slidev/global-components/top'
9
9
  import GlobalBottom from '/@slidev/global-components/bottom'
10
10
  import PresenterMouse from './PresenterMouse.vue'
11
11
 
12
+ defineProps<{ context: 'slide' | 'presenter' }>()
13
+
12
14
  // preload next route
13
15
  watch(currentRoute, () => {
14
16
  if (currentRoute.value?.meta && currentRoute.value.meta.preload !== false)
@@ -37,6 +39,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
37
39
  :clicks-disabled="false"
38
40
  :class="getSlideClass(route)"
39
41
  :route="route"
42
+ :context="context"
40
43
  />
41
44
  </template>
42
45
 
package/package.json CHANGED
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.32.3",
3
+ "version": "0.32.4",
4
4
  "description": "Presentation slides for developers",
5
- "homepage": "https://sli.dev",
6
- "bugs": "https://github.com/slidevjs/slidev/issues",
7
- "license": "MIT",
8
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
+ "license": "MIT",
7
+ "funding": "https://github.com/sponsors/antfu",
8
+ "homepage": "https://sli.dev",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/slidevjs/slidev"
12
12
  },
13
- "funding": "https://github.com/sponsors/antfu",
13
+ "bugs": "https://github.com/slidevjs/slidev/issues",
14
+ "engines": {
15
+ "node": ">=14.0.0"
16
+ },
14
17
  "dependencies": {
15
18
  "@antfu/utils": "^0.5.2",
16
- "@slidev/parser": "0.32.3",
17
- "@slidev/types": "0.32.3",
18
- "@vueuse/core": "^8.5.0",
19
+ "@slidev/parser": "0.32.4",
20
+ "@slidev/types": "0.32.4",
21
+ "@vueuse/core": "^8.6.0",
19
22
  "@vueuse/head": "^0.7.6",
20
23
  "@vueuse/motion": "^2.0.0-beta.18",
21
- "codemirror": "^5.65.4",
24
+ "codemirror": "^5.65.5",
22
25
  "defu": "^6.0.0",
23
26
  "drauu": "^0.3.0",
24
27
  "file-saver": "^2.0.5",
@@ -32,12 +35,9 @@
32
35
  "recordrtc": "^5.6.2",
33
36
  "resolve": "^1.22.0",
34
37
  "vite-plugin-windicss": "^1.8.4",
35
- "vue": "^3.2.35",
38
+ "vue": "^3.2.36",
36
39
  "vue-router": "^4.0.15",
37
- "vue-starport": "^0.2.10",
40
+ "vue-starport": "^0.2.11",
38
41
  "windicss": "^3.5.4"
39
- },
40
- "engines": {
41
- "node": ">=14.0.0"
42
42
  }
43
43
  }
package/shim.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /* eslint-disable import/no-duplicates */
2
-
3
1
  declare interface Window {
4
2
  // extend the window
5
3
  }