@angular/compiler 20.2.0-next.0 → 20.2.0-next.2
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 +730 -196
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +23 -6
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.2.0-next.
|
|
2
|
+
* @license Angular v20.2.0-next.2
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2812,7 +2812,18 @@ class Identifiers {
|
|
|
2812
2812
|
static pipeBind4 = { name: 'ɵɵpipeBind4', moduleName: CORE };
|
|
2813
2813
|
static pipeBindV = { name: 'ɵɵpipeBindV', moduleName: CORE };
|
|
2814
2814
|
static domProperty = { name: 'ɵɵdomProperty', moduleName: CORE };
|
|
2815
|
+
static ariaProperty = { name: 'ɵɵariaProperty', moduleName: CORE };
|
|
2815
2816
|
static property = { name: 'ɵɵproperty', moduleName: CORE };
|
|
2817
|
+
static animationEnterListener = {
|
|
2818
|
+
name: 'ɵɵanimateEnterListener',
|
|
2819
|
+
moduleName: CORE,
|
|
2820
|
+
};
|
|
2821
|
+
static animationLeaveListener = {
|
|
2822
|
+
name: 'ɵɵanimateLeaveListener',
|
|
2823
|
+
moduleName: CORE,
|
|
2824
|
+
};
|
|
2825
|
+
static animationEnter = { name: 'ɵɵanimateEnter', moduleName: CORE };
|
|
2826
|
+
static animationLeave = { name: 'ɵɵanimateLeave', moduleName: CORE };
|
|
2816
2827
|
static i18n = { name: 'ɵɵi18n', moduleName: CORE };
|
|
2817
2828
|
static i18nAttributes = { name: 'ɵɵi18nAttributes', moduleName: CORE };
|
|
2818
2829
|
static i18nExp = { name: 'ɵɵi18nExp', moduleName: CORE };
|
|
@@ -2956,6 +2967,10 @@ class Identifiers {
|
|
|
2956
2967
|
name: 'ɵɵExternalStylesFeature',
|
|
2957
2968
|
moduleName: CORE,
|
|
2958
2969
|
};
|
|
2970
|
+
static AnimationsFeature = {
|
|
2971
|
+
name: 'ɵɵAnimationsFeature',
|
|
2972
|
+
moduleName: CORE,
|
|
2973
|
+
};
|
|
2959
2974
|
static listener = { name: 'ɵɵlistener', moduleName: CORE };
|
|
2960
2975
|
static getInheritedFactory = {
|
|
2961
2976
|
name: 'ɵɵgetInheritedFactory',
|
|
@@ -2987,6 +3002,7 @@ class Identifiers {
|
|
|
2987
3002
|
static InputSignalBrandWriteType = { name: 'ɵINPUT_SIGNAL_BRAND_WRITE_TYPE', moduleName: CORE };
|
|
2988
3003
|
static UnwrapDirectiveSignalInputs = { name: 'ɵUnwrapDirectiveSignalInputs', moduleName: CORE };
|
|
2989
3004
|
static unwrapWritableSignal = { name: 'ɵunwrapWritableSignal', moduleName: CORE };
|
|
3005
|
+
static assertType = { name: 'ɵassertType', moduleName: CORE };
|
|
2990
3006
|
}
|
|
2991
3007
|
|
|
2992
3008
|
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
@@ -4537,6 +4553,7 @@ class ParsedProperty {
|
|
|
4537
4553
|
valueSpan;
|
|
4538
4554
|
isLiteral;
|
|
4539
4555
|
isLegacyAnimation;
|
|
4556
|
+
isAnimation;
|
|
4540
4557
|
constructor(name, expression, type, sourceSpan, keySpan, valueSpan) {
|
|
4541
4558
|
this.name = name;
|
|
4542
4559
|
this.expression = expression;
|
|
@@ -4546,6 +4563,7 @@ class ParsedProperty {
|
|
|
4546
4563
|
this.valueSpan = valueSpan;
|
|
4547
4564
|
this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR;
|
|
4548
4565
|
this.isLegacyAnimation = this.type === ParsedPropertyType.LEGACY_ANIMATION;
|
|
4566
|
+
this.isAnimation = this.type === ParsedPropertyType.ANIMATION;
|
|
4549
4567
|
}
|
|
4550
4568
|
}
|
|
4551
4569
|
var ParsedPropertyType;
|
|
@@ -4554,6 +4572,7 @@ var ParsedPropertyType;
|
|
|
4554
4572
|
ParsedPropertyType[ParsedPropertyType["LITERAL_ATTR"] = 1] = "LITERAL_ATTR";
|
|
4555
4573
|
ParsedPropertyType[ParsedPropertyType["LEGACY_ANIMATION"] = 2] = "LEGACY_ANIMATION";
|
|
4556
4574
|
ParsedPropertyType[ParsedPropertyType["TWO_WAY"] = 3] = "TWO_WAY";
|
|
4575
|
+
ParsedPropertyType[ParsedPropertyType["ANIMATION"] = 4] = "ANIMATION";
|
|
4557
4576
|
})(ParsedPropertyType || (ParsedPropertyType = {}));
|
|
4558
4577
|
var ParsedEventType;
|
|
4559
4578
|
(function (ParsedEventType) {
|
|
@@ -4563,6 +4582,8 @@ var ParsedEventType;
|
|
|
4563
4582
|
ParsedEventType[ParsedEventType["LegacyAnimation"] = 1] = "LegacyAnimation";
|
|
4564
4583
|
// Event side of a two-way binding (e.g. `[(property)]="expression"`).
|
|
4565
4584
|
ParsedEventType[ParsedEventType["TwoWay"] = 2] = "TwoWay";
|
|
4585
|
+
// Animation specific event
|
|
4586
|
+
ParsedEventType[ParsedEventType["Animation"] = 3] = "Animation";
|
|
4566
4587
|
})(ParsedEventType || (ParsedEventType = {}));
|
|
4567
4588
|
class ParsedEvent {
|
|
4568
4589
|
name;
|
|
@@ -4613,6 +4634,8 @@ var BindingType;
|
|
|
4613
4634
|
BindingType[BindingType["LegacyAnimation"] = 4] = "LegacyAnimation";
|
|
4614
4635
|
// Property side of a two-way binding (e.g. `[(property)]="expression"`).
|
|
4615
4636
|
BindingType[BindingType["TwoWay"] = 5] = "TwoWay";
|
|
4637
|
+
// A binding to an animation CSS class or function (e.g. `[animate.leave]="expression"`).
|
|
4638
|
+
BindingType[BindingType["Animation"] = 6] = "Animation";
|
|
4616
4639
|
})(BindingType || (BindingType = {}));
|
|
4617
4640
|
class BoundElementProperty {
|
|
4618
4641
|
name;
|
|
@@ -4815,8 +4838,9 @@ let Element$1 = class Element {
|
|
|
4815
4838
|
sourceSpan;
|
|
4816
4839
|
startSourceSpan;
|
|
4817
4840
|
endSourceSpan;
|
|
4841
|
+
isVoid;
|
|
4818
4842
|
i18n;
|
|
4819
|
-
constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
4843
|
+
constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, isVoid, i18n) {
|
|
4820
4844
|
this.name = name;
|
|
4821
4845
|
this.attributes = attributes;
|
|
4822
4846
|
this.inputs = inputs;
|
|
@@ -4828,6 +4852,7 @@ let Element$1 = class Element {
|
|
|
4828
4852
|
this.sourceSpan = sourceSpan;
|
|
4829
4853
|
this.startSourceSpan = startSourceSpan;
|
|
4830
4854
|
this.endSourceSpan = endSourceSpan;
|
|
4855
|
+
this.isVoid = isVoid;
|
|
4831
4856
|
this.i18n = i18n;
|
|
4832
4857
|
}
|
|
4833
4858
|
visit(visitor) {
|
|
@@ -8741,6 +8766,22 @@ var OpKind;
|
|
|
8741
8766
|
* Creation op that attaches the location at which an element was defined in a template to it.
|
|
8742
8767
|
*/
|
|
8743
8768
|
OpKind[OpKind["SourceLocation"] = 52] = "SourceLocation";
|
|
8769
|
+
/**
|
|
8770
|
+
* An operation to bind animation css classes to an element.
|
|
8771
|
+
*/
|
|
8772
|
+
OpKind[OpKind["Animation"] = 53] = "Animation";
|
|
8773
|
+
/**
|
|
8774
|
+
* An operation to bind animation css classes to an element.
|
|
8775
|
+
*/
|
|
8776
|
+
OpKind[OpKind["AnimationString"] = 54] = "AnimationString";
|
|
8777
|
+
/**
|
|
8778
|
+
* An operation to bind animation css classes to an element.
|
|
8779
|
+
*/
|
|
8780
|
+
OpKind[OpKind["AnimationBinding"] = 55] = "AnimationBinding";
|
|
8781
|
+
/**
|
|
8782
|
+
* An operation to bind animation events to an element.
|
|
8783
|
+
*/
|
|
8784
|
+
OpKind[OpKind["AnimationListener"] = 56] = "AnimationListener";
|
|
8744
8785
|
})(OpKind || (OpKind = {}));
|
|
8745
8786
|
/**
|
|
8746
8787
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -8931,6 +8972,10 @@ var BindingKind;
|
|
|
8931
8972
|
* Property side of a two-way binding.
|
|
8932
8973
|
*/
|
|
8933
8974
|
BindingKind[BindingKind["TwoWayProperty"] = 7] = "TwoWayProperty";
|
|
8975
|
+
/**
|
|
8976
|
+
* Property side of an animation binding.
|
|
8977
|
+
*/
|
|
8978
|
+
BindingKind[BindingKind["Animation"] = 8] = "Animation";
|
|
8934
8979
|
})(BindingKind || (BindingKind = {}));
|
|
8935
8980
|
/**
|
|
8936
8981
|
* Enumeration of possible times i18n params can be resolved.
|
|
@@ -9171,13 +9216,13 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
|
|
|
9171
9216
|
/**
|
|
9172
9217
|
* Create a `PropertyOp`.
|
|
9173
9218
|
*/
|
|
9174
|
-
function createPropertyOp(target, name, expression,
|
|
9219
|
+
function createPropertyOp(target, name, expression, bindingKind, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
|
|
9175
9220
|
return {
|
|
9176
9221
|
kind: OpKind.Property,
|
|
9177
9222
|
target,
|
|
9178
9223
|
name,
|
|
9179
9224
|
expression,
|
|
9180
|
-
|
|
9225
|
+
bindingKind,
|
|
9181
9226
|
securityContext,
|
|
9182
9227
|
sanitizer: null,
|
|
9183
9228
|
isStructuralTemplateAttribute,
|
|
@@ -9328,6 +9373,24 @@ function createRepeaterOp(repeaterCreate, targetSlot, collection, sourceSpan) {
|
|
|
9328
9373
|
...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
|
|
9329
9374
|
};
|
|
9330
9375
|
}
|
|
9376
|
+
/**
|
|
9377
|
+
* Create an `AnimationBindingOp`.
|
|
9378
|
+
*/
|
|
9379
|
+
function createAnimationBindingOp(name, target, animationKind, expression, securityContext, sourceSpan, animationBindingKind) {
|
|
9380
|
+
return {
|
|
9381
|
+
kind: OpKind.AnimationBinding,
|
|
9382
|
+
name,
|
|
9383
|
+
target,
|
|
9384
|
+
animationKind,
|
|
9385
|
+
expression,
|
|
9386
|
+
i18nMessage: null,
|
|
9387
|
+
securityContext,
|
|
9388
|
+
sanitizer: null,
|
|
9389
|
+
sourceSpan,
|
|
9390
|
+
animationBindingKind,
|
|
9391
|
+
...NEW_OP,
|
|
9392
|
+
};
|
|
9393
|
+
}
|
|
9331
9394
|
function createDeferWhenOp(target, expr, modifier, sourceSpan) {
|
|
9332
9395
|
return {
|
|
9333
9396
|
kind: OpKind.DeferWhen,
|
|
@@ -10158,6 +10221,8 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10158
10221
|
case OpKind.StyleMap:
|
|
10159
10222
|
case OpKind.ClassProp:
|
|
10160
10223
|
case OpKind.ClassMap:
|
|
10224
|
+
case OpKind.AnimationString:
|
|
10225
|
+
case OpKind.AnimationBinding:
|
|
10161
10226
|
case OpKind.Binding:
|
|
10162
10227
|
if (op.expression instanceof Interpolation) {
|
|
10163
10228
|
transformExpressionsInInterpolation(op.expression, transform, flags);
|
|
@@ -10210,6 +10275,8 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10210
10275
|
op.contextValue = transformExpressionsInExpression(op.contextValue, transform, flags);
|
|
10211
10276
|
}
|
|
10212
10277
|
break;
|
|
10278
|
+
case OpKind.Animation:
|
|
10279
|
+
case OpKind.AnimationListener:
|
|
10213
10280
|
case OpKind.Listener:
|
|
10214
10281
|
case OpKind.TwoWayListener:
|
|
10215
10282
|
for (const innerOp of op.handlerOps) {
|
|
@@ -10861,6 +10928,43 @@ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
|
10861
10928
|
...NEW_OP,
|
|
10862
10929
|
};
|
|
10863
10930
|
}
|
|
10931
|
+
/**
|
|
10932
|
+
* Create an `AnimationOp`.
|
|
10933
|
+
*/
|
|
10934
|
+
function createAnimationStringOp(name, target, animationKind, expression, securityContext, sourceSpan) {
|
|
10935
|
+
return {
|
|
10936
|
+
kind: OpKind.AnimationString,
|
|
10937
|
+
name,
|
|
10938
|
+
target,
|
|
10939
|
+
animationKind,
|
|
10940
|
+
expression,
|
|
10941
|
+
i18nMessage: null,
|
|
10942
|
+
securityContext,
|
|
10943
|
+
sanitizer: null,
|
|
10944
|
+
sourceSpan,
|
|
10945
|
+
...NEW_OP,
|
|
10946
|
+
};
|
|
10947
|
+
}
|
|
10948
|
+
/**
|
|
10949
|
+
* Create an `AnimationOp`.
|
|
10950
|
+
*/
|
|
10951
|
+
function createAnimationOp(name, target, animationKind, callbackOps, securityContext, sourceSpan) {
|
|
10952
|
+
const handlerOps = new OpList();
|
|
10953
|
+
handlerOps.push(callbackOps);
|
|
10954
|
+
return {
|
|
10955
|
+
kind: OpKind.Animation,
|
|
10956
|
+
name,
|
|
10957
|
+
target,
|
|
10958
|
+
animationKind,
|
|
10959
|
+
handlerOps,
|
|
10960
|
+
handlerFnName: null,
|
|
10961
|
+
i18nMessage: null,
|
|
10962
|
+
securityContext,
|
|
10963
|
+
sanitizer: null,
|
|
10964
|
+
sourceSpan,
|
|
10965
|
+
...NEW_OP,
|
|
10966
|
+
};
|
|
10967
|
+
}
|
|
10864
10968
|
/**
|
|
10865
10969
|
* Create a `ListenerOp`. Host bindings reuse all the listener logic.
|
|
10866
10970
|
*/
|
|
@@ -10884,6 +10988,28 @@ function createListenerOp(target, targetSlot, name, tag, handlerOps, legacyAnima
|
|
|
10884
10988
|
...NEW_OP,
|
|
10885
10989
|
};
|
|
10886
10990
|
}
|
|
10991
|
+
/**
|
|
10992
|
+
* Create a `ListenerOp`. Host bindings reuse all the listener logic.
|
|
10993
|
+
*/
|
|
10994
|
+
function createAnimationListenerOp(target, targetSlot, name, tag, handlerOps, animationKind, eventTarget, hostListener, sourceSpan) {
|
|
10995
|
+
const handlerList = new OpList();
|
|
10996
|
+
handlerList.push(handlerOps);
|
|
10997
|
+
return {
|
|
10998
|
+
kind: OpKind.AnimationListener,
|
|
10999
|
+
target,
|
|
11000
|
+
targetSlot,
|
|
11001
|
+
tag,
|
|
11002
|
+
hostListener,
|
|
11003
|
+
name,
|
|
11004
|
+
animationKind,
|
|
11005
|
+
handlerOps: handlerList,
|
|
11006
|
+
handlerFnName: null,
|
|
11007
|
+
consumesDollarEvent: false,
|
|
11008
|
+
eventTarget,
|
|
11009
|
+
sourceSpan,
|
|
11010
|
+
...NEW_OP,
|
|
11011
|
+
};
|
|
11012
|
+
}
|
|
10887
11013
|
/**
|
|
10888
11014
|
* Create a `TwoWayListenerOp`.
|
|
10889
11015
|
*/
|
|
@@ -11133,12 +11259,12 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
11133
11259
|
};
|
|
11134
11260
|
}
|
|
11135
11261
|
|
|
11136
|
-
function createDomPropertyOp(name, expression,
|
|
11262
|
+
function createDomPropertyOp(name, expression, bindingKind, i18nContext, securityContext, sourceSpan) {
|
|
11137
11263
|
return {
|
|
11138
11264
|
kind: OpKind.DomProperty,
|
|
11139
11265
|
name,
|
|
11140
11266
|
expression,
|
|
11141
|
-
|
|
11267
|
+
bindingKind,
|
|
11142
11268
|
i18nContext,
|
|
11143
11269
|
securityContext,
|
|
11144
11270
|
sanitizer: null,
|
|
@@ -11305,7 +11431,10 @@ class CompilationUnit {
|
|
|
11305
11431
|
*ops() {
|
|
11306
11432
|
for (const op of this.create) {
|
|
11307
11433
|
yield op;
|
|
11308
|
-
if (op.kind === OpKind.Listener ||
|
|
11434
|
+
if (op.kind === OpKind.Listener ||
|
|
11435
|
+
op.kind === OpKind.Animation ||
|
|
11436
|
+
op.kind === OpKind.AnimationListener ||
|
|
11437
|
+
op.kind === OpKind.TwoWayListener) {
|
|
11309
11438
|
for (const listenerOp of op.handlerOps) {
|
|
11310
11439
|
yield listenerOp;
|
|
11311
11440
|
}
|
|
@@ -11585,7 +11714,8 @@ function extractAttributes(job) {
|
|
|
11585
11714
|
extractAttributeOp(unit, op, elements);
|
|
11586
11715
|
break;
|
|
11587
11716
|
case OpKind.Property:
|
|
11588
|
-
if (
|
|
11717
|
+
if (op.bindingKind !== BindingKind.LegacyAnimation &&
|
|
11718
|
+
op.bindingKind !== BindingKind.Animation) {
|
|
11589
11719
|
let bindingKind;
|
|
11590
11720
|
if (op.i18nMessage !== null && op.templateKind === null) {
|
|
11591
11721
|
// If the binding has an i18n context, it is an i18n attribute, and should have that
|
|
@@ -11603,14 +11733,14 @@ function extractAttributes(job) {
|
|
|
11603
11733
|
createExtractedAttributeOp(op.target, bindingKind, null, op.name,
|
|
11604
11734
|
/* expression */ null,
|
|
11605
11735
|
/* i18nContext */ null,
|
|
11606
|
-
/* i18nMessage */ null, op.securityContext), lookupElement$
|
|
11736
|
+
/* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
|
|
11607
11737
|
}
|
|
11608
11738
|
break;
|
|
11609
11739
|
case OpKind.TwoWayProperty:
|
|
11610
11740
|
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name,
|
|
11611
11741
|
/* expression */ null,
|
|
11612
11742
|
/* i18nContext */ null,
|
|
11613
|
-
/* i18nMessage */ null, op.securityContext), lookupElement$
|
|
11743
|
+
/* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
|
|
11614
11744
|
break;
|
|
11615
11745
|
case OpKind.StyleProp:
|
|
11616
11746
|
case OpKind.ClassProp:
|
|
@@ -11623,7 +11753,7 @@ function extractAttributes(job) {
|
|
|
11623
11753
|
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name,
|
|
11624
11754
|
/* expression */ null,
|
|
11625
11755
|
/* i18nContext */ null,
|
|
11626
|
-
/* i18nMessage */ null, SecurityContext.STYLE), lookupElement$
|
|
11756
|
+
/* i18nMessage */ null, SecurityContext.STYLE), lookupElement$3(elements, op.target));
|
|
11627
11757
|
}
|
|
11628
11758
|
break;
|
|
11629
11759
|
case OpKind.Listener:
|
|
@@ -11643,7 +11773,7 @@ function extractAttributes(job) {
|
|
|
11643
11773
|
unit.create.push(extractedAttributeOp);
|
|
11644
11774
|
}
|
|
11645
11775
|
else {
|
|
11646
|
-
OpList.insertBefore(extractedAttributeOp, lookupElement$
|
|
11776
|
+
OpList.insertBefore(extractedAttributeOp, lookupElement$3(elements, op.target));
|
|
11647
11777
|
}
|
|
11648
11778
|
}
|
|
11649
11779
|
break;
|
|
@@ -11654,7 +11784,7 @@ function extractAttributes(job) {
|
|
|
11654
11784
|
/* expression */ null,
|
|
11655
11785
|
/* i18nContext */ null,
|
|
11656
11786
|
/* i18nMessage */ null, SecurityContext.NONE);
|
|
11657
|
-
OpList.insertBefore(extractedAttributeOp, lookupElement$
|
|
11787
|
+
OpList.insertBefore(extractedAttributeOp, lookupElement$3(elements, op.target));
|
|
11658
11788
|
}
|
|
11659
11789
|
break;
|
|
11660
11790
|
}
|
|
@@ -11664,7 +11794,7 @@ function extractAttributes(job) {
|
|
|
11664
11794
|
/**
|
|
11665
11795
|
* Looks up an element in the given map by xref ID.
|
|
11666
11796
|
*/
|
|
11667
|
-
function lookupElement$
|
|
11797
|
+
function lookupElement$3(elements, xref) {
|
|
11668
11798
|
const el = elements.get(xref);
|
|
11669
11799
|
if (el === undefined) {
|
|
11670
11800
|
throw new Error('All attributes should have an element-like target.');
|
|
@@ -11692,7 +11822,7 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
11692
11822
|
unit.create.push(extractedAttributeOp);
|
|
11693
11823
|
}
|
|
11694
11824
|
else {
|
|
11695
|
-
const ownerOp = lookupElement$
|
|
11825
|
+
const ownerOp = lookupElement$3(elements, op.target);
|
|
11696
11826
|
OpList.insertBefore(extractedAttributeOp, ownerOp);
|
|
11697
11827
|
}
|
|
11698
11828
|
OpList.remove(op);
|
|
@@ -11702,7 +11832,7 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
11702
11832
|
/**
|
|
11703
11833
|
* Looks up an element in the given map by xref ID.
|
|
11704
11834
|
*/
|
|
11705
|
-
function lookupElement$
|
|
11835
|
+
function lookupElement$2(elements, xref) {
|
|
11706
11836
|
const el = elements.get(xref);
|
|
11707
11837
|
if (el === undefined) {
|
|
11708
11838
|
throw new Error('All attributes should have an element-like target.');
|
|
@@ -11728,21 +11858,27 @@ function specializeBindings(job) {
|
|
|
11728
11858
|
case BindingKind.Attribute:
|
|
11729
11859
|
if (op.name === 'ngNonBindable') {
|
|
11730
11860
|
OpList.remove(op);
|
|
11731
|
-
const target = lookupElement$
|
|
11861
|
+
const target = lookupElement$2(elements, op.target);
|
|
11732
11862
|
target.nonBindable = true;
|
|
11733
11863
|
}
|
|
11864
|
+
else if (op.name.startsWith('animate.')) {
|
|
11865
|
+
OpList.replace(op, createAnimationBindingOp(op.name, op.target, op.name === 'animate.enter' ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, op.expression, op.securityContext, op.sourceSpan, 0 /* ir.AnimationBindingKind.STRING */));
|
|
11866
|
+
}
|
|
11734
11867
|
else {
|
|
11735
11868
|
const [namespace, name] = splitNsName(op.name);
|
|
11736
11869
|
OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
11737
11870
|
}
|
|
11738
11871
|
break;
|
|
11872
|
+
case BindingKind.Animation:
|
|
11873
|
+
OpList.replace(op, createAnimationBindingOp(op.name, op.target, op.name === 'animate.enter' ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, op.expression, op.securityContext, op.sourceSpan, 1 /* ir.AnimationBindingKind.VALUE */));
|
|
11874
|
+
break;
|
|
11739
11875
|
case BindingKind.Property:
|
|
11740
11876
|
case BindingKind.LegacyAnimation:
|
|
11741
11877
|
if (job.kind === CompilationJobKind.Host) {
|
|
11742
|
-
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind
|
|
11878
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11743
11879
|
}
|
|
11744
11880
|
else {
|
|
11745
|
-
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind
|
|
11881
|
+
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
11746
11882
|
}
|
|
11747
11883
|
break;
|
|
11748
11884
|
case BindingKind.TwoWayProperty:
|
|
@@ -11764,6 +11900,7 @@ function specializeBindings(job) {
|
|
|
11764
11900
|
}
|
|
11765
11901
|
|
|
11766
11902
|
const CHAIN_COMPATIBILITY = new Map([
|
|
11903
|
+
[Identifiers.ariaProperty, Identifiers.ariaProperty],
|
|
11767
11904
|
[Identifiers.attribute, Identifiers.attribute],
|
|
11768
11905
|
[Identifiers.classProp, Identifiers.classProp],
|
|
11769
11906
|
[Identifiers.element, Identifiers.element],
|
|
@@ -11794,6 +11931,10 @@ const CHAIN_COMPATIBILITY = new Map([
|
|
|
11794
11931
|
[Identifiers.domElementContainerEnd, Identifiers.domElementContainerEnd],
|
|
11795
11932
|
[Identifiers.domListener, Identifiers.domListener],
|
|
11796
11933
|
[Identifiers.domTemplate, Identifiers.domTemplate],
|
|
11934
|
+
[Identifiers.animationEnter, Identifiers.animationEnter],
|
|
11935
|
+
[Identifiers.animationLeave, Identifiers.animationLeave],
|
|
11936
|
+
[Identifiers.animationEnterListener, Identifiers.animationEnterListener],
|
|
11937
|
+
[Identifiers.animationLeaveListener, Identifiers.animationLeaveListener],
|
|
11797
11938
|
]);
|
|
11798
11939
|
/**
|
|
11799
11940
|
* Chaining results in repeated call expressions, causing a deep AST of receiver expressions. To prevent running out of
|
|
@@ -12214,6 +12355,52 @@ function serializeAttributes({ attributes, bindings, classes, i18n, projectAs, s
|
|
|
12214
12355
|
return literalArr(attrArray);
|
|
12215
12356
|
}
|
|
12216
12357
|
|
|
12358
|
+
/**
|
|
12359
|
+
* Looks up an element in the given map by xref ID.
|
|
12360
|
+
*/
|
|
12361
|
+
function lookupElement$1(elements, xref) {
|
|
12362
|
+
const el = elements.get(xref);
|
|
12363
|
+
if (el === undefined) {
|
|
12364
|
+
throw new Error('All attributes should have an element-like target.');
|
|
12365
|
+
}
|
|
12366
|
+
return el;
|
|
12367
|
+
}
|
|
12368
|
+
function convertAnimations(job) {
|
|
12369
|
+
const elements = new Map();
|
|
12370
|
+
for (const unit of job.units) {
|
|
12371
|
+
for (const op of unit.create) {
|
|
12372
|
+
if (!isElementOrContainerOp(op)) {
|
|
12373
|
+
continue;
|
|
12374
|
+
}
|
|
12375
|
+
elements.set(op.xref, op);
|
|
12376
|
+
}
|
|
12377
|
+
}
|
|
12378
|
+
for (const unit of job.units) {
|
|
12379
|
+
for (const op of unit.ops()) {
|
|
12380
|
+
if (op.kind === OpKind.AnimationBinding) {
|
|
12381
|
+
const createAnimationOp = getAnimationOp(op);
|
|
12382
|
+
if (job.kind === CompilationJobKind.Host) {
|
|
12383
|
+
unit.create.push(createAnimationOp);
|
|
12384
|
+
}
|
|
12385
|
+
else {
|
|
12386
|
+
OpList.insertAfter(createAnimationOp, lookupElement$1(elements, op.target));
|
|
12387
|
+
}
|
|
12388
|
+
OpList.remove(op);
|
|
12389
|
+
}
|
|
12390
|
+
}
|
|
12391
|
+
}
|
|
12392
|
+
}
|
|
12393
|
+
function getAnimationOp(op) {
|
|
12394
|
+
if (op.animationBindingKind === 0 /* ir.AnimationBindingKind.STRING */) {
|
|
12395
|
+
// this is a simple string case
|
|
12396
|
+
return createAnimationStringOp(op.name, op.target, op.name === 'animate.enter' ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, op.expression, op.securityContext, op.sourceSpan);
|
|
12397
|
+
}
|
|
12398
|
+
else {
|
|
12399
|
+
const expression = op.expression;
|
|
12400
|
+
return createAnimationOp(op.name, op.target, op.name === 'animate.enter' ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, [createStatementOp(new ReturnStatement(expression, expression.sourceSpan))], op.securityContext, op.sourceSpan);
|
|
12401
|
+
}
|
|
12402
|
+
}
|
|
12403
|
+
|
|
12217
12404
|
/**
|
|
12218
12405
|
* Some binding instructions in the update block may actually correspond to i18n bindings. In that
|
|
12219
12406
|
* case, they should be replaced with i18nExp instructions for the dynamic portions.
|
|
@@ -13102,6 +13289,8 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
13102
13289
|
op.trackByOps.prepend(generateVariablesInScopeForView(view, scope, false));
|
|
13103
13290
|
}
|
|
13104
13291
|
break;
|
|
13292
|
+
case OpKind.Animation:
|
|
13293
|
+
case OpKind.AnimationListener:
|
|
13105
13294
|
case OpKind.Listener:
|
|
13106
13295
|
case OpKind.TwoWayListener:
|
|
13107
13296
|
// Prepend variables to listener handler functions.
|
|
@@ -13184,7 +13373,7 @@ function getScopeForView(view, parent) {
|
|
|
13184
13373
|
* This is a recursive process, as views inherit variables available from their parent view, which
|
|
13185
13374
|
* itself may have inherited variables, etc.
|
|
13186
13375
|
*/
|
|
13187
|
-
function generateVariablesInScopeForView(view, scope,
|
|
13376
|
+
function generateVariablesInScopeForView(view, scope, isCallback) {
|
|
13188
13377
|
const newOps = [];
|
|
13189
13378
|
if (scope.view !== view.xref) {
|
|
13190
13379
|
// Before generating variables for a parent view, we need to switch to the context of the parent
|
|
@@ -13208,7 +13397,7 @@ function generateVariablesInScopeForView(view, scope, isListener) {
|
|
|
13208
13397
|
for (const ref of scope.references) {
|
|
13209
13398
|
newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.targetSlot, ref.offset), VariableFlags.None));
|
|
13210
13399
|
}
|
|
13211
|
-
if (scope.view !== view.xref ||
|
|
13400
|
+
if (scope.view !== view.xref || isCallback) {
|
|
13212
13401
|
for (const decl of scope.letDeclarations) {
|
|
13213
13402
|
newOps.push(createVariableOp(view.job.allocateXrefId(), decl.variable, new ContextLetReferenceExpr(decl.targetId, decl.targetSlot), VariableFlags.None));
|
|
13214
13403
|
}
|
|
@@ -13438,7 +13627,8 @@ class Element extends NodeWithI18n {
|
|
|
13438
13627
|
isSelfClosing;
|
|
13439
13628
|
startSourceSpan;
|
|
13440
13629
|
endSourceSpan;
|
|
13441
|
-
|
|
13630
|
+
isVoid;
|
|
13631
|
+
constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, isVoid, i18n) {
|
|
13442
13632
|
super(sourceSpan, i18n);
|
|
13443
13633
|
this.name = name;
|
|
13444
13634
|
this.attrs = attrs;
|
|
@@ -13447,6 +13637,7 @@ class Element extends NodeWithI18n {
|
|
|
13447
13637
|
this.isSelfClosing = isSelfClosing;
|
|
13448
13638
|
this.startSourceSpan = startSourceSpan;
|
|
13449
13639
|
this.endSourceSpan = endSourceSpan;
|
|
13640
|
+
this.isVoid = isVoid;
|
|
13450
13641
|
}
|
|
13451
13642
|
visit(visitor, context) {
|
|
13452
13643
|
return visitor.visitElement(this, context);
|
|
@@ -15784,6 +15975,19 @@ var CharacterReferenceType;
|
|
|
15784
15975
|
CharacterReferenceType["HEX"] = "hexadecimal";
|
|
15785
15976
|
CharacterReferenceType["DEC"] = "decimal";
|
|
15786
15977
|
})(CharacterReferenceType || (CharacterReferenceType = {}));
|
|
15978
|
+
const SUPPORTED_BLOCKS = [
|
|
15979
|
+
'@if',
|
|
15980
|
+
'@else', // Covers `@else if` as well
|
|
15981
|
+
'@for',
|
|
15982
|
+
'@switch',
|
|
15983
|
+
'@case',
|
|
15984
|
+
'@default',
|
|
15985
|
+
'@empty',
|
|
15986
|
+
'@defer',
|
|
15987
|
+
'@placeholder',
|
|
15988
|
+
'@loading',
|
|
15989
|
+
'@error',
|
|
15990
|
+
];
|
|
15787
15991
|
// See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
|
|
15788
15992
|
class _Tokenizer {
|
|
15789
15993
|
_getTagDefinition;
|
|
@@ -15874,10 +16078,10 @@ class _Tokenizer {
|
|
|
15874
16078
|
// don't want to advance in case it's not `@let`.
|
|
15875
16079
|
this._cursor.peek() === $AT &&
|
|
15876
16080
|
!this._inInterpolation &&
|
|
15877
|
-
this.
|
|
16081
|
+
this._isLetStart()) {
|
|
15878
16082
|
this._consumeLetDeclaration(start);
|
|
15879
16083
|
}
|
|
15880
|
-
else if (this._tokenizeBlocks && this.
|
|
16084
|
+
else if (this._tokenizeBlocks && this._isBlockStart()) {
|
|
15881
16085
|
this._consumeBlockStart(start);
|
|
15882
16086
|
}
|
|
15883
16087
|
else if (this._tokenizeBlocks &&
|
|
@@ -15917,6 +16121,7 @@ class _Tokenizer {
|
|
|
15917
16121
|
return this._cursor.getChars(nameCursor).trim();
|
|
15918
16122
|
}
|
|
15919
16123
|
_consumeBlockStart(start) {
|
|
16124
|
+
this._requireCharCode($AT);
|
|
15920
16125
|
this._beginToken(24 /* TokenType.BLOCK_OPEN_START */, start);
|
|
15921
16126
|
const startToken = this._endToken([this._getBlockName()]);
|
|
15922
16127
|
if (this._cursor.peek() === $LPAREN) {
|
|
@@ -15989,6 +16194,7 @@ class _Tokenizer {
|
|
|
15989
16194
|
}
|
|
15990
16195
|
}
|
|
15991
16196
|
_consumeLetDeclaration(start) {
|
|
16197
|
+
this._requireStr('@let');
|
|
15992
16198
|
this._beginToken(29 /* TokenType.LET_START */, start);
|
|
15993
16199
|
// Require at least one white space after the `@let`.
|
|
15994
16200
|
if (isWhitespace(this._cursor.peek())) {
|
|
@@ -16202,6 +16408,27 @@ class _Tokenizer {
|
|
|
16202
16408
|
this._cursor.advance();
|
|
16203
16409
|
return char;
|
|
16204
16410
|
}
|
|
16411
|
+
_peekStr(chars) {
|
|
16412
|
+
const len = chars.length;
|
|
16413
|
+
if (this._cursor.charsLeft() < len) {
|
|
16414
|
+
return false;
|
|
16415
|
+
}
|
|
16416
|
+
const cursor = this._cursor.clone();
|
|
16417
|
+
for (let i = 0; i < len; i++) {
|
|
16418
|
+
if (cursor.peek() !== chars.charCodeAt(i)) {
|
|
16419
|
+
return false;
|
|
16420
|
+
}
|
|
16421
|
+
cursor.advance();
|
|
16422
|
+
}
|
|
16423
|
+
return true;
|
|
16424
|
+
}
|
|
16425
|
+
_isBlockStart() {
|
|
16426
|
+
return (this._cursor.peek() === $AT &&
|
|
16427
|
+
SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName)));
|
|
16428
|
+
}
|
|
16429
|
+
_isLetStart() {
|
|
16430
|
+
return this._cursor.peek() === $AT && this._peekStr('@let');
|
|
16431
|
+
}
|
|
16205
16432
|
_consumeEntity(textTokenType) {
|
|
16206
16433
|
this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
|
|
16207
16434
|
const start = this._cursor.clone();
|
|
@@ -16469,6 +16696,23 @@ class _Tokenizer {
|
|
|
16469
16696
|
return isNameEnd(code);
|
|
16470
16697
|
};
|
|
16471
16698
|
}
|
|
16699
|
+
else if (attrNameStart === $LBRACKET) {
|
|
16700
|
+
let openBrackets = 0;
|
|
16701
|
+
// Be more permissive for which characters are allowed inside square-bracketed attributes,
|
|
16702
|
+
// because they usually end up being bound as attribute values. Some third-party packages
|
|
16703
|
+
// like Tailwind take advantage of this.
|
|
16704
|
+
nameEndPredicate = (code) => {
|
|
16705
|
+
if (code === $LBRACKET) {
|
|
16706
|
+
openBrackets++;
|
|
16707
|
+
}
|
|
16708
|
+
else if (code === $RBRACKET) {
|
|
16709
|
+
openBrackets--;
|
|
16710
|
+
}
|
|
16711
|
+
// Only check for name-ending characters if the brackets are balanced or mismatched.
|
|
16712
|
+
// Also interrupt the matching on new lines.
|
|
16713
|
+
return openBrackets <= 0 ? isNameEnd(code) : isNewLine(code);
|
|
16714
|
+
};
|
|
16715
|
+
}
|
|
16472
16716
|
else {
|
|
16473
16717
|
nameEndPredicate = isNameEnd;
|
|
16474
16718
|
}
|
|
@@ -16748,7 +16992,7 @@ class _Tokenizer {
|
|
|
16748
16992
|
if (this._tokenizeBlocks &&
|
|
16749
16993
|
!this._inInterpolation &&
|
|
16750
16994
|
!this._isInExpansion() &&
|
|
16751
|
-
(this.
|
|
16995
|
+
(this._isBlockStart() || this._isLetStart() || this._cursor.peek() === $RBRACE)) {
|
|
16752
16996
|
return true;
|
|
16753
16997
|
}
|
|
16754
16998
|
return false;
|
|
@@ -17385,13 +17629,13 @@ class _TreeBuilder {
|
|
|
17385
17629
|
const directives = [];
|
|
17386
17630
|
this._consumeAttributesAndDirectives(attrs, directives);
|
|
17387
17631
|
const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
|
|
17632
|
+
const tagDef = this._getTagDefinition(fullName);
|
|
17388
17633
|
let selfClosing = false;
|
|
17389
17634
|
// Note: There could have been a tokenizer error
|
|
17390
17635
|
// so that we don't get a token for the end tag...
|
|
17391
17636
|
if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
|
|
17392
17637
|
this._advance();
|
|
17393
17638
|
selfClosing = true;
|
|
17394
|
-
const tagDef = this._getTagDefinition(fullName);
|
|
17395
17639
|
if (!(tagDef?.canSelfClose || getNsPrefix(fullName) !== null || tagDef?.isVoid)) {
|
|
17396
17640
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
17397
17641
|
}
|
|
@@ -17404,7 +17648,7 @@ class _TreeBuilder {
|
|
|
17404
17648
|
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17405
17649
|
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
|
17406
17650
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17407
|
-
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined);
|
|
17651
|
+
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined, tagDef?.isVoid ?? false);
|
|
17408
17652
|
const parent = this._getContainer();
|
|
17409
17653
|
const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
|
|
17410
17654
|
this._pushContainer(el, isClosedByChild);
|
|
@@ -17847,11 +18091,11 @@ class WhitespaceVisitor {
|
|
|
17847
18091
|
if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
|
|
17848
18092
|
// don't descent into elements where we need to preserve whitespaces
|
|
17849
18093
|
// but still visit all attributes to eliminate one used as a market to preserve WS
|
|
17850
|
-
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
18094
|
+
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
17851
18095
|
this.originalNodeMap?.set(newElement, element);
|
|
17852
18096
|
return newElement;
|
|
17853
18097
|
}
|
|
17854
|
-
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
18098
|
+
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
17855
18099
|
this.originalNodeMap?.set(newElement, element);
|
|
17856
18100
|
return newElement;
|
|
17857
18101
|
}
|
|
@@ -19498,12 +19742,13 @@ class _ParseAST {
|
|
|
19498
19742
|
else {
|
|
19499
19743
|
if (this.isAssignmentOperator(this.next)) {
|
|
19500
19744
|
const operation = this.next.strValue;
|
|
19501
|
-
this.advance();
|
|
19502
19745
|
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
19746
|
+
this.advance();
|
|
19503
19747
|
this.error('Bindings cannot contain assignments');
|
|
19504
19748
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
19505
19749
|
}
|
|
19506
19750
|
const receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
19751
|
+
this.advance();
|
|
19507
19752
|
const value = this.parseConditional();
|
|
19508
19753
|
return new Binary(this.span(start), this.sourceSpan(start), operation, receiver, value);
|
|
19509
19754
|
}
|
|
@@ -19622,12 +19867,13 @@ class _ParseAST {
|
|
|
19622
19867
|
this.expectCharacter($RBRACKET);
|
|
19623
19868
|
if (this.isAssignmentOperator(this.next)) {
|
|
19624
19869
|
const operation = this.next.strValue;
|
|
19625
|
-
this.advance();
|
|
19626
19870
|
if (isSafe) {
|
|
19871
|
+
this.advance();
|
|
19627
19872
|
this.error("The '?.' operator cannot be used in the assignment");
|
|
19628
19873
|
}
|
|
19629
19874
|
else {
|
|
19630
19875
|
const binaryReceiver = new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
|
|
19876
|
+
this.advance();
|
|
19631
19877
|
const value = this.parseConditional();
|
|
19632
19878
|
return new Binary(this.span(start), this.sourceSpan(start), operation, binaryReceiver, value);
|
|
19633
19879
|
}
|
|
@@ -20390,6 +20636,44 @@ const _ATTR_TO_PROP = new Map(Object.entries({
|
|
|
20390
20636
|
'innerHtml': 'innerHTML',
|
|
20391
20637
|
'readonly': 'readOnly',
|
|
20392
20638
|
'tabindex': 'tabIndex',
|
|
20639
|
+
// https://www.w3.org/TR/wai-aria-1.2/#accessibilityroleandproperties-correspondence
|
|
20640
|
+
'aria-atomic': 'ariaAtomic',
|
|
20641
|
+
'aria-autocomplete': 'ariaAutoComplete',
|
|
20642
|
+
'aria-busy': 'ariaBusy',
|
|
20643
|
+
'aria-checked': 'ariaChecked',
|
|
20644
|
+
'aria-colcount': 'ariaColCount',
|
|
20645
|
+
'aria-colindex': 'ariaColIndex',
|
|
20646
|
+
'aria-colspan': 'ariaColSpan',
|
|
20647
|
+
'aria-current': 'ariaCurrent',
|
|
20648
|
+
'aria-disabled': 'ariaDisabled',
|
|
20649
|
+
'aria-expanded': 'ariaExpanded',
|
|
20650
|
+
'aria-haspopup': 'ariaHasPopup',
|
|
20651
|
+
'aria-hidden': 'ariaHidden',
|
|
20652
|
+
'aria-invalid': 'ariaInvalid',
|
|
20653
|
+
'aria-keyshortcuts': 'ariaKeyShortcuts',
|
|
20654
|
+
'aria-label': 'ariaLabel',
|
|
20655
|
+
'aria-level': 'ariaLevel',
|
|
20656
|
+
'aria-live': 'ariaLive',
|
|
20657
|
+
'aria-modal': 'ariaModal',
|
|
20658
|
+
'aria-multiline': 'ariaMultiLine',
|
|
20659
|
+
'aria-multiselectable': 'ariaMultiSelectable',
|
|
20660
|
+
'aria-orientation': 'ariaOrientation',
|
|
20661
|
+
'aria-placeholder': 'ariaPlaceholder',
|
|
20662
|
+
'aria-posinset': 'ariaPosInSet',
|
|
20663
|
+
'aria-pressed': 'ariaPressed',
|
|
20664
|
+
'aria-readonly': 'ariaReadOnly',
|
|
20665
|
+
'aria-required': 'ariaRequired',
|
|
20666
|
+
'aria-roledescription': 'ariaRoleDescription',
|
|
20667
|
+
'aria-rowcount': 'ariaRowCount',
|
|
20668
|
+
'aria-rowindex': 'ariaRowIndex',
|
|
20669
|
+
'aria-rowspan': 'ariaRowSpan',
|
|
20670
|
+
'aria-selected': 'ariaSelected',
|
|
20671
|
+
'aria-setsize': 'ariaSetSize',
|
|
20672
|
+
'aria-sort': 'ariaSort',
|
|
20673
|
+
'aria-valuemax': 'ariaValueMax',
|
|
20674
|
+
'aria-valuemin': 'ariaValueMin',
|
|
20675
|
+
'aria-valuenow': 'ariaValueNow',
|
|
20676
|
+
'aria-valuetext': 'ariaValueText',
|
|
20393
20677
|
}));
|
|
20394
20678
|
// Invert _ATTR_TO_PROP.
|
|
20395
20679
|
const _PROP_TO_ATTR = Array.from(_ATTR_TO_PROP).reduce((inverted, [propertyName, attributeName]) => {
|
|
@@ -22336,10 +22620,33 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22336
22620
|
switch (op.kind) {
|
|
22337
22621
|
case OpKind.Property:
|
|
22338
22622
|
case OpKind.DomProperty:
|
|
22339
|
-
if (op.
|
|
22623
|
+
if (op.bindingKind === BindingKind.LegacyAnimation) {
|
|
22340
22624
|
op.name = '@' + op.name;
|
|
22341
22625
|
}
|
|
22342
22626
|
break;
|
|
22627
|
+
case OpKind.Animation:
|
|
22628
|
+
if (op.handlerFnName === null) {
|
|
22629
|
+
const animationKind = op.name.replace('.', '');
|
|
22630
|
+
op.handlerFnName = `${unit.fnName}_${animationKind}_cb`;
|
|
22631
|
+
op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
|
|
22632
|
+
}
|
|
22633
|
+
break;
|
|
22634
|
+
case OpKind.AnimationListener:
|
|
22635
|
+
if (op.handlerFnName !== null) {
|
|
22636
|
+
break;
|
|
22637
|
+
}
|
|
22638
|
+
if (!op.hostListener && op.targetSlot.slot === null) {
|
|
22639
|
+
throw new Error(`Expected a slot to be assigned`);
|
|
22640
|
+
}
|
|
22641
|
+
const animationKind = op.name.replace('.', '');
|
|
22642
|
+
if (op.hostListener) {
|
|
22643
|
+
op.handlerFnName = `${baseName}_${animationKind}_HostBindingHandler`;
|
|
22644
|
+
}
|
|
22645
|
+
else {
|
|
22646
|
+
op.handlerFnName = `${unit.fnName}_${op.tag.replace('-', '_')}_${animationKind}_${op.targetSlot.slot}_listener`;
|
|
22647
|
+
}
|
|
22648
|
+
op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
|
|
22649
|
+
break;
|
|
22343
22650
|
case OpKind.Listener:
|
|
22344
22651
|
if (op.handlerFnName !== null) {
|
|
22345
22652
|
break;
|
|
@@ -22497,7 +22804,10 @@ function stripImportant(name) {
|
|
|
22497
22804
|
function mergeNextContextExpressions(job) {
|
|
22498
22805
|
for (const unit of job.units) {
|
|
22499
22806
|
for (const op of unit.create) {
|
|
22500
|
-
if (op.kind === OpKind.Listener ||
|
|
22807
|
+
if (op.kind === OpKind.Listener ||
|
|
22808
|
+
op.kind === OpKind.Animation ||
|
|
22809
|
+
op.kind === OpKind.AnimationListener ||
|
|
22810
|
+
op.kind === OpKind.TwoWayListener) {
|
|
22501
22811
|
mergeNextContextsInOps(op.handlerOps);
|
|
22502
22812
|
}
|
|
22503
22813
|
}
|
|
@@ -22618,7 +22928,9 @@ function kindWithInterpolationTest(kind, interpolation) {
|
|
|
22618
22928
|
}
|
|
22619
22929
|
function basicListenerKindTest(op) {
|
|
22620
22930
|
return ((op.kind === OpKind.Listener && !(op.hostListener && op.isLegacyAnimationListener)) ||
|
|
22621
|
-
op.kind === OpKind.TwoWayListener
|
|
22931
|
+
op.kind === OpKind.TwoWayListener ||
|
|
22932
|
+
op.kind === OpKind.Animation ||
|
|
22933
|
+
op.kind === OpKind.AnimationListener);
|
|
22622
22934
|
}
|
|
22623
22935
|
function nonInterpolationPropertyKindTest(op) {
|
|
22624
22936
|
return ((op.kind === OpKind.Property || op.kind === OpKind.TwoWayProperty) &&
|
|
@@ -22665,6 +22977,7 @@ const UPDATE_HOST_ORDERING = [
|
|
|
22665
22977
|
const handledOpKinds = new Set([
|
|
22666
22978
|
OpKind.Listener,
|
|
22667
22979
|
OpKind.TwoWayListener,
|
|
22980
|
+
OpKind.AnimationListener,
|
|
22668
22981
|
OpKind.StyleMap,
|
|
22669
22982
|
OpKind.ClassMap,
|
|
22670
22983
|
OpKind.StyleProp,
|
|
@@ -22673,6 +22986,7 @@ const handledOpKinds = new Set([
|
|
|
22673
22986
|
OpKind.TwoWayProperty,
|
|
22674
22987
|
OpKind.DomProperty,
|
|
22675
22988
|
OpKind.Attribute,
|
|
22989
|
+
OpKind.Animation,
|
|
22676
22990
|
]);
|
|
22677
22991
|
/**
|
|
22678
22992
|
* Many type of operations have ordering constraints that must be respected. For example, a
|
|
@@ -23363,6 +23677,9 @@ function i18nAttributes(slot, i18nAttributesConfig) {
|
|
|
23363
23677
|
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
23364
23678
|
return call(Identifiers.i18nAttributes, args, null);
|
|
23365
23679
|
}
|
|
23680
|
+
function ariaProperty(name, expression, sourceSpan) {
|
|
23681
|
+
return propertyBase(Identifiers.ariaProperty, name, expression, null, sourceSpan);
|
|
23682
|
+
}
|
|
23366
23683
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
23367
23684
|
return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
|
|
23368
23685
|
}
|
|
@@ -23476,6 +23793,36 @@ function i18nApply(slot, sourceSpan) {
|
|
|
23476
23793
|
function domProperty(name, expression, sanitizer, sourceSpan) {
|
|
23477
23794
|
return propertyBase(Identifiers.domProperty, name, expression, sanitizer, sourceSpan);
|
|
23478
23795
|
}
|
|
23796
|
+
function animation(animationKind, handlerFn, sanitizer, sourceSpan) {
|
|
23797
|
+
const args = [handlerFn];
|
|
23798
|
+
if (sanitizer !== null) {
|
|
23799
|
+
args.push(sanitizer);
|
|
23800
|
+
}
|
|
23801
|
+
const identifier = animationKind === "enter" /* ir.AnimationKind.ENTER */
|
|
23802
|
+
? Identifiers.animationEnter
|
|
23803
|
+
: Identifiers.animationLeave;
|
|
23804
|
+
return call(identifier, args, sourceSpan);
|
|
23805
|
+
}
|
|
23806
|
+
function animationString(animationKind, expression, sanitizer, sourceSpan) {
|
|
23807
|
+
const value = expression instanceof Interpolation
|
|
23808
|
+
? interpolationToExpression(expression, sourceSpan)
|
|
23809
|
+
: expression;
|
|
23810
|
+
const args = [value];
|
|
23811
|
+
if (sanitizer !== null) {
|
|
23812
|
+
args.push(sanitizer);
|
|
23813
|
+
}
|
|
23814
|
+
const identifier = animationKind === "enter" /* ir.AnimationKind.ENTER */
|
|
23815
|
+
? Identifiers.animationEnter
|
|
23816
|
+
: Identifiers.animationLeave;
|
|
23817
|
+
return call(identifier, args, sourceSpan);
|
|
23818
|
+
}
|
|
23819
|
+
function animationListener(animationKind, handlerFn, eventTargetResolver, sourceSpan) {
|
|
23820
|
+
const args = [handlerFn];
|
|
23821
|
+
const identifier = animationKind === "enter" /* ir.AnimationKind.ENTER */
|
|
23822
|
+
? Identifiers.animationEnterListener
|
|
23823
|
+
: Identifiers.animationLeaveListener;
|
|
23824
|
+
return call(identifier, args, sourceSpan);
|
|
23825
|
+
}
|
|
23479
23826
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
23480
23827
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
23481
23828
|
}
|
|
@@ -23609,6 +23956,7 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
|
|
|
23609
23956
|
return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
|
|
23610
23957
|
}
|
|
23611
23958
|
|
|
23959
|
+
const ARIA_PREFIX = 'aria';
|
|
23612
23960
|
/**
|
|
23613
23961
|
* Map of target resolvers for event listeners.
|
|
23614
23962
|
*/
|
|
@@ -23722,6 +24070,18 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23722
24070
|
case OpKind.DeclareLet:
|
|
23723
24071
|
OpList.replace(op, declareLet(op.handle.slot, op.sourceSpan));
|
|
23724
24072
|
break;
|
|
24073
|
+
case OpKind.AnimationString:
|
|
24074
|
+
OpList.replace(op, animationString(op.animationKind, op.expression, op.sanitizer, op.sourceSpan));
|
|
24075
|
+
break;
|
|
24076
|
+
case OpKind.Animation:
|
|
24077
|
+
const animationCallbackFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps,
|
|
24078
|
+
/* consumesDollarEvent */ false);
|
|
24079
|
+
OpList.replace(op, animation(op.animationKind, animationCallbackFn, op.sanitizer, op.sourceSpan));
|
|
24080
|
+
break;
|
|
24081
|
+
case OpKind.AnimationListener:
|
|
24082
|
+
const animationListenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
24083
|
+
OpList.replace(op, animationListener(op.animationKind, animationListenerFn, null, op.sourceSpan));
|
|
24084
|
+
break;
|
|
23725
24085
|
case OpKind.Listener:
|
|
23726
24086
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
23727
24087
|
const eventTargetResolver = op.eventTarget
|
|
@@ -23900,9 +24260,11 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23900
24260
|
OpList.replace(op, advance(op.delta, op.sourceSpan));
|
|
23901
24261
|
break;
|
|
23902
24262
|
case OpKind.Property:
|
|
23903
|
-
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly &&
|
|
23904
|
-
|
|
23905
|
-
|
|
24263
|
+
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly &&
|
|
24264
|
+
op.bindingKind !== BindingKind.LegacyAnimation &&
|
|
24265
|
+
op.bindingKind !== BindingKind.Animation
|
|
24266
|
+
? reifyDomProperty(op)
|
|
24267
|
+
: reifyProperty(op));
|
|
23906
24268
|
break;
|
|
23907
24269
|
case OpKind.TwoWayProperty:
|
|
23908
24270
|
OpList.replace(op, twoWayProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
@@ -23936,11 +24298,12 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23936
24298
|
throw new Error('not yet handled');
|
|
23937
24299
|
}
|
|
23938
24300
|
else {
|
|
23939
|
-
if (op.
|
|
24301
|
+
if (op.bindingKind === BindingKind.LegacyAnimation ||
|
|
24302
|
+
op.bindingKind === BindingKind.Animation) {
|
|
23940
24303
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23941
24304
|
}
|
|
23942
24305
|
else {
|
|
23943
|
-
OpList.replace(op,
|
|
24306
|
+
OpList.replace(op, reifyDomProperty(op));
|
|
23944
24307
|
}
|
|
23945
24308
|
}
|
|
23946
24309
|
break;
|
|
@@ -23972,6 +24335,61 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23972
24335
|
}
|
|
23973
24336
|
}
|
|
23974
24337
|
}
|
|
24338
|
+
/**
|
|
24339
|
+
* Converts an ARIA property name to its corresponding attribute name, if necessary.
|
|
24340
|
+
*
|
|
24341
|
+
* For example, converts `ariaLabel` to `aria-label`.
|
|
24342
|
+
*
|
|
24343
|
+
* https://www.w3.org/TR/wai-aria-1.2/#accessibilityroleandproperties-correspondence
|
|
24344
|
+
*
|
|
24345
|
+
* This must be kept in sync with the the function of the same name in
|
|
24346
|
+
* packages/core/src/render3/instructions/aria_property.ts.
|
|
24347
|
+
*
|
|
24348
|
+
* @param name A property name that starts with `aria`.
|
|
24349
|
+
* @returns The corresponding attribute name.
|
|
24350
|
+
*/
|
|
24351
|
+
function ariaAttrName(name) {
|
|
24352
|
+
return name.charAt(ARIA_PREFIX.length) !== '-'
|
|
24353
|
+
? ARIA_PREFIX + '-' + name.slice(ARIA_PREFIX.length).toLowerCase()
|
|
24354
|
+
: name; // Property already has attribute name.
|
|
24355
|
+
}
|
|
24356
|
+
/**
|
|
24357
|
+
* Returns whether `name` is an ARIA property (or attribute) name.
|
|
24358
|
+
*
|
|
24359
|
+
* This is a heuristic based on whether name begins with and is longer than `aria`. For example,
|
|
24360
|
+
* this returns true for both `ariaLabel` and `aria-label`.
|
|
24361
|
+
*/
|
|
24362
|
+
function isAriaProperty(name) {
|
|
24363
|
+
return name.startsWith(ARIA_PREFIX) && name.length > ARIA_PREFIX.length;
|
|
24364
|
+
}
|
|
24365
|
+
/**
|
|
24366
|
+
* Reifies a DOM property binding operation.
|
|
24367
|
+
*
|
|
24368
|
+
* This is an optimized version of {@link reifyProperty} that avoids unnecessarily trying to bind
|
|
24369
|
+
* to directive inputs at runtime for views that don't import any directives.
|
|
24370
|
+
*
|
|
24371
|
+
* @param op A property binding operation.
|
|
24372
|
+
* @returns A statement to update the property at runtime.
|
|
24373
|
+
*/
|
|
24374
|
+
function reifyDomProperty(op) {
|
|
24375
|
+
return isAriaProperty(op.name)
|
|
24376
|
+
? attribute(ariaAttrName(op.name), op.expression, null, null, op.sourceSpan)
|
|
24377
|
+
: domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24378
|
+
}
|
|
24379
|
+
/**
|
|
24380
|
+
* Reifies a property binding operation.
|
|
24381
|
+
*
|
|
24382
|
+
* The returned statement attempts to bind to directive inputs before falling back to a DOM
|
|
24383
|
+
* property.
|
|
24384
|
+
*
|
|
24385
|
+
* @param op A property binding operation.
|
|
24386
|
+
* @returns A statement to update the property at runtime.
|
|
24387
|
+
*/
|
|
24388
|
+
function reifyProperty(op) {
|
|
24389
|
+
return isAriaProperty(op.name)
|
|
24390
|
+
? ariaProperty(op.name, op.expression, op.sourceSpan)
|
|
24391
|
+
: property(op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24392
|
+
}
|
|
23975
24393
|
function reifyIrExpression(expr) {
|
|
23976
24394
|
if (!isIrExpression(expr)) {
|
|
23977
24395
|
return expr;
|
|
@@ -24213,6 +24631,8 @@ function processLexicalScope$1(view, ops) {
|
|
|
24213
24631
|
break;
|
|
24214
24632
|
}
|
|
24215
24633
|
break;
|
|
24634
|
+
case OpKind.Animation:
|
|
24635
|
+
case OpKind.AnimationListener:
|
|
24216
24636
|
case OpKind.Listener:
|
|
24217
24637
|
case OpKind.TwoWayListener:
|
|
24218
24638
|
processLexicalScope$1(view, op.handlerOps);
|
|
@@ -24278,11 +24698,13 @@ function resolveDollarEvent(job) {
|
|
|
24278
24698
|
}
|
|
24279
24699
|
function transformDollarEvent(ops) {
|
|
24280
24700
|
for (const op of ops) {
|
|
24281
|
-
if (op.kind === OpKind.Listener ||
|
|
24701
|
+
if (op.kind === OpKind.Listener ||
|
|
24702
|
+
op.kind === OpKind.TwoWayListener ||
|
|
24703
|
+
op.kind === OpKind.AnimationListener) {
|
|
24282
24704
|
transformExpressionsInOp(op, (expr) => {
|
|
24283
24705
|
if (expr instanceof LexicalReadExpr && expr.name === '$event') {
|
|
24284
24706
|
// Two-way listeners always consume `$event` so they omit this field.
|
|
24285
|
-
if (op.kind === OpKind.Listener) {
|
|
24707
|
+
if (op.kind === OpKind.Listener || op.kind === OpKind.AnimationListener) {
|
|
24286
24708
|
op.consumesDollarEvent = true;
|
|
24287
24709
|
}
|
|
24288
24710
|
return new ReadVarExpr(expr.name);
|
|
@@ -24673,6 +25095,8 @@ function processLexicalScope(unit, ops, savedView) {
|
|
|
24673
25095
|
break;
|
|
24674
25096
|
}
|
|
24675
25097
|
break;
|
|
25098
|
+
case OpKind.Animation:
|
|
25099
|
+
case OpKind.AnimationListener:
|
|
24676
25100
|
case OpKind.Listener:
|
|
24677
25101
|
case OpKind.TwoWayListener:
|
|
24678
25102
|
// Listener functions have separate variable declarations, so process them as a separate
|
|
@@ -24690,7 +25114,10 @@ function processLexicalScope(unit, ops, savedView) {
|
|
|
24690
25114
|
// scope. Also, look for `ir.RestoreViewExpr`s and match them with the snapshotted view context
|
|
24691
25115
|
// variable.
|
|
24692
25116
|
for (const op of ops) {
|
|
24693
|
-
if (op.kind == OpKind.Listener ||
|
|
25117
|
+
if (op.kind == OpKind.Listener ||
|
|
25118
|
+
op.kind === OpKind.TwoWayListener ||
|
|
25119
|
+
op.kind === OpKind.Animation ||
|
|
25120
|
+
op.kind === OpKind.AnimationListener) {
|
|
24694
25121
|
// Listeners were already processed above with their own scopes.
|
|
24695
25122
|
continue;
|
|
24696
25123
|
}
|
|
@@ -24859,7 +25286,10 @@ function saveAndRestoreView(job) {
|
|
|
24859
25286
|
}, new GetCurrentViewExpr(), VariableFlags.None),
|
|
24860
25287
|
]);
|
|
24861
25288
|
for (const op of unit.create) {
|
|
24862
|
-
if (op.kind !== OpKind.Listener &&
|
|
25289
|
+
if (op.kind !== OpKind.Listener &&
|
|
25290
|
+
op.kind !== OpKind.TwoWayListener &&
|
|
25291
|
+
op.kind !== OpKind.Animation &&
|
|
25292
|
+
op.kind !== OpKind.AnimationListener) {
|
|
24863
25293
|
continue;
|
|
24864
25294
|
}
|
|
24865
25295
|
// Embedded views always need the save/restore view operation.
|
|
@@ -25179,7 +25609,10 @@ function generateTemporaries(ops) {
|
|
|
25179
25609
|
// Add declarations for the temp vars.
|
|
25180
25610
|
generatedStatements.push(...Array.from(new Set(defs.values())).map((name) => createStatementOp(new DeclareVarStmt(name))));
|
|
25181
25611
|
opCount++;
|
|
25182
|
-
if (op.kind === OpKind.Listener ||
|
|
25612
|
+
if (op.kind === OpKind.Listener ||
|
|
25613
|
+
op.kind === OpKind.Animation ||
|
|
25614
|
+
op.kind === OpKind.AnimationListener ||
|
|
25615
|
+
op.kind === OpKind.TwoWayListener) {
|
|
25183
25616
|
op.handlerOps.prepend(generateTemporaries(op.handlerOps));
|
|
25184
25617
|
}
|
|
25185
25618
|
else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
@@ -25523,7 +25956,10 @@ function optimizeVariables(job) {
|
|
|
25523
25956
|
inlineAlwaysInlineVariables(unit.create);
|
|
25524
25957
|
inlineAlwaysInlineVariables(unit.update);
|
|
25525
25958
|
for (const op of unit.create) {
|
|
25526
|
-
if (op.kind === OpKind.Listener ||
|
|
25959
|
+
if (op.kind === OpKind.Listener ||
|
|
25960
|
+
op.kind === OpKind.Animation ||
|
|
25961
|
+
op.kind === OpKind.AnimationListener ||
|
|
25962
|
+
op.kind === OpKind.TwoWayListener) {
|
|
25527
25963
|
inlineAlwaysInlineVariables(op.handlerOps);
|
|
25528
25964
|
}
|
|
25529
25965
|
else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
@@ -25533,7 +25969,10 @@ function optimizeVariables(job) {
|
|
|
25533
25969
|
optimizeVariablesInOpList(unit.create, job.compatibility);
|
|
25534
25970
|
optimizeVariablesInOpList(unit.update, job.compatibility);
|
|
25535
25971
|
for (const op of unit.create) {
|
|
25536
|
-
if (op.kind === OpKind.Listener ||
|
|
25972
|
+
if (op.kind === OpKind.Listener ||
|
|
25973
|
+
op.kind === OpKind.Animation ||
|
|
25974
|
+
op.kind === OpKind.AnimationListener ||
|
|
25975
|
+
op.kind === OpKind.TwoWayListener) {
|
|
25537
25976
|
optimizeVariablesInOpList(op.handlerOps, job.compatibility);
|
|
25538
25977
|
}
|
|
25539
25978
|
else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
@@ -25970,6 +26409,7 @@ const phases = [
|
|
|
25970
26409
|
{ kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
|
|
25971
26410
|
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
25972
26411
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
26412
|
+
{ kind: CompilationJobKind.Both, fn: convertAnimations },
|
|
25973
26413
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
25974
26414
|
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
25975
26415
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
@@ -26129,6 +26569,8 @@ const compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
|
26129
26569
|
const domSchema = new DomElementSchemaRegistry();
|
|
26130
26570
|
// Tag name of the `ng-template` element.
|
|
26131
26571
|
const NG_TEMPLATE_TAG_NAME = 'ng-template';
|
|
26572
|
+
// prefix for any animation binding
|
|
26573
|
+
const ANIMATE_PREFIX$1 = 'animate.';
|
|
26132
26574
|
function isI18nRootNode(meta) {
|
|
26133
26575
|
return meta instanceof Message;
|
|
26134
26576
|
}
|
|
@@ -26161,6 +26603,9 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
26161
26603
|
if (property.isLegacyAnimation) {
|
|
26162
26604
|
bindingKind = BindingKind.LegacyAnimation;
|
|
26163
26605
|
}
|
|
26606
|
+
if (property.isAnimation) {
|
|
26607
|
+
bindingKind = BindingKind.Animation;
|
|
26608
|
+
}
|
|
26164
26609
|
const securityContexts = bindingParser
|
|
26165
26610
|
.calcPossibleSecurityContexts(input.componentSelector, property.name, bindingKind === BindingKind.Attribute)
|
|
26166
26611
|
.filter((context) => context !== SecurityContext.NONE);
|
|
@@ -26827,6 +27272,7 @@ const BINDING_KINDS = new Map([
|
|
|
26827
27272
|
[BindingType.Class, BindingKind.ClassName],
|
|
26828
27273
|
[BindingType.Style, BindingKind.StyleProperty],
|
|
26829
27274
|
[BindingType.LegacyAnimation, BindingKind.LegacyAnimation],
|
|
27275
|
+
[BindingType.Animation, BindingKind.Animation],
|
|
26830
27276
|
]);
|
|
26831
27277
|
/**
|
|
26832
27278
|
* Checks whether the given template is a plain ng-template (as opposed to another kind of template
|
|
@@ -26891,6 +27337,9 @@ function ingestElementBindings(unit, op, element) {
|
|
|
26891
27337
|
if (output.type === ParsedEventType.TwoWay) {
|
|
26892
27338
|
unit.create.push(createTwoWayListenerOp(op.xref, op.handle, output.name, op.tag, makeTwoWayListenerHandlerOps(unit, output.handler, output.handlerSpan), output.sourceSpan));
|
|
26893
27339
|
}
|
|
27340
|
+
else if (output.type === ParsedEventType.Animation) {
|
|
27341
|
+
unit.create.push(createAnimationListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.name.endsWith('enter') ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, output.target, false, output.sourceSpan));
|
|
27342
|
+
}
|
|
26894
27343
|
else {
|
|
26895
27344
|
unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
|
|
26896
27345
|
}
|
|
@@ -26999,7 +27448,9 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
26999
27448
|
}
|
|
27000
27449
|
}
|
|
27001
27450
|
if (!isTextBinding &&
|
|
27002
|
-
(type === BindingType.Attribute ||
|
|
27451
|
+
(type === BindingType.Attribute ||
|
|
27452
|
+
type === BindingType.LegacyAnimation ||
|
|
27453
|
+
type === BindingType.Animation)) {
|
|
27003
27454
|
// Again, this binding doesn't really target the ng-template; it actually targets the element
|
|
27004
27455
|
// inside the structural template. In the case of non-text attribute or animation bindings,
|
|
27005
27456
|
// the binding doesn't even show up on the ng-template const array, so we just skip it
|
|
@@ -27157,14 +27608,18 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
27157
27608
|
if (root !== null) {
|
|
27158
27609
|
// Collect the static attributes for content projection purposes.
|
|
27159
27610
|
for (const attr of root.attributes) {
|
|
27160
|
-
|
|
27161
|
-
|
|
27611
|
+
if (!attr.name.startsWith(ANIMATE_PREFIX$1)) {
|
|
27612
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
27613
|
+
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
27614
|
+
}
|
|
27162
27615
|
}
|
|
27163
27616
|
// Also collect the inputs since they participate in content projection as well.
|
|
27164
27617
|
// Note that TDB used to collect the outputs as well, but it wasn't passing them into
|
|
27165
27618
|
// the template instruction. Here we just don't collect them.
|
|
27166
27619
|
for (const attr of root.inputs) {
|
|
27167
|
-
if (attr.type !== BindingType.LegacyAnimation &&
|
|
27620
|
+
if (attr.type !== BindingType.LegacyAnimation &&
|
|
27621
|
+
attr.type !== BindingType.Animation &&
|
|
27622
|
+
attr.type !== BindingType.Attribute) {
|
|
27168
27623
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
27169
27624
|
unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
|
|
27170
27625
|
}
|
|
@@ -27382,6 +27837,7 @@ class HtmlParser extends Parser$1 {
|
|
|
27382
27837
|
|
|
27383
27838
|
const PROPERTY_PARTS_SEPARATOR = '.';
|
|
27384
27839
|
const ATTRIBUTE_PREFIX = 'attr';
|
|
27840
|
+
const ANIMATE_PREFIX = 'animate';
|
|
27385
27841
|
const CLASS_PREFIX = 'class';
|
|
27386
27842
|
const STYLE_PREFIX = 'style';
|
|
27387
27843
|
const TEMPLATE_ATTR_PREFIX$1 = '*';
|
|
@@ -27581,6 +28037,9 @@ class BindingParser {
|
|
|
27581
28037
|
if (isLegacyAnimationProp) {
|
|
27582
28038
|
this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27583
28039
|
}
|
|
28040
|
+
else if (name.startsWith(ANIMATE_PREFIX)) {
|
|
28041
|
+
this._parseAnimation(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
28042
|
+
}
|
|
27584
28043
|
else {
|
|
27585
28044
|
this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
27586
28045
|
}
|
|
@@ -27597,6 +28056,10 @@ class BindingParser {
|
|
|
27597
28056
|
targetMatchableAttrs.push([name, ast.source]);
|
|
27598
28057
|
targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
|
|
27599
28058
|
}
|
|
28059
|
+
_parseAnimation(name, ast, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
|
|
28060
|
+
targetMatchableAttrs.push([name, ast.source]);
|
|
28061
|
+
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
|
|
28062
|
+
}
|
|
27600
28063
|
_parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
|
|
27601
28064
|
if (name.length === 0) {
|
|
27602
28065
|
this._reportError('Animation trigger is missing', sourceSpan);
|
|
@@ -27659,6 +28122,11 @@ class BindingParser {
|
|
|
27659
28122
|
bindingType = BindingType.Style;
|
|
27660
28123
|
securityContexts = [SecurityContext.STYLE];
|
|
27661
28124
|
}
|
|
28125
|
+
else if (parts[0] == ANIMATE_PREFIX) {
|
|
28126
|
+
boundPropertyName = boundProp.name;
|
|
28127
|
+
bindingType = BindingType.Animation;
|
|
28128
|
+
securityContexts = [SecurityContext.NONE];
|
|
28129
|
+
}
|
|
27662
28130
|
}
|
|
27663
28131
|
// If not a special case, use the full property name
|
|
27664
28132
|
if (boundPropertyName === null) {
|
|
@@ -27673,7 +28141,6 @@ class BindingParser {
|
|
|
27673
28141
|
}
|
|
27674
28142
|
return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
27675
28143
|
}
|
|
27676
|
-
// TODO: keySpan should be required but was made optional to avoid changing VE parser.
|
|
27677
28144
|
parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
27678
28145
|
if (name.length === 0) {
|
|
27679
28146
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
@@ -27729,7 +28196,14 @@ class BindingParser {
|
|
|
27729
28196
|
if (isAssignmentEvent && isValid && !this._isAllowedAssignmentEvent(ast)) {
|
|
27730
28197
|
this._reportError('Unsupported expression in a two-way binding', sourceSpan);
|
|
27731
28198
|
}
|
|
27732
|
-
|
|
28199
|
+
let eventType = ParsedEventType.Regular;
|
|
28200
|
+
if (isAssignmentEvent) {
|
|
28201
|
+
eventType = ParsedEventType.TwoWay;
|
|
28202
|
+
}
|
|
28203
|
+
if (name.startsWith(ANIMATE_PREFIX)) {
|
|
28204
|
+
eventType = ParsedEventType.Animation;
|
|
28205
|
+
}
|
|
28206
|
+
targetEvents.push(new ParsedEvent(eventName, target, eventType, ast, sourceSpan, handlerSpan, keySpan));
|
|
27733
28207
|
// Don't detect directives for event names for now,
|
|
27734
28208
|
// so don't add the event name to the matchableAttrs
|
|
27735
28209
|
}
|
|
@@ -28988,7 +29462,7 @@ class HtmlAstToIvyAst {
|
|
|
28988
29462
|
}
|
|
28989
29463
|
else {
|
|
28990
29464
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
28991
|
-
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
29465
|
+
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
28992
29466
|
}
|
|
28993
29467
|
if (elementHasInlineTemplate) {
|
|
28994
29468
|
// If this node is an inline-template (e.g. has *ngFor) then we need to create a template
|
|
@@ -29300,7 +29774,7 @@ class HtmlAstToIvyAst {
|
|
|
29300
29774
|
const identifier = bindParts[IDENT_KW_IDX];
|
|
29301
29775
|
const keySpan = createKeySpan(srcSpan, bindParts[KW_BINDON_IDX], identifier);
|
|
29302
29776
|
this.bindingParser.parsePropertyBinding(identifier, value, false, true, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
|
|
29303
|
-
this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan);
|
|
29777
|
+
this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan, absoluteOffset);
|
|
29304
29778
|
}
|
|
29305
29779
|
else if (bindParts[KW_AT_IDX]) {
|
|
29306
29780
|
const keySpan = createKeySpan(srcSpan, '', name);
|
|
@@ -29331,7 +29805,7 @@ class HtmlAstToIvyAst {
|
|
|
29331
29805
|
const keySpan = createKeySpan(srcSpan, delims.start, identifier);
|
|
29332
29806
|
if (delims.start === BINDING_DELIMS.BANANA_BOX.start) {
|
|
29333
29807
|
this.bindingParser.parsePropertyBinding(identifier, value, false, true, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
|
|
29334
|
-
this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan);
|
|
29808
|
+
this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan, absoluteOffset);
|
|
29335
29809
|
}
|
|
29336
29810
|
else if (delims.start === BINDING_DELIMS.PROPERTY.start) {
|
|
29337
29811
|
this.bindingParser.parsePropertyBinding(identifier, value, false, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
|
|
@@ -29451,7 +29925,7 @@ class HtmlAstToIvyAst {
|
|
|
29451
29925
|
}
|
|
29452
29926
|
references.push(new Reference(identifier, value, sourceSpan, keySpan, valueSpan));
|
|
29453
29927
|
}
|
|
29454
|
-
parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan) {
|
|
29928
|
+
parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan, absoluteOffset) {
|
|
29455
29929
|
const events = [];
|
|
29456
29930
|
this.bindingParser.parseEvent(`${name}Change`, expression,
|
|
29457
29931
|
/* isAssignmentEvent */ true, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
|
|
@@ -29494,7 +29968,7 @@ class NonBindableVisitor {
|
|
|
29494
29968
|
/* inputs */ [],
|
|
29495
29969
|
/* outputs */ [],
|
|
29496
29970
|
/* directives */ [], children,
|
|
29497
|
-
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29971
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.isVoid);
|
|
29498
29972
|
}
|
|
29499
29973
|
visitComment(comment) {
|
|
29500
29974
|
return null;
|
|
@@ -29535,7 +30009,7 @@ class NonBindableVisitor {
|
|
|
29535
30009
|
/* inputs */ [],
|
|
29536
30010
|
/* outputs */ [],
|
|
29537
30011
|
/* directives */ [], children,
|
|
29538
|
-
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
30012
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, false);
|
|
29539
30013
|
}
|
|
29540
30014
|
visitDirective(directive, context) {
|
|
29541
30015
|
return null;
|
|
@@ -29679,9 +30153,184 @@ function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, s
|
|
|
29679
30153
|
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled), interpolationConfig, elementRegistry, []);
|
|
29680
30154
|
}
|
|
29681
30155
|
|
|
30156
|
+
/*!
|
|
30157
|
+
* @license
|
|
30158
|
+
* Copyright Google LLC All Rights Reserved.
|
|
30159
|
+
*
|
|
30160
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
30161
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
30162
|
+
*/
|
|
30163
|
+
/**
|
|
30164
|
+
* Visitor that traverses all template and expression AST nodes in a template.
|
|
30165
|
+
* Useful for cases where every single node needs to be visited.
|
|
30166
|
+
*/
|
|
30167
|
+
class CombinedRecursiveAstVisitor extends RecursiveAstVisitor {
|
|
30168
|
+
visit(node) {
|
|
30169
|
+
if (node instanceof ASTWithSource) {
|
|
30170
|
+
this.visit(node.ast);
|
|
30171
|
+
}
|
|
30172
|
+
else {
|
|
30173
|
+
node.visit(this);
|
|
30174
|
+
}
|
|
30175
|
+
}
|
|
30176
|
+
visitElement(element) {
|
|
30177
|
+
this.visitAllTemplateNodes(element.attributes);
|
|
30178
|
+
this.visitAllTemplateNodes(element.inputs);
|
|
30179
|
+
this.visitAllTemplateNodes(element.outputs);
|
|
30180
|
+
this.visitAllTemplateNodes(element.directives);
|
|
30181
|
+
this.visitAllTemplateNodes(element.references);
|
|
30182
|
+
this.visitAllTemplateNodes(element.children);
|
|
30183
|
+
}
|
|
30184
|
+
visitTemplate(template) {
|
|
30185
|
+
this.visitAllTemplateNodes(template.attributes);
|
|
30186
|
+
this.visitAllTemplateNodes(template.inputs);
|
|
30187
|
+
this.visitAllTemplateNodes(template.outputs);
|
|
30188
|
+
this.visitAllTemplateNodes(template.directives);
|
|
30189
|
+
this.visitAllTemplateNodes(template.templateAttrs);
|
|
30190
|
+
this.visitAllTemplateNodes(template.variables);
|
|
30191
|
+
this.visitAllTemplateNodes(template.references);
|
|
30192
|
+
this.visitAllTemplateNodes(template.children);
|
|
30193
|
+
}
|
|
30194
|
+
visitContent(content) {
|
|
30195
|
+
this.visitAllTemplateNodes(content.children);
|
|
30196
|
+
}
|
|
30197
|
+
visitBoundAttribute(attribute) {
|
|
30198
|
+
this.visit(attribute.value);
|
|
30199
|
+
}
|
|
30200
|
+
visitBoundEvent(attribute) {
|
|
30201
|
+
this.visit(attribute.handler);
|
|
30202
|
+
}
|
|
30203
|
+
visitBoundText(text) {
|
|
30204
|
+
this.visit(text.value);
|
|
30205
|
+
}
|
|
30206
|
+
visitIcu(icu) {
|
|
30207
|
+
Object.keys(icu.vars).forEach((key) => this.visit(icu.vars[key]));
|
|
30208
|
+
Object.keys(icu.placeholders).forEach((key) => this.visit(icu.placeholders[key]));
|
|
30209
|
+
}
|
|
30210
|
+
visitDeferredBlock(deferred) {
|
|
30211
|
+
deferred.visitAll(this);
|
|
30212
|
+
}
|
|
30213
|
+
visitDeferredTrigger(trigger) {
|
|
30214
|
+
if (trigger instanceof BoundDeferredTrigger) {
|
|
30215
|
+
this.visit(trigger.value);
|
|
30216
|
+
}
|
|
30217
|
+
}
|
|
30218
|
+
visitDeferredBlockPlaceholder(block) {
|
|
30219
|
+
this.visitAllTemplateNodes(block.children);
|
|
30220
|
+
}
|
|
30221
|
+
visitDeferredBlockError(block) {
|
|
30222
|
+
this.visitAllTemplateNodes(block.children);
|
|
30223
|
+
}
|
|
30224
|
+
visitDeferredBlockLoading(block) {
|
|
30225
|
+
this.visitAllTemplateNodes(block.children);
|
|
30226
|
+
}
|
|
30227
|
+
visitSwitchBlock(block) {
|
|
30228
|
+
this.visit(block.expression);
|
|
30229
|
+
this.visitAllTemplateNodes(block.cases);
|
|
30230
|
+
}
|
|
30231
|
+
visitSwitchBlockCase(block) {
|
|
30232
|
+
block.expression && this.visit(block.expression);
|
|
30233
|
+
this.visitAllTemplateNodes(block.children);
|
|
30234
|
+
}
|
|
30235
|
+
visitForLoopBlock(block) {
|
|
30236
|
+
block.item.visit(this);
|
|
30237
|
+
this.visitAllTemplateNodes(block.contextVariables);
|
|
30238
|
+
this.visit(block.expression);
|
|
30239
|
+
this.visitAllTemplateNodes(block.children);
|
|
30240
|
+
block.empty?.visit(this);
|
|
30241
|
+
}
|
|
30242
|
+
visitForLoopBlockEmpty(block) {
|
|
30243
|
+
this.visitAllTemplateNodes(block.children);
|
|
30244
|
+
}
|
|
30245
|
+
visitIfBlock(block) {
|
|
30246
|
+
this.visitAllTemplateNodes(block.branches);
|
|
30247
|
+
}
|
|
30248
|
+
visitIfBlockBranch(block) {
|
|
30249
|
+
block.expression && this.visit(block.expression);
|
|
30250
|
+
block.expressionAlias?.visit(this);
|
|
30251
|
+
this.visitAllTemplateNodes(block.children);
|
|
30252
|
+
}
|
|
30253
|
+
visitLetDeclaration(decl) {
|
|
30254
|
+
this.visit(decl.value);
|
|
30255
|
+
}
|
|
30256
|
+
visitComponent(component) {
|
|
30257
|
+
this.visitAllTemplateNodes(component.attributes);
|
|
30258
|
+
this.visitAllTemplateNodes(component.inputs);
|
|
30259
|
+
this.visitAllTemplateNodes(component.outputs);
|
|
30260
|
+
this.visitAllTemplateNodes(component.directives);
|
|
30261
|
+
this.visitAllTemplateNodes(component.references);
|
|
30262
|
+
this.visitAllTemplateNodes(component.children);
|
|
30263
|
+
}
|
|
30264
|
+
visitDirective(directive) {
|
|
30265
|
+
this.visitAllTemplateNodes(directive.attributes);
|
|
30266
|
+
this.visitAllTemplateNodes(directive.inputs);
|
|
30267
|
+
this.visitAllTemplateNodes(directive.outputs);
|
|
30268
|
+
this.visitAllTemplateNodes(directive.references);
|
|
30269
|
+
}
|
|
30270
|
+
visitVariable(variable) { }
|
|
30271
|
+
visitReference(reference) { }
|
|
30272
|
+
visitTextAttribute(attribute) { }
|
|
30273
|
+
visitText(text) { }
|
|
30274
|
+
visitUnknownBlock(block) { }
|
|
30275
|
+
visitAllTemplateNodes(nodes) {
|
|
30276
|
+
for (const node of nodes) {
|
|
30277
|
+
this.visit(node);
|
|
30278
|
+
}
|
|
30279
|
+
}
|
|
30280
|
+
}
|
|
30281
|
+
|
|
30282
|
+
/*!
|
|
30283
|
+
* @license
|
|
30284
|
+
* Copyright Google LLC All Rights Reserved.
|
|
30285
|
+
*
|
|
30286
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
30287
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
30288
|
+
*/
|
|
30289
|
+
const ANIMATE_LEAVE$1 = `animate.leave`;
|
|
30290
|
+
/**
|
|
30291
|
+
* Analyzes a component's template to determine if it's using animate.enter
|
|
30292
|
+
* or animate.leave syntax.
|
|
30293
|
+
*/
|
|
30294
|
+
function analyzeTemplateForAnimations(template) {
|
|
30295
|
+
const analyzer = new AnimationsAnalyzer();
|
|
30296
|
+
visitAll$1(analyzer, template);
|
|
30297
|
+
// The template is considered selectorless only if there
|
|
30298
|
+
// are direct references to directives or pipes.
|
|
30299
|
+
return analyzer.hasAnimations;
|
|
30300
|
+
}
|
|
30301
|
+
/**
|
|
30302
|
+
* Visitor that traverses all the template nodes and
|
|
30303
|
+
* expressions to look for selectorless references.
|
|
30304
|
+
*/
|
|
30305
|
+
class AnimationsAnalyzer extends CombinedRecursiveAstVisitor {
|
|
30306
|
+
hasAnimations = false;
|
|
30307
|
+
visitElement(element) {
|
|
30308
|
+
// check for regular strings
|
|
30309
|
+
for (const attr of element.attributes) {
|
|
30310
|
+
if (attr.name === ANIMATE_LEAVE$1) {
|
|
30311
|
+
this.hasAnimations = true;
|
|
30312
|
+
}
|
|
30313
|
+
}
|
|
30314
|
+
// check for attribute bindings
|
|
30315
|
+
for (const input of element.inputs) {
|
|
30316
|
+
if (input.name === ANIMATE_LEAVE$1) {
|
|
30317
|
+
this.hasAnimations = true;
|
|
30318
|
+
}
|
|
30319
|
+
}
|
|
30320
|
+
// check for event bindings
|
|
30321
|
+
for (const output of element.outputs) {
|
|
30322
|
+
if (output.name === ANIMATE_LEAVE$1) {
|
|
30323
|
+
this.hasAnimations = true;
|
|
30324
|
+
}
|
|
30325
|
+
}
|
|
30326
|
+
super.visitElement(element);
|
|
30327
|
+
}
|
|
30328
|
+
}
|
|
30329
|
+
|
|
29682
30330
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
29683
30331
|
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
|
29684
30332
|
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
|
30333
|
+
const ANIMATE_LEAVE = `animate.leave`;
|
|
29685
30334
|
function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
29686
30335
|
const definitionMap = new DefinitionMap();
|
|
29687
30336
|
const selectors = parseSelectorToR3Selector(meta.selector);
|
|
@@ -29715,6 +30364,11 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
29715
30364
|
}
|
|
29716
30365
|
return definitionMap;
|
|
29717
30366
|
}
|
|
30367
|
+
function hasAnimationHostBinding(meta) {
|
|
30368
|
+
return (meta.host.attributes[ANIMATE_LEAVE] !== undefined ||
|
|
30369
|
+
meta.host.properties[ANIMATE_LEAVE] !== undefined ||
|
|
30370
|
+
meta.host.listeners[ANIMATE_LEAVE] !== undefined);
|
|
30371
|
+
}
|
|
29718
30372
|
/**
|
|
29719
30373
|
* Add features to the definition map.
|
|
29720
30374
|
*/
|
|
@@ -29749,6 +30403,12 @@ function addFeatures(definitionMap, meta) {
|
|
|
29749
30403
|
const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
|
|
29750
30404
|
features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
|
|
29751
30405
|
}
|
|
30406
|
+
const template = meta.template;
|
|
30407
|
+
if (hasAnimationHostBinding(meta) || (template && template.nodes.length > 0)) {
|
|
30408
|
+
if (hasAnimationHostBinding(meta) || analyzeTemplateForAnimations(template.nodes)) {
|
|
30409
|
+
features.push(importExpr(Identifiers.AnimationsFeature).callFn([]));
|
|
30410
|
+
}
|
|
30411
|
+
}
|
|
29752
30412
|
if (features.length) {
|
|
29753
30413
|
definitionMap.set('features', literalArr(features));
|
|
29754
30414
|
}
|
|
@@ -30208,132 +30868,6 @@ function compileDeferResolverFunction(meta) {
|
|
|
30208
30868
|
return arrowFn([], literalArr(depExpressions));
|
|
30209
30869
|
}
|
|
30210
30870
|
|
|
30211
|
-
/*!
|
|
30212
|
-
* @license
|
|
30213
|
-
* Copyright Google LLC All Rights Reserved.
|
|
30214
|
-
*
|
|
30215
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
30216
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
30217
|
-
*/
|
|
30218
|
-
/**
|
|
30219
|
-
* Visitor that traverses all template and expression AST nodes in a template.
|
|
30220
|
-
* Useful for cases where every single node needs to be visited.
|
|
30221
|
-
*/
|
|
30222
|
-
class CombinedRecursiveAstVisitor extends RecursiveAstVisitor {
|
|
30223
|
-
visit(node) {
|
|
30224
|
-
if (node instanceof ASTWithSource) {
|
|
30225
|
-
this.visit(node.ast);
|
|
30226
|
-
}
|
|
30227
|
-
else {
|
|
30228
|
-
node.visit(this);
|
|
30229
|
-
}
|
|
30230
|
-
}
|
|
30231
|
-
visitElement(element) {
|
|
30232
|
-
this.visitAllTemplateNodes(element.attributes);
|
|
30233
|
-
this.visitAllTemplateNodes(element.inputs);
|
|
30234
|
-
this.visitAllTemplateNodes(element.outputs);
|
|
30235
|
-
this.visitAllTemplateNodes(element.directives);
|
|
30236
|
-
this.visitAllTemplateNodes(element.references);
|
|
30237
|
-
this.visitAllTemplateNodes(element.children);
|
|
30238
|
-
}
|
|
30239
|
-
visitTemplate(template) {
|
|
30240
|
-
this.visitAllTemplateNodes(template.attributes);
|
|
30241
|
-
this.visitAllTemplateNodes(template.inputs);
|
|
30242
|
-
this.visitAllTemplateNodes(template.outputs);
|
|
30243
|
-
this.visitAllTemplateNodes(template.directives);
|
|
30244
|
-
this.visitAllTemplateNodes(template.templateAttrs);
|
|
30245
|
-
this.visitAllTemplateNodes(template.variables);
|
|
30246
|
-
this.visitAllTemplateNodes(template.references);
|
|
30247
|
-
this.visitAllTemplateNodes(template.children);
|
|
30248
|
-
}
|
|
30249
|
-
visitContent(content) {
|
|
30250
|
-
this.visitAllTemplateNodes(content.children);
|
|
30251
|
-
}
|
|
30252
|
-
visitBoundAttribute(attribute) {
|
|
30253
|
-
this.visit(attribute.value);
|
|
30254
|
-
}
|
|
30255
|
-
visitBoundEvent(attribute) {
|
|
30256
|
-
this.visit(attribute.handler);
|
|
30257
|
-
}
|
|
30258
|
-
visitBoundText(text) {
|
|
30259
|
-
this.visit(text.value);
|
|
30260
|
-
}
|
|
30261
|
-
visitIcu(icu) {
|
|
30262
|
-
Object.keys(icu.vars).forEach((key) => this.visit(icu.vars[key]));
|
|
30263
|
-
Object.keys(icu.placeholders).forEach((key) => this.visit(icu.placeholders[key]));
|
|
30264
|
-
}
|
|
30265
|
-
visitDeferredBlock(deferred) {
|
|
30266
|
-
deferred.visitAll(this);
|
|
30267
|
-
}
|
|
30268
|
-
visitDeferredTrigger(trigger) {
|
|
30269
|
-
if (trigger instanceof BoundDeferredTrigger) {
|
|
30270
|
-
this.visit(trigger.value);
|
|
30271
|
-
}
|
|
30272
|
-
}
|
|
30273
|
-
visitDeferredBlockPlaceholder(block) {
|
|
30274
|
-
this.visitAllTemplateNodes(block.children);
|
|
30275
|
-
}
|
|
30276
|
-
visitDeferredBlockError(block) {
|
|
30277
|
-
this.visitAllTemplateNodes(block.children);
|
|
30278
|
-
}
|
|
30279
|
-
visitDeferredBlockLoading(block) {
|
|
30280
|
-
this.visitAllTemplateNodes(block.children);
|
|
30281
|
-
}
|
|
30282
|
-
visitSwitchBlock(block) {
|
|
30283
|
-
this.visit(block.expression);
|
|
30284
|
-
this.visitAllTemplateNodes(block.cases);
|
|
30285
|
-
}
|
|
30286
|
-
visitSwitchBlockCase(block) {
|
|
30287
|
-
block.expression && this.visit(block.expression);
|
|
30288
|
-
this.visitAllTemplateNodes(block.children);
|
|
30289
|
-
}
|
|
30290
|
-
visitForLoopBlock(block) {
|
|
30291
|
-
block.item.visit(this);
|
|
30292
|
-
this.visitAllTemplateNodes(block.contextVariables);
|
|
30293
|
-
this.visit(block.expression);
|
|
30294
|
-
this.visitAllTemplateNodes(block.children);
|
|
30295
|
-
block.empty?.visit(this);
|
|
30296
|
-
}
|
|
30297
|
-
visitForLoopBlockEmpty(block) {
|
|
30298
|
-
this.visitAllTemplateNodes(block.children);
|
|
30299
|
-
}
|
|
30300
|
-
visitIfBlock(block) {
|
|
30301
|
-
this.visitAllTemplateNodes(block.branches);
|
|
30302
|
-
}
|
|
30303
|
-
visitIfBlockBranch(block) {
|
|
30304
|
-
block.expression && this.visit(block.expression);
|
|
30305
|
-
block.expressionAlias?.visit(this);
|
|
30306
|
-
this.visitAllTemplateNodes(block.children);
|
|
30307
|
-
}
|
|
30308
|
-
visitLetDeclaration(decl) {
|
|
30309
|
-
this.visit(decl.value);
|
|
30310
|
-
}
|
|
30311
|
-
visitComponent(component) {
|
|
30312
|
-
this.visitAllTemplateNodes(component.attributes);
|
|
30313
|
-
this.visitAllTemplateNodes(component.inputs);
|
|
30314
|
-
this.visitAllTemplateNodes(component.outputs);
|
|
30315
|
-
this.visitAllTemplateNodes(component.directives);
|
|
30316
|
-
this.visitAllTemplateNodes(component.references);
|
|
30317
|
-
this.visitAllTemplateNodes(component.children);
|
|
30318
|
-
}
|
|
30319
|
-
visitDirective(directive) {
|
|
30320
|
-
this.visitAllTemplateNodes(directive.attributes);
|
|
30321
|
-
this.visitAllTemplateNodes(directive.inputs);
|
|
30322
|
-
this.visitAllTemplateNodes(directive.outputs);
|
|
30323
|
-
this.visitAllTemplateNodes(directive.references);
|
|
30324
|
-
}
|
|
30325
|
-
visitVariable(variable) { }
|
|
30326
|
-
visitReference(reference) { }
|
|
30327
|
-
visitTextAttribute(attribute) { }
|
|
30328
|
-
visitText(text) { }
|
|
30329
|
-
visitUnknownBlock(block) { }
|
|
30330
|
-
visitAllTemplateNodes(nodes) {
|
|
30331
|
-
for (const node of nodes) {
|
|
30332
|
-
this.visit(node);
|
|
30333
|
-
}
|
|
30334
|
-
}
|
|
30335
|
-
}
|
|
30336
|
-
|
|
30337
30871
|
/**
|
|
30338
30872
|
* Computes a difference between full list (first argument) and
|
|
30339
30873
|
* list of items that should be excluded from the full list (second
|
|
@@ -31656,7 +32190,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
31656
32190
|
declarations.push(...decl.directives.map((dir) => convertDirectiveDeclarationToMetadata(dir)));
|
|
31657
32191
|
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
31658
32192
|
}
|
|
31659
|
-
const hasDirectiveDependencies = declarations.
|
|
32193
|
+
const hasDirectiveDependencies = declarations.some(({ kind }) => kind === R3TemplateDependencyKind.Directive || kind === R3TemplateDependencyKind.NgModule);
|
|
31660
32194
|
return {
|
|
31661
32195
|
...convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan),
|
|
31662
32196
|
template,
|
|
@@ -32042,7 +32576,7 @@ class _Visitor {
|
|
|
32042
32576
|
this._init(_VisitorMode.Merge, interpolationConfig);
|
|
32043
32577
|
this._translations = translations;
|
|
32044
32578
|
// Construct a single fake root element
|
|
32045
|
-
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined);
|
|
32579
|
+
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined, false);
|
|
32046
32580
|
const translatedNode = wrapper.visit(this, null);
|
|
32047
32581
|
if (this._inI18nBlock) {
|
|
32048
32582
|
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
|
|
@@ -32220,7 +32754,7 @@ class _Visitor {
|
|
|
32220
32754
|
this._inImplicitNode = wasInImplicitNode;
|
|
32221
32755
|
if (this._mode === _VisitorMode.Merge) {
|
|
32222
32756
|
if (node instanceof Element) {
|
|
32223
|
-
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
32757
|
+
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.isVoid);
|
|
32224
32758
|
}
|
|
32225
32759
|
else {
|
|
32226
32760
|
return new Component(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
@@ -33714,7 +34248,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33714
34248
|
function compileDeclareClassMetadata(metadata) {
|
|
33715
34249
|
const definitionMap = new DefinitionMap();
|
|
33716
34250
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33717
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34251
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
33718
34252
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33719
34253
|
definitionMap.set('type', metadata.type);
|
|
33720
34254
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33732,7 +34266,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33732
34266
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33733
34267
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33734
34268
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33735
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34269
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
33736
34270
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33737
34271
|
definitionMap.set('type', metadata.type);
|
|
33738
34272
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33827,7 +34361,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33827
34361
|
const definitionMap = new DefinitionMap();
|
|
33828
34362
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33829
34363
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33830
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34364
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
33831
34365
|
// e.g. `type: MyDirective`
|
|
33832
34366
|
definitionMap.set('type', meta.type.value);
|
|
33833
34367
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34243,7 +34777,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34243
34777
|
function compileDeclareFactoryFunction(meta) {
|
|
34244
34778
|
const definitionMap = new DefinitionMap();
|
|
34245
34779
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34246
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34780
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
34247
34781
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34248
34782
|
definitionMap.set('type', meta.type.value);
|
|
34249
34783
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34278,7 +34812,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34278
34812
|
function createInjectableDefinitionMap(meta) {
|
|
34279
34813
|
const definitionMap = new DefinitionMap();
|
|
34280
34814
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34281
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34815
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
34282
34816
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34283
34817
|
definitionMap.set('type', meta.type.value);
|
|
34284
34818
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34329,7 +34863,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34329
34863
|
function createInjectorDefinitionMap(meta) {
|
|
34330
34864
|
const definitionMap = new DefinitionMap();
|
|
34331
34865
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34332
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34866
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
34333
34867
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34334
34868
|
definitionMap.set('type', meta.type.value);
|
|
34335
34869
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34362,7 +34896,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34362
34896
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34363
34897
|
}
|
|
34364
34898
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34365
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34899
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
34366
34900
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34367
34901
|
definitionMap.set('type', meta.type.value);
|
|
34368
34902
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34413,7 +34947,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34413
34947
|
function createPipeDefinitionMap(meta) {
|
|
34414
34948
|
const definitionMap = new DefinitionMap();
|
|
34415
34949
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34416
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34950
|
+
definitionMap.set('version', literal('20.2.0-next.2'));
|
|
34417
34951
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34418
34952
|
// e.g. `type: MyPipe`
|
|
34419
34953
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34569,7 +35103,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34569
35103
|
* @description
|
|
34570
35104
|
* Entry point for all public APIs of the compiler package.
|
|
34571
35105
|
*/
|
|
34572
|
-
const VERSION = new Version('20.2.0-next.
|
|
35106
|
+
const VERSION = new Version('20.2.0-next.2');
|
|
34573
35107
|
|
|
34574
35108
|
//////////////////////////////////////
|
|
34575
35109
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|