You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/frontend/navi/docs/navigation.md
+52-11Lines changed: 52 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,23 @@
3
3
How to build navigation with `@jsenv/navi`: declaring routes, rendering them,
4
4
linking to them, and turning them into tabs.
5
5
6
+
-[The rule that decides everything else: the position belongs in the URL](#the-rule-that-decides-everything-else-the-position-belongs-in-the-url)
7
+
-[Declaring routes](#declaring-routes)
8
+
-[A section is allowed to be a route of its own](#a-section-is-allowed-to-be-a-route-of-its-own)
9
+
-[Which values a param accepts](#which-values-a-param-accepts)
10
+
-[An address that only sends elsewhere](#an-address-that-only-sends-elsewhere)
11
+
-[Search params](#search-params)
12
+
-[Rendering routes](#rendering-routes)
13
+
-[Loading data](#loading-data)
14
+
-[Links and tab rows](#links-and-tab-rows)
15
+
-[The back arrow: `navBack`](#the-back-arrow-navback)
16
+
-[Tabs that travel: `RouteTravel`](#tabs-that-travel-routetravel)
17
+
-[Where a navigation lands: the scroll](#where-a-navigation-lands-the-scroll)
18
+
-[Creating something, then editing it](#creating-something-then-editing-it)
19
+
-[Tabs that are not routes](#tabs-that-are-not-routes)
20
+
-[A `SlideContainer` in the URL: a position that is not a place one came from](#a-slidecontainer-in-the-url-a-position-that-is-not-a-place-one-came-from)
21
+
-[A state whose values ARE places: `history: "push"`](#a-state-whose-values-are-places-history-push)
22
+
6
23
## The rule that decides everything else: the position belongs in the URL
7
24
8
25
Where the user is — which section, which tab, which sub-page — is state. Put it
@@ -21,8 +38,10 @@ retrofitted later:
21
38
So the default shape of a tab row is routes: `<Nav>` + `<Link route>` +
22
39
`<RouteTravel>`. `SlideContainer` is the exception, not the starting point — see
23
40
[Tabs that are not routes](#tabs-that-are-not-routes) for the cases that
24
-
genuinely are one, and for the middle answer: a position READ from the URL and
25
-
restored on reload, without a route and without a history entry per step.
41
+
genuinely are one, and
42
+
[A `SlideContainer` in the URL](#a-slidecontainer-in-the-url-a-position-that-is-not-a-place-one-came-from)
43
+
for the middle answer: a position READ from the URL and restored on reload,
44
+
without a route and without a history entry per step.
26
45
27
46
## Declaring routes
28
47
@@ -609,7 +628,7 @@ page. It reads which slide is on screen from the container itself, and its bar
609
628
follows the slides, a finger dragging them included. `<Link slide>` has no href
610
629
and behaves like a button: this is not a link to anywhere.
611
630
612
-
### The middle answer: a position in the URL that is not a place one came from
631
+
### A `SlideContainer`in the URL: a position that is not a place one came from
613
632
614
633
"Should a link be able to open the app on this?" has a third answer, and a wizard
615
634
is exactly it: **yes for reading and for reloading, no for history.** The step one
@@ -625,12 +644,12 @@ URL that replaces rather than pushes ([Search params](#search-params)). Declare
625
644
the step as one, and hand its signal to the container:
626
645
627
646
```js
628
-
conststepSignal=stateSignal(undefined, {
647
+
conststepSignal=stateSignal("when", {
629
648
id:"step",
630
649
oneOf: ["when", "where", "who", "recap", "done"],
631
650
// the step qualifies THIS visit, not the screen: a link built to the editor
632
-
// does not inherit the step one happens to be on, and it goes back to nothing
633
-
// when the route stops matching
651
+
// does not inherit the step one happens to be on, and it goes back to the
| a control's value |`signal` (every control, every group) |[control_value.md](./control_value.md)|
116
+
| the area a `SlideContainer` is on |`signal` (a route's search param signal puts it in the URL) | its JSDoc, [navigation.md](./navigation.md#a-slidecontainer-in-the-url-a-position-that-is-not-a-place-one-came-from)|
117
+
| a popup being open |`signal`, `open`, `navState`|[popup_open.md](./popup_open.md)|
118
+
| where the user is | route + search-param signals |[navigation.md](./navigation.md)|
119
+
| a value proposed to a control |`command="--navi-update"`|[control_value.md](./control_value.md#a-button-that-proposes-a-value-is---navi-update)|
120
+
| the state of an async run | an `action`, read by `useAsyncData`|[actions.md](./actions.md)|
0 commit comments