返回 slidev
constants.ts
根目录 / packages / client / constants.ts
1 import type { ClicksContext, RenderContext, SlideRoute } from '@slidev/types'
2 import type { ComputedRef, InjectionKey, Ref, UnwrapNestedRefs } from 'vue'
3 import type { SlidevContext } from './modules/context'
4
5 // Here we use string literal instead of symbols to make HMR more stable
6 // The value of the injections keys are implementation details, you should always use them with the reference to the constant instead of the value
7 export const injectionClicksContext = '$$slidev-clicks-context' as unknown as InjectionKey<Ref<ClicksContext>>
8 export const injectionCurrentPage = '$$slidev-page' as unknown as InjectionKey<Ref<number>>
9 export const injectionSlideElement = '$$slidev-slide-element' as unknown as InjectionKey<Ref<HTMLElement | null>>
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<SlideRoute>
13 export const injectionRenderContext = '$$slidev-render-context' as unknown as InjectionKey<Ref<RenderContext>>
14 export const injectionFrontmatter = '$$slidev-fontmatter' as unknown as InjectionKey<Record<string, any>>
15 export const injectionSlideZoom = '$$slidev-slide-zoom' as unknown as InjectionKey<ComputedRef<number>>
16
17 export const CLASS_VCLICK_TARGET = 'slidev-vclick-target'
18 export const CLASS_VCLICK_HIDDEN = 'slidev-vclick-hidden'
19 export const CLASS_VCLICK_GONE = 'slidev-vclick-gone'
20 export const CLASS_VCLICK_HIDDEN_EXP = 'slidev-vclick-hidden-explicitly'
21 export const CLASS_VCLICK_CURRENT = 'slidev-vclick-current'
22 export const CLASS_VCLICK_PRIOR = 'slidev-vclick-prior'
23 export const CLASS_VCLICK_DISPLAY_NONE = 'slidev-vclick-display-none'
24 export const CLASS_VCLICK_ANIMATION_PREFIX = 'slidev-vclick-anim-'
25
26 export const CLICKS_MAX = 999999
27
28 export const TRUST_ORIGINS = [
29 'localhost',
30 '127.0.0.1',
31 ]
32
33 export const FRONTMATTER_FIELDS = [
34 'clicks',
35 'clicksStart',
36 'disabled',
37 'hide',
38 'hideInToc',
39 'layout',
40 'level',
41 'preload',
42 'routeAlias',
43 'src',
44 'title',
45 'transition',
46 'zoom',
47 'dragPos',
48 'lang',
49 'clickAnimation',
50 ]
51
52 export const HEADMATTER_FIELDS = [
53 ...FRONTMATTER_FIELDS,
54 'theme',
55 'titleTemplate',
56 'info',
57 'author',
58 'keywords',
59 'presenter',
60 'browserExporter',
61 'download',
62 'exportFilename',
63 'export',
64 'highlighter',
65 'lineNumbers',
66 'monaco',
67 'monacoTypesSource',
68 'monacoTypesAdditionalPackages',
69 'monacoRunAdditionalDeps',
70 'monacoRunUseStrict',
71 'remoteAssets',
72 'selectable',
73 'record',
74 'colorSchema',
75 'routerMode',
76 'aspectRatio',
77 'canvasWidth',
78 'themeConfig',
79 'favicon',
80 'plantUmlServer',
81 'fonts',
82 'defaults',
83 'drawings',
84 'htmlAttrs',
85 'mdc',
86 'comark',
87 'contextMenu',
88 'wakeLock',
89 'pwa',
90 'seoMeta',
91 'notesAutoRuby',
92 'magicMoveDuration',
93 'preloadImages',
94 ]
95
95 lines TYPESCRIPT