package @vue/shared

Enumerations

Name Summary

PatchFlags

Patch flags are optimization hints generated by the compiler. when a block with dynamicChildren is encountered during diff, the algorithm enters "optimized mode". In this mode, we know that the vdom is produced by a render function generated by the compiler, so the algorithm only needs to handle updates explicitly marked by these patch flags.

Patch flags can be combined using the | bitwise operator and can be checked using the & operator, e.g.

```js const flag = TEXT

CLASS if (flag & TEXT) { …​ } ` Check the patchElement function in '../../runtime-core/src/renderer.ts' to see how the flags are handled during diff.

ShapeFlags

SlotFlags

Functions

escapeHtml(string)

Parameters
Name Type Description

string

unknown

Returns

string

Signature
export declare function escapeHtml(string: unknown): string;

escapeHtmlComment(src)

Parameters
Name Type Description

src

string

Returns

string

Signature
export declare function escapeHtmlComment(src: string): string;

generateCodeFrame(source, start, end)

Parameters
Name Type Description

source

string

start

number

end

number

Returns

string

Signature
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;

includeBooleanAttr(value)

Boolean attributes should be included if the value is truthy or ''. e.g. <select multiple> compiles to { multiple: '' }

Parameters
Name Type Description

value

unknown

Returns

boolean

Signature
export declare function includeBooleanAttr(value: unknown): boolean;

isSSRSafeAttrName(name)

Parameters
Name Type Description

name

string

Returns

boolean

Signature
export declare function isSSRSafeAttrName(name: string): boolean;

looseEqual(a, b)

Parameters
Name Type Description

a

any

b

any

Returns

boolean

Signature
export declare function looseEqual(a: any, b: any): boolean;

looseIndexOf(arr, val)

Parameters
Name Type Description

arr

any[]

val

any

Returns

number

Signature
export declare function looseIndexOf(arr: any[], val: any): number;

makeMap(str, expectsLowerCase)

Make a map and return a function for checking if a key is in that map. IMPORTANT: all calls of this function must be prefixed with /*\#\\_\\\_PURE\\\_\\\_\*/ So that rollup can tree-shake them if necessary.

Parameters
Name Type Description

str

string

expectsLowerCase

boolean

Returns

(key: string) => boolean

Signature
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;

normalizeClass(value)

Parameters
Name Type Description

value

unknown

Returns

string

Signature
export declare function normalizeClass(value: unknown): string;

normalizeProps(props)

Parameters
Name Type Description

props

Record<string, any> | null

Returns

Record<string, any> | null

Signature
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;

normalizeStyle(value)

Parameters
Name Type Description

value

unknown

Returns

NormalizedStyle | string

undefined

Signature
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;

parseStringStyle(cssText)

Parameters
Name Type Description

cssText

string

Returns

NormalizedStyle

Signature
export declare function parseStringStyle(cssText: string): NormalizedStyle;

stringifyStyle(styles)

Parameters
Name Type Description

styles

NormalizedStyle | string

undefined

Returns

string

Signature
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;