@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.
- package/esm2022/src/core_reactivity_export_internal.mjs +3 -3
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/di/initializer_token.mjs +1 -1
- package/esm2022/src/di/internal_tokens.mjs +1 -1
- package/esm2022/src/di/r3_injector.mjs +3 -4
- package/esm2022/src/hydration/annotate.mjs +9 -6
- package/esm2022/src/hydration/cleanup.mjs +2 -2
- package/esm2022/src/linker/template_ref.mjs +3 -3
- package/esm2022/src/linker/view_container_ref.mjs +80 -25
- package/esm2022/src/metadata/directives.mjs +1 -1
- package/esm2022/src/metadata/resource_loading.mjs +27 -14
- package/esm2022/src/render3/after_render_hooks.mjs +83 -49
- package/esm2022/src/render3/component.mjs +4 -3
- package/esm2022/src/render3/component_ref.mjs +3 -4
- package/esm2022/src/render3/di.mjs +1 -1
- package/esm2022/src/render3/index.mjs +2 -2
- package/esm2022/src/render3/instructions/all.mjs +2 -1
- package/esm2022/src/render3/instructions/change_detection.mjs +7 -8
- package/esm2022/src/render3/instructions/component_instance.mjs +23 -0
- package/esm2022/src/render3/instructions/control_flow.mjs +20 -4
- package/esm2022/src/render3/instructions/defer.mjs +100 -39
- package/esm2022/src/render3/instructions/shared.mjs +20 -14
- package/esm2022/src/render3/interfaces/defer.mjs +1 -1
- package/esm2022/src/render3/interfaces/definition.mjs +1 -1
- package/esm2022/src/render3/interfaces/injector.mjs +1 -1
- package/esm2022/src/render3/interfaces/node.mjs +16 -1
- package/esm2022/src/render3/interfaces/styling.mjs +4 -7
- package/esm2022/src/render3/interfaces/view.mjs +1 -1
- package/esm2022/src/render3/jit/directive.mjs +6 -2
- package/esm2022/src/render3/jit/environment.mjs +2 -1
- package/esm2022/src/render3/node_manipulation.mjs +4 -3
- package/esm2022/src/render3/pipe.mjs +2 -1
- package/esm2022/src/render3/reactive_lview_consumer.mjs +25 -45
- package/esm2022/src/render3/reactivity/effect.mjs +147 -44
- package/esm2022/src/render3/util/injector_utils.mjs +1 -1
- package/esm2022/src/render3/view_manipulation.mjs +13 -2
- package/esm2022/src/signals/index.mjs +4 -4
- package/esm2022/src/signals/src/api.mjs +2 -11
- package/esm2022/src/signals/src/computed.mjs +43 -93
- package/esm2022/src/signals/src/graph.mjs +241 -162
- package/esm2022/src/signals/src/signal.mjs +59 -79
- package/esm2022/src/signals/src/watch.mjs +38 -52
- package/esm2022/src/signals/src/weak_ref.mjs +2 -29
- package/esm2022/src/util/security/trusted_type_defs.mjs +1 -1
- package/esm2022/src/util/security/trusted_types.mjs +1 -1
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/zone/ng_zone.mjs +16 -1
- package/esm2022/testing/src/component_fixture.mjs +4 -2
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed.mjs +14 -3
- package/esm2022/testing/src/test_bed_compiler.mjs +3 -3
- package/fesm2022/core.mjs +6654 -6366
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +19 -6
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +201 -142
- package/package.json +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +264 -201
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +10 -2
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-next.
|
|
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.
|
|
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
|