@slidev/client 0.48.0-beta.5 → 0.48.0-beta.6

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.
package/constants.ts CHANGED
@@ -3,14 +3,16 @@ import type { RouteRecordRaw } from 'vue-router'
3
3
  import type { ClicksContext, RenderContext } from '@slidev/types'
4
4
  import type { SlidevContext } from './modules/context'
5
5
 
6
- export const injectionClicksContext: InjectionKey<Ref<ClicksContext>> = Symbol('slidev-clicks-context')
7
- export const injectionCurrentPage: InjectionKey<Ref<number>> = Symbol('slidev-page')
8
- export const injectionSlideScale: InjectionKey<ComputedRef<number>> = Symbol('slidev-slide-scale')
9
- export const injectionSlidevContext: InjectionKey<UnwrapNestedRefs<SlidevContext>> = Symbol('slidev-slidev-context')
10
- export const injectionRoute: InjectionKey<RouteRecordRaw> = Symbol('slidev-route')
11
- export const injectionRenderContext: InjectionKey<Ref<RenderContext>> = Symbol('slidev-render-context')
12
- export const injectionActive: InjectionKey<Ref<boolean>> = Symbol('slidev-active')
13
- export const injectionFrontmatter: InjectionKey<Record<string, any>> = Symbol('slidev-fontmatter')
6
+ // Here we use string literal instead of symbols to make HMR more stable
7
+ // The value of the injections keys are implementation details, you should always use them with the reference to the constant instead of the value
8
+ export const injectionClicksContext = '$$slidev-clicks-context' as unknown as InjectionKey<Ref<ClicksContext>>
9
+ export const injectionCurrentPage = '$$slidev-page' as unknown as InjectionKey<Ref<number>>
10
+ export const injectionSlideScale = '$$slidev-slide-scale' as unknown as InjectionKey<ComputedRef<number>>
11
+ export const injectionSlidevContext = '$$slidev-context' as unknown as InjectionKey<UnwrapNestedRefs<SlidevContext>>
12
+ export const injectionRoute = '$$slidev-route' as unknown as InjectionKey<RouteRecordRaw>
13
+ export const injectionRenderContext = '$$slidev-render-context' as unknown as InjectionKey<Ref<RenderContext>>
14
+ export const injectionActive = '$$slidev-active' as unknown as InjectionKey<Ref<boolean>>
15
+ export const injectionFrontmatter = '$$slidev-fontmatter' as unknown as InjectionKey<Record<string, any>>
14
16
 
15
17
  export const CLASS_VCLICK_TARGET = 'slidev-vclick-target'
16
18
  export const CLASS_VCLICK_HIDDEN = 'slidev-vclick-hidden'
@@ -102,6 +102,11 @@ onMounted(async () => {
102
102
  noteEditor.refresh()
103
103
  })
104
104
  })
105
+
106
+ watch(currentSlideId, () => {
107
+ contentEditor.clearHistory()
108
+ noteEditor.clearHistory()
109
+ }, { flush: 'post' })
105
110
  })
106
111
 
107
112
  const handlerDown = ref(false)
package/logic/note.ts CHANGED
@@ -2,11 +2,11 @@ import type { MaybeRef } from '@vueuse/core'
2
2
  import { useFetch } from '@vueuse/core'
3
3
  import type { Ref } from 'vue'
4
4
  import { computed, ref, unref } from 'vue'
5
- import type { SlideInfo } from '@slidev/types'
5
+ import type { SlideInfo, SlidePatch } from '@slidev/types'
6
6
 
7
7
  export interface UseSlideInfo {
8
8
  info: Ref<SlideInfo | undefined>
9
- update: (data: Partial<SlideInfo>) => Promise<SlideInfo | void>
9
+ update: (data: SlidePatch) => Promise<SlideInfo | void>
10
10
  }
11
11
 
12
12
  export function useSlideInfo(id: number | undefined): UseSlideInfo {
@@ -21,7 +21,7 @@ export function useSlideInfo(id: number | undefined): UseSlideInfo {
21
21
 
22
22
  execute()
23
23
 
24
- const update = async (data: Partial<SlideInfo>) => {
24
+ const update = async (data: SlidePatch) => {
25
25
  return await fetch(
26
26
  url,
27
27
  {
@@ -64,7 +64,7 @@ export function useDynamicSlideInfo(id: MaybeRef<number | undefined>) {
64
64
 
65
65
  return {
66
66
  info: computed(() => get(unref(id)).info.value),
67
- update: async (data: Partial<SlideInfo>, newId?: number) => {
67
+ update: async (data: SlidePatch, newId?: number) => {
68
68
  const info = get(newId ?? unref(id))
69
69
  const newData = await info.update(data)
70
70
  if (newData)
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.5",
4
+ "version": "0.48.0-beta.6",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -53,8 +53,8 @@
53
53
  "unocss": "^0.58.5",
54
54
  "vue": "^3.4.19",
55
55
  "vue-router": "^4.2.5",
56
- "@slidev/parser": "0.48.0-beta.5",
57
- "@slidev/types": "0.48.0-beta.5"
56
+ "@slidev/parser": "0.48.0-beta.6",
57
+ "@slidev/types": "0.48.0-beta.6"
58
58
  },
59
59
  "devDependencies": {
60
60
  "vite": "^5.1.3"