1 | /**
|
---|
2 | * Make a map and return a function for checking if a key
|
---|
3 | * is in that map.
|
---|
4 | * IMPORTANT: all calls of this function must be prefixed with
|
---|
5 | * \/\*#\_\_PURE\_\_\*\/
|
---|
6 | * So that rollup can tree-shake them if necessary.
|
---|
7 | */
|
---|
8 | /*! #__NO_SIDE_EFFECTS__ */
|
---|
9 | export declare function makeMap(str: string): (key: string) => boolean;
|
---|
10 |
|
---|
11 | export declare const EMPTY_OBJ: {
|
---|
12 | readonly [key: string]: any;
|
---|
13 | };
|
---|
14 | export declare const EMPTY_ARR: readonly never[];
|
---|
15 | export declare const NOOP: () => void;
|
---|
16 | /**
|
---|
17 | * Always return false.
|
---|
18 | */
|
---|
19 | export declare const NO: () => boolean;
|
---|
20 | export declare const isOn: (key: string) => boolean;
|
---|
21 | export declare const isModelListener: (key: string) => key is `onUpdate:${string}`;
|
---|
22 | export declare const extend: typeof Object.assign;
|
---|
23 | export declare const remove: <T>(arr: T[], el: T) => void;
|
---|
24 | export declare const hasOwn: (val: object, key: string | symbol) => key is keyof typeof val;
|
---|
25 | export declare const isArray: typeof Array.isArray;
|
---|
26 | export declare const isMap: (val: unknown) => val is Map<any, any>;
|
---|
27 | export declare const isSet: (val: unknown) => val is Set<any>;
|
---|
28 | export declare const isDate: (val: unknown) => val is Date;
|
---|
29 | export declare const isRegExp: (val: unknown) => val is RegExp;
|
---|
30 | export declare const isFunction: (val: unknown) => val is Function;
|
---|
31 | export declare const isString: (val: unknown) => val is string;
|
---|
32 | export declare const isSymbol: (val: unknown) => val is symbol;
|
---|
33 | export declare const isObject: (val: unknown) => val is Record<any, any>;
|
---|
34 | export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
---|
35 | export declare const objectToString: typeof Object.prototype.toString;
|
---|
36 | export declare const toTypeString: (value: unknown) => string;
|
---|
37 | export declare const toRawType: (value: unknown) => string;
|
---|
38 | export declare const isPlainObject: (val: unknown) => val is object;
|
---|
39 | export declare const isIntegerKey: (key: unknown) => boolean;
|
---|
40 | export declare const isReservedProp: (key: string) => boolean;
|
---|
41 | export declare const isBuiltInDirective: (key: string) => boolean;
|
---|
42 | /**
|
---|
43 | * @private
|
---|
44 | */
|
---|
45 | export declare const camelize: (str: string) => string;
|
---|
46 | /**
|
---|
47 | * @private
|
---|
48 | */
|
---|
49 | export declare const hyphenate: (str: string) => string;
|
---|
50 | /**
|
---|
51 | * @private
|
---|
52 | */
|
---|
53 | export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
|
---|
54 | /**
|
---|
55 | * @private
|
---|
56 | */
|
---|
57 | export declare const toHandlerKey: <T extends string>(str: T) => T extends '' ? '' : `on${Capitalize<T>}`;
|
---|
58 | export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
---|
59 | export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void;
|
---|
60 | export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void;
|
---|
61 | /**
|
---|
62 | * "123-foo" will be parsed to 123
|
---|
63 | * This is used for the .number modifier in v-model
|
---|
64 | */
|
---|
65 | export declare const looseToNumber: (val: any) => any;
|
---|
66 | /**
|
---|
67 | * Only concerns number-like strings
|
---|
68 | * "123-foo" will be returned as-is
|
---|
69 | */
|
---|
70 | export declare const toNumber: (val: any) => any;
|
---|
71 | export declare const getGlobalThis: () => any;
|
---|
72 | export declare function genPropsAccessExp(name: string): string;
|
---|
73 | export declare function genCacheKey(source: string, options: any): string;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Patch flags are optimization hints generated by the compiler.
|
---|
77 | * when a block with dynamicChildren is encountered during diff, the algorithm
|
---|
78 | * enters "optimized mode". In this mode, we know that the vdom is produced by
|
---|
79 | * a render function generated by the compiler, so the algorithm only needs to
|
---|
80 | * handle updates explicitly marked by these patch flags.
|
---|
81 | *
|
---|
82 | * Patch flags can be combined using the | bitwise operator and can be checked
|
---|
83 | * using the & operator, e.g.
|
---|
84 | *
|
---|
85 | * ```js
|
---|
86 | * const flag = TEXT | CLASS
|
---|
87 | * if (flag & TEXT) { ... }
|
---|
88 | * ```
|
---|
89 | *
|
---|
90 | * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
|
---|
91 | * flags are handled during diff.
|
---|
92 | */
|
---|
93 | export declare enum PatchFlags {
|
---|
94 | /**
|
---|
95 | * Indicates an element with dynamic textContent (children fast path)
|
---|
96 | */
|
---|
97 | TEXT = 1,
|
---|
98 | /**
|
---|
99 | * Indicates an element with dynamic class binding.
|
---|
100 | */
|
---|
101 | CLASS = 2,
|
---|
102 | /**
|
---|
103 | * Indicates an element with dynamic style
|
---|
104 | * The compiler pre-compiles static string styles into static objects
|
---|
105 | * + detects and hoists inline static objects
|
---|
106 | * e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted
|
---|
107 | * as:
|
---|
108 | * ```js
|
---|
109 | * const style = { color: 'red' }
|
---|
110 | * render() { return e('div', { style }) }
|
---|
111 | * ```
|
---|
112 | */
|
---|
113 | STYLE = 4,
|
---|
114 | /**
|
---|
115 | * Indicates an element that has non-class/style dynamic props.
|
---|
116 | * Can also be on a component that has any dynamic props (includes
|
---|
117 | * class/style). when this flag is present, the vnode also has a dynamicProps
|
---|
118 | * array that contains the keys of the props that may change so the runtime
|
---|
119 | * can diff them faster (without having to worry about removed props)
|
---|
120 | */
|
---|
121 | PROPS = 8,
|
---|
122 | /**
|
---|
123 | * Indicates an element with props with dynamic keys. When keys change, a full
|
---|
124 | * diff is always needed to remove the old key. This flag is mutually
|
---|
125 | * exclusive with CLASS, STYLE and PROPS.
|
---|
126 | */
|
---|
127 | FULL_PROPS = 16,
|
---|
128 | /**
|
---|
129 | * Indicates an element that requires props hydration
|
---|
130 | * (but not necessarily patching)
|
---|
131 | * e.g. event listeners & v-bind with prop modifier
|
---|
132 | */
|
---|
133 | NEED_HYDRATION = 32,
|
---|
134 | /**
|
---|
135 | * Indicates a fragment whose children order doesn't change.
|
---|
136 | */
|
---|
137 | STABLE_FRAGMENT = 64,
|
---|
138 | /**
|
---|
139 | * Indicates a fragment with keyed or partially keyed children
|
---|
140 | */
|
---|
141 | KEYED_FRAGMENT = 128,
|
---|
142 | /**
|
---|
143 | * Indicates a fragment with unkeyed children.
|
---|
144 | */
|
---|
145 | UNKEYED_FRAGMENT = 256,
|
---|
146 | /**
|
---|
147 | * Indicates an element that only needs non-props patching, e.g. ref or
|
---|
148 | * directives (onVnodeXXX hooks). since every patched vnode checks for refs
|
---|
149 | * and onVnodeXXX hooks, it simply marks the vnode so that a parent block
|
---|
150 | * will track it.
|
---|
151 | */
|
---|
152 | NEED_PATCH = 512,
|
---|
153 | /**
|
---|
154 | * Indicates a component with dynamic slots (e.g. slot that references a v-for
|
---|
155 | * iterated value, or dynamic slot names).
|
---|
156 | * Components with this flag are always force updated.
|
---|
157 | */
|
---|
158 | DYNAMIC_SLOTS = 1024,
|
---|
159 | /**
|
---|
160 | * Indicates a fragment that was created only because the user has placed
|
---|
161 | * comments at the root level of a template. This is a dev-only flag since
|
---|
162 | * comments are stripped in production.
|
---|
163 | */
|
---|
164 | DEV_ROOT_FRAGMENT = 2048,
|
---|
165 | /**
|
---|
166 | * SPECIAL FLAGS -------------------------------------------------------------
|
---|
167 | * Special flags are negative integers. They are never matched against using
|
---|
168 | * bitwise operators (bitwise matching should only happen in branches where
|
---|
169 | * patchFlag > 0), and are mutually exclusive. When checking for a special
|
---|
170 | * flag, simply check patchFlag === FLAG.
|
---|
171 | */
|
---|
172 | /**
|
---|
173 | * Indicates a cached static vnode. This is also a hint for hydration to skip
|
---|
174 | * the entire sub tree since static content never needs to be updated.
|
---|
175 | */
|
---|
176 | CACHED = -1,
|
---|
177 | /**
|
---|
178 | * A special flag that indicates that the diffing algorithm should bail out
|
---|
179 | * of optimized mode. For example, on block fragments created by renderSlot()
|
---|
180 | * when encountering non-compiler generated slots (i.e. manually written
|
---|
181 | * render functions, which should always be fully diffed)
|
---|
182 | * OR manually cloneVNodes
|
---|
183 | */
|
---|
184 | BAIL = -2
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * dev only flag -> name mapping
|
---|
188 | */
|
---|
189 | export declare const PatchFlagNames: Record<PatchFlags, string>;
|
---|
190 |
|
---|
191 | export declare enum ShapeFlags {
|
---|
192 | ELEMENT = 1,
|
---|
193 | FUNCTIONAL_COMPONENT = 2,
|
---|
194 | STATEFUL_COMPONENT = 4,
|
---|
195 | TEXT_CHILDREN = 8,
|
---|
196 | ARRAY_CHILDREN = 16,
|
---|
197 | SLOTS_CHILDREN = 32,
|
---|
198 | TELEPORT = 64,
|
---|
199 | SUSPENSE = 128,
|
---|
200 | COMPONENT_SHOULD_KEEP_ALIVE = 256,
|
---|
201 | COMPONENT_KEPT_ALIVE = 512,
|
---|
202 | COMPONENT = 6
|
---|
203 | }
|
---|
204 |
|
---|
205 | export declare enum SlotFlags {
|
---|
206 | /**
|
---|
207 | * Stable slots that only reference slot props or context state. The slot
|
---|
208 | * can fully capture its own dependencies so when passed down the parent won't
|
---|
209 | * need to force the child to update.
|
---|
210 | */
|
---|
211 | STABLE = 1,
|
---|
212 | /**
|
---|
213 | * Slots that reference scope variables (v-for or an outer slot prop), or
|
---|
214 | * has conditional structure (v-if, v-for). The parent will need to force
|
---|
215 | * the child to update because the slot does not fully capture its dependencies.
|
---|
216 | */
|
---|
217 | DYNAMIC = 2,
|
---|
218 | /**
|
---|
219 | * `<slot/>` being forwarded into a child component. Whether the parent needs
|
---|
220 | * to update the child is dependent on what kind of slots the parent itself
|
---|
221 | * received. This has to be refined at runtime, when the child's vnode
|
---|
222 | * is being created (in `normalizeChildren`)
|
---|
223 | */
|
---|
224 | FORWARDED = 3
|
---|
225 | }
|
---|
226 | /**
|
---|
227 | * Dev only
|
---|
228 | */
|
---|
229 | export declare const slotFlagsText: Record<SlotFlags, string>;
|
---|
230 |
|
---|
231 | export declare const isGloballyAllowed: (key: string) => boolean;
|
---|
232 | /** @deprecated use `isGloballyAllowed` instead */
|
---|
233 | export declare const isGloballyWhitelisted: (key: string) => boolean;
|
---|
234 |
|
---|
235 | export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
---|
236 |
|
---|
237 | export type NormalizedStyle = Record<string, string | number>;
|
---|
238 | export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
---|
239 | export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
---|
240 | export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
---|
241 | export declare function normalizeClass(value: unknown): string;
|
---|
242 | export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
---|
243 |
|
---|
244 | /**
|
---|
245 | * Compiler only.
|
---|
246 | * Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
---|
247 | */
|
---|
248 | export declare const isHTMLTag: (key: string) => boolean;
|
---|
249 | /**
|
---|
250 | * Compiler only.
|
---|
251 | * Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
---|
252 | */
|
---|
253 | export declare const isSVGTag: (key: string) => boolean;
|
---|
254 | /**
|
---|
255 | * Compiler only.
|
---|
256 | * Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
---|
257 | */
|
---|
258 | export declare const isMathMLTag: (key: string) => boolean;
|
---|
259 | /**
|
---|
260 | * Compiler only.
|
---|
261 | * Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
---|
262 | */
|
---|
263 | export declare const isVoidTag: (key: string) => boolean;
|
---|
264 |
|
---|
265 | export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
---|
266 | /**
|
---|
267 | * The full list is needed during SSR to produce the correct initial markup.
|
---|
268 | */
|
---|
269 | export declare const isBooleanAttr: (key: string) => boolean;
|
---|
270 | /**
|
---|
271 | * Boolean attributes should be included if the value is truthy or ''.
|
---|
272 | * e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
---|
273 | */
|
---|
274 | export declare function includeBooleanAttr(value: unknown): boolean;
|
---|
275 | export declare function isSSRSafeAttrName(name: string): boolean;
|
---|
276 | export declare const propsToAttrMap: Record<string, string | undefined>;
|
---|
277 | /**
|
---|
278 | * Known attributes, this is used for stringification of runtime static nodes
|
---|
279 | * so that we don't stringify bindings that cannot be set from HTML.
|
---|
280 | * Don't also forget to allow `data-*` and `aria-*`!
|
---|
281 | * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
---|
282 | */
|
---|
283 | export declare const isKnownHtmlAttr: (key: string) => boolean;
|
---|
284 | /**
|
---|
285 | * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
---|
286 | */
|
---|
287 | export declare const isKnownSvgAttr: (key: string) => boolean;
|
---|
288 | /**
|
---|
289 | * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
|
---|
290 | */
|
---|
291 | export declare const isKnownMathMLAttr: (key: string) => boolean;
|
---|
292 | /**
|
---|
293 | * Shared between server-renderer and runtime-core hydration logic
|
---|
294 | */
|
---|
295 | export declare function isRenderableAttrValue(value: unknown): boolean;
|
---|
296 |
|
---|
297 | export declare function escapeHtml(string: unknown): string;
|
---|
298 | export declare function escapeHtmlComment(src: string): string;
|
---|
299 | export declare const cssVarNameEscapeSymbolsRE: RegExp;
|
---|
300 | export declare function getEscapedCssVarName(key: string, doubleEscape: boolean): string;
|
---|
301 |
|
---|
302 | export declare function looseEqual(a: any, b: any): boolean;
|
---|
303 | export declare function looseIndexOf(arr: any[], val: any): number;
|
---|
304 |
|
---|
305 | /**
|
---|
306 | * For converting {{ interpolation }} values to displayed strings.
|
---|
307 | * @private
|
---|
308 | */
|
---|
309 | export declare const toDisplayString: (val: unknown) => string;
|
---|
310 |
|
---|
311 | export type Prettify<T> = {
|
---|
312 | [K in keyof T]: T[K];
|
---|
313 | } & {};
|
---|
314 | export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
---|
315 | export type LooseRequired<T> = {
|
---|
316 | [P in keyof (T & Required<T>)]: T[P];
|
---|
317 | };
|
---|
318 | export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
---|
319 | export type IsKeyValues<T, K = string> = IfAny<T, false, T extends object ? (keyof T extends K ? true : false) : false>;
|
---|
320 | /**
|
---|
321 | * Utility for extracting the parameters from a function overload (for typed emits)
|
---|
322 | * https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709
|
---|
323 | */
|
---|
324 | export type OverloadParameters<T extends (...args: any[]) => any> = Parameters<OverloadUnion<T>>;
|
---|
325 | type OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>;
|
---|
326 | type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (...args: infer TArgs) => infer TReturn ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never;
|
---|
327 | type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends () => never ? never : () => never>;
|
---|
328 |
|
---|