@equinor/fusion-framework-module-navigation 7.0.9 → 7.0.10
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/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -7
- package/CHANGELOG.md +0 -600
- package/src/NavigateEvent.ts +0 -47
- package/src/NavigatedEvent.ts +0 -35
- package/src/NavigationConfigurator.interface.ts +0 -41
- package/src/NavigationConfigurator.ts +0 -226
- package/src/NavigationProvider.interface.ts +0 -99
- package/src/NavigationProvider.ts +0 -436
- package/src/__tests__/BrowserHistory.test.ts +0 -151
- package/src/__tests__/HashHistory.test.ts +0 -121
- package/src/__tests__/MemoryHistory.test.ts +0 -185
- package/src/__tests__/NavigationProvider.test.ts +0 -302
- package/src/__tests__/ProxyHistory.test.ts +0 -149
- package/src/__tests__/setup.ts +0 -8
- package/src/enable-navigation.ts +0 -60
- package/src/index.ts +0 -51
- package/src/lib/BaseHistory.ts +0 -255
- package/src/lib/BrowserHistory.ts +0 -124
- package/src/lib/BrowserHistoryHashStack.ts +0 -57
- package/src/lib/BrowserHistoryStack.ts +0 -96
- package/src/lib/MemoryHistory.ts +0 -76
- package/src/lib/MemoryHistoryStack.ts +0 -118
- package/src/lib/ProxyHistory.ts +0 -145
- package/src/lib/create-history.ts +0 -58
- package/src/lib/index.ts +0 -33
- package/src/lib/state/actions.ts +0 -108
- package/src/lib/state/check-blockers.ts +0 -52
- package/src/lib/state/create-flow.ts +0 -36
- package/src/lib/state/create-history-reducer.ts +0 -77
- package/src/lib/state/create-store.ts +0 -39
- package/src/lib/state/flow-creators.ts +0 -7
- package/src/lib/state/go.ts +0 -20
- package/src/lib/state/history.state.ts +0 -14
- package/src/lib/state/index.ts +0 -4
- package/src/lib/state/navigate.ts +0 -58
- package/src/lib/state/pop.ts +0 -24
- package/src/lib/state/validate-current-location.ts +0 -33
- package/src/lib/types.ts +0 -190
- package/src/lib/utils/encode-trailing-whitespace.ts +0 -18
- package/src/lib/utils/has-protocol.ts +0 -21
- package/src/lib/utils/index.ts +0 -5
- package/src/lib/utils/path-to-string.ts +0 -24
- package/src/lib/utils/path-to-url.ts +0 -52
- package/src/lib/utils/resolve-browser-location.ts +0 -1
- package/src/lib/utils/resolve-hash-location.ts +0 -26
- package/src/lib/utils/resolve-path.ts +0 -22
- package/src/lib/utils/resolve-window-location.ts +0 -24
- package/src/module.ts +0 -80
- package/src/version.ts +0 -2
- package/tsconfig.json +0 -24
- package/vitest.config.ts +0 -14
package/src/NavigateEvent.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { FrameworkEvent, type FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
|
-
|
|
3
|
-
import type { INavigationProvider } from './NavigationProvider.interface';
|
|
4
|
-
import type { NavigationUpdate, Path } from './lib/types';
|
|
5
|
-
|
|
6
|
-
/** Event detail for navigation events (before navigation). */
|
|
7
|
-
export interface NavigateEventDetail {
|
|
8
|
-
/** The target path or location to navigate to */
|
|
9
|
-
location: NavigationUpdate;
|
|
10
|
-
/** Optional current location before navigation */
|
|
11
|
-
currentLocation?: Path;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Event emitted before navigation occurs.
|
|
16
|
-
* Can be canceled by calling `preventDefault()` to block the navigation.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* eventProvider.addEventListener('onNavigate', (event) => {
|
|
21
|
-
* if (hasUnsavedChanges) {
|
|
22
|
-
* event.preventDefault();
|
|
23
|
-
* }
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export class NavigateEvent extends FrameworkEvent<
|
|
28
|
-
FrameworkEventInit<NavigateEventDetail, INavigationProvider>
|
|
29
|
-
> {
|
|
30
|
-
/** @param detail - Navigation target details. @param source - Provider dispatching the event. */
|
|
31
|
-
constructor(detail: NavigateEventDetail, source: INavigationProvider) {
|
|
32
|
-
super('onNavigate', {
|
|
33
|
-
detail,
|
|
34
|
-
source,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Declares navigation events in the FrameworkEventMap for type safety. */
|
|
40
|
-
declare module '@equinor/fusion-framework-module-event' {
|
|
41
|
-
interface FrameworkEventMap {
|
|
42
|
-
/** Event emitted before navigation occurs, can be canceled to prevent navigation */
|
|
43
|
-
onNavigate: NavigateEvent;
|
|
44
|
-
/** Event emitted after navigation occurs */
|
|
45
|
-
onNavigated: import('./NavigatedEvent').NavigatedEvent;
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/NavigatedEvent.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FrameworkEvent, type FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
|
-
|
|
3
|
-
import type { INavigationProvider } from './NavigationProvider.interface';
|
|
4
|
-
import type { Action, NavigationUpdate } from './lib/types';
|
|
5
|
-
|
|
6
|
-
/** Event detail for navigated events (after navigation). */
|
|
7
|
-
export interface NavigatedEventDetail {
|
|
8
|
-
/** The navigation action that occurred (PUSH, POP, REPLACE) */
|
|
9
|
-
action: Action;
|
|
10
|
-
/** The new location after navigation */
|
|
11
|
-
current: NavigationUpdate;
|
|
12
|
-
/** The previous location before navigation */
|
|
13
|
-
previous: NavigationUpdate;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Event emitted after navigation completes.
|
|
18
|
-
* Contains the navigation action type and both current and previous locations.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* eventProvider.addEventListener('onNavigated', (event) => {
|
|
23
|
-
* const { action, current, previous } = event.detail;
|
|
24
|
-
* console.log(`${action}: ${previous.location.pathname} -> ${current.location.pathname}`);
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export class NavigatedEvent extends FrameworkEvent<
|
|
29
|
-
FrameworkEventInit<NavigatedEventDetail, INavigationProvider>
|
|
30
|
-
> {
|
|
31
|
-
/** @param detail - Completed navigation details. @param source - Provider dispatching the event. */
|
|
32
|
-
constructor(detail: NavigatedEventDetail, source: INavigationProvider) {
|
|
33
|
-
super('onNavigated', { detail, source });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { History } from './lib/types';
|
|
2
|
-
import type { ITelemetryProvider } from '@equinor/fusion-framework-module-telemetry';
|
|
3
|
-
import type { IEventModuleProvider } from '@equinor/fusion-framework-module-event';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Configuration object for the navigation module.
|
|
7
|
-
*
|
|
8
|
-
* Provides options for customizing the history implementation, basename prefix,
|
|
9
|
-
* telemetry tracking, and event dispatching used by the {@link NavigationProvider}.
|
|
10
|
-
*/
|
|
11
|
-
export interface INavigationConfigurator {
|
|
12
|
-
/**
|
|
13
|
-
* Base pathname prefix for the application (e.g. `"/apps/my-app"`).
|
|
14
|
-
*
|
|
15
|
-
* When set, the navigation provider automatically prepends this prefix to
|
|
16
|
-
* outgoing paths and strips it from incoming paths, so consumer code
|
|
17
|
-
* operates on clean, basename-free paths.
|
|
18
|
-
*/
|
|
19
|
-
basename?: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Custom {@link History} instance for navigation.
|
|
23
|
-
*
|
|
24
|
-
* If not provided, defaults to browser history in browser environments
|
|
25
|
-
* or memory history in Node.js environments. Create instances with
|
|
26
|
-
* {@link createHistory}.
|
|
27
|
-
*/
|
|
28
|
-
history?: History;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Telemetry provider for tracking navigation events, location changes,
|
|
32
|
-
* and errors for monitoring and debugging.
|
|
33
|
-
*/
|
|
34
|
-
telemetry?: ITelemetryProvider;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Event provider for dispatching {@link NavigateEvent} and {@link NavigatedEvent}.
|
|
38
|
-
* Allows other modules to listen for and react to navigation changes.
|
|
39
|
-
*/
|
|
40
|
-
eventProvider?: IEventModuleProvider;
|
|
41
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { of, from, type ObservableInput } from 'rxjs';
|
|
3
|
-
import { map } from 'rxjs/operators';
|
|
4
|
-
import {
|
|
5
|
-
BaseConfigBuilder,
|
|
6
|
-
type ModulesInstance,
|
|
7
|
-
type ConfigBuilderCallback,
|
|
8
|
-
type ConfigBuilderCallbackArgs,
|
|
9
|
-
} from '@equinor/fusion-framework-module';
|
|
10
|
-
import type { ITelemetryProvider } from '@equinor/fusion-framework-module-telemetry';
|
|
11
|
-
import type { IEventModuleProvider } from '@equinor/fusion-framework-module-event';
|
|
12
|
-
import type { INavigationConfigurator } from './NavigationConfigurator.interface';
|
|
13
|
-
|
|
14
|
-
import type { History } from './lib/types';
|
|
15
|
-
import { createHistory } from './lib/create-history';
|
|
16
|
-
import { ProxyHistory } from './lib/ProxyHistory';
|
|
17
|
-
import type { NavigationModule } from './module';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Zod schema for navigation module configuration validation.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
const navigationConfigSchema = z
|
|
25
|
-
.object({
|
|
26
|
-
basename: z
|
|
27
|
-
.string()
|
|
28
|
-
.optional()
|
|
29
|
-
.describe(
|
|
30
|
-
'Base pathname for the application (e.g., "/app"). Must match the URL path prefix where your app is served. The router requires the pathname to start with this basename.',
|
|
31
|
-
),
|
|
32
|
-
history: z
|
|
33
|
-
.custom<History>()
|
|
34
|
-
.describe(
|
|
35
|
-
'Custom history instance implementing the History interface. Defaults to browser history if not provided. Use createHistory("browser"|"hash"|"memory") to create instances.',
|
|
36
|
-
),
|
|
37
|
-
telemetry: z
|
|
38
|
-
.custom<ITelemetryProvider>()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe(
|
|
41
|
-
'Telemetry provider for tracking navigation events. Used to log navigation actions, location changes, and errors for monitoring and debugging.',
|
|
42
|
-
),
|
|
43
|
-
eventProvider: z
|
|
44
|
-
.custom<IEventModuleProvider>()
|
|
45
|
-
.optional()
|
|
46
|
-
.describe(
|
|
47
|
-
'Event provider for dispatching navigation events (NavigateEvent, NavigatedEvent). Allows other modules to listen for navigation changes and block navigation attempts.',
|
|
48
|
-
),
|
|
49
|
-
})
|
|
50
|
-
.describe(
|
|
51
|
-
'Validates navigation module configuration settings for routing and navigation capabilities.',
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Parses and validates a navigation configuration object.
|
|
56
|
-
*
|
|
57
|
-
* @param config - The configuration object to parse
|
|
58
|
-
* @returns Validated navigation configuration
|
|
59
|
-
* @throws {z.ZodError} If the configuration is invalid
|
|
60
|
-
*/
|
|
61
|
-
const parseNavigationConfig = (config: unknown): INavigationConfigurator => {
|
|
62
|
-
return navigationConfigSchema.parse(config);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Configurator class for navigation module settings.
|
|
67
|
-
* Extends BaseConfigBuilder to provide fluent configuration API with Zod validation.
|
|
68
|
-
*/
|
|
69
|
-
export class NavigationConfigurator extends BaseConfigBuilder<INavigationConfigurator> {
|
|
70
|
-
/** Creates a navigation configurator with default history and event providers. */
|
|
71
|
-
constructor() {
|
|
72
|
-
super();
|
|
73
|
-
this.setEventProvider(async (args) => {
|
|
74
|
-
// Only resolve the optional provider when the event module participates in this framework.
|
|
75
|
-
if (args.hasModule('event')) {
|
|
76
|
-
return await args.requireInstance('event');
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
this.setHistory(
|
|
80
|
-
async (args) => {
|
|
81
|
-
const history = (args.ref as ModulesInstance<[NavigationModule]>)?.navigation?.history;
|
|
82
|
-
// Wrap supplied history so the module owns only the proxy lifecycle.
|
|
83
|
-
if (history) {
|
|
84
|
-
// Wrap the provided history in a ProxyHistory to ensure the module can manage its own teardowns without affecting the original instance.
|
|
85
|
-
return new ProxyHistory(history);
|
|
86
|
-
}
|
|
87
|
-
// Prefer browser history when a DOM is available, otherwise use memory history for SSR.
|
|
88
|
-
if (typeof window !== 'undefined') {
|
|
89
|
-
return createHistory('browser');
|
|
90
|
-
}
|
|
91
|
-
return createHistory('memory');
|
|
92
|
-
},
|
|
93
|
-
// Don't wrap the default history in a ProxyHistory since it's already owned by the module and will be properly disposed.
|
|
94
|
-
{ proxy: false },
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Use `setBasename()` method instead
|
|
99
|
-
* @param value - Deprecated basename value to configure.
|
|
100
|
-
*/
|
|
101
|
-
public set basename(value: string | undefined) {
|
|
102
|
-
// Warn only during development so deprecated setters remain silent in production.
|
|
103
|
-
if (process.env.NODE_ENV === 'development') {
|
|
104
|
-
console.warn('NavigationConfigurator.basename', 'use setBasename() method instead');
|
|
105
|
-
}
|
|
106
|
-
this.setBasename(value);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated Use `setHistory()` method instead
|
|
111
|
-
* @param value - Deprecated history value to configure.
|
|
112
|
-
*/
|
|
113
|
-
public set history(value: History | undefined) {
|
|
114
|
-
// Warn only during development so deprecated setters remain silent in production.
|
|
115
|
-
if (process.env.NODE_ENV === 'development') {
|
|
116
|
-
console.warn('NavigationConfigurator.history', 'use setHistory() method instead');
|
|
117
|
-
}
|
|
118
|
-
this.setHistory(value);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Sets the basename for the application.
|
|
123
|
-
*
|
|
124
|
-
* @param basenameOrCallback - Basename string or configuration callback
|
|
125
|
-
* @returns The configurator instance for method chaining
|
|
126
|
-
*/
|
|
127
|
-
public setBasename(basenameOrCallback?: string | ConfigBuilderCallback<string>): this {
|
|
128
|
-
const fn =
|
|
129
|
-
typeof basenameOrCallback === 'function'
|
|
130
|
-
? basenameOrCallback
|
|
131
|
-
: async () => basenameOrCallback;
|
|
132
|
-
this._set('basename', fn);
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Sets a custom history instance for the navigation module.
|
|
138
|
-
*
|
|
139
|
-
* By default the resolved history is wrapped in a {@link ProxyHistory} so the
|
|
140
|
-
* module gets its own disposable handle without owning (or accidentally
|
|
141
|
-
* disposing) the original instance. Set `proxy` to `false` to use the
|
|
142
|
-
* history as-is.
|
|
143
|
-
*
|
|
144
|
-
* @param historyOrCallback - History instance or configuration callback
|
|
145
|
-
* @param options - Optional settings for history wrapping
|
|
146
|
-
* @param options.proxy - Wrap the history in a {@link ProxyHistory} (default: `true`)
|
|
147
|
-
* @returns The configurator instance for method chaining
|
|
148
|
-
*/
|
|
149
|
-
public setHistory(
|
|
150
|
-
historyOrCallback?: History | ConfigBuilderCallback<History>,
|
|
151
|
-
options?: { proxy?: boolean },
|
|
152
|
-
): this {
|
|
153
|
-
const { proxy = true } = options ?? {};
|
|
154
|
-
const resolve =
|
|
155
|
-
typeof historyOrCallback === 'function'
|
|
156
|
-
? historyOrCallback
|
|
157
|
-
: // Normalize a direct instance to a callback for consistent handling.
|
|
158
|
-
async () => historyOrCallback;
|
|
159
|
-
|
|
160
|
-
// Proxying isolates teardown ownership when callers provide an existing history instance.
|
|
161
|
-
if (proxy) {
|
|
162
|
-
// Wrap each emitted history in a ProxyHistory so dispose only tears down
|
|
163
|
-
// proxy-owned listeners/blockers, never the underlying history itself.
|
|
164
|
-
this._set('history', (args) =>
|
|
165
|
-
from(resolve(args) as ObservableInput<History | undefined>)
|
|
166
|
-
// Transform each resolved history into an independently disposable proxy.
|
|
167
|
-
.pipe(map((history) => (history ? new ProxyHistory(history) : undefined))),
|
|
168
|
-
);
|
|
169
|
-
// Direct histories are already owned by the navigation module and can be used unchanged.
|
|
170
|
-
} else {
|
|
171
|
-
this._set('history', resolve);
|
|
172
|
-
}
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Sets telemetry configuration for navigation-specific events.
|
|
178
|
-
*
|
|
179
|
-
* @param telemetryOrCallback - Telemetry provider instance or configuration callback
|
|
180
|
-
* @returns The configurator instance for method chaining
|
|
181
|
-
*/
|
|
182
|
-
public setTelemetry(
|
|
183
|
-
telemetryOrCallback: ITelemetryProvider | ConfigBuilderCallback<ITelemetryProvider>,
|
|
184
|
-
): this {
|
|
185
|
-
const fn =
|
|
186
|
-
typeof telemetryOrCallback === 'function'
|
|
187
|
-
? telemetryOrCallback
|
|
188
|
-
: async () => telemetryOrCallback;
|
|
189
|
-
this._set('telemetry', fn);
|
|
190
|
-
return this;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Sets event provider for dispatching navigation events.
|
|
195
|
-
*
|
|
196
|
-
* @param eventProviderOrCallback - Event provider instance or configuration callback
|
|
197
|
-
* @returns The configurator instance for method chaining
|
|
198
|
-
*/
|
|
199
|
-
public setEventProvider(
|
|
200
|
-
eventProviderOrCallback: IEventModuleProvider | ConfigBuilderCallback<IEventModuleProvider>,
|
|
201
|
-
): this {
|
|
202
|
-
const fn =
|
|
203
|
-
typeof eventProviderOrCallback === 'function'
|
|
204
|
-
? eventProviderOrCallback
|
|
205
|
-
: async () => eventProviderOrCallback;
|
|
206
|
-
this._set('eventProvider', fn);
|
|
207
|
-
return this;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Processes and validates the configuration using Zod schema.
|
|
212
|
-
*
|
|
213
|
-
* @param config - Raw configuration object from builder
|
|
214
|
-
* @param _init - Configuration builder callback arguments (unused)
|
|
215
|
-
* @returns Observable that emits validated and processed configuration object
|
|
216
|
-
* @throws {z.ZodError} If the configuration is invalid
|
|
217
|
-
*
|
|
218
|
-
* @protected
|
|
219
|
-
*/
|
|
220
|
-
protected _processConfig(
|
|
221
|
-
config: Partial<INavigationConfigurator>,
|
|
222
|
-
_init: ConfigBuilderCallbackArgs,
|
|
223
|
-
): ObservableInput<INavigationConfigurator> {
|
|
224
|
-
return of(parseNavigationConfig(config));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// TODO(#5158): Remove @remix-run/router dependency once all apps have migrated to @equinor/fusion-framework-react-router
|
|
2
|
-
import type { AgnosticRouteObject, Router } from '@remix-run/router';
|
|
3
|
-
|
|
4
|
-
import type { History, NavigateOptions } from './lib/types';
|
|
5
|
-
import type { Action, Path, To } from './lib/types';
|
|
6
|
-
|
|
7
|
-
import type { Observable } from 'rxjs';
|
|
8
|
-
import type { IModuleProvider } from '@equinor/fusion-framework-module';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Navigation provider interface.
|
|
12
|
-
*
|
|
13
|
-
* Provides routing and navigation capabilities with automatic basename
|
|
14
|
-
* localization. Consumers work with clean paths (e.g. `/users`) while the
|
|
15
|
-
* underlying history operates on full paths (e.g. `/apps/my-app/users`).
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const nav: INavigationProvider = framework.modules.navigation;
|
|
20
|
-
* nav.push('/users');
|
|
21
|
-
* console.log(nav.path.pathname); // '/users'
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export interface INavigationProvider extends IModuleProvider {
|
|
25
|
-
/**
|
|
26
|
-
* Observable stream of navigation state updates.
|
|
27
|
-
* Emits localized paths (with basename removed) for consumers.
|
|
28
|
-
*/
|
|
29
|
-
readonly state$: Observable<{ action: Action; location: Path }>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Gets the basename.
|
|
33
|
-
*/
|
|
34
|
-
readonly basename: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Gets the current localized path (basename removed).
|
|
38
|
-
*/
|
|
39
|
-
readonly path: Path;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use `history` instead
|
|
43
|
-
*/
|
|
44
|
-
readonly navigator: History;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Gets the history instance.
|
|
48
|
-
*/
|
|
49
|
-
readonly history: History;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Creates a router instance from route configuration.
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Use `@equinor/fusion-framework-react-router` instead.
|
|
55
|
-
* @param routes - Route configuration objects compatible with Remix/React Router
|
|
56
|
-
* @returns A configured and initialized {@link Router} instance with basename applied
|
|
57
|
-
*/
|
|
58
|
-
createRouter(routes: AgnosticRouteObject[]): Router;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Creates a localized href string including the basename prefix.
|
|
62
|
-
*
|
|
63
|
-
* @param to - Path or location to resolve (defaults to current path)
|
|
64
|
-
* @returns Fully-qualified href string with basename included
|
|
65
|
-
*/
|
|
66
|
-
createHref(to?: To): string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Creates a full {@link URL} object including the basename prefix.
|
|
70
|
-
*
|
|
71
|
-
* @param to - Path or location to resolve (defaults to current path)
|
|
72
|
-
* @returns A {@link URL} instance representing the resolved navigation target
|
|
73
|
-
*/
|
|
74
|
-
createURL(to?: To): URL;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Navigates to a location with explicit options.
|
|
78
|
-
*
|
|
79
|
-
* @param to - Optional path or location (defaults to current path)
|
|
80
|
-
* @param options - Optional navigation options
|
|
81
|
-
*/
|
|
82
|
-
navigate(to?: To, options?: Partial<NavigateOptions>): void;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Pushes a new navigation entry onto the history stack.
|
|
86
|
-
*
|
|
87
|
-
* @param to - Path or location to navigate to (relative to basename)
|
|
88
|
-
* @param state - Optional state to associate with the navigation
|
|
89
|
-
*/
|
|
90
|
-
push(to: To, state?: unknown): void;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Replaces the current history entry with a new one.
|
|
94
|
-
*
|
|
95
|
-
* @param to - Path or location to navigate to (relative to basename)
|
|
96
|
-
* @param state - Optional state to associate with the navigation
|
|
97
|
-
*/
|
|
98
|
-
replace(to: To, state?: unknown): void;
|
|
99
|
-
}
|