@angular/core 17.0.0-next.2 → 17.0.0-next.4

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 (62) hide show
  1. package/esm2022/src/core_reactivity_export_internal.mjs +3 -3
  2. package/esm2022/src/core_render3_private_export.mjs +2 -2
  3. package/esm2022/src/di/initializer_token.mjs +1 -1
  4. package/esm2022/src/di/internal_tokens.mjs +1 -1
  5. package/esm2022/src/di/r3_injector.mjs +3 -4
  6. package/esm2022/src/hydration/annotate.mjs +9 -6
  7. package/esm2022/src/hydration/cleanup.mjs +2 -2
  8. package/esm2022/src/linker/template_ref.mjs +3 -3
  9. package/esm2022/src/linker/view_container_ref.mjs +80 -25
  10. package/esm2022/src/metadata/directives.mjs +1 -1
  11. package/esm2022/src/metadata/resource_loading.mjs +27 -14
  12. package/esm2022/src/render3/after_render_hooks.mjs +83 -49
  13. package/esm2022/src/render3/component.mjs +4 -3
  14. package/esm2022/src/render3/component_ref.mjs +3 -4
  15. package/esm2022/src/render3/di.mjs +1 -1
  16. package/esm2022/src/render3/index.mjs +2 -2
  17. package/esm2022/src/render3/instructions/all.mjs +2 -1
  18. package/esm2022/src/render3/instructions/change_detection.mjs +7 -8
  19. package/esm2022/src/render3/instructions/component_instance.mjs +23 -0
  20. package/esm2022/src/render3/instructions/control_flow.mjs +20 -4
  21. package/esm2022/src/render3/instructions/defer.mjs +100 -39
  22. package/esm2022/src/render3/instructions/shared.mjs +20 -14
  23. package/esm2022/src/render3/interfaces/defer.mjs +1 -1
  24. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  25. package/esm2022/src/render3/interfaces/injector.mjs +1 -1
  26. package/esm2022/src/render3/interfaces/node.mjs +16 -1
  27. package/esm2022/src/render3/interfaces/styling.mjs +4 -7
  28. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  29. package/esm2022/src/render3/jit/directive.mjs +6 -2
  30. package/esm2022/src/render3/jit/environment.mjs +2 -1
  31. package/esm2022/src/render3/node_manipulation.mjs +4 -3
  32. package/esm2022/src/render3/pipe.mjs +2 -1
  33. package/esm2022/src/render3/reactive_lview_consumer.mjs +25 -45
  34. package/esm2022/src/render3/reactivity/effect.mjs +147 -44
  35. package/esm2022/src/render3/util/injector_utils.mjs +1 -1
  36. package/esm2022/src/render3/view_manipulation.mjs +13 -2
  37. package/esm2022/src/signals/index.mjs +4 -4
  38. package/esm2022/src/signals/src/api.mjs +2 -11
  39. package/esm2022/src/signals/src/computed.mjs +43 -93
  40. package/esm2022/src/signals/src/graph.mjs +241 -162
  41. package/esm2022/src/signals/src/signal.mjs +59 -79
  42. package/esm2022/src/signals/src/watch.mjs +38 -52
  43. package/esm2022/src/signals/src/weak_ref.mjs +2 -29
  44. package/esm2022/src/util/security/trusted_type_defs.mjs +1 -1
  45. package/esm2022/src/util/security/trusted_types.mjs +1 -1
  46. package/esm2022/src/version.mjs +1 -1
  47. package/esm2022/src/zone/ng_zone.mjs +16 -1
  48. package/esm2022/testing/src/component_fixture.mjs +4 -2
  49. package/esm2022/testing/src/logger.mjs +3 -3
  50. package/esm2022/testing/src/test_bed.mjs +14 -3
  51. package/esm2022/testing/src/test_bed_compiler.mjs +3 -3
  52. package/fesm2022/core.mjs +6654 -6366
  53. package/fesm2022/core.mjs.map +1 -1
  54. package/fesm2022/rxjs-interop.mjs +1 -1
  55. package/fesm2022/testing.mjs +19 -6
  56. package/fesm2022/testing.mjs.map +1 -1
  57. package/index.d.ts +201 -142
  58. package/package.json +1 -1
  59. package/rxjs-interop/index.d.ts +1 -1
  60. package/schematics/ng-generate/standalone-migration/bundle.js +264 -201
  61. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  62. package/testing/index.d.ts +10 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { getDebugNode, RendererFactory2, InjectionToken, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadata, ɵgenerateStandaloneInDeclarationsError, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, EnvironmentInjector, NgZone, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
7
+ import { getDebugNode, RendererFactory2, InjectionToken, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadata, ɵgenerateStandaloneInDeclarationsError, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, EnvironmentInjector, NgZone, ɵZoneAwareQueueingScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
8
8
  import { ResourceLoader } from '@angular/compiler';
9
9
 
10
10
  /**
@@ -56,9 +56,10 @@ function async(fn) {
56
56
  * @publicApi
57
57
  */
58
58
  class ComponentFixture {
59
- constructor(componentRef, ngZone, _autoDetect) {
59
+ constructor(componentRef, ngZone, effectRunner, _autoDetect) {
60
60
  this.componentRef = componentRef;
61
61
  this.ngZone = ngZone;
62
+ this.effectRunner = effectRunner;
62
63
  this._autoDetect = _autoDetect;
63
64
  this._isStable = true;
64
65
  this._isDestroyed = false;
@@ -131,6 +132,7 @@ class ComponentFixture {
131
132
  * Trigger a change detection cycle for the component.
132
133
  */
133
134
  detectChanges(checkNoChanges = true) {
135
+ this.effectRunner?.flush();
134
136
  if (this.ngZone != null) {
135
137
  // Run the change detection inside the NgZone so that any async tasks as part of the change
136
138
  // detection are captured by the zone and can be waited for in isStable.
@@ -775,7 +777,7 @@ class TestBedCompiler {
775
777
  const def = type[ɵNG_COMP_DEF];
776
778
  const hasStyleUrls = () => {
777
779
  const metadata = this.resolvers.component.resolve(type);
778
- return !!metadata.styleUrls && metadata.styleUrls.length > 0;
780
+ return !!metadata.styleUrl || !!metadata.styleUrls?.length;
779
781
  };
780
782
  const overrideStyleUrls = !!def && !ɵisComponentDefPendingResolution(type) && hasStyleUrls();
781
783
  // In Ivy, compiling a component does not require knowing the module providing the
@@ -785,7 +787,7 @@ class TestBedCompiler {
785
787
  // resolution). In order to avoid this, we preemptively set styleUrls to an empty array,
786
788
  // preserve current styles available on Component def and restore styles back once compilation
787
789
  // is complete.
788
- const override = overrideStyleUrls ? { template, styles: [], styleUrls: [] } : { template };
790
+ const override = overrideStyleUrls ? { template, styles: [], styleUrls: [], styleUrl: undefined } : { template };
789
791
  this.overrideComponent(type, { set: override });
790
792
  if (overrideStyleUrls && def.styles && def.styles.length > 0) {
791
793
  this.existingComponentStyles.set(type, def.styles);
@@ -1614,6 +1616,9 @@ class TestBedImpl {
1614
1616
  static get ngModule() {
1615
1617
  return TestBedImpl.INSTANCE.ngModule;
1616
1618
  }
1619
+ static flushEffects() {
1620
+ return TestBedImpl.INSTANCE.flushEffects();
1621
+ }
1617
1622
  /**
1618
1623
  * Initialize the environment for testing with a compiler factory, a PlatformRef, and an
1619
1624
  * angular module. These are common to every test in the suite.
@@ -1795,7 +1800,7 @@ class TestBedImpl {
1795
1800
  const componentFactory = new ɵRender3ComponentFactory(componentDef);
1796
1801
  const initComponent = () => {
1797
1802
  const componentRef = componentFactory.create(Injector.NULL, [], `#${rootElId}`, this.testModuleRef);
1798
- return new ComponentFixture(componentRef, ngZone, autoDetect);
1803
+ return new ComponentFixture(componentRef, ngZone, this.inject(ɵZoneAwareQueueingScheduler, null), autoDetect);
1799
1804
  };
1800
1805
  const fixture = ngZone ? ngZone.run(initComponent) : initComponent();
1801
1806
  this._activeFixtures.push(fixture);
@@ -1920,6 +1925,14 @@ class TestBedImpl {
1920
1925
  testRenderer.removeAllRootElements?.();
1921
1926
  }
1922
1927
  }
1928
+ /**
1929
+ * Execute any pending effects.
1930
+ *
1931
+ * @developerPreview
1932
+ */
1933
+ flushEffects() {
1934
+ this.inject(ɵZoneAwareQueueingScheduler).flush();
1935
+ }
1923
1936
  }
1924
1937
  /**
1925
1938
  * @description