@angular/core 18.0.0-next.4 → 18.0.0-next.5

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 (40) hide show
  1. package/esm2022/src/application/application_ref.mjs +4 -2
  2. package/esm2022/src/change_detection/scheduling/flags.mjs +10 -0
  3. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +18 -33
  4. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +1 -1
  5. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +64 -7
  6. package/esm2022/src/core.mjs +2 -1
  7. package/esm2022/src/core_private_export.mjs +1 -3
  8. package/esm2022/src/debug/debug_node.mjs +1 -1
  9. package/esm2022/src/metadata/directives.mjs +1 -62
  10. package/esm2022/src/platform/platform_ref.mjs +3 -3
  11. package/esm2022/src/render3/component_ref.mjs +1 -1
  12. package/esm2022/src/render3/instructions/control_flow.mjs +6 -6
  13. package/esm2022/src/testability/testability.mjs +2 -30
  14. package/esm2022/src/util/callback_scheduler.mjs +3 -3
  15. package/esm2022/src/version.mjs +1 -1
  16. package/esm2022/testing/src/component_fixture.mjs +7 -12
  17. package/esm2022/testing/src/logger.mjs +3 -3
  18. package/esm2022/testing/src/test_bed_common.mjs +1 -6
  19. package/esm2022/testing/src/testing.mjs +1 -2
  20. package/event-dispatch-contract.min.js +1 -0
  21. package/fesm2022/core.mjs +99 -142
  22. package/fesm2022/core.mjs.map +1 -1
  23. package/fesm2022/primitives/signals.mjs +1 -1
  24. package/fesm2022/rxjs-interop.mjs +1 -1
  25. package/fesm2022/testing.mjs +34 -44
  26. package/fesm2022/testing.mjs.map +1 -1
  27. package/index.d.ts +127 -105
  28. package/package.json +4 -1
  29. package/primitives/signals/index.d.ts +1 -1
  30. package/rxjs-interop/index.d.ts +1 -1
  31. package/schematics/migrations/block-template-entities/bundle.js +27 -72
  32. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  33. package/schematics/migrations/invalid-two-way-bindings/bundle.js +32 -77
  34. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  35. package/schematics/ng-generate/control-flow-migration/bundle.js +27 -73
  36. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  37. package/schematics/ng-generate/standalone-migration/bundle.js +54 -87
  38. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  39. package/testing/index.d.ts +1 -7
  40. package/esm2022/testing/src/private_export.mjs +0 -9
@@ -6411,11 +6411,10 @@ function createAdvanceOp(delta, sourceSpan) {
6411
6411
  sourceSpan
6412
6412
  }, NEW_OP);
6413
6413
  }
6414
- function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
6414
+ function createConditionalOp(target, test, conditions, sourceSpan) {
6415
6415
  return __spreadValues(__spreadValues(__spreadValues({
6416
6416
  kind: OpKind.Conditional,
6417
6417
  target,
6418
- targetSlot,
6419
6418
  test,
6420
6419
  conditions,
6421
6420
  processed: null,
@@ -16637,19 +16636,7 @@ function pipeBindV(slot, varOffset, args) {
16637
16636
  ]);
16638
16637
  }
16639
16638
  function textInterpolate(strings, expressions, sourceSpan) {
16640
- if (strings.length < 1 || expressions.length !== strings.length - 1) {
16641
- throw new Error(`AssertionError: expected specific shape of args for strings/expressions in interpolation`);
16642
- }
16643
- const interpolationArgs = [];
16644
- if (expressions.length === 1 && strings[0] === "" && strings[1] === "") {
16645
- interpolationArgs.push(expressions[0]);
16646
- } else {
16647
- let idx;
16648
- for (idx = 0; idx < expressions.length; idx++) {
16649
- interpolationArgs.push(literal(strings[idx]), expressions[idx]);
16650
- }
16651
- interpolationArgs.push(literal(strings[idx]));
16652
- }
16639
+ const interpolationArgs = collateInterpolationArgs(strings, expressions);
16653
16640
  return callVariadicInstruction(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
16654
16641
  }
16655
16642
  function i18nExp(expr, sourceSpan) {
@@ -16726,8 +16713,8 @@ function call(instruction, args, sourceSpan) {
16726
16713
  const expr = importExpr(instruction).callFn(args, sourceSpan);
16727
16714
  return createStatementOp(new ExpressionStatement(expr, sourceSpan));
16728
16715
  }
16729
- function conditional(slot, condition, contextValue, sourceSpan) {
16730
- const args = [literal(slot), condition];
16716
+ function conditional(condition, contextValue, sourceSpan) {
16717
+ const args = [condition];
16731
16718
  if (contextValue !== null) {
16732
16719
  args.push(contextValue);
16733
16720
  }
@@ -17153,10 +17140,7 @@ function reifyUpdateOperations(_unit, ops) {
17153
17140
  if (op.processed === null) {
17154
17141
  throw new Error(`Conditional test was not set.`);
17155
17142
  }
17156
- if (op.targetSlot.slot === null) {
17157
- throw new Error(`Conditional slot was not set.`);
17158
- }
17159
- OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
17143
+ OpList.replace(op, conditional(op.processed, op.contextValue, op.sourceSpan));
17160
17144
  break;
17161
17145
  case OpKind.Repeater:
17162
17146
  OpList.replace(op, repeater(op.collection, op.sourceSpan));
@@ -17738,49 +17722,22 @@ function transformTwoWayBindingSet(job) {
17738
17722
  for (const op of unit.create) {
17739
17723
  if (op.kind === OpKind.TwoWayListener) {
17740
17724
  transformExpressionsInOp(op, (expr) => {
17741
- if (expr instanceof TwoWayBindingSetExpr) {
17742
- return wrapAction(expr.target, expr.value);
17725
+ if (!(expr instanceof TwoWayBindingSetExpr)) {
17726
+ return expr;
17743
17727
  }
17744
- return expr;
17728
+ const { target, value } = expr;
17729
+ if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
17730
+ return twoWayBindingSet(target, value).or(target.set(value));
17731
+ }
17732
+ if (target instanceof ReadVariableExpr) {
17733
+ return twoWayBindingSet(target, value);
17734
+ }
17735
+ throw new Error(`Unsupported expression in two-way action binding.`);
17745
17736
  }, VisitorContextFlag.InChildOperation);
17746
17737
  }
17747
17738
  }
17748
17739
  }
17749
17740
  }
17750
- function wrapSetOperation(target, value) {
17751
- if (target instanceof ReadVariableExpr) {
17752
- return twoWayBindingSet(target, value);
17753
- }
17754
- return twoWayBindingSet(target, value).or(target.set(value));
17755
- }
17756
- function isReadExpression(value) {
17757
- return value instanceof ReadPropExpr || value instanceof ReadKeyExpr || value instanceof ReadVariableExpr;
17758
- }
17759
- function wrapAction(target, value) {
17760
- if (isReadExpression(target)) {
17761
- return wrapSetOperation(target, value);
17762
- }
17763
- if (target instanceof BinaryOperatorExpr && isReadExpression(target.rhs)) {
17764
- return new BinaryOperatorExpr(target.operator, target.lhs, wrapSetOperation(target.rhs, value));
17765
- }
17766
- if (target instanceof ConditionalExpr && isReadExpression(target.falseCase)) {
17767
- return new ConditionalExpr(target.condition, target.trueCase, wrapSetOperation(target.falseCase, value));
17768
- }
17769
- if (target instanceof NotExpr) {
17770
- let expr = target.condition;
17771
- while (true) {
17772
- if (expr instanceof NotExpr) {
17773
- expr = expr.condition;
17774
- } else {
17775
- if (isReadExpression(expr)) {
17776
- return wrapSetOperation(expr, value);
17777
- }
17778
- break;
17779
- }
17780
- }
17781
- }
17782
- throw new Error(`Unsupported expression in two-way action binding.`);
17783
- }
17784
17741
 
17785
17742
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
17786
17743
  function saveAndRestoreView(job) {
@@ -18791,7 +18748,6 @@ function ingestBoundText(unit, text2, icuPlaceholder) {
18791
18748
  function ingestIfBlock(unit, ifBlock) {
18792
18749
  var _a2;
18793
18750
  let firstXref = null;
18794
- let firstSlotHandle = null;
18795
18751
  let conditions = [];
18796
18752
  for (let i = 0; i < ifBlock.branches.length; i++) {
18797
18753
  const ifCase = ifBlock.branches[i];
@@ -18811,15 +18767,13 @@ function ingestIfBlock(unit, ifBlock) {
18811
18767
  unit.create.push(templateOp);
18812
18768
  if (firstXref === null) {
18813
18769
  firstXref = cView.xref;
18814
- firstSlotHandle = templateOp.handle;
18815
18770
  }
18816
18771
  const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
18817
18772
  const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle, ifCase.expressionAlias);
18818
18773
  conditions.push(conditionalCaseExpr);
18819
18774
  ingestNodes(cView, ifCase.children);
18820
18775
  }
18821
- const conditional2 = createConditionalOp(firstXref, firstSlotHandle, null, conditions, ifBlock.sourceSpan);
18822
- unit.update.push(conditional2);
18776
+ unit.update.push(createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan));
18823
18777
  }
18824
18778
  function ingestSwitchBlock(unit, switchBlock) {
18825
18779
  var _a2;
@@ -18827,7 +18781,6 @@ function ingestSwitchBlock(unit, switchBlock) {
18827
18781
  return;
18828
18782
  }
18829
18783
  let firstXref = null;
18830
- let firstSlotHandle = null;
18831
18784
  let conditions = [];
18832
18785
  for (const switchCase of switchBlock.cases) {
18833
18786
  const cView = unit.job.allocateView(unit.xref);
@@ -18843,15 +18796,13 @@ function ingestSwitchBlock(unit, switchBlock) {
18843
18796
  unit.create.push(templateOp);
18844
18797
  if (firstXref === null) {
18845
18798
  firstXref = cView.xref;
18846
- firstSlotHandle = templateOp.handle;
18847
18799
  }
18848
18800
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
18849
18801
  const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle);
18850
18802
  conditions.push(conditionalCaseExpr);
18851
18803
  ingestNodes(cView, switchCase.children);
18852
18804
  }
18853
- const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
18854
- unit.update.push(conditional2);
18805
+ unit.update.push(createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan));
18855
18806
  }
18856
18807
  function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
18857
18808
  if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
@@ -19546,11 +19497,12 @@ var STYLE_PREFIX = "style";
19546
19497
  var TEMPLATE_ATTR_PREFIX = "*";
19547
19498
  var ANIMATE_PROP_PREFIX = "animate-";
19548
19499
  var BindingParser = class {
19549
- constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors) {
19500
+ constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors, _allowInvalidAssignmentEvents = false) {
19550
19501
  this._exprParser = _exprParser;
19551
19502
  this._interpolationConfig = _interpolationConfig;
19552
19503
  this._schemaRegistry = _schemaRegistry;
19553
19504
  this.errors = errors;
19505
+ this._allowInvalidAssignmentEvents = _allowInvalidAssignmentEvents;
19554
19506
  }
19555
19507
  get interpolationConfig() {
19556
19508
  return this._interpolationConfig;
@@ -19854,6 +19806,9 @@ var BindingParser = class {
19854
19806
  if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
19855
19807
  return true;
19856
19808
  }
19809
+ if (!this._allowInvalidAssignmentEvents) {
19810
+ return false;
19811
+ }
19857
19812
  if (ast instanceof Binary) {
19858
19813
  return (ast.operation === "&&" || ast.operation === "||" || ast.operation === "??") && (ast.right instanceof PropertyRead || ast.right instanceof KeyedRead);
19859
19814
  }
@@ -21099,8 +21054,8 @@ function textContents(node) {
21099
21054
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
21100
21055
  function parseTemplate(template2, templateUrl, options = {}) {
21101
21056
  var _a2;
21102
- const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
21103
- const bindingParser = makeBindingParser(interpolationConfig);
21057
+ const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat, allowInvalidAssignmentEvents } = options;
21058
+ const bindingParser = makeBindingParser(interpolationConfig, allowInvalidAssignmentEvents);
21104
21059
  const htmlParser = new HtmlParser();
21105
21060
  const parseResult = htmlParser.parse(template2, templateUrl, __spreadProps(__spreadValues({
21106
21061
  leadingTriviaChars: LEADING_TRIVIA_CHARS
@@ -21165,8 +21120,8 @@ function parseTemplate(template2, templateUrl, options = {}) {
21165
21120
  return parsedTemplate;
21166
21121
  }
21167
21122
  var elementRegistry = new DomElementSchemaRegistry();
21168
- function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
21169
- return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []);
21123
+ function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, allowInvalidAssignmentEvents = false) {
21124
+ return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, [], allowInvalidAssignmentEvents);
21170
21125
  }
21171
21126
 
21172
21127
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
@@ -22730,7 +22685,7 @@ function publishFacade(global) {
22730
22685
  }
22731
22686
 
22732
22687
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22733
- var VERSION2 = new Version("18.0.0-next.4");
22688
+ var VERSION2 = new Version("18.0.0-next.5");
22734
22689
 
22735
22690
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22736
22691
  var _VisitorMode;
@@ -22782,7 +22737,7 @@ function migrateTemplate(template2) {
22782
22737
  }
22783
22738
  let rootNodes = null;
22784
22739
  try {
22785
- const parsed = parseTemplate(template2, "");
22740
+ const parsed = parseTemplate(template2, "", { allowInvalidAssignmentEvents: true });
22786
22741
  if (parsed.errors === null) {
22787
22742
  rootNodes = parsed.nodes;
22788
22743
  }
@@ -22821,9 +22776,9 @@ function migrateTwoWayEvent(value, binding, printer) {
22821
22776
  return null;
22822
22777
  }
22823
22778
  let migrated = null;
22824
- if (import_typescript4.default.isBinaryExpression(expression) && isReadExpression2(expression.right)) {
22779
+ if (import_typescript4.default.isBinaryExpression(expression) && isReadExpression(expression.right)) {
22825
22780
  migrated = import_typescript4.default.factory.updateBinaryExpression(expression, expression.left, expression.operatorToken, wrapInEventAssignment(expression.right));
22826
- } else if (import_typescript4.default.isConditionalExpression(expression) && isReadExpression2(expression.whenFalse)) {
22781
+ } else if (import_typescript4.default.isConditionalExpression(expression) && isReadExpression(expression.whenFalse)) {
22827
22782
  migrated = import_typescript4.default.factory.updateConditionalExpression(expression, expression.condition, expression.questionToken, expression.whenTrue, expression.colonToken, wrapInEventAssignment(expression.whenFalse));
22828
22783
  } else if (isPrefixNot(expression)) {
22829
22784
  let innerExpression = expression.operand;
@@ -22831,7 +22786,7 @@ function migrateTwoWayEvent(value, binding, printer) {
22831
22786
  if (isPrefixNot(innerExpression)) {
22832
22787
  innerExpression = innerExpression.operand;
22833
22788
  } else {
22834
- if (isReadExpression2(innerExpression)) {
22789
+ if (isReadExpression(innerExpression)) {
22835
22790
  migrated = wrapInEventAssignment(innerExpression);
22836
22791
  }
22837
22792
  break;
@@ -22847,7 +22802,7 @@ function migrateTwoWayEvent(value, binding, printer) {
22847
22802
  function wrapInEventAssignment(node) {
22848
22803
  return import_typescript4.default.factory.createBinaryExpression(node, import_typescript4.default.factory.createToken(import_typescript4.default.SyntaxKind.EqualsToken), import_typescript4.default.factory.createIdentifier("$event"));
22849
22804
  }
22850
- function isReadExpression2(node) {
22805
+ function isReadExpression(node) {
22851
22806
  return import_typescript4.default.isIdentifier(node) || import_typescript4.default.isPropertyAccessExpression(node) || import_typescript4.default.isElementAccessExpression(node);
22852
22807
  }
22853
22808
  function isPrefixNot(node) {