Skip to content

Commit 10eb167

Browse files
committed
feat: new render context none for out side of slides
1 parent 061a29f commit 10eb167

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/client/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ref, shallowRef, toRef } from 'vue'
1+
import { shallowRef, toRef } from 'vue'
22
import { injectLocal, objectOmit, provideLocal } from '@vueuse/core'
33
import { useFixedClicks } from './composables/useClicks'
44
import {
@@ -23,7 +23,7 @@ export function useSlideContext() {
2323
const $clicksContext = injectLocal(injectionClicksContext, clicksContextFallback)!.value
2424
const $clicks = toRef($clicksContext, 'current')
2525
const $page = injectLocal(injectionCurrentPage)!
26-
const $renderContext = injectLocal(injectionRenderContext, ref('slide'))
26+
const $renderContext = injectLocal(injectionRenderContext)!
2727
const $frontmatter = injectLocal(injectionFrontmatter, {})
2828
const $route = injectLocal(injectionRoute, undefined)
2929

packages/client/modules/context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { App } from 'vue'
2-
import { computed, reactive } from 'vue'
2+
import { computed, reactive, ref } from 'vue'
33
import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router'
44
import type { ComputedRef } from '@vue/reactivity'
55
import type { configs } from '../env'
66
import * as nav from '../logic/nav'
77
import { route } from '../logic/nav'
88
import { isDark } from '../logic/dark'
9-
import { injectionCurrentPage, injectionSlidevContext } from '../constants'
9+
import { injectionCurrentPage, injectionRenderContext, injectionSlidevContext } from '../constants'
1010
import { useContext } from '../composables/useContext'
1111

1212
export type SlidevContextNavKey = 'path' | 'total' | 'clicksContext' | 'clicks' | 'clicksTotal' | 'currentPage' | 'currentPath' | 'currentRoute' | 'currentSlideId' | 'currentLayout' | 'nextRoute' | 'rawTree' | 'treeWithActiveStatuses' | 'tree' | 'downloadPDF' | 'next' | 'nextSlide' | 'openInEditor' | 'prev' | 'prevSlide' | 'rawRoutes' | 'go'
@@ -25,6 +25,7 @@ export default function createSlidevContext() {
2525
return {
2626
install(app: App) {
2727
const context = reactive(useContext(route))
28+
app.provide(injectionRenderContext, ref('none'))
2829
app.provide(injectionSlidevContext, context)
2930
app.provide(injectionCurrentPage, computed(() => context.nav.currentPage))
3031

packages/types/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export interface SlidevPreparserExtension {
8989

9090
export type PreparserExtensionLoader = (headmatter?: Record<string, unknown>, filepath?: string) => Promise<SlidevPreparserExtension[]>
9191

92-
export type RenderContext = 'slide' | 'overview' | 'presenter' | 'previewNext'
92+
export type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext'
9393

9494
export type LoadedSnippets = Record<string, string>
9595

0 commit comments

Comments
 (0)