@angular/compiler 20.1.0-next.3 → 20.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/fesm2022/compiler.mjs +108 -80
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +14 -14
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.1.0
|
|
2
|
+
* @license Angular v20.1.0
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -4536,7 +4536,7 @@ class ParsedProperty {
|
|
|
4536
4536
|
keySpan;
|
|
4537
4537
|
valueSpan;
|
|
4538
4538
|
isLiteral;
|
|
4539
|
-
|
|
4539
|
+
isLegacyAnimation;
|
|
4540
4540
|
constructor(name, expression, type, sourceSpan, keySpan, valueSpan) {
|
|
4541
4541
|
this.name = name;
|
|
4542
4542
|
this.expression = expression;
|
|
@@ -4545,22 +4545,22 @@ class ParsedProperty {
|
|
|
4545
4545
|
this.keySpan = keySpan;
|
|
4546
4546
|
this.valueSpan = valueSpan;
|
|
4547
4547
|
this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR;
|
|
4548
|
-
this.
|
|
4548
|
+
this.isLegacyAnimation = this.type === ParsedPropertyType.LEGACY_ANIMATION;
|
|
4549
4549
|
}
|
|
4550
4550
|
}
|
|
4551
4551
|
var ParsedPropertyType;
|
|
4552
4552
|
(function (ParsedPropertyType) {
|
|
4553
4553
|
ParsedPropertyType[ParsedPropertyType["DEFAULT"] = 0] = "DEFAULT";
|
|
4554
4554
|
ParsedPropertyType[ParsedPropertyType["LITERAL_ATTR"] = 1] = "LITERAL_ATTR";
|
|
4555
|
-
ParsedPropertyType[ParsedPropertyType["
|
|
4555
|
+
ParsedPropertyType[ParsedPropertyType["LEGACY_ANIMATION"] = 2] = "LEGACY_ANIMATION";
|
|
4556
4556
|
ParsedPropertyType[ParsedPropertyType["TWO_WAY"] = 3] = "TWO_WAY";
|
|
4557
4557
|
})(ParsedPropertyType || (ParsedPropertyType = {}));
|
|
4558
4558
|
var ParsedEventType;
|
|
4559
4559
|
(function (ParsedEventType) {
|
|
4560
4560
|
// DOM or Directive event
|
|
4561
4561
|
ParsedEventType[ParsedEventType["Regular"] = 0] = "Regular";
|
|
4562
|
-
//
|
|
4563
|
-
ParsedEventType[ParsedEventType["
|
|
4562
|
+
// Legacy animation specific event
|
|
4563
|
+
ParsedEventType[ParsedEventType["LegacyAnimation"] = 1] = "LegacyAnimation";
|
|
4564
4564
|
// Event side of a two-way binding (e.g. `[(property)]="expression"`).
|
|
4565
4565
|
ParsedEventType[ParsedEventType["TwoWay"] = 2] = "TwoWay";
|
|
4566
4566
|
})(ParsedEventType || (ParsedEventType = {}));
|
|
@@ -4609,8 +4609,8 @@ var BindingType;
|
|
|
4609
4609
|
BindingType[BindingType["Class"] = 2] = "Class";
|
|
4610
4610
|
// A binding to a style rule (e.g. `[style.rule]="expression"`).
|
|
4611
4611
|
BindingType[BindingType["Style"] = 3] = "Style";
|
|
4612
|
-
// A binding to
|
|
4613
|
-
BindingType[BindingType["
|
|
4612
|
+
// A binding to a legacy animation reference (e.g. `[animate.key]="expression"`).
|
|
4613
|
+
BindingType[BindingType["LegacyAnimation"] = 4] = "LegacyAnimation";
|
|
4614
4614
|
// Property side of a two-way binding (e.g. `[(property)]="expression"`).
|
|
4615
4615
|
BindingType[BindingType["TwoWay"] = 5] = "TwoWay";
|
|
4616
4616
|
})(BindingType || (BindingType = {}));
|
|
@@ -4793,7 +4793,7 @@ class BoundEvent {
|
|
|
4793
4793
|
}
|
|
4794
4794
|
static fromParsedEvent(event) {
|
|
4795
4795
|
const target = event.type === ParsedEventType.Regular ? event.targetOrPhase : null;
|
|
4796
|
-
const phase = event.type === ParsedEventType.
|
|
4796
|
+
const phase = event.type === ParsedEventType.LegacyAnimation ? event.targetOrPhase : null;
|
|
4797
4797
|
if (event.keySpan === undefined) {
|
|
4798
4798
|
throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);
|
|
4799
4799
|
}
|
|
@@ -6625,7 +6625,7 @@ var ParseErrorLevel;
|
|
|
6625
6625
|
ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
|
|
6626
6626
|
ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
|
|
6627
6627
|
})(ParseErrorLevel || (ParseErrorLevel = {}));
|
|
6628
|
-
class ParseError {
|
|
6628
|
+
class ParseError extends Error {
|
|
6629
6629
|
span;
|
|
6630
6630
|
msg;
|
|
6631
6631
|
level;
|
|
@@ -6642,10 +6642,15 @@ class ParseError {
|
|
|
6642
6642
|
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
|
|
6643
6643
|
*/
|
|
6644
6644
|
relatedError) {
|
|
6645
|
+
super(msg);
|
|
6645
6646
|
this.span = span;
|
|
6646
6647
|
this.msg = msg;
|
|
6647
6648
|
this.level = level;
|
|
6648
6649
|
this.relatedError = relatedError;
|
|
6650
|
+
// Extending `Error` ends up breaking some internal tests. This appears to be a known issue
|
|
6651
|
+
// when extending errors in TS and the workaround is to explicitly set the prototype.
|
|
6652
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
6653
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
6649
6654
|
}
|
|
6650
6655
|
contextualMessage() {
|
|
6651
6656
|
const ctx = this.span.start.getContext(100, 3);
|
|
@@ -8919,9 +8924,9 @@ var BindingKind;
|
|
|
8919
8924
|
*/
|
|
8920
8925
|
BindingKind[BindingKind["I18n"] = 5] = "I18n";
|
|
8921
8926
|
/**
|
|
8922
|
-
*
|
|
8927
|
+
* Legacy animation property bindings.
|
|
8923
8928
|
*/
|
|
8924
|
-
BindingKind[BindingKind["
|
|
8929
|
+
BindingKind[BindingKind["LegacyAnimation"] = 6] = "LegacyAnimation";
|
|
8925
8930
|
/**
|
|
8926
8931
|
* Property side of a two-way binding.
|
|
8927
8932
|
*/
|
|
@@ -9166,13 +9171,13 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
|
|
|
9166
9171
|
/**
|
|
9167
9172
|
* Create a `PropertyOp`.
|
|
9168
9173
|
*/
|
|
9169
|
-
function createPropertyOp(target, name, expression,
|
|
9174
|
+
function createPropertyOp(target, name, expression, isLegacyAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
|
|
9170
9175
|
return {
|
|
9171
9176
|
kind: OpKind.Property,
|
|
9172
9177
|
target,
|
|
9173
9178
|
name,
|
|
9174
9179
|
expression,
|
|
9175
|
-
|
|
9180
|
+
isLegacyAnimationTrigger,
|
|
9176
9181
|
securityContext,
|
|
9177
9182
|
sanitizer: null,
|
|
9178
9183
|
isStructuralTemplateAttribute,
|
|
@@ -10571,7 +10576,7 @@ class OpList {
|
|
|
10571
10576
|
oldOp.next = null;
|
|
10572
10577
|
let prev = oldPrev;
|
|
10573
10578
|
for (const newOp of newOps) {
|
|
10574
|
-
|
|
10579
|
+
OpList.assertIsUnowned(newOp);
|
|
10575
10580
|
newOp.debugListId = listId;
|
|
10576
10581
|
prev.next = newOp;
|
|
10577
10582
|
newOp.prev = prev;
|
|
@@ -10612,7 +10617,7 @@ class OpList {
|
|
|
10612
10617
|
static insertBefore(op, target) {
|
|
10613
10618
|
if (Array.isArray(op)) {
|
|
10614
10619
|
for (const o of op) {
|
|
10615
|
-
|
|
10620
|
+
OpList.insertBefore(o, target);
|
|
10616
10621
|
}
|
|
10617
10622
|
return;
|
|
10618
10623
|
}
|
|
@@ -10859,7 +10864,7 @@ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
|
10859
10864
|
/**
|
|
10860
10865
|
* Create a `ListenerOp`. Host bindings reuse all the listener logic.
|
|
10861
10866
|
*/
|
|
10862
|
-
function createListenerOp(target, targetSlot, name, tag, handlerOps,
|
|
10867
|
+
function createListenerOp(target, targetSlot, name, tag, handlerOps, legacyAnimationPhase, eventTarget, hostListener, sourceSpan) {
|
|
10863
10868
|
const handlerList = new OpList();
|
|
10864
10869
|
handlerList.push(handlerOps);
|
|
10865
10870
|
return {
|
|
@@ -10872,8 +10877,8 @@ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPh
|
|
|
10872
10877
|
handlerOps: handlerList,
|
|
10873
10878
|
handlerFnName: null,
|
|
10874
10879
|
consumesDollarEvent: false,
|
|
10875
|
-
|
|
10876
|
-
|
|
10880
|
+
isLegacyAnimationListener: legacyAnimationPhase !== null,
|
|
10881
|
+
legacyAnimationPhase: legacyAnimationPhase,
|
|
10877
10882
|
eventTarget,
|
|
10878
10883
|
sourceSpan,
|
|
10879
10884
|
...NEW_OP,
|
|
@@ -11128,12 +11133,12 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
11128
11133
|
};
|
|
11129
11134
|
}
|
|
11130
11135
|
|
|
11131
|
-
function createDomPropertyOp(name, expression,
|
|
11136
|
+
function createDomPropertyOp(name, expression, isLegacyAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
11132
11137
|
return {
|
|
11133
11138
|
kind: OpKind.DomProperty,
|
|
11134
11139
|
name,
|
|
11135
11140
|
expression,
|
|
11136
|
-
|
|
11141
|
+
isLegacyAnimationTrigger,
|
|
11137
11142
|
i18nContext,
|
|
11138
11143
|
securityContext,
|
|
11139
11144
|
sanitizer: null,
|
|
@@ -11580,7 +11585,7 @@ function extractAttributes(job) {
|
|
|
11580
11585
|
extractAttributeOp(unit, op, elements);
|
|
11581
11586
|
break;
|
|
11582
11587
|
case OpKind.Property:
|
|
11583
|
-
if (!op.
|
|
11588
|
+
if (!op.isLegacyAnimationTrigger) {
|
|
11584
11589
|
let bindingKind;
|
|
11585
11590
|
if (op.i18nMessage !== null && op.templateKind === null) {
|
|
11586
11591
|
// If the binding has an i18n context, it is an i18n attribute, and should have that
|
|
@@ -11622,7 +11627,7 @@ function extractAttributes(job) {
|
|
|
11622
11627
|
}
|
|
11623
11628
|
break;
|
|
11624
11629
|
case OpKind.Listener:
|
|
11625
|
-
if (!op.
|
|
11630
|
+
if (!op.isLegacyAnimationListener) {
|
|
11626
11631
|
const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name,
|
|
11627
11632
|
/* expression */ null,
|
|
11628
11633
|
/* i18nContext */ null,
|
|
@@ -11732,12 +11737,12 @@ function specializeBindings(job) {
|
|
|
11732
11737
|
}
|
|
11733
11738
|
break;
|
|
11734
11739
|
case BindingKind.Property:
|
|
11735
|
-
case BindingKind.
|
|
11740
|
+
case BindingKind.LegacyAnimation:
|
|
11736
11741
|
if (job.kind === CompilationJobKind.Host) {
|
|
11737
|
-
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.
|
|
11742
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.LegacyAnimation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11738
11743
|
}
|
|
11739
11744
|
else {
|
|
11740
|
-
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.
|
|
11745
|
+
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.LegacyAnimation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
11741
11746
|
}
|
|
11742
11747
|
break;
|
|
11743
11748
|
case BindingKind.TwoWayProperty:
|
|
@@ -17102,12 +17107,16 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
17102
17107
|
}
|
|
17103
17108
|
}
|
|
17104
17109
|
}
|
|
17105
|
-
class CursorError {
|
|
17110
|
+
class CursorError extends Error {
|
|
17106
17111
|
msg;
|
|
17107
17112
|
cursor;
|
|
17108
17113
|
constructor(msg, cursor) {
|
|
17114
|
+
super(msg);
|
|
17109
17115
|
this.msg = msg;
|
|
17110
17116
|
this.cursor = cursor;
|
|
17117
|
+
// Extending `Error` does not always work when code is transpiled. See:
|
|
17118
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
17119
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
17111
17120
|
}
|
|
17112
17121
|
}
|
|
17113
17122
|
|
|
@@ -18094,9 +18103,11 @@ class Token {
|
|
|
18094
18103
|
return this.type === TokenType.Number ? this.numValue : -1;
|
|
18095
18104
|
}
|
|
18096
18105
|
isTemplateLiteralPart() {
|
|
18106
|
+
// Note: Explicit type is needed for Closure.
|
|
18097
18107
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
|
|
18098
18108
|
}
|
|
18099
18109
|
isTemplateLiteralEnd() {
|
|
18110
|
+
// Note: Explicit type is needed for Closure.
|
|
18100
18111
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
|
|
18101
18112
|
}
|
|
18102
18113
|
isTemplateLiteralInterpolationStart() {
|
|
@@ -18642,10 +18653,14 @@ class Parser {
|
|
|
18642
18653
|
return null;
|
|
18643
18654
|
const expressionNodes = [];
|
|
18644
18655
|
for (let i = 0; i < expressions.length; ++i) {
|
|
18656
|
+
// If we have a token for the specific expression, it's preferrable to use it because it
|
|
18657
|
+
// allows us to produce more accurate error messages. The expressions are always at the odd
|
|
18658
|
+
// indexes inside the tokens.
|
|
18659
|
+
const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
|
|
18645
18660
|
const expressionText = expressions[i].text;
|
|
18646
18661
|
const sourceToLex = this._stripComments(expressionText);
|
|
18647
18662
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18648
|
-
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18663
|
+
const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18649
18664
|
expressionNodes.push(ast);
|
|
18650
18665
|
}
|
|
18651
18666
|
return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
@@ -22321,7 +22336,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22321
22336
|
switch (op.kind) {
|
|
22322
22337
|
case OpKind.Property:
|
|
22323
22338
|
case OpKind.DomProperty:
|
|
22324
|
-
if (op.
|
|
22339
|
+
if (op.isLegacyAnimationTrigger) {
|
|
22325
22340
|
op.name = '@' + op.name;
|
|
22326
22341
|
}
|
|
22327
22342
|
break;
|
|
@@ -22333,8 +22348,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22333
22348
|
throw new Error(`Expected a slot to be assigned`);
|
|
22334
22349
|
}
|
|
22335
22350
|
let animation = '';
|
|
22336
|
-
if (op.
|
|
22337
|
-
op.name = `@${op.name}.${op.
|
|
22351
|
+
if (op.isLegacyAnimationListener) {
|
|
22352
|
+
op.name = `@${op.name}.${op.legacyAnimationPhase}`;
|
|
22338
22353
|
animation = 'animation';
|
|
22339
22354
|
}
|
|
22340
22355
|
if (op.hostListener) {
|
|
@@ -22602,7 +22617,7 @@ function kindWithInterpolationTest(kind, interpolation) {
|
|
|
22602
22617
|
};
|
|
22603
22618
|
}
|
|
22604
22619
|
function basicListenerKindTest(op) {
|
|
22605
|
-
return ((op.kind === OpKind.Listener && !(op.hostListener && op.
|
|
22620
|
+
return ((op.kind === OpKind.Listener && !(op.hostListener && op.isLegacyAnimationListener)) ||
|
|
22606
22621
|
op.kind === OpKind.TwoWayListener);
|
|
22607
22622
|
}
|
|
22608
22623
|
function nonInterpolationPropertyKindTest(op) {
|
|
@@ -22615,7 +22630,7 @@ function nonInterpolationPropertyKindTest(op) {
|
|
|
22615
22630
|
* the groups in the order defined here.
|
|
22616
22631
|
*/
|
|
22617
22632
|
const CREATE_ORDERING = [
|
|
22618
|
-
{ test: (op) => op.kind === OpKind.Listener && op.hostListener && op.
|
|
22633
|
+
{ test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isLegacyAnimationListener },
|
|
22619
22634
|
{ test: basicListenerKindTest },
|
|
22620
22635
|
];
|
|
22621
22636
|
/**
|
|
@@ -23602,6 +23617,18 @@ const GLOBAL_TARGET_RESOLVERS = new Map([
|
|
|
23602
23617
|
['document', Identifiers.resolveDocument],
|
|
23603
23618
|
['body', Identifiers.resolveBody],
|
|
23604
23619
|
]);
|
|
23620
|
+
/**
|
|
23621
|
+
* DOM properties that need to be remapped on the compiler side.
|
|
23622
|
+
* Note: this mapping has to be kept in sync with the equally named mapping in the runtime.
|
|
23623
|
+
*/
|
|
23624
|
+
const DOM_PROPERTY_REMAPPING = new Map([
|
|
23625
|
+
['class', 'className'],
|
|
23626
|
+
['for', 'htmlFor'],
|
|
23627
|
+
['formaction', 'formAction'],
|
|
23628
|
+
['innerHtml', 'innerHTML'],
|
|
23629
|
+
['readonly', 'readOnly'],
|
|
23630
|
+
['tabindex', 'tabIndex'],
|
|
23631
|
+
]);
|
|
23605
23632
|
/**
|
|
23606
23633
|
* Compiles semantic operations across all views and generates output `o.Statement`s with actual
|
|
23607
23634
|
* runtime calls in their place.
|
|
@@ -23705,9 +23732,9 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23705
23732
|
}
|
|
23706
23733
|
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly &&
|
|
23707
23734
|
!op.hostListener &&
|
|
23708
|
-
!op.
|
|
23735
|
+
!op.isLegacyAnimationListener
|
|
23709
23736
|
? domListener(op.name, listenerFn, eventTargetResolver, op.sourceSpan)
|
|
23710
|
-
: listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.
|
|
23737
|
+
: listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isLegacyAnimationListener, op.sourceSpan));
|
|
23711
23738
|
break;
|
|
23712
23739
|
case OpKind.TwoWayListener:
|
|
23713
23740
|
OpList.replace(op, twoWayListener(op.name, reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, true), op.sourceSpan));
|
|
@@ -23873,8 +23900,8 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23873
23900
|
OpList.replace(op, advance(op.delta, op.sourceSpan));
|
|
23874
23901
|
break;
|
|
23875
23902
|
case OpKind.Property:
|
|
23876
|
-
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.
|
|
23877
|
-
? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23903
|
+
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
|
|
23904
|
+
? domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23878
23905
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23879
23906
|
break;
|
|
23880
23907
|
case OpKind.TwoWayProperty:
|
|
@@ -23909,11 +23936,11 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23909
23936
|
throw new Error('not yet handled');
|
|
23910
23937
|
}
|
|
23911
23938
|
else {
|
|
23912
|
-
if (op.
|
|
23939
|
+
if (op.isLegacyAnimationTrigger) {
|
|
23913
23940
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23914
23941
|
}
|
|
23915
23942
|
else {
|
|
23916
|
-
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23943
|
+
OpList.replace(op, domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23917
23944
|
}
|
|
23918
23945
|
}
|
|
23919
23946
|
break;
|
|
@@ -26131,8 +26158,8 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
26131
26158
|
property.name = property.name.substring('attr.'.length);
|
|
26132
26159
|
bindingKind = BindingKind.Attribute;
|
|
26133
26160
|
}
|
|
26134
|
-
if (property.
|
|
26135
|
-
bindingKind = BindingKind.
|
|
26161
|
+
if (property.isLegacyAnimation) {
|
|
26162
|
+
bindingKind = BindingKind.LegacyAnimation;
|
|
26136
26163
|
}
|
|
26137
26164
|
const securityContexts = bindingParser
|
|
26138
26165
|
.calcPossibleSecurityContexts(input.componentSelector, property.name, bindingKind === BindingKind.Attribute)
|
|
@@ -26174,7 +26201,7 @@ function ingestHostAttribute(job, name, value, securityContexts) {
|
|
|
26174
26201
|
job.root.update.push(attrBinding);
|
|
26175
26202
|
}
|
|
26176
26203
|
function ingestHostEvent(job, event) {
|
|
26177
|
-
const [phase, target] = event.type !== ParsedEventType.
|
|
26204
|
+
const [phase, target] = event.type !== ParsedEventType.LegacyAnimation
|
|
26178
26205
|
? [null, event.targetOrPhase]
|
|
26179
26206
|
: [event.targetOrPhase, null];
|
|
26180
26207
|
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
|
|
@@ -26799,7 +26826,7 @@ const BINDING_KINDS = new Map([
|
|
|
26799
26826
|
[BindingType.Attribute, BindingKind.Attribute],
|
|
26800
26827
|
[BindingType.Class, BindingKind.ClassName],
|
|
26801
26828
|
[BindingType.Style, BindingKind.StyleProperty],
|
|
26802
|
-
[BindingType.
|
|
26829
|
+
[BindingType.LegacyAnimation, BindingKind.LegacyAnimation],
|
|
26803
26830
|
]);
|
|
26804
26831
|
/**
|
|
26805
26832
|
* Checks whether the given template is a plain ng-template (as opposed to another kind of template
|
|
@@ -26858,7 +26885,7 @@ function ingestElementBindings(unit, op, element) {
|
|
|
26858
26885
|
unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
|
|
26859
26886
|
unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
|
|
26860
26887
|
for (const output of element.outputs) {
|
|
26861
|
-
if (output.type === ParsedEventType.
|
|
26888
|
+
if (output.type === ParsedEventType.LegacyAnimation && output.phase === null) {
|
|
26862
26889
|
throw Error('Animation listener should have a phase');
|
|
26863
26890
|
}
|
|
26864
26891
|
if (output.type === ParsedEventType.TwoWay) {
|
|
@@ -26901,7 +26928,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
|
|
|
26901
26928
|
unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
|
|
26902
26929
|
unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
|
|
26903
26930
|
for (const output of template.outputs) {
|
|
26904
|
-
if (output.type === ParsedEventType.
|
|
26931
|
+
if (output.type === ParsedEventType.LegacyAnimation && output.phase === null) {
|
|
26905
26932
|
throw Error('Animation listener should have a phase');
|
|
26906
26933
|
}
|
|
26907
26934
|
if (templateKind === TemplateKind.NgTemplate) {
|
|
@@ -26913,7 +26940,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
|
|
|
26913
26940
|
}
|
|
26914
26941
|
}
|
|
26915
26942
|
if (templateKind === TemplateKind.Structural &&
|
|
26916
|
-
output.type !== ParsedEventType.
|
|
26943
|
+
output.type !== ParsedEventType.LegacyAnimation) {
|
|
26917
26944
|
// Animation bindings are excluded from the structural template's const array.
|
|
26918
26945
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
|
|
26919
26946
|
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
|
|
@@ -26971,7 +26998,8 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
26971
26998
|
return createExtractedAttributeOp(xref, BindingKind.TwoWayProperty, null, name, null, null, i18nMessage, securityContext);
|
|
26972
26999
|
}
|
|
26973
27000
|
}
|
|
26974
|
-
if (!isTextBinding &&
|
|
27001
|
+
if (!isTextBinding &&
|
|
27002
|
+
(type === BindingType.Attribute || type === BindingType.LegacyAnimation)) {
|
|
26975
27003
|
// Again, this binding doesn't really target the ng-template; it actually targets the element
|
|
26976
27004
|
// inside the structural template. In the case of non-text attribute or animation bindings,
|
|
26977
27005
|
// the binding doesn't even show up on the ng-template const array, so we just skip it
|
|
@@ -27136,7 +27164,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
27136
27164
|
// Note that TDB used to collect the outputs as well, but it wasn't passing them into
|
|
27137
27165
|
// the template instruction. Here we just don't collect them.
|
|
27138
27166
|
for (const attr of root.inputs) {
|
|
27139
|
-
if (attr.type !== BindingType.
|
|
27167
|
+
if (attr.type !== BindingType.LegacyAnimation && attr.type !== BindingType.Attribute) {
|
|
27140
27168
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
27141
27169
|
unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
|
|
27142
27170
|
}
|
|
@@ -27357,7 +27385,7 @@ const ATTRIBUTE_PREFIX = 'attr';
|
|
|
27357
27385
|
const CLASS_PREFIX = 'class';
|
|
27358
27386
|
const STYLE_PREFIX = 'style';
|
|
27359
27387
|
const TEMPLATE_ATTR_PREFIX$1 = '*';
|
|
27360
|
-
const
|
|
27388
|
+
const LEGACY_ANIMATE_PROP_PREFIX = 'animate-';
|
|
27361
27389
|
/**
|
|
27362
27390
|
* Parses bindings in templates and in the directive host area.
|
|
27363
27391
|
*/
|
|
@@ -27516,7 +27544,7 @@ class BindingParser {
|
|
|
27516
27544
|
}
|
|
27517
27545
|
}
|
|
27518
27546
|
parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
|
|
27519
|
-
if (
|
|
27547
|
+
if (isLegacyAnimationLabel(name)) {
|
|
27520
27548
|
name = name.substring(1);
|
|
27521
27549
|
if (keySpan !== undefined) {
|
|
27522
27550
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
@@ -27525,7 +27553,7 @@ class BindingParser {
|
|
|
27525
27553
|
this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid.` +
|
|
27526
27554
|
` Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR);
|
|
27527
27555
|
}
|
|
27528
|
-
this.
|
|
27556
|
+
this._parseLegacyAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27529
27557
|
}
|
|
27530
27558
|
else {
|
|
27531
27559
|
targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, '', absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
|
|
@@ -27535,23 +27563,23 @@ class BindingParser {
|
|
|
27535
27563
|
if (name.length === 0) {
|
|
27536
27564
|
this._reportError(`Property name is missing in binding`, sourceSpan);
|
|
27537
27565
|
}
|
|
27538
|
-
let
|
|
27539
|
-
if (name.startsWith(
|
|
27540
|
-
|
|
27541
|
-
name = name.substring(
|
|
27566
|
+
let isLegacyAnimationProp = false;
|
|
27567
|
+
if (name.startsWith(LEGACY_ANIMATE_PROP_PREFIX)) {
|
|
27568
|
+
isLegacyAnimationProp = true;
|
|
27569
|
+
name = name.substring(LEGACY_ANIMATE_PROP_PREFIX.length);
|
|
27542
27570
|
if (keySpan !== undefined) {
|
|
27543
|
-
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset +
|
|
27571
|
+
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + LEGACY_ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
|
|
27544
27572
|
}
|
|
27545
27573
|
}
|
|
27546
|
-
else if (
|
|
27547
|
-
|
|
27574
|
+
else if (isLegacyAnimationLabel(name)) {
|
|
27575
|
+
isLegacyAnimationProp = true;
|
|
27548
27576
|
name = name.substring(1);
|
|
27549
27577
|
if (keySpan !== undefined) {
|
|
27550
27578
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
27551
27579
|
}
|
|
27552
27580
|
}
|
|
27553
|
-
if (
|
|
27554
|
-
this.
|
|
27581
|
+
if (isLegacyAnimationProp) {
|
|
27582
|
+
this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27555
27583
|
}
|
|
27556
27584
|
else {
|
|
27557
27585
|
this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
@@ -27569,7 +27597,7 @@ class BindingParser {
|
|
|
27569
27597
|
targetMatchableAttrs.push([name, ast.source]);
|
|
27570
27598
|
targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
|
|
27571
27599
|
}
|
|
27572
|
-
|
|
27600
|
+
_parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
|
|
27573
27601
|
if (name.length === 0) {
|
|
27574
27602
|
this._reportError('Animation trigger is missing', sourceSpan);
|
|
27575
27603
|
}
|
|
@@ -27578,7 +27606,7 @@ class BindingParser {
|
|
|
27578
27606
|
// states will be applied by angular when the element is attached/detached
|
|
27579
27607
|
const ast = this.parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
|
|
27580
27608
|
targetMatchableAttrs.push([name, ast.source]);
|
|
27581
|
-
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.
|
|
27609
|
+
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.LEGACY_ANIMATION, sourceSpan, keySpan, valueSpan));
|
|
27582
27610
|
}
|
|
27583
27611
|
parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
|
27584
27612
|
try {
|
|
@@ -27596,8 +27624,8 @@ class BindingParser {
|
|
|
27596
27624
|
}
|
|
27597
27625
|
}
|
|
27598
27626
|
createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
|
|
27599
|
-
if (boundProp.
|
|
27600
|
-
return new BoundElementProperty(boundProp.name, BindingType.
|
|
27627
|
+
if (boundProp.isLegacyAnimation) {
|
|
27628
|
+
return new BoundElementProperty(boundProp.name, BindingType.LegacyAnimation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
27601
27629
|
}
|
|
27602
27630
|
let unit = null;
|
|
27603
27631
|
let bindingType = undefined;
|
|
@@ -27650,12 +27678,12 @@ class BindingParser {
|
|
|
27650
27678
|
if (name.length === 0) {
|
|
27651
27679
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
27652
27680
|
}
|
|
27653
|
-
if (
|
|
27681
|
+
if (isLegacyAnimationLabel(name)) {
|
|
27654
27682
|
name = name.slice(1);
|
|
27655
27683
|
if (keySpan !== undefined) {
|
|
27656
27684
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
27657
27685
|
}
|
|
27658
|
-
this.
|
|
27686
|
+
this._parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
27659
27687
|
}
|
|
27660
27688
|
else {
|
|
27661
27689
|
this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
@@ -27669,14 +27697,14 @@ class BindingParser {
|
|
|
27669
27697
|
const [target, eventName] = splitAtColon(rawName, [null, rawName]);
|
|
27670
27698
|
return { eventName: eventName, target };
|
|
27671
27699
|
}
|
|
27672
|
-
|
|
27700
|
+
parseLegacyAnimationEventName(rawName) {
|
|
27673
27701
|
const matches = splitAtPeriod(rawName, [rawName, null]);
|
|
27674
27702
|
return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
|
|
27675
27703
|
}
|
|
27676
|
-
|
|
27677
|
-
const { eventName, phase } = this.
|
|
27704
|
+
_parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
27705
|
+
const { eventName, phase } = this.parseLegacyAnimationEventName(name);
|
|
27678
27706
|
const ast = this._parseAction(expression, handlerSpan);
|
|
27679
|
-
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.
|
|
27707
|
+
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.LegacyAnimation, ast, sourceSpan, handlerSpan, keySpan));
|
|
27680
27708
|
if (eventName.length === 0) {
|
|
27681
27709
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
27682
27710
|
}
|
|
@@ -27764,7 +27792,7 @@ class BindingParser {
|
|
|
27764
27792
|
return false;
|
|
27765
27793
|
}
|
|
27766
27794
|
}
|
|
27767
|
-
function
|
|
27795
|
+
function isLegacyAnimationLabel(name) {
|
|
27768
27796
|
return name[0] == '@';
|
|
27769
27797
|
}
|
|
27770
27798
|
function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
|
|
@@ -33686,7 +33714,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33686
33714
|
function compileDeclareClassMetadata(metadata) {
|
|
33687
33715
|
const definitionMap = new DefinitionMap();
|
|
33688
33716
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33689
|
-
definitionMap.set('version', literal('20.1.0
|
|
33717
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
33690
33718
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33691
33719
|
definitionMap.set('type', metadata.type);
|
|
33692
33720
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33704,7 +33732,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33704
33732
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33705
33733
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33706
33734
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33707
|
-
definitionMap.set('version', literal('20.1.0
|
|
33735
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
33708
33736
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33709
33737
|
definitionMap.set('type', metadata.type);
|
|
33710
33738
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33799,7 +33827,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33799
33827
|
const definitionMap = new DefinitionMap();
|
|
33800
33828
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33801
33829
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33802
|
-
definitionMap.set('version', literal('20.1.0
|
|
33830
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
33803
33831
|
// e.g. `type: MyDirective`
|
|
33804
33832
|
definitionMap.set('type', meta.type.value);
|
|
33805
33833
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34215,7 +34243,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34215
34243
|
function compileDeclareFactoryFunction(meta) {
|
|
34216
34244
|
const definitionMap = new DefinitionMap();
|
|
34217
34245
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34218
|
-
definitionMap.set('version', literal('20.1.0
|
|
34246
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
34219
34247
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34220
34248
|
definitionMap.set('type', meta.type.value);
|
|
34221
34249
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34250,7 +34278,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34250
34278
|
function createInjectableDefinitionMap(meta) {
|
|
34251
34279
|
const definitionMap = new DefinitionMap();
|
|
34252
34280
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34253
|
-
definitionMap.set('version', literal('20.1.0
|
|
34281
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
34254
34282
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34255
34283
|
definitionMap.set('type', meta.type.value);
|
|
34256
34284
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34301,7 +34329,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34301
34329
|
function createInjectorDefinitionMap(meta) {
|
|
34302
34330
|
const definitionMap = new DefinitionMap();
|
|
34303
34331
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34304
|
-
definitionMap.set('version', literal('20.1.0
|
|
34332
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
34305
34333
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34306
34334
|
definitionMap.set('type', meta.type.value);
|
|
34307
34335
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34334,7 +34362,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34334
34362
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34335
34363
|
}
|
|
34336
34364
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34337
|
-
definitionMap.set('version', literal('20.1.0
|
|
34365
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
34338
34366
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34339
34367
|
definitionMap.set('type', meta.type.value);
|
|
34340
34368
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34385,7 +34413,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34385
34413
|
function createPipeDefinitionMap(meta) {
|
|
34386
34414
|
const definitionMap = new DefinitionMap();
|
|
34387
34415
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34388
|
-
definitionMap.set('version', literal('20.1.0
|
|
34416
|
+
definitionMap.set('version', literal('20.1.0'));
|
|
34389
34417
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34390
34418
|
// e.g. `type: MyPipe`
|
|
34391
34419
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34541,7 +34569,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34541
34569
|
* @description
|
|
34542
34570
|
* Entry point for all public APIs of the compiler package.
|
|
34543
34571
|
*/
|
|
34544
|
-
const VERSION = new Version('20.1.0
|
|
34572
|
+
const VERSION = new Version('20.1.0');
|
|
34545
34573
|
|
|
34546
34574
|
//////////////////////////////////////
|
|
34547
34575
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|