@slidev/client 0.48.5 → 0.48.7

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.
@@ -86,6 +86,7 @@ export function useNavBase(
86
86
  clicksContext: ComputedRef<ClicksContext>,
87
87
  queryClicks: Ref<number> = ref(0),
88
88
  isPresenter: Ref<boolean>,
89
+ isPrint: Ref<boolean>,
89
90
  router?: Router,
90
91
  ): SlidevContextNav {
91
92
  const total = computed(() => slides.value.length)
@@ -157,7 +158,9 @@ export function useNavBase(
157
158
  await go(
158
159
  next,
159
160
  lastClicks
160
- ? getSlide(next)?.meta.__clicksContext?.total ?? CLICKS_MAX
161
+ ? isPrint.value
162
+ ? undefined
163
+ : getSlide(next)?.meta.__clicksContext?.total ?? CLICKS_MAX
161
164
  : undefined,
162
165
  )
163
166
  }
@@ -226,6 +229,7 @@ export function useFixedNav(
226
229
  computed(() => clicksContext),
227
230
  ref(CLICKS_MAX),
228
231
  ref(false),
232
+ ref(false),
229
233
  ),
230
234
  next: noop,
231
235
  prev: noop,
@@ -241,13 +245,18 @@ const useNavState = createSharedComposable((): SlidevContextNavState => {
241
245
  const router = useRouter()
242
246
 
243
247
  const currentRoute = computed(() => router.currentRoute.value)
244
- const isPrintMode = computed(() => currentRoute.value.query.print !== undefined)
245
- const isPrintWithClicks = computed(() => currentRoute.value.query.print === 'clicks')
246
- const isEmbedded = computed(() => currentRoute.value.query.embedded !== undefined)
248
+ const query = computed(() => {
249
+ // eslint-disable-next-line no-unused-expressions
250
+ router.currentRoute.value.query
251
+ return new URLSearchParams(location.search)
252
+ })
253
+ const isPrintMode = computed(() => query.value.has('print'))
254
+ const isPrintWithClicks = computed(() => query.value.get('print') === 'clicks')
255
+ const isEmbedded = computed(() => query.value.has('embedded'))
247
256
  const isPlaying = computed(() => currentRoute.value.name === 'play')
248
257
  const isPresenter = computed(() => currentRoute.value.name === 'presenter')
249
258
  const isNotesViewer = computed(() => currentRoute.value.name === 'notes')
250
- const isPresenterAvailable = computed(() => !isPresenter.value && (!configs.remote || currentRoute.value.query.password === configs.remote))
259
+ const isPresenterAvailable = computed(() => !isPresenter.value && (!configs.remote || query.value.get('password') === configs.remote))
251
260
  const hasPrimarySlide = logicOr(isPlaying, isPresenter)
252
261
 
253
262
  const currentSlideNo = computed(() => hasPrimarySlide.value ? getSlide(currentRoute.value.params.no as string)?.no ?? 1 : 1)
@@ -335,6 +344,7 @@ export const useNav = createSharedComposable((): SlidevContextNavFull => {
335
344
  state.clicksContext,
336
345
  state.queryClicks,
337
346
  state.isPresenter,
347
+ state.isPrintMode,
338
348
  router,
339
349
  )
340
350
 
@@ -55,7 +55,7 @@ const SlideComponent = defineAsyncComponent({
55
55
  return defineComponent({
56
56
  setup(_, { attrs }) {
57
57
  onMounted(() => {
58
- props.clicksContext.onMounted()
58
+ props.clicksContext?.onMounted?.()
59
59
  })
60
60
  return () => h(component.default, attrs)
61
61
  },
@@ -70,6 +70,7 @@ const SlideComponent = defineAsyncComponent({
70
70
  <component
71
71
  :is="SlideComponent"
72
72
  :style="style"
73
+ :data-slidev-no="props.route.no"
73
74
  :class="{ 'disable-view-transition': !['slide', 'presenter'].includes(props.renderContext) }"
74
75
  />
75
76
  </template>
@@ -5,6 +5,8 @@ import { useNav } from '../composables/useNav'
5
5
  import { getSlideClass } from '../utils'
6
6
  import { useViewTransition } from '../composables/useViewTransition'
7
7
  import { skipTransition } from '../logic/hmr'
8
+ import { createFixedClicks } from '../composables/useClicks'
9
+ import { CLICKS_MAX } from '../constants'
8
10
  import SlideWrapper from './SlideWrapper.vue'
9
11
  import PresenterMouse from './PresenterMouse.vue'
10
12
 
@@ -22,6 +24,8 @@ const {
22
24
  isPresenter,
23
25
  nextRoute,
24
26
  slides,
27
+ isPrintMode,
28
+ isPrintWithClicks,
25
29
  } = useNav()
26
30
 
27
31
  // preload next route
@@ -68,16 +72,17 @@ function onAfterLeave() {
68
72
  >
69
73
  <SlideWrapper
70
74
  :is="route.component!"
71
- :clicks-context="getPrimaryClicks(route)"
75
+ :clicks-context="isPrintMode && !isPrintWithClicks ? createFixedClicks(route, CLICKS_MAX) : getPrimaryClicks(route)"
72
76
  :class="getSlideClass(route)"
73
77
  :route="route"
74
78
  :render-context="renderContext"
75
79
  class="overflow-hidden"
76
80
  />
77
81
  </div>
78
- <div id="twoslash-container" />
79
82
  </component>
80
83
 
84
+ <div id="twoslash-container" />
85
+
81
86
  <!-- Global Top -->
82
87
  <GlobalTop />
83
88
 
@@ -92,7 +97,7 @@ function onAfterLeave() {
92
97
  height: 100%;
93
98
  }
94
99
 
95
- #slideshow > div:not(#twoslash-container) {
100
+ #slideshow > div {
96
101
  position: absolute;
97
102
  height: 100%;
98
103
  width: 100%;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
3
  "type": "module",
4
- "version": "0.48.5",
4
+ "version": "0.48.7",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -60,8 +60,8 @@
60
60
  "vue": "^3.4.21",
61
61
  "vue-demi": "^0.14.7",
62
62
  "vue-router": "^4.3.0",
63
- "@slidev/parser": "0.48.5",
64
- "@slidev/types": "0.48.5"
63
+ "@slidev/types": "0.48.7",
64
+ "@slidev/parser": "0.48.7"
65
65
  },
66
66
  "devDependencies": {
67
67
  "vite": "^5.1.6"
package/pages/play.vue CHANGED
@@ -63,6 +63,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
63
63
  </template>
64
64
  <template #controls>
65
65
  <div
66
+ v-if="!isPrintMode"
66
67
  class="absolute bottom-0 left-0 transition duration-300 opacity-0 hover:opacity-100"
67
68
  :class="[
68
69
  persistNav ? '!opacity-100 right-0' : 'opacity-0 p-2',
@@ -81,5 +82,5 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
81
82
  <SideEditor :resize="true" />
82
83
  </template>
83
84
  </div>
84
- <Controls />
85
- </template>../composables/drawings
85
+ <Controls v-if="!isPrintMode" />
86
+ </template>