A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/commit/ced774be6ddbc53884d7a5d395514a9f62e32336 below:

add types for vue-template-compiler (#7918) · vuejs/vue@ced774b · GitHub

1 +

import Vue, { VNode } from "vue"

2 + 3 +

/*

4 +

* Template compilation options / results

5 +

*/

6 +

interface CompilerOptions {

7 +

modules?: ModuleOptions[];

8 +

directives?: Record<string, DirectiveFunction>;

9 +

preserveWhitespace?: boolean;

10 +

}

11 + 12 +

interface CompiledResult {

13 +

ast: ASTElement | undefined;

14 +

render: string;

15 +

staticRenderFns: string[];

16 +

errors: string[];

17 +

tips: string[];

18 +

}

19 + 20 +

interface CompiledResultFunctions {

21 +

render: () => VNode;

22 +

staticRenderFns: (() => VNode)[];

23 +

}

24 + 25 +

interface ModuleOptions {

26 +

preTransformNode: (el: ASTElement) => ASTElement | undefined;

27 +

transformNode: (el: ASTElement) => ASTElement | undefined;

28 +

postTransformNode: (el: ASTElement) => void;

29 +

genData: (el: ASTElement) => string;

30 +

transformCode?: (el: ASTElement, code: string) => string;

31 +

staticKeys?: string[];

32 +

}

33 + 34 +

type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void;

35 + 36 +

/*

37 +

* AST Types

38 +

*/

39 + 40 +

/**

41 +

* - 0: FALSE - whole sub tree un-optimizable

42 +

* - 1: FULL - whole sub tree optimizable

43 +

* - 2: SELF - self optimizable but has some un-optimizable children

44 +

* - 3: CHILDREN - self un-optimizable but have fully optimizable children

45 +

* - 4: PARTIAL - self un-optimizable with some un-optimizable children

46 +

*/

47 +

export type SSROptimizability = 0 | 1 | 2 | 3 | 4

48 + 49 +

export interface ASTModifiers {

50 +

[key: string]: boolean;

51 +

}

52 + 53 +

export interface ASTIfCondition {

54 +

exp: string | undefined;

55 +

block: ASTElement;

56 +

}

57 + 58 +

export interface ASTElementHandler {

59 +

value: string;

60 +

params?: any[];

61 +

modifiers: ASTModifiers | undefined;

62 +

}

63 + 64 +

export interface ASTElementHandlers {

65 +

[key: string]: ASTElementHandler | ASTElementHandler[];

66 +

}

67 + 68 +

export interface ASTDirective {

69 +

name: string;

70 +

rawName: string;

71 +

value: string;

72 +

arg: string | undefined;

73 +

modifiers: ASTModifiers | undefined;

74 +

}

75 + 76 +

export type ASTNode = ASTElement | ASTText | ASTExpression;

77 + 78 +

export interface ASTElement {

79 +

type: 1;

80 +

tag: string;

81 +

attrsList: { name: string; value: any }[];

82 +

attrsMap: Record<string, any>;

83 +

parent: ASTElement | undefined;

84 +

children: ASTNode[];

85 + 86 +

processed?: true;

87 + 88 +

static?: boolean;

89 +

staticRoot?: boolean;

90 +

staticInFor?: boolean;

91 +

staticProcessed?: boolean;

92 +

hasBindings?: boolean;

93 + 94 +

text?: string;

95 +

attrs?: { name: string; value: any }[];

96 +

props?: { name: string; value: string }[];

97 +

plain?: boolean;

98 +

pre?: true;

99 +

ns?: string;

100 + 101 +

component?: string;

102 +

inlineTemplate?: true;

103 +

transitionMode?: string | null;

104 +

slotName?: string;

105 +

slotTarget?: string;

106 +

slotScope?: string;

107 +

scopedSlots?: Record<string, ASTElement>;

108 + 109 +

ref?: string;

110 +

refInFor?: boolean;

111 + 112 +

if?: string;

113 +

ifProcessed?: boolean;

114 +

elseif?: string;

115 +

else?: true;

116 +

ifConditions?: ASTIfCondition[];

117 + 118 +

for?: string;

119 +

forProcessed?: boolean;

120 +

key?: string;

121 +

alias?: string;

122 +

iterator1?: string;

123 +

iterator2?: string;

124 + 125 +

staticClass?: string;

126 +

classBinding?: string;

127 +

staticStyle?: string;

128 +

styleBinding?: string;

129 +

events?: ASTElementHandlers;

130 +

nativeEvents?: ASTElementHandlers;

131 + 132 +

transition?: string | true;

133 +

transitionOnAppear?: boolean;

134 + 135 +

model?: {

136 +

value: string;

137 +

callback: string;

138 +

expression: string;

139 +

};

140 + 141 +

directives?: ASTDirective[];

142 + 143 +

forbidden?: true;

144 +

once?: true;

145 +

onceProcessed?: boolean;

146 +

wrapData?: (code: string) => string;

147 +

wrapListeners?: (code: string) => string;

148 + 149 +

// 2.4 ssr optimization

150 +

ssrOptimizability?: SSROptimizability;

151 + 152 +

// weex specific

153 +

appendAsTree?: boolean;

154 +

}

155 + 156 +

export interface ASTExpression {

157 +

type: 2;

158 +

expression: string;

159 +

text: string;

160 +

tokens: (string | Record<string, any>)[];

161 +

static?: boolean;

162 +

// 2.4 ssr optimization

163 +

ssrOptimizability?: SSROptimizability;

164 +

}

165 + 166 +

export interface ASTText {

167 +

type: 3;

168 +

text: string;

169 +

static?: boolean;

170 +

isComment?: boolean;

171 +

// 2.4 ssr optimization

172 +

ssrOptimizability?: SSROptimizability;

173 +

}

174 + 175 +

/*

176 +

* SFC parser related types

177 +

*/

178 +

interface SFCParserOptions {

179 +

pad?: true | 'line' | 'space';

180 +

}

181 + 182 +

export interface SFCBlock {

183 +

type: string;

184 +

content: string;

185 +

attrs: Record<string, string>;

186 +

start?: number;

187 +

end?: number;

188 +

lang?: string;

189 +

src?: string;

190 +

scoped?: boolean;

191 +

module?: string | boolean;

192 +

}

193 + 194 +

export interface SFCDescriptor {

195 +

template: SFCBlock | undefined;

196 +

script: SFCBlock | undefined;

197 +

styles: SFCBlock[];

198 +

customBlocks: SFCBlock[];

199 +

}

200 + 201 +

/*

202 +

* Exposed functions

203 +

*/

204 +

export function compile(

205 +

template: string,

206 +

options?: CompilerOptions

207 +

): CompiledResult;

208 + 209 +

export function compileToFunctions(template: string): CompiledResultFunctions;

210 + 211 +

export function ssrCompile(

212 +

template: string,

213 +

options?: CompilerOptions

214 +

): CompiledResult;

215 + 216 +

export function ssrCompileToFunctions(template: string): CompiledResultFunctions;

217 + 218 +

export function parseComponent(

219 +

file: string,

220 +

options?: SFCParserOptions

221 +

): SFCDescriptor;


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4