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,4588 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as vite from 'vite';
|
|
3
|
+
import { BuildOptions, Logger, UserConfig as UserConfig$1, ConfigEnv, ServerOptions } from 'vite';
|
|
4
|
+
export { Plugin, loadEnv } from 'vite';
|
|
5
|
+
import { UseDarkOptions } from '@vueuse/core';
|
|
6
|
+
import { Options as Options$3 } from '@vitejs/plugin-vue';
|
|
7
|
+
import { TransformOptions } from 'stream';
|
|
8
|
+
import { ThemeRegistrationAny, BuiltinTheme, LanguageInput, ShikiTransformer, Highlighter } from 'shiki';
|
|
9
|
+
import { Options as Options$2 } from 'minisearch';
|
|
10
|
+
import { Ref as Ref$1, ComputedRef } from 'vue';
|
|
11
|
+
import glob from 'fast-glob';
|
|
12
|
+
import { Root } from 'postcss';
|
|
13
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
14
|
+
import { Server, ListenOptions } from 'net';
|
|
15
|
+
|
|
16
|
+
declare function build(root?: string, buildOptions?: BuildOptions & {
|
|
17
|
+
base?: string;
|
|
18
|
+
mpa?: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
|
|
21
|
+
type Prettify<T> = {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
} & {};
|
|
24
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
25
|
+
type LooseRequired<T> = {
|
|
26
|
+
[P in keyof (T & Required<T>)]: T[P];
|
|
27
|
+
};
|
|
28
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
29
|
+
type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
|
30
|
+
then(onfulfilled: infer F, ...args: infer _): any;
|
|
31
|
+
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
|
|
32
|
+
|
|
33
|
+
declare enum TrackOpTypes {
|
|
34
|
+
GET = "get",
|
|
35
|
+
HAS = "has",
|
|
36
|
+
ITERATE = "iterate"
|
|
37
|
+
}
|
|
38
|
+
declare enum TriggerOpTypes {
|
|
39
|
+
SET = "set",
|
|
40
|
+
ADD = "add",
|
|
41
|
+
DELETE = "delete",
|
|
42
|
+
CLEAR = "clear"
|
|
43
|
+
}
|
|
44
|
+
declare enum ReactiveFlags {
|
|
45
|
+
SKIP = "__v_skip",
|
|
46
|
+
IS_REACTIVE = "__v_isReactive",
|
|
47
|
+
IS_READONLY = "__v_isReadonly",
|
|
48
|
+
IS_SHALLOW = "__v_isShallow",
|
|
49
|
+
RAW = "__v_raw"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type Dep = Map<ReactiveEffect, number> & {
|
|
53
|
+
cleanup: () => void;
|
|
54
|
+
computed?: ComputedRefImpl<any>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
declare class EffectScope {
|
|
58
|
+
detached: boolean;
|
|
59
|
+
constructor(detached?: boolean);
|
|
60
|
+
get active(): boolean;
|
|
61
|
+
run<T>(fn: () => T): T | undefined;
|
|
62
|
+
stop(fromParent?: boolean): void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type EffectScheduler = (...args: any[]) => any;
|
|
66
|
+
type DebuggerEvent = {
|
|
67
|
+
effect: ReactiveEffect;
|
|
68
|
+
} & DebuggerEventExtraInfo;
|
|
69
|
+
type DebuggerEventExtraInfo = {
|
|
70
|
+
target: object;
|
|
71
|
+
type: TrackOpTypes | TriggerOpTypes;
|
|
72
|
+
key: any;
|
|
73
|
+
newValue?: any;
|
|
74
|
+
oldValue?: any;
|
|
75
|
+
oldTarget?: Map<any, any> | Set<any>;
|
|
76
|
+
};
|
|
77
|
+
declare class ReactiveEffect<T = any> {
|
|
78
|
+
fn: () => T;
|
|
79
|
+
trigger: () => void;
|
|
80
|
+
scheduler?: EffectScheduler | undefined;
|
|
81
|
+
active: boolean;
|
|
82
|
+
deps: Dep[];
|
|
83
|
+
onStop?: () => void;
|
|
84
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
85
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
86
|
+
constructor(fn: () => T, trigger: () => void, scheduler?: EffectScheduler | undefined, scope?: EffectScope);
|
|
87
|
+
get dirty(): boolean;
|
|
88
|
+
set dirty(v: boolean);
|
|
89
|
+
run(): T;
|
|
90
|
+
stop(): void;
|
|
91
|
+
}
|
|
92
|
+
interface DebuggerOptions {
|
|
93
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
94
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
95
|
+
}
|
|
96
|
+
type ComputedGetter<T> = (oldValue?: T) => T;
|
|
97
|
+
type ComputedSetter<T> = (newValue: T) => void;
|
|
98
|
+
interface WritableComputedOptions<T> {
|
|
99
|
+
get: ComputedGetter<T>;
|
|
100
|
+
set: ComputedSetter<T>;
|
|
101
|
+
}
|
|
102
|
+
declare class ComputedRefImpl<T> {
|
|
103
|
+
private getter;
|
|
104
|
+
private readonly _setter;
|
|
105
|
+
dep?: Dep;
|
|
106
|
+
private _value;
|
|
107
|
+
readonly effect: ReactiveEffect<T>;
|
|
108
|
+
readonly __v_isRef = true;
|
|
109
|
+
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
|
110
|
+
_cacheable: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Dev only
|
|
113
|
+
*/
|
|
114
|
+
_warnRecursive?: boolean;
|
|
115
|
+
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
|
116
|
+
get value(): T;
|
|
117
|
+
set value(newValue: T);
|
|
118
|
+
get _dirty(): boolean;
|
|
119
|
+
set _dirty(v: boolean);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
|
123
|
+
declare const ShallowReactiveMarker: unique symbol;
|
|
124
|
+
|
|
125
|
+
declare const RefSymbol: unique symbol;
|
|
126
|
+
declare const RawSymbol: unique symbol;
|
|
127
|
+
interface Ref<T = any> {
|
|
128
|
+
value: T;
|
|
129
|
+
/**
|
|
130
|
+
* Type differentiator only.
|
|
131
|
+
* We need this to be in public d.ts but don't want it to show up in IDE
|
|
132
|
+
* autocomplete, so we use a private Symbol instead.
|
|
133
|
+
*/
|
|
134
|
+
[RefSymbol]: true;
|
|
135
|
+
}
|
|
136
|
+
declare const ShallowRefMarker: unique symbol;
|
|
137
|
+
type ShallowRef$1<T = any> = Ref<T> & {
|
|
138
|
+
[ShallowRefMarker]?: true;
|
|
139
|
+
};
|
|
140
|
+
type BaseTypes = string | number | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* This is a special exported interface for other packages to declare
|
|
143
|
+
* additional types that should bail out for ref unwrapping. For example
|
|
144
|
+
* \@vue/runtime-dom can declare it like so in its d.ts:
|
|
145
|
+
*
|
|
146
|
+
* ``` ts
|
|
147
|
+
* declare module '@vue/reactivity' {
|
|
148
|
+
* export interface RefUnwrapBailTypes {
|
|
149
|
+
* runtimeDOMBailTypes: Node | Window
|
|
150
|
+
* }
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
interface RefUnwrapBailTypes {
|
|
155
|
+
}
|
|
156
|
+
type ShallowUnwrapRef<T> = {
|
|
157
|
+
[K in keyof T]: DistrubuteRef<T[K]>;
|
|
158
|
+
};
|
|
159
|
+
type DistrubuteRef<T> = T extends Ref<infer V> ? V : T;
|
|
160
|
+
type UnwrapRef<T> = T extends ShallowRef$1<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
161
|
+
type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
162
|
+
[RawSymbol]?: true;
|
|
163
|
+
} ? 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> ? {
|
|
164
|
+
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
|
165
|
+
} : T extends object & {
|
|
166
|
+
[ShallowReactiveMarker]?: never;
|
|
167
|
+
} ? {
|
|
168
|
+
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
|
169
|
+
} : T;
|
|
170
|
+
|
|
171
|
+
type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => VNode[];
|
|
172
|
+
type InternalSlots = {
|
|
173
|
+
[name: string]: Slot | undefined;
|
|
174
|
+
};
|
|
175
|
+
type Slots = Readonly<InternalSlots>;
|
|
176
|
+
declare const SlotSymbol: unique symbol;
|
|
177
|
+
type SlotsType<T extends Record<string, any> = Record<string, any>> = {
|
|
178
|
+
[SlotSymbol]?: T;
|
|
179
|
+
};
|
|
180
|
+
type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T;
|
|
181
|
+
type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
|
|
182
|
+
[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
|
|
183
|
+
}>>;
|
|
184
|
+
type RawSlots = {
|
|
185
|
+
[name: string]: unknown;
|
|
186
|
+
$stable?: boolean;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
interface SchedulerJob extends Function {
|
|
190
|
+
id?: number;
|
|
191
|
+
pre?: boolean;
|
|
192
|
+
active?: boolean;
|
|
193
|
+
computed?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Indicates whether the effect is allowed to recursively trigger itself
|
|
196
|
+
* when managed by the scheduler.
|
|
197
|
+
*
|
|
198
|
+
* By default, a job cannot trigger itself because some built-in method calls,
|
|
199
|
+
* e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
200
|
+
* can lead to confusing infinite loops.
|
|
201
|
+
* The allowed cases are component update functions and watch callbacks.
|
|
202
|
+
* Component update functions may update child component props, which in turn
|
|
203
|
+
* trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
204
|
+
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
205
|
+
* triggers itself again, it's likely intentional and it is the user's
|
|
206
|
+
* responsibility to perform recursive state mutation that eventually
|
|
207
|
+
* stabilizes (#1727).
|
|
208
|
+
*/
|
|
209
|
+
allowRecurse?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Attached by renderer.ts when setting up a component's render effect
|
|
212
|
+
* Used to obtain component information when reporting max recursive updates.
|
|
213
|
+
* dev only.
|
|
214
|
+
*/
|
|
215
|
+
ownerInstance?: ComponentInternalInstance;
|
|
216
|
+
}
|
|
217
|
+
declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
218
|
+
|
|
219
|
+
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
220
|
+
type EmitsOptions = ObjectEmitsOptions | string[];
|
|
221
|
+
type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
|
|
222
|
+
[K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
|
|
223
|
+
} : T extends ObjectEmitsOptions ? {
|
|
224
|
+
[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;
|
|
225
|
+
} : {};
|
|
226
|
+
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
227
|
+
[K in keyof E]: (...args: E[K]) => any;
|
|
228
|
+
} : E;
|
|
229
|
+
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<{
|
|
230
|
+
[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;
|
|
231
|
+
}[Event]>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Custom properties added to component instances in any way and can be accessed through `this`
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* Here is an example of adding a property `$router` to every component instance:
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { createApp } from 'vue'
|
|
240
|
+
* import { Router, createRouter } from 'vue-router'
|
|
241
|
+
*
|
|
242
|
+
* declare module '@vue/runtime-core' {
|
|
243
|
+
* interface ComponentCustomProperties {
|
|
244
|
+
* $router: Router
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
248
|
+
* // effectively adding the router to every component instance
|
|
249
|
+
* const app = createApp({})
|
|
250
|
+
* const router = createRouter()
|
|
251
|
+
* app.config.globalProperties.$router = router
|
|
252
|
+
*
|
|
253
|
+
* const vm = app.mount('#app')
|
|
254
|
+
* // we can access the router from the instance
|
|
255
|
+
* vm.$router.push('/')
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
interface ComponentCustomProperties {
|
|
259
|
+
}
|
|
260
|
+
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false;
|
|
261
|
+
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;
|
|
262
|
+
type ExtractMixin<T> = {
|
|
263
|
+
Mixin: MixinToOptionTypes<T>;
|
|
264
|
+
}[T extends ComponentOptionsMixin ? 'Mixin' : never];
|
|
265
|
+
type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>;
|
|
266
|
+
type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
|
|
267
|
+
type EnsureNonVoid<T> = T extends void ? {} : T;
|
|
268
|
+
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> = {
|
|
269
|
+
__isFragment?: never;
|
|
270
|
+
__isTeleport?: never;
|
|
271
|
+
__isSuspense?: never;
|
|
272
|
+
new (...args: any[]): T;
|
|
273
|
+
};
|
|
274
|
+
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>;
|
|
275
|
+
type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
276
|
+
B = {}, // raw bindings returned from setup()
|
|
277
|
+
D = {}, // return from data()
|
|
278
|
+
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 = {}> = {
|
|
279
|
+
$: ComponentInternalInstance;
|
|
280
|
+
$data: D;
|
|
281
|
+
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
282
|
+
$attrs: Data;
|
|
283
|
+
$refs: Data;
|
|
284
|
+
$slots: UnwrapSlotsType<S>;
|
|
285
|
+
$root: ComponentPublicInstance | null;
|
|
286
|
+
$parent: ComponentPublicInstance | null;
|
|
287
|
+
$emit: EmitFn<E>;
|
|
288
|
+
$el: any;
|
|
289
|
+
$options: Options & MergedComponentOptionsOverride;
|
|
290
|
+
$forceUpdate: () => void;
|
|
291
|
+
$nextTick: typeof nextTick;
|
|
292
|
+
$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;
|
|
293
|
+
} & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
|
|
294
|
+
|
|
295
|
+
interface SuspenseProps {
|
|
296
|
+
onResolve?: () => void;
|
|
297
|
+
onPending?: () => void;
|
|
298
|
+
onFallback?: () => void;
|
|
299
|
+
timeout?: string | number;
|
|
300
|
+
/**
|
|
301
|
+
* Allow suspense to be captured by parent suspense
|
|
302
|
+
*
|
|
303
|
+
* @default false
|
|
304
|
+
*/
|
|
305
|
+
suspensible?: boolean;
|
|
306
|
+
}
|
|
307
|
+
declare const SuspenseImpl: {
|
|
308
|
+
name: string;
|
|
309
|
+
__isSuspense: boolean;
|
|
310
|
+
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;
|
|
311
|
+
hydrate: typeof hydrateSuspense;
|
|
312
|
+
create: typeof createSuspenseBoundary;
|
|
313
|
+
normalize: typeof normalizeSuspenseChildren;
|
|
314
|
+
};
|
|
315
|
+
declare const Suspense: {
|
|
316
|
+
new (): {
|
|
317
|
+
$props: VNodeProps & SuspenseProps;
|
|
318
|
+
$slots: {
|
|
319
|
+
default(): VNode[];
|
|
320
|
+
fallback(): VNode[];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
__isSuspense: true;
|
|
324
|
+
};
|
|
325
|
+
interface SuspenseBoundary {
|
|
326
|
+
vnode: VNode<RendererNode, RendererElement, SuspenseProps>;
|
|
327
|
+
parent: SuspenseBoundary | null;
|
|
328
|
+
parentComponent: ComponentInternalInstance | null;
|
|
329
|
+
namespace: ElementNamespace;
|
|
330
|
+
container: RendererElement;
|
|
331
|
+
hiddenContainer: RendererElement;
|
|
332
|
+
activeBranch: VNode | null;
|
|
333
|
+
pendingBranch: VNode | null;
|
|
334
|
+
deps: number;
|
|
335
|
+
pendingId: number;
|
|
336
|
+
timeout: number;
|
|
337
|
+
isInFallback: boolean;
|
|
338
|
+
isHydrating: boolean;
|
|
339
|
+
isUnmounted: boolean;
|
|
340
|
+
effects: Function[];
|
|
341
|
+
resolve(force?: boolean, sync?: boolean): void;
|
|
342
|
+
fallback(fallbackVNode: VNode): void;
|
|
343
|
+
move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
|
|
344
|
+
next(): RendererNode | null;
|
|
345
|
+
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void;
|
|
346
|
+
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
|
|
347
|
+
}
|
|
348
|
+
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;
|
|
349
|
+
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;
|
|
350
|
+
declare function normalizeSuspenseChildren(vnode: VNode): void;
|
|
351
|
+
|
|
352
|
+
type Hook<T = () => void> = T | T[];
|
|
353
|
+
interface BaseTransitionProps<HostElement = RendererElement> {
|
|
354
|
+
mode?: 'in-out' | 'out-in' | 'default';
|
|
355
|
+
appear?: boolean;
|
|
356
|
+
persisted?: boolean;
|
|
357
|
+
onBeforeEnter?: Hook<(el: HostElement) => void>;
|
|
358
|
+
onEnter?: Hook<(el: HostElement, done: () => void) => void>;
|
|
359
|
+
onAfterEnter?: Hook<(el: HostElement) => void>;
|
|
360
|
+
onEnterCancelled?: Hook<(el: HostElement) => void>;
|
|
361
|
+
onBeforeLeave?: Hook<(el: HostElement) => void>;
|
|
362
|
+
onLeave?: Hook<(el: HostElement, done: () => void) => void>;
|
|
363
|
+
onAfterLeave?: Hook<(el: HostElement) => void>;
|
|
364
|
+
onLeaveCancelled?: Hook<(el: HostElement) => void>;
|
|
365
|
+
onBeforeAppear?: Hook<(el: HostElement) => void>;
|
|
366
|
+
onAppear?: Hook<(el: HostElement, done: () => void) => void>;
|
|
367
|
+
onAfterAppear?: Hook<(el: HostElement) => void>;
|
|
368
|
+
onAppearCancelled?: Hook<(el: HostElement) => void>;
|
|
369
|
+
}
|
|
370
|
+
interface TransitionHooks<HostElement = RendererElement> {
|
|
371
|
+
mode: BaseTransitionProps['mode'];
|
|
372
|
+
persisted: boolean;
|
|
373
|
+
beforeEnter(el: HostElement): void;
|
|
374
|
+
enter(el: HostElement): void;
|
|
375
|
+
leave(el: HostElement, remove: () => void): void;
|
|
376
|
+
clone(vnode: VNode): TransitionHooks<HostElement>;
|
|
377
|
+
afterLeave?(): void;
|
|
378
|
+
delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void;
|
|
379
|
+
delayedLeave?(): void;
|
|
380
|
+
}
|
|
381
|
+
type ElementNamespace = 'svg' | 'mathml' | undefined;
|
|
382
|
+
interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
|
|
383
|
+
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, prevChildren?: VNode<HostNode, HostElement>[], parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, unmountChildren?: UnmountChildrenFn): void;
|
|
384
|
+
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
385
|
+
remove(el: HostNode): void;
|
|
386
|
+
createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
|
|
387
|
+
[key: string]: any;
|
|
388
|
+
}) | null): HostElement;
|
|
389
|
+
createText(text: string): HostNode;
|
|
390
|
+
createComment(text: string): HostNode;
|
|
391
|
+
setText(node: HostNode, text: string): void;
|
|
392
|
+
setElementText(node: HostElement, text: string): void;
|
|
393
|
+
parentNode(node: HostNode): HostElement | null;
|
|
394
|
+
nextSibling(node: HostNode): HostNode | null;
|
|
395
|
+
querySelector?(selector: string): HostElement | null;
|
|
396
|
+
setScopeId?(el: HostElement, id: string): void;
|
|
397
|
+
cloneNode?(node: HostNode): HostNode;
|
|
398
|
+
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
399
|
+
}
|
|
400
|
+
interface RendererNode {
|
|
401
|
+
[key: string]: any;
|
|
402
|
+
}
|
|
403
|
+
interface RendererElement extends RendererNode {
|
|
404
|
+
}
|
|
405
|
+
interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> {
|
|
406
|
+
p: PatchFn;
|
|
407
|
+
um: UnmountFn;
|
|
408
|
+
r: RemoveFn;
|
|
409
|
+
m: MoveFn;
|
|
410
|
+
mt: MountComponentFn;
|
|
411
|
+
mc: MountChildrenFn;
|
|
412
|
+
pc: PatchChildrenFn;
|
|
413
|
+
pbc: PatchBlockChildrenFn;
|
|
414
|
+
n: NextFn;
|
|
415
|
+
o: RendererOptions<HostNode, HostElement>;
|
|
416
|
+
}
|
|
417
|
+
type PatchFn = (n1: VNode | null, // null means this is a mount
|
|
418
|
+
n2: VNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void;
|
|
419
|
+
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;
|
|
420
|
+
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;
|
|
421
|
+
type PatchBlockChildrenFn = (oldChildren: VNode[], newChildren: VNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void;
|
|
422
|
+
type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void;
|
|
423
|
+
type NextFn = (vnode: VNode) => RendererNode | null;
|
|
424
|
+
type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
|
|
425
|
+
type RemoveFn = (vnode: VNode) => void;
|
|
426
|
+
type UnmountChildrenFn = (children: VNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void;
|
|
427
|
+
type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
428
|
+
type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
429
|
+
declare enum MoveType {
|
|
430
|
+
ENTER = 0,
|
|
431
|
+
LEAVE = 1,
|
|
432
|
+
REORDER = 2
|
|
433
|
+
}
|
|
434
|
+
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
435
|
+
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
436
|
+
|
|
437
|
+
type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
|
|
438
|
+
type ComponentObjectPropsOptions<P = Data> = {
|
|
439
|
+
[K in keyof P]: Prop<P[K]> | null;
|
|
440
|
+
};
|
|
441
|
+
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
442
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
443
|
+
interface PropOptions<T = any, D = T> {
|
|
444
|
+
type?: PropType<T> | true | null;
|
|
445
|
+
required?: boolean;
|
|
446
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
447
|
+
validator?(value: unknown, props: Data): boolean;
|
|
448
|
+
}
|
|
449
|
+
type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
|
|
450
|
+
type PropConstructor<T = any> = {
|
|
451
|
+
new (...args: any[]): T & {};
|
|
452
|
+
} | {
|
|
453
|
+
(): T;
|
|
454
|
+
} | PropMethod<T>;
|
|
455
|
+
type PropMethod<T, TConstructor = any> = [T] extends [
|
|
456
|
+
((...args: any) => any) | undefined
|
|
457
|
+
] ? {
|
|
458
|
+
new (): TConstructor;
|
|
459
|
+
(): T;
|
|
460
|
+
readonly prototype: TConstructor;
|
|
461
|
+
} : never;
|
|
462
|
+
type RequiredKeys<T> = {
|
|
463
|
+
[K in keyof T]: T[K] extends {
|
|
464
|
+
required: true;
|
|
465
|
+
} | {
|
|
466
|
+
default: any;
|
|
467
|
+
} | BooleanConstructor | {
|
|
468
|
+
type: BooleanConstructor;
|
|
469
|
+
} ? T[K] extends {
|
|
470
|
+
default: undefined | (() => undefined);
|
|
471
|
+
} ? never : K : never;
|
|
472
|
+
}[keyof T];
|
|
473
|
+
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
|
474
|
+
type DefaultKeys<T> = {
|
|
475
|
+
[K in keyof T]: T[K] extends {
|
|
476
|
+
default: any;
|
|
477
|
+
} | BooleanConstructor | {
|
|
478
|
+
type: BooleanConstructor;
|
|
479
|
+
} ? T[K] extends {
|
|
480
|
+
type: BooleanConstructor;
|
|
481
|
+
required: true;
|
|
482
|
+
} ? never : K : never;
|
|
483
|
+
}[keyof T];
|
|
484
|
+
type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
485
|
+
type: null | true;
|
|
486
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
487
|
+
type: ObjectConstructor;
|
|
488
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
489
|
+
type: BooleanConstructor;
|
|
490
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
491
|
+
type: DateConstructor;
|
|
492
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
493
|
+
type: (infer U)[];
|
|
494
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
495
|
+
/**
|
|
496
|
+
* Extract prop types from a runtime props options object.
|
|
497
|
+
* The extracted types are **internal** - i.e. the resolved props received by
|
|
498
|
+
* the component.
|
|
499
|
+
* - Boolean props are always present
|
|
500
|
+
* - Props with default values are always present
|
|
501
|
+
*
|
|
502
|
+
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
|
|
503
|
+
*/
|
|
504
|
+
type ExtractPropTypes<O> = {
|
|
505
|
+
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
|
|
506
|
+
} & {
|
|
507
|
+
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
508
|
+
};
|
|
509
|
+
type ExtractDefaultPropTypes<O> = O extends object ? {
|
|
510
|
+
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
|
|
511
|
+
} : {};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
Runtime helper for applying directives to a vnode. Example usage:
|
|
515
|
+
|
|
516
|
+
const comp = resolveComponent('comp')
|
|
517
|
+
const foo = resolveDirective('foo')
|
|
518
|
+
const bar = resolveDirective('bar')
|
|
519
|
+
|
|
520
|
+
return withDirectives(h(comp), [
|
|
521
|
+
[foo, this.x],
|
|
522
|
+
[bar, this.y]
|
|
523
|
+
])
|
|
524
|
+
*/
|
|
525
|
+
|
|
526
|
+
interface DirectiveBinding<V = any> {
|
|
527
|
+
instance: ComponentPublicInstance | null;
|
|
528
|
+
value: V;
|
|
529
|
+
oldValue: V | null;
|
|
530
|
+
arg?: string;
|
|
531
|
+
modifiers: DirectiveModifiers;
|
|
532
|
+
dir: ObjectDirective<any, V>;
|
|
533
|
+
}
|
|
534
|
+
type DirectiveHook<T = any, Prev = VNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode<any, T>, prevVNode: Prev) => void;
|
|
535
|
+
type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
536
|
+
interface ObjectDirective<T = any, V = any> {
|
|
537
|
+
created?: DirectiveHook<T, null, V>;
|
|
538
|
+
beforeMount?: DirectiveHook<T, null, V>;
|
|
539
|
+
mounted?: DirectiveHook<T, null, V>;
|
|
540
|
+
beforeUpdate?: DirectiveHook<T, VNode<any, T>, V>;
|
|
541
|
+
updated?: DirectiveHook<T, VNode<any, T>, V>;
|
|
542
|
+
beforeUnmount?: DirectiveHook<T, null, V>;
|
|
543
|
+
unmounted?: DirectiveHook<T, null, V>;
|
|
544
|
+
getSSRProps?: SSRDirectiveHook;
|
|
545
|
+
deep?: boolean;
|
|
546
|
+
}
|
|
547
|
+
type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
|
|
548
|
+
type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
|
|
549
|
+
type DirectiveModifiers = Record<string, boolean>;
|
|
550
|
+
|
|
551
|
+
declare enum DeprecationTypes$1 {
|
|
552
|
+
GLOBAL_MOUNT = "GLOBAL_MOUNT",
|
|
553
|
+
GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER",
|
|
554
|
+
GLOBAL_EXTEND = "GLOBAL_EXTEND",
|
|
555
|
+
GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE",
|
|
556
|
+
GLOBAL_SET = "GLOBAL_SET",
|
|
557
|
+
GLOBAL_DELETE = "GLOBAL_DELETE",
|
|
558
|
+
GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE",
|
|
559
|
+
GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL",
|
|
560
|
+
CONFIG_SILENT = "CONFIG_SILENT",
|
|
561
|
+
CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS",
|
|
562
|
+
CONFIG_KEY_CODES = "CONFIG_KEY_CODES",
|
|
563
|
+
CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP",
|
|
564
|
+
CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS",
|
|
565
|
+
CONFIG_WHITESPACE = "CONFIG_WHITESPACE",
|
|
566
|
+
CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS",
|
|
567
|
+
INSTANCE_SET = "INSTANCE_SET",
|
|
568
|
+
INSTANCE_DELETE = "INSTANCE_DELETE",
|
|
569
|
+
INSTANCE_DESTROY = "INSTANCE_DESTROY",
|
|
570
|
+
INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER",
|
|
571
|
+
INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS",
|
|
572
|
+
INSTANCE_CHILDREN = "INSTANCE_CHILDREN",
|
|
573
|
+
INSTANCE_LISTENERS = "INSTANCE_LISTENERS",
|
|
574
|
+
INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS",
|
|
575
|
+
INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE",
|
|
576
|
+
OPTIONS_DATA_FN = "OPTIONS_DATA_FN",
|
|
577
|
+
OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE",
|
|
578
|
+
OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY",
|
|
579
|
+
OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
|
|
580
|
+
WATCH_ARRAY = "WATCH_ARRAY",
|
|
581
|
+
PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
|
|
582
|
+
V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
|
|
583
|
+
CUSTOM_DIR = "CUSTOM_DIR",
|
|
584
|
+
ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
|
|
585
|
+
ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION",
|
|
586
|
+
TRANSITION_CLASSES = "TRANSITION_CLASSES",
|
|
587
|
+
TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT",
|
|
588
|
+
COMPONENT_ASYNC = "COMPONENT_ASYNC",
|
|
589
|
+
COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL",
|
|
590
|
+
COMPONENT_V_MODEL = "COMPONENT_V_MODEL",
|
|
591
|
+
RENDER_FUNCTION = "RENDER_FUNCTION",
|
|
592
|
+
FILTERS = "FILTERS",
|
|
593
|
+
PRIVATE_APIS = "PRIVATE_APIS"
|
|
594
|
+
}
|
|
595
|
+
type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & {
|
|
596
|
+
MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3);
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Interface for declaring custom options.
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* ```ts
|
|
604
|
+
* declare module '@vue/runtime-core' {
|
|
605
|
+
* interface ComponentCustomOptions {
|
|
606
|
+
* beforeRouteUpdate?(
|
|
607
|
+
* to: Route,
|
|
608
|
+
* from: Route,
|
|
609
|
+
* next: () => void
|
|
610
|
+
* ): void
|
|
611
|
+
* }
|
|
612
|
+
* }
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
interface ComponentCustomOptions {
|
|
616
|
+
}
|
|
617
|
+
type RenderFunction = () => VNodeChild;
|
|
618
|
+
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 {
|
|
619
|
+
setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
|
|
620
|
+
name?: string;
|
|
621
|
+
template?: string | object;
|
|
622
|
+
render?: Function;
|
|
623
|
+
components?: Record<string, Component>;
|
|
624
|
+
directives?: Record<string, Directive>;
|
|
625
|
+
inheritAttrs?: boolean;
|
|
626
|
+
emits?: (E | EE[]) & ThisType<void>;
|
|
627
|
+
slots?: S;
|
|
628
|
+
expose?: string[];
|
|
629
|
+
serverPrefetch?(): void | Promise<any>;
|
|
630
|
+
compilerOptions?: RuntimeCompilerOptions;
|
|
631
|
+
call?: (this: unknown, ...args: unknown[]) => never;
|
|
632
|
+
__isFragment?: never;
|
|
633
|
+
__isTeleport?: never;
|
|
634
|
+
__isSuspense?: never;
|
|
635
|
+
__defaults?: Defaults;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Subset of compiler options that makes sense for the runtime.
|
|
639
|
+
*/
|
|
640
|
+
interface RuntimeCompilerOptions {
|
|
641
|
+
isCustomElement?: (tag: string) => boolean;
|
|
642
|
+
whitespace?: 'preserve' | 'condense';
|
|
643
|
+
comments?: boolean;
|
|
644
|
+
delimiters?: [string, string];
|
|
645
|
+
}
|
|
646
|
+
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> & {
|
|
647
|
+
props?: undefined;
|
|
648
|
+
} & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>;
|
|
649
|
+
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>>>;
|
|
650
|
+
type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>;
|
|
651
|
+
type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
652
|
+
interface MethodOptions {
|
|
653
|
+
[key: string]: Function;
|
|
654
|
+
}
|
|
655
|
+
type ExtractComputedReturns<T extends any> = {
|
|
656
|
+
[key in keyof T]: T[key] extends {
|
|
657
|
+
get: (...args: any[]) => infer TReturn;
|
|
658
|
+
} ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
|
|
659
|
+
};
|
|
660
|
+
type ObjectWatchOptionItem = {
|
|
661
|
+
handler: WatchCallback | string;
|
|
662
|
+
} & WatchOptions;
|
|
663
|
+
type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem;
|
|
664
|
+
type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[];
|
|
665
|
+
type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
|
|
666
|
+
type ComponentProvideOptions = ObjectProvideOptions | Function;
|
|
667
|
+
type ObjectProvideOptions = Record<string | symbol, unknown>;
|
|
668
|
+
type ComponentInjectOptions = string[] | ObjectInjectOptions;
|
|
669
|
+
type ObjectInjectOptions = Record<string | symbol, string | symbol | {
|
|
670
|
+
from?: string | symbol;
|
|
671
|
+
default?: unknown;
|
|
672
|
+
}>;
|
|
673
|
+
type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
|
|
674
|
+
[K in T[number]]?: unknown;
|
|
675
|
+
} : T extends ObjectInjectOptions ? {
|
|
676
|
+
[K in keyof T]?: unknown;
|
|
677
|
+
} : never;
|
|
678
|
+
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
|
|
679
|
+
compatConfig?: CompatConfig;
|
|
680
|
+
[key: string]: any;
|
|
681
|
+
data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
682
|
+
computed?: C;
|
|
683
|
+
methods?: M;
|
|
684
|
+
watch?: ComponentWatchOptions;
|
|
685
|
+
provide?: ComponentProvideOptions;
|
|
686
|
+
inject?: I | II[];
|
|
687
|
+
filters?: Record<string, Function>;
|
|
688
|
+
mixins?: Mixin[];
|
|
689
|
+
extends?: Extends;
|
|
690
|
+
beforeCreate?(): void;
|
|
691
|
+
created?(): void;
|
|
692
|
+
beforeMount?(): void;
|
|
693
|
+
mounted?(): void;
|
|
694
|
+
beforeUpdate?(): void;
|
|
695
|
+
updated?(): void;
|
|
696
|
+
activated?(): void;
|
|
697
|
+
deactivated?(): void;
|
|
698
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
699
|
+
beforeDestroy?(): void;
|
|
700
|
+
beforeUnmount?(): void;
|
|
701
|
+
/** @deprecated use `unmounted` instead */
|
|
702
|
+
destroyed?(): void;
|
|
703
|
+
unmounted?(): void;
|
|
704
|
+
renderTracked?: DebuggerHook;
|
|
705
|
+
renderTriggered?: DebuggerHook;
|
|
706
|
+
errorCaptured?: ErrorCapturedHook;
|
|
707
|
+
/**
|
|
708
|
+
* runtime compile only
|
|
709
|
+
* @deprecated use `compilerOptions.delimiters` instead.
|
|
710
|
+
*/
|
|
711
|
+
delimiters?: [string, string];
|
|
712
|
+
/**
|
|
713
|
+
* #3468
|
|
714
|
+
*
|
|
715
|
+
* type-only, used to assist Mixin's type inference,
|
|
716
|
+
* typescript will try to simplify the inferred `Mixin` type,
|
|
717
|
+
* with the `__differentiator`, typescript won't be able to combine different mixins,
|
|
718
|
+
* because the `__differentiator` will be different
|
|
719
|
+
*/
|
|
720
|
+
__differentiator?: keyof D | keyof C | keyof M;
|
|
721
|
+
}
|
|
722
|
+
type MergedHook<T = () => void> = T | T[];
|
|
723
|
+
type MergedComponentOptionsOverride = {
|
|
724
|
+
beforeCreate?: MergedHook;
|
|
725
|
+
created?: MergedHook;
|
|
726
|
+
beforeMount?: MergedHook;
|
|
727
|
+
mounted?: MergedHook;
|
|
728
|
+
beforeUpdate?: MergedHook;
|
|
729
|
+
updated?: MergedHook;
|
|
730
|
+
activated?: MergedHook;
|
|
731
|
+
deactivated?: MergedHook;
|
|
732
|
+
/** @deprecated use `beforeUnmount` instead */
|
|
733
|
+
beforeDestroy?: MergedHook;
|
|
734
|
+
beforeUnmount?: MergedHook;
|
|
735
|
+
/** @deprecated use `unmounted` instead */
|
|
736
|
+
destroyed?: MergedHook;
|
|
737
|
+
unmounted?: MergedHook;
|
|
738
|
+
renderTracked?: MergedHook<DebuggerHook>;
|
|
739
|
+
renderTriggered?: MergedHook<DebuggerHook>;
|
|
740
|
+
errorCaptured?: MergedHook<ErrorCapturedHook>;
|
|
741
|
+
};
|
|
742
|
+
type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults';
|
|
743
|
+
type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = {
|
|
744
|
+
P: P;
|
|
745
|
+
B: B;
|
|
746
|
+
D: D;
|
|
747
|
+
C: C;
|
|
748
|
+
M: M;
|
|
749
|
+
Defaults: Defaults;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
interface InjectionKey<T> extends Symbol {
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
756
|
+
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
757
|
+
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;
|
|
758
|
+
|
|
759
|
+
interface App<HostElement = any> {
|
|
760
|
+
version: string;
|
|
761
|
+
config: AppConfig;
|
|
762
|
+
use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): this;
|
|
763
|
+
use<Options>(plugin: Plugin<Options>, options: Options): this;
|
|
764
|
+
mixin(mixin: ComponentOptions): this;
|
|
765
|
+
component(name: string): Component | undefined;
|
|
766
|
+
component(name: string, component: Component | DefineComponent): this;
|
|
767
|
+
directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
|
|
768
|
+
directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
|
|
769
|
+
mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
|
|
770
|
+
unmount(): void;
|
|
771
|
+
provide<T>(key: InjectionKey<T> | string, value: T): this;
|
|
772
|
+
/**
|
|
773
|
+
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
774
|
+
* to variables provided via `app.provide()`.
|
|
775
|
+
*
|
|
776
|
+
* @param fn - function to run with the app as active instance
|
|
777
|
+
*/
|
|
778
|
+
runWithContext<T>(fn: () => T): T;
|
|
779
|
+
_uid: number;
|
|
780
|
+
_component: ConcreteComponent;
|
|
781
|
+
_props: Data | null;
|
|
782
|
+
_container: HostElement | null;
|
|
783
|
+
_context: AppContext;
|
|
784
|
+
_instance: ComponentInternalInstance | null;
|
|
785
|
+
/**
|
|
786
|
+
* v2 compat only
|
|
787
|
+
*/
|
|
788
|
+
filter?(name: string): Function | undefined;
|
|
789
|
+
filter?(name: string, filter: Function): this;
|
|
790
|
+
}
|
|
791
|
+
type OptionMergeFunction = (to: unknown, from: unknown) => any;
|
|
792
|
+
interface AppConfig {
|
|
793
|
+
readonly isNativeTag: (tag: string) => boolean;
|
|
794
|
+
performance: boolean;
|
|
795
|
+
optionMergeStrategies: Record<string, OptionMergeFunction>;
|
|
796
|
+
globalProperties: ComponentCustomProperties & Record<string, any>;
|
|
797
|
+
errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
|
|
798
|
+
warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
|
|
799
|
+
/**
|
|
800
|
+
* Options to pass to `@vue/compiler-dom`.
|
|
801
|
+
* Only supported in runtime compiler build.
|
|
802
|
+
*/
|
|
803
|
+
compilerOptions: RuntimeCompilerOptions;
|
|
804
|
+
/**
|
|
805
|
+
* @deprecated use config.compilerOptions.isCustomElement
|
|
806
|
+
*/
|
|
807
|
+
isCustomElement?: (tag: string) => boolean;
|
|
808
|
+
/**
|
|
809
|
+
* TODO document for 3.5
|
|
810
|
+
* Enable warnings for computed getters that recursively trigger itself.
|
|
811
|
+
*/
|
|
812
|
+
warnRecursiveComputed?: boolean;
|
|
813
|
+
}
|
|
814
|
+
interface AppContext {
|
|
815
|
+
app: App;
|
|
816
|
+
config: AppConfig;
|
|
817
|
+
mixins: ComponentOptions[];
|
|
818
|
+
components: Record<string, Component>;
|
|
819
|
+
directives: Record<string, Directive>;
|
|
820
|
+
provides: Record<string | symbol, any>;
|
|
821
|
+
}
|
|
822
|
+
type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any;
|
|
823
|
+
type ObjectPlugin<Options = any[]> = {
|
|
824
|
+
install: PluginInstallFunction<Options>;
|
|
825
|
+
};
|
|
826
|
+
type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
|
|
827
|
+
type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>;
|
|
828
|
+
|
|
829
|
+
type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
830
|
+
interface TeleportProps {
|
|
831
|
+
to: string | RendererElement | null | undefined;
|
|
832
|
+
disabled?: boolean;
|
|
833
|
+
}
|
|
834
|
+
declare const TeleportImpl: {
|
|
835
|
+
name: string;
|
|
836
|
+
__isTeleport: boolean;
|
|
837
|
+
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;
|
|
838
|
+
remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
|
|
839
|
+
move: typeof moveTeleport;
|
|
840
|
+
hydrate: typeof hydrateTeleport;
|
|
841
|
+
};
|
|
842
|
+
declare enum TeleportMoveTypes {
|
|
843
|
+
TARGET_CHANGE = 0,
|
|
844
|
+
TOGGLE = 1,// enable / disable
|
|
845
|
+
REORDER = 2
|
|
846
|
+
}
|
|
847
|
+
declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
|
|
848
|
+
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;
|
|
849
|
+
declare const Teleport: {
|
|
850
|
+
new (): {
|
|
851
|
+
$props: VNodeProps & TeleportProps;
|
|
852
|
+
$slots: {
|
|
853
|
+
default(): VNode[];
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
__isTeleport: true;
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
declare const Fragment: {
|
|
860
|
+
new (): {
|
|
861
|
+
$props: VNodeProps;
|
|
862
|
+
};
|
|
863
|
+
__isFragment: true;
|
|
864
|
+
};
|
|
865
|
+
declare const Text: unique symbol;
|
|
866
|
+
declare const Comment: unique symbol;
|
|
867
|
+
declare const Static: unique symbol;
|
|
868
|
+
type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
|
|
869
|
+
type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
|
|
870
|
+
type VNodeNormalizedRefAtom = {
|
|
871
|
+
i: ComponentInternalInstance;
|
|
872
|
+
r: VNodeRef;
|
|
873
|
+
k?: string;
|
|
874
|
+
f?: boolean;
|
|
875
|
+
};
|
|
876
|
+
type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
|
|
877
|
+
type VNodeMountHook = (vnode: VNode) => void;
|
|
878
|
+
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
|
|
879
|
+
type VNodeProps = {
|
|
880
|
+
key?: string | number | symbol;
|
|
881
|
+
ref?: VNodeRef;
|
|
882
|
+
ref_for?: boolean;
|
|
883
|
+
ref_key?: string;
|
|
884
|
+
onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
|
|
885
|
+
onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
|
|
886
|
+
onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
887
|
+
onVnodeUpdated?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
888
|
+
onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
|
|
889
|
+
onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
|
|
890
|
+
};
|
|
891
|
+
type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
|
|
892
|
+
type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
|
|
893
|
+
type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
|
|
894
|
+
type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
|
|
895
|
+
interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraProps = {
|
|
896
|
+
[key: string]: any;
|
|
897
|
+
}> {
|
|
898
|
+
type: VNodeTypes;
|
|
899
|
+
props: (VNodeProps & ExtraProps) | null;
|
|
900
|
+
key: string | number | symbol | null;
|
|
901
|
+
ref: VNodeNormalizedRef | null;
|
|
902
|
+
/**
|
|
903
|
+
* SFC only. This is assigned on vnode creation using currentScopeId
|
|
904
|
+
* which is set alongside currentRenderingInstance.
|
|
905
|
+
*/
|
|
906
|
+
scopeId: string | null;
|
|
907
|
+
children: VNodeNormalizedChildren;
|
|
908
|
+
component: ComponentInternalInstance | null;
|
|
909
|
+
dirs: DirectiveBinding[] | null;
|
|
910
|
+
transition: TransitionHooks<HostElement> | null;
|
|
911
|
+
el: HostNode | null;
|
|
912
|
+
anchor: HostNode | null;
|
|
913
|
+
target: HostElement | null;
|
|
914
|
+
targetAnchor: HostNode | null;
|
|
915
|
+
suspense: SuspenseBoundary | null;
|
|
916
|
+
shapeFlag: number;
|
|
917
|
+
patchFlag: number;
|
|
918
|
+
appContext: AppContext | null;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
type Data = Record<string, unknown>;
|
|
922
|
+
/**
|
|
923
|
+
* For extending allowed non-declared props on components in TSX
|
|
924
|
+
*/
|
|
925
|
+
interface ComponentCustomProps {
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Default allowed non-declared props on component in TSX
|
|
929
|
+
*/
|
|
930
|
+
interface AllowedComponentProps {
|
|
931
|
+
class?: unknown;
|
|
932
|
+
style?: unknown;
|
|
933
|
+
}
|
|
934
|
+
interface ComponentInternalOptions {
|
|
935
|
+
/**
|
|
936
|
+
* Compat build only, for bailing out of certain compatibility behavior
|
|
937
|
+
*/
|
|
938
|
+
__isBuiltIn?: boolean;
|
|
939
|
+
/**
|
|
940
|
+
* This one should be exposed so that devtools can make use of it
|
|
941
|
+
*/
|
|
942
|
+
__file?: string;
|
|
943
|
+
/**
|
|
944
|
+
* name inferred from filename
|
|
945
|
+
*/
|
|
946
|
+
__name?: string;
|
|
947
|
+
}
|
|
948
|
+
interface FunctionalComponent<P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>> extends ComponentInternalOptions {
|
|
949
|
+
(props: P & EmitsToProps<EE>, ctx: Omit<SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, 'expose'>): any;
|
|
950
|
+
props?: ComponentPropsOptions<P>;
|
|
951
|
+
emits?: EE | (keyof EE)[];
|
|
952
|
+
slots?: IfAny<S, Slots, SlotsType<S>>;
|
|
953
|
+
inheritAttrs?: boolean;
|
|
954
|
+
displayName?: string;
|
|
955
|
+
compatConfig?: CompatConfig;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Concrete component type matches its actual value: it's either an options
|
|
959
|
+
* object, or a function. Use this where the code expects to work with actual
|
|
960
|
+
* values, e.g. checking if its a function or not. This is mostly for internal
|
|
961
|
+
* implementation code.
|
|
962
|
+
*/
|
|
963
|
+
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>;
|
|
964
|
+
/**
|
|
965
|
+
* A type used in public APIs where a component type is expected.
|
|
966
|
+
* The constructor type is an artificial type returned by defineComponent().
|
|
967
|
+
*/
|
|
968
|
+
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>;
|
|
969
|
+
|
|
970
|
+
type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
|
|
971
|
+
attrs: Data;
|
|
972
|
+
slots: UnwrapSlotsType<S>;
|
|
973
|
+
emit: EmitFn<E>;
|
|
974
|
+
expose: (exposed?: Record<string, any>) => void;
|
|
975
|
+
} : never;
|
|
976
|
+
/**
|
|
977
|
+
* We expose a subset of properties on the internal instance as they are
|
|
978
|
+
* useful for advanced external libraries and tools.
|
|
979
|
+
*/
|
|
980
|
+
interface ComponentInternalInstance {
|
|
981
|
+
uid: number;
|
|
982
|
+
type: ConcreteComponent;
|
|
983
|
+
parent: ComponentInternalInstance | null;
|
|
984
|
+
root: ComponentInternalInstance;
|
|
985
|
+
appContext: AppContext;
|
|
986
|
+
/**
|
|
987
|
+
* Vnode representing this component in its parent's vdom tree
|
|
988
|
+
*/
|
|
989
|
+
vnode: VNode;
|
|
990
|
+
/**
|
|
991
|
+
* Root vnode of this component's own vdom tree
|
|
992
|
+
*/
|
|
993
|
+
subTree: VNode;
|
|
994
|
+
/**
|
|
995
|
+
* Render effect instance
|
|
996
|
+
*/
|
|
997
|
+
effect: ReactiveEffect;
|
|
998
|
+
/**
|
|
999
|
+
* Bound effect runner to be passed to schedulers
|
|
1000
|
+
*/
|
|
1001
|
+
update: SchedulerJob;
|
|
1002
|
+
proxy: ComponentPublicInstance | null;
|
|
1003
|
+
exposed: Record<string, any> | null;
|
|
1004
|
+
exposeProxy: Record<string, any> | null;
|
|
1005
|
+
data: Data;
|
|
1006
|
+
props: Data;
|
|
1007
|
+
attrs: Data;
|
|
1008
|
+
slots: InternalSlots;
|
|
1009
|
+
refs: Data;
|
|
1010
|
+
emit: EmitFn;
|
|
1011
|
+
attrsProxy: Data | null;
|
|
1012
|
+
slotsProxy: Slots | null;
|
|
1013
|
+
isMounted: boolean;
|
|
1014
|
+
isUnmounted: boolean;
|
|
1015
|
+
isDeactivated: boolean;
|
|
1016
|
+
}
|
|
1017
|
+
type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
1018
|
+
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1019
|
+
interface WatchOptionsBase extends DebuggerOptions {
|
|
1020
|
+
flush?: 'pre' | 'post' | 'sync';
|
|
1021
|
+
}
|
|
1022
|
+
interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
|
|
1023
|
+
immediate?: Immediate;
|
|
1024
|
+
deep?: boolean;
|
|
1025
|
+
once?: boolean;
|
|
1026
|
+
}
|
|
1027
|
+
type WatchStopHandle = () => void;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
1031
|
+
* expected argument is the same as the component `props` option.
|
|
1032
|
+
*
|
|
1033
|
+
* Example runtime declaration:
|
|
1034
|
+
* ```js
|
|
1035
|
+
* // using Array syntax
|
|
1036
|
+
* const props = defineProps(['foo', 'bar'])
|
|
1037
|
+
* // using Object syntax
|
|
1038
|
+
* const props = defineProps({
|
|
1039
|
+
* foo: String,
|
|
1040
|
+
* bar: {
|
|
1041
|
+
* type: Number,
|
|
1042
|
+
* required: true
|
|
1043
|
+
* }
|
|
1044
|
+
* })
|
|
1045
|
+
* ```
|
|
1046
|
+
*
|
|
1047
|
+
* Equivalent type-based declaration:
|
|
1048
|
+
* ```ts
|
|
1049
|
+
* // will be compiled into equivalent runtime declarations
|
|
1050
|
+
* const props = defineProps<{
|
|
1051
|
+
* foo?: string
|
|
1052
|
+
* bar: number
|
|
1053
|
+
* }>()
|
|
1054
|
+
* ```
|
|
1055
|
+
*
|
|
1056
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1057
|
+
*
|
|
1058
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1059
|
+
* output and should **not** be actually called at runtime.
|
|
1060
|
+
*/
|
|
1061
|
+
declare function defineProps<PropNames extends string = string>(props: PropNames[]): Prettify<Readonly<{
|
|
1062
|
+
[key in PropNames]?: any;
|
|
1063
|
+
}>>;
|
|
1064
|
+
declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
|
|
1065
|
+
declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
|
|
1066
|
+
type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
|
1067
|
+
readonly [K in BKeys]-?: boolean;
|
|
1068
|
+
};
|
|
1069
|
+
type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
|
|
1070
|
+
/**
|
|
1071
|
+
* Vue `<script setup>` compiler macro for declaring a component's emitted
|
|
1072
|
+
* events. The expected argument is the same as the component `emits` option.
|
|
1073
|
+
*
|
|
1074
|
+
* Example runtime declaration:
|
|
1075
|
+
* ```js
|
|
1076
|
+
* const emit = defineEmits(['change', 'update'])
|
|
1077
|
+
* ```
|
|
1078
|
+
*
|
|
1079
|
+
* Example type-based declaration:
|
|
1080
|
+
* ```ts
|
|
1081
|
+
* const emit = defineEmits<{
|
|
1082
|
+
* // <eventName>: <expected arguments>
|
|
1083
|
+
* change: []
|
|
1084
|
+
* update: [value: string] // named tuple syntax
|
|
1085
|
+
* }>()
|
|
1086
|
+
*
|
|
1087
|
+
* emit('change')
|
|
1088
|
+
* emit('update', 1)
|
|
1089
|
+
* ```
|
|
1090
|
+
*
|
|
1091
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1092
|
+
* output and should **not** be actually called at runtime.
|
|
1093
|
+
*
|
|
1094
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
|
|
1095
|
+
*/
|
|
1096
|
+
declare function defineEmits<EE extends string = string>(emitOptions: EE[]): EmitFn<EE[]>;
|
|
1097
|
+
declare function defineEmits<E extends EmitsOptions = EmitsOptions>(emitOptions: E): EmitFn<E>;
|
|
1098
|
+
declare function defineEmits<T extends ((...args: any[]) => any) | Record<string, any[]>>(): T extends (...args: any[]) => any ? T : ShortEmits<T>;
|
|
1099
|
+
type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
1100
|
+
type ShortEmits<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
1101
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
1102
|
+
}>>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Vue `<script setup>` compiler macro for declaring a component's exposed
|
|
1105
|
+
* instance properties when it is accessed by a parent component via template
|
|
1106
|
+
* refs.
|
|
1107
|
+
*
|
|
1108
|
+
* `<script setup>` components are closed by default - i.e. variables inside
|
|
1109
|
+
* the `<script setup>` scope is not exposed to parent unless explicitly exposed
|
|
1110
|
+
* via `defineExpose`.
|
|
1111
|
+
*
|
|
1112
|
+
* This is only usable inside `<script setup>`, is compiled away in the
|
|
1113
|
+
* output and should **not** be actually called at runtime.
|
|
1114
|
+
*
|
|
1115
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
|
|
1116
|
+
*/
|
|
1117
|
+
declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
1118
|
+
/**
|
|
1119
|
+
* Vue `<script setup>` compiler macro for declaring a component's additional
|
|
1120
|
+
* options. This should be used only for options that cannot be expressed via
|
|
1121
|
+
* Composition API - e.g. `inheritAttrs`.
|
|
1122
|
+
*
|
|
1123
|
+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
|
|
1124
|
+
*/
|
|
1125
|
+
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> & {
|
|
1126
|
+
emits?: undefined;
|
|
1127
|
+
expose?: undefined;
|
|
1128
|
+
slots?: undefined;
|
|
1129
|
+
}): void;
|
|
1130
|
+
declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1131
|
+
type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
|
|
1132
|
+
ModelRef<T, M>,
|
|
1133
|
+
Record<M, true | undefined>
|
|
1134
|
+
];
|
|
1135
|
+
type DefineModelOptions<T = any> = {
|
|
1136
|
+
get?: (v: T) => any;
|
|
1137
|
+
set?: (v: T) => any;
|
|
1138
|
+
};
|
|
1139
|
+
/**
|
|
1140
|
+
* Vue `<script setup>` compiler macro for declaring a
|
|
1141
|
+
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
1142
|
+
* component. This will declare a prop with the same name and a corresponding
|
|
1143
|
+
* `update:propName` event.
|
|
1144
|
+
*
|
|
1145
|
+
* If the first argument is a string, it will be used as the prop name;
|
|
1146
|
+
* Otherwise the prop name will default to "modelValue". In both cases, you
|
|
1147
|
+
* can also pass an additional object which will be used as the prop's options.
|
|
1148
|
+
*
|
|
1149
|
+
* The returned ref behaves differently depending on whether the parent
|
|
1150
|
+
* provided the corresponding v-model props or not:
|
|
1151
|
+
* - If yes, the returned ref's value will always be in sync with the parent
|
|
1152
|
+
* prop.
|
|
1153
|
+
* - If not, the returned ref will behave like a normal local ref.
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* ```ts
|
|
1157
|
+
* // default model (consumed via `v-model`)
|
|
1158
|
+
* const modelValue = defineModel<string>()
|
|
1159
|
+
* modelValue.value = "hello"
|
|
1160
|
+
*
|
|
1161
|
+
* // default model with options
|
|
1162
|
+
* const modelValue = defineModel<string>({ required: true })
|
|
1163
|
+
*
|
|
1164
|
+
* // with specified name (consumed via `v-model:count`)
|
|
1165
|
+
* const count = defineModel<number>('count')
|
|
1166
|
+
* count.value++
|
|
1167
|
+
*
|
|
1168
|
+
* // with specified name and default value
|
|
1169
|
+
* const count = defineModel<number>('count', { default: 0 })
|
|
1170
|
+
* ```
|
|
1171
|
+
*/
|
|
1172
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1173
|
+
required: true;
|
|
1174
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1175
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1176
|
+
default: any;
|
|
1177
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1178
|
+
declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1179
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1180
|
+
required: true;
|
|
1181
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1182
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1183
|
+
default: any;
|
|
1184
|
+
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
1185
|
+
declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1186
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1187
|
+
type MappedOmit<T, K extends keyof any> = {
|
|
1188
|
+
[P in keyof T as P extends K ? never : P]: T[P];
|
|
1189
|
+
};
|
|
1190
|
+
type InferDefaults<T> = {
|
|
1191
|
+
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
1192
|
+
};
|
|
1193
|
+
type NativeType = null | number | string | boolean | symbol | Function;
|
|
1194
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
1195
|
+
type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<MappedOmit<T, keyof Defaults>> & {
|
|
1196
|
+
readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
|
|
1197
|
+
} & {
|
|
1198
|
+
readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* Vue `<script setup>` compiler macro for providing props default values when
|
|
1202
|
+
* using type-based `defineProps` declaration.
|
|
1203
|
+
*
|
|
1204
|
+
* Example usage:
|
|
1205
|
+
* ```ts
|
|
1206
|
+
* withDefaults(defineProps<{
|
|
1207
|
+
* size?: number
|
|
1208
|
+
* labels?: string[]
|
|
1209
|
+
* }>(), {
|
|
1210
|
+
* size: 3,
|
|
1211
|
+
* labels: () => ['default label']
|
|
1212
|
+
* })
|
|
1213
|
+
* ```
|
|
1214
|
+
*
|
|
1215
|
+
* This is only usable inside `<script setup>`, is compiled away in the output
|
|
1216
|
+
* and should **not** be actually called at runtime.
|
|
1217
|
+
*
|
|
1218
|
+
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
|
|
1219
|
+
*/
|
|
1220
|
+
declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1221
|
+
|
|
1222
|
+
declare module '@vue/reactivity' {
|
|
1223
|
+
interface RefUnwrapBailTypes {
|
|
1224
|
+
runtimeCoreBailTypes: VNode | {
|
|
1225
|
+
$: ComponentInternalInstance;
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
// Note: this file is auto concatenated to the end of the bundled d.ts during
|
|
1230
|
+
// build.
|
|
1231
|
+
type _defineProps = typeof defineProps
|
|
1232
|
+
type _defineEmits = typeof defineEmits
|
|
1233
|
+
type _defineExpose = typeof defineExpose
|
|
1234
|
+
type _defineOptions = typeof defineOptions
|
|
1235
|
+
type _defineSlots = typeof defineSlots
|
|
1236
|
+
type _defineModel = typeof defineModel
|
|
1237
|
+
type _withDefaults = typeof withDefaults
|
|
1238
|
+
|
|
1239
|
+
declare global {
|
|
1240
|
+
const defineProps: _defineProps
|
|
1241
|
+
const defineEmits: _defineEmits
|
|
1242
|
+
const defineExpose: _defineExpose
|
|
1243
|
+
const defineOptions: _defineOptions
|
|
1244
|
+
const defineSlots: _defineSlots
|
|
1245
|
+
const defineModel: _defineModel
|
|
1246
|
+
const withDefaults: _withDefaults
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
type SSRContext = {
|
|
1250
|
+
[key: string]: any;
|
|
1251
|
+
teleports?: Record<string, string>;
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1254
|
+
declare namespace Token {
|
|
1255
|
+
type Nesting = 1 | 0 | -1;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Create new token and fill passed properties.
|
|
1260
|
+
*/
|
|
1261
|
+
declare class Token {
|
|
1262
|
+
constructor(type: string, tag: string, nesting: Token.Nesting);
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Type of the token, e.g. "paragraph_open"
|
|
1266
|
+
*/
|
|
1267
|
+
type: string;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* HTML tag name, e.g. "p"
|
|
1271
|
+
*/
|
|
1272
|
+
tag: string;
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* HTML attributes. Format: `[[name1, value1], [name2, value2]]`
|
|
1276
|
+
*/
|
|
1277
|
+
attrs: Array<[string, string]> | null;
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* Source map info. Format: `[line_begin, line_end]`
|
|
1281
|
+
*/
|
|
1282
|
+
map: [number, number] | null;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Level change (number in {-1, 0, 1} set), where:
|
|
1286
|
+
*
|
|
1287
|
+
* - `1` means the tag is opening
|
|
1288
|
+
* - `0` means the tag is self-closing
|
|
1289
|
+
* - `-1` means the tag is closing
|
|
1290
|
+
*/
|
|
1291
|
+
nesting: 1 | 0 | -1;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* nesting level, the same as `state.level`
|
|
1295
|
+
*/
|
|
1296
|
+
level: number;
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* An array of child nodes (inline and img tokens)
|
|
1300
|
+
*/
|
|
1301
|
+
children: Token[] | null;
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* In a case of self-closing tag (code, html, fence, etc.),
|
|
1305
|
+
* it has contents of this tag.
|
|
1306
|
+
*/
|
|
1307
|
+
content: string;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
1311
|
+
*/
|
|
1312
|
+
markup: string;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Fence info string
|
|
1316
|
+
*/
|
|
1317
|
+
info: string;
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* A place for plugins to store an arbitrary data
|
|
1321
|
+
*/
|
|
1322
|
+
meta: any;
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* True for block-level tokens, false for inline tokens.
|
|
1326
|
+
* Used in renderer to calculate line breaks
|
|
1327
|
+
*/
|
|
1328
|
+
block: boolean;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* If it's true, ignore this element when rendering. Used for tight lists
|
|
1332
|
+
* to hide paragraphs.
|
|
1333
|
+
*/
|
|
1334
|
+
hidden: boolean;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Search attribute index by name.
|
|
1338
|
+
*/
|
|
1339
|
+
attrIndex(name: string): number;
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Add `[name, value]` attribute to list. Init attrs if necessary
|
|
1343
|
+
*/
|
|
1344
|
+
attrPush(attrData: [string, string]): void;
|
|
1345
|
+
|
|
1346
|
+
/**
|
|
1347
|
+
* Set `name` attribute to `value`. Override old value if exists.
|
|
1348
|
+
*/
|
|
1349
|
+
attrSet(name: string, value: string): void;
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Get the value of attribute `name`, or null if it does not exist.
|
|
1353
|
+
*/
|
|
1354
|
+
attrGet(name: string): string | null;
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* Join value to existing attribute via space. Or create new attribute if not
|
|
1358
|
+
* exists. Useful to operate with token classes.
|
|
1359
|
+
*/
|
|
1360
|
+
attrJoin(name: string, value: string): void;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
declare namespace __token {
|
|
1364
|
+
export { Token as default };
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
declare const LinkifyIt: {
|
|
1368
|
+
(
|
|
1369
|
+
schemas?: LinkifyIt.SchemaRules | LinkifyIt.Options,
|
|
1370
|
+
options?: LinkifyIt.Options,
|
|
1371
|
+
): LinkifyIt.LinkifyIt;
|
|
1372
|
+
new(
|
|
1373
|
+
schemas?: LinkifyIt.SchemaRules | LinkifyIt.Options,
|
|
1374
|
+
options?: LinkifyIt.Options,
|
|
1375
|
+
): LinkifyIt.LinkifyIt;
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
declare namespace LinkifyIt {
|
|
1379
|
+
type Validate = (text: string, pos: number, self: LinkifyIt) => number | boolean;
|
|
1380
|
+
|
|
1381
|
+
interface FullRule {
|
|
1382
|
+
validate: string | RegExp | Validate;
|
|
1383
|
+
normalize?: ((match: Match) => void) | undefined;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
type Rule = string | FullRule;
|
|
1387
|
+
|
|
1388
|
+
interface SchemaRules {
|
|
1389
|
+
[schema: string]: Rule;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
interface Options {
|
|
1393
|
+
fuzzyLink?: boolean | undefined;
|
|
1394
|
+
fuzzyIP?: boolean | undefined;
|
|
1395
|
+
fuzzyEmail?: boolean | undefined;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
interface Match {
|
|
1399
|
+
index: number;
|
|
1400
|
+
lastIndex: number;
|
|
1401
|
+
raw: string;
|
|
1402
|
+
schema: string;
|
|
1403
|
+
text: string;
|
|
1404
|
+
url: string;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
interface LinkifyIt {
|
|
1408
|
+
// Use overloads to provide contextual typing to `FullRule.normalize`, which is ambiguous with string.normalize
|
|
1409
|
+
// This appears unneeded to the unified-signatures lint rule.
|
|
1410
|
+
add(schema: string, rule: string): LinkifyIt;
|
|
1411
|
+
// tslint:disable-next-line: unified-signatures
|
|
1412
|
+
add(schema: string, rule: FullRule | null): LinkifyIt;
|
|
1413
|
+
match(text: string): Match[] | null;
|
|
1414
|
+
normalize(raw: string): string;
|
|
1415
|
+
pretest(text: string): boolean;
|
|
1416
|
+
set(options: Options): LinkifyIt;
|
|
1417
|
+
test(text: string): boolean;
|
|
1418
|
+
testSchemaAt(text: string, schemaName: string, pos: number): number;
|
|
1419
|
+
tlds(list: string | string[], keepOld?: boolean): LinkifyIt;
|
|
1420
|
+
re: {
|
|
1421
|
+
[key: string]: RegExp;
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
declare namespace encode {
|
|
1427
|
+
const defaultChars: string;
|
|
1428
|
+
const componentChars: string;
|
|
1429
|
+
}
|
|
1430
|
+
declare function encode(str: string, exclude?: string, keepEscaped?: boolean): string;
|
|
1431
|
+
|
|
1432
|
+
declare namespace decode {
|
|
1433
|
+
const defaultChars: string;
|
|
1434
|
+
const componentChars: string;
|
|
1435
|
+
}
|
|
1436
|
+
declare function decode(input: string, exclude?: string): string;
|
|
1437
|
+
|
|
1438
|
+
declare function parse(input: string, slashesDenoteHost?: boolean): Url;
|
|
1439
|
+
|
|
1440
|
+
declare function format(url: Url): string;
|
|
1441
|
+
|
|
1442
|
+
interface Url {
|
|
1443
|
+
protocol: string;
|
|
1444
|
+
slashes: string;
|
|
1445
|
+
auth: string;
|
|
1446
|
+
port: string;
|
|
1447
|
+
hostname: string;
|
|
1448
|
+
hash: string;
|
|
1449
|
+
search: string;
|
|
1450
|
+
pathname: string;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
type mdurl_Url = Url;
|
|
1454
|
+
declare const mdurl_decode: typeof decode;
|
|
1455
|
+
declare const mdurl_encode: typeof encode;
|
|
1456
|
+
declare const mdurl_format: typeof format;
|
|
1457
|
+
declare const mdurl_parse: typeof parse;
|
|
1458
|
+
declare namespace mdurl {
|
|
1459
|
+
export { type mdurl_Url as Url, mdurl_decode as decode, mdurl_encode as encode, mdurl_format as format, mdurl_parse as parse };
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
// import ucmicro from 'uc.micro';
|
|
1463
|
+
|
|
1464
|
+
interface Utils {
|
|
1465
|
+
lib: {
|
|
1466
|
+
mdurl: typeof mdurl;
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Merge objects
|
|
1471
|
+
*/
|
|
1472
|
+
assign(target: any, ...sources: any[]): any;
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* Check if the type is string or not
|
|
1476
|
+
*/
|
|
1477
|
+
isString(obj: any): obj is string;
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* has own property
|
|
1481
|
+
*/
|
|
1482
|
+
has(obj: any, key: keyof any): boolean;
|
|
1483
|
+
|
|
1484
|
+
unescapeMd(str: string): string;
|
|
1485
|
+
unescapeAll(str: string): string;
|
|
1486
|
+
|
|
1487
|
+
isValidEntityCode(code: number): boolean;
|
|
1488
|
+
fromCodePoint(code: number): string;
|
|
1489
|
+
escapeHtml(str: string): string;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Remove element from array and put another array at those position.
|
|
1493
|
+
* Useful for some operations with tokens.
|
|
1494
|
+
* Return a new array.
|
|
1495
|
+
*/
|
|
1496
|
+
arrayReplaceAt<T>(src: T[], pos: number, newElements: T[]): T[];
|
|
1497
|
+
|
|
1498
|
+
isSpace(code: number): boolean;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Zs (unicode class) || [\t\f\v\r\n]
|
|
1502
|
+
*/
|
|
1503
|
+
isWhiteSpace(code: number): boolean;
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Markdown ASCII punctuation characters.
|
|
1507
|
+
*
|
|
1508
|
+
* !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
1509
|
+
* http://spec.commonmark.org/0.15/#ascii-punctuation-character
|
|
1510
|
+
*
|
|
1511
|
+
* Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
|
|
1512
|
+
*/
|
|
1513
|
+
isMdAsciiPunct(code: number): boolean;
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Currently without astral characters support.
|
|
1517
|
+
*/
|
|
1518
|
+
isPunctChar(ch: string): boolean;
|
|
1519
|
+
|
|
1520
|
+
escapeRE(str: string): string;
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Hepler to unify [reference labels].
|
|
1524
|
+
*/
|
|
1525
|
+
normalizeReference(str: string): string;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
declare const utils: Utils;
|
|
1529
|
+
|
|
1530
|
+
declare namespace StateInline {
|
|
1531
|
+
interface Scanned {
|
|
1532
|
+
can_open: boolean;
|
|
1533
|
+
can_close: boolean;
|
|
1534
|
+
length: number;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
interface Delimiter {
|
|
1538
|
+
marker: number;
|
|
1539
|
+
length: number;
|
|
1540
|
+
jump: number;
|
|
1541
|
+
token: number;
|
|
1542
|
+
end: number;
|
|
1543
|
+
open: boolean;
|
|
1544
|
+
close: boolean;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
interface TokenMata {
|
|
1548
|
+
delimiters: Delimiter[];
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
declare class StateInline {
|
|
1553
|
+
constructor(src: string, md: MarkdownIt, env: any, outTokens: Token[]);
|
|
1554
|
+
|
|
1555
|
+
src: string;
|
|
1556
|
+
env: any;
|
|
1557
|
+
md: MarkdownIt;
|
|
1558
|
+
tokens: Token[];
|
|
1559
|
+
tokens_meta: Array<StateInline.TokenMata | null>;
|
|
1560
|
+
|
|
1561
|
+
pos: number;
|
|
1562
|
+
posMax: number;
|
|
1563
|
+
level: number;
|
|
1564
|
+
pending: string;
|
|
1565
|
+
pendingLevel: number;
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Stores { start: end } pairs. Useful for backtrack
|
|
1569
|
+
* optimization of pairs parse (emphasis, strikes).
|
|
1570
|
+
*/
|
|
1571
|
+
cache: any;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* List of emphasis-like delimiters for current tag
|
|
1575
|
+
*/
|
|
1576
|
+
delimiters: StateInline.Delimiter[];
|
|
1577
|
+
|
|
1578
|
+
// Stack of delimiter lists for upper level tags
|
|
1579
|
+
// _prev_delimiters: StateInline.Delimiter[][];
|
|
1580
|
+
|
|
1581
|
+
/**
|
|
1582
|
+
* Flush pending text
|
|
1583
|
+
*/
|
|
1584
|
+
pushPending(): Token;
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Push new token to "stream".
|
|
1588
|
+
* If pending text exists - flush it as text token
|
|
1589
|
+
*/
|
|
1590
|
+
push(type: string, tag: string, nesting: Token.Nesting): Token;
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Scan a sequence of emphasis-like markers, and determine whether
|
|
1594
|
+
* it can start an emphasis sequence or end an emphasis sequence.
|
|
1595
|
+
*
|
|
1596
|
+
* @param start position to scan from (it should point at a valid marker);
|
|
1597
|
+
* @param canSplitWord determine if these markers can be found inside a word
|
|
1598
|
+
*/
|
|
1599
|
+
scanDelims(start: number, canSplitWord: boolean): StateInline.Scanned;
|
|
1600
|
+
|
|
1601
|
+
Token: typeof Token;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
declare function parseLinkLabel(state: StateInline, start: number, disableNested?: boolean): number;
|
|
1605
|
+
|
|
1606
|
+
declare namespace parseLinkDestination {
|
|
1607
|
+
interface ParseResult {
|
|
1608
|
+
ok: boolean;
|
|
1609
|
+
pos: number;
|
|
1610
|
+
lines: number;
|
|
1611
|
+
str: string;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
declare function parseLinkDestination(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
|
|
1616
|
+
|
|
1617
|
+
declare function parseLinkTitle(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
|
|
1618
|
+
|
|
1619
|
+
interface Helpers {
|
|
1620
|
+
parseLinkLabel: typeof parseLinkLabel;
|
|
1621
|
+
parseLinkDestination: typeof parseLinkDestination;
|
|
1622
|
+
parseLinkTitle: typeof parseLinkTitle;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
declare const helpers: Helpers;
|
|
1626
|
+
|
|
1627
|
+
declare namespace Ruler {
|
|
1628
|
+
interface RuleOptions {
|
|
1629
|
+
/**
|
|
1630
|
+
* array with names of "alternate" chains.
|
|
1631
|
+
*/
|
|
1632
|
+
alt: string[];
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* class Ruler
|
|
1638
|
+
*
|
|
1639
|
+
* Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
|
|
1640
|
+
* [[MarkdownIt#inline]] to manage sequences of functions (rules):
|
|
1641
|
+
*
|
|
1642
|
+
* - keep rules in defined order
|
|
1643
|
+
* - assign the name to each rule
|
|
1644
|
+
* - enable/disable rules
|
|
1645
|
+
* - add/replace rules
|
|
1646
|
+
* - allow assign rules to additional named chains (in the same)
|
|
1647
|
+
* - cacheing lists of active rules
|
|
1648
|
+
*
|
|
1649
|
+
* You will not need use this class directly until write plugins. For simple
|
|
1650
|
+
* rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
|
|
1651
|
+
* [[MarkdownIt.use]].
|
|
1652
|
+
*/
|
|
1653
|
+
declare class Ruler<T> {
|
|
1654
|
+
/**
|
|
1655
|
+
* Replace rule by name with new function & options. Throws error if name not
|
|
1656
|
+
* found.
|
|
1657
|
+
*
|
|
1658
|
+
* ##### Example
|
|
1659
|
+
*
|
|
1660
|
+
* Replace existing typographer replacement rule with new one:
|
|
1661
|
+
*
|
|
1662
|
+
* ```javascript
|
|
1663
|
+
* var md = require('markdown-it')();
|
|
1664
|
+
*
|
|
1665
|
+
* md.core.ruler.at('replacements', function replace(state) {
|
|
1666
|
+
* //...
|
|
1667
|
+
* });
|
|
1668
|
+
* ```
|
|
1669
|
+
*
|
|
1670
|
+
* @param name rule name to replace.
|
|
1671
|
+
* @param fn new rule function.
|
|
1672
|
+
* @param options new rule options (not mandatory).
|
|
1673
|
+
*/
|
|
1674
|
+
at(name: string, fn: T, options?: Ruler.RuleOptions): void;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Add new rule to chain before one with given name. See also
|
|
1678
|
+
* [[Ruler.after]], [[Ruler.push]].
|
|
1679
|
+
*
|
|
1680
|
+
* ##### Example
|
|
1681
|
+
*
|
|
1682
|
+
* ```javascript
|
|
1683
|
+
* var md = require('markdown-it')();
|
|
1684
|
+
*
|
|
1685
|
+
* md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
|
|
1686
|
+
* //...
|
|
1687
|
+
* });
|
|
1688
|
+
* ```
|
|
1689
|
+
*
|
|
1690
|
+
* @param beforeName new rule will be added before this one.
|
|
1691
|
+
* @param ruleName name of added rule.
|
|
1692
|
+
* @param fn rule function.
|
|
1693
|
+
* @param options rule options (not mandatory).
|
|
1694
|
+
*/
|
|
1695
|
+
before(beforeName: string, ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* Add new rule to chain after one with given name. See also
|
|
1699
|
+
* [[Ruler.before]], [[Ruler.push]].
|
|
1700
|
+
*
|
|
1701
|
+
* ##### Options:
|
|
1702
|
+
*
|
|
1703
|
+
* - __alt__ - array with names of "alternate" chains.
|
|
1704
|
+
*
|
|
1705
|
+
* ##### Example
|
|
1706
|
+
*
|
|
1707
|
+
* ```javascript
|
|
1708
|
+
* var md = require('markdown-it')();
|
|
1709
|
+
*
|
|
1710
|
+
* md.inline.ruler.after('text', 'my_rule', function replace(state) {
|
|
1711
|
+
* //...
|
|
1712
|
+
* });
|
|
1713
|
+
* ```
|
|
1714
|
+
*
|
|
1715
|
+
* @param afterName new rule will be added after this one.
|
|
1716
|
+
* @param ruleName name of added rule.
|
|
1717
|
+
* @param fn rule function.
|
|
1718
|
+
* @param options rule options (not mandatory).
|
|
1719
|
+
*/
|
|
1720
|
+
after(afterName: string, ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* Push new rule to the end of chain. See also
|
|
1724
|
+
* [[Ruler.before]], [[Ruler.after]].
|
|
1725
|
+
*
|
|
1726
|
+
* ##### Options:
|
|
1727
|
+
*
|
|
1728
|
+
* - __alt__ - array with names of "alternate" chains.
|
|
1729
|
+
*
|
|
1730
|
+
* ##### Example
|
|
1731
|
+
*
|
|
1732
|
+
* ```javascript
|
|
1733
|
+
* var md = require('markdown-it')();
|
|
1734
|
+
*
|
|
1735
|
+
* md.core.ruler.push('my_rule', function replace(state) {
|
|
1736
|
+
* //...
|
|
1737
|
+
* });
|
|
1738
|
+
* ```
|
|
1739
|
+
*
|
|
1740
|
+
* @param ruleName name of added rule.
|
|
1741
|
+
* @param fn rule function.
|
|
1742
|
+
* @param options rule options (not mandatory).
|
|
1743
|
+
*/
|
|
1744
|
+
push(ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* Enable rules with given names. If any rule name not found - throw Error.
|
|
1748
|
+
* Errors can be disabled by second param.
|
|
1749
|
+
*
|
|
1750
|
+
* Returns list of found rule names (if no exception happened).
|
|
1751
|
+
*
|
|
1752
|
+
* See also [[Ruler.disable]], [[Ruler.enableOnly]].
|
|
1753
|
+
*
|
|
1754
|
+
* @param list list of rule names to enable.
|
|
1755
|
+
* @param ignoreInvalid set `true` to ignore errors when rule not found.
|
|
1756
|
+
*/
|
|
1757
|
+
enable(list: string | string[], ignoreInvalid?: boolean): string[];
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Enable rules with given names, and disable everything else. If any rule name
|
|
1761
|
+
* not found - throw Error. Errors can be disabled by second param.
|
|
1762
|
+
*
|
|
1763
|
+
* See also [[Ruler.disable]], [[Ruler.enable]].
|
|
1764
|
+
*
|
|
1765
|
+
* @param list list of rule names to enable (whitelist).
|
|
1766
|
+
* @param ignoreInvalid set `true` to ignore errors when rule not found.
|
|
1767
|
+
*/
|
|
1768
|
+
enableOnly(list: string | string[], ignoreInvalid?: boolean): string[];
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Disable rules with given names. If any rule name not found - throw Error.
|
|
1772
|
+
* Errors can be disabled by second param.
|
|
1773
|
+
*
|
|
1774
|
+
* Returns list of found rule names (if no exception happened).
|
|
1775
|
+
*
|
|
1776
|
+
* See also [[Ruler.enable]], [[Ruler.enableOnly]].
|
|
1777
|
+
*
|
|
1778
|
+
* @param list list of rule names to disable.
|
|
1779
|
+
* @param ignoreInvalid set `true` to ignore errors when rule not found.
|
|
1780
|
+
*/
|
|
1781
|
+
disable(list: string | string[], ignoreInvalid?: boolean): string[];
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Return array of active functions (rules) for given chain name. It analyzes
|
|
1785
|
+
* rules configuration, compiles caches if not exists and returns result.
|
|
1786
|
+
*
|
|
1787
|
+
* Default chain name is `''` (empty string). It can't be skipped. That's
|
|
1788
|
+
* done intentionally, to keep signature monomorphic for high speed.
|
|
1789
|
+
*/
|
|
1790
|
+
getRules(chainName: string): T[];
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
declare namespace StateBlock {
|
|
1794
|
+
type ParentType = "blockquote" | "list" | "root" | "paragraph" | "reference";
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
declare class StateBlock {
|
|
1798
|
+
constructor(src: string, md: MarkdownIt, env: any, tokens: Token[]);
|
|
1799
|
+
|
|
1800
|
+
src: string;
|
|
1801
|
+
|
|
1802
|
+
/**
|
|
1803
|
+
* link to parser instance
|
|
1804
|
+
*/
|
|
1805
|
+
md: MarkdownIt;
|
|
1806
|
+
|
|
1807
|
+
env: any;
|
|
1808
|
+
|
|
1809
|
+
//
|
|
1810
|
+
// Internal state vartiables
|
|
1811
|
+
//
|
|
1812
|
+
|
|
1813
|
+
tokens: Token[];
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* line begin offsets for fast jumps
|
|
1817
|
+
*/
|
|
1818
|
+
bMarks: number[];
|
|
1819
|
+
/**
|
|
1820
|
+
* line end offsets for fast jumps
|
|
1821
|
+
*/
|
|
1822
|
+
eMarks: number[];
|
|
1823
|
+
/**
|
|
1824
|
+
* offsets of the first non-space characters (tabs not expanded)
|
|
1825
|
+
*/
|
|
1826
|
+
tShift: number[];
|
|
1827
|
+
/**
|
|
1828
|
+
* indents for each line (tabs expanded)
|
|
1829
|
+
*/
|
|
1830
|
+
sCount: number[];
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* An amount of virtual spaces (tabs expanded) between beginning
|
|
1834
|
+
* of each line (bMarks) and real beginning of that line.
|
|
1835
|
+
*
|
|
1836
|
+
* It exists only as a hack because blockquotes override bMarks
|
|
1837
|
+
* losing information in the process.
|
|
1838
|
+
*
|
|
1839
|
+
* It's used only when expanding tabs, you can think about it as
|
|
1840
|
+
* an initial tab length, e.g. bsCount=21 applied to string `\t123`
|
|
1841
|
+
* means first tab should be expanded to 4-21%4 === 3 spaces.
|
|
1842
|
+
*/
|
|
1843
|
+
bsCount: number[];
|
|
1844
|
+
|
|
1845
|
+
// block parser variables
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* required block content indent (for example, if we are
|
|
1849
|
+
* inside a list, it would be positioned after list marker)
|
|
1850
|
+
*/
|
|
1851
|
+
blkIndent: number;
|
|
1852
|
+
/**
|
|
1853
|
+
* line index in src
|
|
1854
|
+
*/
|
|
1855
|
+
line: number;
|
|
1856
|
+
/**
|
|
1857
|
+
* lines count
|
|
1858
|
+
*/
|
|
1859
|
+
lineMax: number;
|
|
1860
|
+
/**
|
|
1861
|
+
* loose/tight mode for lists
|
|
1862
|
+
*/
|
|
1863
|
+
tight: boolean;
|
|
1864
|
+
/**
|
|
1865
|
+
* indent of the current dd block (-1 if there isn't any)
|
|
1866
|
+
*/
|
|
1867
|
+
ddIndent: number;
|
|
1868
|
+
/**
|
|
1869
|
+
* indent of the current list block (-1 if there isn't any)
|
|
1870
|
+
*/
|
|
1871
|
+
listIndent: number;
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
|
|
1875
|
+
* used in lists to determine if they interrupt a paragraph
|
|
1876
|
+
*/
|
|
1877
|
+
parentType: StateBlock.ParentType;
|
|
1878
|
+
|
|
1879
|
+
level: number;
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* renderer
|
|
1883
|
+
*/
|
|
1884
|
+
result: string;
|
|
1885
|
+
|
|
1886
|
+
/**
|
|
1887
|
+
* Push new token to "stream".
|
|
1888
|
+
*/
|
|
1889
|
+
push(type: string, tag: string, nesting: Token.Nesting): Token;
|
|
1890
|
+
|
|
1891
|
+
isEmpty(line: number): boolean;
|
|
1892
|
+
|
|
1893
|
+
skipEmptyLines(from: number): number;
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Skip spaces from given position.
|
|
1897
|
+
*/
|
|
1898
|
+
skipSpaces(pos: number): number;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Skip spaces from given position in reverse.
|
|
1902
|
+
*/
|
|
1903
|
+
skipSpacesBack(pos: number, min: number): number;
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Skip char codes from given position
|
|
1907
|
+
*/
|
|
1908
|
+
skipChars(pos: number, code: number): number;
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* Skip char codes reverse from given position - 1
|
|
1912
|
+
*/
|
|
1913
|
+
skipCharsBack(pos: number, code: number, min: number): number;
|
|
1914
|
+
|
|
1915
|
+
/**
|
|
1916
|
+
* cut lines range from source.
|
|
1917
|
+
*/
|
|
1918
|
+
getLines(begin: number, end: number, indent: number, keepLastLF: boolean): string;
|
|
1919
|
+
|
|
1920
|
+
Token: typeof Token;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
declare namespace ParserBlock {
|
|
1924
|
+
type RuleBlock = (state: StateBlock, startLine: number, endLine: number, silent: boolean) => boolean;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
declare class ParserBlock {
|
|
1928
|
+
/**
|
|
1929
|
+
* [[Ruler]] instance. Keep configuration of block rules.
|
|
1930
|
+
*/
|
|
1931
|
+
ruler: Ruler<ParserBlock.RuleBlock>;
|
|
1932
|
+
|
|
1933
|
+
/**
|
|
1934
|
+
* Generate tokens for input range
|
|
1935
|
+
*/
|
|
1936
|
+
tokenize(state: StateBlock, startLine: number, endLine: number): void;
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Process input string and push block tokens into `outTokens`
|
|
1940
|
+
*/
|
|
1941
|
+
parse(str: string, md: MarkdownIt, env: any, outTokens: Token[]): void;
|
|
1942
|
+
|
|
1943
|
+
State: typeof StateBlock;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
declare class StateCore {
|
|
1947
|
+
constructor(src: string, md: MarkdownIt, env: any);
|
|
1948
|
+
|
|
1949
|
+
src: string;
|
|
1950
|
+
env: any;
|
|
1951
|
+
tokens: Token[];
|
|
1952
|
+
inlineMode: boolean;
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* link to parser instance
|
|
1956
|
+
*/
|
|
1957
|
+
md: MarkdownIt;
|
|
1958
|
+
|
|
1959
|
+
Token: typeof Token;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
declare namespace Core {
|
|
1963
|
+
type RuleCore = (state: StateCore) => void;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
declare class Core {
|
|
1967
|
+
ruler: Ruler<Core.RuleCore>;
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Executes core chain rules.
|
|
1971
|
+
*/
|
|
1972
|
+
process(state: StateCore): void;
|
|
1973
|
+
|
|
1974
|
+
State: typeof StateCore;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
declare namespace ParserInline {
|
|
1978
|
+
type RuleInline = (state: StateInline, silent: boolean) => boolean;
|
|
1979
|
+
type RuleInline2 = (state: StateInline) => boolean;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
declare class ParserInline {
|
|
1983
|
+
/**
|
|
1984
|
+
* [[Ruler]] instance. Keep configuration of inline rules.
|
|
1985
|
+
*/
|
|
1986
|
+
ruler: Ruler<ParserInline.RuleInline>;
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* [[Ruler]] instance. Second ruler used for post-processing
|
|
1990
|
+
* (e.g. in emphasis-like rules).
|
|
1991
|
+
*/
|
|
1992
|
+
ruler2: Ruler<ParserInline.RuleInline2>;
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* Skip single token by running all rules in validation mode;
|
|
1996
|
+
* returns `true` if any rule reported success
|
|
1997
|
+
*/
|
|
1998
|
+
skipToken(state: StateInline): void;
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* Generate tokens for input range
|
|
2002
|
+
*/
|
|
2003
|
+
tokenize(state: StateInline): void;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Process input string and push inline tokens into `outTokens`
|
|
2007
|
+
*/
|
|
2008
|
+
parse(str: string, md: MarkdownIt, env: any, outTokens: Token[]): void;
|
|
2009
|
+
|
|
2010
|
+
State: typeof StateInline;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
declare namespace Renderer {
|
|
2014
|
+
type RenderRule = (tokens: Token[], idx: number, options: MarkdownIt.Options, env: any, self: Renderer) => string;
|
|
2015
|
+
|
|
2016
|
+
interface RenderRuleRecord {
|
|
2017
|
+
[type: string]: RenderRule | undefined;
|
|
2018
|
+
code_inline?: RenderRule | undefined;
|
|
2019
|
+
code_block?: RenderRule | undefined;
|
|
2020
|
+
fence?: RenderRule | undefined;
|
|
2021
|
+
image?: RenderRule | undefined;
|
|
2022
|
+
hardbreak?: RenderRule | undefined;
|
|
2023
|
+
softbreak?: RenderRule | undefined;
|
|
2024
|
+
text?: RenderRule | undefined;
|
|
2025
|
+
html_block?: RenderRule | undefined;
|
|
2026
|
+
html_inline?: RenderRule | undefined;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
declare class Renderer {
|
|
2031
|
+
/**
|
|
2032
|
+
* Contains render rules for tokens. Can be updated and extended.
|
|
2033
|
+
*
|
|
2034
|
+
* ##### Example
|
|
2035
|
+
*
|
|
2036
|
+
* ```javascript
|
|
2037
|
+
* var md = require('markdown-it')();
|
|
2038
|
+
*
|
|
2039
|
+
* md.renderer.rules.strong_open = function () { return '<b>'; };
|
|
2040
|
+
* md.renderer.rules.strong_close = function () { return '</b>'; };
|
|
2041
|
+
*
|
|
2042
|
+
* var result = md.renderInline(...);
|
|
2043
|
+
* ```
|
|
2044
|
+
*
|
|
2045
|
+
* Each rule is called as independent static function with fixed signature:
|
|
2046
|
+
*
|
|
2047
|
+
* ```javascript
|
|
2048
|
+
* function my_token_render(tokens, idx, options, env, renderer) {
|
|
2049
|
+
* // ...
|
|
2050
|
+
* return renderedHTML;
|
|
2051
|
+
* }
|
|
2052
|
+
* ```
|
|
2053
|
+
*
|
|
2054
|
+
* See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
|
|
2055
|
+
* for more details and examples.
|
|
2056
|
+
*/
|
|
2057
|
+
rules: Renderer.RenderRuleRecord;
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* Render token attributes to string.
|
|
2061
|
+
*/
|
|
2062
|
+
renderAttrs(token: Token): string;
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* Default token renderer. Can be overriden by custom function
|
|
2066
|
+
* in [[Renderer#rules]].
|
|
2067
|
+
*
|
|
2068
|
+
* @param tokens list of tokens
|
|
2069
|
+
* @param idx token index to render
|
|
2070
|
+
* @param options params of parser instance
|
|
2071
|
+
*/
|
|
2072
|
+
renderToken(tokens: Token[], idx: number, options: MarkdownIt.Options): string;
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* The same as [[Renderer.render]], but for single token of `inline` type.
|
|
2076
|
+
*
|
|
2077
|
+
* @param tokens list on block tokens to renter
|
|
2078
|
+
* @param options params of parser instance
|
|
2079
|
+
* @param env additional data from parsed input (references, for example)
|
|
2080
|
+
*/
|
|
2081
|
+
renderInline(tokens: Token[], options: MarkdownIt.Options, env: any): string;
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* Special kludge for image `alt` attributes to conform CommonMark spec.
|
|
2085
|
+
* Don't try to use it! Spec requires to show `alt` content with stripped markup,
|
|
2086
|
+
* instead of simple escaping.
|
|
2087
|
+
*
|
|
2088
|
+
* @param tokens list on block tokens to renter
|
|
2089
|
+
* @param options params of parser instance
|
|
2090
|
+
* @param env additional data from parsed input (references, for example)
|
|
2091
|
+
*/
|
|
2092
|
+
renderInlineAsText(tokens: Token[], options: MarkdownIt.Options, env: any): string;
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* Takes token stream and generates HTML. Probably, you will never need to call
|
|
2096
|
+
* this method directly.
|
|
2097
|
+
*
|
|
2098
|
+
* @param tokens list on block tokens to renter
|
|
2099
|
+
* @param options params of parser instance
|
|
2100
|
+
* @param env additional data from parsed input (references, for example)
|
|
2101
|
+
*/
|
|
2102
|
+
render(tokens: Token[], options: MarkdownIt.Options, env: any): string;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
interface MarkdownItConstructor {
|
|
2106
|
+
new(): MarkdownIt;
|
|
2107
|
+
new(presetName: MarkdownIt.PresetName, options?: MarkdownIt.Options): MarkdownIt;
|
|
2108
|
+
new(options: MarkdownIt.Options): MarkdownIt;
|
|
2109
|
+
(): MarkdownIt;
|
|
2110
|
+
(presetName: MarkdownIt.PresetName, options?: MarkdownIt.Options): MarkdownIt;
|
|
2111
|
+
(options: MarkdownIt.Options): MarkdownIt;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
declare namespace MarkdownIt {
|
|
2115
|
+
type Token = __token;
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* MarkdownIt provides named presets as a convenience to quickly
|
|
2119
|
+
* enable/disable active syntax rules and options for common use cases.
|
|
2120
|
+
*
|
|
2121
|
+
* - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
|
|
2122
|
+
* configures parser to strict [CommonMark](http://commonmark.org/) mode.
|
|
2123
|
+
* - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
|
|
2124
|
+
* similar to GFM, used when no preset name given. Enables all available rules,
|
|
2125
|
+
* but still without html, typographer & autolinker.
|
|
2126
|
+
* - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
|
|
2127
|
+
* all rules disabled. Useful to quickly setup your config via `.enable()`.
|
|
2128
|
+
* For example, when you need only `bold` and `italic` markup and nothing else.
|
|
2129
|
+
*/
|
|
2130
|
+
type PresetName = "default" | "zero" | "commonmark";
|
|
2131
|
+
|
|
2132
|
+
interface Options {
|
|
2133
|
+
/**
|
|
2134
|
+
* Set `true` to enable HTML tags in source. Be careful!
|
|
2135
|
+
* That's not safe! You may need external sanitizer to protect output from XSS.
|
|
2136
|
+
* It's better to extend features via plugins, instead of enabling HTML.
|
|
2137
|
+
* @default false
|
|
2138
|
+
*/
|
|
2139
|
+
html?: boolean | undefined;
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* Set `true` to add '/' when closing single tags
|
|
2143
|
+
* (`<br />`). This is needed only for full CommonMark compatibility. In real
|
|
2144
|
+
* world you will need HTML output.
|
|
2145
|
+
* @default false
|
|
2146
|
+
*/
|
|
2147
|
+
xhtmlOut?: boolean | undefined;
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* Set `true` to convert `\n` in paragraphs into `<br>`.
|
|
2151
|
+
* @default false
|
|
2152
|
+
*/
|
|
2153
|
+
breaks?: boolean | undefined;
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* CSS language class prefix for fenced blocks.
|
|
2157
|
+
* Can be useful for external highlighters.
|
|
2158
|
+
* @default 'language-'
|
|
2159
|
+
*/
|
|
2160
|
+
langPrefix?: string | undefined;
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* Set `true` to autoconvert URL-like text to links.
|
|
2164
|
+
* @default false
|
|
2165
|
+
*/
|
|
2166
|
+
linkify?: boolean | undefined;
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Set `true` to enable [some language-neutral replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
|
|
2170
|
+
* quotes beautification (smartquotes).
|
|
2171
|
+
* @default false
|
|
2172
|
+
*/
|
|
2173
|
+
typographer?: boolean | undefined;
|
|
2174
|
+
|
|
2175
|
+
/**
|
|
2176
|
+
* Double + single quotes replacement
|
|
2177
|
+
* pairs, when typographer enabled and smartquotes on. For example, you can
|
|
2178
|
+
* use `'«»„“'` for Russian, `'„“‚‘'` for German, and
|
|
2179
|
+
* `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
|
|
2180
|
+
* @default '“”‘’'
|
|
2181
|
+
*/
|
|
2182
|
+
quotes?: string | string[];
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Highlighter function for fenced code blocks.
|
|
2186
|
+
* Highlighter `function (str, lang, attrs)` should return escaped HTML. It can
|
|
2187
|
+
* also return empty string if the source was not changed and should be escaped
|
|
2188
|
+
* externally. If result starts with <pre... internal wrapper is skipped.
|
|
2189
|
+
* @default null
|
|
2190
|
+
*/
|
|
2191
|
+
highlight?: ((str: string, lang: string, attrs: string) => string) | null | undefined;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
type PluginSimple = (md: MarkdownIt) => void;
|
|
2195
|
+
type PluginWithOptions<T = any> = (md: MarkdownIt, options?: T) => void;
|
|
2196
|
+
type PluginWithParams = (md: MarkdownIt, ...params: any[]) => void;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
interface MarkdownIt {
|
|
2200
|
+
/**
|
|
2201
|
+
* Instance of [[ParserInline]]. You may need it to add new rules when
|
|
2202
|
+
* writing plugins. For simple rules control use [[MarkdownIt.disable]] and
|
|
2203
|
+
* [[MarkdownIt.enable]].
|
|
2204
|
+
*/
|
|
2205
|
+
readonly inline: ParserInline;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Instance of [[ParserBlock]]. You may need it to add new rules when
|
|
2209
|
+
* writing plugins. For simple rules control use [[MarkdownIt.disable]] and
|
|
2210
|
+
* [[MarkdownIt.enable]].
|
|
2211
|
+
*/
|
|
2212
|
+
readonly block: ParserBlock;
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Instance of [[Core]] chain executor. You may need it to add new rules when
|
|
2216
|
+
* writing plugins. For simple rules control use [[MarkdownIt.disable]] and
|
|
2217
|
+
* [[MarkdownIt.enable]].
|
|
2218
|
+
*/
|
|
2219
|
+
readonly core: Core;
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
|
|
2223
|
+
* rules for new token types, generated by plugins.
|
|
2224
|
+
*
|
|
2225
|
+
* ##### Example
|
|
2226
|
+
*
|
|
2227
|
+
* ```javascript
|
|
2228
|
+
* var md = require('markdown-it')();
|
|
2229
|
+
*
|
|
2230
|
+
* function myToken(tokens, idx, options, env, self) {
|
|
2231
|
+
* //...
|
|
2232
|
+
* return result;
|
|
2233
|
+
* };
|
|
2234
|
+
*
|
|
2235
|
+
* md.renderer.rules['my_token'] = myToken
|
|
2236
|
+
* ```
|
|
2237
|
+
*
|
|
2238
|
+
* See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
|
|
2239
|
+
*/
|
|
2240
|
+
readonly renderer: Renderer;
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* [linkify-it](https://github.com/markdown-it/linkify-it) instance.
|
|
2244
|
+
* Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
|
|
2245
|
+
* rule.
|
|
2246
|
+
*/
|
|
2247
|
+
readonly linkify: LinkifyIt.LinkifyIt;
|
|
2248
|
+
|
|
2249
|
+
/**
|
|
2250
|
+
* Link validation function. CommonMark allows too much in links. By default
|
|
2251
|
+
* we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
|
|
2252
|
+
* except some embedded image types.
|
|
2253
|
+
*
|
|
2254
|
+
* You can change this behaviour:
|
|
2255
|
+
*
|
|
2256
|
+
* ```javascript
|
|
2257
|
+
* var md = require('markdown-it')();
|
|
2258
|
+
* // enable everything
|
|
2259
|
+
* md.validateLink = function () { return true; }
|
|
2260
|
+
* ```
|
|
2261
|
+
*/
|
|
2262
|
+
validateLink(url: string): boolean;
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Function used to encode link url to a machine-readable format,
|
|
2266
|
+
* which includes url-encoding, punycode, etc.
|
|
2267
|
+
*/
|
|
2268
|
+
normalizeLink(url: string): string;
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Function used to decode link url to a human-readable format`
|
|
2272
|
+
*/
|
|
2273
|
+
normalizeLinkText(url: string): string;
|
|
2274
|
+
|
|
2275
|
+
readonly utils: typeof utils;
|
|
2276
|
+
|
|
2277
|
+
readonly helpers: typeof helpers;
|
|
2278
|
+
|
|
2279
|
+
readonly options: MarkdownIt.Options;
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* *chainable*
|
|
2283
|
+
*
|
|
2284
|
+
* Set parser options (in the same format as in constructor). Probably, you
|
|
2285
|
+
* will never need it, but you can change options after constructor call.
|
|
2286
|
+
*
|
|
2287
|
+
* ##### Example
|
|
2288
|
+
*
|
|
2289
|
+
* ```javascript
|
|
2290
|
+
* var md = require('markdown-it')()
|
|
2291
|
+
* .set({ html: true, breaks: true })
|
|
2292
|
+
* .set({ typographer: true });
|
|
2293
|
+
* ```
|
|
2294
|
+
*
|
|
2295
|
+
* __Note:__ To achieve the best possible performance, don't modify a
|
|
2296
|
+
* `markdown-it` instance options on the fly. If you need multiple configurations
|
|
2297
|
+
* it's best to create multiple instances and initialize each with separate
|
|
2298
|
+
* config.
|
|
2299
|
+
*/
|
|
2300
|
+
set(options: MarkdownIt.Options): this;
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* *chainable*, *internal*
|
|
2304
|
+
*
|
|
2305
|
+
* Batch load of all options and compenent settings. This is internal method,
|
|
2306
|
+
* and you probably will not need it. But if you with - see available presets
|
|
2307
|
+
* and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
|
|
2308
|
+
*
|
|
2309
|
+
* We strongly recommend to use presets instead of direct config loads. That
|
|
2310
|
+
* will give better compatibility with next versions.
|
|
2311
|
+
*/
|
|
2312
|
+
configure(presets: MarkdownIt.PresetName): this;
|
|
2313
|
+
|
|
2314
|
+
/**
|
|
2315
|
+
* *chainable*
|
|
2316
|
+
*
|
|
2317
|
+
* Enable list or rules. It will automatically find appropriate components,
|
|
2318
|
+
* containing rules with given names. If rule not found, and `ignoreInvalid`
|
|
2319
|
+
* not set - throws exception.
|
|
2320
|
+
*
|
|
2321
|
+
* ##### Example
|
|
2322
|
+
*
|
|
2323
|
+
* ```javascript
|
|
2324
|
+
* var md = require('markdown-it')()
|
|
2325
|
+
* .enable(['sub', 'sup'])
|
|
2326
|
+
* .disable('smartquotes');
|
|
2327
|
+
* ```
|
|
2328
|
+
*
|
|
2329
|
+
* @param list rule name or list of rule names to enable
|
|
2330
|
+
* @param ignoreInvalid set `true` to ignore errors when rule not found.
|
|
2331
|
+
*/
|
|
2332
|
+
enable(list: string | string[], ignoreInvalid?: boolean): this;
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* *chainable*
|
|
2336
|
+
*
|
|
2337
|
+
* The same as [[MarkdownIt.enable]], but turn specified rules off.
|
|
2338
|
+
*
|
|
2339
|
+
* @param list rule name or list of rule names to disable.
|
|
2340
|
+
* @param ignoreInvalid set `true` to ignore errors when rule not found.
|
|
2341
|
+
*/
|
|
2342
|
+
disable(list: string | string[], ignoreInvalid?: boolean): this;
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* *chainable*
|
|
2346
|
+
*
|
|
2347
|
+
* Load specified plugin with given params into current parser instance.
|
|
2348
|
+
* It's just a sugar to call `plugin(md, params)` with curring.
|
|
2349
|
+
*
|
|
2350
|
+
* ##### Example
|
|
2351
|
+
*
|
|
2352
|
+
* ```javascript
|
|
2353
|
+
* var iterator = require('markdown-it-for-inline');
|
|
2354
|
+
* var md = require('markdown-it')()
|
|
2355
|
+
* .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
|
|
2356
|
+
* tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
|
|
2357
|
+
* });
|
|
2358
|
+
* ```
|
|
2359
|
+
*/
|
|
2360
|
+
use(plugin: MarkdownIt.PluginSimple): this;
|
|
2361
|
+
use<T = any>(plugin: MarkdownIt.PluginWithOptions<T>, options?: T): this;
|
|
2362
|
+
use(plugin: MarkdownIt.PluginWithParams, ...params: any[]): this;
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* *internal*
|
|
2366
|
+
*
|
|
2367
|
+
* Parse input string and returns list of block tokens (special token type
|
|
2368
|
+
* "inline" will contain list of inline tokens). You should not call this
|
|
2369
|
+
* method directly, until you write custom renderer (for example, to produce
|
|
2370
|
+
* AST).
|
|
2371
|
+
*
|
|
2372
|
+
* `env` is used to pass data between "distributed" rules and return additional
|
|
2373
|
+
* metadata like reference info, needed for the renderer. It also can be used to
|
|
2374
|
+
* inject data in specific cases. Usually, you will be ok to pass `{}`,
|
|
2375
|
+
* and then pass updated object to renderer.
|
|
2376
|
+
*
|
|
2377
|
+
* @param src source string
|
|
2378
|
+
* @param env environment sandbox
|
|
2379
|
+
*/
|
|
2380
|
+
parse(src: string, env: any): Token[];
|
|
2381
|
+
|
|
2382
|
+
/**
|
|
2383
|
+
* Render markdown string into html. It does all magic for you :).
|
|
2384
|
+
*
|
|
2385
|
+
* `env` can be used to inject additional metadata (`{}` by default).
|
|
2386
|
+
* But you will not need it with high probability. See also comment
|
|
2387
|
+
* in [[MarkdownIt.parse]].
|
|
2388
|
+
*
|
|
2389
|
+
* @param src source string
|
|
2390
|
+
* @param env environment sandbox
|
|
2391
|
+
*/
|
|
2392
|
+
render(src: string, env?: any): string;
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* *internal*
|
|
2396
|
+
*
|
|
2397
|
+
* The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
|
|
2398
|
+
* block tokens list with the single `inline` element, containing parsed inline
|
|
2399
|
+
* tokens in `children` property. Also updates `env` object.
|
|
2400
|
+
*
|
|
2401
|
+
* @param src source string
|
|
2402
|
+
* @param env environment sandbox
|
|
2403
|
+
*/
|
|
2404
|
+
parseInline(src: string, env: any): Token[];
|
|
2405
|
+
|
|
2406
|
+
/**
|
|
2407
|
+
* Similar to [[MarkdownIt.render]] but for single paragraph content. Result
|
|
2408
|
+
* will NOT be wrapped into `<p>` tags.
|
|
2409
|
+
*
|
|
2410
|
+
* @param src source string
|
|
2411
|
+
* @param env environment sandbox
|
|
2412
|
+
*/
|
|
2413
|
+
renderInline(src: string, env?: any): string;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* Main parser/renderer class.
|
|
2418
|
+
*
|
|
2419
|
+
* ##### Usage
|
|
2420
|
+
*
|
|
2421
|
+
* ```javascript
|
|
2422
|
+
* // node.js, "classic" way:
|
|
2423
|
+
* var MarkdownIt = require('markdown-it'),
|
|
2424
|
+
* md = new MarkdownIt();
|
|
2425
|
+
* var result = md.render('# markdown-it rulezz!');
|
|
2426
|
+
*
|
|
2427
|
+
* // node.js, the same, but with sugar:
|
|
2428
|
+
* var md = require('markdown-it')();
|
|
2429
|
+
* var result = md.render('# markdown-it rulezz!');
|
|
2430
|
+
*
|
|
2431
|
+
* // browser without AMD, added to "window" on script load
|
|
2432
|
+
* // Note, there are no dash.
|
|
2433
|
+
* var md = window.markdownit();
|
|
2434
|
+
* var result = md.render('# markdown-it rulezz!');
|
|
2435
|
+
* ```
|
|
2436
|
+
*
|
|
2437
|
+
* Single line rendering, without paragraph wrap:
|
|
2438
|
+
*
|
|
2439
|
+
* ```javascript
|
|
2440
|
+
* var md = require('markdown-it')();
|
|
2441
|
+
* var result = md.renderInline('__markdown-it__ rulezz!');
|
|
2442
|
+
* ```
|
|
2443
|
+
*
|
|
2444
|
+
* ##### Example
|
|
2445
|
+
*
|
|
2446
|
+
* ```javascript
|
|
2447
|
+
* // commonmark mode
|
|
2448
|
+
* var md = require('markdown-it')('commonmark');
|
|
2449
|
+
*
|
|
2450
|
+
* // default mode
|
|
2451
|
+
* var md = require('markdown-it')();
|
|
2452
|
+
*
|
|
2453
|
+
* // enable everything
|
|
2454
|
+
* var md = require('markdown-it')({
|
|
2455
|
+
* html: true,
|
|
2456
|
+
* linkify: true,
|
|
2457
|
+
* typographer: true
|
|
2458
|
+
* });
|
|
2459
|
+
* ```
|
|
2460
|
+
*
|
|
2461
|
+
* ##### Syntax highlighting
|
|
2462
|
+
*
|
|
2463
|
+
* ```js
|
|
2464
|
+
* var hljs = require('highlight.js') // https://highlightjs.org/
|
|
2465
|
+
*
|
|
2466
|
+
* var md = require('markdown-it')({
|
|
2467
|
+
* highlight: function (str, lang) {
|
|
2468
|
+
* if (lang && hljs.getLanguage(lang)) {
|
|
2469
|
+
* try {
|
|
2470
|
+
* return hljs.highlight(lang, str, true).value;
|
|
2471
|
+
* } catch (__) {}
|
|
2472
|
+
* }
|
|
2473
|
+
*
|
|
2474
|
+
* return ''; // use external default escaping
|
|
2475
|
+
* }
|
|
2476
|
+
* });
|
|
2477
|
+
* ```
|
|
2478
|
+
*
|
|
2479
|
+
* Or with full wrapper override (if you need assign class to `<pre>`):
|
|
2480
|
+
*
|
|
2481
|
+
* ```javascript
|
|
2482
|
+
* var hljs = require('highlight.js') // https://highlightjs.org/
|
|
2483
|
+
*
|
|
2484
|
+
* // Actual default values
|
|
2485
|
+
* var md = require('markdown-it')({
|
|
2486
|
+
* highlight: function (str, lang) {
|
|
2487
|
+
* if (lang && hljs.getLanguage(lang)) {
|
|
2488
|
+
* try {
|
|
2489
|
+
* return '<pre class="hljs"><code>' +
|
|
2490
|
+
* hljs.highlight(lang, str, true).value +
|
|
2491
|
+
* '</code></pre>';
|
|
2492
|
+
* } catch (__) {}
|
|
2493
|
+
* }
|
|
2494
|
+
*
|
|
2495
|
+
* return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
|
|
2496
|
+
* }
|
|
2497
|
+
* });
|
|
2498
|
+
* ```
|
|
2499
|
+
*/
|
|
2500
|
+
declare const MarkdownIt: MarkdownItConstructor;
|
|
2501
|
+
|
|
2502
|
+
interface DocSearchProps {
|
|
2503
|
+
appId: string
|
|
2504
|
+
apiKey: string
|
|
2505
|
+
indexName: string
|
|
2506
|
+
placeholder?: string
|
|
2507
|
+
searchParameters?: SearchOptions
|
|
2508
|
+
disableUserPersonalization?: boolean
|
|
2509
|
+
initialQuery?: string
|
|
2510
|
+
insights?: boolean
|
|
2511
|
+
translations?: DocSearchTranslations
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
interface SearchOptions {
|
|
2515
|
+
query?: string
|
|
2516
|
+
similarQuery?: string
|
|
2517
|
+
facetFilters?: string | string[]
|
|
2518
|
+
optionalFilters?: string | string[]
|
|
2519
|
+
numericFilters?: string | string[]
|
|
2520
|
+
tagFilters?: string | string[]
|
|
2521
|
+
sumOrFiltersScores?: boolean
|
|
2522
|
+
filters?: string
|
|
2523
|
+
page?: number
|
|
2524
|
+
hitsPerPage?: number
|
|
2525
|
+
offset?: number
|
|
2526
|
+
length?: number
|
|
2527
|
+
attributesToHighlight?: string[]
|
|
2528
|
+
attributesToSnippet?: string[]
|
|
2529
|
+
attributesToRetrieve?: string[]
|
|
2530
|
+
highlightPreTag?: string
|
|
2531
|
+
highlightPostTag?: string
|
|
2532
|
+
snippetEllipsisText?: string
|
|
2533
|
+
restrictHighlightAndSnippetArrays?: boolean
|
|
2534
|
+
facets?: string[]
|
|
2535
|
+
maxValuesPerFacet?: number
|
|
2536
|
+
facetingAfterDistinct?: boolean
|
|
2537
|
+
minWordSizefor1Typo?: number
|
|
2538
|
+
minWordSizefor2Typos?: number
|
|
2539
|
+
allowTyposOnNumericTokens?: boolean
|
|
2540
|
+
disableTypoToleranceOnAttributes?: string[]
|
|
2541
|
+
queryType?: 'prefixLast' | 'prefixAll' | 'prefixNone'
|
|
2542
|
+
removeWordsIfNoResults?: 'none' | 'lastWords' | 'firstWords' | 'allOptional'
|
|
2543
|
+
advancedSyntax?: boolean
|
|
2544
|
+
advancedSyntaxFeatures?: ('exactPhrase' | 'excludeWords')[]
|
|
2545
|
+
optionalWords?: string | string[]
|
|
2546
|
+
disableExactOnAttributes?: string[]
|
|
2547
|
+
exactOnSingleWordQuery?: 'attribute' | 'none' | 'word'
|
|
2548
|
+
alternativesAsExact?: (
|
|
2549
|
+
| 'ignorePlurals'
|
|
2550
|
+
| 'singleWordSynonym'
|
|
2551
|
+
| 'multiWordsSynonym'
|
|
2552
|
+
)[]
|
|
2553
|
+
enableRules?: boolean
|
|
2554
|
+
ruleContexts?: string[]
|
|
2555
|
+
distinct?: boolean | number
|
|
2556
|
+
analytics?: boolean
|
|
2557
|
+
analyticsTags?: string[]
|
|
2558
|
+
synonyms?: boolean
|
|
2559
|
+
replaceSynonymsInHighlight?: boolean
|
|
2560
|
+
minProximity?: number
|
|
2561
|
+
responseFields?: string[]
|
|
2562
|
+
maxFacetHits?: number
|
|
2563
|
+
percentileComputation?: boolean
|
|
2564
|
+
clickAnalytics?: boolean
|
|
2565
|
+
personalizationImpact?: number
|
|
2566
|
+
enablePersonalization?: boolean
|
|
2567
|
+
restrictSearchableAttributes?: string[]
|
|
2568
|
+
sortFacetValuesBy?: 'count' | 'alpha'
|
|
2569
|
+
typoTolerance?: boolean | 'min' | 'strict'
|
|
2570
|
+
aroundLatLng?: string
|
|
2571
|
+
aroundLatLngViaIP?: boolean
|
|
2572
|
+
aroundRadius?: number | 'all'
|
|
2573
|
+
aroundPrecision?: number | { from: number; value: number }[]
|
|
2574
|
+
minimumAroundRadius?: number
|
|
2575
|
+
insideBoundingBox?: number[][]
|
|
2576
|
+
insidePolygon?: number[][]
|
|
2577
|
+
ignorePlurals?: boolean | string[]
|
|
2578
|
+
removeStopWords?: boolean | string[]
|
|
2579
|
+
naturalLanguages?: string[]
|
|
2580
|
+
getRankingInfo?: boolean
|
|
2581
|
+
userToken?: string
|
|
2582
|
+
enableABTest?: boolean
|
|
2583
|
+
decompoundQuery?: boolean
|
|
2584
|
+
relevancyStrictness?: number
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
interface DocSearchTranslations {
|
|
2588
|
+
button?: ButtonTranslations$1
|
|
2589
|
+
modal?: ModalTranslations$1
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
interface ButtonTranslations$1 {
|
|
2593
|
+
buttonText?: string
|
|
2594
|
+
buttonAriaLabel?: string
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
interface ModalTranslations$1 extends ScreenStateTranslations {
|
|
2598
|
+
searchBox?: SearchBoxTranslations
|
|
2599
|
+
footer?: FooterTranslations$1
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
interface ScreenStateTranslations {
|
|
2603
|
+
errorScreen?: ErrorScreenTranslations
|
|
2604
|
+
startScreen?: StartScreenTranslations
|
|
2605
|
+
noResultsScreen?: NoResultsScreenTranslations
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
interface SearchBoxTranslations {
|
|
2609
|
+
resetButtonTitle?: string
|
|
2610
|
+
resetButtonAriaLabel?: string
|
|
2611
|
+
cancelButtonText?: string
|
|
2612
|
+
cancelButtonAriaLabel?: string
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
interface FooterTranslations$1 {
|
|
2616
|
+
selectText?: string
|
|
2617
|
+
selectKeyAriaLabel?: string
|
|
2618
|
+
navigateText?: string
|
|
2619
|
+
navigateUpKeyAriaLabel?: string
|
|
2620
|
+
navigateDownKeyAriaLabel?: string
|
|
2621
|
+
closeText?: string
|
|
2622
|
+
closeKeyAriaLabel?: string
|
|
2623
|
+
searchByText?: string
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
interface ErrorScreenTranslations {
|
|
2627
|
+
titleText?: string
|
|
2628
|
+
helpText?: string
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
interface StartScreenTranslations {
|
|
2632
|
+
recentSearchesTitle?: string
|
|
2633
|
+
noRecentSearchesText?: string
|
|
2634
|
+
saveRecentSearchButtonTitle?: string
|
|
2635
|
+
removeRecentSearchButtonTitle?: string
|
|
2636
|
+
favoriteSearchesTitle?: string
|
|
2637
|
+
removeFavoriteSearchButtonTitle?: string
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
interface NoResultsScreenTranslations {
|
|
2641
|
+
noResultsText?: string
|
|
2642
|
+
suggestedQueryText?: string
|
|
2643
|
+
reportMissingResultsText?: string
|
|
2644
|
+
reportMissingResultsLinkText?: string
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
interface LocalSearchTranslations {
|
|
2648
|
+
button?: ButtonTranslations
|
|
2649
|
+
modal?: ModalTranslations
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
interface ButtonTranslations {
|
|
2653
|
+
buttonText?: string
|
|
2654
|
+
buttonAriaLabel?: string
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
interface ModalTranslations {
|
|
2658
|
+
displayDetails?: string
|
|
2659
|
+
resetButtonTitle?: string
|
|
2660
|
+
backButtonTitle?: string
|
|
2661
|
+
noResultsText?: string
|
|
2662
|
+
footer?: FooterTranslations
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
interface FooterTranslations {
|
|
2666
|
+
selectText?: string
|
|
2667
|
+
selectKeyAriaLabel?: string
|
|
2668
|
+
navigateText?: string
|
|
2669
|
+
navigateUpKeyAriaLabel?: string
|
|
2670
|
+
navigateDownKeyAriaLabel?: string
|
|
2671
|
+
closeText?: string
|
|
2672
|
+
closeKeyAriaLabel?: string
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
interface PageSplitSection {
|
|
2676
|
+
anchor?: string
|
|
2677
|
+
titles: string[]
|
|
2678
|
+
text: string
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
declare namespace DefaultTheme {
|
|
2682
|
+
export interface Config {
|
|
2683
|
+
/**
|
|
2684
|
+
* The logo file of the site.
|
|
2685
|
+
*
|
|
2686
|
+
* @example '/logo.svg'
|
|
2687
|
+
*/
|
|
2688
|
+
logo?: ThemeableImage
|
|
2689
|
+
|
|
2690
|
+
/**
|
|
2691
|
+
* Overrides the link of the site logo.
|
|
2692
|
+
*/
|
|
2693
|
+
logoLink?: string | { link?: string; rel?: string; target?: string }
|
|
2694
|
+
|
|
2695
|
+
/**
|
|
2696
|
+
* Custom site title in navbar. If the value is undefined,
|
|
2697
|
+
* `config.title` will be used.
|
|
2698
|
+
*/
|
|
2699
|
+
siteTitle?: string | false
|
|
2700
|
+
|
|
2701
|
+
/**
|
|
2702
|
+
* Custom header levels of outline in the aside component.
|
|
2703
|
+
*
|
|
2704
|
+
* @default 2
|
|
2705
|
+
*/
|
|
2706
|
+
outline?: Outline | Outline['level'] | false
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* @deprecated Use `outline.label` instead.
|
|
2710
|
+
*
|
|
2711
|
+
* @default 'On this page'
|
|
2712
|
+
*/
|
|
2713
|
+
outlineTitle?: string
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* The nav items.
|
|
2717
|
+
*/
|
|
2718
|
+
nav?: NavItem[]
|
|
2719
|
+
|
|
2720
|
+
/**
|
|
2721
|
+
* The sidebar items.
|
|
2722
|
+
*/
|
|
2723
|
+
sidebar?: Sidebar
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* Set to `false` to prevent rendering of aside container.
|
|
2727
|
+
* Set to `true` to render the aside to the right.
|
|
2728
|
+
* Set to `left` to render the aside to the left.
|
|
2729
|
+
*
|
|
2730
|
+
* @default true
|
|
2731
|
+
*/
|
|
2732
|
+
aside?: boolean | 'left'
|
|
2733
|
+
|
|
2734
|
+
/**
|
|
2735
|
+
* Info for the edit link. If it's undefined, the edit link feature will
|
|
2736
|
+
* be disabled.
|
|
2737
|
+
*/
|
|
2738
|
+
editLink?: EditLink
|
|
2739
|
+
|
|
2740
|
+
/**
|
|
2741
|
+
* @deprecated Use `lastUpdated.text` instead.
|
|
2742
|
+
*
|
|
2743
|
+
* Set custom last updated text.
|
|
2744
|
+
*
|
|
2745
|
+
* @default 'Last updated'
|
|
2746
|
+
*/
|
|
2747
|
+
lastUpdatedText?: string
|
|
2748
|
+
|
|
2749
|
+
lastUpdated?: LastUpdatedOptions
|
|
2750
|
+
|
|
2751
|
+
/**
|
|
2752
|
+
* Set custom prev/next labels.
|
|
2753
|
+
*/
|
|
2754
|
+
docFooter?: DocFooter
|
|
2755
|
+
|
|
2756
|
+
/**
|
|
2757
|
+
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
2758
|
+
* placing links to social services such as GitHub, Twitter, Facebook, etc.
|
|
2759
|
+
*/
|
|
2760
|
+
socialLinks?: SocialLink[]
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* The footer configuration.
|
|
2764
|
+
*/
|
|
2765
|
+
footer?: Footer
|
|
2766
|
+
|
|
2767
|
+
/**
|
|
2768
|
+
* @default 'Appearance'
|
|
2769
|
+
*/
|
|
2770
|
+
darkModeSwitchLabel?: string
|
|
2771
|
+
|
|
2772
|
+
/**
|
|
2773
|
+
* @default 'Switch to light theme'
|
|
2774
|
+
*/
|
|
2775
|
+
lightModeSwitchTitle?: string
|
|
2776
|
+
|
|
2777
|
+
/**
|
|
2778
|
+
* @default 'Switch to dark theme'
|
|
2779
|
+
*/
|
|
2780
|
+
darkModeSwitchTitle?: string
|
|
2781
|
+
|
|
2782
|
+
/**
|
|
2783
|
+
* @default 'Menu'
|
|
2784
|
+
*/
|
|
2785
|
+
sidebarMenuLabel?: string
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* @default 'Return to top'
|
|
2789
|
+
*/
|
|
2790
|
+
returnToTopLabel?: string
|
|
2791
|
+
|
|
2792
|
+
/**
|
|
2793
|
+
* Set custom `aria-label` for language menu button.
|
|
2794
|
+
*
|
|
2795
|
+
* @default 'Change language'
|
|
2796
|
+
*/
|
|
2797
|
+
langMenuLabel?: string
|
|
2798
|
+
|
|
2799
|
+
search?:
|
|
2800
|
+
| { provider: 'local'; options?: LocalSearchOptions }
|
|
2801
|
+
| { provider: 'algolia'; options: AlgoliaSearchOptions }
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* @deprecated Use `search` instead.
|
|
2805
|
+
*/
|
|
2806
|
+
algolia?: AlgoliaSearchOptions
|
|
2807
|
+
|
|
2808
|
+
/**
|
|
2809
|
+
* The carbon ads options. Leave it undefined to disable the ads feature.
|
|
2810
|
+
*/
|
|
2811
|
+
carbonAds?: CarbonAdsOptions
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* Changing locale when current url is `/foo` will redirect to `/locale/foo`.
|
|
2815
|
+
*
|
|
2816
|
+
* @default true
|
|
2817
|
+
*/
|
|
2818
|
+
i18nRouting?: boolean
|
|
2819
|
+
|
|
2820
|
+
/**
|
|
2821
|
+
* Show external link icon in Markdown links.
|
|
2822
|
+
*
|
|
2823
|
+
* @default false
|
|
2824
|
+
*/
|
|
2825
|
+
externalLinkIcon?: boolean
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* Customize text of 404 page.
|
|
2829
|
+
*/
|
|
2830
|
+
notFound?: NotFoundOptions
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
// nav -----------------------------------------------------------------------
|
|
2834
|
+
|
|
2835
|
+
export type NavItem = NavItemWithLink | NavItemWithChildren
|
|
2836
|
+
|
|
2837
|
+
export interface NavItemWithLink {
|
|
2838
|
+
text: string
|
|
2839
|
+
link: string
|
|
2840
|
+
items?: never
|
|
2841
|
+
|
|
2842
|
+
/**
|
|
2843
|
+
* `activeMatch` is expected to be a regex string. We can't use actual
|
|
2844
|
+
* RegExp object here because it isn't serializable
|
|
2845
|
+
*/
|
|
2846
|
+
activeMatch?: string
|
|
2847
|
+
rel?: string
|
|
2848
|
+
target?: string
|
|
2849
|
+
noIcon?: boolean
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
|
+
export interface NavItemChildren {
|
|
2853
|
+
text?: string
|
|
2854
|
+
items: NavItemWithLink[]
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
export interface NavItemWithChildren {
|
|
2858
|
+
text?: string
|
|
2859
|
+
items: (NavItemChildren | NavItemWithLink)[]
|
|
2860
|
+
|
|
2861
|
+
/**
|
|
2862
|
+
* `activeMatch` is expected to be a regex string. We can't use actual
|
|
2863
|
+
* RegExp object here because it isn't serializable
|
|
2864
|
+
*/
|
|
2865
|
+
activeMatch?: string
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
// image ---------------------------------------------------------------------
|
|
2869
|
+
|
|
2870
|
+
export type ThemeableImage =
|
|
2871
|
+
| string
|
|
2872
|
+
| { src: string; alt?: string; [prop: string]: any }
|
|
2873
|
+
| { light: string; dark: string; alt?: string; [prop: string]: any }
|
|
2874
|
+
|
|
2875
|
+
export type FeatureIcon =
|
|
2876
|
+
| string
|
|
2877
|
+
| {
|
|
2878
|
+
src: string
|
|
2879
|
+
alt?: string
|
|
2880
|
+
width?: string
|
|
2881
|
+
height?: string
|
|
2882
|
+
wrap?: boolean
|
|
2883
|
+
}
|
|
2884
|
+
| {
|
|
2885
|
+
light: string
|
|
2886
|
+
dark: string
|
|
2887
|
+
alt?: string
|
|
2888
|
+
width?: string
|
|
2889
|
+
height?: string
|
|
2890
|
+
wrap?: boolean
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
// sidebar -------------------------------------------------------------------
|
|
2894
|
+
|
|
2895
|
+
export type Sidebar = SidebarItem[] | SidebarMulti
|
|
2896
|
+
|
|
2897
|
+
export interface SidebarMulti {
|
|
2898
|
+
[path: string]: SidebarItem[] | { items: SidebarItem[]; base: string }
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
export type SidebarItem = {
|
|
2902
|
+
/**
|
|
2903
|
+
* The text label of the item.
|
|
2904
|
+
*/
|
|
2905
|
+
text?: string
|
|
2906
|
+
|
|
2907
|
+
/**
|
|
2908
|
+
* The link of the item.
|
|
2909
|
+
*/
|
|
2910
|
+
link?: string
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* The children of the item.
|
|
2914
|
+
*/
|
|
2915
|
+
items?: SidebarItem[]
|
|
2916
|
+
|
|
2917
|
+
/**
|
|
2918
|
+
* If not specified, group is not collapsible.
|
|
2919
|
+
*
|
|
2920
|
+
* If `true`, group is collapsible and collapsed by default
|
|
2921
|
+
*
|
|
2922
|
+
* If `false`, group is collapsible but expanded by default
|
|
2923
|
+
*/
|
|
2924
|
+
collapsed?: boolean
|
|
2925
|
+
|
|
2926
|
+
/**
|
|
2927
|
+
* Base path for the children items.
|
|
2928
|
+
*/
|
|
2929
|
+
base?: string
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* Customize text that appears on the footer of previous/next page.
|
|
2933
|
+
*/
|
|
2934
|
+
docFooterText?: string
|
|
2935
|
+
|
|
2936
|
+
rel?: string
|
|
2937
|
+
target?: string
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
/**
|
|
2941
|
+
* ReturnType of `useSidebar`
|
|
2942
|
+
*/
|
|
2943
|
+
export interface DocSidebar {
|
|
2944
|
+
isOpen: Ref$1<boolean>
|
|
2945
|
+
sidebar: ComputedRef<SidebarItem[]>
|
|
2946
|
+
sidebarGroups: ComputedRef<SidebarItem[]>
|
|
2947
|
+
hasSidebar: ComputedRef<boolean>
|
|
2948
|
+
hasAside: ComputedRef<boolean>
|
|
2949
|
+
leftAside: ComputedRef<boolean>
|
|
2950
|
+
isSidebarEnabled: ComputedRef<boolean>
|
|
2951
|
+
open: () => void
|
|
2952
|
+
close: () => void
|
|
2953
|
+
toggle: () => void
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
// edit link -----------------------------------------------------------------
|
|
2957
|
+
|
|
2958
|
+
export interface EditLink {
|
|
2959
|
+
/**
|
|
2960
|
+
* Pattern for edit link.
|
|
2961
|
+
*
|
|
2962
|
+
* @example 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
|
|
2963
|
+
* @example ({ filePath }) => { ... }
|
|
2964
|
+
*/
|
|
2965
|
+
pattern: string | ((payload: PageData) => string)
|
|
2966
|
+
|
|
2967
|
+
/**
|
|
2968
|
+
* Custom text for edit link.
|
|
2969
|
+
*
|
|
2970
|
+
* @default 'Edit this page'
|
|
2971
|
+
*/
|
|
2972
|
+
text?: string
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
// prev-next -----------------------------------------------------------------
|
|
2976
|
+
|
|
2977
|
+
export interface DocFooter {
|
|
2978
|
+
/**
|
|
2979
|
+
* Custom label for previous page button. Can be set to `false` to disable.
|
|
2980
|
+
*
|
|
2981
|
+
* @default 'Previous page'
|
|
2982
|
+
*/
|
|
2983
|
+
prev?: string | boolean
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* Custom label for next page button. Can be set to `false` to disable.
|
|
2987
|
+
*
|
|
2988
|
+
* @default 'Next page'
|
|
2989
|
+
*/
|
|
2990
|
+
next?: string | boolean
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
// social link ---------------------------------------------------------------
|
|
2994
|
+
|
|
2995
|
+
export interface SocialLink {
|
|
2996
|
+
icon: SocialLinkIcon
|
|
2997
|
+
link: string
|
|
2998
|
+
ariaLabel?: string
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
export type SocialLinkIcon =
|
|
3002
|
+
| 'discord'
|
|
3003
|
+
| 'facebook'
|
|
3004
|
+
| 'github'
|
|
3005
|
+
| 'instagram'
|
|
3006
|
+
| 'linkedin'
|
|
3007
|
+
| 'mastodon'
|
|
3008
|
+
| 'npm'
|
|
3009
|
+
| 'slack'
|
|
3010
|
+
| 'twitter'
|
|
3011
|
+
| 'x'
|
|
3012
|
+
| 'youtube'
|
|
3013
|
+
| { svg: string }
|
|
3014
|
+
|
|
3015
|
+
// footer --------------------------------------------------------------------
|
|
3016
|
+
|
|
3017
|
+
export interface Footer {
|
|
3018
|
+
message?: string
|
|
3019
|
+
copyright?: string
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
// team ----------------------------------------------------------------------
|
|
3023
|
+
|
|
3024
|
+
export interface TeamMember {
|
|
3025
|
+
avatar: string
|
|
3026
|
+
name: string
|
|
3027
|
+
title?: string
|
|
3028
|
+
org?: string
|
|
3029
|
+
orgLink?: string
|
|
3030
|
+
desc?: string
|
|
3031
|
+
links?: SocialLink[]
|
|
3032
|
+
sponsor?: string
|
|
3033
|
+
actionText?: string
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
// local nav -----------------------------------------------------------------
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* ReturnType of `useLocalNav`.
|
|
3040
|
+
*/
|
|
3041
|
+
export interface DocLocalNav {
|
|
3042
|
+
/**
|
|
3043
|
+
* The outline headers of the current page.
|
|
3044
|
+
*/
|
|
3045
|
+
headers: ShallowRef<MenuItem[]>
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* Whether the current page has a local nav. Local nav is shown when the
|
|
3049
|
+
* "outline" is present in the page. However, note that the actual
|
|
3050
|
+
* local nav visibility depends on the screen width as well.
|
|
3051
|
+
*/
|
|
3052
|
+
hasLocalNav: ComputedRef<boolean>
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
// outline -------------------------------------------------------------------
|
|
3056
|
+
|
|
3057
|
+
export interface Outline {
|
|
3058
|
+
level?: number | [number, number] | 'deep'
|
|
3059
|
+
label?: string
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// local search --------------------------------------------------------------
|
|
3063
|
+
|
|
3064
|
+
export interface LocalSearchOptions {
|
|
3065
|
+
/**
|
|
3066
|
+
* @default false
|
|
3067
|
+
* @deprecated Use `detailedView: false` instead.
|
|
3068
|
+
*/
|
|
3069
|
+
disableDetailedView?: boolean
|
|
3070
|
+
|
|
3071
|
+
/**
|
|
3072
|
+
* If `true`, the detailed view will be enabled by default.
|
|
3073
|
+
* If `false`, the detailed view will be disabled.
|
|
3074
|
+
* If `'auto'`, the detailed view will be disabled by default, but can be enabled by the user.
|
|
3075
|
+
*
|
|
3076
|
+
* @default 'auto'
|
|
3077
|
+
*/
|
|
3078
|
+
detailedView?: boolean | 'auto'
|
|
3079
|
+
|
|
3080
|
+
/**
|
|
3081
|
+
* @default false
|
|
3082
|
+
*/
|
|
3083
|
+
disableQueryPersistence?: boolean
|
|
3084
|
+
|
|
3085
|
+
translations?: LocalSearchTranslations
|
|
3086
|
+
locales?: Record<string, Partial<Omit<LocalSearchOptions, 'locales'>>>
|
|
3087
|
+
|
|
3088
|
+
miniSearch?: {
|
|
3089
|
+
/**
|
|
3090
|
+
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
|
|
3091
|
+
*/
|
|
3092
|
+
options?: Pick<
|
|
3093
|
+
Options$2,
|
|
3094
|
+
'extractField' | 'tokenize' | 'processTerm'
|
|
3095
|
+
>
|
|
3096
|
+
/**
|
|
3097
|
+
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchoptions-1
|
|
3098
|
+
*/
|
|
3099
|
+
searchOptions?: Options$2['searchOptions']
|
|
3100
|
+
|
|
3101
|
+
/**
|
|
3102
|
+
* Overrides the default regex based page splitter.
|
|
3103
|
+
* Supports async generator, making it possible to run in true parallel
|
|
3104
|
+
* (when used along with `node:child_process` or `worker_threads`)
|
|
3105
|
+
* ---
|
|
3106
|
+
* This should be especially useful for scalability reasons.
|
|
3107
|
+
* ---
|
|
3108
|
+
* @param {string} path - absolute path to the markdown source file
|
|
3109
|
+
* @param {string} html - document page rendered as html
|
|
3110
|
+
*/
|
|
3111
|
+
_splitIntoSections?: (
|
|
3112
|
+
path: string,
|
|
3113
|
+
html: string
|
|
3114
|
+
) =>
|
|
3115
|
+
| AsyncGenerator<PageSplitSection>
|
|
3116
|
+
| Generator<PageSplitSection>
|
|
3117
|
+
| Awaitable<PageSplitSection[]>
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* Allows transformation of content before indexing (node only)
|
|
3121
|
+
* Return empty string to skip indexing
|
|
3122
|
+
*/
|
|
3123
|
+
_render?: (
|
|
3124
|
+
src: string,
|
|
3125
|
+
env: MarkdownEnv,
|
|
3126
|
+
md: MarkdownIt
|
|
3127
|
+
) => Awaitable<string>
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
// algolia -------------------------------------------------------------------
|
|
3131
|
+
|
|
3132
|
+
/**
|
|
3133
|
+
* Algolia search options. Partially copied from
|
|
3134
|
+
* `@docsearch/react/dist/esm/DocSearch.d.ts`
|
|
3135
|
+
*/
|
|
3136
|
+
export interface AlgoliaSearchOptions extends DocSearchProps {
|
|
3137
|
+
locales?: Record<string, Partial<DocSearchProps>>
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
// carbon ads ----------------------------------------------------------------
|
|
3141
|
+
|
|
3142
|
+
export interface CarbonAdsOptions {
|
|
3143
|
+
code: string
|
|
3144
|
+
placement: string
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
// last updated --------------------------------------------------------------
|
|
3148
|
+
|
|
3149
|
+
export interface LastUpdatedOptions {
|
|
3150
|
+
/**
|
|
3151
|
+
* Set custom last updated text.
|
|
3152
|
+
*
|
|
3153
|
+
* @default 'Last updated'
|
|
3154
|
+
*/
|
|
3155
|
+
text?: string
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* Set options for last updated time formatting.
|
|
3159
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options
|
|
3160
|
+
*
|
|
3161
|
+
* @default
|
|
3162
|
+
* { dateStyle: 'short', timeStyle: 'short' }
|
|
3163
|
+
*/
|
|
3164
|
+
formatOptions?: Intl.DateTimeFormatOptions & { forceLocale?: boolean }
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
// not found -----------------------------------------------------------------
|
|
3168
|
+
|
|
3169
|
+
export interface NotFoundOptions {
|
|
3170
|
+
/**
|
|
3171
|
+
* Set custom not found message.
|
|
3172
|
+
*
|
|
3173
|
+
* @default 'PAGE NOT FOUND'
|
|
3174
|
+
*/
|
|
3175
|
+
title?: string
|
|
3176
|
+
|
|
3177
|
+
/**
|
|
3178
|
+
* Set custom not found description.
|
|
3179
|
+
*
|
|
3180
|
+
* @default "But if you don't change your direction, and if you keep looking, you may end up where you are heading."
|
|
3181
|
+
*/
|
|
3182
|
+
quote?: string
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* Set aria label for home link.
|
|
3186
|
+
*
|
|
3187
|
+
* @default 'go to home'
|
|
3188
|
+
*/
|
|
3189
|
+
linkLabel?: string
|
|
3190
|
+
|
|
3191
|
+
/**
|
|
3192
|
+
* Set custom home link text.
|
|
3193
|
+
*
|
|
3194
|
+
* @default 'Take me home'
|
|
3195
|
+
*/
|
|
3196
|
+
linkText?: string
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* @default '404'
|
|
3200
|
+
*/
|
|
3201
|
+
code?: string
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
// types shared between server and client
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
type Awaitable<T> = T | PromiseLike<T>
|
|
3209
|
+
|
|
3210
|
+
interface PageData {
|
|
3211
|
+
relativePath: string
|
|
3212
|
+
filePath: string // differs from relativePath in case of path rewrites
|
|
3213
|
+
title: string
|
|
3214
|
+
titleTemplate?: string | boolean
|
|
3215
|
+
description: string
|
|
3216
|
+
headers: Header[]
|
|
3217
|
+
frontmatter: Record<string, any>
|
|
3218
|
+
params?: Record<string, any>
|
|
3219
|
+
isNotFound?: boolean
|
|
3220
|
+
lastUpdated?: number
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
/**
|
|
3224
|
+
* SFC block extracted from markdown
|
|
3225
|
+
*/
|
|
3226
|
+
interface SfcBlock$1 {
|
|
3227
|
+
/**
|
|
3228
|
+
* The type of the block
|
|
3229
|
+
*/
|
|
3230
|
+
type: string
|
|
3231
|
+
/**
|
|
3232
|
+
* The content, including open-tag and close-tag
|
|
3233
|
+
*/
|
|
3234
|
+
content: string
|
|
3235
|
+
/**
|
|
3236
|
+
* The content that stripped open-tag and close-tag off
|
|
3237
|
+
*/
|
|
3238
|
+
contentStripped: string
|
|
3239
|
+
/**
|
|
3240
|
+
* The open-tag
|
|
3241
|
+
*/
|
|
3242
|
+
tagOpen: string
|
|
3243
|
+
/**
|
|
3244
|
+
* The close-tag
|
|
3245
|
+
*/
|
|
3246
|
+
tagClose: string
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
interface MarkdownSfcBlocks$1 {
|
|
3250
|
+
/**
|
|
3251
|
+
* The `<template>` block
|
|
3252
|
+
*/
|
|
3253
|
+
template: SfcBlock$1 | null
|
|
3254
|
+
/**
|
|
3255
|
+
* The common `<script>` block
|
|
3256
|
+
*/
|
|
3257
|
+
script: SfcBlock$1 | null
|
|
3258
|
+
/**
|
|
3259
|
+
* The `<script setup>` block
|
|
3260
|
+
*/
|
|
3261
|
+
scriptSetup: SfcBlock$1 | null
|
|
3262
|
+
/**
|
|
3263
|
+
* All `<script>` blocks.
|
|
3264
|
+
*
|
|
3265
|
+
* By default, SFC only allows one `<script>` block and one `<script setup>` block.
|
|
3266
|
+
* However, some tools may support different types of `<script>`s, so we keep all of them here.
|
|
3267
|
+
*/
|
|
3268
|
+
scripts: SfcBlock$1[]
|
|
3269
|
+
/**
|
|
3270
|
+
* All `<style>` blocks.
|
|
3271
|
+
*/
|
|
3272
|
+
styles: SfcBlock$1[]
|
|
3273
|
+
/**
|
|
3274
|
+
* All custom blocks.
|
|
3275
|
+
*/
|
|
3276
|
+
customBlocks: SfcBlock$1[]
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
interface Header {
|
|
3280
|
+
/**
|
|
3281
|
+
* The level of the header
|
|
3282
|
+
*
|
|
3283
|
+
* `1` to `6` for `<h1>` to `<h6>`
|
|
3284
|
+
*/
|
|
3285
|
+
level: number
|
|
3286
|
+
/**
|
|
3287
|
+
* The title of the header
|
|
3288
|
+
*/
|
|
3289
|
+
title: string
|
|
3290
|
+
/**
|
|
3291
|
+
* The slug of the header
|
|
3292
|
+
*
|
|
3293
|
+
* Typically the `id` attr of the header anchor
|
|
3294
|
+
*/
|
|
3295
|
+
slug: string
|
|
3296
|
+
/**
|
|
3297
|
+
* Link of the header
|
|
3298
|
+
*
|
|
3299
|
+
* Typically using `#${slug}` as the anchor hash
|
|
3300
|
+
*/
|
|
3301
|
+
link: string
|
|
3302
|
+
/**
|
|
3303
|
+
* The children of the header
|
|
3304
|
+
*/
|
|
3305
|
+
children: Header[]
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
interface SiteData<ThemeConfig = any> {
|
|
3309
|
+
base: string
|
|
3310
|
+
cleanUrls?: boolean
|
|
3311
|
+
lang: string
|
|
3312
|
+
dir: string
|
|
3313
|
+
title: string
|
|
3314
|
+
titleTemplate?: string | boolean
|
|
3315
|
+
description: string
|
|
3316
|
+
head: HeadConfig[]
|
|
3317
|
+
appearance:
|
|
3318
|
+
| boolean
|
|
3319
|
+
| 'dark'
|
|
3320
|
+
| 'force-dark'
|
|
3321
|
+
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
|
|
3322
|
+
themeConfig: ThemeConfig
|
|
3323
|
+
scrollOffset:
|
|
3324
|
+
| number
|
|
3325
|
+
| string
|
|
3326
|
+
| string[]
|
|
3327
|
+
| { selector: string | string[]; padding: number }
|
|
3328
|
+
locales: LocaleConfig<ThemeConfig>
|
|
3329
|
+
localeIndex?: string
|
|
3330
|
+
contentProps?: Record<string, any>
|
|
3331
|
+
router: {
|
|
3332
|
+
prefetchLinks: boolean
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
type HeadConfig =
|
|
3337
|
+
| [string, Record<string, string>]
|
|
3338
|
+
| [string, Record<string, string>, string]
|
|
3339
|
+
|
|
3340
|
+
interface SSGContext extends SSRContext {
|
|
3341
|
+
content: string
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
interface LocaleSpecificConfig<ThemeConfig = any> {
|
|
3345
|
+
lang?: string
|
|
3346
|
+
dir?: string
|
|
3347
|
+
title?: string
|
|
3348
|
+
titleTemplate?: string | boolean
|
|
3349
|
+
description?: string
|
|
3350
|
+
head?: HeadConfig[]
|
|
3351
|
+
themeConfig?: ThemeConfig
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
type LocaleConfig<ThemeConfig = any> = Record<
|
|
3355
|
+
string,
|
|
3356
|
+
LocaleSpecificConfig<ThemeConfig> & { label: string; link?: string }
|
|
3357
|
+
>
|
|
3358
|
+
|
|
3359
|
+
// Manually declaring all properties as rollup-plugin-dts
|
|
3360
|
+
// is unable to merge augmented module declarations
|
|
3361
|
+
|
|
3362
|
+
interface MarkdownEnv {
|
|
3363
|
+
/**
|
|
3364
|
+
* The raw Markdown content without frontmatter
|
|
3365
|
+
*/
|
|
3366
|
+
content?: string
|
|
3367
|
+
/**
|
|
3368
|
+
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
|
|
3369
|
+
*
|
|
3370
|
+
* - Would be the rendered HTML when `renderExcerpt` is enabled
|
|
3371
|
+
* - Would be the raw Markdown when `renderExcerpt` is disabled
|
|
3372
|
+
*/
|
|
3373
|
+
excerpt?: string
|
|
3374
|
+
/**
|
|
3375
|
+
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
|
|
3376
|
+
*/
|
|
3377
|
+
frontmatter?: Record<string, unknown>
|
|
3378
|
+
/**
|
|
3379
|
+
* The headers that extracted by `@mdit-vue/plugin-headers`
|
|
3380
|
+
*/
|
|
3381
|
+
headers?: Header[]
|
|
3382
|
+
/**
|
|
3383
|
+
* SFC blocks that extracted by `@mdit-vue/plugin-sfc`
|
|
3384
|
+
*/
|
|
3385
|
+
sfcBlocks?: MarkdownSfcBlocks$1
|
|
3386
|
+
/**
|
|
3387
|
+
* The title that extracted by `@mdit-vue/plugin-title`
|
|
3388
|
+
*/
|
|
3389
|
+
title?: string
|
|
3390
|
+
path: string
|
|
3391
|
+
relativePath: string
|
|
3392
|
+
cleanUrls: boolean
|
|
3393
|
+
links?: string[]
|
|
3394
|
+
includes?: string[]
|
|
3395
|
+
realPath?: string
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* How frequently the page is likely to change. This value provides general
|
|
3400
|
+
* information to search engines and may not correlate exactly to how often they crawl the page. Please note that the
|
|
3401
|
+
* value of this tag is considered a hint and not a command. See
|
|
3402
|
+
* <https://www.sitemaps.org/protocol.html#xmlTagDefinitions> for the acceptable
|
|
3403
|
+
* values
|
|
3404
|
+
*/
|
|
3405
|
+
declare enum EnumChangefreq {
|
|
3406
|
+
DAILY = "daily",
|
|
3407
|
+
MONTHLY = "monthly",
|
|
3408
|
+
ALWAYS = "always",
|
|
3409
|
+
HOURLY = "hourly",
|
|
3410
|
+
WEEKLY = "weekly",
|
|
3411
|
+
YEARLY = "yearly",
|
|
3412
|
+
NEVER = "never"
|
|
3413
|
+
}
|
|
3414
|
+
/**
|
|
3415
|
+
* https://support.google.com/webmasters/answer/74288?hl=en&ref_topic=4581190
|
|
3416
|
+
*/
|
|
3417
|
+
interface NewsItem {
|
|
3418
|
+
access?: 'Registration' | 'Subscription';
|
|
3419
|
+
publication: {
|
|
3420
|
+
name: string;
|
|
3421
|
+
/**
|
|
3422
|
+
* The `<language>` is the language of your publication. Use an ISO 639
|
|
3423
|
+
* language code (2 or 3 letters).
|
|
3424
|
+
*/
|
|
3425
|
+
language: string;
|
|
3426
|
+
};
|
|
3427
|
+
/**
|
|
3428
|
+
* @example 'PressRelease, Blog'
|
|
3429
|
+
*/
|
|
3430
|
+
genres?: string;
|
|
3431
|
+
/**
|
|
3432
|
+
* Article publication date in W3C format, using either the "complete date" (YYYY-MM-DD) format or the "complete date
|
|
3433
|
+
* plus hours, minutes, and seconds"
|
|
3434
|
+
*/
|
|
3435
|
+
publication_date: string;
|
|
3436
|
+
/**
|
|
3437
|
+
* The title of the news article
|
|
3438
|
+
* @example 'Companies A, B in Merger Talks'
|
|
3439
|
+
*/
|
|
3440
|
+
title: string;
|
|
3441
|
+
/**
|
|
3442
|
+
* @example 'business, merger, acquisition'
|
|
3443
|
+
*/
|
|
3444
|
+
keywords?: string;
|
|
3445
|
+
/**
|
|
3446
|
+
* @example 'NASDAQ:A, NASDAQ:B'
|
|
3447
|
+
*/
|
|
3448
|
+
stock_tickers?: string;
|
|
3449
|
+
}
|
|
3450
|
+
/**
|
|
3451
|
+
* Sitemap Image
|
|
3452
|
+
* https://support.google.com/webmasters/answer/178636?hl=en&ref_topic=4581190
|
|
3453
|
+
*/
|
|
3454
|
+
interface Img {
|
|
3455
|
+
/**
|
|
3456
|
+
* The URL of the image
|
|
3457
|
+
* @example 'https://example.com/image.jpg'
|
|
3458
|
+
*/
|
|
3459
|
+
url: string;
|
|
3460
|
+
/**
|
|
3461
|
+
* The caption of the image
|
|
3462
|
+
* @example 'Thanksgiving dinner'
|
|
3463
|
+
*/
|
|
3464
|
+
caption?: string;
|
|
3465
|
+
/**
|
|
3466
|
+
* The title of the image
|
|
3467
|
+
* @example 'Star Wars EP IV'
|
|
3468
|
+
*/
|
|
3469
|
+
title?: string;
|
|
3470
|
+
/**
|
|
3471
|
+
* The geographic location of the image.
|
|
3472
|
+
* @example 'Limerick, Ireland'
|
|
3473
|
+
*/
|
|
3474
|
+
geoLocation?: string;
|
|
3475
|
+
/**
|
|
3476
|
+
* A URL to the license of the image.
|
|
3477
|
+
* @example 'https://example.com/license.txt'
|
|
3478
|
+
*/
|
|
3479
|
+
license?: string;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* https://support.google.com/webmasters/answer/189077
|
|
3483
|
+
*/
|
|
3484
|
+
interface LinkItem {
|
|
3485
|
+
/**
|
|
3486
|
+
* @example 'en'
|
|
3487
|
+
*/
|
|
3488
|
+
lang: string;
|
|
3489
|
+
/**
|
|
3490
|
+
* @example 'en-us'
|
|
3491
|
+
*/
|
|
3492
|
+
hreflang?: string;
|
|
3493
|
+
url: string;
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* How to handle errors in passed in urls
|
|
3497
|
+
*/
|
|
3498
|
+
declare enum ErrorLevel {
|
|
3499
|
+
/**
|
|
3500
|
+
* Validation will be skipped and nothing logged or thrown.
|
|
3501
|
+
*/
|
|
3502
|
+
SILENT = "silent",
|
|
3503
|
+
/**
|
|
3504
|
+
* If an invalid value is encountered, a console.warn will be called with details
|
|
3505
|
+
*/
|
|
3506
|
+
WARN = "warn",
|
|
3507
|
+
/**
|
|
3508
|
+
* An Error will be thrown on encountering invalid data.
|
|
3509
|
+
*/
|
|
3510
|
+
THROW = "throw"
|
|
3511
|
+
}
|
|
3512
|
+
declare type ErrorHandler = (error: Error, level: ErrorLevel) => void;
|
|
3513
|
+
|
|
3514
|
+
interface NSArgs {
|
|
3515
|
+
news: boolean;
|
|
3516
|
+
video: boolean;
|
|
3517
|
+
xhtml: boolean;
|
|
3518
|
+
image: boolean;
|
|
3519
|
+
custom?: string[];
|
|
3520
|
+
}
|
|
3521
|
+
interface SitemapStreamOptions extends TransformOptions {
|
|
3522
|
+
hostname?: string;
|
|
3523
|
+
level?: ErrorLevel;
|
|
3524
|
+
lastmodDateOnly?: boolean;
|
|
3525
|
+
xmlns?: NSArgs;
|
|
3526
|
+
xslUrl?: string;
|
|
3527
|
+
errorHandler?: ErrorHandler;
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
interface SitemapItem {
|
|
3531
|
+
lastmod?: string | number | Date;
|
|
3532
|
+
changefreq?: `${EnumChangefreq}`;
|
|
3533
|
+
fullPrecisionPriority?: boolean;
|
|
3534
|
+
priority?: number;
|
|
3535
|
+
news?: NewsItem;
|
|
3536
|
+
expires?: string;
|
|
3537
|
+
androidLink?: string;
|
|
3538
|
+
ampLink?: string;
|
|
3539
|
+
url: string;
|
|
3540
|
+
video?: any;
|
|
3541
|
+
img?: string | Img | (string | Img)[];
|
|
3542
|
+
links?: LinkItem[];
|
|
3543
|
+
lastmodfile?: string | Buffer | URL;
|
|
3544
|
+
lastmodISO?: string;
|
|
3545
|
+
lastmodrealtime?: boolean;
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
/**
|
|
3549
|
+
* Options of @mdit-vue/plugin-component
|
|
3550
|
+
*/
|
|
3551
|
+
interface ComponentPluginOptions {
|
|
3552
|
+
/**
|
|
3553
|
+
* Extra tags to be treated as block tags.
|
|
3554
|
+
*
|
|
3555
|
+
* @default []
|
|
3556
|
+
*/
|
|
3557
|
+
blockTags?: string[];
|
|
3558
|
+
/**
|
|
3559
|
+
* Extra tags to be treated as inline tags.
|
|
3560
|
+
*
|
|
3561
|
+
* @default []
|
|
3562
|
+
*/
|
|
3563
|
+
inlineTags?: string[];
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
/**
|
|
3567
|
+
* Takes a string or object with `content` property, extracts
|
|
3568
|
+
* and parses front-matter from the string, then returns an object
|
|
3569
|
+
* with `data`, `content` and other [useful properties](#returned-object).
|
|
3570
|
+
*
|
|
3571
|
+
* ```js
|
|
3572
|
+
* var matter = require('gray-matter');
|
|
3573
|
+
* console.log(matter('---\ntitle: Home\n---\nOther stuff'));
|
|
3574
|
+
* //=> { data: { title: 'Home'}, content: 'Other stuff' }
|
|
3575
|
+
* ```
|
|
3576
|
+
* @param {Object|String} `input` String, or object with `content` string
|
|
3577
|
+
* @param {Object} `options`
|
|
3578
|
+
* @return {Object}
|
|
3579
|
+
* @api public
|
|
3580
|
+
*/
|
|
3581
|
+
declare function matter<
|
|
3582
|
+
I extends matter.Input,
|
|
3583
|
+
O extends matter.GrayMatterOption<I, O>
|
|
3584
|
+
>(input: I | { content: I }, options?: O): matter.GrayMatterFile<I>
|
|
3585
|
+
|
|
3586
|
+
declare namespace matter {
|
|
3587
|
+
type Input = string | Buffer
|
|
3588
|
+
interface GrayMatterOption<
|
|
3589
|
+
I extends Input,
|
|
3590
|
+
O extends GrayMatterOption<I, O>
|
|
3591
|
+
> {
|
|
3592
|
+
parser?: () => void
|
|
3593
|
+
eval?: boolean
|
|
3594
|
+
excerpt?: boolean | ((input: I, options: O) => string)
|
|
3595
|
+
excerpt_separator?: string
|
|
3596
|
+
engines?: {
|
|
3597
|
+
[index: string]:
|
|
3598
|
+
| ((input: string) => object)
|
|
3599
|
+
| { parse: (input: string) => object; stringify?: (data: object) => string }
|
|
3600
|
+
}
|
|
3601
|
+
language?: string
|
|
3602
|
+
delimiters?: string | [string, string]
|
|
3603
|
+
}
|
|
3604
|
+
interface GrayMatterFile<I extends Input> {
|
|
3605
|
+
data: { [key: string]: any }
|
|
3606
|
+
content: string
|
|
3607
|
+
excerpt?: string
|
|
3608
|
+
orig: Buffer | I
|
|
3609
|
+
language: string
|
|
3610
|
+
matter: string
|
|
3611
|
+
stringify(lang: string): string
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
/**
|
|
3615
|
+
* Stringify an object to YAML or the specified language, and
|
|
3616
|
+
* append it to the given string. By default, only YAML and JSON
|
|
3617
|
+
* can be stringified. See the [engines](#engines) section to learn
|
|
3618
|
+
* how to stringify other languages.
|
|
3619
|
+
*
|
|
3620
|
+
* ```js
|
|
3621
|
+
* console.log(matter.stringify('foo bar baz', {title: 'Home'}));
|
|
3622
|
+
* // results in:
|
|
3623
|
+
* // ---
|
|
3624
|
+
* // title: Home
|
|
3625
|
+
* // ---
|
|
3626
|
+
* // foo bar baz
|
|
3627
|
+
* ```
|
|
3628
|
+
* @param {String|Object} `file` The content string to append to stringified front-matter, or a file object with `file.content` string.
|
|
3629
|
+
* @param {Object} `data` Front matter to stringify.
|
|
3630
|
+
* @param {Object} `options` [Options](#options) to pass to gray-matter and [js-yaml].
|
|
3631
|
+
* @return {String} Returns a string created by wrapping stringified yaml with delimiters, and appending that to the given string.
|
|
3632
|
+
*/
|
|
3633
|
+
export function stringify<O extends GrayMatterOption<string, O>>(
|
|
3634
|
+
file: string | { content: string },
|
|
3635
|
+
data: object,
|
|
3636
|
+
options?: GrayMatterOption<string, O>
|
|
3637
|
+
): string
|
|
3638
|
+
|
|
3639
|
+
/**
|
|
3640
|
+
* Synchronously read a file from the file system and parse
|
|
3641
|
+
* front matter. Returns the same object as the [main function](#matter).
|
|
3642
|
+
*
|
|
3643
|
+
* ```js
|
|
3644
|
+
* var file = matter.read('./content/blog-post.md');
|
|
3645
|
+
* ```
|
|
3646
|
+
* @param {String} `filepath` file path of the file to read.
|
|
3647
|
+
* @param {Object} `options` [Options](#options) to pass to gray-matter.
|
|
3648
|
+
* @return {Object} Returns [an object](#returned-object) with `data` and `content`
|
|
3649
|
+
*/
|
|
3650
|
+
export function read<O extends GrayMatterOption<string, O>>(
|
|
3651
|
+
fp: string,
|
|
3652
|
+
options?: GrayMatterOption<string, O>
|
|
3653
|
+
): matter.GrayMatterFile<string>
|
|
3654
|
+
|
|
3655
|
+
/**
|
|
3656
|
+
* Returns true if the given `string` has front matter.
|
|
3657
|
+
* @param {String} `string`
|
|
3658
|
+
* @param {Object} `options`
|
|
3659
|
+
* @return {Boolean} True if front matter exists.
|
|
3660
|
+
*/
|
|
3661
|
+
export function test<O extends matter.GrayMatterOption<string, O>>(
|
|
3662
|
+
str: string,
|
|
3663
|
+
options?: GrayMatterOption<string, O>
|
|
3664
|
+
): boolean
|
|
3665
|
+
|
|
3666
|
+
/**
|
|
3667
|
+
* Detect the language to use, if one is defined after the
|
|
3668
|
+
* first front-matter delimiter.
|
|
3669
|
+
* @param {String} `string`
|
|
3670
|
+
* @param {Object} `options`
|
|
3671
|
+
* @return {Object} Object with `raw` (actual language string), and `name`, the language with whitespace trimmed
|
|
3672
|
+
*/
|
|
3673
|
+
export function language<O extends matter.GrayMatterOption<string, O>>(
|
|
3674
|
+
str: string,
|
|
3675
|
+
options?: GrayMatterOption<string, O>
|
|
3676
|
+
): { name: string; raw: string }
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
type GrayMatterOptions = matter.GrayMatterOption<string, GrayMatterOptions>;
|
|
3680
|
+
/**
|
|
3681
|
+
* Options of @mdit-vue/plugin-frontmatter
|
|
3682
|
+
*/
|
|
3683
|
+
interface FrontmatterPluginOptions {
|
|
3684
|
+
/**
|
|
3685
|
+
* Options of gray-matter
|
|
3686
|
+
*
|
|
3687
|
+
* @see https://github.com/jonschlinkert/gray-matter#options
|
|
3688
|
+
*/
|
|
3689
|
+
grayMatterOptions?: GrayMatterOptions;
|
|
3690
|
+
/**
|
|
3691
|
+
* Render the excerpt or not
|
|
3692
|
+
*
|
|
3693
|
+
* @default true
|
|
3694
|
+
*/
|
|
3695
|
+
renderExcerpt?: boolean;
|
|
3696
|
+
}
|
|
3697
|
+
declare module '@mdit-vue/types' {
|
|
3698
|
+
interface MarkdownItEnv {
|
|
3699
|
+
/**
|
|
3700
|
+
* The raw Markdown content without frontmatter
|
|
3701
|
+
*/
|
|
3702
|
+
content?: string;
|
|
3703
|
+
/**
|
|
3704
|
+
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
|
|
3705
|
+
*
|
|
3706
|
+
* - Would be the rendered HTML when `renderExcerpt` is enabled
|
|
3707
|
+
* - Would be the raw Markdown when `renderExcerpt` is disabled
|
|
3708
|
+
*/
|
|
3709
|
+
excerpt?: string;
|
|
3710
|
+
/**
|
|
3711
|
+
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
|
|
3712
|
+
*/
|
|
3713
|
+
frontmatter?: Record<string, unknown>;
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
interface MarkdownItHeader {
|
|
3718
|
+
/**
|
|
3719
|
+
* The level of the header
|
|
3720
|
+
*
|
|
3721
|
+
* `1` to `6` for `<h1>` to `<h6>`
|
|
3722
|
+
*/
|
|
3723
|
+
level: number;
|
|
3724
|
+
/**
|
|
3725
|
+
* The title of the header
|
|
3726
|
+
*/
|
|
3727
|
+
title: string;
|
|
3728
|
+
/**
|
|
3729
|
+
* The slug of the header
|
|
3730
|
+
*
|
|
3731
|
+
* Typically the `id` attr of the header anchor
|
|
3732
|
+
*/
|
|
3733
|
+
slug: string;
|
|
3734
|
+
/**
|
|
3735
|
+
* Link of the header
|
|
3736
|
+
*
|
|
3737
|
+
* Typically using `#${slug}` as the anchor hash
|
|
3738
|
+
*/
|
|
3739
|
+
link: string;
|
|
3740
|
+
/**
|
|
3741
|
+
* The children of the header
|
|
3742
|
+
*/
|
|
3743
|
+
children: MarkdownItHeader[];
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
/**
|
|
3747
|
+
* Options of @mdit-vue/plugin-headers
|
|
3748
|
+
*/
|
|
3749
|
+
interface HeadersPluginOptions {
|
|
3750
|
+
/**
|
|
3751
|
+
* A custom slugification function
|
|
3752
|
+
*
|
|
3753
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
3754
|
+
* to ensure the link is matched
|
|
3755
|
+
*/
|
|
3756
|
+
slugify?: (str: string) => string;
|
|
3757
|
+
/**
|
|
3758
|
+
* A function for formatting header title
|
|
3759
|
+
*/
|
|
3760
|
+
format?: (str: string) => string;
|
|
3761
|
+
/**
|
|
3762
|
+
* Heading level that going to be extracted
|
|
3763
|
+
*
|
|
3764
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
3765
|
+
* to ensure the slug is existed
|
|
3766
|
+
*
|
|
3767
|
+
* @default [2,3]
|
|
3768
|
+
*/
|
|
3769
|
+
level?: number[];
|
|
3770
|
+
/**
|
|
3771
|
+
* Should allow headers inside nested blocks or not
|
|
3772
|
+
*
|
|
3773
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be extracted.
|
|
3774
|
+
*
|
|
3775
|
+
* @default false
|
|
3776
|
+
*/
|
|
3777
|
+
shouldAllowNested?: boolean;
|
|
3778
|
+
}
|
|
3779
|
+
declare module '@mdit-vue/types' {
|
|
3780
|
+
interface MarkdownItEnv {
|
|
3781
|
+
/**
|
|
3782
|
+
* The headers that extracted by `@mdit-vue/plugin-headers`
|
|
3783
|
+
*/
|
|
3784
|
+
headers?: MarkdownItHeader[];
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
|
|
3788
|
+
/**
|
|
3789
|
+
* Options of @mdit-vue/plugin-sfc
|
|
3790
|
+
*/
|
|
3791
|
+
interface SfcPluginOptions {
|
|
3792
|
+
/**
|
|
3793
|
+
* Custom blocks to be extracted
|
|
3794
|
+
*
|
|
3795
|
+
* @default []
|
|
3796
|
+
*/
|
|
3797
|
+
customBlocks?: string[];
|
|
3798
|
+
}
|
|
3799
|
+
/**
|
|
3800
|
+
* SFC block that extracted from markdown
|
|
3801
|
+
*/
|
|
3802
|
+
interface SfcBlock {
|
|
3803
|
+
/**
|
|
3804
|
+
* The type of the block
|
|
3805
|
+
*/
|
|
3806
|
+
type: string;
|
|
3807
|
+
/**
|
|
3808
|
+
* The content, including open-tag and close-tag
|
|
3809
|
+
*/
|
|
3810
|
+
content: string;
|
|
3811
|
+
/**
|
|
3812
|
+
* The content that stripped open-tag and close-tag off
|
|
3813
|
+
*/
|
|
3814
|
+
contentStripped: string;
|
|
3815
|
+
/**
|
|
3816
|
+
* The open-tag
|
|
3817
|
+
*/
|
|
3818
|
+
tagOpen: string;
|
|
3819
|
+
/**
|
|
3820
|
+
* The close-tag
|
|
3821
|
+
*/
|
|
3822
|
+
tagClose: string;
|
|
3823
|
+
}
|
|
3824
|
+
interface MarkdownSfcBlocks {
|
|
3825
|
+
/**
|
|
3826
|
+
* The `<template>` block
|
|
3827
|
+
*/
|
|
3828
|
+
template: SfcBlock | null;
|
|
3829
|
+
/**
|
|
3830
|
+
* The common `<script>` block
|
|
3831
|
+
*/
|
|
3832
|
+
script: SfcBlock | null;
|
|
3833
|
+
/**
|
|
3834
|
+
* The `<script setup>` block
|
|
3835
|
+
*/
|
|
3836
|
+
scriptSetup: SfcBlock | null;
|
|
3837
|
+
/**
|
|
3838
|
+
* All `<script>` blocks.
|
|
3839
|
+
*
|
|
3840
|
+
* By default, SFC only allows one `<script>` block and one `<script setup>` block.
|
|
3841
|
+
* However, some tools may support different types of `<script>`s, so we keep all of them here.
|
|
3842
|
+
*/
|
|
3843
|
+
scripts: SfcBlock[];
|
|
3844
|
+
/**
|
|
3845
|
+
* All `<style>` blocks.
|
|
3846
|
+
*/
|
|
3847
|
+
styles: SfcBlock[];
|
|
3848
|
+
/**
|
|
3849
|
+
* All custom blocks.
|
|
3850
|
+
*/
|
|
3851
|
+
customBlocks: SfcBlock[];
|
|
3852
|
+
}
|
|
3853
|
+
declare module '@mdit-vue/types' {
|
|
3854
|
+
interface MarkdownItEnv {
|
|
3855
|
+
/**
|
|
3856
|
+
* SFC blocks that extracted by `@mdit-vue/plugin-sfc`
|
|
3857
|
+
*/
|
|
3858
|
+
sfcBlocks?: MarkdownSfcBlocks;
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
|
|
3862
|
+
/**
|
|
3863
|
+
* Options of @mdit-vue/plugin-toc
|
|
3864
|
+
*/
|
|
3865
|
+
interface TocPluginOptions {
|
|
3866
|
+
/**
|
|
3867
|
+
* The pattern serving as the TOC placeholder in your markdown
|
|
3868
|
+
*
|
|
3869
|
+
* @default /^\[\[toc\]\]$/i
|
|
3870
|
+
*/
|
|
3871
|
+
pattern?: RegExp;
|
|
3872
|
+
/**
|
|
3873
|
+
* A custom slugification function
|
|
3874
|
+
*
|
|
3875
|
+
* Should use the same slugify function with markdown-it-anchor
|
|
3876
|
+
* to ensure the link is matched
|
|
3877
|
+
*/
|
|
3878
|
+
slugify?: (str: string) => string;
|
|
3879
|
+
/**
|
|
3880
|
+
* A function for formatting headings
|
|
3881
|
+
*/
|
|
3882
|
+
format?: (str: string) => string;
|
|
3883
|
+
/**
|
|
3884
|
+
* Heading level that going to be included in the TOC
|
|
3885
|
+
*
|
|
3886
|
+
* Should be a subset of markdown-it-anchor's `level` option
|
|
3887
|
+
* to ensure the link is existed
|
|
3888
|
+
*
|
|
3889
|
+
* @default [2,3]
|
|
3890
|
+
*/
|
|
3891
|
+
level?: number[];
|
|
3892
|
+
/**
|
|
3893
|
+
* Should allow headers inside nested blocks or not
|
|
3894
|
+
*
|
|
3895
|
+
* If set to `true`, headers inside blockquote, list, etc. would also be included.
|
|
3896
|
+
*
|
|
3897
|
+
* @default false
|
|
3898
|
+
*/
|
|
3899
|
+
shouldAllowNested?: boolean;
|
|
3900
|
+
/**
|
|
3901
|
+
* HTML tag of the TOC container
|
|
3902
|
+
*
|
|
3903
|
+
* @default 'nav'
|
|
3904
|
+
*/
|
|
3905
|
+
containerTag?: string;
|
|
3906
|
+
/**
|
|
3907
|
+
* The class for the TOC container
|
|
3908
|
+
*
|
|
3909
|
+
* @default 'table-of-contents'
|
|
3910
|
+
*/
|
|
3911
|
+
containerClass?: string;
|
|
3912
|
+
/**
|
|
3913
|
+
* HTML tag of the TOC list
|
|
3914
|
+
*
|
|
3915
|
+
* @default 'ul'
|
|
3916
|
+
*/
|
|
3917
|
+
listTag?: 'ul' | 'ol';
|
|
3918
|
+
/**
|
|
3919
|
+
* The class for the TOC list
|
|
3920
|
+
*
|
|
3921
|
+
* @default ''
|
|
3922
|
+
*/
|
|
3923
|
+
listClass?: string;
|
|
3924
|
+
/**
|
|
3925
|
+
* The class for the `<li>` tag
|
|
3926
|
+
*
|
|
3927
|
+
* @default ''
|
|
3928
|
+
*/
|
|
3929
|
+
itemClass?: string;
|
|
3930
|
+
/**
|
|
3931
|
+
* The tag of the link inside `<li>` tag
|
|
3932
|
+
*
|
|
3933
|
+
* @default 'a'
|
|
3934
|
+
*/
|
|
3935
|
+
linkTag?: 'a' | 'router-link';
|
|
3936
|
+
/**
|
|
3937
|
+
* The class for the link inside the `<li>` tag
|
|
3938
|
+
*
|
|
3939
|
+
* @default ''
|
|
3940
|
+
*/
|
|
3941
|
+
linkClass?: string;
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3944
|
+
declare namespace anchor {
|
|
3945
|
+
export type RenderHref = (slug: string, state: StateCore) => string;
|
|
3946
|
+
export type RenderAttrs = (slug: string, state: StateCore) => Record<string, string | number>;
|
|
3947
|
+
|
|
3948
|
+
export interface PermalinkOptions {
|
|
3949
|
+
class?: string,
|
|
3950
|
+
symbol?: string,
|
|
3951
|
+
renderHref?: RenderHref,
|
|
3952
|
+
renderAttrs?: RenderAttrs
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
export interface HeaderLinkPermalinkOptions extends PermalinkOptions {
|
|
3956
|
+
safariReaderFix?: boolean;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
export interface LinkAfterHeaderPermalinkOptions extends PermalinkOptions {
|
|
3960
|
+
style?: 'visually-hidden' | 'aria-label' | 'aria-describedby' | 'aria-labelledby',
|
|
3961
|
+
assistiveText?: (title: string) => string,
|
|
3962
|
+
visuallyHiddenClass?: string,
|
|
3963
|
+
space?: boolean | string,
|
|
3964
|
+
placement?: 'before' | 'after'
|
|
3965
|
+
wrapper?: [string, string] | null
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
export interface LinkInsideHeaderPermalinkOptions extends PermalinkOptions {
|
|
3969
|
+
space?: boolean | string,
|
|
3970
|
+
placement?: 'before' | 'after',
|
|
3971
|
+
ariaHidden?: boolean
|
|
3972
|
+
}
|
|
3973
|
+
|
|
3974
|
+
export interface AriaHiddenPermalinkOptions extends PermalinkOptions {
|
|
3975
|
+
space?: boolean | string,
|
|
3976
|
+
placement?: 'before' | 'after'
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
export type PermalinkGenerator = (slug: string, opts: PermalinkOptions, state: StateCore, index: number) => void;
|
|
3980
|
+
|
|
3981
|
+
export interface AnchorInfo {
|
|
3982
|
+
slug: string;
|
|
3983
|
+
title: string;
|
|
3984
|
+
}
|
|
3985
|
+
|
|
3986
|
+
export interface AnchorOptions {
|
|
3987
|
+
level?: number | number[];
|
|
3988
|
+
|
|
3989
|
+
slugify?(str: string): string;
|
|
3990
|
+
getTokensText?(tokens: Token[]): string;
|
|
3991
|
+
|
|
3992
|
+
uniqueSlugStartIndex?: number;
|
|
3993
|
+
permalink?: PermalinkGenerator;
|
|
3994
|
+
|
|
3995
|
+
callback?(token: Token, anchor_info: AnchorInfo): void;
|
|
3996
|
+
|
|
3997
|
+
tabIndex?: number | false;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
export const permalink: {
|
|
4001
|
+
headerLink: (opts?: HeaderLinkPermalinkOptions) => PermalinkGenerator
|
|
4002
|
+
linkAfterHeader: (opts?: LinkAfterHeaderPermalinkOptions) => PermalinkGenerator
|
|
4003
|
+
linkInsideHeader: (opts?: LinkInsideHeaderPermalinkOptions) => PermalinkGenerator
|
|
4004
|
+
ariaHidden: (opts?: AriaHiddenPermalinkOptions) => PermalinkGenerator
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
declare function anchor(md: MarkdownIt, opts?: anchor.AnchorOptions): void;
|
|
4009
|
+
|
|
4010
|
+
interface ContainerOptions {
|
|
4011
|
+
infoLabel?: string;
|
|
4012
|
+
noteLabel?: string;
|
|
4013
|
+
tipLabel?: string;
|
|
4014
|
+
warningLabel?: string;
|
|
4015
|
+
dangerLabel?: string;
|
|
4016
|
+
detailsLabel?: string;
|
|
4017
|
+
importantLabel?: string;
|
|
4018
|
+
cautionLabel?: string;
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
interface Options$1 {
|
|
4022
|
+
/**
|
|
4023
|
+
* Support native lazy loading for the `<img>` tag.
|
|
4024
|
+
* @default false
|
|
4025
|
+
*/
|
|
4026
|
+
lazyLoading?: boolean;
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
type ThemeOptions = ThemeRegistrationAny | BuiltinTheme | {
|
|
4030
|
+
light: ThemeRegistrationAny | BuiltinTheme;
|
|
4031
|
+
dark: ThemeRegistrationAny | BuiltinTheme;
|
|
4032
|
+
};
|
|
4033
|
+
interface MarkdownOptions extends MarkdownIt.Options {
|
|
4034
|
+
/**
|
|
4035
|
+
* Setup markdown-it instance before applying plugins
|
|
4036
|
+
*/
|
|
4037
|
+
preConfig?: (md: MarkdownIt) => void;
|
|
4038
|
+
/**
|
|
4039
|
+
* Setup markdown-it instance
|
|
4040
|
+
*/
|
|
4041
|
+
config?: (md: MarkdownIt) => void;
|
|
4042
|
+
/**
|
|
4043
|
+
* Disable cache (experimental)
|
|
4044
|
+
*/
|
|
4045
|
+
cache?: boolean;
|
|
4046
|
+
externalLinks?: Record<string, string>;
|
|
4047
|
+
/**
|
|
4048
|
+
* Custom theme for syntax highlighting.
|
|
4049
|
+
*
|
|
4050
|
+
* You can also pass an object with `light` and `dark` themes to support dual themes.
|
|
4051
|
+
*
|
|
4052
|
+
* @example { theme: 'github-dark' }
|
|
4053
|
+
* @example { theme: { light: 'github-light', dark: 'github-dark' } }
|
|
4054
|
+
*
|
|
4055
|
+
* You can use an existing theme.
|
|
4056
|
+
* @see https://shiki.style/themes
|
|
4057
|
+
* Or add your own theme.
|
|
4058
|
+
* @see https://shiki.style/guide/load-theme
|
|
4059
|
+
*/
|
|
4060
|
+
theme?: ThemeOptions;
|
|
4061
|
+
/**
|
|
4062
|
+
* Languages for syntax highlighting.
|
|
4063
|
+
* @see https://shiki.style/languages
|
|
4064
|
+
*/
|
|
4065
|
+
languages?: LanguageInput[];
|
|
4066
|
+
/**
|
|
4067
|
+
* Custom language aliases.
|
|
4068
|
+
*
|
|
4069
|
+
* @example { 'my-lang': 'js' }
|
|
4070
|
+
* @see https://shiki.style/guide/load-lang#custom-language-aliases
|
|
4071
|
+
*/
|
|
4072
|
+
languageAlias?: Record<string, string>;
|
|
4073
|
+
/**
|
|
4074
|
+
* Show line numbers in code blocks
|
|
4075
|
+
* @default false
|
|
4076
|
+
*/
|
|
4077
|
+
lineNumbers?: boolean;
|
|
4078
|
+
/**
|
|
4079
|
+
* Fallback language when the specified language is not available.
|
|
4080
|
+
*/
|
|
4081
|
+
defaultHighlightLang?: string;
|
|
4082
|
+
/**
|
|
4083
|
+
* Transformers applied to code blocks
|
|
4084
|
+
* @see https://shiki.style/guide/transformers
|
|
4085
|
+
*/
|
|
4086
|
+
codeTransformers?: ShikiTransformer[];
|
|
4087
|
+
/**
|
|
4088
|
+
* Setup Shiki instance
|
|
4089
|
+
*/
|
|
4090
|
+
shikiSetup?: (shiki: Highlighter) => void | Promise<void>;
|
|
4091
|
+
/**
|
|
4092
|
+
* Options for `markdown-it-anchor`
|
|
4093
|
+
* @see https://github.com/valeriangalliat/markdown-it-anchor
|
|
4094
|
+
*/
|
|
4095
|
+
anchor?: anchor.AnchorOptions;
|
|
4096
|
+
/**
|
|
4097
|
+
* Options for `markdown-it-attrs`
|
|
4098
|
+
* @see https://github.com/arve0/markdown-it-attrs
|
|
4099
|
+
*/
|
|
4100
|
+
attrs?: {
|
|
4101
|
+
leftDelimiter?: string;
|
|
4102
|
+
rightDelimiter?: string;
|
|
4103
|
+
allowedAttributes?: Array<string | RegExp>;
|
|
4104
|
+
disable?: boolean;
|
|
4105
|
+
};
|
|
4106
|
+
/**
|
|
4107
|
+
* Options for `markdown-it-emoji`
|
|
4108
|
+
* @see https://github.com/markdown-it/markdown-it-emoji
|
|
4109
|
+
*/
|
|
4110
|
+
emoji?: {
|
|
4111
|
+
defs?: Record<string, string>;
|
|
4112
|
+
enabled?: string[];
|
|
4113
|
+
shortcuts?: Record<string, string | string[]>;
|
|
4114
|
+
};
|
|
4115
|
+
/**
|
|
4116
|
+
* Options for `@mdit-vue/plugin-frontmatter`
|
|
4117
|
+
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter
|
|
4118
|
+
*/
|
|
4119
|
+
frontmatter?: FrontmatterPluginOptions;
|
|
4120
|
+
/**
|
|
4121
|
+
* Options for `@mdit-vue/plugin-headers`
|
|
4122
|
+
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers
|
|
4123
|
+
*/
|
|
4124
|
+
headers?: HeadersPluginOptions | boolean;
|
|
4125
|
+
/**
|
|
4126
|
+
* Options for `@mdit-vue/plugin-sfc`
|
|
4127
|
+
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc
|
|
4128
|
+
*/
|
|
4129
|
+
sfc?: SfcPluginOptions;
|
|
4130
|
+
/**
|
|
4131
|
+
* Options for `@mdit-vue/plugin-toc`
|
|
4132
|
+
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc
|
|
4133
|
+
*/
|
|
4134
|
+
toc?: TocPluginOptions;
|
|
4135
|
+
/**
|
|
4136
|
+
* Options for `@mdit-vue/plugin-component`
|
|
4137
|
+
* @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component
|
|
4138
|
+
*/
|
|
4139
|
+
component?: ComponentPluginOptions;
|
|
4140
|
+
/**
|
|
4141
|
+
* Options for `markdown-it-container`
|
|
4142
|
+
* @see https://github.com/markdown-it/markdown-it-container
|
|
4143
|
+
*/
|
|
4144
|
+
container?: ContainerOptions;
|
|
4145
|
+
/**
|
|
4146
|
+
* Math support (experimental)
|
|
4147
|
+
*
|
|
4148
|
+
* You need to install `markdown-it-mathjax3` and set `math` to `true` to enable it.
|
|
4149
|
+
* You can also pass options to `markdown-it-mathjax3` here.
|
|
4150
|
+
* @default false
|
|
4151
|
+
* @see https://vitepress.dev/guide/markdown#math-equations
|
|
4152
|
+
*/
|
|
4153
|
+
math?: boolean | any;
|
|
4154
|
+
image?: Options$1;
|
|
4155
|
+
/**
|
|
4156
|
+
* Allows disabling the github alerts plugin
|
|
4157
|
+
* @default true
|
|
4158
|
+
* @see https://vitepress.dev/guide/markdown#github-flavored-alerts
|
|
4159
|
+
*/
|
|
4160
|
+
gfmAlerts?: boolean;
|
|
4161
|
+
}
|
|
4162
|
+
type MarkdownRenderer = MarkdownIt;
|
|
4163
|
+
declare const createMarkdownRenderer: (srcDir: string, options?: MarkdownOptions, base?: string, logger?: Pick<Logger, 'warn'>) => Promise<MarkdownRenderer>;
|
|
4164
|
+
|
|
4165
|
+
type RawConfigExports<ThemeConfig = any> = Awaitable<UserConfig<ThemeConfig>> | (() => Awaitable<UserConfig<ThemeConfig>>);
|
|
4166
|
+
interface TransformContext {
|
|
4167
|
+
page: string;
|
|
4168
|
+
siteConfig: SiteConfig;
|
|
4169
|
+
siteData: SiteData;
|
|
4170
|
+
pageData: PageData;
|
|
4171
|
+
title: string;
|
|
4172
|
+
description: string;
|
|
4173
|
+
head: HeadConfig[];
|
|
4174
|
+
content: string;
|
|
4175
|
+
assets: string[];
|
|
4176
|
+
}
|
|
4177
|
+
interface UserRouteConfig {
|
|
4178
|
+
params: Record<string, string>;
|
|
4179
|
+
content?: string;
|
|
4180
|
+
}
|
|
4181
|
+
type ResolvedRouteConfig = UserRouteConfig & {
|
|
4182
|
+
/**
|
|
4183
|
+
* the raw route (relative to src root), e.g. foo/[bar].md
|
|
4184
|
+
*/
|
|
4185
|
+
route: string;
|
|
4186
|
+
/**
|
|
4187
|
+
* the actual path with params resolved (relative to src root), e.g. foo/1.md
|
|
4188
|
+
*/
|
|
4189
|
+
path: string;
|
|
4190
|
+
/**
|
|
4191
|
+
* absolute fs path
|
|
4192
|
+
*/
|
|
4193
|
+
fullPath: string;
|
|
4194
|
+
};
|
|
4195
|
+
interface TransformPageContext {
|
|
4196
|
+
siteConfig: SiteConfig;
|
|
4197
|
+
}
|
|
4198
|
+
interface UserConfig<ThemeConfig = any> extends LocaleSpecificConfig<ThemeConfig> {
|
|
4199
|
+
extends?: RawConfigExports<ThemeConfig>;
|
|
4200
|
+
base?: string;
|
|
4201
|
+
srcDir?: string;
|
|
4202
|
+
srcExclude?: string[];
|
|
4203
|
+
outDir?: string;
|
|
4204
|
+
assetsDir?: string;
|
|
4205
|
+
cacheDir?: string;
|
|
4206
|
+
shouldPreload?: (link: string, page: string) => boolean;
|
|
4207
|
+
locales?: LocaleConfig<ThemeConfig>;
|
|
4208
|
+
router?: {
|
|
4209
|
+
prefetchLinks?: boolean;
|
|
4210
|
+
};
|
|
4211
|
+
appearance?: boolean | 'dark' | 'force-dark' | (Omit<UseDarkOptions, 'initialValue'> & {
|
|
4212
|
+
initialValue?: 'dark';
|
|
4213
|
+
});
|
|
4214
|
+
lastUpdated?: boolean;
|
|
4215
|
+
contentProps?: Record<string, any>;
|
|
4216
|
+
/**
|
|
4217
|
+
* MarkdownIt options
|
|
4218
|
+
*/
|
|
4219
|
+
markdown?: MarkdownOptions;
|
|
4220
|
+
/**
|
|
4221
|
+
* Options to pass on to `@vitejs/plugin-vue`
|
|
4222
|
+
*/
|
|
4223
|
+
vue?: Options$3;
|
|
4224
|
+
/**
|
|
4225
|
+
* Vite config
|
|
4226
|
+
*/
|
|
4227
|
+
vite?: UserConfig$1 & {
|
|
4228
|
+
configFile?: string | false;
|
|
4229
|
+
};
|
|
4230
|
+
/**
|
|
4231
|
+
* Configure the scroll offset when the theme has a sticky header.
|
|
4232
|
+
* Can be a number or a selector element to get the offset from.
|
|
4233
|
+
* Can also be an array of selectors in case some elements will be
|
|
4234
|
+
* invisible due to responsive layout. VitePress will fallback to the next
|
|
4235
|
+
* selector if a selector fails to match, or the matched element is not
|
|
4236
|
+
* currently visible in viewport.
|
|
4237
|
+
*/
|
|
4238
|
+
scrollOffset?: number | string | string[] | {
|
|
4239
|
+
selector: string | string[];
|
|
4240
|
+
padding: number;
|
|
4241
|
+
};
|
|
4242
|
+
/**
|
|
4243
|
+
* Enable MPA / zero-JS mode.
|
|
4244
|
+
* @experimental
|
|
4245
|
+
*/
|
|
4246
|
+
mpa?: boolean;
|
|
4247
|
+
/**
|
|
4248
|
+
* Extracts metadata to a separate chunk.
|
|
4249
|
+
* @experimental
|
|
4250
|
+
*/
|
|
4251
|
+
metaChunk?: boolean;
|
|
4252
|
+
/**
|
|
4253
|
+
* Don't fail builds due to dead links.
|
|
4254
|
+
*
|
|
4255
|
+
* @default false
|
|
4256
|
+
*/
|
|
4257
|
+
ignoreDeadLinks?: boolean | 'localhostLinks' | (string | RegExp | ((link: string) => boolean))[];
|
|
4258
|
+
/**
|
|
4259
|
+
* Don't force `.html` on URLs.
|
|
4260
|
+
*
|
|
4261
|
+
* @default false
|
|
4262
|
+
*/
|
|
4263
|
+
cleanUrls?: boolean;
|
|
4264
|
+
/**
|
|
4265
|
+
* Use web fonts instead of emitting font files to dist.
|
|
4266
|
+
* The used theme should import a file named `fonts.(s)css` for this to work.
|
|
4267
|
+
* If you are a theme author, to support this, place your web font import
|
|
4268
|
+
* between `webfont-marker-begin` and `webfont-marker-end` comments.
|
|
4269
|
+
*
|
|
4270
|
+
* @default true in webcontainers, else false
|
|
4271
|
+
*/
|
|
4272
|
+
useWebFonts?: boolean;
|
|
4273
|
+
/**
|
|
4274
|
+
* This option allows you to configure the concurrency of the build.
|
|
4275
|
+
* A lower number will reduce the memory usage but will increase the build time.
|
|
4276
|
+
*
|
|
4277
|
+
* @experimental
|
|
4278
|
+
* @default 64
|
|
4279
|
+
*/
|
|
4280
|
+
buildConcurrency?: number;
|
|
4281
|
+
/**
|
|
4282
|
+
* @experimental
|
|
4283
|
+
*
|
|
4284
|
+
* source -> destination
|
|
4285
|
+
*/
|
|
4286
|
+
rewrites?: Record<string, string>;
|
|
4287
|
+
/**
|
|
4288
|
+
* @experimental
|
|
4289
|
+
*/
|
|
4290
|
+
sitemap?: SitemapStreamOptions & {
|
|
4291
|
+
hostname: string;
|
|
4292
|
+
transformItems?: (items: SitemapItem[]) => Awaitable<SitemapItem[]>;
|
|
4293
|
+
};
|
|
4294
|
+
/**
|
|
4295
|
+
* Build end hook: called when SSG finish.
|
|
4296
|
+
* @param siteConfig The resolved configuration.
|
|
4297
|
+
*/
|
|
4298
|
+
buildEnd?: (siteConfig: SiteConfig) => Awaitable<void>;
|
|
4299
|
+
/**
|
|
4300
|
+
* Render end hook: called when SSR rendering is done.
|
|
4301
|
+
*/
|
|
4302
|
+
postRender?: (context: SSGContext) => Awaitable<SSGContext | void>;
|
|
4303
|
+
/**
|
|
4304
|
+
* Head transform hook: runs before writing HTML to dist.
|
|
4305
|
+
*
|
|
4306
|
+
* This build hook will allow you to modify the head adding new entries that cannot be statically added.
|
|
4307
|
+
*/
|
|
4308
|
+
transformHead?: (context: TransformContext) => Awaitable<HeadConfig[] | void>;
|
|
4309
|
+
/**
|
|
4310
|
+
* HTML transform hook: runs before writing HTML to dist.
|
|
4311
|
+
*/
|
|
4312
|
+
transformHtml?: (code: string, id: string, ctx: TransformContext) => Awaitable<string | void>;
|
|
4313
|
+
/**
|
|
4314
|
+
* PageData transform hook: runs when rendering markdown to vue
|
|
4315
|
+
*/
|
|
4316
|
+
transformPageData?: (pageData: PageData, ctx: TransformPageContext) => Awaitable<Partial<PageData> | {
|
|
4317
|
+
[key: string]: any;
|
|
4318
|
+
} | void>;
|
|
4319
|
+
}
|
|
4320
|
+
interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'router' | 'mpa' | 'metaChunk' | 'lastUpdated' | 'ignoreDeadLinks' | 'cleanUrls' | 'useWebFonts' | 'postRender' | 'buildEnd' | 'transformHead' | 'transformHtml' | 'transformPageData' | 'sitemap'> {
|
|
4321
|
+
root: string;
|
|
4322
|
+
srcDir: string;
|
|
4323
|
+
site: SiteData<ThemeConfig>;
|
|
4324
|
+
configPath: string | undefined;
|
|
4325
|
+
configDeps: string[];
|
|
4326
|
+
themeDir: string;
|
|
4327
|
+
outDir: string;
|
|
4328
|
+
assetsDir: string;
|
|
4329
|
+
cacheDir: string;
|
|
4330
|
+
tempDir: string;
|
|
4331
|
+
pages: string[];
|
|
4332
|
+
dynamicRoutes: {
|
|
4333
|
+
routes: ResolvedRouteConfig[];
|
|
4334
|
+
fileToModulesMap: Record<string, Set<string>>;
|
|
4335
|
+
};
|
|
4336
|
+
rewrites: {
|
|
4337
|
+
map: Record<string, string | undefined>;
|
|
4338
|
+
inv: Record<string, string | undefined>;
|
|
4339
|
+
};
|
|
4340
|
+
logger: Logger;
|
|
4341
|
+
userConfig: UserConfig;
|
|
4342
|
+
buildConcurrency: number;
|
|
4343
|
+
}
|
|
4344
|
+
|
|
4345
|
+
declare function resolvePages(srcDir: string, userConfig: UserConfig, logger: Logger): Promise<{
|
|
4346
|
+
pages: string[];
|
|
4347
|
+
dynamicRoutes: {
|
|
4348
|
+
routes: ResolvedRouteConfig[];
|
|
4349
|
+
fileToModulesMap: Record<string, Set<string>>;
|
|
4350
|
+
};
|
|
4351
|
+
rewrites: {
|
|
4352
|
+
map: Record<string, string>;
|
|
4353
|
+
inv: Record<string, string>;
|
|
4354
|
+
};
|
|
4355
|
+
}>;
|
|
4356
|
+
|
|
4357
|
+
type UserConfigFn<ThemeConfig> = (env: ConfigEnv) => UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>>;
|
|
4358
|
+
type UserConfigExport<ThemeConfig> = UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>> | UserConfigFn<ThemeConfig>;
|
|
4359
|
+
/**
|
|
4360
|
+
* Type config helper
|
|
4361
|
+
*/
|
|
4362
|
+
declare function defineConfig(config: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
|
|
4363
|
+
/**
|
|
4364
|
+
* Type config helper for custom theme config
|
|
4365
|
+
*/
|
|
4366
|
+
declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
|
|
4367
|
+
declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
|
|
4368
|
+
declare function resolveUserConfig(root: string, command: 'serve' | 'build', mode: string): Promise<[UserConfig, string | undefined, string[]]>;
|
|
4369
|
+
declare function mergeConfig(a: UserConfig, b: UserConfig, isRoot?: boolean): Record<string, any>;
|
|
4370
|
+
declare function resolveSiteData(root: string, userConfig?: UserConfig, command?: 'serve' | 'build', mode?: string): Promise<SiteData>;
|
|
4371
|
+
|
|
4372
|
+
interface ContentOptions<T = ContentData[]> {
|
|
4373
|
+
/**
|
|
4374
|
+
* Include src?
|
|
4375
|
+
* @default false
|
|
4376
|
+
*/
|
|
4377
|
+
includeSrc?: boolean;
|
|
4378
|
+
/**
|
|
4379
|
+
* Render src to HTML and include in data?
|
|
4380
|
+
* @default false
|
|
4381
|
+
*/
|
|
4382
|
+
render?: boolean;
|
|
4383
|
+
/**
|
|
4384
|
+
* If `boolean`, whether to parse and include excerpt? (rendered as HTML)
|
|
4385
|
+
*
|
|
4386
|
+
* If `function`, control how the excerpt is extracted from the content.
|
|
4387
|
+
*
|
|
4388
|
+
* If `string`, define a custom separator to be used for extracting the
|
|
4389
|
+
* excerpt. Default separator is `---` if `excerpt` is `true`.
|
|
4390
|
+
*
|
|
4391
|
+
* @see https://github.com/jonschlinkert/gray-matter#optionsexcerpt
|
|
4392
|
+
* @see https://github.com/jonschlinkert/gray-matter#optionsexcerpt_separator
|
|
4393
|
+
*
|
|
4394
|
+
* @default false
|
|
4395
|
+
*/
|
|
4396
|
+
excerpt?: boolean | ((file: {
|
|
4397
|
+
data: {
|
|
4398
|
+
[key: string]: any;
|
|
4399
|
+
};
|
|
4400
|
+
content: string;
|
|
4401
|
+
excerpt?: string;
|
|
4402
|
+
}, options?: any) => void) | string;
|
|
4403
|
+
/**
|
|
4404
|
+
* Transform the data. Note the data will be inlined as JSON in the client
|
|
4405
|
+
* bundle if imported from components or markdown files.
|
|
4406
|
+
*/
|
|
4407
|
+
transform?: (data: ContentData[]) => T | Promise<T>;
|
|
4408
|
+
/**
|
|
4409
|
+
* Options to pass to `fast-glob`.
|
|
4410
|
+
* You'll need to manually specify `node_modules` and `dist` in
|
|
4411
|
+
* `globOptions.ignore` if you've overridden it.
|
|
4412
|
+
*/
|
|
4413
|
+
globOptions?: glob.Options;
|
|
4414
|
+
}
|
|
4415
|
+
interface ContentData {
|
|
4416
|
+
url: string;
|
|
4417
|
+
src: string | undefined;
|
|
4418
|
+
html: string | undefined;
|
|
4419
|
+
frontmatter: Record<string, any>;
|
|
4420
|
+
excerpt: string | undefined;
|
|
4421
|
+
}
|
|
4422
|
+
/**
|
|
4423
|
+
* Create a loader object that can be directly used as the default export
|
|
4424
|
+
* of a data loader file.
|
|
4425
|
+
*/
|
|
4426
|
+
declare function createContentLoader<T = ContentData[]>(
|
|
4427
|
+
/**
|
|
4428
|
+
* files to glob / watch - relative to srcDir
|
|
4429
|
+
*/
|
|
4430
|
+
pattern: string | string[], { includeSrc, render, excerpt: renderExcerpt, transform, globOptions }?: ContentOptions<T>): {
|
|
4431
|
+
watch: string | string[];
|
|
4432
|
+
load: () => Promise<T>;
|
|
4433
|
+
};
|
|
4434
|
+
|
|
4435
|
+
declare enum ScaffoldThemeType {
|
|
4436
|
+
Default = "default theme",
|
|
4437
|
+
DefaultCustom = "default theme + customization",
|
|
4438
|
+
Custom = "custom theme"
|
|
4439
|
+
}
|
|
4440
|
+
interface ScaffoldOptions {
|
|
4441
|
+
root: string;
|
|
4442
|
+
title?: string;
|
|
4443
|
+
description?: string;
|
|
4444
|
+
theme: ScaffoldThemeType;
|
|
4445
|
+
useTs: boolean;
|
|
4446
|
+
injectNpmScripts: boolean;
|
|
4447
|
+
}
|
|
4448
|
+
declare function init(): Promise<void>;
|
|
4449
|
+
declare function scaffold({ root, title, description, theme, useTs, injectNpmScripts }: ScaffoldOptions): string;
|
|
4450
|
+
|
|
4451
|
+
interface LoaderModule {
|
|
4452
|
+
watch?: string[] | string;
|
|
4453
|
+
load: (watchedFiles: string[]) => any;
|
|
4454
|
+
}
|
|
4455
|
+
/**
|
|
4456
|
+
* Helper for defining loaders with type inference
|
|
4457
|
+
*/
|
|
4458
|
+
declare function defineLoader(loader: LoaderModule): LoaderModule;
|
|
4459
|
+
|
|
4460
|
+
interface Options {
|
|
4461
|
+
prefix?: string | undefined;
|
|
4462
|
+
exclude?: ReadonlyArray<string | RegExp> | undefined;
|
|
4463
|
+
ignoreFiles?: ReadonlyArray<string | RegExp> | undefined;
|
|
4464
|
+
includeFiles?: ReadonlyArray<string | RegExp> | undefined;
|
|
4465
|
+
transform?:
|
|
4466
|
+
| ((
|
|
4467
|
+
prefix: Readonly<string>,
|
|
4468
|
+
selector: Readonly<string>,
|
|
4469
|
+
prefixedSelector: Readonly<string>,
|
|
4470
|
+
file: Readonly<string>,
|
|
4471
|
+
) => string)
|
|
4472
|
+
| undefined;
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
declare function postcssPrefixSelector(options: Readonly<Options>): (root: Root) => void;
|
|
4476
|
+
|
|
4477
|
+
declare function postcssIsolateStyles(options?: Parameters<typeof postcssPrefixSelector>[0]): ReturnType<typeof postcssPrefixSelector>;
|
|
4478
|
+
|
|
4479
|
+
interface ParsedURL {
|
|
4480
|
+
pathname: string;
|
|
4481
|
+
search: string;
|
|
4482
|
+
query: Record<string, string | string[]> | void;
|
|
4483
|
+
raw: string;
|
|
4484
|
+
}
|
|
4485
|
+
|
|
4486
|
+
// Thank you: @fwilkerson, @stahlstift
|
|
4487
|
+
// ---
|
|
4488
|
+
|
|
4489
|
+
/** @type {import('http').METHODS} */
|
|
4490
|
+
type Methods = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |'M-SEARCH' | 'MERGE' | 'MKACTIVITY' |'MKCALENDAR' | 'MKCOL' | 'MOVE' |'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' | 'PRI' | 'PROPFIND' | 'PROPPATCH' | 'PURGE' | 'PUT' | 'REBIND' | 'REPORT' | 'SEARCH' | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' | 'UNSUBSCRIBE';
|
|
4491
|
+
|
|
4492
|
+
type Pattern = RegExp | string;
|
|
4493
|
+
|
|
4494
|
+
declare class Trouter<T = Function> {
|
|
4495
|
+
find(method: Methods, url: string): {
|
|
4496
|
+
params: Record<string, string>;
|
|
4497
|
+
handlers: T[];
|
|
4498
|
+
};
|
|
4499
|
+
add(method: Methods, pattern: Pattern, ...handlers: T[]): this;
|
|
4500
|
+
use(pattern: Pattern, ...handlers: T[]): this;
|
|
4501
|
+
all(pattern: Pattern, ...handlers: T[]): this;
|
|
4502
|
+
get(pattern: Pattern, ...handlers: T[]): this;
|
|
4503
|
+
head(pattern: Pattern, ...handlers: T[]): this;
|
|
4504
|
+
patch(pattern: Pattern, ...handlers: T[]): this;
|
|
4505
|
+
options(pattern: Pattern, ...handlers: T[]): this;
|
|
4506
|
+
connect(pattern: Pattern, ...handlers: T[]): this;
|
|
4507
|
+
delete(pattern: Pattern, ...handlers: T[]): this;
|
|
4508
|
+
trace(pattern: Pattern, ...handlers: T[]): this;
|
|
4509
|
+
post(pattern: Pattern, ...handlers: T[]): this;
|
|
4510
|
+
put(pattern: Pattern, ...handlers: T[]): this;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
type Promisable<T> = Promise<T> | T;
|
|
4514
|
+
type ListenCallback = () => Promisable<void>;
|
|
4515
|
+
|
|
4516
|
+
declare namespace polka {
|
|
4517
|
+
export interface IError extends Error {
|
|
4518
|
+
code?: number;
|
|
4519
|
+
status?: number;
|
|
4520
|
+
details?: any;
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4523
|
+
export type NextHandler = (err?: string | IError) => Promisable<void>;
|
|
4524
|
+
export type ErrorHandler<T extends Request = Request> = (err: string | IError, req: T, res: Response, next: NextHandler) => Promisable<void>;
|
|
4525
|
+
export type Middleware<T extends IncomingMessage = Request> = (req: T & Request, res: Response, next: NextHandler) => Promisable<void>;
|
|
4526
|
+
|
|
4527
|
+
export interface IOptions<T extends Request = Request> {
|
|
4528
|
+
server?: Server;
|
|
4529
|
+
onNoMatch?: Middleware<T>;
|
|
4530
|
+
onError?: ErrorHandler<T>;
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4533
|
+
export type Response = ServerResponse;
|
|
4534
|
+
|
|
4535
|
+
export interface Request extends IncomingMessage {
|
|
4536
|
+
url: string;
|
|
4537
|
+
method: string;
|
|
4538
|
+
originalUrl: string;
|
|
4539
|
+
params: Record<string, string>;
|
|
4540
|
+
path: string;
|
|
4541
|
+
search: string;
|
|
4542
|
+
query: Record<string,string>;
|
|
4543
|
+
body?: any;
|
|
4544
|
+
_decoded?: true;
|
|
4545
|
+
_parsedUrl: ParsedURL;
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
export interface Polka<T extends Request = Request> extends Trouter<Middleware<T>> {
|
|
4549
|
+
readonly server: Server;
|
|
4550
|
+
readonly wares: Middleware<T>[];
|
|
4551
|
+
|
|
4552
|
+
readonly onError: ErrorHandler<T>;
|
|
4553
|
+
readonly onNoMatch: Middleware<T>;
|
|
4554
|
+
|
|
4555
|
+
readonly handler: Middleware<T>;
|
|
4556
|
+
parse: (req: IncomingMessage) => ParsedURL;
|
|
4557
|
+
|
|
4558
|
+
use(pattern: RegExp|string, ...handlers: (Polka<T> | Middleware<T>)[]): this;
|
|
4559
|
+
use(...handlers: (Polka<T> | Middleware<T>)[]): this;
|
|
4560
|
+
|
|
4561
|
+
listen(port?: number, hostname?: string, backlog?: number, callback?: ListenCallback): this;
|
|
4562
|
+
listen(port?: number, hostname?: string, callback?: ListenCallback): this;
|
|
4563
|
+
listen(port?: number, backlog?: number, callback?: ListenCallback): this;
|
|
4564
|
+
listen(port?: number, callback?: ListenCallback): this;
|
|
4565
|
+
listen(path: string, backlog?: number, callback?: ListenCallback): this;
|
|
4566
|
+
listen(path: string, callback?: ListenCallback): this;
|
|
4567
|
+
listen(options: ListenOptions, callback?: ListenCallback): this;
|
|
4568
|
+
listen(handle: any, backlog?: number, callback?: ListenCallback): this;
|
|
4569
|
+
listen(handle: any, callback?: ListenCallback): this;
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4573
|
+
declare function polka<T extends polka.Request = polka.Request>(
|
|
4574
|
+
options?: polka.IOptions<T>
|
|
4575
|
+
): polka.Polka<T>;
|
|
4576
|
+
|
|
4577
|
+
interface ServeOptions {
|
|
4578
|
+
base?: string;
|
|
4579
|
+
root?: string;
|
|
4580
|
+
port?: number;
|
|
4581
|
+
}
|
|
4582
|
+
declare function serve(options?: ServeOptions): Promise<polka.Polka<polka.Request>>;
|
|
4583
|
+
|
|
4584
|
+
declare function createServer(root?: string, serverOptions?: ServerOptions & {
|
|
4585
|
+
base?: string;
|
|
4586
|
+
}, recreateServer?: () => Promise<void>): Promise<vite.ViteDevServer>;
|
|
4587
|
+
|
|
4588
|
+
export { type ContentData, type ContentOptions, DefaultTheme, type HeadConfig, type Header, type LoaderModule, type MarkdownOptions, type MarkdownRenderer, type RawConfigExports, type ResolvedRouteConfig, type ScaffoldOptions, ScaffoldThemeType, type ServeOptions, type SiteConfig, type SiteData, type ThemeOptions, type TransformContext, type TransformPageContext, type UserConfig, type UserConfigExport, type UserConfigFn, build, createContentLoader, createMarkdownRenderer, createServer, defineConfig, defineConfigWithTheme, defineLoader, init, mergeConfig, postcssIsolateStyles, resolveConfig, resolvePages, resolveSiteData, resolveUserConfig, scaffold, serve };
|