@mmstack/router-core 19.3.11 → 20.0.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/fesm2022/mmstack-router-core.mjs +32 -23
- package/fesm2022/mmstack-router-core.mjs.map +1 -1
- package/index.d.ts +404 -6
- package/package.json +5 -4
- package/lib/breadcrumb/breadcrumb.config.d.ts +0 -73
- package/lib/breadcrumb/breadcrumb.resolver.d.ts +0 -58
- package/lib/breadcrumb/breadcrumb.store.d.ts +0 -44
- package/lib/breadcrumb/breadcrumb.type.d.ts +0 -57
- package/lib/breadcrumb/public_api.d.ts +0 -4
- package/lib/link.directive.d.ts +0 -51
- package/lib/preloading/index.d.ts +0 -2
- package/lib/preloading/preload.service.d.ts +0 -8
- package/lib/preloading/preload.strategy.d.ts +0 -11
- package/lib/preloading/public_api.d.ts +0 -1
- package/lib/query-param.d.ts +0 -78
- package/lib/title/public_api.d.ts +0 -2
- package/lib/title/title.config.d.ts +0 -31
- package/lib/title/title.store.d.ts +0 -23
- package/lib/url.d.ts +0 -32
- package/lib/util/create-route-predicate.d.ts +0 -1
- package/lib/util/find-path.d.ts +0 -2
- package/lib/util/index.d.ts +0 -4
- package/lib/util/leaf.store.d.ts +0 -21
- package/lib/util/snapshot-path.d.ts +0 -2
package/lib/link.directive.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@angular/core';
|
|
2
|
-
import { type ActivatedRoute, type Params, UrlTree } from '@angular/router';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@angular/router";
|
|
5
|
-
export declare function injectTriggerPreload(): (link: string | any[] | UrlTree | null, relativeTo?: ActivatedRoute, queryParams?: Params, fragment?: string, queryParamsHandling?: "merge" | "preserve" | "") => void;
|
|
6
|
-
/**
|
|
7
|
-
* Configuration for the `mmLink` directive.
|
|
8
|
-
*/
|
|
9
|
-
type MMLinkConfig = {
|
|
10
|
-
/**
|
|
11
|
-
* The default preload behavior for links.
|
|
12
|
-
* Can be 'hover', 'visible', or null (no preloading).
|
|
13
|
-
* @default 'hover'
|
|
14
|
-
*/
|
|
15
|
-
preloadOn: 'hover' | 'visible' | null;
|
|
16
|
-
/**
|
|
17
|
-
* Whether to use mouse down events for preloading.
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
useMouseDown: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare function provideMMLinkDefaultConfig(config: Partial<MMLinkConfig>): Provider;
|
|
23
|
-
export declare class LinkDirective {
|
|
24
|
-
private readonly routerLink;
|
|
25
|
-
private readonly svc;
|
|
26
|
-
private readonly router;
|
|
27
|
-
readonly target: import("@angular/core").InputSignal<string | undefined>;
|
|
28
|
-
readonly queryParams: import("@angular/core").InputSignal<Params | undefined>;
|
|
29
|
-
readonly fragment: import("@angular/core").InputSignal<string | undefined>;
|
|
30
|
-
readonly queryParamsHandling: import("@angular/core").InputSignal<"" | "merge" | "preserve" | undefined>;
|
|
31
|
-
readonly state: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
32
|
-
readonly info: import("@angular/core").InputSignal<unknown>;
|
|
33
|
-
readonly relativeTo: import("@angular/core").InputSignal<ActivatedRoute | undefined>;
|
|
34
|
-
readonly skipLocationChange: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
35
|
-
readonly replaceUrl: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
36
|
-
readonly mmLink: import("@angular/core").InputSignal<string | any[] | UrlTree | null>;
|
|
37
|
-
readonly preloadOn: import("@angular/core").InputSignal<"hover" | "visible" | null>;
|
|
38
|
-
readonly useMouseDown: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
39
|
-
readonly preloading: import("@angular/core").OutputEmitterRef<void>;
|
|
40
|
-
private readonly urlTree;
|
|
41
|
-
private readonly fullPath;
|
|
42
|
-
onHover(): void;
|
|
43
|
-
onMouseDown(button: number, ctrlKey: boolean, shiftKey: boolean, altKey: boolean, metaKey: boolean): boolean | undefined;
|
|
44
|
-
onClick(button: number, ctrlKey: boolean, shiftKey: boolean, altKey: boolean, metaKey: boolean): boolean | undefined;
|
|
45
|
-
constructor();
|
|
46
|
-
private requestPreload;
|
|
47
|
-
private trigger;
|
|
48
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LinkDirective, never>;
|
|
49
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkDirective, "[mmLink]", ["mmLink"], { "target": { "alias": "target"; "required": false; "isSignal": true; }; "queryParams": { "alias": "queryParams"; "required": false; "isSignal": true; }; "fragment": { "alias": "fragment"; "required": false; "isSignal": true; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "info": { "alias": "info"; "required": false; "isSignal": true; }; "relativeTo": { "alias": "relativeTo"; "required": false; "isSignal": true; }; "skipLocationChange": { "alias": "skipLocationChange"; "required": false; "isSignal": true; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; "isSignal": true; }; "mmLink": { "alias": "mmLink"; "required": false; "isSignal": true; }; "preloadOn": { "alias": "preloadOn"; "required": false; "isSignal": true; }; "useMouseDown": { "alias": "useMouseDown"; "required": false; "isSignal": true; }; }, { "preloading": "preloading"; }, never, never, true, [{ directive: typeof i1.RouterLink; inputs: { "routerLink": "mmLink"; "target": "target"; "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "state": "state"; "relativeTo": "relativeTo"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; }; outputs: {}; }]>;
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
export declare class PreloadService {
|
|
3
|
-
private readonly preloadOnDemand$;
|
|
4
|
-
readonly preloadRequested$: import("rxjs").Observable<string>;
|
|
5
|
-
startPreload(routePath: string): void;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PreloadService, never>;
|
|
7
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<PreloadService>;
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PreloadingStrategy, type Route } from '@angular/router';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class PreloadStrategy implements PreloadingStrategy {
|
|
5
|
-
private readonly loading;
|
|
6
|
-
private readonly router;
|
|
7
|
-
private readonly svc;
|
|
8
|
-
preload(route: Route, load: () => Observable<any>): Observable<any>;
|
|
9
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PreloadStrategy, never>;
|
|
10
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<PreloadStrategy>;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { PreloadStrategy } from './preload.strategy';
|
package/lib/query-param.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { type WritableSignal } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a WritableSignal that synchronizes with a specific URL query parameter,
|
|
4
|
-
* enabling two-way binding between the signal's state and the URL.
|
|
5
|
-
*
|
|
6
|
-
* Reading the signal provides the current value of the query parameter (or null if absent).
|
|
7
|
-
* Setting the signal updates the URL query parameter using `Router.navigate`, triggering
|
|
8
|
-
* navigation and causing the signal to update reactively if the navigation is successful.
|
|
9
|
-
*
|
|
10
|
-
* @param key The key of the query parameter to synchronize with.
|
|
11
|
-
* Can be a static string (e.g., `'search'`) or a function/signal returning a string
|
|
12
|
-
* for dynamic keys (e.g., `() => this.userId() + '_filter'` or `computed(() => this.category() + '_sort')`).
|
|
13
|
-
* The signal will reactively update if the key returned by the function/signal changes.
|
|
14
|
-
* @returns {WritableSignal<string | null>} A signal representing the query parameter's value.
|
|
15
|
-
* - Reading returns the current value string, or `null` if the parameter is absent in the URL.
|
|
16
|
-
* - Setting the signal to a string updates the query parameter in the URL (e.g., `signal.set('value')` results in `?key=value`).
|
|
17
|
-
* - Setting the signal to `null` removes the query parameter from the URL (e.g., `signal.set(null)` results in `?otherParam=...`).
|
|
18
|
-
* - Automatically reflects changes if the query parameters update due to external navigation.
|
|
19
|
-
* @remarks
|
|
20
|
-
* - Requires Angular's `ActivatedRoute` and `Router` to be available in the injection context.
|
|
21
|
-
* - Uses `Router.navigate` with `queryParamsHandling: 'merge'` to preserve other existing query parameters during updates.
|
|
22
|
-
* - Handles dynamic keys reactively. If the result of the `key` function/signal changes, the signal will start reflecting the value of the *new* query parameter key.
|
|
23
|
-
* - During Server-Side Rendering (SSR), it reads the initial value from the route snapshot. Write operations (`set`) might have limited or no effect on the server depending on the platform configuration.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* import { Component, computed, effect, signal } from '@angular/core';
|
|
28
|
-
* import { queryParam } from '@mmstack/router-core'; // Adjust import path as needed
|
|
29
|
-
* // import { FormsModule } from '@angular/forms'; // If using ngModel
|
|
30
|
-
*
|
|
31
|
-
* @Component({
|
|
32
|
-
* selector: 'app-product-list',
|
|
33
|
-
* standalone: true,
|
|
34
|
-
* // imports: [FormsModule], // If using ngModel
|
|
35
|
-
* template: `
|
|
36
|
-
* <div>
|
|
37
|
-
* Sort By:
|
|
38
|
-
* <select [value]="sortSignal() ?? ''" (change)="sortSignal.set($any($event.target).value || null)">
|
|
39
|
-
* <option value="">Default</option>
|
|
40
|
-
* <option value="price_asc">Price Asc</option>
|
|
41
|
-
* <option value="price_desc">Price Desc</option>
|
|
42
|
-
* <option value="name">Name</option>
|
|
43
|
-
* </select>
|
|
44
|
-
* <button (click)="sortSignal.set(null)" [disabled]="!sortSignal()">Clear Sort</button>
|
|
45
|
-
* </div>
|
|
46
|
-
* <div>
|
|
47
|
-
* Page:
|
|
48
|
-
* <input type="number" min="1" [value]="pageSignal() ?? '1'" #p (input)="setPage(p.value)"/>
|
|
49
|
-
* </div>
|
|
50
|
-
* * `
|
|
51
|
-
* })
|
|
52
|
-
* export class ProductListComponent {
|
|
53
|
-
* // Two-way bind the 'sort' query parameter (?sort=...)
|
|
54
|
-
* // Defaults to null if param is missing
|
|
55
|
-
* sortSignal = queryParam('sort');
|
|
56
|
-
*
|
|
57
|
-
* // Example with a different type (needs serialization or separate logic)
|
|
58
|
-
* // For simplicity, we treat page as string | null here
|
|
59
|
-
* pageSignal = queryParam('page');
|
|
60
|
-
*
|
|
61
|
-
* constructor() {
|
|
62
|
-
* effect(() => {
|
|
63
|
-
* const currentSort = this.sortSignal();
|
|
64
|
-
* const currentPage = this.pageSignal(); // Read as string | null
|
|
65
|
-
* console.log('Sort/Page changed, reloading products for:', { sort: currentSort, page: currentPage });
|
|
66
|
-
* // --- Fetch data based on currentSort and currentPage ---
|
|
67
|
-
* });
|
|
68
|
-
* }
|
|
69
|
-
*
|
|
70
|
-
* setPage(value: string): void {
|
|
71
|
-
* const pageNum = parseInt(value, 10);
|
|
72
|
-
* // Set to null if page is 1 (to remove param), otherwise set string value
|
|
73
|
-
* this.pageSignal.set(isNaN(pageNum) || pageNum <= 1 ? null : pageNum.toString());
|
|
74
|
-
* }
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare function queryParam(key: string | (() => string)): WritableSignal<string | null>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Title configuration interface.
|
|
4
|
-
* Defines how createTitle should behave
|
|
5
|
-
* @see {createTitle}
|
|
6
|
-
*/
|
|
7
|
-
export type TitleConfig = {
|
|
8
|
-
/**
|
|
9
|
-
* The title to be used when no title is set.
|
|
10
|
-
* If not provided it defaults to an empty string
|
|
11
|
-
* @default ''
|
|
12
|
-
*/
|
|
13
|
-
prefix?: string | ((title: string) => string);
|
|
14
|
-
/**
|
|
15
|
-
* if false, the title will change to the url, otherwise default to true as that is standard behavior
|
|
16
|
-
* @default true
|
|
17
|
-
*/
|
|
18
|
-
keepLastKnownTitle?: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export type InternalTitleConfig = {
|
|
24
|
-
parser: (title: string) => string;
|
|
25
|
-
keepLastKnown: boolean;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* used to provide the title configuration, will not be applied unless a `createTitle` resolver is used
|
|
29
|
-
*/
|
|
30
|
-
export declare function provideTitleConfig(config?: TitleConfig): Provider;
|
|
31
|
-
export declare function injectTitleConfig(): InternalTitleConfig;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import { ResolveFn } from '@angular/router';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class TitleStore {
|
|
5
|
-
private readonly title;
|
|
6
|
-
private readonly map;
|
|
7
|
-
private readonly leafRoutes;
|
|
8
|
-
constructor();
|
|
9
|
-
register(id: string, titleFn: Signal<string>): void;
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TitleStore, never>;
|
|
11
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<TitleStore>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* Creates a title resolver function that can be used in Angular's router.
|
|
16
|
-
*
|
|
17
|
-
* @param fn
|
|
18
|
-
* A function that returns a string or a Signal<string> representing the title.
|
|
19
|
-
* @param awaitValue
|
|
20
|
-
* If `true`, the resolver will wait until the title signal has a value before resolving.
|
|
21
|
-
* Defaults to `false`.
|
|
22
|
-
*/
|
|
23
|
-
export declare function createTitle(fn: () => string | (() => string), awaitValue?: boolean): ResolveFn<string>;
|
package/lib/url.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type Signal } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a Signal that tracks the current router URL.
|
|
4
|
-
*
|
|
5
|
-
* The signal emits the URL string reflecting the router state *after* redirects
|
|
6
|
-
* have completed for each successful navigation. It initializes with the router's
|
|
7
|
-
* current URL state.
|
|
8
|
-
*
|
|
9
|
-
* @returns {Signal<string>} A Signal emitting the `urlAfterRedirects` upon successful navigation.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { Component, effect } from '@angular/core';
|
|
14
|
-
* import { url } from '@mmstack/router-core'; // Adjust import path
|
|
15
|
-
*
|
|
16
|
-
* @Component({
|
|
17
|
-
* selector: 'app-root',
|
|
18
|
-
* template: `Current URL: {{ currentUrl() }}`
|
|
19
|
-
* })
|
|
20
|
-
* export class AppComponent {
|
|
21
|
-
* currentUrl = url();
|
|
22
|
-
*
|
|
23
|
-
* constructor() {
|
|
24
|
-
* effect(() => {
|
|
25
|
-
* console.log('Navigation ended. New URL:', this.currentUrl());
|
|
26
|
-
* // e.g., track page view with analytics
|
|
27
|
-
* });
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function url(): Signal<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createRoutePredicate(path: string): (linkPath: string) => boolean;
|
package/lib/util/find-path.d.ts
DELETED
package/lib/util/index.d.ts
DELETED
package/lib/util/leaf.store.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export type ResolvedLeafRoute = {
|
|
8
|
-
route: ActivatedRouteSnapshot;
|
|
9
|
-
segment: {
|
|
10
|
-
path: string;
|
|
11
|
-
resolved: string;
|
|
12
|
-
};
|
|
13
|
-
path: string;
|
|
14
|
-
link: string;
|
|
15
|
-
};
|
|
16
|
-
export declare class RouteLeafStore {
|
|
17
|
-
readonly leaves: Signal<ResolvedLeafRoute[]>;
|
|
18
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RouteLeafStore, never>;
|
|
19
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<RouteLeafStore>;
|
|
20
|
-
}
|
|
21
|
-
export declare function injectLeafRoutes(): Signal<ResolvedLeafRoute[]>;
|