@angular/core 17.3.0 → 18.0.0-next.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.
- package/esm2022/src/application/application_ref.mjs +15 -30
- package/esm2022/src/change_detection/flags.mjs +4 -3
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +6 -34
- package/esm2022/src/render3/component_ref.mjs +1 -1
- package/esm2022/src/render3/instructions/change_detection.mjs +1 -1
- package/esm2022/src/util/callback_scheduler.mjs +74 -0
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/zone/ng_zone.mjs +9 -8
- package/esm2022/testing/src/component_fixture.mjs +46 -11
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +90 -98
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +46 -11
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +6543 -10012
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +9281 -12750
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +6554 -10023
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +11613 -15036
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2022/src/util/raf.mjs +0 -41
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v18.0.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, ɵDeferBlockBehavior, InjectionToken, inject as inject$1, ɵNoopNgZone, NgZone, ɵEffectScheduler, ApplicationRef, getDebugNode, RendererFactory2, ɵPendingTasks, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵ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, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵChangeDetectionScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
7
|
+
import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, ɵDeferBlockBehavior, InjectionToken, inject as inject$1, ɵNoopNgZone, NgZone, ɵEffectScheduler, ApplicationRef, getDebugNode, RendererFactory2, ɵPendingTasks, ɵdetectChangesInViewIfRequired, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵ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, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵChangeDetectionScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
10
|
import { first } from 'rxjs/operators';
|
|
@@ -301,6 +301,12 @@ class PseudoApplicationComponentFixture extends ComponentFixture {
|
|
|
301
301
|
this.beforeRenderSubscription = undefined;
|
|
302
302
|
}
|
|
303
303
|
initialize() {
|
|
304
|
+
if (this._autoDetect) {
|
|
305
|
+
this.subscribeToAppRefEvents();
|
|
306
|
+
}
|
|
307
|
+
this.componentRef.hostView.onDestroy(() => {
|
|
308
|
+
this.unsubscribeFromAppRefEvents();
|
|
309
|
+
});
|
|
304
310
|
// Create subscriptions outside the NgZone so that the callbacks run outside
|
|
305
311
|
// of NgZone.
|
|
306
312
|
this._ngZone.runOutsideAngular(() => {
|
|
@@ -309,15 +315,6 @@ class PseudoApplicationComponentFixture extends ComponentFixture {
|
|
|
309
315
|
this._isStable = false;
|
|
310
316
|
},
|
|
311
317
|
}));
|
|
312
|
-
this._subscriptions.add(this._ngZone.onMicrotaskEmpty.subscribe({
|
|
313
|
-
next: () => {
|
|
314
|
-
if (this._autoDetect) {
|
|
315
|
-
// Do a change detection run with checkNoChanges set to true to check
|
|
316
|
-
// there are no changes on the second run.
|
|
317
|
-
this.detectChanges(true);
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
}));
|
|
321
318
|
this._subscriptions.add(this._ngZone.onStable.subscribe({
|
|
322
319
|
next: () => {
|
|
323
320
|
this._isStable = true;
|
|
@@ -380,10 +377,48 @@ class PseudoApplicationComponentFixture extends ComponentFixture {
|
|
|
380
377
|
if (this._noZoneOptionIsSet) {
|
|
381
378
|
throw new Error('Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set.');
|
|
382
379
|
}
|
|
380
|
+
if (autoDetect !== this._autoDetect) {
|
|
381
|
+
if (autoDetect) {
|
|
382
|
+
this.subscribeToAppRefEvents();
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
this.unsubscribeFromAppRefEvents();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
383
388
|
this._autoDetect = autoDetect;
|
|
384
389
|
this.detectChanges();
|
|
385
390
|
}
|
|
391
|
+
subscribeToAppRefEvents() {
|
|
392
|
+
this._ngZone.runOutsideAngular(() => {
|
|
393
|
+
this.afterTickSubscription = this._testAppRef.afterTick.subscribe(() => {
|
|
394
|
+
this.checkNoChanges();
|
|
395
|
+
});
|
|
396
|
+
this.beforeRenderSubscription = this._testAppRef.beforeRender.subscribe((isFirstPass) => {
|
|
397
|
+
try {
|
|
398
|
+
ɵdetectChangesInViewIfRequired(this.componentRef.hostView._lView, isFirstPass, this.componentRef.hostView.notifyErrorHandler);
|
|
399
|
+
}
|
|
400
|
+
catch (e) {
|
|
401
|
+
// If an error ocurred during change detection, remove the test view from the application
|
|
402
|
+
// ref tracking. Note that this isn't exactly desirable but done this way because of how
|
|
403
|
+
// things used to work with `autoDetect` and uncaught errors. Ideally we would surface
|
|
404
|
+
// this error to the error handler instead and continue refreshing the view like
|
|
405
|
+
// what would happen in the application.
|
|
406
|
+
this.unsubscribeFromAppRefEvents();
|
|
407
|
+
throw e;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
this._testAppRef.externalTestViews.add(this.componentRef.hostView);
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
unsubscribeFromAppRefEvents() {
|
|
414
|
+
this.afterTickSubscription?.unsubscribe();
|
|
415
|
+
this.beforeRenderSubscription?.unsubscribe();
|
|
416
|
+
this.afterTickSubscription = undefined;
|
|
417
|
+
this.beforeRenderSubscription = undefined;
|
|
418
|
+
this._testAppRef.externalTestViews.delete(this.componentRef.hostView);
|
|
419
|
+
}
|
|
386
420
|
destroy() {
|
|
421
|
+
this.unsubscribeFromAppRefEvents();
|
|
387
422
|
this._subscriptions.unsubscribe();
|
|
388
423
|
super.destroy();
|
|
389
424
|
}
|