@adukiorg/anza 0.2.0 → 0.2.3
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/CHANGELOG.md +90 -4
- package/README.md +97 -133
- package/bin/anza/anza-linux-arm64 +0 -0
- package/bin/anza/anza-linux-x64 +0 -0
- package/bin/anza/anza-macos-arm64 +0 -0
- package/bin/anza/anza-macos-x64 +0 -0
- package/bin/anza/anza-windows-x64.exe +0 -0
- package/bin/anza/find.js +35 -0
- package/bin/anza/index.js +34 -0
- package/bin/anza/launch.js +19 -0
- package/bin/common/index.js +7 -0
- package/bin/common/logs.js +62 -0
- package/bin/create/copy.js +18 -0
- package/bin/create/index.js +45 -0
- package/bin/create/run.js +210 -0
- package/bin/create/write.js +19 -0
- package/importmap.json +4 -0
- package/package.json +16 -10
- package/src/core/offline/{usage.md → notes/usage.md} +11 -1
- package/src/core/router/boot.js +82 -0
- package/src/core/router/cascade.js +76 -0
- package/src/core/router/container.js +63 -72
- package/src/core/router/graph.js +144 -0
- package/src/core/router/index.js +12 -2
- package/src/core/router/intercept.js +26 -7
- package/src/core/router/lca.js +58 -0
- package/src/core/router/match.js +49 -36
- package/src/core/router/notes/audit-old.md +887 -0
- package/src/core/router/notes/audti.md +773 -0
- package/src/core/router/notes/tasks.md +473 -0
- package/src/core/router/{usage.md → notes/usage.md} +57 -35
- package/src/core/router/sync/tab.js +6 -4
- package/src/core/router/transitions.js +35 -8
- package/src/core/router/trie.js +130 -0
- package/src/core/security/{usage.md → notes/usage.md} +1 -2
- package/src/core/storage/{usage.md → notes/usage.md} +6 -6
- package/src/core/theme/index.js +78 -0
- package/src/core/ui/define/index.js +2 -1
- package/src/core/ui/define/orchestrator.js +10 -4
- package/src/core/ui/defs/dock.js +134 -0
- package/src/core/ui/defs/index.js +20 -0
- package/src/core/ui/defs/page.js +89 -0
- package/src/core/ui/defs/part.js +28 -0
- package/src/core/ui/defs/spec.js +96 -0
- package/src/core/ui/defs/view.js +23 -0
- package/src/core/ui/index.js +16 -3
- package/src/core/ui/notes/definations.md +979 -0
- package/src/tokens/index.css +1 -0
- package/src/tokens/semantic/contrast.css +18 -0
- package/src/tokens/semantic/transitions.css +32 -0
- package/types/core/platform/index.d.ts +39 -10
- package/types/core/router/index.d.ts +9 -0
- package/types/core/theme/index.d.ts +18 -0
- package/types/core/ui/index.d.ts +11 -0
- package/types/index.d.ts +1 -0
- package/bin/anza.js +0 -63
- package/bin/create.js +0 -150
- package/src/core/api/plan.md +0 -209
- package/src/core/events/missing.md +0 -103
- package/src/core/events/plan.md +0 -177
- package/src/core/offline/missing.md +0 -89
- package/src/core/offline/plan.md +0 -143
- package/src/core/platform/missing.md +0 -119
- package/src/core/platform/platform.d.ts +0 -88
- package/src/core/router/missing.md +0 -716
- package/src/core/router/outlet.js +0 -139
- package/src/core/router/plan.md +0 -370
- package/src/core/security/missing.md +0 -97
- package/src/core/state/missing.md +0 -165
- package/src/core/storage/missing.md +0 -165
- package/src/core/storage/plan.md +0 -69
- package/src/core/ui/implementation.md +0 -170
- package/src/core/ui/plan.md +0 -510
- package/src/core/ui/ui.types.md +0 -890
- /package/src/core/animations/{usage.md → notes/usage.md} +0 -0
- /package/src/core/api/{usage.md → notes/usage.md} +0 -0
- /package/src/core/events/{usage.md → notes/usage.md} +0 -0
- /package/src/core/platform/{usage.md → notes/usage.md} +0 -0
- /package/src/core/state/{usage.md → notes/usage.md} +0 -0
- /package/src/core/ui/{usage.md → notes/usage.md} +0 -0
- /package/src/core/ui/{watch.md → notes/watch.md} +0 -0
- /package/src/core/workers/{plan.md → notes/plan.md} +0 -0
- /package/src/core/workers/{usage.md → notes/usage.md} +0 -0
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
# Native Router Missing Support
|
|
2
|
-
|
|
3
|
-
This document tracks remaining support and enhancement work for `src/core/router`. Implemented behavior belongs in `usage.md`; unsupported, untyped, or under-tested behavior belongs here until it is built and verified.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 0. Toolchain and Naming Rules
|
|
8
|
-
|
|
9
|
-
Heavy parsing, extraction, generation, and validation work belongs in `tools/`, not in browser runtime modules.
|
|
10
|
-
|
|
11
|
-
Current toolchain support:
|
|
12
|
-
|
|
13
|
-
```text
|
|
14
|
-
tools/src/extract/html.rs # HTML template scan
|
|
15
|
-
tools/src/extract/runner.rs # JS spec scan and type generation
|
|
16
|
-
tools/src/extract/routes.rs # declarative route manifest generation
|
|
17
|
-
tools/src/watcher/runner.rs # file watch, debounce, regenerate
|
|
18
|
-
tools/src/types/runner.rs # shared tool data types
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Current commands:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
anza scan --src src
|
|
25
|
-
anza scan --src src --watch
|
|
26
|
-
anza build --src src --dist dist
|
|
27
|
-
anza dev --src src --port 3000
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Current router toolchain support:
|
|
31
|
-
|
|
32
|
-
- `ui.element({ url, container })` specs are parsed.
|
|
33
|
-
- `routes.json` is emitted during `scan`, `build`, and `dev`.
|
|
34
|
-
- Duplicate route patterns warn.
|
|
35
|
-
- Route param names are extracted from `:param` path segments.
|
|
36
|
-
|
|
37
|
-
Naming rules for new support:
|
|
38
|
-
|
|
39
|
-
- Prefer one-word files: `routes.rs`, `match.js`, `history.js`, `sync.js`, `types.rs`.
|
|
40
|
-
- Prefer one-word generated files: `routes.json`, `routes.d.ts`, `types.d.ts`.
|
|
41
|
-
- Prefer one-word commands: `scan`, `build`, `dev`, `check`.
|
|
42
|
-
- Prefer one-word methods in context: `add`, `get`, `set`, `clear`, `reset`, `start`, `stop`, `active`, `match`.
|
|
43
|
-
- Avoid repeated scope: inside `router.guards`, use `clear`, not `clearGuards`; inside `router.links`, use `add`, not `registerConnection`.
|
|
44
|
-
- Keep route segments plural and one word: `/members`, `/loans`, `/causes`.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 1. Critical Runtime Gaps
|
|
49
|
-
|
|
50
|
-
### 1.1. Type declarations do not match runtime
|
|
51
|
-
|
|
52
|
-
Status: critical mismatch.
|
|
53
|
-
|
|
54
|
-
Files:
|
|
55
|
-
|
|
56
|
-
```text
|
|
57
|
-
types/core/router/index.d.ts
|
|
58
|
-
src/core/router/index.js
|
|
59
|
-
src/core/router/match.js
|
|
60
|
-
src/core/router/intercept.js
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Problem:
|
|
64
|
-
|
|
65
|
-
The type file still describes older APIs such as:
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
router.on(pathPattern, callback)
|
|
69
|
-
router.render(outletElement, content)
|
|
70
|
-
router.match(pathname): { params, callback } | null
|
|
71
|
-
renderOutlet(...)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The runtime exposes:
|
|
75
|
-
|
|
76
|
-
```javascript
|
|
77
|
-
router.register(pattern, handler, meta)
|
|
78
|
-
router.on('found' | 'notfound' | 'error', callback, signal)
|
|
79
|
-
router.match(url): Promise<{ route, tag, params, result } | null>
|
|
80
|
-
router.nav.to(url)
|
|
81
|
-
router.guards.add(fn)
|
|
82
|
-
router.miss.set(handler)
|
|
83
|
-
router.sync.start()
|
|
84
|
-
router.links.add(pattern, factory)
|
|
85
|
-
router.registerContainer(name, element)
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Expected support:
|
|
89
|
-
|
|
90
|
-
- Rewrite `types/core/router/index.d.ts` to match runtime.
|
|
91
|
-
- Include route record, match result, event payload, guard, transition controller, container, sync, and connection types.
|
|
92
|
-
- Remove `router.render` and `renderOutlet` types unless those functions are implemented.
|
|
93
|
-
- Add `tests/types/router-types.test.ts`.
|
|
94
|
-
- Add a one-word `check` script for `.ts` type tests.
|
|
95
|
-
|
|
96
|
-
### 1.2. Not-found handler emits an undefined `url`
|
|
97
|
-
|
|
98
|
-
Status: runtime bug.
|
|
99
|
-
|
|
100
|
-
File:
|
|
101
|
-
|
|
102
|
-
```text
|
|
103
|
-
src/core/router/intercept.js
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Problem:
|
|
107
|
-
|
|
108
|
-
Inside the intercepted navigation handler, the not-found branch emits and logs `url`, but that local variable is not defined in that scope.
|
|
109
|
-
|
|
110
|
-
Current shape:
|
|
111
|
-
|
|
112
|
-
```javascript
|
|
113
|
-
emit('notfound', { url });
|
|
114
|
-
console.error(`Route matching failed ... ${url}`);
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Expected support:
|
|
118
|
-
|
|
119
|
-
```javascript
|
|
120
|
-
const url = destination.url;
|
|
121
|
-
emit('notfound', { url });
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Tests:
|
|
125
|
-
|
|
126
|
-
- Intercepted unmatched navigation emits `notfound` with the destination URL.
|
|
127
|
-
- Default not-found logging does not throw.
|
|
128
|
-
|
|
129
|
-
### 1.3. Route handler function semantics are ambiguous
|
|
130
|
-
|
|
131
|
-
Status: design/runtime risk.
|
|
132
|
-
|
|
133
|
-
Files:
|
|
134
|
-
|
|
135
|
-
```text
|
|
136
|
-
src/core/router/match.js
|
|
137
|
-
src/core/router/intercept.js
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Problem:
|
|
141
|
-
|
|
142
|
-
`match()` treats every function handler as a lazy tag factory:
|
|
143
|
-
|
|
144
|
-
```javascript
|
|
145
|
-
if (typeof tag === 'function') {
|
|
146
|
-
tag = await tag();
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
`intercept.js` then treats function handlers with arguments as legacy callbacks:
|
|
151
|
-
|
|
152
|
-
```javascript
|
|
153
|
-
if (typeof routeMatch.route.handler === 'function' && routeMatch.route.handler.length > 0) {
|
|
154
|
-
await routeMatch.route.handler(routeMatch.params, event);
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
This can call callback handlers once with no args during matching and again with params during navigation.
|
|
159
|
-
|
|
160
|
-
Expected support:
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
router.register('/path', 'page-tag');
|
|
164
|
-
router.register('/path', { tag: 'page-tag' });
|
|
165
|
-
router.register('/path', { load: async () => 'page-tag' });
|
|
166
|
-
router.register('/path', { handler: async (params, event) => {} });
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Recommended path:
|
|
170
|
-
|
|
171
|
-
- Keep tag strings.
|
|
172
|
-
- Add object route records for lazy tags and callbacks.
|
|
173
|
-
- Deprecate bare function ambiguity.
|
|
174
|
-
- Add a `scan` warning when static ambiguous bare function route handlers can be detected.
|
|
175
|
-
|
|
176
|
-
Tests:
|
|
177
|
-
|
|
178
|
-
- Lazy tag factory is called once.
|
|
179
|
-
- Callback handler is not called during `match()`.
|
|
180
|
-
- Callback handler receives `(params, event)` only during intercepted navigation.
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## 2. Declarative Routing Enhancements
|
|
185
|
-
|
|
186
|
-
### 2.1. Route param casting for UI props
|
|
187
|
-
|
|
188
|
-
Status: enhancement.
|
|
189
|
-
|
|
190
|
-
Files:
|
|
191
|
-
|
|
192
|
-
```text
|
|
193
|
-
src/core/ui/define/orchestrator.js
|
|
194
|
-
src/core/router/match.js
|
|
195
|
-
tools/src/extract/routes.rs
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Current behavior:
|
|
199
|
-
|
|
200
|
-
Route params are assigned directly as strings:
|
|
201
|
-
|
|
202
|
-
```javascript
|
|
203
|
-
pageEl[key] = value;
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Expected support:
|
|
207
|
-
|
|
208
|
-
- `Number` props receive numbers.
|
|
209
|
-
- `Boolean` props receive booleans by convention.
|
|
210
|
-
- `String` props remain strings.
|
|
211
|
-
- Generated route data can include prop type hints when statically known.
|
|
212
|
-
- Runtime falls back to string params for dynamic routes.
|
|
213
|
-
|
|
214
|
-
### 2.2. Query string and hash params are not mapped
|
|
215
|
-
|
|
216
|
-
Status: enhancement.
|
|
217
|
-
|
|
218
|
-
Files:
|
|
219
|
-
|
|
220
|
-
```text
|
|
221
|
-
src/core/router/match.js
|
|
222
|
-
src/core/ui/define/orchestrator.js
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Current behavior:
|
|
226
|
-
|
|
227
|
-
Only pathname groups are exposed as `params`.
|
|
228
|
-
|
|
229
|
-
Expected support:
|
|
230
|
-
|
|
231
|
-
```javascript
|
|
232
|
-
{
|
|
233
|
-
params,
|
|
234
|
-
query,
|
|
235
|
-
hash,
|
|
236
|
-
url
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
Declarative UI route options:
|
|
241
|
-
|
|
242
|
-
```javascript
|
|
243
|
-
ui.element('page-search', {
|
|
244
|
-
url: '/search',
|
|
245
|
-
query: ['q', 'page']
|
|
246
|
-
});
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Naming:
|
|
250
|
-
|
|
251
|
-
- Use `query`, not `searchParams`.
|
|
252
|
-
- Use `hash`, not `fragment`.
|
|
253
|
-
|
|
254
|
-
### 2.3. No nested route outlet implementation
|
|
255
|
-
|
|
256
|
-
Status: planned but missing.
|
|
257
|
-
|
|
258
|
-
Files:
|
|
259
|
-
|
|
260
|
-
```text
|
|
261
|
-
src/core/router/plan.md
|
|
262
|
-
src/core/router/
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Expected support:
|
|
266
|
-
|
|
267
|
-
- Add `outlet.js`.
|
|
268
|
-
- Define `<route-outlet>`.
|
|
269
|
-
- Diff route chains to preserve parent layouts.
|
|
270
|
-
- Mount changed child segments only.
|
|
271
|
-
|
|
272
|
-
Naming:
|
|
273
|
-
|
|
274
|
-
- `outlet.js` is acceptable because the folder already provides router context.
|
|
275
|
-
- `<route-outlet>` is acceptable because custom element names require a hyphen.
|
|
276
|
-
|
|
277
|
-
### 2.4. Container selector/name semantics need tightening
|
|
278
|
-
|
|
279
|
-
Status: partial support.
|
|
280
|
-
|
|
281
|
-
Files:
|
|
282
|
-
|
|
283
|
-
```text
|
|
284
|
-
src/core/router/container.js
|
|
285
|
-
src/core/ui/define/container.js
|
|
286
|
-
src/core/ui/define/orchestrator.js
|
|
287
|
-
tools/src/extract/routes.rs
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
Current behavior:
|
|
291
|
-
|
|
292
|
-
- `ui.container` registers by `name` attribute or tag name.
|
|
293
|
-
- `getContainer(name)` also tries `document.querySelector(name)`.
|
|
294
|
-
- `ui.element({ container })` passes a string through route metadata.
|
|
295
|
-
|
|
296
|
-
Risk:
|
|
297
|
-
|
|
298
|
-
Strings such as `main`, `#main`, and `app-main` can mean registry keys or CSS selectors.
|
|
299
|
-
|
|
300
|
-
Expected support:
|
|
301
|
-
|
|
302
|
-
- Document and enforce one convention.
|
|
303
|
-
- Recommended: registered container names are plain names; CSS selectors start with `#`, `.`, `[`, or another clear selector marker.
|
|
304
|
-
- Add runtime warnings for ambiguous names.
|
|
305
|
-
- Add `scan` warnings for ambiguous declarative containers.
|
|
306
|
-
|
|
307
|
-
### 2.5. Container swap cancellation
|
|
308
|
-
|
|
309
|
-
Status: enhancement.
|
|
310
|
-
|
|
311
|
-
Files:
|
|
312
|
-
|
|
313
|
-
```text
|
|
314
|
-
src/core/ui/define/container.js
|
|
315
|
-
src/core/router/transitions.js
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
Need:
|
|
319
|
-
|
|
320
|
-
When users navigate rapidly, older swaps can finish after newer swaps.
|
|
321
|
-
|
|
322
|
-
Expected support:
|
|
323
|
-
|
|
324
|
-
- Track a per-container swap token.
|
|
325
|
-
- Ignore stale swap completions.
|
|
326
|
-
- Ensure latest route remains mounted.
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
## 3. Toolchain Enhancements
|
|
331
|
-
|
|
332
|
-
### 3.1. Route declarations are not generated
|
|
333
|
-
|
|
334
|
-
Status: enhancement.
|
|
335
|
-
|
|
336
|
-
Files:
|
|
337
|
-
|
|
338
|
-
```text
|
|
339
|
-
tools/src/extract/routes.rs
|
|
340
|
-
tools/src/extract/runner.rs
|
|
341
|
-
tools/src/types/runner.rs
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
Current support:
|
|
345
|
-
|
|
346
|
-
- `routes.json` is generated.
|
|
347
|
-
- Duplicate route patterns warn.
|
|
348
|
-
- Path params are listed in each route record.
|
|
349
|
-
|
|
350
|
-
Missing support:
|
|
351
|
-
|
|
352
|
-
- Generate `routes.d.ts`.
|
|
353
|
-
- Include route metadata types.
|
|
354
|
-
- Include UI prop type hints for route params.
|
|
355
|
-
- Warn for route segment naming violations.
|
|
356
|
-
- Warn for ambiguous declarative container names.
|
|
357
|
-
|
|
358
|
-
### 3.2. Generated route docs
|
|
359
|
-
|
|
360
|
-
Status: enhancement.
|
|
361
|
-
|
|
362
|
-
Files:
|
|
363
|
-
|
|
364
|
-
```text
|
|
365
|
-
src/core/router/usage.md
|
|
366
|
-
docs/core/router/index.md
|
|
367
|
-
tools/src/extract/routes.rs
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
Need:
|
|
371
|
-
|
|
372
|
-
Once `routes.json` is stable, docs can show generated route maps and param names.
|
|
373
|
-
|
|
374
|
-
Expected support:
|
|
375
|
-
|
|
376
|
-
- Keep generated file names short: `routes.json`, `routes.d.ts`.
|
|
377
|
-
- Do not introduce names like `router-routes.json`.
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
## 4. View Transition Enhancements
|
|
382
|
-
|
|
383
|
-
### 4.1. Router transitions wait for `finished`
|
|
384
|
-
|
|
385
|
-
Status: implementation differs from plan.
|
|
386
|
-
|
|
387
|
-
File:
|
|
388
|
-
|
|
389
|
-
```text
|
|
390
|
-
src/core/router/transitions.js
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
Current behavior:
|
|
394
|
-
|
|
395
|
-
The router awaits `transition.finished`.
|
|
396
|
-
|
|
397
|
-
Plan expectation:
|
|
398
|
-
|
|
399
|
-
Resolve route management on `transition.ready` to avoid blocking on long animations.
|
|
400
|
-
|
|
401
|
-
Expected support:
|
|
402
|
-
|
|
403
|
-
- Decide whether router should await `ready` or `finished`.
|
|
404
|
-
- If switching to `ready`, still clear shared element names on `finished`.
|
|
405
|
-
|
|
406
|
-
### 4.2. Transition event hooks are missing
|
|
407
|
-
|
|
408
|
-
Status: enhancement.
|
|
409
|
-
|
|
410
|
-
File:
|
|
411
|
-
|
|
412
|
-
```text
|
|
413
|
-
src/core/router/transitions.js
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
Expected support:
|
|
417
|
-
|
|
418
|
-
```javascript
|
|
419
|
-
router.on('transitionstart', handler);
|
|
420
|
-
router.on('transitionend', handler);
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Use cases:
|
|
424
|
-
|
|
425
|
-
- Progress UI.
|
|
426
|
-
- Analytics.
|
|
427
|
-
- Debugging slow transitions.
|
|
428
|
-
|
|
429
|
-
---
|
|
430
|
-
|
|
431
|
-
## 5. Event and Error Enhancements
|
|
432
|
-
|
|
433
|
-
### 5.1. Event set is minimal
|
|
434
|
-
|
|
435
|
-
Status: enhancement.
|
|
436
|
-
|
|
437
|
-
File:
|
|
438
|
-
|
|
439
|
-
```text
|
|
440
|
-
src/core/router/intercept.js
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
Current events:
|
|
444
|
-
|
|
445
|
-
```text
|
|
446
|
-
found
|
|
447
|
-
notfound
|
|
448
|
-
error
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
Useful additions:
|
|
452
|
-
|
|
453
|
-
```text
|
|
454
|
-
before
|
|
455
|
-
guard
|
|
456
|
-
redirect
|
|
457
|
-
start
|
|
458
|
-
success
|
|
459
|
-
finish
|
|
460
|
-
transitionstart
|
|
461
|
-
transitionend
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
Tests:
|
|
465
|
-
|
|
466
|
-
- Events fire in documented order.
|
|
467
|
-
- Redirect event includes from/to.
|
|
468
|
-
- Error event includes destination URL.
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
## 6. Security Enhancements
|
|
473
|
-
|
|
474
|
-
### 6.1. Param validation helpers
|
|
475
|
-
|
|
476
|
-
Status: enhancement.
|
|
477
|
-
|
|
478
|
-
Files:
|
|
479
|
-
|
|
480
|
-
```text
|
|
481
|
-
src/core/router/match.js
|
|
482
|
-
src/core/router/index.js
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
Need:
|
|
486
|
-
|
|
487
|
-
Route params are untrusted strings. Add optional validation or parsing utilities.
|
|
488
|
-
|
|
489
|
-
Example:
|
|
490
|
-
|
|
491
|
-
```javascript
|
|
492
|
-
router.register('/members/:member', 'page-member', {
|
|
493
|
-
params: {
|
|
494
|
-
member: /^\d+$/
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
Expected support:
|
|
500
|
-
|
|
501
|
-
- Invalid params produce notfound or error.
|
|
502
|
-
- Validation failure can redirect.
|
|
503
|
-
- Validation error payload includes the param name.
|
|
504
|
-
|
|
505
|
-
---
|
|
506
|
-
|
|
507
|
-
## 7. Documentation Enhancements
|
|
508
|
-
|
|
509
|
-
### 7.1. `docs/core/router/index.md` is stale
|
|
510
|
-
|
|
511
|
-
Status: stale docs.
|
|
512
|
-
|
|
513
|
-
File:
|
|
514
|
-
|
|
515
|
-
```text
|
|
516
|
-
docs/core/router/index.md
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
Problem:
|
|
520
|
-
|
|
521
|
-
The docs mention APIs that do not exist in runtime:
|
|
522
|
-
|
|
523
|
-
```javascript
|
|
524
|
-
router.on('/dashboard', ...)
|
|
525
|
-
router.render(...)
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
Expected support:
|
|
529
|
-
|
|
530
|
-
- Rewrite docs to match `src/core/router/usage.md`.
|
|
531
|
-
- Keep conceptual architecture separate from public API examples.
|
|
532
|
-
|
|
533
|
-
### 7.2. Older docs use `router.on(pattern, handler)`
|
|
534
|
-
|
|
535
|
-
Status: stale repo-wide docs.
|
|
536
|
-
|
|
537
|
-
Files:
|
|
538
|
-
|
|
539
|
-
```text
|
|
540
|
-
docs/plan.md
|
|
541
|
-
docs/library.md
|
|
542
|
-
docs/library2.md
|
|
543
|
-
docs/notes/20 - Internal API.md
|
|
544
|
-
usages/index.md
|
|
545
|
-
usages/server.md
|
|
546
|
-
README.md
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
Expected support:
|
|
550
|
-
|
|
551
|
-
- Update or explicitly mark old API as historical.
|
|
552
|
-
- Prefer `router.register(pattern, handler, meta)` for route registration.
|
|
553
|
-
- Reserve `router.on(type, callback)` for router events.
|
|
554
|
-
|
|
555
|
-
---
|
|
556
|
-
|
|
557
|
-
## 8. Test Coverage Gaps
|
|
558
|
-
|
|
559
|
-
### 8.1. Intercept tests are mostly simulated
|
|
560
|
-
|
|
561
|
-
Status: weak coverage.
|
|
562
|
-
|
|
563
|
-
File:
|
|
564
|
-
|
|
565
|
-
```text
|
|
566
|
-
tests/core/router/intercept.test.js
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
Needed coverage:
|
|
570
|
-
|
|
571
|
-
- Mock `window.navigation`.
|
|
572
|
-
- Verify `setup()` attaches one `navigate` listener.
|
|
573
|
-
- Verify `destroy()` removes listeners.
|
|
574
|
-
- Verify guard redirect calls `controller.redirect`.
|
|
575
|
-
- Verify Safari fallback uses replace navigation.
|
|
576
|
-
- Verify `found`, `notfound`, and `error` emit from actual handler flow.
|
|
577
|
-
- Verify strict container guard throws when required container is missing.
|
|
578
|
-
|
|
579
|
-
### 8.2. Declarative routing test manually mounts components
|
|
580
|
-
|
|
581
|
-
Status: weak coverage.
|
|
582
|
-
|
|
583
|
-
File:
|
|
584
|
-
|
|
585
|
-
```text
|
|
586
|
-
tests/core/router/declarative.test.js
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
Problem:
|
|
590
|
-
|
|
591
|
-
The test manually creates and inserts the page element instead of exercising the full UI orchestrator through emitted router events.
|
|
592
|
-
|
|
593
|
-
Expected support:
|
|
594
|
-
|
|
595
|
-
- Drive a real `found` event.
|
|
596
|
-
- Assert `ui.container` receives a route page.
|
|
597
|
-
- Assert same-tag params update the existing instance.
|
|
598
|
-
|
|
599
|
-
### 8.3. History wrapper tests are missing
|
|
600
|
-
|
|
601
|
-
Status: missing coverage.
|
|
602
|
-
|
|
603
|
-
File:
|
|
604
|
-
|
|
605
|
-
```text
|
|
606
|
-
tests/core/router/history.test.js
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
Needed coverage:
|
|
610
|
-
|
|
611
|
-
- `navigate`
|
|
612
|
-
- `replace`
|
|
613
|
-
- `back`
|
|
614
|
-
- `forward`
|
|
615
|
-
- `go`
|
|
616
|
-
- `current`
|
|
617
|
-
- `entries`
|
|
618
|
-
- `canBack`
|
|
619
|
-
- `canForward`
|
|
620
|
-
- no-window fallbacks
|
|
621
|
-
|
|
622
|
-
### 8.4. Container registry tests are missing
|
|
623
|
-
|
|
624
|
-
Status: missing coverage.
|
|
625
|
-
|
|
626
|
-
File:
|
|
627
|
-
|
|
628
|
-
```text
|
|
629
|
-
tests/core/router/container.test.js
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
Needed coverage:
|
|
633
|
-
|
|
634
|
-
- Register and retrieve.
|
|
635
|
-
- Duplicate singleton throws.
|
|
636
|
-
- Unregister only removes matching element.
|
|
637
|
-
- CSS selector fallback works.
|
|
638
|
-
- Invalid selector is ignored.
|
|
639
|
-
- `clearContainers` clears map and observer.
|
|
640
|
-
|
|
641
|
-
### 8.5. Sync and connection tests need grouped APIs
|
|
642
|
-
|
|
643
|
-
Status: partial coverage.
|
|
644
|
-
|
|
645
|
-
Files:
|
|
646
|
-
|
|
647
|
-
```text
|
|
648
|
-
tests/core/router/sync.test.js
|
|
649
|
-
src/core/router/sync/tab.js
|
|
650
|
-
src/core/router/sync/transport.js
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
Needed coverage:
|
|
654
|
-
|
|
655
|
-
- `router.sync.start()` is idempotent.
|
|
656
|
-
- `router.sync.stop()` removes handlers.
|
|
657
|
-
- `router.sync.active()` reports state.
|
|
658
|
-
- `router.sync.close()` closes the channel.
|
|
659
|
-
- `router.links.add()` returns a disposer.
|
|
660
|
-
- `router.links.remove()` closes one active connection.
|
|
661
|
-
- `router.links.clear()` closes all active connections.
|
|
662
|
-
|
|
663
|
-
### 8.6. Type tests are missing
|
|
664
|
-
|
|
665
|
-
Status: missing coverage.
|
|
666
|
-
|
|
667
|
-
Files:
|
|
668
|
-
|
|
669
|
-
```text
|
|
670
|
-
tests/types/router-types.test.ts
|
|
671
|
-
types/core/router/index.d.ts
|
|
672
|
-
routes.d.ts
|
|
673
|
-
```
|
|
674
|
-
|
|
675
|
-
Needed coverage:
|
|
676
|
-
|
|
677
|
-
- `router.register` handler/tag/meta shapes.
|
|
678
|
-
- `router.on` event payloads.
|
|
679
|
-
- `router.match` async result.
|
|
680
|
-
- `router.nav.to` chain.
|
|
681
|
-
- Guard and miss grouped APIs.
|
|
682
|
-
- Sync grouped APIs.
|
|
683
|
-
- Container APIs.
|
|
684
|
-
- Connection APIs.
|
|
685
|
-
- Generated route params from `routes.d.ts`.
|
|
686
|
-
- `npm run check` or equivalent one-word command runs the type tests.
|
|
687
|
-
|
|
688
|
-
---
|
|
689
|
-
|
|
690
|
-
## 9. Suggested Implementation Order
|
|
691
|
-
|
|
692
|
-
1. Fix the not-found `url` runtime bug.
|
|
693
|
-
2. Rewrite `types/core/router/index.d.ts`.
|
|
694
|
-
3. Add `check` tooling and router type tests.
|
|
695
|
-
4. Resolve route handler function ambiguity.
|
|
696
|
-
5. Generate `routes.d.ts`.
|
|
697
|
-
6. Add route segment and container validation to `scan`.
|
|
698
|
-
7. Add history and container tests.
|
|
699
|
-
8. Expand sync and connection tests for grouped APIs.
|
|
700
|
-
9. Add route param/query/hash support.
|
|
701
|
-
10. Decide whether transitions should await `ready` or `finished`.
|
|
702
|
-
11. Rewrite stale `docs/core/router/index.md`.
|
|
703
|
-
|
|
704
|
-
## 10. Done Criteria
|
|
705
|
-
|
|
706
|
-
This missing-support list is complete when:
|
|
707
|
-
|
|
708
|
-
- Router type declarations match runtime.
|
|
709
|
-
- The not-found path emits a valid URL.
|
|
710
|
-
- Public docs no longer mention missing APIs.
|
|
711
|
-
- Route handler semantics are explicit.
|
|
712
|
-
- Heavy route extraction, validation, and generation live in `tools/`.
|
|
713
|
-
- Generated route files use short names such as `routes.json` and `routes.d.ts`.
|
|
714
|
-
- Declarative UI routes are tested through the real orchestration path.
|
|
715
|
-
- History, container, sync, and connection APIs have focused tests.
|
|
716
|
-
- Query/hash/param casting enhancements are either implemented or clearly deferred.
|