@angular/compiler 17.1.0-next.5 → 17.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/esm2022/src/compiler_facade_interface.mjs +1 -1
  2. package/esm2022/src/core.mjs +8 -1
  3. package/esm2022/src/jit_compiler_facade.mjs +5 -3
  4. package/esm2022/src/output/abstract_emitter.mjs +4 -1
  5. package/esm2022/src/output/output_ast.mjs +11 -7
  6. package/esm2022/src/render3/partial/class_metadata.mjs +1 -1
  7. package/esm2022/src/render3/partial/directive.mjs +4 -4
  8. package/esm2022/src/render3/partial/factory.mjs +1 -1
  9. package/esm2022/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2022/src/render3/partial/injector.mjs +1 -1
  11. package/esm2022/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2022/src/render3/partial/pipe.mjs +1 -1
  13. package/esm2022/src/render3/r3_identifiers.mjs +5 -1
  14. package/esm2022/src/render3/view/style_parser.mjs +2 -1
  15. package/esm2022/src/render3/view/template.mjs +5 -2
  16. package/esm2022/src/render3/view/util.mjs +35 -7
  17. package/esm2022/src/template/pipeline/ir/src/enums.mjs +1 -11
  18. package/esm2022/src/template/pipeline/ir/src/expression.mjs +1 -21
  19. package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +3 -2
  20. package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +3 -2
  21. package/esm2022/src/template/pipeline/src/conversion.mjs +2 -1
  22. package/esm2022/src/template/pipeline/src/emit.mjs +1 -3
  23. package/esm2022/src/template/pipeline/src/ingest.mjs +40 -15
  24. package/esm2022/src/template/pipeline/src/instruction.mjs +8 -7
  25. package/esm2022/src/template/pipeline/src/phases/attribute_extraction.mjs +6 -5
  26. package/esm2022/src/template/pipeline/src/phases/binding_specialization.mjs +4 -2
  27. package/esm2022/src/template/pipeline/src/phases/const_collection.mjs +8 -12
  28. package/esm2022/src/template/pipeline/src/phases/host_style_property_parsing.mjs +2 -2
  29. package/esm2022/src/template/pipeline/src/phases/parse_extracted_styles.mjs +3 -3
  30. package/esm2022/src/template/pipeline/src/phases/reify.mjs +2 -2
  31. package/esm2022/src/version.mjs +1 -1
  32. package/fesm2022/compiler.mjs +147 -134
  33. package/fesm2022/compiler.mjs.map +1 -1
  34. package/index.d.ts +19 -7
  35. package/package.json +2 -2
  36. package/esm2022/src/template/pipeline/src/phases/repeater_derived_vars.mjs +0 -45
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.0-next.5
2
+ * @license Angular v17.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -409,6 +409,13 @@ var ChangeDetectionStrategy;
409
409
  ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
410
410
  ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
411
411
  })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
412
+ /** Flags describing an input for a directive. */
413
+ var InputFlags;
414
+ (function (InputFlags) {
415
+ InputFlags[InputFlags["None"] = 0] = "None";
416
+ InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
417
+ InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
418
+ })(InputFlags || (InputFlags = {}));
412
419
  const CUSTOM_ELEMENTS_SCHEMA = {
413
420
  name: 'custom-elements'
414
421
  };
@@ -472,6 +479,7 @@ var core = /*#__PURE__*/Object.freeze({
472
479
  emitDistinctChangesOnlyDefaultValue: emitDistinctChangesOnlyDefaultValue,
473
480
  get ViewEncapsulation () { return ViewEncapsulation; },
474
481
  get ChangeDetectionStrategy () { return ChangeDetectionStrategy; },
482
+ get InputFlags () { return InputFlags; },
475
483
  CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
476
484
  NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
477
485
  Type: Type$1,
@@ -890,12 +898,13 @@ var BinaryOperator;
890
898
  BinaryOperator[BinaryOperator["Modulo"] = 8] = "Modulo";
891
899
  BinaryOperator[BinaryOperator["And"] = 9] = "And";
892
900
  BinaryOperator[BinaryOperator["Or"] = 10] = "Or";
893
- BinaryOperator[BinaryOperator["BitwiseAnd"] = 11] = "BitwiseAnd";
894
- BinaryOperator[BinaryOperator["Lower"] = 12] = "Lower";
895
- BinaryOperator[BinaryOperator["LowerEquals"] = 13] = "LowerEquals";
896
- BinaryOperator[BinaryOperator["Bigger"] = 14] = "Bigger";
897
- BinaryOperator[BinaryOperator["BiggerEquals"] = 15] = "BiggerEquals";
898
- BinaryOperator[BinaryOperator["NullishCoalesce"] = 16] = "NullishCoalesce";
901
+ BinaryOperator[BinaryOperator["BitwiseOr"] = 11] = "BitwiseOr";
902
+ BinaryOperator[BinaryOperator["BitwiseAnd"] = 12] = "BitwiseAnd";
903
+ BinaryOperator[BinaryOperator["Lower"] = 13] = "Lower";
904
+ BinaryOperator[BinaryOperator["LowerEquals"] = 14] = "LowerEquals";
905
+ BinaryOperator[BinaryOperator["Bigger"] = 15] = "Bigger";
906
+ BinaryOperator[BinaryOperator["BiggerEquals"] = 16] = "BiggerEquals";
907
+ BinaryOperator[BinaryOperator["NullishCoalesce"] = 17] = "NullishCoalesce";
899
908
  })(BinaryOperator || (BinaryOperator = {}));
900
909
  function nullSafeIsEquivalent(base, other) {
901
910
  if (base == null || other == null) {
@@ -968,6 +977,9 @@ class Expression {
968
977
  and(rhs, sourceSpan) {
969
978
  return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
970
979
  }
980
+ bitwiseOr(rhs, sourceSpan, parens = true) {
981
+ return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);
982
+ }
971
983
  bitwiseAnd(rhs, sourceSpan, parens = true) {
972
984
  return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);
973
985
  }
@@ -2628,6 +2640,10 @@ class Identifiers {
2628
2640
  name: 'ɵɵgetInheritedFactory',
2629
2641
  moduleName: CORE,
2630
2642
  }; }
2643
+ static { this.InputFlags = {
2644
+ name: 'ɵɵInputFlags',
2645
+ moduleName: CORE,
2646
+ }; }
2631
2647
  // sanitization-related functions
2632
2648
  static { this.sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE }; }
2633
2649
  static { this.sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE }; }
@@ -3269,6 +3285,9 @@ class AbstractEmitterVisitor {
3269
3285
  case BinaryOperator.And:
3270
3286
  opStr = '&&';
3271
3287
  break;
3288
+ case BinaryOperator.BitwiseOr:
3289
+ opStr = '|';
3290
+ break;
3272
3291
  case BinaryOperator.BitwiseAnd:
3273
3292
  opStr = '&';
3274
3293
  break;
@@ -4973,7 +4992,7 @@ function asLiteral(value) {
4973
4992
  * This will attempt to generate optimized data structures to minimize memory or
4974
4993
  * file size of fully compiled applications.
4975
4994
  */
4976
- function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
4995
+ function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
4977
4996
  const keys = Object.getOwnPropertyNames(map);
4978
4997
  if (keys.length === 0) {
4979
4998
  return null;
@@ -4995,12 +5014,28 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
4995
5014
  minifiedName = key;
4996
5015
  declaredName = value.classPropertyName;
4997
5016
  publicName = value.bindingPropertyName;
4998
- if (keepDeclared && (publicName !== declaredName || value.transformFunction != null)) {
4999
- const expressionKeys = [asLiteral(publicName), asLiteral(declaredName)];
5000
- if (value.transformFunction != null) {
5001
- expressionKeys.push(value.transformFunction);
5017
+ const differentDeclaringName = publicName !== declaredName;
5018
+ const hasDecoratorInputTransform = value.transformFunction !== null;
5019
+ // Build up input flags
5020
+ let flags = null;
5021
+ if (value.isSignal) {
5022
+ flags = bitwiseOrInputFlagsExpr(InputFlags.SignalBased, flags);
5023
+ }
5024
+ if (hasDecoratorInputTransform) {
5025
+ flags = bitwiseOrInputFlagsExpr(InputFlags.HasDecoratorInputTransform, flags);
5026
+ }
5027
+ // Inputs, compared to outputs, will track their declared name (for `ngOnChanges`), support
5028
+ // decorator input transform functions, or store flag information if there is any.
5029
+ if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== null)) {
5030
+ const flagsExpr = flags ?? importExpr(Identifiers.InputFlags).prop(InputFlags[InputFlags.None]);
5031
+ const result = [flagsExpr, asLiteral(publicName)];
5032
+ if (differentDeclaringName || hasDecoratorInputTransform) {
5033
+ result.push(asLiteral(declaredName));
5034
+ if (hasDecoratorInputTransform) {
5035
+ result.push(value.transformFunction);
5036
+ }
5002
5037
  }
5003
- expressionValue = literalArr(expressionKeys);
5038
+ expressionValue = literalArr(result);
5004
5039
  }
5005
5040
  else {
5006
5041
  expressionValue = asLiteral(publicName);
@@ -5014,6 +5049,17 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
5014
5049
  };
5015
5050
  }));
5016
5051
  }
5052
+ /** Gets an output AST expression referencing the given flag. */
5053
+ function getInputFlagExpr(flag) {
5054
+ return importExpr(Identifiers.InputFlags).prop(InputFlags[flag]);
5055
+ }
5056
+ /** Combines a given input flag with an existing flag expression, if present. */
5057
+ function bitwiseOrInputFlagsExpr(flag, expr) {
5058
+ if (expr === null) {
5059
+ return getInputFlagExpr(flag);
5060
+ }
5061
+ return getInputFlagExpr(flag).bitwiseOr(expr);
5062
+ }
5017
5063
  /**
5018
5064
  * Remove trailing null nodes as they are implied.
5019
5065
  */
@@ -9270,16 +9316,6 @@ var DeferTriggerKind;
9270
9316
  DeferTriggerKind[DeferTriggerKind["Interaction"] = 4] = "Interaction";
9271
9317
  DeferTriggerKind[DeferTriggerKind["Viewport"] = 5] = "Viewport";
9272
9318
  })(DeferTriggerKind || (DeferTriggerKind = {}));
9273
- /**
9274
- * Repeaters implicitly define these derived variables, and child nodes may read them.
9275
- */
9276
- var DerivedRepeaterVarIdentity;
9277
- (function (DerivedRepeaterVarIdentity) {
9278
- DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["First"] = 0] = "First";
9279
- DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Last"] = 1] = "Last";
9280
- DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Even"] = 2] = "Even";
9281
- DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Odd"] = 3] = "Odd";
9282
- })(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
9283
9319
  /**
9284
9320
  * Kinds of i18n contexts. They can be created because of root i18n blocks, or ICUs.
9285
9321
  */
@@ -9524,10 +9560,11 @@ function createClassMapOp(xref, expression, sourceSpan) {
9524
9560
  /**
9525
9561
  * Create an `AttributeOp`.
9526
9562
  */
9527
- function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
9563
+ function createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
9528
9564
  return {
9529
9565
  kind: OpKind.Attribute,
9530
9566
  target,
9567
+ namespace,
9531
9568
  name,
9532
9569
  expression,
9533
9570
  securityContext,
@@ -10224,26 +10261,6 @@ class ConditionalCaseExpr extends ExpressionBase {
10224
10261
  }
10225
10262
  }
10226
10263
  }
10227
- class DerivedRepeaterVarExpr extends ExpressionBase {
10228
- constructor(xref, identity) {
10229
- super();
10230
- this.xref = xref;
10231
- this.identity = identity;
10232
- this.kind = ExpressionKind.DerivedRepeaterVar;
10233
- }
10234
- transformInternalExpressions(transform, flags) { }
10235
- visitExpression(visitor, context) { }
10236
- isEquivalent(e) {
10237
- return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity &&
10238
- e.xref === this.xref;
10239
- }
10240
- isConstant() {
10241
- return false;
10242
- }
10243
- clone() {
10244
- return new DerivedRepeaterVarExpr(this.xref, this.identity);
10245
- }
10246
- }
10247
10264
  class ConstCollectedExpr extends ExpressionBase {
10248
10265
  constructor(expr) {
10249
10266
  super();
@@ -11009,11 +11026,12 @@ function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
11009
11026
  /**
11010
11027
  * Create an `ExtractedAttributeOp`.
11011
11028
  */
11012
- function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
11029
+ function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
11013
11030
  return {
11014
11031
  kind: OpKind.ExtractedAttribute,
11015
11032
  target,
11016
11033
  bindingKind,
11034
+ namespace,
11017
11035
  name,
11018
11036
  expression,
11019
11037
  i18nContext,
@@ -11563,7 +11581,8 @@ function extractAttributes(job) {
11563
11581
  }
11564
11582
  OpList.insertBefore(
11565
11583
  // Deliberaly null i18nMessage value
11566
- createExtractedAttributeOp(op.target, bindingKind, op.name, /* expression */ null, /* i18nContext */ null,
11584
+ createExtractedAttributeOp(op.target, bindingKind, null, op.name, /* expression */ null,
11585
+ /* i18nContext */ null,
11567
11586
  /* i18nMessage */ null, op.securityContext), lookupElement$2(elements, op.target));
11568
11587
  }
11569
11588
  break;
@@ -11575,14 +11594,14 @@ function extractAttributes(job) {
11575
11594
  // mode.
11576
11595
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder &&
11577
11596
  op.expression instanceof EmptyExpr) {
11578
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, /* expression */ null,
11597
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */ null,
11579
11598
  /* i18nContext */ null,
11580
11599
  /* i18nMessage */ null, SecurityContext.STYLE), lookupElement$2(elements, op.target));
11581
11600
  }
11582
11601
  break;
11583
11602
  case OpKind.Listener:
11584
11603
  if (!op.isAnimationListener) {
11585
- const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, op.name, /* expression */ null,
11604
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */ null,
11586
11605
  /* i18nContext */ null,
11587
11606
  /* i18nMessage */ null, SecurityContext.NONE);
11588
11607
  if (job.kind === CompilationJobKind.Host) {
@@ -11628,7 +11647,7 @@ function extractAttributeOp(unit, op, elements) {
11628
11647
  extractable &&= op.isTextAttribute;
11629
11648
  }
11630
11649
  if (extractable) {
11631
- const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
11650
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
11632
11651
  if (unit.job.kind === CompilationJobKind.Host) {
11633
11652
  // This attribute will apply to the enclosing host binding compilation unit, so order doesn't
11634
11653
  // matter.
@@ -11675,7 +11694,8 @@ function specializeBindings(job) {
11675
11694
  target.nonBindable = true;
11676
11695
  }
11677
11696
  else {
11678
- OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
11697
+ const [namespace, name] = splitNsName(op.name);
11698
+ OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
11679
11699
  }
11680
11700
  break;
11681
11701
  case BindingKind.Property:
@@ -11865,6 +11885,7 @@ const BINARY_OPERATORS = new Map([
11865
11885
  ['&&', BinaryOperator.And],
11866
11886
  ['>', BinaryOperator.Bigger],
11867
11887
  ['>=', BinaryOperator.BiggerEquals],
11888
+ ['|', BinaryOperator.BitwiseOr],
11868
11889
  ['&', BinaryOperator.BitwiseAnd],
11869
11890
  ['/', BinaryOperator.Divide],
11870
11891
  ['==', BinaryOperator.Equals],
@@ -11921,7 +11942,7 @@ function collectElementConsts(job) {
11921
11942
  if (op.kind === OpKind.ExtractedAttribute) {
11922
11943
  const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
11923
11944
  allElementAttributes.set(op.target, attributes);
11924
- attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
11945
+ attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
11925
11946
  OpList.remove(op);
11926
11947
  }
11927
11948
  }
@@ -12018,7 +12039,7 @@ class ElementAttributes {
12018
12039
  nameToValue.add(name);
12019
12040
  return false;
12020
12041
  }
12021
- add(kind, name, value, trustedValueFn) {
12042
+ add(kind, name, value, namespace, trustedValueFn) {
12022
12043
  // TemplateDefinitionBuilder puts duplicate attribute, class, and style values into the consts
12023
12044
  // array. This seems inefficient, we can probably keep just the first one or the last value
12024
12045
  // (whichever actually gets applied when multiple values are listed for the same attribute).
@@ -12039,7 +12060,7 @@ class ElementAttributes {
12039
12060
  // attribute. Is this sane?
12040
12061
  }
12041
12062
  const array = this.arrayFor(kind);
12042
- array.push(...getAttributeNameLiterals$1(name));
12063
+ array.push(...getAttributeNameLiterals$1(namespace, name));
12043
12064
  if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
12044
12065
  if (value === null) {
12045
12066
  throw Error('Attribute, i18n attribute, & style element attributes must have a value');
@@ -12065,13 +12086,10 @@ class ElementAttributes {
12065
12086
  /**
12066
12087
  * Gets an array of literal expressions representing the attribute's namespaced name.
12067
12088
  */
12068
- function getAttributeNameLiterals$1(name) {
12069
- const [attributeNamespace, attributeName] = splitNsName(name, false);
12070
- const nameLiteral = literal(attributeName);
12071
- if (attributeNamespace) {
12072
- return [
12073
- literal(0 /* core.AttributeMarker.NamespaceURI */), literal(attributeNamespace), nameLiteral
12074
- ];
12089
+ function getAttributeNameLiterals$1(namespace, name) {
12090
+ const nameLiteral = literal(name);
12091
+ if (namespace) {
12092
+ return [literal(0 /* core.AttributeMarker.NamespaceURI */), literal(namespace), nameLiteral];
12075
12093
  }
12076
12094
  return [nameLiteral];
12077
12095
  }
@@ -13126,7 +13144,7 @@ function parseHostStyleProperties(job) {
13126
13144
  if (op.name.startsWith(STYLE_DOT)) {
13127
13145
  op.bindingKind = BindingKind.StyleProperty;
13128
13146
  op.name = op.name.substring(STYLE_DOT.length);
13129
- if (isCssCustomProperty$1(op.name)) {
13147
+ if (!isCssCustomProperty$1(op.name)) {
13130
13148
  op.name = hyphenate$1(op.name);
13131
13149
  }
13132
13150
  const { property, suffix } = parseProperty$1(op.name);
@@ -20566,6 +20584,7 @@ function parse(value) {
20566
20584
  break;
20567
20585
  case 58 /* Char.Colon */:
20568
20586
  if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
20587
+ // TODO: Do not hyphenate CSS custom property names like: `--intentionallyCamelCase`
20569
20588
  currentProp = hyphenate(value.substring(propStart, i - 1).trim());
20570
20589
  valueStart = i;
20571
20590
  }
@@ -21030,14 +21049,14 @@ function parseExtractedStyles(job) {
21030
21049
  if (op.name === 'style') {
21031
21050
  const parsedStyles = parse(op.expression.value);
21032
21051
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
21033
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
21052
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
21034
21053
  }
21035
21054
  OpList.remove(op);
21036
21055
  }
21037
21056
  else if (op.name === 'class') {
21038
21057
  const parsedClasses = op.expression.value.trim().split(/\s+/g);
21039
21058
  for (const parsedClass of parsedClasses) {
21040
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
21059
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, null, parsedClass, null, null, null, SecurityContext.NONE), op);
21041
21060
  }
21042
21061
  OpList.remove(op);
21043
21062
  }
@@ -21416,9 +21435,7 @@ function namespaceMath() {
21416
21435
  return call(Identifiers.namespaceMathML, [], null);
21417
21436
  }
21418
21437
  function advance(delta, sourceSpan) {
21419
- return call(Identifiers.advance, [
21420
- literal(delta),
21421
- ], sourceSpan);
21438
+ return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
21422
21439
  }
21423
21440
  function reference(slot) {
21424
21441
  return importExpr(Identifiers.reference).callFn([
@@ -21562,10 +21579,13 @@ function property(name, expression, sanitizer, sourceSpan) {
21562
21579
  }
21563
21580
  return call(Identifiers.property, args, sourceSpan);
21564
21581
  }
21565
- function attribute(name, expression, sanitizer) {
21582
+ function attribute(name, expression, sanitizer, namespace) {
21566
21583
  const args = [literal(name), expression];
21567
- if (sanitizer !== null) {
21568
- args.push(sanitizer);
21584
+ if (sanitizer !== null || namespace !== null) {
21585
+ args.push(sanitizer ?? literal(null));
21586
+ }
21587
+ if (namespace !== null) {
21588
+ args.push(literal(namespace));
21569
21589
  }
21570
21590
  return call(Identifiers.attribute, args, null);
21571
21591
  }
@@ -22150,7 +22170,7 @@ function reifyUpdateOperations(_unit, ops) {
22150
22170
  OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
22151
22171
  }
22152
22172
  else {
22153
- OpList.replace(op, attribute(op.name, op.expression, op.sanitizer));
22173
+ OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
22154
22174
  }
22155
22175
  break;
22156
22176
  case OpKind.HostProperty:
@@ -22339,42 +22359,6 @@ function removeUnusedI18nAttributesOps(job) {
22339
22359
  }
22340
22360
  }
22341
22361
 
22342
- /**
22343
- * Inside the body of a repeater, certain context variables (such as `$first`) are ambiently
22344
- * available. This phase finds those variable usages, and replaces them with the appropriate
22345
- * expression.
22346
- */
22347
- function generateRepeaterDerivedVars(job) {
22348
- const repeaters = new Map();
22349
- for (const unit of job.units) {
22350
- for (const op of unit.ops()) {
22351
- if (op.kind === OpKind.RepeaterCreate) {
22352
- repeaters.set(op.xref, op);
22353
- }
22354
- }
22355
- }
22356
- for (const unit of job.units) {
22357
- for (const op of unit.ops()) {
22358
- transformExpressionsInOp(op, expr => {
22359
- if (!(expr instanceof DerivedRepeaterVarExpr)) {
22360
- return expr;
22361
- }
22362
- const repeaterOp = repeaters.get(expr.xref);
22363
- switch (expr.identity) {
22364
- case DerivedRepeaterVarIdentity.First:
22365
- return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
22366
- case DerivedRepeaterVarIdentity.Last:
22367
- return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
22368
- case DerivedRepeaterVarIdentity.Even:
22369
- return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
22370
- case DerivedRepeaterVarIdentity.Odd:
22371
- return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
22372
- }
22373
- }, VisitorContextFlag.None);
22374
- }
22375
- }
22376
- }
22377
-
22378
22362
  /**
22379
22363
  * Resolves `ir.ContextExpr` expressions (which represent embedded view or component contexts) to
22380
22364
  * either the `ctx` parameter to component functions (for the current view context) or to variables
@@ -23959,7 +23943,6 @@ const phases = [
23959
23943
  { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
23960
23944
  { kind: CompilationJobKind.Both, fn: deleteAnyCasts },
23961
23945
  { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
23962
- { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
23963
23946
  { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
23964
23947
  { kind: CompilationJobKind.Both, fn: resolveNames },
23965
23948
  { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
@@ -24377,6 +24360,10 @@ function ingestIfBlock(unit, ifBlock) {
24377
24360
  * Ingest an `@switch` block into the given `ViewCompilation`.
24378
24361
  */
24379
24362
  function ingestSwitchBlock(unit, switchBlock) {
24363
+ // Don't ingest empty switches since they won't render anything.
24364
+ if (switchBlock.cases.length === 0) {
24365
+ return;
24366
+ }
24380
24367
  let firstXref = null;
24381
24368
  let firstSlotHandle = null;
24382
24369
  let conditions = [];
@@ -24533,22 +24520,43 @@ function ingestIcu(unit, icu) {
24533
24520
  */
24534
24521
  function ingestForBlock(unit, forBlock) {
24535
24522
  const repeaterView = unit.job.allocateView(unit.xref);
24536
- const createRepeaterAlias = (ident, repeaterVar) => {
24537
- repeaterView.aliases.add({
24538
- kind: SemanticVariableKind.Alias,
24539
- name: null,
24540
- identifier: ident,
24541
- expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar),
24542
- });
24543
- };
24544
24523
  // Set all the context variables and aliases available in the repeater.
24545
24524
  repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
24546
24525
  repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
24547
24526
  repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
24548
- createRepeaterAlias(forBlock.contextVariables.$first.name, DerivedRepeaterVarIdentity.First);
24549
- createRepeaterAlias(forBlock.contextVariables.$last.name, DerivedRepeaterVarIdentity.Last);
24550
- createRepeaterAlias(forBlock.contextVariables.$even.name, DerivedRepeaterVarIdentity.Even);
24551
- createRepeaterAlias(forBlock.contextVariables.$odd.name, DerivedRepeaterVarIdentity.Odd);
24527
+ // We copy TemplateDefinitionBuilder's scheme of creating names for `$count` and `$index` that are
24528
+ // suffixed with special information, to disambiguate which level of nested loop the below aliases
24529
+ // refer to.
24530
+ // TODO: We should refactor Template Pipeline's variable phases to gracefully handle shadowing,
24531
+ // and arbitrarily many levels of variables depending on each other.
24532
+ const indexName = `ɵ${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
24533
+ const countName = `ɵ${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
24534
+ repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
24535
+ repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
24536
+ repeaterView.aliases.add({
24537
+ kind: SemanticVariableKind.Alias,
24538
+ name: null,
24539
+ identifier: forBlock.contextVariables.$first.name,
24540
+ expression: new LexicalReadExpr(indexName).identical(literal(0))
24541
+ });
24542
+ repeaterView.aliases.add({
24543
+ kind: SemanticVariableKind.Alias,
24544
+ name: null,
24545
+ identifier: forBlock.contextVariables.$last.name,
24546
+ expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
24547
+ });
24548
+ repeaterView.aliases.add({
24549
+ kind: SemanticVariableKind.Alias,
24550
+ name: null,
24551
+ identifier: forBlock.contextVariables.$even.name,
24552
+ expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
24553
+ });
24554
+ repeaterView.aliases.add({
24555
+ kind: SemanticVariableKind.Alias,
24556
+ name: null,
24557
+ identifier: forBlock.contextVariables.$odd.name,
24558
+ expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
24559
+ });
24552
24560
  const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
24553
24561
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
24554
24562
  ingestNodes(repeaterView, forBlock.children);
@@ -24837,7 +24845,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
24837
24845
  output.type !== 1 /* e.ParsedEventType.Animation */) {
24838
24846
  // Animation bindings are excluded from the structural template's const array.
24839
24847
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, output.name, false);
24840
- unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
24848
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
24841
24849
  }
24842
24850
  }
24843
24851
  // TODO: Perhaps we could do this in a phase? (It likely wouldn't change the slot indices.)
@@ -24885,7 +24893,7 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
24885
24893
  // inner node of a structural template. We can't skip it entirely, because we still need it on
24886
24894
  // the ng-template's consts (e.g. for the purposes of directive matching). However, we should
24887
24895
  // not generate an update instruction for it.
24888
- return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
24896
+ return createExtractedAttributeOp(xref, BindingKind.Property, null, name, null, null, i18nMessage, securityContext);
24889
24897
  }
24890
24898
  if (!isTextBinding && (type === 1 /* e.BindingType.Attribute */ || type === 4 /* e.BindingType.Animation */)) {
24891
24899
  // Again, this binding doesn't really target the ng-template; it actually targets the element
@@ -28687,6 +28695,9 @@ class TemplateDefinitionBuilder {
28687
28695
  this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
28688
28696
  }
28689
28697
  visitSwitchBlock(block) {
28698
+ if (block.cases.length === 0) {
28699
+ return;
28700
+ }
28690
28701
  // We have to process the block in two steps: once here and again in the update instruction
28691
28702
  // callback in order to generate the correct expressions when pipes or pure functions are used.
28692
28703
  const caseData = block.cases.map(currentCase => {
@@ -29150,7 +29161,7 @@ class TemplateDefinitionBuilder {
29150
29161
  if (delta < 1) {
29151
29162
  throw new Error('advance instruction can only go forwards');
29152
29163
  }
29153
- this.instructionFn(this._updateCodeFns, span, Identifiers.advance, [literal(delta)]);
29164
+ this.instructionFn(this._updateCodeFns, span, Identifiers.advance, delta > 1 ? [literal(delta)] : []);
29154
29165
  this._currentIndex = nodeIndex;
29155
29166
  }
29156
29167
  }
@@ -31849,8 +31860,10 @@ function convertDirectiveFacadeToMetadata(facade) {
31849
31860
  bindingPropertyName: ann.alias || field,
31850
31861
  classPropertyName: field,
31851
31862
  required: ann.required || false,
31852
- // TODO(signals): Support JIT signal inputs via decorator transform.
31853
- isSignal: false,
31863
+ // For JIT, decorators are used to declare signal inputs. That is because of
31864
+ // a technical limitation where it's not possible to statically reflect class
31865
+ // members of a directive/component at runtime before instantiating the class.
31866
+ isSignal: !!ann.isSignal,
31854
31867
  transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null,
31855
31868
  };
31856
31869
  }
@@ -32262,7 +32275,7 @@ function publishFacade(global) {
32262
32275
  * @description
32263
32276
  * Entry point for all public APIs of the compiler package.
32264
32277
  */
32265
- const VERSION = new Version('17.1.0-next.5');
32278
+ const VERSION = new Version('17.1.0-rc.0');
32266
32279
 
32267
32280
  class CompilerConfig {
32268
32281
  constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -33828,7 +33841,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$5 = '12.0.0';
33828
33841
  function compileDeclareClassMetadata(metadata) {
33829
33842
  const definitionMap = new DefinitionMap();
33830
33843
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
33831
- definitionMap.set('version', literal('17.1.0-next.5'));
33844
+ definitionMap.set('version', literal('17.1.0-rc.0'));
33832
33845
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33833
33846
  definitionMap.set('type', metadata.type);
33834
33847
  definitionMap.set('decorators', metadata.decorators);
@@ -33924,7 +33937,7 @@ function createDirectiveDefinitionMap(meta) {
33924
33937
  const definitionMap = new DefinitionMap();
33925
33938
  const minVersion = getMinimumVersionForPartialOutput(meta);
33926
33939
  definitionMap.set('minVersion', literal(minVersion));
33927
- definitionMap.set('version', literal('17.1.0-next.5'));
33940
+ definitionMap.set('version', literal('17.1.0-rc.0'));
33928
33941
  // e.g. `type: MyDirective`
33929
33942
  definitionMap.set('type', meta.type.value);
33930
33943
  if (meta.isStandalone) {
@@ -33982,8 +33995,8 @@ function getMinimumVersionForPartialOutput(meta) {
33982
33995
  // Note: in order to allow consuming Angular libraries that have been compiled with 16.1+ in
33983
33996
  // Angular 16.0, we only force a minimum version of 16.1 if input transform feature as introduced
33984
33997
  // in 16.1 is actually used.
33985
- const hasTransformFunctions = Object.values(meta.inputs).some(input => input.transformFunction !== null);
33986
- if (hasTransformFunctions) {
33998
+ const hasDecoratorTransformFunctions = Object.values(meta.inputs).some(input => input.transformFunction !== null);
33999
+ if (hasDecoratorTransformFunctions) {
33987
34000
  minVersion = '16.1.0';
33988
34001
  }
33989
34002
  // If there are input flags and we need the new emit, use the actual minimum version,
@@ -34308,7 +34321,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34308
34321
  function compileDeclareFactoryFunction(meta) {
34309
34322
  const definitionMap = new DefinitionMap();
34310
34323
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34311
- definitionMap.set('version', literal('17.1.0-next.5'));
34324
+ definitionMap.set('version', literal('17.1.0-rc.0'));
34312
34325
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34313
34326
  definitionMap.set('type', meta.type.value);
34314
34327
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34343,7 +34356,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34343
34356
  function createInjectableDefinitionMap(meta) {
34344
34357
  const definitionMap = new DefinitionMap();
34345
34358
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34346
- definitionMap.set('version', literal('17.1.0-next.5'));
34359
+ definitionMap.set('version', literal('17.1.0-rc.0'));
34347
34360
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34348
34361
  definitionMap.set('type', meta.type.value);
34349
34362
  // Only generate providedIn property if it has a non-null value
@@ -34394,7 +34407,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34394
34407
  function createInjectorDefinitionMap(meta) {
34395
34408
  const definitionMap = new DefinitionMap();
34396
34409
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34397
- definitionMap.set('version', literal('17.1.0-next.5'));
34410
+ definitionMap.set('version', literal('17.1.0-rc.0'));
34398
34411
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34399
34412
  definitionMap.set('type', meta.type.value);
34400
34413
  definitionMap.set('providers', meta.providers);
@@ -34427,7 +34440,7 @@ function createNgModuleDefinitionMap(meta) {
34427
34440
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34428
34441
  }
34429
34442
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34430
- definitionMap.set('version', literal('17.1.0-next.5'));
34443
+ definitionMap.set('version', literal('17.1.0-rc.0'));
34431
34444
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34432
34445
  definitionMap.set('type', meta.type.value);
34433
34446
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34478,7 +34491,7 @@ function compileDeclarePipeFromMetadata(meta) {
34478
34491
  function createPipeDefinitionMap(meta) {
34479
34492
  const definitionMap = new DefinitionMap();
34480
34493
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34481
- definitionMap.set('version', literal('17.1.0-next.5'));
34494
+ definitionMap.set('version', literal('17.1.0-rc.0'));
34482
34495
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34483
34496
  // e.g. `type: MyPipe`
34484
34497
  definitionMap.set('type', meta.type.value);