@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
@@ -1928,12 +1928,12 @@ var ConstantPool = class {
1928
1928
  if (isArrow && current instanceof DeclareVarStmt && ((_a2 = current.value) == null ? void 0 : _a2.isEquivalent(fn2))) {
1929
1929
  return variable(current.name);
1930
1930
  }
1931
- if (!isArrow && current instanceof DeclareFunctionStmt && fn2.isEquivalent(current)) {
1931
+ if (!isArrow && current instanceof DeclareFunctionStmt && fn2 instanceof FunctionExpr && fn2.isEquivalent(current)) {
1932
1932
  return variable(current.name);
1933
1933
  }
1934
1934
  }
1935
1935
  const name = useUniqueName ? this.uniqueName(prefix) : prefix;
1936
- this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
1936
+ this.statements.push(fn2 instanceof FunctionExpr ? fn2.toDeclStmt(name, StmtModifier.Final) : new DeclareVarStmt(name, fn2, INFERRED_TYPE, StmtModifier.Final, fn2.sourceSpan));
1937
1937
  return variable(name);
1938
1938
  }
1939
1939
  _getLiteralFactory(key, values, resultMap) {
@@ -2559,6 +2559,9 @@ var Identifiers = _Identifiers;
2559
2559
  (() => {
2560
2560
  _Identifiers.declareClassMetadata = { name: "\u0275\u0275ngDeclareClassMetadata", moduleName: CORE };
2561
2561
  })();
2562
+ (() => {
2563
+ _Identifiers.declareClassMetadataAsync = { name: "\u0275\u0275ngDeclareClassMetadataAsync", moduleName: CORE };
2564
+ })();
2562
2565
  (() => {
2563
2566
  _Identifiers.setClassMetadata = { name: "\u0275setClassMetadata", moduleName: CORE };
2564
2567
  })();
@@ -4358,9 +4361,10 @@ var Template = class {
4358
4361
  }
4359
4362
  };
4360
4363
  var Content = class {
4361
- constructor(selector, attributes, sourceSpan, i18n2) {
4364
+ constructor(selector, attributes, children, sourceSpan, i18n2) {
4362
4365
  this.selector = selector;
4363
4366
  this.attributes = attributes;
4367
+ this.children = children;
4364
4368
  this.sourceSpan = sourceSpan;
4365
4369
  this.i18n = i18n2;
4366
4370
  this.name = "ng-content";
@@ -4439,7 +4443,7 @@ var RecursiveVisitor = class {
4439
4443
  visitAll(this, block.children);
4440
4444
  }
4441
4445
  visitForLoopBlock(block) {
4442
- const blockItems = [block.item, ...Object.values(block.contextVariables), ...block.children];
4446
+ const blockItems = [block.item, ...block.contextVariables, ...block.children];
4443
4447
  block.empty && blockItems.push(block.empty);
4444
4448
  visitAll(this, blockItems);
4445
4449
  }
@@ -4455,6 +4459,7 @@ var RecursiveVisitor = class {
4455
4459
  visitAll(this, blockItems);
4456
4460
  }
4457
4461
  visitContent(content) {
4462
+ visitAll(this, content.children);
4458
4463
  }
4459
4464
  visitVariable(variable2) {
4460
4465
  }
@@ -7693,18 +7698,21 @@ function createProjectionDefOp(def) {
7693
7698
  def
7694
7699
  }, NEW_OP);
7695
7700
  }
7696
- function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
7697
- return __spreadValues(__spreadValues({
7701
+ function createProjectionOp(xref, selector, i18nPlaceholder, fallbackView, sourceSpan) {
7702
+ return __spreadProps(__spreadValues(__spreadValues({
7698
7703
  kind: OpKind.Projection,
7699
7704
  xref,
7700
7705
  handle: new SlotHandle(),
7701
7706
  selector,
7702
7707
  i18nPlaceholder,
7708
+ fallbackView,
7703
7709
  projectionSlotIndex: 0,
7704
7710
  attributes: null,
7705
7711
  localRefs: [],
7706
7712
  sourceSpan
7707
- }, NEW_OP), TRAIT_CONSUMES_SLOT);
7713
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), {
7714
+ numSlotsUsed: fallbackView === null ? 1 : 2
7715
+ });
7708
7716
  }
7709
7717
  function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
7710
7718
  return __spreadValues({
@@ -9250,6 +9258,11 @@ function recursivelyProcessView(view, parentScope) {
9250
9258
  case OpKind.Template:
9251
9259
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9252
9260
  break;
9261
+ case OpKind.Projection:
9262
+ if (op.fallbackView !== null) {
9263
+ recursivelyProcessView(view.job.views.get(op.fallbackView), scope);
9264
+ }
9265
+ break;
9253
9266
  case OpKind.RepeaterCreate:
9254
9267
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9255
9268
  if (op.emptyView) {
@@ -15830,6 +15843,18 @@ function addNamesToView(unit, baseName, state, compatibility) {
15830
15843
  }
15831
15844
  addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
15832
15845
  break;
15846
+ case OpKind.Projection:
15847
+ if (!(unit instanceof ViewCompilationUnit)) {
15848
+ throw new Error(`AssertionError: must be compiling a component`);
15849
+ }
15850
+ if (op.handle.slot === null) {
15851
+ throw new Error(`Expected slot to be assigned`);
15852
+ }
15853
+ if (op.fallbackView !== null) {
15854
+ const fallbackView = unit.job.views.get(op.fallbackView);
15855
+ addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
15856
+ }
15857
+ break;
15833
15858
  case OpKind.Template:
15834
15859
  if (!(unit instanceof ViewCompilationUnit)) {
15835
15860
  throw new Error(`AssertionError: must be compiling a component`);
@@ -16496,13 +16521,19 @@ function deferOn(trigger, args, prefetch, sourceSpan) {
16496
16521
  function projectionDef(def) {
16497
16522
  return call(Identifiers.projectionDef, def ? [def] : [], null);
16498
16523
  }
16499
- function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
16524
+ function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
16500
16525
  const args = [literal(slot)];
16501
- if (projectionSlotIndex !== 0 || attributes !== null) {
16526
+ if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
16502
16527
  args.push(literal(projectionSlotIndex));
16503
16528
  if (attributes !== null) {
16504
16529
  args.push(attributes);
16505
16530
  }
16531
+ if (fallbackFnName !== null) {
16532
+ if (attributes === null) {
16533
+ args.push(literal(null));
16534
+ }
16535
+ args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
16536
+ }
16506
16537
  }
16507
16538
  return call(Identifiers.projection, args, sourceSpan);
16508
16539
  }
@@ -17005,7 +17036,25 @@ function reifyCreateOperations(unit, ops) {
17005
17036
  if (op.handle.slot === null) {
17006
17037
  throw new Error("No slot was assigned for project instruction");
17007
17038
  }
17008
- OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, op.sourceSpan));
17039
+ let fallbackViewFnName = null;
17040
+ let fallbackDecls = null;
17041
+ let fallbackVars = null;
17042
+ if (op.fallbackView !== null) {
17043
+ if (!(unit instanceof ViewCompilationUnit)) {
17044
+ throw new Error(`AssertionError: must be compiling a component`);
17045
+ }
17046
+ const fallbackView = unit.job.views.get(op.fallbackView);
17047
+ if (fallbackView === void 0) {
17048
+ throw new Error("AssertionError: projection had fallback view xref, but fallback view was not found");
17049
+ }
17050
+ if (fallbackView.fnName === null || fallbackView.decls === null || fallbackView.vars === null) {
17051
+ throw new Error(`AssertionError: expected projection fallback view to have been named and counted`);
17052
+ }
17053
+ fallbackViewFnName = fallbackView.fnName;
17054
+ fallbackDecls = fallbackView.decls;
17055
+ fallbackVars = fallbackView.vars;
17056
+ }
17057
+ OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
17009
17058
  break;
17010
17059
  case OpKind.RepeaterCreate:
17011
17060
  if (op.handle.slot === null) {
@@ -17952,6 +18001,7 @@ function optimizeTrackFns(job) {
17952
18001
  } else if (op.track instanceof ReadVarExpr && op.track.name === "$item") {
17953
18002
  op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
17954
18003
  } else if (isTrackByFunctionCall(job.root.xref, op.track)) {
18004
+ op.usesComponentInstance = true;
17955
18005
  if (op.track.receiver.receiver.view === unit.xref) {
17956
18006
  op.trackByFn = op.track.receiver;
17957
18007
  } else {
@@ -17996,7 +18046,7 @@ function generateTrackVariables(job) {
17996
18046
  }
17997
18047
  op.track = transformExpressionsInExpression(op.track, (expr) => {
17998
18048
  if (expr instanceof LexicalReadExpr) {
17999
- if (expr.name === op.varNames.$index) {
18049
+ if (op.varNames.$index.has(expr.name)) {
18000
18050
  return variable("$index");
18001
18051
  } else if (expr.name === op.varNames.$implicit) {
18002
18052
  return variable("$item");
@@ -18713,10 +18763,17 @@ function ingestTemplate(unit, tmpl) {
18713
18763
  }
18714
18764
  }
18715
18765
  function ingestContent(unit, content) {
18766
+ var _a2;
18716
18767
  if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
18717
18768
  throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
18718
18769
  }
18719
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
18770
+ const id = unit.job.allocateXrefId();
18771
+ let fallbackView = null;
18772
+ if (content.children.some((child) => !(child instanceof Comment) && (!(child instanceof Text) || child.value.trim().length > 0))) {
18773
+ fallbackView = unit.job.allocateView(unit.xref);
18774
+ ingestNodes(fallbackView, content.children);
18775
+ }
18776
+ const op = createProjectionOp(id, content.selector, content.i18n, (_a2 = fallbackView == null ? void 0 : fallbackView.xref) != null ? _a2 : null, content.sourceSpan);
18720
18777
  for (const attr of content.attributes) {
18721
18778
  const securityContext = domSchema.securityContext(content.name, attr.name, true);
18722
18779
  unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
@@ -18755,10 +18812,7 @@ function ingestIfBlock(unit, ifBlock) {
18755
18812
  for (let i = 0; i < ifBlock.branches.length; i++) {
18756
18813
  const ifCase = ifBlock.branches[i];
18757
18814
  const cView = unit.job.allocateView(unit.xref);
18758
- let tagName = null;
18759
- if (i === 0) {
18760
- tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18761
- }
18815
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18762
18816
  if (ifCase.expressionAlias !== null) {
18763
18817
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
18764
18818
  }
@@ -18793,6 +18847,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18793
18847
  let conditions = [];
18794
18848
  for (const switchCase of switchBlock.cases) {
18795
18849
  const cView = unit.job.allocateView(unit.xref);
18850
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
18796
18851
  let switchCaseI18nMeta = void 0;
18797
18852
  if (switchCase.i18n !== void 0) {
18798
18853
  if (!(switchCase.i18n instanceof BlockPlaceholder)) {
@@ -18800,7 +18855,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18800
18855
  }
18801
18856
  switchCaseI18nMeta = switchCase.i18n;
18802
18857
  }
18803
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18858
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18804
18859
  unit.create.push(templateOp);
18805
18860
  if (firstXref === null) {
18806
18861
  firstXref = cView.xref;
@@ -18934,37 +18989,27 @@ function ingestIcu(unit, icu) {
18934
18989
  function ingestForBlock(unit, forBlock) {
18935
18990
  var _a2, _b2, _c2;
18936
18991
  const repeaterView = unit.job.allocateView(unit.xref);
18992
+ const indexName = `\u0275$index_${repeaterView.xref}`;
18993
+ const countName = `\u0275$count_${repeaterView.xref}`;
18994
+ const indexVarNames = /* @__PURE__ */ new Set();
18937
18995
  repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
18938
- repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
18939
- repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
18940
- const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
18941
- const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
18942
- repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
18943
- repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
18944
- repeaterView.aliases.add({
18945
- kind: SemanticVariableKind.Alias,
18946
- name: null,
18947
- identifier: forBlock.contextVariables.$first.name,
18948
- expression: new LexicalReadExpr(indexName).identical(literal(0))
18949
- });
18950
- repeaterView.aliases.add({
18951
- kind: SemanticVariableKind.Alias,
18952
- name: null,
18953
- identifier: forBlock.contextVariables.$last.name,
18954
- expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
18955
- });
18956
- repeaterView.aliases.add({
18957
- kind: SemanticVariableKind.Alias,
18958
- name: null,
18959
- identifier: forBlock.contextVariables.$even.name,
18960
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
18961
- });
18962
- repeaterView.aliases.add({
18963
- kind: SemanticVariableKind.Alias,
18964
- name: null,
18965
- identifier: forBlock.contextVariables.$odd.name,
18966
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
18967
- });
18996
+ for (const variable2 of forBlock.contextVariables) {
18997
+ if (variable2.value === "$index") {
18998
+ indexVarNames.add(variable2.name);
18999
+ }
19000
+ if (variable2.name === "$index") {
19001
+ repeaterView.contextVariables.set("$index", variable2.value).set(indexName, variable2.value);
19002
+ } else if (variable2.name === "$count") {
19003
+ repeaterView.contextVariables.set("$count", variable2.value).set(countName, variable2.value);
19004
+ } else {
19005
+ repeaterView.aliases.add({
19006
+ kind: SemanticVariableKind.Alias,
19007
+ name: null,
19008
+ identifier: variable2.name,
19009
+ expression: getComputedForLoopVariableExpression(variable2, indexName, countName)
19010
+ });
19011
+ }
19012
+ }
18968
19013
  const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
18969
19014
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
18970
19015
  ingestNodes(repeaterView, forBlock.children);
@@ -18976,12 +19021,7 @@ function ingestForBlock(unit, forBlock) {
18976
19021
  emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
18977
19022
  }
18978
19023
  const varNames = {
18979
- $index: forBlock.contextVariables.$index.name,
18980
- $count: forBlock.contextVariables.$count.name,
18981
- $first: forBlock.contextVariables.$first.name,
18982
- $last: forBlock.contextVariables.$last.name,
18983
- $even: forBlock.contextVariables.$even.name,
18984
- $odd: forBlock.contextVariables.$odd.name,
19024
+ $index: indexVarNames,
18985
19025
  $implicit: forBlock.item.name
18986
19026
  };
18987
19027
  if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
@@ -18999,6 +19039,24 @@ function ingestForBlock(unit, forBlock) {
18999
19039
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
19000
19040
  unit.update.push(repeater2);
19001
19041
  }
19042
+ function getComputedForLoopVariableExpression(variable2, indexName, countName) {
19043
+ switch (variable2.value) {
19044
+ case "$index":
19045
+ return new LexicalReadExpr(indexName);
19046
+ case "$count":
19047
+ return new LexicalReadExpr(countName);
19048
+ case "$first":
19049
+ return new LexicalReadExpr(indexName).identical(literal(0));
19050
+ case "$last":
19051
+ return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
19052
+ case "$even":
19053
+ return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
19054
+ case "$odd":
19055
+ return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
19056
+ default:
19057
+ throw new Error(`AssertionError: unknown @for loop variable ${variable2.value}`);
19058
+ }
19059
+ }
19002
19060
  function convertAst(ast, job, baseSourceSpan) {
19003
19061
  if (ast instanceof ASTWithSource) {
19004
19062
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -20034,19 +20092,25 @@ function parseForLoopParameters(block, errors, bindingParser) {
20034
20092
  return null;
20035
20093
  }
20036
20094
  const [, itemName, rawExpression] = match;
20095
+ if (ALLOWED_FOR_LOOP_LET_VARIABLES.has(itemName)) {
20096
+ errors.push(new ParseError(expressionParam.sourceSpan, `@for loop item name cannot be one of ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}.`));
20097
+ }
20037
20098
  const variableName = expressionParam.expression.split(" ")[0];
20038
20099
  const variableSpan = new ParseSourceSpan(expressionParam.sourceSpan.start, expressionParam.sourceSpan.start.moveBy(variableName.length));
20039
20100
  const result = {
20040
20101
  itemName: new Variable(itemName, "$implicit", variableSpan, variableSpan),
20041
20102
  trackBy: null,
20042
20103
  expression: parseBlockParameterToBinding(expressionParam, bindingParser, rawExpression),
20043
- context: {}
20104
+ context: Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES, (variableName2) => {
20105
+ const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
20106
+ return new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
20107
+ })
20044
20108
  };
20045
20109
  for (const param of secondaryParams) {
20046
20110
  const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
20047
20111
  if (letMatch !== null) {
20048
20112
  const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
20049
- parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, result.context, errors);
20113
+ parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
20050
20114
  continue;
20051
20115
  }
20052
20116
  const trackMatch = param.expression.match(FOR_LOOP_TRACK_PATTERN);
@@ -20065,15 +20129,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
20065
20129
  }
20066
20130
  errors.push(new ParseError(param.sourceSpan, `Unrecognized @for loop paramater "${param.expression}"`));
20067
20131
  }
20068
- for (const variableName2 of ALLOWED_FOR_LOOP_LET_VARIABLES) {
20069
- if (!result.context.hasOwnProperty(variableName2)) {
20070
- const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
20071
- result.context[variableName2] = new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
20072
- }
20073
- }
20074
20132
  return result;
20075
20133
  }
20076
- function parseLetParameter(sourceSpan, expression, span, context, errors) {
20134
+ function parseLetParameter(sourceSpan, expression, span, loopItemName, context, errors) {
20077
20135
  var _a2, _b2, _c2;
20078
20136
  const parts = expression.split(",");
20079
20137
  let startSpan = span.start;
@@ -20085,7 +20143,9 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
20085
20143
  errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Parameter should match the pattern "<name> = <variable name>"`));
20086
20144
  } else if (!ALLOWED_FOR_LOOP_LET_VARIABLES.has(variableName)) {
20087
20145
  errors.push(new ParseError(sourceSpan, `Unknown "let" parameter variable "${variableName}". The allowed variables are: ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}`));
20088
- } else if (context.hasOwnProperty(variableName)) {
20146
+ } else if (name === loopItemName) {
20147
+ errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Variable cannot be called "${loopItemName}"`));
20148
+ } else if (context.some((v) => v.name === name)) {
20089
20149
  errors.push(new ParseError(sourceSpan, `Duplicate "let" parameter variable "${variableName}"`));
20090
20150
  } else {
20091
20151
  const [, keyLeadingWhitespace, keyName] = (_a2 = expressionParts[0].match(CHARACTERS_IN_SURROUNDING_WHITESPACE_PATTERN)) != null ? _a2 : [];
@@ -20099,7 +20159,7 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
20099
20159
  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;
20100
20160
  }
20101
20161
  const sourceSpan2 = new ParseSourceSpan(keySpan.start, (_c2 = valueSpan == null ? void 0 : valueSpan.end) != null ? _c2 : keySpan.end);
20102
- context[variableName] = new Variable(name, variableName, sourceSpan2, keySpan, valueSpan);
20162
+ context.push(new Variable(name, variableName, sourceSpan2, keySpan, valueSpan));
20103
20163
  }
20104
20164
  startSpan = startSpan.moveBy(part.length + 1);
20105
20165
  }
@@ -20737,12 +20797,9 @@ var HtmlAstToIvyAst = class {
20737
20797
  }
20738
20798
  let parsedElement;
20739
20799
  if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
20740
- if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
20741
- this.reportError(`<ng-content> element cannot have content.`, element2.sourceSpan);
20742
- }
20743
20800
  const selector = preparsedElement.selectAttr;
20744
20801
  const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
20745
- parsedElement = new Content(selector, attrs, element2.sourceSpan, element2.i18n);
20802
+ parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
20746
20803
  this.ngContentSelectors.push(selector);
20747
20804
  } else if (isTemplateElement) {
20748
20805
  const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
@@ -21046,12 +21103,6 @@ function normalizeAttributeName(attrName) {
21046
21103
  function addEvents(events, boundEvents) {
21047
21104
  boundEvents.push(...events.map((e) => BoundEvent.fromParsedEvent(e)));
21048
21105
  }
21049
- function isEmptyTextNode(node) {
21050
- return node instanceof Text4 && node.value.trim().length == 0;
21051
- }
21052
- function isCommentNode(node) {
21053
- return node instanceof Comment2;
21054
- }
21055
21106
  function textContents(node) {
21056
21107
  if (node.children.length !== 1 || !(node.children[0] instanceof Text4)) {
21057
21108
  return null;
@@ -21228,7 +21279,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21228
21279
  let allDeferrableDepsFn = null;
21229
21280
  if (meta.defer.mode === 1 && meta.defer.dependenciesFn !== null) {
21230
21281
  const fnName = `${templateTypeName}_DeferFn`;
21231
- constantPool.statements.push(meta.defer.dependenciesFn.toDeclStmt(fnName, StmtModifier.Final));
21282
+ constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, void 0, StmtModifier.Final));
21232
21283
  allDeferrableDepsFn = variable(fnName);
21233
21284
  }
21234
21285
  const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn);
@@ -21540,9 +21591,9 @@ var Scope2 = class {
21540
21591
  nodeOrNodes.children.forEach((node) => node.visit(this));
21541
21592
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21542
21593
  this.visitVariable(nodeOrNodes.item);
21543
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitVariable(v));
21594
+ nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
21544
21595
  nodeOrNodes.children.forEach((node) => node.visit(this));
21545
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21596
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21546
21597
  nodeOrNodes.children.forEach((node) => node.visit(this));
21547
21598
  } else {
21548
21599
  nodeOrNodes.forEach((node) => node.visit(this));
@@ -21600,6 +21651,7 @@ var Scope2 = class {
21600
21651
  this.ingestScopedNode(block);
21601
21652
  }
21602
21653
  visitContent(content) {
21654
+ this.ingestScopedNode(content);
21603
21655
  }
21604
21656
  visitBoundAttribute(attr) {
21605
21657
  }
@@ -21738,7 +21790,7 @@ var DirectiveBinder = class {
21738
21790
  visitForLoopBlock(block) {
21739
21791
  var _a2;
21740
21792
  block.item.visit(this);
21741
- Object.values(block.contextVariables).forEach((v) => v.visit(this));
21793
+ block.contextVariables.forEach((v) => v.visit(this));
21742
21794
  block.children.forEach((node) => node.visit(this));
21743
21795
  (_a2 = block.empty) == null ? void 0 : _a2.visit(this);
21744
21796
  }
@@ -21754,6 +21806,7 @@ var DirectiveBinder = class {
21754
21806
  block.children.forEach((node) => node.visit(this));
21755
21807
  }
21756
21808
  visitContent(content) {
21809
+ content.children.forEach((child) => child.visit(this));
21757
21810
  }
21758
21811
  visitVariable(variable2) {
21759
21812
  }
@@ -21806,7 +21859,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21806
21859
  const usedPipes = /* @__PURE__ */ new Set();
21807
21860
  const eagerPipes = /* @__PURE__ */ new Set();
21808
21861
  const template2 = nodes instanceof Template ? nodes : null;
21809
- const deferBlocks = /* @__PURE__ */ new Map();
21862
+ const deferBlocks = [];
21810
21863
  const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
21811
21864
  binder.ingest(nodes);
21812
21865
  return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
@@ -21824,7 +21877,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21824
21877
  this.nestingLevel.set(nodeOrNodes, this.level);
21825
21878
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21826
21879
  this.visitNode(nodeOrNodes.item);
21827
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitNode(v));
21880
+ nodeOrNodes.contextVariables.forEach((v) => this.visitNode(v));
21828
21881
  nodeOrNodes.trackBy.visit(this);
21829
21882
  nodeOrNodes.children.forEach(this.visitNode);
21830
21883
  this.nestingLevel.set(nodeOrNodes, this.level);
@@ -21832,10 +21885,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21832
21885
  if (this.scope.rootNode !== nodeOrNodes) {
21833
21886
  throw new Error(`Assertion error: resolved incorrect scope for deferred block ${nodeOrNodes}`);
21834
21887
  }
21835
- this.deferBlocks.set(nodeOrNodes, this.scope);
21888
+ this.deferBlocks.push([nodeOrNodes, this.scope]);
21836
21889
  nodeOrNodes.children.forEach((node) => node.visit(this));
21837
21890
  this.nestingLevel.set(nodeOrNodes, this.level);
21838
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21891
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21839
21892
  nodeOrNodes.children.forEach((node) => node.visit(this));
21840
21893
  this.nestingLevel.set(nodeOrNodes, this.level);
21841
21894
  } else {
@@ -21867,8 +21920,6 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21867
21920
  }
21868
21921
  visitText(text2) {
21869
21922
  }
21870
- visitContent(content) {
21871
- }
21872
21923
  visitTextAttribute(attribute2) {
21873
21924
  }
21874
21925
  visitUnknownBlock(block) {
@@ -21929,6 +21980,9 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21929
21980
  (_a2 = block.expression) == null ? void 0 : _a2.visit(this);
21930
21981
  this.ingestScopedNode(block);
21931
21982
  }
21983
+ visitContent(content) {
21984
+ this.ingestScopedNode(content);
21985
+ }
21932
21986
  visitBoundText(text2) {
21933
21987
  text2.value.visit(this);
21934
21988
  }
@@ -21967,7 +22021,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21967
22021
  }
21968
22022
  };
21969
22023
  var R3BoundTarget = class {
21970
- constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks) {
22024
+ constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
21971
22025
  this.target = target;
21972
22026
  this.directives = directives;
21973
22027
  this.eagerDirectives = eagerDirectives;
@@ -21979,7 +22033,8 @@ var R3BoundTarget = class {
21979
22033
  this.scopedNodeEntities = scopedNodeEntities;
21980
22034
  this.usedPipes = usedPipes;
21981
22035
  this.eagerPipes = eagerPipes;
21982
- this.deferBlocks = deferBlocks;
22036
+ this.deferredBlocks = rawDeferred.map((current) => current[0]);
22037
+ this.deferredScopes = new Map(rawDeferred);
21983
22038
  }
21984
22039
  getEntitiesInScope(node) {
21985
22040
  var _a2;
@@ -22019,7 +22074,7 @@ var R3BoundTarget = class {
22019
22074
  return Array.from(this.eagerPipes);
22020
22075
  }
22021
22076
  getDeferBlocks() {
22022
- return Array.from(this.deferBlocks.keys());
22077
+ return this.deferredBlocks;
22023
22078
  }
22024
22079
  getDeferredTriggerTarget(block, trigger) {
22025
22080
  if (!(trigger instanceof InteractionDeferredTrigger) && !(trigger instanceof ViewportDeferredTrigger) && !(trigger instanceof HoverDeferredTrigger)) {
@@ -22060,8 +22115,11 @@ var R3BoundTarget = class {
22060
22115
  return null;
22061
22116
  }
22062
22117
  isDeferred(element2) {
22063
- for (const deferredScope of this.deferBlocks.values()) {
22064
- const stack = [deferredScope];
22118
+ for (const block of this.deferredBlocks) {
22119
+ if (!this.deferredScopes.has(block)) {
22120
+ continue;
22121
+ }
22122
+ const stack = [this.deferredScopes.get(block)];
22065
22123
  while (stack.length > 0) {
22066
22124
  const current = stack.pop();
22067
22125
  if (current.elementsInScope.has(element2)) {
@@ -22074,9 +22132,9 @@ var R3BoundTarget = class {
22074
22132
  }
22075
22133
  findEntityInScope(rootNode, name) {
22076
22134
  const entities = this.getEntitiesInScope(rootNode);
22077
- for (const entitity of entities) {
22078
- if (entitity.name === name) {
22079
- return entitity;
22135
+ for (const entity of entities) {
22136
+ if (entity.name === name) {
22137
+ return entity;
22080
22138
  }
22081
22139
  }
22082
22140
  return null;
@@ -22242,7 +22300,7 @@ var CompilerFacadeImpl = class {
22242
22300
  }
22243
22301
  compileComponent(angularCoreEnv, sourceMapUrl, facade) {
22244
22302
  var _a2;
22245
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
22303
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation, void 0);
22246
22304
  const meta = __spreadProps(__spreadValues(__spreadValues({}, facade), convertDirectiveFacadeToMetadata(facade)), {
22247
22305
  selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
22248
22306
  template: template2,
@@ -22431,7 +22489,7 @@ function convertOpaqueValuesToExpressions(obj) {
22431
22489
  }
22432
22490
  function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
22433
22491
  var _a2, _b2, _c2, _d2;
22434
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation);
22492
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation, decl.deferBlockDependencies);
22435
22493
  const declarations = [];
22436
22494
  if (decl.dependencies) {
22437
22495
  for (const innerDep of decl.dependencies) {
@@ -22501,7 +22559,7 @@ function convertPipeDeclarationToMetadata(pipe2) {
22501
22559
  type: new WrappedNodeExpr(pipe2.type)
22502
22560
  };
22503
22561
  }
22504
- function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
22562
+ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation, deferBlockDependencies) {
22505
22563
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
22506
22564
  const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
22507
22565
  if (parsed.errors !== null) {
@@ -22513,7 +22571,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
22513
22571
  return {
22514
22572
  template: parsed,
22515
22573
  interpolation: interpolationConfig,
22516
- defer: createR3ComponentDeferMetadata(boundTarget)
22574
+ defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies)
22517
22575
  };
22518
22576
  }
22519
22577
  function convertToProviderExpression(obj, property2) {
@@ -22553,11 +22611,12 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
22553
22611
  const attributeNameType = isAttributeDep ? literal("unknown") : null;
22554
22612
  return { token, attributeNameType, host, optional, self, skipSelf };
22555
22613
  }
22556
- function createR3ComponentDeferMetadata(boundTarget) {
22614
+ function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
22557
22615
  const deferredBlocks = boundTarget.getDeferBlocks();
22558
22616
  const blocks = /* @__PURE__ */ new Map();
22559
- for (const block of deferredBlocks) {
22560
- blocks.set(block, null);
22617
+ for (let i = 0; i < deferredBlocks.length; i++) {
22618
+ const dependencyFn = deferBlockDependencies == null ? void 0 : deferBlockDependencies[i];
22619
+ blocks.set(deferredBlocks[i], dependencyFn ? new WrappedNodeExpr(dependencyFn) : null);
22561
22620
  }
22562
22621
  return { mode: 0, blocks };
22563
22622
  }
@@ -22687,7 +22746,7 @@ function publishFacade(global) {
22687
22746
  }
22688
22747
 
22689
22748
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22690
- var VERSION2 = new Version("18.0.0-next.1");
22749
+ var VERSION2 = new Version("18.0.0-next.2");
22691
22750
 
22692
22751
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22693
22752
  var _VisitorMode;