@angular/core 18.0.0-next.1 → 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 (46) hide show
  1. package/esm2022/src/authoring/input/input.mjs +37 -14
  2. package/esm2022/src/authoring/input/input_signal.mjs +1 -1
  3. package/esm2022/src/authoring/input/input_signal_node.mjs +1 -1
  4. package/esm2022/src/authoring/input/input_type_checking.mjs +1 -1
  5. package/esm2022/src/authoring/model/model.mjs +35 -15
  6. package/esm2022/src/authoring/output/output.mjs +32 -10
  7. package/esm2022/src/authoring/queries.mjs +11 -1
  8. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +21 -4
  9. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +5 -1
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +88 -20
  11. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  12. package/esm2022/src/core_private_export.mjs +2 -2
  13. package/esm2022/src/core_render3_private_export.mjs +2 -2
  14. package/esm2022/src/defer/instructions.mjs +23 -9
  15. package/esm2022/src/platform/platform_ref.mjs +3 -2
  16. package/esm2022/src/render3/component_ref.mjs +1 -1
  17. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +2 -2
  18. package/esm2022/src/render3/instructions/control_flow.mjs +24 -15
  19. package/esm2022/src/render3/instructions/projection.mjs +35 -9
  20. package/esm2022/src/render3/instructions/template.mjs +45 -24
  21. package/esm2022/src/render3/jit/partial.mjs +13 -2
  22. package/esm2022/src/render3/util/injector_discovery_utils.mjs +2 -2
  23. package/esm2022/src/util/callback_scheduler.mjs +6 -1
  24. package/esm2022/src/version.mjs +1 -1
  25. package/esm2022/testing/src/component_fixture.mjs +23 -58
  26. package/esm2022/testing/src/logger.mjs +3 -3
  27. package/esm2022/testing/src/test_bed.mjs +4 -4
  28. package/fesm2022/core.mjs +388 -148
  29. package/fesm2022/core.mjs.map +1 -1
  30. package/fesm2022/primitives/signals.mjs +1 -1
  31. package/fesm2022/rxjs-interop.mjs +1 -1
  32. package/fesm2022/testing.mjs +25 -60
  33. package/fesm2022/testing.mjs.map +1 -1
  34. package/index.d.ts +190 -117
  35. package/package.json +1 -1
  36. package/primitives/signals/index.d.ts +1 -1
  37. package/rxjs-interop/index.d.ts +1 -1
  38. package/schematics/migrations/block-template-entities/bundle.js +157 -99
  39. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  40. package/schematics/migrations/invalid-two-way-bindings/bundle.js +159 -100
  41. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  42. package/schematics/ng-generate/control-flow-migration/bundle.js +161 -100
  43. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  44. package/schematics/ng-generate/standalone-migration/bundle.js +1380 -882
  45. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  46. 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);
@@ -19945,19 +20002,25 @@ function parseForLoopParameters(block, errors, bindingParser) {
19945
20002
  return null;
19946
20003
  }
19947
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
+ }
19948
20008
  const variableName = expressionParam.expression.split(" ")[0];
19949
20009
  const variableSpan = new ParseSourceSpan(expressionParam.sourceSpan.start, expressionParam.sourceSpan.start.moveBy(variableName.length));
19950
20010
  const result = {
19951
20011
  itemName: new Variable(itemName, "$implicit", variableSpan, variableSpan),
19952
20012
  trackBy: null,
19953
20013
  expression: parseBlockParameterToBinding(expressionParam, bindingParser, rawExpression),
19954
- 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
+ })
19955
20018
  };
19956
20019
  for (const param of secondaryParams) {
19957
20020
  const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
19958
20021
  if (letMatch !== null) {
19959
20022
  const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
19960
- parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, result.context, errors);
20023
+ parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
19961
20024
  continue;
19962
20025
  }
19963
20026
  const trackMatch = param.expression.match(FOR_LOOP_TRACK_PATTERN);
@@ -19976,15 +20039,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
19976
20039
  }
19977
20040
  errors.push(new ParseError(param.sourceSpan, `Unrecognized @for loop paramater "${param.expression}"`));
19978
20041
  }
19979
- for (const variableName2 of ALLOWED_FOR_LOOP_LET_VARIABLES) {
19980
- if (!result.context.hasOwnProperty(variableName2)) {
19981
- const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19982
- result.context[variableName2] = new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
19983
- }
19984
- }
19985
20042
  return result;
19986
20043
  }
19987
- function parseLetParameter(sourceSpan, expression, span, context, errors) {
20044
+ function parseLetParameter(sourceSpan, expression, span, loopItemName, context, errors) {
19988
20045
  var _a2, _b2, _c2;
19989
20046
  const parts = expression.split(",");
19990
20047
  let startSpan = span.start;
@@ -19996,7 +20053,9 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
19996
20053
  errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Parameter should match the pattern "<name> = <variable name>"`));
19997
20054
  } else if (!ALLOWED_FOR_LOOP_LET_VARIABLES.has(variableName)) {
19998
20055
  errors.push(new ParseError(sourceSpan, `Unknown "let" parameter variable "${variableName}". The allowed variables are: ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}`));
19999
- } 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)) {
20000
20059
  errors.push(new ParseError(sourceSpan, `Duplicate "let" parameter variable "${variableName}"`));
20001
20060
  } else {
20002
20061
  const [, keyLeadingWhitespace, keyName] = (_a2 = expressionParts[0].match(CHARACTERS_IN_SURROUNDING_WHITESPACE_PATTERN)) != null ? _a2 : [];
@@ -20010,7 +20069,7 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
20010
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;
20011
20070
  }
20012
20071
  const sourceSpan2 = new ParseSourceSpan(keySpan.start, (_c2 = valueSpan == null ? void 0 : valueSpan.end) != null ? _c2 : keySpan.end);
20013
- context[variableName] = new Variable(name, variableName, sourceSpan2, keySpan, valueSpan);
20072
+ context.push(new Variable(name, variableName, sourceSpan2, keySpan, valueSpan));
20014
20073
  }
20015
20074
  startSpan = startSpan.moveBy(part.length + 1);
20016
20075
  }
@@ -20648,12 +20707,9 @@ var HtmlAstToIvyAst = class {
20648
20707
  }
20649
20708
  let parsedElement;
20650
20709
  if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
20651
- if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
20652
- this.reportError(`<ng-content> element cannot have content.`, element2.sourceSpan);
20653
- }
20654
20710
  const selector = preparsedElement.selectAttr;
20655
20711
  const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
20656
- parsedElement = new Content(selector, attrs, element2.sourceSpan, element2.i18n);
20712
+ parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
20657
20713
  this.ngContentSelectors.push(selector);
20658
20714
  } else if (isTemplateElement) {
20659
20715
  const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
@@ -20957,12 +21013,6 @@ function normalizeAttributeName(attrName) {
20957
21013
  function addEvents(events, boundEvents) {
20958
21014
  boundEvents.push(...events.map((e) => BoundEvent.fromParsedEvent(e)));
20959
21015
  }
20960
- function isEmptyTextNode(node) {
20961
- return node instanceof Text4 && node.value.trim().length == 0;
20962
- }
20963
- function isCommentNode(node) {
20964
- return node instanceof Comment2;
20965
- }
20966
21016
  function textContents(node) {
20967
21017
  if (node.children.length !== 1 || !(node.children[0] instanceof Text4)) {
20968
21018
  return null;
@@ -21139,7 +21189,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21139
21189
  let allDeferrableDepsFn = null;
21140
21190
  if (meta.defer.mode === 1 && meta.defer.dependenciesFn !== null) {
21141
21191
  const fnName = `${templateTypeName}_DeferFn`;
21142
- constantPool.statements.push(meta.defer.dependenciesFn.toDeclStmt(fnName, StmtModifier.Final));
21192
+ constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, void 0, StmtModifier.Final));
21143
21193
  allDeferrableDepsFn = variable(fnName);
21144
21194
  }
21145
21195
  const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn);
@@ -21451,9 +21501,9 @@ var Scope2 = class {
21451
21501
  nodeOrNodes.children.forEach((node) => node.visit(this));
21452
21502
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21453
21503
  this.visitVariable(nodeOrNodes.item);
21454
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitVariable(v));
21504
+ nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
21455
21505
  nodeOrNodes.children.forEach((node) => node.visit(this));
21456
- } 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) {
21457
21507
  nodeOrNodes.children.forEach((node) => node.visit(this));
21458
21508
  } else {
21459
21509
  nodeOrNodes.forEach((node) => node.visit(this));
@@ -21511,6 +21561,7 @@ var Scope2 = class {
21511
21561
  this.ingestScopedNode(block);
21512
21562
  }
21513
21563
  visitContent(content) {
21564
+ this.ingestScopedNode(content);
21514
21565
  }
21515
21566
  visitBoundAttribute(attr) {
21516
21567
  }
@@ -21649,7 +21700,7 @@ var DirectiveBinder = class {
21649
21700
  visitForLoopBlock(block) {
21650
21701
  var _a2;
21651
21702
  block.item.visit(this);
21652
- Object.values(block.contextVariables).forEach((v) => v.visit(this));
21703
+ block.contextVariables.forEach((v) => v.visit(this));
21653
21704
  block.children.forEach((node) => node.visit(this));
21654
21705
  (_a2 = block.empty) == null ? void 0 : _a2.visit(this);
21655
21706
  }
@@ -21665,6 +21716,7 @@ var DirectiveBinder = class {
21665
21716
  block.children.forEach((node) => node.visit(this));
21666
21717
  }
21667
21718
  visitContent(content) {
21719
+ content.children.forEach((child) => child.visit(this));
21668
21720
  }
21669
21721
  visitVariable(variable2) {
21670
21722
  }
@@ -21717,7 +21769,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21717
21769
  const usedPipes = /* @__PURE__ */ new Set();
21718
21770
  const eagerPipes = /* @__PURE__ */ new Set();
21719
21771
  const template2 = nodes instanceof Template ? nodes : null;
21720
- const deferBlocks = /* @__PURE__ */ new Map();
21772
+ const deferBlocks = [];
21721
21773
  const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
21722
21774
  binder.ingest(nodes);
21723
21775
  return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
@@ -21735,7 +21787,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21735
21787
  this.nestingLevel.set(nodeOrNodes, this.level);
21736
21788
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21737
21789
  this.visitNode(nodeOrNodes.item);
21738
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitNode(v));
21790
+ nodeOrNodes.contextVariables.forEach((v) => this.visitNode(v));
21739
21791
  nodeOrNodes.trackBy.visit(this);
21740
21792
  nodeOrNodes.children.forEach(this.visitNode);
21741
21793
  this.nestingLevel.set(nodeOrNodes, this.level);
@@ -21743,10 +21795,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21743
21795
  if (this.scope.rootNode !== nodeOrNodes) {
21744
21796
  throw new Error(`Assertion error: resolved incorrect scope for deferred block ${nodeOrNodes}`);
21745
21797
  }
21746
- this.deferBlocks.set(nodeOrNodes, this.scope);
21798
+ this.deferBlocks.push([nodeOrNodes, this.scope]);
21747
21799
  nodeOrNodes.children.forEach((node) => node.visit(this));
21748
21800
  this.nestingLevel.set(nodeOrNodes, this.level);
21749
- } 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) {
21750
21802
  nodeOrNodes.children.forEach((node) => node.visit(this));
21751
21803
  this.nestingLevel.set(nodeOrNodes, this.level);
21752
21804
  } else {
@@ -21778,8 +21830,6 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21778
21830
  }
21779
21831
  visitText(text2) {
21780
21832
  }
21781
- visitContent(content) {
21782
- }
21783
21833
  visitTextAttribute(attribute2) {
21784
21834
  }
21785
21835
  visitUnknownBlock(block) {
@@ -21840,6 +21890,9 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21840
21890
  (_a2 = block.expression) == null ? void 0 : _a2.visit(this);
21841
21891
  this.ingestScopedNode(block);
21842
21892
  }
21893
+ visitContent(content) {
21894
+ this.ingestScopedNode(content);
21895
+ }
21843
21896
  visitBoundText(text2) {
21844
21897
  text2.value.visit(this);
21845
21898
  }
@@ -21878,7 +21931,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21878
21931
  }
21879
21932
  };
21880
21933
  var R3BoundTarget = class {
21881
- 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) {
21882
21935
  this.target = target;
21883
21936
  this.directives = directives;
21884
21937
  this.eagerDirectives = eagerDirectives;
@@ -21890,7 +21943,8 @@ var R3BoundTarget = class {
21890
21943
  this.scopedNodeEntities = scopedNodeEntities;
21891
21944
  this.usedPipes = usedPipes;
21892
21945
  this.eagerPipes = eagerPipes;
21893
- this.deferBlocks = deferBlocks;
21946
+ this.deferredBlocks = rawDeferred.map((current) => current[0]);
21947
+ this.deferredScopes = new Map(rawDeferred);
21894
21948
  }
21895
21949
  getEntitiesInScope(node) {
21896
21950
  var _a2;
@@ -21930,7 +21984,7 @@ var R3BoundTarget = class {
21930
21984
  return Array.from(this.eagerPipes);
21931
21985
  }
21932
21986
  getDeferBlocks() {
21933
- return Array.from(this.deferBlocks.keys());
21987
+ return this.deferredBlocks;
21934
21988
  }
21935
21989
  getDeferredTriggerTarget(block, trigger) {
21936
21990
  if (!(trigger instanceof InteractionDeferredTrigger) && !(trigger instanceof ViewportDeferredTrigger) && !(trigger instanceof HoverDeferredTrigger)) {
@@ -21971,8 +22025,11 @@ var R3BoundTarget = class {
21971
22025
  return null;
21972
22026
  }
21973
22027
  isDeferred(element2) {
21974
- for (const deferredScope of this.deferBlocks.values()) {
21975
- 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)];
21976
22033
  while (stack.length > 0) {
21977
22034
  const current = stack.pop();
21978
22035
  if (current.elementsInScope.has(element2)) {
@@ -21985,9 +22042,9 @@ var R3BoundTarget = class {
21985
22042
  }
21986
22043
  findEntityInScope(rootNode, name) {
21987
22044
  const entities = this.getEntitiesInScope(rootNode);
21988
- for (const entitity of entities) {
21989
- if (entitity.name === name) {
21990
- return entitity;
22045
+ for (const entity of entities) {
22046
+ if (entity.name === name) {
22047
+ return entity;
21991
22048
  }
21992
22049
  }
21993
22050
  return null;
@@ -22153,7 +22210,7 @@ var CompilerFacadeImpl = class {
22153
22210
  }
22154
22211
  compileComponent(angularCoreEnv, sourceMapUrl, facade) {
22155
22212
  var _a2;
22156
- 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);
22157
22214
  const meta = __spreadProps(__spreadValues(__spreadValues({}, facade), convertDirectiveFacadeToMetadata(facade)), {
22158
22215
  selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
22159
22216
  template: template2,
@@ -22342,7 +22399,7 @@ function convertOpaqueValuesToExpressions(obj) {
22342
22399
  }
22343
22400
  function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
22344
22401
  var _a2, _b2, _c2, _d2;
22345
- 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);
22346
22403
  const declarations = [];
22347
22404
  if (decl.dependencies) {
22348
22405
  for (const innerDep of decl.dependencies) {
@@ -22412,7 +22469,7 @@ function convertPipeDeclarationToMetadata(pipe2) {
22412
22469
  type: new WrappedNodeExpr(pipe2.type)
22413
22470
  };
22414
22471
  }
22415
- function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
22472
+ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation, deferBlockDependencies) {
22416
22473
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
22417
22474
  const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
22418
22475
  if (parsed.errors !== null) {
@@ -22424,7 +22481,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
22424
22481
  return {
22425
22482
  template: parsed,
22426
22483
  interpolation: interpolationConfig,
22427
- defer: createR3ComponentDeferMetadata(boundTarget)
22484
+ defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies)
22428
22485
  };
22429
22486
  }
22430
22487
  function convertToProviderExpression(obj, property2) {
@@ -22464,11 +22521,12 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
22464
22521
  const attributeNameType = isAttributeDep ? literal("unknown") : null;
22465
22522
  return { token, attributeNameType, host, optional, self, skipSelf };
22466
22523
  }
22467
- function createR3ComponentDeferMetadata(boundTarget) {
22524
+ function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
22468
22525
  const deferredBlocks = boundTarget.getDeferBlocks();
22469
22526
  const blocks = /* @__PURE__ */ new Map();
22470
- for (const block of deferredBlocks) {
22471
- 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);
22472
22530
  }
22473
22531
  return { mode: 0, blocks };
22474
22532
  }
@@ -22598,7 +22656,7 @@ function publishFacade(global) {
22598
22656
  }
22599
22657
 
22600
22658
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22601
- var VERSION2 = new Version("18.0.0-next.1");
22659
+ var VERSION2 = new Version("18.0.0-next.2");
22602
22660
 
22603
22661
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22604
22662
  var _VisitorMode;