@angular/compiler 14.0.0-next.1 → 14.0.0-next.12
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/esm2020/src/compiler.mjs +2 -2
- package/esm2020/src/compiler_facade_interface.mjs +1 -1
- package/esm2020/src/expression_parser/parser.mjs +76 -19
- package/esm2020/src/jit_compiler_facade.mjs +6 -3
- package/esm2020/src/ml_parser/lexer.mjs +2 -2
- package/esm2020/src/output/output_ast.mjs +1 -1
- package/esm2020/src/parse_util.mjs +2 -2
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/directive.mjs +1 -1
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +1 -1
- package/esm2020/src/render3/r3_identifiers.mjs +3 -1
- package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
- package/esm2020/src/render3/r3_pipe_compiler.mjs +4 -1
- package/esm2020/src/render3/r3_template_transform.mjs +9 -9
- package/esm2020/src/render3/view/api.mjs +1 -1
- package/esm2020/src/render3/view/compiler.mjs +43 -40
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +2 -5
- package/esm2020/src/render3/view/i18n/meta.mjs +11 -6
- package/esm2020/src/render3/view/style_parser.mjs +2 -2
- package/esm2020/src/render3/view/styling_builder.mjs +3 -3
- package/esm2020/src/render3/view/template.mjs +98 -129
- package/esm2020/src/render3/view/util.mjs +94 -15
- package/esm2020/src/selector.mjs +3 -3
- package/esm2020/src/shadow_css.mjs +2 -2
- package/esm2020/src/template_parser/binding_parser.mjs +16 -16
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +414 -257
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/compiler.mjs +410 -255
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/package.json +10 -2
- package/src/compiler.d.ts +1 -1
- package/src/compiler_facade_interface.d.ts +4 -0
- package/src/expression_parser/parser.d.ts +22 -5
- package/src/output/output_ast.d.ts +2 -1
- package/src/render3/partial/api.d.ts +10 -0
- package/src/render3/r3_identifiers.d.ts +2 -0
- package/src/render3/r3_module_compiler.d.ts +30 -4
- package/src/render3/r3_pipe_compiler.d.ts +4 -0
- package/src/render3/view/api.d.ts +4 -0
- package/src/render3/view/i18n/meta.d.ts +1 -1
- package/src/render3/view/template.d.ts +1 -4
- package/src/render3/view/util.d.ts +19 -2
- package/src/template_parser/binding_parser.d.ts +4 -3
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.12
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -224,11 +224,11 @@ class CssSelector {
|
|
|
224
224
|
const prefix = match[3 /* PREFIX */];
|
|
225
225
|
if (prefix === '#') {
|
|
226
226
|
// #hash
|
|
227
|
-
current.addAttribute('id', tag.
|
|
227
|
+
current.addAttribute('id', tag.slice(1));
|
|
228
228
|
}
|
|
229
229
|
else if (prefix === '.') {
|
|
230
230
|
// Class
|
|
231
|
-
current.addClassName(tag.
|
|
231
|
+
current.addClassName(tag.slice(1));
|
|
232
232
|
}
|
|
233
233
|
else {
|
|
234
234
|
// Element
|
|
@@ -2800,6 +2800,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
|
|
|
2800
2800
|
Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
|
|
2801
2801
|
Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
|
|
2802
2802
|
Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
|
|
2803
|
+
Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
|
|
2803
2804
|
Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
|
|
2804
2805
|
Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
|
|
2805
2806
|
Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
|
|
@@ -2910,6 +2911,7 @@ Identifiers.ModuleWithProviders = {
|
|
|
2910
2911
|
Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
|
|
2911
2912
|
Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
|
|
2912
2913
|
Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
|
|
2914
|
+
Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
|
|
2913
2915
|
Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
|
|
2914
2916
|
Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
|
|
2915
2917
|
Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
|
|
@@ -4876,6 +4878,65 @@ const IMPLICIT_REFERENCE = '$implicit';
|
|
|
4876
4878
|
const NON_BINDABLE_ATTR = 'ngNonBindable';
|
|
4877
4879
|
/** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
|
|
4878
4880
|
const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
|
|
4881
|
+
/** Instructions that support chaining. */
|
|
4882
|
+
const CHAINABLE_INSTRUCTIONS = new Set([
|
|
4883
|
+
Identifiers.element,
|
|
4884
|
+
Identifiers.elementStart,
|
|
4885
|
+
Identifiers.elementEnd,
|
|
4886
|
+
Identifiers.elementContainer,
|
|
4887
|
+
Identifiers.elementContainerStart,
|
|
4888
|
+
Identifiers.elementContainerEnd,
|
|
4889
|
+
Identifiers.i18nExp,
|
|
4890
|
+
Identifiers.listener,
|
|
4891
|
+
Identifiers.classProp,
|
|
4892
|
+
Identifiers.syntheticHostListener,
|
|
4893
|
+
Identifiers.hostProperty,
|
|
4894
|
+
Identifiers.syntheticHostProperty,
|
|
4895
|
+
Identifiers.property,
|
|
4896
|
+
Identifiers.propertyInterpolate1,
|
|
4897
|
+
Identifiers.propertyInterpolate2,
|
|
4898
|
+
Identifiers.propertyInterpolate3,
|
|
4899
|
+
Identifiers.propertyInterpolate4,
|
|
4900
|
+
Identifiers.propertyInterpolate5,
|
|
4901
|
+
Identifiers.propertyInterpolate6,
|
|
4902
|
+
Identifiers.propertyInterpolate7,
|
|
4903
|
+
Identifiers.propertyInterpolate8,
|
|
4904
|
+
Identifiers.propertyInterpolateV,
|
|
4905
|
+
Identifiers.attribute,
|
|
4906
|
+
Identifiers.attributeInterpolate1,
|
|
4907
|
+
Identifiers.attributeInterpolate2,
|
|
4908
|
+
Identifiers.attributeInterpolate3,
|
|
4909
|
+
Identifiers.attributeInterpolate4,
|
|
4910
|
+
Identifiers.attributeInterpolate5,
|
|
4911
|
+
Identifiers.attributeInterpolate6,
|
|
4912
|
+
Identifiers.attributeInterpolate7,
|
|
4913
|
+
Identifiers.attributeInterpolate8,
|
|
4914
|
+
Identifiers.attributeInterpolateV,
|
|
4915
|
+
Identifiers.styleProp,
|
|
4916
|
+
Identifiers.stylePropInterpolate1,
|
|
4917
|
+
Identifiers.stylePropInterpolate2,
|
|
4918
|
+
Identifiers.stylePropInterpolate3,
|
|
4919
|
+
Identifiers.stylePropInterpolate4,
|
|
4920
|
+
Identifiers.stylePropInterpolate5,
|
|
4921
|
+
Identifiers.stylePropInterpolate6,
|
|
4922
|
+
Identifiers.stylePropInterpolate7,
|
|
4923
|
+
Identifiers.stylePropInterpolate8,
|
|
4924
|
+
Identifiers.stylePropInterpolateV,
|
|
4925
|
+
Identifiers.textInterpolate,
|
|
4926
|
+
Identifiers.textInterpolate1,
|
|
4927
|
+
Identifiers.textInterpolate2,
|
|
4928
|
+
Identifiers.textInterpolate3,
|
|
4929
|
+
Identifiers.textInterpolate4,
|
|
4930
|
+
Identifiers.textInterpolate5,
|
|
4931
|
+
Identifiers.textInterpolate6,
|
|
4932
|
+
Identifiers.textInterpolate7,
|
|
4933
|
+
Identifiers.textInterpolate8,
|
|
4934
|
+
Identifiers.textInterpolateV,
|
|
4935
|
+
]);
|
|
4936
|
+
/** Generates a call to a single instruction. */
|
|
4937
|
+
function invokeInstruction(span, reference, params) {
|
|
4938
|
+
return importExpr(reference, null, span).callFn(params, span);
|
|
4939
|
+
}
|
|
4879
4940
|
/**
|
|
4880
4941
|
* Creates an allocator for a temporary variable.
|
|
4881
4942
|
*
|
|
@@ -5017,20 +5078,6 @@ function getAttrsForDirectiveMatching(elOrTpl) {
|
|
|
5017
5078
|
}
|
|
5018
5079
|
return attributesMap;
|
|
5019
5080
|
}
|
|
5020
|
-
/** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */
|
|
5021
|
-
function chainedInstruction(reference, calls, span) {
|
|
5022
|
-
let expression = importExpr(reference, null, span);
|
|
5023
|
-
if (calls.length > 0) {
|
|
5024
|
-
for (let i = 0; i < calls.length; i++) {
|
|
5025
|
-
expression = expression.callFn(calls[i], span);
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
else {
|
|
5029
|
-
// Add a blank invocation, in case the `calls` array is empty.
|
|
5030
|
-
expression = expression.callFn([], span);
|
|
5031
|
-
}
|
|
5032
|
-
return expression;
|
|
5033
|
-
}
|
|
5034
5081
|
/**
|
|
5035
5082
|
* Gets the number of arguments expected to be passed to a generated instruction in the case of
|
|
5036
5083
|
* interpolation instructions.
|
|
@@ -5048,6 +5095,40 @@ function getInterpolationArgsLength(interpolation) {
|
|
|
5048
5095
|
return expressions.length + strings.length;
|
|
5049
5096
|
}
|
|
5050
5097
|
}
|
|
5098
|
+
/**
|
|
5099
|
+
* Generates the final instruction call statements based on the passed in configuration.
|
|
5100
|
+
* Will try to chain instructions as much as possible, if chaining is supported.
|
|
5101
|
+
*/
|
|
5102
|
+
function getInstructionStatements(instructions) {
|
|
5103
|
+
var _a;
|
|
5104
|
+
const statements = [];
|
|
5105
|
+
let pendingExpression = null;
|
|
5106
|
+
let pendingExpressionType = null;
|
|
5107
|
+
for (const current of instructions) {
|
|
5108
|
+
const resolvedParams = (_a = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn)) !== null && _a !== void 0 ? _a : [];
|
|
5109
|
+
const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
|
|
5110
|
+
// If the current instruction is the same as the previous one
|
|
5111
|
+
// and it can be chained, add another call to the chain.
|
|
5112
|
+
if (pendingExpressionType === current.reference &&
|
|
5113
|
+
CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
|
|
5114
|
+
// We'll always have a pending expression when there's a pending expression type.
|
|
5115
|
+
pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
|
|
5116
|
+
}
|
|
5117
|
+
else {
|
|
5118
|
+
if (pendingExpression !== null) {
|
|
5119
|
+
statements.push(pendingExpression.toStmt());
|
|
5120
|
+
}
|
|
5121
|
+
pendingExpression = invokeInstruction(current.span, current.reference, params);
|
|
5122
|
+
pendingExpressionType = current.reference;
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
// Since the current instruction adds the previous one to the statements,
|
|
5126
|
+
// we may be left with the final one at the end that is still pending.
|
|
5127
|
+
if (pendingExpression !== null) {
|
|
5128
|
+
statements.push(pendingExpression.toStmt());
|
|
5129
|
+
}
|
|
5130
|
+
return statements;
|
|
5131
|
+
}
|
|
5051
5132
|
|
|
5052
5133
|
/**
|
|
5053
5134
|
* @license
|
|
@@ -5337,7 +5418,7 @@ class ParseLocation {
|
|
|
5337
5418
|
const ch = source.charCodeAt(offset);
|
|
5338
5419
|
if (ch == $LF) {
|
|
5339
5420
|
line--;
|
|
5340
|
-
const priorLine = source.
|
|
5421
|
+
const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
5341
5422
|
col = priorLine > 0 ? offset - priorLine : offset;
|
|
5342
5423
|
}
|
|
5343
5424
|
else {
|
|
@@ -5892,20 +5973,49 @@ class R3JitReflector {
|
|
|
5892
5973
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5893
5974
|
* found in the LICENSE file at https://angular.io/license
|
|
5894
5975
|
*/
|
|
5976
|
+
/**
|
|
5977
|
+
* How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
|
|
5978
|
+
* as a part of the NgModule definition.
|
|
5979
|
+
*/
|
|
5980
|
+
var R3SelectorScopeMode;
|
|
5981
|
+
(function (R3SelectorScopeMode) {
|
|
5982
|
+
/**
|
|
5983
|
+
* Emit the declarations inline into the module definition.
|
|
5984
|
+
*
|
|
5985
|
+
* This option is useful in certain contexts where it's known that JIT support is required. The
|
|
5986
|
+
* tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
|
|
5987
|
+
* they are unused, but the NgModule is used.
|
|
5988
|
+
*/
|
|
5989
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
|
|
5990
|
+
/**
|
|
5991
|
+
* Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
|
|
5992
|
+
* guarded with the `ngJitMode` flag.
|
|
5993
|
+
*
|
|
5994
|
+
* This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
|
|
5995
|
+
* false, which allows unused directives and pipes to be tree-shaken.
|
|
5996
|
+
*/
|
|
5997
|
+
R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
|
|
5998
|
+
/**
|
|
5999
|
+
* Don't generate selector scopes at all.
|
|
6000
|
+
*
|
|
6001
|
+
* This is useful for contexts where JIT support is known to be unnecessary.
|
|
6002
|
+
*/
|
|
6003
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
|
6004
|
+
})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
|
|
5895
6005
|
/**
|
|
5896
6006
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
|
5897
6007
|
*/
|
|
5898
6008
|
function compileNgModule(meta) {
|
|
5899
|
-
const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls,
|
|
6009
|
+
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
|
5900
6010
|
const statements = [];
|
|
5901
6011
|
const definitionMap = new DefinitionMap();
|
|
5902
6012
|
definitionMap.set('type', internalType);
|
|
5903
6013
|
if (bootstrap.length > 0) {
|
|
5904
6014
|
definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
|
|
5905
6015
|
}
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
6016
|
+
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
|
6017
|
+
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
|
6018
|
+
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
|
5909
6019
|
if (declarations.length > 0) {
|
|
5910
6020
|
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
5911
6021
|
}
|
|
@@ -5916,19 +6026,27 @@ function compileNgModule(meta) {
|
|
|
5916
6026
|
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
5917
6027
|
}
|
|
5918
6028
|
}
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
6029
|
+
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
|
6030
|
+
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
|
6031
|
+
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
|
6032
|
+
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
|
6033
|
+
// `ngJitMode` flag.
|
|
5922
6034
|
const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
|
|
5923
6035
|
if (setNgModuleScopeCall !== null) {
|
|
5924
6036
|
statements.push(setNgModuleScopeCall);
|
|
5925
6037
|
}
|
|
5926
6038
|
}
|
|
6039
|
+
else {
|
|
6040
|
+
// Selector scope emit was not requested, so skip it.
|
|
6041
|
+
}
|
|
5927
6042
|
if (schemas !== null && schemas.length > 0) {
|
|
5928
6043
|
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
|
5929
6044
|
}
|
|
5930
6045
|
if (id !== null) {
|
|
5931
6046
|
definitionMap.set('id', id);
|
|
6047
|
+
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
|
6048
|
+
// NgModule ids.
|
|
6049
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
|
|
5932
6050
|
}
|
|
5933
6051
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
|
5934
6052
|
const type = createNgModuleType(meta);
|
|
@@ -6024,6 +6142,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6024
6142
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6025
6143
|
// e.g. `pure: true`
|
|
6026
6144
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6145
|
+
if (metadata.isStandalone) {
|
|
6146
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6147
|
+
}
|
|
6027
6148
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6028
6149
|
const type = createPipeType(metadata);
|
|
6029
6150
|
return { expression, type, statements: [] };
|
|
@@ -7878,7 +7999,7 @@ class ShadowCss {
|
|
|
7878
7999
|
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
|
7879
8000
|
}
|
|
7880
8001
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
|
7881
|
-
rule.selector.startsWith('@document')) {
|
|
8002
|
+
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
|
|
7882
8003
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
7883
8004
|
}
|
|
7884
8005
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
|
@@ -8341,7 +8462,7 @@ function parse(value) {
|
|
|
8341
8462
|
}
|
|
8342
8463
|
}
|
|
8343
8464
|
if (currentProp && valueStart) {
|
|
8344
|
-
const styleVal = value.
|
|
8465
|
+
const styleVal = value.slice(valueStart).trim();
|
|
8345
8466
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8346
8467
|
}
|
|
8347
8468
|
return styles;
|
|
@@ -8519,7 +8640,7 @@ class StylingBuilder {
|
|
|
8519
8640
|
const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
|
|
8520
8641
|
if (isStyle || isClass) {
|
|
8521
8642
|
const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
|
|
8522
|
-
const property = name.
|
|
8643
|
+
const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
|
|
8523
8644
|
if (isStyle) {
|
|
8524
8645
|
binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
|
|
8525
8646
|
}
|
|
@@ -8793,7 +8914,7 @@ function parseProperty(name) {
|
|
|
8793
8914
|
let property = name;
|
|
8794
8915
|
const unitIndex = name.lastIndexOf('.');
|
|
8795
8916
|
if (unitIndex > 0) {
|
|
8796
|
-
suffix = name.
|
|
8917
|
+
suffix = name.slice(unitIndex + 1);
|
|
8797
8918
|
property = name.substring(0, unitIndex);
|
|
8798
8919
|
}
|
|
8799
8920
|
return { property, suffix, hasOverrideFlag };
|
|
@@ -9340,11 +9461,15 @@ class Parser$1 {
|
|
|
9340
9461
|
this._lexer = _lexer;
|
|
9341
9462
|
this.errors = [];
|
|
9342
9463
|
}
|
|
9343
|
-
parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9464
|
+
parseAction(input, isAssignmentEvent, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9344
9465
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9345
9466
|
const sourceToLex = this._stripComments(input);
|
|
9346
9467
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9347
|
-
|
|
9468
|
+
let flags = 1 /* Action */;
|
|
9469
|
+
if (isAssignmentEvent) {
|
|
9470
|
+
flags |= 2 /* AssignmentEvent */;
|
|
9471
|
+
}
|
|
9472
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
|
|
9348
9473
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
9349
9474
|
}
|
|
9350
9475
|
parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
@@ -9371,7 +9496,7 @@ class Parser$1 {
|
|
|
9371
9496
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9372
9497
|
const sourceToLex = this._stripComments(input);
|
|
9373
9498
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9374
|
-
return new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9499
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9375
9500
|
.parseChain();
|
|
9376
9501
|
}
|
|
9377
9502
|
/**
|
|
@@ -9402,14 +9527,14 @@ class Parser$1 {
|
|
|
9402
9527
|
*/
|
|
9403
9528
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9404
9529
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9405
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens,
|
|
9530
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
|
|
9406
9531
|
return parser.parseTemplateBindings({
|
|
9407
9532
|
source: templateKey,
|
|
9408
9533
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
9409
9534
|
});
|
|
9410
9535
|
}
|
|
9411
|
-
parseInterpolation(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9412
|
-
const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolationConfig);
|
|
9536
|
+
parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9537
|
+
const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolatedTokens, interpolationConfig);
|
|
9413
9538
|
if (expressions.length === 0)
|
|
9414
9539
|
return null;
|
|
9415
9540
|
const expressionNodes = [];
|
|
@@ -9417,7 +9542,7 @@ class Parser$1 {
|
|
|
9417
9542
|
const expressionText = expressions[i].text;
|
|
9418
9543
|
const sourceToLex = this._stripComments(expressionText);
|
|
9419
9544
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9420
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9545
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
|
|
9421
9546
|
.parseChain();
|
|
9422
9547
|
expressionNodes.push(ast);
|
|
9423
9548
|
}
|
|
@@ -9431,8 +9556,7 @@ class Parser$1 {
|
|
|
9431
9556
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9432
9557
|
const sourceToLex = this._stripComments(expression);
|
|
9433
9558
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9434
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9435
|
-
/* parseAction */ false, this.errors, 0)
|
|
9559
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9436
9560
|
.parseChain();
|
|
9437
9561
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
9438
9562
|
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
@@ -9449,10 +9573,12 @@ class Parser$1 {
|
|
|
9449
9573
|
* `SplitInterpolation` with splits that look like
|
|
9450
9574
|
* <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
|
|
9451
9575
|
*/
|
|
9452
|
-
splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9576
|
+
splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9577
|
+
var _a;
|
|
9453
9578
|
const strings = [];
|
|
9454
9579
|
const expressions = [];
|
|
9455
9580
|
const offsets = [];
|
|
9581
|
+
const inputToTemplateIndexMap = interpolatedTokens ? getIndexMapForOriginalTemplate(interpolatedTokens) : null;
|
|
9456
9582
|
let i = 0;
|
|
9457
9583
|
let atInterpolation = false;
|
|
9458
9584
|
let extendLastString = false;
|
|
@@ -9487,7 +9613,9 @@ class Parser$1 {
|
|
|
9487
9613
|
this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);
|
|
9488
9614
|
}
|
|
9489
9615
|
expressions.push({ text, start: fullStart, end: fullEnd });
|
|
9490
|
-
|
|
9616
|
+
const startInOriginalTemplate = (_a = inputToTemplateIndexMap === null || inputToTemplateIndexMap === void 0 ? void 0 : inputToTemplateIndexMap.get(fullStart)) !== null && _a !== void 0 ? _a : fullStart;
|
|
9617
|
+
const offset = startInOriginalTemplate + interpStart.length;
|
|
9618
|
+
offsets.push(offset);
|
|
9491
9619
|
i = fullEnd;
|
|
9492
9620
|
atInterpolation = false;
|
|
9493
9621
|
}
|
|
@@ -9603,12 +9731,12 @@ var ParseContextFlags;
|
|
|
9603
9731
|
ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
|
|
9604
9732
|
})(ParseContextFlags || (ParseContextFlags = {}));
|
|
9605
9733
|
class _ParseAST {
|
|
9606
|
-
constructor(input, location, absoluteOffset, tokens,
|
|
9734
|
+
constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {
|
|
9607
9735
|
this.input = input;
|
|
9608
9736
|
this.location = location;
|
|
9609
9737
|
this.absoluteOffset = absoluteOffset;
|
|
9610
9738
|
this.tokens = tokens;
|
|
9611
|
-
this.
|
|
9739
|
+
this.parseFlags = parseFlags;
|
|
9612
9740
|
this.errors = errors;
|
|
9613
9741
|
this.offset = offset;
|
|
9614
9742
|
this.rparensExpected = 0;
|
|
@@ -9785,7 +9913,7 @@ class _ParseAST {
|
|
|
9785
9913
|
const expr = this.parsePipe();
|
|
9786
9914
|
exprs.push(expr);
|
|
9787
9915
|
if (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
9788
|
-
if (!this.
|
|
9916
|
+
if (!(this.parseFlags & 1 /* Action */)) {
|
|
9789
9917
|
this.error('Binding expression cannot contain chained expression');
|
|
9790
9918
|
}
|
|
9791
9919
|
while (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
@@ -9809,7 +9937,7 @@ class _ParseAST {
|
|
|
9809
9937
|
const start = this.inputIndex;
|
|
9810
9938
|
let result = this.parseExpression();
|
|
9811
9939
|
if (this.consumeOptionalOperator('|')) {
|
|
9812
|
-
if (this.
|
|
9940
|
+
if (this.parseFlags & 1 /* Action */) {
|
|
9813
9941
|
this.error('Cannot have a pipe in an action expression');
|
|
9814
9942
|
}
|
|
9815
9943
|
do {
|
|
@@ -10152,7 +10280,7 @@ class _ParseAST {
|
|
|
10152
10280
|
const nameSpan = this.sourceSpan(nameStart);
|
|
10153
10281
|
let receiver;
|
|
10154
10282
|
if (isSafe) {
|
|
10155
|
-
if (this.
|
|
10283
|
+
if (this.consumeOptionalAssignment()) {
|
|
10156
10284
|
this.error('The \'?.\' operator cannot be used in the assignment');
|
|
10157
10285
|
receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10158
10286
|
}
|
|
@@ -10161,8 +10289,8 @@ class _ParseAST {
|
|
|
10161
10289
|
}
|
|
10162
10290
|
}
|
|
10163
10291
|
else {
|
|
10164
|
-
if (this.
|
|
10165
|
-
if (!this.
|
|
10292
|
+
if (this.consumeOptionalAssignment()) {
|
|
10293
|
+
if (!(this.parseFlags & 1 /* Action */)) {
|
|
10166
10294
|
this.error('Bindings cannot contain assignments');
|
|
10167
10295
|
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10168
10296
|
}
|
|
@@ -10188,6 +10316,22 @@ class _ParseAST {
|
|
|
10188
10316
|
return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) :
|
|
10189
10317
|
new Call(span, sourceSpan, receiver, args, argumentSpan);
|
|
10190
10318
|
}
|
|
10319
|
+
consumeOptionalAssignment() {
|
|
10320
|
+
// When parsing assignment events (originating from two-way-binding aka banana-in-a-box syntax),
|
|
10321
|
+
// it is valid for the primary expression to be terminated by the non-null operator. This
|
|
10322
|
+
// primary expression is substituted as LHS of the assignment operator to achieve
|
|
10323
|
+
// two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
|
|
10324
|
+
// naturally allow for this syntax, so assignment events are parsed specially.
|
|
10325
|
+
if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10326
|
+
this.peek(1).isOperator('=')) {
|
|
10327
|
+
// First skip over the ! operator.
|
|
10328
|
+
this.advance();
|
|
10329
|
+
// Then skip over the = operator, to fully consume the optional assignment operator.
|
|
10330
|
+
this.advance();
|
|
10331
|
+
return true;
|
|
10332
|
+
}
|
|
10333
|
+
return this.consumeOptionalOperator('=');
|
|
10334
|
+
}
|
|
10191
10335
|
parseCallArguments() {
|
|
10192
10336
|
if (this.next.isCharacter($RPAREN))
|
|
10193
10337
|
return [];
|
|
@@ -10480,6 +10624,41 @@ class SimpleExpressionChecker extends RecursiveAstVisitor {
|
|
|
10480
10624
|
this.errors.push('pipes');
|
|
10481
10625
|
}
|
|
10482
10626
|
}
|
|
10627
|
+
/**
|
|
10628
|
+
* Computes the real offset in the original template for indexes in an interpolation.
|
|
10629
|
+
*
|
|
10630
|
+
* Because templates can have encoded HTML entities and the input passed to the parser at this stage
|
|
10631
|
+
* of the compiler is the _decoded_ value, we need to compute the real offset using the original
|
|
10632
|
+
* encoded values in the interpolated tokens. Note that this is only a special case handling for
|
|
10633
|
+
* `MlParserTokenType.ENCODED_ENTITY` token types. All other interpolated tokens are expected to
|
|
10634
|
+
* have parts which exactly match the input string for parsing the interpolation.
|
|
10635
|
+
*
|
|
10636
|
+
* @param interpolatedTokens The tokens for the interpolated value.
|
|
10637
|
+
*
|
|
10638
|
+
* @returns A map of index locations in the decoded template to indexes in the original template
|
|
10639
|
+
*/
|
|
10640
|
+
function getIndexMapForOriginalTemplate(interpolatedTokens) {
|
|
10641
|
+
let offsetMap = new Map();
|
|
10642
|
+
let consumedInOriginalTemplate = 0;
|
|
10643
|
+
let consumedInInput = 0;
|
|
10644
|
+
let tokenIndex = 0;
|
|
10645
|
+
while (tokenIndex < interpolatedTokens.length) {
|
|
10646
|
+
const currentToken = interpolatedTokens[tokenIndex];
|
|
10647
|
+
if (currentToken.type === 9 /* ENCODED_ENTITY */) {
|
|
10648
|
+
const [decoded, encoded] = currentToken.parts;
|
|
10649
|
+
consumedInOriginalTemplate += encoded.length;
|
|
10650
|
+
consumedInInput += decoded.length;
|
|
10651
|
+
}
|
|
10652
|
+
else {
|
|
10653
|
+
const lengthOfParts = currentToken.parts.reduce((sum, current) => sum + current.length, 0);
|
|
10654
|
+
consumedInInput += lengthOfParts;
|
|
10655
|
+
consumedInOriginalTemplate += lengthOfParts;
|
|
10656
|
+
}
|
|
10657
|
+
offsetMap.set(consumedInInput, consumedInOriginalTemplate);
|
|
10658
|
+
tokenIndex++;
|
|
10659
|
+
}
|
|
10660
|
+
return offsetMap;
|
|
10661
|
+
}
|
|
10483
10662
|
|
|
10484
10663
|
/**
|
|
10485
10664
|
* @license
|
|
@@ -13721,7 +13900,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
13721
13900
|
}
|
|
13722
13901
|
}
|
|
13723
13902
|
decodeHexDigits(start, length) {
|
|
13724
|
-
const hex = this.input.
|
|
13903
|
+
const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
|
|
13725
13904
|
const charCode = parseInt(hex, 16);
|
|
13726
13905
|
if (!isNaN(charCode)) {
|
|
13727
13906
|
return charCode;
|
|
@@ -14878,7 +15057,7 @@ class BindingParser {
|
|
|
14878
15057
|
// Regardless, neither of these values are used in Ivy but are only here to satisfy the
|
|
14879
15058
|
// function signature. This should likely be refactored in the future so that `sourceSpan`
|
|
14880
15059
|
// isn't being used inaccurately.
|
|
14881
|
-
this.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
|
|
15060
|
+
this.parseEvent(propName, expression, /* isAssignmentEvent */ false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
|
|
14882
15061
|
}
|
|
14883
15062
|
else {
|
|
14884
15063
|
this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
|
|
@@ -14886,11 +15065,11 @@ class BindingParser {
|
|
|
14886
15065
|
}
|
|
14887
15066
|
return targetEvents;
|
|
14888
15067
|
}
|
|
14889
|
-
parseInterpolation(value, sourceSpan) {
|
|
15068
|
+
parseInterpolation(value, sourceSpan, interpolatedTokens) {
|
|
14890
15069
|
const sourceInfo = sourceSpan.start.toString();
|
|
14891
15070
|
const absoluteOffset = sourceSpan.fullStart.offset;
|
|
14892
15071
|
try {
|
|
14893
|
-
const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15072
|
+
const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, interpolatedTokens, this._interpolationConfig);
|
|
14894
15073
|
if (ast)
|
|
14895
15074
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
|
14896
15075
|
return ast;
|
|
@@ -15027,8 +15206,8 @@ class BindingParser {
|
|
|
15027
15206
|
this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15028
15207
|
}
|
|
15029
15208
|
}
|
|
15030
|
-
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
|
|
15031
|
-
const expr = this.parseInterpolation(value, valueSpan || sourceSpan);
|
|
15209
|
+
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
|
|
15210
|
+
const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
|
|
15032
15211
|
if (expr) {
|
|
15033
15212
|
this._parsePropertyAst(name, expr, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15034
15213
|
return true;
|
|
@@ -15115,30 +15294,30 @@ class BindingParser {
|
|
|
15115
15294
|
return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15116
15295
|
}
|
|
15117
15296
|
// TODO: keySpan should be required but was made optional to avoid changing VE parser.
|
|
15118
|
-
parseEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15297
|
+
parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15119
15298
|
if (name.length === 0) {
|
|
15120
15299
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
15121
15300
|
}
|
|
15122
15301
|
if (isAnimationLabel(name)) {
|
|
15123
|
-
name = name.
|
|
15302
|
+
name = name.slice(1);
|
|
15124
15303
|
if (keySpan !== undefined) {
|
|
15125
15304
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
15126
15305
|
}
|
|
15127
|
-
this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
15306
|
+
this._parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
15128
15307
|
}
|
|
15129
15308
|
else {
|
|
15130
|
-
this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
15309
|
+
this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
15131
15310
|
}
|
|
15132
15311
|
}
|
|
15133
15312
|
calcPossibleSecurityContexts(selector, propName, isAttribute) {
|
|
15134
15313
|
const prop = this._schemaRegistry.getMappedPropName(propName);
|
|
15135
15314
|
return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
|
|
15136
15315
|
}
|
|
15137
|
-
_parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
15316
|
+
_parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
15138
15317
|
const matches = splitAtPeriod(name, [name, '']);
|
|
15139
15318
|
const eventName = matches[0];
|
|
15140
15319
|
const phase = matches[1].toLowerCase();
|
|
15141
|
-
const ast = this._parseAction(expression, handlerSpan);
|
|
15320
|
+
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15142
15321
|
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15143
15322
|
if (eventName.length === 0) {
|
|
15144
15323
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
@@ -15152,20 +15331,20 @@ class BindingParser {
|
|
|
15152
15331
|
this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
|
|
15153
15332
|
}
|
|
15154
15333
|
}
|
|
15155
|
-
_parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15334
|
+
_parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15156
15335
|
// long format: 'target: eventName'
|
|
15157
15336
|
const [target, eventName] = splitAtColon(name, [null, name]);
|
|
15158
|
-
const ast = this._parseAction(expression, handlerSpan);
|
|
15337
|
+
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15159
15338
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15160
15339
|
targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15161
15340
|
// Don't detect directives for event names for now,
|
|
15162
15341
|
// so don't add the event name to the matchableAttrs
|
|
15163
15342
|
}
|
|
15164
|
-
_parseAction(value, sourceSpan) {
|
|
15343
|
+
_parseAction(value, isAssignmentEvent, sourceSpan) {
|
|
15165
15344
|
const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
|
|
15166
15345
|
const absoluteOffset = (sourceSpan && sourceSpan.start) ? sourceSpan.start.offset : 0;
|
|
15167
15346
|
try {
|
|
15168
|
-
const ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15347
|
+
const ast = this._exprParser.parseAction(value, isAssignmentEvent, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15169
15348
|
if (ast) {
|
|
15170
15349
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
|
15171
15350
|
}
|
|
@@ -15525,7 +15704,7 @@ class HtmlAstToIvyAst {
|
|
|
15525
15704
|
return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
|
|
15526
15705
|
}
|
|
15527
15706
|
visitText(text) {
|
|
15528
|
-
return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.i18n);
|
|
15707
|
+
return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.tokens, text.i18n);
|
|
15529
15708
|
}
|
|
15530
15709
|
visitExpansion(expansion) {
|
|
15531
15710
|
if (!expansion.i18n) {
|
|
@@ -15555,7 +15734,7 @@ class HtmlAstToIvyAst {
|
|
|
15555
15734
|
vars[formattedKey] = new BoundText(ast, value.sourceSpan);
|
|
15556
15735
|
}
|
|
15557
15736
|
else {
|
|
15558
|
-
placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan);
|
|
15737
|
+
placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan, null);
|
|
15559
15738
|
}
|
|
15560
15739
|
});
|
|
15561
15740
|
return new Icu$1(vars, placeholders, expansion.sourceSpan, message);
|
|
@@ -15589,6 +15768,7 @@ class HtmlAstToIvyAst {
|
|
|
15589
15768
|
return { bound, literal };
|
|
15590
15769
|
}
|
|
15591
15770
|
parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) {
|
|
15771
|
+
var _a;
|
|
15592
15772
|
const name = normalizeAttributeName(attribute.name);
|
|
15593
15773
|
const value = attribute.value;
|
|
15594
15774
|
const srcSpan = attribute.sourceSpan;
|
|
@@ -15627,7 +15807,7 @@ class HtmlAstToIvyAst {
|
|
|
15627
15807
|
const events = [];
|
|
15628
15808
|
const identifier = bindParts[IDENT_KW_IDX];
|
|
15629
15809
|
const keySpan = createKeySpan(srcSpan, bindParts[KW_ON_IDX], identifier);
|
|
15630
|
-
this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15810
|
+
this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15631
15811
|
addEvents(events, boundEvents);
|
|
15632
15812
|
}
|
|
15633
15813
|
else if (bindParts[KW_BINDON_IDX]) {
|
|
@@ -15671,19 +15851,19 @@ class HtmlAstToIvyAst {
|
|
|
15671
15851
|
}
|
|
15672
15852
|
else {
|
|
15673
15853
|
const events = [];
|
|
15674
|
-
this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15854
|
+
this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15675
15855
|
addEvents(events, boundEvents);
|
|
15676
15856
|
}
|
|
15677
15857
|
return true;
|
|
15678
15858
|
}
|
|
15679
15859
|
// No explicit binding found.
|
|
15680
15860
|
const keySpan = createKeySpan(srcSpan, '' /* prefix */, name);
|
|
15681
|
-
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
|
|
15861
|
+
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, (_a = attribute.valueTokens) !== null && _a !== void 0 ? _a : null);
|
|
15682
15862
|
return hasBinding;
|
|
15683
15863
|
}
|
|
15684
|
-
_visitTextWithInterpolation(value, sourceSpan, i18n) {
|
|
15864
|
+
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
|
|
15685
15865
|
const valueNoNgsp = replaceNgsp(value);
|
|
15686
|
-
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan);
|
|
15866
|
+
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
|
|
15687
15867
|
return expr ? new BoundText(expr, sourceSpan, i18n) : new Text$3(valueNoNgsp, sourceSpan);
|
|
15688
15868
|
}
|
|
15689
15869
|
parseVariable(identifier, value, sourceSpan, keySpan, valueSpan, variables) {
|
|
@@ -15709,7 +15889,7 @@ class HtmlAstToIvyAst {
|
|
|
15709
15889
|
}
|
|
15710
15890
|
parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan) {
|
|
15711
15891
|
const events = [];
|
|
15712
|
-
this.bindingParser.parseEvent(`${name}Change`, `${expression}=$event`, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
|
|
15892
|
+
this.bindingParser.parseEvent(`${name}Change`, `${expression} =$event`, /* isAssignmentEvent */ true, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
|
|
15713
15893
|
addEvents(events, boundEvents);
|
|
15714
15894
|
}
|
|
15715
15895
|
reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
|
|
@@ -16498,7 +16678,8 @@ class I18nMetaVisitor {
|
|
|
16498
16678
|
*/
|
|
16499
16679
|
_parseMetadata(meta) {
|
|
16500
16680
|
return typeof meta === 'string' ? parseI18nMeta(meta) :
|
|
16501
|
-
meta instanceof Message ? meta :
|
|
16681
|
+
meta instanceof Message ? meta :
|
|
16682
|
+
{};
|
|
16502
16683
|
}
|
|
16503
16684
|
/**
|
|
16504
16685
|
* Generate (or restore) message id if not specified already.
|
|
@@ -16523,9 +16704,9 @@ class I18nMetaVisitor {
|
|
|
16523
16704
|
// `packages/compiler/src/render3/view/template.ts`).
|
|
16524
16705
|
// In that case we want to reuse the legacy message generated in the 1st pass (see
|
|
16525
16706
|
// `setI18nRefs()`).
|
|
16526
|
-
const previousMessage = meta instanceof Message ?
|
|
16527
|
-
meta :
|
|
16528
|
-
|
|
16707
|
+
const previousMessage = meta instanceof Message ? meta :
|
|
16708
|
+
meta instanceof IcuPlaceholder ? meta.previousMessage :
|
|
16709
|
+
undefined;
|
|
16529
16710
|
message.legacyIds = previousMessage ? previousMessage.legacyIds : [];
|
|
16530
16711
|
}
|
|
16531
16712
|
}
|
|
@@ -16570,10 +16751,14 @@ function i18nMetaToJSDoc(meta) {
|
|
|
16570
16751
|
if (meta.description) {
|
|
16571
16752
|
tags.push({ tagName: "desc" /* Desc */, text: meta.description });
|
|
16572
16753
|
}
|
|
16754
|
+
else {
|
|
16755
|
+
// Suppress the JSCompiler warning that a `@desc` was not given for this message.
|
|
16756
|
+
tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
|
|
16757
|
+
}
|
|
16573
16758
|
if (meta.meaning) {
|
|
16574
16759
|
tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
|
|
16575
16760
|
}
|
|
16576
|
-
return
|
|
16761
|
+
return jsDocComment(tags);
|
|
16577
16762
|
}
|
|
16578
16763
|
|
|
16579
16764
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
@@ -16591,10 +16776,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
|
|
|
16591
16776
|
// const MSG_... = goog.getMsg(..);
|
|
16592
16777
|
// I18N_X = MSG_...;
|
|
16593
16778
|
const googGetMsgStmt = closureVar.set(variable(GOOG_GET_MSG).callFn(args)).toConstDecl();
|
|
16594
|
-
|
|
16595
|
-
if (metaComment !== null) {
|
|
16596
|
-
googGetMsgStmt.addLeadingComment(metaComment);
|
|
16597
|
-
}
|
|
16779
|
+
googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
|
|
16598
16780
|
const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
|
|
16599
16781
|
return [googGetMsgStmt, i18nAssignmentStmt];
|
|
16600
16782
|
}
|
|
@@ -16775,13 +16957,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16775
16957
|
scope.getOrCreateSharedContextVar(0);
|
|
16776
16958
|
const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
|
|
16777
16959
|
const statements = [];
|
|
16778
|
-
|
|
16960
|
+
const variableDeclarations = scope === null || scope === void 0 ? void 0 : scope.variableDeclarations();
|
|
16961
|
+
const restoreViewStatement = scope === null || scope === void 0 ? void 0 : scope.restoreViewStatement();
|
|
16962
|
+
if (variableDeclarations) {
|
|
16779
16963
|
// `variableDeclarations` needs to run first, because
|
|
16780
16964
|
// `restoreViewStatement` depends on the result.
|
|
16781
|
-
statements.push(...
|
|
16782
|
-
statements.unshift(...scope.restoreViewStatement());
|
|
16965
|
+
statements.push(...variableDeclarations);
|
|
16783
16966
|
}
|
|
16784
16967
|
statements.push(...bindingStatements);
|
|
16968
|
+
if (restoreViewStatement) {
|
|
16969
|
+
statements.unshift(restoreViewStatement);
|
|
16970
|
+
// If there's a `restoreView` call, we need to reset the view at the end of the listener
|
|
16971
|
+
// in order to avoid a leak. If there's a `return` statement already, we wrap it in the
|
|
16972
|
+
// call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
|
|
16973
|
+
const lastStatement = statements[statements.length - 1];
|
|
16974
|
+
if (lastStatement instanceof ReturnStatement) {
|
|
16975
|
+
statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
|
|
16976
|
+
}
|
|
16977
|
+
else {
|
|
16978
|
+
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16979
|
+
}
|
|
16980
|
+
}
|
|
16785
16981
|
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16786
16982
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16787
16983
|
const fnArgs = [];
|
|
@@ -16925,9 +17121,9 @@ class TemplateDefinitionBuilder {
|
|
|
16925
17121
|
this.i18nEnd(null, selfClosingI18nInstruction);
|
|
16926
17122
|
}
|
|
16927
17123
|
// Generate all the creation mode instructions (e.g. resolve bindings in listeners)
|
|
16928
|
-
const creationStatements = this._creationCodeFns
|
|
17124
|
+
const creationStatements = getInstructionStatements(this._creationCodeFns);
|
|
16929
17125
|
// Generate all the update mode instructions (e.g. resolve property or text bindings)
|
|
16930
|
-
const updateStatements = this._updateCodeFns
|
|
17126
|
+
const updateStatements = getInstructionStatements(this._updateCodeFns);
|
|
16931
17127
|
// Variable declaration must occur after binding resolution so we can generate context
|
|
16932
17128
|
// instructions that build on each other.
|
|
16933
17129
|
// e.g. const b = nextContext().$implicit(); const b = nextContext();
|
|
@@ -17080,7 +17276,7 @@ class TemplateDefinitionBuilder {
|
|
|
17080
17276
|
if (Object.keys(icuMapping).length) {
|
|
17081
17277
|
args.push(mapLiteral(icuMapping, true));
|
|
17082
17278
|
}
|
|
17083
|
-
return
|
|
17279
|
+
return invokeInstruction(null, Identifiers.i18nPostprocess, args);
|
|
17084
17280
|
};
|
|
17085
17281
|
}
|
|
17086
17282
|
this.i18nTranslate(meta, params, context.ref, transformFn);
|
|
@@ -17115,14 +17311,12 @@ class TemplateDefinitionBuilder {
|
|
|
17115
17311
|
// setup accumulated bindings
|
|
17116
17312
|
const { index, bindings } = this.i18n;
|
|
17117
17313
|
if (bindings.size) {
|
|
17118
|
-
const
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
// necessary lifecycle hooks of components/directives are properly flushed.
|
|
17125
|
-
this.updateInstructionChainWithAdvance(this.getConstCount() - 1, Identifiers.i18nExp, chainBindings);
|
|
17314
|
+
for (const binding of bindings) {
|
|
17315
|
+
// for i18n block, advance to the most recent element index (by taking the current number of
|
|
17316
|
+
// elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
|
|
17317
|
+
// necessary lifecycle hooks of components/directives are properly flushed.
|
|
17318
|
+
this.updateInstructionWithAdvance(this.getConstCount() - 1, span, Identifiers.i18nExp, () => this.convertPropertyBinding(binding));
|
|
17319
|
+
}
|
|
17126
17320
|
this.updateInstruction(span, Identifiers.i18nApply, [literal(index)]);
|
|
17127
17321
|
}
|
|
17128
17322
|
if (!selfClosing) {
|
|
@@ -17133,7 +17327,6 @@ class TemplateDefinitionBuilder {
|
|
|
17133
17327
|
i18nAttributesInstruction(nodeIndex, attrs, sourceSpan) {
|
|
17134
17328
|
let hasBindings = false;
|
|
17135
17329
|
const i18nAttrArgs = [];
|
|
17136
|
-
const bindings = [];
|
|
17137
17330
|
attrs.forEach(attr => {
|
|
17138
17331
|
const message = attr.i18n;
|
|
17139
17332
|
const converted = attr.value.visit(this._valueConverter);
|
|
@@ -17144,16 +17337,10 @@ class TemplateDefinitionBuilder {
|
|
|
17144
17337
|
i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
|
|
17145
17338
|
converted.expressions.forEach(expression => {
|
|
17146
17339
|
hasBindings = true;
|
|
17147
|
-
|
|
17148
|
-
sourceSpan,
|
|
17149
|
-
value: () => this.convertPropertyBinding(expression),
|
|
17150
|
-
});
|
|
17340
|
+
this.updateInstructionWithAdvance(nodeIndex, sourceSpan, Identifiers.i18nExp, () => this.convertPropertyBinding(expression));
|
|
17151
17341
|
});
|
|
17152
17342
|
}
|
|
17153
17343
|
});
|
|
17154
|
-
if (bindings.length > 0) {
|
|
17155
|
-
this.updateInstructionChainWithAdvance(nodeIndex, Identifiers.i18nExp, bindings);
|
|
17156
|
-
}
|
|
17157
17344
|
if (i18nAttrArgs.length > 0) {
|
|
17158
17345
|
const index = literal(this.allocateDataSlot());
|
|
17159
17346
|
const constIndex = this.addToConsts(literalArr(i18nAttrArgs));
|
|
@@ -17282,11 +17469,9 @@ class TemplateDefinitionBuilder {
|
|
|
17282
17469
|
}
|
|
17283
17470
|
// Generate Listeners (outputs)
|
|
17284
17471
|
if (element.outputs.length > 0) {
|
|
17285
|
-
const
|
|
17286
|
-
|
|
17287
|
-
|
|
17288
|
-
}));
|
|
17289
|
-
this.creationInstructionChain(Identifiers.listener, listeners);
|
|
17472
|
+
for (const outputAst of element.outputs) {
|
|
17473
|
+
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(element.name, outputAst, elementIndex));
|
|
17474
|
+
}
|
|
17290
17475
|
}
|
|
17291
17476
|
// Note: it's important to keep i18n/i18nStart instructions after i18nAttributes and
|
|
17292
17477
|
// listeners, to make sure i18nAttributes instruction targets current element at runtime.
|
|
@@ -17327,9 +17512,8 @@ class TemplateDefinitionBuilder {
|
|
|
17327
17512
|
const hasValue = value instanceof LiteralPrimitive ? !!value.value : true;
|
|
17328
17513
|
this.allocateBindingSlots(value);
|
|
17329
17514
|
propertyBindings.push({
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
value: () => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction
|
|
17515
|
+
span: input.sourceSpan,
|
|
17516
|
+
paramsOrFn: getBindingFunctionParams(() => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction, prepareSyntheticPropertyName(input.name))
|
|
17333
17517
|
});
|
|
17334
17518
|
}
|
|
17335
17519
|
else {
|
|
@@ -17366,10 +17550,8 @@ class TemplateDefinitionBuilder {
|
|
|
17366
17550
|
// [prop]="value"
|
|
17367
17551
|
// Collect all the properties so that we can chain into a single function at the end.
|
|
17368
17552
|
propertyBindings.push({
|
|
17369
|
-
|
|
17370
|
-
|
|
17371
|
-
value: () => this.convertPropertyBinding(value),
|
|
17372
|
-
params
|
|
17553
|
+
span: input.sourceSpan,
|
|
17554
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), attrName, params)
|
|
17373
17555
|
});
|
|
17374
17556
|
}
|
|
17375
17557
|
}
|
|
@@ -17383,10 +17565,8 @@ class TemplateDefinitionBuilder {
|
|
|
17383
17565
|
// [attr.name]="value" or attr.name="{{value}}"
|
|
17384
17566
|
// Collect the attribute bindings so that they can be chained at the end.
|
|
17385
17567
|
attributeBindings.push({
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
value: () => this.convertPropertyBinding(boundValue),
|
|
17389
|
-
params
|
|
17568
|
+
span: input.sourceSpan,
|
|
17569
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(boundValue), attrName, params)
|
|
17390
17570
|
});
|
|
17391
17571
|
}
|
|
17392
17572
|
}
|
|
@@ -17402,11 +17582,11 @@ class TemplateDefinitionBuilder {
|
|
|
17402
17582
|
}
|
|
17403
17583
|
}
|
|
17404
17584
|
});
|
|
17405
|
-
|
|
17406
|
-
this.
|
|
17585
|
+
for (const propertyBinding of propertyBindings) {
|
|
17586
|
+
this.updateInstructionWithAdvance(elementIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
|
|
17407
17587
|
}
|
|
17408
|
-
|
|
17409
|
-
this.
|
|
17588
|
+
for (const attributeBinding of attributeBindings) {
|
|
17589
|
+
this.updateInstructionWithAdvance(elementIndex, attributeBinding.span, Identifiers.attribute, attributeBinding.paramsOrFn);
|
|
17410
17590
|
}
|
|
17411
17591
|
// Traverse element child nodes
|
|
17412
17592
|
visitAll$1(this, element.children);
|
|
@@ -17486,12 +17666,8 @@ class TemplateDefinitionBuilder {
|
|
|
17486
17666
|
this.templatePropertyBindings(templateIndex, inputs);
|
|
17487
17667
|
}
|
|
17488
17668
|
// Generate listeners for directive output
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
sourceSpan: outputAst.sourceSpan,
|
|
17492
|
-
params: this.prepareListenerParameter('ng_template', outputAst, templateIndex)
|
|
17493
|
-
}));
|
|
17494
|
-
this.creationInstructionChain(Identifiers.listener, listeners);
|
|
17669
|
+
for (const outputAst of template.outputs) {
|
|
17670
|
+
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter('ng_template', outputAst, templateIndex));
|
|
17495
17671
|
}
|
|
17496
17672
|
}
|
|
17497
17673
|
}
|
|
@@ -17546,7 +17722,7 @@ class TemplateDefinitionBuilder {
|
|
|
17546
17722
|
const transformFn = (raw) => {
|
|
17547
17723
|
const params = Object.assign(Object.assign({}, vars), placeholders);
|
|
17548
17724
|
const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
|
|
17549
|
-
return
|
|
17725
|
+
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
17550
17726
|
};
|
|
17551
17727
|
// in case the whole i18n message is a single ICU - we do not need to
|
|
17552
17728
|
// create a separate top-level translation, we can use the root ref instead
|
|
@@ -17588,32 +17764,33 @@ class TemplateDefinitionBuilder {
|
|
|
17588
17764
|
}
|
|
17589
17765
|
templatePropertyBindings(templateIndex, attrs) {
|
|
17590
17766
|
const propertyBindings = [];
|
|
17591
|
-
|
|
17592
|
-
if (input instanceof BoundAttribute) {
|
|
17593
|
-
|
|
17594
|
-
if (value !== undefined) {
|
|
17595
|
-
this.allocateBindingSlots(value);
|
|
17596
|
-
if (value instanceof Interpolation) {
|
|
17597
|
-
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
|
17598
|
-
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
|
17599
|
-
// inputs to directives), so keep params array empty.
|
|
17600
|
-
const params = [];
|
|
17601
|
-
// prop="{{value}}" case
|
|
17602
|
-
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
|
|
17603
|
-
}
|
|
17604
|
-
else {
|
|
17605
|
-
// [prop]="value" case
|
|
17606
|
-
propertyBindings.push({
|
|
17607
|
-
name: input.name,
|
|
17608
|
-
sourceSpan: input.sourceSpan,
|
|
17609
|
-
value: () => this.convertPropertyBinding(value)
|
|
17610
|
-
});
|
|
17611
|
-
}
|
|
17612
|
-
}
|
|
17767
|
+
for (const input of attrs) {
|
|
17768
|
+
if (!(input instanceof BoundAttribute)) {
|
|
17769
|
+
continue;
|
|
17613
17770
|
}
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17771
|
+
const value = input.value.visit(this._valueConverter);
|
|
17772
|
+
if (value === undefined) {
|
|
17773
|
+
continue;
|
|
17774
|
+
}
|
|
17775
|
+
this.allocateBindingSlots(value);
|
|
17776
|
+
if (value instanceof Interpolation) {
|
|
17777
|
+
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
|
17778
|
+
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
|
17779
|
+
// inputs to directives), so keep params array empty.
|
|
17780
|
+
const params = [];
|
|
17781
|
+
// prop="{{value}}" case
|
|
17782
|
+
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
|
|
17783
|
+
}
|
|
17784
|
+
else {
|
|
17785
|
+
// [prop]="value" case
|
|
17786
|
+
propertyBindings.push({
|
|
17787
|
+
span: input.sourceSpan,
|
|
17788
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), input.name)
|
|
17789
|
+
});
|
|
17790
|
+
}
|
|
17791
|
+
}
|
|
17792
|
+
for (const propertyBinding of propertyBindings) {
|
|
17793
|
+
this.updateInstructionWithAdvance(templateIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
|
|
17617
17794
|
}
|
|
17618
17795
|
}
|
|
17619
17796
|
// Bindings must only be resolved after all local refs have been visited, so all
|
|
@@ -17621,39 +17798,23 @@ class TemplateDefinitionBuilder {
|
|
|
17621
17798
|
// Otherwise, we wouldn't be able to support local refs that are defined after their
|
|
17622
17799
|
// bindings. e.g. {{ foo }} <div #foo></div>
|
|
17623
17800
|
instructionFn(fns, span, reference, paramsOrFn, prepend = false) {
|
|
17624
|
-
fns[prepend ? 'unshift' : 'push'](
|
|
17625
|
-
const params = Array.isArray(paramsOrFn) ? paramsOrFn : paramsOrFn();
|
|
17626
|
-
return instruction(span, reference, params).toStmt();
|
|
17627
|
-
});
|
|
17801
|
+
fns[prepend ? 'unshift' : 'push']({ span, reference, paramsOrFn });
|
|
17628
17802
|
}
|
|
17629
17803
|
processStylingUpdateInstruction(elementIndex, instruction) {
|
|
17630
17804
|
let allocateBindingSlots = 0;
|
|
17631
17805
|
if (instruction) {
|
|
17632
|
-
const calls
|
|
17633
|
-
instruction.calls.forEach(call => {
|
|
17806
|
+
for (const call of instruction.calls) {
|
|
17634
17807
|
allocateBindingSlots += call.allocateBindingSlots;
|
|
17635
|
-
|
|
17636
|
-
|
|
17637
|
-
value
|
|
17638
|
-
|
|
17639
|
-
this.getUpdateInstructionArguments(value) :
|
|
17640
|
-
this.convertPropertyBinding(value));
|
|
17641
|
-
}
|
|
17642
|
-
});
|
|
17643
|
-
});
|
|
17644
|
-
this.updateInstructionChainWithAdvance(elementIndex, instruction.reference, calls);
|
|
17808
|
+
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
|
|
17809
|
+
this.getUpdateInstructionArguments(value) :
|
|
17810
|
+
this.convertPropertyBinding(value)));
|
|
17811
|
+
}
|
|
17645
17812
|
}
|
|
17646
17813
|
return allocateBindingSlots;
|
|
17647
17814
|
}
|
|
17648
17815
|
creationInstruction(span, reference, paramsOrFn, prepend) {
|
|
17649
17816
|
this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend);
|
|
17650
17817
|
}
|
|
17651
|
-
creationInstructionChain(reference, calls) {
|
|
17652
|
-
const span = calls.length ? calls[0].sourceSpan : null;
|
|
17653
|
-
this._creationCodeFns.push(() => {
|
|
17654
|
-
return chainedInstruction(reference, calls.map(call => call.params()), span).toStmt();
|
|
17655
|
-
});
|
|
17656
|
-
}
|
|
17657
17818
|
updateInstructionWithAdvance(nodeIndex, span, reference, paramsOrFn) {
|
|
17658
17819
|
this.addAdvanceInstructionIfNecessary(nodeIndex, span);
|
|
17659
17820
|
this.updateInstruction(span, reference, paramsOrFn);
|
|
@@ -17661,28 +17822,6 @@ class TemplateDefinitionBuilder {
|
|
|
17661
17822
|
updateInstruction(span, reference, paramsOrFn) {
|
|
17662
17823
|
this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
|
|
17663
17824
|
}
|
|
17664
|
-
updateInstructionChain(reference, bindings) {
|
|
17665
|
-
const span = bindings.length ? bindings[0].sourceSpan : null;
|
|
17666
|
-
this._updateCodeFns.push(() => {
|
|
17667
|
-
const calls = bindings.map(property => {
|
|
17668
|
-
const value = property.value();
|
|
17669
|
-
const fnParams = Array.isArray(value) ? value : [value];
|
|
17670
|
-
if (property.params) {
|
|
17671
|
-
fnParams.push(...property.params);
|
|
17672
|
-
}
|
|
17673
|
-
if (property.name) {
|
|
17674
|
-
// We want the property name to always be the first function parameter.
|
|
17675
|
-
fnParams.unshift(literal(property.name));
|
|
17676
|
-
}
|
|
17677
|
-
return fnParams;
|
|
17678
|
-
});
|
|
17679
|
-
return chainedInstruction(reference, calls, span).toStmt();
|
|
17680
|
-
});
|
|
17681
|
-
}
|
|
17682
|
-
updateInstructionChainWithAdvance(nodeIndex, reference, bindings) {
|
|
17683
|
-
this.addAdvanceInstructionIfNecessary(nodeIndex, bindings.length ? bindings[0].sourceSpan : null);
|
|
17684
|
-
this.updateInstructionChain(reference, bindings);
|
|
17685
|
-
}
|
|
17686
17825
|
addAdvanceInstructionIfNecessary(nodeIndex, span) {
|
|
17687
17826
|
if (nodeIndex !== this._currentIndex) {
|
|
17688
17827
|
const delta = nodeIndex - this._currentIndex;
|
|
@@ -17968,9 +18107,6 @@ function pureFunctionCallInfo(args) {
|
|
|
17968
18107
|
isVarLength: !identifier,
|
|
17969
18108
|
};
|
|
17970
18109
|
}
|
|
17971
|
-
function instruction(span, reference, params) {
|
|
17972
|
-
return importExpr(reference, null, span).callFn(params, span);
|
|
17973
|
-
}
|
|
17974
18110
|
// e.g. x(2);
|
|
17975
18111
|
function generateNextContextExpr(relativeLevelDiff) {
|
|
17976
18112
|
return importExpr(Identifiers.nextContext)
|
|
@@ -18173,21 +18309,22 @@ class BindingScope {
|
|
|
18173
18309
|
}
|
|
18174
18310
|
}
|
|
18175
18311
|
restoreViewStatement() {
|
|
18176
|
-
const statements = [];
|
|
18177
18312
|
if (this.restoreViewVariable) {
|
|
18178
|
-
const restoreCall =
|
|
18313
|
+
const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
|
|
18179
18314
|
// Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
|
|
18180
18315
|
// depending on whether it is being used.
|
|
18181
|
-
|
|
18316
|
+
return this.usesRestoredViewContext ?
|
|
18182
18317
|
variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
|
|
18183
|
-
restoreCall.toStmt()
|
|
18318
|
+
restoreCall.toStmt();
|
|
18184
18319
|
}
|
|
18185
|
-
return
|
|
18320
|
+
return null;
|
|
18186
18321
|
}
|
|
18187
18322
|
viewSnapshotStatements() {
|
|
18188
18323
|
// const $state$ = getCurrentView();
|
|
18189
18324
|
return this.restoreViewVariable ?
|
|
18190
|
-
[
|
|
18325
|
+
[
|
|
18326
|
+
this.restoreViewVariable.set(invokeInstruction(null, Identifiers.getCurrentView, [])).toConstDecl()
|
|
18327
|
+
] :
|
|
18191
18328
|
[];
|
|
18192
18329
|
}
|
|
18193
18330
|
isListenerScope() {
|
|
@@ -18460,6 +18597,20 @@ function isTextNode(node) {
|
|
|
18460
18597
|
function hasTextChildrenOnly(children) {
|
|
18461
18598
|
return children.every(isTextNode);
|
|
18462
18599
|
}
|
|
18600
|
+
function getBindingFunctionParams(deferredParams, name, eagerParams) {
|
|
18601
|
+
return () => {
|
|
18602
|
+
const value = deferredParams();
|
|
18603
|
+
const fnParams = Array.isArray(value) ? value : [value];
|
|
18604
|
+
if (eagerParams) {
|
|
18605
|
+
fnParams.push(...eagerParams);
|
|
18606
|
+
}
|
|
18607
|
+
if (name) {
|
|
18608
|
+
// We want the property name to always be the first function parameter.
|
|
18609
|
+
fnParams.unshift(literal(name));
|
|
18610
|
+
}
|
|
18611
|
+
return fnParams;
|
|
18612
|
+
};
|
|
18613
|
+
}
|
|
18463
18614
|
/** Name of the global variable that is used to determine if we use Closure translations or not */
|
|
18464
18615
|
const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
|
|
18465
18616
|
/**
|
|
@@ -18556,6 +18707,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18556
18707
|
if (meta.exportAs !== null) {
|
|
18557
18708
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
18558
18709
|
}
|
|
18710
|
+
if (meta.isStandalone) {
|
|
18711
|
+
definitionMap.set('standalone', literal(true));
|
|
18712
|
+
}
|
|
18559
18713
|
return definitionMap;
|
|
18560
18714
|
}
|
|
18561
18715
|
/**
|
|
@@ -18841,14 +18995,14 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18841
18995
|
if (classAttr !== undefined) {
|
|
18842
18996
|
styleBuilder.registerClassAttr(classAttr);
|
|
18843
18997
|
}
|
|
18844
|
-
const
|
|
18845
|
-
const
|
|
18998
|
+
const createInstructions = [];
|
|
18999
|
+
const updateInstructions = [];
|
|
19000
|
+
const updateVariables = [];
|
|
18846
19001
|
const hostBindingSourceSpan = typeSourceSpan;
|
|
18847
19002
|
// Calculate host event bindings
|
|
18848
19003
|
const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
|
|
18849
19004
|
if (eventBindings && eventBindings.length) {
|
|
18850
|
-
|
|
18851
|
-
createStatements.push(...listeners);
|
|
19005
|
+
createInstructions.push(...createHostListeners(eventBindings, name));
|
|
18852
19006
|
}
|
|
18853
19007
|
// Calculate the host property bindings
|
|
18854
19008
|
const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
|
|
@@ -18884,7 +19038,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18884
19038
|
const propertyBindings = [];
|
|
18885
19039
|
const attributeBindings = [];
|
|
18886
19040
|
const syntheticHostBindings = [];
|
|
18887
|
-
|
|
19041
|
+
for (const binding of allOtherBindings) {
|
|
18888
19042
|
// resolve literal arrays and literal objects
|
|
18889
19043
|
const value = binding.expression.visit(getValueConverter());
|
|
18890
19044
|
const bindingExpr = bindingFn(bindingContext, value);
|
|
@@ -18910,7 +19064,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18910
19064
|
if (sanitizerFn) {
|
|
18911
19065
|
instructionParams.push(sanitizerFn);
|
|
18912
19066
|
}
|
|
18913
|
-
|
|
19067
|
+
updateVariables.push(...bindingExpr.stmts);
|
|
18914
19068
|
if (instruction === Identifiers.hostProperty) {
|
|
18915
19069
|
propertyBindings.push(instructionParams);
|
|
18916
19070
|
}
|
|
@@ -18921,17 +19075,17 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18921
19075
|
syntheticHostBindings.push(instructionParams);
|
|
18922
19076
|
}
|
|
18923
19077
|
else {
|
|
18924
|
-
|
|
19078
|
+
updateInstructions.push({ reference: instruction, paramsOrFn: instructionParams, span: null });
|
|
18925
19079
|
}
|
|
18926
|
-
});
|
|
18927
|
-
if (propertyBindings.length > 0) {
|
|
18928
|
-
updateStatements.push(chainedInstruction(Identifiers.hostProperty, propertyBindings).toStmt());
|
|
18929
19080
|
}
|
|
18930
|
-
|
|
18931
|
-
|
|
19081
|
+
for (const bindingParams of propertyBindings) {
|
|
19082
|
+
updateInstructions.push({ reference: Identifiers.hostProperty, paramsOrFn: bindingParams, span: null });
|
|
18932
19083
|
}
|
|
18933
|
-
|
|
18934
|
-
|
|
19084
|
+
for (const bindingParams of attributeBindings) {
|
|
19085
|
+
updateInstructions.push({ reference: Identifiers.attribute, paramsOrFn: bindingParams, span: null });
|
|
19086
|
+
}
|
|
19087
|
+
for (const bindingParams of syntheticHostBindings) {
|
|
19088
|
+
updateInstructions.push({ reference: Identifiers.syntheticHostProperty, paramsOrFn: bindingParams, span: null });
|
|
18935
19089
|
}
|
|
18936
19090
|
// since we're dealing with directives/components and both have hostBinding
|
|
18937
19091
|
// functions, we need to generate a special hostAttrs instruction that deals
|
|
@@ -18947,30 +19101,30 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18947
19101
|
// the update block of a component/directive templateFn/hostBindingsFn so that the bindings
|
|
18948
19102
|
// are evaluated and updated for the element.
|
|
18949
19103
|
styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(instruction => {
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
19104
|
+
for (const call of instruction.calls) {
|
|
19105
|
+
// we subtract a value of `1` here because the binding slot was already allocated
|
|
19106
|
+
// at the top of this method when all the input bindings were counted.
|
|
19107
|
+
totalHostVarsCount +=
|
|
19108
|
+
Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
|
|
19109
|
+
updateInstructions.push({
|
|
19110
|
+
reference: instruction.reference,
|
|
19111
|
+
paramsOrFn: convertStylingCall(call, bindingContext, bindingFn),
|
|
19112
|
+
span: null
|
|
18958
19113
|
});
|
|
18959
|
-
updateStatements.push(chainedInstruction(instruction.reference, calls).toStmt());
|
|
18960
19114
|
}
|
|
18961
19115
|
});
|
|
18962
19116
|
}
|
|
18963
19117
|
if (totalHostVarsCount) {
|
|
18964
19118
|
definitionMap.set('hostVars', literal(totalHostVarsCount));
|
|
18965
19119
|
}
|
|
18966
|
-
if (
|
|
19120
|
+
if (createInstructions.length > 0 || updateInstructions.length > 0) {
|
|
18967
19121
|
const hostBindingsFnName = name ? `${name}_HostBindings` : null;
|
|
18968
19122
|
const statements = [];
|
|
18969
|
-
if (
|
|
18970
|
-
statements.push(renderFlagCheckIfStmt(1 /* Create */,
|
|
19123
|
+
if (createInstructions.length > 0) {
|
|
19124
|
+
statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
|
|
18971
19125
|
}
|
|
18972
|
-
if (
|
|
18973
|
-
statements.push(renderFlagCheckIfStmt(2 /* Update */,
|
|
19126
|
+
if (updateInstructions.length > 0) {
|
|
19127
|
+
statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
18974
19128
|
}
|
|
18975
19129
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
|
|
18976
19130
|
}
|
|
@@ -19006,10 +19160,10 @@ function getBindingNameAndInstruction(binding) {
|
|
|
19006
19160
|
return { bindingName, instruction, isAttribute: !!attrMatches };
|
|
19007
19161
|
}
|
|
19008
19162
|
function createHostListeners(eventBindings, name) {
|
|
19009
|
-
const
|
|
19010
|
-
const
|
|
19163
|
+
const listenerParams = [];
|
|
19164
|
+
const syntheticListenerParams = [];
|
|
19011
19165
|
const instructions = [];
|
|
19012
|
-
|
|
19166
|
+
for (const binding of eventBindings) {
|
|
19013
19167
|
let bindingName = binding.name && sanitizeIdentifier(binding.name);
|
|
19014
19168
|
const bindingFnName = binding.type === 1 /* Animation */ ?
|
|
19015
19169
|
prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
|
|
@@ -19017,17 +19171,17 @@ function createHostListeners(eventBindings, name) {
|
|
|
19017
19171
|
const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
|
|
19018
19172
|
const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
|
|
19019
19173
|
if (binding.type == 1 /* Animation */) {
|
|
19020
|
-
|
|
19174
|
+
syntheticListenerParams.push(params);
|
|
19021
19175
|
}
|
|
19022
19176
|
else {
|
|
19023
|
-
|
|
19177
|
+
listenerParams.push(params);
|
|
19024
19178
|
}
|
|
19025
|
-
});
|
|
19026
|
-
if (syntheticListeners.length > 0) {
|
|
19027
|
-
instructions.push(chainedInstruction(Identifiers.syntheticHostListener, syntheticListeners).toStmt());
|
|
19028
19179
|
}
|
|
19029
|
-
|
|
19030
|
-
instructions.push(
|
|
19180
|
+
for (const params of syntheticListenerParams) {
|
|
19181
|
+
instructions.push({ reference: Identifiers.syntheticHostListener, paramsOrFn: params, span: null });
|
|
19182
|
+
}
|
|
19183
|
+
for (const params of listenerParams) {
|
|
19184
|
+
instructions.push({ reference: Identifiers.listener, paramsOrFn: params, span: null });
|
|
19031
19185
|
}
|
|
19032
19186
|
return instructions;
|
|
19033
19187
|
}
|
|
@@ -19148,6 +19302,7 @@ class CompilerFacadeImpl {
|
|
|
19148
19302
|
deps: null,
|
|
19149
19303
|
pipeName: facade.pipeName,
|
|
19150
19304
|
pure: facade.pure,
|
|
19305
|
+
isStandalone: facade.isStandalone,
|
|
19151
19306
|
};
|
|
19152
19307
|
const res = compilePipeFromMetadata(metadata);
|
|
19153
19308
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
|
|
@@ -19216,7 +19371,7 @@ class CompilerFacadeImpl {
|
|
|
19216
19371
|
declarations: facade.declarations.map(wrapReference),
|
|
19217
19372
|
imports: facade.imports.map(wrapReference),
|
|
19218
19373
|
exports: facade.exports.map(wrapReference),
|
|
19219
|
-
|
|
19374
|
+
selectorScopeMode: R3SelectorScopeMode.Inline,
|
|
19220
19375
|
containsForwardDecls: false,
|
|
19221
19376
|
schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
|
|
19222
19377
|
id: facade.id ? new WrappedNodeExpr(facade.id) : null,
|
|
@@ -19358,7 +19513,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
19358
19513
|
return Object.assign(Object.assign({}, facade), { typeArgumentCount: 0, typeSourceSpan: facade.typeSourceSpan, type: wrapReference(facade.type), internalType: new WrappedNodeExpr(facade.type), deps: null, host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign(Object.assign({}, inputsFromMetadata), inputsFromType), outputs: Object.assign(Object.assign({}, outputsFromMetadata), outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), fullInheritance: false });
|
|
19359
19514
|
}
|
|
19360
19515
|
function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
19361
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19362
19517
|
return {
|
|
19363
19518
|
name: declaration.type.name,
|
|
19364
19519
|
type: wrapReference(declaration.type),
|
|
@@ -19378,6 +19533,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
19378
19533
|
deps: null,
|
|
19379
19534
|
typeArgumentCount: 0,
|
|
19380
19535
|
fullInheritance: false,
|
|
19536
|
+
isStandalone: (_j = declaration.isStandalone) !== null && _j !== void 0 ? _j : false,
|
|
19381
19537
|
};
|
|
19382
19538
|
}
|
|
19383
19539
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
@@ -19541,7 +19697,7 @@ function parseInputOutputs(values) {
|
|
|
19541
19697
|
}, {});
|
|
19542
19698
|
}
|
|
19543
19699
|
function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
19544
|
-
var _a;
|
|
19700
|
+
var _a, _b;
|
|
19545
19701
|
return {
|
|
19546
19702
|
name: declaration.type.name,
|
|
19547
19703
|
type: wrapReference(declaration.type),
|
|
@@ -19550,6 +19706,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
|
19550
19706
|
pipeName: declaration.name,
|
|
19551
19707
|
deps: null,
|
|
19552
19708
|
pure: (_a = declaration.pure) !== null && _a !== void 0 ? _a : true,
|
|
19709
|
+
isStandalone: (_b = declaration.isStandalone) !== null && _b !== void 0 ? _b : false,
|
|
19553
19710
|
};
|
|
19554
19711
|
}
|
|
19555
19712
|
function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
@@ -19576,7 +19733,7 @@ function publishFacade(global) {
|
|
|
19576
19733
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19577
19734
|
* found in the LICENSE file at https://angular.io/license
|
|
19578
19735
|
*/
|
|
19579
|
-
const VERSION = new Version('14.0.0-next.
|
|
19736
|
+
const VERSION = new Version('14.0.0-next.12');
|
|
19580
19737
|
|
|
19581
19738
|
/**
|
|
19582
19739
|
* @license
|
|
@@ -21603,7 +21760,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21603
21760
|
function compileDeclareClassMetadata(metadata) {
|
|
21604
21761
|
const definitionMap = new DefinitionMap();
|
|
21605
21762
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21606
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21763
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
21607
21764
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21608
21765
|
definitionMap.set('type', metadata.type);
|
|
21609
21766
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21720,7 +21877,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21720
21877
|
function createDirectiveDefinitionMap(meta) {
|
|
21721
21878
|
const definitionMap = new DefinitionMap();
|
|
21722
21879
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21723
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21880
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
21724
21881
|
// e.g. `type: MyDirective`
|
|
21725
21882
|
definitionMap.set('type', meta.internalType);
|
|
21726
21883
|
// e.g. `selector: 'some-dir'`
|
|
@@ -21941,7 +22098,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
21941
22098
|
function compileDeclareFactoryFunction(meta) {
|
|
21942
22099
|
const definitionMap = new DefinitionMap();
|
|
21943
22100
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
21944
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22101
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
21945
22102
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21946
22103
|
definitionMap.set('type', meta.internalType);
|
|
21947
22104
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -21983,7 +22140,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
21983
22140
|
function createInjectableDefinitionMap(meta) {
|
|
21984
22141
|
const definitionMap = new DefinitionMap();
|
|
21985
22142
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
21986
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22143
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
21987
22144
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21988
22145
|
definitionMap.set('type', meta.internalType);
|
|
21989
22146
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22041,7 +22198,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22041
22198
|
function createInjectorDefinitionMap(meta) {
|
|
22042
22199
|
const definitionMap = new DefinitionMap();
|
|
22043
22200
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22044
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22201
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
22045
22202
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22046
22203
|
definitionMap.set('type', meta.internalType);
|
|
22047
22204
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22078,7 +22235,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22078
22235
|
function createNgModuleDefinitionMap(meta) {
|
|
22079
22236
|
const definitionMap = new DefinitionMap();
|
|
22080
22237
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22081
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22238
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
22082
22239
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22083
22240
|
definitionMap.set('type', meta.internalType);
|
|
22084
22241
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22136,7 +22293,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22136
22293
|
function createPipeDefinitionMap(meta) {
|
|
22137
22294
|
const definitionMap = new DefinitionMap();
|
|
22138
22295
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22139
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22296
|
+
definitionMap.set('version', literal('14.0.0-next.12'));
|
|
22140
22297
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22141
22298
|
// e.g. `type: MyPipe`
|
|
22142
22299
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22186,5 +22343,5 @@ publishFacade(_global);
|
|
|
22186
22343
|
* found in the LICENSE file at https://angular.io/license
|
|
22187
22344
|
*/
|
|
22188
22345
|
|
|
22189
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3TargetBinder, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22346
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22190
22347
|
//# sourceMappingURL=compiler.mjs.map
|