@angular/compiler 20.1.0-next.3 → 20.1.0-rc.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 +79 -74
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +13 -13
- 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-rc.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
|
}
|
|
@@ -8919,9 +8919,9 @@ var BindingKind;
|
|
|
8919
8919
|
*/
|
|
8920
8920
|
BindingKind[BindingKind["I18n"] = 5] = "I18n";
|
|
8921
8921
|
/**
|
|
8922
|
-
*
|
|
8922
|
+
* Legacy animation property bindings.
|
|
8923
8923
|
*/
|
|
8924
|
-
BindingKind[BindingKind["
|
|
8924
|
+
BindingKind[BindingKind["LegacyAnimation"] = 6] = "LegacyAnimation";
|
|
8925
8925
|
/**
|
|
8926
8926
|
* Property side of a two-way binding.
|
|
8927
8927
|
*/
|
|
@@ -9166,13 +9166,13 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
|
|
|
9166
9166
|
/**
|
|
9167
9167
|
* Create a `PropertyOp`.
|
|
9168
9168
|
*/
|
|
9169
|
-
function createPropertyOp(target, name, expression,
|
|
9169
|
+
function createPropertyOp(target, name, expression, isLegacyAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
|
|
9170
9170
|
return {
|
|
9171
9171
|
kind: OpKind.Property,
|
|
9172
9172
|
target,
|
|
9173
9173
|
name,
|
|
9174
9174
|
expression,
|
|
9175
|
-
|
|
9175
|
+
isLegacyAnimationTrigger,
|
|
9176
9176
|
securityContext,
|
|
9177
9177
|
sanitizer: null,
|
|
9178
9178
|
isStructuralTemplateAttribute,
|
|
@@ -10859,7 +10859,7 @@ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
|
10859
10859
|
/**
|
|
10860
10860
|
* Create a `ListenerOp`. Host bindings reuse all the listener logic.
|
|
10861
10861
|
*/
|
|
10862
|
-
function createListenerOp(target, targetSlot, name, tag, handlerOps,
|
|
10862
|
+
function createListenerOp(target, targetSlot, name, tag, handlerOps, legacyAnimationPhase, eventTarget, hostListener, sourceSpan) {
|
|
10863
10863
|
const handlerList = new OpList();
|
|
10864
10864
|
handlerList.push(handlerOps);
|
|
10865
10865
|
return {
|
|
@@ -10872,8 +10872,8 @@ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPh
|
|
|
10872
10872
|
handlerOps: handlerList,
|
|
10873
10873
|
handlerFnName: null,
|
|
10874
10874
|
consumesDollarEvent: false,
|
|
10875
|
-
|
|
10876
|
-
|
|
10875
|
+
isLegacyAnimationListener: legacyAnimationPhase !== null,
|
|
10876
|
+
legacyAnimationPhase: legacyAnimationPhase,
|
|
10877
10877
|
eventTarget,
|
|
10878
10878
|
sourceSpan,
|
|
10879
10879
|
...NEW_OP,
|
|
@@ -11128,12 +11128,12 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
11128
11128
|
};
|
|
11129
11129
|
}
|
|
11130
11130
|
|
|
11131
|
-
function createDomPropertyOp(name, expression,
|
|
11131
|
+
function createDomPropertyOp(name, expression, isLegacyAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
11132
11132
|
return {
|
|
11133
11133
|
kind: OpKind.DomProperty,
|
|
11134
11134
|
name,
|
|
11135
11135
|
expression,
|
|
11136
|
-
|
|
11136
|
+
isLegacyAnimationTrigger,
|
|
11137
11137
|
i18nContext,
|
|
11138
11138
|
securityContext,
|
|
11139
11139
|
sanitizer: null,
|
|
@@ -11580,7 +11580,7 @@ function extractAttributes(job) {
|
|
|
11580
11580
|
extractAttributeOp(unit, op, elements);
|
|
11581
11581
|
break;
|
|
11582
11582
|
case OpKind.Property:
|
|
11583
|
-
if (!op.
|
|
11583
|
+
if (!op.isLegacyAnimationTrigger) {
|
|
11584
11584
|
let bindingKind;
|
|
11585
11585
|
if (op.i18nMessage !== null && op.templateKind === null) {
|
|
11586
11586
|
// If the binding has an i18n context, it is an i18n attribute, and should have that
|
|
@@ -11622,7 +11622,7 @@ function extractAttributes(job) {
|
|
|
11622
11622
|
}
|
|
11623
11623
|
break;
|
|
11624
11624
|
case OpKind.Listener:
|
|
11625
|
-
if (!op.
|
|
11625
|
+
if (!op.isLegacyAnimationListener) {
|
|
11626
11626
|
const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name,
|
|
11627
11627
|
/* expression */ null,
|
|
11628
11628
|
/* i18nContext */ null,
|
|
@@ -11732,12 +11732,12 @@ function specializeBindings(job) {
|
|
|
11732
11732
|
}
|
|
11733
11733
|
break;
|
|
11734
11734
|
case BindingKind.Property:
|
|
11735
|
-
case BindingKind.
|
|
11735
|
+
case BindingKind.LegacyAnimation:
|
|
11736
11736
|
if (job.kind === CompilationJobKind.Host) {
|
|
11737
|
-
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.
|
|
11737
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.LegacyAnimation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11738
11738
|
}
|
|
11739
11739
|
else {
|
|
11740
|
-
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.
|
|
11740
|
+
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
11741
|
}
|
|
11742
11742
|
break;
|
|
11743
11743
|
case BindingKind.TwoWayProperty:
|
|
@@ -18642,10 +18642,14 @@ class Parser {
|
|
|
18642
18642
|
return null;
|
|
18643
18643
|
const expressionNodes = [];
|
|
18644
18644
|
for (let i = 0; i < expressions.length; ++i) {
|
|
18645
|
+
// If we have a token for the specific expression, it's preferrable to use it because it
|
|
18646
|
+
// allows us to produce more accurate error messages. The expressions are always at the odd
|
|
18647
|
+
// indexes inside the tokens.
|
|
18648
|
+
const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
|
|
18645
18649
|
const expressionText = expressions[i].text;
|
|
18646
18650
|
const sourceToLex = this._stripComments(expressionText);
|
|
18647
18651
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18648
|
-
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18652
|
+
const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18649
18653
|
expressionNodes.push(ast);
|
|
18650
18654
|
}
|
|
18651
18655
|
return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
@@ -22321,7 +22325,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22321
22325
|
switch (op.kind) {
|
|
22322
22326
|
case OpKind.Property:
|
|
22323
22327
|
case OpKind.DomProperty:
|
|
22324
|
-
if (op.
|
|
22328
|
+
if (op.isLegacyAnimationTrigger) {
|
|
22325
22329
|
op.name = '@' + op.name;
|
|
22326
22330
|
}
|
|
22327
22331
|
break;
|
|
@@ -22333,8 +22337,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22333
22337
|
throw new Error(`Expected a slot to be assigned`);
|
|
22334
22338
|
}
|
|
22335
22339
|
let animation = '';
|
|
22336
|
-
if (op.
|
|
22337
|
-
op.name = `@${op.name}.${op.
|
|
22340
|
+
if (op.isLegacyAnimationListener) {
|
|
22341
|
+
op.name = `@${op.name}.${op.legacyAnimationPhase}`;
|
|
22338
22342
|
animation = 'animation';
|
|
22339
22343
|
}
|
|
22340
22344
|
if (op.hostListener) {
|
|
@@ -22602,7 +22606,7 @@ function kindWithInterpolationTest(kind, interpolation) {
|
|
|
22602
22606
|
};
|
|
22603
22607
|
}
|
|
22604
22608
|
function basicListenerKindTest(op) {
|
|
22605
|
-
return ((op.kind === OpKind.Listener && !(op.hostListener && op.
|
|
22609
|
+
return ((op.kind === OpKind.Listener && !(op.hostListener && op.isLegacyAnimationListener)) ||
|
|
22606
22610
|
op.kind === OpKind.TwoWayListener);
|
|
22607
22611
|
}
|
|
22608
22612
|
function nonInterpolationPropertyKindTest(op) {
|
|
@@ -22615,7 +22619,7 @@ function nonInterpolationPropertyKindTest(op) {
|
|
|
22615
22619
|
* the groups in the order defined here.
|
|
22616
22620
|
*/
|
|
22617
22621
|
const CREATE_ORDERING = [
|
|
22618
|
-
{ test: (op) => op.kind === OpKind.Listener && op.hostListener && op.
|
|
22622
|
+
{ test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isLegacyAnimationListener },
|
|
22619
22623
|
{ test: basicListenerKindTest },
|
|
22620
22624
|
];
|
|
22621
22625
|
/**
|
|
@@ -23705,9 +23709,9 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23705
23709
|
}
|
|
23706
23710
|
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly &&
|
|
23707
23711
|
!op.hostListener &&
|
|
23708
|
-
!op.
|
|
23712
|
+
!op.isLegacyAnimationListener
|
|
23709
23713
|
? domListener(op.name, listenerFn, eventTargetResolver, op.sourceSpan)
|
|
23710
|
-
: listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.
|
|
23714
|
+
: listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isLegacyAnimationListener, op.sourceSpan));
|
|
23711
23715
|
break;
|
|
23712
23716
|
case OpKind.TwoWayListener:
|
|
23713
23717
|
OpList.replace(op, twoWayListener(op.name, reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, true), op.sourceSpan));
|
|
@@ -23873,7 +23877,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23873
23877
|
OpList.replace(op, advance(op.delta, op.sourceSpan));
|
|
23874
23878
|
break;
|
|
23875
23879
|
case OpKind.Property:
|
|
23876
|
-
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.
|
|
23880
|
+
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
|
|
23877
23881
|
? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23878
23882
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23879
23883
|
break;
|
|
@@ -23909,7 +23913,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23909
23913
|
throw new Error('not yet handled');
|
|
23910
23914
|
}
|
|
23911
23915
|
else {
|
|
23912
|
-
if (op.
|
|
23916
|
+
if (op.isLegacyAnimationTrigger) {
|
|
23913
23917
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23914
23918
|
}
|
|
23915
23919
|
else {
|
|
@@ -26131,8 +26135,8 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
26131
26135
|
property.name = property.name.substring('attr.'.length);
|
|
26132
26136
|
bindingKind = BindingKind.Attribute;
|
|
26133
26137
|
}
|
|
26134
|
-
if (property.
|
|
26135
|
-
bindingKind = BindingKind.
|
|
26138
|
+
if (property.isLegacyAnimation) {
|
|
26139
|
+
bindingKind = BindingKind.LegacyAnimation;
|
|
26136
26140
|
}
|
|
26137
26141
|
const securityContexts = bindingParser
|
|
26138
26142
|
.calcPossibleSecurityContexts(input.componentSelector, property.name, bindingKind === BindingKind.Attribute)
|
|
@@ -26174,7 +26178,7 @@ function ingestHostAttribute(job, name, value, securityContexts) {
|
|
|
26174
26178
|
job.root.update.push(attrBinding);
|
|
26175
26179
|
}
|
|
26176
26180
|
function ingestHostEvent(job, event) {
|
|
26177
|
-
const [phase, target] = event.type !== ParsedEventType.
|
|
26181
|
+
const [phase, target] = event.type !== ParsedEventType.LegacyAnimation
|
|
26178
26182
|
? [null, event.targetOrPhase]
|
|
26179
26183
|
: [event.targetOrPhase, null];
|
|
26180
26184
|
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 +26803,7 @@ const BINDING_KINDS = new Map([
|
|
|
26799
26803
|
[BindingType.Attribute, BindingKind.Attribute],
|
|
26800
26804
|
[BindingType.Class, BindingKind.ClassName],
|
|
26801
26805
|
[BindingType.Style, BindingKind.StyleProperty],
|
|
26802
|
-
[BindingType.
|
|
26806
|
+
[BindingType.LegacyAnimation, BindingKind.LegacyAnimation],
|
|
26803
26807
|
]);
|
|
26804
26808
|
/**
|
|
26805
26809
|
* Checks whether the given template is a plain ng-template (as opposed to another kind of template
|
|
@@ -26858,7 +26862,7 @@ function ingestElementBindings(unit, op, element) {
|
|
|
26858
26862
|
unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
|
|
26859
26863
|
unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
|
|
26860
26864
|
for (const output of element.outputs) {
|
|
26861
|
-
if (output.type === ParsedEventType.
|
|
26865
|
+
if (output.type === ParsedEventType.LegacyAnimation && output.phase === null) {
|
|
26862
26866
|
throw Error('Animation listener should have a phase');
|
|
26863
26867
|
}
|
|
26864
26868
|
if (output.type === ParsedEventType.TwoWay) {
|
|
@@ -26901,7 +26905,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
|
|
|
26901
26905
|
unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
|
|
26902
26906
|
unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
|
|
26903
26907
|
for (const output of template.outputs) {
|
|
26904
|
-
if (output.type === ParsedEventType.
|
|
26908
|
+
if (output.type === ParsedEventType.LegacyAnimation && output.phase === null) {
|
|
26905
26909
|
throw Error('Animation listener should have a phase');
|
|
26906
26910
|
}
|
|
26907
26911
|
if (templateKind === TemplateKind.NgTemplate) {
|
|
@@ -26913,7 +26917,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
|
|
|
26913
26917
|
}
|
|
26914
26918
|
}
|
|
26915
26919
|
if (templateKind === TemplateKind.Structural &&
|
|
26916
|
-
output.type !== ParsedEventType.
|
|
26920
|
+
output.type !== ParsedEventType.LegacyAnimation) {
|
|
26917
26921
|
// Animation bindings are excluded from the structural template's const array.
|
|
26918
26922
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
|
|
26919
26923
|
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
|
|
@@ -26971,7 +26975,8 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
26971
26975
|
return createExtractedAttributeOp(xref, BindingKind.TwoWayProperty, null, name, null, null, i18nMessage, securityContext);
|
|
26972
26976
|
}
|
|
26973
26977
|
}
|
|
26974
|
-
if (!isTextBinding &&
|
|
26978
|
+
if (!isTextBinding &&
|
|
26979
|
+
(type === BindingType.Attribute || type === BindingType.LegacyAnimation)) {
|
|
26975
26980
|
// Again, this binding doesn't really target the ng-template; it actually targets the element
|
|
26976
26981
|
// inside the structural template. In the case of non-text attribute or animation bindings,
|
|
26977
26982
|
// the binding doesn't even show up on the ng-template const array, so we just skip it
|
|
@@ -27136,7 +27141,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
27136
27141
|
// Note that TDB used to collect the outputs as well, but it wasn't passing them into
|
|
27137
27142
|
// the template instruction. Here we just don't collect them.
|
|
27138
27143
|
for (const attr of root.inputs) {
|
|
27139
|
-
if (attr.type !== BindingType.
|
|
27144
|
+
if (attr.type !== BindingType.LegacyAnimation && attr.type !== BindingType.Attribute) {
|
|
27140
27145
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
27141
27146
|
unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
|
|
27142
27147
|
}
|
|
@@ -27357,7 +27362,7 @@ const ATTRIBUTE_PREFIX = 'attr';
|
|
|
27357
27362
|
const CLASS_PREFIX = 'class';
|
|
27358
27363
|
const STYLE_PREFIX = 'style';
|
|
27359
27364
|
const TEMPLATE_ATTR_PREFIX$1 = '*';
|
|
27360
|
-
const
|
|
27365
|
+
const LEGACY_ANIMATE_PROP_PREFIX = 'animate-';
|
|
27361
27366
|
/**
|
|
27362
27367
|
* Parses bindings in templates and in the directive host area.
|
|
27363
27368
|
*/
|
|
@@ -27516,7 +27521,7 @@ class BindingParser {
|
|
|
27516
27521
|
}
|
|
27517
27522
|
}
|
|
27518
27523
|
parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
|
|
27519
|
-
if (
|
|
27524
|
+
if (isLegacyAnimationLabel(name)) {
|
|
27520
27525
|
name = name.substring(1);
|
|
27521
27526
|
if (keySpan !== undefined) {
|
|
27522
27527
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
@@ -27525,7 +27530,7 @@ class BindingParser {
|
|
|
27525
27530
|
this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid.` +
|
|
27526
27531
|
` Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR);
|
|
27527
27532
|
}
|
|
27528
|
-
this.
|
|
27533
|
+
this._parseLegacyAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27529
27534
|
}
|
|
27530
27535
|
else {
|
|
27531
27536
|
targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, '', absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
|
|
@@ -27535,23 +27540,23 @@ class BindingParser {
|
|
|
27535
27540
|
if (name.length === 0) {
|
|
27536
27541
|
this._reportError(`Property name is missing in binding`, sourceSpan);
|
|
27537
27542
|
}
|
|
27538
|
-
let
|
|
27539
|
-
if (name.startsWith(
|
|
27540
|
-
|
|
27541
|
-
name = name.substring(
|
|
27543
|
+
let isLegacyAnimationProp = false;
|
|
27544
|
+
if (name.startsWith(LEGACY_ANIMATE_PROP_PREFIX)) {
|
|
27545
|
+
isLegacyAnimationProp = true;
|
|
27546
|
+
name = name.substring(LEGACY_ANIMATE_PROP_PREFIX.length);
|
|
27542
27547
|
if (keySpan !== undefined) {
|
|
27543
|
-
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset +
|
|
27548
|
+
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + LEGACY_ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
|
|
27544
27549
|
}
|
|
27545
27550
|
}
|
|
27546
|
-
else if (
|
|
27547
|
-
|
|
27551
|
+
else if (isLegacyAnimationLabel(name)) {
|
|
27552
|
+
isLegacyAnimationProp = true;
|
|
27548
27553
|
name = name.substring(1);
|
|
27549
27554
|
if (keySpan !== undefined) {
|
|
27550
27555
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
27551
27556
|
}
|
|
27552
27557
|
}
|
|
27553
|
-
if (
|
|
27554
|
-
this.
|
|
27558
|
+
if (isLegacyAnimationProp) {
|
|
27559
|
+
this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27555
27560
|
}
|
|
27556
27561
|
else {
|
|
27557
27562
|
this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
@@ -27569,7 +27574,7 @@ class BindingParser {
|
|
|
27569
27574
|
targetMatchableAttrs.push([name, ast.source]);
|
|
27570
27575
|
targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
|
|
27571
27576
|
}
|
|
27572
|
-
|
|
27577
|
+
_parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
|
|
27573
27578
|
if (name.length === 0) {
|
|
27574
27579
|
this._reportError('Animation trigger is missing', sourceSpan);
|
|
27575
27580
|
}
|
|
@@ -27578,7 +27583,7 @@ class BindingParser {
|
|
|
27578
27583
|
// states will be applied by angular when the element is attached/detached
|
|
27579
27584
|
const ast = this.parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
|
|
27580
27585
|
targetMatchableAttrs.push([name, ast.source]);
|
|
27581
|
-
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.
|
|
27586
|
+
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.LEGACY_ANIMATION, sourceSpan, keySpan, valueSpan));
|
|
27582
27587
|
}
|
|
27583
27588
|
parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
|
27584
27589
|
try {
|
|
@@ -27596,8 +27601,8 @@ class BindingParser {
|
|
|
27596
27601
|
}
|
|
27597
27602
|
}
|
|
27598
27603
|
createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
|
|
27599
|
-
if (boundProp.
|
|
27600
|
-
return new BoundElementProperty(boundProp.name, BindingType.
|
|
27604
|
+
if (boundProp.isLegacyAnimation) {
|
|
27605
|
+
return new BoundElementProperty(boundProp.name, BindingType.LegacyAnimation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
27601
27606
|
}
|
|
27602
27607
|
let unit = null;
|
|
27603
27608
|
let bindingType = undefined;
|
|
@@ -27650,12 +27655,12 @@ class BindingParser {
|
|
|
27650
27655
|
if (name.length === 0) {
|
|
27651
27656
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
27652
27657
|
}
|
|
27653
|
-
if (
|
|
27658
|
+
if (isLegacyAnimationLabel(name)) {
|
|
27654
27659
|
name = name.slice(1);
|
|
27655
27660
|
if (keySpan !== undefined) {
|
|
27656
27661
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
27657
27662
|
}
|
|
27658
|
-
this.
|
|
27663
|
+
this._parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
27659
27664
|
}
|
|
27660
27665
|
else {
|
|
27661
27666
|
this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
@@ -27669,14 +27674,14 @@ class BindingParser {
|
|
|
27669
27674
|
const [target, eventName] = splitAtColon(rawName, [null, rawName]);
|
|
27670
27675
|
return { eventName: eventName, target };
|
|
27671
27676
|
}
|
|
27672
|
-
|
|
27677
|
+
parseLegacyAnimationEventName(rawName) {
|
|
27673
27678
|
const matches = splitAtPeriod(rawName, [rawName, null]);
|
|
27674
27679
|
return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
|
|
27675
27680
|
}
|
|
27676
|
-
|
|
27677
|
-
const { eventName, phase } = this.
|
|
27681
|
+
_parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
27682
|
+
const { eventName, phase } = this.parseLegacyAnimationEventName(name);
|
|
27678
27683
|
const ast = this._parseAction(expression, handlerSpan);
|
|
27679
|
-
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.
|
|
27684
|
+
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.LegacyAnimation, ast, sourceSpan, handlerSpan, keySpan));
|
|
27680
27685
|
if (eventName.length === 0) {
|
|
27681
27686
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
27682
27687
|
}
|
|
@@ -27764,7 +27769,7 @@ class BindingParser {
|
|
|
27764
27769
|
return false;
|
|
27765
27770
|
}
|
|
27766
27771
|
}
|
|
27767
|
-
function
|
|
27772
|
+
function isLegacyAnimationLabel(name) {
|
|
27768
27773
|
return name[0] == '@';
|
|
27769
27774
|
}
|
|
27770
27775
|
function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
|
|
@@ -33686,7 +33691,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33686
33691
|
function compileDeclareClassMetadata(metadata) {
|
|
33687
33692
|
const definitionMap = new DefinitionMap();
|
|
33688
33693
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33689
|
-
definitionMap.set('version', literal('20.1.0-
|
|
33694
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
33690
33695
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33691
33696
|
definitionMap.set('type', metadata.type);
|
|
33692
33697
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33704,7 +33709,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33704
33709
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33705
33710
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33706
33711
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33707
|
-
definitionMap.set('version', literal('20.1.0-
|
|
33712
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
33708
33713
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33709
33714
|
definitionMap.set('type', metadata.type);
|
|
33710
33715
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33799,7 +33804,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33799
33804
|
const definitionMap = new DefinitionMap();
|
|
33800
33805
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33801
33806
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33802
|
-
definitionMap.set('version', literal('20.1.0-
|
|
33807
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
33803
33808
|
// e.g. `type: MyDirective`
|
|
33804
33809
|
definitionMap.set('type', meta.type.value);
|
|
33805
33810
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34215,7 +34220,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34215
34220
|
function compileDeclareFactoryFunction(meta) {
|
|
34216
34221
|
const definitionMap = new DefinitionMap();
|
|
34217
34222
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34218
|
-
definitionMap.set('version', literal('20.1.0-
|
|
34223
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
34219
34224
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34220
34225
|
definitionMap.set('type', meta.type.value);
|
|
34221
34226
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34250,7 +34255,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34250
34255
|
function createInjectableDefinitionMap(meta) {
|
|
34251
34256
|
const definitionMap = new DefinitionMap();
|
|
34252
34257
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34253
|
-
definitionMap.set('version', literal('20.1.0-
|
|
34258
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
34254
34259
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34255
34260
|
definitionMap.set('type', meta.type.value);
|
|
34256
34261
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34301,7 +34306,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34301
34306
|
function createInjectorDefinitionMap(meta) {
|
|
34302
34307
|
const definitionMap = new DefinitionMap();
|
|
34303
34308
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34304
|
-
definitionMap.set('version', literal('20.1.0-
|
|
34309
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
34305
34310
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34306
34311
|
definitionMap.set('type', meta.type.value);
|
|
34307
34312
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34334,7 +34339,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34334
34339
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34335
34340
|
}
|
|
34336
34341
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34337
|
-
definitionMap.set('version', literal('20.1.0-
|
|
34342
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
34338
34343
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34339
34344
|
definitionMap.set('type', meta.type.value);
|
|
34340
34345
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34385,7 +34390,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34385
34390
|
function createPipeDefinitionMap(meta) {
|
|
34386
34391
|
const definitionMap = new DefinitionMap();
|
|
34387
34392
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34388
|
-
definitionMap.set('version', literal('20.1.0-
|
|
34393
|
+
definitionMap.set('version', literal('20.1.0-rc.0'));
|
|
34389
34394
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34390
34395
|
// e.g. `type: MyPipe`
|
|
34391
34396
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34541,7 +34546,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34541
34546
|
* @description
|
|
34542
34547
|
* Entry point for all public APIs of the compiler package.
|
|
34543
34548
|
*/
|
|
34544
|
-
const VERSION = new Version('20.1.0-
|
|
34549
|
+
const VERSION = new Version('20.1.0-rc.0');
|
|
34545
34550
|
|
|
34546
34551
|
//////////////////////////////////////
|
|
34547
34552
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|