@loozo/angular-router 0.0.3 → 0.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/README.md +246 -124
- package/fesm2022/loozo-angular-router-_core.mjs +19 -41
- package/fesm2022/loozo-angular-router-_core.mjs.map +1 -1
- package/fesm2022/loozo-angular-router-_generated.mjs +148 -315
- package/fesm2022/loozo-angular-router-_generated.mjs.map +1 -1
- package/fesm2022/loozo-angular-router.mjs +2 -2
- package/node/src/builders/application.js +12 -3
- package/node/src/builders/options.js +9 -3
- package/node/src/builders/serve.js +21 -14
- package/node/src/generation/emit.js +26 -8
- package/node/src/generation/filesystem.js +261 -69
- package/node/src/generation/generate.d.ts +1 -1
- package/node/src/generation/generate.js +6 -1
- package/node/src/generation/sources.js +7 -2
- package/node/src/generation/validate.js +15 -24
- package/package.json +1 -1
- package/schemas/application.json +29 -20
- package/schemas/serve.json +142 -7
- package/snippets/angular.json +29 -0
- package/snippets/generated/destinations.generated.ts +126 -0
- package/snippets/generated/routes.generated.ts +35 -0
- package/snippets/src/catalog.ts +20 -0
- package/snippets/src/docs-url.ts +8 -0
- package/snippets/src/index.html +11 -0
- package/snippets/src/main.ts +6 -0
- package/snippets/src/product-url.ts +8 -0
- package/snippets/src/routes/products/$productId/page.ts +20 -0
- package/snippets/src/routes/products/$productId/route.generated.ts +24 -0
- package/snippets/src/routes/products/$productId/route.ts +7 -0
- package/snippets/src/routes/reports/$reportId/page.ts +9 -0
- package/snippets/src/routes/reports/$reportId/route.generated.ts +24 -0
- package/snippets/src/routes/reports/$reportId/route.ts +6 -0
- package/snippets/src/routes/teams/$teamId/items/$id/inputs.ts +15 -0
- package/snippets/src/routes/teams/$teamId/items/$id/links.ts +13 -0
- package/snippets/src/routes/teams/$teamId/items/$id/page.ts +9 -0
- package/snippets/src/routes/teams/$teamId/items/$id/route.generated.ts +24 -0
- package/snippets/src/routes/teams/$teamId/items/$id/route.ts +18 -0
- package/snippets/src/routes/teams/$teamId/members/$memberId/page.ts +9 -0
- package/snippets/src/routes/teams/$teamId/members/$memberId/route.generated.ts +24 -0
- package/snippets/src/routes/teams/$teamId/members/$memberId/route.ts +7 -0
- package/snippets/src/routes/teams/$teamId/old-items/$id/route.ts +13 -0
- package/snippets/src/routes/teams/$teamId/route.generated.ts +24 -0
- package/snippets/src/routes/teams/$teamId/route.ts +6 -0
- package/snippets/src/shell.ts +9 -0
- package/snippets/src/slug.ts +14 -0
- package/snippets/tsconfig.app.json +14 -0
- package/snippets/tsconfig.routes.json +5 -0
- package/types/loozo-angular-router-_core.d.ts +141 -99
- package/types/loozo-angular-router-_generated.d.ts +48 -31
- package/types/loozo-angular-router.d.ts +2 -2
package/schemas/serve.json
CHANGED
|
@@ -1,18 +1,153 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$comment": "
|
|
3
|
+
"$comment": "Generated by scripts/builder-schemas.mjs from the @angular/build 22.2.2 dev-server schema plus the router options. Do not edit. The @angular/build schema portions are distributed under this license:\n\nThe MIT License\n\nCopyright (c) 2010-2026 Google LLC. https://angular.dev/license\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.",
|
|
4
|
+
"title": "Dev Server Target",
|
|
5
|
+
"description": "Dev Server target options for Build Facade.",
|
|
4
6
|
"type": "object",
|
|
5
|
-
"additionalProperties": true,
|
|
6
|
-
"required": ["buildTarget"],
|
|
7
7
|
"properties": {
|
|
8
8
|
"buildTarget": {
|
|
9
9
|
"type": "string",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"description": "A target using @loozo/angular-router:application, as project:target[:configuration]. Router options come from it.",
|
|
11
|
+
"pattern": "^[^:\\s]*:[^:\\s]*(:[^\\s]+)?$"
|
|
12
|
+
},
|
|
13
|
+
"port": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"description": "Port to listen on.",
|
|
16
|
+
"default": 4200
|
|
17
|
+
},
|
|
18
|
+
"host": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Host to listen on.",
|
|
21
|
+
"default": "localhost"
|
|
22
|
+
},
|
|
23
|
+
"proxyConfig": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Proxy configuration file. For more information, see https://angular.dev/tools/cli/serve#proxying-to-a-backend-server."
|
|
26
|
+
},
|
|
27
|
+
"ssl": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "Serve using HTTPS.",
|
|
30
|
+
"default": false
|
|
31
|
+
},
|
|
32
|
+
"sslKey": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "SSL key to use for serving HTTPS."
|
|
35
|
+
},
|
|
36
|
+
"sslCert": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "SSL certificate to use for serving HTTPS."
|
|
39
|
+
},
|
|
40
|
+
"allowedHosts": {
|
|
41
|
+
"description": "The hosts that the development server will respond to. This option sets the Vite option of the same name. For further details: https://vite.dev/config/server-options.html#server-allowedhosts",
|
|
42
|
+
"default": [],
|
|
43
|
+
"oneOf": [
|
|
44
|
+
{
|
|
45
|
+
"type": "array",
|
|
46
|
+
"description": "A list of hosts that the development server will respond to.",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Indicates that all hosts are allowed. This is not recommended and a security risk."
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"define": {
|
|
58
|
+
"description": "Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.",
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"headers": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"description": "Custom HTTP headers to be added to all responses.",
|
|
67
|
+
"propertyNames": {
|
|
68
|
+
"pattern": "^[-_A-Za-z0-9]+$"
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": {
|
|
71
|
+
"type": "string"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"open": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "Opens the url in default browser.",
|
|
77
|
+
"default": false,
|
|
78
|
+
"alias": "o"
|
|
79
|
+
},
|
|
80
|
+
"verbose": {
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"description": "Adds more details to output logging."
|
|
83
|
+
},
|
|
84
|
+
"liveReload": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"description": "Whether to reload the page on change, using live-reload.",
|
|
87
|
+
"default": true
|
|
88
|
+
},
|
|
89
|
+
"servePath": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "The pathname where the application will be served."
|
|
92
|
+
},
|
|
93
|
+
"hmr": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"description": "Enable hot module replacement. Defaults to the value of 'liveReload'. Currently, only global and component stylesheets are supported."
|
|
96
|
+
},
|
|
97
|
+
"watch": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"description": "Rebuild on change.",
|
|
100
|
+
"default": true
|
|
12
101
|
},
|
|
13
102
|
"poll": {
|
|
14
103
|
"description": "Watch by polling every this many milliseconds. Defaults to 1000 when omitted. false adds no default, so Angular's own configuration applies, including a poll on the build target.",
|
|
15
|
-
"oneOf": [
|
|
104
|
+
"oneOf": [
|
|
105
|
+
{
|
|
106
|
+
"type": "number",
|
|
107
|
+
"exclusiveMinimum": 0
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"const": false
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"inspect": {
|
|
115
|
+
"default": false,
|
|
116
|
+
"description": "Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are enabled.",
|
|
117
|
+
"oneOf": [
|
|
118
|
+
{
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "Activate the inspector on host and port in the format of `[[host:]port]`. See the security warning in https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure regarding the host parameter usage."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "boolean"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"prebundle": {
|
|
128
|
+
"description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled.",
|
|
129
|
+
"default": true,
|
|
130
|
+
"oneOf": [
|
|
131
|
+
{
|
|
132
|
+
"type": "boolean"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"type": "object",
|
|
136
|
+
"properties": {
|
|
137
|
+
"exclude": {
|
|
138
|
+
"description": "List of package imports that should not be prebundled by the development server. The packages will be bundled into the application code itself. Note: specifying `@foo/bar` marks all paths within the `@foo/bar` package as excluded, including sub-paths like `@foo/bar/baz`.",
|
|
139
|
+
"type": "array",
|
|
140
|
+
"items": {
|
|
141
|
+
"type": "string"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"additionalProperties": false,
|
|
146
|
+
"required": ["exclude"]
|
|
147
|
+
}
|
|
148
|
+
]
|
|
16
149
|
}
|
|
17
|
-
}
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"required": ["buildTarget"]
|
|
18
153
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"projects": {
|
|
4
|
+
"app": {
|
|
5
|
+
"projectType": "application",
|
|
6
|
+
"root": "",
|
|
7
|
+
"sourceRoot": "src",
|
|
8
|
+
"architect": {
|
|
9
|
+
"build": {
|
|
10
|
+
"builder": "@loozo/angular-router:application",
|
|
11
|
+
"options": {
|
|
12
|
+
"tsconfig": "tsconfig.routes.json",
|
|
13
|
+
"scanDirectories": ["src/routes"],
|
|
14
|
+
"outDirectory": "generated",
|
|
15
|
+
"browser": "src/main.ts",
|
|
16
|
+
"index": "src/index.html",
|
|
17
|
+
"tsConfig": "tsconfig.app.json",
|
|
18
|
+
"outputPath": "dist/app"
|
|
19
|
+
},
|
|
20
|
+
"configurations": { "ci": { "check": true } }
|
|
21
|
+
},
|
|
22
|
+
"serve": {
|
|
23
|
+
"builder": "@loozo/angular-router:serve",
|
|
24
|
+
"options": { "buildTarget": "app:build" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @loozo/angular-router routegen: owned destinations.generated.ts
|
|
2
|
+
import type { RouteSet, Handle as GeneratedHandle, Destination as GeneratedDestination } from '@loozo/angular-router/_generated';
|
|
3
|
+
import definition0 from "../src/routes/products/$productId/route.js";
|
|
4
|
+
import definition1 from "../src/routes/reports/$reportId/route.js";
|
|
5
|
+
import definition2 from "../src/routes/teams/$teamId/items/$id/route.js";
|
|
6
|
+
import definition3 from "../src/routes/teams/$teamId/members/$memberId/route.js";
|
|
7
|
+
import definition4 from "../src/routes/teams/$teamId/old-items/$id/route.js";
|
|
8
|
+
import definition5 from "../src/routes/teams/$teamId/route.js";
|
|
9
|
+
|
|
10
|
+
export type Definitions = {
|
|
11
|
+
"src/routes/products/$productId/route.ts": typeof definition0;
|
|
12
|
+
"src/routes/reports/$reportId/route.ts": typeof definition1;
|
|
13
|
+
"src/routes/teams/$teamId/items/$id/route.ts": typeof definition2;
|
|
14
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": typeof definition3;
|
|
15
|
+
"src/routes/teams/$teamId/old-items/$id/route.ts": typeof definition4;
|
|
16
|
+
"src/routes/teams/$teamId/route.ts": typeof definition5;
|
|
17
|
+
};
|
|
18
|
+
declare const setIdentity: unique symbol;
|
|
19
|
+
export type AbsoluteTargets = {
|
|
20
|
+
"/products/$productId": "src/routes/products/$productId/route.ts";
|
|
21
|
+
"/reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
22
|
+
"/teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
23
|
+
"/teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
24
|
+
"/teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
25
|
+
"/teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
26
|
+
};
|
|
27
|
+
export type RelativeTargets = {
|
|
28
|
+
"src/routes/products/$productId/route.ts": {
|
|
29
|
+
"./": "src/routes/products/$productId/route.ts";
|
|
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";
|
|
37
|
+
};
|
|
38
|
+
"src/routes/reports/$reportId/route.ts": {
|
|
39
|
+
"./": "src/routes/reports/$reportId/route.ts";
|
|
40
|
+
"../$reportId": "src/routes/reports/$reportId/route.ts";
|
|
41
|
+
"../../products/$productId": "src/routes/products/$productId/route.ts";
|
|
42
|
+
"../../reports/$reportId": "src/routes/reports/$reportId/route.ts";
|
|
43
|
+
"../../teams/$teamId/items/$id": "src/routes/teams/$teamId/items/$id/route.ts";
|
|
44
|
+
"../../teams/$teamId/members/$memberId": "src/routes/teams/$teamId/members/$memberId/route.ts";
|
|
45
|
+
"../../teams/$teamId/old-items/$id": "src/routes/teams/$teamId/old-items/$id/route.ts";
|
|
46
|
+
"../../teams/$teamId": "src/routes/teams/$teamId/route.ts";
|
|
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];
|
|
107
|
+
};
|
|
108
|
+
/** A declaration-bound handle; obtain it through its colocated injectRoute facade. */
|
|
109
|
+
export type Handle<Id extends keyof RelativeTargets> = GeneratedHandle<Definitions[Id], Selected<Id>, typeof setIdentity, Pick<Definitions, keyof RelativeTargets>>;
|
|
110
|
+
/** A same-set nominal reference; use the destination exported by a colocated facade. */
|
|
111
|
+
export type Destination<Id extends keyof RelativeTargets> = GeneratedDestination<Definitions[Id], typeof setIdentity, Id>;
|
|
112
|
+
const routeSet: RouteSet = { records: {
|
|
113
|
+
"src/routes/products/$productId/route.ts": { definition: () => definition0, owners: ["src/routes/products/$productId/route.ts"] },
|
|
114
|
+
"src/routes/reports/$reportId/route.ts": { definition: () => definition1, owners: ["src/routes/reports/$reportId/route.ts"] },
|
|
115
|
+
"src/routes/teams/$teamId/items/$id/route.ts": { definition: () => definition2, owners: ["src/routes/teams/$teamId/route.ts","src/routes/teams/$teamId/items/$id/route.ts"] },
|
|
116
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": { definition: () => definition3, owners: ["src/routes/teams/$teamId/route.ts","src/routes/teams/$teamId/members/$memberId/route.ts"] },
|
|
117
|
+
"src/routes/teams/$teamId/route.ts": { definition: () => definition5, owners: ["src/routes/teams/$teamId/route.ts"] },
|
|
118
|
+
}, destinations: {
|
|
119
|
+
"src/routes/products/$productId/route.ts": () => definition0,
|
|
120
|
+
"src/routes/reports/$reportId/route.ts": () => definition1,
|
|
121
|
+
"src/routes/teams/$teamId/items/$id/route.ts": () => definition2,
|
|
122
|
+
"src/routes/teams/$teamId/members/$memberId/route.ts": () => definition3,
|
|
123
|
+
"src/routes/teams/$teamId/old-items/$id/route.ts": () => definition4,
|
|
124
|
+
"src/routes/teams/$teamId/route.ts": () => definition5,
|
|
125
|
+
}, absolute: {"/products/$productId":"src/routes/products/$productId/route.ts","/reports/$reportId":"src/routes/reports/$reportId/route.ts","/teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","/teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","/teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","/teams/$teamId":"src/routes/teams/$teamId/route.ts"}, relative: {"src/routes/products/$productId/route.ts":{"./":"src/routes/products/$productId/route.ts","../$productId":"src/routes/products/$productId/route.ts","../../products/$productId":"src/routes/products/$productId/route.ts","../../reports/$reportId":"src/routes/reports/$reportId/route.ts","../../teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../teams/$teamId":"src/routes/teams/$teamId/route.ts"},"src/routes/reports/$reportId/route.ts":{"./":"src/routes/reports/$reportId/route.ts","../$reportId":"src/routes/reports/$reportId/route.ts","../../products/$productId":"src/routes/products/$productId/route.ts","../../reports/$reportId":"src/routes/reports/$reportId/route.ts","../../teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../teams/$teamId":"src/routes/teams/$teamId/route.ts"},"src/routes/teams/$teamId/items/$id/route.ts":{"./":"src/routes/teams/$teamId/items/$id/route.ts","../$id":"src/routes/teams/$teamId/items/$id/route.ts","../../items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../..":"src/routes/teams/$teamId/route.ts","../../":"src/routes/teams/$teamId/route.ts","../../../$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../../$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../../$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../../$teamId":"src/routes/teams/$teamId/route.ts","../../../../products/$productId":"src/routes/products/$productId/route.ts","../../../../reports/$reportId":"src/routes/reports/$reportId/route.ts","../../../../teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../../../teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../../../teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../../../teams/$teamId":"src/routes/teams/$teamId/route.ts"},"src/routes/teams/$teamId/members/$memberId/route.ts":{"./":"src/routes/teams/$teamId/members/$memberId/route.ts","../$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../..":"src/routes/teams/$teamId/route.ts","../../":"src/routes/teams/$teamId/route.ts","../../../$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../../$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../../$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../../$teamId":"src/routes/teams/$teamId/route.ts","../../../../products/$productId":"src/routes/products/$productId/route.ts","../../../../reports/$reportId":"src/routes/reports/$reportId/route.ts","../../../../teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../../../teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../../../teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../../../teams/$teamId":"src/routes/teams/$teamId/route.ts"},"src/routes/teams/$teamId/route.ts":{"./items/$id":"src/routes/teams/$teamId/items/$id/route.ts","./members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","./old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","./":"src/routes/teams/$teamId/route.ts","../$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../$teamId":"src/routes/teams/$teamId/route.ts","../../products/$productId":"src/routes/products/$productId/route.ts","../../reports/$reportId":"src/routes/reports/$reportId/route.ts","../../teams/$teamId/items/$id":"src/routes/teams/$teamId/items/$id/route.ts","../../teams/$teamId/members/$memberId":"src/routes/teams/$teamId/members/$memberId/route.ts","../../teams/$teamId/old-items/$id":"src/routes/teams/$teamId/old-items/$id/route.ts","../../teams/$teamId":"src/routes/teams/$teamId/route.ts"}} };
|
|
126
|
+
export function getRouteSet(): RouteSet { return routeSet; }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @loozo/angular-router routegen: owned routes.generated.ts
|
|
2
|
+
import type { Routes } from '@angular/router';
|
|
3
|
+
import { getRouteSet } from './destinations.generated.js';
|
|
4
|
+
import { nativeOptions, callbacks, redirect } from '@loozo/angular-router/_generated';
|
|
5
|
+
import definition2 from "../src/routes/teams/$teamId/items/$id/route.js";
|
|
6
|
+
import definition4 from "../src/routes/teams/$teamId/old-items/$id/route.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated native Angular route configuration; install with provideRouter(routes).
|
|
10
|
+
* Regenerate through the router's Architect companions instead of editing this file.
|
|
11
|
+
*/
|
|
12
|
+
export const routes: Routes = [{ path: "teams/:teamId/old-items/:id",
|
|
13
|
+
pathMatch: 'full',
|
|
14
|
+
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/old-items/$id/route.ts" },
|
|
15
|
+
redirectTo: redirect(() => definition4) },
|
|
16
|
+
{ path: "products/:productId",
|
|
17
|
+
data: { __loozoAngularRouterRouteId: "src/routes/products/$productId/route.ts" },
|
|
18
|
+
...callbacks(getRouteSet(), "src/routes/products/$productId/route.ts"),
|
|
19
|
+
loadComponent: () => import("../src/routes/products/$productId/page") },
|
|
20
|
+
{ path: "reports/:reportId",
|
|
21
|
+
data: { __loozoAngularRouterRouteId: "src/routes/reports/$reportId/route.ts" },
|
|
22
|
+
...callbacks(getRouteSet(), "src/routes/reports/$reportId/route.ts"),
|
|
23
|
+
loadComponent: () => import("../src/routes/reports/$reportId/page") },
|
|
24
|
+
{ path: "teams/:teamId",
|
|
25
|
+
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/route.ts" },
|
|
26
|
+
...callbacks(getRouteSet(), "src/routes/teams/$teamId/route.ts"),
|
|
27
|
+
children: [{ ...nativeOptions(definition2),
|
|
28
|
+
path: "items/:id",
|
|
29
|
+
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/items/$id/route.ts" },
|
|
30
|
+
...callbacks(getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts"),
|
|
31
|
+
loadComponent: () => import("../src/routes/teams/$teamId/items/$id/page") },
|
|
32
|
+
{ path: "members/:memberId",
|
|
33
|
+
data: { __loozoAngularRouterRouteId: "src/routes/teams/$teamId/members/$memberId/route.ts" },
|
|
34
|
+
...callbacks(getRouteSet(), "src/routes/teams/$teamId/members/$memberId/route.ts"),
|
|
35
|
+
loadComponent: () => import("../src/routes/teams/$teamId/members/$memberId/page") }] }];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InjectionToken } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
export interface ItemQuery {
|
|
4
|
+
readonly teamId: number;
|
|
5
|
+
readonly id: number;
|
|
6
|
+
readonly score: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface Item extends ItemQuery {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ItemCatalog = new InjectionToken<(query: ItemQuery) => Promise<Item>>("ItemCatalog", {
|
|
14
|
+
providedIn: "root",
|
|
15
|
+
factory: () => {
|
|
16
|
+
return async (query) => {
|
|
17
|
+
return { ...query, name: `Item ${query.id}` };
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createUrl, defineRoute, stringParam } from "@loozo/angular-router";
|
|
2
|
+
|
|
3
|
+
// #region catchall
|
|
4
|
+
const docs = defineRoute("docs/$segments[]", { params: { segments: stringParam } });
|
|
5
|
+
|
|
6
|
+
createUrl(docs, { params: { segments: ["guides", "setup"] } }); // "/docs/guides/setup"
|
|
7
|
+
createUrl(docs, { params: { segments: [] } }); // "/docs"
|
|
8
|
+
// #endregion catchall
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { bootstrapApplication } from "@angular/platform-browser";
|
|
2
|
+
import { provideRouter } from "@angular/router";
|
|
3
|
+
import Shell from "./shell.js";
|
|
4
|
+
import { routes } from "../generated/routes.generated.js";
|
|
5
|
+
|
|
6
|
+
void bootstrapApplication(Shell, { providers: [provideRouter(routes)] });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { RouterLink } from "@angular/router";
|
|
3
|
+
import { injectRoute } from "./route.generated.js";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
imports: [RouterLink],
|
|
7
|
+
template: `
|
|
8
|
+
<h1>Product {{ route.params().productId }}</h1>
|
|
9
|
+
<p>Tab: {{ route.search().tab }}</p>
|
|
10
|
+
<a [routerLink]="reviews">Reviews</a>
|
|
11
|
+
`,
|
|
12
|
+
})
|
|
13
|
+
export default class Product {
|
|
14
|
+
readonly route = injectRoute();
|
|
15
|
+
readonly reviews = this.route.link({
|
|
16
|
+
params: { productId: 42 },
|
|
17
|
+
search: { tab: "reviews" },
|
|
18
|
+
fragment: "reviews",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @loozo/angular-router routegen: owned route.generated.ts
|
|
2
|
+
import { createDestination, injectGeneratedRoute } from '@loozo/angular-router/_generated';
|
|
3
|
+
import { getRouteSet, type Destination, type Handle } from "../../../../generated/destinations.generated.js";
|
|
4
|
+
export { defineRoute } from '@loozo/angular-router';
|
|
5
|
+
/**
|
|
6
|
+
* Inert reference to this exact declaration for same-set handle link/navigate calls.
|
|
7
|
+
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
|
+
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
|
+
*/
|
|
10
|
+
export const destination: Destination<"src/routes/products/$productId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/products/$productId/route.ts");
|
|
11
|
+
/**
|
|
12
|
+
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Call in an Angular injection context. The handle exposes readonly native
|
|
16
|
+
* params/search/data Signals and destination-typed link/navigate methods.
|
|
17
|
+
* Data includes local resolver results only, not static or inherited data.
|
|
18
|
+
* All navigation values are explicit; current inputs are never reused implicitly.
|
|
19
|
+
*
|
|
20
|
+
* @returns A noncallable handle for this declaration.
|
|
21
|
+
* @throws A synchronous wiring error outside an injection context or when the
|
|
22
|
+
* activated record does not carry this declaration's own generated identity.
|
|
23
|
+
*/
|
|
24
|
+
export function injectRoute(): Handle<"src/routes/products/$productId/route.ts"> { return injectGeneratedRoute(getRouteSet(), "src/routes/products/$productId/route.ts"); }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { defineRoute, enumParam, numberParam, withFallback } from "@loozo/angular-router";
|
|
2
|
+
|
|
3
|
+
export default defineRoute("products/$productId", {
|
|
4
|
+
params: { productId: numberParam },
|
|
5
|
+
search: { tab: withFallback(enumParam(["details", "reviews"]), "details") },
|
|
6
|
+
fragments: ["summary", "reviews"],
|
|
7
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @loozo/angular-router routegen: owned route.generated.ts
|
|
2
|
+
import { createDestination, injectGeneratedRoute } from '@loozo/angular-router/_generated';
|
|
3
|
+
import { getRouteSet, type Destination, type Handle } from "../../../../generated/destinations.generated.js";
|
|
4
|
+
export { defineRoute } from '@loozo/angular-router';
|
|
5
|
+
/**
|
|
6
|
+
* Inert reference to this exact declaration for same-set handle link/navigate calls.
|
|
7
|
+
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
|
+
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
|
+
*/
|
|
10
|
+
export const destination: Destination<"src/routes/reports/$reportId/route.ts"> = createDestination(() => getRouteSet(), "src/routes/reports/$reportId/route.ts");
|
|
11
|
+
/**
|
|
12
|
+
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Call in an Angular injection context. The handle exposes readonly native
|
|
16
|
+
* params/search/data Signals and destination-typed link/navigate methods.
|
|
17
|
+
* Data includes local resolver results only, not static or inherited data.
|
|
18
|
+
* All navigation values are explicit; current inputs are never reused implicitly.
|
|
19
|
+
*
|
|
20
|
+
* @returns A noncallable handle for this declaration.
|
|
21
|
+
* @throws A synchronous wiring error outside an injection context or when the
|
|
22
|
+
* activated record does not carry this declaration's own generated identity.
|
|
23
|
+
*/
|
|
24
|
+
export function injectRoute(): Handle<"src/routes/reports/$reportId/route.ts"> { return injectGeneratedRoute(getRouteSet(), "src/routes/reports/$reportId/route.ts"); }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Shows the handle's input types; the README embeds the region below.
|
|
2
|
+
/* oxlint-disable no-unused-expressions */
|
|
3
|
+
|
|
4
|
+
// #region inputs
|
|
5
|
+
import { injectRoute } from "./route.generated.js";
|
|
6
|
+
|
|
7
|
+
// injectRoute() needs an injection context, such as a component field initializer.
|
|
8
|
+
export function readInputs() {
|
|
9
|
+
const route = injectRoute();
|
|
10
|
+
|
|
11
|
+
route.params(); // { teamId: number; id: number }
|
|
12
|
+
route.search(); // { score?: number }
|
|
13
|
+
route.data(); // { item: Item }, local resolver results only
|
|
14
|
+
}
|
|
15
|
+
// #endregion inputs
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { destination as report } from "../../../../reports/$reportId/route.generated.js";
|
|
2
|
+
import { injectRoute } from "./route.generated.js";
|
|
3
|
+
|
|
4
|
+
// injectRoute() needs an injection context, such as a component field initializer.
|
|
5
|
+
export function itemLinks() {
|
|
6
|
+
const route = injectRoute();
|
|
7
|
+
|
|
8
|
+
route.link({ params: { teamId: 7, id: 8 } }); // this route
|
|
9
|
+
route.link(".", { params: { teamId: 7, id: 8 } }); // same as above
|
|
10
|
+
route.link("/teams/$teamId/items/$id", { params: { teamId: 7, id: 9 } }); // absolute
|
|
11
|
+
route.link("../..", { params: { teamId: 7 } }); // relative
|
|
12
|
+
void route.navigate(report, { params: { reportId: 42 } }); // another route's destination
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @loozo/angular-router routegen: owned route.generated.ts
|
|
2
|
+
import { createDestination, injectGeneratedRoute } from '@loozo/angular-router/_generated';
|
|
3
|
+
import { getRouteSet, type Destination, type Handle } from "../../../../../../generated/destinations.generated.js";
|
|
4
|
+
export { defineRoute } from '@loozo/angular-router';
|
|
5
|
+
/**
|
|
6
|
+
* Inert reference to this exact declaration for same-set handle link/navigate calls.
|
|
7
|
+
* No injection context is required; copies and foreign-set references are invalid.
|
|
8
|
+
* This is not an authored route and cannot be passed to the root createUrl function.
|
|
9
|
+
*/
|
|
10
|
+
export const destination: Destination<"src/routes/teams/$teamId/items/$id/route.ts"> = createDestination(() => getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts");
|
|
11
|
+
/**
|
|
12
|
+
* Injects a typed handle bound to this exact generated activated route record.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Call in an Angular injection context. The handle exposes readonly native
|
|
16
|
+
* params/search/data Signals and destination-typed link/navigate methods.
|
|
17
|
+
* Data includes local resolver results only, not static or inherited data.
|
|
18
|
+
* All navigation values are explicit; current inputs are never reused implicitly.
|
|
19
|
+
*
|
|
20
|
+
* @returns A noncallable handle for this declaration.
|
|
21
|
+
* @throws A synchronous wiring error outside an injection context or when the
|
|
22
|
+
* activated record does not carry this declaration's own generated identity.
|
|
23
|
+
*/
|
|
24
|
+
export function injectRoute(): Handle<"src/routes/teams/$teamId/items/$id/route.ts"> { return injectGeneratedRoute(getRouteSet(), "src/routes/teams/$teamId/items/$id/route.ts"); }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inject } from "@angular/core";
|
|
2
|
+
import { defineRoute, numberParam } from "@loozo/angular-router";
|
|
3
|
+
import team from "../../route.js";
|
|
4
|
+
import { ItemCatalog } from "../../../../../catalog.js";
|
|
5
|
+
|
|
6
|
+
export default defineRoute("items/$id", {
|
|
7
|
+
parent: team,
|
|
8
|
+
params: { id: numberParam },
|
|
9
|
+
runGuardsAndResolvers: "paramsOrQueryParamsChange",
|
|
10
|
+
title: ({ params }) => `Item ${params.id}`,
|
|
11
|
+
resolve: {
|
|
12
|
+
item: ({ params, search }) => {
|
|
13
|
+
const catalog = inject(ItemCatalog);
|
|
14
|
+
|
|
15
|
+
return catalog({ teamId: params.teamId, id: params.id, score: search.score });
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|