@loozo/angular-router 0.0.6 → 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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { dirname, relative, resolve, sep } from "node:path";
|
|
1
|
+
import { dirname, extname, relative, resolve, sep } from "node:path";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
import { markers } from "./files.js";
|
|
4
4
|
import { resolveModule } from "./sources.js";
|
|
5
5
|
import { authoredPath } from "./validate.js";
|
|
6
|
-
import {
|
|
6
|
+
import { parentTargets } from "./selectors.js";
|
|
7
7
|
export function specifier(from, file) {
|
|
8
8
|
let name = relative(dirname(from), file).split(sep).join("/").replace(/\.ts$/, ".js");
|
|
9
9
|
if (!name.startsWith(".")) {
|
|
@@ -41,8 +41,20 @@ export function emit(sources, selected) {
|
|
|
41
41
|
const routesFile = resolve(sources.output, "routes.generated.ts");
|
|
42
42
|
const sharedFile = resolve(sources.output, "destinations.generated.ts");
|
|
43
43
|
const names = new Map();
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const taken = new Set();
|
|
45
|
+
const byId = [...declarations].sort((a, b) => a.id.localeCompare(b.id, "en"));
|
|
46
|
+
// Path-derived bindings, so adding or removing a declaration doesn't rename the others.
|
|
47
|
+
// Sanitized paths that collide take numeric suffixes in id order.
|
|
48
|
+
for (const declaration of byId) {
|
|
49
|
+
const local = relative(sources.roots[0], declaration.file).split(sep).join("/");
|
|
50
|
+
const stem = local.slice(0, local.length - extname(local).length);
|
|
51
|
+
const base = `definition_${stem.replace(/[^A-Za-z0-9_$]/g, "_")}`;
|
|
52
|
+
let name = base;
|
|
53
|
+
for (let suffix = 2; taken.has(name); suffix += 1) {
|
|
54
|
+
name = `${base}_${suffix}`;
|
|
55
|
+
}
|
|
56
|
+
taken.add(name);
|
|
57
|
+
names.set(declaration, name);
|
|
46
58
|
}
|
|
47
59
|
const routes = [
|
|
48
60
|
markers["routes.generated.ts"],
|
|
@@ -210,25 +222,24 @@ export const routes: Routes = [${[...before, ...ordinary, ...after].map(record).
|
|
|
210
222
|
for (const [path, declaration] of selected) {
|
|
211
223
|
shared.push(`${JSON.stringify(path)}: ${JSON.stringify(declaration.id)};`);
|
|
212
224
|
}
|
|
213
|
-
const
|
|
214
|
-
shared.push("};\nexport type
|
|
215
|
-
for (const [id,
|
|
216
|
-
shared.push(`${JSON.stringify(id)}: {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
shared.push(
|
|
225
|
+
const parents = parentTargets(sources, selected);
|
|
226
|
+
shared.push("};\nexport type Parents = {");
|
|
227
|
+
for (const [id, target] of parents) {
|
|
228
|
+
shared.push(`${JSON.stringify(id)}: ${JSON.stringify(target)};`);
|
|
229
|
+
}
|
|
230
|
+
shared.push("};\n/** Declarations with a colocated facade. */\nexport type Retained =");
|
|
231
|
+
for (const declaration of retained) {
|
|
232
|
+
shared.push(`| ${JSON.stringify(declaration.id)}`);
|
|
221
233
|
}
|
|
222
|
-
shared.push(
|
|
223
|
-
export type
|
|
224
|
-
readonly [Expression in keyof AbsoluteTargets
|
|
225
|
-
Definitions[(Expression extends keyof AbsoluteTargets ? AbsoluteTargets[Expression] :
|
|
226
|
-
Expression extends keyof RelativeTargets[Id] ? RelativeTargets[Id][Expression] : never) & keyof Definitions];
|
|
234
|
+
shared.push(`;
|
|
235
|
+
export type AbsoluteSelected = {
|
|
236
|
+
readonly [Expression in keyof AbsoluteTargets]: Definitions[AbsoluteTargets[Expression] & keyof Definitions];
|
|
227
237
|
};
|
|
238
|
+
type ParentOf<Id extends Retained> = Id extends keyof Parents ? Definitions[Parents[Id] & keyof Definitions] : never;
|
|
228
239
|
/** A declaration-bound handle; obtain it through its colocated injectRoute facade. */
|
|
229
|
-
export type Handle<Id extends
|
|
240
|
+
export type Handle<Id extends Retained> = GeneratedHandle<Definitions[Id], AbsoluteSelected, ParentOf<Id>, typeof setIdentity, Pick<Definitions, Retained>>;
|
|
230
241
|
/** A same-set nominal reference; use the destination exported by a colocated facade. */
|
|
231
|
-
export type Destination<Id extends
|
|
242
|
+
export type Destination<Id extends Retained> = GeneratedDestination<Definitions[Id], typeof setIdentity, Id>;
|
|
232
243
|
const routeSet: RouteSet = { records: {`);
|
|
233
244
|
for (const declaration of retained) {
|
|
234
245
|
const owners = [];
|
|
@@ -243,15 +254,16 @@ const routeSet: RouteSet = { records: {`);
|
|
|
243
254
|
for (const declaration of declarations) {
|
|
244
255
|
shared.push(`${JSON.stringify(declaration.id)}: () => ${names.get(declaration)},`);
|
|
245
256
|
}
|
|
246
|
-
|
|
247
|
-
|
|
257
|
+
// One entry per line, so adding or removing a destination changes only its own lines.
|
|
258
|
+
shared.push("}, absolute: {");
|
|
248
259
|
for (const [path, declaration] of selected) {
|
|
249
|
-
|
|
260
|
+
shared.push(`${JSON.stringify(path)}: ${JSON.stringify(declaration.id)},`);
|
|
250
261
|
}
|
|
251
|
-
|
|
252
|
-
|
|
262
|
+
shared.push("}, parents: {");
|
|
263
|
+
for (const [id, target] of parents) {
|
|
264
|
+
shared.push(`${JSON.stringify(id)}: ${JSON.stringify(target)},`);
|
|
253
265
|
}
|
|
254
|
-
shared.push(
|
|
266
|
+
shared.push("} };\nexport function getRouteSet(): RouteSet { return routeSet; }\n");
|
|
255
267
|
desired.set(sharedFile, shared.join("\n"));
|
|
256
268
|
for (const declaration of retained) {
|
|
257
269
|
const facade = resolve(dirname(declaration.file), "route.generated.ts");
|
|
@@ -265,7 +277,7 @@ const routeSet: RouteSet = { records: {`);
|
|
|
265
277
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
266
278
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
267
279
|
*/`,
|
|
268
|
-
`export const destination: Destination<${JSON.stringify(declaration.id)}> = createDestination(() => getRouteSet(), ${JSON.stringify(declaration.id)});`,
|
|
280
|
+
`export const destination: Destination<${JSON.stringify(declaration.id)}> = /* @__PURE__ */ createDestination(() => getRouteSet(), ${JSON.stringify(declaration.id)});`,
|
|
269
281
|
`/**
|
|
270
282
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
271
283
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Declaration, Sources } from "./sources.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function parentTargets(sources: Sources, selected: ReadonlyMap<string, Declaration>): Map<string, string>;
|
|
@@ -1,59 +1,24 @@
|
|
|
1
1
|
import { authoredPath } from "./validate.js";
|
|
2
|
-
//
|
|
3
|
-
|
|
2
|
+
// The ".." target of each retained declaration: the canonical destination of its nearest
|
|
3
|
+
// ancestor with a shorter effective path, or of the root path for a top-level route.
|
|
4
|
+
// Pathless ancestors share their child's path, so they are skipped.
|
|
5
|
+
export function parentTargets(sources, selected) {
|
|
4
6
|
const result = new Map();
|
|
5
7
|
for (const origin of sources.declarations) {
|
|
6
|
-
if (!origin.retained) {
|
|
8
|
+
if (!origin.retained || origin.effective.length === 0) {
|
|
7
9
|
continue;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
continue;
|
|
11
|
+
let ancestor = origin.parent;
|
|
12
|
+
while (ancestor && ancestor.effective.length >= origin.effective.length) {
|
|
13
|
+
ancestor = ancestor.parent;
|
|
13
14
|
}
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
let path = "/";
|
|
16
|
+
if (ancestor) {
|
|
17
|
+
path = authoredPath(ancestor);
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for (let index = 0; index < climb; index += 1) {
|
|
22
|
-
steps.push("..");
|
|
23
|
-
}
|
|
24
|
-
for (const [path, target] of selected) {
|
|
25
|
-
let targetParts = [];
|
|
26
|
-
if (target.effective.length > 0) {
|
|
27
|
-
targetParts = path.slice(1).split("/");
|
|
28
|
-
}
|
|
29
|
-
if (prefix.length > targetParts.length) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
let matches = true;
|
|
33
|
-
for (let index = 0; index < prefix.length; index += 1) {
|
|
34
|
-
if (prefix[index] !== targetParts[index]) {
|
|
35
|
-
matches = false;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (!matches) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
const suffix = targetParts.slice(prefix.length);
|
|
43
|
-
if (suffix.some((part) => part.includes("?") || part.includes("#"))) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
let expression = "./";
|
|
47
|
-
if (climb > 0) {
|
|
48
|
-
expression = steps.join("/");
|
|
49
|
-
if (suffix.length === 0) {
|
|
50
|
-
expressions.set(expression, target.id);
|
|
51
|
-
}
|
|
52
|
-
expression += "/";
|
|
53
|
-
}
|
|
54
|
-
expression += suffix.join("/");
|
|
55
|
-
expressions.set(expression, target.id);
|
|
56
|
-
}
|
|
19
|
+
const target = selected.get(path);
|
|
20
|
+
if (target) {
|
|
21
|
+
result.set(origin.id, target.id);
|
|
57
22
|
}
|
|
58
23
|
}
|
|
59
24
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loozo/angular-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Typed route declarations, URLs, navigation and route handles for Angular's native router.",
|
|
5
5
|
"bugs": "https://github.com/theo-matzavinos/loozo/issues",
|
|
6
6
|
"license": "MIT",
|
package/schemas/application.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// @loozo/angular-router routegen: owned destinations.generated.ts
|
|
2
2
|
import type { RouteSet, Handle as GeneratedHandle, Destination as GeneratedDestination } from '@loozo/angular-router/_generated';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import definition_products_$productId_route from "../src/routes/products/$productId/route.js";
|
|
4
|
+
import definition_reports_$reportId_route from "../src/routes/reports/$reportId/route.js";
|
|
5
|
+
import definition_teams_$teamId_items_$id_route from "../src/routes/teams/$teamId/items/$id/route.js";
|
|
6
|
+
import definition_teams_$teamId_members_$memberId_route from "../src/routes/teams/$teamId/members/$memberId/route.js";
|
|
7
|
+
import definition_teams_$teamId_old_items_$id_route from "../src/routes/teams/$teamId/old-items/$id/route.js";
|
|
8
|
+
import definition_teams_$teamId_route from "../src/routes/teams/$teamId/route.js";
|
|
9
9
|
|
|
10
10
|
export type Definitions = {
|
|
11
|
-
"src/routes/products/$productId/route.ts": typeof
|
|
12
|
-
"src/routes/reports/$reportId/route.ts": typeof
|
|
13
|
-
"src/routes/teams/$teamId/items/$id/route.ts": typeof
|
|
14
|
-
"src/routes/teams/$teamId/members/$memberId/route.ts": typeof
|
|
15
|
-
"src/routes/teams/$teamId/old-items/$id/route.ts": typeof
|
|
16
|
-
"src/routes/teams/$teamId/route.ts": typeof
|
|
11
|
+
"src/routes/products/$productId/route.ts": typeof definition_products_$productId_route;
|
|
12
|
+
"src/routes/reports/$reportId/route.ts": typeof definition_reports_$reportId_route;
|
|
13
|
+
"src/routes/teams/$teamId/items/$id/route.ts": typeof definition_teams_$teamId_items_$id_route;
|
|
14
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": typeof definition_teams_$teamId_members_$memberId_route;
|
|
15
|
+
"src/routes/teams/$teamId/old-items/$id/route.ts": typeof definition_teams_$teamId_old_items_$id_route;
|
|
16
|
+
"src/routes/teams/$teamId/route.ts": typeof definition_teams_$teamId_route;
|
|
17
17
|
};
|
|
18
18
|
declare const setIdentity: unique symbol;
|
|
19
19
|
export type AbsoluteTargets = {
|
|
@@ -24,103 +24,48 @@ export type AbsoluteTargets = {
|
|
|
24
24
|
"/teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
25
25
|
"/teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
26
26
|
};
|
|
27
|
-
export type
|
|
28
|
-
"src/routes/
|
|
29
|
-
"
|
|
30
|
-
"../$productId": "src/routes/products/$productId/route.ts";
|
|
31
|
-
"../../products/$productId": "src/routes/products/$productId/route.ts";
|
|
32
|
-
"../../reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
33
|
-
"../../teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
34
|
-
"../../teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
35
|
-
"../../teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
36
|
-
"../../teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
27
|
+
export type Parents = {
|
|
28
|
+
"src/routes/teams/$teamId/items/$id/route.ts": "src/routes/teams/$teamId/route.ts";
|
|
29
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": "src/routes/teams/$teamId/route.ts";
|
|
37
30
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"src/routes/teams/$teamId/items/$id/route.ts": {
|
|
49
|
-
"./": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
50
|
-
"../$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
51
|
-
"../../items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
52
|
-
"../../members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
53
|
-
"../../old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
54
|
-
"../..": "src/routes/teams/$teamId/route.ts";
|
|
55
|
-
"../../": "src/routes/teams/$teamId/route.ts";
|
|
56
|
-
"../../../$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
57
|
-
"../../../$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
58
|
-
"../../../$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
59
|
-
"../../../$teamId": "src/routes/teams/$teamId/route.ts";
|
|
60
|
-
"../../../../products/$productId": "src/routes/products/$productId/route.ts";
|
|
61
|
-
"../../../../reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
62
|
-
"../../../../teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
63
|
-
"../../../../teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
64
|
-
"../../../../teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
65
|
-
"../../../../teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
66
|
-
};
|
|
67
|
-
"src/routes/teams/$teamId/members/$memberId/route.ts": {
|
|
68
|
-
"./": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
69
|
-
"../$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
70
|
-
"../../items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
71
|
-
"../../members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
72
|
-
"../../old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
73
|
-
"../..": "src/routes/teams/$teamId/route.ts";
|
|
74
|
-
"../../": "src/routes/teams/$teamId/route.ts";
|
|
75
|
-
"../../../$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
76
|
-
"../../../$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
77
|
-
"../../../$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
78
|
-
"../../../$teamId": "src/routes/teams/$teamId/route.ts";
|
|
79
|
-
"../../../../products/$productId": "src/routes/products/$productId/route.ts";
|
|
80
|
-
"../../../../reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
81
|
-
"../../../../teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
82
|
-
"../../../../teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
83
|
-
"../../../../teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
84
|
-
"../../../../teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
85
|
-
};
|
|
86
|
-
"src/routes/teams/$teamId/route.ts": {
|
|
87
|
-
"./items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
88
|
-
"./members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
89
|
-
"./old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
90
|
-
"./": "src/routes/teams/$teamId/route.ts";
|
|
91
|
-
"../$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
92
|
-
"../$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
93
|
-
"../$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
94
|
-
"../$teamId": "src/routes/teams/$teamId/route.ts";
|
|
95
|
-
"../../products/$productId": "src/routes/products/$productId/route.ts";
|
|
96
|
-
"../../reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
97
|
-
"../../teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
98
|
-
"../../teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
99
|
-
"../../teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
100
|
-
"../../teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export type Selected<Id extends keyof RelativeTargets> = {
|
|
104
|
-
readonly [Expression in keyof AbsoluteTargets | keyof RelativeTargets[Id]]:
|
|
105
|
-
Definitions[(Expression extends keyof AbsoluteTargets ? AbsoluteTargets[Expression] :
|
|
106
|
-
Expression extends keyof RelativeTargets[Id] ? RelativeTargets[Id][Expression] : never) & keyof Definitions];
|
|
31
|
+
/** Declarations with a colocated facade. */
|
|
32
|
+
export type Retained =
|
|
33
|
+
| "src/routes/products/$productId/route.ts"
|
|
34
|
+
| "src/routes/reports/$reportId/route.ts"
|
|
35
|
+
| "src/routes/teams/$teamId/items/$id/route.ts"
|
|
36
|
+
| "src/routes/teams/$teamId/members/$memberId/route.ts"
|
|
37
|
+
| "src/routes/teams/$teamId/route.ts"
|
|
38
|
+
;
|
|
39
|
+
export type AbsoluteSelected = {
|
|
40
|
+
readonly [Expression in keyof AbsoluteTargets]: Definitions[AbsoluteTargets[Expression] & keyof Definitions];
|
|
107
41
|
};
|
|
42
|
+
type ParentOf<Id extends Retained> = Id extends keyof Parents ? Definitions[Parents[Id] & keyof Definitions] : never;
|
|
108
43
|
/** A declaration-bound handle; obtain it through its colocated injectRoute facade. */
|
|
109
|
-
export type Handle<Id extends
|
|
44
|
+
export type Handle<Id extends Retained> = GeneratedHandle<Definitions[Id], AbsoluteSelected, ParentOf<Id>, typeof setIdentity, Pick<Definitions, Retained>>;
|
|
110
45
|
/** A same-set nominal reference; use the destination exported by a colocated facade. */
|
|
111
|
-
export type Destination<Id extends
|
|
46
|
+
export type Destination<Id extends Retained> = GeneratedDestination<Definitions[Id], typeof setIdentity, Id>;
|
|
112
47
|
const routeSet: RouteSet = { records: {
|
|
113
|
-
"src/routes/products/$productId/route.ts": { definition: () =>
|
|
114
|
-
"src/routes/reports/$reportId/route.ts": { definition: () =>
|
|
115
|
-
"src/routes/teams/$teamId/items/$id/route.ts": { definition: () =>
|
|
116
|
-
"src/routes/teams/$teamId/members/$memberId/route.ts": { definition: () =>
|
|
117
|
-
"src/routes/teams/$teamId/route.ts": { definition: () =>
|
|
48
|
+
"src/routes/products/$productId/route.ts": { definition: () => definition_products_$productId_route, owners: ["src/routes/products/$productId/route.ts"] },
|
|
49
|
+
"src/routes/reports/$reportId/route.ts": { definition: () => definition_reports_$reportId_route, owners: ["src/routes/reports/$reportId/route.ts"] },
|
|
50
|
+
"src/routes/teams/$teamId/items/$id/route.ts": { definition: () => definition_teams_$teamId_items_$id_route, owners: ["src/routes/teams/$teamId/route.ts","src/routes/teams/$teamId/items/$id/route.ts"] },
|
|
51
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": { definition: () => definition_teams_$teamId_members_$memberId_route, owners: ["src/routes/teams/$teamId/route.ts","src/routes/teams/$teamId/members/$memberId/route.ts"] },
|
|
52
|
+
"src/routes/teams/$teamId/route.ts": { definition: () => definition_teams_$teamId_route, owners: ["src/routes/teams/$teamId/route.ts"] },
|
|
118
53
|
}, destinations: {
|
|
119
|
-
"src/routes/products/$productId/route.ts": () =>
|
|
120
|
-
"src/routes/reports/$reportId/route.ts": () =>
|
|
121
|
-
"src/routes/teams/$teamId/items/$id/route.ts": () =>
|
|
122
|
-
"src/routes/teams/$teamId/members/$memberId/route.ts": () =>
|
|
123
|
-
"src/routes/teams/$teamId/old-items/$id/route.ts": () =>
|
|
124
|
-
"src/routes/teams/$teamId/route.ts": () =>
|
|
125
|
-
}, absolute: {
|
|
54
|
+
"src/routes/products/$productId/route.ts": () => definition_products_$productId_route,
|
|
55
|
+
"src/routes/reports/$reportId/route.ts": () => definition_reports_$reportId_route,
|
|
56
|
+
"src/routes/teams/$teamId/items/$id/route.ts": () => definition_teams_$teamId_items_$id_route,
|
|
57
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": () => definition_teams_$teamId_members_$memberId_route,
|
|
58
|
+
"src/routes/teams/$teamId/old-items/$id/route.ts": () => definition_teams_$teamId_old_items_$id_route,
|
|
59
|
+
"src/routes/teams/$teamId/route.ts": () => definition_teams_$teamId_route,
|
|
60
|
+
}, absolute: {
|
|
61
|
+
"/products/$productId": "src/routes/products/$productId/route.ts",
|
|
62
|
+
"/reports/$reportId": "src/routes/reports/$reportId/route.ts",
|
|
63
|
+
"/teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts",
|
|
64
|
+
"/teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts",
|
|
65
|
+
"/teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts",
|
|
66
|
+
"/teams/$teamId": "src/routes/teams/$teamId/route.ts",
|
|
67
|
+
}, parents: {
|
|
68
|
+
"src/routes/teams/$teamId/items/$id/route.ts": "src/routes/teams/$teamId/route.ts",
|
|
69
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": "src/routes/teams/$teamId/route.ts",
|
|
70
|
+
} };
|
|
126
71
|
export function getRouteSet(): RouteSet { return routeSet; }
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { Routes } from '@angular/router';
|
|
3
3
|
import { getRouteSet } from './destinations.generated.js';
|
|
4
4
|
import { nativeOptions, callbacks, redirect } from '@loozo/angular-router/_generated';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import definition_teams_$teamId_items_$id_route from "../src/routes/teams/$teamId/items/$id/route.js";
|
|
6
|
+
import definition_teams_$teamId_old_items_$id_route from "../src/routes/teams/$teamId/old-items/$id/route.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Generated native Angular route configuration; install with provideRouter(routes).
|
|
@@ -12,7 +12,7 @@ import definition4 from "../src/routes/teams/$teamId/old-items/$id/route.js";
|
|
|
12
12
|
export const routes: Routes = [{ path: "teams/:teamId/old-items/:id",
|
|
13
13
|
pathMatch: 'full',
|
|
14
14
|
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/old-items/$id/route.ts" },
|
|
15
|
-
redirectTo: redirect(() =>
|
|
15
|
+
redirectTo: redirect(() => definition_teams_$teamId_old_items_$id_route) },
|
|
16
16
|
{ path: "products/:productId",
|
|
17
17
|
data: { __loozoAngularRouterRouteId: "src/routes/products/$productId/route.ts" },
|
|
18
18
|
...callbacks(getRouteSet(), "src/routes/products/$productId/route.ts"),
|
|
@@ -24,7 +24,7 @@ loadComponent: () => import("../src/routes/reports/$reportId/page") },
|
|
|
24
24
|
{ path: "teams/:teamId",
|
|
25
25
|
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/route.ts" },
|
|
26
26
|
...callbacks(getRouteSet(), "src/routes/teams/$teamId/route.ts"),
|
|
27
|
-
children: [{ ...nativeOptions(
|
|
27
|
+
children: [{ ...nativeOptions(definition_teams_$teamId_items_$id_route),
|
|
28
28
|
path: "items/:id",
|
|
29
29
|
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/items/$id/route.ts" },
|
|
30
30
|
...callbacks(getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts"),
|
|
@@ -7,7 +7,7 @@ export { defineRoute } from '@loozo/angular-router';
|
|
|
7
7
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
8
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
9
|
*/
|
|
10
|
-
export const destination: Destination<"src/routes/products/$productId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/products/$productId/route.ts");
|
|
10
|
+
export const destination: Destination<"src/routes/products/$productId/route.ts"> = /* @__PURE__ */ createDestination(() => getRouteSet(), "src/routes/products/$productId/route.ts");
|
|
11
11
|
/**
|
|
12
12
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
13
|
*
|
|
@@ -7,7 +7,7 @@ export { defineRoute } from '@loozo/angular-router';
|
|
|
7
7
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
8
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
9
|
*/
|
|
10
|
-
export const destination: Destination<"src/routes/reports/$reportId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/reports/$reportId/route.ts");
|
|
10
|
+
export const destination: Destination<"src/routes/reports/$reportId/route.ts"> = /* @__PURE__ */ createDestination(() => getRouteSet(), "src/routes/reports/$reportId/route.ts");
|
|
11
11
|
/**
|
|
12
12
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
13
|
*
|
|
@@ -8,6 +8,6 @@ export function itemLinks() {
|
|
|
8
8
|
route.link({ params: { teamId: 7, id: 8 } }); // this route
|
|
9
9
|
route.link(".", { params: { teamId: 7, id: 8 } }); // same as above
|
|
10
10
|
route.link("/teams/$teamId/items/$id", { params: { teamId: 7, id: 9 } }); // absolute
|
|
11
|
-
route.link("
|
|
11
|
+
route.link("..", { params: { teamId: 7 } }); // parent route
|
|
12
12
|
void route.navigate(report, { params: { reportId: 42 } }); // another route's destination
|
|
13
13
|
}
|
|
@@ -7,7 +7,7 @@ export { defineRoute } from '@loozo/angular-router';
|
|
|
7
7
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
8
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
9
|
*/
|
|
10
|
-
export const destination: Destination<"src/routes/teams/$teamId/items/$id/route.ts"> = createDestination(() => getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts");
|
|
10
|
+
export const destination: Destination<"src/routes/teams/$teamId/items/$id/route.ts"> = /* @__PURE__ */ createDestination(() => getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts");
|
|
11
11
|
/**
|
|
12
12
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
13
|
*
|
|
@@ -7,7 +7,7 @@ export { defineRoute } from '@loozo/angular-router';
|
|
|
7
7
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
8
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
9
|
*/
|
|
10
|
-
export const destination: Destination<"src/routes/teams/$teamId/members/$memberId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/teams/$teamId/members/$memberId/route.ts");
|
|
10
|
+
export const destination: Destination<"src/routes/teams/$teamId/members/$memberId/route.ts"> = /* @__PURE__ */ createDestination(() => getRouteSet(), "src/routes/teams/$teamId/members/$memberId/route.ts");
|
|
11
11
|
/**
|
|
12
12
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
13
|
*
|
|
@@ -7,7 +7,7 @@ export { defineRoute } from '@loozo/angular-router';
|
|
|
7
7
|
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
8
|
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
9
|
*/
|
|
10
|
-
export const destination: Destination<"src/routes/teams/$teamId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/teams/$teamId/route.ts");
|
|
10
|
+
export const destination: Destination<"src/routes/teams/$teamId/route.ts"> = /* @__PURE__ */ createDestination(() => getRouteSet(), "src/routes/teams/$teamId/route.ts");
|
|
11
11
|
/**
|
|
12
12
|
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
13
|
*
|
|
@@ -484,7 +484,8 @@ export declare function defineRoute<const Path extends string, Parent extends An
|
|
|
484
484
|
* not a generated destination, spread/copy or structural lookalike.
|
|
485
485
|
* @param values - Explicit destination-typed params, search and optional fragment.
|
|
486
486
|
* Pass an empty object when the route needs no values.
|
|
487
|
-
* @returns A root-relative URL string
|
|
487
|
+
* @returns A root-relative URL string, typed `` `/${string}` ``; this does not navigate or
|
|
488
|
+
* return a UrlTree.
|
|
488
489
|
* @throws TypeError for invalid routes/records, missing or unknown keys,
|
|
489
490
|
* undeclared fragments, nonarray catchalls, nonstring codec output, or empty/dot
|
|
490
491
|
* path output. Application stringifier failures propagate unchanged.
|
|
@@ -500,5 +501,5 @@ export declare function defineRoute<const Path extends string, Parent extends An
|
|
|
500
501
|
* // /products/42#summary
|
|
501
502
|
* ```
|
|
502
503
|
*/
|
|
503
|
-
export declare function createUrl<Target extends AnyRoute, SearchKeys extends keyof SearchOf<NoInfer<Target>> = never>(route: Target, values: UrlValues<NoInfer<Target>, SearchKeys>): string
|
|
504
|
+
export declare function createUrl<Target extends AnyRoute, SearchKeys extends keyof SearchOf<NoInfer<Target>> = never>(route: Target, values: UrlValues<NoInfer<Target>, SearchKeys>): `/${string}`;
|
|
504
505
|
export type { AnyRoute, FragmentsOf, Inputs, ParamCodec, ParamsOf, Route, RouteMetadata, SearchOf, UrlValues };
|