@loozo/angular-router 0.0.5 → 0.0.7
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/README.md +30 -8
- package/fesm2022/loozo-angular-router-_core.mjs +2 -2
- package/fesm2022/loozo-angular-router-_core.mjs.map +1 -1
- package/fesm2022/loozo-angular-router-_generated.mjs +1 -1
- package/fesm2022/loozo-angular-router-_generated.mjs.map +1 -1
- package/node/src/builders/application.js +17 -0
- package/node/src/generation/emit.js +38 -26
- package/node/src/generation/selectors.d.ts +1 -1
- package/node/src/generation/selectors.js +14 -49
- package/package.json +1 -1
- package/schemas/application.json +2 -1
- package/snippets/generated/destinations.generated.ts +50 -105
- package/snippets/generated/routes.generated.ts +4 -4
- package/snippets/src/routes/products/$productId/route.generated.ts +1 -1
- package/snippets/src/routes/reports/$reportId/route.generated.ts +1 -1
- package/snippets/src/routes/teams/$teamId/items/$id/links.ts +1 -1
- package/snippets/src/routes/teams/$teamId/items/$id/route.generated.ts +1 -1
- package/snippets/src/routes/teams/$teamId/members/$memberId/route.generated.ts +1 -1
- package/snippets/src/routes/teams/$teamId/route.generated.ts +1 -1
- package/types/loozo-angular-router-_core.d.ts +3 -2
- package/types/loozo-angular-router-_generated.d.ts +32 -13
|
@@ -9,7 +9,7 @@ interface RouteSet {
|
|
|
9
9
|
readonly records: Readonly<Record<string, RecordBinding>>;
|
|
10
10
|
readonly destinations: Readonly<Record<string, () => AnyRoute>>;
|
|
11
11
|
readonly absolute: Readonly<Record<string, string>>;
|
|
12
|
-
readonly
|
|
12
|
+
readonly parents: Readonly<Record<string, string>>;
|
|
13
13
|
}
|
|
14
14
|
interface Parsed {
|
|
15
15
|
readonly params: Readonly<Record<string, unknown>>;
|
|
@@ -106,14 +106,15 @@ type IsUnion<Value, Whole = Value> = Value extends unknown ? [Whole] extends [Va
|
|
|
106
106
|
* rejects a value it accepted while matching, a programming error.
|
|
107
107
|
*
|
|
108
108
|
* Selectors are single known authored literals, not concrete URLs or string
|
|
109
|
-
* unions. `.` is exact-current;
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
109
|
+
* unions. `.` is exact-current; `..` selects the parent route: the nearest
|
|
110
|
+
* ancestor with a shorter path, or the root for a top-level route. It and
|
|
111
|
+
* absolute selectors use generated canonical targets. Every call supplies all
|
|
112
|
+
* target values; there is no current-value reuse, extras argument or implicit
|
|
113
|
+
* query merge.
|
|
114
114
|
*
|
|
115
115
|
* @typeParam Target - The bound declaration's schema.
|
|
116
|
-
* @typeParam
|
|
116
|
+
* @typeParam Absolute - Absolute literal selectors and their target schemas.
|
|
117
|
+
* @typeParam Parent - The `..` target's schema, or never when there is none.
|
|
117
118
|
* @typeParam Set - The generator's nominal route-set identity.
|
|
118
119
|
* @typeParam References - Exact declarations addressable by same-set references.
|
|
119
120
|
*
|
|
@@ -127,7 +128,7 @@ type IsUnion<Value, Whole = Value> = Value extends unknown ? [Whole] extends [Va
|
|
|
127
128
|
* // Bind link to Angular RouterLink, or call route.navigate with the same values.
|
|
128
129
|
* ```
|
|
129
130
|
*/
|
|
130
|
-
export interface Handle<Target extends AnyRoute,
|
|
131
|
+
export interface Handle<Target extends AnyRoute, Absolute extends Record<string, AnyRoute> = {}, Parent extends AnyRoute = never, Set = unknown, References extends Record<string, AnyRoute> = {}> {
|
|
131
132
|
/** Effective positional params of the committed snapshot; kept while a navigation is pending. */
|
|
132
133
|
readonly params: Signal<Readonly<ParamsOf<Target>>>;
|
|
133
134
|
/** Effective declared search, from the same snapshot as params; absent keys have no value or fallback. */
|
|
@@ -152,14 +153,23 @@ export interface Handle<Target extends AnyRoute, Selected extends Record<string,
|
|
|
152
153
|
*/
|
|
153
154
|
link<Keys extends keyof SearchOf<Target> = never>(selector: ".", values: UrlValues<Target, Keys>): UrlTree;
|
|
154
155
|
/**
|
|
155
|
-
* Creates a UrlTree for a statically admitted absolute
|
|
156
|
+
* Creates a UrlTree for a statically admitted absolute authored selector.
|
|
156
157
|
*
|
|
157
158
|
* @param selector - A single known template literal, never a concrete URL.
|
|
158
159
|
* @param values - The selected target's complete explicit values.
|
|
159
160
|
* @returns Router.parseUrl's result without navigating.
|
|
160
161
|
* @throws Synchronously for unknown selectors or invalid URL values.
|
|
161
162
|
*/
|
|
162
|
-
link<const Selector extends keyof
|
|
163
|
+
link<const Selector extends keyof Absolute & string, Keys extends keyof SearchOf<NoInfer<Absolute[Selector]>> = never>(selector: Selector & (IsUnion<Selector> extends true ? never : unknown), values: UrlValues<NoInfer<Absolute[Selector]>, Keys>): UrlTree;
|
|
164
|
+
/**
|
|
165
|
+
* Creates a UrlTree for the parent route, when the bound declaration has one.
|
|
166
|
+
*
|
|
167
|
+
* @param selector - The literal `..`.
|
|
168
|
+
* @param values - The parent route's complete explicit values.
|
|
169
|
+
* @returns Router.parseUrl's result without navigating.
|
|
170
|
+
* @throws Synchronously for invalid URL values.
|
|
171
|
+
*/
|
|
172
|
+
link<Keys extends keyof SearchOf<Parent> = never>(selector: [Parent] extends [never] ? never : "..", values: UrlValues<Parent, Keys>): UrlTree;
|
|
163
173
|
/**
|
|
164
174
|
* Creates a UrlTree for a generated reference's own exact declaration.
|
|
165
175
|
*
|
|
@@ -187,14 +197,23 @@ export interface Handle<Target extends AnyRoute, Selected extends Record<string,
|
|
|
187
197
|
*/
|
|
188
198
|
navigate<Keys extends keyof SearchOf<Target> = never>(selector: ".", values: UrlValues<Target, Keys>): Promise<boolean>;
|
|
189
199
|
/**
|
|
190
|
-
* Navigates to a statically admitted absolute
|
|
200
|
+
* Navigates to a statically admitted absolute authored selector.
|
|
191
201
|
*
|
|
192
202
|
* @param selector - A single known template literal, never a concrete URL.
|
|
193
203
|
* @param values - The selected target's complete explicit values.
|
|
194
204
|
* @returns Angular's identical Router.navigateByUrl Promise.
|
|
195
205
|
* @throws Synchronously for unknown selectors or invalid URL values.
|
|
196
206
|
*/
|
|
197
|
-
navigate<const Selector extends keyof
|
|
207
|
+
navigate<const Selector extends keyof Absolute & string, Keys extends keyof SearchOf<NoInfer<Absolute[Selector]>> = never>(selector: Selector & (IsUnion<Selector> extends true ? never : unknown), values: UrlValues<NoInfer<Absolute[Selector]>, Keys>): Promise<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* Navigates to the parent route, when the bound declaration has one.
|
|
210
|
+
*
|
|
211
|
+
* @param selector - The literal `..`.
|
|
212
|
+
* @param values - The parent route's complete explicit values.
|
|
213
|
+
* @returns Angular's identical Router.navigateByUrl Promise.
|
|
214
|
+
* @throws Synchronously for invalid URL values.
|
|
215
|
+
*/
|
|
216
|
+
navigate<Keys extends keyof SearchOf<Parent> = never>(selector: [Parent] extends [never] ? never : "..", values: UrlValues<Parent, Keys>): Promise<boolean>;
|
|
198
217
|
/**
|
|
199
218
|
* Navigates to a generated reference's own exact declaration.
|
|
200
219
|
*
|
|
@@ -206,5 +225,5 @@ export interface Handle<Target extends AnyRoute, Selected extends Record<string,
|
|
|
206
225
|
navigate<const Id extends keyof References & string, Keys extends keyof SearchOf<NoInfer<References[Id]>> = never>(selector: Destination<NoInfer<References[Id]>, Set, Id> & (IsUnion<Id> extends true ? never : unknown), values: UrlValues<NoInfer<References[Id]>, Keys>): Promise<boolean>;
|
|
207
226
|
}
|
|
208
227
|
export declare function nativeOptions(definition: AnyRoute): Record<string, unknown>;
|
|
209
|
-
export declare function injectGeneratedRoute<Target extends AnyRoute,
|
|
228
|
+
export declare function injectGeneratedRoute<Target extends AnyRoute, Absolute extends Record<string, AnyRoute>, Parent extends AnyRoute, Set, References extends Record<string, AnyRoute>>(set: RouteSet, id: string): Handle<Target, Absolute, Parent, Set, References>;
|
|
210
229
|
export type { RecordBinding, RouteSet };
|