@angular/core 16.0.0-next.7 → 16.0.0-rc.1

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 (54) hide show
  1. package/esm2022/rxjs-interop/src/index.mjs +3 -3
  2. package/esm2022/rxjs-interop/src/to_observable.mjs +39 -0
  3. package/esm2022/rxjs-interop/src/to_signal.mjs +52 -0
  4. package/esm2022/src/application_ref.mjs +3 -3
  5. package/esm2022/src/application_tokens.mjs +12 -2
  6. package/esm2022/src/core_private_export.mjs +3 -2
  7. package/esm2022/src/debug/debug_node.mjs +4 -9
  8. package/esm2022/src/di/interface/defs.mjs +3 -18
  9. package/esm2022/src/di/r3_injector.mjs +2 -1
  10. package/esm2022/src/errors.mjs +1 -1
  11. package/esm2022/src/hydration/annotate.mjs +42 -33
  12. package/esm2022/src/hydration/api.mjs +48 -20
  13. package/esm2022/src/hydration/error_handling.mjs +1 -17
  14. package/esm2022/src/hydration/tokens.mjs +4 -3
  15. package/esm2022/src/initial_render_pending_tasks.mjs +10 -10
  16. package/esm2022/src/render3/assert.mjs +1 -1
  17. package/esm2022/src/render3/component_ref.mjs +3 -3
  18. package/esm2022/src/render3/di.mjs +3 -3
  19. package/esm2022/src/render3/hooks.mjs +3 -3
  20. package/esm2022/src/render3/instructions/element_validation.mjs +4 -5
  21. package/esm2022/src/render3/instructions/i18n.mjs +14 -2
  22. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +1 -1
  23. package/esm2022/src/render3/instructions/shared.mjs +14 -14
  24. package/esm2022/src/render3/interfaces/type_checks.mjs +1 -1
  25. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  26. package/esm2022/src/render3/node_manipulation.mjs +9 -9
  27. package/esm2022/src/render3/reactive_lview_consumer.mjs +2 -2
  28. package/esm2022/src/render3/reactivity/effect.mjs +1 -1
  29. package/esm2022/src/render3/util/discovery_utils.mjs +1 -1
  30. package/esm2022/src/render3/util/view_traversal_utils.mjs +1 -1
  31. package/esm2022/src/render3/util/view_utils.mjs +6 -2
  32. package/esm2022/src/render3/view_ref.mjs +4 -4
  33. package/esm2022/src/signals/src/signal.mjs +8 -1
  34. package/esm2022/src/signals/src/watch.mjs +6 -2
  35. package/esm2022/src/version.mjs +1 -1
  36. package/esm2022/testing/src/logger.mjs +3 -3
  37. package/esm2022/testing/src/ng_zone_mock.mjs +3 -3
  38. package/esm2022/testing/src/styling.mjs +1 -2
  39. package/fesm2022/core.mjs +179 -145
  40. package/fesm2022/core.mjs.map +1 -1
  41. package/fesm2022/rxjs-interop.mjs +764 -56
  42. package/fesm2022/rxjs-interop.mjs.map +1 -1
  43. package/fesm2022/testing.mjs +87 -81
  44. package/fesm2022/testing.mjs.map +1 -1
  45. package/index.d.ts +43 -18
  46. package/package.json +2 -2
  47. package/rxjs-interop/index.d.ts +53 -46
  48. package/schematics/migrations/guard-and-resolve-interfaces/bundle.js +13 -13
  49. package/schematics/migrations/remove-module-id/bundle.js +14 -14
  50. package/schematics/ng-generate/standalone-migration/bundle.js +2938 -1229
  51. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  52. package/testing/index.d.ts +1 -1
  53. package/esm2022/rxjs-interop/src/from_observable.mjs +0 -46
  54. package/esm2022/rxjs-interop/src/from_signal.mjs +0 -36
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.7
2
+ * @license Angular v16.0.0-rc.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -771,30 +771,15 @@ function getOwnDefinition(type, field) {
771
771
  function getInheritedInjectableDef(type) {
772
772
  const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);
773
773
  if (def) {
774
- const typeName = getTypeName(type);
775
774
  ngDevMode &&
776
- console.warn(`DEPRECATED: DI is instantiating a token "${typeName}" that inherits its @Injectable decorator but does not provide one itself.\n` +
777
- `This will become an error in a future version of Angular. Please add @Injectable() to the "${typeName}" class.`);
775
+ console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.\n` +
776
+ `This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`);
778
777
  return def;
779
778
  }
780
779
  else {
781
780
  return null;
782
781
  }
783
782
  }
784
- /** Gets the name of a type, accounting for some cross-browser differences. */
785
- function getTypeName(type) {
786
- // `Function.prototype.name` behaves differently between IE and other browsers. In most browsers
787
- // it'll always return the name of the function itself, no matter how many other functions it
788
- // inherits from. On IE the function doesn't have its own `name` property, but it takes it from
789
- // the lowest level in the prototype chain. E.g. if we have `class Foo extends Parent` most
790
- // browsers will evaluate `Foo.name` to `Foo` while IE will return `Parent`. We work around
791
- // the issue by converting the function to a string and parsing its name out that way via a regex.
792
- if (type.hasOwnProperty('name')) {
793
- return type.name;
794
- }
795
- const match = ('' + type).match(/^function\s*([^\s(]+)/);
796
- return match === null ? '' : match[1];
797
- }
798
783
  /**
799
784
  * Read the injector def type in a way which is immune to accidentally reading inherited value.
800
785
  *
@@ -3319,7 +3304,7 @@ function isComponentDef(def) {
3319
3304
  return !!def.template;
3320
3305
  }
3321
3306
  function isRootView(target) {
3322
- return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
3307
+ return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;
3323
3308
  }
3324
3309
  function isProjectionTNode(tNode) {
3325
3310
  return (tNode.type & 16 /* TNodeType.Projection */) === 16 /* TNodeType.Projection */;
@@ -3894,6 +3879,12 @@ class WritableSignalImpl extends ReactiveNode {
3894
3879
  this.producerMayHaveChanged();
3895
3880
  postSignalSetFn?.();
3896
3881
  }
3882
+ asReadonly() {
3883
+ if (this.readonlySignal === undefined) {
3884
+ this.readonlySignal = createSignalFromFunction(this, () => this.signal());
3885
+ }
3886
+ return this.readonlySignal;
3887
+ }
3897
3888
  signal() {
3898
3889
  this.producerAccessed();
3899
3890
  return this.value;
@@ -3912,6 +3903,7 @@ function signal(initialValue, options) {
3912
3903
  set: signalNode.set.bind(signalNode),
3913
3904
  update: signalNode.update.bind(signalNode),
3914
3905
  mutate: signalNode.mutate.bind(signalNode),
3906
+ asReadonly: signalNode.asReadonly.bind(signalNode)
3915
3907
  });
3916
3908
  return signalFn;
3917
3909
  }
@@ -3954,6 +3946,9 @@ class Watch extends ReactiveNode {
3954
3946
  this.schedule = schedule;
3955
3947
  this.dirty = false;
3956
3948
  this.cleanupFn = NOOP_CLEANUP_FN;
3949
+ this.registerOnCleanup = (cleanupFn) => {
3950
+ this.cleanupFn = cleanupFn;
3951
+ };
3957
3952
  this.consumerAllowSignalWrites = allowSignalWrites;
3958
3953
  }
3959
3954
  notify() {
@@ -3983,7 +3978,8 @@ class Watch extends ReactiveNode {
3983
3978
  this.trackingVersion++;
3984
3979
  try {
3985
3980
  this.cleanupFn();
3986
- this.cleanupFn = this.watch() ?? NOOP_CLEANUP_FN;
3981
+ this.cleanupFn = NOOP_CLEANUP_FN;
3982
+ this.watch(this.registerOnCleanup);
3987
3983
  }
3988
3984
  finally {
3989
3985
  setActiveConsumer(prevConsumer);
@@ -4244,7 +4240,7 @@ function isCreationMode(view) {
4244
4240
  * into a container. For that, you'll want `viewAttachedToContainer` below.
4245
4241
  */
4246
4242
  function viewAttachedToChangeDetector(view) {
4247
- return (view[FLAGS] & 64 /* LViewFlags.Attached */) === 64 /* LViewFlags.Attached */;
4243
+ return (view[FLAGS] & 128 /* LViewFlags.Attached */) === 128 /* LViewFlags.Attached */;
4248
4244
  }
4249
4245
  /** Returns a boolean for whether the view is attached to a container. */
4250
4246
  function viewAttachedToContainer(view) {
@@ -4286,6 +4282,9 @@ function updateTransplantedViewCount(lContainer, amount) {
4286
4282
  * Stores a LView-specific destroy callback.
4287
4283
  */
4288
4284
  function storeLViewOnDestroy(lView, onDestroyCallback) {
4285
+ if ((lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */) {
4286
+ throw new RuntimeError(911 /* RuntimeErrorCode.VIEW_ALREADY_DESTROYED */, ngDevMode && 'View has already been destroyed.');
4287
+ }
4289
4288
  if (lView[ON_DESTROY_HOOKS] === null) {
4290
4289
  lView[ON_DESTROY_HOOKS] = [];
4291
4290
  }
@@ -4984,7 +4983,7 @@ function incrementInitPhaseFlags(lView, initPhase) {
4984
4983
  assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');
4985
4984
  let flags = lView[FLAGS];
4986
4985
  if ((flags & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {
4987
- flags &= 2047 /* LViewFlags.IndexWithinInitPhaseReset */;
4986
+ flags &= 4095 /* LViewFlags.IndexWithinInitPhaseReset */;
4988
4987
  flags += 1 /* LViewFlags.InitPhaseStateIncrementer */;
4989
4988
  lView[FLAGS] = flags;
4990
4989
  }
@@ -5065,12 +5064,12 @@ function callHook(currentView, initPhase, arr, i) {
5065
5064
  const directiveIndex = isInitHook ? -arr[i] : arr[i];
5066
5065
  const directive = currentView[directiveIndex];
5067
5066
  if (isInitHook) {
5068
- const indexWithintInitPhase = currentView[FLAGS] >> 11 /* LViewFlags.IndexWithinInitPhaseShift */;
5067
+ const indexWithintInitPhase = currentView[FLAGS] >> 12 /* LViewFlags.IndexWithinInitPhaseShift */;
5069
5068
  // The init phase state must be always checked here as it may have been recursively updated.
5070
5069
  if (indexWithintInitPhase <
5071
5070
  (currentView[PREORDER_HOOK_FLAGS] >> 16 /* PreOrderHookFlags.NumberOfInitHooksCalledShift */) &&
5072
5071
  (currentView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {
5073
- currentView[FLAGS] += 2048 /* LViewFlags.IndexWithinInitPhaseIncrementer */;
5072
+ currentView[FLAGS] += 4096 /* LViewFlags.IndexWithinInitPhaseIncrementer */;
5074
5073
  callHookInternal(directive, hook);
5075
5074
  }
5076
5075
  }
@@ -5660,7 +5659,7 @@ function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default,
5660
5659
  if (tNode !== null) {
5661
5660
  // If the view or any of its ancestors have an embedded
5662
5661
  // view injector, we have to look it up there first.
5663
- if (lView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */) {
5662
+ if (lView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */) {
5664
5663
  const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND);
5665
5664
  if (embeddedInjectorValue !== NOT_FOUND) {
5666
5665
  return embeddedInjectorValue;
@@ -6003,8 +6002,8 @@ function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundVa
6003
6002
  // hierarchy when resolving the value is to walk it node-by-node while attempting to resolve
6004
6003
  // the token at each level.
6005
6004
  while (currentTNode !== null && currentLView !== null &&
6006
- (currentLView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */) &&
6007
- !(currentLView[FLAGS] & 256 /* LViewFlags.IsRoot */)) {
6005
+ (currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */) &&
6006
+ !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
6008
6007
  ngDevMode && assertTNodeForLView(currentTNode, currentLView);
6009
6008
  // Note that this lookup on the node injector is using the `Self` flag, because
6010
6009
  // we don't want the node injector to look at any parent injectors since we
@@ -6310,8 +6309,8 @@ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives)
6310
6309
  // as a custom element. Note that unknown elements with a dash in their name won't be instances
6311
6310
  // of HTMLUnknownElement in browsers that support web components.
6312
6311
  const isUnknown =
6313
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
6314
- // because while most browsers return 'function', IE returns 'object'.
6312
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because
6313
+ // Domino doesn't expose HTMLUnknownElement globally.
6315
6314
  (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
6316
6315
  element instanceof HTMLUnknownElement) ||
6317
6316
  (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
@@ -6368,8 +6367,7 @@ function isPropertyValid(element, propName, tagName, schemas) {
6368
6367
  if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
6369
6368
  return true;
6370
6369
  }
6371
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
6372
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
6370
+ // Note: `typeof Node` returns 'function' in most browsers, but is undefined with domino.
6373
6371
  return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
6374
6372
  }
6375
6373
  /**
@@ -6967,7 +6965,7 @@ function getLViewParent(lView) {
6967
6965
  function getRootView(componentOrLView) {
6968
6966
  ngDevMode && assertDefined(componentOrLView, 'component');
6969
6967
  let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
6970
- while (lView && !(lView[FLAGS] & 256 /* LViewFlags.IsRoot */)) {
6968
+ while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
6971
6969
  lView = getLViewParent(lView);
6972
6970
  }
6973
6971
  ngDevMode && assertLView(lView);
@@ -7213,7 +7211,7 @@ function insertView(tView, lView, lContainer, index) {
7213
7211
  lQueries.insertView(tView);
7214
7212
  }
7215
7213
  // Sets the attached flag
7216
- lView[FLAGS] |= 64 /* LViewFlags.Attached */;
7214
+ lView[FLAGS] |= 128 /* LViewFlags.Attached */;
7217
7215
  }
7218
7216
  /**
7219
7217
  * Track views created from the declaration container (TemplateRef) and inserted into a
@@ -7253,8 +7251,8 @@ function detachMovedView(declarationContainer, lView) {
7253
7251
  // If the view was marked for refresh but then detached before it was checked (where the flag
7254
7252
  // would be cleared and the counter decremented), we need to decrement the view counter here
7255
7253
  // instead.
7256
- if (lView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
7257
- lView[FLAGS] &= ~512 /* LViewFlags.RefreshTransplantedView */;
7254
+ if (lView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
7255
+ lView[FLAGS] &= ~1024 /* LViewFlags.RefreshTransplantedView */;
7258
7256
  updateTransplantedViewCount(insertionLContainer, -1);
7259
7257
  }
7260
7258
  movedViews.splice(declarationViewIndex, 1);
@@ -7292,7 +7290,7 @@ function detachView(lContainer, removeIndex) {
7292
7290
  viewToDetach[PARENT] = null;
7293
7291
  viewToDetach[NEXT] = null;
7294
7292
  // Unsets the attached flag
7295
- viewToDetach[FLAGS] &= ~64 /* LViewFlags.Attached */;
7293
+ viewToDetach[FLAGS] &= ~128 /* LViewFlags.Attached */;
7296
7294
  }
7297
7295
  return viewToDetach;
7298
7296
  }
@@ -7304,7 +7302,7 @@ function detachView(lContainer, removeIndex) {
7304
7302
  * @param lView The view to be destroyed.
7305
7303
  */
7306
7304
  function destroyLView(tView, lView) {
7307
- if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7305
+ if (!(lView[FLAGS] & 256 /* LViewFlags.Destroyed */)) {
7308
7306
  const renderer = lView[RENDERER];
7309
7307
  lView[REACTIVE_TEMPLATE_CONSUMER]?.destroy();
7310
7308
  lView[REACTIVE_HOST_BINDING_CONSUMER]?.destroy();
@@ -7323,16 +7321,16 @@ function destroyLView(tView, lView) {
7323
7321
  * @param lView The LView to clean up
7324
7322
  */
7325
7323
  function cleanUpView(tView, lView) {
7326
- if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7324
+ if (!(lView[FLAGS] & 256 /* LViewFlags.Destroyed */)) {
7327
7325
  // Usually the Attached flag is removed when the view is detached from its parent, however
7328
7326
  // if it's a root view, the flag won't be unset hence why we're also removing on destroy.
7329
- lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
7327
+ lView[FLAGS] &= ~128 /* LViewFlags.Attached */;
7330
7328
  // Mark the LView as destroyed *before* executing the onDestroy hooks. An onDestroy hook
7331
7329
  // runs arbitrary user code, which could include its own `viewRef.destroy()` (or similar). If
7332
7330
  // We don't flag the view as destroyed before the hooks, this could lead to an infinite loop.
7333
7331
  // This also aligns with the ViewEngine behavior. It also means that the onDestroy hook is
7334
7332
  // really more of an "afterDestroy" hook if you think about it.
7335
- lView[FLAGS] |= 128 /* LViewFlags.Destroyed */;
7333
+ lView[FLAGS] |= 256 /* LViewFlags.Destroyed */;
7336
7334
  executeOnDestroys(tView, lView);
7337
7335
  processCleanups(tView, lView);
7338
7336
  // For component views only, the local renderer is destroyed at clean up time.
@@ -9399,6 +9397,7 @@ class R3Injector extends EnvironmentInjector {
9399
9397
  }
9400
9398
  }
9401
9399
  onDestroy(callback) {
9400
+ this.assertNotDestroyed();
9402
9401
  this._onDestroyHooks.push(callback);
9403
9402
  return () => this.removeOnDestroy(callback);
9404
9403
  }
@@ -9794,9 +9793,19 @@ const CSP_NONCE = new InjectionToken('CSP nonce', {
9794
9793
  // 4. Have the `ComponentFactory` read the attribute and provide it to the injector under the
9795
9794
  // hood - has the same problem as #1 and #2 in that the renderer is used to query for the root
9796
9795
  // node and the nonce value needs to be available when the renderer is created.
9797
- return getDocument().body.querySelector('[ngCspNonce]')?.getAttribute('ngCspNonce') || null;
9796
+ return getDocument().body?.querySelector('[ngCspNonce]')?.getAttribute('ngCspNonce') || null;
9798
9797
  },
9799
9798
  });
9799
+ /**
9800
+ * Internal token to collect all SSR-related features enabled for this application.
9801
+ *
9802
+ * Note: the token is in `core` to let other packages register features (the `core`
9803
+ * package is imported in other packages).
9804
+ */
9805
+ const ENABLED_SSR_FEATURES = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'ENABLED_SSR_FEATURES' : '', {
9806
+ providedIn: 'root',
9807
+ factory: () => new Set(),
9808
+ });
9800
9809
 
9801
9810
  function escapeTransferStateContent(text) {
9802
9811
  const escapedText = {
@@ -10350,7 +10359,7 @@ class Version {
10350
10359
  /**
10351
10360
  * @publicApi
10352
10361
  */
10353
- const VERSION = new Version('16.0.0-next.7');
10362
+ const VERSION = new Version('16.0.0-rc.1');
10354
10363
 
10355
10364
  // This default value is when checking the hierarchy for a token.
10356
10365
  //
@@ -10384,7 +10393,7 @@ const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
10384
10393
  */
10385
10394
  function markViewDirty(lView) {
10386
10395
  while (lView) {
10387
- lView[FLAGS] |= 32 /* LViewFlags.Dirty */;
10396
+ lView[FLAGS] |= 64 /* LViewFlags.Dirty */;
10388
10397
  const parent = getLViewParent(lView);
10389
10398
  // Stop traversing up as soon as you find a root view that wasn't attached to any container
10390
10399
  if (isRootView(lView) && !parent) {
@@ -10500,9 +10509,10 @@ function isInSkipHydrationBlock(tNode) {
10500
10509
 
10501
10510
  const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
10502
10511
  /**
10503
- * Internal token that specifies whether hydration is enabled.
10512
+ * Internal token that specifies whether DOM reuse logic
10513
+ * during hydration is enabled.
10504
10514
  */
10505
- const IS_HYDRATION_FEATURE_ENABLED = new InjectionToken(NG_DEV_MODE$1 ? 'IS_HYDRATION_FEATURE_ENABLED' : '');
10515
+ const IS_HYDRATION_DOM_REUSE_ENABLED = new InjectionToken(NG_DEV_MODE$1 ? 'IS_HYDRATION_DOM_REUSE_ENABLED' : '');
10506
10516
  // By default (in client rendering mode), we remove all the contents
10507
10517
  // of the host element and render an application after that.
10508
10518
  const PRESERVE_HOST_CONTENT_DEFAULT = false;
@@ -11088,10 +11098,10 @@ function renderChildComponents(hostLView, components) {
11088
11098
  function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
11089
11099
  const lView = tView.blueprint.slice();
11090
11100
  lView[HOST] = host;
11091
- lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
11101
+ lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 128 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
11092
11102
  if (embeddedViewInjector !== null ||
11093
- (parentLView && (parentLView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */))) {
11094
- lView[FLAGS] |= 1024 /* LViewFlags.HasEmbeddedViewInjector */;
11103
+ (parentLView && (parentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */))) {
11104
+ lView[FLAGS] |= 2048 /* LViewFlags.HasEmbeddedViewInjector */;
11095
11105
  }
11096
11106
  resetPreOrderHookFlags(lView);
11097
11107
  ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
@@ -11277,7 +11287,7 @@ function renderView(tView, lView, context) {
11277
11287
  function refreshView(tView, lView, templateFn, context) {
11278
11288
  ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
11279
11289
  const flags = lView[FLAGS];
11280
- if ((flags & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */)
11290
+ if ((flags & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */)
11281
11291
  return;
11282
11292
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
11283
11293
  // since they were assigned. We do not want to execute lifecycle hooks in that mode.
@@ -11380,10 +11390,10 @@ function refreshView(tView, lView, templateFn, context) {
11380
11390
  // no changes cycle, the component would be not be dirty for the next update pass. This would
11381
11391
  // be different in production mode where the component dirty state is not reset.
11382
11392
  if (!isInCheckNoChangesPass) {
11383
- lView[FLAGS] &= ~(32 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
11393
+ lView[FLAGS] &= ~(64 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
11384
11394
  }
11385
- if (lView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
11386
- lView[FLAGS] &= ~512 /* LViewFlags.RefreshTransplantedView */;
11395
+ if (lView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
11396
+ lView[FLAGS] &= ~1024 /* LViewFlags.RefreshTransplantedView */;
11387
11397
  updateTransplantedViewCount(lView[PARENT], -1);
11388
11398
  }
11389
11399
  }
@@ -11835,7 +11845,7 @@ function markDirtyIfOnPush(lView, viewIndex) {
11835
11845
  ngDevMode && assertLView(lView);
11836
11846
  const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
11837
11847
  if (!(childComponentLView[FLAGS] & 16 /* LViewFlags.CheckAlways */)) {
11838
- childComponentLView[FLAGS] |= 32 /* LViewFlags.Dirty */;
11848
+ childComponentLView[FLAGS] |= 64 /* LViewFlags.Dirty */;
11839
11849
  }
11840
11850
  }
11841
11851
  function setNgReflectProperty(lView, element, type, attrName, value) {
@@ -12208,7 +12218,7 @@ function addComponentLogic(lView, hostTNode, def) {
12208
12218
  // Only component views should be added to the view tree directly. Embedded views are
12209
12219
  // accessed through their containers because they may be removed / re-added later.
12210
12220
  const rendererFactory = lView[ENVIRONMENT].rendererFactory;
12211
- const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
12221
+ const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 64 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
12212
12222
  // Component view will always be created before any injected LContainers,
12213
12223
  // so this is a regular element, wrap it with the component view
12214
12224
  lView[hostTNode.index] = componentView;
@@ -12381,14 +12391,14 @@ function markTransplantedViewsForRefresh(lView) {
12381
12391
  ngDevMode && assertLContainer(insertionLContainer);
12382
12392
  // We don't want to increment the counter if the moved LView was already marked for
12383
12393
  // refresh.
12384
- if ((movedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) === 0) {
12394
+ if ((movedLView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) === 0) {
12385
12395
  updateTransplantedViewCount(insertionLContainer, 1);
12386
12396
  }
12387
12397
  // Note, it is possible that the `movedViews` is tracking views that are transplanted *and*
12388
12398
  // those that aren't (declaration component === insertion component). In the latter case,
12389
12399
  // it's fine to add the flag, as we will clear it immediately in
12390
12400
  // `refreshEmbeddedViews` for the view currently being refreshed.
12391
- movedLView[FLAGS] |= 512 /* LViewFlags.RefreshTransplantedView */;
12401
+ movedLView[FLAGS] |= 1024 /* LViewFlags.RefreshTransplantedView */;
12392
12402
  }
12393
12403
  }
12394
12404
  }
@@ -12404,7 +12414,7 @@ function refreshComponent(hostLView, componentHostIdx) {
12404
12414
  // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
12405
12415
  if (viewAttachedToChangeDetector(componentView)) {
12406
12416
  const tView = componentView[TVIEW];
12407
- if (componentView[FLAGS] & (16 /* LViewFlags.CheckAlways */ | 32 /* LViewFlags.Dirty */)) {
12417
+ if (componentView[FLAGS] & (16 /* LViewFlags.CheckAlways */ | 64 /* LViewFlags.Dirty */)) {
12408
12418
  refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
12409
12419
  }
12410
12420
  else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
@@ -12424,7 +12434,7 @@ function refreshContainsDirtyView(lView) {
12424
12434
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
12425
12435
  const embeddedLView = lContainer[i];
12426
12436
  if (viewAttachedToChangeDetector(embeddedLView)) {
12427
- if (embeddedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
12437
+ if (embeddedLView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
12428
12438
  const embeddedTView = embeddedLView[TVIEW];
12429
12439
  ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
12430
12440
  refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
@@ -12885,7 +12895,7 @@ class ViewRef {
12885
12895
  this._lView[CONTEXT] = value;
12886
12896
  }
12887
12897
  get destroyed() {
12888
- return (this._lView[FLAGS] & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */;
12898
+ return (this._lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;
12889
12899
  }
12890
12900
  destroy() {
12891
12901
  if (this._appRef) {
@@ -12998,7 +13008,7 @@ class ViewRef {
12998
13008
  * ```
12999
13009
  */
13000
13010
  detach() {
13001
- this._lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
13011
+ this._lView[FLAGS] &= ~128 /* LViewFlags.Attached */;
13002
13012
  }
13003
13013
  /**
13004
13014
  * Re-attaches a view to the change detection tree.
@@ -13057,7 +13067,7 @@ class ViewRef {
13057
13067
  * ```
13058
13068
  */
13059
13069
  reattach() {
13060
- this._lView[FLAGS] |= 64 /* LViewFlags.Attached */;
13070
+ this._lView[FLAGS] |= 128 /* LViewFlags.Attached */;
13061
13071
  }
13062
13072
  /**
13063
13073
  * Checks the view and its children.
@@ -13243,8 +13253,8 @@ class ComponentFactory extends ComponentFactory$1 {
13243
13253
  const hostRNode = rootSelectorOrNode ?
13244
13254
  locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector) :
13245
13255
  createElementNode(hostRenderer, elementName, getNamespace(elementName));
13246
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13247
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13256
+ const rootFlags = this.componentDef.onPush ? 64 /* LViewFlags.Dirty */ | 512 /* LViewFlags.IsRoot */ :
13257
+ 16 /* LViewFlags.CheckAlways */ | 512 /* LViewFlags.IsRoot */;
13248
13258
  // Create the root view. Uses empty TView and ContentTemplate.
13249
13259
  const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
13250
13260
  const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, null);
@@ -13387,7 +13397,7 @@ function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirecti
13387
13397
  hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR$1]);
13388
13398
  }
13389
13399
  const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
13390
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
13400
+ const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 64 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
13391
13401
  if (tView.firstCreatePass) {
13392
13402
  markAsComponentHost(tView, tNode, rootDirectives.length - 1);
13393
13403
  }
@@ -14677,22 +14687,6 @@ function invalidSkipHydrationHost(rNode) {
14677
14687
  const message = header + actual + footer;
14678
14688
  return new RuntimeError(-504 /* RuntimeErrorCode.INVALID_SKIP_HYDRATION_HOST */, message);
14679
14689
  }
14680
- /**
14681
- * Builds the hydration error message in the case that a user is attempting to enable
14682
- * hydration on internationalized nodes, which is not yet supported.
14683
- *
14684
- * @param rNode the HTML Element
14685
- * @returns an error
14686
- */
14687
- function notYetSupportedI18nBlockError(rNode) {
14688
- const header = 'Hydration for nodes marked with `i18n` is not yet supported. ' +
14689
- 'You can opt-out a component that uses `i18n` in a template using ' +
14690
- 'the `ngSkipHydration` attribute or fall back to the previous ' +
14691
- 'hydration logic (which re-creates the application structure).\n\n';
14692
- const actual = `${describeDomFromNode(rNode)}\n\n`;
14693
- const message = header + actual;
14694
- return new RuntimeError(518 /* RuntimeErrorCode.HYDRATION_I18N_NOT_YET_SUPPORTED */, message);
14695
- }
14696
14690
  // Stringification methods
14697
14691
  /**
14698
14692
  * Stringifies a given TNode's attributes
@@ -21281,6 +21275,18 @@ function ɵɵi18nStart(index, messageIndex, subTemplateIndex = -1) {
21281
21275
  if (tView.firstCreatePass) {
21282
21276
  i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
21283
21277
  }
21278
+ // Set a flag that this LView has i18n blocks.
21279
+ // The flag is later used to determine whether this component should
21280
+ // be hydrated (currently hydration is not supported for i18n blocks).
21281
+ if (tView.type === 2 /* TViewType.Embedded */) {
21282
+ // Annotate host component's LView (not embedded view's LView),
21283
+ // since hydration can be skipped on per-component basis only.
21284
+ const componentLView = lView[DECLARATION_COMPONENT_VIEW];
21285
+ componentLView[FLAGS] |= 32 /* LViewFlags.HasI18n */;
21286
+ }
21287
+ else {
21288
+ lView[FLAGS] |= 32 /* LViewFlags.HasI18n */;
21289
+ }
21284
21290
  const tI18n = tView.data[adjustedIndex];
21285
21291
  const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
21286
21292
  const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
@@ -21978,7 +21984,7 @@ function getOwningComponent(elementOrDir) {
21978
21984
  while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21979
21985
  lView = parent;
21980
21986
  }
21981
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
21987
+ return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
21982
21988
  }
21983
21989
  /**
21984
21990
  * Retrieves all root components associated with a DOM element, directive or component instance.