@angular/core 17.3.0-next.1 → 17.3.0

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 (79) hide show
  1. package/esm2022/rxjs-interop/src/index.mjs +3 -1
  2. package/esm2022/rxjs-interop/src/output_from_observable.mjs +68 -0
  3. package/esm2022/rxjs-interop/src/output_to_observable.mjs +29 -0
  4. package/esm2022/rxjs-interop/src/to_observable.mjs +1 -1
  5. package/esm2022/src/application/application_ref.mjs +56 -40
  6. package/esm2022/src/authoring/input/input.mjs +4 -1
  7. package/esm2022/src/authoring/input/input_type_checking.mjs +1 -1
  8. package/esm2022/src/authoring/model/model.mjs +4 -1
  9. package/esm2022/src/authoring/model/model_signal.mjs +9 -18
  10. package/esm2022/src/authoring/output/output.mjs +35 -0
  11. package/esm2022/src/authoring/output/output_emitter_ref.mjs +85 -0
  12. package/esm2022/src/authoring/output/output_ref.mjs +9 -0
  13. package/esm2022/src/authoring/queries.mjs +7 -1
  14. package/esm2022/src/authoring.mjs +3 -2
  15. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +1 -1
  16. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +10 -4
  17. package/esm2022/src/core_private_export.mjs +4 -4
  18. package/esm2022/src/di/contextual.mjs +9 -3
  19. package/esm2022/src/di/interface/provider.mjs +1 -1
  20. package/esm2022/src/di/metadata.mjs +1 -1
  21. package/esm2022/src/di/r3_injector.mjs +26 -15
  22. package/esm2022/src/errors.mjs +1 -1
  23. package/esm2022/src/event_emitter.mjs +18 -2
  24. package/esm2022/src/hydration/annotate.mjs +4 -2
  25. package/esm2022/src/hydration/api.mjs +28 -3
  26. package/esm2022/src/hydration/cleanup.mjs +18 -2
  27. package/esm2022/src/hydration/interfaces.mjs +1 -1
  28. package/esm2022/src/hydration/node_lookup_utils.mjs +59 -39
  29. package/esm2022/src/hydration/tokens.mjs +6 -1
  30. package/esm2022/src/i18n/utils.mjs +16 -0
  31. package/esm2022/src/render3/after_render_hooks.mjs +12 -9
  32. package/esm2022/src/render3/component_ref.mjs +103 -93
  33. package/esm2022/src/render3/i18n/i18n_apply.mjs +32 -7
  34. package/esm2022/src/render3/i18n/i18n_parse.mjs +50 -16
  35. package/esm2022/src/render3/instructions/control_flow.mjs +4 -2
  36. package/esm2022/src/render3/instructions/element.mjs +5 -3
  37. package/esm2022/src/render3/instructions/element_container.mjs +3 -2
  38. package/esm2022/src/render3/instructions/listener.mjs +7 -9
  39. package/esm2022/src/render3/instructions/render.mjs +3 -2
  40. package/esm2022/src/render3/instructions/template.mjs +4 -2
  41. package/esm2022/src/render3/instructions/text.mjs +4 -2
  42. package/esm2022/src/render3/interfaces/i18n.mjs +1 -1
  43. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  44. package/esm2022/src/render3/node_manipulation.mjs +18 -5
  45. package/esm2022/src/render3/node_selector_matcher.mjs +37 -51
  46. package/esm2022/src/render3/queue_state_update.mjs +2 -4
  47. package/esm2022/src/render3/reactivity/effect.mjs +11 -7
  48. package/esm2022/src/render3/reactivity/signal.mjs +3 -4
  49. package/esm2022/src/render3/util/view_utils.mjs +2 -1
  50. package/esm2022/src/render3/view_manipulation.mjs +24 -17
  51. package/esm2022/src/sanitization/html_sanitizer.mjs +54 -14
  52. package/esm2022/src/util/assert.mjs +7 -1
  53. package/esm2022/src/version.mjs +1 -1
  54. package/esm2022/testing/src/component_fixture.mjs +15 -11
  55. package/esm2022/testing/src/logger.mjs +3 -3
  56. package/esm2022/testing/src/test_bed_compiler.mjs +26 -4
  57. package/fesm2022/core.mjs +14049 -13736
  58. package/fesm2022/core.mjs.map +1 -1
  59. package/fesm2022/primitives/signals.mjs +1 -1
  60. package/fesm2022/rxjs-interop.mjs +82 -3
  61. package/fesm2022/rxjs-interop.mjs.map +1 -1
  62. package/fesm2022/testing.mjs +38 -12
  63. package/fesm2022/testing.mjs.map +1 -1
  64. package/index.d.ts +210 -78
  65. package/package.json +1 -1
  66. package/primitives/signals/index.d.ts +1 -1
  67. package/rxjs-interop/index.d.ts +39 -1
  68. package/schematics/migrations/block-template-entities/bundle.js +25 -34
  69. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  70. package/schematics/migrations/invalid-two-way-bindings/bundle.js +26387 -0
  71. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +7 -0
  72. package/schematics/migrations.json +5 -0
  73. package/schematics/ng-generate/control-flow-migration/bundle.js +25 -34
  74. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  75. package/schematics/ng-generate/standalone-migration/bundle.js +424 -351
  76. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  77. package/testing/index.d.ts +1 -1
  78. package/esm2022/src/authoring/output.mjs +0 -33
  79. package/esm2022/src/is_internal.mjs +0 -15
@@ -14,6 +14,11 @@
14
14
  "version": "17.0.0",
15
15
  "description": "Updates `TransferState`, `makeStateKey`, `StateKey` imports from `@angular/platform-browser` to `@angular/core`.",
16
16
  "factory": "./migrations/transfer-state/bundle"
17
+ },
18
+ "invalid-two-way-bindings": {
19
+ "version": "17.3.0",
20
+ "description": "Updates two-way bindings that have an invalid expression to use the longform expression instead.",
21
+ "factory": "./migrations/invalid-two-way-bindings/bundle"
17
22
  }
18
23
  }
19
24
  }
@@ -7158,13 +7158,10 @@ var ExpressionKind;
7158
7158
  ExpressionKind2[ExpressionKind2["EmptyExpr"] = 17] = "EmptyExpr";
7159
7159
  ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
7160
7160
  ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
7161
- ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
7162
- ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
7163
- ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
7164
- ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
7165
- ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
7166
- ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
7167
- ExpressionKind2[ExpressionKind2["TwoWayBindingSet"] = 26] = "TwoWayBindingSet";
7161
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 20] = "SlotLiteralExpr";
7162
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 21] = "ConditionalCase";
7163
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 22] = "ConstCollected";
7164
+ ExpressionKind2[ExpressionKind2["TwoWayBindingSet"] = 23] = "TwoWayBindingSet";
7168
7165
  })(ExpressionKind || (ExpressionKind = {}));
7169
7166
  var VariableFlags;
7170
7167
  (function(VariableFlags2) {
@@ -7183,12 +7180,6 @@ var CompatibilityMode;
7183
7180
  CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
7184
7181
  CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
7185
7182
  })(CompatibilityMode || (CompatibilityMode = {}));
7186
- var DeferSecondaryKind;
7187
- (function(DeferSecondaryKind2) {
7188
- DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
7189
- DeferSecondaryKind2[DeferSecondaryKind2["Placeholder"] = 1] = "Placeholder";
7190
- DeferSecondaryKind2[DeferSecondaryKind2["Error"] = 2] = "Error";
7191
- })(DeferSecondaryKind || (DeferSecondaryKind = {}));
7192
7183
  var BindingKind;
7193
7184
  (function(BindingKind2) {
7194
7185
  BindingKind2[BindingKind2["Attribute"] = 0] = "Attribute";
@@ -7262,10 +7253,6 @@ var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
7262
7253
  var TRAIT_CONSUMES_VARS = {
7263
7254
  [ConsumesVarsTrait]: true
7264
7255
  };
7265
- var TRAIT_USES_VAR_OFFSET = {
7266
- [UsesVarOffset]: true,
7267
- varOffset: null
7268
- };
7269
7256
  function hasConsumesSlotTrait(op) {
7270
7257
  return op[ConsumesSlot] === true;
7271
7258
  }
@@ -9530,7 +9517,7 @@ var ElementAttributes = class {
9530
9517
  this.propertyBindings = null;
9531
9518
  this.projectAs = null;
9532
9519
  }
9533
- isKnown(kind, name, value) {
9520
+ isKnown(kind, name) {
9534
9521
  var _a2;
9535
9522
  const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
9536
9523
  this.known.set(kind, nameToValue);
@@ -9543,7 +9530,7 @@ var ElementAttributes = class {
9543
9530
  add(kind, name, value, namespace, trustedValueFn) {
9544
9531
  var _a2;
9545
9532
  const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
9546
- if (!allowDuplicates && this.isKnown(kind, name, value)) {
9533
+ if (!allowDuplicates && this.isKnown(kind, name)) {
9547
9534
  return;
9548
9535
  }
9549
9536
  if (name === "ngProjectAs") {
@@ -10143,7 +10130,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
10143
10130
  }
10144
10131
  function formatIcuPlaceholder(op) {
10145
10132
  if (op.strings.length !== op.expressionPlaceholders.length + 1) {
10146
- throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
10133
+ throw Error(`AssertionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
10147
10134
  }
10148
10135
  const values = op.expressionPlaceholders.map(formatValue);
10149
10136
  return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
@@ -16789,7 +16776,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
16789
16776
  }
16790
16777
  if (op.emptyView !== null) {
16791
16778
  const emptyView = unit.job.views.get(op.emptyView);
16792
- addNamesToView(emptyView, `${baseName}_${`${op.functionNameSuffix}Empty`}_${op.handle.slot + 2}`, state, compatibility);
16779
+ addNamesToView(emptyView, `${baseName}_${op.functionNameSuffix}Empty_${op.handle.slot + 2}`, state, compatibility);
16793
16780
  }
16794
16781
  addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
16795
16782
  break;
@@ -17210,7 +17197,7 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
17210
17197
  break;
17211
17198
  case OpKind.RepeaterCreate:
17212
17199
  const forView = unit.job.views.get(op.xref);
17213
- subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
17200
+ subTemplateIndex = propagateI18nBlocksForView(forView, i18nBlock, op.i18nPlaceholder, subTemplateIndex);
17214
17201
  if (op.emptyView !== null) {
17215
17202
  subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
17216
17203
  }
@@ -18310,11 +18297,11 @@ function processLexicalScope(view, ops) {
18310
18297
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
18311
18298
  function resolveDollarEvent(job) {
18312
18299
  for (const unit of job.units) {
18313
- transformDollarEvent(unit, unit.create);
18314
- transformDollarEvent(unit, unit.update);
18300
+ transformDollarEvent(unit.create);
18301
+ transformDollarEvent(unit.update);
18315
18302
  }
18316
18303
  }
18317
- function transformDollarEvent(unit, ops) {
18304
+ function transformDollarEvent(ops) {
18318
18305
  for (const op of ops) {
18319
18306
  if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener) {
18320
18307
  transformExpressionsInOp(op, (expr) => {
@@ -18485,7 +18472,7 @@ function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18n
18485
18472
  addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
18486
18473
  }
18487
18474
  function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
18488
- const { startName, closeName } = i18nPlaceholder;
18475
+ const { closeName } = i18nPlaceholder;
18489
18476
  const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
18490
18477
  if (closeName) {
18491
18478
  addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
@@ -18512,14 +18499,14 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
18512
18499
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
18513
18500
  function resolveI18nExpressionPlaceholders(job) {
18514
18501
  var _a2;
18515
- const subTemplateIndicies = /* @__PURE__ */ new Map();
18502
+ const subTemplateIndices = /* @__PURE__ */ new Map();
18516
18503
  const i18nContexts = /* @__PURE__ */ new Map();
18517
18504
  const icuPlaceholders = /* @__PURE__ */ new Map();
18518
18505
  for (const unit of job.units) {
18519
18506
  for (const op of unit.create) {
18520
18507
  switch (op.kind) {
18521
18508
  case OpKind.I18nStart:
18522
- subTemplateIndicies.set(op.xref, op.subTemplateIndex);
18509
+ subTemplateIndices.set(op.xref, op.subTemplateIndex);
18523
18510
  break;
18524
18511
  case OpKind.I18nContext:
18525
18512
  i18nContexts.set(op.xref, op);
@@ -18536,7 +18523,7 @@ function resolveI18nExpressionPlaceholders(job) {
18536
18523
  for (const op of unit.update) {
18537
18524
  if (op.kind === OpKind.I18nExpression) {
18538
18525
  const index = expressionIndices.get(referenceIndex(op)) || 0;
18539
- const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
18526
+ const subTemplateIndex = (_a2 = subTemplateIndices.get(op.i18nOwner)) != null ? _a2 : null;
18540
18527
  const value = {
18541
18528
  value: index,
18542
18529
  subTemplateIndex,
@@ -18600,7 +18587,7 @@ function processLexicalScope2(unit, ops, savedView) {
18600
18587
  if (op.kind == OpKind.Listener || op.kind === OpKind.TwoWayListener) {
18601
18588
  continue;
18602
18589
  }
18603
- transformExpressionsInOp(op, (expr, flags) => {
18590
+ transformExpressionsInOp(op, (expr) => {
18604
18591
  if (expr instanceof LexicalReadExpr) {
18605
18592
  if (scope.has(expr.name)) {
18606
18593
  return new ReadVariableExpr(scope.get(expr.name));
@@ -18713,10 +18700,13 @@ function transformTwoWayBindingSet(job) {
18713
18700
  }
18714
18701
  }
18715
18702
  function wrapSetOperation(target, value) {
18703
+ if (target instanceof ReadVariableExpr) {
18704
+ return twoWayBindingSet(target, value);
18705
+ }
18716
18706
  return twoWayBindingSet(target, value).or(target.set(value));
18717
18707
  }
18718
18708
  function isReadExpression2(value) {
18719
- return value instanceof ReadPropExpr || value instanceof ReadKeyExpr;
18709
+ return value instanceof ReadPropExpr || value instanceof ReadKeyExpr || value instanceof ReadVariableExpr;
18720
18710
  }
18721
18711
  function wrapAction(target, value) {
18722
18712
  if (isReadExpression2(target)) {
@@ -19202,7 +19192,6 @@ function optimizeVariablesInOpList(ops, compatibility) {
19202
19192
  const toInline = [];
19203
19193
  for (const [id, count] of varUsages) {
19204
19194
  const decl = varDecls.get(id);
19205
- const varInfo = opMap.get(decl);
19206
19195
  const isAlwaysInline = !!(decl.flags & VariableFlags.AlwaysInline);
19207
19196
  if (count !== 1 || isAlwaysInline) {
19208
19197
  continue;
@@ -19905,7 +19894,6 @@ function ingestIcu(unit, icu) {
19905
19894
  var _a2;
19906
19895
  if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
19907
19896
  const xref = unit.job.allocateXrefId();
19908
- const icuNode = icu.i18n.nodes[0];
19909
19897
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19910
19898
  for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
19911
19899
  if (text2 instanceof BoundText) {
@@ -20920,6 +20908,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
20920
20908
  errors.push(new ParseError(param.sourceSpan, '@for loop can only have one "track" expression'));
20921
20909
  } else {
20922
20910
  const expression = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
20911
+ if (expression.ast instanceof EmptyExpr) {
20912
+ errors.push(new ParseError(param.sourceSpan, '@for loop must have a "track" expression'));
20913
+ }
20923
20914
  const keywordSpan = new ParseSourceSpan(param.sourceSpan.start, param.sourceSpan.start.moveBy("track".length));
20924
20915
  result.trackBy = { expression, keywordSpan };
20925
20916
  }
@@ -26001,7 +25992,7 @@ function publishFacade(global) {
26001
25992
  }
26002
25993
 
26003
25994
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
26004
- var VERSION2 = new Version("17.3.0-next.1");
25995
+ var VERSION2 = new Version("17.3.0");
26005
25996
 
26006
25997
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
26007
25998
  var _VisitorMode;