-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.d.ts
executable file
·5733 lines (5300 loc) · 215 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @license Angular v19.1.0-next.0+sha-bd08d1d
* (c) 2010-2024 Google LLC. https://angular.io/
* License: MIT
*/
/**
* Records the absolute position of a text span in a source file, where `start` and `end` are the
* starting and ending byte offsets, respectively, of the text span in a source file.
*/
export declare class AbsoluteSourceSpan {
readonly start: number;
readonly end: number;
constructor(start: number, end: number);
}
/**
* A data structure which captures the animation trigger names that are statically resolvable
* and whether some names could not be statically evaluated.
*/
export declare interface AnimationTriggerNames {
includesDynamicAnimations: boolean;
staticTriggerNames: string[];
}
declare function areAllEquivalent<T extends {
isEquivalent(other: T): boolean;
}>(base: T[], other: T[]): boolean;
export declare class ArrayType extends Type {
of: Type;
constructor(of: Type, modifiers?: TypeModifier);
visitType(visitor: TypeVisitor, context: any): any;
}
declare function arrowFn(params: FnParam[], body: Expression | Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null): ArrowFunctionExpr;
export declare class ArrowFunctionExpr extends Expression {
params: FnParam[];
body: Expression | Statement[];
constructor(params: FnParam[], body: Expression | Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null);
isEquivalent(e: Expression): boolean;
isConstant(): boolean;
visitExpression(visitor: ExpressionVisitor, context: any): any;
clone(): Expression;
toDeclStmt(name: string, modifiers?: StmtModifier): DeclareVarStmt;
}
export declare abstract class AST {
span: ParseSpan;
/**
* Absolute location of the expression AST in a source code file.
*/
sourceSpan: AbsoluteSourceSpan;
constructor(span: ParseSpan,
/**
* Absolute location of the expression AST in a source code file.
*/
sourceSpan: AbsoluteSourceSpan);
abstract visit(visitor: AstVisitor, context?: any): any;
toString(): string;
}
export declare class AstMemoryEfficientTransformer implements AstVisitor {
visitImplicitReceiver(ast: ImplicitReceiver, context: any): AST;
visitThisReceiver(ast: ThisReceiver, context: any): AST;
visitInterpolation(ast: Interpolation, context: any): Interpolation;
visitLiteralPrimitive(ast: LiteralPrimitive, context: any): AST;
visitPropertyRead(ast: PropertyRead, context: any): AST;
visitPropertyWrite(ast: PropertyWrite, context: any): AST;
visitSafePropertyRead(ast: SafePropertyRead, context: any): AST;
visitLiteralArray(ast: LiteralArray, context: any): AST;
visitLiteralMap(ast: LiteralMap, context: any): AST;
visitUnary(ast: Unary, context: any): AST;
visitBinary(ast: Binary, context: any): AST;
visitPrefixNot(ast: PrefixNot, context: any): AST;
visitTypeofExpresion(ast: TypeofExpression, context: any): AST;
visitNonNullAssert(ast: NonNullAssert, context: any): AST;
visitConditional(ast: Conditional, context: any): AST;
visitPipe(ast: BindingPipe, context: any): AST;
visitKeyedRead(ast: KeyedRead, context: any): AST;
visitKeyedWrite(ast: KeyedWrite, context: any): AST;
visitAll(asts: any[]): any[];
visitChain(ast: Chain, context: any): AST;
visitCall(ast: Call, context: any): AST;
visitSafeCall(ast: SafeCall, context: any): AST;
visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
}
export declare class AstTransformer implements AstVisitor {
visitImplicitReceiver(ast: ImplicitReceiver, context: any): AST;
visitThisReceiver(ast: ThisReceiver, context: any): AST;
visitInterpolation(ast: Interpolation, context: any): AST;
visitLiteralPrimitive(ast: LiteralPrimitive, context: any): AST;
visitPropertyRead(ast: PropertyRead, context: any): AST;
visitPropertyWrite(ast: PropertyWrite, context: any): AST;
visitSafePropertyRead(ast: SafePropertyRead, context: any): AST;
visitLiteralArray(ast: LiteralArray, context: any): AST;
visitLiteralMap(ast: LiteralMap, context: any): AST;
visitUnary(ast: Unary, context: any): AST;
visitBinary(ast: Binary, context: any): AST;
visitPrefixNot(ast: PrefixNot, context: any): AST;
visitTypeofExpresion(ast: TypeofExpression, context: any): AST;
visitNonNullAssert(ast: NonNullAssert, context: any): AST;
visitConditional(ast: Conditional, context: any): AST;
visitPipe(ast: BindingPipe, context: any): AST;
visitKeyedRead(ast: KeyedRead, context: any): AST;
visitKeyedWrite(ast: KeyedWrite, context: any): AST;
visitCall(ast: Call, context: any): AST;
visitSafeCall(ast: SafeCall, context: any): AST;
visitAll(asts: any[]): any[];
visitChain(ast: Chain, context: any): AST;
visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
}
export declare interface AstVisitor {
/**
* The `visitUnary` method is declared as optional for backwards compatibility. In an upcoming
* major release, this method will be made required.
*/
visitUnary?(ast: Unary, context: any): any;
visitBinary(ast: Binary, context: any): any;
visitChain(ast: Chain, context: any): any;
visitConditional(ast: Conditional, context: any): any;
/**
* The `visitThisReceiver` method is declared as optional for backwards compatibility.
* In an upcoming major release, this method will be made required.
*/
visitThisReceiver?(ast: ThisReceiver, context: any): any;
visitImplicitReceiver(ast: ImplicitReceiver, context: any): any;
visitInterpolation(ast: Interpolation, context: any): any;
visitKeyedRead(ast: KeyedRead, context: any): any;
visitKeyedWrite(ast: KeyedWrite, context: any): any;
visitLiteralArray(ast: LiteralArray, context: any): any;
visitLiteralMap(ast: LiteralMap, context: any): any;
visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any;
visitPipe(ast: BindingPipe, context: any): any;
visitPrefixNot(ast: PrefixNot, context: any): any;
visitTypeofExpresion(ast: TypeofExpression, context: any): any;
visitNonNullAssert(ast: NonNullAssert, context: any): any;
visitPropertyRead(ast: PropertyRead, context: any): any;
visitPropertyWrite(ast: PropertyWrite, context: any): any;
visitSafePropertyRead(ast: SafePropertyRead, context: any): any;
visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any;
visitCall(ast: Call, context: any): any;
visitSafeCall(ast: SafeCall, context: any): any;
visitASTWithSource?(ast: ASTWithSource, context: any): any;
/**
* This function is optionally defined to allow classes that implement this
* interface to selectively decide if the specified `ast` should be visited.
* @param ast node to visit
* @param context context that gets passed to the node and all its children
*/
visit?(ast: AST, context?: any): any;
}
export declare abstract class ASTWithName extends AST {
nameSpan: AbsoluteSourceSpan;
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan);
}
export declare class ASTWithSource<T extends AST = AST> extends AST {
ast: T;
source: string | null;
location: string;
errors: ParserError[];
constructor(ast: T, source: string | null, location: string, absoluteOffset: number, errors: ParserError[]);
visit(visitor: AstVisitor, context?: any): any;
toString(): string;
}
export declare class Attribute extends NodeWithI18n {
name: string;
value: string;
readonly keySpan: ParseSourceSpan | undefined;
valueSpan: ParseSourceSpan | undefined;
valueTokens: InterpolatedAttributeToken[] | undefined;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta_2 | undefined);
visit(visitor: Visitor, context: any): any;
}
/**
* A set of marker values to be used in the attributes arrays. These markers indicate that some
* items are not regular attributes and the processing should be adapted accordingly.
*/
declare const enum AttributeMarker {
/**
* Marker indicates that the following 3 values in the attributes array are:
* namespaceUri, attributeName, attributeValue
* in that order.
*/
NamespaceURI = 0,
/**
* Signals class declaration.
*
* Each value following `Classes` designates a class name to include on the element.
* ## Example:
*
* Given:
* ```
* <div class="foo bar baz">...<d/vi>
* ```
*
* the generated code is:
* ```
* var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz'];
* ```
*/
Classes = 1,
/**
* Signals style declaration.
*
* Each pair of values following `Styles` designates a style name and value to include on the
* element.
* ## Example:
*
* Given:
* ```
* <div style="width:100px; height:200px; color:red">...</div>
* ```
*
* the generated code is:
* ```
* var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red'];
* ```
*/
Styles = 2,
/**
* Signals that the following attribute names were extracted from input or output bindings.
*
* For example, given the following HTML:
*
* ```
* <div moo="car" [foo]="exp" (bar)="doSth()">
* ```
*
* the generated code is:
*
* ```
* var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar'];
* ```
*/
Bindings = 3,
/**
* Signals that the following attribute names were hoisted from an inline-template declaration.
*
* For example, given the following HTML:
*
* ```
* <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value">
* ```
*
* the generated code for the `template()` instruction would include:
*
* ```
* ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf',
* 'ngForTrackBy', 'let-value']
* ```
*
* while the generated code for the `element()` instruction inside the template function would
* include:
*
* ```
* ['dirA', '', AttributeMarker.Bindings, 'dirB']
* ```
*/
Template = 4,
/**
* Signals that the following attribute is `ngProjectAs` and its value is a parsed `CssSelector`.
*
* For example, given the following HTML:
*
* ```
* <h1 attr="value" ngProjectAs="[title]">
* ```
*
* the generated code for the `element()` instruction would include:
*
* ```
* ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']]
* ```
*/
ProjectAs = 5,
/**
* Signals that the following attribute will be translated by runtime i18n
*
* For example, given the following HTML:
*
* ```
* <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar>
* ```
*
* the generated code is:
*
* ```
* var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar'];
*/
I18n = 6
}
declare interface AttributeValueInterpolationToken extends TokenBase {
type: LexerTokenType.ATTR_VALUE_INTERPOLATION;
parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string];
}
declare interface AttributeValueTextToken extends TokenBase {
type: LexerTokenType.ATTR_VALUE_TEXT;
parts: [value: string];
}
declare interface BaseNode {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor, context: any): any;
}
export declare class Binary extends AST {
operation: string;
left: AST;
right: AST;
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, operation: string, left: AST, right: AST);
visit(visitor: AstVisitor, context?: any): any;
}
export declare enum BinaryOperator {
Equals = 0,
NotEquals = 1,
Identical = 2,
NotIdentical = 3,
Minus = 4,
Plus = 5,
Divide = 6,
Multiply = 7,
Modulo = 8,
And = 9,
Or = 10,
BitwiseOr = 11,
BitwiseAnd = 12,
Lower = 13,
LowerEquals = 14,
Bigger = 15,
BiggerEquals = 16,
NullishCoalesce = 17
}
export declare class BinaryOperatorExpr extends Expression {
operator: BinaryOperator;
rhs: Expression;
parens: boolean;
lhs: Expression;
constructor(operator: BinaryOperator, lhs: Expression, rhs: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null, parens?: boolean);
isEquivalent(e: Expression): boolean;
isConstant(): boolean;
visitExpression(visitor: ExpressionVisitor, context: any): any;
clone(): BinaryOperatorExpr;
}
/**
* Parses bindings in templates and in the directive host area.
*/
declare class BindingParser {
private _exprParser;
private _interpolationConfig;
private _schemaRegistry;
errors: ParseError[];
private _allowInvalidAssignmentEvents;
constructor(_exprParser: Parser, _interpolationConfig: InterpolationConfig, _schemaRegistry: ElementSchemaRegistry, errors: ParseError[], _allowInvalidAssignmentEvents?: boolean);
get interpolationConfig(): InterpolationConfig;
createBoundHostProperties(properties: HostProperties, sourceSpan: ParseSourceSpan): ParsedProperty[] | null;
createDirectiveHostEventAsts(hostListeners: HostListeners, sourceSpan: ParseSourceSpan): ParsedEvent[] | null;
parseInterpolation(value: string, sourceSpan: ParseSourceSpan, interpolatedTokens: InterpolatedAttributeToken[] | InterpolatedTextToken[] | null): ASTWithSource;
/**
* Similar to `parseInterpolation`, but treats the provided string as a single expression
* element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).
* This is used for parsing the switch expression in ICUs.
*/
parseInterpolationExpression(expression: string, sourceSpan: ParseSourceSpan): ASTWithSource;
/**
* Parses the bindings in a microsyntax expression, and converts them to
* `ParsedProperty` or `ParsedVariable`.
*
* @param tplKey template binding name
* @param tplValue template binding value
* @param sourceSpan span of template binding relative to entire the template
* @param absoluteValueOffset start of the tplValue relative to the entire template
* @param targetMatchableAttrs potential attributes to match in the template
* @param targetProps target property bindings in the template
* @param targetVars target variables in the template
*/
parseInlineTemplateBinding(tplKey: string, tplValue: string, sourceSpan: ParseSourceSpan, absoluteValueOffset: number, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], targetVars: ParsedVariable[], isIvyAst: boolean): void;
/**
* Parses the bindings in a microsyntax expression, e.g.
* ```
* <tag *tplKey="let value1 = prop; let value2 = localVar">
* ```
*
* @param tplKey template binding name
* @param tplValue template binding value
* @param sourceSpan span of template binding relative to entire the template
* @param absoluteKeyOffset start of the `tplKey`
* @param absoluteValueOffset start of the `tplValue`
*/
private _parseTemplateBindings;
parseLiteralAttr(name: string, value: string | null, sourceSpan: ParseSourceSpan, absoluteOffset: number, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan: ParseSourceSpan): void;
parsePropertyBinding(name: string, expression: string, isHost: boolean, isPartOfAssignmentBinding: boolean, sourceSpan: ParseSourceSpan, absoluteOffset: number, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan: ParseSourceSpan): void;
parsePropertyInterpolation(name: string, value: string, sourceSpan: ParseSourceSpan, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan: ParseSourceSpan, interpolatedTokens: InterpolatedAttributeToken[] | InterpolatedTextToken[] | null): boolean;
private _parsePropertyAst;
private _parseAnimation;
parseBinding(value: string, isHostBinding: boolean, sourceSpan: ParseSourceSpan, absoluteOffset: number): ASTWithSource;
createBoundElementProperty(elementSelector: string, boundProp: ParsedProperty, skipValidation?: boolean, mapPropertyName?: boolean): BoundElementProperty;
parseEvent(name: string, expression: string, isAssignmentEvent: boolean, sourceSpan: ParseSourceSpan, handlerSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetEvents: ParsedEvent[], keySpan: ParseSourceSpan): void;
calcPossibleSecurityContexts(selector: string, propName: string, isAttribute: boolean): SecurityContext[];
private _parseAnimationEvent;
private _parseRegularEvent;
private _parseAction;
private _reportError;
private _reportExpressionParserErrors;
/**
* @param propName the name of the property / attribute
* @param sourceSpan
* @param isAttr true when binding to an attribute
*/
private _validatePropertyOrAttributeName;
/**
* Returns whether a parsed AST is allowed to be used within the event side of a two-way binding.
* @param ast Parsed AST to be checked.
*/
private _isAllowedAssignmentEvent;
}
export declare class BindingPipe extends ASTWithName {
exp: AST;
name: string;
args: any[];
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, exp: AST, name: string, args: any[], nameSpan: AbsoluteSourceSpan);
visit(visitor: AstVisitor, context?: any): any;
}
export declare enum BindingType {
Property = 0,
Attribute = 1,
Class = 2,
Style = 3,
Animation = 4,
TwoWay = 5
}
export declare class Block extends NodeWithI18n {
name: string;
parameters: BlockParameter[];
children: Node_2[];
nameSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: BlockParameter[], children: Node_2[], sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta_2);
visit(visitor: Visitor, context: any): any;
}
export declare class BlockParameter implements BaseNode {
expression: string;
sourceSpan: ParseSourceSpan;
constructor(expression: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
}
declare class BlockPlaceholder implements Node_3 {
name: string;
parameters: string[];
startName: string;
closeName: string;
children: Node_3[];
sourceSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan | null;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: string[], startName: string, closeName: string, children: Node_3[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
visit(visitor: Visitor_2, context?: any): any;
}
declare const BOOL_TYPE: BuiltinType;
export declare class BoundElementProperty {
name: string;
type: BindingType;
securityContext: SecurityContext;
value: ASTWithSource;
unit: string | null;
sourceSpan: ParseSourceSpan;
readonly keySpan: ParseSourceSpan | undefined;
valueSpan: ParseSourceSpan | undefined;
constructor(name: string, type: BindingType, securityContext: SecurityContext, value: ASTWithSource, unit: string | null, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined);
}
/**
* Result of performing the binding operation against a `Target`.
*
* The original `Target` is accessible, as well as a suite of methods for extracting binding
* information regarding the `Target`.
*
* @param DirectiveT directive metadata type
*/
export declare interface BoundTarget<DirectiveT extends DirectiveMeta> {
/**
* Get the original `Target` that was bound.
*/
readonly target: Target;
/**
* For a given template node (either an `Element` or a `Template`), get the set of directives
* which matched the node, if any.
*/
getDirectivesOfNode(node: TmplAstElement | TmplAstTemplate): DirectiveT[] | null;
/**
* For a given `Reference`, get the reference's target - either an `Element`, a `Template`, or
* a directive on a particular node.
*/
getReferenceTarget(ref: TmplAstReference): ReferenceTarget<DirectiveT> | null;
/**
* For a given binding, get the entity to which the binding is being made.
*
* This will either be a directive or the node itself.
*/
getConsumerOfBinding(binding: TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstTextAttribute): DirectiveT | TmplAstElement | TmplAstTemplate | null;
/**
* If the given `AST` expression refers to a `Reference` or `Variable` within the `Target`, then
* return that.
*
* Otherwise, returns `null`.
*
* This is only defined for `AST` expressions that read or write to a property of an
* `ImplicitReceiver`.
*/
getExpressionTarget(expr: AST): TemplateEntity | null;
/**
* Given a particular `Reference` or `Variable`, get the `ScopedNode` which created it.
*
* All `Variable`s are defined on node, so this will always return a value for a `Variable`
* from the `Target`. Returns `null` otherwise.
*/
getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null;
/**
* Get the nesting level of a particular `ScopedNode`.
*
* This starts at 1 for top-level nodes within the `Target` and increases for nodes
* nested at deeper levels.
*/
getNestingLevel(node: ScopedNode): number;
/**
* Get all `Reference`s and `Variables` visible within the given `ScopedNode` (or at the top
* level, if `null` is passed).
*/
getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity>;
/**
* Get a list of all the directives used by the target,
* including directives from `@defer` blocks.
*/
getUsedDirectives(): DirectiveT[];
/**
* Get a list of eagerly used directives from the target.
* Note: this list *excludes* directives from `@defer` blocks.
*/
getEagerlyUsedDirectives(): DirectiveT[];
/**
* Get a list of all the pipes used by the target,
* including pipes from `@defer` blocks.
*/
getUsedPipes(): string[];
/**
* Get a list of eagerly used pipes from the target.
* Note: this list *excludes* pipes from `@defer` blocks.
*/
getEagerlyUsedPipes(): string[];
/**
* Get a list of all `@defer` blocks used by the target.
*/
getDeferBlocks(): TmplAstDeferredBlock[];
/**
* Gets the element that a specific deferred block trigger is targeting.
* @param block Block that the trigger belongs to.
* @param trigger Trigger whose target is being looked up.
*/
getDeferredTriggerTarget(block: TmplAstDeferredBlock, trigger: TmplAstDeferredTrigger): TmplAstElement | null;
/**
* Whether a given node is located in a `@defer` block.
*/
isDeferred(node: TmplAstElement): boolean;
}
export declare class BuiltinType extends Type {
name: BuiltinTypeName;
constructor(name: BuiltinTypeName, modifiers?: TypeModifier);
visitType(visitor: TypeVisitor, context: any): any;
}
export declare enum BuiltinTypeName {
Dynamic = 0,
Bool = 1,
String = 2,
Int = 3,
Number = 4,
Function = 5,
Inferred = 6,
None = 7
}
export declare class Call extends AST {
receiver: AST;
args: AST[];
argumentSpan: AbsoluteSourceSpan;
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, receiver: AST, args: AST[], argumentSpan: AbsoluteSourceSpan);
visit(visitor: AstVisitor, context?: any): any;
}
/**
* Multiple expressions separated by a semicolon.
*/
export declare class Chain extends AST {
expressions: any[];
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expressions: any[]);
visit(visitor: AstVisitor, context?: any): any;
}
export declare enum ChangeDetectionStrategy {
OnPush = 0,
Default = 1
}
declare class CloneVisitor implements Visitor_2 {
visitText(text: Text_3, context?: any): Text_3;
visitContainer(container: Container, context?: any): Container;
visitIcu(icu: Icu, context?: any): Icu;
visitTagPlaceholder(ph: TagPlaceholder, context?: any): TagPlaceholder;
visitPlaceholder(ph: Placeholder, context?: any): Placeholder;
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): IcuPlaceholder;
visitBlockPlaceholder(ph: BlockPlaceholder, context?: any): BlockPlaceholder;
}
export declare class CommaExpr extends Expression {
parts: Expression[];
constructor(parts: Expression[], sourceSpan?: ParseSourceSpan | null);
isEquivalent(e: Expression): boolean;
isConstant(): boolean;
visitExpression(visitor: ExpressionVisitor, context: any): any;
clone(): CommaExpr;
}
declare class Comment_2 implements BaseNode {
value: string | null;
sourceSpan: ParseSourceSpan;
constructor(value: string | null, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
}
export { Comment_2 as Comment }
/**
* This is an R3 `Node`-like wrapper for a raw `html.Comment` node. We do not currently
* require the implementation of a visitor for Comments as they are only collected at
* the top-level of the R3 AST, and only if `Render3ParseOptions['collectCommentNodes']`
* is true.
*/
declare class Comment_3 implements TmplAstNode {
value: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, sourceSpan: ParseSourceSpan);
visit<Result>(_visitor: TmplAstVisitor<Result>): Result;
}
/**
* Generate an ngDevMode guarded call to setClassDebugInfo with the debug info about the class
* (e.g., the file name in which the class is defined)
*/
export declare function compileClassDebugInfo(debugInfo: R3ClassDebugInfo): outputAst.Expression;
export declare function compileClassMetadata(metadata: R3ClassMetadata): outputAst.InvokeFunctionExpr;
export declare type CompileClassMetadataFn = (metadata: R3ClassMetadata) => outputAst.Expression;
/**
* Wraps the `setClassMetadata` function with extra logic that dynamically
* loads dependencies from `@defer` blocks.
*
* Generates a call like this:
* ```
* setClassMetadataAsync(type, () => [
* import('./cmp-a').then(m => m.CmpA);
* import('./cmp-b').then(m => m.CmpB);
* ], (CmpA, CmpB) => {
* setClassMetadata(type, decorators, ctorParameters, propParameters);
* });
* ```
*
* Similar to the `setClassMetadata` call, it's wrapped into the `ngDevMode`
* check to tree-shake away this code in production mode.
*/
export declare function compileComponentClassMetadata(metadata: R3ClassMetadata, dependencies: R3DeferPerComponentDependency[] | null): outputAst.Expression;
export declare function compileComponentDeclareClassMetadata(metadata: R3ClassMetadata, dependencies: R3DeferPerComponentDependency[] | null): outputAst.Expression;
/**
* Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
*/
export declare function compileComponentFromMetadata(meta: R3ComponentMetadata<R3TemplateDependency>, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
export declare function compileDeclareClassMetadata(metadata: R3ClassMetadata): outputAst.Expression;
/**
* Compile a component declaration defined by the `R3ComponentMetadata`.
*/
export declare function compileDeclareComponentFromMetadata(meta: R3ComponentMetadata<R3TemplateDependencyMetadata>, template: ParsedTemplate, additionalTemplateInfo: DeclareComponentTemplateInfo): R3CompiledExpression;
/**
* Compile a directive declaration defined by the `R3DirectiveMetadata`.
*/
export declare function compileDeclareDirectiveFromMetadata(meta: R3DirectiveMetadata): R3CompiledExpression;
export declare function compileDeclareFactoryFunction(meta: R3FactoryMetadata): R3CompiledExpression;
/**
* Compile a Injectable declaration defined by the `R3InjectableMetadata`.
*/
export declare function compileDeclareInjectableFromMetadata(meta: R3InjectableMetadata): R3CompiledExpression;
export declare function compileDeclareInjectorFromMetadata(meta: R3InjectorMetadata): R3CompiledExpression;
export declare function compileDeclareNgModuleFromMetadata(meta: R3NgModuleMetadata): R3CompiledExpression;
/**
* Compile a Pipe declaration defined by the `R3PipeMetadata`.
*/
export declare function compileDeclarePipeFromMetadata(meta: R3PipeMetadata): R3CompiledExpression;
/**
* Compiles the dependency resolver function for a defer block.
*/
export declare function compileDeferResolverFunction(meta: R3DeferResolverFunctionMetadata): outputAst.ArrowFunctionExpr;
/**
* Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
*/
export declare function compileDirectiveFromMetadata(meta: R3DirectiveMetadata, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
/**
* Construct a factory function expression for the given `R3FactoryMetadata`.
*/
export declare function compileFactoryFunction(meta: R3FactoryMetadata): R3CompiledExpression;
/**
* Compiles the expression that initializes HMR for a class.
* @param meta HMR metadata extracted from the class.
*/
export declare function compileHmrInitializer(meta: R3HmrMetadata): outputAst.Expression;
/**
* Compiles the HMR update callback for a class.
* @param definitions Compiled definitions for the class (e.g. `defineComponent` calls).
* @param constantStatements Supporting constants statements that were generated alongside
* the definition.
* @param meta HMR metadata extracted from the class.
*/
export declare function compileHmrUpdateCallback(definitions: {
name: string;
initializer: outputAst.Expression | null;
statements: outputAst.Statement[];
}[], constantStatements: outputAst.Statement[], meta: R3HmrMetadata): outputAst.DeclareFunctionStmt;
export declare interface CompileIdentifierMetadata {
reference: any;
}
export declare function compileInjectable(meta: R3InjectableMetadata, resolveForwardRefs: boolean): R3CompiledExpression;
export declare function compileInjector(meta: R3InjectorMetadata): R3CompiledExpression;
/**
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
*/
export declare function compileNgModule(meta: R3NgModuleMetadata): R3CompiledExpression;
/**
* Identical to `compileComponentClassMetadata`. Used for the cases where we're unable to
* analyze the deferred block dependencies, but we have a reference to the compiled
* dependency resolver function that we can use as is.
* @param metadata Class metadata for the internal `setClassMetadata` call.
* @param deferResolver Expression representing the deferred dependency loading function.
* @param deferredDependencyNames Names of the dependencies that are being loaded asynchronously.
*/
export declare function compileOpaqueAsyncClassMetadata(metadata: R3ClassMetadata, deferResolver: outputAst.Expression, deferredDependencyNames: string[]): outputAst.Expression;
export declare function compilePipeFromMetadata(metadata: R3PipeMetadata): R3CompiledExpression;
export declare class CompilerConfig {
defaultEncapsulation: ViewEncapsulation | null;
preserveWhitespaces: boolean;
strictInjectionParameters: boolean;
constructor({ defaultEncapsulation, preserveWhitespaces, strictInjectionParameters, }?: {
defaultEncapsulation?: ViewEncapsulation;
preserveWhitespaces?: boolean;
strictInjectionParameters?: boolean;
});
}
export declare function computeMsgId(msg: string, meaning?: string): string;
export declare class Conditional extends AST {
condition: AST;
trueExp: AST;
falseExp: AST;
constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, condition: AST, trueExp: AST, falseExp: AST);
visit(visitor: AstVisitor, context?: any): any;
}
export declare class ConditionalExpr extends Expression {
condition: Expression;
falseCase: Expression | null;
trueCase: Expression;
constructor(condition: Expression, trueCase: Expression, falseCase?: Expression | null, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
isEquivalent(e: Expression): boolean;
isConstant(): boolean;
visitExpression(visitor: ExpressionVisitor, context: any): any;
clone(): ConditionalExpr;
}
declare interface Console_2 {
log(message: string): void;
warn(message: string): void;
}
/**
* A constant pool allows a code emitter to share constant in an output context.
*
* The constant pool also supports sharing access to ivy definitions references.
*/
export declare class ConstantPool {
private readonly isClosureCompilerEnabled;
statements: outputAst.Statement[];
private literals;
private literalFactories;
private sharedConstants;
/**
* Constant pool also tracks claimed names from {@link uniqueName}.
* This is useful to avoid collisions if variables are intended to be
* named a certain way- but may conflict. We wouldn't want to always suffix
* them with unique numbers.
*/
private _claimedNames;
private nextNameIndex;
constructor(isClosureCompilerEnabled?: boolean);
getConstLiteral(literal: outputAst.Expression, forceShared?: boolean): outputAst.Expression;
getSharedConstant(def: SharedConstantDefinition, expr: outputAst.Expression): outputAst.Expression;
getLiteralFactory(literal: outputAst.LiteralArrayExpr | outputAst.LiteralMapExpr): {
literalFactory: outputAst.Expression;
literalFactoryArguments: outputAst.Expression[];
};
getSharedFunctionReference(fn: outputAst.Expression, prefix: string, useUniqueName?: boolean): outputAst.Expression;
private _getLiteralFactory;
/**
* Produce a unique name in the context of this pool.
*
* The name might be unique among different prefixes if any of the prefixes end in
* a digit so the prefix should be a constant string (not based on user input) and
* must not end in a digit.
*/
uniqueName(name: string, alwaysIncludeSuffix?: boolean): string;
private freshName;
}
declare class Container implements Node_3 {
children: Node_3[];
sourceSpan: ParseSourceSpan;
constructor(children: Node_3[], sourceSpan: ParseSourceSpan);
visit(visitor: Visitor_2, context?: any): any;
}
/**
* A structure to hold the cooked and raw strings of a template literal element, along with its
* source-span range.
*/
declare interface CookedRawString {
cooked: string;
raw: string;
range: ParseSourceSpan | null;
}
declare namespace core {
export {
parseSelectorToR3Selector,
emitDistinctChangesOnlyDefaultValue,
ViewEncapsulation,
ChangeDetectionStrategy,
Input,
InputFlags,
Output,
HostBinding,
HostListener,
SchemaMetadata,
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA,
Type_2 as Type,
SecurityContext,
InjectFlags,
MissingTranslationStrategy,
SelectorFlags,
R3CssSelector,
R3CssSelectorList,
RenderFlags,
AttributeMarker
}
}
export { core }
/**
* Creates a `CssSelector` from an AST node.
*/
export declare function createCssSelectorFromNode(node: t.Element | t.Template): CssSelector;
export declare function createInjectableType(meta: R3InjectableMetadata): outputAst.ExpressionType;
export declare function createMayBeForwardRefExpression<T extends outputAst.Expression>(expression: T, forwardRef: ForwardRefHandling): MaybeForwardRefExpression<T>;
/**
* A css selector contains an element name,
* css classes and attribute/value pairs with the purpose
* of selecting subsets out of them.
*/
export declare class CssSelector {
element: string | null;
classNames: string[];
/**
* The selectors are encoded in pairs where:
* - even locations are attribute names
* - odd locations are attribute values.
*
* Example:
* Selector: `[key1=value1][key2]` would parse to:
* ```
* ['key1', 'value1', 'key2', '']
* ```
*/
attrs: string[];
notSelectors: CssSelector[];
static parse(selector: string): CssSelector[];
/**
* Unescape `\$` sequences from the CSS attribute selector.
*
* This is needed because `$` can have a special meaning in CSS selectors,
* but we might want to match an attribute that contains `$`.
* [MDN web link for more
* info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).
* @param attr the attribute to unescape.
* @returns the unescaped string.
*/
unescapeAttribute(attr: string): string;
/**
* Escape `$` sequences from the CSS attribute selector.
*
* This is needed because `$` can have a special meaning in CSS selectors,
* with this method we are escaping `$` with `\$'.
* [MDN web link for more
* info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).
* @param attr the attribute to escape.
* @returns the escaped string.
*/
escapeAttribute(attr: string): string;
isElementSelector(): boolean;
hasElementSelector(): boolean;
setElement(element?: string | null): void;
getAttrs(): string[];
addAttribute(name: string, value?: string): void;
addClassName(name: string): void;
toString(): string;
}
export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata;
/**
* Specifies how a list of declaration type references should be emitted into the generated code.
*/
export declare const enum DeclarationListEmitMode {
/**
* The list of declarations is emitted into the generated code as is.
*
* ```
* directives: [MyDir],
* ```
*/
Direct = 0,
/**
* The list of declarations is emitted into the generated code wrapped inside a closure, which
* is needed when at least one declaration is a forward reference.
*
* ```
* directives: function () { return [MyDir, ForwardDir]; },
* ```
*/
Closure = 1,
/**
* Similar to `Closure`, with the addition that the list of declarations can contain individual
* items that are themselves forward references. This is relevant for JIT compilations, as
* unwrapping the forwardRef cannot be done statically so must be deferred. This mode emits
* the declaration list using a mapping transform through `resolveForwardRef` to ensure that
* any forward references within the list are resolved when the outer closure is invoked.