@angular/compiler 20.0.0-next.3 → 20.0.0-next.5
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 +282 -125
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +23 -10
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1320,14 +1320,13 @@ class TemplateLiteralElementExpr extends Expression {
|
|
|
1320
1320
|
constructor(text, sourceSpan, rawText) {
|
|
1321
1321
|
super(STRING_TYPE, sourceSpan);
|
|
1322
1322
|
this.text = text;
|
|
1323
|
-
// If `rawText` is not provided,
|
|
1324
|
-
// associated `sourceSpan`. If that is also not available, "fake" the raw
|
|
1325
|
-
// string instead by escaping the following control sequences:
|
|
1323
|
+
// If `rawText` is not provided, "fake" the raw string by escaping the following sequences:
|
|
1326
1324
|
// - "\" would otherwise indicate that the next character is a control character.
|
|
1327
1325
|
// - "`" and "${" are template string control sequences that would otherwise prematurely
|
|
1328
1326
|
// indicate the end of the template literal element.
|
|
1329
|
-
|
|
1330
|
-
|
|
1327
|
+
// Note that we can't rely on the `sourceSpan` here, because it may be incorrect (see
|
|
1328
|
+
// https://github.com/angular/angular/pull/60267#discussion_r1986402524).
|
|
1329
|
+
this.rawText = rawText ?? escapeForTemplateLiteral(escapeSlashes(text));
|
|
1331
1330
|
}
|
|
1332
1331
|
visitExpression(visitor, context) {
|
|
1333
1332
|
return visitor.visitTemplateLiteralElementExpr(this, context);
|
|
@@ -2896,6 +2895,11 @@ class Identifiers {
|
|
|
2896
2895
|
name: 'ɵɵdeferEnableTimerScheduling',
|
|
2897
2896
|
moduleName: CORE,
|
|
2898
2897
|
};
|
|
2898
|
+
static conditionalCreate = { name: 'ɵɵconditionalCreate', moduleName: CORE };
|
|
2899
|
+
static conditionalBranchCreate = {
|
|
2900
|
+
name: 'ɵɵconditionalBranchCreate',
|
|
2901
|
+
moduleName: CORE,
|
|
2902
|
+
};
|
|
2899
2903
|
static conditional = { name: 'ɵɵconditional', moduleName: CORE };
|
|
2900
2904
|
static repeater = { name: 'ɵɵrepeater', moduleName: CORE };
|
|
2901
2905
|
static repeaterCreate = { name: 'ɵɵrepeaterCreate', moduleName: CORE };
|
|
@@ -2938,7 +2942,7 @@ class Identifiers {
|
|
|
2938
2942
|
static pipeBind3 = { name: 'ɵɵpipeBind3', moduleName: CORE };
|
|
2939
2943
|
static pipeBind4 = { name: 'ɵɵpipeBind4', moduleName: CORE };
|
|
2940
2944
|
static pipeBindV = { name: 'ɵɵpipeBindV', moduleName: CORE };
|
|
2941
|
-
static
|
|
2945
|
+
static domProperty = { name: 'ɵɵdomProperty', moduleName: CORE };
|
|
2942
2946
|
static property = { name: 'ɵɵproperty', moduleName: CORE };
|
|
2943
2947
|
static propertyInterpolate = {
|
|
2944
2948
|
name: 'ɵɵpropertyInterpolate',
|
|
@@ -8729,167 +8733,175 @@ var OpKind;
|
|
|
8729
8733
|
* node.
|
|
8730
8734
|
*/
|
|
8731
8735
|
OpKind[OpKind["DisableBindings"] = 10] = "DisableBindings";
|
|
8736
|
+
/**
|
|
8737
|
+
* Create a conditional creation instruction op.
|
|
8738
|
+
*/
|
|
8739
|
+
OpKind[OpKind["ConditionalCreate"] = 11] = "ConditionalCreate";
|
|
8740
|
+
/**
|
|
8741
|
+
* Create a conditional branch creation instruction op.
|
|
8742
|
+
*/
|
|
8743
|
+
OpKind[OpKind["ConditionalBranchCreate"] = 12] = "ConditionalBranchCreate";
|
|
8732
8744
|
/**
|
|
8733
8745
|
* An op to conditionally render a template.
|
|
8734
8746
|
*/
|
|
8735
|
-
OpKind[OpKind["Conditional"] =
|
|
8747
|
+
OpKind[OpKind["Conditional"] = 13] = "Conditional";
|
|
8736
8748
|
/**
|
|
8737
8749
|
* An operation to re-enable binding, after it was previously disabled.
|
|
8738
8750
|
*/
|
|
8739
|
-
OpKind[OpKind["EnableBindings"] =
|
|
8751
|
+
OpKind[OpKind["EnableBindings"] = 14] = "EnableBindings";
|
|
8740
8752
|
/**
|
|
8741
8753
|
* An operation to render a text node.
|
|
8742
8754
|
*/
|
|
8743
|
-
OpKind[OpKind["Text"] =
|
|
8755
|
+
OpKind[OpKind["Text"] = 15] = "Text";
|
|
8744
8756
|
/**
|
|
8745
8757
|
* An operation declaring an event listener for an element.
|
|
8746
8758
|
*/
|
|
8747
|
-
OpKind[OpKind["Listener"] =
|
|
8759
|
+
OpKind[OpKind["Listener"] = 16] = "Listener";
|
|
8748
8760
|
/**
|
|
8749
8761
|
* An operation to interpolate text into a text node.
|
|
8750
8762
|
*/
|
|
8751
|
-
OpKind[OpKind["InterpolateText"] =
|
|
8763
|
+
OpKind[OpKind["InterpolateText"] = 17] = "InterpolateText";
|
|
8752
8764
|
/**
|
|
8753
8765
|
* An intermediate binding op, that has not yet been processed into an individual property,
|
|
8754
8766
|
* attribute, style, etc.
|
|
8755
8767
|
*/
|
|
8756
|
-
OpKind[OpKind["Binding"] =
|
|
8768
|
+
OpKind[OpKind["Binding"] = 18] = "Binding";
|
|
8757
8769
|
/**
|
|
8758
8770
|
* An operation to bind an expression to a property of an element.
|
|
8759
8771
|
*/
|
|
8760
|
-
OpKind[OpKind["Property"] =
|
|
8772
|
+
OpKind[OpKind["Property"] = 19] = "Property";
|
|
8761
8773
|
/**
|
|
8762
8774
|
* An operation to bind an expression to a style property of an element.
|
|
8763
8775
|
*/
|
|
8764
|
-
OpKind[OpKind["StyleProp"] =
|
|
8776
|
+
OpKind[OpKind["StyleProp"] = 20] = "StyleProp";
|
|
8765
8777
|
/**
|
|
8766
8778
|
* An operation to bind an expression to a class property of an element.
|
|
8767
8779
|
*/
|
|
8768
|
-
OpKind[OpKind["ClassProp"] =
|
|
8780
|
+
OpKind[OpKind["ClassProp"] = 21] = "ClassProp";
|
|
8769
8781
|
/**
|
|
8770
8782
|
* An operation to bind an expression to the styles of an element.
|
|
8771
8783
|
*/
|
|
8772
|
-
OpKind[OpKind["StyleMap"] =
|
|
8784
|
+
OpKind[OpKind["StyleMap"] = 22] = "StyleMap";
|
|
8773
8785
|
/**
|
|
8774
8786
|
* An operation to bind an expression to the classes of an element.
|
|
8775
8787
|
*/
|
|
8776
|
-
OpKind[OpKind["ClassMap"] =
|
|
8788
|
+
OpKind[OpKind["ClassMap"] = 23] = "ClassMap";
|
|
8777
8789
|
/**
|
|
8778
8790
|
* An operation to advance the runtime's implicit slot context during the update phase of a view.
|
|
8779
8791
|
*/
|
|
8780
|
-
OpKind[OpKind["Advance"] =
|
|
8792
|
+
OpKind[OpKind["Advance"] = 24] = "Advance";
|
|
8781
8793
|
/**
|
|
8782
8794
|
* An operation to instantiate a pipe.
|
|
8783
8795
|
*/
|
|
8784
|
-
OpKind[OpKind["Pipe"] =
|
|
8796
|
+
OpKind[OpKind["Pipe"] = 25] = "Pipe";
|
|
8785
8797
|
/**
|
|
8786
8798
|
* An operation to associate an attribute with an element.
|
|
8787
8799
|
*/
|
|
8788
|
-
OpKind[OpKind["Attribute"] =
|
|
8800
|
+
OpKind[OpKind["Attribute"] = 26] = "Attribute";
|
|
8789
8801
|
/**
|
|
8790
8802
|
* An attribute that has been extracted for inclusion in the consts array.
|
|
8791
8803
|
*/
|
|
8792
|
-
OpKind[OpKind["ExtractedAttribute"] =
|
|
8804
|
+
OpKind[OpKind["ExtractedAttribute"] = 27] = "ExtractedAttribute";
|
|
8793
8805
|
/**
|
|
8794
8806
|
* An operation that configures a `@defer` block.
|
|
8795
8807
|
*/
|
|
8796
|
-
OpKind[OpKind["Defer"] =
|
|
8808
|
+
OpKind[OpKind["Defer"] = 28] = "Defer";
|
|
8797
8809
|
/**
|
|
8798
8810
|
* An operation that controls when a `@defer` loads.
|
|
8799
8811
|
*/
|
|
8800
|
-
OpKind[OpKind["DeferOn"] =
|
|
8812
|
+
OpKind[OpKind["DeferOn"] = 29] = "DeferOn";
|
|
8801
8813
|
/**
|
|
8802
8814
|
* An operation that controls when a `@defer` loads, using a custom expression as the condition.
|
|
8803
8815
|
*/
|
|
8804
|
-
OpKind[OpKind["DeferWhen"] =
|
|
8816
|
+
OpKind[OpKind["DeferWhen"] = 30] = "DeferWhen";
|
|
8805
8817
|
/**
|
|
8806
8818
|
* An i18n message that has been extracted for inclusion in the consts array.
|
|
8807
8819
|
*/
|
|
8808
|
-
OpKind[OpKind["I18nMessage"] =
|
|
8820
|
+
OpKind[OpKind["I18nMessage"] = 31] = "I18nMessage";
|
|
8809
8821
|
/**
|
|
8810
|
-
* A
|
|
8822
|
+
* A binding to a native DOM property.
|
|
8811
8823
|
*/
|
|
8812
|
-
OpKind[OpKind["
|
|
8824
|
+
OpKind[OpKind["DomProperty"] = 32] = "DomProperty";
|
|
8813
8825
|
/**
|
|
8814
8826
|
* A namespace change, which causes the subsequent elements to be processed as either HTML or SVG.
|
|
8815
8827
|
*/
|
|
8816
|
-
OpKind[OpKind["Namespace"] =
|
|
8828
|
+
OpKind[OpKind["Namespace"] = 33] = "Namespace";
|
|
8817
8829
|
/**
|
|
8818
8830
|
* Configure a content projeciton definition for the view.
|
|
8819
8831
|
*/
|
|
8820
|
-
OpKind[OpKind["ProjectionDef"] =
|
|
8832
|
+
OpKind[OpKind["ProjectionDef"] = 34] = "ProjectionDef";
|
|
8821
8833
|
/**
|
|
8822
8834
|
* Create a content projection slot.
|
|
8823
8835
|
*/
|
|
8824
|
-
OpKind[OpKind["Projection"] =
|
|
8836
|
+
OpKind[OpKind["Projection"] = 35] = "Projection";
|
|
8825
8837
|
/**
|
|
8826
8838
|
* Create a repeater creation instruction op.
|
|
8827
8839
|
*/
|
|
8828
|
-
OpKind[OpKind["RepeaterCreate"] =
|
|
8840
|
+
OpKind[OpKind["RepeaterCreate"] = 36] = "RepeaterCreate";
|
|
8829
8841
|
/**
|
|
8830
8842
|
* An update up for a repeater.
|
|
8831
8843
|
*/
|
|
8832
|
-
OpKind[OpKind["Repeater"] =
|
|
8844
|
+
OpKind[OpKind["Repeater"] = 37] = "Repeater";
|
|
8833
8845
|
/**
|
|
8834
8846
|
* An operation to bind an expression to the property side of a two-way binding.
|
|
8835
8847
|
*/
|
|
8836
|
-
OpKind[OpKind["TwoWayProperty"] =
|
|
8848
|
+
OpKind[OpKind["TwoWayProperty"] = 38] = "TwoWayProperty";
|
|
8837
8849
|
/**
|
|
8838
8850
|
* An operation declaring the event side of a two-way binding.
|
|
8839
8851
|
*/
|
|
8840
|
-
OpKind[OpKind["TwoWayListener"] =
|
|
8852
|
+
OpKind[OpKind["TwoWayListener"] = 39] = "TwoWayListener";
|
|
8841
8853
|
/**
|
|
8842
8854
|
* A creation-time operation that initializes the slot for a `@let` declaration.
|
|
8843
8855
|
*/
|
|
8844
|
-
OpKind[OpKind["DeclareLet"] =
|
|
8856
|
+
OpKind[OpKind["DeclareLet"] = 40] = "DeclareLet";
|
|
8845
8857
|
/**
|
|
8846
8858
|
* An update-time operation that stores the current value of a `@let` declaration.
|
|
8847
8859
|
*/
|
|
8848
|
-
OpKind[OpKind["StoreLet"] =
|
|
8860
|
+
OpKind[OpKind["StoreLet"] = 41] = "StoreLet";
|
|
8849
8861
|
/**
|
|
8850
8862
|
* The start of an i18n block.
|
|
8851
8863
|
*/
|
|
8852
|
-
OpKind[OpKind["I18nStart"] =
|
|
8864
|
+
OpKind[OpKind["I18nStart"] = 42] = "I18nStart";
|
|
8853
8865
|
/**
|
|
8854
8866
|
* A self-closing i18n on a single element.
|
|
8855
8867
|
*/
|
|
8856
|
-
OpKind[OpKind["I18n"] =
|
|
8868
|
+
OpKind[OpKind["I18n"] = 43] = "I18n";
|
|
8857
8869
|
/**
|
|
8858
8870
|
* The end of an i18n block.
|
|
8859
8871
|
*/
|
|
8860
|
-
OpKind[OpKind["I18nEnd"] =
|
|
8872
|
+
OpKind[OpKind["I18nEnd"] = 44] = "I18nEnd";
|
|
8861
8873
|
/**
|
|
8862
8874
|
* An expression in an i18n message.
|
|
8863
8875
|
*/
|
|
8864
|
-
OpKind[OpKind["I18nExpression"] =
|
|
8876
|
+
OpKind[OpKind["I18nExpression"] = 45] = "I18nExpression";
|
|
8865
8877
|
/**
|
|
8866
8878
|
* An instruction that applies a set of i18n expressions.
|
|
8867
8879
|
*/
|
|
8868
|
-
OpKind[OpKind["I18nApply"] =
|
|
8880
|
+
OpKind[OpKind["I18nApply"] = 46] = "I18nApply";
|
|
8869
8881
|
/**
|
|
8870
8882
|
* An instruction to create an ICU expression.
|
|
8871
8883
|
*/
|
|
8872
|
-
OpKind[OpKind["IcuStart"] =
|
|
8884
|
+
OpKind[OpKind["IcuStart"] = 47] = "IcuStart";
|
|
8873
8885
|
/**
|
|
8874
8886
|
* An instruction to update an ICU expression.
|
|
8875
8887
|
*/
|
|
8876
|
-
OpKind[OpKind["IcuEnd"] =
|
|
8888
|
+
OpKind[OpKind["IcuEnd"] = 48] = "IcuEnd";
|
|
8877
8889
|
/**
|
|
8878
8890
|
* An instruction representing a placeholder in an ICU expression.
|
|
8879
8891
|
*/
|
|
8880
|
-
OpKind[OpKind["IcuPlaceholder"] =
|
|
8892
|
+
OpKind[OpKind["IcuPlaceholder"] = 49] = "IcuPlaceholder";
|
|
8881
8893
|
/**
|
|
8882
8894
|
* An i18n context containing information needed to generate an i18n message.
|
|
8883
8895
|
*/
|
|
8884
|
-
OpKind[OpKind["I18nContext"] =
|
|
8896
|
+
OpKind[OpKind["I18nContext"] = 50] = "I18nContext";
|
|
8885
8897
|
/**
|
|
8886
8898
|
* A creation op that corresponds to i18n attributes on an element.
|
|
8887
8899
|
*/
|
|
8888
|
-
OpKind[OpKind["I18nAttributes"] =
|
|
8900
|
+
OpKind[OpKind["I18nAttributes"] = 51] = "I18nAttributes";
|
|
8889
8901
|
/**
|
|
8890
8902
|
* Creation op that attaches the location at which an element was defined in a template to it.
|
|
8891
8903
|
*/
|
|
8892
|
-
OpKind[OpKind["SourceLocation"] =
|
|
8904
|
+
OpKind[OpKind["SourceLocation"] = 52] = "SourceLocation";
|
|
8893
8905
|
})(OpKind || (OpKind = {}));
|
|
8894
8906
|
/**
|
|
8895
8907
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -10316,7 +10328,7 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10316
10328
|
}
|
|
10317
10329
|
break;
|
|
10318
10330
|
case OpKind.Property:
|
|
10319
|
-
case OpKind.
|
|
10331
|
+
case OpKind.DomProperty:
|
|
10320
10332
|
case OpKind.Attribute:
|
|
10321
10333
|
if (op.expression instanceof Interpolation) {
|
|
10322
10334
|
transformExpressionsInInterpolation(op.expression, transform, flags);
|
|
@@ -10439,6 +10451,8 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10439
10451
|
case OpKind.IcuPlaceholder:
|
|
10440
10452
|
case OpKind.DeclareLet:
|
|
10441
10453
|
case OpKind.SourceLocation:
|
|
10454
|
+
case OpKind.ConditionalCreate:
|
|
10455
|
+
case OpKind.ConditionalBranchCreate:
|
|
10442
10456
|
// These operations contain no expressions.
|
|
10443
10457
|
break;
|
|
10444
10458
|
default:
|
|
@@ -10854,6 +10868,8 @@ const elementContainerOpKinds = new Set([
|
|
|
10854
10868
|
OpKind.ContainerStart,
|
|
10855
10869
|
OpKind.Template,
|
|
10856
10870
|
OpKind.RepeaterCreate,
|
|
10871
|
+
OpKind.ConditionalCreate,
|
|
10872
|
+
OpKind.ConditionalBranchCreate,
|
|
10857
10873
|
]);
|
|
10858
10874
|
/**
|
|
10859
10875
|
* Checks whether the given operation represents the creation of an element or container.
|
|
@@ -10905,6 +10921,48 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
10905
10921
|
...NEW_OP,
|
|
10906
10922
|
};
|
|
10907
10923
|
}
|
|
10924
|
+
function createConditionalCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10925
|
+
return {
|
|
10926
|
+
kind: OpKind.ConditionalCreate,
|
|
10927
|
+
xref,
|
|
10928
|
+
templateKind,
|
|
10929
|
+
attributes: null,
|
|
10930
|
+
tag,
|
|
10931
|
+
handle: new SlotHandle(),
|
|
10932
|
+
functionNameSuffix,
|
|
10933
|
+
decls: null,
|
|
10934
|
+
vars: null,
|
|
10935
|
+
localRefs: [],
|
|
10936
|
+
nonBindable: false,
|
|
10937
|
+
namespace,
|
|
10938
|
+
i18nPlaceholder,
|
|
10939
|
+
startSourceSpan,
|
|
10940
|
+
wholeSourceSpan,
|
|
10941
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10942
|
+
...NEW_OP,
|
|
10943
|
+
};
|
|
10944
|
+
}
|
|
10945
|
+
function createConditionalBranchCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10946
|
+
return {
|
|
10947
|
+
kind: OpKind.ConditionalBranchCreate,
|
|
10948
|
+
xref,
|
|
10949
|
+
templateKind,
|
|
10950
|
+
attributes: null,
|
|
10951
|
+
tag,
|
|
10952
|
+
handle: new SlotHandle(),
|
|
10953
|
+
functionNameSuffix,
|
|
10954
|
+
decls: null,
|
|
10955
|
+
vars: null,
|
|
10956
|
+
localRefs: [],
|
|
10957
|
+
nonBindable: false,
|
|
10958
|
+
namespace,
|
|
10959
|
+
i18nPlaceholder,
|
|
10960
|
+
startSourceSpan,
|
|
10961
|
+
wholeSourceSpan,
|
|
10962
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10963
|
+
...NEW_OP,
|
|
10964
|
+
};
|
|
10965
|
+
}
|
|
10908
10966
|
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10909
10967
|
return {
|
|
10910
10968
|
kind: OpKind.RepeaterCreate,
|
|
@@ -11248,9 +11306,9 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
11248
11306
|
};
|
|
11249
11307
|
}
|
|
11250
11308
|
|
|
11251
|
-
function
|
|
11309
|
+
function createDomPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
11252
11310
|
return {
|
|
11253
|
-
kind: OpKind.
|
|
11311
|
+
kind: OpKind.DomProperty,
|
|
11254
11312
|
name,
|
|
11255
11313
|
expression,
|
|
11256
11314
|
isAnimationTrigger,
|
|
@@ -11828,7 +11886,7 @@ function specializeBindings(job) {
|
|
|
11828
11886
|
case BindingKind.Property:
|
|
11829
11887
|
case BindingKind.Animation:
|
|
11830
11888
|
if (job.kind === CompilationJobKind.Host) {
|
|
11831
|
-
OpList.replace(op,
|
|
11889
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11832
11890
|
}
|
|
11833
11891
|
else {
|
|
11834
11892
|
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
@@ -11852,36 +11910,38 @@ function specializeBindings(job) {
|
|
|
11852
11910
|
}
|
|
11853
11911
|
}
|
|
11854
11912
|
|
|
11855
|
-
const
|
|
11856
|
-
Identifiers.attribute,
|
|
11857
|
-
Identifiers.classProp,
|
|
11858
|
-
Identifiers.element,
|
|
11859
|
-
Identifiers.elementContainer,
|
|
11860
|
-
Identifiers.elementContainerEnd,
|
|
11861
|
-
Identifiers.elementContainerStart,
|
|
11862
|
-
Identifiers.elementEnd,
|
|
11863
|
-
Identifiers.elementStart,
|
|
11864
|
-
Identifiers.
|
|
11865
|
-
Identifiers.i18nExp,
|
|
11866
|
-
Identifiers.listener,
|
|
11867
|
-
Identifiers.listener,
|
|
11868
|
-
Identifiers.property,
|
|
11869
|
-
Identifiers.styleProp,
|
|
11870
|
-
Identifiers.stylePropInterpolate1,
|
|
11871
|
-
Identifiers.stylePropInterpolate2,
|
|
11872
|
-
Identifiers.stylePropInterpolate3,
|
|
11873
|
-
Identifiers.stylePropInterpolate4,
|
|
11874
|
-
Identifiers.stylePropInterpolate5,
|
|
11875
|
-
Identifiers.stylePropInterpolate6,
|
|
11876
|
-
Identifiers.stylePropInterpolate7,
|
|
11877
|
-
Identifiers.stylePropInterpolate8,
|
|
11878
|
-
Identifiers.stylePropInterpolateV,
|
|
11879
|
-
Identifiers.syntheticHostListener,
|
|
11880
|
-
Identifiers.syntheticHostProperty,
|
|
11881
|
-
Identifiers.templateCreate,
|
|
11882
|
-
Identifiers.twoWayProperty,
|
|
11883
|
-
Identifiers.twoWayListener,
|
|
11884
|
-
Identifiers.declareLet,
|
|
11913
|
+
const CHAIN_COMPATIBILITY = new Map([
|
|
11914
|
+
[Identifiers.attribute, Identifiers.attribute],
|
|
11915
|
+
[Identifiers.classProp, Identifiers.classProp],
|
|
11916
|
+
[Identifiers.element, Identifiers.element],
|
|
11917
|
+
[Identifiers.elementContainer, Identifiers.elementContainer],
|
|
11918
|
+
[Identifiers.elementContainerEnd, Identifiers.elementContainerEnd],
|
|
11919
|
+
[Identifiers.elementContainerStart, Identifiers.elementContainerStart],
|
|
11920
|
+
[Identifiers.elementEnd, Identifiers.elementEnd],
|
|
11921
|
+
[Identifiers.elementStart, Identifiers.elementStart],
|
|
11922
|
+
[Identifiers.domProperty, Identifiers.domProperty],
|
|
11923
|
+
[Identifiers.i18nExp, Identifiers.i18nExp],
|
|
11924
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11925
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11926
|
+
[Identifiers.property, Identifiers.property],
|
|
11927
|
+
[Identifiers.styleProp, Identifiers.styleProp],
|
|
11928
|
+
[Identifiers.stylePropInterpolate1, Identifiers.stylePropInterpolate1],
|
|
11929
|
+
[Identifiers.stylePropInterpolate2, Identifiers.stylePropInterpolate2],
|
|
11930
|
+
[Identifiers.stylePropInterpolate3, Identifiers.stylePropInterpolate3],
|
|
11931
|
+
[Identifiers.stylePropInterpolate4, Identifiers.stylePropInterpolate4],
|
|
11932
|
+
[Identifiers.stylePropInterpolate5, Identifiers.stylePropInterpolate5],
|
|
11933
|
+
[Identifiers.stylePropInterpolate6, Identifiers.stylePropInterpolate6],
|
|
11934
|
+
[Identifiers.stylePropInterpolate7, Identifiers.stylePropInterpolate7],
|
|
11935
|
+
[Identifiers.stylePropInterpolate8, Identifiers.stylePropInterpolate8],
|
|
11936
|
+
[Identifiers.stylePropInterpolateV, Identifiers.stylePropInterpolateV],
|
|
11937
|
+
[Identifiers.syntheticHostListener, Identifiers.syntheticHostListener],
|
|
11938
|
+
[Identifiers.syntheticHostProperty, Identifiers.syntheticHostProperty],
|
|
11939
|
+
[Identifiers.templateCreate, Identifiers.templateCreate],
|
|
11940
|
+
[Identifiers.twoWayProperty, Identifiers.twoWayProperty],
|
|
11941
|
+
[Identifiers.twoWayListener, Identifiers.twoWayListener],
|
|
11942
|
+
[Identifiers.declareLet, Identifiers.declareLet],
|
|
11943
|
+
[Identifiers.conditionalCreate, Identifiers.conditionalBranchCreate],
|
|
11944
|
+
[Identifiers.conditionalBranchCreate, Identifiers.conditionalBranchCreate],
|
|
11885
11945
|
]);
|
|
11886
11946
|
/**
|
|
11887
11947
|
* Chaining results in repeated call expressions, causing a deep AST of receiver expressions. To prevent running out of
|
|
@@ -11927,14 +11987,16 @@ function chainOperationsInList(opList) {
|
|
|
11927
11987
|
continue;
|
|
11928
11988
|
}
|
|
11929
11989
|
const instruction = op.statement.expr.fn.value;
|
|
11930
|
-
if (!
|
|
11990
|
+
if (!CHAIN_COMPATIBILITY.has(instruction)) {
|
|
11931
11991
|
// This instruction isn't chainable.
|
|
11932
11992
|
chain = null;
|
|
11933
11993
|
continue;
|
|
11934
11994
|
}
|
|
11935
11995
|
// This instruction can be chained. It can either be added on to the previous chain (if
|
|
11936
11996
|
// compatible) or it can be the start of a new chain.
|
|
11937
|
-
if (chain !== null &&
|
|
11997
|
+
if (chain !== null &&
|
|
11998
|
+
CHAIN_COMPATIBILITY.get(chain.instruction) === instruction &&
|
|
11999
|
+
chain.length < MAX_CHAIN_LENGTH) {
|
|
11938
12000
|
// This instruction can be added onto the previous chain.
|
|
11939
12001
|
const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
11940
12002
|
chain.expression = expression;
|
|
@@ -13153,6 +13215,8 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
13153
13215
|
const scope = getScopeForView(view, parentScope);
|
|
13154
13216
|
for (const op of view.create) {
|
|
13155
13217
|
switch (op.kind) {
|
|
13218
|
+
case OpKind.ConditionalCreate:
|
|
13219
|
+
case OpKind.ConditionalBranchCreate:
|
|
13156
13220
|
case OpKind.Template:
|
|
13157
13221
|
// Descend into child embedded views.
|
|
13158
13222
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
@@ -13210,6 +13274,8 @@ function getScopeForView(view, parent) {
|
|
|
13210
13274
|
for (const op of view.create) {
|
|
13211
13275
|
switch (op.kind) {
|
|
13212
13276
|
case OpKind.ElementStart:
|
|
13277
|
+
case OpKind.ConditionalCreate:
|
|
13278
|
+
case OpKind.ConditionalBranchCreate:
|
|
13213
13279
|
case OpKind.Template:
|
|
13214
13280
|
if (!Array.isArray(op.localRefs)) {
|
|
13215
13281
|
throw new Error(`AssertionError: expected localRefs to be an array`);
|
|
@@ -16259,7 +16325,7 @@ class _Tokenizer {
|
|
|
16259
16325
|
else {
|
|
16260
16326
|
const name = this._cursor.getChars(nameStart);
|
|
16261
16327
|
this._cursor.advance();
|
|
16262
|
-
const char = NAMED_ENTITIES[name];
|
|
16328
|
+
const char = NAMED_ENTITIES.hasOwnProperty(name) && NAMED_ENTITIES[name];
|
|
16263
16329
|
if (!char) {
|
|
16264
16330
|
throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));
|
|
16265
16331
|
}
|
|
@@ -19894,6 +19960,7 @@ const SCHEMA = [
|
|
|
19894
19960
|
'q,blockquote,cite^[HTMLElement]|',
|
|
19895
19961
|
'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type',
|
|
19896
19962
|
'select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
|
|
19963
|
+
'selectedcontent^[HTMLElement]|',
|
|
19897
19964
|
'slot^[HTMLElement]|name',
|
|
19898
19965
|
'source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width',
|
|
19899
19966
|
'span^[HTMLElement]|',
|
|
@@ -21740,6 +21807,8 @@ function liftLocalRefs(job) {
|
|
|
21740
21807
|
for (const op of unit.create) {
|
|
21741
21808
|
switch (op.kind) {
|
|
21742
21809
|
case OpKind.ElementStart:
|
|
21810
|
+
case OpKind.ConditionalCreate:
|
|
21811
|
+
case OpKind.ConditionalBranchCreate:
|
|
21743
21812
|
case OpKind.Template:
|
|
21744
21813
|
if (!Array.isArray(op.localRefs)) {
|
|
21745
21814
|
throw new Error(`AssertionError: expected localRefs to be an array still`);
|
|
@@ -21882,7 +21951,9 @@ function parseExtractedStyles(job) {
|
|
|
21882
21951
|
isStringLiteral(op.expression)) {
|
|
21883
21952
|
const target = elements.get(op.target);
|
|
21884
21953
|
if (target !== undefined &&
|
|
21885
|
-
target.kind === OpKind.Template
|
|
21954
|
+
(target.kind === OpKind.Template ||
|
|
21955
|
+
target.kind === OpKind.ConditionalCreate ||
|
|
21956
|
+
target.kind === OpKind.ConditionalBranchCreate) &&
|
|
21886
21957
|
target.templateKind === TemplateKind.Structural) {
|
|
21887
21958
|
// TemplateDefinitionBuilder will not apply class and style bindings to structural
|
|
21888
21959
|
// directives; instead, it will leave them as attributes.
|
|
@@ -21933,7 +22004,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
21933
22004
|
for (const op of unit.ops()) {
|
|
21934
22005
|
switch (op.kind) {
|
|
21935
22006
|
case OpKind.Property:
|
|
21936
|
-
case OpKind.
|
|
22007
|
+
case OpKind.DomProperty:
|
|
21937
22008
|
if (op.isAnimationTrigger) {
|
|
21938
22009
|
op.name = '@' + op.name;
|
|
21939
22010
|
}
|
|
@@ -21997,6 +22068,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
21997
22068
|
addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
|
|
21998
22069
|
}
|
|
21999
22070
|
break;
|
|
22071
|
+
case OpKind.ConditionalCreate:
|
|
22072
|
+
case OpKind.ConditionalBranchCreate:
|
|
22000
22073
|
case OpKind.Template:
|
|
22001
22074
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22002
22075
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -22247,8 +22320,8 @@ const UPDATE_ORDERING = [
|
|
|
22247
22320
|
* Host bindings have their own update ordering.
|
|
22248
22321
|
*/
|
|
22249
22322
|
const UPDATE_HOST_ORDERING = [
|
|
22250
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
22251
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
22323
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, true) },
|
|
22324
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, false) },
|
|
22252
22325
|
{ test: kindTest(OpKind.Attribute) },
|
|
22253
22326
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
22254
22327
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
@@ -22267,7 +22340,7 @@ const handledOpKinds = new Set([
|
|
|
22267
22340
|
OpKind.ClassProp,
|
|
22268
22341
|
OpKind.Property,
|
|
22269
22342
|
OpKind.TwoWayProperty,
|
|
22270
|
-
OpKind.
|
|
22343
|
+
OpKind.DomProperty,
|
|
22271
22344
|
OpKind.Attribute,
|
|
22272
22345
|
]);
|
|
22273
22346
|
/**
|
|
@@ -22482,6 +22555,8 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
22482
22555
|
}
|
|
22483
22556
|
i18nBlock = null;
|
|
22484
22557
|
break;
|
|
22558
|
+
case OpKind.ConditionalCreate:
|
|
22559
|
+
case OpKind.ConditionalBranchCreate:
|
|
22485
22560
|
case OpKind.Template:
|
|
22486
22561
|
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
22487
22562
|
break;
|
|
@@ -22846,6 +22921,42 @@ function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
|
22846
22921
|
}
|
|
22847
22922
|
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
22848
22923
|
}
|
|
22924
|
+
function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
22925
|
+
const args = [
|
|
22926
|
+
literal(slot),
|
|
22927
|
+
templateFnRef,
|
|
22928
|
+
literal(decls),
|
|
22929
|
+
literal(vars),
|
|
22930
|
+
literal(tag),
|
|
22931
|
+
literal(constIndex),
|
|
22932
|
+
];
|
|
22933
|
+
if (localRefs !== null) {
|
|
22934
|
+
args.push(literal(localRefs));
|
|
22935
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
22936
|
+
}
|
|
22937
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
22938
|
+
args.pop();
|
|
22939
|
+
}
|
|
22940
|
+
return call(Identifiers.conditionalCreate, args, sourceSpan);
|
|
22941
|
+
}
|
|
22942
|
+
function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
22943
|
+
const args = [
|
|
22944
|
+
literal(slot),
|
|
22945
|
+
templateFnRef,
|
|
22946
|
+
literal(decls),
|
|
22947
|
+
literal(vars),
|
|
22948
|
+
literal(tag),
|
|
22949
|
+
literal(constIndex),
|
|
22950
|
+
];
|
|
22951
|
+
if (localRefs !== null) {
|
|
22952
|
+
args.push(literal(localRefs));
|
|
22953
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
22954
|
+
}
|
|
22955
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
22956
|
+
args.pop();
|
|
22957
|
+
}
|
|
22958
|
+
return call(Identifiers.conditionalBranchCreate, args, sourceSpan);
|
|
22959
|
+
}
|
|
22849
22960
|
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
22850
22961
|
const args = [
|
|
22851
22962
|
literal(slot),
|
|
@@ -23003,12 +23114,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
|
|
|
23003
23114
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
23004
23115
|
return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
23005
23116
|
}
|
|
23006
|
-
function
|
|
23117
|
+
function domProperty(name, expression, sanitizer, sourceSpan) {
|
|
23007
23118
|
const args = [literal(name), expression];
|
|
23008
23119
|
if (sanitizer !== null) {
|
|
23009
23120
|
args.push(sanitizer);
|
|
23010
23121
|
}
|
|
23011
|
-
return call(Identifiers.
|
|
23122
|
+
return call(Identifiers.domProperty, args, sourceSpan);
|
|
23012
23123
|
}
|
|
23013
23124
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
23014
23125
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
@@ -23415,6 +23526,26 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23415
23526
|
}
|
|
23416
23527
|
OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
|
|
23417
23528
|
break;
|
|
23529
|
+
case OpKind.ConditionalCreate:
|
|
23530
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
23531
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
23532
|
+
}
|
|
23533
|
+
if (Array.isArray(op.localRefs)) {
|
|
23534
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
23535
|
+
}
|
|
23536
|
+
const conditionalCreateChildView = unit.job.views.get(op.xref);
|
|
23537
|
+
OpList.replace(op, conditionalCreate(op.handle.slot, variable(conditionalCreateChildView.fnName), conditionalCreateChildView.decls, conditionalCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23538
|
+
break;
|
|
23539
|
+
case OpKind.ConditionalBranchCreate:
|
|
23540
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
23541
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
23542
|
+
}
|
|
23543
|
+
if (Array.isArray(op.localRefs)) {
|
|
23544
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
23545
|
+
}
|
|
23546
|
+
const conditionalBranchCreateChildView = unit.job.views.get(op.xref);
|
|
23547
|
+
OpList.replace(op, conditionalBranchCreate(op.handle.slot, variable(conditionalBranchCreateChildView.fnName), conditionalBranchCreateChildView.decls, conditionalBranchCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23548
|
+
break;
|
|
23418
23549
|
case OpKind.RepeaterCreate:
|
|
23419
23550
|
if (op.handle.slot === null) {
|
|
23420
23551
|
throw new Error('No slot was assigned for repeater instruction');
|
|
@@ -23527,7 +23658,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
23527
23658
|
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
23528
23659
|
}
|
|
23529
23660
|
break;
|
|
23530
|
-
case OpKind.
|
|
23661
|
+
case OpKind.DomProperty:
|
|
23531
23662
|
if (op.expression instanceof Interpolation) {
|
|
23532
23663
|
throw new Error('not yet handled');
|
|
23533
23664
|
}
|
|
@@ -23536,7 +23667,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
23536
23667
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23537
23668
|
}
|
|
23538
23669
|
else {
|
|
23539
|
-
OpList.replace(op,
|
|
23670
|
+
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23540
23671
|
}
|
|
23541
23672
|
}
|
|
23542
23673
|
break;
|
|
@@ -23972,6 +24103,8 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
|
|
|
23972
24103
|
pendingStructuralDirective = undefined;
|
|
23973
24104
|
}
|
|
23974
24105
|
break;
|
|
24106
|
+
case OpKind.ConditionalCreate:
|
|
24107
|
+
case OpKind.ConditionalBranchCreate:
|
|
23975
24108
|
case OpKind.Template:
|
|
23976
24109
|
const view = job.views.get(op.xref);
|
|
23977
24110
|
if (op.i18nPlaceholder === undefined) {
|
|
@@ -24368,7 +24501,7 @@ function resolveSanitizers(job) {
|
|
|
24368
24501
|
switch (op.kind) {
|
|
24369
24502
|
case OpKind.Property:
|
|
24370
24503
|
case OpKind.Attribute:
|
|
24371
|
-
case OpKind.
|
|
24504
|
+
case OpKind.DomProperty:
|
|
24372
24505
|
let sanitizerFn = null;
|
|
24373
24506
|
if (Array.isArray(op.securityContext) &&
|
|
24374
24507
|
op.securityContext.length === 2 &&
|
|
@@ -24390,7 +24523,7 @@ function resolveSanitizers(job) {
|
|
|
24390
24523
|
// <iframe>).
|
|
24391
24524
|
if (op.sanitizer === null) {
|
|
24392
24525
|
let isIframe = false;
|
|
24393
|
-
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.
|
|
24526
|
+
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.DomProperty) {
|
|
24394
24527
|
// Note: for host bindings defined on a directive, we do not try to find all
|
|
24395
24528
|
// possible places where it can be matched, so we can not determine whether
|
|
24396
24529
|
// the host element is an <iframe>. In this case, we just assume it is and append a
|
|
@@ -24535,7 +24668,10 @@ function allocateSlots(job) {
|
|
|
24535
24668
|
// propagate the number of slots used for each view into the operation which declares it.
|
|
24536
24669
|
for (const unit of job.units) {
|
|
24537
24670
|
for (const op of unit.ops()) {
|
|
24538
|
-
if (op.kind === OpKind.Template ||
|
|
24671
|
+
if (op.kind === OpKind.Template ||
|
|
24672
|
+
op.kind === OpKind.ConditionalCreate ||
|
|
24673
|
+
op.kind === OpKind.ConditionalBranchCreate ||
|
|
24674
|
+
op.kind === OpKind.RepeaterCreate) {
|
|
24539
24675
|
// Record the number of slots used by the view this `ir.TemplateOp` declares in the
|
|
24540
24676
|
// operation itself, so it can be emitted later.
|
|
24541
24677
|
const childView = job.views.get(op.xref);
|
|
@@ -24596,6 +24732,8 @@ function optimizeStoreLet(job) {
|
|
|
24596
24732
|
* typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
|
|
24597
24733
|
* incorrectly prints `a ? b : c ?? d`. This is different from how it handles the same situation
|
|
24598
24734
|
* with `||` and `&&` where it prints the parentheses even if they are not present in the AST.
|
|
24735
|
+
* Note: We may be able to remove this case if Typescript resolves the following issue:
|
|
24736
|
+
* https://github.com/microsoft/TypeScript/issues/61369
|
|
24599
24737
|
*/
|
|
24600
24738
|
function stripNonrequiredParentheses(job) {
|
|
24601
24739
|
// Check which parentheses are required.
|
|
@@ -24970,7 +25108,10 @@ function countVariables(job) {
|
|
|
24970
25108
|
// an embedded view).
|
|
24971
25109
|
for (const unit of job.units) {
|
|
24972
25110
|
for (const op of unit.create) {
|
|
24973
|
-
if (op.kind !== OpKind.Template &&
|
|
25111
|
+
if (op.kind !== OpKind.Template &&
|
|
25112
|
+
op.kind !== OpKind.RepeaterCreate &&
|
|
25113
|
+
op.kind !== OpKind.ConditionalCreate &&
|
|
25114
|
+
op.kind !== OpKind.ConditionalBranchCreate) {
|
|
24974
25115
|
continue;
|
|
24975
25116
|
}
|
|
24976
25117
|
const childView = job.views.get(op.xref);
|
|
@@ -24989,7 +25130,7 @@ function varsUsedByOp(op) {
|
|
|
24989
25130
|
let slots;
|
|
24990
25131
|
switch (op.kind) {
|
|
24991
25132
|
case OpKind.Property:
|
|
24992
|
-
case OpKind.
|
|
25133
|
+
case OpKind.DomProperty:
|
|
24993
25134
|
case OpKind.Attribute:
|
|
24994
25135
|
// All of these bindings use 1 variable slot, plus 1 slot for every interpolated expression,
|
|
24995
25136
|
// if any.
|
|
@@ -25718,7 +25859,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
25718
25859
|
const securityContexts = bindingParser
|
|
25719
25860
|
.calcPossibleSecurityContexts(input.componentSelector, property.name, bindingKind === BindingKind.Attribute)
|
|
25720
25861
|
.filter((context) => context !== SecurityContext.NONE);
|
|
25721
|
-
|
|
25862
|
+
ingestDomProperty(job, property, bindingKind, securityContexts);
|
|
25722
25863
|
}
|
|
25723
25864
|
for (const [name, expr] of Object.entries(input.attributes) ?? []) {
|
|
25724
25865
|
const securityContexts = bindingParser
|
|
@@ -25733,7 +25874,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
25733
25874
|
}
|
|
25734
25875
|
// TODO: We should refactor the parser to use the same types and structures for host bindings as
|
|
25735
25876
|
// with ordinary components. This would allow us to share a lot more ingestion code.
|
|
25736
|
-
function
|
|
25877
|
+
function ingestDomProperty(job, property, bindingKind, securityContexts) {
|
|
25737
25878
|
let expression;
|
|
25738
25879
|
const ast = property.expression.ast;
|
|
25739
25880
|
if (ast instanceof Interpolation$1) {
|
|
@@ -25954,13 +26095,14 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
25954
26095
|
}
|
|
25955
26096
|
ifCaseI18nMeta = ifCase.i18n;
|
|
25956
26097
|
}
|
|
25957
|
-
const
|
|
25958
|
-
|
|
26098
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
26099
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Conditional', Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
26100
|
+
unit.create.push(conditionalCreateOp);
|
|
25959
26101
|
if (firstXref === null) {
|
|
25960
26102
|
firstXref = cView.xref;
|
|
25961
26103
|
}
|
|
25962
26104
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
25963
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
26105
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle, ifCase.expressionAlias);
|
|
25964
26106
|
conditions.push(conditionalCaseExpr);
|
|
25965
26107
|
ingestNodes(cView, ifCase.children);
|
|
25966
26108
|
}
|
|
@@ -25976,7 +26118,8 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
25976
26118
|
}
|
|
25977
26119
|
let firstXref = null;
|
|
25978
26120
|
let conditions = [];
|
|
25979
|
-
for (
|
|
26121
|
+
for (let i = 0; i < switchBlock.cases.length; i++) {
|
|
26122
|
+
const switchCase = switchBlock.cases[i];
|
|
25980
26123
|
const cView = unit.job.allocateView(unit.xref);
|
|
25981
26124
|
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
|
|
25982
26125
|
let switchCaseI18nMeta = undefined;
|
|
@@ -25986,15 +26129,16 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
25986
26129
|
}
|
|
25987
26130
|
switchCaseI18nMeta = switchCase.i18n;
|
|
25988
26131
|
}
|
|
25989
|
-
const
|
|
25990
|
-
|
|
26132
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
26133
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Case', Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
26134
|
+
unit.create.push(conditionalCreateOp);
|
|
25991
26135
|
if (firstXref === null) {
|
|
25992
26136
|
firstXref = cView.xref;
|
|
25993
26137
|
}
|
|
25994
26138
|
const caseExpr = switchCase.expression
|
|
25995
26139
|
? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan)
|
|
25996
26140
|
: null;
|
|
25997
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
26141
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle);
|
|
25998
26142
|
conditions.push(conditionalCaseExpr);
|
|
25999
26143
|
ingestNodes(cView, switchCase.children);
|
|
26000
26144
|
}
|
|
@@ -27248,10 +27392,16 @@ class BindingParser {
|
|
|
27248
27392
|
const prop = this._schemaRegistry.getMappedPropName(propName);
|
|
27249
27393
|
return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
|
|
27250
27394
|
}
|
|
27395
|
+
parseEventListenerName(rawName) {
|
|
27396
|
+
const [target, eventName] = splitAtColon(rawName, [null, rawName]);
|
|
27397
|
+
return { eventName: eventName, target };
|
|
27398
|
+
}
|
|
27399
|
+
parseAnimationEventName(rawName) {
|
|
27400
|
+
const matches = splitAtPeriod(rawName, [rawName, null]);
|
|
27401
|
+
return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
|
|
27402
|
+
}
|
|
27251
27403
|
_parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
27252
|
-
const
|
|
27253
|
-
const eventName = matches[0];
|
|
27254
|
-
const phase = matches[1].toLowerCase();
|
|
27404
|
+
const { eventName, phase } = this.parseAnimationEventName(name);
|
|
27255
27405
|
const ast = this._parseAction(expression, handlerSpan);
|
|
27256
27406
|
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.Animation, ast, sourceSpan, handlerSpan, keySpan));
|
|
27257
27407
|
if (eventName.length === 0) {
|
|
@@ -27268,7 +27418,7 @@ class BindingParser {
|
|
|
27268
27418
|
}
|
|
27269
27419
|
_parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
27270
27420
|
// long format: 'target: eventName'
|
|
27271
|
-
const
|
|
27421
|
+
const { eventName, target } = this.parseEventListenerName(name);
|
|
27272
27422
|
const prevErrorCount = this.errors.length;
|
|
27273
27423
|
const ast = this._parseAction(expression, handlerSpan);
|
|
27274
27424
|
const isValid = this.errors.length === prevErrorCount;
|
|
@@ -27472,11 +27622,13 @@ const FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
|
|
|
27472
27622
|
/** Pattern for the tracking expression in a for loop block. */
|
|
27473
27623
|
const FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
|
|
27474
27624
|
/** Pattern for the `as` expression in a conditional block. */
|
|
27475
|
-
const CONDITIONAL_ALIAS_PATTERN = /^(as\s)
|
|
27625
|
+
const CONDITIONAL_ALIAS_PATTERN = /^(as\s+)(.*)/;
|
|
27476
27626
|
/** Pattern used to identify an `else if` block. */
|
|
27477
27627
|
const ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
|
|
27478
27628
|
/** Pattern used to identify a `let` parameter. */
|
|
27479
27629
|
const FOR_LOOP_LET_PATTERN = /^let\s+([\S\s]*)/;
|
|
27630
|
+
/** Pattern used to validate a JavaScript identifier. */
|
|
27631
|
+
const IDENTIFIER_PATTERN = /^[$A-Z_][0-9A-Z_$]*$/i;
|
|
27480
27632
|
/**
|
|
27481
27633
|
* Pattern to group a string into leading whitespace, non whitespace, and trailing whitespace.
|
|
27482
27634
|
* Useful for getting the variable name span when a span can contain leading and trailing space.
|
|
@@ -27824,9 +27976,14 @@ function parseConditionalBlockParameters(block, errors, bindingParser) {
|
|
|
27824
27976
|
}
|
|
27825
27977
|
else {
|
|
27826
27978
|
const name = aliasMatch[2].trim();
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27979
|
+
if (IDENTIFIER_PATTERN.test(name)) {
|
|
27980
|
+
const variableStart = param.sourceSpan.start.moveBy(aliasMatch[1].length);
|
|
27981
|
+
const variableSpan = new ParseSourceSpan(variableStart, variableStart.moveBy(name.length));
|
|
27982
|
+
expressionAlias = new Variable(name, name, variableSpan, variableSpan);
|
|
27983
|
+
}
|
|
27984
|
+
else {
|
|
27985
|
+
errors.push(new ParseError(param.sourceSpan, '"as" expression must be a valid JavaScript identifier'));
|
|
27986
|
+
}
|
|
27830
27987
|
}
|
|
27831
27988
|
}
|
|
27832
27989
|
return { expression, expressionAlias };
|
|
@@ -32911,7 +33068,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32911
33068
|
function compileDeclareClassMetadata(metadata) {
|
|
32912
33069
|
const definitionMap = new DefinitionMap();
|
|
32913
33070
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32914
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33071
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
32915
33072
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32916
33073
|
definitionMap.set('type', metadata.type);
|
|
32917
33074
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32929,7 +33086,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32929
33086
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32930
33087
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32931
33088
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32932
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33089
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
32933
33090
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32934
33091
|
definitionMap.set('type', metadata.type);
|
|
32935
33092
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33024,7 +33181,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33024
33181
|
const definitionMap = new DefinitionMap();
|
|
33025
33182
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33026
33183
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33027
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33184
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33028
33185
|
// e.g. `type: MyDirective`
|
|
33029
33186
|
definitionMap.set('type', meta.type.value);
|
|
33030
33187
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33440,7 +33597,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33440
33597
|
function compileDeclareFactoryFunction(meta) {
|
|
33441
33598
|
const definitionMap = new DefinitionMap();
|
|
33442
33599
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33443
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33600
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33444
33601
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33445
33602
|
definitionMap.set('type', meta.type.value);
|
|
33446
33603
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33475,7 +33632,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33475
33632
|
function createInjectableDefinitionMap(meta) {
|
|
33476
33633
|
const definitionMap = new DefinitionMap();
|
|
33477
33634
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33478
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33635
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33479
33636
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33480
33637
|
definitionMap.set('type', meta.type.value);
|
|
33481
33638
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33526,7 +33683,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33526
33683
|
function createInjectorDefinitionMap(meta) {
|
|
33527
33684
|
const definitionMap = new DefinitionMap();
|
|
33528
33685
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33529
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33686
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33530
33687
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33531
33688
|
definitionMap.set('type', meta.type.value);
|
|
33532
33689
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33559,7 +33716,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33559
33716
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33560
33717
|
}
|
|
33561
33718
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33562
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33719
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33563
33720
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33564
33721
|
definitionMap.set('type', meta.type.value);
|
|
33565
33722
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33610,7 +33767,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33610
33767
|
function createPipeDefinitionMap(meta) {
|
|
33611
33768
|
const definitionMap = new DefinitionMap();
|
|
33612
33769
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33613
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33770
|
+
definitionMap.set('version', literal('20.0.0-next.5'));
|
|
33614
33771
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33615
33772
|
// e.g. `type: MyPipe`
|
|
33616
33773
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33768,7 +33925,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
33768
33925
|
* @description
|
|
33769
33926
|
* Entry point for all public APIs of the compiler package.
|
|
33770
33927
|
*/
|
|
33771
|
-
const VERSION = new Version('20.0.0-next.
|
|
33928
|
+
const VERSION = new Version('20.0.0-next.5');
|
|
33772
33929
|
|
|
33773
33930
|
//////////////////////////////////////
|
|
33774
33931
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|