@angular/core 20.0.3 → 20.0.5
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/{api.d-B0vztftH.d.ts → api.d.d.ts} +2 -2
- package/{chrome_dev_tools_performance.d-DvzAxqBc.d.ts → chrome_dev_tools_performance.d.d.ts} +3 -3
- package/{discovery.d-C5dkZ8lJ.d.ts → discovery.d.d.ts} +6 -5
- package/{event_dispatcher.d-BReQpZfC.d.ts → event_dispatcher.d.d.ts} +1 -1
- package/fesm2022/{attribute-BWp59EjE.mjs → attribute.mjs} +2 -2
- package/fesm2022/attribute.mjs.map +1 -0
- package/fesm2022/core.mjs +18 -20
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{debug_node-JnOYh9kg.mjs → debug_node.mjs} +32 -19
- package/fesm2022/debug_node.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -2
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -5
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/{resource-BarKSp_3.mjs → resource.mjs} +12 -8
- package/fesm2022/resource.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler-DCy1y1b8.mjs → root_effect_scheduler.mjs} +20 -6
- package/fesm2022/root_effect_scheduler.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +5 -5
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{signal-nCiHhWf6.mjs → signal.mjs} +2 -2
- package/fesm2022/signal.mjs.map +1 -0
- package/fesm2022/testing.mjs +142 -53
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/{untracked-DmD_2MlC.mjs → untracked.mjs} +3 -3
- package/fesm2022/untracked.mjs.map +1 -0
- package/fesm2022/{weak_ref-BaIq-pgY.mjs → weak_ref.mjs} +2 -2
- package/fesm2022/weak_ref.mjs.map +1 -0
- package/{graph.d-BcIOep_B.d.ts → graph.d.d.ts} +1 -1
- package/index.d.ts +11 -14
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +6 -6
- package/rxjs-interop/index.d.ts +5 -5
- package/schematics/bundles/{apply_import_manager-DT15wSJs.cjs → apply_import_manager-z2wdNH9i.cjs} +3 -3
- package/schematics/bundles/{checker-Bu1Wu4f7.cjs → checker-bovuFVqM.cjs} +40 -7
- package/schematics/bundles/cleanup-unused-imports.cjs +35 -21
- package/schematics/bundles/{compiler_host-C_4Iw5UD.cjs → compiler_host-Kg3VLaJg.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +3 -3
- package/schematics/bundles/document-core.cjs +5 -5
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-CAM7Xiu7.cjs → index-C_IZ6xLU.cjs} +4 -4
- package/schematics/bundles/{index-CCX_cTPD.cjs → index-D6D7R0Xm.cjs} +12 -12
- package/schematics/bundles/inject-flags.cjs +5 -5
- package/schematics/bundles/inject-migration.cjs +9 -4
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DSqmdRpG.cjs → migrate_ts_type_references-CNZBdxAV.cjs} +5 -5
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{project_paths-BjQra9mv.cjs → project_paths-CBE0nAL9.cjs} +3 -3
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
- package/schematics/bundles/signal-input-migration.cjs +7 -7
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +4 -4
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/bundles/test-bed-get.cjs +4 -4
- package/{signal.d-BcmOdASA.d.ts → signal.d.d.ts} +2 -2
- package/testing/index.d.ts +73 -6
- package/{weak_ref.d-eGOEP9S1.d.ts → weak_ref.d.d.ts} +1 -1
- package/fesm2022/attribute-BWp59EjE.mjs.map +0 -1
- package/fesm2022/debug_node-JnOYh9kg.mjs.map +0 -1
- package/fesm2022/resource-BarKSp_3.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler-DCy1y1b8.mjs.map +0 -1
- package/fesm2022/signal-nCiHhWf6.mjs.map +0 -1
- package/fesm2022/untracked-DmD_2MlC.mjs.map +0 -1
- package/fesm2022/weak_ref-BaIq-pgY.mjs.map +0 -1
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.
|
|
2
|
+
* @license Angular v20.0.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { NgZone, Injectable, DeferBlockState, triggerResourceLoading, renderDeferBlockState, getDeferBlocks, DeferBlockBehavior, NoopNgZone, ApplicationRef, getDebugNode, RendererFactory2, Directive, Component, Pipe, NgModule, ReflectionCapabilities, depsTracker, isComponentDefPendingResolution, resolveComponentResources, NgModuleRef, ApplicationInitStatus, LOCALE_ID, DEFAULT_LOCALE_ID, setLocaleId, ComponentFactory, getAsyncClassMetadataFn, compileComponent, compileDirective, compilePipe, patchComponentDefWithScope, compileNgModuleDefs, clearResolutionOfComponentResourcesQueue, restoreComponentResolutionQueue, internalProvideZoneChangeDetection, ChangeDetectionSchedulerImpl, COMPILER_OPTIONS, generateStandaloneInDeclarationsError, transitiveScopesFor, Compiler, DEFER_BLOCK_CONFIG, NgModuleFactory, ModuleWithComponentFactories, resetCompiledComponents, ɵsetUnknownElementStrictMode as _setUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode as _setUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode as _getUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode as _getUnknownPropertyStrictMode, flushModuleScopingQueueAsMuchAsPossible, setAllowDuplicateNgModuleIdsForTest } from './debug_node
|
|
8
|
+
import { NgZone, Injectable, DeferBlockState, triggerResourceLoading, renderDeferBlockState, getDeferBlocks, DeferBlockBehavior, NoopNgZone, ApplicationRef, getDebugNode, RendererFactory2, Directive, Component, Pipe, NgModule, ReflectionCapabilities, depsTracker, isComponentDefPendingResolution, resolveComponentResources, NgModuleRef, ApplicationInitStatus, LOCALE_ID, DEFAULT_LOCALE_ID, setLocaleId, ComponentFactory, getAsyncClassMetadataFn, compileComponent, compileDirective, compilePipe, patchComponentDefWithScope, compileNgModuleDefs, clearResolutionOfComponentResourcesQueue, restoreComponentResolutionQueue, internalProvideZoneChangeDetection, ChangeDetectionSchedulerImpl, COMPILER_OPTIONS, generateStandaloneInDeclarationsError, transitiveScopesFor, Compiler, DEFER_BLOCK_CONFIG, NgModuleFactory, ModuleWithComponentFactories, resetCompiledComponents, ɵsetUnknownElementStrictMode as _setUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode as _setUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode as _getUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode as _getUnknownPropertyStrictMode, flushModuleScopingQueueAsMuchAsPossible, setAllowDuplicateNgModuleIdsForTest } from './debug_node.mjs';
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
|
-
import { inject as inject$1, EnvironmentInjector, ErrorHandler, CONTAINER_HEADER_OFFSET, InjectionToken, PendingTasksInternal, ZONELESS_ENABLED, ChangeDetectionScheduler, EffectScheduler, stringify, getInjectableDef, resolveForwardRef, NG_COMP_DEF, NG_DIR_DEF, NG_PIPE_DEF, NG_INJ_DEF, NG_MOD_DEF, ENVIRONMENT_INITIALIZER, Injector, isEnvironmentProviders, INTERNAL_APPLICATION_ERROR_HANDLER, runInInjectionContext } from './root_effect_scheduler
|
|
10
|
+
import { inject as inject$1, EnvironmentInjector, ErrorHandler, CONTAINER_HEADER_OFFSET, InjectionToken, PendingTasksInternal, ZONELESS_ENABLED, ChangeDetectionScheduler, EffectScheduler, stringify, getInjectableDef, resolveForwardRef, NG_COMP_DEF, NG_DIR_DEF, NG_PIPE_DEF, NG_INJ_DEF, NG_MOD_DEF, ENVIRONMENT_INITIALIZER, Injector, isEnvironmentProviders, INTERNAL_APPLICATION_ERROR_HANDLER, runInInjectionContext } from './root_effect_scheduler.mjs';
|
|
11
11
|
import { ResourceLoader } from '@angular/compiler';
|
|
12
|
-
import './signal
|
|
12
|
+
import './signal.mjs';
|
|
13
13
|
import '@angular/core/primitives/signals';
|
|
14
14
|
import 'rxjs/operators';
|
|
15
|
-
import './attribute
|
|
15
|
+
import './attribute.mjs';
|
|
16
16
|
import './primitives/di.mjs';
|
|
17
17
|
import '@angular/core/primitives/di';
|
|
18
18
|
|
|
@@ -2468,8 +2468,9 @@ class FakeNavigation {
|
|
|
2468
2468
|
const hashChange = isHashChange(fromUrl, toUrl);
|
|
2469
2469
|
const destination = new FakeNavigationDestination({
|
|
2470
2470
|
url: toUrl.toString(),
|
|
2471
|
-
sameDocument: true,
|
|
2471
|
+
sameDocument: true, // history.pushState/replaceState are always same-document
|
|
2472
2472
|
historyState: data,
|
|
2473
|
+
state: undefined, // No Navigation API state directly from history.pushState
|
|
2473
2474
|
});
|
|
2474
2475
|
const result = new InternalNavigationResult(this);
|
|
2475
2476
|
const intercepted = this.userAgentNavigate(destination, result, {
|
|
@@ -2662,6 +2663,16 @@ class FakeNavigation {
|
|
|
2662
2663
|
isDisposed() {
|
|
2663
2664
|
return this.disposed;
|
|
2664
2665
|
}
|
|
2666
|
+
abortOngoingNavigation(eventToAbort, reason) {
|
|
2667
|
+
if (this.navigateEvent !== eventToAbort) {
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
if (this.navigateEvent.abortController.signal.aborted) {
|
|
2671
|
+
return;
|
|
2672
|
+
}
|
|
2673
|
+
const abortReason = reason ?? new DOMException('Navigation aborted', 'AbortError');
|
|
2674
|
+
this.navigateEvent.cancel(abortReason);
|
|
2675
|
+
}
|
|
2665
2676
|
/**
|
|
2666
2677
|
* Implementation for all navigations and traversals.
|
|
2667
2678
|
* @returns true if the event was intercepted, otherwise false
|
|
@@ -2671,21 +2682,24 @@ class FakeNavigation {
|
|
|
2671
2682
|
// entry.
|
|
2672
2683
|
this.canSetInitialEntry = false;
|
|
2673
2684
|
if (this.navigateEvent) {
|
|
2674
|
-
this.navigateEvent
|
|
2675
|
-
this.navigateEvent = null;
|
|
2685
|
+
this.abortOngoingNavigation(this.navigateEvent, new DOMException('Navigation superseded by a new navigation.', 'AbortError'));
|
|
2676
2686
|
}
|
|
2677
|
-
|
|
2687
|
+
// TODO(atscott): Disposing doesn't really do much because new requests are still processed
|
|
2688
|
+
// if (this.disposed) {
|
|
2689
|
+
// return false;
|
|
2690
|
+
// }
|
|
2691
|
+
const dispatchResultIsTrueIfNoInterception = dispatchNavigateEvent({
|
|
2678
2692
|
navigationType: options.navigationType,
|
|
2679
2693
|
cancelable: options.cancelable,
|
|
2680
2694
|
canIntercept: options.canIntercept,
|
|
2681
2695
|
userInitiated: options.userInitiated,
|
|
2682
2696
|
hashChange: options.hashChange,
|
|
2683
|
-
signal: result.signal,
|
|
2684
2697
|
destination,
|
|
2685
2698
|
info: options.info,
|
|
2686
2699
|
sameDocument: destination.sameDocument,
|
|
2687
2700
|
result,
|
|
2688
2701
|
});
|
|
2702
|
+
return !dispatchResultIsTrueIfNoInterception;
|
|
2689
2703
|
}
|
|
2690
2704
|
/**
|
|
2691
2705
|
* Implementation for a push or replace navigation.
|
|
@@ -2743,7 +2757,9 @@ class FakeNavigation {
|
|
|
2743
2757
|
}
|
|
2744
2758
|
if (navigationType === 'push' || navigationType === 'replace') {
|
|
2745
2759
|
const index = this.currentEntryIndex;
|
|
2746
|
-
const key = navigationType === 'push'
|
|
2760
|
+
const key = navigationType === 'push'
|
|
2761
|
+
? String(this.nextKey++)
|
|
2762
|
+
: (oldCurrentNHE?.key ?? String(this.nextKey++));
|
|
2747
2763
|
const newNHE = new FakeNavigationHistoryEntry(this.eventTarget, destination.url, {
|
|
2748
2764
|
id: String(this.nextId++),
|
|
2749
2765
|
key,
|
|
@@ -2877,19 +2893,21 @@ class FakeNavigationHistoryEntry {
|
|
|
2877
2893
|
*
|
|
2878
2894
|
* https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigate-event-firing
|
|
2879
2895
|
*/
|
|
2880
|
-
function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashChange, navigationType,
|
|
2896
|
+
function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashChange, navigationType, destination, info, sameDocument, result, }) {
|
|
2881
2897
|
const { navigation } = result;
|
|
2898
|
+
const eventAbortController = new AbortController();
|
|
2882
2899
|
const event = new Event('navigate', { bubbles: false, cancelable });
|
|
2883
|
-
event.
|
|
2884
|
-
event.
|
|
2885
|
-
event.interceptionState = 'none';
|
|
2900
|
+
event.navigationType = navigationType;
|
|
2901
|
+
event.destination = destination;
|
|
2886
2902
|
event.canIntercept = canIntercept;
|
|
2887
2903
|
event.userInitiated = userInitiated;
|
|
2888
2904
|
event.hashChange = hashChange;
|
|
2889
|
-
event.
|
|
2890
|
-
event.
|
|
2891
|
-
event.destination = destination;
|
|
2905
|
+
event.signal = eventAbortController.signal;
|
|
2906
|
+
event.abortController = eventAbortController;
|
|
2892
2907
|
event.info = info;
|
|
2908
|
+
event.focusResetBehavior = null;
|
|
2909
|
+
event.scrollBehavior = null;
|
|
2910
|
+
event.interceptionState = 'none';
|
|
2893
2911
|
event.downloadRequest = null;
|
|
2894
2912
|
event.formData = null;
|
|
2895
2913
|
event.result = result;
|
|
@@ -2931,7 +2949,7 @@ function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashCh
|
|
|
2931
2949
|
processScrollBehavior(event);
|
|
2932
2950
|
};
|
|
2933
2951
|
// https://whatpr.org/html/10919/nav-history-apis.html#dom-navigationprecommitcontroller-redirect
|
|
2934
|
-
function redirect(url) {
|
|
2952
|
+
function redirect(url, options = {}) {
|
|
2935
2953
|
if (event.interceptionState === 'none') {
|
|
2936
2954
|
throw new Error('cannot redirect when event is not intercepted');
|
|
2937
2955
|
}
|
|
@@ -2941,8 +2959,17 @@ function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashCh
|
|
|
2941
2959
|
if (event.navigationType !== 'push' && event.navigationType !== 'replace') {
|
|
2942
2960
|
throw new DOMException(`cannot redirect when navigationType is not 'push' or 'replace`, 'InvalidStateError');
|
|
2943
2961
|
}
|
|
2944
|
-
const
|
|
2945
|
-
|
|
2962
|
+
const destinationUrl = new URL(url, navigation.currentEntry.url);
|
|
2963
|
+
if (options.history === 'push' || options.history === 'replace') {
|
|
2964
|
+
event.navigationType = options.history;
|
|
2965
|
+
}
|
|
2966
|
+
if (options.hasOwnProperty('state')) {
|
|
2967
|
+
event.destination.state = options.state;
|
|
2968
|
+
}
|
|
2969
|
+
event.destination.url = destinationUrl.href;
|
|
2970
|
+
if (options.hasOwnProperty('info')) {
|
|
2971
|
+
event.info = options.info;
|
|
2972
|
+
}
|
|
2946
2973
|
}
|
|
2947
2974
|
// https://whatpr.org/html/10919/nav-history-apis.html#inner-navigate-event-firing-algorithm
|
|
2948
2975
|
// "Let commit be the following steps:"
|
|
@@ -2950,12 +2977,9 @@ function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashCh
|
|
|
2950
2977
|
if (result.signal.aborted) {
|
|
2951
2978
|
return;
|
|
2952
2979
|
}
|
|
2953
|
-
|
|
2980
|
+
navigation.transition?.committedResolve();
|
|
2981
|
+
if (event.interceptionState === 'intercepted') {
|
|
2954
2982
|
event.interceptionState = 'committed';
|
|
2955
|
-
if (!navigation.currentEntry) {
|
|
2956
|
-
throw new Error('from history entry should not be null');
|
|
2957
|
-
}
|
|
2958
|
-
navigation.transition = new InternalNavigationTransition(navigation.currentEntry, navigationType);
|
|
2959
2983
|
switch (event.navigationType) {
|
|
2960
2984
|
case 'push':
|
|
2961
2985
|
case 'replace': {
|
|
@@ -2984,19 +3008,27 @@ function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashCh
|
|
|
2984
3008
|
return;
|
|
2985
3009
|
}
|
|
2986
3010
|
if (event !== navigation.navigateEvent) {
|
|
2987
|
-
|
|
3011
|
+
if (!result.signal.aborted && result.committedTo) {
|
|
3012
|
+
result.finishedReject(new DOMException('Navigation superseded before handler completion', 'AbortError'));
|
|
3013
|
+
}
|
|
3014
|
+
return;
|
|
2988
3015
|
}
|
|
2989
3016
|
navigation.navigateEvent = null;
|
|
2990
3017
|
finishNavigationEvent(event, true);
|
|
2991
|
-
const navigatesuccessEvent = new Event('navigatesuccess', {
|
|
3018
|
+
const navigatesuccessEvent = new Event('navigatesuccess', {
|
|
3019
|
+
bubbles: false,
|
|
3020
|
+
cancelable: false,
|
|
3021
|
+
});
|
|
2992
3022
|
navigation.eventTarget.dispatchEvent(navigatesuccessEvent);
|
|
2993
3023
|
result.finishedResolve();
|
|
2994
|
-
|
|
2995
|
-
navigation.transition.finishedResolve();
|
|
2996
|
-
}
|
|
3024
|
+
navigation.transition?.finishedResolve();
|
|
2997
3025
|
navigation.transition = null;
|
|
2998
3026
|
})
|
|
2999
|
-
.catch((reason) =>
|
|
3027
|
+
.catch((reason) => {
|
|
3028
|
+
if (!event.abortController.signal.aborted) {
|
|
3029
|
+
event.cancel(reason);
|
|
3030
|
+
}
|
|
3031
|
+
});
|
|
3000
3032
|
}
|
|
3001
3033
|
// Internal only.
|
|
3002
3034
|
// https://whatpr.org/html/10919/nav-history-apis.html#inner-navigate-event-firing-algorithm
|
|
@@ -3005,37 +3037,84 @@ function dispatchNavigateEvent({ cancelable, canIntercept, userInitiated, hashCh
|
|
|
3005
3037
|
if (result.signal.aborted) {
|
|
3006
3038
|
return;
|
|
3007
3039
|
}
|
|
3008
|
-
|
|
3009
|
-
|
|
3040
|
+
this.abortController.abort(reason);
|
|
3041
|
+
const isCurrentGlobalNavigationEvent = this === navigation.navigateEvent;
|
|
3042
|
+
if (isCurrentGlobalNavigationEvent) {
|
|
3043
|
+
navigation.navigateEvent = null;
|
|
3010
3044
|
}
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
finishNavigationEvent(event, false);
|
|
3045
|
+
if (this.interceptionState !== 'intercepted' && this.interceptionState !== 'finished') {
|
|
3046
|
+
finishNavigationEvent(this, false);
|
|
3014
3047
|
}
|
|
3015
|
-
|
|
3048
|
+
else if (this.interceptionState === 'intercepted') {
|
|
3049
|
+
this.interceptionState = 'finished';
|
|
3050
|
+
}
|
|
3051
|
+
const navigateerrorEvent = new Event('navigateerror', {
|
|
3052
|
+
bubbles: false,
|
|
3053
|
+
cancelable,
|
|
3054
|
+
});
|
|
3055
|
+
navigateerrorEvent.error = reason;
|
|
3016
3056
|
navigation.eventTarget.dispatchEvent(navigateerrorEvent);
|
|
3017
|
-
result.
|
|
3018
|
-
|
|
3019
|
-
navigation.transition.finishedReject(reason);
|
|
3057
|
+
if (result.committedTo === null && !result.signal.aborted) {
|
|
3058
|
+
result.committedReject(reason);
|
|
3020
3059
|
}
|
|
3060
|
+
result.finishedReject(reason);
|
|
3061
|
+
const transition = navigation.transition;
|
|
3062
|
+
transition?.committedReject(reason);
|
|
3063
|
+
transition?.finishedReject(reason);
|
|
3021
3064
|
navigation.transition = null;
|
|
3022
3065
|
};
|
|
3023
3066
|
function dispatch() {
|
|
3024
3067
|
navigation.navigateEvent = event;
|
|
3025
|
-
navigation.eventTarget.dispatchEvent(event);
|
|
3026
|
-
if (
|
|
3027
|
-
|
|
3068
|
+
const dispatchResult = navigation.eventTarget.dispatchEvent(event);
|
|
3069
|
+
if (event.interceptionState === 'intercepted') {
|
|
3070
|
+
if (!navigation.currentEntry) {
|
|
3071
|
+
event.cancel(new DOMException('Cannot create transition without a currentEntry for intercepted navigation.', 'InvalidStateError'));
|
|
3072
|
+
return;
|
|
3073
|
+
}
|
|
3074
|
+
const transition = new InternalNavigationTransition(navigation.currentEntry, navigationType);
|
|
3075
|
+
navigation.transition = transition;
|
|
3076
|
+
// Mark transition.finished as handled (Spec Step 33.4)
|
|
3077
|
+
transition.finished.catch(() => { });
|
|
3078
|
+
transition.committed.catch(() => { });
|
|
3079
|
+
}
|
|
3080
|
+
if (!dispatchResult && event.cancelable) {
|
|
3081
|
+
if (!event.abortController.signal.aborted) {
|
|
3082
|
+
event.cancel(new DOMException('Navigation prevented by event.preventDefault()', 'AbortError'));
|
|
3083
|
+
}
|
|
3028
3084
|
}
|
|
3029
3085
|
else {
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3086
|
+
if (precommitHandlers.length === 0) {
|
|
3087
|
+
commit();
|
|
3088
|
+
}
|
|
3089
|
+
else {
|
|
3090
|
+
const precommitController = { redirect };
|
|
3091
|
+
const precommitPromisesList = precommitHandlers.map((handler) => {
|
|
3092
|
+
let p;
|
|
3093
|
+
try {
|
|
3094
|
+
p = handler(precommitController);
|
|
3095
|
+
}
|
|
3096
|
+
catch (e) {
|
|
3097
|
+
p = Promise.reject(e);
|
|
3098
|
+
}
|
|
3099
|
+
p.catch(() => { });
|
|
3100
|
+
return p;
|
|
3101
|
+
});
|
|
3102
|
+
Promise.all(precommitPromisesList)
|
|
3103
|
+
.then(() => commit())
|
|
3104
|
+
.catch((reason) => {
|
|
3105
|
+
if (event.abortController.signal.aborted) {
|
|
3106
|
+
return;
|
|
3107
|
+
}
|
|
3108
|
+
if (navigation.transition) {
|
|
3109
|
+
navigation.transition.committedReject(reason);
|
|
3110
|
+
}
|
|
3111
|
+
event.cancel(reason);
|
|
3112
|
+
});
|
|
3113
|
+
}
|
|
3035
3114
|
}
|
|
3036
3115
|
}
|
|
3037
3116
|
dispatch();
|
|
3038
|
-
return event.interceptionState
|
|
3117
|
+
return event.interceptionState === 'none';
|
|
3039
3118
|
}
|
|
3040
3119
|
/** https://whatpr.org/html/10919/nav-history-apis.html#navigateevent-finish */
|
|
3041
3120
|
function finishNavigationEvent(event, didFulfill) {
|
|
@@ -3046,7 +3125,6 @@ function finishNavigationEvent(event, didFulfill) {
|
|
|
3046
3125
|
if (didFulfill === true) {
|
|
3047
3126
|
throw new Error('didFulfill should be false');
|
|
3048
3127
|
}
|
|
3049
|
-
// assert precommit handlers is not empty
|
|
3050
3128
|
event.interceptionState = 'finished';
|
|
3051
3129
|
return;
|
|
3052
3130
|
}
|
|
@@ -3064,7 +3142,10 @@ function potentiallyResetFocus(event) {
|
|
|
3064
3142
|
if (event.interceptionState !== 'committed' && event.interceptionState !== 'scrolled') {
|
|
3065
3143
|
throw new Error('cannot reset focus if navigation event is not committed or scrolled');
|
|
3066
3144
|
}
|
|
3067
|
-
|
|
3145
|
+
if (event.focusResetBehavior === 'manual') {
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3148
|
+
// TODO(atscott): the rest of the steps
|
|
3068
3149
|
}
|
|
3069
3150
|
function potentiallyResetScroll(event) {
|
|
3070
3151
|
if (event.interceptionState !== 'committed' && event.interceptionState !== 'scrolled') {
|
|
@@ -3155,8 +3236,11 @@ class InternalNavigationTransition {
|
|
|
3155
3236
|
from;
|
|
3156
3237
|
navigationType;
|
|
3157
3238
|
finished;
|
|
3239
|
+
committed;
|
|
3158
3240
|
finishedResolve;
|
|
3159
3241
|
finishedReject;
|
|
3242
|
+
committedResolve;
|
|
3243
|
+
committedReject;
|
|
3160
3244
|
constructor(from, navigationType) {
|
|
3161
3245
|
this.from = from;
|
|
3162
3246
|
this.navigationType = navigationType;
|
|
@@ -3164,8 +3248,13 @@ class InternalNavigationTransition {
|
|
|
3164
3248
|
this.finishedReject = reject;
|
|
3165
3249
|
this.finishedResolve = resolve;
|
|
3166
3250
|
});
|
|
3251
|
+
this.committed = new Promise((resolve, reject) => {
|
|
3252
|
+
this.committedReject = reject;
|
|
3253
|
+
this.committedResolve = resolve;
|
|
3254
|
+
});
|
|
3167
3255
|
// All rejections are handled.
|
|
3168
3256
|
this.finished.catch(() => { });
|
|
3257
|
+
this.committed.catch(() => { });
|
|
3169
3258
|
}
|
|
3170
3259
|
}
|
|
3171
3260
|
/**
|
|
@@ -3194,7 +3283,7 @@ class InternalNavigationResult {
|
|
|
3194
3283
|
};
|
|
3195
3284
|
this.committedReject = reject;
|
|
3196
3285
|
});
|
|
3197
|
-
this.finished = new Promise(
|
|
3286
|
+
this.finished = new Promise((resolve, reject) => {
|
|
3198
3287
|
this.finishedResolve = () => {
|
|
3199
3288
|
if (this.committedTo === null) {
|
|
3200
3289
|
throw new Error('NavigateEvent should have been committed before resolving finished promise.');
|