@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
@@ -6211,11 +6211,10 @@ function createAdvanceOp(delta, sourceSpan) {
6211
6211
  sourceSpan
6212
6212
  }, NEW_OP);
6213
6213
  }
6214
- function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
6214
+ function createConditionalOp(target, test, conditions, sourceSpan) {
6215
6215
  return __spreadValues(__spreadValues(__spreadValues({
6216
6216
  kind: OpKind.Conditional,
6217
6217
  target,
6218
- targetSlot,
6219
6218
  test,
6220
6219
  conditions,
6221
6220
  processed: null,
@@ -16478,19 +16477,7 @@ function pipeBindV(slot, varOffset, args) {
16478
16477
  ]);
16479
16478
  }
16480
16479
  function textInterpolate(strings, expressions, sourceSpan) {
16481
- if (strings.length < 1 || expressions.length !== strings.length - 1) {
16482
- throw new Error(`AssertionError: expected specific shape of args for strings/expressions in interpolation`);
16483
- }
16484
- const interpolationArgs = [];
16485
- if (expressions.length === 1 && strings[0] === "" && strings[1] === "") {
16486
- interpolationArgs.push(expressions[0]);
16487
- } else {
16488
- let idx;
16489
- for (idx = 0; idx < expressions.length; idx++) {
16490
- interpolationArgs.push(literal(strings[idx]), expressions[idx]);
16491
- }
16492
- interpolationArgs.push(literal(strings[idx]));
16493
- }
16480
+ const interpolationArgs = collateInterpolationArgs(strings, expressions);
16494
16481
  return callVariadicInstruction(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
16495
16482
  }
16496
16483
  function i18nExp(expr, sourceSpan) {
@@ -16567,8 +16554,8 @@ function call(instruction, args, sourceSpan) {
16567
16554
  const expr = importExpr(instruction).callFn(args, sourceSpan);
16568
16555
  return createStatementOp(new ExpressionStatement(expr, sourceSpan));
16569
16556
  }
16570
- function conditional(slot, condition, contextValue, sourceSpan) {
16571
- const args = [literal(slot), condition];
16557
+ function conditional(condition, contextValue, sourceSpan) {
16558
+ const args = [condition];
16572
16559
  if (contextValue !== null) {
16573
16560
  args.push(contextValue);
16574
16561
  }
@@ -16994,10 +16981,7 @@ function reifyUpdateOperations(_unit, ops) {
16994
16981
  if (op.processed === null) {
16995
16982
  throw new Error(`Conditional test was not set.`);
16996
16983
  }
16997
- if (op.targetSlot.slot === null) {
16998
- throw new Error(`Conditional slot was not set.`);
16999
- }
17000
- OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
16984
+ OpList.replace(op, conditional(op.processed, op.contextValue, op.sourceSpan));
17001
16985
  break;
17002
16986
  case OpKind.Repeater:
17003
16987
  OpList.replace(op, repeater(op.collection, op.sourceSpan));
@@ -17579,49 +17563,22 @@ function transformTwoWayBindingSet(job) {
17579
17563
  for (const op of unit.create) {
17580
17564
  if (op.kind === OpKind.TwoWayListener) {
17581
17565
  transformExpressionsInOp(op, (expr) => {
17582
- if (expr instanceof TwoWayBindingSetExpr) {
17583
- return wrapAction(expr.target, expr.value);
17566
+ if (!(expr instanceof TwoWayBindingSetExpr)) {
17567
+ return expr;
17584
17568
  }
17585
- return expr;
17569
+ const { target, value } = expr;
17570
+ if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
17571
+ return twoWayBindingSet(target, value).or(target.set(value));
17572
+ }
17573
+ if (target instanceof ReadVariableExpr) {
17574
+ return twoWayBindingSet(target, value);
17575
+ }
17576
+ throw new Error(`Unsupported expression in two-way action binding.`);
17586
17577
  }, VisitorContextFlag.InChildOperation);
17587
17578
  }
17588
17579
  }
17589
17580
  }
17590
17581
  }
17591
- function wrapSetOperation(target, value) {
17592
- if (target instanceof ReadVariableExpr) {
17593
- return twoWayBindingSet(target, value);
17594
- }
17595
- return twoWayBindingSet(target, value).or(target.set(value));
17596
- }
17597
- function isReadExpression(value) {
17598
- return value instanceof ReadPropExpr || value instanceof ReadKeyExpr || value instanceof ReadVariableExpr;
17599
- }
17600
- function wrapAction(target, value) {
17601
- if (isReadExpression(target)) {
17602
- return wrapSetOperation(target, value);
17603
- }
17604
- if (target instanceof BinaryOperatorExpr && isReadExpression(target.rhs)) {
17605
- return new BinaryOperatorExpr(target.operator, target.lhs, wrapSetOperation(target.rhs, value));
17606
- }
17607
- if (target instanceof ConditionalExpr && isReadExpression(target.falseCase)) {
17608
- return new ConditionalExpr(target.condition, target.trueCase, wrapSetOperation(target.falseCase, value));
17609
- }
17610
- if (target instanceof NotExpr) {
17611
- let expr = target.condition;
17612
- while (true) {
17613
- if (expr instanceof NotExpr) {
17614
- expr = expr.condition;
17615
- } else {
17616
- if (isReadExpression(expr)) {
17617
- return wrapSetOperation(expr, value);
17618
- }
17619
- break;
17620
- }
17621
- }
17622
- }
17623
- throw new Error(`Unsupported expression in two-way action binding.`);
17624
- }
17625
17582
 
17626
17583
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
17627
17584
  function saveAndRestoreView(job) {
@@ -18632,7 +18589,6 @@ function ingestBoundText(unit, text2, icuPlaceholder) {
18632
18589
  function ingestIfBlock(unit, ifBlock) {
18633
18590
  var _a2;
18634
18591
  let firstXref = null;
18635
- let firstSlotHandle = null;
18636
18592
  let conditions = [];
18637
18593
  for (let i = 0; i < ifBlock.branches.length; i++) {
18638
18594
  const ifCase = ifBlock.branches[i];
@@ -18652,15 +18608,13 @@ function ingestIfBlock(unit, ifBlock) {
18652
18608
  unit.create.push(templateOp);
18653
18609
  if (firstXref === null) {
18654
18610
  firstXref = cView.xref;
18655
- firstSlotHandle = templateOp.handle;
18656
18611
  }
18657
18612
  const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
18658
18613
  const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle, ifCase.expressionAlias);
18659
18614
  conditions.push(conditionalCaseExpr);
18660
18615
  ingestNodes(cView, ifCase.children);
18661
18616
  }
18662
- const conditional2 = createConditionalOp(firstXref, firstSlotHandle, null, conditions, ifBlock.sourceSpan);
18663
- unit.update.push(conditional2);
18617
+ unit.update.push(createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan));
18664
18618
  }
18665
18619
  function ingestSwitchBlock(unit, switchBlock) {
18666
18620
  var _a2;
@@ -18668,7 +18622,6 @@ function ingestSwitchBlock(unit, switchBlock) {
18668
18622
  return;
18669
18623
  }
18670
18624
  let firstXref = null;
18671
- let firstSlotHandle = null;
18672
18625
  let conditions = [];
18673
18626
  for (const switchCase of switchBlock.cases) {
18674
18627
  const cView = unit.job.allocateView(unit.xref);
@@ -18684,15 +18637,13 @@ function ingestSwitchBlock(unit, switchBlock) {
18684
18637
  unit.create.push(templateOp);
18685
18638
  if (firstXref === null) {
18686
18639
  firstXref = cView.xref;
18687
- firstSlotHandle = templateOp.handle;
18688
18640
  }
18689
18641
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
18690
18642
  const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle);
18691
18643
  conditions.push(conditionalCaseExpr);
18692
18644
  ingestNodes(cView, switchCase.children);
18693
18645
  }
18694
- const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
18695
- unit.update.push(conditional2);
18646
+ unit.update.push(createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan));
18696
18647
  }
18697
18648
  function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
18698
18649
  if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
@@ -19387,11 +19338,12 @@ var STYLE_PREFIX = "style";
19387
19338
  var TEMPLATE_ATTR_PREFIX = "*";
19388
19339
  var ANIMATE_PROP_PREFIX = "animate-";
19389
19340
  var BindingParser = class {
19390
- constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors) {
19341
+ constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors, _allowInvalidAssignmentEvents = false) {
19391
19342
  this._exprParser = _exprParser;
19392
19343
  this._interpolationConfig = _interpolationConfig;
19393
19344
  this._schemaRegistry = _schemaRegistry;
19394
19345
  this.errors = errors;
19346
+ this._allowInvalidAssignmentEvents = _allowInvalidAssignmentEvents;
19395
19347
  }
19396
19348
  get interpolationConfig() {
19397
19349
  return this._interpolationConfig;
@@ -19695,6 +19647,9 @@ var BindingParser = class {
19695
19647
  if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
19696
19648
  return true;
19697
19649
  }
19650
+ if (!this._allowInvalidAssignmentEvents) {
19651
+ return false;
19652
+ }
19698
19653
  if (ast instanceof Binary) {
19699
19654
  return (ast.operation === "&&" || ast.operation === "||" || ast.operation === "??") && (ast.right instanceof PropertyRead || ast.right instanceof KeyedRead);
19700
19655
  }
@@ -20940,8 +20895,8 @@ function textContents(node) {
20940
20895
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
20941
20896
  function parseTemplate(template2, templateUrl, options = {}) {
20942
20897
  var _a2;
20943
- const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
20944
- const bindingParser = makeBindingParser(interpolationConfig);
20898
+ const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat, allowInvalidAssignmentEvents } = options;
20899
+ const bindingParser = makeBindingParser(interpolationConfig, allowInvalidAssignmentEvents);
20945
20900
  const htmlParser = new HtmlParser();
20946
20901
  const parseResult = htmlParser.parse(template2, templateUrl, __spreadProps(__spreadValues({
20947
20902
  leadingTriviaChars: LEADING_TRIVIA_CHARS
@@ -21006,8 +20961,8 @@ function parseTemplate(template2, templateUrl, options = {}) {
21006
20961
  return parsedTemplate;
21007
20962
  }
21008
20963
  var elementRegistry = new DomElementSchemaRegistry();
21009
- function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
21010
- return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []);
20964
+ function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, allowInvalidAssignmentEvents = false) {
20965
+ return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, [], allowInvalidAssignmentEvents);
21011
20966
  }
21012
20967
 
21013
20968
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
@@ -22571,7 +22526,7 @@ function publishFacade(global) {
22571
22526
  }
22572
22527
 
22573
22528
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22574
- var VERSION2 = new Version("18.0.0-next.4");
22529
+ var VERSION2 = new Version("18.0.0-next.5");
22575
22530
 
22576
22531
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22577
22532
  var _VisitorMode;
@@ -24013,7 +23968,6 @@ function control_flow_migration_default(options) {
24013
23968
  if (!allPaths.length) {
24014
23969
  throw new import_schematics.SchematicsException("Could not find any tsconfig file. Cannot run the control flow migration.");
24015
23970
  }
24016
- context.logger.warn("IMPORTANT! This migration is in developer preview. Use with caution.");
24017
23971
  let errors = [];
24018
23972
  for (const tsconfigPath of allPaths) {
24019
23973
  const migrateErrors = runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, options);