themekit-js 1.1.0
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/LICENSE +21 -0
- package/README.md +27 -0
- package/bin/themekit.js +2 -0
- package/client.d.ts +5 -0
- package/dist/client/app/components/ClientOnly.js +10 -0
- package/dist/client/app/components/Content.js +23 -0
- package/dist/client/app/composables/codeGroups.js +40 -0
- package/dist/client/app/composables/copyCode.js +73 -0
- package/dist/client/app/composables/head.js +81 -0
- package/dist/client/app/composables/preFetch.js +99 -0
- package/dist/client/app/data.js +59 -0
- package/dist/client/app/devtools.js +29 -0
- package/dist/client/app/index.js +140 -0
- package/dist/client/app/router.js +233 -0
- package/dist/client/app/ssr.js +10 -0
- package/dist/client/app/theme.js +1 -0
- package/dist/client/app/utils.js +119 -0
- package/dist/client/index.d.ts +1446 -0
- package/dist/client/index.js +9 -0
- package/dist/client/shared.js +139 -0
- package/dist/client/theme-default/Layout.vue +94 -0
- package/dist/client/theme-default/NotFound.vue +109 -0
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +99 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +41 -0
- package/dist/client/theme-default/components/VPBadge.vue +86 -0
- package/dist/client/theme-default/components/VPButton.vue +123 -0
- package/dist/client/theme-default/components/VPCarbonAds.vue +109 -0
- package/dist/client/theme-default/components/VPContent.vue +98 -0
- package/dist/client/theme-default/components/VPDoc.vue +193 -0
- package/dist/client/theme-default/components/VPDocAside.vue +46 -0
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +18 -0
- package/dist/client/theme-default/components/VPDocAsideOutline.vue +87 -0
- package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +145 -0
- package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +50 -0
- package/dist/client/theme-default/components/VPDocOutlineItem.vue +59 -0
- package/dist/client/theme-default/components/VPFeature.vue +123 -0
- package/dist/client/theme-default/components/VPFeatures.vue +121 -0
- package/dist/client/theme-default/components/VPFlyout.vue +136 -0
- package/dist/client/theme-default/components/VPFooter.vue +60 -0
- package/dist/client/theme-default/components/VPHero.vue +336 -0
- package/dist/client/theme-default/components/VPHome.vue +43 -0
- package/dist/client/theme-default/components/VPHomeContent.vue +52 -0
- package/dist/client/theme-default/components/VPHomeFeatures.vue +14 -0
- package/dist/client/theme-default/components/VPHomeHero.vue +24 -0
- package/dist/client/theme-default/components/VPHomeSponsors.vue +116 -0
- package/dist/client/theme-default/components/VPImage.vue +46 -0
- package/dist/client/theme-default/components/VPLink.vue +33 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +171 -0
- package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +190 -0
- package/dist/client/theme-default/components/VPLocalSearchBox.vue +856 -0
- package/dist/client/theme-default/components/VPMenu.vue +72 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +47 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +54 -0
- package/dist/client/theme-default/components/VPNav.vue +57 -0
- package/dist/client/theme-default/components/VPNavBar.vue +267 -0
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +94 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
- package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +42 -0
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +53 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +194 -0
- package/dist/client/theme-default/components/VPNavBarSearchButton.vue +208 -0
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +76 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +47 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +99 -0
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +23 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +111 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +39 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +34 -0
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +39 -0
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
- package/dist/client/theme-default/components/VPPage.vue +7 -0
- package/dist/client/theme-default/components/VPSidebar.vue +137 -0
- package/dist/client/theme-default/components/VPSidebarItem.vue +250 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +68 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +50 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPSponsors.vue +48 -0
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +48 -0
- package/dist/client/theme-default/components/VPSwitch.vue +63 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +52 -0
- package/dist/client/theme-default/components/VPTeamMembers.vue +66 -0
- package/dist/client/theme-default/components/VPTeamMembersItem.vue +225 -0
- package/dist/client/theme-default/components/VPTeamPage.vue +58 -0
- package/dist/client/theme-default/components/VPTeamPageSection.vue +77 -0
- package/dist/client/theme-default/components/VPTeamPageTitle.vue +63 -0
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
- package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
- package/dist/client/theme-default/composables/aside.js +17 -0
- package/dist/client/theme-default/composables/data.js +2 -0
- package/dist/client/theme-default/composables/edit-link.js +16 -0
- package/dist/client/theme-default/composables/flyout.js +41 -0
- package/dist/client/theme-default/composables/langs.js +26 -0
- package/dist/client/theme-default/composables/local-nav.js +18 -0
- package/dist/client/theme-default/composables/nav.js +30 -0
- package/dist/client/theme-default/composables/outline.js +178 -0
- package/dist/client/theme-default/composables/prev-next.js +57 -0
- package/dist/client/theme-default/composables/sidebar.js +136 -0
- package/dist/client/theme-default/composables/sponsor-grid.js +94 -0
- package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.js +3 -0
- package/dist/client/theme-default/styles/base.css +252 -0
- package/dist/client/theme-default/styles/components/custom-block.css +208 -0
- package/dist/client/theme-default/styles/components/vp-code-group.css +85 -0
- package/dist/client/theme-default/styles/components/vp-code.css +7 -0
- package/dist/client/theme-default/styles/components/vp-doc.css +570 -0
- package/dist/client/theme-default/styles/components/vp-sponsor.css +155 -0
- package/dist/client/theme-default/styles/fonts.css +157 -0
- package/dist/client/theme-default/styles/icons.css +123 -0
- package/dist/client/theme-default/styles/utils.css +9 -0
- package/dist/client/theme-default/styles/vars.css +563 -0
- package/dist/client/theme-default/support/lru.js +33 -0
- package/dist/client/theme-default/support/sidebar.js +89 -0
- package/dist/client/theme-default/support/translation.js +49 -0
- package/dist/client/theme-default/support/utils.js +33 -0
- package/dist/client/theme-default/without-fonts.js +32 -0
- package/dist/node/cli.js +444 -0
- package/dist/node/index.d.ts +4588 -0
- package/dist/node/index.js +198 -0
- package/dist/node/serve-BjvG349_.js +50301 -0
- package/lib/vue-demi.mjs +34 -0
- package/package.json +223 -0
- package/template/.vitepress/config.js +28 -0
- package/template/.vitepress/theme/Layout.vue +21 -0
- package/template/.vitepress/theme/index.js +29 -0
- package/template/.vitepress/theme/style.css +143 -0
- package/template/api-examples.md +49 -0
- package/template/index.md +28 -0
- package/template/markdown-examples.md +85 -0
- package/theme-without-fonts.d.ts +2 -0
- package/theme.d.ts +30 -0
- package/types/default-theme.d.ts +533 -0
- package/types/docsearch.d.ts +144 -0
- package/types/index.d.ts +3 -0
- package/types/local-search.d.ts +33 -0
- package/types/shared.d.ts +199 -0
|
@@ -0,0 +1,1446 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { Component as Component$1, InjectionKey as InjectionKey$1, Ref as Ref$1, App as App$1, AsyncComponentLoader } from 'vue';
|
|
3
|
+
import { UseDarkOptions } from '@vueuse/core';
|
|
4
|
+
|
|
5
|
+
type Prettify<T> = {
|
|
6
|
+
[K in keyof T]: T[K];
|
|
7
|
+
} & {};
|
|
8
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
9
|
+
type LooseRequired<T> = {
|
|
10
|
+
[P in keyof (T & Required<T>)]: T[P];
|
|
11
|
+
};
|
|
12
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
13
|
+
type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
|
14
|
+
then(onfulfilled: infer F, ...args: infer _): any;
|
|
15
|
+
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
|
|
16
|
+
|
|
17
|
+
declare enum TrackOpTypes {
|
|
18
|
+
GET = "get",
|
|
19
|
+
HAS = "has",
|
|
20
|
+
ITERATE = "iterate"
|
|
21
|
+
}
|
|
22
|
+
declare enum TriggerOpTypes {
|
|
23
|
+
SET = "set",
|
|
24
|
+
ADD = "add",
|
|
25
|
+
DELETE = "delete",
|
|
26
|
+
CLEAR = "clear"
|
|
27
|
+
}
|
|
28
|
+
declare enum ReactiveFlags {
|
|
29
|
+
SKIP = "__v_skip",
|
|
30
|
+
IS_REACTIVE = "__v_isReactive",
|
|
31
|
+
IS_READONLY = "__v_isReadonly",
|
|
32
|
+
IS_SHALLOW = "__v_isShallow",
|
|
33
|
+
RAW = "__v_raw"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type Dep = Map<ReactiveEffect, number> & {
|
|
37
|
+
cleanup: () => void;
|
|
38
|
+
computed?: ComputedRefImpl<any>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare class EffectScope {
|
|
42
|
+
detached: boolean;
|
|
43
|
+
constructor(detached?: boolean);
|
|
44
|
+
get active(): boolean;
|
|
45
|
+
run<T>(fn: () => T): T | undefined;
|
|
46
|
+
stop(fromParent?: boolean): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type EffectScheduler = (...args: any[]) => any;
|
|
50
|
+
type DebuggerEvent = {
|
|
51
|
+
effect: ReactiveEffect;
|
|
52
|
+
} & DebuggerEventExtraInfo;
|
|
53
|
+
type DebuggerEventExtraInfo = {
|
|
54
|
+
target: object;
|
|
55
|
+
type: TrackOpTypes | TriggerOpTypes;
|
|
56
|
+
key: any;
|
|
57
|
+
newValue?: any;
|
|
58
|
+
oldValue?: any;
|
|
59
|
+
oldTarget?: Map<any, any> | Set<any>;
|
|
60
|
+
};
|
|
61
|
+
declare class ReactiveEffect<T = any> {
|
|
62
|
+
fn: () => T;
|
|
63
|
+
trigger: () => void;
|
|
64
|
+
scheduler?: EffectScheduler | undefined;
|
|
65
|
+
active: boolean;
|
|
66
|
+
deps: Dep[];
|
|
67
|
+
onStop?: () => void;
|
|
68
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
69
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
70
|
+
constructor(fn: () => T, trigger: () => void, scheduler?: EffectScheduler | undefined, scope?: EffectScope);
|
|
71
|
+
get dirty(): boolean;
|
|
72
|
+
set dirty(v: boolean);
|
|
73
|
+
run(): T;
|
|
74
|
+
stop(): void;
|
|
75
|
+
}
|
|
76
|
+
interface DebuggerOptions {
|
|
77
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
78
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
79
|
+
}
|
|
80
|
+
type ComputedGetter<T> = (oldValue?: T) => T;
|
|
81
|
+
type ComputedSetter<T> = (newValue: T) => void;
|
|
82
|
+
interface WritableComputedOptions<T> {
|
|
83
|
+
get: ComputedGetter<T>;
|
|
84
|
+
set: ComputedSetter<T>;
|
|
85
|
+
}
|
|
86
|
+
declare class ComputedRefImpl<T> {
|
|
87
|
+
private getter;
|
|
88
|
+
private readonly _setter;
|
|
89
|
+
dep?: Dep;
|
|
90
|
+
private _value;
|
|
91
|
+
readonly effect: ReactiveEffect<T>;
|
|
92
|
+
readonly __v_isRef = true;
|
|
93
|
+
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
|
94
|
+
_cacheable: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Dev only
|
|
97
|
+
*/
|
|
98
|
+
_warnRecursive?: boolean;
|
|
99
|
+
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
|
100
|
+
get value(): T;
|
|
101
|
+
set value(newValue: T);
|
|
102
|
+
get _dirty(): boolean;
|
|
103
|
+
set _dirty(v: boolean);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
|
107
|
+
declare const ShallowReactiveMarker: unique symbol;
|
|
108
|
+
|
|
109
|
+
declare const RefSymbol: unique symbol;
|
|
110
|
+
declare const RawSymbol: unique symbol;
|
|
111
|
+
interface Ref<T = any> {
|
|
112
|
+
value: T;
|
|
113
|
+
/**
|
|
114
|
+
* Type differentiator only.
|
|
115
|
+
* We need this to be in public d.ts but don't want it to show up in IDE
|
|
116
|
+
* autocomplete, so we use a private Symbol instead.
|
|
117
|
+
*/
|
|
118
|
+
[RefSymbol]: true;
|
|
119
|
+
}
|
|
120
|
+
declare const ShallowRefMarker: unique symbol;
|
|
121
|
+
type ShallowRef<T = any> = Ref<T> & {
|
|
122
|
+
[ShallowRefMarker]?: true;
|
|
123
|
+
};
|
|
124
|
+
type BaseTypes = string | number | boolean;
|
|
125
|
+
/**
|
|
126
|
+
* This is a special exported interface for other packages to declare
|
|
127
|
+
* additional types that should bail out for ref unwrapping. For example
|
|
128
|
+
* \@vue/runtime-dom can declare it like so in its d.ts:
|
|
129
|
+
*
|
|
130
|
+
* ``` ts
|
|
131
|
+
* declare module '@vue/reactivity' {
|
|
132
|
+
* export interface RefUnwrapBailTypes {
|
|
133
|
+
* runtimeDOMBailTypes: Node | Window
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
interface RefUnwrapBailTypes {
|
|
139
|
+
}
|
|
140
|
+
type ShallowUnwrapRef<T> = {
|
|
141
|
+
[K in keyof T]: DistrubuteRef<T[K]>;
|
|
142
|
+
};
|
|
143
|
+
type DistrubuteRef<T> = T extends Ref<infer V> ? V : T;
|
|
144
|
+
type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
145
|
+
type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
146
|
+
[RawSymbol]?: true;
|
|
147
|
+
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
|
|
148
|
+
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
|
149
|
+
} : T extends object & {
|
|
150
|
+
[ShallowReactiveMarker]?: never;
|
|
151
|
+
} ? {
|
|
152
|
+
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
|
153
|
+
} : T;
|
|
154
|
+
|
|
155
|
+
type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
|
|
156
|
+
type InternalSlots = {
|
|
157
|
+
[name: string]: Slot | undefined;
|
|
158
|
+
};
|
|
159
|
+
type Slots = Readonly<InternalSlots>;
|
|
160
|
+
declare const SlotSymbol: unique symbol;
|
|
161
|
+
type SlotsType<T extends Record<string, any> = Record<string, any>> = {
|
|
162
|
+
[SlotSymbol]?: T;
|
|
163
|
+
};
|
|
164
|
+
type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
|
|
165
|
+
type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
|
|
166
|
+
[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
|
|
167
|
+
}>>;
|
|
168
|
+
type RawSlots = {
|
|
169
|
+
[name: string]: unknown;
|
|
170
|
+
$stable?: boolean;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
interface SchedulerJob extends Function {
|
|
174
|
+
id?: number;
|
|
175
|
+
pre?: boolean;
|
|
176
|
+
active?: boolean;
|
|
177
|
+
computed?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Indicates whether the effect is allowed to recursively trigger itself
|
|
180
|
+
* when managed by the scheduler.
|
|
181
|
+
*
|
|
182
|
+
* By default, a job cannot trigger itself because some built-in method calls,
|
|
183
|
+
* e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
184
|
+
* can lead to confusing infinite loops.
|
|
185
|
+
* The allowed cases are component update functions and watch callbacks.
|
|
186
|
+
* Component update functions may update child component props, which in turn
|
|
187
|
+
* trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
188
|
+
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
189
|
+
* triggers itself again, it's likely intentional and it is the user's
|
|
190
|
+
* responsibility to perform recursive state mutation that eventually
|
|
191
|
+
* stabilizes (#1727).
|
|
192
|
+
*/
|
|
193
|
+
allowRecurse?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Attached by renderer.ts when setting up a component's render effect
|
|
196
|
+
* Used to obtain component information when reporting max recursive updates.
|
|
197
|
+
* dev only.
|
|
198
|
+
*/
|
|
199
|
+
ownerInstance?: ComponentInternalInstance;
|
|
200
|
+
}
|
|
201
|
+
declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
202
|
+
|
|
203
|
+
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
204
|
+
type EmitsOptions = ObjectEmitsOptions | string[];
|
|
205
|
+
type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
|
|
206
|
+
[K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
|
|
207
|
+
} : T extends ObjectEmitsOptions ? {
|
|
208
|
+
[K in `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : T[Uncapitalize<C>] extends null ? any[] : never) => any : never;
|
|
209
|
+
} : {};
|
|
210
|
+
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
211
|
+
[K in keyof E]: (...args: E[K]) => any;
|
|
212
|
+
} : E;
|
|
213
|
+
type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
|
|
214
|
+
[key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void;
|
|
215
|
+
}[Event]>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* Here is an example of adding a property `$router` to every component instance:
|
|
222
|
+
* ```ts
|
|
223
|
+
* import { createApp } from 'vue'
|
|
224
|
+
* import { Router, createRouter } from 'vue-router'
|
|
225
|
+
*
|
|
226
|
+
* declare module '@vue/runtime-core' {
|
|
227
|
+
* interface ComponentCustomProperties {
|
|
228
|
+
* $router: Router
|
|
229
|
+
* }
|
|
230
|
+
* }
|
|
231
|
+
*
|
|
232
|
+
* // effectively adding the router to every component instance
|
|
233
|
+
* const app = createApp({})
|
|
234
|
+
* const router = createRouter()
|
|
235
|
+
* app.config.globalProperties.$router = router
|
|
236
|
+
*
|
|
237
|
+
* const vm = app.mount('#app')
|
|
238
|
+
* // we can access the router from the instance
|
|
239
|
+
* vm.$router.push('/')
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
interface ComponentCustomProperties {
|
|
243
|
+
}
|
|
244
|
+
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
|
|
245
|
+
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never;
|
|
246
|
+
type ExtractMixin<T> = {
|
|
247
|
+
Mixin: MixinToOptionTypes<T>;
|
|
248
|
+
}[T extends ComponentOptionsMixin ? 'Mixin' : never];
|
|
249
|
+
type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
|
|
250
|
+
type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
|
|
251
|
+
type EnsureNonVoid<T> = T extends void ? {} : T;
|
|
252
|
+
type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
|
|
253
|
+
__isFragment?: never;
|
|
254
|
+
__isTeleport?: never;
|
|
255
|
+
__isSuspense?: never;
|
|
256
|
+
new (...args: any[]): T;
|
|
257
|
+
};
|
|
258
|
+
type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S>, I, S>;
|
|
259
|
+
type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
260
|
+
B = {}, // raw bindings returned from setup()
|
|
261
|
+
D = {}, // return from data()
|
|
262
|
+
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}> = {
|
|
263
|
+
$: ComponentInternalInstance;
|
|
264
|
+
$data: D;
|
|
265
|
+
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
266
|
+
$attrs: Data;
|
|
267
|
+
$refs: Data;
|
|
268
|
+
$slots: UnwrapSlotsType<S>;
|
|
269
|
+
$root: ComponentPublicInstance | null;
|
|
270
|
+
$parent: ComponentPublicInstance | null;
|
|
271
|
+
$emit: EmitFn<E>;
|
|
272
|
+
$el: any;
|
|
273
|
+
$options: Options & MergedComponentOptionsOverride;
|
|
274
|
+
$forceUpdate: () => void;
|
|
275
|
+
$nextTick: typeof nextTick;
|
|
276
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
|
|
277
|
+
} & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
|
|
278
|
+
|
|
279
|
+
interface SuspenseProps {
|
|
280
|
+
onResolve?: () => void;
|
|
281
|
+
onPending?: () => void;
|
|
282
|
+
onFallback?: () => void;
|
|
283
|
+
timeout?: string | number;
|
|
284
|
+
/**
|
|
285
|
+
* Allow suspense to be captured by parent suspense
|
|
286
|
+
*
|
|
287
|
+
* @default false
|
|
288
|
+
*/
|
|
289
|
+
suspensible?: boolean;
|
|
290
|
+
}
|
|
291
|
+
declare const SuspenseImpl: {
|
|
292
|
+
name: string;
|
|
293
|
+
__isSuspense: boolean;
|
|
294
|
+
process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
|
|
295
|
+
hydrate: typeof hydrateSuspense;
|
|
296
|
+
create: typeof createSuspenseBoundary;
|
|
297
|
+
normalize: typeof normalizeSuspenseChildren;
|
|
298
|
+
};
|
|
299
|
+
declare const Suspense: {
|
|
300
|
+
new (): {
|
|
301
|
+
$props: VNodeProps & SuspenseProps;
|
|
302
|
+
$slots: {
|
|
303
|
+
default(): VNode[];
|
|
304
|
+
fallback(): VNode[];
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
__isSuspense: true;
|
|
308
|
+
};
|
|
309
|
+
interface SuspenseBoundary {
|
|
310
|
+
vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
|
|
311
|
+
parent: SuspenseBoundary | null;
|
|
312
|
+
parentComponent: ComponentInternalInstance | null;
|
|
313
|
+
namespace: ElementNamespace;
|
|
314
|
+
container: RendererElement;
|
|
315
|
+
hiddenContainer: RendererElement;
|
|
316
|
+
activeBranch: VNode | null;
|
|
317
|
+
pendingBranch: VNode | null;
|
|
318
|
+
deps: number;
|
|
319
|
+
pendingId: number;
|
|
320
|
+
timeout: number;
|
|
321
|
+
isInFallback: boolean;
|
|
322
|
+
isHydrating: boolean;
|
|
323
|
+
isUnmounted: boolean;
|
|
324
|
+
effects: Function[];
|
|
325
|
+
resolve(force?: boolean, sync?: boolean): void;
|
|
326
|
+
fallback(fallbackVNode: VNode): void;
|
|
327
|
+
move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
|
|
328
|
+
next(): RendererNode | null;
|
|
329
|
+
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void;
|
|
330
|
+
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
|
|
331
|
+
}
|
|
332
|
+
declare function createSuspenseBoundary(vnode: VNode, parentSuspense: SuspenseBoundary | null, parentComponent: ComponentInternalInstance | null, container: RendererElement, hiddenContainer: RendererElement, anchor: RendererNode | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, isHydrating?: boolean): SuspenseBoundary;
|
|
333
|
+
declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
334
|
+
declare function normalizeSuspenseChildren(vnode: VNode): void;
|
|
335
|
+
|
|
336
|
+
type Hook<T = () => void> = T | T[];
|
|
337
|
+
interface BaseTransitionProps<HostElement = RendererElement> {
|
|
338
|
+
mode?: 'in-out' | 'out-in' | 'default';
|
|
339
|
+
appear?: boolean;
|
|
340
|
+
persisted?: boolean;
|
|
341
|
+
onBeforeEnter?: Hook<(el: HostElement) => void>;
|
|
342
|
+
onEnter?: Hook<(el: HostElement, done: () => void) => void>;
|
|
343
|
+
onAfterEnter?: Hook<(el: HostElement) => void>;
|
|
344
|
+
onEnterCancelled?: Hook<(el: HostElement) => void>;
|
|
345
|
+
onBeforeLeave?: Hook<(el: HostElement) => void>;
|
|
346
|
+
onLeave?: Hook<(el: HostElement, done: () => void) => void>;
|
|
347
|
+
onAfterLeave?: Hook<(el: HostElement) => void>;
|
|
348
|
+
onLeaveCancelled?: Hook<(el: HostElement) => void>;
|
|
349
|
+
onBeforeAppear?: Hook<(el: HostElement) => void>;
|
|
350
|
+
onAppear?: Hook<(el: HostElement, done: () => void) => void>;
|
|
351
|
+
onAfterAppear?: Hook<(el: HostElement) => void>;
|
|
352
|
+
onAppearCancelled?: Hook<(el: HostElement) => void>;
|
|
353
|
+
}
|
|
354
|
+
interface TransitionHooks<HostElement = RendererElement> {
|
|
355
|
+
mode: BaseTransitionProps['mode'];
|
|
356
|
+
persisted: boolean;
|
|
357
|
+
beforeEnter(el: HostElement): void;
|
|
358
|
+
enter(el: HostElement): void;
|
|
359
|
+
leave(el: HostElement, remove: () => void): void;
|
|
360
|
+
clone(vnode: VNode): TransitionHooks<HostElement>;
|
|
361
|
+
afterLeave?(): void;
|
|
362
|
+
delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
|
|
363
|
+
delayedLeave?(): void;
|
|
364
|
+
}
|
|
365
|
+
type ElementNamespace = 'svg' | 'mathml' | undefined;
|
|
366
|
+
interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
|
|
367
|
+
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, prevChildren?: VNode<HostNode, HostElement>[], parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, unmountChildren?: UnmountChildrenFn): void;
|
|
368
|
+
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
369
|
+
remove(el: HostNode): void;
|
|
370
|
+
createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
|
|
371
|
+
[key: string]: any;
|
|
372
|
+
}) | null): HostElement;
|
|
373
|
+
createText(text: string): HostNode;
|
|
374
|
+
createComment(text: string): HostNode;
|
|
375
|
+
setText(node: HostNode, text: string): void;
|
|
376
|
+
setElementText(node: HostElement, text: string): void;
|
|
377
|
+
parentNode(node: HostNode): HostElement | null;
|
|
378
|
+
nextSibling(node: HostNode): HostNode | null;
|
|
379
|
+
querySelector?(selector: string): HostElement | null;
|
|
380
|
+
setScopeId?(el: HostElement, id: string): void;
|
|
381
|
+
cloneNode?(node: HostNode): HostNode;
|
|
382
|
+
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
383
|
+
}
|
|
384
|
+
interface RendererNode {
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
}
|
|
387
|
+
interface RendererElement extends RendererNode {
|
|
388
|
+
}
|
|
389
|
+
interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
|
|
390
|
+
p: PatchFn;
|
|
391
|
+
um: UnmountFn;
|
|
392
|
+
r: RemoveFn;
|
|
393
|
+
m: MoveFn;
|
|
394
|
+
mt: MountComponentFn;
|
|
395
|
+
mc: MountChildrenFn;
|
|
396
|
+
pc: PatchChildrenFn;
|
|
397
|
+
pbc: PatchBlockChildrenFn;
|
|
398
|
+
n: NextFn;
|
|
399
|
+
o: RendererOptions<HostNode, HostElement>;
|
|
400
|
+
}
|
|
401
|
+
type PatchFn = (n1: VNode | null, // null means this is a mount
|
|
402
|
+
n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
|
|
403
|
+
type MountChildrenFn = (children: VNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void;
|
|
404
|
+
type PatchChildrenFn = (n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void;
|
|
405
|
+
type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
|
|
406
|
+
type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
|
|
407
|
+
type NextFn = (vnode: VNode) => RendererNode | null;
|
|
408
|
+
type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
|
|
409
|
+
type RemoveFn = (vnode: VNode) => void;
|
|
410
|
+
type UnmountChildrenFn = (children: VNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void;
|
|
411
|
+
type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
412
|
+
type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
413
|
+
declare enum MoveType {
|
|
414
|
+
ENTER = 0,
|
|
415
|
+
LEAVE = 1,
|
|
416
|
+
REORDER = 2
|
|
417
|
+
}
|
|
418
|
+
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
419
|
+
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
420
|
+
|
|
421
|
+
type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
422
|
+
type ComponentObjectPropsOptions<P = Data> = {
|
|
423
|
+
[K in keyof P]: Prop<P[K]> | null;
|
|
424
|
+
};
|
|
425
|
+
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
426
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
427
|
+
interface PropOptions<T = any, D = T> {
|
|
428
|
+
type?: PropType<T> | true | null;
|
|
429
|
+
required?: boolean;
|
|
430
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
431
|
+
validator?(value: unknown, props: Data): boolean;
|
|
432
|
+
}
|
|
433
|
+
type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
|
|
434
|
+
type PropConstructor<T = any> = {
|
|
435
|
+
new (...args: any[]): T & {};
|
|
436
|
+
} | {
|
|
437
|
+
(): T;
|
|
438
|
+
} | PropMethod<T>;
|
|
439
|
+
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
440
|
+
((...args: any) => any) | undefined
|
|
441
|
+
] ? {
|
|
442
|
+
new (): TConstructor;
|
|
443
|
+
(): T;
|
|
444
|
+
readonly prototype: TConstructor;
|
|
445
|
+
} : never;
|
|
446
|
+
type RequiredKeys<T> = {
|
|
447
|
+
[K in keyof T]: T[K] extends {
|
|
448
|
+
required: true;
|
|
449
|
+
} | {
|
|
450
|
+
default: any;
|
|
451
|
+
} | BooleanConstructor | {
|
|
452
|
+
type: BooleanConstructor;
|
|
453
|
+
} ? T[K] extends {
|
|
454
|
+
default: undefined | (() => undefined);
|
|
455
|
+
} ? never : K : never;
|
|
456
|
+
}[keyof T];
|
|
457
|
+
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
458
|
+
type DefaultKeys<T> = {
|
|
459
|
+
[K in keyof T]: T[K] extends {
|
|
460
|
+
default: any;
|
|
461
|
+
} | BooleanConstructor | {
|
|
462
|
+
type: BooleanConstructor;
|
|
463
|
+
} ? T[K] extends {
|
|
464
|
+
type: BooleanConstructor;
|
|
465
|
+
required: true;
|
|
466
|
+
} ? never : K : never;
|
|
467
|
+
}[keyof T];
|
|
468
|
+
type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
469
|
+
type: null | true;
|
|
470
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
471
|
+
type: ObjectConstructor;
|
|
472
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
473
|
+
type: BooleanConstructor;
|
|
474
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
475
|
+
type: DateConstructor;
|
|
476
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
477
|
+
type: (infer U)[];
|
|
478
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
479
|
+
/**
|
|
480
|
+
* Extract prop types from a runtime props options object.
|
|
481
|
+
* The extracted types are **internal** - i.e. the resolved props received by
|
|
482
|
+
* the component.
|
|
483
|
+
* - Boolean props are always present
|
|
484
|
+
* - Props with default values are always present
|
|
485
|
+
*
|
|
486
|
+
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
487
|
+
*/
|
|
488
|
+
type ExtractPropTypes<O> = {
|
|
489
|
+
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
490
|
+
} & {
|
|
491
|
+
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
492
|
+
};
|
|
493
|
+
type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
494
|
+
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
495
|
+
} : {};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
499
|
+
|
|
500
|
+
const comp = resolveComponent('comp')
|
|
501
|
+
const foo = resolveDirective('foo')
|
|
502
|
+
const bar = resolveDirective('bar')
|
|
503
|
+
|
|
504
|
+
return withDirectives(h(comp), [
|
|
505
|
+
[foo, this.x],
|
|
506
|
+
[bar, this.y]
|
|
507
|
+
])
|
|
508
|
+
*/
|
|
509
|
+
|
|
510
|
+
interface DirectiveBinding<V = any> {
|
|
511
|
+
instance: ComponentPublicInstance | null;
|
|
512
|
+
value: V;
|
|
513
|
+
oldValue: V | null;
|
|
514
|
+
arg?: string;
|
|
515
|
+
modifiers: DirectiveModifiers;
|
|
516
|
+
dir: ObjectDirective<any, V>;
|
|
517
|
+
}
|
|
518
|
+
type DirectiveHook<T = any, Prev = VNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode<any, T>, prevVNode: Prev) => void;
|
|
519
|
+
type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
520
|
+
interface ObjectDirective<T = any, V = any> {
|
|
521
|
+
created?: DirectiveHook<T, null, V>;
|
|
522
|
+
beforeMount?: DirectiveHook<T, null, V>;
|
|
523
|
+
mounted?: DirectiveHook<T, null, V>;
|
|
524
|
+
beforeUpdate?: DirectiveHook<T, VNode<any, T>, V>;
|
|
525
|
+
updated?: DirectiveHook<T, VNode<any, T>, V>;
|
|
526
|
+
beforeUnmount?: DirectiveHook<T, null, V>;
|
|
527
|
+
unmounted?: DirectiveHook<T, null, V>;
|
|
528
|
+
getSSRProps?: SSRDirectiveHook;
|
|
529
|
+
deep?: boolean;
|
|
530
|
+
}
|
|
531
|
+
type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
|
|
532
|
+
type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
|
|
533
|
+
type DirectiveModifiers = Record<string, boolean>;
|
|
534
|
+
|
|
535
|
+
declare enum DeprecationTypes$1 {
|
|
536
|
+
GLOBAL_MOUNT = "GLOBAL_MOUNT",
|
|
537
|
+
GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
|
|
538
|
+
GLOBAL_EXTEND = "GLOBAL_EXTEND",
|
|
539
|
+
GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
|
|
540
|
+
GLOBAL_SET = "GLOBAL_SET",
|
|
541
|
+
GLOBAL_DELETE = "GLOBAL_DELETE",
|
|
542
|
+
GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
|
|
543
|
+
GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
|
|
544
|
+
CONFIG_SILENT = "CONFIG_SILENT",
|
|
545
|
+
CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
|
|
546
|
+
CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
|
|
547
|
+
CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
|
|
548
|
+
CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
|
|
549
|
+
CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
|
|
550
|
+
CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
|
|
551
|
+
INSTANCE_SET = "INSTANCE_SET",
|
|
552
|
+
INSTANCE_DELETE = "INSTANCE_DELETE",
|
|
553
|
+
INSTANCE_DESTROY = "INSTANCE_DESTROY",
|
|
554
|
+
INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
|
|
555
|
+
INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
|
|
556
|
+
INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
|
|
557
|
+
INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
|
|
558
|
+
INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
|
|
559
|
+
INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
|
|
560
|
+
OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
|
|
561
|
+
OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
|
|
562
|
+
OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
|
|
563
|
+
OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
|
|
564
|
+
WATCH_ARRAY = "WATCH_ARRAY",
|
|
565
|
+
PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
|
|
566
|
+
V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
|
|
567
|
+
CUSTOM_DIR = "CUSTOM_DIR",
|
|
568
|
+
ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
|
|
569
|
+
ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
|
|
570
|
+
TRANSITION_CLASSES = "TRANSITION_CLASSES",
|
|
571
|
+
TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
|
|
572
|
+
COMPONENT_ASYNC = "COMPONENT_ASYNC",
|
|
573
|
+
COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
|
|
574
|
+
COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
|
|
575
|
+
RENDER_FUNCTION = "RENDER_FUNCTION",
|
|
576
|
+
FILTERS = "FILTERS",
|
|
577
|
+
PRIVATE_APIS = "PRIVATE_APIS"
|
|
578
|
+
}
|
|
579
|
+
type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
|
|
580
|
+
MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Interface for declaring custom options.
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* ```ts
|
|
588
|
+
* declare module '@vue/runtime-core' {
|
|
589
|
+
* interface ComponentCustomOptions {
|
|
590
|
+
* beforeRouteUpdate?(
|
|
591
|
+
* to: Route,
|
|
592
|
+
* from: Route,
|
|
593
|
+
* next: () => void
|
|
594
|
+
* ): void
|
|
595
|
+
* }
|
|
596
|
+
* }
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
interface ComponentCustomOptions {
|
|
600
|
+
}
|
|
601
|
+
type RenderFunction = () => VNodeChild;
|
|
602
|
+
interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>, ComponentInternalOptions, ComponentCustomOptions {
|
|
603
|
+
setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
|
|
604
|
+
name?: string;
|
|
605
|
+
template?: string | object;
|
|
606
|
+
render?: Function;
|
|
607
|
+
components?: Record<string, Component>;
|
|
608
|
+
directives?: Record<string, Directive>;
|
|
609
|
+
inheritAttrs?: boolean;
|
|
610
|
+
emits?: (E | EE[]) & ThisType<void>;
|
|
611
|
+
slots?: S;
|
|
612
|
+
expose?: string[];
|
|
613
|
+
serverPrefetch?(): void | Promise<any>;
|
|
614
|
+
compilerOptions?: RuntimeCompilerOptions;
|
|
615
|
+
call?: (this: unknown, ...args: unknown[]) => never;
|
|
616
|
+
__isFragment?: never;
|
|
617
|
+
__isTeleport?: never;
|
|
618
|
+
__isSuspense?: never;
|
|
619
|
+
__defaults?: Defaults;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Subset of compiler options that makes sense for the runtime.
|
|
623
|
+
*/
|
|
624
|
+
interface RuntimeCompilerOptions {
|
|
625
|
+
isCustomElement?: (tag: string) => boolean;
|
|
626
|
+
whitespace?: 'preserve' | 'condense';
|
|
627
|
+
comments?: boolean;
|
|
628
|
+
delimiters?: [string, string];
|
|
629
|
+
}
|
|
630
|
+
type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, PE = Props & EmitsToProps<E>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & {
|
|
631
|
+
props?: undefined;
|
|
632
|
+
} & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>;
|
|
633
|
+
type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, S extends SlotsType = any> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, string, S> & ThisType<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>>>;
|
|
634
|
+
type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>;
|
|
635
|
+
type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
636
|
+
interface MethodOptions {
|
|
637
|
+
[key: string]: Function;
|
|
638
|
+
}
|
|
639
|
+
type ExtractComputedReturns<T extends any> = {
|
|
640
|
+
[key in keyof T]: T[key] extends {
|
|
641
|
+
get: (...args: any[]) => infer TReturn;
|
|
642
|
+
} ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
|
|
643
|
+
};
|
|
644
|
+
type ObjectWatchOptionItem = {
|
|
645
|
+
handler: WatchCallback | string;
|
|
646
|
+
} & WatchOptions;
|
|
647
|
+
type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
|
|
648
|
+
type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
|
|
649
|
+
type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
|
|
650
|
+
type ComponentProvideOptions = ObjectProvideOptions | Function;
|
|
651
|
+
type ObjectProvideOptions = Record<string | symbol, unknown>;
|
|
652
|
+
type ComponentInjectOptions = string[] | ObjectInjectOptions;
|
|
653
|
+
type ObjectInjectOptions = Record<string | symbol, string | symbol | {
|
|
654
|
+
from?: string | symbol;
|
|
655
|
+
default?: unknown;
|
|
656
|
+
}>;
|
|
657
|
+
type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
|
|
658
|
+
[K in T[number]]?: unknown;
|
|
659
|
+
} : T extends ObjectInjectOptions ? {
|
|
660
|
+
[K in keyof T]?: unknown;
|
|
661
|
+
} : never;
|
|
662
|
+
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
|
|
663
|
+
compatConfig?: CompatConfig;
|
|
664
|
+
[key: string]: any;
|
|
665
|
+
data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
666
|
+
computed?: C;
|
|
667
|
+
methods?: M;
|
|
668
|
+
watch?: ComponentWatchOptions;
|
|
669
|
+
provide?: ComponentProvideOptions;
|
|
670
|
+
inject?: I | II[];
|
|
671
|
+
filters?: Record<string, Function>;
|
|
672
|
+
mixins?: Mixin[];
|
|
673
|
+
extends?: Extends;
|
|
674
|
+
beforeCreate?(): void;
|
|
675
|
+
created?(): void;
|
|
676
|
+
beforeMount?(): void;
|
|
677
|
+
mounted?(): void;
|
|
678
|
+
beforeUpdate?(): void;
|
|
679
|
+
updated?(): void;
|
|
680
|
+
activated?(): void;
|
|
681
|
+
deactivated?(): void;
|
|
682
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
683
|
+
beforeDestroy?(): void;
|
|
684
|
+
beforeUnmount?(): void;
|
|
685
|
+
/** @deprecated use `unmounted` instead */
|
|
686
|
+
destroyed?(): void;
|
|
687
|
+
unmounted?(): void;
|
|
688
|
+
renderTracked?: DebuggerHook;
|
|
689
|
+
renderTriggered?: DebuggerHook;
|
|
690
|
+
errorCaptured?: ErrorCapturedHook;
|
|
691
|
+
/**
|
|
692
|
+
* runtime compile only
|
|
693
|
+
* @deprecated use `compilerOptions.delimiters` instead.
|
|
694
|
+
*/
|
|
695
|
+
delimiters?: [string, string];
|
|
696
|
+
/**
|
|
697
|
+
* #3468
|
|
698
|
+
*
|
|
699
|
+
* type-only, used to assist Mixin's type inference,
|
|
700
|
+
* typescript will try to simplify the inferred `Mixin` type,
|
|
701
|
+
* with the `__differentiator`, typescript won't be able to combine different mixins,
|
|
702
|
+
* because the `__differentiator` will be different
|
|
703
|
+
*/
|
|
704
|
+
__differentiator?: keyof D | keyof C | keyof M;
|
|
705
|
+
}
|
|
706
|
+
type MergedHook<T = () => void> = T | T[];
|
|
707
|
+
type MergedComponentOptionsOverride = {
|
|
708
|
+
beforeCreate?: MergedHook;
|
|
709
|
+
created?: MergedHook;
|
|
710
|
+
beforeMount?: MergedHook;
|
|
711
|
+
mounted?: MergedHook;
|
|
712
|
+
beforeUpdate?: MergedHook;
|
|
713
|
+
updated?: MergedHook;
|
|
714
|
+
activated?: MergedHook;
|
|
715
|
+
deactivated?: MergedHook;
|
|
716
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
717
|
+
beforeDestroy?: MergedHook;
|
|
718
|
+
beforeUnmount?: MergedHook;
|
|
719
|
+
/** @deprecated use `unmounted` instead */
|
|
720
|
+
destroyed?: MergedHook;
|
|
721
|
+
unmounted?: MergedHook;
|
|
722
|
+
renderTracked?: MergedHook<DebuggerHook>;
|
|
723
|
+
renderTriggered?: MergedHook<DebuggerHook>;
|
|
724
|
+
errorCaptured?: MergedHook<ErrorCapturedHook>;
|
|
725
|
+
};
|
|
726
|
+
type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
|
|
727
|
+
type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
|
|
728
|
+
P: P;
|
|
729
|
+
B: B;
|
|
730
|
+
D: D;
|
|
731
|
+
C: C;
|
|
732
|
+
M: M;
|
|
733
|
+
Defaults: Defaults;
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
interface InjectionKey<T> extends Symbol {
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
740
|
+
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
741
|
+
type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP;
|
|
742
|
+
|
|
743
|
+
interface App<HostElement = any> {
|
|
744
|
+
version: string;
|
|
745
|
+
config: AppConfig;
|
|
746
|
+
use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): this;
|
|
747
|
+
use<Options>(plugin: Plugin<Options>, options: Options): this;
|
|
748
|
+
mixin(mixin: ComponentOptions): this;
|
|
749
|
+
component(name: string): Component | undefined;
|
|
750
|
+
component(name: string, component: Component | DefineComponent): this;
|
|
751
|
+
directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
|
|
752
|
+
directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
|
|
753
|
+
mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
|
|
754
|
+
unmount(): void;
|
|
755
|
+
provide<T>(key: InjectionKey<T> | string, value: T): this;
|
|
756
|
+
/**
|
|
757
|
+
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
758
|
+
* to variables provided via `app.provide()`.
|
|
759
|
+
*
|
|
760
|
+
* @param fn - function to run with the app as active instance
|
|
761
|
+
*/
|
|
762
|
+
runWithContext<T>(fn: () => T): T;
|
|
763
|
+
_uid: number;
|
|
764
|
+
_component: ConcreteComponent;
|
|
765
|
+
_props: Data | null;
|
|
766
|
+
_container: HostElement | null;
|
|
767
|
+
_context: AppContext;
|
|
768
|
+
_instance: ComponentInternalInstance | null;
|
|
769
|
+
/**
|
|
770
|
+
* v2 compat only
|
|
771
|
+
*/
|
|
772
|
+
filter?(name: string): Function | undefined;
|
|
773
|
+
filter?(name: string, filter: Function): this;
|
|
774
|
+
}
|
|
775
|
+
type OptionMergeFunction = (to: unknown, from: unknown) => any;
|
|
776
|
+
interface AppConfig {
|
|
777
|
+
readonly isNativeTag: (tag: string) => boolean;
|
|
778
|
+
performance: boolean;
|
|
779
|
+
optionMergeStrategies: Record<string, OptionMergeFunction>;
|
|
780
|
+
globalProperties: ComponentCustomProperties & Record<string, any>;
|
|
781
|
+
errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
|
|
782
|
+
warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
|
|
783
|
+
/**
|
|
784
|
+
* Options to pass to `@vue/compiler-dom`.
|
|
785
|
+
* Only supported in runtime compiler build.
|
|
786
|
+
*/
|
|
787
|
+
compilerOptions: RuntimeCompilerOptions;
|
|
788
|
+
/**
|
|
789
|
+
* @deprecated use config.compilerOptions.isCustomElement
|
|
790
|
+
*/
|
|
791
|
+
isCustomElement?: (tag: string) => boolean;
|
|
792
|
+
/**
|
|
793
|
+
* TODO document for 3.5
|
|
794
|
+
* Enable warnings for computed getters that recursively trigger itself.
|
|
795
|
+
*/
|
|
796
|
+
warnRecursiveComputed?: boolean;
|
|
797
|
+
}
|
|
798
|
+
interface AppContext {
|
|
799
|
+
app: App;
|
|
800
|
+
config: AppConfig;
|
|
801
|
+
mixins: ComponentOptions[];
|
|
802
|
+
components: Record<string, Component>;
|
|
803
|
+
directives: Record<string, Directive>;
|
|
804
|
+
provides: Record<string | symbol, any>;
|
|
805
|
+
}
|
|
806
|
+
type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
|
|
807
|
+
type ObjectPlugin<Options = any[]> = {
|
|
808
|
+
install: PluginInstallFunction<Options>;
|
|
809
|
+
};
|
|
810
|
+
type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
|
|
811
|
+
type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>;
|
|
812
|
+
|
|
813
|
+
type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
814
|
+
interface TeleportProps {
|
|
815
|
+
to: string | RendererElement | null | undefined;
|
|
816
|
+
disabled?: boolean;
|
|
817
|
+
}
|
|
818
|
+
declare const TeleportImpl: {
|
|
819
|
+
name: string;
|
|
820
|
+
__isTeleport: boolean;
|
|
821
|
+
process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
|
|
822
|
+
remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
|
|
823
|
+
move: typeof moveTeleport;
|
|
824
|
+
hydrate: typeof hydrateTeleport;
|
|
825
|
+
};
|
|
826
|
+
declare enum TeleportMoveTypes {
|
|
827
|
+
TARGET_CHANGE = 0,
|
|
828
|
+
TOGGLE = 1,// enable / disable
|
|
829
|
+
REORDER = 2
|
|
830
|
+
}
|
|
831
|
+
declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
|
|
832
|
+
declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
833
|
+
declare const Teleport: {
|
|
834
|
+
new (): {
|
|
835
|
+
$props: VNodeProps & TeleportProps;
|
|
836
|
+
$slots: {
|
|
837
|
+
default(): VNode[];
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
__isTeleport: true;
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
declare const Fragment: {
|
|
844
|
+
new (): {
|
|
845
|
+
$props: VNodeProps;
|
|
846
|
+
};
|
|
847
|
+
__isFragment: true;
|
|
848
|
+
};
|
|
849
|
+
declare const Text: unique symbol;
|
|
850
|
+
declare const Comment: unique symbol;
|
|
851
|
+
declare const Static: unique symbol;
|
|
852
|
+
type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
|
|
853
|
+
type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
|
|
854
|
+
type VNodeNormalizedRefAtom = {
|
|
855
|
+
i: ComponentInternalInstance;
|
|
856
|
+
r: VNodeRef;
|
|
857
|
+
k?: string;
|
|
858
|
+
f?: boolean;
|
|
859
|
+
};
|
|
860
|
+
type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
|
|
861
|
+
type VNodeMountHook = (vnode: VNode) => void;
|
|
862
|
+
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
|
|
863
|
+
type VNodeProps = {
|
|
864
|
+
key?: string | number | symbol;
|
|
865
|
+
ref?: VNodeRef;
|
|
866
|
+
ref_for?: boolean;
|
|
867
|
+
ref_key?: string;
|
|
868
|
+
onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
|
|
869
|
+
onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
|
|
870
|
+
onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
871
|
+
onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
872
|
+
onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
|
|
873
|
+
onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
|
|
874
|
+
};
|
|
875
|
+
type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
|
|
876
|
+
type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
|
|
877
|
+
type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
|
|
878
|
+
type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
|
|
879
|
+
interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
|
|
880
|
+
[key: string]: any;
|
|
881
|
+
}> {
|
|
882
|
+
type: VNodeTypes;
|
|
883
|
+
props: (VNodeProps & ExtraProps) | null;
|
|
884
|
+
key: string | number | symbol | null;
|
|
885
|
+
ref: VNodeNormalizedRef | null;
|
|
886
|
+
/**
|
|
887
|
+
* SFC only. This is assigned on vnode creation using currentScopeId
|
|
888
|
+
* which is set alongside currentRenderingInstance.
|
|
889
|
+
*/
|
|
890
|
+
scopeId: string | null;
|
|
891
|
+
children: VNodeNormalizedChildren;
|
|
892
|
+
component: ComponentInternalInstance | null;
|
|
893
|
+
dirs: DirectiveBinding[] | null;
|
|
894
|
+
transition: TransitionHooks<HostElement> | null;
|
|
895
|
+
el: HostNode | null;
|
|
896
|
+
anchor: HostNode | null;
|
|
897
|
+
target: HostElement | null;
|
|
898
|
+
targetAnchor: HostNode | null;
|
|
899
|
+
suspense: SuspenseBoundary | null;
|
|
900
|
+
shapeFlag: number;
|
|
901
|
+
patchFlag: number;
|
|
902
|
+
appContext: AppContext | null;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
type Data = Record<string, unknown>;
|
|
906
|
+
/**
|
|
907
|
+
* For extending allowed non-declared props on components in TSX
|
|
908
|
+
*/
|
|
909
|
+
interface ComponentCustomProps {
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Default allowed non-declared props on component in TSX
|
|
913
|
+
*/
|
|
914
|
+
interface AllowedComponentProps {
|
|
915
|
+
class?: unknown;
|
|
916
|
+
style?: unknown;
|
|
917
|
+
}
|
|
918
|
+
interface ComponentInternalOptions {
|
|
919
|
+
/**
|
|
920
|
+
* Compat build only, for bailing out of certain compatibility behavior
|
|
921
|
+
*/
|
|
922
|
+
__isBuiltIn?: boolean;
|
|
923
|
+
/**
|
|
924
|
+
* This one should be exposed so that devtools can make use of it
|
|
925
|
+
*/
|
|
926
|
+
__file?: string;
|
|
927
|
+
/**
|
|
928
|
+
* name inferred from filename
|
|
929
|
+
*/
|
|
930
|
+
__name?: string;
|
|
931
|
+
}
|
|
932
|
+
interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
|
|
933
|
+
(props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
|
|
934
|
+
props?: ComponentPropsOptions<P>;
|
|
935
|
+
emits?: EE | (keyof EE)[];
|
|
936
|
+
slots?: IfAny<S, Slots, SlotsType<S>>;
|
|
937
|
+
inheritAttrs?: boolean;
|
|
938
|
+
displayName?: string;
|
|
939
|
+
compatConfig?: CompatConfig;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Concrete component type matches its actual value: it's either an options
|
|
943
|
+
* object, or a function. Use this where the code expects to work with actual
|
|
944
|
+
* values, e.g. checking if its a function or not. This is mostly for internal
|
|
945
|
+
* implementation code.
|
|
946
|
+
*/
|
|
947
|
+
type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ComponentOptions<Props, RawBindings, D, C, M> | FunctionalComponent<Props, E, S>;
|
|
948
|
+
/**
|
|
949
|
+
* A type used in public APIs where a component type is expected.
|
|
950
|
+
* The constructor type is an artificial type returned by defineComponent().
|
|
951
|
+
*/
|
|
952
|
+
type Component<Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<Props, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<Props>;
|
|
953
|
+
|
|
954
|
+
type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
|
|
955
|
+
attrs: Data;
|
|
956
|
+
slots: UnwrapSlotsType<S>;
|
|
957
|
+
emit: EmitFn<E>;
|
|
958
|
+
expose: (exposed?: Record<string, any>) => void;
|
|
959
|
+
} : never;
|
|
960
|
+
/**
|
|
961
|
+
* We expose a subset of properties on the internal instance as they are
|
|
962
|
+
* useful for advanced external libraries and tools.
|
|
963
|
+
*/
|
|
964
|
+
interface ComponentInternalInstance {
|
|
965
|
+
uid: number;
|
|
966
|
+
type: ConcreteComponent;
|
|
967
|
+
parent: ComponentInternalInstance | null;
|
|
968
|
+
root: ComponentInternalInstance;
|
|
969
|
+
appContext: AppContext;
|
|
970
|
+
/**
|
|
971
|
+
* Vnode representing this component in its parent's vdom tree
|
|
972
|
+
*/
|
|
973
|
+
vnode: VNode;
|
|
974
|
+
/**
|
|
975
|
+
* Root vnode of this component's own vdom tree
|
|
976
|
+
*/
|
|
977
|
+
subTree: VNode;
|
|
978
|
+
/**
|
|
979
|
+
* Render effect instance
|
|
980
|
+
*/
|
|
981
|
+
effect: ReactiveEffect;
|
|
982
|
+
/**
|
|
983
|
+
* Bound effect runner to be passed to schedulers
|
|
984
|
+
*/
|
|
985
|
+
update: SchedulerJob;
|
|
986
|
+
proxy: ComponentPublicInstance | null;
|
|
987
|
+
exposed: Record<string, any> | null;
|
|
988
|
+
exposeProxy: Record<string, any> | null;
|
|
989
|
+
data: Data;
|
|
990
|
+
props: Data;
|
|
991
|
+
attrs: Data;
|
|
992
|
+
slots: InternalSlots;
|
|
993
|
+
refs: Data;
|
|
994
|
+
emit: EmitFn;
|
|
995
|
+
attrsProxy: Data | null;
|
|
996
|
+
slotsProxy: Slots | null;
|
|
997
|
+
isMounted: boolean;
|
|
998
|
+
isUnmounted: boolean;
|
|
999
|
+
isDeactivated: boolean;
|
|
1000
|
+
}
|
|
1001
|
+
type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
1002
|
+
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1003
|
+
interface WatchOptionsBase extends DebuggerOptions {
|
|
1004
|
+
flush?: 'pre' | 'post' | 'sync';
|
|
1005
|
+
}
|
|
1006
|
+
interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
|
|
1007
|
+
immediate?: Immediate;
|
|
1008
|
+
deep?: boolean;
|
|
1009
|
+
once?: boolean;
|
|
1010
|
+
}
|
|
1011
|
+
type WatchStopHandle = () => void;
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
1015
|
+
* expected argument is the same as the component `props` option.
|
|
1016
|
+
*
|
|
1017
|
+
* Example runtime declaration:
|
|
1018
|
+
* ```js
|
|
1019
|
+
* // using Array syntax
|
|
1020
|
+
* const props = defineProps(['foo', 'bar'])
|
|
1021
|
+
* // using Object syntax
|
|
1022
|
+
* const props = defineProps({
|
|
1023
|
+
* foo: String,
|
|
1024
|
+
* bar: {
|
|
1025
|
+
* type: Number,
|
|
1026
|
+
* required: true
|
|
1027
|
+
* }
|
|
1028
|
+
* })
|
|
1029
|
+
* ```
|
|
1030
|
+
*
|
|
1031
|
+
* Equivalent type-based declaration:
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* // will be compiled into equivalent runtime declarations
|
|
1034
|
+
* const props = defineProps<{
|
|
1035
|
+
* foo?: string
|
|
1036
|
+
* bar: number
|
|
1037
|
+
* }>()
|
|
1038
|
+
* ```
|
|
1039
|
+
*
|
|
1040
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1041
|
+
*
|
|
1042
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1043
|
+
* output and should **not** be actually called at runtime.
|
|
1044
|
+
*/
|
|
1045
|
+
declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
1046
|
+
[key in PropNames]?: any;
|
|
1047
|
+
}>>;
|
|
1048
|
+
declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
1049
|
+
declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
1050
|
+
type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
1051
|
+
readonly [K in BKeys]-?: boolean;
|
|
1052
|
+
};
|
|
1053
|
+
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
1054
|
+
/**
|
|
1055
|
+
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
1056
|
+
* events. The expected argument is the same as the component `emits` option.
|
|
1057
|
+
*
|
|
1058
|
+
* Example runtime declaration:
|
|
1059
|
+
* ```js
|
|
1060
|
+
* const emit = defineEmits(['change', 'update'])
|
|
1061
|
+
* ```
|
|
1062
|
+
*
|
|
1063
|
+
* Example type-based declaration:
|
|
1064
|
+
* ```ts
|
|
1065
|
+
* const emit = defineEmits<{
|
|
1066
|
+
* // <eventName>: <expected arguments>
|
|
1067
|
+
* change: []
|
|
1068
|
+
* update: [value: string] // named tuple syntax
|
|
1069
|
+
* }>()
|
|
1070
|
+
*
|
|
1071
|
+
* emit('change')
|
|
1072
|
+
* emit('update', 1)
|
|
1073
|
+
* ```
|
|
1074
|
+
*
|
|
1075
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1076
|
+
* output and should **not** be actually called at runtime.
|
|
1077
|
+
*
|
|
1078
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1079
|
+
*/
|
|
1080
|
+
declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
1081
|
+
declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
1082
|
+
declare function defineEmits<T extends ((...args: any[]) => any) | Record<string, any[]>>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
1083
|
+
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
1084
|
+
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
1085
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
1086
|
+
}>>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
1089
|
+
* instance properties when it is accessed by a parent component via template
|
|
1090
|
+
* refs.
|
|
1091
|
+
*
|
|
1092
|
+
* `<script setup>` components are closed by default - i.e. variables inside
|
|
1093
|
+
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
1094
|
+
* via `defineExpose`.
|
|
1095
|
+
*
|
|
1096
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1097
|
+
* output and should **not** be actually called at runtime.
|
|
1098
|
+
*
|
|
1099
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
1100
|
+
*/
|
|
1101
|
+
declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
1104
|
+
* options. This should be used only for options that cannot be expressed via
|
|
1105
|
+
* Composition API - e.g. `inheritAttrs`.
|
|
1106
|
+
*
|
|
1107
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
1108
|
+
*/
|
|
1109
|
+
declare function defineOptions<RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin>(options?: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M, Mixin, Extends> & {
|
|
1110
|
+
emits?: undefined;
|
|
1111
|
+
expose?: undefined;
|
|
1112
|
+
slots?: undefined;
|
|
1113
|
+
}): void;
|
|
1114
|
+
declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1115
|
+
type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
|
|
1116
|
+
ModelRef<T, M>,
|
|
1117
|
+
Record<M, true | undefined>
|
|
1118
|
+
];
|
|
1119
|
+
type DefineModelOptions<T = any> = {
|
|
1120
|
+
get?: (v: T) => any;
|
|
1121
|
+
set?: (v: T) => any;
|
|
1122
|
+
};
|
|
1123
|
+
/**
|
|
1124
|
+
* Vue `<script setup>` compiler macro for declaring a
|
|
1125
|
+
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
1126
|
+
* component. This will declare a prop with the same name and a corresponding
|
|
1127
|
+
* `update:propName` event.
|
|
1128
|
+
*
|
|
1129
|
+
* If the first argument is a string, it will be used as the prop name;
|
|
1130
|
+
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
1131
|
+
* can also pass an additional object which will be used as the prop's options.
|
|
1132
|
+
*
|
|
1133
|
+
* The returned ref behaves differently depending on whether the parent
|
|
1134
|
+
* provided the corresponding v-model props or not:
|
|
1135
|
+
* - If yes, the returned ref's value will always be in sync with the parent
|
|
1136
|
+
* prop.
|
|
1137
|
+
* - If not, the returned ref will behave like a normal local ref.
|
|
1138
|
+
*
|
|
1139
|
+
* @example
|
|
1140
|
+
* ```ts
|
|
1141
|
+
* // default model (consumed via `v-model`)
|
|
1142
|
+
* const modelValue = defineModel<string>()
|
|
1143
|
+
* modelValue.value = "hello"
|
|
1144
|
+
*
|
|
1145
|
+
* // default model with options
|
|
1146
|
+
* const modelValue = defineModel<string>({ required: true })
|
|
1147
|
+
*
|
|
1148
|
+
* // with specified name (consumed via `v-model:count`)
|
|
1149
|
+
* const count = defineModel<number>('count')
|
|
1150
|
+
* count.value++
|
|
1151
|
+
*
|
|
1152
|
+
* // with specified name and default value
|
|
1153
|
+
* const count = defineModel<number>('count', { default: 0 })
|
|
1154
|
+
* ```
|
|
1155
|
+
*/
|
|
1156
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1157
|
+
required: true;
|
|
1158
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1159
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1160
|
+
default: any;
|
|
1161
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1162
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1163
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1164
|
+
required: true;
|
|
1165
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1166
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1167
|
+
default: any;
|
|
1168
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1169
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1170
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1171
|
+
type MappedOmit<T, K extends keyof any> = {
|
|
1172
|
+
[P in keyof T as P extends K ? never : P]: T[P];
|
|
1173
|
+
};
|
|
1174
|
+
type InferDefaults<T> = {
|
|
1175
|
+
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
1176
|
+
};
|
|
1177
|
+
type NativeType = null | number | string | boolean | symbol | Function;
|
|
1178
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
1179
|
+
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
1180
|
+
readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
|
|
1181
|
+
} & {
|
|
1182
|
+
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
1183
|
+
};
|
|
1184
|
+
/**
|
|
1185
|
+
* Vue `<script setup>` compiler macro for providing props default values when
|
|
1186
|
+
* using type-based `defineProps` declaration.
|
|
1187
|
+
*
|
|
1188
|
+
* Example usage:
|
|
1189
|
+
* ```ts
|
|
1190
|
+
* withDefaults(defineProps<{
|
|
1191
|
+
* size?: number
|
|
1192
|
+
* labels?: string[]
|
|
1193
|
+
* }>(), {
|
|
1194
|
+
* size: 3,
|
|
1195
|
+
* labels: () => ['default label']
|
|
1196
|
+
* })
|
|
1197
|
+
* ```
|
|
1198
|
+
*
|
|
1199
|
+
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
1200
|
+
* and should **not** be actually called at runtime.
|
|
1201
|
+
*
|
|
1202
|
+
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
1203
|
+
*/
|
|
1204
|
+
declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1205
|
+
|
|
1206
|
+
declare module '@vue/reactivity' {
|
|
1207
|
+
interface RefUnwrapBailTypes {
|
|
1208
|
+
runtimeCoreBailTypes: VNode | {
|
|
1209
|
+
$: ComponentInternalInstance;
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1214
|
+
// build.
|
|
1215
|
+
type _defineProps = typeof defineProps
|
|
1216
|
+
type _defineEmits = typeof defineEmits
|
|
1217
|
+
type _defineExpose = typeof defineExpose
|
|
1218
|
+
type _defineOptions = typeof defineOptions
|
|
1219
|
+
type _defineSlots = typeof defineSlots
|
|
1220
|
+
type _defineModel = typeof defineModel
|
|
1221
|
+
type _withDefaults = typeof withDefaults
|
|
1222
|
+
|
|
1223
|
+
declare global {
|
|
1224
|
+
const defineProps: _defineProps
|
|
1225
|
+
const defineEmits: _defineEmits
|
|
1226
|
+
const defineExpose: _defineExpose
|
|
1227
|
+
const defineOptions: _defineOptions
|
|
1228
|
+
const defineSlots: _defineSlots
|
|
1229
|
+
const defineModel: _defineModel
|
|
1230
|
+
const withDefaults: _withDefaults
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
// types shared between server and client
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
type Awaitable<T> = T | PromiseLike<T>
|
|
1237
|
+
|
|
1238
|
+
interface PageData {
|
|
1239
|
+
relativePath: string
|
|
1240
|
+
filePath: string // differs from relativePath in case of path rewrites
|
|
1241
|
+
title: string
|
|
1242
|
+
titleTemplate?: string | boolean
|
|
1243
|
+
description: string
|
|
1244
|
+
headers: Header[]
|
|
1245
|
+
frontmatter: Record<string, any>
|
|
1246
|
+
params?: Record<string, any>
|
|
1247
|
+
isNotFound?: boolean
|
|
1248
|
+
lastUpdated?: number
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
interface Header {
|
|
1252
|
+
/**
|
|
1253
|
+
* The level of the header
|
|
1254
|
+
*
|
|
1255
|
+
* `1` to `6` for `<h1>` to `<h6>`
|
|
1256
|
+
*/
|
|
1257
|
+
level: number
|
|
1258
|
+
/**
|
|
1259
|
+
* The title of the header
|
|
1260
|
+
*/
|
|
1261
|
+
title: string
|
|
1262
|
+
/**
|
|
1263
|
+
* The slug of the header
|
|
1264
|
+
*
|
|
1265
|
+
* Typically the `id` attr of the header anchor
|
|
1266
|
+
*/
|
|
1267
|
+
slug: string
|
|
1268
|
+
/**
|
|
1269
|
+
* Link of the header
|
|
1270
|
+
*
|
|
1271
|
+
* Typically using `#${slug}` as the anchor hash
|
|
1272
|
+
*/
|
|
1273
|
+
link: string
|
|
1274
|
+
/**
|
|
1275
|
+
* The children of the header
|
|
1276
|
+
*/
|
|
1277
|
+
children: Header[]
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
interface SiteData<ThemeConfig = any> {
|
|
1281
|
+
base: string
|
|
1282
|
+
cleanUrls?: boolean
|
|
1283
|
+
lang: string
|
|
1284
|
+
dir: string
|
|
1285
|
+
title: string
|
|
1286
|
+
titleTemplate?: string | boolean
|
|
1287
|
+
description: string
|
|
1288
|
+
head: HeadConfig[]
|
|
1289
|
+
appearance:
|
|
1290
|
+
| boolean
|
|
1291
|
+
| 'dark'
|
|
1292
|
+
| 'force-dark'
|
|
1293
|
+
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
|
|
1294
|
+
themeConfig: ThemeConfig
|
|
1295
|
+
scrollOffset:
|
|
1296
|
+
| number
|
|
1297
|
+
| string
|
|
1298
|
+
| string[]
|
|
1299
|
+
| { selector: string | string[]; padding: number }
|
|
1300
|
+
locales: LocaleConfig<ThemeConfig>
|
|
1301
|
+
localeIndex?: string
|
|
1302
|
+
contentProps?: Record<string, any>
|
|
1303
|
+
router: {
|
|
1304
|
+
prefetchLinks: boolean
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
type HeadConfig =
|
|
1309
|
+
| [string, Record<string, string>]
|
|
1310
|
+
| [string, Record<string, string>, string]
|
|
1311
|
+
|
|
1312
|
+
interface LocaleSpecificConfig<ThemeConfig = any> {
|
|
1313
|
+
lang?: string
|
|
1314
|
+
dir?: string
|
|
1315
|
+
title?: string
|
|
1316
|
+
titleTemplate?: string | boolean
|
|
1317
|
+
description?: string
|
|
1318
|
+
head?: HeadConfig[]
|
|
1319
|
+
themeConfig?: ThemeConfig
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
type LocaleConfig<ThemeConfig = any> = Record<
|
|
1323
|
+
string,
|
|
1324
|
+
LocaleSpecificConfig<ThemeConfig> & { label: string; link?: string }
|
|
1325
|
+
>
|
|
1326
|
+
|
|
1327
|
+
declare const inBrowser: boolean;
|
|
1328
|
+
|
|
1329
|
+
interface Route {
|
|
1330
|
+
path: string;
|
|
1331
|
+
data: PageData;
|
|
1332
|
+
component: Component$1 | null;
|
|
1333
|
+
}
|
|
1334
|
+
interface Router {
|
|
1335
|
+
/**
|
|
1336
|
+
* Current route.
|
|
1337
|
+
*/
|
|
1338
|
+
route: Route;
|
|
1339
|
+
/**
|
|
1340
|
+
* Navigate to a new URL.
|
|
1341
|
+
*/
|
|
1342
|
+
go: (to?: string) => Promise<void>;
|
|
1343
|
+
/**
|
|
1344
|
+
* Called before the route changes. Return `false` to cancel the navigation.
|
|
1345
|
+
*/
|
|
1346
|
+
onBeforeRouteChange?: (to: string) => Awaitable<void | boolean>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Called before the page component is loaded (after the history state is
|
|
1349
|
+
* updated). Return `false` to cancel the navigation.
|
|
1350
|
+
*/
|
|
1351
|
+
onBeforePageLoad?: (to: string) => Awaitable<void | boolean>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Called after the route changes.
|
|
1354
|
+
*/
|
|
1355
|
+
onAfterRouteChanged?: (to: string) => Awaitable<void>;
|
|
1356
|
+
}
|
|
1357
|
+
declare function useRouter(): Router;
|
|
1358
|
+
declare function useRoute(): Route;
|
|
1359
|
+
|
|
1360
|
+
declare const dataSymbol: InjectionKey$1<VitePressData>;
|
|
1361
|
+
interface VitePressData<T = any> {
|
|
1362
|
+
/**
|
|
1363
|
+
* Site-level metadata
|
|
1364
|
+
*/
|
|
1365
|
+
site: Ref$1<SiteData<T>>;
|
|
1366
|
+
/**
|
|
1367
|
+
* themeConfig from .vitepress/config.js
|
|
1368
|
+
*/
|
|
1369
|
+
theme: Ref$1<T>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Page-level metadata
|
|
1372
|
+
*/
|
|
1373
|
+
page: Ref$1<PageData>;
|
|
1374
|
+
/**
|
|
1375
|
+
* page frontmatter data
|
|
1376
|
+
*/
|
|
1377
|
+
frontmatter: Ref$1<PageData['frontmatter']>;
|
|
1378
|
+
/**
|
|
1379
|
+
* dynamic route params
|
|
1380
|
+
*/
|
|
1381
|
+
params: Ref$1<PageData['params']>;
|
|
1382
|
+
title: Ref$1<string>;
|
|
1383
|
+
description: Ref$1<string>;
|
|
1384
|
+
lang: Ref$1<string>;
|
|
1385
|
+
dir: Ref$1<string>;
|
|
1386
|
+
localeIndex: Ref$1<string>;
|
|
1387
|
+
isDark: Ref$1<boolean>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Current location hash
|
|
1390
|
+
*/
|
|
1391
|
+
hash: Ref$1<string>;
|
|
1392
|
+
}
|
|
1393
|
+
declare function useData<T = any>(): VitePressData<T>;
|
|
1394
|
+
|
|
1395
|
+
interface EnhanceAppContext {
|
|
1396
|
+
app: App$1;
|
|
1397
|
+
router: Router;
|
|
1398
|
+
siteData: Ref$1<SiteData>;
|
|
1399
|
+
}
|
|
1400
|
+
interface Theme {
|
|
1401
|
+
Layout?: Component$1;
|
|
1402
|
+
enhanceApp?: (ctx: EnhanceAppContext) => Awaitable<void>;
|
|
1403
|
+
extends?: Theme;
|
|
1404
|
+
/**
|
|
1405
|
+
* @deprecated can be replaced by wrapping layout component
|
|
1406
|
+
*/
|
|
1407
|
+
setup?: () => void;
|
|
1408
|
+
/**
|
|
1409
|
+
* @deprecated Render not found page by checking `useData().page.value.isNotFound` in Layout instead.
|
|
1410
|
+
*/
|
|
1411
|
+
NotFound?: Component$1;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* Append base to internal (non-relative) urls
|
|
1416
|
+
*/
|
|
1417
|
+
declare function withBase(path: string): string;
|
|
1418
|
+
/**
|
|
1419
|
+
* Register callback that is called every time the markdown content is updated
|
|
1420
|
+
* in the DOM.
|
|
1421
|
+
*/
|
|
1422
|
+
declare function onContentUpdated(fn: () => any): void;
|
|
1423
|
+
declare function defineClientComponent(loader: AsyncComponentLoader, args?: any[], cb?: () => Awaitable<void>): {
|
|
1424
|
+
setup(): () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
1425
|
+
[key: string]: any;
|
|
1426
|
+
}> | null;
|
|
1427
|
+
};
|
|
1428
|
+
declare function getScrollOffset(): number;
|
|
1429
|
+
|
|
1430
|
+
declare const Content: vue.DefineComponent<{
|
|
1431
|
+
as: {
|
|
1432
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
1433
|
+
default: string;
|
|
1434
|
+
};
|
|
1435
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
1436
|
+
[key: string]: any;
|
|
1437
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
1438
|
+
as: {
|
|
1439
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
1440
|
+
default: string;
|
|
1441
|
+
};
|
|
1442
|
+
}>>, {
|
|
1443
|
+
as: string | Record<string, any>;
|
|
1444
|
+
}, {}>;
|
|
1445
|
+
|
|
1446
|
+
export { Content, type EnhanceAppContext, type HeadConfig, type Header, type PageData, type Route, type Router, type SiteData, type Theme, type VitePressData, dataSymbol, defineClientComponent, getScrollOffset, inBrowser, onContentUpdated, useData, useRoute, useRouter, withBase };
|