@angular/compiler 14.0.0-next.5 → 14.0.0-next.8

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.
Files changed (37) hide show
  1. package/esm2020/src/compiler.mjs +2 -2
  2. package/esm2020/src/expression_parser/parser.mjs +43 -5
  3. package/esm2020/src/jit_compiler_facade.mjs +3 -3
  4. package/esm2020/src/ml_parser/lexer.mjs +2 -2
  5. package/esm2020/src/parse_util.mjs +2 -2
  6. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  7. package/esm2020/src/render3/partial/directive.mjs +1 -1
  8. package/esm2020/src/render3/partial/factory.mjs +1 -1
  9. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2020/src/render3/partial/injector.mjs +1 -1
  11. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  13. package/esm2020/src/render3/r3_identifiers.mjs +3 -1
  14. package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
  15. package/esm2020/src/render3/r3_template_transform.mjs +6 -6
  16. package/esm2020/src/render3/view/style_parser.mjs +2 -2
  17. package/esm2020/src/render3/view/styling_builder.mjs +3 -3
  18. package/esm2020/src/render3/view/template.mjs +21 -8
  19. package/esm2020/src/selector.mjs +3 -3
  20. package/esm2020/src/shadow_css.mjs +2 -2
  21. package/esm2020/src/template_parser/binding_parser.mjs +6 -6
  22. package/esm2020/src/version.mjs +1 -1
  23. package/fesm2015/compiler.mjs +139 -47
  24. package/fesm2015/compiler.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +1 -1
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/compiler.mjs +137 -47
  28. package/fesm2020/compiler.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +1 -1
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/package.json +10 -2
  32. package/src/compiler.d.ts +1 -1
  33. package/src/expression_parser/parser.d.ts +3 -2
  34. package/src/render3/r3_identifiers.d.ts +2 -0
  35. package/src/render3/r3_module_compiler.d.ts +30 -4
  36. package/src/render3/view/template.d.ts +1 -1
  37. package/src/template_parser/binding_parser.d.ts +3 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.5
2
+ * @license Angular v14.0.0-next.8
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAQA;;;;;;;;;;;;;;;AAgBA;AACA;AACA;AACA;AACA;MACa,YAAY,GAAG;;AC7B5B;;;;;;;AAiBA;;ACjBA;;;;;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;AAEH;;;;;;;;;;;;;;AAcG;AAEH;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,GAAG;;AC7B5B;;;;;;AAMG;AAWH;;ACjBA;;;;;;AAMG;;ACNH;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.5
2
+ * @license Angular v14.0.0-next.8
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.substr(1));
227
+ current.addAttribute('id', tag.slice(1));
228
228
  }
229
229
  else if (prefix === '.') {
230
230
  // Class
231
- current.addClassName(tag.substr(1));
231
+ current.addClassName(tag.slice(1));
232
232
  }
233
233
  else {
234
234
  // Element
@@ -2796,6 +2796,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
2796
2796
  Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
2797
2797
  Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
2798
2798
  Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
2799
+ Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
2799
2800
  Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
2800
2801
  Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
2801
2802
  Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
@@ -2906,6 +2907,7 @@ Identifiers.ModuleWithProviders = {
2906
2907
  Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
2907
2908
  Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
2908
2909
  Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
2910
+ Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
2909
2911
  Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
2910
2912
  Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
2911
2913
  Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
@@ -5428,7 +5430,7 @@ class ParseLocation {
5428
5430
  const ch = source.charCodeAt(offset);
5429
5431
  if (ch == $LF) {
5430
5432
  line--;
5431
- const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
5433
+ const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
5432
5434
  col = priorLine > 0 ? offset - priorLine : offset;
5433
5435
  }
5434
5436
  else {
@@ -5982,20 +5984,49 @@ class R3JitReflector {
5982
5984
  * Use of this source code is governed by an MIT-style license that can be
5983
5985
  * found in the LICENSE file at https://angular.io/license
5984
5986
  */
5987
+ /**
5988
+ * How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
5989
+ * as a part of the NgModule definition.
5990
+ */
5991
+ var R3SelectorScopeMode;
5992
+ (function (R3SelectorScopeMode) {
5993
+ /**
5994
+ * Emit the declarations inline into the module definition.
5995
+ *
5996
+ * This option is useful in certain contexts where it's known that JIT support is required. The
5997
+ * tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
5998
+ * they are unused, but the NgModule is used.
5999
+ */
6000
+ R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
6001
+ /**
6002
+ * Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
6003
+ * guarded with the `ngJitMode` flag.
6004
+ *
6005
+ * This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
6006
+ * false, which allows unused directives and pipes to be tree-shaken.
6007
+ */
6008
+ R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
6009
+ /**
6010
+ * Don't generate selector scopes at all.
6011
+ *
6012
+ * This is useful for contexts where JIT support is known to be unnecessary.
6013
+ */
6014
+ R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
6015
+ })(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
5985
6016
  /**
5986
6017
  * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
5987
6018
  */
5988
6019
  function compileNgModule(meta) {
5989
- const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, emitInline, id } = meta;
6020
+ const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
5990
6021
  const statements = [];
5991
6022
  const definitionMap = new DefinitionMap();
5992
6023
  definitionMap.set('type', internalType);
5993
6024
  if (bootstrap.length > 0) {
5994
6025
  definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
5995
6026
  }
5996
- // If requested to emit scope information inline, pass the `declarations`, `imports` and `exports`
5997
- // to the `ɵɵdefineNgModule()` call. The JIT compilation uses this.
5998
- if (emitInline) {
6027
+ if (selectorScopeMode === R3SelectorScopeMode.Inline) {
6028
+ // If requested to emit scope information inline, pass the `declarations`, `imports` and
6029
+ // `exports` to the `ɵɵdefineNgModule()` call directly.
5999
6030
  if (declarations.length > 0) {
6000
6031
  definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
6001
6032
  }
@@ -6006,19 +6037,27 @@ function compileNgModule(meta) {
6006
6037
  definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
6007
6038
  }
6008
6039
  }
6009
- // If not emitting inline, the scope information is not passed into `ɵɵdefineNgModule` as it would
6010
- // prevent tree-shaking of the declarations, imports and exports references.
6011
- else {
6040
+ else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
6041
+ // In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
6042
+ // would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
6043
+ // patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
6044
+ // `ngJitMode` flag.
6012
6045
  const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
6013
6046
  if (setNgModuleScopeCall !== null) {
6014
6047
  statements.push(setNgModuleScopeCall);
6015
6048
  }
6016
6049
  }
6050
+ else {
6051
+ // Selector scope emit was not requested, so skip it.
6052
+ }
6017
6053
  if (schemas !== null && schemas.length > 0) {
6018
6054
  definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
6019
6055
  }
6020
6056
  if (id !== null) {
6021
6057
  definitionMap.set('id', id);
6058
+ // Generate a side-effectful call to register this NgModule by its id, as per the semantics of
6059
+ // NgModule ids.
6060
+ statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
6022
6061
  }
6023
6062
  const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
6024
6063
  const type = createNgModuleType(meta);
@@ -7965,7 +8004,7 @@ class ShadowCss {
7965
8004
  this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
7966
8005
  }
7967
8006
  else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
7968
- rule.selector.startsWith('@document')) {
8007
+ rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
7969
8008
  content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
7970
8009
  }
7971
8010
  else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
@@ -8428,7 +8467,7 @@ function parse(value) {
8428
8467
  }
8429
8468
  }
8430
8469
  if (currentProp && valueStart) {
8431
- const styleVal = value.substr(valueStart).trim();
8470
+ const styleVal = value.slice(valueStart).trim();
8432
8471
  styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
8433
8472
  }
8434
8473
  return styles;
@@ -8606,7 +8645,7 @@ class StylingBuilder {
8606
8645
  const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
8607
8646
  if (isStyle || isClass) {
8608
8647
  const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
8609
- const property = name.substr(isMapBased ? 5 : 6); // the dot explains why there's a +1
8648
+ const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
8610
8649
  if (isStyle) {
8611
8650
  binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
8612
8651
  }
@@ -8880,7 +8919,7 @@ function parseProperty(name) {
8880
8919
  let property = name;
8881
8920
  const unitIndex = name.lastIndexOf('.');
8882
8921
  if (unitIndex > 0) {
8883
- suffix = name.substr(unitIndex + 1);
8922
+ suffix = name.slice(unitIndex + 1);
8884
8923
  property = name.substring(0, unitIndex);
8885
8924
  }
8886
8925
  return { property, suffix, hasOverrideFlag };
@@ -9499,8 +9538,8 @@ class Parser$1 {
9499
9538
  span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
9500
9539
  });
9501
9540
  }
9502
- parseInterpolation(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9503
- const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolationConfig);
9541
+ parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9542
+ const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolatedTokens, interpolationConfig);
9504
9543
  if (expressions.length === 0)
9505
9544
  return null;
9506
9545
  const expressionNodes = [];
@@ -9539,10 +9578,11 @@ class Parser$1 {
9539
9578
  * `SplitInterpolation` with splits that look like
9540
9579
  * <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
9541
9580
  */
9542
- splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9581
+ splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9543
9582
  const strings = [];
9544
9583
  const expressions = [];
9545
9584
  const offsets = [];
9585
+ const inputToTemplateIndexMap = interpolatedTokens ? getIndexMapForOriginalTemplate(interpolatedTokens) : null;
9546
9586
  let i = 0;
9547
9587
  let atInterpolation = false;
9548
9588
  let extendLastString = false;
@@ -9577,7 +9617,9 @@ class Parser$1 {
9577
9617
  this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);
9578
9618
  }
9579
9619
  expressions.push({ text, start: fullStart, end: fullEnd });
9580
- offsets.push(exprStart);
9620
+ const startInOriginalTemplate = inputToTemplateIndexMap?.get(fullStart) ?? fullStart;
9621
+ const offset = startInOriginalTemplate + interpStart.length;
9622
+ offsets.push(offset);
9581
9623
  i = fullEnd;
9582
9624
  atInterpolation = false;
9583
9625
  }
@@ -10585,6 +10627,41 @@ class SimpleExpressionChecker extends RecursiveAstVisitor {
10585
10627
  this.errors.push('pipes');
10586
10628
  }
10587
10629
  }
10630
+ /**
10631
+ * Computes the real offset in the original template for indexes in an interpolation.
10632
+ *
10633
+ * Because templates can have encoded HTML entities and the input passed to the parser at this stage
10634
+ * of the compiler is the _decoded_ value, we need to compute the real offset using the original
10635
+ * encoded values in the interpolated tokens. Note that this is only a special case handling for
10636
+ * `MlParserTokenType.ENCODED_ENTITY` token types. All other interpolated tokens are expected to
10637
+ * have parts which exactly match the input string for parsing the interpolation.
10638
+ *
10639
+ * @param interpolatedTokens The tokens for the interpolated value.
10640
+ *
10641
+ * @returns A map of index locations in the decoded template to indexes in the original template
10642
+ */
10643
+ function getIndexMapForOriginalTemplate(interpolatedTokens) {
10644
+ let offsetMap = new Map();
10645
+ let consumedInOriginalTemplate = 0;
10646
+ let consumedInInput = 0;
10647
+ let tokenIndex = 0;
10648
+ while (tokenIndex < interpolatedTokens.length) {
10649
+ const currentToken = interpolatedTokens[tokenIndex];
10650
+ if (currentToken.type === 9 /* ENCODED_ENTITY */) {
10651
+ const [decoded, encoded] = currentToken.parts;
10652
+ consumedInOriginalTemplate += encoded.length;
10653
+ consumedInInput += decoded.length;
10654
+ }
10655
+ else {
10656
+ const lengthOfParts = currentToken.parts.reduce((sum, current) => sum + current.length, 0);
10657
+ consumedInInput += lengthOfParts;
10658
+ consumedInOriginalTemplate += lengthOfParts;
10659
+ }
10660
+ offsetMap.set(consumedInInput, consumedInOriginalTemplate);
10661
+ tokenIndex++;
10662
+ }
10663
+ return offsetMap;
10664
+ }
10588
10665
 
10589
10666
  /**
10590
10667
  * @license
@@ -13826,7 +13903,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
13826
13903
  }
13827
13904
  }
13828
13905
  decodeHexDigits(start, length) {
13829
- const hex = this.input.substr(start.internalState.offset, length);
13906
+ const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
13830
13907
  const charCode = parseInt(hex, 16);
13831
13908
  if (!isNaN(charCode)) {
13832
13909
  return charCode;
@@ -14990,11 +15067,11 @@ class BindingParser {
14990
15067
  }
14991
15068
  return targetEvents;
14992
15069
  }
14993
- parseInterpolation(value, sourceSpan) {
15070
+ parseInterpolation(value, sourceSpan, interpolatedTokens) {
14994
15071
  const sourceInfo = sourceSpan.start.toString();
14995
15072
  const absoluteOffset = sourceSpan.fullStart.offset;
14996
15073
  try {
14997
- const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, this._interpolationConfig);
15074
+ const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, interpolatedTokens, this._interpolationConfig);
14998
15075
  if (ast)
14999
15076
  this._reportExpressionParserErrors(ast.errors, sourceSpan);
15000
15077
  return ast;
@@ -15131,8 +15208,8 @@ class BindingParser {
15131
15208
  this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
15132
15209
  }
15133
15210
  }
15134
- parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
15135
- const expr = this.parseInterpolation(value, valueSpan || sourceSpan);
15211
+ parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
15212
+ const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
15136
15213
  if (expr) {
15137
15214
  this._parsePropertyAst(name, expr, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
15138
15215
  return true;
@@ -15224,7 +15301,7 @@ class BindingParser {
15224
15301
  this._reportError(`Event name is missing in binding`, sourceSpan);
15225
15302
  }
15226
15303
  if (isAnimationLabel(name)) {
15227
- name = name.substr(1);
15304
+ name = name.slice(1);
15228
15305
  if (keySpan !== undefined) {
15229
15306
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
15230
15307
  }
@@ -15629,7 +15706,7 @@ class HtmlAstToIvyAst {
15629
15706
  return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
15630
15707
  }
15631
15708
  visitText(text) {
15632
- return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.i18n);
15709
+ return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.tokens, text.i18n);
15633
15710
  }
15634
15711
  visitExpansion(expansion) {
15635
15712
  if (!expansion.i18n) {
@@ -15659,7 +15736,7 @@ class HtmlAstToIvyAst {
15659
15736
  vars[formattedKey] = new BoundText(ast, value.sourceSpan);
15660
15737
  }
15661
15738
  else {
15662
- placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan);
15739
+ placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan, null);
15663
15740
  }
15664
15741
  });
15665
15742
  return new Icu$1(vars, placeholders, expansion.sourceSpan, message);
@@ -15782,12 +15859,12 @@ class HtmlAstToIvyAst {
15782
15859
  }
15783
15860
  // No explicit binding found.
15784
15861
  const keySpan = createKeySpan(srcSpan, '' /* prefix */, name);
15785
- const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
15862
+ const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, attribute.valueTokens ?? null);
15786
15863
  return hasBinding;
15787
15864
  }
15788
- _visitTextWithInterpolation(value, sourceSpan, i18n) {
15865
+ _visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
15789
15866
  const valueNoNgsp = replaceNgsp(value);
15790
- const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan);
15867
+ const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
15791
15868
  return expr ? new BoundText(expr, sourceSpan, i18n) : new Text$3(valueNoNgsp, sourceSpan);
15792
15869
  }
15793
15870
  parseVariable(identifier, value, sourceSpan, keySpan, valueSpan, variables) {
@@ -16879,13 +16956,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
16879
16956
  scope.getOrCreateSharedContextVar(0);
16880
16957
  const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
16881
16958
  const statements = [];
16882
- if (scope) {
16959
+ const variableDeclarations = scope?.variableDeclarations();
16960
+ const restoreViewStatement = scope?.restoreViewStatement();
16961
+ if (variableDeclarations) {
16883
16962
  // `variableDeclarations` needs to run first, because
16884
16963
  // `restoreViewStatement` depends on the result.
16885
- statements.push(...scope.variableDeclarations());
16886
- statements.unshift(...scope.restoreViewStatement());
16964
+ statements.push(...variableDeclarations);
16887
16965
  }
16888
16966
  statements.push(...bindingStatements);
16967
+ if (restoreViewStatement) {
16968
+ statements.unshift(restoreViewStatement);
16969
+ // If there's a `restoreView` call, we need to reset the view at the end of the listener
16970
+ // in order to avoid a leak. If there's a `return` statement already, we wrap it in the
16971
+ // call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
16972
+ const lastStatement = statements[statements.length - 1];
16973
+ if (lastStatement instanceof ReturnStatement) {
16974
+ statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
16975
+ }
16976
+ else {
16977
+ statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
16978
+ }
16979
+ }
16889
16980
  const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
16890
16981
  const fnName = handlerName && sanitizeIdentifier(handlerName);
16891
16982
  const fnArgs = [];
@@ -18215,16 +18306,15 @@ class BindingScope {
18215
18306
  }
18216
18307
  }
18217
18308
  restoreViewStatement() {
18218
- const statements = [];
18219
18309
  if (this.restoreViewVariable) {
18220
18310
  const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18221
18311
  // Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
18222
18312
  // depending on whether it is being used.
18223
- statements.push(this.usesRestoredViewContext ?
18313
+ return this.usesRestoredViewContext ?
18224
18314
  variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
18225
- restoreCall.toStmt());
18315
+ restoreCall.toStmt();
18226
18316
  }
18227
- return statements;
18317
+ return null;
18228
18318
  }
18229
18319
  viewSnapshotStatements() {
18230
18320
  // const $state$ = getCurrentView();
@@ -19273,7 +19363,7 @@ class CompilerFacadeImpl {
19273
19363
  declarations: facade.declarations.map(wrapReference),
19274
19364
  imports: facade.imports.map(wrapReference),
19275
19365
  exports: facade.exports.map(wrapReference),
19276
- emitInline: true,
19366
+ selectorScopeMode: R3SelectorScopeMode.Inline,
19277
19367
  containsForwardDecls: false,
19278
19368
  schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
19279
19369
  id: facade.id ? new WrappedNodeExpr(facade.id) : null,
@@ -19676,7 +19766,7 @@ function publishFacade(global) {
19676
19766
  * Use of this source code is governed by an MIT-style license that can be
19677
19767
  * found in the LICENSE file at https://angular.io/license
19678
19768
  */
19679
- const VERSION = new Version('14.0.0-next.5');
19769
+ const VERSION = new Version('14.0.0-next.8');
19680
19770
 
19681
19771
  /**
19682
19772
  * @license
@@ -21717,7 +21807,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21717
21807
  function compileDeclareClassMetadata(metadata) {
21718
21808
  const definitionMap = new DefinitionMap();
21719
21809
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21720
- definitionMap.set('version', literal('14.0.0-next.5'));
21810
+ definitionMap.set('version', literal('14.0.0-next.8'));
21721
21811
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21722
21812
  definitionMap.set('type', metadata.type);
21723
21813
  definitionMap.set('decorators', metadata.decorators);
@@ -21834,7 +21924,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21834
21924
  function createDirectiveDefinitionMap(meta) {
21835
21925
  const definitionMap = new DefinitionMap();
21836
21926
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21837
- definitionMap.set('version', literal('14.0.0-next.5'));
21927
+ definitionMap.set('version', literal('14.0.0-next.8'));
21838
21928
  // e.g. `type: MyDirective`
21839
21929
  definitionMap.set('type', meta.internalType);
21840
21930
  // e.g. `selector: 'some-dir'`
@@ -22055,7 +22145,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22055
22145
  function compileDeclareFactoryFunction(meta) {
22056
22146
  const definitionMap = new DefinitionMap();
22057
22147
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22058
- definitionMap.set('version', literal('14.0.0-next.5'));
22148
+ definitionMap.set('version', literal('14.0.0-next.8'));
22059
22149
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22060
22150
  definitionMap.set('type', meta.internalType);
22061
22151
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22097,7 +22187,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22097
22187
  function createInjectableDefinitionMap(meta) {
22098
22188
  const definitionMap = new DefinitionMap();
22099
22189
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22100
- definitionMap.set('version', literal('14.0.0-next.5'));
22190
+ definitionMap.set('version', literal('14.0.0-next.8'));
22101
22191
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22102
22192
  definitionMap.set('type', meta.internalType);
22103
22193
  // Only generate providedIn property if it has a non-null value
@@ -22155,7 +22245,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22155
22245
  function createInjectorDefinitionMap(meta) {
22156
22246
  const definitionMap = new DefinitionMap();
22157
22247
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22158
- definitionMap.set('version', literal('14.0.0-next.5'));
22248
+ definitionMap.set('version', literal('14.0.0-next.8'));
22159
22249
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22160
22250
  definitionMap.set('type', meta.internalType);
22161
22251
  definitionMap.set('providers', meta.providers);
@@ -22192,7 +22282,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22192
22282
  function createNgModuleDefinitionMap(meta) {
22193
22283
  const definitionMap = new DefinitionMap();
22194
22284
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22195
- definitionMap.set('version', literal('14.0.0-next.5'));
22285
+ definitionMap.set('version', literal('14.0.0-next.8'));
22196
22286
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22197
22287
  definitionMap.set('type', meta.internalType);
22198
22288
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22250,7 +22340,7 @@ function compileDeclarePipeFromMetadata(meta) {
22250
22340
  function createPipeDefinitionMap(meta) {
22251
22341
  const definitionMap = new DefinitionMap();
22252
22342
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22253
- definitionMap.set('version', literal('14.0.0-next.5'));
22343
+ definitionMap.set('version', literal('14.0.0-next.8'));
22254
22344
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22255
22345
  // e.g. `type: MyPipe`
22256
22346
  definitionMap.set('type', meta.internalType);
@@ -22300,5 +22390,5 @@ publishFacade(_global);
22300
22390
  * found in the LICENSE file at https://angular.io/license
22301
22391
  */
22302
22392
 
22303
- 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 };
22393
+ 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 };
22304
22394
  //# sourceMappingURL=compiler.mjs.map