@angular/core 18.0.0-next.0 → 18.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/esm2022/src/application/application_ref.mjs +2 -2
  2. package/esm2022/src/authoring/input/input.mjs +37 -14
  3. package/esm2022/src/authoring/input/input_signal.mjs +1 -1
  4. package/esm2022/src/authoring/input/input_signal_node.mjs +1 -1
  5. package/esm2022/src/authoring/input/input_type_checking.mjs +1 -1
  6. package/esm2022/src/authoring/model/model.mjs +35 -15
  7. package/esm2022/src/authoring/output/output.mjs +32 -10
  8. package/esm2022/src/authoring/queries.mjs +11 -1
  9. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +21 -4
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +5 -1
  11. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +88 -20
  12. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  13. package/esm2022/src/core_private_export.mjs +2 -2
  14. package/esm2022/src/core_render3_private_export.mjs +2 -2
  15. package/esm2022/src/defer/instructions.mjs +22 -8
  16. package/esm2022/src/hydration/error_handling.mjs +6 -3
  17. package/esm2022/src/hydration/utils.mjs +5 -4
  18. package/esm2022/src/linker/template_ref.mjs +2 -2
  19. package/esm2022/src/platform/platform_ref.mjs +3 -2
  20. package/esm2022/src/render3/component_ref.mjs +1 -1
  21. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +2 -2
  22. package/esm2022/src/render3/instructions/change_detection.mjs +26 -18
  23. package/esm2022/src/render3/instructions/control_flow.mjs +24 -15
  24. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +11 -2
  25. package/esm2022/src/render3/instructions/projection.mjs +35 -9
  26. package/esm2022/src/render3/instructions/template.mjs +45 -24
  27. package/esm2022/src/render3/jit/partial.mjs +13 -2
  28. package/esm2022/src/render3/state.mjs +13 -1
  29. package/esm2022/src/render3/util/injector_discovery_utils.mjs +2 -2
  30. package/esm2022/src/render3/view_manipulation.mjs +2 -2
  31. package/esm2022/src/util/callback_scheduler.mjs +6 -1
  32. package/esm2022/src/version.mjs +1 -1
  33. package/esm2022/testing/src/component_fixture.mjs +23 -58
  34. package/esm2022/testing/src/logger.mjs +3 -3
  35. package/esm2022/testing/src/test_bed.mjs +4 -4
  36. package/fesm2022/core.mjs +1439 -1168
  37. package/fesm2022/core.mjs.map +1 -1
  38. package/fesm2022/primitives/signals.mjs +1 -1
  39. package/fesm2022/rxjs-interop.mjs +1 -1
  40. package/fesm2022/testing.mjs +25 -60
  41. package/fesm2022/testing.mjs.map +1 -1
  42. package/index.d.ts +190 -117
  43. package/package.json +1 -1
  44. package/primitives/signals/index.d.ts +1 -1
  45. package/rxjs-interop/index.d.ts +1 -1
  46. package/schematics/migrations/block-template-entities/bundle.js +163 -99
  47. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  48. package/schematics/migrations/invalid-two-way-bindings/bundle.js +165 -100
  49. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  50. package/schematics/ng-generate/control-flow-migration/bundle.js +167 -100
  51. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  52. package/schematics/ng-generate/standalone-migration/bundle.js +3295 -1417
  53. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  54. package/testing/index.d.ts +4 -3
@@ -1871,12 +1871,12 @@ var ConstantPool = class {
1871
1871
  if (isArrow && current instanceof DeclareVarStmt && ((_a2 = current.value) == null ? void 0 : _a2.isEquivalent(fn2))) {
1872
1872
  return variable(current.name);
1873
1873
  }
1874
- if (!isArrow && current instanceof DeclareFunctionStmt && fn2.isEquivalent(current)) {
1874
+ if (!isArrow && current instanceof DeclareFunctionStmt && fn2 instanceof FunctionExpr && fn2.isEquivalent(current)) {
1875
1875
  return variable(current.name);
1876
1876
  }
1877
1877
  }
1878
1878
  const name = useUniqueName ? this.uniqueName(prefix) : prefix;
1879
- this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
1879
+ this.statements.push(fn2 instanceof FunctionExpr ? fn2.toDeclStmt(name, StmtModifier.Final) : new DeclareVarStmt(name, fn2, INFERRED_TYPE, StmtModifier.Final, fn2.sourceSpan));
1880
1880
  return variable(name);
1881
1881
  }
1882
1882
  _getLiteralFactory(key, values, resultMap) {
@@ -2502,6 +2502,9 @@ var Identifiers = _Identifiers;
2502
2502
  (() => {
2503
2503
  _Identifiers.declareClassMetadata = { name: "\u0275\u0275ngDeclareClassMetadata", moduleName: CORE };
2504
2504
  })();
2505
+ (() => {
2506
+ _Identifiers.declareClassMetadataAsync = { name: "\u0275\u0275ngDeclareClassMetadataAsync", moduleName: CORE };
2507
+ })();
2505
2508
  (() => {
2506
2509
  _Identifiers.setClassMetadata = { name: "\u0275setClassMetadata", moduleName: CORE };
2507
2510
  })();
@@ -4301,9 +4304,10 @@ var Template = class {
4301
4304
  }
4302
4305
  };
4303
4306
  var Content = class {
4304
- constructor(selector, attributes, sourceSpan, i18n2) {
4307
+ constructor(selector, attributes, children, sourceSpan, i18n2) {
4305
4308
  this.selector = selector;
4306
4309
  this.attributes = attributes;
4310
+ this.children = children;
4307
4311
  this.sourceSpan = sourceSpan;
4308
4312
  this.i18n = i18n2;
4309
4313
  this.name = "ng-content";
@@ -7563,18 +7567,21 @@ function createProjectionDefOp(def) {
7563
7567
  def
7564
7568
  }, NEW_OP);
7565
7569
  }
7566
- function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
7567
- return __spreadValues(__spreadValues({
7570
+ function createProjectionOp(xref, selector, i18nPlaceholder, fallbackView, sourceSpan) {
7571
+ return __spreadProps(__spreadValues(__spreadValues({
7568
7572
  kind: OpKind.Projection,
7569
7573
  xref,
7570
7574
  handle: new SlotHandle(),
7571
7575
  selector,
7572
7576
  i18nPlaceholder,
7577
+ fallbackView,
7573
7578
  projectionSlotIndex: 0,
7574
7579
  attributes: null,
7575
7580
  localRefs: [],
7576
7581
  sourceSpan
7577
- }, NEW_OP), TRAIT_CONSUMES_SLOT);
7582
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), {
7583
+ numSlotsUsed: fallbackView === null ? 1 : 2
7584
+ });
7578
7585
  }
7579
7586
  function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
7580
7587
  return __spreadValues({
@@ -9120,6 +9127,11 @@ function recursivelyProcessView(view, parentScope) {
9120
9127
  case OpKind.Template:
9121
9128
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9122
9129
  break;
9130
+ case OpKind.Projection:
9131
+ if (op.fallbackView !== null) {
9132
+ recursivelyProcessView(view.job.views.get(op.fallbackView), scope);
9133
+ }
9134
+ break;
9123
9135
  case OpKind.RepeaterCreate:
9124
9136
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9125
9137
  if (op.emptyView) {
@@ -15741,6 +15753,18 @@ function addNamesToView(unit, baseName, state, compatibility) {
15741
15753
  }
15742
15754
  addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
15743
15755
  break;
15756
+ case OpKind.Projection:
15757
+ if (!(unit instanceof ViewCompilationUnit)) {
15758
+ throw new Error(`AssertionError: must be compiling a component`);
15759
+ }
15760
+ if (op.handle.slot === null) {
15761
+ throw new Error(`Expected slot to be assigned`);
15762
+ }
15763
+ if (op.fallbackView !== null) {
15764
+ const fallbackView = unit.job.views.get(op.fallbackView);
15765
+ addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
15766
+ }
15767
+ break;
15744
15768
  case OpKind.Template:
15745
15769
  if (!(unit instanceof ViewCompilationUnit)) {
15746
15770
  throw new Error(`AssertionError: must be compiling a component`);
@@ -16407,13 +16431,19 @@ function deferOn(trigger, args, prefetch, sourceSpan) {
16407
16431
  function projectionDef(def) {
16408
16432
  return call(Identifiers.projectionDef, def ? [def] : [], null);
16409
16433
  }
16410
- function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
16434
+ function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
16411
16435
  const args = [literal(slot)];
16412
- if (projectionSlotIndex !== 0 || attributes !== null) {
16436
+ if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
16413
16437
  args.push(literal(projectionSlotIndex));
16414
16438
  if (attributes !== null) {
16415
16439
  args.push(attributes);
16416
16440
  }
16441
+ if (fallbackFnName !== null) {
16442
+ if (attributes === null) {
16443
+ args.push(literal(null));
16444
+ }
16445
+ args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
16446
+ }
16417
16447
  }
16418
16448
  return call(Identifiers.projection, args, sourceSpan);
16419
16449
  }
@@ -16916,7 +16946,25 @@ function reifyCreateOperations(unit, ops) {
16916
16946
  if (op.handle.slot === null) {
16917
16947
  throw new Error("No slot was assigned for project instruction");
16918
16948
  }
16919
- OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, op.sourceSpan));
16949
+ let fallbackViewFnName = null;
16950
+ let fallbackDecls = null;
16951
+ let fallbackVars = null;
16952
+ if (op.fallbackView !== null) {
16953
+ if (!(unit instanceof ViewCompilationUnit)) {
16954
+ throw new Error(`AssertionError: must be compiling a component`);
16955
+ }
16956
+ const fallbackView = unit.job.views.get(op.fallbackView);
16957
+ if (fallbackView === void 0) {
16958
+ throw new Error("AssertionError: projection had fallback view xref, but fallback view was not found");
16959
+ }
16960
+ if (fallbackView.fnName === null || fallbackView.decls === null || fallbackView.vars === null) {
16961
+ throw new Error(`AssertionError: expected projection fallback view to have been named and counted`);
16962
+ }
16963
+ fallbackViewFnName = fallbackView.fnName;
16964
+ fallbackDecls = fallbackView.decls;
16965
+ fallbackVars = fallbackView.vars;
16966
+ }
16967
+ OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
16920
16968
  break;
16921
16969
  case OpKind.RepeaterCreate:
16922
16970
  if (op.handle.slot === null) {
@@ -17863,6 +17911,7 @@ function optimizeTrackFns(job) {
17863
17911
  } else if (op.track instanceof ReadVarExpr && op.track.name === "$item") {
17864
17912
  op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
17865
17913
  } else if (isTrackByFunctionCall(job.root.xref, op.track)) {
17914
+ op.usesComponentInstance = true;
17866
17915
  if (op.track.receiver.receiver.view === unit.xref) {
17867
17916
  op.trackByFn = op.track.receiver;
17868
17917
  } else {
@@ -17907,7 +17956,7 @@ function generateTrackVariables(job) {
17907
17956
  }
17908
17957
  op.track = transformExpressionsInExpression(op.track, (expr) => {
17909
17958
  if (expr instanceof LexicalReadExpr) {
17910
- if (expr.name === op.varNames.$index) {
17959
+ if (op.varNames.$index.has(expr.name)) {
17911
17960
  return variable("$index");
17912
17961
  } else if (expr.name === op.varNames.$implicit) {
17913
17962
  return variable("$item");
@@ -18624,10 +18673,17 @@ function ingestTemplate(unit, tmpl) {
18624
18673
  }
18625
18674
  }
18626
18675
  function ingestContent(unit, content) {
18676
+ var _a2;
18627
18677
  if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
18628
18678
  throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
18629
18679
  }
18630
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
18680
+ const id = unit.job.allocateXrefId();
18681
+ let fallbackView = null;
18682
+ if (content.children.some((child) => !(child instanceof Comment) && (!(child instanceof Text) || child.value.trim().length > 0))) {
18683
+ fallbackView = unit.job.allocateView(unit.xref);
18684
+ ingestNodes(fallbackView, content.children);
18685
+ }
18686
+ const op = createProjectionOp(id, content.selector, content.i18n, (_a2 = fallbackView == null ? void 0 : fallbackView.xref) != null ? _a2 : null, content.sourceSpan);
18631
18687
  for (const attr of content.attributes) {
18632
18688
  const securityContext = domSchema.securityContext(content.name, attr.name, true);
18633
18689
  unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
@@ -18666,10 +18722,7 @@ function ingestIfBlock(unit, ifBlock) {
18666
18722
  for (let i = 0; i < ifBlock.branches.length; i++) {
18667
18723
  const ifCase = ifBlock.branches[i];
18668
18724
  const cView = unit.job.allocateView(unit.xref);
18669
- let tagName = null;
18670
- if (i === 0) {
18671
- tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18672
- }
18725
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18673
18726
  if (ifCase.expressionAlias !== null) {
18674
18727
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
18675
18728
  }
@@ -18704,6 +18757,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18704
18757
  let conditions = [];
18705
18758
  for (const switchCase of switchBlock.cases) {
18706
18759
  const cView = unit.job.allocateView(unit.xref);
18760
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
18707
18761
  let switchCaseI18nMeta = void 0;
18708
18762
  if (switchCase.i18n !== void 0) {
18709
18763
  if (!(switchCase.i18n instanceof BlockPlaceholder)) {
@@ -18711,7 +18765,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18711
18765
  }
18712
18766
  switchCaseI18nMeta = switchCase.i18n;
18713
18767
  }
18714
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18768
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18715
18769
  unit.create.push(templateOp);
18716
18770
  if (firstXref === null) {
18717
18771
  firstXref = cView.xref;
@@ -18845,37 +18899,27 @@ function ingestIcu(unit, icu) {
18845
18899
  function ingestForBlock(unit, forBlock) {
18846
18900
  var _a2, _b2, _c2;
18847
18901
  const repeaterView = unit.job.allocateView(unit.xref);
18902
+ const indexName = `\u0275$index_${repeaterView.xref}`;
18903
+ const countName = `\u0275$count_${repeaterView.xref}`;
18904
+ const indexVarNames = /* @__PURE__ */ new Set();
18848
18905
  repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
18849
- repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
18850
- repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
18851
- const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
18852
- const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
18853
- repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
18854
- repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
18855
- repeaterView.aliases.add({
18856
- kind: SemanticVariableKind.Alias,
18857
- name: null,
18858
- identifier: forBlock.contextVariables.$first.name,
18859
- expression: new LexicalReadExpr(indexName).identical(literal(0))
18860
- });
18861
- repeaterView.aliases.add({
18862
- kind: SemanticVariableKind.Alias,
18863
- name: null,
18864
- identifier: forBlock.contextVariables.$last.name,
18865
- expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
18866
- });
18867
- repeaterView.aliases.add({
18868
- kind: SemanticVariableKind.Alias,
18869
- name: null,
18870
- identifier: forBlock.contextVariables.$even.name,
18871
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
18872
- });
18873
- repeaterView.aliases.add({
18874
- kind: SemanticVariableKind.Alias,
18875
- name: null,
18876
- identifier: forBlock.contextVariables.$odd.name,
18877
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
18878
- });
18906
+ for (const variable2 of forBlock.contextVariables) {
18907
+ if (variable2.value === "$index") {
18908
+ indexVarNames.add(variable2.name);
18909
+ }
18910
+ if (variable2.name === "$index") {
18911
+ repeaterView.contextVariables.set("$index", variable2.value).set(indexName, variable2.value);
18912
+ } else if (variable2.name === "$count") {
18913
+ repeaterView.contextVariables.set("$count", variable2.value).set(countName, variable2.value);
18914
+ } else {
18915
+ repeaterView.aliases.add({
18916
+ kind: SemanticVariableKind.Alias,
18917
+ name: null,
18918
+ identifier: variable2.name,
18919
+ expression: getComputedForLoopVariableExpression(variable2, indexName, countName)
18920
+ });
18921
+ }
18922
+ }
18879
18923
  const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
18880
18924
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
18881
18925
  ingestNodes(repeaterView, forBlock.children);
@@ -18887,12 +18931,7 @@ function ingestForBlock(unit, forBlock) {
18887
18931
  emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
18888
18932
  }
18889
18933
  const varNames = {
18890
- $index: forBlock.contextVariables.$index.name,
18891
- $count: forBlock.contextVariables.$count.name,
18892
- $first: forBlock.contextVariables.$first.name,
18893
- $last: forBlock.contextVariables.$last.name,
18894
- $even: forBlock.contextVariables.$even.name,
18895
- $odd: forBlock.contextVariables.$odd.name,
18934
+ $index: indexVarNames,
18896
18935
  $implicit: forBlock.item.name
18897
18936
  };
18898
18937
  if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
@@ -18910,6 +18949,24 @@ function ingestForBlock(unit, forBlock) {
18910
18949
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
18911
18950
  unit.update.push(repeater2);
18912
18951
  }
18952
+ function getComputedForLoopVariableExpression(variable2, indexName, countName) {
18953
+ switch (variable2.value) {
18954
+ case "$index":
18955
+ return new LexicalReadExpr(indexName);
18956
+ case "$count":
18957
+ return new LexicalReadExpr(countName);
18958
+ case "$first":
18959
+ return new LexicalReadExpr(indexName).identical(literal(0));
18960
+ case "$last":
18961
+ return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
18962
+ case "$even":
18963
+ return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
18964
+ case "$odd":
18965
+ return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
18966
+ default:
18967
+ throw new Error(`AssertionError: unknown @for loop variable ${variable2.value}`);
18968
+ }
18969
+ }
18913
18970
  function convertAst(ast, job, baseSourceSpan) {
18914
18971
  if (ast instanceof ASTWithSource) {
18915
18972
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -19199,6 +19256,12 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
19199
19256
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19200
19257
  unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19201
19258
  }
19259
+ for (const attr of root.inputs) {
19260
+ if (attr.type !== BindingType.Animation && attr.type !== BindingType.Attribute) {
19261
+ const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
19262
+ unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
19263
+ }
19264
+ }
19202
19265
  const tagName = root instanceof Element ? root.name : root.tagName;
19203
19266
  return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
19204
19267
  }
@@ -19939,19 +20002,25 @@ function parseForLoopParameters(block, errors, bindingParser) {
19939
20002
  return null;
19940
20003
  }
19941
20004
  const [, itemName, rawExpression] = match;
20005
+ if (ALLOWED_FOR_LOOP_LET_VARIABLES.has(itemName)) {
20006
+ errors.push(new ParseError(expressionParam.sourceSpan, `@for loop item name cannot be one of ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}.`));
20007
+ }
19942
20008
  const variableName = expressionParam.expression.split(" ")[0];
19943
20009
  const variableSpan = new ParseSourceSpan(expressionParam.sourceSpan.start, expressionParam.sourceSpan.start.moveBy(variableName.length));
19944
20010
  const result = {
19945
20011
  itemName: new Variable(itemName, "$implicit", variableSpan, variableSpan),
19946
20012
  trackBy: null,
19947
20013
  expression: parseBlockParameterToBinding(expressionParam, bindingParser, rawExpression),
19948
- context: {}
20014
+ context: Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES, (variableName2) => {
20015
+ const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
20016
+ return new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
20017
+ })
19949
20018
  };
19950
20019
  for (const param of secondaryParams) {
19951
20020
  const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
19952
20021
  if (letMatch !== null) {
19953
20022
  const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
19954
- parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, result.context, errors);
20023
+ parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
19955
20024
  continue;
19956
20025
  }
19957
20026
  const trackMatch = param.expression.match(FOR_LOOP_TRACK_PATTERN);
@@ -19970,15 +20039,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
19970
20039
  }
19971
20040
  errors.push(new ParseError(param.sourceSpan, `Unrecognized @for loop paramater "${param.expression}"`));
19972
20041
  }
19973
- for (const variableName2 of ALLOWED_FOR_LOOP_LET_VARIABLES) {
19974
- if (!result.context.hasOwnProperty(variableName2)) {
19975
- const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19976
- result.context[variableName2] = new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
19977
- }
19978
- }
19979
20042
  return result;
19980
20043
  }
19981
- function parseLetParameter(sourceSpan, expression, span, context, errors) {
20044
+ function parseLetParameter(sourceSpan, expression, span, loopItemName, context, errors) {
19982
20045
  var _a2, _b2, _c2;
19983
20046
  const parts = expression.split(",");
19984
20047
  let startSpan = span.start;
@@ -19990,7 +20053,9 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
19990
20053
  errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Parameter should match the pattern "<name> = <variable name>"`));
19991
20054
  } else if (!ALLOWED_FOR_LOOP_LET_VARIABLES.has(variableName)) {
19992
20055
  errors.push(new ParseError(sourceSpan, `Unknown "let" parameter variable "${variableName}". The allowed variables are: ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}`));
19993
- } else if (context.hasOwnProperty(variableName)) {
20056
+ } else if (name === loopItemName) {
20057
+ errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Variable cannot be called "${loopItemName}"`));
20058
+ } else if (context.some((v) => v.name === name)) {
19994
20059
  errors.push(new ParseError(sourceSpan, `Duplicate "let" parameter variable "${variableName}"`));
19995
20060
  } else {
19996
20061
  const [, keyLeadingWhitespace, keyName] = (_a2 = expressionParts[0].match(CHARACTERS_IN_SURROUNDING_WHITESPACE_PATTERN)) != null ? _a2 : [];
@@ -20004,7 +20069,7 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
20004
20069
  valueSpan = valueLeadingWhitespace !== void 0 ? new ParseSourceSpan(startSpan.moveBy(expressionParts[0].length + 1 + valueLeadingWhitespace.length), startSpan.moveBy(expressionParts[0].length + 1 + valueLeadingWhitespace.length + implicit.length)) : void 0;
20005
20070
  }
20006
20071
  const sourceSpan2 = new ParseSourceSpan(keySpan.start, (_c2 = valueSpan == null ? void 0 : valueSpan.end) != null ? _c2 : keySpan.end);
20007
- context[variableName] = new Variable(name, variableName, sourceSpan2, keySpan, valueSpan);
20072
+ context.push(new Variable(name, variableName, sourceSpan2, keySpan, valueSpan));
20008
20073
  }
20009
20074
  startSpan = startSpan.moveBy(part.length + 1);
20010
20075
  }
@@ -20642,12 +20707,9 @@ var HtmlAstToIvyAst = class {
20642
20707
  }
20643
20708
  let parsedElement;
20644
20709
  if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
20645
- if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
20646
- this.reportError(`<ng-content> element cannot have content.`, element2.sourceSpan);
20647
- }
20648
20710
  const selector = preparsedElement.selectAttr;
20649
20711
  const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
20650
- parsedElement = new Content(selector, attrs, element2.sourceSpan, element2.i18n);
20712
+ parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
20651
20713
  this.ngContentSelectors.push(selector);
20652
20714
  } else if (isTemplateElement) {
20653
20715
  const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
@@ -20951,12 +21013,6 @@ function normalizeAttributeName(attrName) {
20951
21013
  function addEvents(events, boundEvents) {
20952
21014
  boundEvents.push(...events.map((e) => BoundEvent.fromParsedEvent(e)));
20953
21015
  }
20954
- function isEmptyTextNode(node) {
20955
- return node instanceof Text4 && node.value.trim().length == 0;
20956
- }
20957
- function isCommentNode(node) {
20958
- return node instanceof Comment2;
20959
- }
20960
21016
  function textContents(node) {
20961
21017
  if (node.children.length !== 1 || !(node.children[0] instanceof Text4)) {
20962
21018
  return null;
@@ -21133,7 +21189,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21133
21189
  let allDeferrableDepsFn = null;
21134
21190
  if (meta.defer.mode === 1 && meta.defer.dependenciesFn !== null) {
21135
21191
  const fnName = `${templateTypeName}_DeferFn`;
21136
- constantPool.statements.push(meta.defer.dependenciesFn.toDeclStmt(fnName, StmtModifier.Final));
21192
+ constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, void 0, StmtModifier.Final));
21137
21193
  allDeferrableDepsFn = variable(fnName);
21138
21194
  }
21139
21195
  const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn);
@@ -21445,9 +21501,9 @@ var Scope2 = class {
21445
21501
  nodeOrNodes.children.forEach((node) => node.visit(this));
21446
21502
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21447
21503
  this.visitVariable(nodeOrNodes.item);
21448
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitVariable(v));
21504
+ nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
21449
21505
  nodeOrNodes.children.forEach((node) => node.visit(this));
21450
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21506
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21451
21507
  nodeOrNodes.children.forEach((node) => node.visit(this));
21452
21508
  } else {
21453
21509
  nodeOrNodes.forEach((node) => node.visit(this));
@@ -21505,6 +21561,7 @@ var Scope2 = class {
21505
21561
  this.ingestScopedNode(block);
21506
21562
  }
21507
21563
  visitContent(content) {
21564
+ this.ingestScopedNode(content);
21508
21565
  }
21509
21566
  visitBoundAttribute(attr) {
21510
21567
  }
@@ -21643,7 +21700,7 @@ var DirectiveBinder = class {
21643
21700
  visitForLoopBlock(block) {
21644
21701
  var _a2;
21645
21702
  block.item.visit(this);
21646
- Object.values(block.contextVariables).forEach((v) => v.visit(this));
21703
+ block.contextVariables.forEach((v) => v.visit(this));
21647
21704
  block.children.forEach((node) => node.visit(this));
21648
21705
  (_a2 = block.empty) == null ? void 0 : _a2.visit(this);
21649
21706
  }
@@ -21659,6 +21716,7 @@ var DirectiveBinder = class {
21659
21716
  block.children.forEach((node) => node.visit(this));
21660
21717
  }
21661
21718
  visitContent(content) {
21719
+ content.children.forEach((child) => child.visit(this));
21662
21720
  }
21663
21721
  visitVariable(variable2) {
21664
21722
  }
@@ -21711,7 +21769,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21711
21769
  const usedPipes = /* @__PURE__ */ new Set();
21712
21770
  const eagerPipes = /* @__PURE__ */ new Set();
21713
21771
  const template2 = nodes instanceof Template ? nodes : null;
21714
- const deferBlocks = /* @__PURE__ */ new Map();
21772
+ const deferBlocks = [];
21715
21773
  const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
21716
21774
  binder.ingest(nodes);
21717
21775
  return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
@@ -21729,7 +21787,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21729
21787
  this.nestingLevel.set(nodeOrNodes, this.level);
21730
21788
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21731
21789
  this.visitNode(nodeOrNodes.item);
21732
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitNode(v));
21790
+ nodeOrNodes.contextVariables.forEach((v) => this.visitNode(v));
21733
21791
  nodeOrNodes.trackBy.visit(this);
21734
21792
  nodeOrNodes.children.forEach(this.visitNode);
21735
21793
  this.nestingLevel.set(nodeOrNodes, this.level);
@@ -21737,10 +21795,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21737
21795
  if (this.scope.rootNode !== nodeOrNodes) {
21738
21796
  throw new Error(`Assertion error: resolved incorrect scope for deferred block ${nodeOrNodes}`);
21739
21797
  }
21740
- this.deferBlocks.set(nodeOrNodes, this.scope);
21798
+ this.deferBlocks.push([nodeOrNodes, this.scope]);
21741
21799
  nodeOrNodes.children.forEach((node) => node.visit(this));
21742
21800
  this.nestingLevel.set(nodeOrNodes, this.level);
21743
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21801
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21744
21802
  nodeOrNodes.children.forEach((node) => node.visit(this));
21745
21803
  this.nestingLevel.set(nodeOrNodes, this.level);
21746
21804
  } else {
@@ -21772,8 +21830,6 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21772
21830
  }
21773
21831
  visitText(text2) {
21774
21832
  }
21775
- visitContent(content) {
21776
- }
21777
21833
  visitTextAttribute(attribute2) {
21778
21834
  }
21779
21835
  visitUnknownBlock(block) {
@@ -21834,6 +21890,9 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21834
21890
  (_a2 = block.expression) == null ? void 0 : _a2.visit(this);
21835
21891
  this.ingestScopedNode(block);
21836
21892
  }
21893
+ visitContent(content) {
21894
+ this.ingestScopedNode(content);
21895
+ }
21837
21896
  visitBoundText(text2) {
21838
21897
  text2.value.visit(this);
21839
21898
  }
@@ -21872,7 +21931,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21872
21931
  }
21873
21932
  };
21874
21933
  var R3BoundTarget = class {
21875
- constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks) {
21934
+ constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
21876
21935
  this.target = target;
21877
21936
  this.directives = directives;
21878
21937
  this.eagerDirectives = eagerDirectives;
@@ -21884,7 +21943,8 @@ var R3BoundTarget = class {
21884
21943
  this.scopedNodeEntities = scopedNodeEntities;
21885
21944
  this.usedPipes = usedPipes;
21886
21945
  this.eagerPipes = eagerPipes;
21887
- this.deferBlocks = deferBlocks;
21946
+ this.deferredBlocks = rawDeferred.map((current) => current[0]);
21947
+ this.deferredScopes = new Map(rawDeferred);
21888
21948
  }
21889
21949
  getEntitiesInScope(node) {
21890
21950
  var _a2;
@@ -21924,7 +21984,7 @@ var R3BoundTarget = class {
21924
21984
  return Array.from(this.eagerPipes);
21925
21985
  }
21926
21986
  getDeferBlocks() {
21927
- return Array.from(this.deferBlocks.keys());
21987
+ return this.deferredBlocks;
21928
21988
  }
21929
21989
  getDeferredTriggerTarget(block, trigger) {
21930
21990
  if (!(trigger instanceof InteractionDeferredTrigger) && !(trigger instanceof ViewportDeferredTrigger) && !(trigger instanceof HoverDeferredTrigger)) {
@@ -21965,8 +22025,11 @@ var R3BoundTarget = class {
21965
22025
  return null;
21966
22026
  }
21967
22027
  isDeferred(element2) {
21968
- for (const deferredScope of this.deferBlocks.values()) {
21969
- const stack = [deferredScope];
22028
+ for (const block of this.deferredBlocks) {
22029
+ if (!this.deferredScopes.has(block)) {
22030
+ continue;
22031
+ }
22032
+ const stack = [this.deferredScopes.get(block)];
21970
22033
  while (stack.length > 0) {
21971
22034
  const current = stack.pop();
21972
22035
  if (current.elementsInScope.has(element2)) {
@@ -21979,9 +22042,9 @@ var R3BoundTarget = class {
21979
22042
  }
21980
22043
  findEntityInScope(rootNode, name) {
21981
22044
  const entities = this.getEntitiesInScope(rootNode);
21982
- for (const entitity of entities) {
21983
- if (entitity.name === name) {
21984
- return entitity;
22045
+ for (const entity of entities) {
22046
+ if (entity.name === name) {
22047
+ return entity;
21985
22048
  }
21986
22049
  }
21987
22050
  return null;
@@ -22147,7 +22210,7 @@ var CompilerFacadeImpl = class {
22147
22210
  }
22148
22211
  compileComponent(angularCoreEnv, sourceMapUrl, facade) {
22149
22212
  var _a2;
22150
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
22213
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation, void 0);
22151
22214
  const meta = __spreadProps(__spreadValues(__spreadValues({}, facade), convertDirectiveFacadeToMetadata(facade)), {
22152
22215
  selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
22153
22216
  template: template2,
@@ -22336,7 +22399,7 @@ function convertOpaqueValuesToExpressions(obj) {
22336
22399
  }
22337
22400
  function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
22338
22401
  var _a2, _b2, _c2, _d2;
22339
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation);
22402
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation, decl.deferBlockDependencies);
22340
22403
  const declarations = [];
22341
22404
  if (decl.dependencies) {
22342
22405
  for (const innerDep of decl.dependencies) {
@@ -22406,7 +22469,7 @@ function convertPipeDeclarationToMetadata(pipe2) {
22406
22469
  type: new WrappedNodeExpr(pipe2.type)
22407
22470
  };
22408
22471
  }
22409
- function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
22472
+ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation, deferBlockDependencies) {
22410
22473
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
22411
22474
  const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
22412
22475
  if (parsed.errors !== null) {
@@ -22418,7 +22481,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
22418
22481
  return {
22419
22482
  template: parsed,
22420
22483
  interpolation: interpolationConfig,
22421
- defer: createR3ComponentDeferMetadata(boundTarget)
22484
+ defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies)
22422
22485
  };
22423
22486
  }
22424
22487
  function convertToProviderExpression(obj, property2) {
@@ -22458,11 +22521,12 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
22458
22521
  const attributeNameType = isAttributeDep ? literal("unknown") : null;
22459
22522
  return { token, attributeNameType, host, optional, self, skipSelf };
22460
22523
  }
22461
- function createR3ComponentDeferMetadata(boundTarget) {
22524
+ function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
22462
22525
  const deferredBlocks = boundTarget.getDeferBlocks();
22463
22526
  const blocks = /* @__PURE__ */ new Map();
22464
- for (const block of deferredBlocks) {
22465
- blocks.set(block, null);
22527
+ for (let i = 0; i < deferredBlocks.length; i++) {
22528
+ const dependencyFn = deferBlockDependencies == null ? void 0 : deferBlockDependencies[i];
22529
+ blocks.set(deferredBlocks[i], dependencyFn ? new WrappedNodeExpr(dependencyFn) : null);
22466
22530
  }
22467
22531
  return { mode: 0, blocks };
22468
22532
  }
@@ -22592,7 +22656,7 @@ function publishFacade(global) {
22592
22656
  }
22593
22657
 
22594
22658
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22595
- var VERSION2 = new Version("18.0.0-next.0");
22659
+ var VERSION2 = new Version("18.0.0-next.2");
22596
22660
 
22597
22661
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22598
22662
  var _VisitorMode;